@liberfi.io/ui-tokens 3.0.74 → 3.0.76
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {memo,useMemo,useState,useRef,useCallback,useEffect,useSyncExternalStore}from'react';import {List}from'react-window';import {StyledTooltip,HorsePowerHighIcon,HorsePowerLowIcon,HorsePowerIcon,cn,useCopyToClipboard,toast,CheckIcon,CopyIcon,Link,WebsiteIcon,TwitterIcon,TelegramIcon,DiscordIcon,SearchIcon,PeopleIcon,KlineCandlesIcon,StarIcon,UserWithStarBadgeIcon,CookIcon,SniperIcon,RatIcon,BundlesIcon,TriangleUpIcon,TriangleDownIcon,Avatar,CameraIcon,Image,PauseIcon,HorizontalScrollContainer,Button,TrashIcon,Chip,StyledInput,XCloseIcon,Kbd,Spinner,EmptyIcon,useScreen,StyledModal,ModalContent,ModalHeader,ModalBody,useDisclosure,FilterIcon,ScrollShadow,ModalFooter,RefreshIcon,StyledPlainTabs,Tab,ChevronDownIcon,TableColumn,Sortable,StyledTable,TableHeader,TableBody,CrownIcon,ShiningStarIcon,TableRow,Skeleton,Progress,StyledLightTabs,StyledBadge,TableCell,StyledNumberInput}from'@liberfi.io/ui';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useTickAge,useResizeObserver,useCallbackRef}from'@liberfi.io/hooks';import {useTranslation}from'@liberfi.io/i18n';import {formatMCapInUsd,SafeBigNumber,formatPercent,formatAge,searchTwitterUrl,formatAmount,formatAmountInUsd,formatPriceInUsd,parseTokenProtocolFamily,searchImageUrl,formatPrice,formatTokenProtocolName}from'@liberfi.io/utils';export{formatAmount}from'@liberfi.io/utils';import {SolanaTokenProtocol,Chain}from'@liberfi.io/types';import {useNewPoolsQuery,useNewPoolsSubscription,useNewTokensMetadataSubscription,useMigratedTokensQuery,useFinalStretchTokensQuery,useSearchTokensInfiniteQuery,useTrendingTokensQuery,useTrendingTokensSubscription,useTokenHoldersQuery,useTokenSubscription,useTokenActivitiesQuery,useTokenActivitiesSubscription,useTokenSecurityQuery,useTokenStatsQuery,useWalletTokenPositionsQuery,useWalletLimitOrdersQuery,useTokenTopTradersQuery,useTokensByCreatorQuery,useSearchTokensQuery,useStockTokensQuery,useStockTokensSubscription,useTokensQuery,useTokenMarketRuntime,tokenMarketKey,useTokenMarket}from'@liberfi.io/react';import {AsyncModal,useAsyncModal,StatsFlipPanel}from'@liberfi.io/ui-scaffold';import {createBrowserSearchHistoryStorage,createMemorySearchHistoryStorage,useSearchKeyboardNavigation,useSearchController}from'@liberfi.io/ui/search';import {useInfiniteLoader}from'react-window-infinite-loader';import {createRealtimeCursorCollection}from'@liberfi.io/utils/realtime-cursor-collection';function Dr({title:e,isPaused:t,extra:o,className:r}){return jsxs("div",{className:cn("w-full h-12 px-3 flex-none bg-[#0a0a0b] flex items-center justify-between gap-4 border-b border-[rgba(39,39,42,0.6)]",r),children:[jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[jsx("h2",{className:"min-w-0 truncate font-semibold",children:e}),t&&jsx("div",{className:"flex flex-none items-center gap-1 text-primary",children:jsx(PauseIcon,{className:"w-4 h-4"})})]}),o&&jsx("div",{className:"flex min-w-0 items-center gap-3",children:o})]})}function Do({isLast:e=false,className:t}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse",t),style:{borderBottom:e?"none":"1px solid rgba(39,39,42,0.6)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-sm bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("div",{className:"w-16 h-4 rounded bg-content2"})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsx("div",{className:"w-10 h-2.5 rounded bg-content2"})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-4",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}function $({icon:e,value:t,tooltip:o,warning:r,disable:s=false,className:n,tooltipPlacement:i="top"}){return jsx(StyledTooltip,{content:o,placement:i,children:jsxs("div",{className:cn("shrink-0 px-2 py-0.5 flex items-center gap-1 rounded-full text-xs border border-border/60",r?"text-danger-500":s?"text-neutral":"text-primary",n),children:[e,jsx("span",{children:t})]})})}var Oo={kol:{label:"KOL",bgClass:"bg-yellow-500/15",textClass:"text-yellow-400"},smart:{label:"Smart",bgClass:"bg-sky-500/15",textClass:"text-sky-400"},sniper:{label:"Sniper",bgClass:"bg-red-500/15",textClass:"text-red-400"},dev:{label:"Dev",bgClass:"bg-orange-500/15",textClass:"text-orange-400"},bundle:{label:"Bundle",bgClass:"bg-purple-500/15",textClass:"text-purple-400"},bluechip:{label:"Bluechip",bgClass:"bg-emerald-500/15",textClass:"text-emerald-400"},insider:{label:"Insider",bgClass:"bg-fuchsia-500/15",textClass:"text-fuchsia-400"},fresh:{label:"Fresh",bgClass:"bg-teal-500/15",textClass:"text-teal-400"}};function Bl({tag:e,className:t}){let o=Oo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Wr({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(Bl,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}function El({tag:e,className:t}){let o=Oo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-default-500"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Et({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let r=o!=null&&o>0?e.slice(0,o):e,s=e.length-r.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[r.map(n=>jsx(El,{tag:n},n)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-default-500",children:["+",s]})]})}var Wl={[SolanaTokenProtocol.BAGS]:{text:"text-bags",bg:"bg-bags",bg5:"bg-bags/5",bg20:"bg-bags/20",border:"border-bags"},[SolanaTokenProtocol.BELIEVE]:{text:"text-believe",bg:"bg-believe",bg5:"bg-believe/5",bg20:"bg-believe/20",border:"border-believe"},[SolanaTokenProtocol.BONK]:{text:"text-bonk",bg:"bg-bonk",bg5:"bg-bonk/5",bg20:"bg-bonk/20",border:"border-bonk"},[SolanaTokenProtocol.BOOP]:{text:"text-boop",bg:"bg-boop",bg5:"bg-boop/5",bg20:"bg-boop/20",border:"border-boop"},[SolanaTokenProtocol.HEAVEN]:{text:"text-heaven",bg:"bg-heaven",bg5:"bg-heaven/5",bg20:"bg-heaven/20",border:"border-heaven"},[SolanaTokenProtocol.JUPSTUDIO]:{text:"text-jupstudio",bg:"bg-jupstudio",bg5:"bg-jupstudio/5",bg20:"bg-jupstudio/20",border:"border-jupstudio"},[SolanaTokenProtocol.LAUNCHLAB]:{text:"text-launchlab",bg:"bg-launchlab",bg5:"bg-launchlab/5",bg20:"bg-launchlab/20",border:"border-launchlab"},[SolanaTokenProtocol.METEORA]:{text:"text-meteora",bg:"bg-meteora",bg5:"bg-meteora/5",bg20:"bg-meteora/20",border:"border-meteora"},[SolanaTokenProtocol.MOONIT]:{text:"text-moonit",bg:"bg-moonit",bg5:"bg-moonit/5",bg20:"bg-moonit/20",border:"border-moonit"},[SolanaTokenProtocol.MOONSHOT]:{text:"text-moonshot",bg:"bg-moonshot",bg5:"bg-moonshot/5",bg20:"bg-moonshot/20",border:"border-moonshot"},[SolanaTokenProtocol.ORCA]:{text:"text-orca",bg:"bg-orca",bg5:"bg-orca/5",bg20:"bg-orca/20",border:"border-orca"},[SolanaTokenProtocol.PUMP]:{text:"text-pump",bg:"bg-pump",bg5:"bg-pump/5",bg20:"bg-pump/20",border:"border-pump"},[SolanaTokenProtocol.RAYDIUM]:{text:"text-raydium",bg:"bg-raydium",bg5:"bg-raydium/5",bg20:"bg-raydium/20",border:"border-raydium"},[SolanaTokenProtocol.SUGAR]:{text:"text-sugar",bg:"bg-sugar",bg5:"bg-sugar/5",bg20:"bg-sugar/20",border:"border-sugar"},[SolanaTokenProtocol.VIRTUAL_CURVE]:{text:"text-virtual-curve",bg:"bg-virtual-curve",bg5:"bg-virtual-curve/5",bg20:"bg-virtual-curve/20",border:"border-virtual-curve"},[SolanaTokenProtocol.PUMP_AMM]:{text:"text-pump-amm",bg:"bg-pump-amm",bg5:"bg-pump-amm/5",bg20:"bg-pump-amm/20",border:"border-pump-amm"}},Vl={text:"text-neutral",bg:"bg-neutral",bg5:"bg-neutral/5",bg20:"bg-neutral/20",border:"border-neutral"};function Oe(e){return Wl[e]??Vl}function xe({token:e,enablePreview:t=true,enableSearch:o=true,showProgress:r=true,showProtocolFamily:s=true,radius:n="sm",className:i,classNames:l}){let a=useMemo(()=>e.launchedFrom?.protocolFamily?parseTokenProtocolFamily(e.chain,e.launchedFrom.protocolFamily):void 0,[e.chain,e.launchedFrom?.protocolFamily]),d=useMemo(()=>s&&a,[s,a]),m=useMemo(()=>r&&e.migrateProgress&&new SafeBigNumber(e.migrateProgress).lt(100),[r,e.migrateProgress]),c=useMemo(()=>o&&e.image,[o,e.image]),u=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[p,f]=useState(false),k=useCallback(()=>{f(true);},[]),g=useCallback(()=>{f(false);},[]),h=useCallback(x=>{if(x.stopPropagation(),!e.image)return;let y=searchImageUrl(e.image);window.open(y,"_blank");},[e.image]);return jsxs("div",{className:cn("relative justify-center items-center",i??"w-15 h-15"),children:[!m&&jsx("div",{className:cn("absolute inset-0",`rounded-${n}`,a?Oe(a).bg:"bg-[rgba(39,39,42,0.6)]",l?.background)}),m&&jsx("div",{className:cn("absolute -inset-0.5",`rounded-${n}`),children:jsx(Ql,{className:cn(a?Oe(a).text:"text-[rgba(39,39,42,0.6)]",l?.progress),progress:e.migrateProgress??"0"})}),jsx("div",{className:cn("absolute inset-0 p-px flex items-center justify-center",`rounded-${n}`,a?Oe(a).bg20:"bg-[rgba(39,39,42,0.12)]",l?.avatarWrapper),children:jsx($l,{token:e,radius:n,enableSearch:o,enablePreview:t,classNames:l,children:jsxs("div",{className:cn("relative w-full h-full bg-content1 flex items-center justify-center p-0.5",`rounded-${n}`,p&&c&&"cursor-pointer"),onMouseEnter:k,onMouseLeave:g,children:[jsx(Avatar,{showFallback:true,src:e.image,name:u,className:cn("w-full h-full bg-content1 text-neutral text-2xl",`rounded-${n}`,l?.avatar)}),p&&c&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${n}`,l?.searchWrapper),onClick:h,children:jsx(CameraIcon,{className:cn("w-6 h-6",l?.searchIcon)})})]})})}),d&&jsx("div",{className:"contents",children:jsx(StyledTooltip,{content:e.launchedFrom?.protocolFamily??a,placement:"bottom",children:jsx("div",{className:cn("absolute -bottom-1 -right-1 rounded-full p-px w-4 h-4",a&&Oe(a).bg,l?.protocolFamilyIconWrapper),children:jsx(Image,{removeWrapper:true,src:`/images/protocols/${a}.svg`,className:cn("w-full h-full rounded-full bg-content1",l?.protocolFamilyIcon)})})})})]})}function $l({token:e,radius:t,enableSearch:o,enablePreview:r,classNames:s,children:n}){return useMemo(()=>r&&e.image,[r,e.image])?jsx(StyledTooltip,{content:jsx(zl,{token:e,radius:t,enableSearch:o,classNames:s}),closeDelay:100,placement:"bottom-start",classNames:{content:"p-1"},children:n}):n}function zl({token:e,enableSearch:t,radius:o,classNames:r}){let s=useMemo(()=>t&&e.image,[t,e.image]),n=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[i,l]=useState(false),a=useCallback(()=>{l(true);},[]),d=useCallback(()=>{l(false);},[]),m=useCallback(c=>{if(c.stopPropagation(),!e.image)return;let u=searchImageUrl(e.image);window.open(u,"_blank");},[e.image]);return jsxs("div",{className:cn("relative flex items-center justify-center w-60 h-60",`rounded-${o}`,i&&s&&"cursor-pointer",r?.previewWrapper),onMouseEnter:a,onMouseLeave:d,children:[jsx(Avatar,{showFallback:true,src:e.image,name:n,className:cn("w-full h-full bg-content1 text-neutral text-3xl",`rounded-${o}`,r?.previewAvatar)}),i&&s&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${o}`,r?.previewSearchWrapper),onClick:m,children:jsx(CameraIcon,{className:cn("w-10 h-10",r?.previewSearchIcon)})})]})}function Ql({progress:e,className:t}){let o=useMemo(()=>296-Number(e)*296/100,[e]);return jsxs("svg",{viewBox:"0 0 78 78",className:"w-full h-full",children:[jsx("path",{className:`${t} opacity-40`,stroke:"currentColor",fill:"transparent",strokeWidth:"1",d:`
|
|
1
|
+
import {memo,useMemo,useState,useRef,useCallback,useEffect,useSyncExternalStore}from'react';import {List}from'react-window';import {StyledTooltip,HorsePowerHighIcon,HorsePowerLowIcon,HorsePowerIcon,cn,useCopyToClipboard,toast,CheckIcon,CopyIcon,Link,WebsiteIcon,TwitterIcon,TelegramIcon,DiscordIcon,SearchIcon,PeopleIcon,KlineCandlesIcon,StarIcon,UserWithStarBadgeIcon,CookIcon,SniperIcon,RatIcon,BundlesIcon,TriangleUpIcon,TriangleDownIcon,Avatar,CameraIcon,Image,PauseIcon,HorizontalScrollContainer,Button,TrashIcon,Chip,StyledInput,XCloseIcon,Kbd,Spinner,EmptyIcon,useScreen,StyledModal,ModalContent,ModalHeader,ModalBody,useDisclosure,FilterIcon,ScrollShadow,ModalFooter,RefreshIcon,StyledPlainTabs,Tab,ChevronDownIcon,TableColumn,Sortable,StyledTable,TableHeader,TableBody,CrownIcon,ShiningStarIcon,TableRow,Skeleton,Progress,StyledLightTabs,StyledBadge,TableCell,StyledNumberInput}from'@liberfi.io/ui';import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useTickAge,useResizeObserver,useCallbackRef}from'@liberfi.io/hooks';import {useTranslation}from'@liberfi.io/i18n';import {formatMCapInUsd,SafeBigNumber,formatPercent,formatAge,searchTwitterUrl,formatAmount,formatAmountInUsd,formatPriceInUsd,parseTokenProtocolFamily,searchImageUrl,formatPrice,formatTokenProtocolName}from'@liberfi.io/utils';export{formatAmount}from'@liberfi.io/utils';import {SolanaTokenProtocol,Chain}from'@liberfi.io/types';import {useNewPoolsQuery,useNewPoolsSubscription,useNewTokensMetadataSubscription,useMigratedTokensQuery,useFinalStretchTokensQuery,useSearchTokensInfiniteQuery,useTrendingTokensQuery,useTrendingTokensSubscription,useTokenHoldersQuery,useTokenSubscription,useTokenActivitiesQuery,useTokenActivitiesSubscription,useTokenSecurityQuery,useTokenStatsQuery,useWalletTokenPositionsQuery,useWalletLimitOrdersQuery,useTokenTopTradersQuery,useTokensByCreatorQuery,useSearchTokensQuery,useStockTokensQuery,useStockTokensSubscription,useTokensQuery,useTokenMarketRuntime,tokenMarketKey,useTokenMarket}from'@liberfi.io/react';import {AsyncModal,useAsyncModal,StatsFlipPanel}from'@liberfi.io/ui-scaffold';import {createBrowserSearchHistoryStorage,createMemorySearchHistoryStorage,useSearchKeyboardNavigation,useSearchController}from'@liberfi.io/ui/search';import {useInfiniteLoader}from'react-window-infinite-loader';import {createRealtimeCursorCollection}from'@liberfi.io/utils/realtime-cursor-collection';function Bn({title:e,isPaused:t,extra:o,className:n}){return jsxs("div",{className:cn("w-full h-12 px-3 flex-none bg-surface-base flex items-center justify-between gap-4 border-b border-border-subtle/60",n),children:[jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[jsx("h2",{className:"min-w-0 truncate font-semibold",children:e}),t&&jsx("div",{className:"flex flex-none items-center gap-1 text-primary",children:jsx(PauseIcon,{className:"w-4 h-4"})})]}),o&&jsx("div",{className:"flex min-w-0 items-center gap-3",children:o})]})}function Uo({isLast:e=false,className:t}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse",t),style:{borderBottom:e?"none":"1px solid var(--color-border-subtle)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-sm bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("div",{className:"w-16 h-4 rounded bg-content2"})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsx("div",{className:"w-10 h-2.5 rounded bg-content2"})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-4",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}function $({icon:e,value:t,tooltip:o,warning:n,disable:s=false,className:r,tooltipPlacement:i="top"}){return jsx(StyledTooltip,{content:o,placement:i,children:jsxs("div",{className:cn("shrink-0 px-2 py-0.5 flex items-center gap-1 rounded-full text-xs border border-border/60",n?"text-danger-500":s?"text-text-muted":"text-primary",r),children:[e,jsx("span",{children:t})]})})}var Oo={kol:{label:"KOL",labelKey:"common.walletTag.kol",bgClass:"bg-warning/15",textClass:"text-warning"},smart:{label:"Smart",labelKey:"common.walletTag.smart",bgClass:"bg-sky-500/15",textClass:"text-sky-400"},sniper:{label:"Sniper",labelKey:"common.walletTag.sniper",bgClass:"bg-danger/15",textClass:"text-danger"},dev:{label:"Dev",labelKey:"common.walletTag.dev",bgClass:"bg-negative/15",textClass:"text-negative"},bundle:{label:"Bundle",labelKey:"common.walletTag.bundle",bgClass:"bg-purple-500/15",textClass:"text-purple-400"},bluechip:{label:"Bluechip",labelKey:"common.walletTag.bluechip",bgClass:"bg-success/15",textClass:"text-success"},insider:{label:"Insider",labelKey:"common.walletTag.insider",bgClass:"bg-fuchsia-500/15",textClass:"text-fuchsia-400"},fresh:{label:"Fresh",labelKey:"common.walletTag.fresh",bgClass:"bg-teal-500/15",textClass:"text-teal-400"}};function Wl({tag:e,className:t}){let{t:o}=useTranslation(),n=Oo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-text-muted"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",n.bgClass,n.textClass,t),children:n.labelKey?o(n.labelKey):n.label})}function Kn({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let n=o!=null&&o>0?e.slice(0,o):e,s=e.length-n.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[n.map(r=>jsx(Wl,{tag:r},r)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",children:["+",s]})]})}function Vl({tag:e,className:t}){let o=Oo[e]??{label:e,bgClass:"bg-default/20",textClass:"text-text-muted"};return jsx("span",{className:cn("inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide",o.bgClass,o.textClass,t),children:o.label})}function Et({tags:e,className:t,max:o}){if(!e||e.length===0)return null;let n=o!=null&&o>0?e.slice(0,o):e,s=e.length-n.length;return jsxs("div",{className:cn("flex flex-wrap items-center gap-1",t),children:[n.map(r=>jsx(Vl,{tag:r},r)),s>0&&jsxs("span",{className:"inline-flex items-center rounded bg-default/20 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",children:["+",s]})]})}var Kl={[SolanaTokenProtocol.BAGS]:{text:"text-bags",bg:"bg-bags",bg5:"bg-bags/5",bg20:"bg-bags/20",border:"border-bags"},[SolanaTokenProtocol.BELIEVE]:{text:"text-believe",bg:"bg-believe",bg5:"bg-believe/5",bg20:"bg-believe/20",border:"border-believe"},[SolanaTokenProtocol.BONK]:{text:"text-bonk",bg:"bg-bonk",bg5:"bg-bonk/5",bg20:"bg-bonk/20",border:"border-bonk"},[SolanaTokenProtocol.BOOP]:{text:"text-boop",bg:"bg-boop",bg5:"bg-boop/5",bg20:"bg-boop/20",border:"border-boop"},[SolanaTokenProtocol.HEAVEN]:{text:"text-heaven",bg:"bg-heaven",bg5:"bg-heaven/5",bg20:"bg-heaven/20",border:"border-heaven"},[SolanaTokenProtocol.JUPSTUDIO]:{text:"text-jupstudio",bg:"bg-jupstudio",bg5:"bg-jupstudio/5",bg20:"bg-jupstudio/20",border:"border-jupstudio"},[SolanaTokenProtocol.LAUNCHLAB]:{text:"text-launchlab",bg:"bg-launchlab",bg5:"bg-launchlab/5",bg20:"bg-launchlab/20",border:"border-launchlab"},[SolanaTokenProtocol.METEORA]:{text:"text-meteora",bg:"bg-meteora",bg5:"bg-meteora/5",bg20:"bg-meteora/20",border:"border-meteora"},[SolanaTokenProtocol.MOONIT]:{text:"text-moonit",bg:"bg-moonit",bg5:"bg-moonit/5",bg20:"bg-moonit/20",border:"border-moonit"},[SolanaTokenProtocol.MOONSHOT]:{text:"text-moonshot",bg:"bg-moonshot",bg5:"bg-moonshot/5",bg20:"bg-moonshot/20",border:"border-moonshot"},[SolanaTokenProtocol.ORCA]:{text:"text-orca",bg:"bg-orca",bg5:"bg-orca/5",bg20:"bg-orca/20",border:"border-orca"},[SolanaTokenProtocol.PUMP]:{text:"text-pump",bg:"bg-pump",bg5:"bg-pump/5",bg20:"bg-pump/20",border:"border-pump"},[SolanaTokenProtocol.RAYDIUM]:{text:"text-raydium",bg:"bg-raydium",bg5:"bg-raydium/5",bg20:"bg-raydium/20",border:"border-raydium"},[SolanaTokenProtocol.SUGAR]:{text:"text-sugar",bg:"bg-sugar",bg5:"bg-sugar/5",bg20:"bg-sugar/20",border:"border-sugar"},[SolanaTokenProtocol.VIRTUAL_CURVE]:{text:"text-virtual-curve",bg:"bg-virtual-curve",bg5:"bg-virtual-curve/5",bg20:"bg-virtual-curve/20",border:"border-virtual-curve"},[SolanaTokenProtocol.PUMP_AMM]:{text:"text-pump-amm",bg:"bg-pump-amm",bg5:"bg-pump-amm/5",bg20:"bg-pump-amm/20",border:"border-pump-amm"}},_l={text:"text-text-muted",bg:"bg-text-muted",bg5:"bg-text-muted/5",bg20:"bg-text-muted/20",border:"border-border-control"};function Be(e){return Kl[e]??_l}function ke({token:e,enablePreview:t=true,enableSearch:o=true,showProgress:n=true,showProtocolFamily:s=true,radius:r="sm",className:i,classNames:l}){let a=useMemo(()=>e.launchedFrom?.protocolFamily?parseTokenProtocolFamily(e.chain,e.launchedFrom.protocolFamily):void 0,[e.chain,e.launchedFrom?.protocolFamily]),d=useMemo(()=>s&&a,[s,a]),m=useMemo(()=>n&&e.migrateProgress&&new SafeBigNumber(e.migrateProgress).lt(100),[n,e.migrateProgress]),c=useMemo(()=>o&&e.image,[o,e.image]),u=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[p,x]=useState(false),f=useCallback(()=>{x(true);},[]),g=useCallback(()=>{x(false);},[]),h=useCallback(k=>{if(k.stopPropagation(),!e.image)return;let T=searchImageUrl(e.image);window.open(T,"_blank");},[e.image]);return jsxs("div",{className:cn("relative justify-center items-center",i??"w-15 h-15"),children:[!m&&jsx("div",{className:cn("absolute inset-0",`rounded-${r}`,a?Be(a).bg:"bg-surface-strong/60",l?.background)}),m&&jsx("div",{className:cn("absolute -inset-0.5",`rounded-${r}`),children:jsx(Xl,{className:cn(a?Be(a).text:"text-surface-strong/60",l?.progress),progress:e.migrateProgress??"0"})}),jsx("div",{className:cn("absolute inset-0 p-px flex items-center justify-center",`rounded-${r}`,a?Be(a).bg20:"bg-surface-strong/12",l?.avatarWrapper),children:jsx(Ql,{token:e,radius:r,enableSearch:o,enablePreview:t,classNames:l,children:jsxs("div",{className:cn("relative w-full h-full bg-content1 flex items-center justify-center p-0.5",`rounded-${r}`,p&&c&&"cursor-pointer"),onMouseEnter:f,onMouseLeave:g,children:[jsx(Avatar,{showFallback:true,src:e.image,name:u,className:cn("w-full h-full bg-content1 text-text-muted text-2xl",`rounded-${r}`,l?.avatar)}),p&&c&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${r}`,l?.searchWrapper),onClick:h,children:jsx(CameraIcon,{className:cn("w-6 h-6",l?.searchIcon)})})]})})}),d&&jsx("div",{className:"contents",children:jsx(StyledTooltip,{content:e.launchedFrom?.protocolFamily??a,placement:"bottom",children:jsx("div",{className:cn("absolute -bottom-1 -right-1 rounded-full p-px w-4 h-4",a&&Be(a).bg,l?.protocolFamilyIconWrapper),children:jsx(Image,{removeWrapper:true,src:`/images/protocols/${a}.svg`,className:cn("w-full h-full rounded-full bg-content1",l?.protocolFamilyIcon)})})})})]})}function Ql({token:e,radius:t,enableSearch:o,enablePreview:n,classNames:s,children:r}){return useMemo(()=>n&&e.image,[n,e.image])?jsx(StyledTooltip,{content:jsx(Gl,{token:e,radius:t,enableSearch:o,classNames:s}),closeDelay:100,placement:"bottom-start",classNames:{content:"p-1"},children:r}):r}function Gl({token:e,enableSearch:t,radius:o,classNames:n}){let s=useMemo(()=>t&&e.image,[t,e.image]),r=useMemo(()=>(e.symbol??e.name??e.address??"L").slice(0,1).toUpperCase(),[e.symbol,e.name,e.address]),[i,l]=useState(false),a=useCallback(()=>{l(true);},[]),d=useCallback(()=>{l(false);},[]),m=useCallback(c=>{if(c.stopPropagation(),!e.image)return;let u=searchImageUrl(e.image);window.open(u,"_blank");},[e.image]);return jsxs("div",{className:cn("relative flex items-center justify-center w-60 h-60",`rounded-${o}`,i&&s&&"cursor-pointer",n?.previewWrapper),onMouseEnter:a,onMouseLeave:d,children:[jsx(Avatar,{showFallback:true,src:e.image,name:r,className:cn("w-full h-full bg-content1 text-text-muted text-3xl",`rounded-${o}`,n?.previewAvatar)}),i&&s&&jsx("div",{className:cn("absolute inset-0 bg-content1/80 flex items-center justify-center",`rounded-${o}`,n?.previewSearchWrapper),onClick:m,children:jsx(CameraIcon,{className:cn("w-10 h-10",n?.previewSearchIcon)})})]})}function Xl({progress:e,className:t}){let o=useMemo(()=>296-Number(e)*296/100,[e]);return jsxs("svg",{viewBox:"0 0 78 78",className:"w-full h-full",children:[jsx("path",{className:`${t} opacity-40`,stroke:"currentColor",fill:"transparent",strokeWidth:"1",d:`
|
|
2
2
|
M 76 76
|
|
3
3
|
L 6 76
|
|
4
4
|
Q 2 76 2 72
|
|
@@ -18,7 +18,7 @@ import {memo,useMemo,useState,useRef,useCallback,useEffect,useSyncExternalStore}
|
|
|
18
18
|
Q 76 2 76 6
|
|
19
19
|
L 76 72
|
|
20
20
|
Q 76 76 76 76
|
|
21
|
-
`})]})}function Zr({token:e,renderAction:t,isLast:o=false,onSelectToken:r,className:s}){let{t:n}=useTranslation(),i=useCopyToClipboard(),l=useTickAge(e.createdAt),a=e.marketData,d=e.stats?.["1h"],m=useCallback(()=>{r?.(e);},[r,e]),c=useCallback(E=>{E.stopPropagation(),i(e.address,()=>toast.success(n("tokens.copied.address")));},[i,e.address,n]),u=useMemo(()=>d?.volumesInUsd,[d?.volumesInUsd]),p=useMemo(()=>d?.buyVolumesInUsd,[d?.buyVolumesInUsd]),f=useMemo(()=>d?.sellVolumesInUsd,[d?.sellVolumesInUsd]),k=useMemo(()=>d?.trades,[d?.trades]),g=useMemo(()=>a?.marketCapInUsd,[a?.marketCapInUsd]),h=useMemo(()=>a?.tvlInUsd,[a?.tvlInUsd]),x=useMemo(()=>{let E=new SafeBigNumber(g);return E.lt(1e3)?"text-foreground":E.lt(1e6)?"text-secondary":"text-primary"},[g]),y=useMemo(()=>new SafeBigNumber(a?.top10HoldingsRatio).gte(.1),[a?.top10HoldingsRatio]),b=useMemo(()=>new SafeBigNumber(a?.devHoldingsRatio).gte(.1),[a?.devHoldingsRatio]),v=useMemo(()=>new SafeBigNumber(a?.insiderHoldingsRatio).gte(.1),[a?.insiderHoldingsRatio]),T=useMemo(()=>new SafeBigNumber(a?.sniperHoldingsRatio).gte(.1),[a?.sniperHoldingsRatio]),L=useMemo(()=>new SafeBigNumber(a?.bundleHoldingsRatio).gte(.1),[a?.bundleHoldingsRatio]),A=a?.holders!==void 0&&a.holders>0,N=a?.proHolders!==void 0&&a.proHolders>0,_=a?.kolHolders!==void 0&&a.kolHolders>0,ge=A||N||_;return jsxs("div",{className:cn("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",s),style:{borderBottom:o?"none":"1px solid rgba(39,39,42,0.6)"},onClick:r?m:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(xe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:true,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:c,"aria-label":n("tokens.copied.address"),title:n("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(l)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{className:cn(x),children:formatMCapInUsd(g)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountInUsd(h)})]})]}),ge&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[A&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(a?.holders)]})}),N&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.proHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(KlineCandlesIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(a?.proHolders)]})}),_&&jsx(StyledTooltip,{content:n("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(StarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(a?.kolHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("span",{className:cn("text-base font-bold leading-none",x),children:formatMCapInUsd(g)})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountInUsd(u)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountInUsd(p)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountInUsd(f)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(k)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(a?.top10HoldingsRatio),tooltip:n("tokens.tokenInfo.top10HoldingsRatio"),warning:y,disable:!a?.top10HoldingsRatio||a?.top10HoldingsRatio==="0"}),jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(a?.devHoldingsRatio),tooltip:n("tokens.tokenInfo.devHoldingsRatio"),warning:b,disable:!a?.devHoldingsRatio||a?.devHoldingsRatio==="0"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(a?.sniperHoldingsRatio),tooltip:n("tokens.tokenInfo.sniperHoldingsRatio"),warning:T,disable:!a?.sniperHoldingsRatio||a?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(a?.insiderHoldingsRatio),tooltip:n("tokens.tokenInfo.insiderHoldingsRatio"),warning:v,disable:!a?.insiderHoldingsRatio||a?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(a?.bundleHoldingsRatio),tooltip:n("tokens.tokenInfo.bundleHoldingsRatio"),warning:L,disable:!a?.bundleHoldingsRatio||a?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:E=>E.stopPropagation(),children:t(e)})]})]})}var bd=152,en=10;function Td({index:e,style:t,data:o,skeletonCount:r,renderItemAction:s,onSelectToken:n}){if(!o)return jsx("div",{style:t,children:jsx(Do,{isLast:e===r-1})});let i=o[e];return i?jsx("div",{style:t,children:jsx(Zr,{token:i,isLast:e===o.length-1,renderAction:s,onSelectToken:n})}):jsx("div",{style:t,children:jsx(Do,{isLast:e===o.length-1})})}function Ge({title:e,tokens:t,isLoading:o,itemHeight:r=bd,renderHeaderExtra:s,renderItemAction:n,onSelectToken:i,onPauseChange:l,onScrollingChange:a,className:d,hideHeader:m}){let c=o||!t?void 0:t,u=c?c.length:en,p=useMemo(()=>({data:c,skeletonCount:en,renderItemAction:n,onSelectToken:i}),[c,n,i]),[f,k]=useState(false),g=useRef(void 0),h=useRef(false),x=useCallback(()=>{k(true),l?.(true);},[l]),y=useCallback(()=>{k(false),l?.(false);},[l]),b=useCallback(()=>{h.current||(h.current=true,a?.(true)),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=false,a?.(false);},180);},[a]);return useEffect(()=>()=>{g.current&&clearTimeout(g.current),h.current&&a?.(false);},[a]),jsxs("div",{className:cn("w-full h-full bg-[#0a0a0b] overflow-hidden flex flex-col border border-[rgba(39,39,42,0.6)] rounded-lg",d),onMouseEnter:x,onMouseLeave:y,children:[!m&&jsx(Dr,{title:e,isPaused:f,extra:s}),jsx("div",{className:"flex-1 w-full overflow-hidden",onScrollCapture:b,children:jsx(List,{className:"h-full w-full",rowCount:u,rowHeight:r,rowComponent:Td,rowProps:p,overscanCount:10})})]})}function Wo(e,t){let o={...e};for(let r of Object.keys(t))t[r]!==void 0&&(o[r]=t[r]);return o}var vd=["1m","5m","15m","30m","1h","4h","24h"];function Sd(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let r of vd)t[r]&&(o[r]=e[r]?Wo(e[r],t[r]):t[r]);return o}function Nd(e,t){return t?e?Wo(e,t):t:e}function $t(e,t){return t?e?Wo(e,t):t:e}function ee(e,t){let{chain:o,address:r,stats:s,marketData:n,socialMedias:i,security:l,launchedFrom:a,migratedTo:d,...m}=t,c={...e};for(let u of Object.keys(m))m[u]!==void 0&&(c[u]=m[u]);return c.stats=Sd(e.stats,s),c.marketData=Nd(e.marketData,n),c.socialMedias=$t(e.socialMedias,i),c.security=$t(e.security,l),c.launchedFrom=$t(e.launchedFrom,a),c.migratedTo=$t(e.migratedTo,d),c}function zt(e,t){let o=new Map(e.map(r=>[r.address,r]));return t.map(r=>{let s=o.get(r.address);return s?ee(s,r):r})}function Cd(e){return e.chain!==void 0&&e.address!==void 0&&e.address!==""&&e.name!==void 0&&e.symbol!==void 0&&e.decimals!==void 0}function Re(e,t){if(t.length===0)return e;let o=[...e],r=false;for(let s of t){let n=o.findIndex(i=>i.address===s.address);if(n>=0){o[n]=ee(o[n],s),r=true;continue}Cd(s)&&(o.push(s),r=true);}return r?o:e}var Ld=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],Pd=new Set(["price","marketCap","athMarketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),Rd=new Set(["priceChange","volumes","trades","traders","buys","sells"]);function Y(e){if(e==null||e==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function on(e){for(let t of Ld){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function rn(e){if(Pd.has(e))return true;let t=on(e);return t?Rd.has(t.metric):false}function Qt(e,t){switch(t){case "price":return Y(e.marketData?.priceInUsd);case "marketCap":return Y(e.marketData?.marketCapInUsd);case "athMarketCap":return Y(e.marketData?.athMarketCapInUsd);case "tvl":return Y(e.marketData?.tvlInUsd);case "holders":return Y(e.marketData?.holders);case "top10Holdings":return Y(e.marketData?.top10Holdings);case "top10Ratio":return Y(e.marketData?.top10HoldingsRatio);case "top100Holdings":return Y(e.marketData?.top100Holdings);case "top100Ratio":return Y(e.marketData?.top100HoldingsRatio);case "creatorsHoldings":return Y(e.marketData?.devHoldings);case "creatorsRatio":return Y(e.marketData?.devHoldingsRatio);case "createdAt":return e.createdAt?.getTime();case "launchedFromProtocolFamily":return tn(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return tn(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=on(t);if(!o)return;let r=e.stats,s=r&&o.resolution in r?r[o.resolution]:void 0;switch(o.metric){case "priceChange":return Y(s?.priceChange);case "volumes":return Y(s?.volumesInUsd);case "trades":return Y(s?.trades);case "traders":return Y(s?.traders);case "buys":return Y(s?.buys);case "sells":return Y(s?.sells);default:return}}function tn(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var Ad=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function nn(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Id(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function Md(e){return Array.isArray(e)?e:void 0}function Hd(e){return Array.isArray(e)?void 0:e}function sn(e,t){if(!Ad.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function he(e,t){let o=Hd(t);return o===void 0?void 0:sn(e,o)}function Vo(e,t){return Md(t)?.map(o=>sn(e,o))}function Xe(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)?e-o:void 0}if(typeof e=="string")return e.localeCompare(String(t))}function Gt(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)&&e===o}return String(e)===String(t)}function Fd(e,t){if(!rn(t.field))return false;let o=Qt(e,t.field),r=o===void 0;if(t.operator==="isNull")return r;if(t.operator==="isNotNull")return !r;if(r)return false;switch(t.operator){case "eq":{let s=he(t.field,t.value);return s!==void 0&&Gt(o,s)}case "ne":{let s=he(t.field,t.value);return s!==void 0&&!Gt(o,s)}case "gt":{let s=he(t.field,t.value),n=s!==void 0?Xe(o,s):void 0;return n!==void 0&&n>0}case "gte":{let s=he(t.field,t.value),n=s!==void 0?Xe(o,s):void 0;return n!==void 0&&n>=0}case "lt":{let s=he(t.field,t.value),n=s!==void 0?Xe(o,s):void 0;return n!==void 0&&n<0}case "lte":{let s=he(t.field,t.value),n=s!==void 0?Xe(o,s):void 0;return n!==void 0&&n<=0}case "between":{let s=Vo(t.field,t.value);if(!s||s.length<2)return false;let n=Xe(o,s[0]),i=Xe(o,s[1]);return n!==void 0&&i!==void 0&&n>=0&&i<=0}case "in":{let s=Vo(t.field,t.value);return s?s.some(n=>Gt(o,n)):false}case "nin":{let s=Vo(t.field,t.value);return s?s.every(n=>!Gt(o,n)):false}case "contains":{let s=he(t.field,t.value);return s!==void 0&&String(o).includes(String(s))}case "notContains":{let s=he(t.field,t.value);return s!==void 0&&!String(o).includes(String(s))}case "startsWith":{let s=he(t.field,t.value);return s!==void 0&&String(o).startsWith(String(s))}case "endsWith":{let s=he(t.field,t.value);return s!==void 0&&String(o).endsWith(String(s))}default:return false}}function ae(e,t){let o=t?.keywords?.map(nn).filter(n=>n!==void 0),r=t?.excludeKeywords?.map(nn).filter(n=>n!==void 0),s=t?.filters;return !o?.length&&!r?.length&&!s?.length?e:e.filter(n=>{let i=Id(n);return !(o?.length&&!o.some(l=>i.includes(l))||r?.length&&r.some(l=>i.includes(l))||s?.length&&!s.every(l=>Fd(n,l)))})}function le({applyUpdates:e,paused:t=false,flushInterval:o=500}){let r=useRef(e),s=useRef(t),n=useRef([]),i=useRef(void 0),l=useRef(void 0);r.current=e,s.current=t;let a=useCallback(()=>{i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),l.current!==void 0&&(cancelAnimationFrame(l.current),l.current=void 0);},[]),d=useCallback(()=>{if(a(),s.current){i.current=setTimeout(d,o);return}let u=n.current;u.length!==0&&(n.current=[],r.current(u));},[a,o]),m=useCallback(()=>{i.current!==void 0||l.current!==void 0||(i.current=setTimeout(()=>{i.current=void 0,l.current=requestAnimationFrame(()=>{l.current=void 0,d();});},o));},[d,o]),c=useCallback(u=>{u.length!==0&&(n.current.push(...u),m());},[m]);return useEffect(()=>{t||d();},[d,t]),useEffect(()=>a,[a]),{enqueueUpdates:c,flush:d}}function mn({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let s=useTokenMarketRuntime(),n=useRef(new Map),i=useRef(o);i.current=o;let l=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),a=useMemo(()=>l?l.split(","):[],[l]),d=()=>{n.current.forEach(m=>m()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(a),c=n.current;for(let[u,p]of c)m.has(u)||(p(),c.delete(u));for(let u of a){if(c.has(u))continue;let p=tokenMarketKey(e,u),f=s.subscribe(p,g=>{g.token&&i.current([g.token]);}),k=s.retain(p);c.set(u,()=>{f(),k();});}},[a,e,r,s]);}var Wd=80;function xn(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function Vd(e,t,o){return e===t?o:e===o?t:o||t}function Ko(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:Vd(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function _d(e){return {...xn(Ko(e)),...e.token??{},liquidities:Ko(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function kn(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,Wd)}function hn({chain:e,filters:t,isPaused:o=false,deferUpdates:r=false,updateFlushInterval:s}){let n=useMemo(()=>({chain:e}),[e]),i=useRef(o);i.current=o;let l=useRef(e),[a,d]=useState(true),[m,c]=useState([]);useEffect(()=>{e!==l.current&&(d(true),c([]),l.current=e);},[e]);let{data:u,isPending:p}=useNewPoolsQuery(n);useEffect(()=>{u&&(c(y=>{let b=i.current,v=y.length===0&&u.length>0,T=[...y];for(let L of u){let A=_d(L),N=T.findIndex(_=>_.address===A.address);N>=0?T[N]=ee(T[N],A):(!b||v)&&T.push(A);}return b?T:kn(T)}),d(false));},[u]);let f=useCallback(y=>{c(b=>{let v=i.current,T=[...b],L=false;for(let A of y){let N=T.findIndex(_=>_.address===A.address);N>=0?(L=true,T[N]=ee(T[N],A)):v||(L=true,T.push(xn(A)));}return L?v?T:kn(T):b});},[]),{enqueueUpdates:k}=le({applyUpdates:f,paused:r,flushInterval:s}),g=useCallback(y=>{k(y.map(Ko));},[k]);useNewPoolsSubscription({chain:e},g),useNewTokensMetadataSubscription({chain:e},k),mn({chain:e,tokens:m,onUpdate:k});let h=useMemo(()=>p||a,[p,a]);return {tokens:useMemo(()=>ae(m,t),[m,t]),isLoading:h}}function Yh({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=hn({chain:e,filters:t,isPaused:a,deferUpdates:m}),f=useCallback(k=>{d(k);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:f,onScrollingChange:c,className:i,hideHeader:l})}function be({chain:e,tokens:t,onUpdate:o,enabled:r=true}){let s=useTokenMarketRuntime(),n=useRef(new Map),i=useRef(o);i.current=o;let l=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),a=useMemo(()=>l?l.split(","):[],[l]),d=()=>{n.current.forEach(m=>m()),n.current.clear();};useEffect(()=>d,[e,s,r]),useEffect(()=>{if(!r){d();return}let m=new Set(a),c=n.current;for(let[u,p]of c)m.has(u)||(p(),c.delete(u));for(let u of a){if(c.has(u))continue;let p=tokenMarketKey(e,u),f=s.subscribe(p,g=>{g.token&&i.current([g.token]);}),k=s.retain(p);c.set(u,()=>{f(),k();});}},[a,e,r,s]);}function wn({chain:e,filters:t,isPaused:o=false,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,u]=useState([]);useEffect(()=>{e!==a.current&&(m(true),u([]),a.current=e);},[e]);let{data:p,isPending:f}=useMigratedTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(u(y=>{let b=l.current,v=[...y];for(let T of p){let L=v.findIndex(A=>A.address===T.address);L>=0?v[L]=ee(v[L],T):b||v.unshift(T);}return v}),m(false));},[p]);let k=useCallback(y=>{u(b=>Re(b,y));},[]),{enqueueUpdates:g}=le({applyUpdates:k,paused:s,flushInterval:n});be({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>f||d,[f,d]);return {tokens:useMemo(()=>ae(c,t),[c,t]),isLoading:h}}function pb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=wn({chain:e,filters:t,isPaused:a,deferUpdates:m}),f=useCallback(k=>{d(k);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:f,onScrollingChange:c,className:i,hideHeader:l})}function jd(e){return e.sort((t,o)=>{let r=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-r})}function In({chain:e,filters:t,isPaused:o=false,refetchInterval:r=15e3,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,u]=useState([]);useEffect(()=>{e!==a.current&&(m(true),u([]),a.current=e);},[e]);let{data:p,isPending:f}=useFinalStretchTokensQuery(i,{refetchInterval:r});useEffect(()=>{p&&(u(y=>{let b=l.current,v=y.length===0&&p.length>0,T=[...y];for(let L of p){let A=T.findIndex(N=>N.address===L.address);A>=0?T[A]=ee(T[A],L):(!b||v)&&T.push(L);}return b?T:jd(T)}),m(false));},[p]);let k=useCallback(y=>{u(b=>Re(b,y));},[]),{enqueueUpdates:g}=le({applyUpdates:k,paused:s,flushInterval:n});be({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>f||d,[f,d]);return {tokens:useMemo(()=>ae(c,t),[c,t]),isLoading:h}}function Lb({chain:e,filters:t,title:o,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=In({chain:e,filters:t,isPaused:a,deferUpdates:m}),f=useCallback(k=>{d(k);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:r,renderItemAction:s,onSelectToken:n,onPauseChange:f,onScrollingChange:c,className:i,hideHeader:l})}var ac=10,lc="liberfi:search_histories";function kt(){return createBrowserSearchHistoryStorage({key:lc,fallback:createMemorySearchHistoryStorage()})}function dc(e,t){return e.length===t.length&&e.every((o,r)=>o===t[r])}function Fn(){let e=useMemo(()=>kt(),[]),t=useRef(e.read()),o=()=>{let i=e.read();return dc(t.current,i)?t.current:(t.current=i,i)},r=useSyncExternalStore(e.subscribe,o,o),s=useCallback(i=>{let l=i.trim();if(!l)return;let a=e.read().filter(d=>d!==l);e.write([l,...a].slice(0,ac));},[e]),n=useCallback(()=>{e.clear();},[e]);return {histories:r,addHistory:s,clearHistories:n}}function On({histories:e,onSelect:t,onClear:o,className:r}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn("px-4 pb-4",r),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium",children:s("tokens.search.history")}),jsx(Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(TrashIcon,{width:20,height:20})})]}),jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(n=>jsx(Chip,{size:"sm",variant:"bordered",className:cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(n),children:n},n))})]})}function Bn({onSelect:e,histories:t,onClear:o,className:r}){let s=Fn(),n=t?[...t]:s.histories,i=o??s.clearHistories;return jsx(On,{className:cn(r),histories:n,onSelect:e,onClear:i})}var vc=["ArrowDown","ArrowUp","Enter","Escape"];function Sc(e){return vc.includes(e)}function En({value:e,onValueChange:t,onClear:o,onEscape:r,onNavigateKey:s,className:n}){let{t:i}=useTranslation();return jsx("div",{className:n,children:jsx(StyledInput,{autoFocus:true,variant:"bordered",radius:"full",value:e,onValueChange:t,onKeyDown:l=>{Sc(l.key)&&(l.key!=="Escape"&&l.preventDefault(),s?.(l.key));},placeholder:i("tokens.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsx(SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsx(Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:o,children:jsx(XCloseIcon,{width:20,height:20})}):jsx(Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-full cursor-pointer select-none",onMouseDown:l=>{l.preventDefault(),r?.();},children:"Esc"})})})}function Yt({token:e,highlighted:t=false,className:o}){let{t:r}=useTranslation(),s=useTickAge(e.createdAt),n=useMemo(()=>e.marketData?.priceInUsd,[e]),i=useMemo(()=>e.marketData?.marketCapInUsd,[e]),l=useMemo(()=>e.marketData?.tvlInUsd,[e]),a=useMemo(()=>e.stats?.["24h"]?.priceChange,[e]),d=useMemo(()=>a?new SafeBigNumber(a).abs().toString():void 0,[a]),m=useMemo(()=>a!=null&&new SafeBigNumber(a).gte(0),[a]);return jsxs("div",{className:cn("w-full h-full px-3 flex items-center justify-between gap-2","hover:cursor-pointer hover:bg-content2 rounded-lg",t&&"bg-content2",o),"data-highlighted":t?"true":"false","aria-selected":t,children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2.5",children:[jsx(xe,{token:e,className:"w-10 h-10 flex-none",showProtocolFamily:true,classNames:{searchIcon:"w-5 h-5"}}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"font-medium text-sm truncate",children:e.symbol}),jsx("span",{className:"text-xs text-primary font-medium",children:formatAge(s)})]}),jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral",children:[jsxs("span",{children:[r("tokens.listHeader.mcShort")," ",formatMCapInUsd(i)]}),jsx("span",{children:"/"}),jsxs("span",{children:[r("tokens.listHeader.liqShort")," ",formatAmountInUsd(l)]})]})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end",children:[jsx("span",{className:"text-xs",children:formatPriceInUsd(n)}),jsxs("span",{className:cn("inline-flex gap-0.5 items-center text-xs",m?"text-bullish":"text-bearish"),children:[m?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),jsx("span",{children:formatPercent(d)})]})]})]})}function Jt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn("h-9 px-3 flex items-center justify-between","text-xs font-medium text-neutral","sticky top-0 z-10",e),children:[jsx("div",{className:"flex-1",children:jsxs("span",{children:[t("tokens.listHeader.token")," / ",t("tokens.listHeader.age")," /"," ",t("tokens.listHeader.marketCap")," /"," ",t("tokens.listHeader.liquidity")]})}),jsx("div",{className:"flex-none w-20 text-right",children:jsxs("span",{children:[t("tokens.listHeader.price")," / ",t("tokens.listHeader.24hChange")]})})]})}function Dc(){return jsxs("div",{className:"w-full h-14 px-3 flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[jsx(Skeleton,{className:"flex-none w-8 h-8 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1.5",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-36 h-3 rounded-md"})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end gap-1.5",children:[jsx(Skeleton,{className:"w-14 h-4 rounded-md"}),jsx(Skeleton,{className:"w-10 h-3 rounded-md"})]})]})}function jt({rows:e=6,className:t}){return jsx("div",{className:cn("w-full",t),children:Array.from({length:e}).map((o,r)=>jsx(Dc,{},r))})}function qn({keyword:e,chains:t,limit:o=50}){let r=useMemo(()=>({keyword:e,chains:t,limit:o}),[e,t,o]),{data:s,isLoading:n,isFetchingNextPage:i,hasNextPage:l,fetchNextPage:a}=useSearchTokensInfiniteQuery(r,{enabled:!!e}),d=useMemo(()=>s?.pages.flatMap(m=>m.data)??[],[s]);return {tokens:d,items:d,isLoading:n,isFetchingNextPage:i,hasNextPage:l??false,fetchNextPage:a}}var Qc=56;function Qn({onSelectToken:e,className:t,navigationRef:o,onEscape:r,...s}){let{tokens:n,isLoading:i,isFetchingNextPage:l,hasNextPage:a,fetchNextPage:d}=qn(s),m=useRef(null),{height:c}=useResizeObserver({ref:m}),u=useCallback(x=>x<n.length,[n]),p=useCallback(async()=>{a&&!l&&await d();},[a,l,d]),f=useMemo(()=>a?n.length+1:n.length,[n,a]),k=useInfiniteLoader({isRowLoaded:u,loadMoreRows:p,rowCount:f,threshold:5}),g=i?0:n.length,h=useSearchKeyboardNavigation({itemCount:g,hasNextPage:a&&!i,isFetchingNextPage:l,onSelectIndex:x=>{let y=n[x];y&&e?.(y);},onRequestNextPage:()=>{a&&!l&&d();},onEscape:()=>r?.()});return o&&(o.current=h),useEffect(()=>()=>{o&&o.current===h&&(o.current=null);},[h,o]),useEffect(()=>{h.reset();},[s.keyword,h]),i?jsxs("div",{className:cn("w-full",t),children:[jsx(Jt,{}),jsx(jt,{})]}):n.length===0?jsxs("div",{className:cn("w-full",t),children:[jsx(Jt,{}),jsx(Xc,{})]}):jsxs("div",{className:cn("w-full h-full flex flex-col",t),children:[jsx(Jt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:m,children:jsx(List,{style:{height:c},onRowsRendered:k,rowComponent:Gc,rowCount:f,rowHeight:Qc,rowProps:{tokens:n,onSelectToken:e,highlightedIndex:h.highlightedIndex},overscanCount:5})})]})}function Gc({index:e,style:t,tokens:o,onSelectToken:r,highlightedIndex:s}){let n=o[e];return n?jsx("div",{style:t,"data-index":e,onClick:()=>r?.(n),children:jsx(Yt,{token:n,highlighted:s===e})}):jsx("div",{style:t,className:"flex items-center justify-center",children:jsx(Spinner,{size:"sm"})})}function Xc(){let{t:e}=useTranslation();return jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral",children:e("tokens.search.noResults")})]})}function Yc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function Ze(e,t){let o=Object.keys(t??{})[0];if(!o)return e;let r=t?.[o];if(r!=="asc"&&r!=="desc")return e;let s=e.map((n,i)=>({token:n,index:i,value:Qt(n,o)}));return s.every(({value:n})=>n===void 0)?e:s.sort((n,i)=>{let l=n.value===void 0,a=i.value===void 0;if(l&&a)return n.index-i.index;if(l)return 1;if(a)return -1;let d=Yc(n.value,i.value);return d===0?n.index-i.index:r==="asc"?d:-d}).map(({token:n})=>n)}function oo({chain:e,resolution:t,filters:o,sortDirections:r,refetchInterval:s=3e4,deferUpdates:n=false,updateFlushInterval:i}){let l=useMemo(()=>({chain:e,resolution:t}),[e,t]),a=useRef(l),[d,m]=useState(true);useEffect(()=>{JSON.stringify(l)!==JSON.stringify(a.current)&&(m(true),u([]),a.current=l);},[l]);let[c,u]=useState([]),{data:p,isPending:f}=useTrendingTokensQuery(l,{refetchInterval:s});useEffect(()=>{p&&(u(b=>zt(b,p)),m(false));},[p]);let k=useCallback(b=>{u(v=>Re(v,b));},[]),{enqueueUpdates:g}=le({applyUpdates:k,paused:n,flushInterval:i});useTrendingTokensSubscription({chain:e},g),be({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>!!(f||d),[f,d]),x=useMemo(()=>ae(c,o),[c,o]);return {tokens:useMemo(()=>Ze(x,r),[x,r]),isLoading:h}}var rm=Chain.ETHEREUM,nm="24h",sm=56;function Yn({chains:e,onSelectToken:t,className:o}){let r=e?.length===1?e[0]:e?.[0]??rm,{tokens:s,isLoading:n}=oo({chain:r,resolution:nm});return jsx("div",{className:cn("w-full flex flex-col overflow-hidden",o),children:n?jsx(jt,{}):jsx("div",{className:"overflow-y-auto",children:s.map(i=>jsx("div",{style:{height:sm},onClick:()=>t?.(i),children:jsx(Yt,{token:i,className:"h-full"})},i.address))})})}function jn({chains:e,onKeywordChange:t,onSelectToken:o,onEscape:r}){let s=useMemo(()=>kt(),[]),n=useSearchController({storage:s,onQueryChange:t??Jn,onDismiss:r??Jn}),i=useRef(null),l=n.dismiss,a=useCallback(d=>{if(i.current){i.current.onKey(d);return}d==="Escape"&&l();},[l]);return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(En,{value:n.text,onValueChange:n.setText,onClear:n.clearQuery,onEscape:n.dismiss,onNavigateKey:a}),n.query?jsx(Qn,{className:"flex-auto min-h-0",keyword:n.query,chains:e,onSelectToken:o,navigationRef:i,onEscape:n.dismiss}):jsxs("div",{className:"flex-auto min-h-0 flex flex-col overflow-hidden",children:[jsx(Bn,{histories:n.history,onSelect:n.commitQuery,onClear:n.clearHistory}),jsx(Yn,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}function Jn(){}var Go="search";function fy({id:e=Go}){return jsx(AsyncModal,{id:e,children:t=>jsx(Tm,{...t})})}function Tm({params:e,isOpen:t,onOpenChange:o,onResult:r}){let{t:s}=useTranslation(),{isMobile:n}=useScreen(),i=useCallback(l=>{r(l);},[r]);return jsx(StyledModal,{isOpen:t,onOpenChange:o,size:n?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxs(ModalContent,{className:"w-full h-full",style:{borderRadius:n?void 0:14,border:n?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:n?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxs(ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsx("span",{className:"text-base font-semibold",children:s("tokens.search.title")}),jsx(Button,{isIconOnly:true,onPress:()=>o(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsx(XCloseIcon,{width:20,height:20})})]}),jsx(ModalBody,{className:"p-4",children:jsx(jn,{chains:e?.chains,onSelectToken:i,onEscape:()=>o(false)})})]})})}function Sy({chains:e,onSelectToken:t,className:o}){let{t:r}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:n,onClose:i}=useAsyncModal(Go),l=useCallbackRef(t),a=useCallbackRef(async()=>{let m=await n({params:{chains:e}});m&&l(m);}),d=useCallbackRef(()=>{i();});return useEffect(()=>{let m=c=>{let u=document.activeElement,p=!!u&&(u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.getAttribute("contenteditable")==="true");c.key==="/"&&!p&&(c.preventDefault(),a()),c.key==="Escape"&&(c.preventDefault(),d());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[a,d]),s?jsx(Button,{size:"sm",radius:"full",onPress:a,variant:"bordered",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsx(Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",o),children:r("tokens.search.placeholder")}):jsx(Button,{size:"sm",radius:"full",isIconOnly:true,onPress:a,variant:"bordered",className:cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",o),children:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"})})}var ns=()=>{};function Ry({onKeywordChange:e}){let t=useMemo(()=>kt(),[]),o=useSearchController({storage:t,onQueryChange:e??ns,onDismiss:ns});return {text:o.text,keyword:o.query,setText:o.setText,setKeyword:o.commitQuery,clearKeyword:o.clearQuery}}function yt(e){return e==null||e===""?"--":formatPercent(Number(e)/100)}function Te(e,t=4,o=4){return e?e.length<=t+o+1?e:`${e.slice(0,t)}\u2026${e.slice(-o)}`:"--"}function Pe(e,t=Date.now()){if(e==null)return "--";let o=typeof e=="string"||typeof e=="number"?new Date(e):e,r=typeof t=="number"?new Date(t):t,s=Math.max(0,Math.floor((r.getTime()-o.getTime())/1e3));if(s<60)return `${s}s`;let n=Math.floor(s/60);if(n<60)return `${n}m`;let i=Math.floor(n/60);if(i<24)return `${i}h`;let l=Math.floor(i/24);if(l<30)return `${l}d`;let a=Math.floor(l/30);return a<12?`${a}mo`:`${Math.floor(l/365)}y`}function U(e,t){let{token:o,isLoading:r}=useTokenMarket({chain:e,address:t});return {token:o,isLoading:r}}function je({label:e,totalFormatted:t,buysFormatted:o,sellsFormatted:r,totalValue:s=0,buysValue:n=0,className:i}){let l=new SafeBigNumber(s??0),a=new SafeBigNumber(n??0),d=l.eq(0)?0:a.div(l).times(100).toNumber();return jsxs("div",{className:cn("flex flex-col gap-1",i),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-xs text-default-500",children:e}),jsx("span",{className:"text-xs text-foreground",children:t})]}),jsx(Progress,{size:"sm",value:d,classNames:{track:"bg-bearish/40",indicator:"bg-bullish"},"aria-label":`${e} buy share`}),jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[jsxs("span",{className:"text-bullish",children:["Buys: ",o]}),jsxs("span",{className:"text-bearish",children:["Sells: ",r]})]})]})}function is({token:e,actions:t,dataStrip:o,className:r,onCopyAddress:s}){let n=e?.address;return jsxs("div",{className:cn("flex w-full flex-wrap items-center gap-4 px-4 py-3",r),children:[jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&jsx(xe,{token:e,radius:"lg",className:"h-10 w-10"}),jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"truncate text-base font-semibold text-foreground",children:e?.symbol??"--"}),jsx("span",{className:"truncate text-xs text-default-400",children:e?.name})]}),n&&jsxs("button",{type:"button",onClick:()=>s?.(n),className:"flex items-center gap-1 text-[11px] text-default-400 transition-colors hover:text-foreground",title:n,children:[Te(n,6,6),jsx(CopyIcon,{width:12,height:12})]})]})]}),o&&jsx("div",{className:"flex-1 min-w-0",children:o}),t&&jsx("div",{className:"ml-auto flex items-center gap-2",children:t})]})}function as(e,t){return U(e,t)}function ds({price:e,marketCap:t,volume:o,holdersCount:r,socialMedia:s,className:n}){return jsxs("div",{className:cn("flex flex-wrap items-center gap-x-6 gap-y-3",n),children:[e,jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[t,o,r]}),jsx("div",{className:"ml-auto",children:s})]})}function kv(e,t){return U(e,t)}function ms({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:r}){return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e!=null?formatAmount(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:yt(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:yt(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"Holders / Top10 / Top100"})]})}function us(e,t){return U(e,t)}function ps({chain:e,address:t,className:o}){let{token:r}=us(e,t);return jsx(ms,{holders:r?.marketData?.holders,top10HoldingsRatio:r?.marketData?.top10HoldingsRatio,top100HoldingsRatio:r?.marketData?.top100HoldingsRatio,className:o})}function gs({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:r}){return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatMCapInUsd(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t?formatAmountInUsd(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Pe(o)})]}),jsx("div",{className:"text-[10px] text-default-400",children:"MC / Liq / Age"})]})}function ks(e,t){return U(e,t)}function xs({chain:e,address:t,className:o}){let{token:r}=ks(e,t);return jsx(gs,{marketCapInUsd:r?.marketData?.marketCapInUsd,tvlInUsd:r?.marketData?.tvlInUsd,createdAt:r?.createdAt,className:o})}function Ts({priceInUsd:e,price24hAgoInUsd:t,className:o}){let{bearish:r,priceChange:s}=useMemo(()=>{if(!e||!t)return {bearish:false,priceChange:void 0};let n=new SafeBigNumber(e),i=new SafeBigNumber(t);return i.lte(0)?{bearish:false,priceChange:void 0}:{bearish:n.lt(i),priceChange:n.minus(i).div(i).abs().toNumber()}},[e,t]);return jsxs("div",{className:cn("group flex flex-col gap-1",o),"data-bearish":r,children:[jsx("div",{className:"text-base font-medium leading-none text-bullish group-data-[bearish=true]:text-bearish",children:e?formatPriceInUsd(e):"--"}),jsxs("div",{className:"flex items-center gap-2 text-[10px] leading-none",children:[jsx("span",{className:"text-default-400",children:"24h"}),jsx("span",{className:"text-bullish group-data-[bearish=true]:text-bearish",children:s!=null?formatPercent(s):"--"})]})]})}function ys(e,t){return U(e,t)}function vs({chain:e,address:t,className:o}){let{token:r}=ys(e,t);return jsx(Ts,{priceInUsd:r?.marketData?.priceInUsd,price24hAgoInUsd:r?.stats?.["24h"]?.openPriceInUsd,className:o})}function jm(e,t){switch(e){case "website":return jsx(WebsiteIcon,{width:t,height:t});case "twitter":return jsx(TwitterIcon,{width:t,height:t});case "telegram":return jsx(TelegramIcon,{width:t,height:t});case "discord":return jsx(DiscordIcon,{width:t,height:t});default:return jsx("span",{className:"text-[9px] font-medium uppercase",children:e.slice(0,2)})}}function Ss({socials:e,className:t,iconSize:o=16}){if(!e)return null;let s=["website","twitter","telegram","discord","github","reddit","youtube","medium"].filter(n=>!!e[n]);return s.length===0?null:jsx("div",{className:cn("flex items-center gap-3",t),children:s.map(n=>jsx("a",{href:e[n],target:"_blank",rel:"noreferrer noopener",className:"flex items-center justify-center text-default-400 transition-colors hover:text-foreground",style:{width:o,height:o},children:jm(n,o)},n))})}function Ns(e,t){return U(e,t)}function Cs({chain:e,address:t,className:o,iconSize:r}){let{token:s}=Ns(e,t);return jsx(Ss,{socials:s?.socialMedias,className:o,iconSize:r})}function Ps({volumesInUsd:e,trades:t,traders:o,className:r}){return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",r),children:[jsxs("div",{className:"text-xs font-medium text-default-500",children:[jsx("span",{className:"text-foreground",children:e?formatAmountInUsd(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t!=null?formatAmount(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:o!=null?formatAmount(o):"--"})]}),jsx("div",{className:"text-[10px] text-default-400",children:"24h Vol / Txs / Traders"})]})}function Rs(e,t){return U(e,t)}function As({chain:e,address:t,className:o}){let{token:r}=Rs(e,t),s=r?.stats?.["24h"];return jsx(Ps,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function Is({chain:e,address:t,className:o}){return jsx(ds,{className:o,price:jsx(vs,{chain:e,address:t}),marketCap:jsx(xs,{chain:e,address:t}),volume:jsx(As,{chain:e,address:t}),holdersCount:jsx(ps,{chain:e,address:t}),socialMedia:jsx(Cs,{chain:e,address:t})})}function J0({chain:e,address:t,actions:o,dataStrip:r,className:s,onCopyAddress:n}){let{token:i}=as(e,t);return jsx(is,{token:i,actions:o,dataStrip:r===void 0?jsx(Is,{chain:e,address:t}):r,className:s,onCopyAddress:n})}var iu=[{value:"holdingUsd",label:"Value"},{value:"lastActiveAt",label:"Last active"}];function Fs({holders:e,isLoading:t,sortBy:o,sortDirection:r,onSortByChange:s,onlyTracked:n=false,onOnlyTrackedChange:i,onLoadMore:l,hasMore:a,now:d=Date.now(),wellKnownAddresses:m,className:c,renderAddress:u}){let p=n?e.filter(f=>f.tags&&f.tags.length>0):e;return jsxs("div",{className:cn("flex flex-col",c),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Holders"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:n,onChange:f=>i?.(f.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"flex items-center gap-1",children:iu.map(f=>jsx("button",{type:"button",onClick:()=>s(f.value,r??"desc"),className:cn("rounded px-2 py-1 text-[11px] transition-colors",o===f.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:f.label},f.value))})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[640px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[30%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"First held"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[p.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No holders"})}),p.map(f=>jsx(au,{holder:f,now:d,wellKnownAddresses:m,renderAddress:u},f.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),a&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:l,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function au({holder:e,now:t,wellKnownAddresses:o,renderAddress:r}){let s=o?.[e.address],n=useMemo(()=>r?r(e.address):s?jsx("span",{className:"rounded bg-default-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-default-600",children:s}):jsx("span",{className:"font-mono text-[11px] text-default-500",children:Te(e.address,6,6)}),[e.address,r,s]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:n}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Et,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountInUsd(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:yt(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.startHoldingAt?Pe(e.startHoldingAt,t):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Os({chain:e,address:t,limit:o=50,initialSortBy:r,initialSortDirection:s}){let[n,i]=useState(r),[l,a]=useState(s),[d,m]=useState(void 0),[c,u]=useState([]),p=useCallback(()=>{m(void 0),u([]);},[]),f=useCallback((N,_)=>{N===n&&_===l||(i(N),a(_),p());},[p,n,l]),k=useCallback(N=>{f(N,l??"desc");},[f,l]),g=useCallback(N=>{N!==l&&(a(N),p());},[p,l]);useEffect(()=>{p();},[e,t,p]);let h=useMemo(()=>({chain:e,address:t,cursor:d,limit:o,sortBy:n,sortDirection:l}),[e,t,d,o,n,l]),{data:x,isPending:y,isFetching:b}=useTokenHoldersQuery(h);useEffect(()=>{x&&u(N=>d==null?[x]:N[N.length-1]?.endCursor===x.endCursor?N:[...N,x]);},[x,d]),useTokenSubscription({chain:e,address:t},()=>{});let v=useMemo(()=>c.flatMap(N=>N.data),[c]),T=c[c.length-1],L=!!(T?.hasNext&&T.endCursor),A=useCallback(()=>{!T?.endCursor||!T.hasNext||m(T.endCursor);},[T]);return {holders:v,isLoading:y||b,sortBy:n,sortDirection:l,setSortBy:k,setSort:f,setSortDirection:g,hasMore:L,loadMore:A}}function hS({chain:e,address:t,limit:o,initialSortBy:r,initialSortDirection:s,initialOnlyTracked:n=false,wellKnownAddresses:i,className:l,renderAddress:a}){let[d,m]=useState(n),{holders:c,isLoading:u,sortBy:p,sortDirection:f,setSort:k,hasMore:g,loadMore:h}=Os({chain:e,address:t,limit:o,initialSortBy:r,initialSortDirection:s});return jsx(Fs,{holders:c,isLoading:u,sortBy:p,sortDirection:f,onSortByChange:k,onlyTracked:d,onOnlyTrackedChange:m,wellKnownAddresses:i,hasMore:g,onLoadMore:h,className:l,renderAddress:a})}var fu=[{value:"timestamp",label:"Latest"},{value:"totalUsd",label:"Top USD"}],gu=[{value:"all",label:"All"},{value:"buy",label:"Buys"},{value:"sell",label:"Sells"}],ku=[{value:"all",label:"All"},{value:"dev",label:"DEV"},{value:"tracked",label:"TRACKED"},{value:"you",label:"YOU"}];function Bs({activities:e,isLoading:t,sortBy:o,sortDirection:r="desc",onSortByChange:s,typeFilter:n="all",onTypeFilterChange:i,traderFilter:l="all",onTraderFilterChange:a,youWalletAddress:d,currency:m="usd",onCurrencyChange:c,onLoadMore:u,hasMore:p,now:f=Date.now(),nativeDecimals:k=9,nativeSymbol:g="SOL",className:h,onRowClick:x}){let y=hu(e,l,d);return jsxs("div",{className:cn("flex flex-col",h),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-1",children:[gu.map(b=>jsx("button",{type:"button",onClick:()=>i?.(b.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",n===b.value?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value)),jsx("span",{className:"mx-1 h-3 w-px bg-default-200","aria-hidden":true}),ku.map(b=>{let v=l===b.value,T=b.value==="you"&&!d;return jsx("button",{type:"button",disabled:T,onClick:()=>a?.(b.value),className:cn("rounded px-2 py-1 text-[11px] transition-colors",v?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground",T&&"cursor-not-allowed opacity-50"),children:b.label},b.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(bu,{value:m,nativeSymbol:g,onChange:c}),jsx("div",{className:"flex items-center gap-1",children:fu.map(b=>{let v=o===b.value,T=v&&r==="desc"?"asc":v&&r==="asc"?void 0:"desc",L=T?b.value:void 0;return jsx("button",{type:"button",onClick:()=>s(L,T),className:cn("rounded px-2 py-1 text-[11px] transition-colors",v?"bg-default-100 text-foreground":"text-default-400 hover:text-foreground"),children:b.label},b.value)})})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[780px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Side"}),jsx("th",{className:"w-[25%] px-3 py-2 text-left font-normal",children:"Trader"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"USD"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Price"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Gas"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"Age"})]})}),jsxs("tbody",{children:[y.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-8 text-center text-default-400",children:"No activities"})}),y.map(b=>jsx(yu,{activity:b,now:f,nativeDecimals:k,nativeSymbol:g,currency:m,onRowClick:x},b.txHash)),t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),p&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:u,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function xu(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function hu(e,t,o){if(t==="all")return e;if(t==="you"){if(!o)return [];let s=o.toLowerCase();return e.filter(n=>n.walletAddress?.toLowerCase()===s)}if(t==="dev")return e.filter(s=>s.traderTags?.some(n=>n==="dev"));let r=new Set(["kol","smart","bluechip"]);return e.filter(s=>s.traderTags?.some(n=>r.has(n)))}function bu({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[22px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Tu(e,t,o){if(!e)return "--";let r=Number(e)/Math.pow(10,t);return Number.isFinite(r)?`${formatAmount(r)} ${o}`:"--"}function yu({activity:e,now:t,nativeDecimals:o,nativeSymbol:r,currency:s,onRowClick:n}){let i=xu(e),l=e.type==="buy"?"Buy":e.type==="sell"?"Sell":e.type.replace(/_/g," "),a=e.type==="buy"?"text-bullish":e.type==="sell"?"text-bearish":"text-default-500";return jsxs("tr",{className:cn("border-b border-default-50 hover:bg-default-50/60",n&&"cursor-pointer"),onClick:n?()=>n(e):void 0,children:[jsx("td",{className:cn("px-3 py-2 align-middle font-medium capitalize",a),children:l}),jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"font-mono text-[11px] text-default-500",children:Te(e.walletAddress,6,6)}),jsx(Wr,{tags:e.traderTags,max:2})]})}),jsxs("td",{className:"px-3 py-2 text-right align-middle",children:[formatAmount(i.amount)," ",i.symbol]}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s==="native"&&i.amountInNative?`${formatAmount(i.amountInNative)} ${i.symbol}`:i.amountInUsd?formatAmountInUsd(i.amountInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:i.priceInUsd?`$${formatPrice(i.priceInUsd)}`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Tu(e.gasFee,o,r)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:Pe(e.time,t)})]})}var vu=500;function tr({sortBy:e,sortDirection:t,typeFilter:o}){return {getKey:er,compare:(r,s)=>Cu(r,s,e,t),include:r=>Nu(r,o),merge:(r,s,n)=>n.incomingSource==="live"?{item:s,placement:"incoming"}:n.previousSource==="live"?{item:r,placement:"previous"}:{item:r,placement:"previous"},maxLiveItems:vu}}function _s(e){return Object.freeze({cursor:null,generation:e,mode:"replace"})}function Ks(e=tr({sortDirection:"desc",typeFilter:"all"})){let{snapshot:t}=createRealtimeCursorCollection(e);return {collection:t,request:_s(t.generation)}}function Ct(e,t,o){let{reduce:r}=createRealtimeCursorCollection(o);switch(t.type){case "reset":{let s=r(e.collection,{type:"reset"});return {collection:s,request:_s(s.generation)}}case "load-more":return Su(e);case "live":return t.items.length===0?e:{collection:r(e.collection,{type:"live",items:t.items}),request:e.request};case "page":return t.request.mode==="append"&&t.nextCursor===e.collection.nextCursor?e:{collection:r(e.collection,{type:"page",mode:t.request.mode,generation:t.request.generation,items:t.items,nextCursor:t.nextCursor,hasNextPage:t.hasNextPage}),request:e.request};default:return t}}function Su(e){let{collection:t,request:o}=e;return !t.hasNextPage||t.nextCursor==null||o.mode==="append"&&o.cursor===t.nextCursor&&o.generation===t.generation?e:{collection:t,request:Object.freeze({cursor:t.nextCursor,generation:t.generation,mode:"append"})}}function Nu(e,t){return t==="all"?true:e.type===t}function Cu(e,t,o,r){let n=(o??"timestamp")==="totalUsd"?jo(Ws(e),Ws(t)):jo(so(e),so(t)),i=Es(n,r);if(i!==0)return i;let l=Es(jo(so(e),so(t)),"desc");return l!==0?l:er(e).localeCompare(er(t))}function Es(e,t){return t==="asc"?e:-e}function jo(e,t){return e<t?-1:e>t?1:0}function so(e){let t=e.time instanceof Date?e.time.getTime():new Date(e.time).getTime();return Number.isFinite(t)?t:0}function Ws(e){let t=e.type==="sell"?e.from:e.to,o=Number(t.amountInUsd);return Number.isFinite(o)?o:0}function er(e){return e.txHash}function zs({chain:e,address:t,limit:o=50,initialSortBy:r,initialSortDirection:s="desc",initialTypeFilter:n="all"}){let[i,l]=useState(r),[a,d]=useState(s),[m,c]=useState(n),u=useMemo(()=>tr({sortBy:i,sortDirection:a,typeFilter:m}),[i,a,m]),p=useRef(u);p.current=u;let[f,k]=useState(()=>Ks(u)),g=useRef(true),h=useCallback(()=>{k(P=>Ct(P,{type:"reset"},p.current));},[]),x=useCallback((P,Q)=>{let pt=Q??(P===i?a:"desc");P===i&&pt===a||(l(P),d(pt),h());},[i,a,h]),y=useCallback(P=>{P!==a&&(d(P),h());},[a,h]),b=useCallback(P=>{P!==m&&(c(P),h());},[m,h]);useEffect(()=>{if(g.current){g.current=false;return}h();},[e,t,h]);let v=m==="all"?void 0:m,{collection:T,request:L}=f,A=useMemo(()=>({chain:e,address:t,cursor:L.cursor??void 0,limit:o,sortBy:i,sortDirection:a,type:v}),[e,t,L,o,i,a,v]),{data:N,isPending:_,isFetching:ge}=useTokenActivitiesQuery(A);useEffect(()=>{N&&k(P=>Ct(P,{type:"page",request:L,items:N.data,nextCursor:N.endCursor??null,hasNextPage:!!N.hasNext},u));},[N,L,u]),useTokenActivitiesSubscription({chain:e,address:t},P=>{P?.length&&k(Q=>Ct(Q,{type:"live",items:P},u));});let E=useMemo(()=>T.items.slice(),[T]),W=!!(T.hasNextPage&&T.nextCursor),ke=useCallback(()=>{k(P=>Ct(P,{type:"load-more"},u));},[u]);return {activities:E,isLoading:_||ge,sortBy:i,sortDirection:a,setSortBy:x,setSortDirection:y,typeFilter:m,setTypeFilter:b,hasMore:W,loadMore:ke}}function WS({chain:e,address:t,limit:o,initialSortBy:r,initialSortDirection:s,initialTypeFilter:n,initialTraderFilter:i="all",initialCurrency:l="usd",youWalletAddress:a,nativeDecimals:d,nativeSymbol:m,className:c,onRowClick:u}){let[p,f]=useState(i),[k,g]=useState(l),{activities:h,isLoading:x,sortBy:y,sortDirection:b,setSortBy:v,typeFilter:T,setTypeFilter:L,hasMore:A,loadMore:N}=zs({chain:e,address:t,limit:o,initialSortBy:r,initialSortDirection:s,initialTypeFilter:n});return jsx(Bs,{activities:h,isLoading:x,sortBy:y,sortDirection:b,onSortByChange:v,typeFilter:T,onTypeFilterChange:L,traderFilter:p,onTraderFilterChange:f,youWalletAddress:a,currency:k,onCurrencyChange:g,hasMore:A,onLoadMore:N,className:c,nativeDecimals:d,nativeSymbol:m,onRowClick:u})}function Gs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.traders??0,n=r?.buyers??0,i=r?.sellers??0;return jsx(je,{className:o,label:`Traders (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function Xs(e,t){return U(e,t)}function tN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Xs(e,t);return jsx(Gs,{stats:s?.stats,resolution:o,className:r})}function Ys({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.trades??0,n=r?.buys??0,i=r?.sells??0;return jsx(je,{className:o,label:`Transactions (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(n),sellsFormatted:formatAmount(i),totalValue:s,buysValue:n})}function Js(e,t){return U(e,t)}function kN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=Js(e,t);return jsx(Ys,{stats:s?.stats,resolution:o,className:r})}function Zs({stats:e,resolution:t,className:o}){let r=e?.[t],s=r?.volumesInUsd??"0",n=r?.buyVolumesInUsd??"0",i=r?.sellVolumesInUsd??"0";return jsx(je,{className:o,label:`Volume (${t})`,totalFormatted:formatAmountInUsd(s),buysFormatted:formatAmountInUsd(n),sellsFormatted:formatAmountInUsd(i),totalValue:s,buysValue:n})}function js(e,t){return U(e,t)}function IN({chain:e,address:t,resolution:o="24h",className:r}){let{token:s}=js(e,t);return jsx(Zs,{stats:s?.stats,resolution:o,className:r})}function ei({security:e,externalUrl:t,externalLabel:o,className:r}){let s=[{title:"Transfer fee",value:e?.hasTransferFee,safeWhen:false,description:"Whether the token charges a fee on transfer."},{title:"Fee not upgradable",value:e?.isTransferFeeUpgradable,safeWhen:false,description:"Whether the transfer fee can be raised by the token owner."},{title:"Transferable",value:e?.isTransferable,safeWhen:true,description:"Whether token holders can freely transfer the token."},{title:"Not freezable",value:e?.isFreezable,safeWhen:false,description:"Whether the token authority can freeze holder balances."},{title:"Not closable",value:e?.isClosable,safeWhen:false,description:"Whether the token program can be closed by its owner."}],n=s.every(i=>i.value!==void 0&&i.value===i.safeWhen);return jsxs("section",{className:cn("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Security"}),jsx("span",{className:cn("text-xs",e===void 0?"text-default-400":n?"text-success-500":"text-danger-500"),children:e===void 0?"--":n?"Safe":"Review"})]}),jsx("div",{className:"flex flex-col",children:s.map(i=>jsx(Uu,{...i},i.title))}),t&&o&&jsx("div",{className:"flex justify-center",children:jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"text-xs text-default-400 transition-colors hover:text-foreground",children:o})})]})}function Uu({title:e,value:t,safeWhen:o,description:r}){let s=t!==void 0&&t===o,n=t===void 0?"--":s?"OK":"Risk";return jsxs("div",{className:"flex h-8 items-center justify-between gap-2",children:[jsx("span",{className:"text-xs text-default-500",title:r,children:e}),jsx("span",{className:cn("text-xs",t===void 0?"text-default-400":s?"text-success-500":"text-danger-500"),children:n})]})}function ti(e,t){let{data:o,isLoading:r}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:r}}function $N({chain:e,address:t,externalUrl:o,externalLabel:r,className:s}){let{security:n}=ti(e,t);return jsx(ei,{security:n,externalUrl:o,externalLabel:r,className:s})}function ni({token:e,className:t}){return e?jsxs("section",{className:cn("flex w-full flex-col gap-2",t),children:[jsxs("div",{className:"text-sm font-medium text-foreground",children:["About ",e.symbol]}),e.description?jsx("p",{className:"whitespace-pre-line text-xs text-default-500",children:e.description}):jsx("p",{className:"text-xs text-default-400",children:"No description provided."})]}):null}function si(e,t){return U(e,t)}function sC({chain:e,address:t,className:o}){let{token:r}=si(e,t);return jsx(ni,{token:r,className:o})}function li({liquidities:e,totalTvlInUsd:t,collapseAt:o=3,className:r,onPoolClick:s}){let[n,i]=useState(!e||e.length<=o),l=useCallback(()=>i(a=>!a),[]);return jsxs("section",{className:cn("flex w-full flex-col gap-3",r),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:"Liquidity"}),t&&jsx("span",{className:"text-xs text-foreground",children:formatAmountInUsd(t)})]}),(!e||e.length===0)&&jsx("div",{className:"py-4 text-center text-xs text-default-400",children:"No pools"}),e&&e.length>0&&jsxs("div",{className:"flex flex-col gap-2",children:[e.map((a,d)=>jsxs("div",{className:cn("flex h-10 w-full items-center justify-between overflow-hidden text-xs",d>=o&&!n&&"hidden",s&&"cursor-pointer hover:bg-default-50"),onClick:s?()=>s(a):void 0,children:[jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-foreground",children:a.protocolFamily??a.protocolName??"Unknown"}),a.poolAddress&&jsxs("span",{className:"font-mono text-[10px] text-default-400",children:["Pool: ",Te(a.poolAddress,6,6)]})]}),jsx("div",{className:"text-default-500",children:formatAmountInUsd(a.tvlInUsd??0)})]},a.poolAddress??`${a.protocolFamily}-${d}`)),e.length>o&&jsx("div",{className:"flex justify-center pt-1",children:jsx("button",{type:"button",onClick:l,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:n?"Show less":"Show more"})})]})]})}function di(e,t){return U(e,t)}function vC({chain:e,address:t,collapseAt:o,className:r,onPoolClick:s}){let{token:n}=di(e,t);return jsx(li,{liquidities:n?.liquidities,totalTvlInUsd:n?.marketData?.tvlInUsd,collapseAt:o,className:r,onPoolClick:s})}function ci({cexes:e,collapseAt:t=4,className:o}){let[r,s]=useState(!e||e.length<=t),n=useCallback(()=>s(i=>!i),[]);return !e||e.length===0?null:jsxs("section",{className:cn("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"CEX listings"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((i,l)=>{let a=l>=t&&!r,d=jsx(Chip,{startContent:i.logo?jsx(Image,{src:i.logo,width:20,height:20,alt:i.name}):void 0,className:cn("bg-default-100 text-xs",a&&"hidden"),children:i.name},i.id);return i.url?jsx("a",{href:i.url,target:"_blank",rel:"noreferrer noopener",className:cn(a&&"hidden"),children:d},i.id):d})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:n,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:r?"Show less":"Show more"})})]})}function mi(e){return {cexes:e}}function DC({cexes:e,collapseAt:t,className:o}){let{cexes:r}=mi(e);return jsx(ci,{cexes:r,collapseAt:t,className:o})}function pi({categories:e,collapseAt:t=4,className:o,onCategoryClick:r}){let[s,n]=useState(!e||e.length<=t),i=useCallback(()=>n(l=>!l),[]);return !e||e.length===0?null:jsxs("section",{className:cn("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:"Categories"}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((l,a)=>{let d=a>=t&&!s;return jsx(Chip,{size:"sm",className:cn("bg-default-100",d&&"hidden",r&&"cursor-pointer"),onClick:r?()=>r(l):void 0,children:l},l)})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:i,className:"rounded px-2 py-1 text-xs text-default-400 transition-colors hover:text-foreground",children:s?"Show less":"Show more"})})]})}function fi(e,t){return U(e,t)}function JC({chain:e,address:t,collapseAt:o,className:r,onCategoryClick:s}){let{token:n}=fi(e,t);return jsx(pi,{categories:n?.tags,collapseAt:o,className:r,onCategoryClick:s})}var gi=["5m","1h","4h","24h"];function ki({stats:e,resolution:t,className:o}){let r=e?.[t],s=new SafeBigNumber(r?.buyVolumesInUsd??0),n=new SafeBigNumber(r?.sellVolumesInUsd??0),i=s.plus(n),l=s.minus(n),a=i.eq(0)?50:Math.min(100,Math.max(0,s.div(i).times(100).toNumber())),d=[{label:`${t} Vol`,value:formatAmountInUsd(i.toString()),className:"text-foreground"},{label:"Buys",value:formatAmountInUsd(s.toString()),className:"text-bullish"},{label:"Sells",value:formatAmountInUsd(n.toString()),className:"text-bearish"},{label:"Net Vol.",value:formatAmountInUsd(l.abs().toString()),className:l.gte(0)?"text-bullish":"text-bearish"}];return jsxs("div",{className:cn("flex h-full w-full flex-col",o),children:[jsx("div",{className:"grid flex-1 grid-cols-4 items-center",children:d.map(m=>jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:m.label}),jsx("span",{className:cn("text-[13px] font-medium leading-none tabular-nums",m.className),children:m.value})]},m.label))}),jsx("div",{className:"relative h-[2px] w-full overflow-hidden bg-bearish",children:jsx("div",{className:"absolute inset-y-0 left-0 bg-bullish transition-[width] duration-200 ease-out",style:{width:`${a}%`}})})]})}function xi({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn("grid h-full w-full grid-cols-4 items-center",o),children:t.map(r=>{let n=e?.[r]?.priceChange,i=n?new SafeBigNumber(n):void 0,l=i?i.gte(0):void 0,a=r,d=i?formatPercent(i,{showPlusGtThanZero:true}):"\u2014";return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:a}),jsx("span",{className:cn("text-[13px] font-medium leading-none tabular-nums",l===void 0?"text-foreground":l?"text-bullish":"text-bearish"),children:d})]},r)})})}function hi({chain:e,address:t}){let{data:o,isLoading:r}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:r}}function pw({chain:e,address:t,baseResolution:o="5m",hoverResolutions:r=gi,height:s=64,className:n}){let{stats:i}=hi({chain:e,address:t});return jsx(StatsFlipPanel,{className:n,height:s,base:jsx(ki,{stats:i,resolution:o}),hover:jsx(xi,{stats:i,resolutions:r})})}function bi({positions:e,isLoading:t,hasMore:o,onLoadMore:r,currency:s="usd",onCurrencyChange:n,showHidden:i=false,onShowHiddenChange:l,nativeSymbol:a="Native",renderActions:d,className:m}){return jsxs("div",{className:cn("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:"Positions"}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:i,onChange:c=>l?.(c.target.checked)}),"Show Hidden"]})]}),jsx(ap,{value:s,nativeSymbol:a,onChange:n})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[720px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[26%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Bought"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Sold"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Remaining"}),jsx("th",{className:"w-[18%] px-3 py-2 text-right font-normal",children:"PnL"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Actions"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No open positions"})}),e.map(c=>jsx(lp,{position:c,currency:s,renderActions:d},`${c.chain}:${c.address}`)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function ap({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function lp({position:e,currency:t,renderActions:o}){let{bought:r,sold:s,remaining:n,pnl:i}=useMemo(()=>dp(e,t),[e,t]),l=jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:l}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n}),jsx("td",{className:cn("px-3 py-2 text-right align-middle font-medium",i.isPositive===void 0?"text-default-400":i.isPositive?"text-bullish":"text-bearish"),children:jsxs("div",{className:"flex flex-col items-end leading-tight",children:[jsx("span",{children:i.amount}),i.ratio?jsx("span",{className:"text-[10px]",children:i.ratio}):null]})}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function dp(e,t){let o=t==="usd"?e.buyVolumesInUsd:e.buyVolumes,r=t==="usd"?e.sellVolumesInUsd:e.sellVolumes,s=t==="usd"?e.amountInUsd:e.amount,n=e.totalProfitInUsd,i=t==="usd"?formatAmountInUsd(o??0):formatAmount(o??0),l=t==="usd"?formatAmountInUsd(r??0):formatAmount(r??0),a=t==="usd"?formatAmountInUsd(s??0):formatAmount(s??0),d=n?new SafeBigNumber(n):void 0,m=d?d.gte(0):void 0,c=d?(m?"+":"")+formatAmountInUsd(d.toString()):"--",u=e.totalProfitRatio?formatPercent(e.totalProfitRatio,{showPlusGtThanZero:true}):void 0;return {bought:i,sold:l,remaining:a,pnl:{amount:c,ratio:u,isPositive:m}}}function vi({chain:e,wallet:t,limit:o=50,initialShowHidden:r=false}){let[s,n]=useState(void 0),[i,l]=useState([]),[a,d]=useState(r);useEffect(()=>{n(void 0),l([]);},[e,t]);let m=useMemo(()=>({chain:e,address:t??"",cursor:s,limit:o,positionState:"open"}),[e,t,s,o]),{data:c,isPending:u,isFetching:p}=useWalletTokenPositionsQuery(m,{enabled:!!t});useEffect(()=>{c&&l(x=>s==null?[c]:x[x.length-1]?.endCursor===c.endCursor?x:[...x,c]);},[c,s]);let f=useMemo(()=>i.flatMap(x=>x.portfolios),[i]),k=i[i.length-1],g=!!(k?.hasNext&&k.endCursor),h=useCallback(()=>{!k?.endCursor||!k.hasNext||n(k.endCursor);},[k]);return {positions:f,isLoading:!!t&&(u||p),hasMore:g,loadMore:h,showHidden:a,setShowHidden:d}}function Iw({chain:e,wallet:t,limit:o,initialCurrency:r="usd",nativeSymbol:s,renderActions:n,className:i}){let[l,a]=useState(r),{positions:d,isLoading:m,hasMore:c,loadMore:u,showHidden:p,setShowHidden:f}=vi({chain:e,wallet:t,limit:o});return jsx(bi,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:u,currency:l,onCurrencyChange:a,showHidden:p,onShowHiddenChange:f,nativeSymbol:s,renderActions:n})}function Ni({orders:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,stateFilter:n,onStateFilterChange:i,onlyThisToken:l=false,onOnlyThisTokenChange:a,tokenSymbol:d,currency:m="usd",onCurrencyChange:c,nativeSymbol:u="Native",onCancelAll:p,renderActions:f,className:k}){return jsxs("div",{className:cn("flex flex-col",k),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"active",label:"Active Orders"},{k:"history",label:"Order History"}].map(g=>jsx("button",{type:"button",onClick:()=>i(g.k),className:cn("rounded px-2 transition-colors",n===g.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:g.label},g.k))}),d?jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:l,onChange:g=>a?.(g.target.checked)}),"Only ",d]}):null]}),jsxs("div",{className:"flex items-center gap-2",children:[p?jsx("button",{type:"button",onClick:p,className:"rounded px-2 py-1 text-[11px] text-bearish transition-colors hover:bg-default-100",children:"Cancel All"}):null,jsx(bp,{value:m,nativeSymbol:u,onChange:c})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[760px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[22%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:"Type"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Amount"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Current MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Target MC"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Settings"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:"Action"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:7,className:"py-10 text-center text-default-400",children:"Limit orders are coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsxs("td",{colSpan:7,className:"py-10 text-center text-default-400",children:["No ",n==="active"?"active":"historical"," orders"]})}):e.map(g=>jsx(Tp,{order:g,currency:m,renderActions:f},g.id)),t&&!o&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function bp({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-default-400 hover:text-foreground"),children:s.label},s.k))})}function Tp({order:e,currency:t,renderActions:o}){let r=useMemo(()=>t==="usd"&&e.amountInUsd?formatAmountInUsd(e.amountInUsd):formatAmount(e.amount),[t,e.amount,e.amountInUsd]),s=e.side==="buy"?"Buy":"Sell",n=e.side==="buy"?"text-bullish":"text-bearish";return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.tokenImage??void 0,name:(e.tokenSymbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsx("span",{className:"truncate text-foreground",children:e.tokenSymbol??"--"})]})}),jsx("td",{className:cn("px-3 py-2 align-middle font-medium",n),children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:e.currentMarketCapInUsd?formatMCapInUsd(e.currentMarketCapInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:e.targetMarketCapInUsd?formatMCapInUsd(e.targetMarketCapInUsd):e.targetPriceInUsd?formatPriceInUsd(e.targetPriceInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.slippage!=null?`Slip ${e.slippage}%`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-default-400",children:"--"})})]})}function vp(e){return e instanceof Error&&e.code==="NotImplemented"}function Sp(e){return e==="active"?"active":"filled"}function Pi({chain:e,wallet:t,tokenAddress:o,limit:r=50,initialStateFilter:s="active",initialOnlyThisToken:n=false}){let[i,l]=useState(s),[a,d]=useState(n),[m,c]=useState(void 0),[u,p]=useState([]);useEffect(()=>{c(void 0),p([]);},[e,t,i,a,o]);let f=useCallback(N=>{N!==i&&l(N);},[i]),k=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:r,state:Sp(i),tokenAddress:a?o:void 0}),[e,t,m,r,i,a,o]),{data:g,isPending:h,isFetching:x,error:y}=useWalletLimitOrdersQuery(k,{enabled:!!t});useEffect(()=>{g&&p(N=>m==null?[g]:N[N.length-1]?.endCursor===g.endCursor?N:[...N,g]);},[g,m]);let b=!!y&&vp(y),v=useMemo(()=>u.flatMap(N=>N.data),[u]),T=u[u.length-1],L=!!(T?.hasNext&&T.endCursor),A=useCallback(()=>{!T?.endCursor||!T.hasNext||c(T.endCursor);},[T]);return {orders:v,isLoading:!!t&&!b&&(h||x),unavailable:b,hasMore:L,loadMore:A,stateFilter:i,setStateFilter:f,onlyThisToken:a,setOnlyThisToken:d}}function Xw({chain:e,wallet:t,tokenAddress:o,tokenSymbol:r,limit:s,initialStateFilter:n="active",initialCurrency:i="usd",nativeSymbol:l,onCancelAll:a,renderActions:d,className:m}){let[c,u]=useState(i),{orders:p,isLoading:f,unavailable:k,hasMore:g,loadMore:h,stateFilter:x,setStateFilter:y,onlyThisToken:b,setOnlyThisToken:v}=Pi({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:n});return jsx(Ni,{className:m,orders:p,isLoading:f,unavailable:k,hasMore:g,onLoadMore:h,stateFilter:x,onStateFilterChange:y,onlyThisToken:b,onOnlyThisTokenChange:v,tokenSymbol:r,currency:c,onCurrencyChange:u,nativeSymbol:l,onCancelAll:k?void 0:a,renderActions:d})}function Ai({traders:e,isLoading:t,hasMore:o,onLoadMore:r,onlyTracked:s=false,onOnlyTrackedChange:n,now:i=Date.now(),renderAddress:l,className:a}){let{t:d}=useTranslation();return jsxs("div",{className:cn("flex flex-col",a),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsx("span",{className:"text-xs font-medium text-default-500",children:d("tokens.tokenDetail.topTraders")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-default-400",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:m=>n?.(m.target.checked)}),"Only Tracked"]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[680px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Wallet"}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:"Tags"}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:"Value"}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"Realized PnL"}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:"Last active"})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No top traders yet"})}),e.map(m=>jsx(Rp,{trader:m,now:i,renderAddress:l},m.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:r,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Rp({trader:e,now:t,renderAddress:o}){let r=useMemo(()=>o?o(e.address):jsx("span",{className:"font-mono text-[11px] text-default-500",children:Te(e.address,6,6)}),[e.address,o]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:r}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Et,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountInUsd(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-500",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:formatAmountInUsd(e.totalRealizedPnlInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-default-400",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Mi({chain:e,address:t,limit:o=50,initialSortBy:r,initialSortDirection:s,initialOnlyTracked:n=false}){let[i,l]=useState(r),[a,d]=useState(s),[m,c]=useState(void 0),[u,p]=useState([]),[f,k]=useState(n),g=useCallback(()=>{c(void 0),p([]);},[]),h=useCallback((W,ke)=>{W===i&&ke===a||(l(W),d(ke),g());},[g,i,a]),x=useCallback(W=>{h(W,a??"desc");},[h,a]),y=useCallback(W=>{W!==a&&(d(W),g());},[g,a]);useEffect(()=>{g();},[e,t,g]);let b=useMemo(()=>({chain:e,address:t,cursor:m,limit:o,sortBy:i,sortDirection:a}),[e,t,m,o,i,a]),{data:v,isPending:T,isFetching:L}=useTokenTopTradersQuery(b);useEffect(()=>{v&&p(W=>m==null?[v]:W[W.length-1]?.endCursor===v.endCursor?W:[...W,v]);},[v,m]);let A=useMemo(()=>u.flatMap(W=>W.data),[u]),N=useMemo(()=>f?A.filter(W=>W.tags&&W.tags.length>0):A,[A,f]),_=u[u.length-1],ge=!!(_?.hasNext&&_.endCursor),E=useCallback(()=>{!_?.endCursor||!_.hasNext||c(_.endCursor);},[_]);return {traders:N,isLoading:T||L,sortBy:i,sortDirection:a,setSortBy:x,setSortDirection:y,setSort:h,hasMore:ge,loadMore:E,onlyTracked:f,setOnlyTracked:k}}function gL({chain:e,address:t,limit:o,className:r,renderAddress:s}){let{traders:n,isLoading:i,hasMore:l,loadMore:a,onlyTracked:d,setOnlyTracked:m}=Mi({chain:e,address:t,limit:o});return jsx(Ai,{className:r,traders:n,isLoading:i,hasMore:l,onLoadMore:a,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}function Ui({tokens:e,isLoading:t,unavailable:o,hasMore:r,onLoadMore:s,renderTokenLink:n,className:i}){return jsxs("div",{className:cn("flex flex-col",i),children:[jsx("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Dev Tokens"})}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[700px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-default-400",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:"Token"}),jsx("th",{className:"w-[10%] px-3 py-2 text-center font-normal",children:"Migrated"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Market Cap"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:"ATH"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"Liquidity"}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:"1h Volume"})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-10 text-center text-default-400",children:"Dev tokens index is coming soon."})}):e.length===0&&!t?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-default-400",children:"No dev tokens"})}):e.map(l=>jsx(Fp,{token:l,renderTokenLink:n},`${l.chain}:${l.address}`)),!o&&t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-default-400",children:"Loading\u2026"})})]})]})}),!o&&r&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-default-600 transition-colors hover:bg-default-200 disabled:opacity-50",children:"Load more"})})]})}function Fp({token:e,renderTokenLink:t}){let o=e.marketData?.marketCapInUsd??e.marketData?.marketCap,r=e.marketData?.tvlInUsd,n=e.stats?.["1h"]?.volumesInUsd,i=!!e.migratedTo,l=t?t(e):jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??e.name??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:l}),jsx("td",{className:"px-3 py-2 text-center align-middle",children:i?jsx("span",{className:"text-bullish",children:"\u2713"}):jsx("span",{className:"text-default-400",children:"\u2014"})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:o?formatMCapInUsd(o):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r?formatAmountInUsd(r):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n?formatAmountInUsd(n):"--"})]})}function Di({tokens:e,className:t}){let o=e.length,r=e.filter(l=>!!l.migratedTo).length,s=o===0?0:Math.round(r/o*100),n=e.map(l=>l.stats?.["1h"]?.volumesInUsd??"0").reduce((l,a)=>l.plus(new SafeBigNumber(a)),new SafeBigNumber(0)),i=e.map(l=>l.marketData?.marketCapInUsd??l.marketData?.marketCap??"0").reduce((l,a)=>l.plus(new SafeBigNumber(a)),new SafeBigNumber(0));return jsxs("div",{className:cn("flex flex-col gap-2 p-3",t),children:[jsx("div",{className:"flex items-center justify-between",children:jsx("span",{className:"text-xs font-medium text-default-500",children:"Token Stats"})}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(fo,{label:"Total",value:String(o)}),jsx(fo,{label:"Migrated",value:`${r} (${s}%)`}),jsx(fo,{label:"Total Market Cap",value:formatMCapInUsd(i.toString())}),jsx(fo,{label:"Total 1h Volume",value:formatAmountInUsd(n.toString())})]})]})}function fo({label:e,value:t}){return jsxs("div",{className:"flex flex-col gap-[2px]",children:[jsx("span",{className:"text-[10px] text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium text-foreground",children:t})]})}function Dp(e){return e instanceof Error&&e.code==="NotImplemented"}function Vi({chain:e,creator:t,limit:o=20}){let[r,s]=useState(void 0),[n,i]=useState([]),l=useCallback(()=>{s(void 0),i([]);},[]);useEffect(()=>{l();},[e,t,l]);let a=useMemo(()=>({chain:e,creator:t??"",cursor:r,limit:o}),[e,t,r,o]),{data:d,isPending:m,isFetching:c,error:u}=useTokensByCreatorQuery(a,{enabled:!!t});useEffect(()=>{d&&i(x=>r==null?[d]:x[x.length-1]?.endCursor===d.endCursor?x:[...x,d]);},[d,r]);let p=useMemo(()=>n.flatMap(x=>x.data),[n]),f=n[n.length-1],k=!!(f?.hasNext&&f.endCursor),g=!!u&&Dp(u),h=useCallback(()=>{!f?.endCursor||!f.hasNext||s(f.endCursor);},[f]);return {tokens:p,isLoading:!!t&&!g&&(m||c),unavailable:g,hasMore:k,loadMore:h}}function IL({chain:e,creator:t,limit:o,showSummary:r=false,renderTokenLink:s,className:n}){let{tokens:i,isLoading:l,unavailable:a,hasMore:d,loadMore:m}=Vi({chain:e,creator:t,limit:o});return jsxs("div",{className:n,children:[jsx(Ui,{tokens:i,isLoading:l,unavailable:a,hasMore:d,onLoadMore:m,renderTokenLink:s}),r&&!a?jsx(Di,{tokens:i}):null]})}function zi({token:e,athInUsd:t,athAt:o,globalFeesPaidInUsd:r,rank:s,onTogglePin:n,pinned:i,className:l}){let a=e?.marketData?.priceInUsd,d=e?.marketData?.tvlInUsd,m=e?.marketData?.totalSupply;return jsxs("div",{className:cn("flex h-[48px] w-full flex-row items-center gap-4 overflow-x-auto px-3 text-[12px]",l),children:[jsx(it,{label:"Price",value:a?formatPriceInUsd(a):"--"}),jsx(it,{label:"Liquidity",value:d?formatAmountInUsd(d):"--"}),jsx(it,{label:"Supply",value:m?formatAmount(m):"--"}),r?jsx(it,{label:"Fees Paid",value:formatAmountInUsd(r)}):null,t?jsx(it,{label:"ATH",value:formatPriceInUsd(t),title:o?`All-time high at ${o.toLocaleDateString()}`:void 0}):null,s!==void 0?jsx(it,{label:"Rank",value:`#${s}`}):null,jsx("div",{className:"flex-1"}),n?jsx("button",{type:"button",onClick:n,"aria-pressed":i,className:cn("flex size-[26px] items-center justify-center rounded text-default-400 transition-colors hover:bg-default-100 hover:text-foreground",i&&"text-foreground"),title:i?"Unpin token":"Pin token",children:i?"\u2605":"\u2606"}):null]})}function it({label:e,value:t,title:o}){return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] whitespace-nowrap",title:o,children:[jsx("span",{className:"text-[10px] leading-none text-default-400",children:e}),jsx("span",{className:"text-[13px] font-medium leading-none tabular-nums text-foreground",children:t})]})}function Gi({chain:e,address:t}){return U(e,t)}function zL({chain:e,address:t,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:l,className:a}){let{token:d}=Gi({chain:e,address:t});return jsx(zi,{className:a,token:d,athInUsd:o,athAt:r,globalFeesPaidInUsd:s,rank:n,pinned:i,onTogglePin:l})}function Xi({tokens:e,isLoading:t,unavailable:o,onTokenClick:r,className:s}){return o?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"Similar tokens coming soon."}):!t&&e.length===0?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-default-400",s),children:"No similar tokens found."}):jsxs("ul",{className:cn("flex flex-col",s),children:[e.map(n=>jsxs("li",{className:cn("flex cursor-pointer items-center gap-2 border-b border-default-50 px-3 py-2 last:border-0 hover:bg-default-50/60",!r&&"cursor-default"),onClick:r?()=>r(n):void 0,children:[jsx(Avatar,{src:n.image??void 0,name:(n.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[jsx("span",{className:"truncate text-[12px] text-foreground",children:n.symbol}),jsx("span",{className:"truncate text-[10px] text-default-400",children:n.name})]}),jsx("span",{className:"text-[11px] tabular-nums text-default-500",children:n.marketData?.marketCapInUsd?formatMCapInUsd(n.marketData.marketCapInUsd):"--"})]},`${n.chain}:${n.address}`)),t&&jsx("li",{className:"py-2 text-center text-[11px] text-default-400",children:"Loading\u2026"})]})}function Yi({chain:e,address:t,keyword:o,limit:r=10}){let s=!!o&&o.length>0,{data:n,isPending:i,isFetching:l}=useSearchTokensQuery({chains:[e],keyword:o,limit:r+1},{enabled:s});return {tokens:useMemo(()=>{if(!n)return [];let d=t.toLowerCase();return (n.data??[]).filter(m=>m.address.toLowerCase()!==d).slice(0,r)},[n,t,r]),isLoading:s&&(i||l),unavailable:!s}}function lP({chain:e,address:t,keyword:o,limit:r,onTokenClick:s,className:n}){let{tokens:i,isLoading:l,unavailable:a}=Yi({chain:e,address:t,keyword:o,limit:r});return jsx(Xi,{className:n,tokens:i,isLoading:l,unavailable:a,onTokenClick:s})}function Ji({tokens:e=[],unavailable:t=true,onTokenClick:o,className:r}){return t?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"Image-similarity search is coming soon."}):e.length===0?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-default-400",r),children:"No reused-image tokens found."}):jsx("div",{className:cn("flex flex-row flex-wrap gap-2 p-3",r),children:e.map(s=>jsx("button",{type:"button",onClick:o?()=>o(s):void 0,className:"flex size-10 items-center justify-center overflow-hidden rounded-full border border-default-100 transition-opacity hover:opacity-80",title:s.symbol,children:jsx(Avatar,{src:s.image??void 0,name:(s.symbol??"?").slice(0,1),className:"size-full bg-default-100 text-[10px] text-default-400",showFallback:true})},`${s.chain}:${s.address}`))})}function Zi(e){return {tokens:[],isLoading:false,unavailable:true}}function yP({chain:e,address:t,onTokenClick:o,className:r}){let{tokens:s,unavailable:n}=Zi();return jsx(Ji,{className:r,tokens:s,unavailable:n,onTokenClick:o})}function ra({keywords:e,excludeKeywords:t,onKeywordsChange:o,onExcludeKeywordsChange:r,className:s}){let{t:n}=useTranslation(),[i,l]=useState(e?.join(", ")??""),[a,d]=useState(t?.join(", ")??"");useEffect(()=>{l(u=>{let p=ko(u);return p===void 0&&e===void 0?u:p===void 0?e?.join(", ")??"":e===void 0?"":p.join("")===e.join("")?u:e.join(", ")});},[e]),useEffect(()=>{d(u=>{let p=ko(u);return p===void 0&&t===void 0?u:p===void 0?t?.join(", ")??"":t===void 0?"":p.join("")===t.join("")?u:t.join(", ")});},[t]);let m=useCallback(u=>{l(u),o?.(ko(u));},[o]),c=useCallback(u=>{d(u),r?.(ko(u));},[r]);return jsxs("div",{className:cn("grid grid-cols-2 gap-3 px-4",s),children:[jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:i,onValueChange:m})]}),jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-neutral",children:n("tokens.filters.keywords.exclude.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:n("tokens.filters.keywords.placeholder"),value:a,onValueChange:c})]})]})}function ko(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function da({protocols:e,selectedProtocols:t=[],onSelectedProtocolsChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useMemo(()=>e.every(m=>n.includes(m)),[e,n]),a=useCallback(()=>{if(l){let m=[];i(m),o?.(m);}else {let m=[...e];i(m),o?.(m);}},[e,o,l]),d=useCallback(m=>()=>{if(n.includes(m)){let c=n.filter(u=>u!==m);i(c),o?.(c);}else {let c=[...n,m];i(c),o?.(c);}},[n,o]);return jsxs("div",{className:cn("flex flex-col gap-3 px-4",r),children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-xs text-neutral",children:s("tokens.filters.protocols.title")}),jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",onPress:a,children:s(l?"tokens.filters.protocols.unselectAll":"tokens.filters.protocols.selectAll")})]}),jsx("div",{className:"grid grid-cols-3 gap-3",children:e.map(m=>{let c=Oe(m);return jsx(Button,{variant:"bordered",size:"sm",radius:"full",className:cn("w-fit h-6 px-2.5",c.text,c.bg5,"border",c.border,{"opacity-40 data-[hover=true]:!opacity-30":!n.includes(m)}),startContent:jsx(Image,{width:14,height:14,src:`/images/protocols/${m}.svg`,alt:formatTokenProtocolName(m)}),onPress:d(m),children:formatTokenProtocolName(m)},m)})})]})}function Ne({title:e,field:t,value:o,onChange:r}){let{t:s}=useTranslation(),[n,i]=useState(o?Tr(o).min:NaN),[l,a]=useState(o?Tr(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),a(NaN);else {let{min:c,max:u}=Tr(o);i(c),a(u);}},[o]);let d=useCallback(c=>{i(c),r?.(pa(t,c,l));},[t,r,l]),m=useCallback(c=>{a(c),r?.(pa(t,n,c));},[t,r,n]);return jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx("h3",{className:"text-xs text-neutral",children:e}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(StyledNumberInput,{value:n,onValueChange:d,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.min"),"aria-label":`${e} min`}),jsx(StyledNumberInput,{value:l,onValueChange:m,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.max"),"aria-label":`${e} max`})]})]})}function Tr(e){if(e.operator==="between"){let[t,o]=e.value;return {min:t,max:o}}return e.operator==="gte"?{min:e.value,max:NaN}:e.operator==="lte"?{min:NaN,max:e.value}:{min:NaN,max:NaN}}function pa(e,t,o){if(!(isNaN(t)&&isNaN(o)))return isNaN(t)?{field:e,operator:"lte",value:o}:isNaN(o)?{field:e,operator:"gte",value:t}:{field:e,operator:"between",value:[t,o]}}function ga({values:e,onValuesChange:t,className:o}){let{t:r}=useTranslation(),[s,n]=useState(e);useEffect(()=>{n(e);},[e]);let i=useCallback(l=>a=>{if(a===void 0){let d=(s??[]).filter(m=>m.field!==l);d=d.length>0?d:void 0,n(d),t?.(d);}else {let d=[...(s??[]).filter(m=>m.field!==l),a];n(d),t?.(d);}},[s,t]);return jsxs("div",{className:cn("flex flex-col gap-4",o),children:[jsx(Ne,{field:"holders",title:r("tokens.filters.stats.audits.holders"),value:s?.find(l=>l.field==="holders"),onChange:i("holders")}),jsx(Ne,{field:"top10Ratio",title:r("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(l=>l.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(Ne,{field:"top100Ratio",title:r("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(l=>l.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(Ne,{field:"creatorsRatio",title:r("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(l=>l.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function ka({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useCallback(a=>d=>{if(d===void 0){let m=(n??[]).filter(c=>c.field!==a);m=m.length>0?m:void 0,i(m),o?.(m);}else {let m=[...(n??[]).filter(c=>c.field!==a),d];i(m),o?.(m);}},[n,o]);return jsxs("div",{className:cn("flex flex-col gap-4",r),children:[jsx(Ne,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:n?.find(a=>a.field==="marketCap"),onChange:l("marketCap")}),jsx(Ne,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:n?.find(a=>a.field==="tvl"),onChange:l("tvl")}),jsx(Ne,{field:`volumes${e}`,title:s("tokens.filters.stats.metrics.volumes",{resolution:s(`common.resolution.${e}`)}),value:n?.find(a=>a.field===`volumes${e}`),onChange:l(`volumes${e}`)}),jsx(Ne,{field:`trades${e}`,title:s("tokens.filters.stats.metrics.txns",{resolution:s(`common.resolution.${e}`)}),value:n?.find(a=>a.field===`trades${e}`),onChange:l(`trades${e}`)})]})}function va({resolution:e,values:t,onValuesChange:o,className:r}){let{t:s}=useTranslation(),[n,i]=useState("audits"),[l,a]=useState(t);useEffect(()=>{a(t);},[t]);let d=useCallback(u=>{a(u),o?.(u);},[o]),m=useMemo(()=>{let u=["holders","top10Ratio","top100Ratio","creatorsRatio"];return l?.filter(p=>u.includes(p.field))?.length??0},[l]),c=useMemo(()=>{let u=["marketCap","tvl",`volumes${e}`,`trades${e}`];return l?.filter(p=>u.includes(p.field)).length??0},[l,e]);return jsxs("div",{className:cn("flex flex-col gap-3 px-4",r),children:[jsxs(StyledLightTabs,{color:"default",radius:"full",size:"sm",selectedKey:n,onSelectionChange:i,children:[jsx(Tab,{title:m===0?s("tokens.filters.stats.audits"):jsx(StyledBadge,{color:"primary",size:"sm",content:m,shape:"circle",children:s("tokens.filters.stats.audits")})},"audits"),jsx(Tab,{title:c===0?s("tokens.filters.stats.metrics"):jsx(StyledBadge,{color:"primary",size:"sm",content:c,shape:"circle",children:s("tokens.filters.stats.metrics")})},"metrics")]}),jsx(ga,{values:l,onValuesChange:d,className:cn({hidden:n!=="audits"})}),jsx(ka,{values:l,onValuesChange:d,resolution:e,className:cn({hidden:n!=="metrics"})})]})}function No({protocols:e,resolution:t,filters:o,onFiltersChange:r,className:s}){let[n,i]=useState(Sa(o?.filters,e));useEffect(()=>{i(Sa(o?.filters,e));},[o?.filters,e]);let[l,a]=useState(o?.keywords);useEffect(()=>{a(o?.keywords);},[o?.keywords]);let[d,m]=useState(o?.excludeKeywords);useEffect(()=>{m(o?.excludeKeywords);},[o?.excludeKeywords]);let[c,u]=useState(o?.filters);useEffect(()=>{u(o?.filters);},[o?.filters]);let p=useCallback(h=>{i(h),r?.(So(e,h,l,d,c));},[e,l,d,c,r]),f=useCallback(h=>{a(h),r?.(So(e,n,h,d,c));},[e,n,d,c,r]),k=useCallback(h=>{m(h),r?.(So(e,n,l,h,c));},[e,n,l,c,r]),g=useCallback(h=>{u(h),r?.(So(e,n,l,d,h));},[e,n,l,d,r]);return jsxs("div",{className:cn("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx(da,{protocols:e,selectedProtocols:n,onSelectedProtocolsChange:p}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}})]}),jsx(ra,{keywords:l,excludeKeywords:d,onKeywordsChange:f,onExcludeKeywordsChange:k}),jsx("div",{style:{height:1,background:"rgba(39,39,42,1)"}}),jsx(va,{resolution:t,values:c,onValuesChange:g})]})}function Sa(e,t){let o=e?.find(r=>r.field==="launchedFromProtocolFamily");return o?o.operator==="in"?o.value:(console.warn("invalid token protocols filter",o),[...t||[]]):[...t||[]]}function So(e,t,o,r,s){let n=s?[...s.filter(i=>i.field!=="launchedFromProtocolFamily")]:[];return e&&e.length>0&&(e.every(l=>t.includes(l))||n.push({field:"launchedFromProtocolFamily",operator:"in",value:t})),o===void 0&&r===void 0&&n.length===0?void 0:{keywords:o,excludeKeywords:r,filters:n.length>0?n:void 0}}function La({protocols:e,resolution:t,filters:o,onFiltersChange:r,triggerVariant:s="default",badgePlacement:n="outer",className:i}){let{t:l}=useTranslation(),{isOpen:a,onOpen:d,onClose:m,onOpenChange:c}=useDisclosure(),[u,p]=useState(o),f=useCallback(()=>{p(void 0);},[]),k=useCallback(()=>{r?.(u),m();},[u,r,m]);useEffect(()=>{p(o);},[a,o]);let g=useMemo(()=>Object.values(o||{}).every(h=>h===void 0),[o]);return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:i,onClick:d,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:9999,border:s==="plain"?"none":"1px solid rgba(63,63,70,0.5)",background:s==="plain"?"transparent":"rgba(39,39,42,0.6)",width:32,height:32,minHeight:32,padding:0,cursor:"pointer",position:"relative"},children:[jsx(FilterIcon,{width:16,height:16,className:"text-zinc-400"}),!g&&jsx("span",{style:{position:"absolute",top:n==="icon"?6:-2,right:n==="icon"?6:-2,width:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),jsx(StyledModal,{isOpen:a,onOpenChange:c,size:"md",scrollBehavior:"inside",children:jsxs(ModalContent,{className:"w-full h-full",children:[jsx(ModalHeader,{className:"px-4 py-2",children:jsx("span",{className:"text-base font-semibold",children:l("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(No,{protocols:e,resolution:t,filters:u,onFiltersChange:p,className:"pb-4"})})}),jsx(ModalFooter,{className:"px-4",children:jsxs("div",{className:"w-full flex justify-between items-center",children:[jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:f,children:l("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:k,children:l("common.apply")})]})})]})})]})}var Ia={display:"inline-flex",alignItems:"center",gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",fontSize:14,fontWeight:700,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s",height:32},Vf={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},_f={height:1,background:"rgba(39,39,42,1)",margin:0};function Ma({protocols:e,resolution:t,filters:o,onFiltersChange:r,iconOnly:s=false,className:n}){let{t:i}=useTranslation(),[l,a]=useState(false),d=useRef(null),[m,c]=useState(o),u=useCallback(()=>{c(void 0);},[]),p=useCallback(()=>{r?.(m),a(false);},[m,r]);useEffect(()=>{c(o);},[l,o]),useEffect(()=>{let k=g=>{d.current&&!d.current.contains(g.target)&&a(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]),useEffect(()=>{if(!l)return;let k=g=>{g.key==="Escape"&&a(false);};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let f=useMemo(()=>Object.values(o||{}).every(k=>k===void 0),[o]);return jsxs("div",{ref:d,style:{position:"relative"},children:[jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxs("button",{type:"button",className:n,style:s?{...Ia,justifyContent:"center",gap:0,width:32,minWidth:32,padding:0}:Ia,onMouseEnter:k=>{k.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:k=>{k.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>a(k=>!k),children:[jsx(FilterIcon,{width:16,height:16,className:"flex-none"}),!s&&jsxs(Fragment,{children:[jsx("span",{className:"hidden sm:block",children:i("tokens.listHeader.filter")}),jsx(Kf,{open:l})]})]}),!f&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),l&&jsxs("div",{style:{...Vf,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(No,{protocols:e,resolution:t,filters:m,onFiltersChange:c})})}),jsx("div",{style:_f}),jsxs("div",{style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Button,{variant:"light",size:"sm",color:"default",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:u,children:i("common.reset")}),jsx(Button,{variant:"solid",size:"sm",color:"primary",radius:"full",onPress:p,children:i("common.apply")})]})]})]})}function Kf({open:e}){return jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function p2({popoverPlacement:e="bottom-end",iconOnly:t,className:o,desktopOverlay:r="popover",...s}){let{isMobile:n}=useScreen();return n||r==="modal"?jsx(La,{className:o,...s}):jsx(Ma,{placement:e,iconOnly:t,className:o,...s})}function Ua({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),s=useCallback(n=>{t?.(n);},[t]);return jsx(StyledPlainTabs,{color:"primary",radius:"lg",selectedKey:e,onSelectionChange:s,"aria-label":"Select Resolution",classNames:{tabList:"gap-0",tab:"px-2",tabContent:"!text-zinc-500 group-data-[hover=true]:!text-foreground group-data-[selected=true]:!text-primary"},children:o.map(n=>jsx(Tab,{title:r(`common.resolution.${n}`)},n))})}var rg={display:"inline-flex",alignItems:"center",gap:4,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"0 10px",fontSize:12,fontWeight:500,color:"#d4d4d8",cursor:"pointer",height:32,minHeight:32},ng={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:6,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden",padding:"6px",minWidth:"100%"};function Oa({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:r}=useTranslation(),[s,n]=useState(false),i=useRef(null),l=useCallback(a=>{t?.(a),n(false);},[t]);return useEffect(()=>{if(!s)return;let a=m=>{i.current&&!i.current.contains(m.target)&&n(false);},d=m=>{m.key==="Escape"&&n(false);};return document.addEventListener("mousedown",a),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",d);}},[s]),jsxs("div",{ref:i,style:{position:"relative",zIndex:50},children:[jsxs("button",{type:"button",style:rg,onClick:()=>n(a=>!a),children:[jsx("span",{children:e?r(`common.resolution.${e}`):"\u2014"}),jsx(ChevronDownIcon,{width:14,height:14,className:"text-zinc-500",style:{transition:"transform 0.15s",transform:s?"rotate(180deg)":void 0}})]}),s&&jsx("div",{style:ng,children:o.map(a=>jsx("button",{type:"button",onClick:()=>l(a),className:cn("w-full text-left px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer",a===e?"text-primary bg-primary/10":"text-zinc-400 hover:text-foreground hover:bg-zinc-800"),children:r(`common.resolution.${a}`)},a))})]})}function A2(e){let{isMobile:t}=useScreen();return t?jsx(Oa,{...e}):jsx(Ua,{...e})}var Ea=memo(function({token:t}){let o=useMemo(()=>t.marketData?.athMarketCapInUsd,[t.marketData?.athMarketCapInUsd]);return jsx(Fragment,{children:formatMCapInUsd(o)})});var Va=memo(function({token:t}){let{t:o}=useTranslation(),r=useMemo(()=>t.marketData?.bluechipHoldingsRatio,[t.marketData?.bluechipHoldingsRatio]),s=useMemo(()=>r!==void 0&&new SafeBigNumber(r).gte(.1),[r]),n=useMemo(()=>r===void 0||new SafeBigNumber(r).lt(.05),[r]);return jsx(StyledTooltip,{content:o("tokens.bluechip.explained"),children:jsxs("div",{className:"flex items-center gap-2.5",children:[s&&jsx(HorsePowerHighIcon,{}),n&&jsx(HorsePowerLowIcon,{}),!s&&!n&&jsx(HorsePowerIcon,{}),jsx("span",{className:cn(s&&"text-bullish",!s&&!n&&"text-bearish",r===void 0&&"text-neutral"),children:formatPercent(r)})]})})});function Hg(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var Ga=memo(function({token:t}){let o=useCopyToClipboard(),[r,s]=useState(false),[n,i]=useState(false),l=useRef(void 0),a=useRef(void 0),{t:d}=useTranslation(),m=useCallback(p=>{p.preventDefault(),p.stopPropagation(),o(t.name,()=>{toast.success(d("tokens.copied.name")),s(true),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(false);},2e3);});},[o,t.name,d]),c=useCallback(p=>{p.preventDefault(),p.stopPropagation(),o(t.address,()=>{toast.success(d("tokens.copied.address")),i(true),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(false);},2e3);});},[o,t.address,d]);useEffect(()=>()=>{l.current&&clearTimeout(l.current),a.current&&clearTimeout(a.current);},[]);let u=useTickAge(t.createdAt);return jsxs("div",{className:"w-full flex justify-start items-center gap-3",children:[jsx(xe,{token:t,showProgress:false,className:"w-10 h-10 sm:w-16 sm:h-16 flex-none"}),jsxs("div",{className:"flex-auto flex flex-col gap-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"flex-none font-medium tracking-[-0.02em]",children:t.symbol}),jsx(StyledTooltip,{content:t.name,children:jsxs("div",{className:"flex-initial flex items-center gap-1 min-w-0 text-neutral hover:text-primary-200 cursor-pointer",onClick:m,children:[jsx("div",{className:"flex-initial whitespace-nowrap truncate",children:t.name}),r?jsx(CheckIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"}):jsx(CopyIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"})]})})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-primary text-xs sm:text-sm font-medium",children:formatAge(u)}),jsxs("button",{type:"button",className:"group flex items-center gap-1 min-w-0 max-w-28 sm:max-w-36 text-neutral hover:text-primary-200 cursor-pointer",onClick:c,"aria-label":d("tokens.copied.address"),children:[jsx("span",{className:"min-w-0 truncate text-left text-xs font-mono text-neutral/70 group-hover:text-primary-200",children:Hg(t.address)}),n?jsx(CheckIcon,{className:"flex-none w-3 h-3"}):jsx(CopyIcon,{className:"flex-none w-3 h-3"})]}),t.socialMedias?.website&&jsx(Link,{href:t.socialMedias.website,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.twitter&&jsx(Link,{href:t.socialMedias.twitter,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TwitterIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.telegram&&jsx(Link,{href:t.socialMedias.telegram,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(TelegramIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.discord&&jsx(Link,{href:t.socialMedias.discord,className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(DiscordIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),jsx(Link,{href:searchTwitterUrl(`${t.symbol} OR ${t.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",children:jsx(SearchIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})]})});var Xa=memo(function({token:t}){let{t:o}=useTranslation(),r=t.marketData,s=useMemo(()=>new SafeBigNumber(r?.top10HoldingsRatio).gte(.1),[r?.top10HoldingsRatio]),n=useMemo(()=>new SafeBigNumber(r?.devHoldingsRatio).gte(.1),[r?.devHoldingsRatio]),i=useMemo(()=>new SafeBigNumber(r?.sniperHoldingsRatio).gte(.1),[r?.sniperHoldingsRatio]),l=useMemo(()=>new SafeBigNumber(r?.insiderHoldingsRatio).gte(.1),[r?.insiderHoldingsRatio]),a=useMemo(()=>new SafeBigNumber(r?.bundleHoldingsRatio).gte(.1),[r?.bundleHoldingsRatio]);return jsxs("div",{className:"w-full h-full flex flex-col gap-1 justify-center",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(PeopleIcon,{width:12,height:12}),value:formatAmount(r?.holders),tooltip:o("tokens.tokenInfo.holders"),warning:false,disable:!r?.holders}),jsx($,{icon:jsx(KlineCandlesIcon,{width:12,height:12}),value:formatAmount(r?.proHolders),tooltip:o("tokens.tokenInfo.proHolders"),warning:false,disable:!r?.proHolders}),jsx($,{icon:jsx(StarIcon,{width:12,height:12}),value:formatAmount(r?.kolHolders),tooltip:o("tokens.tokenInfo.kolHolders"),warning:false,disable:!r?.kolHolders}),jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(r?.top10HoldingsRatio),tooltip:o("tokens.tokenInfo.top10HoldingsRatio"),warning:s,disable:!r?.top10HoldingsRatio||r?.top10HoldingsRatio==="0"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(r?.devHoldingsRatio),tooltip:o("tokens.tokenInfo.devHoldingsRatio"),warning:n,disable:!r?.devHoldingsRatio||r?.devHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(r?.sniperHoldingsRatio),tooltip:o("tokens.tokenInfo.sniperHoldingsRatio"),warning:i,disable:!r?.sniperHoldingsRatio||r?.sniperHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(r?.insiderHoldingsRatio),tooltip:o("tokens.tokenInfo.insiderHoldingsRatio"),warning:l,disable:!r?.insiderHoldingsRatio||r?.insiderHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(r?.bundleHoldingsRatio),tooltip:o("tokens.tokenInfo.bundleHoldingsRatio"),warning:a,disable:!r?.bundleHoldingsRatio||r?.bundleHoldingsRatio==="0",tooltipPlacement:"bottom"})]})]})});var Ya=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountInUsd(o)})});var Ja=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatMCapInUsd(o)})});var el=memo(function({token:t,resolution:o}){let r=useMemo(()=>t.marketData?.priceInUsd,[t.marketData?.priceInUsd]),s=useMemo(()=>t.stats?.[o]?.priceChange,[t,o]),n=useMemo(()=>s?new SafeBigNumber(s).abs().toString():void 0,[s]),i=useMemo(()=>s&&new SafeBigNumber(s).gte(0),[s]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatPriceInUsd(r)}),jsxs("span",{className:cn("inline-flex gap-1 items-center text-xs",i?"text-bullish":"text-bearish"),children:[i?jsx(TriangleUpIcon,{width:10,height:10}):jsx(TriangleDownIcon,{width:10,height:10}),jsx("span",{children:formatPercent(n)})]})]})});var ol=memo(function({token:t,resolution:o}){let r=t.stats?.[o],s=r?.traders,n=r?.buyers,i=r?.sellers;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(n)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(i)})]})]})});var nl=memo(function({token:t,resolution:o}){let r=t.stats?.[o],s=r?.trades,n=r?.buys,i=r?.sells;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmount(n)}),"/",jsx("span",{className:"text-bearish",children:formatAmount(i)})]})]})});var il=memo(function({token:t,resolution:o}){let r=t.stats?.[o],s=r?.volumesInUsd,n=r?.buyVolumesInUsd,i=r?.sellVolumesInUsd;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmountInUsd(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-bullish",children:formatAmountInUsd(n)}),"/",jsx("span",{className:"text-bearish",children:formatAmountInUsd(i)})]})]})});var dk=`
|
|
21
|
+
`})]})}function er({token:e,renderAction:t,isLast:o=false,onSelectToken:n,className:s}){let{t:r}=useTranslation(),i=useCopyToClipboard(),l=useTickAge(e.createdAt),a=e.marketData,d=e.stats?.["1h"],m=useCallback(()=>{n?.(e);},[n,e]),c=useCallback(E=>{E.stopPropagation(),i(e.address,()=>toast.success(r("tokens.copied.address")));},[i,e.address,r]),u=useMemo(()=>d?.volumesInUsd,[d?.volumesInUsd]),p=useMemo(()=>d?.buyVolumesInUsd,[d?.buyVolumesInUsd]),x=useMemo(()=>d?.sellVolumesInUsd,[d?.sellVolumesInUsd]),f=useMemo(()=>d?.trades,[d?.trades]),g=useMemo(()=>a?.marketCapInUsd,[a?.marketCapInUsd]),h=useMemo(()=>a?.tvlInUsd,[a?.tvlInUsd]),k=useMemo(()=>{let E=new SafeBigNumber(g);return E.lt(1e3)?"text-foreground":E.lt(1e6)?"text-secondary":"text-primary"},[g]),T=useMemo(()=>new SafeBigNumber(a?.top10HoldingsRatio).gte(.1),[a?.top10HoldingsRatio]),v=useMemo(()=>new SafeBigNumber(a?.devHoldingsRatio).gte(.1),[a?.devHoldingsRatio]),b=useMemo(()=>new SafeBigNumber(a?.insiderHoldingsRatio).gte(.1),[a?.insiderHoldingsRatio]),y=useMemo(()=>new SafeBigNumber(a?.sniperHoldingsRatio).gte(.1),[a?.sniperHoldingsRatio]),L=useMemo(()=>new SafeBigNumber(a?.bundleHoldingsRatio).gte(.1),[a?.bundleHoldingsRatio]),A=a?.holders!==void 0&&a.holders>0,N=a?.proHolders!==void 0&&a.proHolders>0,K=a?.kolHolders!==void 0&&a.kolHolders>0,fe=A||N||K;return jsxs("div",{className:cn("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",s),style:{borderBottom:o?"none":"1px solid var(--color-border-subtle)"},onClick:n?m:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(ke,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:true,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-text-muted hover:text-foreground leading-none",onClick:c,"aria-label":r("tokens.copied.address"),title:r("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:c,"aria-label":r("tokens.copied.address"),title:r("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-text-muted truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-text-muted"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-text-muted",children:formatAge(l)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-text-muted hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-text-muted hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-text-muted hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",onClick:E=>E.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-text-muted",children:"MC"}),jsx("span",{className:cn(k),children:formatMCapInUsd(g)})]}),jsx("span",{className:"text-text-muted/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-text-muted",children:r("tokens.listHeader.liqShort")}),jsx("span",{children:formatAmountInUsd(h)})]})]}),fe&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-text-muted leading-none",children:[A&&jsx(StyledTooltip,{content:r("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(a?.holders)]})}),N&&jsx(StyledTooltip,{content:r("tokens.tokenInfo.proHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(KlineCandlesIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(a?.proHolders)]})}),K&&jsx(StyledTooltip,{content:r("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(StarIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(a?.kolHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsx("div",{className:"flex flex-col items-end gap-1",children:jsx("span",{className:cn("text-base font-bold leading-none",k),children:formatMCapInUsd(g)})}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-text-muted",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountInUsd(u)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-positive",children:formatAmountInUsd(p)}),jsx("span",{className:"text-text-muted/50 mx-0.5",children:"/"}),jsx("span",{className:"text-negative",children:formatAmountInUsd(x)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-text-muted",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(f)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(a?.top10HoldingsRatio),tooltip:r("tokens.tokenInfo.top10HoldingsRatio"),warning:T,disable:!a?.top10HoldingsRatio||a?.top10HoldingsRatio==="0"}),jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(a?.devHoldingsRatio),tooltip:r("tokens.tokenInfo.devHoldingsRatio"),warning:v,disable:!a?.devHoldingsRatio||a?.devHoldingsRatio==="0"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(a?.sniperHoldingsRatio),tooltip:r("tokens.tokenInfo.sniperHoldingsRatio"),warning:y,disable:!a?.sniperHoldingsRatio||a?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(a?.insiderHoldingsRatio),tooltip:r("tokens.tokenInfo.insiderHoldingsRatio"),warning:b,disable:!a?.insiderHoldingsRatio||a?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(a?.bundleHoldingsRatio),tooltip:r("tokens.tokenInfo.bundleHoldingsRatio"),warning:L,disable:!a?.bundleHoldingsRatio||a?.bundleHoldingsRatio==="0"})]})}),t&&jsx("div",{className:"flex-none relative",onClick:E=>E.stopPropagation(),children:t(e)})]})]})}var bd=152,or=10;function vd({index:e,style:t,data:o,skeletonCount:n,renderItemAction:s,onSelectToken:r}){if(!o)return jsx("div",{style:t,children:jsx(Uo,{isLast:e===n-1})});let i=o[e];return i?jsx("div",{style:t,children:jsx(er,{token:i,isLast:e===o.length-1,renderAction:s,onSelectToken:r})}):jsx("div",{style:t,children:jsx(Uo,{isLast:e===o.length-1})})}function Ge({title:e,tokens:t,isLoading:o,itemHeight:n=bd,renderHeaderExtra:s,renderItemAction:r,onSelectToken:i,onPauseChange:l,onScrollingChange:a,className:d,hideHeader:m}){let c=o||!t?void 0:t,u=c?c.length:or,p=useMemo(()=>({data:c,skeletonCount:or,renderItemAction:r,onSelectToken:i}),[c,r,i]),[x,f]=useState(false),g=useRef(void 0),h=useRef(false),k=useCallback(()=>{f(true),l?.(true);},[l]),T=useCallback(()=>{f(false),l?.(false);},[l]),v=useCallback(()=>{h.current||(h.current=true,a?.(true)),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=false,a?.(false);},180);},[a]);return useEffect(()=>()=>{g.current&&clearTimeout(g.current),h.current&&a?.(false);},[a]),jsxs("div",{className:cn("w-full h-full bg-surface-base overflow-hidden flex flex-col border border-border-subtle/60 rounded-lg",d),onMouseEnter:k,onMouseLeave:T,children:[!m&&jsx(Bn,{title:e,isPaused:x,extra:s}),jsx("div",{className:"flex-1 w-full overflow-hidden",onScrollCapture:v,children:jsx(List,{className:"h-full w-full",rowCount:u,rowHeight:n,rowComponent:vd,rowProps:p,overscanCount:10})})]})}function Wo(e,t){let o={...e};for(let n of Object.keys(t))t[n]!==void 0&&(o[n]=t[n]);return o}var Nd=["1m","5m","15m","30m","1h","4h","24h"];function Cd(e,t){if(!t)return e;if(!e)return t;let o={...e};for(let n of Nd)t[n]&&(o[n]=e[n]?Wo(e[n],t[n]):t[n]);return o}function wd(e,t){return t?e?Wo(e,t):t:e}function $t(e,t){return t?e?Wo(e,t):t:e}function ee(e,t){let{chain:o,address:n,stats:s,marketData:r,socialMedias:i,security:l,launchedFrom:a,migratedTo:d,...m}=t,c={...e};for(let u of Object.keys(m))m[u]!==void 0&&(c[u]=m[u]);return c.stats=Cd(e.stats,s),c.marketData=wd(e.marketData,r),c.socialMedias=$t(e.socialMedias,i),c.security=$t(e.security,l),c.launchedFrom=$t(e.launchedFrom,a),c.migratedTo=$t(e.migratedTo,d),c}function zt(e,t){let o=new Map(e.map(n=>[n.address,n]));return t.map(n=>{let s=o.get(n.address);return s?ee(s,n):n})}function Ld(e){return e.chain!==void 0&&e.address!==void 0&&e.address!==""&&e.name!==void 0&&e.symbol!==void 0&&e.decimals!==void 0}function Re(e,t){if(t.length===0)return e;let o=[...e],n=false;for(let s of t){let r=o.findIndex(i=>i.address===s.address);if(r>=0){o[r]=ee(o[r],s),n=true;continue}Ld(s)&&(o.push(s),n=true);}return n?o:e}var Rd=["24h","12h","30m","15m","30s","15s","1m","5m","1h","4h","1s"],Ad=new Set(["price","marketCap","athMarketCap","tvl","holders","top10Holdings","top10Ratio","top100Holdings","top100Ratio","creatorsHoldings","creatorsRatio","createdAt","launchedFromProtocolFamily","migratedToProtocolFamily","tag"]),Id=new Set(["priceChange","volumes","trades","traders","buys","sells"]);function Y(e){if(e==null||e==="")return;let t=Number(e);return Number.isFinite(t)?t:void 0}function rr(e){for(let t of Rd){if(!e.endsWith(t))continue;let o=e.slice(0,-t.length);return o?{metric:o,resolution:t}:void 0}}function sr(e){if(Ad.has(e))return true;let t=rr(e);return t?Id.has(t.metric):false}function Qt(e,t){switch(t){case "price":return Y(e.marketData?.priceInUsd);case "marketCap":return Y(e.marketData?.marketCapInUsd);case "athMarketCap":return Y(e.marketData?.athMarketCapInUsd);case "tvl":return Y(e.marketData?.tvlInUsd);case "holders":return Y(e.marketData?.holders);case "top10Holdings":return Y(e.marketData?.top10Holdings);case "top10Ratio":return Y(e.marketData?.top10HoldingsRatio);case "top100Holdings":return Y(e.marketData?.top100Holdings);case "top100Ratio":return Y(e.marketData?.top100HoldingsRatio);case "creatorsHoldings":return Y(e.marketData?.devHoldings);case "creatorsRatio":return Y(e.marketData?.devHoldingsRatio);case "createdAt":return e.createdAt?.getTime();case "launchedFromProtocolFamily":return nr(e,e.launchedFrom?.protocolFamily);case "migratedToProtocolFamily":return nr(e,e.migratedTo?.protocolFamily);case "tag":return e.tags?.[0];}let o=rr(t);if(!o)return;let n=e.stats,s=n&&o.resolution in n?n[o.resolution]:void 0;switch(o.metric){case "priceChange":return Y(s?.priceChange);case "volumes":return Y(s?.volumesInUsd);case "trades":return Y(s?.trades);case "traders":return Y(s?.traders);case "buys":return Y(s?.buys);case "sells":return Y(s?.sells);default:return}}function nr(e,t){if(t)return parseTokenProtocolFamily(e.chain,t)??t}var Md=new Set(["top10Ratio","top100Ratio","creatorsRatio"]);function ir(e){let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Dd(e){return [e.name,e.symbol].filter(Boolean).join(" ").toLowerCase()}function Hd(e){return Array.isArray(e)?e:void 0}function Fd(e){return Array.isArray(e)?void 0:e}function ar(e,t){if(!Md.has(e))return t;let o=Number(t);return Number.isFinite(o)?o/100:t}function xe(e,t){let o=Fd(t);return o===void 0?void 0:ar(e,o)}function Vo(e,t){return Hd(t)?.map(o=>ar(e,o))}function Xe(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)?e-o:void 0}if(typeof e=="string")return e.localeCompare(String(t))}function Gt(e,t){if(typeof e=="number"){let o=Number(t);return Number.isFinite(o)&&e===o}return String(e)===String(t)}function Ud(e,t){if(!sr(t.field))return false;let o=Qt(e,t.field),n=o===void 0;if(t.operator==="isNull")return n;if(t.operator==="isNotNull")return !n;if(n)return false;switch(t.operator){case "eq":{let s=xe(t.field,t.value);return s!==void 0&&Gt(o,s)}case "ne":{let s=xe(t.field,t.value);return s!==void 0&&!Gt(o,s)}case "gt":{let s=xe(t.field,t.value),r=s!==void 0?Xe(o,s):void 0;return r!==void 0&&r>0}case "gte":{let s=xe(t.field,t.value),r=s!==void 0?Xe(o,s):void 0;return r!==void 0&&r>=0}case "lt":{let s=xe(t.field,t.value),r=s!==void 0?Xe(o,s):void 0;return r!==void 0&&r<0}case "lte":{let s=xe(t.field,t.value),r=s!==void 0?Xe(o,s):void 0;return r!==void 0&&r<=0}case "between":{let s=Vo(t.field,t.value);if(!s||s.length<2)return false;let r=Xe(o,s[0]),i=Xe(o,s[1]);return r!==void 0&&i!==void 0&&r>=0&&i<=0}case "in":{let s=Vo(t.field,t.value);return s?s.some(r=>Gt(o,r)):false}case "nin":{let s=Vo(t.field,t.value);return s?s.every(r=>!Gt(o,r)):false}case "contains":{let s=xe(t.field,t.value);return s!==void 0&&String(o).includes(String(s))}case "notContains":{let s=xe(t.field,t.value);return s!==void 0&&!String(o).includes(String(s))}case "startsWith":{let s=xe(t.field,t.value);return s!==void 0&&String(o).startsWith(String(s))}case "endsWith":{let s=xe(t.field,t.value);return s!==void 0&&String(o).endsWith(String(s))}default:return false}}function ae(e,t){let o=t?.keywords?.map(ir).filter(r=>r!==void 0),n=t?.excludeKeywords?.map(ir).filter(r=>r!==void 0),s=t?.filters;return !o?.length&&!n?.length&&!s?.length?e:e.filter(r=>{let i=Dd(r);return !(o?.length&&!o.some(l=>i.includes(l))||n?.length&&n.some(l=>i.includes(l))||s?.length&&!s.every(l=>Ud(r,l)))})}function le({applyUpdates:e,paused:t=false,flushInterval:o=500}){let n=useRef(e),s=useRef(t),r=useRef([]),i=useRef(void 0),l=useRef(void 0);n.current=e,s.current=t;let a=useCallback(()=>{i.current!==void 0&&(clearTimeout(i.current),i.current=void 0),l.current!==void 0&&(cancelAnimationFrame(l.current),l.current=void 0);},[]),d=useCallback(()=>{if(a(),s.current){i.current=setTimeout(d,o);return}let u=r.current;u.length!==0&&(r.current=[],n.current(u));},[a,o]),m=useCallback(()=>{i.current!==void 0||l.current!==void 0||(i.current=setTimeout(()=>{i.current=void 0,l.current=requestAnimationFrame(()=>{l.current=void 0,d();});},o));},[d,o]),c=useCallback(u=>{u.length!==0&&(r.current.push(...u),m());},[m]);return useEffect(()=>{t||d();},[d,t]),useEffect(()=>a,[a]),{enqueueUpdates:c,flush:d}}function ur({chain:e,tokens:t,onUpdate:o,enabled:n=true}){let s=useTokenMarketRuntime(),r=useRef(new Map),i=useRef(o);i.current=o;let l=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),a=useMemo(()=>l?l.split(","):[],[l]),d=()=>{r.current.forEach(m=>m()),r.current.clear();};useEffect(()=>d,[e,s,n]),useEffect(()=>{if(!n){d();return}let m=new Set(a),c=r.current;for(let[u,p]of c)m.has(u)||(p(),c.delete(u));for(let u of a){if(c.has(u))continue;let p=tokenMarketKey(e,u),x=s.subscribe(p,g=>{g.token&&i.current([g.token]);}),f=s.retain(p);c.set(u,()=>{x(),f();});}},[a,e,n,s]);}var Kd=80;function hr(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function _d(e,t,o){return e===t?o:e===o?t:o||t}function _o(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:_d(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function qd(e){return {...hr(_o(e)),...e.token??{},liquidities:_o(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function xr(e){return e.sort((t,o)=>{let n=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-n}),e.slice(0,Kd)}function Tr({chain:e,filters:t,isPaused:o=false,deferUpdates:n=false,updateFlushInterval:s}){let r=useMemo(()=>({chain:e}),[e]),i=useRef(o);i.current=o;let l=useRef(e),[a,d]=useState(true),[m,c]=useState([]);useEffect(()=>{e!==l.current&&(d(true),c([]),l.current=e);},[e]);let{data:u,isPending:p}=useNewPoolsQuery(r);useEffect(()=>{u&&(c(T=>{let v=i.current,b=T.length===0&&u.length>0,y=[...T];for(let L of u){let A=qd(L),N=y.findIndex(K=>K.address===A.address);N>=0?y[N]=ee(y[N],A):(!v||b)&&y.push(A);}return v?y:xr(y)}),d(false));},[u]);let x=useCallback(T=>{c(v=>{let b=i.current,y=[...v],L=false;for(let A of T){let N=y.findIndex(K=>K.address===A.address);N>=0?(L=true,y[N]=ee(y[N],A)):b||(L=true,y.push(hr(A)));}return L?b?y:xr(y):v});},[]),{enqueueUpdates:f}=le({applyUpdates:x,paused:n,flushInterval:s}),g=useCallback(T=>{f(T.map(_o));},[f]);useNewPoolsSubscription({chain:e},g),useNewTokensMetadataSubscription({chain:e},f),ur({chain:e,tokens:m,onUpdate:f});let h=useMemo(()=>p||a,[p,a]);return {tokens:useMemo(()=>ae(m,t),[m,t]),isLoading:h}}function hT({chain:e,filters:t,title:o,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=Tr({chain:e,filters:t,isPaused:a,deferUpdates:m}),x=useCallback(f=>{d(f);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,onPauseChange:x,onScrollingChange:c,className:i,hideHeader:l})}function he({chain:e,tokens:t,onUpdate:o,enabled:n=true}){let s=useTokenMarketRuntime(),r=useRef(new Map),i=useRef(o);i.current=o;let l=useMemo(()=>Array.from(new Set(t.map(m=>m.address.trim()).filter(Boolean))).sort().join(","),[t]),a=useMemo(()=>l?l.split(","):[],[l]),d=()=>{r.current.forEach(m=>m()),r.current.clear();};useEffect(()=>d,[e,s,n]),useEffect(()=>{if(!n){d();return}let m=new Set(a),c=r.current;for(let[u,p]of c)m.has(u)||(p(),c.delete(u));for(let u of a){if(c.has(u))continue;let p=tokenMarketKey(e,u),x=s.subscribe(p,g=>{g.token&&i.current([g.token]);}),f=s.retain(p);c.set(u,()=>{x(),f();});}},[a,e,n,s]);}function Lr({chain:e,filters:t,isPaused:o=false,refetchInterval:n=3e4,deferUpdates:s=false,updateFlushInterval:r}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,u]=useState([]);useEffect(()=>{e!==a.current&&(m(true),u([]),a.current=e);},[e]);let{data:p,isPending:x}=useMigratedTokensQuery(i,{refetchInterval:n});useEffect(()=>{p&&(u(T=>{let v=l.current,b=[...T];for(let y of p){let L=b.findIndex(A=>A.address===y.address);L>=0?b[L]=ee(b[L],y):v||b.unshift(y);}return b}),m(false));},[p]);let f=useCallback(T=>{u(v=>Re(v,T));},[]),{enqueueUpdates:g}=le({applyUpdates:f,paused:s,flushInterval:r});he({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>x||d,[x,d]);return {tokens:useMemo(()=>ae(c,t),[c,t]),isLoading:h}}function FT({chain:e,filters:t,title:o,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=Lr({chain:e,filters:t,isPaused:a,deferUpdates:m}),x=useCallback(f=>{d(f);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,onPauseChange:x,onScrollingChange:c,className:i,hideHeader:l})}function tc(e){return e.sort((t,o)=>{let n=Number(t.migrateProgress??0);return Number(o.migrateProgress??0)-n})}function Mr({chain:e,filters:t,isPaused:o=false,refetchInterval:n=15e3,deferUpdates:s=false,updateFlushInterval:r}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(o);l.current=o;let a=useRef(e),[d,m]=useState(true),[c,u]=useState([]);useEffect(()=>{e!==a.current&&(m(true),u([]),a.current=e);},[e]);let{data:p,isPending:x}=useFinalStretchTokensQuery(i,{refetchInterval:n});useEffect(()=>{p&&(u(T=>{let v=l.current,b=T.length===0&&p.length>0,y=[...T];for(let L of p){let A=y.findIndex(N=>N.address===L.address);A>=0?y[A]=ee(y[A],L):(!v||b)&&y.push(L);}return v?y:tc(y)}),m(false));},[p]);let f=useCallback(T=>{u(v=>Re(v,T));},[]),{enqueueUpdates:g}=le({applyUpdates:f,paused:s,flushInterval:r});he({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>x||d,[x,d]);return {tokens:useMemo(()=>ae(c,t),[c,t]),isLoading:h}}function XT({chain:e,filters:t,title:o,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,className:i,hideHeader:l}){let[a,d]=useState(false),[m,c]=useState(false),{tokens:u,isLoading:p}=Mr({chain:e,filters:t,isPaused:a,deferUpdates:m}),x=useCallback(f=>{d(f);},[]);return jsx(Ge,{title:o,tokens:u,isLoading:p,renderHeaderExtra:n,renderItemAction:s,onSelectToken:r,onPauseChange:x,onScrollingChange:c,className:i,hideHeader:l})}var dc=10,cc="liberfi:search_histories";function gt(){return createBrowserSearchHistoryStorage({key:cc,fallback:createMemorySearchHistoryStorage()})}function mc(e,t){return e.length===t.length&&e.every((o,n)=>o===t[n])}function Fr(){let e=useMemo(()=>gt(),[]),t=useRef(e.read()),o=()=>{let i=e.read();return mc(t.current,i)?t.current:(t.current=i,i)},n=useSyncExternalStore(e.subscribe,o,o),s=useCallback(i=>{let l=i.trim();if(!l)return;let a=e.read().filter(d=>d!==l);e.write([l,...a].slice(0,dc));},[e]),r=useCallback(()=>{e.clear();},[e]);return {histories:n,addHistory:s,clearHistories:r}}function Br({histories:e,onSelect:t,onClear:o,className:n}){let{t:s}=useTranslation();return e.length===0?null:jsxs("div",{className:cn("px-4 pb-4",n),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium",children:s("tokens.search.history")}),jsx(Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-text-muted",onPress:o,children:jsx(TrashIcon,{width:20,height:20})})]}),jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(r=>jsx(Chip,{size:"sm",variant:"bordered",className:cn("text-text-muted","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(r),children:r},r))})]})}function Er({onSelect:e,histories:t,onClear:o,className:n}){let s=Fr(),r=t?[...t]:s.histories,i=o??s.clearHistories;return jsx(Br,{className:cn(n),histories:r,onSelect:e,onClear:i})}var Nc=["ArrowDown","ArrowUp","Enter","Escape"];function Cc(e){return Nc.includes(e)}function Wr({value:e,onValueChange:t,onClear:o,onEscape:n,onNavigateKey:s,className:r}){let{t:i}=useTranslation();return jsx("div",{className:r,children:jsx(StyledInput,{autoFocus:true,variant:"bordered",radius:"full",value:e,onValueChange:t,onKeyDown:l=>{Cc(l.key)&&(l.key!=="Escape"&&l.preventDefault(),s?.(l.key));},placeholder:i("tokens.search.placeholder"),classNames:{inputWrapper:["!bg-surface-strong/60","!border-border-control/50","data-[hover=true]:!bg-surface-strong","group-data-[focus=true]:!bg-surface-strong","group-data-[focus=true]:!border-border-control/80"].join(" ")},startContent:jsx(SearchIcon,{width:20,height:20,className:"text-text-muted"}),endContent:e?jsx(Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-text-muted",onPress:o,children:jsx(XCloseIcon,{width:20,height:20})}):jsx(Kbd,{className:"min-w-8 justify-center text-xs text-text-muted bg-transparent border border-border-control/50 rounded-full cursor-pointer select-none",onMouseDown:l=>{l.preventDefault(),n?.();},children:i("common.escape")})})})}function Yt({token:e,highlighted:t=false,className:o}){let{t:n}=useTranslation(),s=useTickAge(e.createdAt),r=useMemo(()=>e.marketData?.priceInUsd,[e]),i=useMemo(()=>e.marketData?.marketCapInUsd,[e]),l=useMemo(()=>e.marketData?.tvlInUsd,[e]),a=useMemo(()=>e.stats?.["24h"]?.priceChange,[e]),d=useMemo(()=>a?new SafeBigNumber(a).abs().toString():void 0,[a]),m=useMemo(()=>a!=null&&new SafeBigNumber(a).gte(0),[a]);return jsxs("div",{className:cn("w-full h-full px-3 flex items-center justify-between gap-2","hover:cursor-pointer hover:bg-content2 rounded-lg",t&&"bg-content2",o),"data-highlighted":t?"true":"false","aria-selected":t,children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2.5",children:[jsx(ke,{token:e,className:"w-10 h-10 flex-none",showProtocolFamily:true,classNames:{searchIcon:"w-5 h-5"}}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"font-medium text-sm truncate",children:e.symbol}),jsx("span",{className:"text-xs text-primary font-medium",children:formatAge(s)})]}),jsxs("div",{className:"flex items-center gap-1 text-xs text-text-muted",children:[jsxs("span",{children:[n("tokens.listHeader.mcShort")," ",formatMCapInUsd(i)]}),jsx("span",{children:"/"}),jsxs("span",{children:[n("tokens.listHeader.liqShort")," ",formatAmountInUsd(l)]})]})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end",children:[jsx("span",{className:"text-xs",children:formatPriceInUsd(r)}),jsxs("span",{className:cn("inline-flex gap-0.5 items-center text-xs",m?"text-positive":"text-negative"),children:[m?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),jsx("span",{children:formatPercent(d)})]})]})]})}function Jt({className:e}){let{t}=useTranslation();return jsxs("div",{className:cn("h-9 px-3 flex items-center justify-between","text-xs font-medium text-text-muted","sticky top-0 z-10",e),children:[jsx("div",{className:"flex-1",children:jsxs("span",{children:[t("tokens.listHeader.token")," / ",t("tokens.listHeader.age")," /"," ",t("tokens.listHeader.marketCap")," /"," ",t("tokens.listHeader.liquidity")]})}),jsx("div",{className:"flex-none w-20 text-right",children:jsxs("span",{children:[t("tokens.listHeader.price")," / ",t("tokens.listHeader.24hChange")]})})]})}function Bc(){return jsxs("div",{className:"w-full h-14 px-3 flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[jsx(Skeleton,{className:"flex-none w-8 h-8 rounded-full"}),jsxs("div",{className:"flex flex-col gap-1.5",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-36 h-3 rounded-md"})]})]}),jsxs("div",{className:"flex-none w-20 flex flex-col items-end gap-1.5",children:[jsx(Skeleton,{className:"w-14 h-4 rounded-md"}),jsx(Skeleton,{className:"w-10 h-3 rounded-md"})]})]})}function jt({rows:e=6,className:t}){return jsx("div",{className:cn("w-full",t),children:Array.from({length:e}).map((o,n)=>jsx(Bc,{},n))})}function $r({keyword:e,chains:t,limit:o=50}){let n=useMemo(()=>({keyword:e,chains:t,limit:o}),[e,t,o]),{data:s,isLoading:r,isFetchingNextPage:i,hasNextPage:l,fetchNextPage:a}=useSearchTokensInfiniteQuery(n,{enabled:!!e}),d=useMemo(()=>s?.pages.flatMap(m=>m.data)??[],[s]);return {tokens:d,items:d,isLoading:r,isFetchingNextPage:i,hasNextPage:l??false,fetchNextPage:a}}var Xc=56;function Gr({onSelectToken:e,className:t,navigationRef:o,onEscape:n,...s}){let{tokens:r,isLoading:i,isFetchingNextPage:l,hasNextPage:a,fetchNextPage:d}=$r(s),m=useRef(null),{height:c}=useResizeObserver({ref:m}),u=useCallback(k=>k<r.length,[r]),p=useCallback(async()=>{a&&!l&&await d();},[a,l,d]),x=useMemo(()=>a?r.length+1:r.length,[r,a]),f=useInfiniteLoader({isRowLoaded:u,loadMoreRows:p,rowCount:x,threshold:5}),g=i?0:r.length,h=useSearchKeyboardNavigation({itemCount:g,hasNextPage:a&&!i,isFetchingNextPage:l,onSelectIndex:k=>{let T=r[k];T&&e?.(T);},onRequestNextPage:()=>{a&&!l&&d();},onEscape:()=>n?.()});return o&&(o.current=h),useEffect(()=>()=>{o&&o.current===h&&(o.current=null);},[h,o]),useEffect(()=>{h.reset();},[s.keyword,h]),i?jsxs("div",{className:cn("w-full",t),children:[jsx(Jt,{}),jsx(jt,{})]}):r.length===0?jsxs("div",{className:cn("w-full",t),children:[jsx(Jt,{}),jsx(Jc,{})]}):jsxs("div",{className:cn("w-full h-full flex flex-col",t),children:[jsx(Jt,{className:"flex-none"}),jsx("div",{className:"flex-auto min-h-0",ref:m,children:jsx(List,{style:{height:c},onRowsRendered:f,rowComponent:Yc,rowCount:x,rowHeight:Xc,rowProps:{tokens:r,onSelectToken:e,highlightedIndex:h.highlightedIndex},overscanCount:5})})]})}function Yc({index:e,style:t,tokens:o,onSelectToken:n,highlightedIndex:s}){let r=o[e];return r?jsx("div",{style:t,"data-index":e,onClick:()=>n?.(r),children:jsx(Yt,{token:r,highlighted:s===e})}):jsx("div",{style:t,className:"flex items-center justify-center",children:jsx(Spinner,{size:"sm"})})}function Jc(){let{t:e}=useTranslation();return jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-text-muted"}),jsx("p",{className:"mt-2 text-sm text-text-muted",children:e("tokens.search.noResults")})]})}function Zc(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function Ze(e,t){let o=Object.keys(t??{})[0];if(!o)return e;let n=t?.[o];if(n!=="asc"&&n!=="desc")return e;let s=e.map((r,i)=>({token:r,index:i,value:Qt(r,o)}));return s.every(({value:r})=>r===void 0)?e:s.sort((r,i)=>{let l=r.value===void 0,a=i.value===void 0;if(l&&a)return r.index-i.index;if(l)return 1;if(a)return -1;let d=Zc(r.value,i.value);return d===0?r.index-i.index:n==="asc"?d:-d}).map(({token:r})=>r)}function oo({chain:e,resolution:t,filters:o,sortDirections:n,refetchInterval:s=3e4,deferUpdates:r=false,updateFlushInterval:i}){let l=useMemo(()=>({chain:e,resolution:t}),[e,t]),a=useRef(l),[d,m]=useState(true);useEffect(()=>{JSON.stringify(l)!==JSON.stringify(a.current)&&(m(true),u([]),a.current=l);},[l]);let[c,u]=useState([]),{data:p,isPending:x}=useTrendingTokensQuery(l,{refetchInterval:s});useEffect(()=>{p&&(u(v=>zt(v,p)),m(false));},[p]);let f=useCallback(v=>{u(b=>Re(b,v));},[]),{enqueueUpdates:g}=le({applyUpdates:f,paused:r,flushInterval:i});useTrendingTokensSubscription({chain:e},g),he({chain:e,tokens:c,onUpdate:g});let h=useMemo(()=>!!(x||d),[x,d]),k=useMemo(()=>ae(c,o),[c,o]);return {tokens:useMemo(()=>Ze(k,n),[k,n]),isLoading:h}}var sm=Chain.ETHEREUM,im="24h",am=56;function Jr({chains:e,onSelectToken:t,className:o}){let n=e?.length===1?e[0]:e?.[0]??sm,{tokens:s,isLoading:r}=oo({chain:n,resolution:im});return jsx("div",{className:cn("w-full flex flex-col overflow-hidden",o),children:r?jsx(jt,{}):jsx("div",{className:"overflow-y-auto",children:s.map(i=>jsx("div",{style:{height:am},onClick:()=>t?.(i),children:jsx(Yt,{token:i,className:"h-full"})},i.address))})})}function es({chains:e,onKeywordChange:t,onSelectToken:o,onEscape:n}){let s=useMemo(()=>gt(),[]),r=useSearchController({storage:s,onQueryChange:t??Zr,onDismiss:n??Zr}),i=useRef(null),l=r.dismiss,a=useCallback(d=>{if(i.current){i.current.onKey(d);return}d==="Escape"&&l();},[l]);return jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsx(Wr,{value:r.text,onValueChange:r.setText,onClear:r.clearQuery,onEscape:r.dismiss,onNavigateKey:a}),r.query?jsx(Gr,{className:"flex-auto min-h-0",keyword:r.query,chains:e,onSelectToken:o,navigationRef:i,onEscape:r.dismiss}):jsxs("div",{className:"flex-auto min-h-0 flex flex-col overflow-hidden",children:[jsx(Er,{histories:r.history,onSelect:r.commitQuery,onClear:r.clearHistory}),jsx(Jr,{className:"flex-auto min-h-0",chains:e,onSelectToken:o})]})]})}function Zr(){}var Go="search";function Ub({id:e=Go}){return jsx(AsyncModal,{id:e,children:t=>jsx(vm,{...t})})}function vm({params:e,isOpen:t,onOpenChange:o,onResult:n}){let{t:s}=useTranslation(),{isMobile:r}=useScreen(),i=useCallback(l=>{n(l);},[n]);return jsx(StyledModal,{isOpen:t,onOpenChange:o,size:r?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxs(ModalContent,{className:"w-full h-full",style:{borderRadius:r?void 0:14,border:r?void 0:"1px solid var(--color-border-control)",background:"var(--color-surface-interactive)",boxShadow:r?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxs(ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsx("span",{className:"text-base font-semibold",children:s("tokens.search.title")}),jsx(Button,{isIconOnly:true,onPress:()=>o(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsx(XCloseIcon,{width:20,height:20})})]}),jsx(ModalBody,{className:"p-4",children:jsx(es,{chains:e?.chains,onSelectToken:i,onEscape:()=>o(false)})})]})})}function $b({chains:e,onSelectToken:t,className:o}){let{t:n}=useTranslation(),{isDesktop:s}=useScreen(),{onOpen:r,onClose:i}=useAsyncModal(Go),l=useCallbackRef(t),a=useCallbackRef(async()=>{let m=await r({params:{chains:e}});m&&l(m);}),d=useCallbackRef(()=>{i();});return useEffect(()=>{let m=c=>{let u=document.activeElement,p=!!u&&(u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.getAttribute("contenteditable")==="true");c.key==="/"&&!p&&(c.preventDefault(),a()),c.key==="Escape"&&(c.preventDefault(),d());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[a,d]),s?jsx(Button,{size:"sm",radius:"full",onPress:a,variant:"bordered",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsx(Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-text-muted",o),children:n("tokens.search.placeholder")}):jsx(Button,{size:"sm",radius:"full",isIconOnly:true,onPress:a,variant:"bordered",className:cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",o),children:jsx(SearchIcon,{width:16,height:16,className:"text-foreground"})})}var ss=()=>{};function Jb({onKeywordChange:e}){let t=useMemo(()=>gt(),[]),o=useSearchController({storage:t,onQueryChange:e??ss,onDismiss:ss});return {text:o.text,keyword:o.query,setText:o.setText,setKeyword:o.commitQuery,clearKeyword:o.clearQuery}}function yt(e){return e==null||e===""?"--":formatPercent(Number(e)/100)}function Te(e,t=4,o=4){return e?e.length<=t+o+1?e:`${e.slice(0,t)}\u2026${e.slice(-o)}`:"--"}function Pe(e,t=Date.now()){if(e==null)return "--";let o=typeof e=="string"||typeof e=="number"?new Date(e):e,n=typeof t=="number"?new Date(t):t,s=Math.max(0,Math.floor((n.getTime()-o.getTime())/1e3));if(s<60)return `${s}s`;let r=Math.floor(s/60);if(r<60)return `${r}m`;let i=Math.floor(r/60);if(i<24)return `${i}h`;let l=Math.floor(i/24);if(l<30)return `${l}d`;let a=Math.floor(l/30);return a<12?`${a}mo`:`${Math.floor(l/365)}y`}function F(e,t){let{token:o,isLoading:n}=useTokenMarket({chain:e,address:t});return {token:o,isLoading:n}}function je({label:e,totalFormatted:t,buysFormatted:o,sellsFormatted:n,totalValue:s=0,buysValue:r=0,className:i}){let{t:l}=useTranslation(),a=new SafeBigNumber(s??0),d=new SafeBigNumber(r??0),m=a.eq(0)?0:d.div(a).times(100).toNumber();return jsxs("div",{className:cn("flex flex-col gap-1",i),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-xs text-text-muted",children:e}),jsx("span",{className:"text-xs text-foreground",children:t})]}),jsx(Progress,{size:"sm",value:m,classNames:{track:"bg-negative/40",indicator:"bg-positive"},"aria-label":l("tokens.tokenDetail.buyShare",{label:e})}),jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[jsx("span",{className:"text-positive",children:l("tokens.tokenDetail.buys",{value:o})}),jsx("span",{className:"text-negative",children:l("tokens.tokenDetail.sells",{value:n})})]})]})}function as({token:e,actions:t,dataStrip:o,className:n,onCopyAddress:s}){let r=e?.address;return jsxs("div",{className:cn("flex w-full flex-wrap items-center gap-4 px-4 py-3",n),children:[jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&jsx(ke,{token:e,radius:"lg",className:"h-10 w-10"}),jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"truncate text-base font-semibold text-foreground",children:e?.symbol??"--"}),jsx("span",{className:"truncate text-xs text-text-muted",children:e?.name})]}),r&&jsxs("button",{type:"button",onClick:()=>s?.(r),className:"flex items-center gap-1 text-[11px] text-text-muted transition-colors hover:text-foreground",title:r,children:[Te(r,6,6),jsx(CopyIcon,{width:12,height:12})]})]})]}),o&&jsx("div",{className:"flex-1 min-w-0",children:o}),t&&jsx("div",{className:"ml-auto flex items-center gap-2",children:t})]})}function ls(e,t){return F(e,t)}function cs({price:e,marketCap:t,volume:o,holdersCount:n,socialMedia:s,className:r}){return jsxs("div",{className:cn("flex flex-wrap items-center gap-x-6 gap-y-3",r),children:[e,jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[t,o,n]}),jsx("div",{className:"ml-auto",children:s})]})}function Ev(e,t){return F(e,t)}function us({holders:e,top10HoldingsRatio:t,top100HoldingsRatio:o,className:n}){let{t:s}=useTranslation();return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",n),children:[jsxs("div",{className:"text-xs font-medium text-text-muted",children:[jsx("span",{className:"text-foreground",children:e!=null?formatAmount(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:yt(t)}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:yt(o)})]}),jsx("div",{className:"text-[10px] text-text-muted",children:s("tokens.tokenDetail.holdersSummary")})]})}function ps(e,t){return F(e,t)}function fs({chain:e,address:t,className:o}){let{token:n}=ps(e,t);return jsx(us,{holders:n?.marketData?.holders,top10HoldingsRatio:n?.marketData?.top10HoldingsRatio,top100HoldingsRatio:n?.marketData?.top100HoldingsRatio,className:o})}function ks({marketCapInUsd:e,tvlInUsd:t,createdAt:o,className:n}){let{t:s}=useTranslation();return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",n),children:[jsxs("div",{className:"text-xs font-medium text-text-muted",children:[jsx("span",{className:"text-foreground",children:e?formatMCapInUsd(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t?formatAmountInUsd(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:Pe(o)})]}),jsx("div",{className:"text-[10px] text-text-muted",children:s("tokens.tokenDetail.marketCapSummary")})]})}function xs(e,t){return F(e,t)}function hs({chain:e,address:t,className:o}){let{token:n}=xs(e,t);return jsx(ks,{marketCapInUsd:n?.marketData?.marketCapInUsd,tvlInUsd:n?.marketData?.tvlInUsd,createdAt:n?.createdAt,className:o})}function bs({priceInUsd:e,price24hAgoInUsd:t,className:o}){let{t:n}=useTranslation(),{bearish:s,priceChange:r}=useMemo(()=>{if(!e||!t)return {bearish:false,priceChange:void 0};let i=new SafeBigNumber(e),l=new SafeBigNumber(t);return l.lte(0)?{bearish:false,priceChange:void 0}:{bearish:i.lt(l),priceChange:i.minus(l).div(l).abs().toNumber()}},[e,t]);return jsxs("div",{className:cn("group flex flex-col gap-1",o),"data-bearish":s,children:[jsx("div",{className:"text-base font-medium leading-none text-positive group-data-[bearish=true]:text-negative",children:e?formatPriceInUsd(e):"--"}),jsxs("div",{className:"flex items-center gap-2 text-[10px] leading-none",children:[jsx("span",{className:"text-text-muted",children:n("tokens.tokenDetail.change24h")}),jsx("span",{className:"text-positive group-data-[bearish=true]:text-negative",children:r!=null?formatPercent(r):"--"})]})]})}function vs(e,t){return F(e,t)}function Ss({chain:e,address:t,className:o}){let{token:n}=vs(e,t);return jsx(bs,{priceInUsd:n?.marketData?.priceInUsd,price24hAgoInUsd:n?.stats?.["24h"]?.openPriceInUsd,className:o})}function su(e,t){switch(e){case "website":return jsx(WebsiteIcon,{width:t,height:t});case "twitter":return jsx(TwitterIcon,{width:t,height:t});case "telegram":return jsx(TelegramIcon,{width:t,height:t});case "discord":return jsx(DiscordIcon,{width:t,height:t});default:return jsx("span",{className:"text-[9px] font-medium uppercase",children:e.slice(0,2)})}}function Ns({socials:e,className:t,iconSize:o=16}){if(!e)return null;let s=["website","twitter","telegram","discord","github","reddit","youtube","medium"].filter(r=>!!e[r]);return s.length===0?null:jsx("div",{className:cn("flex items-center gap-3",t),children:s.map(r=>jsx("a",{href:e[r],target:"_blank",rel:"noreferrer noopener",className:"flex items-center justify-center text-text-muted transition-colors hover:text-foreground",style:{width:o,height:o},children:su(r,o)},r))})}function Cs(e,t){return F(e,t)}function ws({chain:e,address:t,className:o,iconSize:n}){let{token:s}=Cs(e,t);return jsx(Ns,{socials:s?.socialMedias,className:o,iconSize:n})}function Rs({volumesInUsd:e,trades:t,traders:o,className:n}){let{t:s}=useTranslation();return jsxs("div",{className:cn("flex flex-col items-start justify-center gap-0.5",n),children:[jsxs("div",{className:"text-xs font-medium text-text-muted",children:[jsx("span",{className:"text-foreground",children:e?formatAmountInUsd(e):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:t!=null?formatAmount(t):"--"}),jsx("span",{className:"px-1",children:"/"}),jsx("span",{children:o!=null?formatAmount(o):"--"})]}),jsx("div",{className:"text-[10px] text-text-muted",children:s("tokens.tokenDetail.volumeSummary")})]})}function As(e,t){return F(e,t)}function Is({chain:e,address:t,className:o}){let{token:n}=As(e,t),s=n?.stats?.["24h"];return jsx(Rs,{volumesInUsd:s?.volumesInUsd,trades:s?.trades,traders:s?.traders,className:o})}function Ms({chain:e,address:t,className:o}){return jsx(cs,{className:o,price:jsx(Ss,{chain:e,address:t}),marketCap:jsx(hs,{chain:e,address:t}),volume:jsx(Is,{chain:e,address:t}),holdersCount:jsx(fs,{chain:e,address:t}),socialMedia:jsx(ws,{chain:e,address:t})})}function NN({chain:e,address:t,actions:o,dataStrip:n,className:s,onCopyAddress:r}){let{token:i}=ls(e,t);return jsx(as,{token:i,actions:o,dataStrip:n===void 0?jsx(Ms,{chain:e,address:t}):n,className:s,onCopyAddress:r})}var fu=["holdingUsd","lastActiveAt"];function Fs({holders:e,isLoading:t,sortBy:o,sortDirection:n,onSortByChange:s,onlyTracked:r=false,onOnlyTrackedChange:i,onLoadMore:l,hasMore:a,now:d=Date.now(),wellKnownAddresses:m,className:c,renderAddress:u}){let{t:p}=useTranslation(),x=r?e.filter(f=>f.tags&&f.tags.length>0):e;return jsxs("div",{className:cn("flex flex-col",c),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-text-muted",children:p("tokens.tokenDetail.holders.title")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-text-muted",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:r,onChange:f=>i?.(f.target.checked)}),p("tokens.tokenDetail.filter.onlyTracked")]})]}),jsx("div",{className:"flex items-center gap-1",children:fu.map(f=>jsx("button",{type:"button",onClick:()=>s(f,n??"desc"),className:cn("rounded px-2 py-1 text-[11px] transition-colors",o===f?"bg-default-100 text-foreground":"text-text-muted hover:text-foreground"),children:p(f==="holdingUsd"?"tokens.tokenDetail.columns.value":"tokens.tokenDetail.columns.lastActive")},f))})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[640px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[30%] px-3 py-2 text-left font-normal",children:p("tokens.tokenDetail.columns.wallet")}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:p("tokens.tokenDetail.columns.tags")}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:p("tokens.tokenDetail.columns.value")}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:p("tokens.tokenDetail.columns.firstHeld")}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:p("tokens.tokenDetail.columns.lastActive")})]})}),jsxs("tbody",{children:[x.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-text-muted",children:p("tokens.tokenDetail.holders.empty")})}),x.map(f=>jsx(gu,{holder:f,now:d,wellKnownAddresses:m,renderAddress:u},f.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-text-muted",children:p("tokens.tokenDetail.loading")})})]})]})}),a&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:l,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:p("tokens.tokenDetail.loadMore")})})]})}function gu({holder:e,now:t,wellKnownAddresses:o,renderAddress:n}){let s=o?.[e.address],r=useMemo(()=>n?n(e.address):s?jsx("span",{className:"rounded bg-default-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:s}):jsx("span",{className:"font-mono text-[11px] text-text-muted",children:Te(e.address,6,6)}),[e.address,n,s]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:r}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Et,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountInUsd(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:yt(e.ratio)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:e.startHoldingAt?Pe(e.startHoldingAt,t):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Bs({chain:e,address:t,limit:o=50,initialSortBy:n,initialSortDirection:s}){let[r,i]=useState(n),[l,a]=useState(s),[d,m]=useState(void 0),[c,u]=useState([]),p=useCallback(()=>{m(void 0),u([]);},[]),x=useCallback((N,K)=>{N===r&&K===l||(i(N),a(K),p());},[p,r,l]),f=useCallback(N=>{x(N,l??"desc");},[x,l]),g=useCallback(N=>{N!==l&&(a(N),p());},[p,l]);useEffect(()=>{p();},[e,t,p]);let h=useMemo(()=>({chain:e,address:t,cursor:d,limit:o,sortBy:r,sortDirection:l}),[e,t,d,o,r,l]),{data:k,isPending:T,isFetching:v}=useTokenHoldersQuery(h);useEffect(()=>{k&&u(N=>d==null?[k]:N[N.length-1]?.endCursor===k.endCursor?N:[...N,k]);},[k,d]),useTokenSubscription({chain:e,address:t},()=>{});let b=useMemo(()=>c.flatMap(N=>N.data),[c]),y=c[c.length-1],L=!!(y?.hasNext&&y.endCursor),A=useCallback(()=>{!y?.endCursor||!y.hasNext||m(y.endCursor);},[y]);return {holders:b,isLoading:T||v,sortBy:r,sortDirection:l,setSortBy:f,setSort:x,setSortDirection:g,hasMore:L,loadMore:A}}function zN({chain:e,address:t,limit:o,initialSortBy:n,initialSortDirection:s,initialOnlyTracked:r=false,wellKnownAddresses:i,className:l,renderAddress:a}){let[d,m]=useState(r),{holders:c,isLoading:u,sortBy:p,sortDirection:x,setSort:f,hasMore:g,loadMore:h}=Bs({chain:e,address:t,limit:o,initialSortBy:n,initialSortDirection:s});return jsx(Fs,{holders:c,isLoading:u,sortBy:p,sortDirection:x,onSortByChange:f,onlyTracked:d,onOnlyTrackedChange:m,wellKnownAddresses:i,hasMore:g,onLoadMore:h,className:l,renderAddress:a})}var Su=["timestamp","totalUsd"],Nu=["all","buy","sell"],Cu=["all","dev","tracked","you"];function Es({activities:e,isLoading:t,sortBy:o,sortDirection:n="desc",onSortByChange:s,typeFilter:r="all",onTypeFilterChange:i,traderFilter:l="all",onTraderFilterChange:a,youWalletAddress:d,currency:m="usd",onCurrencyChange:c,onLoadMore:u,hasMore:p,now:x=Date.now(),nativeDecimals:f=9,nativeSymbol:g="SOL",className:h,onRowClick:k}){let{t:T}=useTranslation(),v=Lu(e,l,d);return jsxs("div",{className:cn("flex flex-col",h),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-1",children:[Nu.map(b=>jsx("button",{type:"button",onClick:()=>i?.(b),className:cn("rounded px-2 py-1 text-[11px] transition-colors",r===b?"bg-default-100 text-foreground":"text-text-muted hover:text-foreground"),children:T(b==="all"?"tokens.tokenDetail.filter.all":b==="buy"?"tokens.tokenDetail.filter.buys":"tokens.tokenDetail.filter.sells")},b)),jsx("span",{className:"mx-1 h-3 w-px bg-default-200","aria-hidden":true}),Cu.map(b=>{let y=l===b,L=b==="you"&&!d;return jsx("button",{type:"button",disabled:L,onClick:()=>a?.(b),className:cn("rounded px-2 py-1 text-[11px] transition-colors",y?"bg-default-100 text-foreground":"text-text-muted hover:text-foreground",L&&"cursor-not-allowed opacity-50"),children:T(`tokens.tokenDetail.filter.${b}`)},b)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx(Pu,{value:m,nativeSymbol:g,onChange:c}),jsx("div",{className:"flex items-center gap-1",children:Su.map(b=>{let y=o===b,L=y&&n==="desc"?"asc":y&&n==="asc"?void 0:"desc",A=L?b:void 0;return jsx("button",{type:"button",onClick:()=>s(A,L),className:cn("rounded px-2 py-1 text-[11px] transition-colors",y?"bg-default-100 text-foreground":"text-text-muted hover:text-foreground"),children:T(b==="timestamp"?"tokens.tokenDetail.filter.latest":"tokens.tokenDetail.filter.topUsd")},b)})})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[780px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:T("tokens.tokenDetail.columns.side")}),jsx("th",{className:"w-[25%] px-3 py-2 text-left font-normal",children:T("tokens.tokenDetail.columns.trader")}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:T("tokens.tokenDetail.columns.amount")}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:T("tokens.tokenDetail.columns.usd")}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:T("tokens.tokenDetail.columns.price")}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:T("tokens.tokenDetail.columns.gas")}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:T("tokens.tokenDetail.columns.age")})]})}),jsxs("tbody",{children:[v.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-8 text-center text-text-muted",children:T("tokens.tokenDetail.activities.empty")})}),v.map(b=>jsx(Au,{activity:b,now:x,nativeDecimals:f,nativeSymbol:g,currency:m,onRowClick:k},b.txHash)),t&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-text-muted",children:T("tokens.tokenDetail.loading")})})]})]})}),p&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:u,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:T("tokens.tokenDetail.loadMore")})})]})}function wu(e){return e.type==="buy"?e.to:e.type==="sell"?e.from:e.to}function Lu(e,t,o){if(t==="all")return e;if(t==="you"){if(!o)return [];let s=o.toLowerCase();return e.filter(r=>r.walletAddress?.toLowerCase()===s)}if(t==="dev")return e.filter(s=>s.traderTags?.some(r=>r==="dev"));let n=new Set(["kol","smart","bluechip"]);return e.filter(s=>s.traderTags?.some(r=>n.has(r)))}function Pu({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[22px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-text-muted hover:text-foreground"),children:s.label},s.k))})}function Ru(e,t,o){if(!e)return "--";let n=Number(e)/Math.pow(10,t);return Number.isFinite(n)?`${formatAmount(n)} ${o}`:"--"}function Au({activity:e,now:t,nativeDecimals:o,nativeSymbol:n,currency:s,onRowClick:r}){let i=wu(e),l=e.type==="buy"?"Buy":e.type==="sell"?"Sell":e.type.replace(/_/g," "),a=e.type==="buy"?"text-positive":e.type==="sell"?"text-negative":"text-text-muted";return jsxs("tr",{className:cn("border-b border-default-50 hover:bg-default-50/60",r&&"cursor-pointer"),onClick:r?()=>r(e):void 0,children:[jsx("td",{className:cn("px-3 py-2 align-middle font-medium capitalize",a),children:l}),jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"font-mono text-[11px] text-text-muted",children:Te(e.walletAddress,6,6)}),jsx(Kn,{tags:e.traderTags,max:2})]})}),jsxs("td",{className:"px-3 py-2 text-right align-middle",children:[formatAmount(i.amount)," ",i.symbol]}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s==="native"&&i.amountInNative?`${formatAmount(i.amountInNative)} ${i.symbol}`:i.amountInUsd?formatAmountInUsd(i.amountInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:i.priceInUsd?`$${formatPrice(i.priceInUsd)}`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:Ru(e.gasFee,o,n)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:Pe(e.time,t)})]})}var Iu=500;function tn({sortBy:e,sortDirection:t,typeFilter:o}){return {getKey:en,compare:(n,s)=>Hu(n,s,e,t),include:n=>Du(n,o),merge:(n,s,r)=>r.incomingSource==="live"?{item:s,placement:"incoming"}:r.previousSource==="live"?{item:n,placement:"previous"}:{item:n,placement:"previous"},maxLiveItems:Iu}}function _s(e){return Object.freeze({cursor:null,generation:e,mode:"replace"})}function qs(e=tn({sortDirection:"desc",typeFilter:"all"})){let{snapshot:t}=createRealtimeCursorCollection(e);return {collection:t,request:_s(t.generation)}}function Nt(e,t,o){let{reduce:n}=createRealtimeCursorCollection(o);switch(t.type){case "reset":{let s=n(e.collection,{type:"reset"});return {collection:s,request:_s(s.generation)}}case "load-more":return Mu(e);case "live":return t.items.length===0?e:{collection:n(e.collection,{type:"live",items:t.items}),request:e.request};case "page":return t.request.mode==="append"&&t.nextCursor===e.collection.nextCursor?e:{collection:n(e.collection,{type:"page",mode:t.request.mode,generation:t.request.generation,items:t.items,nextCursor:t.nextCursor,hasNextPage:t.hasNextPage}),request:e.request};default:return t}}function Mu(e){let{collection:t,request:o}=e;return !t.hasNextPage||t.nextCursor==null||o.mode==="append"&&o.cursor===t.nextCursor&&o.generation===t.generation?e:{collection:t,request:Object.freeze({cursor:t.nextCursor,generation:t.generation,mode:"append"})}}function Du(e,t){return t==="all"?true:e.type===t}function Hu(e,t,o,n){let r=(o??"timestamp")==="totalUsd"?jo(Vs(e),Vs(t)):jo(so(e),so(t)),i=Ws(r,n);if(i!==0)return i;let l=Ws(jo(so(e),so(t)),"desc");return l!==0?l:en(e).localeCompare(en(t))}function Ws(e,t){return t==="asc"?e:-e}function jo(e,t){return e<t?-1:e>t?1:0}function so(e){let t=e.time instanceof Date?e.time.getTime():new Date(e.time).getTime();return Number.isFinite(t)?t:0}function Vs(e){let t=e.type==="sell"?e.from:e.to,o=Number(t.amountInUsd);return Number.isFinite(o)?o:0}function en(e){return e.txHash}function Qs({chain:e,address:t,limit:o=50,initialSortBy:n,initialSortDirection:s="desc",initialTypeFilter:r="all"}){let[i,l]=useState(n),[a,d]=useState(s),[m,c]=useState(r),u=useMemo(()=>tn({sortBy:i,sortDirection:a,typeFilter:m}),[i,a,m]),p=useRef(u);p.current=u;let[x,f]=useState(()=>qs(u)),g=useRef(true),h=useCallback(()=>{f(P=>Nt(P,{type:"reset"},p.current));},[]),k=useCallback((P,Q)=>{let ut=Q??(P===i?a:"desc");P===i&&ut===a||(l(P),d(ut),h());},[i,a,h]),T=useCallback(P=>{P!==a&&(d(P),h());},[a,h]),v=useCallback(P=>{P!==m&&(c(P),h());},[m,h]);useEffect(()=>{if(g.current){g.current=false;return}h();},[e,t,h]);let b=m==="all"?void 0:m,{collection:y,request:L}=x,A=useMemo(()=>({chain:e,address:t,cursor:L.cursor??void 0,limit:o,sortBy:i,sortDirection:a,type:b}),[e,t,L,o,i,a,b]),{data:N,isPending:K,isFetching:fe}=useTokenActivitiesQuery(A);useEffect(()=>{N&&f(P=>Nt(P,{type:"page",request:L,items:N.data,nextCursor:N.endCursor??null,hasNextPage:!!N.hasNext},u));},[N,L,u]),useTokenActivitiesSubscription({chain:e,address:t},P=>{P?.length&&f(Q=>Nt(Q,{type:"live",items:P},u));});let E=useMemo(()=>y.items.slice(),[y]),W=!!(y.hasNextPage&&y.nextCursor),ge=useCallback(()=>{f(P=>Nt(P,{type:"load-more"},u));},[u]);return {activities:E,isLoading:K||fe,sortBy:i,sortDirection:a,setSortBy:k,setSortDirection:T,typeFilter:m,setTypeFilter:v,hasMore:W,loadMore:ge}}function gC({chain:e,address:t,limit:o,initialSortBy:n,initialSortDirection:s,initialTypeFilter:r,initialTraderFilter:i="all",initialCurrency:l="usd",youWalletAddress:a,nativeDecimals:d,nativeSymbol:m,className:c,onRowClick:u}){let[p,x]=useState(i),[f,g]=useState(l),{activities:h,isLoading:k,sortBy:T,sortDirection:v,setSortBy:b,typeFilter:y,setTypeFilter:L,hasMore:A,loadMore:N}=Qs({chain:e,address:t,limit:o,initialSortBy:n,initialSortDirection:s,initialTypeFilter:r});return jsx(Es,{activities:h,isLoading:k,sortBy:T,sortDirection:v,onSortByChange:b,typeFilter:y,onTypeFilterChange:L,traderFilter:p,onTraderFilterChange:x,youWalletAddress:a,currency:f,onCurrencyChange:g,hasMore:A,onLoadMore:N,className:c,nativeDecimals:d,nativeSymbol:m,onRowClick:u})}function Xs({stats:e,resolution:t,className:o}){let n=e?.[t],s=n?.traders??0,r=n?.buyers??0,i=n?.sellers??0;return jsx(je,{className:o,label:`Traders (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(r),sellsFormatted:formatAmount(i),totalValue:s,buysValue:r})}function Ys(e,t){return F(e,t)}function AC({chain:e,address:t,resolution:o="24h",className:n}){let{token:s}=Ys(e,t);return jsx(Xs,{stats:s?.stats,resolution:o,className:n})}function Js({stats:e,resolution:t,className:o}){let n=e?.[t],s=n?.trades??0,r=n?.buys??0,i=n?.sells??0;return jsx(je,{className:o,label:`Transactions (${t})`,totalFormatted:formatAmount(s),buysFormatted:formatAmount(r),sellsFormatted:formatAmount(i),totalValue:s,buysValue:r})}function Zs(e,t){return F(e,t)}function $C({chain:e,address:t,resolution:o="24h",className:n}){let{token:s}=Zs(e,t);return jsx(Js,{stats:s?.stats,resolution:o,className:n})}function js({stats:e,resolution:t,className:o}){let n=e?.[t],s=n?.volumesInUsd??"0",r=n?.buyVolumesInUsd??"0",i=n?.sellVolumesInUsd??"0";return jsx(je,{className:o,label:`Volume (${t})`,totalFormatted:formatAmountInUsd(s),buysFormatted:formatAmountInUsd(r),sellsFormatted:formatAmountInUsd(i),totalValue:s,buysValue:r})}function ei(e,t){return F(e,t)}function i0({chain:e,address:t,resolution:o="24h",className:n}){let{token:s}=ei(e,t);return jsx(js,{stats:s?.stats,resolution:o,className:n})}function oi({security:e,externalUrl:t,externalLabel:o,className:n}){let{t:s}=useTranslation(),r=[{title:s("tokens.tokenDetail.security.transferFee"),value:e?.hasTransferFee,safeWhen:false,description:s("tokens.tokenDetail.security.transferFeeDescription")},{title:s("tokens.tokenDetail.security.feeNotUpgradable"),value:e?.isTransferFeeUpgradable,safeWhen:false,description:s("tokens.tokenDetail.security.feeNotUpgradableDescription")},{title:s("tokens.tokenDetail.security.transferable"),value:e?.isTransferable,safeWhen:true,description:s("tokens.tokenDetail.security.transferableDescription")},{title:s("tokens.tokenDetail.security.notFreezable"),value:e?.isFreezable,safeWhen:false,description:s("tokens.tokenDetail.security.notFreezableDescription")},{title:s("tokens.tokenDetail.security.notClosable"),value:e?.isClosable,safeWhen:false,description:s("tokens.tokenDetail.security.notClosableDescription")}],i=r.every(l=>l.value!==void 0&&l.value===l.safeWhen);return jsxs("section",{className:cn("flex w-full flex-col gap-3",n),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:s("tokens.tokenDetail.security.title")}),jsx("span",{className:cn("text-xs",e===void 0?"text-text-muted":i?"text-success-500":"text-danger-500"),children:e===void 0?"--":s(i?"tokens.tokenDetail.security.safe":"tokens.tokenDetail.security.review")})]}),jsx("div",{className:"flex flex-col",children:r.map(l=>jsx(qu,{...l},l.title))}),t&&o&&jsx("div",{className:"flex justify-center",children:jsx("a",{href:t,target:"_blank",rel:"noreferrer noopener",className:"text-xs text-text-muted transition-colors hover:text-foreground",children:o})})]})}function qu({title:e,value:t,safeWhen:o,description:n}){let{t:s}=useTranslation(),r=t!==void 0&&t===o,i=t===void 0?"--":s(r?"tokens.tokenDetail.security.ok":"tokens.tokenDetail.security.risk");return jsxs("div",{className:"flex h-8 items-center justify-between gap-2",children:[jsx("span",{className:"text-xs text-text-muted",title:n,children:e}),jsx("span",{className:cn("text-xs",t===void 0?"text-text-muted":r?"text-success-500":"text-danger-500"),children:i})]})}function ni(e,t){let{data:o,isLoading:n}=useTokenSecurityQuery({chain:e,address:t});return {security:o,isLoading:n}}function b0({chain:e,address:t,externalUrl:o,externalLabel:n,className:s}){let{security:r}=ni(e,t);return jsx(oi,{security:r,externalUrl:o,externalLabel:n,className:s})}function ri({token:e,className:t}){let{t:o}=useTranslation();return e?jsxs("section",{className:cn("flex w-full flex-col gap-2",t),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:o("tokens.tokenDetail.about",{symbol:e.symbol})}),e.description?jsx("p",{className:"whitespace-pre-line text-xs text-text-muted",children:e.description}):jsx("p",{className:"text-xs text-text-muted",children:o("tokens.tokenDetail.noDescription")})]}):null}function si(e,t){return F(e,t)}function U0({chain:e,address:t,className:o}){let{token:n}=si(e,t);return jsx(ri,{token:n,className:o})}function li({liquidities:e,totalTvlInUsd:t,collapseAt:o=3,className:n,onPoolClick:s}){let{t:r}=useTranslation(),[i,l]=useState(!e||e.length<=o),a=useCallback(()=>l(d=>!d),[]);return jsxs("section",{className:cn("flex w-full flex-col gap-3",n),children:[jsxs("div",{className:"flex items-baseline justify-between",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:r("tokens.tokenDetail.liquidity")}),t&&jsx("span",{className:"text-xs text-foreground",children:formatAmountInUsd(t)})]}),(!e||e.length===0)&&jsx("div",{className:"py-4 text-center text-xs text-text-muted",children:r("tokens.tokenDetail.noPools")}),e&&e.length>0&&jsxs("div",{className:"flex flex-col gap-2",children:[e.map((d,m)=>jsxs("div",{className:cn("flex h-10 w-full items-center justify-between overflow-hidden text-xs",m>=o&&!i&&"hidden",s&&"cursor-pointer hover:bg-default-50"),onClick:s?()=>s(d):void 0,children:[jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-foreground",children:d.protocolFamily??d.protocolName??r("tokens.tokenDetail.unknownProtocol")}),d.poolAddress&&jsx("span",{className:"font-mono text-[10px] text-text-muted",children:r("tokens.tokenDetail.poolAddress",{address:Te(d.poolAddress,6,6)})})]}),jsx("div",{className:"text-text-muted",children:formatAmountInUsd(d.tvlInUsd??0)})]},d.poolAddress??`${d.protocolFamily}-${m}`)),e.length>o&&jsx("div",{className:"flex justify-center pt-1",children:jsx("button",{type:"button",onClick:a,className:"rounded px-2 py-1 text-xs text-text-muted transition-colors hover:text-foreground",children:r(i?"tokens.tokenDetail.showLess":"tokens.tokenDetail.showMore")})})]})]})}function di(e,t){return F(e,t)}function ew({chain:e,address:t,collapseAt:o,className:n,onPoolClick:s}){let{token:r}=di(e,t);return jsx(li,{liquidities:r?.liquidities,totalTvlInUsd:r?.marketData?.tvlInUsd,collapseAt:o,className:n,onPoolClick:s})}function ci({cexes:e,collapseAt:t=4,className:o}){let{t:n}=useTranslation(),[s,r]=useState(!e||e.length<=t),i=useCallback(()=>r(l=>!l),[]);return !e||e.length===0?null:jsxs("section",{className:cn("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:n("tokens.tokenDetail.cexListings")}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((l,a)=>{let d=a>=t&&!s,m=jsx(Chip,{startContent:l.logo?jsx(Image,{src:l.logo,width:20,height:20,alt:l.name}):void 0,className:cn("bg-default-100 text-xs",d&&"hidden"),children:l.name},l.id);return l.url?jsx("a",{href:l.url,target:"_blank",rel:"noreferrer noopener",className:cn(d&&"hidden"),children:m},l.id):m})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:i,className:"rounded px-2 py-1 text-xs text-text-muted transition-colors hover:text-foreground",children:n(s?"tokens.tokenDetail.showLess":"tokens.tokenDetail.showMore")})})]})}function mi(e){return {cexes:e}}function gw({cexes:e,collapseAt:t,className:o}){let{cexes:n}=mi(e);return jsx(ci,{cexes:n,collapseAt:t,className:o})}function pi({categories:e,collapseAt:t=4,className:o,onCategoryClick:n}){let{t:s}=useTranslation(),[r,i]=useState(!e||e.length<=t),l=useCallback(()=>i(a=>!a),[]);return !e||e.length===0?null:jsxs("section",{className:cn("w-full",o),children:[jsx("div",{className:"text-sm font-medium text-foreground",children:s("tokens.tokenDetail.categories")}),jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((a,d)=>{let m=d>=t&&!r;return jsx(Chip,{size:"sm",className:cn("bg-default-100",m&&"hidden",n&&"cursor-pointer"),onClick:n?()=>n(a):void 0,children:a},a)})}),e.length>t&&jsx("div",{className:"mt-3 flex justify-center",children:jsx("button",{type:"button",onClick:l,className:"rounded px-2 py-1 text-xs text-text-muted transition-colors hover:text-foreground",children:s(r?"tokens.tokenDetail.showLess":"tokens.tokenDetail.showMore")})})]})}function fi(e,t){return F(e,t)}function Iw({chain:e,address:t,collapseAt:o,className:n,onCategoryClick:s}){let{token:r}=fi(e,t);return jsx(pi,{categories:r?.tags,collapseAt:o,className:n,onCategoryClick:s})}var gi=["5m","1h","4h","24h"];function ki({stats:e,resolution:t,className:o}){let{t:n}=useTranslation(),s=e?.[t],r=new SafeBigNumber(s?.buyVolumesInUsd??0),i=new SafeBigNumber(s?.sellVolumesInUsd??0),l=r.plus(i),a=r.minus(i),d=l.eq(0)?50:Math.min(100,Math.max(0,r.div(l).times(100).toNumber())),m=[{label:`${t} Vol`,value:formatAmountInUsd(l.toString()),className:"text-foreground"},{label:n("tokens.tokenDetail.stats.buys"),value:formatAmountInUsd(r.toString()),className:"text-positive"},{label:n("tokens.tokenDetail.stats.sells"),value:formatAmountInUsd(i.toString()),className:"text-negative"},{label:n("tokens.tokenDetail.stats.netVolume"),value:formatAmountInUsd(a.abs().toString()),className:a.gte(0)?"text-positive":"text-negative"}];return jsxs("div",{className:cn("flex h-full w-full flex-col",o),children:[jsx("div",{className:"grid flex-1 grid-cols-4 items-center",children:m.map(c=>jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-text-muted",children:c.label}),jsx("span",{className:cn("text-[13px] font-medium leading-none tabular-nums",c.className),children:c.value})]},c.label))}),jsx("div",{className:"relative h-[2px] w-full overflow-hidden bg-negative",children:jsx("div",{className:"absolute inset-y-0 left-0 bg-positive transition-[width] duration-200 ease-out",style:{width:`${d}%`}})})]})}function xi({stats:e,resolutions:t,className:o}){return jsx("div",{className:cn("grid h-full w-full grid-cols-4 items-center",o),children:t.map(n=>{let r=e?.[n]?.priceChange,i=r?new SafeBigNumber(r):void 0,l=i?i.gte(0):void 0,a=n,d=i?formatPercent(i,{showPlusGtThanZero:true}):"\u2014";return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] px-2",children:[jsx("span",{className:"text-[10px] leading-none text-text-muted",children:a}),jsx("span",{className:cn("text-[13px] font-medium leading-none tabular-nums",l===void 0?"text-foreground":l?"text-positive":"text-negative"),children:d})]},n)})})}function hi({chain:e,address:t}){let{data:o,isLoading:n}=useTokenStatsQuery({chain:e,address:t});return {stats:o,isLoading:n}}function Gw({chain:e,address:t,baseResolution:o="5m",hoverResolutions:n=gi,height:s=64,className:r}){let{stats:i}=hi({chain:e,address:t});return jsx(StatsFlipPanel,{className:r,height:s,base:jsx(ki,{stats:i,resolution:o}),hover:jsx(xi,{stats:i,resolutions:n})})}function Ti({positions:e,isLoading:t,hasMore:o,onLoadMore:n,currency:s="usd",onCurrencyChange:r,showHidden:i=false,onShowHiddenChange:l,nativeSymbol:a,renderActions:d,className:m}){let{t:c}=useTranslation(),u=a??c("tokens.tokenDetail.native");return jsxs("div",{className:cn("flex flex-col",m),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:"text-xs font-medium text-text-muted",children:c("tokens.tokenDetail.positions.title")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-text-muted",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:i,onChange:p=>l?.(p.target.checked)}),c("tokens.tokenDetail.filter.showHidden")]})]}),jsx(Sp,{value:s,nativeSymbol:u,onChange:r})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[720px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[26%] px-3 py-2 text-left font-normal",children:c("tokens.tokenDetail.columns.token")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:c("tokens.tokenDetail.columns.bought")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:c("tokens.tokenDetail.columns.sold")}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:c("tokens.tokenDetail.columns.remaining")}),jsx("th",{className:"w-[18%] px-3 py-2 text-right font-normal",children:c("tokens.tokenDetail.columns.pnl")}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:c("tokens.tokenDetail.columns.actions")})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-text-muted",children:c("tokens.tokenDetail.positions.empty")})}),e.map(p=>jsx(Np,{position:p,currency:s,renderActions:d},`${p.chain}:${p.address}`)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-text-muted",children:c("tokens.tokenDetail.loading")})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:n,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:c("tokens.tokenDetail.loadMore")})})]})}function Sp({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-text-muted hover:text-foreground"),children:s.label},s.k))})}function Np({position:e,currency:t,renderActions:o}){let{bought:n,sold:s,remaining:r,pnl:i}=useMemo(()=>Cp(e,t),[e,t]),l=jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-text-muted",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:l}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r}),jsx("td",{className:cn("px-3 py-2 text-right align-middle font-medium",i.isPositive===void 0?"text-text-muted":i.isPositive?"text-positive":"text-negative"),children:jsxs("div",{className:"flex flex-col items-end leading-tight",children:[jsx("span",{children:i.amount}),i.ratio?jsx("span",{className:"text-[10px]",children:i.ratio}):null]})}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-text-muted",children:"--"})})]})}function Cp(e,t){let o=t==="usd"?e.buyVolumesInUsd:e.buyVolumes,n=t==="usd"?e.sellVolumesInUsd:e.sellVolumes,s=t==="usd"?e.amountInUsd:e.amount,r=e.totalProfitInUsd,i=t==="usd"?formatAmountInUsd(o??0):formatAmount(o??0),l=t==="usd"?formatAmountInUsd(n??0):formatAmount(n??0),a=t==="usd"?formatAmountInUsd(s??0):formatAmount(s??0),d=r?new SafeBigNumber(r):void 0,m=d?d.gte(0):void 0,c=d?(m?"+":"")+formatAmountInUsd(d.toString()):"--",u=e.totalProfitRatio?formatPercent(e.totalProfitRatio,{showPlusGtThanZero:true}):void 0;return {bought:i,sold:l,remaining:a,pnl:{amount:c,ratio:u,isPositive:m}}}function vi({chain:e,wallet:t,limit:o=50,initialShowHidden:n=false}){let[s,r]=useState(void 0),[i,l]=useState([]),[a,d]=useState(n);useEffect(()=>{r(void 0),l([]);},[e,t]);let m=useMemo(()=>({chain:e,address:t??"",cursor:s,limit:o,positionState:"open"}),[e,t,s,o]),{data:c,isPending:u,isFetching:p}=useWalletTokenPositionsQuery(m,{enabled:!!t});useEffect(()=>{c&&l(k=>s==null?[c]:k[k.length-1]?.endCursor===c.endCursor?k:[...k,c]);},[c,s]);let x=useMemo(()=>i.flatMap(k=>k.portfolios),[i]),f=i[i.length-1],g=!!(f?.hasNext&&f.endCursor),h=useCallback(()=>{!f?.endCursor||!f.hasNext||r(f.endCursor);},[f]);return {positions:x,isLoading:!!t&&(u||p),hasMore:g,loadMore:h,showHidden:a,setShowHidden:d}}function pL({chain:e,wallet:t,limit:o,initialCurrency:n="usd",nativeSymbol:s,renderActions:r,className:i}){let[l,a]=useState(n),{positions:d,isLoading:m,hasMore:c,loadMore:u,showHidden:p,setShowHidden:x}=vi({chain:e,wallet:t,limit:o});return jsx(Ti,{className:i,positions:d,isLoading:m,hasMore:c,onLoadMore:u,currency:l,onCurrencyChange:a,showHidden:p,onShowHiddenChange:x,nativeSymbol:s,renderActions:r})}function Ni({orders:e,isLoading:t,unavailable:o,hasMore:n,onLoadMore:s,stateFilter:r,onStateFilterChange:i,onlyThisToken:l=false,onOnlyThisTokenChange:a,tokenSymbol:d,currency:m="usd",onCurrencyChange:c,nativeSymbol:u,onCancelAll:p,renderActions:x,className:f}){let{t:g}=useTranslation(),h=u??g("tokens.tokenDetail.native");return jsxs("div",{className:cn("flex flex-col",f),children:[jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"active",labelKey:"tokens.tokenDetail.activeOrders"},{k:"history",labelKey:"tokens.tokenDetail.orderHistory"}].map(k=>jsx("button",{type:"button",onClick:()=>i(k.k),className:cn("rounded px-2 transition-colors",r===k.k?"bg-default-200 text-foreground":"text-text-muted hover:text-foreground"),children:g(k.labelKey)},k.k))}),d?jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-text-muted",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:l,onChange:k=>a?.(k.target.checked)}),g("tokens.tokenDetail.filter.onlyToken",{symbol:d})]}):null]}),jsxs("div",{className:"flex items-center gap-2",children:[p?jsx("button",{type:"button",onClick:p,className:"rounded px-2 py-1 text-[11px] text-negative transition-colors hover:bg-default-100",children:g("tokens.tokenDetail.cancelAll")}):null,jsx(Up,{value:m,nativeSymbol:h,onChange:c})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[760px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[22%] px-3 py-2 text-left font-normal",children:g("tokens.tokenDetail.columns.token")}),jsx("th",{className:"w-[10%] px-3 py-2 text-left font-normal",children:g("tokens.tokenDetail.columns.type")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:g("tokens.tokenDetail.columns.amount")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:g("tokens.tokenDetail.columns.currentMarketCap")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:g("tokens.tokenDetail.columns.targetMarketCap")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:g("tokens.tokenDetail.columns.settings")}),jsx("th",{className:"w-[12%] px-3 py-2 text-right font-normal",children:g("tokens.tokenDetail.columns.action")})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:7,className:"py-10 text-center text-text-muted",children:g("tokens.tokenDetail.orders.unavailable")})}):e.length===0&&!t?jsx("tr",{children:jsx("td",{colSpan:7,className:"py-10 text-center text-text-muted",children:g(r==="active"?"tokens.tokenDetail.orders.emptyActive":"tokens.tokenDetail.orders.emptyHistorical")})}):e.map(k=>jsx(Op,{order:k,currency:m,renderActions:x},k.id)),t&&!o&&jsx("tr",{children:jsx("td",{colSpan:7,className:"py-4 text-center text-text-muted",children:g("tokens.tokenDetail.loading")})})]})]})}),!o&&n&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:g("tokens.tokenDetail.loadMore")})})]})}function Up({value:e,nativeSymbol:t,onChange:o}){return jsx("div",{className:"flex h-[24px] items-center rounded bg-default-100 p-[2px] text-[11px]",children:[{k:"usd",label:"USD"},{k:"native",label:t}].map(s=>jsx("button",{type:"button",onClick:()=>o?.(s.k),className:cn("rounded px-2 transition-colors",e===s.k?"bg-default-200 text-foreground":"text-text-muted hover:text-foreground"),children:s.label},s.k))})}function Op({order:e,currency:t,renderActions:o}){let n=useMemo(()=>t==="usd"&&e.amountInUsd?formatAmountInUsd(e.amountInUsd):formatAmount(e.amount),[t,e.amount,e.amountInUsd]),s=e.side==="buy"?"Buy":"Sell",r=e.side==="buy"?"text-positive":"text-negative";return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.tokenImage??void 0,name:(e.tokenSymbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsx("span",{className:"truncate text-foreground",children:e.tokenSymbol??"--"})]})}),jsx("td",{className:cn("px-3 py-2 align-middle font-medium",r),children:s}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:e.currentMarketCapInUsd?formatMCapInUsd(e.currentMarketCapInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:e.targetMarketCapInUsd?formatMCapInUsd(e.targetMarketCapInUsd):e.targetPriceInUsd?formatPriceInUsd(e.targetPriceInUsd):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:e.slippage!=null?`Slip ${e.slippage}%`:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle",children:o?o(e):jsx("span",{className:"text-text-muted",children:"--"})})]})}function Ep(e){return e instanceof Error&&e.code==="NotImplemented"}function Wp(e){return e==="active"?"active":"filled"}function Pi({chain:e,wallet:t,tokenAddress:o,limit:n=50,initialStateFilter:s="active",initialOnlyThisToken:r=false}){let[i,l]=useState(s),[a,d]=useState(r),[m,c]=useState(void 0),[u,p]=useState([]);useEffect(()=>{c(void 0),p([]);},[e,t,i,a,o]);let x=useCallback(N=>{N!==i&&l(N);},[i]),f=useMemo(()=>({chain:e,address:t??"",cursor:m,limit:n,state:Wp(i),tokenAddress:a?o:void 0}),[e,t,m,n,i,a,o]),{data:g,isPending:h,isFetching:k,error:T}=useWalletLimitOrdersQuery(f,{enabled:!!t});useEffect(()=>{g&&p(N=>m==null?[g]:N[N.length-1]?.endCursor===g.endCursor?N:[...N,g]);},[g,m]);let v=!!T&&Ep(T),b=useMemo(()=>u.flatMap(N=>N.data),[u]),y=u[u.length-1],L=!!(y?.hasNext&&y.endCursor),A=useCallback(()=>{!y?.endCursor||!y.hasNext||c(y.endCursor);},[y]);return {orders:b,isLoading:!!t&&!v&&(h||k),unavailable:v,hasMore:L,loadMore:A,stateFilter:i,setStateFilter:x,onlyThisToken:a,setOnlyThisToken:d}}function ML({chain:e,wallet:t,tokenAddress:o,tokenSymbol:n,limit:s,initialStateFilter:r="active",initialCurrency:i="usd",nativeSymbol:l,onCancelAll:a,renderActions:d,className:m}){let[c,u]=useState(i),{orders:p,isLoading:x,unavailable:f,hasMore:g,loadMore:h,stateFilter:k,setStateFilter:T,onlyThisToken:v,setOnlyThisToken:b}=Pi({chain:e,wallet:t,tokenAddress:o,limit:s,initialStateFilter:r});return jsx(Ni,{className:m,orders:p,isLoading:x,unavailable:f,hasMore:g,onLoadMore:h,stateFilter:k,onStateFilterChange:T,onlyThisToken:v,onOnlyThisTokenChange:b,tokenSymbol:n,currency:c,onCurrencyChange:u,nativeSymbol:l,onCancelAll:f?void 0:a,renderActions:d})}function Ai({traders:e,isLoading:t,hasMore:o,onLoadMore:n,onlyTracked:s=false,onOnlyTrackedChange:r,now:i=Date.now(),renderAddress:l,className:a}){let{t:d}=useTranslation();return jsxs("div",{className:cn("flex flex-col",a),children:[jsxs("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:[jsx("span",{className:"text-xs font-medium text-text-muted",children:d("tokens.tokenDetail.topTraders")}),jsxs("label",{className:"flex cursor-pointer items-center gap-1 text-[11px] text-text-muted",children:[jsx("input",{type:"checkbox",className:"size-3 accent-primary",checked:s,onChange:m=>r?.(m.target.checked)}),d("tokens.tokenDetail.filter.onlyTracked")]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[680px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:d("tokens.tokenDetail.columns.wallet")}),jsx("th",{className:"w-[20%] px-3 py-2 text-left font-normal",children:d("tokens.tokenDetail.columns.tags")}),jsx("th",{className:"w-[15%] px-3 py-2 text-right font-normal",children:d("tokens.tokenDetail.columns.value")}),jsx("th",{className:"w-[10%] px-3 py-2 text-right font-normal",children:"%"}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:d("tokens.tokenDetail.columns.realizedPnl")}),jsx("th",{className:"w-[13%] px-3 py-2 text-right font-normal",children:d("tokens.tokenDetail.columns.lastActive")})]})}),jsxs("tbody",{children:[e.length===0&&!t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-text-muted",children:d("tokens.tokenDetail.topTraders.empty")})}),e.map(m=>jsx(zp,{trader:m,now:i,renderAddress:l},m.address)),t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-text-muted",children:d("tokens.tokenDetail.loading")})})]})]})}),o&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:n,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:d("tokens.tokenDetail.loadMore")})})]})}function zp({trader:e,now:t,renderAddress:o}){let n=useMemo(()=>o?o(e.address):jsx("span",{className:"font-mono text-[11px] text-text-muted",children:Te(e.address,6,6)}),[e.address,o]);return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:n}),jsx("td",{className:"px-3 py-2 align-middle",children:jsx(Et,{tags:e.tags,max:3})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:formatAmountInUsd(e.amountInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:formatAmountInUsd(e.totalRealizedPnlInUsd)}),jsx("td",{className:"px-3 py-2 text-right align-middle text-text-muted",children:e.lastActiveAt?Pe(e.lastActiveAt,t):"--"})]})}function Mi({chain:e,address:t,limit:o=50,initialSortBy:n,initialSortDirection:s,initialOnlyTracked:r=false}){let[i,l]=useState(n),[a,d]=useState(s),[m,c]=useState(void 0),[u,p]=useState([]),[x,f]=useState(r),g=useCallback(()=>{c(void 0),p([]);},[]),h=useCallback((W,ge)=>{W===i&&ge===a||(l(W),d(ge),g());},[g,i,a]),k=useCallback(W=>{h(W,a??"desc");},[h,a]),T=useCallback(W=>{W!==a&&(d(W),g());},[g,a]);useEffect(()=>{g();},[e,t,g]);let v=useMemo(()=>({chain:e,address:t,cursor:m,limit:o,sortBy:i,sortDirection:a}),[e,t,m,o,i,a]),{data:b,isPending:y,isFetching:L}=useTokenTopTradersQuery(v);useEffect(()=>{b&&p(W=>m==null?[b]:W[W.length-1]?.endCursor===b.endCursor?W:[...W,b]);},[b,m]);let A=useMemo(()=>u.flatMap(W=>W.data),[u]),N=useMemo(()=>x?A.filter(W=>W.tags&&W.tags.length>0):A,[A,x]),K=u[u.length-1],fe=!!(K?.hasNext&&K.endCursor),E=useCallback(()=>{!K?.endCursor||!K.hasNext||c(K.endCursor);},[K]);return {traders:N,isLoading:y||L,sortBy:i,sortDirection:a,setSortBy:k,setSortDirection:T,setSort:h,hasMore:fe,loadMore:E,onlyTracked:x,setOnlyTracked:f}}function ZL({chain:e,address:t,limit:o,className:n,renderAddress:s}){let{traders:r,isLoading:i,hasMore:l,loadMore:a,onlyTracked:d,setOnlyTracked:m}=Mi({chain:e,address:t,limit:o});return jsx(Ai,{className:n,traders:r,isLoading:i,hasMore:l,onLoadMore:a,onlyTracked:d,onOnlyTrackedChange:m,renderAddress:s})}var Jp="\u2713";function Ui({tokens:e,isLoading:t,unavailable:o,hasMore:n,onLoadMore:s,renderTokenLink:r,className:i}){let{t:l}=useTranslation();return jsxs("div",{className:cn("flex flex-col",i),children:[jsx("div",{className:"flex items-center justify-between gap-4 px-3 py-2",children:jsx("span",{className:"text-xs font-medium text-text-muted",children:l("tokens.tokenDetail.devTokens.title")})}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full min-w-[700px] table-fixed text-[12px]",children:[jsx("thead",{className:"text-text-muted",children:jsxs("tr",{className:"border-b border-default-100",children:[jsx("th",{className:"w-[28%] px-3 py-2 text-left font-normal",children:l("tokens.tokenDetail.columns.token")}),jsx("th",{className:"w-[10%] px-3 py-2 text-center font-normal",children:l("tokens.tokenDetail.columns.migrated")}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:l("tokens.tokenDetail.columns.marketCap")}),jsx("th",{className:"w-[14%] px-3 py-2 text-right font-normal",children:l("tokens.tokenDetail.columns.ath")}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:l("tokens.tokenDetail.liquidity")}),jsx("th",{className:"w-[16%] px-3 py-2 text-right font-normal",children:l("tokens.tokenDetail.columns.volume1h")})]})}),jsxs("tbody",{children:[o?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-10 text-center text-text-muted",children:l("tokens.tokenDetail.devTokens.unavailable")})}):e.length===0&&!t?jsx("tr",{children:jsx("td",{colSpan:6,className:"py-8 text-center text-text-muted",children:l("tokens.tokenDetail.devTokens.empty")})}):e.map(a=>jsx(Zp,{token:a,renderTokenLink:r},`${a.chain}:${a.address}`)),!o&&t&&jsx("tr",{children:jsx("td",{colSpan:6,className:"py-4 text-center text-text-muted",children:l("tokens.tokenDetail.loading")})})]})]})}),!o&&n&&jsx("div",{className:"flex justify-center px-3 py-2",children:jsx("button",{type:"button",onClick:s,disabled:t,className:"rounded bg-default-100 px-3 py-1 text-[11px] text-text-muted transition-colors hover:bg-default-200 disabled:opacity-50",children:l("tokens.tokenDetail.loadMore")})})]})}function Zp({token:e,renderTokenLink:t}){let o=e.marketData?.marketCapInUsd??e.marketData?.marketCap,n=e.marketData?.tvlInUsd,r=e.stats?.["1h"]?.volumesInUsd,i=!!e.migratedTo,l=t?t(e):jsxs("div",{className:"flex items-center gap-2",children:[jsx(Avatar,{src:e.image??void 0,name:(e.symbol??e.name??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-col",children:[jsx("span",{className:"truncate text-foreground",children:e.symbol}),jsx("span",{className:"truncate text-[10px] text-text-muted",children:e.name})]})]});return jsxs("tr",{className:"border-b border-default-50 hover:bg-default-50/60",children:[jsx("td",{className:"px-3 py-2 align-middle",children:l}),jsx("td",{className:"px-3 py-2 text-center align-middle",children:i?jsx("span",{className:"text-positive",children:Jp}):jsx("span",{className:"text-text-muted",children:"\u2014"})}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:o?formatMCapInUsd(o):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:n?formatAmountInUsd(n):"--"}),jsx("td",{className:"px-3 py-2 text-right align-middle text-foreground",children:r?formatAmountInUsd(r):"--"})]})}function Oi({tokens:e,className:t}){let{t:o}=useTranslation(),n=e.length,s=e.filter(a=>!!a.migratedTo).length,r=n===0?0:Math.round(s/n*100),i=e.map(a=>a.stats?.["1h"]?.volumesInUsd??"0").reduce((a,d)=>a.plus(new SafeBigNumber(d)),new SafeBigNumber(0)),l=e.map(a=>a.marketData?.marketCapInUsd??a.marketData?.marketCap??"0").reduce((a,d)=>a.plus(new SafeBigNumber(d)),new SafeBigNumber(0));return jsxs("div",{className:cn("flex flex-col gap-2 p-3",t),children:[jsx("div",{className:"flex items-center justify-between",children:jsx("span",{className:"text-xs font-medium text-text-muted",children:o("tokens.tokenDetail.devTokens.stats")})}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(fo,{label:o("tokens.tokenDetail.devTokens.total"),value:String(n)}),jsx(fo,{label:o("tokens.tokenDetail.columns.migrated"),value:`${s} (${r}%)`}),jsx(fo,{label:o("tokens.tokenDetail.devTokens.totalMarketCap"),value:formatMCapInUsd(l.toString())}),jsx(fo,{label:o("tokens.tokenDetail.devTokens.totalVolume1h"),value:formatAmountInUsd(i.toString())})]})]})}function fo({label:e,value:t}){return jsxs("div",{className:"flex flex-col gap-[2px]",children:[jsx("span",{className:"text-[10px] text-text-muted",children:e}),jsx("span",{className:"text-[13px] font-medium text-foreground",children:t})]})}function ef(e){return e instanceof Error&&e.code==="NotImplemented"}function Ki({chain:e,creator:t,limit:o=20}){let[n,s]=useState(void 0),[r,i]=useState([]),l=useCallback(()=>{s(void 0),i([]);},[]);useEffect(()=>{l();},[e,t,l]);let a=useMemo(()=>({chain:e,creator:t??"",cursor:n,limit:o}),[e,t,n,o]),{data:d,isPending:m,isFetching:c,error:u}=useTokensByCreatorQuery(a,{enabled:!!t});useEffect(()=>{d&&i(k=>n==null?[d]:k[k.length-1]?.endCursor===d.endCursor?k:[...k,d]);},[d,n]);let p=useMemo(()=>r.flatMap(k=>k.data),[r]),x=r[r.length-1],f=!!(x?.hasNext&&x.endCursor),g=!!u&&ef(u),h=useCallback(()=>{!x?.endCursor||!x.hasNext||s(x.endCursor);},[x]);return {tokens:p,isLoading:!!t&&!g&&(m||c),unavailable:g,hasMore:f,loadMore:h}}function gP({chain:e,creator:t,limit:o,showSummary:n=false,renderTokenLink:s,className:r}){let{tokens:i,isLoading:l,unavailable:a,hasMore:d,loadMore:m}=Ki({chain:e,creator:t,limit:o});return jsxs("div",{className:r,children:[jsx(Ui,{tokens:i,isLoading:l,unavailable:a,hasMore:d,onLoadMore:m,renderTokenLink:s}),n&&!a?jsx(Oi,{tokens:i}):null]})}function Qi({token:e,athInUsd:t,athAt:o,globalFeesPaidInUsd:n,rank:s,onTogglePin:r,pinned:i,className:l}){let{t:a}=useTranslation(),d=e?.marketData?.priceInUsd,m=e?.marketData?.tvlInUsd,c=e?.marketData?.totalSupply;return jsxs("div",{className:cn("flex h-[48px] w-full flex-row items-center gap-4 overflow-x-auto px-3 text-[12px]",l),children:[jsx(st,{label:a("tokens.tokenDetail.chart.price"),value:d?formatPriceInUsd(d):"--"}),jsx(st,{label:a("tokens.tokenDetail.chart.liquidity"),value:m?formatAmountInUsd(m):"--"}),jsx(st,{label:a("tokens.tokenDetail.chart.supply"),value:c?formatAmount(c):"--"}),n?jsx(st,{label:a("tokens.tokenDetail.chart.feesPaid"),value:formatAmountInUsd(n)}):null,t?jsx(st,{label:a("tokens.tokenDetail.chart.ath"),value:formatPriceInUsd(t),title:o?a("tokens.tokenDetail.chart.athAt",{date:o.toLocaleDateString()}):void 0}):null,s!==void 0?jsx(st,{label:a("tokens.tokenDetail.chart.rank"),value:`#${s}`}):null,jsx("div",{className:"flex-1"}),r?jsx("button",{type:"button",onClick:r,"aria-pressed":i,className:cn("flex size-[26px] items-center justify-center rounded text-text-muted transition-colors hover:bg-default-100 hover:text-foreground",i&&"text-foreground"),title:a(i?"tokens.tokenDetail.chart.unpin":"tokens.tokenDetail.chart.pin"),children:i?"\u2605":"\u2606"}):null]})}function st({label:e,value:t,title:o}){return jsxs("div",{className:"flex flex-col items-start justify-center gap-[2px] whitespace-nowrap",title:o,children:[jsx("span",{className:"text-[10px] leading-none text-text-muted",children:e}),jsx("span",{className:"text-[13px] font-medium leading-none tabular-nums text-foreground",children:t})]})}function Xi({chain:e,address:t}){return F(e,t)}function IP({chain:e,address:t,athInUsd:o,athAt:n,globalFeesPaidInUsd:s,rank:r,pinned:i,onTogglePin:l,className:a}){let{token:d}=Xi({chain:e,address:t});return jsx(Qi,{className:a,token:d,athInUsd:o,athAt:n,globalFeesPaidInUsd:s,rank:r,pinned:i,onTogglePin:l})}function Yi({tokens:e,isLoading:t,unavailable:o,onTokenClick:n,className:s}){let{t:r}=useTranslation();return o?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-text-muted",s),children:r("tokens.tokenDetail.similarUnavailable")}):!t&&e.length===0?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-text-muted",s),children:r("tokens.tokenDetail.noSimilarTokens")}):jsxs("ul",{className:cn("flex flex-col",s),children:[e.map(i=>jsxs("li",{className:cn("flex cursor-pointer items-center gap-2 border-b border-default-50 px-3 py-2 last:border-0 hover:bg-default-50/60",!n&&"cursor-default"),onClick:n?()=>n(i):void 0,children:[jsx(Avatar,{src:i.image??void 0,name:(i.symbol??"?").slice(0,1),className:"size-5 shrink-0 rounded-full bg-default-200 text-[10px]",showFallback:true}),jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[jsx("span",{className:"truncate text-[12px] text-foreground",children:i.symbol}),jsx("span",{className:"truncate text-[10px] text-text-muted",children:i.name})]}),jsx("span",{className:"text-[11px] tabular-nums text-text-muted",children:i.marketData?.marketCapInUsd?formatMCapInUsd(i.marketData.marketCapInUsd):"--"})]},`${i.chain}:${i.address}`)),t&&jsx("li",{className:"py-2 text-center text-[11px] text-text-muted",children:r("tokens.tokenDetail.loading")})]})}function Ji({chain:e,address:t,keyword:o,limit:n=10}){let s=!!o&&o.length>0,{data:r,isPending:i,isFetching:l}=useSearchTokensQuery({chains:[e],keyword:o,limit:n+1},{enabled:s});return {tokens:useMemo(()=>{if(!r)return [];let d=t.toLowerCase();return (r.data??[]).filter(m=>m.address.toLowerCase()!==d).slice(0,n)},[r,t,n]),isLoading:s&&(i||l),unavailable:!s}}function GP({chain:e,address:t,keyword:o,limit:n,onTokenClick:s,className:r}){let{tokens:i,isLoading:l,unavailable:a}=Ji({chain:e,address:t,keyword:o,limit:n});return jsx(Yi,{className:r,tokens:i,isLoading:l,unavailable:a,onTokenClick:s})}function Zi({tokens:e=[],unavailable:t=true,onTokenClick:o,className:n}){let{t:s}=useTranslation();return t?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-text-muted",n),children:s("tokens.tokenDetail.reusedImagesUnavailable")}):e.length===0?jsx("div",{className:cn("flex items-center justify-center p-4 text-center text-[11px] text-text-muted",n),children:s("tokens.tokenDetail.noReusedImages")}):jsx("div",{className:cn("flex flex-row flex-wrap gap-2 p-3",n),children:e.map(r=>jsx("button",{type:"button",onClick:o?()=>o(r):void 0,className:"flex size-10 items-center justify-center overflow-hidden rounded-full border border-default-100 transition-opacity hover:opacity-80",title:r.symbol,children:jsx(Avatar,{src:r.image??void 0,name:(r.symbol??"?").slice(0,1),className:"size-full bg-default-100 text-[10px] text-text-muted",showFallback:true})},`${r.chain}:${r.address}`))})}function ji(e){return {tokens:[],isLoading:false,unavailable:true}}function l1({chain:e,address:t,onTokenClick:o,className:n}){let{tokens:s,unavailable:r}=ji();return jsx(Zi,{className:n,tokens:s,unavailable:r,onTokenClick:o})}function ra({keywords:e,excludeKeywords:t,onKeywordsChange:o,onExcludeKeywordsChange:n,className:s}){let{t:r}=useTranslation(),[i,l]=useState(e?.join(", ")??""),[a,d]=useState(t?.join(", ")??"");useEffect(()=>{l(u=>{let p=ko(u);return p===void 0&&e===void 0?u:p===void 0?e?.join(", ")??"":e===void 0?"":p.join("")===e.join("")?u:e.join(", ")});},[e]),useEffect(()=>{d(u=>{let p=ko(u);return p===void 0&&t===void 0?u:p===void 0?t?.join(", ")??"":t===void 0?"":p.join("")===t.join("")?u:t.join(", ")});},[t]);let m=useCallback(u=>{l(u),o?.(ko(u));},[o]),c=useCallback(u=>{d(u),n?.(ko(u));},[n]);return jsxs("div",{className:cn("grid grid-cols-2 gap-3 px-4",s),children:[jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-text-muted",children:r("tokens.filters.keywords.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:r("tokens.filters.keywords.placeholder"),value:i,onValueChange:m})]}),jsxs("div",{className:"flex flex-col gap-3",children:[jsx("h3",{className:"text-xs text-text-muted",children:r("tokens.filters.keywords.exclude.title")}),jsx(StyledInput,{variant:"bordered",radius:"lg",size:"sm",placeholder:r("tokens.filters.keywords.placeholder"),value:a,onValueChange:c})]})]})}function ko(e){let t=e.split(",").map(o=>o.trim()).filter(Boolean);return t.length>0?t:void 0}function ca({protocols:e,selectedProtocols:t=[],onSelectedProtocolsChange:o,className:n}){let{t:s}=useTranslation(),[r,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useMemo(()=>e.every(m=>r.includes(m)),[e,r]),a=useCallback(()=>{if(l){let m=[];i(m),o?.(m);}else {let m=[...e];i(m),o?.(m);}},[e,o,l]),d=useCallback(m=>()=>{if(r.includes(m)){let c=r.filter(u=>u!==m);i(c),o?.(c);}else {let c=[...r,m];i(c),o?.(c);}},[r,o]);return jsxs("div",{className:cn("flex flex-col gap-3 px-4",n),children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-xs text-text-muted",children:s("tokens.filters.protocols.title")}),jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",onPress:a,children:s(l?"tokens.filters.protocols.unselectAll":"tokens.filters.protocols.selectAll")})]}),jsx("div",{className:"grid grid-cols-3 gap-3",children:e.map(m=>{let c=Be(m);return jsx(Button,{variant:"bordered",size:"sm",radius:"full",className:cn("w-fit h-6 px-2.5",c.text,c.bg5,"border",c.border,{"opacity-40 data-[hover=true]:!opacity-30":!r.includes(m)}),startContent:jsx(Image,{width:14,height:14,src:`/images/protocols/${m}.svg`,alt:formatTokenProtocolName(m)}),onPress:d(m),children:formatTokenProtocolName(m)},m)})})]})}function Ne({title:e,field:t,value:o,onChange:n}){let{t:s}=useTranslation(),[r,i]=useState(o?vn(o).min:NaN),[l,a]=useState(o?vn(o).max:NaN);useEffect(()=>{if(o===void 0)i(NaN),a(NaN);else {let{min:c,max:u}=vn(o);i(c),a(u);}},[o]);let d=useCallback(c=>{i(c),n?.(fa(t,c,l));},[t,n,l]),m=useCallback(c=>{a(c),n?.(fa(t,r,c));},[t,n,r]);return jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx("h3",{className:"text-xs text-text-muted",children:e}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsx(StyledNumberInput,{value:r,onValueChange:d,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.min"),"aria-label":`${e} min`}),jsx(StyledNumberInput,{value:l,onValueChange:m,variant:"bordered",radius:"lg",size:"sm",placeholder:s("tokens.filters.stats.max"),"aria-label":`${e} max`})]})]})}function vn(e){if(e.operator==="between"){let[t,o]=e.value;return {min:t,max:o}}return e.operator==="gte"?{min:e.value,max:NaN}:e.operator==="lte"?{min:NaN,max:e.value}:{min:NaN,max:NaN}}function fa(e,t,o){if(!(isNaN(t)&&isNaN(o)))return isNaN(t)?{field:e,operator:"lte",value:o}:isNaN(o)?{field:e,operator:"gte",value:t}:{field:e,operator:"between",value:[t,o]}}function ka({values:e,onValuesChange:t,className:o}){let{t:n}=useTranslation(),[s,r]=useState(e);useEffect(()=>{r(e);},[e]);let i=useCallback(l=>a=>{if(a===void 0){let d=(s??[]).filter(m=>m.field!==l);d=d.length>0?d:void 0,r(d),t?.(d);}else {let d=[...(s??[]).filter(m=>m.field!==l),a];r(d),t?.(d);}},[s,t]);return jsxs("div",{className:cn("flex flex-col gap-4",o),children:[jsx(Ne,{field:"holders",title:n("tokens.filters.stats.audits.holders"),value:s?.find(l=>l.field==="holders"),onChange:i("holders")}),jsx(Ne,{field:"top10Ratio",title:n("tokens.filters.stats.audits.top10HoldingsRatio"),value:s?.find(l=>l.field==="top10Ratio"),onChange:i("top10Ratio")}),jsx(Ne,{field:"top100Ratio",title:n("tokens.filters.stats.audits.top100HoldingsRatio"),value:s?.find(l=>l.field==="top100Ratio"),onChange:i("top100Ratio")}),jsx(Ne,{field:"creatorsRatio",title:n("tokens.filters.stats.audits.devHoldingsRatio"),value:s?.find(l=>l.field==="creatorsRatio"),onChange:i("creatorsRatio")})]})}function xa({resolution:e,values:t,onValuesChange:o,className:n}){let{t:s}=useTranslation(),[r,i]=useState(t);useEffect(()=>{i(t);},[t]);let l=useCallback(a=>d=>{if(d===void 0){let m=(r??[]).filter(c=>c.field!==a);m=m.length>0?m:void 0,i(m),o?.(m);}else {let m=[...(r??[]).filter(c=>c.field!==a),d];i(m),o?.(m);}},[r,o]);return jsxs("div",{className:cn("flex flex-col gap-4",n),children:[jsx(Ne,{field:"marketCap",title:s("tokens.filters.stats.metrics.marketCap"),value:r?.find(a=>a.field==="marketCap"),onChange:l("marketCap")}),jsx(Ne,{field:"tvl",title:s("tokens.filters.stats.metrics.liquidity"),value:r?.find(a=>a.field==="tvl"),onChange:l("tvl")}),jsx(Ne,{field:`volumes${e}`,title:s("tokens.filters.stats.metrics.volumes",{resolution:s(`common.resolution.${e}`)}),value:r?.find(a=>a.field===`volumes${e}`),onChange:l(`volumes${e}`)}),jsx(Ne,{field:`trades${e}`,title:s("tokens.filters.stats.metrics.txns",{resolution:s(`common.resolution.${e}`)}),value:r?.find(a=>a.field===`trades${e}`),onChange:l(`trades${e}`)})]})}function Sa({resolution:e,values:t,onValuesChange:o,className:n}){let{t:s}=useTranslation(),[r,i]=useState("audits"),[l,a]=useState(t);useEffect(()=>{a(t);},[t]);let d=useCallback(u=>{a(u),o?.(u);},[o]),m=useMemo(()=>{let u=["holders","top10Ratio","top100Ratio","creatorsRatio"];return l?.filter(p=>u.includes(p.field))?.length??0},[l]),c=useMemo(()=>{let u=["marketCap","tvl",`volumes${e}`,`trades${e}`];return l?.filter(p=>u.includes(p.field)).length??0},[l,e]);return jsxs("div",{className:cn("flex flex-col gap-3 px-4",n),children:[jsxs(StyledLightTabs,{color:"default",radius:"full",size:"sm",selectedKey:r,onSelectionChange:i,children:[jsx(Tab,{title:m===0?s("tokens.filters.stats.audits"):jsx(StyledBadge,{color:"primary",size:"sm",content:m,shape:"circle",children:s("tokens.filters.stats.audits")})},"audits"),jsx(Tab,{title:c===0?s("tokens.filters.stats.metrics"):jsx(StyledBadge,{color:"primary",size:"sm",content:c,shape:"circle",children:s("tokens.filters.stats.metrics")})},"metrics")]}),jsx(ka,{values:l,onValuesChange:d,className:cn({hidden:r!=="audits"})}),jsx(xa,{values:l,onValuesChange:d,resolution:e,className:cn({hidden:r!=="metrics"})})]})}function No({protocols:e,resolution:t,filters:o,onFiltersChange:n,className:s}){let[r,i]=useState(Na(o?.filters,e));useEffect(()=>{i(Na(o?.filters,e));},[o?.filters,e]);let[l,a]=useState(o?.keywords);useEffect(()=>{a(o?.keywords);},[o?.keywords]);let[d,m]=useState(o?.excludeKeywords);useEffect(()=>{m(o?.excludeKeywords);},[o?.excludeKeywords]);let[c,u]=useState(o?.filters);useEffect(()=>{u(o?.filters);},[o?.filters]);let p=useCallback(h=>{i(h),n?.(So(e,h,l,d,c));},[e,l,d,c,n]),x=useCallback(h=>{a(h),n?.(So(e,r,h,d,c));},[e,r,d,c,n]),f=useCallback(h=>{m(h),n?.(So(e,r,l,h,c));},[e,r,l,c,n]),g=useCallback(h=>{u(h),n?.(So(e,r,l,d,h));},[e,r,l,d,n]);return jsxs("div",{className:cn("flex flex-col gap-4",s),children:[e&&e.length>0&&jsxs(Fragment,{children:[jsx(ca,{protocols:e,selectedProtocols:r,onSelectedProtocolsChange:p}),jsx("div",{style:{height:1,background:"var(--color-surface-strong)"}})]}),jsx(ra,{keywords:l,excludeKeywords:d,onKeywordsChange:x,onExcludeKeywordsChange:f}),jsx("div",{style:{height:1,background:"var(--color-surface-strong)"}}),jsx(Sa,{resolution:t,values:c,onValuesChange:g})]})}function Na(e,t){let o=e?.find(n=>n.field==="launchedFromProtocolFamily");return o?o.operator==="in"?o.value:(console.warn("invalid token protocols filter",o),[...t||[]]):[...t||[]]}function So(e,t,o,n,s){let r=s?[...s.filter(i=>i.field!=="launchedFromProtocolFamily")]:[];return e&&e.length>0&&(e.every(l=>t.includes(l))||r.push({field:"launchedFromProtocolFamily",operator:"in",value:t})),o===void 0&&n===void 0&&r.length===0?void 0:{keywords:o,excludeKeywords:n,filters:r.length>0?r:void 0}}function Pa({protocols:e,resolution:t,filters:o,onFiltersChange:n,triggerVariant:s="default",badgePlacement:r="outer",className:i}){let{t:l}=useTranslation(),{isOpen:a,onOpen:d,onClose:m,onOpenChange:c}=useDisclosure(),[u,p]=useState(o),x=useCallback(()=>{p(void 0);},[]),f=useCallback(()=>{n?.(u),m();},[u,n,m]);useEffect(()=>{p(o);},[a,o]);let g=useMemo(()=>Object.values(o||{}).every(h=>h===void 0),[o]);return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:i,onClick:d,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:9999,border:s==="plain"?"none":"1px solid rgba(63,63,70,0.5)",background:s==="plain"?"transparent":"hsl(var(--heroui-content3) / 0.6)",width:32,height:32,minHeight:32,padding:0,cursor:"pointer",position:"relative"},children:[jsx(FilterIcon,{width:16,height:16,className:"text-text-secondary"}),!g&&jsx("span",{style:{position:"absolute",top:r==="icon"?6:-2,right:r==="icon"?6:-2,width:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),jsx(StyledModal,{isOpen:a,onOpenChange:c,size:"md",scrollBehavior:"inside",children:jsxs(ModalContent,{className:"w-full h-full",children:[jsx(ModalHeader,{className:"px-4 py-2",children:jsx("span",{className:"text-base font-semibold",children:l("tokens.filters.modal.title")})}),jsx(ModalBody,{className:"px-0 pt-0 pb-4",children:jsx(ScrollShadow,{children:jsx(No,{protocols:e,resolution:t,filters:u,onFiltersChange:p,className:"pb-4"})})}),jsx(ModalFooter,{className:"px-4",children:jsxs("div",{className:"w-full flex justify-between items-center",children:[jsx(Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:x,children:l("common.reset")}),jsx(Button,{color:"primary",size:"sm",radius:"full",onPress:f,children:l("common.apply")})]})})]})})]})}var Ma={display:"inline-flex",alignItems:"center",gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"hsl(var(--heroui-content3) / 0.6)",padding:"6px 12px",fontSize:14,fontWeight:700,color:"var(--color-text-primary)",cursor:"pointer",transition:"all 0.15s",height:32},lg={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid var(--color-border-control)",background:"var(--color-surface-interactive)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},dg={height:1,background:"var(--color-surface-strong)",margin:0};function Da({protocols:e,resolution:t,filters:o,onFiltersChange:n,iconOnly:s=false,className:r}){let{t:i}=useTranslation(),[l,a]=useState(false),d=useRef(null),[m,c]=useState(o),u=useCallback(()=>{c(void 0);},[]),p=useCallback(()=>{n?.(m),a(false);},[m,n]);useEffect(()=>{c(o);},[l,o]),useEffect(()=>{let f=g=>{d.current&&!d.current.contains(g.target)&&a(false);};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),useEffect(()=>{if(!l)return;let f=g=>{g.key==="Escape"&&a(false);};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[l]);let x=useMemo(()=>Object.values(o||{}).every(f=>f===void 0),[o]);return jsxs("div",{ref:d,style:{position:"relative"},children:[jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxs("button",{type:"button",className:r,style:s?{...Ma,justifyContent:"center",gap:0,width:32,minWidth:32,padding:0}:Ma,onMouseEnter:f=>{f.currentTarget.style.background="var(--color-surface-strong)";},onMouseLeave:f=>{f.currentTarget.style.background="hsl(var(--heroui-content3) / 0.6)";},onClick:()=>a(f=>!f),children:[jsx(FilterIcon,{width:16,height:16,className:"flex-none"}),!s&&jsxs(Fragment,{children:[jsx("span",{className:"hidden sm:block",children:i("tokens.listHeader.filter")}),jsx(cg,{open:l})]})]}),!x&&jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:8,height:8,borderRadius:4,background:"#c7ff2e"}})]}),l&&jsxs("div",{style:{...lg,width:420},children:[jsx("div",{style:{padding:"16px 0"},children:jsx(ScrollShadow,{className:"w-full max-h-120 px-4",children:jsx(No,{protocols:e,resolution:t,filters:m,onFiltersChange:c})})}),jsx("div",{style:dg}),jsxs("div",{style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsx(Button,{variant:"light",size:"sm",color:"default",radius:"full",startContent:jsx(RefreshIcon,{width:16,height:16}),onPress:u,children:i("common.reset")}),jsx(Button,{variant:"solid",size:"sm",color:"primary",radius:"full",onPress:p,children:i("common.apply")})]})]})]})}function cg({open:e}){return jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"var(--color-text-muted)",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m6 9 6 6 6-6"})})}function eR({popoverPlacement:e="bottom-end",iconOnly:t,className:o,desktopOverlay:n="popover",...s}){let{isMobile:r}=useScreen();return r||n==="modal"?jsx(Pa,{className:o,...s}):jsx(Da,{placement:e,iconOnly:t,className:o,...s})}function Ua({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:n}=useTranslation(),s=useCallback(r=>{t?.(r);},[t]);return jsx(StyledPlainTabs,{color:"primary",radius:"lg",selectedKey:e,onSelectionChange:s,"aria-label":n("tokens.resolutionSelector.ariaLabel"),classNames:{tabList:"gap-0",tab:"px-2",tabContent:"!text-text-muted group-data-[hover=true]:!text-foreground group-data-[selected=true]:!text-primary"},children:o.map(r=>jsx(Tab,{title:n(`common.resolution.${r}`)},r))})}var Ng={display:"inline-flex",alignItems:"center",gap:4,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"hsl(var(--heroui-content3) / 0.6)",padding:"0 10px",fontSize:12,fontWeight:500,color:"var(--color-text-primary)",cursor:"pointer",height:32,minHeight:32},Cg={position:"absolute",left:0,top:"100%",zIndex:20,marginTop:6,borderRadius:14,border:"1px solid var(--color-border-control)",background:"var(--color-surface-interactive)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden",padding:"6px",minWidth:"100%"};function Ba({resolution:e,onResolutionChange:t,resolutionOptions:o=["1m","5m","1h","4h","24h"]}){let{t:n}=useTranslation(),[s,r]=useState(false),i=useRef(null),l=useCallback(a=>{t?.(a),r(false);},[t]);return useEffect(()=>{if(!s)return;let a=m=>{i.current&&!i.current.contains(m.target)&&r(false);},d=m=>{m.key==="Escape"&&r(false);};return document.addEventListener("mousedown",a),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",d);}},[s]),jsxs("div",{ref:i,style:{position:"relative",zIndex:50},children:[jsxs("button",{type:"button",style:Ng,onClick:()=>r(a=>!a),children:[jsx("span",{children:e?n(`common.resolution.${e}`):"\u2014"}),jsx(ChevronDownIcon,{width:14,height:14,className:"text-text-muted",style:{transition:"transform 0.15s",transform:s?"rotate(180deg)":void 0}})]}),s&&jsx("div",{style:Cg,children:o.map(a=>jsx("button",{type:"button",onClick:()=>l(a),className:cn("w-full text-left px-3 py-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer",a===e?"text-primary bg-primary/10":"text-text-secondary hover:text-foreground hover:bg-surface-interactive"),children:n(`common.resolution.${a}`)},a))})]})}function xR(e){let{isMobile:t}=useScreen();return t?jsx(Ba,{...e}):jsx(Ua,{...e})}var Wa=memo(function({token:t}){let o=useMemo(()=>t.marketData?.athMarketCapInUsd,[t.marketData?.athMarketCapInUsd]);return jsx(Fragment,{children:formatMCapInUsd(o)})});var Ka=memo(function({token:t}){let{t:o}=useTranslation(),n=useMemo(()=>t.marketData?.bluechipHoldingsRatio,[t.marketData?.bluechipHoldingsRatio]),s=useMemo(()=>n!==void 0&&new SafeBigNumber(n).gte(.1),[n]),r=useMemo(()=>n===void 0||new SafeBigNumber(n).lt(.05),[n]);return jsx(StyledTooltip,{content:o("tokens.bluechip.explained"),children:jsxs("div",{className:"flex items-center gap-2.5",children:[s&&jsx(HorsePowerHighIcon,{}),r&&jsx(HorsePowerLowIcon,{}),!s&&!r&&jsx(HorsePowerIcon,{}),jsx("span",{className:cn(s&&"text-positive",!s&&!r&&"text-negative",n===void 0&&"text-text-muted"),children:formatPercent(n)})]})})});function ek(e){return e.length<=10?e:`${e.slice(0,4)}...${e.slice(-4)}`}var Xa=memo(function({token:t}){let o=useCopyToClipboard(),[n,s]=useState(false),[r,i]=useState(false),l=useRef(void 0),a=useRef(void 0),{t:d}=useTranslation(),m=useCallback(p=>{p.preventDefault(),p.stopPropagation(),o(t.name,()=>{toast.success(d("tokens.copied.name")),s(true),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s(false);},2e3);});},[o,t.name,d]),c=useCallback(p=>{p.preventDefault(),p.stopPropagation(),o(t.address,()=>{toast.success(d("tokens.copied.address")),i(true),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(false);},2e3);});},[o,t.address,d]);useEffect(()=>()=>{l.current&&clearTimeout(l.current),a.current&&clearTimeout(a.current);},[]);let u=useTickAge(t.createdAt);return jsxs("div",{className:"w-full flex justify-start items-center gap-3",children:[jsx(ke,{token:t,showProgress:false,className:"w-10 h-10 sm:w-16 sm:h-16 flex-none"}),jsxs("div",{className:"flex-auto flex flex-col gap-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"flex-none font-medium tracking-[-0.02em]",children:t.symbol}),jsx(StyledTooltip,{content:t.name,children:jsxs("div",{className:"flex-initial flex items-center gap-1 min-w-0 text-text-muted hover:text-primary-200 cursor-pointer",onClick:m,children:[jsx("div",{className:"flex-initial whitespace-nowrap truncate",children:t.name}),n?jsx(CheckIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"}):jsx(CopyIcon,{className:"flex-none w-3 h-3 sm:w-3.5 sm:h-3.5"})]})})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-primary text-xs sm:text-sm font-medium",children:formatAge(u)}),jsxs("button",{type:"button",className:"group flex items-center gap-1 min-w-0 max-w-28 sm:max-w-36 text-text-muted hover:text-primary-200 cursor-pointer",onClick:c,"aria-label":d("tokens.copied.address"),children:[jsx("span",{className:"min-w-0 truncate text-left text-xs font-mono text-text-muted/70 group-hover:text-primary-200",children:ek(t.address)}),r?jsx(CheckIcon,{className:"flex-none w-3 h-3"}):jsx(CopyIcon,{className:"flex-none w-3 h-3"})]}),t.socialMedias?.website&&jsx(Link,{href:t.socialMedias.website,className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.twitter&&jsx(Link,{href:t.socialMedias.twitter,className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",children:jsx(TwitterIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.telegram&&jsx(Link,{href:t.socialMedias.telegram,className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",children:jsx(TelegramIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),t.socialMedias?.discord&&jsx(Link,{href:t.socialMedias.discord,className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",children:jsx(DiscordIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})}),jsx(Link,{href:searchTwitterUrl(`${t.symbol} OR ${t.address}`),className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",children:jsx(SearchIcon,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})]})});var Ya=memo(function({token:t}){let{t:o}=useTranslation(),n=t.marketData,s=useMemo(()=>new SafeBigNumber(n?.top10HoldingsRatio).gte(.1),[n?.top10HoldingsRatio]),r=useMemo(()=>new SafeBigNumber(n?.devHoldingsRatio).gte(.1),[n?.devHoldingsRatio]),i=useMemo(()=>new SafeBigNumber(n?.sniperHoldingsRatio).gte(.1),[n?.sniperHoldingsRatio]),l=useMemo(()=>new SafeBigNumber(n?.insiderHoldingsRatio).gte(.1),[n?.insiderHoldingsRatio]),a=useMemo(()=>new SafeBigNumber(n?.bundleHoldingsRatio).gte(.1),[n?.bundleHoldingsRatio]);return jsxs("div",{className:"w-full h-full flex flex-col gap-1 justify-center",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(PeopleIcon,{width:12,height:12}),value:formatAmount(n?.holders),tooltip:o("tokens.tokenInfo.holders"),warning:false,disable:!n?.holders}),jsx($,{icon:jsx(KlineCandlesIcon,{width:12,height:12}),value:formatAmount(n?.proHolders),tooltip:o("tokens.tokenInfo.proHolders"),warning:false,disable:!n?.proHolders}),jsx($,{icon:jsx(StarIcon,{width:12,height:12}),value:formatAmount(n?.kolHolders),tooltip:o("tokens.tokenInfo.kolHolders"),warning:false,disable:!n?.kolHolders}),jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(n?.top10HoldingsRatio),tooltip:o("tokens.tokenInfo.top10HoldingsRatio"),warning:s,disable:!n?.top10HoldingsRatio||n?.top10HoldingsRatio==="0"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(n?.devHoldingsRatio),tooltip:o("tokens.tokenInfo.devHoldingsRatio"),warning:r,disable:!n?.devHoldingsRatio||n?.devHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(n?.sniperHoldingsRatio),tooltip:o("tokens.tokenInfo.sniperHoldingsRatio"),warning:i,disable:!n?.sniperHoldingsRatio||n?.sniperHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(n?.insiderHoldingsRatio),tooltip:o("tokens.tokenInfo.insiderHoldingsRatio"),warning:l,disable:!n?.insiderHoldingsRatio||n?.insiderHoldingsRatio==="0",tooltipPlacement:"bottom"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(n?.bundleHoldingsRatio),tooltip:o("tokens.tokenInfo.bundleHoldingsRatio"),warning:a,disable:!n?.bundleHoldingsRatio||n?.bundleHoldingsRatio==="0",tooltipPlacement:"bottom"})]})]})});var Ja=memo(function({token:t}){let o=useMemo(()=>t.marketData?.tvlInUsd,[t.marketData?.tvlInUsd]);return jsx(Fragment,{children:formatAmountInUsd(o)})});var Za=memo(function({token:t}){let o=useMemo(()=>t.marketData?.marketCapInUsd,[t.marketData?.marketCapInUsd]);return jsx(Fragment,{children:formatMCapInUsd(o)})});var tl=memo(function({token:t,resolution:o}){let n=useMemo(()=>t.marketData?.priceInUsd,[t.marketData?.priceInUsd]),s=useMemo(()=>t.stats?.[o]?.priceChange,[t,o]),r=useMemo(()=>s?new SafeBigNumber(s).abs().toString():void 0,[s]),i=useMemo(()=>s&&new SafeBigNumber(s).gte(0),[s]);return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatPriceInUsd(n)}),jsxs("span",{className:cn("inline-flex gap-1 items-center text-xs",i?"text-positive":"text-negative"),children:[i?jsx(TriangleUpIcon,{width:10,height:10}):jsx(TriangleDownIcon,{width:10,height:10}),jsx("span",{children:formatPercent(r)})]})]})});var nl=memo(function({token:t,resolution:o}){let n=t.stats?.[o],s=n?.traders,r=n?.buyers,i=n?.sellers;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-positive",children:formatAmount(r)}),"/",jsx("span",{className:"text-negative",children:formatAmount(i)})]})]})});var sl=memo(function({token:t,resolution:o}){let n=t.stats?.[o],s=n?.trades,r=n?.buys,i=n?.sells;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmount(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-positive",children:formatAmount(r)}),"/",jsx("span",{className:"text-negative",children:formatAmount(i)})]})]})});var al=memo(function({token:t,resolution:o}){let n=t.stats?.[o],s=n?.volumesInUsd,r=n?.buyVolumesInUsd,i=n?.sellVolumesInUsd;return jsxs("div",{className:"flex flex-col gap-1 justify-center items-start",children:[jsx("span",{children:formatAmountInUsd(s)}),jsxs("div",{className:"flex gap-1 text-xs",children:[jsx("span",{className:"text-positive",children:formatAmountInUsd(r)}),"/",jsx("span",{className:"text-negative",children:formatAmountInUsd(i)})]})]})});var Ak=`
|
|
22
22
|
@keyframes tklShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
|
23
|
-
`,ck={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"tklShimmer 1.8s ease-in-out infinite",borderRadius:6};function V(e,t,o,r){return {...ck,animationDelay:`${e}ms`,width:t,height:o,...r}}var al=10;function ll({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:dk}),Array.from({length:al}).map((r,s)=>jsx(mk,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===al-1},s))]})}function mk({index:e,rowHeight:t,hasActions:o,isMobile:r,isLast:s}){let n=e*80,i=r?208:320,l=r?40:64,a=r?72:124,d=r?64:97;return jsxs("div",{style:{display:"flex",alignItems:"center",height:t,borderBottom:s?void 0:"1px solid rgba(39,39,42,0.3)"},children:[jsxs("div",{style:{width:i,padding:r?"0 12px":"0 12px 0 24px",display:"flex",alignItems:"center",gap:12,flexShrink:0},children:[jsx("div",{style:V(n,l,l,{borderRadius:8,flexShrink:0})}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1},children:[jsx("div",{style:V(n+30,"60%",20)}),jsx("div",{style:V(n+60,"80%",16)})]})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+20,72,20)}),jsx("div",{style:V(n+40,52,16)})]}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+30,64,20)})}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(n+40,60,20)})}),jsxs("div",{style:{width:138,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+50,72,20)}),jsx("div",{style:V(n+70,100,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+60,48,20)}),jsx("div",{style:V(n+80,80,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(n+70,40,20)}),jsx("div",{style:V(n+90,72,16)})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",alignItems:"center",gap:10},children:[jsx("div",{style:V(n+80,20,20,{borderRadius:4})}),jsx("div",{style:V(n+90,52,20)})]}),jsxs("div",{style:{width:308,padding:"0 12px",display:"flex",alignItems:"center",gap:20},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+80,52,16)}),jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+90,48,16)}),jsx("div",{style:V(n+110,40,16)}),jsx("div",{style:V(n+130,40,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(n+100,40,16)}),jsx("div",{style:V(n+120,36,16)})]})]}),o&&jsx("div",{style:{width:a,padding:r?"0 12px 0 0":"0 24px 0 12px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:jsx("div",{style:V(n+100,d,32,{borderRadius:8})})})]})}var bk=100,Tk=200,yk=72;function ct({tokens:e,resolution:t="24h",isLoading:o,ActionsComponent:r,onSelectToken:s,sortDirections:n,onSortChange:i,onScrollingChange:l,height:a=600,itemHeight:d=88,itemHeightMobile:m=72,className:c}){let{isMobile:u}=useScreen(),p=u?m:d,f=useMemo(()=>e.slice(0,bk),[e]),k=!!o,g=useRef(void 0),h=useRef(false),{t:x}=useTranslation(),y=useCallback(P=>Q=>{Q.preventDefault(),Q.stopPropagation(),s?.(P);},[s]),[b,v]=useState(n??{});useEffect(()=>{v(n??{});},[n]);let T=useCallback(P=>Q=>{let pt={[P]:Q};v(pt),i?.(pt);},[i]),L=useCallback(()=>{h.current||(h.current=true,l?.(true)),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=false,l?.(false);},180);},[l]);useEffect(()=>()=>{g.current&&clearTimeout(g.current),h.current&&l?.(false);},[l]);let A=cn("h-full mx-auto",c??(r?"max-w-394 sm:max-w-435":"max-w-363 sm:max-w-404")),N=r?"!w-[1582px] min-w-[1582px] max-w-[1582px]":"!w-[1510px] min-w-[1510px] max-w-[1510px]",_=[jsx(TableColumn,{textValue:x("tokens.listHeader.token"),width:u?Tk:320,className:cn("bg-[#0a0a0b] sticky left-0 z-10",u&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]"),children:x("tokens.listHeader.token")},"token"),jsx(TableColumn,{textValue:x("tokens.listHeader.price"),width:128,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Sortable,{sort:b.price,onSortChange:T("price"),children:x("tokens.listHeader.price")}),jsx("span",{children:"/"}),jsx(Sortable,{sort:b[`priceChange${t}`],onSortChange:T(`priceChange${t}`),children:x("tokens.listHeader.priceChange",{resolution:t})})]})},"price"),jsx(TableColumn,{textValue:x("tokens.listHeader.marketCap"),width:106,children:jsx(Sortable,{sort:b.marketCap,onSortChange:T("marketCap"),children:x("tokens.listHeader.marketCap")})},"marketCap"),jsx(TableColumn,{textValue:x("tokens.listHeader.athMarketCap"),width:144,children:jsx(Sortable,{sort:b.athMarketCap,onSortChange:T("athMarketCap"),children:x("tokens.listHeader.athMarketCap")})},"athMarketCap"),jsx(TableColumn,{textValue:x("tokens.listHeader.liquidity"),width:106,children:jsx(Sortable,{sort:b.tvl,onSortChange:T("tvl"),children:x("tokens.listHeader.liquidity")})},"liquidity"),jsx(TableColumn,{textValue:x("tokens.listHeader.volumes",{resolution:t}),width:138,children:jsx(Sortable,{sort:b[`volumes${t}`],onSortChange:T(`volumes${t}`),children:x("tokens.listHeader.volumes",{resolution:t})})},"volumes"),jsx(TableColumn,{textValue:x("tokens.listHeader.txs",{resolution:t}),width:126,children:jsx(Sortable,{sort:b[`trades${t}`],onSortChange:T(`trades${t}`),children:x("tokens.listHeader.txs",{resolution:t})})},"txs"),jsx(TableColumn,{textValue:x("tokens.listHeader.traders",{resolution:t}),width:126,children:jsx(Sortable,{sort:b[`traders${t}`],onSortChange:T(`traders${t}`),children:x("tokens.listHeader.traders",{resolution:t})})},"traders"),jsx(TableColumn,{textValue:x("tokens.listHeader.bluechip"),width:128,children:x("tokens.listHeader.bluechip")},"bluechip"),jsx(TableColumn,{textValue:x("tokens.listHeader.tokenInfo"),width:308,children:x("tokens.listHeader.tokenInfo")},"tokenInfo"),r?jsx(TableColumn,{textValue:x("tokens.listHeader.actions"),width:u?yk:124,align:"end",className:cn("bg-[#0a0a0b] sticky right-0 z-10",u&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]"),children:x("tokens.listHeader.actions")},"actions"):void 0].filter(Boolean),ge=jsx(ll,{rowHeight:p,hasActions:!!r,isMobile:u}),E=jsxs("div",{children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-neutral"}),jsx("p",{className:"mt-2 text-sm text-neutral text-center",children:x("common.empty")})]}),W=P=>[jsx(TableCell,{className:cn("sticky left-0 z-10 bg-[#0a0a0b]",u&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx(Ga,{token:P,resolution:t})},"token"),jsx(TableCell,{children:jsx(el,{token:P,resolution:t})},"price"),jsx(TableCell,{children:jsx(Ja,{token:P,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Ea,{token:P,resolution:t})},"athMarketCap"),jsx(TableCell,{children:jsx(Ya,{token:P,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(il,{token:P,resolution:t})},"volumes"),jsx(TableCell,{children:jsx(nl,{token:P,resolution:t})},"trades"),jsx(TableCell,{children:jsx(ol,{token:P,resolution:t})},"traders"),jsx(TableCell,{children:jsx(Va,{token:P,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(Xa,{token:P,resolution:t})},"tokenInfo"),r?jsx(TableCell,{className:cn("sticky right-0 z-10 bg-[#0a0a0b]",u&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-[#101211]"),children:jsx("div",{className:cn("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(r,{token:P,resolution:t})})},"actions"):void 0].filter(Boolean),ke=P=>jsx(TableRow,{onClick:s?y(P):void 0,children:W(P)},P.address);return u?jsx("div",{"data-token-list-mobile-scroll":true,className:cn("h-full min-h-0 w-full overflow-y-auto overflow-x-hidden overscroll-contain","mx-auto",c??(r?"max-w-394 sm:max-w-435":"max-w-363 sm:max-w-404")),style:{height:a},onScroll:L,children:jsx("div",{"data-token-list-horizontal-scroll":true,className:"w-full overflow-x-auto overflow-y-visible",children:jsxs(StyledTable,{isHeaderSticky:true,radius:"none",classNames:{table:cn("table-fixed",N),wrapper:"p-0 w-full !max-h-none !overflow-x-visible !overflow-y-visible bg-transparent rounded-none shadow-none",loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},"aria-label":"Tokens",children:[jsx(TableHeader,{children:_}),jsx(TableBody,{items:f,isLoading:k,loadingContent:ge,emptyContent:E,children:ke})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:A,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:L,maxTableHeight:a,rowHeight:p,"aria-label":"Tokens",children:[jsx(TableHeader,{children:_}),jsx(TableBody,{items:e,isLoading:k,loadingContent:ge,emptyContent:E,children:ke})]})}function kl({token:e,resolution:t,renderAction:o,isLast:r=false,onSelectToken:s,className:n}){let{t:i}=useTranslation(),l=useCopyToClipboard(),a=useTickAge(e.createdAt),d=useCallback(()=>{s?.(e);},[s,e]),m=useCallback(Q=>{Q.stopPropagation(),l(e.address,()=>toast.success(i("tokens.copied.address")));},[l,e.address,i]),c=e.marketData,u=e.stats?.[t],p=useMemo(()=>c?.priceInUsd,[c?.priceInUsd]),f=useMemo(()=>u?.priceChange,[u?.priceChange]),k=useMemo(()=>f&&new SafeBigNumber(f).gte(0),[f]),g=useMemo(()=>f?new SafeBigNumber(f).abs().toString():void 0,[f]),h=useMemo(()=>u?.volumesInUsd,[u?.volumesInUsd]),x=useMemo(()=>u?.buyVolumesInUsd,[u?.buyVolumesInUsd]),y=useMemo(()=>u?.sellVolumesInUsd,[u?.sellVolumesInUsd]),b=useMemo(()=>u?.trades,[u?.trades]),v=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),T=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),L=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),A=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),N=useMemo(()=>new SafeBigNumber(c?.sniperHoldingsRatio).gte(.1),[c?.sniperHoldingsRatio]),_=useMemo(()=>new SafeBigNumber(c?.insiderHoldingsRatio).gte(.1),[c?.insiderHoldingsRatio]),ge=useMemo(()=>new SafeBigNumber(c?.bundleHoldingsRatio).gte(.1),[c?.bundleHoldingsRatio]),E=c?.holders!==void 0&&c.holders>0,W=c?.kolHolders!==void 0&&c.kolHolders>0,ke=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,P=E||W||ke;return jsxs("div",{className:cn("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",!r&&"border-b",n),style:r?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},onClick:s?d:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(xe,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:false,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-neutral hover:text-foreground leading-none",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-neutral truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-neutral"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-neutral",children:formatAge(a)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-neutral hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-neutral hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-neutral hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-neutral hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"MC"}),jsx("span",{children:formatMCapInUsd(v)})]}),jsx("span",{className:"text-neutral/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-neutral",children:"Liq"}),jsx("span",{children:formatAmountInUsd(T)})]})]}),P&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-neutral leading-none",children:[E&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.holders)]})}),W&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(CrownIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.kolHolders)]})}),ke&&jsx(StyledTooltip,{content:i("tokens.listHeader.bluechip"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(ShiningStarIcon,{className:"w-3 h-3 text-neutral"}),formatAmount(c?.bluechipHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("span",{className:"text-base font-bold text-foreground leading-none",children:formatPriceInUsd(p)}),jsxs("span",{className:cn("inline-flex items-center gap-0.5 text-[10px] leading-none",k?"text-bullish":"text-bearish"),children:[k?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),f===void 0?"--":formatPercent(g)]})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountInUsd(h)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-bullish",children:formatAmountInUsd(x)}),jsx("span",{className:"text-neutral/50 mx-0.5",children:"/"}),jsx("span",{className:"text-bearish",children:formatAmountInUsd(y)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-neutral",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(b)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(c?.top10HoldingsRatio),tooltip:i("tokens.tokenInfo.top10HoldingsRatio"),warning:L,disable:!c?.top10HoldingsRatio||c?.top10HoldingsRatio==="0"}),jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(c?.devHoldingsRatio),tooltip:i("tokens.tokenInfo.devHoldingsRatio"),warning:A,disable:!c?.devHoldingsRatio||c?.devHoldingsRatio==="0"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(c?.sniperHoldingsRatio),tooltip:i("tokens.tokenInfo.sniperHoldingsRatio"),warning:N,disable:!c?.sniperHoldingsRatio||c?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(c?.insiderHoldingsRatio),tooltip:i("tokens.tokenInfo.insiderHoldingsRatio"),warning:_,disable:!c?.insiderHoldingsRatio||c?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(c?.bundleHoldingsRatio),tooltip:i("tokens.tokenInfo.bundleHoldingsRatio"),warning:ge,disable:!c?.bundleHoldingsRatio||c?.bundleHoldingsRatio==="0"})]})}),o&&jsx("div",{className:"flex-none relative",onClick:Q=>Q.stopPropagation(),children:o(e)})]})]})}function xl({isLast:e=false}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse",!e&&"border-b"),style:e?void 0:{borderBottomColor:"rgba(39,39,42,0.6)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-lg bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-3",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-16 h-4 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1 overflow-hidden",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}var Yk=154,hl=10;function Jk({index:e,style:t,tokens:o,skeletonCount:r,resolution:s,renderAction:n,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(kl,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:n,onSelectToken:i})}):jsx("div",{style:t,children:jsx(xl,{isLast:e===r-1})})}function wA({tokens:e,resolution:t="24h",isLoading:o,height:r=600,renderAction:s,onSelectToken:n,className:i}){let l=o||!e?void 0:e,a=l?l.length:hl,d=useMemo(()=>({tokens:l,skeletonCount:hl,resolution:t,renderAction:s,onSelectToken:n}),[l,t,s,n]);return jsx("div",{className:cn("w-full h-full overflow-hidden border rounded-lg",i),style:{background:"rgba(24,24,27,0.4)",borderColor:"rgba(39,39,42,0.6)"},children:jsx(List,{className:"h-full w-full",style:{height:r},rowCount:a,rowHeight:Yk,overscanCount:5,rowComponent:Jk,rowProps:d})})}var ox=80;function Sl(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function rx(e,t,o){return e===t?o:e===o?t:o||t}function Fr(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:rx(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function nx(e){return {...Sl(Fr(e)),...e.token??{},liquidities:Fr(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function vl(e){return e.sort((t,o)=>{let r=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-r}),e.slice(0,ox)}function sx(e){if(!(!e?.filters&&!e?.keywords&&!e?.excludeKeywords))return {filters:e.filters,keywords:e.keywords,excludeKeywords:e.excludeKeywords}}function ix(e){if(!(!e?.sortBy||!e.sortDirection))return {[e.sortBy]:e.sortDirection}}function Nl({chain:e,options:t,deferUpdates:o=false,updateFlushInterval:r}){let s=useMemo(()=>({chain:e}),[e]),n=useRef(s),[i,l]=useState(true),[a,d]=useState([]);useEffect(()=>{JSON.stringify(s)!==JSON.stringify(n.current)&&(l(true),d([]),n.current=s);},[s]);let{data:m,isPending:c}=useNewPoolsQuery(s);useEffect(()=>{m&&(d(x=>{let y=[...x];for(let b of m){let v=nx(b),T=y.findIndex(L=>L.address===v.address);T>=0?y[T]=ee(y[T],v):y.push(v);}return vl(y)}),l(false));},[m]);let u=useCallback(x=>{d(y=>{let b=[...y],v=false;for(let T of x){let L=b.findIndex(A=>A.address===T.address);L>=0?(v=true,b[L]=ee(b[L],T)):(v=true,b.push(Sl(T)));}return v?vl(b):y});},[]),{enqueueUpdates:p}=le({applyUpdates:u,paused:o,flushInterval:r}),f=useCallback(x=>{p(x.map(Fr));},[p]);useNewPoolsSubscription({chain:e},f),useNewTokensMetadataSubscription({chain:e},p),be({chain:e,tokens:a,onUpdate:p});let k=useMemo(()=>!!(c||i),[c,i]),g=useMemo(()=>ae(a,sx(t)),[a,t]);return {tokens:useMemo(()=>Ze(g,ix(t)),[g,t]),isLoading:k}}function _A({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let p=useMemo(()=>{let g=Object.keys(d??{})[0],h=d?.[g];return {...o,...g&&h?{sortBy:g,sortDirection:h}:void 0}},[o,d]),{tokens:f,isLoading:k}=Nl({chain:e,options:p,deferUpdates:c});return jsx(ct,{tokens:f,isLoading:k,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}function Pl({chain:e,filters:t,sortDirections:o,refetchInterval:r=3e4,deferUpdates:s=false,updateFlushInterval:n}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(i),[a,d]=useState(true);useEffect(()=>{JSON.stringify(i)!==JSON.stringify(l.current)&&(d(true),c([]),l.current=i);},[i]);let[m,c]=useState([]),{data:u,isPending:p}=useStockTokensQuery(i,{refetchInterval:r});useEffect(()=>{u&&(c(y=>zt(y,u)),d(false));},[u]);let f=useCallback(y=>{c(b=>Re(b,y));},[]),{enqueueUpdates:k}=le({applyUpdates:f,paused:s,flushInterval:n});useStockTokensSubscription({chain:e},k),be({chain:e,tokens:m,onUpdate:k});let g=useMemo(()=>!!(p||a),[p,a]),h=useMemo(()=>ae(m,t),[m,t]);return {tokens:useMemo(()=>Ze(h,o),[h,o]),isLoading:g}}function nI({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:p,isLoading:f}=Pl({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(ct,{tokens:p,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}function uI({chain:e,resolution:t,filters:o,ActionsComponent:r,onSelectToken:s,height:n,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:p,isLoading:f}=oo({chain:e,resolution:t,filters:o,sortDirections:d,deferUpdates:c});return jsx(ct,{tokens:p,isLoading:f,resolution:t,height:n,itemHeight:i,itemHeightMobile:l,ActionsComponent:r,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}var Nx=15e3;function Cx({chain:e,addresses:t,pollMs:o=Nx}){let r=t.length>0,[s,n]=useState({}),i=useTokensQuery({chain:e,addresses:t},{enabled:r,refetchInterval:o});useEffect(()=>{i.data&&n(u=>{let p={};for(let f of i.data){let k=u[f.address];p[f.address]=k?ee(k,f):f;}return p});},[i.data]);let l=useTokenMarketRuntime(),a=Array.from(new Set(t.map(u=>u.trim()).filter(Boolean))).sort().join(","),d=useMemo(()=>a?a.split(","):[],[a]);useEffect(()=>{if(!r)return;let u=[];for(let p of d){let f=tokenMarketKey(e,p),k=l.subscribe(f,h=>{let x=h.token;x&&n(y=>{let b=y[x.address],v=b?ee(b,x):x;return v===b?y:{...y,[x.address]:v}});}),g=l.retain(f);u.push(()=>{k(),g();});}return ()=>{for(let p of u)p();}},[l,e,a,r,d]);let m=i.refetch,c=useCallback(async()=>{await m();},[m]);return {tokens:s,isPending:i.isPending,isFetching:i.isFetching,isError:i.isError,isSuccess:i.isSuccess,error:i.error,refetch:c}}export{gi as DEFAULT_FLIP_HOVER_RESOLUTIONS,El as HolderTagBadge,Et as HolderTagBadgeList,$ as HoldingRatioChip,_A as NewTokenListWidget,Lb as PulseFinalStretchListWidget,Ge as PulseList,Dr as PulseListHeader,Zr as PulseListItem,Do as PulseListItemSkeleton,pb as PulseMigratedListWidget,Yh as PulseNewListWidget,Go as SEARCH_MODAL_ID,On as SearchHistoryUI,Bn as SearchHistoryWidget,En as SearchInputUI,fy as SearchModal,Yt as SearchResultItemUI,Jt as SearchResultListHeader,jt as SearchResultListSkeleton,Qn as SearchResultListWidget,Sy as SearchTokensButton,jn as SearchWidget,nI as StockTokenListWidget,lc as TOKEN_SEARCH_HISTORY_KEY,Oo as TRADER_TAG_META,ni as TokenAbout,sC as TokenAboutWidget,Bs as TokenActivitiesList,WS as TokenActivitiesListWidget,xe as TokenAvatar,ds as TokenBasicInfo,Is as TokenBasicInfoWidget,pi as TokenCategories,JC as TokenCategoriesWidget,ci as TokenCexListing,DC as TokenCexListingWidget,zi as TokenChartBanner,zL as TokenChartBannerWidget,is as TokenDetailHeader,J0 as TokenDetailHeaderWidget,Ui as TokenDevTokensList,IL as TokenDevTokensListWidget,Di as TokenDevTokensSummary,ms as TokenHoldersCount,ps as TokenHoldersCountWidget,Fs as TokenHoldersList,hS as TokenHoldersListWidget,li as TokenLiquidities,vC as TokenLiquiditiesWidget,ct as TokenList,No as TokenListFilter,La as TokenListFilterModal,Ma as TokenListFilterPopover,p2 as TokenListFilterWidget,Ua as TokenListResolutionSelectorDesktop,Oa as TokenListResolutionSelectorMobile,A2 as TokenListResolutionSelectorWidget,gs as TokenMarketCap,xs as TokenMarketCapWidget,Ni as TokenOrdersList,Xw as TokenOrdersListWidget,bi as TokenPositionsList,Iw as TokenPositionsListWidget,Ts as TokenPrice,vs as TokenPriceWidget,Ji as TokenReusedImageList,yP as TokenReusedImageListWidget,ei as TokenSecurity,$N as TokenSecurityWidget,Xi as TokenSimilarTokens,lP as TokenSimilarTokensWidget,Ss as TokenSocialMedia,Cs as TokenSocialMediaWidget,ki as TokenStatsFlipBase,xi as TokenStatsFlipHover,pw as TokenStatsFlipWidget,Ai as TokenTopTradersList,gL as TokenTopTradersListWidget,Gs as TokenTradersOverview,tN as TokenTradersOverviewWidget,Ys as TokenTransactionsOverview,kN as TokenTransactionsOverviewWidget,Ps as TokenVolume,As as TokenVolumeWidget,Zs as TokenVolumesOverview,IN as TokenVolumesOverviewWidget,Bl as TraderTagBadge,Wr as TraderTagBadgeList,kl as TrendingTokenCard,wA as TrendingTokenCardList,xl as TrendingTokenCardSkeleton,uI as TrendingTokenListWidget,kt as createTokenSearchHistoryStorage,Nl as useNewTokensScript,In as usePulseFinalStretchListScript,wn as usePulseMigratedListScript,hn as usePulseNewListScript,Fn as useSearchHistory,qn as useSearchResultListScript,Ry as useSearchScript,Pl as useStockTokensScript,si as useTokenAboutScript,zs as useTokenActivitiesListScript,kv as useTokenBasicInfoScript,fi as useTokenCategoriesScript,mi as useTokenCexListingScript,Gi as useTokenChartBannerScript,as as useTokenDetailHeaderScript,Vi as useTokenDevTokensListScript,us as useTokenHoldersCountScript,Os as useTokenHoldersListScript,di as useTokenLiquiditiesScript,ks as useTokenMarketCapScript,Pi as useTokenOrdersListScript,vi as useTokenPositionsListScript,ys as useTokenPriceScript,Zi as useTokenReusedImageListScript,ti as useTokenSecurityScript,Yi as useTokenSimilarTokensScript,Ns as useTokenSocialMediaScript,hi as useTokenStatsFlipScript,Mi as useTokenTopTradersListScript,Xs as useTokenTradersOverviewScript,Js as useTokenTransactionsOverviewScript,Rs as useTokenVolumeScript,js as useTokenVolumesOverviewScript,Cx as useTokens,oo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
|
|
23
|
+
`,Ik={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:"tklShimmer 1.8s ease-in-out infinite",borderRadius:6};function V(e,t,o,n){return {...Ik,animationDelay:`${e}ms`,width:t,height:o,...n}}var ll=10;function dl({rowHeight:e,hasActions:t,isMobile:o}){return jsxs(Fragment,{children:[jsx("style",{children:Ak}),Array.from({length:ll}).map((n,s)=>jsx(Mk,{index:s,rowHeight:e,hasActions:t,isMobile:o,isLast:s===ll-1},s))]})}function Mk({index:e,rowHeight:t,hasActions:o,isMobile:n,isLast:s}){let r=e*80,i=n?208:320,l=n?40:64,a=n?72:124,d=n?64:97;return jsxs("div",{className:s?void 0:"border-b border-border-subtle/30",style:{display:"flex",alignItems:"center",height:t,flexShrink:0},children:[jsxs("div",{style:{width:i,padding:n?"0 12px":"0 12px 0 24px",display:"flex",alignItems:"center",gap:12,flexShrink:0},children:[jsx("div",{style:V(r,l,l,{borderRadius:8,flexShrink:0})}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,flex:1},children:[jsx("div",{style:V(r+30,"60%",20)}),jsx("div",{style:V(r+60,"80%",16)})]})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(r+20,72,20)}),jsx("div",{style:V(r+40,52,16)})]}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(r+30,64,20)})}),jsx("div",{style:{width:106,padding:"0 12px",display:"flex",alignItems:"center"},children:jsx("div",{style:V(r+40,60,20)})}),jsxs("div",{style:{width:138,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(r+50,72,20)}),jsx("div",{style:V(r+70,100,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(r+60,48,20)}),jsx("div",{style:V(r+80,80,16)})]}),jsxs("div",{style:{width:126,padding:"0 12px",display:"flex",flexDirection:"column",justifyContent:"center",gap:4},children:[jsx("div",{style:V(r+70,40,20)}),jsx("div",{style:V(r+90,72,16)})]}),jsxs("div",{style:{width:128,padding:"0 12px",display:"flex",alignItems:"center",gap:10},children:[jsx("div",{style:V(r+80,20,20,{borderRadius:4})}),jsx("div",{style:V(r+90,52,20)})]}),jsxs("div",{style:{width:308,padding:"0 12px",display:"flex",alignItems:"center",gap:20},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(r+80,52,16)}),jsx("div",{style:V(r+100,40,16)}),jsx("div",{style:V(r+120,36,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(r+90,48,16)}),jsx("div",{style:V(r+110,40,16)}),jsx("div",{style:V(r+130,40,16)})]}),jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsx("div",{style:V(r+100,40,16)}),jsx("div",{style:V(r+120,36,16)})]})]}),o&&jsx("div",{style:{width:a,padding:n?"0 12px 0 0":"0 24px 0 12px",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:jsx("div",{style:V(r+100,d,32,{borderRadius:8})})})]})}var Wk=100,Vk=200,Kk=72;function dt({tokens:e,resolution:t="24h",isLoading:o,ActionsComponent:n,onSelectToken:s,sortDirections:r,onSortChange:i,onScrollingChange:l,height:a=600,itemHeight:d=88,itemHeightMobile:m=72,className:c}){let{isMobile:u}=useScreen(),p=u?m:d,x=useMemo(()=>e.slice(0,Wk),[e]),f=!!o,g=useRef(void 0),h=useRef(false),{t:k}=useTranslation(),T=useCallback(P=>Q=>{Q.preventDefault(),Q.stopPropagation(),s?.(P);},[s]),[v,b]=useState(r??{});useEffect(()=>{b(r??{});},[r]);let y=useCallback(P=>Q=>{let ut={[P]:Q};b(ut),i?.(ut);},[i]),L=useCallback(()=>{h.current||(h.current=true,l?.(true)),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{h.current=false,l?.(false);},180);},[l]);useEffect(()=>()=>{g.current&&clearTimeout(g.current),h.current&&l?.(false);},[l]);let A=cn("h-full mx-auto",c??(n?"max-w-394 sm:max-w-435":"max-w-363 sm:max-w-404")),N=n?"!w-[1582px] min-w-[1582px] max-w-[1582px]":"!w-[1510px] min-w-[1510px] max-w-[1510px]",K=[jsx(TableColumn,{textValue:k("tokens.listHeader.token"),width:u?Vk:320,className:cn("bg-surface-base sticky left-0 z-10",u&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]"),children:k("tokens.listHeader.token")},"token"),jsx(TableColumn,{textValue:k("tokens.listHeader.price"),width:128,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Sortable,{sort:v.price,onSortChange:y("price"),children:k("tokens.listHeader.price")}),jsx("span",{children:"/"}),jsx(Sortable,{sort:v[`priceChange${t}`],onSortChange:y(`priceChange${t}`),children:k("tokens.listHeader.priceChange",{resolution:t})})]})},"price"),jsx(TableColumn,{textValue:k("tokens.listHeader.marketCap"),width:106,children:jsx(Sortable,{sort:v.marketCap,onSortChange:y("marketCap"),children:k("tokens.listHeader.marketCap")})},"marketCap"),jsx(TableColumn,{textValue:k("tokens.listHeader.athMarketCap"),width:144,children:jsx(Sortable,{sort:v.athMarketCap,onSortChange:y("athMarketCap"),children:k("tokens.listHeader.athMarketCap")})},"athMarketCap"),jsx(TableColumn,{textValue:k("tokens.listHeader.liquidity"),width:106,children:jsx(Sortable,{sort:v.tvl,onSortChange:y("tvl"),children:k("tokens.listHeader.liquidity")})},"liquidity"),jsx(TableColumn,{textValue:k("tokens.listHeader.volumes",{resolution:t}),width:138,children:jsx(Sortable,{sort:v[`volumes${t}`],onSortChange:y(`volumes${t}`),children:k("tokens.listHeader.volumes",{resolution:t})})},"volumes"),jsx(TableColumn,{textValue:k("tokens.listHeader.txs",{resolution:t}),width:126,children:jsx(Sortable,{sort:v[`trades${t}`],onSortChange:y(`trades${t}`),children:k("tokens.listHeader.txs",{resolution:t})})},"txs"),jsx(TableColumn,{textValue:k("tokens.listHeader.traders",{resolution:t}),width:126,children:jsx(Sortable,{sort:v[`traders${t}`],onSortChange:y(`traders${t}`),children:k("tokens.listHeader.traders",{resolution:t})})},"traders"),jsx(TableColumn,{textValue:k("tokens.listHeader.bluechip"),width:128,children:k("tokens.listHeader.bluechip")},"bluechip"),jsx(TableColumn,{textValue:k("tokens.listHeader.tokenInfo"),width:308,children:k("tokens.listHeader.tokenInfo")},"tokenInfo"),n?jsx(TableColumn,{textValue:k("tokens.listHeader.actions"),width:u?Kk:124,align:"end",className:cn("bg-surface-base sticky right-0 z-10",u&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]"),children:k("tokens.listHeader.actions")},"actions"):void 0].filter(Boolean),fe=jsx(dl,{rowHeight:p,hasActions:!!n,isMobile:u}),E=jsxs("div",{children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-text-muted"}),jsx("p",{className:"mt-2 text-sm text-text-muted text-center",children:k("common.empty")})]}),W=P=>[jsx(TableCell,{className:cn("sticky left-0 z-10 bg-surface-base",u&&"!w-[200px] min-w-[200px] max-w-[200px] overflow-hidden","shadow-[1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-surface-raised"),children:jsx(Xa,{token:P,resolution:t})},"token"),jsx(TableCell,{children:jsx(tl,{token:P,resolution:t})},"price"),jsx(TableCell,{children:jsx(Za,{token:P,resolution:t})},"marketCap"),jsx(TableCell,{children:jsx(Wa,{token:P,resolution:t})},"athMarketCap"),jsx(TableCell,{children:jsx(Ja,{token:P,resolution:t})},"liquidity"),jsx(TableCell,{children:jsx(al,{token:P,resolution:t})},"volumes"),jsx(TableCell,{children:jsx(sl,{token:P,resolution:t})},"trades"),jsx(TableCell,{children:jsx(nl,{token:P,resolution:t})},"traders"),jsx(TableCell,{children:jsx(Ka,{token:P,resolution:t})},"bluechip"),jsx(TableCell,{children:jsx(Ya,{token:P,resolution:t})},"tokenInfo"),n?jsx(TableCell,{className:cn("sticky right-0 z-10 bg-surface-base",u&&"!w-[72px] min-w-[72px] max-w-[72px]","shadow-[-1px_0_0_0_rgba(39,39,42,0.6)]","transition-colors duration-150","[tr:hover_&]:!bg-surface-raised"),children:jsx("div",{className:cn("!absolute inset-y-0 right-3 z-1 w-fit","flex items-center justify-end"),children:jsx(n,{token:P,resolution:t})})},"actions"):void 0].filter(Boolean),ge=P=>jsx(TableRow,{onClick:s?T(P):void 0,children:W(P)},P.address);return u?jsx("div",{"data-token-list-mobile-scroll":true,className:cn("h-full min-h-0 w-full overflow-y-auto overflow-x-hidden overscroll-contain","mx-auto",c??(n?"max-w-394 sm:max-w-435":"max-w-363 sm:max-w-404")),style:{height:a},onScroll:L,children:jsx("div",{"data-token-list-horizontal-scroll":true,className:"w-full overflow-x-auto overflow-y-visible",children:jsxs(StyledTable,{isHeaderSticky:true,radius:"none",classNames:{table:cn("table-fixed",N),wrapper:"p-0 w-full !max-h-none !overflow-x-visible !overflow-y-visible bg-transparent rounded-none shadow-none",loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},"aria-label":k("tokens.table.ariaLabel"),children:[jsx(TableHeader,{children:K}),jsx(TableBody,{items:x,isLoading:f,loadingContent:fe,emptyContent:E,children:ge})]})})}):jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:true,radius:"lg",className:A,classNames:{loadingWrapper:"flex-col justify-start items-start",emptyWrapper:"pt-30"},onScrollCapture:L,maxTableHeight:a,rowHeight:p,"aria-label":k("tokens.table.ariaLabel"),children:[jsx(TableHeader,{children:K}),jsx(TableBody,{items:e,isLoading:f,loadingContent:fe,emptyContent:E,children:ge})]})}function xl({token:e,resolution:t,renderAction:o,isLast:n=false,onSelectToken:s,className:r}){let{t:i}=useTranslation(),l=useCopyToClipboard(),a=useTickAge(e.createdAt),d=useCallback(()=>{s?.(e);},[s,e]),m=useCallback(Q=>{Q.stopPropagation(),l(e.address,()=>toast.success(i("tokens.copied.address")));},[l,e.address,i]),c=e.marketData,u=e.stats?.[t],p=useMemo(()=>c?.priceInUsd,[c?.priceInUsd]),x=useMemo(()=>u?.priceChange,[u?.priceChange]),f=useMemo(()=>x&&new SafeBigNumber(x).gte(0),[x]),g=useMemo(()=>x?new SafeBigNumber(x).abs().toString():void 0,[x]),h=useMemo(()=>u?.volumesInUsd,[u?.volumesInUsd]),k=useMemo(()=>u?.buyVolumesInUsd,[u?.buyVolumesInUsd]),T=useMemo(()=>u?.sellVolumesInUsd,[u?.sellVolumesInUsd]),v=useMemo(()=>u?.trades,[u?.trades]),b=useMemo(()=>c?.marketCapInUsd,[c?.marketCapInUsd]),y=useMemo(()=>c?.tvlInUsd,[c?.tvlInUsd]),L=useMemo(()=>new SafeBigNumber(c?.top10HoldingsRatio).gte(.1),[c?.top10HoldingsRatio]),A=useMemo(()=>new SafeBigNumber(c?.devHoldingsRatio).gte(.1),[c?.devHoldingsRatio]),N=useMemo(()=>new SafeBigNumber(c?.sniperHoldingsRatio).gte(.1),[c?.sniperHoldingsRatio]),K=useMemo(()=>new SafeBigNumber(c?.insiderHoldingsRatio).gte(.1),[c?.insiderHoldingsRatio]),fe=useMemo(()=>new SafeBigNumber(c?.bundleHoldingsRatio).gte(.1),[c?.bundleHoldingsRatio]),E=c?.holders!==void 0&&c.holders>0,W=c?.kolHolders!==void 0&&c.kolHolders>0,ge=c?.bluechipHolders!==void 0&&c.bluechipHolders>0,P=E||W||ge;return jsxs("div",{className:cn("relative w-full h-full overflow-hidden px-4 py-3 hover:bg-content2/40 cursor-pointer",!n&&"border-b",r),style:n?void 0:{borderBottomColor:"hsl(var(--heroui-content3) / 0.6)"},onClick:s?d:void 0,children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx(ke,{token:e,enableSearch:true,enablePreview:!!e.image,showProgress:false,className:"w-20 h-20"}),jsxs("button",{type:"button",className:"text-xs font-mono text-text-muted hover:text-foreground leading-none",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[e.address.slice(0,4),"...",e.address.slice(-4)]})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2.5",children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 min-w-0 text-left",onClick:m,"aria-label":i("tokens.copied.address"),title:i("tokens.copied.address"),children:[jsx("span",{className:"flex-none text-sm font-semibold leading-none whitespace-nowrap overflow-hidden text-ellipsis max-w-24",children:e.symbol}),jsx(StyledTooltip,{content:e.name,children:jsx("span",{className:"text-[13px] leading-none text-text-muted truncate max-w-20",children:e.name})}),jsx(CopyIcon,{className:"flex-none w-3.5 h-3.5 text-text-muted"})]}),jsxs("div",{className:"flex items-center gap-2 leading-none",children:[jsx("span",{className:"text-[13px] font-mono font-medium text-text-muted",children:formatAge(a)}),e.socialMedias?.website&&jsx(Link,{href:e.socialMedias.website,className:"text-text-muted hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(WebsiteIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.twitter&&jsx(Link,{href:e.socialMedias.twitter,className:"text-text-muted hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(TwitterIcon,{className:"w-3.5 h-3.5"})}),e.socialMedias?.telegram&&jsx(Link,{href:e.socialMedias.telegram,className:"text-text-muted hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(TelegramIcon,{className:"w-3.5 h-3.5"})}),jsx(Link,{href:searchTwitterUrl(`${e.symbol} OR ${e.address}`),className:"max-sm:hidden text-text-muted hover:text-primary",target:"_blank",onClick:Q=>Q.stopPropagation(),children:jsx(SearchIcon,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-foreground/80 leading-none",children:[jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-text-muted",children:"MC"}),jsx("span",{children:formatMCapInUsd(b)})]}),jsx("span",{className:"text-text-muted/30",children:"\xB7"}),jsxs("span",{className:"inline-flex items-baseline gap-1",children:[jsx("span",{className:"text-text-muted",children:i("tokens.listHeader.liqShort")}),jsx("span",{children:formatAmountInUsd(y)})]})]}),P&&jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-text-muted leading-none",children:[E&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.holders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(PeopleIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(c?.holders)]})}),W&&jsx(StyledTooltip,{content:i("tokens.tokenInfo.kolHolders"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(CrownIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(c?.kolHolders)]})}),ge&&jsx(StyledTooltip,{content:i("tokens.listHeader.bluechip"),children:jsxs("span",{className:"inline-flex items-center gap-1",children:[jsx(ShiningStarIcon,{className:"w-3 h-3 text-text-muted"}),formatAmount(c?.bluechipHolders)]})})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-2.5 leading-none font-mono",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("span",{className:"text-base font-bold text-foreground leading-none",children:formatPriceInUsd(p)}),jsxs("span",{className:cn("inline-flex items-center gap-0.5 text-[10px] leading-none",f?"text-positive":"text-negative"),children:[f?jsx(TriangleUpIcon,{width:8,height:8}):jsx(TriangleDownIcon,{width:8,height:8}),x===void 0?"--":formatPercent(g)]})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-text-muted",children:"V"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmountInUsd(h)})]}),jsxs("span",{className:"text-[10px] leading-none",children:[jsx("span",{className:"text-positive",children:formatAmountInUsd(k)}),jsx("span",{className:"text-text-muted/50 mx-0.5",children:"/"}),jsx("span",{className:"text-negative",children:formatAmountInUsd(T)})]})]}),jsxs("div",{className:"flex items-baseline gap-1",children:[jsx("span",{className:"text-xs text-text-muted",children:"TX"}),jsx("span",{className:"text-xs text-foreground/80",children:formatAmount(v)})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-start gap-4 relative",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",forceShowArrows:true,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx($,{icon:jsx(UserWithStarBadgeIcon,{width:12,height:12}),value:formatPercent(c?.top10HoldingsRatio),tooltip:i("tokens.tokenInfo.top10HoldingsRatio"),warning:L,disable:!c?.top10HoldingsRatio||c?.top10HoldingsRatio==="0"}),jsx($,{icon:jsx(CookIcon,{width:12,height:12}),value:formatPercent(c?.devHoldingsRatio),tooltip:i("tokens.tokenInfo.devHoldingsRatio"),warning:A,disable:!c?.devHoldingsRatio||c?.devHoldingsRatio==="0"}),jsx($,{icon:jsx(SniperIcon,{width:12,height:12}),value:formatPercent(c?.sniperHoldingsRatio),tooltip:i("tokens.tokenInfo.sniperHoldingsRatio"),warning:N,disable:!c?.sniperHoldingsRatio||c?.sniperHoldingsRatio==="0"}),jsx($,{icon:jsx(RatIcon,{width:12,height:12}),value:formatPercent(c?.insiderHoldingsRatio),tooltip:i("tokens.tokenInfo.insiderHoldingsRatio"),warning:K,disable:!c?.insiderHoldingsRatio||c?.insiderHoldingsRatio==="0"}),jsx($,{icon:jsx(BundlesIcon,{width:12,height:12}),value:formatPercent(c?.bundleHoldingsRatio),tooltip:i("tokens.tokenInfo.bundleHoldingsRatio"),warning:fe,disable:!c?.bundleHoldingsRatio||c?.bundleHoldingsRatio==="0"})]})}),o&&jsx("div",{className:"flex-none relative",onClick:Q=>Q.stopPropagation(),children:o(e)})]})]})}function hl({isLast:e=false}){return jsxs("div",{className:cn("w-full h-full overflow-hidden px-4 py-3 animate-pulse",!e&&"border-b"),style:e?void 0:{borderBottomColor:"hsl(var(--heroui-content3) / 0.6)"},children:[jsxs("div",{className:"flex items-start gap-2",children:[jsxs("div",{className:"flex-none flex flex-col items-center gap-2",children:[jsx("div",{className:"w-20 h-20 rounded-lg bg-content2"}),jsx("div",{className:"w-14 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex-1 min-w-0 flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-16 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-20 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-8 h-3 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"}),jsx("div",{className:"w-3.5 h-3.5 rounded bg-content2"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-3 rounded bg-content2"}),jsx("div",{className:"w-10 h-3 rounded bg-content2"})]})]}),jsxs("div",{className:"flex-none flex flex-col items-end gap-3",children:[jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-16 h-4 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]}),jsxs("div",{className:"flex flex-col items-end gap-1",children:[jsx("div",{className:"w-14 h-3 rounded bg-content2"}),jsx("div",{className:"w-12 h-2.5 rounded bg-content2"})]})]})]}),jsxs("div",{className:"mt-2.5 flex items-center gap-2",children:[jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-1 overflow-hidden",children:[jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"}),jsx("div",{className:"w-12 h-5 rounded-full bg-content2"})]}),jsx("div",{className:"w-16 h-7 rounded-md bg-content2 flex-none"})]})]})}var xx=154,Tl=10;function hx({index:e,style:t,tokens:o,skeletonCount:n,resolution:s,renderAction:r,onSelectToken:i}){return o?jsx("div",{style:t,children:jsx(xl,{token:o[e],resolution:s,isLast:e===o.length-1,renderAction:r,onSelectToken:i})}):jsx("div",{style:t,children:jsx(hl,{isLast:e===n-1})})}function pI({tokens:e,resolution:t="24h",isLoading:o,height:n=600,renderAction:s,onSelectToken:r,className:i}){let l=o||!e?void 0:e,a=l?l.length:Tl,d=useMemo(()=>({tokens:l,skeletonCount:Tl,resolution:t,renderAction:s,onSelectToken:r}),[l,t,s,r]);return jsx("div",{className:cn("w-full h-full overflow-hidden border rounded-lg",i),style:{background:"hsl(var(--heroui-content2) / 0.4)",borderColor:"hsl(var(--heroui-content3) / 0.6)"},children:jsx(List,{className:"h-full w-full",style:{height:n},rowCount:a,rowHeight:xx,overscanCount:5,rowComponent:hx,rowProps:d})})}var Sx=80;function Nl(e){return {chain:e.chain,address:e.address,name:e.name??"",symbol:e.symbol??"",decimals:e.decimals??0,image:e.image,description:e.description,socialMedias:e.socialMedias,launchedFrom:e.launchedFrom,migratedTo:e.migratedTo,createdAt:e.createdAt}}function Nx(e,t,o){return e===t?o:e===o?t:o||t}function Un(e){let t=e.token?.address??e.tokenAAddress??"",o=e.token;return {...o,chain:e.chain,address:t,name:o?.name??"",symbol:o?.symbol??"",decimals:o?.decimals??0,createdAt:o?.createdAt??e.createdAt,liquidities:[{poolAddress:e.poolAddress,pairAddress:Nx(t,e.tokenAAddress,e.tokenBAddress),image:e.dex?.image,programAddress:e.dex?.programAddress,protocolFamily:e.dex?.protocolFamily,protocolName:e.dex?.protocolName}]}}function Cx(e){return {...Nl(Un(e)),...e.token??{},liquidities:Un(e).liquidities,createdAt:e.token?.createdAt??e.createdAt}}function Sl(e){return e.sort((t,o)=>{let n=t.createdAt?.getTime()??0;return (o.createdAt?.getTime()??0)-n}),e.slice(0,Sx)}function wx(e){if(!(!e?.filters&&!e?.keywords&&!e?.excludeKeywords))return {filters:e.filters,keywords:e.keywords,excludeKeywords:e.excludeKeywords}}function Lx(e){if(!(!e?.sortBy||!e.sortDirection))return {[e.sortBy]:e.sortDirection}}function Cl({chain:e,options:t,deferUpdates:o=false,updateFlushInterval:n}){let s=useMemo(()=>({chain:e}),[e]),r=useRef(s),[i,l]=useState(true),[a,d]=useState([]);useEffect(()=>{JSON.stringify(s)!==JSON.stringify(r.current)&&(l(true),d([]),r.current=s);},[s]);let{data:m,isPending:c}=useNewPoolsQuery(s);useEffect(()=>{m&&(d(k=>{let T=[...k];for(let v of m){let b=Cx(v),y=T.findIndex(L=>L.address===b.address);y>=0?T[y]=ee(T[y],b):T.push(b);}return Sl(T)}),l(false));},[m]);let u=useCallback(k=>{d(T=>{let v=[...T],b=false;for(let y of k){let L=v.findIndex(A=>A.address===y.address);L>=0?(b=true,v[L]=ee(v[L],y)):(b=true,v.push(Nl(y)));}return b?Sl(v):T});},[]),{enqueueUpdates:p}=le({applyUpdates:u,paused:o,flushInterval:n}),x=useCallback(k=>{p(k.map(Un));},[p]);useNewPoolsSubscription({chain:e},x),useNewTokensMetadataSubscription({chain:e},p),he({chain:e,tokens:a,onUpdate:p});let f=useMemo(()=>!!(c||i),[c,i]),g=useMemo(()=>ae(a,wx(t)),[a,t]);return {tokens:useMemo(()=>Ze(g,Lx(t)),[g,t]),isLoading:f}}function RI({chain:e,resolution:t,filters:o,ActionsComponent:n,onSelectToken:s,height:r,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let p=useMemo(()=>{let g=Object.keys(d??{})[0],h=d?.[g];return {...o,...g&&h?{sortBy:g,sortDirection:h}:void 0}},[o,d]),{tokens:x,isLoading:f}=Cl({chain:e,options:p,deferUpdates:c});return jsx(dt,{tokens:x,isLoading:f,resolution:t,height:r,itemHeight:i,itemHeightMobile:l,ActionsComponent:n,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}function Rl({chain:e,filters:t,sortDirections:o,refetchInterval:n=3e4,deferUpdates:s=false,updateFlushInterval:r}){let i=useMemo(()=>({chain:e}),[e]),l=useRef(i),[a,d]=useState(true);useEffect(()=>{JSON.stringify(i)!==JSON.stringify(l.current)&&(d(true),c([]),l.current=i);},[i]);let[m,c]=useState([]),{data:u,isPending:p}=useStockTokensQuery(i,{refetchInterval:n});useEffect(()=>{u&&(c(T=>zt(T,u)),d(false));},[u]);let x=useCallback(T=>{c(v=>Re(v,T));},[]),{enqueueUpdates:f}=le({applyUpdates:x,paused:s,flushInterval:r});useStockTokensSubscription({chain:e},f),he({chain:e,tokens:m,onUpdate:f});let g=useMemo(()=>!!(p||a),[p,a]),h=useMemo(()=>ae(m,t),[m,t]);return {tokens:useMemo(()=>Ze(h,o),[h,o]),isLoading:g}}function $I({chain:e,resolution:t,filters:o,ActionsComponent:n,onSelectToken:s,height:r,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:p,isLoading:x}=Rl({chain:e,filters:o,sortDirections:d,deferUpdates:c});return jsx(dt,{tokens:p,isLoading:x,resolution:t,height:r,itemHeight:i,itemHeightMobile:l,ActionsComponent:n,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}function jI({chain:e,resolution:t,filters:o,ActionsComponent:n,onSelectToken:s,height:r,itemHeight:i,itemHeightMobile:l,className:a}){let[d,m]=useState(),[c,u]=useState(false);useEffect(()=>{m(void 0);},[e,t]);let{tokens:p,isLoading:x}=oo({chain:e,resolution:t,filters:o,sortDirections:d,deferUpdates:c});return jsx(dt,{tokens:p,isLoading:x,resolution:t,height:r,itemHeight:i,itemHeightMobile:l,ActionsComponent:n,onSelectToken:s,sortDirections:d,onSortChange:m,onScrollingChange:u,className:a})}var $x=15e3;function zx({chain:e,addresses:t,pollMs:o=$x}){let n=t.length>0,[s,r]=useState({}),i=useTokensQuery({chain:e,addresses:t},{enabled:n,refetchInterval:o});useEffect(()=>{i.data&&r(u=>{let p={};for(let x of i.data){let f=u[x.address];p[x.address]=f?ee(f,x):x;}return p});},[i.data]);let l=useTokenMarketRuntime(),a=Array.from(new Set(t.map(u=>u.trim()).filter(Boolean))).sort().join(","),d=useMemo(()=>a?a.split(","):[],[a]);useEffect(()=>{if(!n)return;let u=[];for(let p of d){let x=tokenMarketKey(e,p),f=l.subscribe(x,h=>{let k=h.token;k&&r(T=>{let v=T[k.address],b=v?ee(v,k):k;return b===v?T:{...T,[k.address]:b}});}),g=l.retain(x);u.push(()=>{f(),g();});}return ()=>{for(let p of u)p();}},[l,e,a,n,d]);let m=i.refetch,c=useCallback(async()=>{await m();},[m]);return {tokens:s,isPending:i.isPending,isFetching:i.isFetching,isError:i.isError,isSuccess:i.isSuccess,error:i.error,refetch:c}}export{gi as DEFAULT_FLIP_HOVER_RESOLUTIONS,Vl as HolderTagBadge,Et as HolderTagBadgeList,$ as HoldingRatioChip,RI as NewTokenListWidget,XT as PulseFinalStretchListWidget,Ge as PulseList,Bn as PulseListHeader,er as PulseListItem,Uo as PulseListItemSkeleton,FT as PulseMigratedListWidget,hT as PulseNewListWidget,Go as SEARCH_MODAL_ID,Br as SearchHistoryUI,Er as SearchHistoryWidget,Wr as SearchInputUI,Ub as SearchModal,Yt as SearchResultItemUI,Jt as SearchResultListHeader,jt as SearchResultListSkeleton,Gr as SearchResultListWidget,$b as SearchTokensButton,es as SearchWidget,$I as StockTokenListWidget,cc as TOKEN_SEARCH_HISTORY_KEY,Oo as TRADER_TAG_META,ri as TokenAbout,U0 as TokenAboutWidget,Es as TokenActivitiesList,gC as TokenActivitiesListWidget,ke as TokenAvatar,cs as TokenBasicInfo,Ms as TokenBasicInfoWidget,pi as TokenCategories,Iw as TokenCategoriesWidget,ci as TokenCexListing,gw as TokenCexListingWidget,Qi as TokenChartBanner,IP as TokenChartBannerWidget,as as TokenDetailHeader,NN as TokenDetailHeaderWidget,Ui as TokenDevTokensList,gP as TokenDevTokensListWidget,Oi as TokenDevTokensSummary,us as TokenHoldersCount,fs as TokenHoldersCountWidget,Fs as TokenHoldersList,zN as TokenHoldersListWidget,li as TokenLiquidities,ew as TokenLiquiditiesWidget,dt as TokenList,No as TokenListFilter,Pa as TokenListFilterModal,Da as TokenListFilterPopover,eR as TokenListFilterWidget,Ua as TokenListResolutionSelectorDesktop,Ba as TokenListResolutionSelectorMobile,xR as TokenListResolutionSelectorWidget,ks as TokenMarketCap,hs as TokenMarketCapWidget,Ni as TokenOrdersList,ML as TokenOrdersListWidget,Ti as TokenPositionsList,pL as TokenPositionsListWidget,bs as TokenPrice,Ss as TokenPriceWidget,Zi as TokenReusedImageList,l1 as TokenReusedImageListWidget,oi as TokenSecurity,b0 as TokenSecurityWidget,Yi as TokenSimilarTokens,GP as TokenSimilarTokensWidget,Ns as TokenSocialMedia,ws as TokenSocialMediaWidget,ki as TokenStatsFlipBase,xi as TokenStatsFlipHover,Gw as TokenStatsFlipWidget,Ai as TokenTopTradersList,ZL as TokenTopTradersListWidget,Xs as TokenTradersOverview,AC as TokenTradersOverviewWidget,Js as TokenTransactionsOverview,$C as TokenTransactionsOverviewWidget,Rs as TokenVolume,Is as TokenVolumeWidget,js as TokenVolumesOverview,i0 as TokenVolumesOverviewWidget,Wl as TraderTagBadge,Kn as TraderTagBadgeList,xl as TrendingTokenCard,pI as TrendingTokenCardList,hl as TrendingTokenCardSkeleton,jI as TrendingTokenListWidget,gt as createTokenSearchHistoryStorage,Cl as useNewTokensScript,Mr as usePulseFinalStretchListScript,Lr as usePulseMigratedListScript,Tr as usePulseNewListScript,Fr as useSearchHistory,$r as useSearchResultListScript,Jb as useSearchScript,Rl as useStockTokensScript,si as useTokenAboutScript,Qs as useTokenActivitiesListScript,Ev as useTokenBasicInfoScript,fi as useTokenCategoriesScript,mi as useTokenCexListingScript,Xi as useTokenChartBannerScript,ls as useTokenDetailHeaderScript,Ki as useTokenDevTokensListScript,ps as useTokenHoldersCountScript,Bs as useTokenHoldersListScript,di as useTokenLiquiditiesScript,xs as useTokenMarketCapScript,Pi as useTokenOrdersListScript,vi as useTokenPositionsListScript,vs as useTokenPriceScript,ji as useTokenReusedImageListScript,ni as useTokenSecurityScript,Ji as useTokenSimilarTokensScript,Cs as useTokenSocialMediaScript,hi as useTokenStatsFlipScript,Mi as useTokenTopTradersListScript,Ys as useTokenTradersOverviewScript,Zs as useTokenTransactionsOverviewScript,As as useTokenVolumeScript,ei as useTokenVolumesOverviewScript,zx as useTokens,oo as useTrendingTokensScript};//# sourceMappingURL=index.mjs.map
|
|
24
24
|
//# sourceMappingURL=index.mjs.map
|