@liberfi.io/ui-channels 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useTranslation}from'@liberfi.io/i18n';import {z,usePinata,useForm,zodResolver,RHForm,RHInput,RHTextArea,RHUpload,Button,toast,StyledTabs,Tab,TelegramIcon,useCopyToClipboard,StyledInput,SearchIcon,StyledTable,TableHeader,TableColumn,TableBody,TableRow,TableCell,CopyIcon,TrashIcon,EmptyIcon,HorizontalScrollContainer,StyledTooltip,Chip,useScreen,clsx,WalletIcon,PeopleIcon,TimerIcon,Link,TwitterIcon,DiscordIcon,Avatar,StyledButton,EditIcon,CheckIcon,PlusIcon,Skeleton,Tabs,ButtonGroup,Input,Table,Image}from'@liberfi.io/ui';import {useQuery,useMutation,useQueryClient}from'@tanstack/react-query';import {createContext,useContext,useCallback,useMemo,useState,useEffect}from'react';import {chainSlug,debounce,shortAddress,uniqBy,intersectionBy,isValidWalletAddress,formatAge,chainIcon,formatAmountUSD2,formatAmount}from'@liberfi.io/utils';import {useDexClient,fetchPresignedUploadUrl}from'@liberfi.io/client';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {Chain}from'@liberfi.io/types';import {useAuthCallback,useAuth}from'@liberfi.io/wallet-connector';import {useTickAge}from'@liberfi.io/hooks';typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-channels"]="0.1.0");var Rt="0.1.0";var H=createContext({});function Fe(){let e=useContext(H);if(!e)throw new Error("useChannelsContext must be used within a ChannelsProvider");return e}function d(){let{client:e}=Fe();return e}function jt(e,t){return ["channelEvents",e,t.timestamp?`${t.timestamp}`:"",t.next_page?`${t.next_page}`:"",t.limit?`${t.limit}`:""]}async function Xt(e,t,n){return await e.getChannelEvents(t,n)}function $t(e,t={},n={}){let s=d();return useQuery({queryKey:jt(e,t),queryFn:async()=>Xt(s,e,t),...n})}function F(e){return ["channel",e]}async function Yt(e,t){return await e.get(t)}function K(e,t={}){let n=d();return useQuery({queryKey:F(e),queryFn:async()=>Yt(n,e),...t})}function nn(e){return ["channels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function on(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getChannels(n)}function Ae(e={},t={}){let n=d();return useQuery({queryKey:nn(e),queryFn:async()=>on(n,e),...t})}function ce(e){return ["channelSources",e]}async function an(e,t){return await e.getSources(t)}function Be(e,t={}){let n=d();return useQuery({queryKey:ce(e),queryFn:async()=>an(n,e),...t})}async function mn(e,t){let n=chainSlug(t.chain);if(!n)throw new Error("Invalid chain");return e.create({...t,chain:n})}function Le(e={}){let t=d();return useMutation({mutationFn:async n=>mn(t,n),...e})}function pn(e){return ["myChannels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function un(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getMyChannels(n)}function G(e={},t={}){let n=d();return useQuery({queryKey:pn(e),queryFn:async()=>un(n,e),...t})}async function gn(e,t){await e.subscribe(t);}function De(e={}){let t=useQueryClient(),n=d();return useMutation({mutationFn:async s=>gn(n,s),...e,onSuccess:(s,o,r,a)=>{t.invalidateQueries({queryKey:["subscribedChannels"]}),t.invalidateQueries({queryKey:F(o)}),e?.onSuccess?.(s,o,r,a);}})}function bn(e){return ["subscribedChannels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function xn(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getSubscribedChannels(n)}function j(e={},t={}){let n=d();return useQuery({queryKey:bn(e),queryFn:async()=>xn(n,e),...t})}async function Sn(e,t){await e.unsubscribe(t);}function Me(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Sn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:["subscribedChannels"]}),n.invalidateQueries({queryKey:F(o)}),e?.onSuccess?.(s,o,r,a);}})}async function Nn(e,t){let n={...t};if(t.chain){let s=chainSlug(t.chain);if(!s)throw new Error("Invalid chain");n.chain=s;}return e.update(n)}function We(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Nn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:F(o.id)}),e?.onSuccess?.(s,o,r,a);}})}async function Fn(e,t){return e.updateSources(t)}function Qe(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Fn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:ce(o.channel_id)}),e?.onSuccess?.(s,o,r,a);}})}var Ve=()=>{let e=usePinata(),{client:t}=useDexClient();return useCallback(async s=>{let o=await fetchPresignedUploadUrl(t),r=await e.upload.public.file(s).url(o);return e.gateways.public.convert(r.cid)},[e,t])};var qe=z.object({name:z.string({error:"channels.forms.base.name.required"}).min(1,"channels.forms.base.name.min").max(24,"channels.forms.base.name.max"),description:z.string().optional(),icon:z.url({error:"channels.forms.base.icon.required"})}),Mn=z.object({address:z.string({error:"channels.forms.wallets.address.required"}),alias:z.string().optional()}),Oe=z.array(Mn).min(1,"channels.forms.wallets.required").max(500,"channels.forms.wallets.maxCount");function $({isSubmitting:e=false,onSubmit:t,defaultValues:n={name:"",description:"",icon:""},submitLabel:s}){let{t:o}=useTranslation(),r=useForm({mode:"onChange",reValidateMode:"onBlur",resolver:zodResolver(qe),defaultValues:n}),a=Ve();return jsxs(RHForm,{methods:r,onSubmit:t,children:[jsx(RHInput,{name:"name",label:o("channels.forms.base.name.label"),"aria-label":o("channels.forms.base.name.label"),placeholder:o("channels.forms.base.name.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,labelPlacement:"outside-top"}),jsx(RHTextArea,{name:"description",label:o("channels.forms.base.description.label"),"aria-label":o("channels.forms.base.description.label"),placeholder:o("channels.forms.base.description.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,labelPlacement:"outside-top"}),jsx(RHUpload,{name:"icon",upload:a,label:o("channels.forms.base.icon.label"),placeholder:o("channels.forms.base.icon.placeholder"),hint:o("channels.forms.base.icon.hint"),radius:"lg",classNames:{upload:"sm:max-w-80"}}),jsx(Button,{color:"primary",fullWidth:true,type:"submit",radius:"lg",className:"mt-8",isLoading:e,children:s??o("channels.forms.base.submit")})]})}function li({onSuccess:e,onError:t}){let{t:n}=useTranslation(),{mutateAsync:s,isPending:o}=Le(),r=useAuthCallback(async a=>{try{let i=await s({name:a.name,description:a.description,icon:a.icon,chain:Chain.SOLANA,privacy:"public"});toast.success(n("channels.create.success")),e?.(i);}catch(i){toast.error(n("channels.create.error")),t?.(i);}},[n,s,e,t]);return jsx($,{onSubmit:r,isSubmitting:o})}function _e(e){let{t}=useTranslation(),{data:n,isLoading:s}=K(e),{mutateAsync:o,isPending:r}=We(),a=useMemo(()=>{if(n)return {name:n.name,description:n.description,icon:n.icon??""}},[n]),i=useAuthCallback(async h=>{try{await o({id:e,name:h.name,description:h.description,icon:h.icon}),toast.success(t("channels.update.success"));}catch{toast.error(t("channels.update.error"));}},[o,e]);return {channel:n,isLoading:s,isSubmitting:r,defaultValues:a,submit:i}}function Re({sink:e,onSaveToken:t}){let{t:n}=useTranslation(),[s,o]=useState("");return useEffect(()=>{},[e]),jsxs("div",{className:"px-2 sm:px-4 space-y-4",children:[jsx("p",{className:"whitespace-pre-wrap text-sm p-2 sm:p-4 bg-content2 rounded-lg text-neutral leading-[2]",children:n("channels.forms.socials.telegram.guide")}),jsxs("div",{className:"flex gap-4 items-center",children:[jsx(StyledInput,{fullWidth:true,placeholder:n("channels.forms.socials.telegram.placeholder"),radius:"lg",value:s,onValueChange:o}),jsx(Button,{color:"primary",radius:"lg",size:"sm",className:"h-10 min-h-10",children:n("common.save")})]})]})}function Ke({channel:e}){let[t,n]=useState("telegram");return jsxs("div",{className:"w-full space-y-4",children:[jsx(StyledTabs,{variant:"underlined",selectedKey:t,onSelectionChange:n,disableAnimation:false,children:jsx(Tab,{title:jsxs("div",{className:"flex items-center gap-2",children:[jsx(TelegramIcon,{width:16,height:16}),jsx("h3",{children:"Telegram"})]})},"telegram")}),t==="telegram"&&jsx(Re,{channel:e})]})}function Ge(e){return e.split(`
|
|
2
|
-
`).map(n=>n.trim()).filter(n=>!!n).map(n=>{let[s,o]=n.split(",");return {address:s?s.trim():void 0,alias:o?o.trim():void 0}})}function $e({wallets:e=[],onSubmit:t,isSubmitting:n}){let{t:s}=useTranslation(),o=useCopyToClipboard(),r=useAuthCallback(c=>{let u=e.filter(y=>y.value!==c.value).map(y=>({address:y.value??"",alias:y.alias}));t?.(u);},[e,t]),[a,i]=useState(""),h=debounce(i,200),m=useMemo(()=>e.filter(c=>c.alias?.toLowerCase()?.includes(a.toLowerCase())||c.value?.toLowerCase()?.includes(a.toLowerCase())),[a,e]);return jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h2",{className:"text-sm font-medium",children:s("channels.forms.wallets.list.title")}),jsx(StyledInput,{size:"sm",className:"max-w-50",radius:"full",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-neutral"}),placeholder:s("channels.forms.wallets.list.search.placeholder"),onValueChange:h})]}),jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:m.length>10||m.length===0,radius:"lg",classNames:{emptyWrapper:"pt-10"},maxTableHeight:500,rowHeight:52,"aria-label":s("channels.forms.wallets.list.title"),children:[jsxs(TableHeader,{children:[jsx(TableColumn,{textValue:s("channels.forms.wallets.list.header.address"),width:"60%",children:s("channels.forms.wallets.list.header.address")},"address"),jsx(TableColumn,{textValue:s("channels.forms.wallets.list.header.actions"),width:"40%",align:"end",children:s("channels.forms.wallets.list.header.actions")},"actions")]}),jsx(TableBody,{items:m,emptyContent:jsxs("div",{className:"space-y-2",children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-neutral"}),jsx("p",{className:"text-xs text-neutral text-center",children:s("channels.forms.wallets.list.empty")})]}),children:c=>jsxs(TableRow,{children:[jsx(TableCell,{children:jsxs("div",{className:"flex flex-col gap-1 text-xs",children:[jsx("div",{children:c.alias}),jsxs("div",{className:"text-neutral flex items-center gap-1",onClick:()=>o(c.value??""),"aria-label":s("common.copy"),children:[jsx("div",{children:shortAddress(c.value??"")}),jsx("div",{children:jsx(CopyIcon,{width:12,height:12})})]})]})},"address"),jsx(TableCell,{children:jsx(Button,{isIconOnly:true,size:"sm",radius:"full",className:"bg-transparent",disabled:n,onPress:()=>r(c),children:jsx(TrashIcon,{className:"text-danger-500",width:18,height:18})})},"actions")]},c.value)})]})]})}var Vo=z.object({walletsText:z.string({error:"channels.forms.wallets.required"}).min(1,"channels.forms.wallets.required")});function Ye({channel:e,wallets:t=[],onSubmit:n,isSubmitting:s=false}){let{t:o}=useTranslation(),r=useForm({mode:"onChange",reValidateMode:"onBlur",resolver:zodResolver(Vo),defaultValues:{walletsText:""}}),a=useMemo(()=>t.map(l=>({address:l.value??"",alias:l.alias})),[t]),{setError:i,reset:h}=r,m=useCallback(l=>{try{let u=Oe.parse(Ge(l)),y=u.length-uniqBy(u,"address").length;if(y!==0)throw new Error(o("channels.forms.wallets.address.duplicated",{count:y}));let Te=intersectionBy(u,a,"address").length;if(Te>0)throw new Error(o("channels.forms.wallets.address.alreadyAdded",{count:Te}));if(u.length+a.length>500)throw new Error(o("channels.forms.wallets.maxCount"));let me=0;for(let zt of u)isValidWalletAddress(e.chain,zt.address)||me++;if(me>0)throw new Error(o("channels.forms.wallets.address.invalid",{count:me}));return u}catch(u){u instanceof z.ZodError?i("walletsText",{message:u.issues[0].message,type:"manual"}):u instanceof Error?i("walletsText",{message:u.message,type:"manual"}):i("walletsText",{message:o("channels.forms.wallets.invalid"),type:"manual"});return}},[a,o,e.chain]),c=useCallback(async l=>{let u=m(l.walletsText);u&&u.length>0&&(await n?.([...a,...u]),h());},[m,n,a]);return jsxs("div",{className:"flex flex-col gap-6",children:[jsxs(RHForm,{methods:r,onSubmit:c,className:"relative",children:[jsx(RHTextArea,{name:"walletsText",label:o("channels.forms.wallets.label"),"aria-label":o("channels.forms.wallets.label"),placeholder:o("channels.forms.wallets.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,minRows:10,maxRows:10,labelPlacement:"outside-top"}),jsxs("div",{className:"absolute right-0 top-0 text-xs flex gap-1 text-neutral",children:[jsxs("span",{className:"text-neutral",children:[o("channels.forms.wallets.addedCount"),":"]}),jsxs("span",{children:[a.length," / 500"]})]}),jsxs("div",{className:"w-full flex items-center gap-4",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",children:jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-xs text-neutral flex-none",children:[o("channels.forms.wallets.supportedFormats"),":"]}),jsx(StyledTooltip,{closeDelay:0,content:jsx("div",{className:"text-xs whitespace-pre-line",children:o("channels.forms.wallets.supportedFormats.text.hint")}),children:jsx(Chip,{size:"sm",variant:"flat",children:o("channels.forms.wallets.supportedFormats.text")})})]})}),jsx("div",{className:"flex-none flex gap-4 items-center",children:jsx(Button,{color:"primary",type:"submit",radius:"lg",isLoading:s,size:"sm",children:o("channels.forms.wallets.submit")})})]})]}),jsx($e,{wallets:t,onSubmit:n,isSubmitting:s})]})}function tt({channel:e,type:t="base",baseFormDefaultValues:n,isSubmittingBaseForm:s=false,onSubmitBaseForm:o,baseFormSubmitLabel:r,wallets:a,isSubmittingWalletsForm:i=false,onSubmitWalletsForm:h,className:m}){let{t:c}=useTranslation(),[l,u]=useState(t),{isMobile:y}=useScreen();return jsxs("div",{className:clsx("w-full flex flex-col gap-4",m),children:[jsxs(StyledTabs,{fullWidth:true,variant:"solid",size:y?"sm":void 0,selectedKey:l,onSelectionChange:u,children:[jsx(Tab,{title:c("channels.forms.base.title")},"base"),jsx(Tab,{title:c("channels.forms.wallets.title")},"wallets"),jsx(Tab,{title:c("channels.forms.socials.title")},"social")]}),l==="base"&&jsx($,{defaultValues:n,isSubmitting:s,onSubmit:o,submitLabel:r}),l==="wallets"&&jsx(Ye,{channel:e,wallets:a,isSubmitting:i,onSubmit:h}),l==="social"&&jsx(Ke,{channel:e})]})}function nt({type:e="base",className:t}){let{t:n}=useTranslation(),[s,o]=useState(e),{isMobile:r}=useScreen();return jsxs("div",{className:clsx("w-full flex flex-col gap-4",t),children:[jsxs(StyledTabs,{fullWidth:true,variant:"solid",size:r?"sm":void 0,selectedKey:s,onSelectionChange:o,children:[jsx(Tab,{title:n("channels.forms.base.title")},"base"),jsx(Tab,{title:n("channels.forms.wallets.title")},"wallets"),jsx(Tab,{title:n("channels.forms.socials.title")},"social")]}),s==="base"&&jsx(ge,{}),s==="wallets"&&jsx(ge,{}),s==="social"&&jsx(ge,{})]})}function ge(){return jsxs("div",{className:"flex flex-col gap-4",children:[jsx(Skeleton,{className:"w-full h-10 rounded-md"}),jsx(Skeleton,{className:"w-full h-10 rounded-md"}),jsx(Skeleton,{className:"w-full h-40 rounded-md"})]})}function st(e,t){let{t:n}=useTranslation(),{data:s,isLoading:o}=Be(e),{mutateAsync:r,isPending:a}=Qe(),i=useAuthCallback(async h=>{try{if(!t?.chain)throw new Error("Channel chain is not set");await r({channel_id:e,type:"wallet",sources:h.map(m=>({type:"wallet",value:m.address,alias:m.alias,configs:{chain:chainSlug(t.chain)}}))}),toast.success(n("channels.forms.wallets.update.success"));}catch{toast.error(n("channels.forms.wallets.update.error"));}},[r,e,t?.chain]);return {isLoading:o,isSubmitting:a,wallets:s,submit:i}}function bl({id:e,type:t="base"}){let{t:n}=useTranslation(),{channel:s,defaultValues:o,isLoading:r,isSubmitting:a,submit:i}=_e(e),{wallets:h,isLoading:m,isSubmitting:c,submit:l}=st(e,s);return r||m||!s?jsx(nt,{type:t}):jsx(tt,{channel:s,type:t,baseFormDefaultValues:o,isSubmittingBaseForm:a,onSubmitBaseForm:i,baseFormSubmitLabel:n("channels.forms.base.update.submit"),wallets:h,isSubmittingWalletsForm:c,onSubmitWalletsForm:l})}function Y({channel:e}){let{t}=useTranslation(),n=useTickAge(new Date(e.updated_at));return jsx(HorizontalScrollContainer,{classNames:{leftArrow:"from-content1/60 to-transparent",rightArrow:"from-content1/60 to-transparent"},children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(StyledTooltip,{content:t("channels.info.walletCount"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(WalletIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:e.source_count||"-"})]})}),jsx(StyledTooltip,{content:t("channels.info.subscribeCount"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(PeopleIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:e.subscribe_count||"-"})]})}),jsx(StyledTooltip,{content:t("channels.info.updatedAt"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(TimerIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:formatAge(n)})]})}),e.twitter&&jsx(Link,{href:e.twitter,target:"_blank",className:"text-neutral",children:jsx(TwitterIcon,{width:16,height:16})}),e.telegram&&jsx(Link,{href:e.telegram,target:"_blank",className:"text-neutral",children:jsx(TelegramIcon,{width:16,height:16})}),e.discord&&jsx(Link,{href:e.discord,target:"_blank",className:"text-neutral",children:jsx(DiscordIcon,{width:16,height:16})})]})})}function it({channel:e,customActions:t}){let n=useMemo(()=>e.chain?chainIcon(e.chain):void 0,[e.chain]);return jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsxs("div",{className:"relative",children:[jsx(Avatar,{src:e.icon,alt:e.name,className:"w-18 h-18",radius:"md"}),n&&jsx(Avatar,{radius:"full",src:n,className:"w-5 h-5 absolute -bottom-1 -right-1 border border-border shadow-sm"})]})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 text-neutral",children:[jsxs("div",{className:"h-6 flex items-center gap-2",children:[jsx("p",{className:"flex-auto min-w-0 text-sm font-medium text-foreground truncate",children:e.name}),jsx("div",{className:"flex-none",children:t})]}),jsx(Y,{channel:e}),jsx("p",{className:"text-xs whitespace-pre-wrap line-clamp-1 h-4 overflow-hidden",children:e.description})]})]})}function Hl({channel:e,onEdit:t}){let{user:n}=useAuth(),s=useAuthCallback(()=>{t?.(e);},[e,t]);return n?.id!==e.owner_id?jsx(Fragment,{}):jsx(StyledButton,{className:"bg-transparent",isIconOnly:true,size:"sm",onPress:s,children:jsx(EditIcon,{width:16,height:16,className:"text-neutral"})})}function ne({channel:e}){let{t}=useTranslation();return jsx(HorizontalScrollContainer,{classNames:{leftArrow:"from-content1/60 to-transparent",rightArrow:"from-content1/60 to-transparent"},children:jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsx(StyledTooltip,{content:t("channels.stats.7dTxs.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dTxs.title")}),jsx("p",{className:"text-foreground font-semibold",children:"--"})]})}),jsx(StyledTooltip,{content:t("channels.stats.7dPnl.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dPnl.title")}),jsx("p",{className:"text-bullish font-semibold",children:"--"})]})}),jsx(StyledTooltip,{content:t("channels.stats.7dWr.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dWr.title")}),jsx("p",{className:"text-bullish font-semibold",children:"--%"})]})})]})})}function sm({channel:e,onSubscribeSuccess:t,onUnsubscribeSuccess:n,onSubscribeError:s,onUnsubscribeError:o}){let{t:r}=useTranslation(),[a,i]=useState(e.is_subscribed);useEffect(()=>{i(e.is_subscribed);},[e.is_subscribed]);let{mutateAsync:h,isPending:m}=De(),{mutateAsync:c,isPending:l}=Me(),u=useAuthCallback(async()=>{try{a?(await c(e.id),i(!1),toast.success(r("channels.unsubscribe.success")),n?.(e)):(await h(e.id),i(!0),toast.success(r("channels.subscribe.success")),t?.(e));}catch(y){a?(toast.error(r("channels.unsubscribe.error")),o?.(e,y)):(toast.error(r("channels.subscribe.error")),s?.(e,y));}},[r,a,e,h,c,t,n,s,o]);return jsx(StyledButton,{color:a?"default":"primary",size:"sm",radius:"lg",onPress:u,isLoading:m||l,variant:a?"bordered":"flat",className:clsx("gap-1",a&&"text-neutral"),startContent:a?!m&&!l?jsx(CheckIcon,{width:16,height:16}):void 0:!m&&!l?jsx(PlusIcon,{width:16,height:16}):void 0,children:r(a?"channels.unsubscribe.submit":"channels.subscribe.submit")})}function mt({channel:e,onSelect:t,headerActions:n,footerActions:s}){let o=useCallback(()=>{t?.(e);},[e,t]);return jsxs("div",{className:clsx("bg-content1 hover:bg-content2 border border-border rounded-lg w-full h-full p-2.5","flex flex-col gap-2.5",t&&"cursor-pointer"),onClick:o,children:[jsx(it,{channel:e,customActions:n}),jsxs("div",{className:"flex items-center gap-4",children:[jsx("div",{className:"flex-auto min-w-0",children:jsx(ne,{channel:e})}),jsx("div",{className:"flex-none",children:s})]})]})}function M({channels:e,onSelect:t,customHeaderActions:n,customFooterActions:s}){return jsx("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(o=>jsx(mt,{channel:o,onSelect:t,headerActions:n?.(o),footerActions:s?.(o)},o.id))})}function Q({count:e}){return jsx("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:e}).map((t,n)=>jsxs("div",{className:"bg-content1 hover:bg-content2 border border-border rounded-lg w-full h-35 p-2.5 flex flex-col gap-2.5",children:[jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsx(Skeleton,{className:"w-18 h-18 flex-none rounded-md"})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 justify-center text-neutral",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-48 h-4 rounded-md"}),jsx(Skeleton,{className:"w-48 h-4 rounded-md"})]})]}),jsxs("div",{className:"w-full flex justify-between gap-4",children:[jsx(Skeleton,{className:"flex-auto min-w-0 h-6 rounded-md"}),jsx(Skeleton,{className:"w-24 h-6 rounded-md"})]})]},n))})}function V({message:e}){let{t}=useTranslation();return jsxs("div",{className:"pt-24 mx-auto",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral mx-auto"}),jsx("p",{className:"pt-2 text-sm text-neutral text-center",children:e||t("common.empty")})]})}var pt=()=>{let{status:e}=useAuth(),t=Ae(),{refetch:n}=t;return useEffect(()=>{e==="authenticated"&&n();},[e,n]),t};function ut({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{data:s,isLoading:o}=pt();return o?jsx(Q,{count:9}):!s||s.list.length===0?jsx(V,{}):jsx(M,{channels:s.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}function re({message:e}){let{t}=useTranslation(),{signIn:n}=useAuth();return jsxs("div",{className:"pt-24 flex flex-col items-center justify-center gap-2",children:[jsx("p",{className:"text-neutral text-sm",children:e||t("common.unauthenticated")}),jsx(StyledButton,{color:"primary",size:"sm",onPress:n,radius:"lg",children:t("common.signIn")})]})}function ft({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{status:s}=useAuth(),{data:o,isLoading:r}=j({},{enabled:s==="authenticated"});return s==="unauthenticated"?jsx(re,{}):s==="authenticating"||r?jsx(Q,{count:9}):!o||o.list.length===0?jsx(V,{}):jsx(M,{channels:o.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}var Ym=()=>j();function gt({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{status:s}=useAuth(),{data:o,isLoading:r}=G({},{enabled:s==="authenticated"});return s==="unauthenticated"?jsx(re,{}):s==="authenticating"||r?jsx(Q,{count:9}):!o||o.list.length===0?jsx(V,{}):jsx(M,{channels:o.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}var cc=()=>G();function yt({channel:e,headerActions:t,footerActions:n}){let s=useMemo(()=>e.chain?chainIcon(e.chain):void 0,[e.chain]);return jsxs("div",{className:clsx("bg-content1 border border-border rounded-lg w-full h-full p-2.5","flex flex-col gap-2.5"),children:[jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsxs("div",{className:"relative",children:[jsx(Avatar,{src:e.icon,alt:e.name,className:"w-18 h-18",radius:"md"}),s&&jsx(Avatar,{radius:"full",src:s,className:"w-5 h-5 absolute -bottom-1 -right-1 border border-border shadow-sm"})]})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 text-neutral",children:[jsxs("div",{className:"h-6 flex items-center gap-2",children:[jsx("p",{className:"flex-auto min-w-0 text-sm font-medium text-foreground truncate",children:e.name}),jsx("div",{className:"flex-none",children:t})]}),jsx(Y,{channel:e})]})]}),jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-auto min-w-0",children:jsx(ne,{channel:e})}),jsx("div",{className:"flex-none",children:n})]}),e.description&&jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]})}function Pe(){let{t:e}=useTranslation();return jsxs("div",{className:"w-ful bg-content1 border border-border rounded-lg p-2.5",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral mx-auto mt-20"}),jsx("p",{className:"pt-2 text-sm text-neutral text-center mb-20",children:e("common.empty")})]})}function wt(){let{t:e}=useTranslation();return jsxs("div",{className:"w-full",children:[jsx(EmptyIcon,{width:40,height:40,className:"mt-10 text-neutral mx-auto"}),jsx("p",{className:"text-sm text-neutral text-center mt-2",children:e("channels.detail.notfound")})]})}function Pt(){return jsxs("div",{className:"w-full space-y-6",children:[jsx(Skeleton,{className:"w-full h-35 rounded-md"}),jsx(Skeleton,{className:"w-full h-40 rounded-md"})]})}var It=e=>K(e);function Nt({id:e,customHeaderActions:t,customFooterActions:n}){let{t:s}=useTranslation(),{data:o,isLoading:r}=It(e);return r?jsx(Pt,{}):o?jsxs("div",{className:"space-y-6",children:[jsx(yt,{channel:o,headerActions:t?.(o),footerActions:n?.(o)}),jsxs("div",{className:"space-y-2.5",children:[jsx("h2",{className:"text-sm font-semibold",children:s("channels.detail.events.title")}),jsx(Pe,{})]})]}):jsx(wt,{})}function hd({onCreateChannel:e,onSelectChannel:t,customHeaderActions:n,customFooterActions:s}){let{t:o}=useTranslation(),{isMobile:r}=useScreen(),[a,i]=useState("trending");return jsxs("div",{className:"w-full max-w-7xl mx-auto py-2 px-2 sm:py-4 sm:px-4",children:[jsxs("div",{className:"flex items-center justify-between gap-2 w-full overflow-x-auto",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",children:jsxs(StyledTabs,{variant:"primaryPlain",radius:"lg",selectedKey:a,onSelectionChange:i,"aria-label":o("channels.list.title"),size:r?"sm":void 0,children:[jsx(Tab,{title:o("channels.trending.title"),"aria-label":o("channels.trending.title")},"trending"),jsx(Tab,{title:o("channels.my.title"),"aria-label":o("channels.my.title")},"my"),jsx(Tab,{title:o("channels.subscribed.title"),"aria-label":o("channels.subscribed.title")},"subscribed")]})}),jsx("div",{className:"flex-none flex items-center gap-2",children:e&&jsxs(Fragment,{children:[jsx(Button,{radius:"lg",color:"primary",size:"sm",onPress:e,className:"max-sm:hidden gap-1",startContent:jsx(PlusIcon,{width:18,height:18}),"aria-label":o("channels.create.title"),children:o("channels.create.title")}),jsx(Button,{isIconOnly:true,radius:"full",color:"primary",size:"sm",onPress:e,className:"sm:hidden w-7 min-w-7 h-7 min-h-7","aria-label":o("channels.create.title"),children:jsx(PlusIcon,{width:18,height:18})})]})})]}),jsxs("div",{className:"mt-4 w-full",children:[a==="trending"&&jsx(ut,{onSelect:t,customHeaderActions:n,customFooterActions:s}),a==="my"&&jsx(gt,{onSelect:t,customHeaderActions:n,customFooterActions:s}),a==="subscribed"&&jsx(ft,{onSelect:t,customHeaderActions:n,customFooterActions:s})]})]})}function bd({id:e,customHeaderActions:t,customFooterActions:n}){let{t:s}=useTranslation();return jsxs("div",{className:"w-full max-w-2xl mx-auto py-2 px-2 sm:py-4 sm:px-4 space-y-2 sm:space-y-4",children:[jsx("h1",{className:"text-sm sm:text-lg font-semibold",children:s("channels.detail.title")}),jsx(Nt,{id:e,customFooterActions:n,customHeaderActions:t})]})}function ke(e){return jsx("svg",{width:"8",height:"16",viewBox:"0 0 5 9",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:jsx("path",{d:"M5 5.72727L2.5 9L0 5.72727H5ZM2.5 0L5 3.27273H0L2.5 0Z",fill:"currentColor"})})}function Lt(e){return jsx("svg",{width:"24",height:"24",viewBox:"0 0 12 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:jsx("path",{d:"M6 0C2.6856 0 0 2.68698 0 6C0 9.3144 2.68698 12 6 12C9.3144 12 12 9.31302 12 6C12.0014 2.68698 9.3144 0 6 0ZM8.53878 6.2036L5.21191 8.88089C5.04155 9.01801 4.78947 8.89612 4.78947 8.67867V3.32271C4.78947 3.10526 5.04155 2.98338 5.21191 3.1205L8.53878 5.79917C8.66897 5.90305 8.66897 6.09972 8.53878 6.2036Z",fill:"currentColor"})})}function Mt({onFilterChange:e}){let[t,n]=useState("newest"),[s,o]=useState("1D"),[r,a]=useState("buy"),[i,h]=useState(""),[m,c]=useState("P1");return useEffect(()=>{e?.({sort:t,timeRange:s,tradeType:r,search:i,plan:m});},[t,s,r,i,m,e]),jsxs("div",{className:"flex items-center justify-between w-full",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(Button,{variant:"bordered",className:"flex items-center gap-1",onPress:()=>n("newest"),children:[jsx(ke,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Newest"})]}),jsxs(Button,{variant:"bordered",className:"flex items-center gap-1",onPress:()=>n("amount"),children:[jsx(ke,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Amount"})]}),jsxs(Tabs,{variant:"solid",size:"sm",selectedKey:s,onSelectionChange:l=>o(l),children:[jsx(Tab,{title:"1D"},"1D"),jsx(Tab,{title:"7D"},"7D"),jsx(Tab,{title:"30D"},"30D")]}),jsxs(ButtonGroup,{size:"sm",children:[jsx(Button,{variant:"flat",onPress:()=>a("buy"),children:jsx("span",{className:"text-primary font-semibold",children:"Buy"})}),jsx(Button,{variant:"flat",onPress:()=>a("sell"),children:jsx("span",{className:"text-danger font-semibold",children:"Sell"})})]})]}),jsx(Input,{placeholder:"Token symbol or address\u2026",variant:"faded",className:"max-w-80",value:i,onChange:l=>h(l.target.value)}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs(Button,{size:"sm",variant:"light",className:"flex items-center gap-1",children:[jsx(Lt,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Listen"})]}),jsxs(Tabs,{variant:"bordered",size:"sm",selectedKey:m,onSelectionChange:l=>c(l),color:"primary",children:[jsx(Tab,{title:"P1"},"P1"),jsx(Tab,{title:"P2"},"P2"),jsx(Tab,{title:"P3"},"P3")]})]})]})}function Qt({trading:e,onBuy:t}){return jsxs(Table,{classNames:{wrapper:"bg-transparent p-0"},className:"text-default-800",children:[jsxs(TableHeader,{children:[jsx(TableColumn,{children:"Date"},"date"),jsx(TableColumn,{children:"Channel"},"channel"),jsx(TableColumn,{children:"Address"},"address"),jsx(TableColumn,{children:"Token"},"token"),jsx(TableColumn,{children:"$ MC"},"mc"),jsxs(TableColumn,{children:["Amount ",jsx("span",{className:"text-primary",children:"$"})]},"amount"),jsx(TableColumn,{children:"Actions"},"actions")]}),jsx(TableBody,{items:e,isLoading:false,children:n=>jsxs(TableRow,{children:[jsx(TableCell,{children:formatAge(Date.now()-n.date)}),jsx(TableCell,{children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Image,{radius:"md",src:n.channel.imageUrl,alt:n.channel.name,width:20,height:20}),n.channel.name]})}),jsx(TableCell,{children:jsx("p",{className:clsx(n.type==="buy"?"text-primary":"text-secondary"),children:shortAddress(n.address)})}),jsx(TableCell,{children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Image,{radius:"md",src:n.token.image,alt:n.token.symbol,width:16,height:16})," ",jsxs("div",{className:"flex items-end gap-0.5",children:[jsx("p",{children:n.token.symbol}),jsx("p",{className:"text-xs text-default-500",children:shortAddress(n.token.address)})]})]})}),jsx(TableCell,{children:formatAmountUSD2(n.mc)}),jsx(TableCell,{children:jsxs("div",{className:"flex gap-1 items-center",children:[jsx(Image,{src:n.token.chainIcon,alt:n.token.symbol,width:16,height:16}),jsx("p",{className:clsx(n.type==="buy"?"text-primary":"text-secondary"),children:formatAmount(n.amount)})]})}),jsx(TableCell,{children:jsxs(Button,{radius:"full",className:clsx("text-white bg-[#B1FF3770]"),size:"sm",onPress:()=>t(n),children:["Buy 0.002 ",n.token.symbol]})})]},n.id)})]})}function qt({trading:e,onBuy:t}){return jsxs("div",{className:"flex flex-col gap-3",children:[jsx(Mt,{}),jsx(Qt,{trading:e,onBuy:t})]})}var Zt=[{id:"1",date:Date.now()-32*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"2",date:Date.now()-60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"3",date:Date.now()-780*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"4",date:Date.now()-3600*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"5",date:Date.now()-1.5*60*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"6",date:Date.now()-10800*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"7",date:Date.now()-720*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"8",date:Date.now()-1440*60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"9",date:Date.now()-7200*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"10",date:Date.now()-14400*60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579}],Ot=[32*1e3,60*1e3,780*1e3,3600*1e3,1.5*60*60*1e3,10800*1e3,720*60*1e3,1440*60*1e3,7200*60*1e3,14400*60*1e3],Et=["buy","sell"];for(let e=11;e<=20;e++)Zt.push({id:`${e}`,date:Date.now()-Ot[(e-1)%Ot.length],type:Et[(e-1)%Et.length],channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579});var _t=()=>Zt;function Hd(){let e=_t();return jsx(qt,{trading:e,onBuy:n=>{}})}function lp({client:e,children:t}){return jsx(H.Provider,{value:{client:e},children:t})}
|
|
1
|
+
import {useTranslation}from'@liberfi.io/i18n';import {z,usePinata,useForm,zodResolver,RHForm,RHInput,RHTextArea,RHUpload,Button,toast,StyledTabs,Tab,TelegramIcon,useCopyToClipboard,StyledInput,SearchIcon,StyledTable,TableHeader,TableColumn,TableBody,TableRow,TableCell,CopyIcon,TrashIcon,EmptyIcon,HorizontalScrollContainer,StyledTooltip,Chip,useScreen,clsx,WalletIcon,PeopleIcon,TimerIcon,Link,TwitterIcon,DiscordIcon,Avatar,StyledButton,EditIcon,CheckIcon,PlusIcon,Skeleton,Tabs,ButtonGroup,Input,Table,Image}from'@liberfi.io/ui';import {useQuery,useMutation,useQueryClient}from'@tanstack/react-query';import {createContext,useContext,useCallback,useMemo,useState,useEffect}from'react';import {chainSlug,debounce,shortAddress,uniqBy,intersectionBy,isValidWalletAddress,formatAge,chainIcon,formatAmountUSD2,formatAmount}from'@liberfi.io/utils';import {useDexClient,fetchPresignedUploadUrl}from'@liberfi.io/client';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {Chain}from'@liberfi.io/types';import {useAuthCallback,useAuth}from'@liberfi.io/wallet-connector';import {useTickAge}from'@liberfi.io/hooks';typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-channels"]="0.1.0");var Rt="0.1.0";var H=createContext({});function Fe(){let e=useContext(H);if(!e)throw new Error("useChannelsContext must be used within a ChannelsProvider");return e}function d(){let{client:e}=Fe();return e}function jt(e,t){return ["channelEvents",e,t.timestamp?`${t.timestamp}`:"",t.next_page?`${t.next_page}`:"",t.limit?`${t.limit}`:""]}async function Xt(e,t,n){return await e.getChannelEvents(t,n)}function $t(e,t={},n={}){let s=d();return useQuery({queryKey:jt(e,t),queryFn:async()=>Xt(s,e,t),...n})}function F(e){return ["channel",e]}async function Yt(e,t){return await e.get(t)}function K(e,t={}){let n=d();return useQuery({queryKey:F(e),queryFn:async()=>Yt(n,e),...t})}function nn(e){return ["channels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function on(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getChannels(n)}function Ae(e={},t={}){let n=d();return useQuery({queryKey:nn(e),queryFn:async()=>on(n,e),...t})}function ce(e){return ["channelSources",e]}async function an(e,t){return await e.getSources(t)}function Be(e,t={}){let n=d();return useQuery({queryKey:ce(e),queryFn:async()=>an(n,e),...t})}async function mn(e,t){let n=chainSlug(t.chain);if(!n)throw new Error("Invalid chain");return e.create({...t,chain:n})}function Le(e={}){let t=d();return useMutation({mutationFn:async n=>mn(t,n),...e})}function pn(e){return ["myChannels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function un(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getMyChannels(n)}function G(e={},t={}){let n=d();return useQuery({queryKey:pn(e),queryFn:async()=>un(n,e),...t})}async function gn(e,t){await e.subscribe(t);}function De(e={}){let t=useQueryClient(),n=d();return useMutation({mutationFn:async s=>gn(n,s),...e,onSuccess:(s,o,r,a)=>{t.invalidateQueries({queryKey:["subscribedChannels"]}),t.invalidateQueries({queryKey:F(o)}),e?.onSuccess?.(s,o,r,a);}})}function bn(e){return ["subscribedChannels",e.chain??"",e.page?`${e.page}`:"",e.size?`${e.size}`:"",e.search??"",e.sort??"",e.order??""]}async function xn(e,t){let n={...t,chain:t.chain?chainSlug(t.chain):void 0};return await e.getSubscribedChannels(n)}function j(e={},t={}){let n=d();return useQuery({queryKey:bn(e),queryFn:async()=>xn(n,e),...t})}async function Sn(e,t){await e.unsubscribe(t);}function Me(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Sn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:["subscribedChannels"]}),n.invalidateQueries({queryKey:F(o)}),e?.onSuccess?.(s,o,r,a);}})}async function Nn(e,t){let n={...t};if(t.chain){let s=chainSlug(t.chain);if(!s)throw new Error("Invalid chain");n.chain=s;}return e.update(n)}function We(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Nn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:F(o.id)}),e?.onSuccess?.(s,o,r,a);}})}async function Fn(e,t){return e.updateSources(t)}function Qe(e={}){let t=d(),n=useQueryClient();return useMutation({mutationFn:async s=>Fn(t,s),...e,onSuccess:(s,o,r,a)=>{n.invalidateQueries({queryKey:ce(o.channel_id)}),e?.onSuccess?.(s,o,r,a);}})}var Ve=()=>{let e=usePinata(),{client:t}=useDexClient();return useCallback(async s=>{let o=await fetchPresignedUploadUrl(t),r=await e.upload.public.file(s).url(o);return e.gateways.public.convert(r.cid)},[e,t])};var qe=z.object({name:z.string({error:"channels.forms.base.name.required"}).min(1,"channels.forms.base.name.min").max(24,"channels.forms.base.name.max"),description:z.string().optional(),icon:z.url({error:"channels.forms.base.icon.required"})}),Mn=z.object({address:z.string({error:"channels.forms.wallets.address.required"}),alias:z.string().optional()}),Oe=z.array(Mn).min(1,"channels.forms.wallets.required").max(500,"channels.forms.wallets.maxCount");function $({isSubmitting:e=false,onSubmit:t,defaultValues:n={name:"",description:"",icon:""},submitLabel:s}){let{t:o}=useTranslation(),r=useForm({mode:"onChange",reValidateMode:"onBlur",resolver:zodResolver(qe),defaultValues:n}),a=Ve();return jsxs(RHForm,{methods:r,onSubmit:t,children:[jsx(RHInput,{name:"name",label:o("channels.forms.base.name.label"),"aria-label":o("channels.forms.base.name.label"),placeholder:o("channels.forms.base.name.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,labelPlacement:"outside-top"}),jsx(RHTextArea,{name:"description",label:o("channels.forms.base.description.label"),"aria-label":o("channels.forms.base.description.label"),placeholder:o("channels.forms.base.description.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,labelPlacement:"outside-top"}),jsx(RHUpload,{name:"icon",upload:a,label:o("channels.forms.base.icon.label"),placeholder:o("channels.forms.base.icon.placeholder"),hint:o("channels.forms.base.icon.hint"),radius:"lg",classNames:{upload:"sm:max-w-80"}}),jsx(Button,{color:"primary",fullWidth:true,type:"submit",radius:"lg",className:"mt-8",isLoading:e,children:s??o("channels.forms.base.submit")})]})}function li({onSuccess:e,onError:t}){let{t:n}=useTranslation(),{mutateAsync:s,isPending:o}=Le(),r=useAuthCallback(async a=>{try{let i=await s({name:a.name,description:a.description,icon:a.icon,chain:Chain.SOLANA,privacy:"public"});toast.success(n("channels.create.success")),e?.(i);}catch(i){toast.error(n("channels.create.error")),t?.(i);}},[n,s,e,t]);return jsx($,{onSubmit:r,isSubmitting:o})}function _e(e){let{t}=useTranslation(),{data:n,isLoading:s}=K(e),{mutateAsync:o,isPending:r}=We(),a=useMemo(()=>{if(n)return {name:n.name,description:n.description,icon:n.icon??""}},[n]),i=useAuthCallback(async h=>{try{await o({id:e,name:h.name,description:h.description,icon:h.icon}),toast.success(t("channels.update.success"));}catch(l){console.error("Update channel base info error",l),toast.error(t("channels.update.error"));}},[o,e]);return {channel:n,isLoading:s,isSubmitting:r,defaultValues:a,submit:i}}function Re({sink:e,onSaveToken:t}){let{t:n}=useTranslation(),[s,o]=useState("");return useEffect(()=>{},[e]),jsxs("div",{className:"px-2 sm:px-4 space-y-4",children:[jsx("p",{className:"whitespace-pre-wrap text-sm p-2 sm:p-4 bg-content2 rounded-lg text-neutral leading-[2]",children:n("channels.forms.socials.telegram.guide")}),jsxs("div",{className:"flex gap-4 items-center",children:[jsx(StyledInput,{fullWidth:true,placeholder:n("channels.forms.socials.telegram.placeholder"),radius:"lg",value:s,onValueChange:o}),jsx(Button,{color:"primary",radius:"lg",size:"sm",className:"h-10 min-h-10",children:n("common.save")})]})]})}function Ke({channel:e}){let[t,n]=useState("telegram");return jsxs("div",{className:"w-full space-y-4",children:[jsx(StyledTabs,{variant:"underlined",selectedKey:t,onSelectionChange:n,disableAnimation:false,children:jsx(Tab,{title:jsxs("div",{className:"flex items-center gap-2",children:[jsx(TelegramIcon,{width:16,height:16}),jsx("h3",{children:"Telegram"})]})},"telegram")}),t==="telegram"&&jsx(Re,{channel:e})]})}function Ge(e){return e.split(`
|
|
2
|
+
`).map(n=>n.trim()).filter(n=>!!n).map(n=>{let[s,o]=n.split(",");return {address:s?s.trim():void 0,alias:o?o.trim():void 0}})}function $e({wallets:e=[],onSubmit:t,isSubmitting:n}){let{t:s}=useTranslation(),o=useCopyToClipboard(),r=useAuthCallback(c=>{let u=e.filter(y=>y.value!==c.value).map(y=>({address:y.value??"",alias:y.alias}));t?.(u);},[e,t]),[a,i]=useState(""),h=debounce(i,200),l=useMemo(()=>e.filter(c=>c.alias?.toLowerCase()?.includes(a.toLowerCase())||c.value?.toLowerCase()?.includes(a.toLowerCase())),[a,e]);return jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h2",{className:"text-sm font-medium",children:s("channels.forms.wallets.list.title")}),jsx(StyledInput,{size:"sm",className:"max-w-50",radius:"full",startContent:jsx(SearchIcon,{width:16,height:16,className:"text-neutral"}),placeholder:s("channels.forms.wallets.list.search.placeholder"),onValueChange:h})]}),jsxs(StyledTable,{isHeaderSticky:true,isVirtualized:l.length>10||l.length===0,radius:"lg",classNames:{emptyWrapper:"pt-10"},maxTableHeight:500,rowHeight:52,"aria-label":s("channels.forms.wallets.list.title"),children:[jsxs(TableHeader,{children:[jsx(TableColumn,{textValue:s("channels.forms.wallets.list.header.address"),width:"60%",children:s("channels.forms.wallets.list.header.address")},"address"),jsx(TableColumn,{textValue:s("channels.forms.wallets.list.header.actions"),width:"40%",align:"end",children:s("channels.forms.wallets.list.header.actions")},"actions")]}),jsx(TableBody,{items:l,emptyContent:jsxs("div",{className:"space-y-2",children:[jsx(EmptyIcon,{className:"w-10 h-10 mx-auto text-neutral"}),jsx("p",{className:"text-xs text-neutral text-center",children:s("channels.forms.wallets.list.empty")})]}),children:c=>jsxs(TableRow,{children:[jsx(TableCell,{children:jsxs("div",{className:"flex flex-col gap-1 text-xs",children:[jsx("div",{children:c.alias}),jsxs("div",{className:"text-neutral flex items-center gap-1",onClick:()=>o(c.value??""),"aria-label":s("common.copy"),children:[jsx("div",{children:shortAddress(c.value??"")}),jsx("div",{children:jsx(CopyIcon,{width:12,height:12})})]})]})},"address"),jsx(TableCell,{children:jsx(Button,{isIconOnly:true,size:"sm",radius:"full",className:"bg-transparent",disabled:n,onPress:()=>r(c),children:jsx(TrashIcon,{className:"text-danger-500",width:18,height:18})})},"actions")]},c.value)})]})]})}var Vo=z.object({walletsText:z.string({error:"channels.forms.wallets.required"}).min(1,"channels.forms.wallets.required")});function Ye({channel:e,wallets:t=[],onSubmit:n,isSubmitting:s=false}){let{t:o}=useTranslation(),r=useForm({mode:"onChange",reValidateMode:"onBlur",resolver:zodResolver(Vo),defaultValues:{walletsText:""}}),a=useMemo(()=>t.map(m=>({address:m.value??"",alias:m.alias})),[t]),{setError:i,reset:h}=r,l=useCallback(m=>{try{let u=Oe.parse(Ge(m)),y=u.length-uniqBy(u,"address").length;if(y!==0)throw new Error(o("channels.forms.wallets.address.duplicated",{count:y}));let Te=intersectionBy(u,a,"address").length;if(Te>0)throw new Error(o("channels.forms.wallets.address.alreadyAdded",{count:Te}));if(u.length+a.length>500)throw new Error(o("channels.forms.wallets.maxCount"));let me=0;for(let zt of u)isValidWalletAddress(e.chain,zt.address)||me++;if(me>0)throw new Error(o("channels.forms.wallets.address.invalid",{count:me}));return u}catch(u){u instanceof z.ZodError?i("walletsText",{message:u.issues[0].message,type:"manual"}):u instanceof Error?i("walletsText",{message:u.message,type:"manual"}):i("walletsText",{message:o("channels.forms.wallets.invalid"),type:"manual"});return}},[a,o,e.chain]),c=useCallback(async m=>{let u=l(m.walletsText);u&&u.length>0&&(await n?.([...a,...u]),h());},[l,n,a]);return jsxs("div",{className:"flex flex-col gap-6",children:[jsxs(RHForm,{methods:r,onSubmit:c,className:"relative",children:[jsx(RHTextArea,{name:"walletsText",label:o("channels.forms.wallets.label"),"aria-label":o("channels.forms.wallets.label"),placeholder:o("channels.forms.wallets.placeholder"),variant:"bordered",radius:"lg",size:"sm",fullWidth:true,minRows:10,maxRows:10,labelPlacement:"outside-top"}),jsxs("div",{className:"absolute right-0 top-0 text-xs flex gap-1 text-neutral",children:[jsxs("span",{className:"text-neutral",children:[o("channels.forms.wallets.addedCount"),":"]}),jsxs("span",{children:[a.length," / 500"]})]}),jsxs("div",{className:"w-full flex items-center gap-4",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",children:jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-xs text-neutral flex-none",children:[o("channels.forms.wallets.supportedFormats"),":"]}),jsx(StyledTooltip,{closeDelay:0,content:jsx("div",{className:"text-xs whitespace-pre-line",children:o("channels.forms.wallets.supportedFormats.text.hint")}),children:jsx(Chip,{size:"sm",variant:"flat",children:o("channels.forms.wallets.supportedFormats.text")})})]})}),jsx("div",{className:"flex-none flex gap-4 items-center",children:jsx(Button,{color:"primary",type:"submit",radius:"lg",isLoading:s,size:"sm",children:o("channels.forms.wallets.submit")})})]})]}),jsx($e,{wallets:t,onSubmit:n,isSubmitting:s})]})}function tt({channel:e,type:t="base",baseFormDefaultValues:n,isSubmittingBaseForm:s=false,onSubmitBaseForm:o,baseFormSubmitLabel:r,wallets:a,isSubmittingWalletsForm:i=false,onSubmitWalletsForm:h,className:l}){let{t:c}=useTranslation(),[m,u]=useState(t),{isMobile:y}=useScreen();return jsxs("div",{className:clsx("w-full flex flex-col gap-4",l),children:[jsxs(StyledTabs,{fullWidth:true,variant:"solid",size:y?"sm":void 0,selectedKey:m,onSelectionChange:u,children:[jsx(Tab,{title:c("channels.forms.base.title")},"base"),jsx(Tab,{title:c("channels.forms.wallets.title")},"wallets"),jsx(Tab,{title:c("channels.forms.socials.title")},"social")]}),m==="base"&&jsx($,{defaultValues:n,isSubmitting:s,onSubmit:o,submitLabel:r}),m==="wallets"&&jsx(Ye,{channel:e,wallets:a,isSubmitting:i,onSubmit:h}),m==="social"&&jsx(Ke,{channel:e})]})}function nt({type:e="base",className:t}){let{t:n}=useTranslation(),[s,o]=useState(e),{isMobile:r}=useScreen();return jsxs("div",{className:clsx("w-full flex flex-col gap-4",t),children:[jsxs(StyledTabs,{fullWidth:true,variant:"solid",size:r?"sm":void 0,selectedKey:s,onSelectionChange:o,children:[jsx(Tab,{title:n("channels.forms.base.title")},"base"),jsx(Tab,{title:n("channels.forms.wallets.title")},"wallets"),jsx(Tab,{title:n("channels.forms.socials.title")},"social")]}),s==="base"&&jsx(ge,{}),s==="wallets"&&jsx(ge,{}),s==="social"&&jsx(ge,{})]})}function ge(){return jsxs("div",{className:"flex flex-col gap-4",children:[jsx(Skeleton,{className:"w-full h-10 rounded-md"}),jsx(Skeleton,{className:"w-full h-10 rounded-md"}),jsx(Skeleton,{className:"w-full h-40 rounded-md"})]})}function st(e,t){let{t:n}=useTranslation(),{data:s,isLoading:o}=Be(e),{mutateAsync:r,isPending:a}=Qe(),i=useAuthCallback(async h=>{try{if(!t?.chain)throw new Error("Channel chain is not set");await r({channel_id:e,type:"wallet",sources:h.map(l=>({type:"wallet",value:l.address,alias:l.alias,configs:{chain:chainSlug(t.chain)}}))}),toast.success(n("channels.forms.wallets.update.success"));}catch(l){console.error("Update channel wallets error",l),toast.error(n("channels.forms.wallets.update.error"));}},[r,e,t?.chain]);return {isLoading:o,isSubmitting:a,wallets:s,submit:i}}function bl({id:e,type:t="base"}){let{t:n}=useTranslation(),{channel:s,defaultValues:o,isLoading:r,isSubmitting:a,submit:i}=_e(e),{wallets:h,isLoading:l,isSubmitting:c,submit:m}=st(e,s);return r||l||!s?jsx(nt,{type:t}):jsx(tt,{channel:s,type:t,baseFormDefaultValues:o,isSubmittingBaseForm:a,onSubmitBaseForm:i,baseFormSubmitLabel:n("channels.forms.base.update.submit"),wallets:h,isSubmittingWalletsForm:c,onSubmitWalletsForm:m})}function Y({channel:e}){let{t}=useTranslation(),n=useTickAge(new Date(e.updated_at));return jsx(HorizontalScrollContainer,{classNames:{leftArrow:"from-content1/60 to-transparent",rightArrow:"from-content1/60 to-transparent"},children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(StyledTooltip,{content:t("channels.info.walletCount"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(WalletIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:e.source_count||"-"})]})}),jsx(StyledTooltip,{content:t("channels.info.subscribeCount"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(PeopleIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:e.subscribe_count||"-"})]})}),jsx(StyledTooltip,{content:t("channels.info.updatedAt"),closeDelay:0,children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(TimerIcon,{width:16,height:16}),jsx("p",{className:"text-xs",children:formatAge(n)})]})}),e.twitter&&jsx(Link,{href:e.twitter,target:"_blank",className:"text-neutral",children:jsx(TwitterIcon,{width:16,height:16})}),e.telegram&&jsx(Link,{href:e.telegram,target:"_blank",className:"text-neutral",children:jsx(TelegramIcon,{width:16,height:16})}),e.discord&&jsx(Link,{href:e.discord,target:"_blank",className:"text-neutral",children:jsx(DiscordIcon,{width:16,height:16})})]})})}function it({channel:e,customActions:t}){let n=useMemo(()=>e.chain?chainIcon(e.chain):void 0,[e.chain]);return jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsxs("div",{className:"relative",children:[jsx(Avatar,{src:e.icon,alt:e.name,className:"w-18 h-18",radius:"md"}),n&&jsx(Avatar,{radius:"full",src:n,className:"w-5 h-5 absolute -bottom-1 -right-1 border border-border shadow-sm"})]})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 text-neutral",children:[jsxs("div",{className:"h-6 flex items-center gap-2",children:[jsx("p",{className:"flex-auto min-w-0 text-sm font-medium text-foreground truncate",children:e.name}),jsx("div",{className:"flex-none",children:t})]}),jsx(Y,{channel:e}),jsx("p",{className:"text-xs whitespace-pre-wrap line-clamp-1 h-4 overflow-hidden",children:e.description})]})]})}function Hl({channel:e,onEdit:t}){let{user:n}=useAuth(),s=useAuthCallback(()=>{t?.(e);},[e,t]);return n?.id!==e.owner_id?jsx(Fragment,{}):jsx(StyledButton,{className:"bg-transparent",isIconOnly:true,size:"sm",onPress:s,children:jsx(EditIcon,{width:16,height:16,className:"text-neutral"})})}function ne({channel:e}){let{t}=useTranslation();return jsx(HorizontalScrollContainer,{classNames:{leftArrow:"from-content1/60 to-transparent",rightArrow:"from-content1/60 to-transparent"},children:jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsx(StyledTooltip,{content:t("channels.stats.7dTxs.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dTxs.title")}),jsx("p",{className:"text-foreground font-semibold",children:"--"})]})}),jsx(StyledTooltip,{content:t("channels.stats.7dPnl.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dPnl.title")}),jsx("p",{className:"text-bullish font-semibold",children:"--"})]})}),jsx(StyledTooltip,{content:t("channels.stats.7dWr.hint"),closeDelay:0,children:jsxs("div",{className:"flex-none flex flex-col gap-1 items-center",children:[jsx("p",{className:"text-neutral font-medium",children:t("channels.stats.7dWr.title")}),jsx("p",{className:"text-bullish font-semibold",children:"--%"})]})})]})})}function sm({channel:e,onSubscribeSuccess:t,onUnsubscribeSuccess:n,onSubscribeError:s,onUnsubscribeError:o}){let{t:r}=useTranslation(),[a,i]=useState(e.is_subscribed);useEffect(()=>{i(e.is_subscribed);},[e.is_subscribed]);let{mutateAsync:h,isPending:l}=De(),{mutateAsync:c,isPending:m}=Me(),u=useAuthCallback(async()=>{try{a?(await c(e.id),i(!1),toast.success(r("channels.unsubscribe.success")),n?.(e)):(await h(e.id),i(!0),toast.success(r("channels.subscribe.success")),t?.(e));}catch(y){console.error("Subscribe / Unsubscribe channel error",y),a?(toast.error(r("channels.unsubscribe.error")),o?.(e,y)):(toast.error(r("channels.subscribe.error")),s?.(e,y));}},[r,a,e,h,c,t,n,s,o]);return jsx(StyledButton,{color:a?"default":"primary",size:"sm",radius:"lg",onPress:u,isLoading:l||m,variant:a?"bordered":"flat",className:clsx("gap-1",a&&"text-neutral"),startContent:a?!l&&!m?jsx(CheckIcon,{width:16,height:16}):void 0:!l&&!m?jsx(PlusIcon,{width:16,height:16}):void 0,children:r(a?"channels.unsubscribe.submit":"channels.subscribe.submit")})}function mt({channel:e,onSelect:t,headerActions:n,footerActions:s}){let o=useCallback(()=>{t?.(e);},[e,t]);return jsxs("div",{className:clsx("bg-content1 hover:bg-content2 border border-border rounded-lg w-full h-full p-2.5","flex flex-col gap-2.5",t&&"cursor-pointer"),onClick:o,children:[jsx(it,{channel:e,customActions:n}),jsxs("div",{className:"flex items-center gap-4",children:[jsx("div",{className:"flex-auto min-w-0",children:jsx(ne,{channel:e})}),jsx("div",{className:"flex-none",children:s})]})]})}function M({channels:e,onSelect:t,customHeaderActions:n,customFooterActions:s}){return jsx("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(o=>jsx(mt,{channel:o,onSelect:t,headerActions:n?.(o),footerActions:s?.(o)},o.id))})}function Q({count:e}){return jsx("div",{className:"w-full grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:e}).map((t,n)=>jsxs("div",{className:"bg-content1 hover:bg-content2 border border-border rounded-lg w-full h-35 p-2.5 flex flex-col gap-2.5",children:[jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsx(Skeleton,{className:"w-18 h-18 flex-none rounded-md"})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 justify-center text-neutral",children:[jsx(Skeleton,{className:"w-24 h-4 rounded-md"}),jsx(Skeleton,{className:"w-48 h-4 rounded-md"}),jsx(Skeleton,{className:"w-48 h-4 rounded-md"})]})]}),jsxs("div",{className:"w-full flex justify-between gap-4",children:[jsx(Skeleton,{className:"flex-auto min-w-0 h-6 rounded-md"}),jsx(Skeleton,{className:"w-24 h-6 rounded-md"})]})]},n))})}function V({message:e}){let{t}=useTranslation();return jsxs("div",{className:"pt-24 mx-auto",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral mx-auto"}),jsx("p",{className:"pt-2 text-sm text-neutral text-center",children:e||t("common.empty")})]})}var pt=()=>{let{status:e}=useAuth(),t=Ae(),{refetch:n}=t;return useEffect(()=>{e==="authenticated"&&n();},[e,n]),t};function ut({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{data:s,isLoading:o}=pt();return o?jsx(Q,{count:9}):!s||s.list.length===0?jsx(V,{}):jsx(M,{channels:s.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}function re({message:e}){let{t}=useTranslation(),{signIn:n}=useAuth();return jsxs("div",{className:"pt-24 flex flex-col items-center justify-center gap-2",children:[jsx("p",{className:"text-neutral text-sm",children:e||t("common.unauthenticated")}),jsx(StyledButton,{color:"primary",size:"sm",onPress:n,radius:"lg",children:t("common.signIn")})]})}function ft({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{status:s}=useAuth(),{data:o,isLoading:r}=j({},{enabled:s==="authenticated"});return s==="unauthenticated"?jsx(re,{}):s==="authenticating"||r?jsx(Q,{count:9}):!o||o.list.length===0?jsx(V,{}):jsx(M,{channels:o.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}var Ym=()=>j();function gt({onSelect:e,customHeaderActions:t,customFooterActions:n}){let{status:s}=useAuth(),{data:o,isLoading:r}=G({},{enabled:s==="authenticated"});return s==="unauthenticated"?jsx(re,{}):s==="authenticating"||r?jsx(Q,{count:9}):!o||o.list.length===0?jsx(V,{}):jsx(M,{channels:o.list,onSelect:e,customHeaderActions:t,customFooterActions:n})}var cc=()=>G();function yt({channel:e,headerActions:t,footerActions:n}){let s=useMemo(()=>e.chain?chainIcon(e.chain):void 0,[e.chain]);return jsxs("div",{className:clsx("bg-content1 border border-border rounded-lg w-full h-full p-2.5","flex flex-col gap-2.5"),children:[jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-none flex flex-col",children:jsxs("div",{className:"relative",children:[jsx(Avatar,{src:e.icon,alt:e.name,className:"w-18 h-18",radius:"md"}),s&&jsx(Avatar,{radius:"full",src:s,className:"w-5 h-5 absolute -bottom-1 -right-1 border border-border shadow-sm"})]})}),jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-2 text-neutral",children:[jsxs("div",{className:"h-6 flex items-center gap-2",children:[jsx("p",{className:"flex-auto min-w-0 text-sm font-medium text-foreground truncate",children:e.name}),jsx("div",{className:"flex-none",children:t})]}),jsx(Y,{channel:e})]})]}),jsxs("div",{className:"flex gap-4",children:[jsx("div",{className:"flex-auto min-w-0",children:jsx(ne,{channel:e})}),jsx("div",{className:"flex-none",children:n})]}),e.description&&jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]})}function Pe(){let{t:e}=useTranslation();return jsxs("div",{className:"w-ful bg-content1 border border-border rounded-lg p-2.5",children:[jsx(EmptyIcon,{width:28,height:28,className:"text-neutral mx-auto mt-20"}),jsx("p",{className:"pt-2 text-sm text-neutral text-center mb-20",children:e("common.empty")})]})}function wt(){let{t:e}=useTranslation();return jsxs("div",{className:"w-full",children:[jsx(EmptyIcon,{width:40,height:40,className:"mt-10 text-neutral mx-auto"}),jsx("p",{className:"text-sm text-neutral text-center mt-2",children:e("channels.detail.notfound")})]})}function Pt(){return jsxs("div",{className:"w-full space-y-6",children:[jsx(Skeleton,{className:"w-full h-35 rounded-md"}),jsx(Skeleton,{className:"w-full h-40 rounded-md"})]})}var It=e=>K(e);function Nt({id:e,customHeaderActions:t,customFooterActions:n}){let{t:s}=useTranslation(),{data:o,isLoading:r}=It(e);return r?jsx(Pt,{}):o?jsxs("div",{className:"space-y-6",children:[jsx(yt,{channel:o,headerActions:t?.(o),footerActions:n?.(o)}),jsxs("div",{className:"space-y-2.5",children:[jsx("h2",{className:"text-sm font-semibold",children:s("channels.detail.events.title")}),jsx(Pe,{})]})]}):jsx(wt,{})}function hd({onCreateChannel:e,onSelectChannel:t,customHeaderActions:n,customFooterActions:s}){let{t:o}=useTranslation(),{isMobile:r}=useScreen(),[a,i]=useState("trending");return jsxs("div",{className:"w-full max-w-7xl mx-auto py-2 px-2 sm:py-4 sm:px-4",children:[jsxs("div",{className:"flex items-center justify-between gap-2 w-full overflow-x-auto",children:[jsx(HorizontalScrollContainer,{className:"flex-auto min-w-0",children:jsxs(StyledTabs,{variant:"primaryPlain",radius:"lg",selectedKey:a,onSelectionChange:i,"aria-label":o("channels.list.title"),size:r?"sm":void 0,children:[jsx(Tab,{title:o("channels.trending.title"),"aria-label":o("channels.trending.title")},"trending"),jsx(Tab,{title:o("channels.my.title"),"aria-label":o("channels.my.title")},"my"),jsx(Tab,{title:o("channels.subscribed.title"),"aria-label":o("channels.subscribed.title")},"subscribed")]})}),jsx("div",{className:"flex-none flex items-center gap-2",children:e&&jsxs(Fragment,{children:[jsx(Button,{radius:"lg",color:"primary",size:"sm",onPress:e,className:"max-sm:hidden gap-1",startContent:jsx(PlusIcon,{width:18,height:18}),"aria-label":o("channels.create.title"),children:o("channels.create.title")}),jsx(Button,{isIconOnly:true,radius:"full",color:"primary",size:"sm",onPress:e,className:"sm:hidden w-7 min-w-7 h-7 min-h-7","aria-label":o("channels.create.title"),children:jsx(PlusIcon,{width:18,height:18})})]})})]}),jsxs("div",{className:"mt-4 w-full",children:[a==="trending"&&jsx(ut,{onSelect:t,customHeaderActions:n,customFooterActions:s}),a==="my"&&jsx(gt,{onSelect:t,customHeaderActions:n,customFooterActions:s}),a==="subscribed"&&jsx(ft,{onSelect:t,customHeaderActions:n,customFooterActions:s})]})]})}function bd({id:e,customHeaderActions:t,customFooterActions:n}){let{t:s}=useTranslation();return jsxs("div",{className:"w-full max-w-2xl mx-auto py-2 px-2 sm:py-4 sm:px-4 space-y-2 sm:space-y-4",children:[jsx("h1",{className:"text-sm sm:text-lg font-semibold",children:s("channels.detail.title")}),jsx(Nt,{id:e,customFooterActions:n,customHeaderActions:t})]})}function ke(e){return jsx("svg",{width:"8",height:"16",viewBox:"0 0 5 9",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:jsx("path",{d:"M5 5.72727L2.5 9L0 5.72727H5ZM2.5 0L5 3.27273H0L2.5 0Z",fill:"currentColor"})})}function Lt(e){return jsx("svg",{width:"24",height:"24",viewBox:"0 0 12 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:jsx("path",{d:"M6 0C2.6856 0 0 2.68698 0 6C0 9.3144 2.68698 12 6 12C9.3144 12 12 9.31302 12 6C12.0014 2.68698 9.3144 0 6 0ZM8.53878 6.2036L5.21191 8.88089C5.04155 9.01801 4.78947 8.89612 4.78947 8.67867V3.32271C4.78947 3.10526 5.04155 2.98338 5.21191 3.1205L8.53878 5.79917C8.66897 5.90305 8.66897 6.09972 8.53878 6.2036Z",fill:"currentColor"})})}function Mt({onFilterChange:e}){let[t,n]=useState("newest"),[s,o]=useState("1D"),[r,a]=useState("buy"),[i,h]=useState(""),[l,c]=useState("P1");return useEffect(()=>{e?.({sort:t,timeRange:s,tradeType:r,search:i,plan:l});},[t,s,r,i,l,e]),jsxs("div",{className:"flex items-center justify-between w-full",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(Button,{variant:"bordered",className:"flex items-center gap-1",onPress:()=>n("newest"),children:[jsx(ke,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Newest"})]}),jsxs(Button,{variant:"bordered",className:"flex items-center gap-1",onPress:()=>n("amount"),children:[jsx(ke,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Amount"})]}),jsxs(Tabs,{variant:"solid",size:"sm",selectedKey:s,onSelectionChange:m=>o(m),children:[jsx(Tab,{title:"1D"},"1D"),jsx(Tab,{title:"7D"},"7D"),jsx(Tab,{title:"30D"},"30D")]}),jsxs(ButtonGroup,{size:"sm",children:[jsx(Button,{variant:"flat",onPress:()=>a("buy"),children:jsx("span",{className:"text-primary font-semibold",children:"Buy"})}),jsx(Button,{variant:"flat",onPress:()=>a("sell"),children:jsx("span",{className:"text-danger font-semibold",children:"Sell"})})]})]}),jsx(Input,{placeholder:"Token symbol or address\u2026",variant:"faded",className:"max-w-80",value:i,onChange:m=>h(m.target.value)}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs(Button,{size:"sm",variant:"light",className:"flex items-center gap-1",children:[jsx(Lt,{className:"w-4 h-4"}),jsx("p",{className:"text-sm font-medium",children:"Listen"})]}),jsxs(Tabs,{variant:"bordered",size:"sm",selectedKey:l,onSelectionChange:m=>c(m),color:"primary",children:[jsx(Tab,{title:"P1"},"P1"),jsx(Tab,{title:"P2"},"P2"),jsx(Tab,{title:"P3"},"P3")]})]})]})}function Qt({trading:e,onBuy:t}){return jsxs(Table,{classNames:{wrapper:"bg-transparent p-0"},className:"text-default-800",children:[jsxs(TableHeader,{children:[jsx(TableColumn,{children:"Date"},"date"),jsx(TableColumn,{children:"Channel"},"channel"),jsx(TableColumn,{children:"Address"},"address"),jsx(TableColumn,{children:"Token"},"token"),jsx(TableColumn,{children:"$ MC"},"mc"),jsxs(TableColumn,{children:["Amount ",jsx("span",{className:"text-primary",children:"$"})]},"amount"),jsx(TableColumn,{children:"Actions"},"actions")]}),jsx(TableBody,{items:e,isLoading:false,children:n=>jsxs(TableRow,{children:[jsx(TableCell,{children:formatAge(Date.now()-n.date)}),jsx(TableCell,{children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(Image,{radius:"md",src:n.channel.imageUrl,alt:n.channel.name,width:20,height:20}),n.channel.name]})}),jsx(TableCell,{children:jsx("p",{className:clsx(n.type==="buy"?"text-primary":"text-secondary"),children:shortAddress(n.address)})}),jsx(TableCell,{children:jsxs("div",{className:"flex items-center gap-1",children:[jsx(Image,{radius:"md",src:n.token.image,alt:n.token.symbol,width:16,height:16})," ",jsxs("div",{className:"flex items-end gap-0.5",children:[jsx("p",{children:n.token.symbol}),jsx("p",{className:"text-xs text-default-500",children:shortAddress(n.token.address)})]})]})}),jsx(TableCell,{children:formatAmountUSD2(n.mc)}),jsx(TableCell,{children:jsxs("div",{className:"flex gap-1 items-center",children:[jsx(Image,{src:n.token.chainIcon,alt:n.token.symbol,width:16,height:16}),jsx("p",{className:clsx(n.type==="buy"?"text-primary":"text-secondary"),children:formatAmount(n.amount)})]})}),jsx(TableCell,{children:jsxs(Button,{radius:"full",className:clsx("text-white bg-[#B1FF3770]"),size:"sm",onPress:()=>t(n),children:["Buy 0.002 ",n.token.symbol]})})]},n.id)})]})}function qt({trading:e,onBuy:t}){return jsxs("div",{className:"flex flex-col gap-3",children:[jsx(Mt,{}),jsx(Qt,{trading:e,onBuy:t})]})}var Zt=[{id:"1",date:Date.now()-32*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"2",date:Date.now()-60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"3",date:Date.now()-780*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"4",date:Date.now()-3600*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"5",date:Date.now()-1.5*60*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"6",date:Date.now()-10800*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"7",date:Date.now()-720*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"8",date:Date.now()-1440*60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"9",date:Date.now()-7200*60*1e3,type:"buy",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579},{id:"10",date:Date.now()-14400*60*1e3,type:"sell",channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579}],Ot=[32*1e3,60*1e3,780*1e3,3600*1e3,1.5*60*60*1e3,10800*1e3,720*60*1e3,1440*60*1e3,7200*60*1e3,14400*60*1e3],Et=["buy","sell"];for(let e=11;e<=20;e++)Zt.push({id:`${e}`,date:Date.now()-Ot[(e-1)%Ot.length],type:Et[(e-1)%Et.length],channel:{id:"1",imageUrl:"https://pbs.twimg.com/profile_images/1821642506800353280/xIpx4wIO_normal.jpg",name:"Zoro - Channel 1",description:"Sol-Daily Update-Golden Dog Smart Money",createdAt:"8h",people:1109,volume:94,followers:105,createdBy:"Zoro",timeAgo:300,socials:{telegram:"https://t.me/Zoro",discord:"https://discord.com/Zoro"},dex:{fromToken:{name:"BNB",image:"https://assets.coingecko.com/coins/images/825/standard/bnb-icon2_2x.png?1696501970"},toToken:{name:"SOL",image:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},txs7d:{total:140,bullish:70,bearish:70},pnl7d:{total:21876},wr7d:{total:60.9}}},address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",token:{symbol:"PINK",image:"https://s1.chainstream.io/tokens/images/4ab7c44fa49cc29bda25878622e5c3f1.webp",address:"BwqpHv4s2wZoxf1ktVjFSfz8LkX4Wyjrf7QGrbPSDMqe",chainIcon:"https://assets.coingecko.com/coins/images/4128/standard/solana.png?1718769756"},mc:26900,amount:1.3579});var _t=()=>Zt;function Hd(){let e=_t();return jsx(qt,{trading:e,onBuy:n=>{console.log("buy",n);}})}function lp({client:e,children:t}){return jsx(H.Provider,{value:{client:e},children:t})}
|
|
3
3
|
export{$ as BaseFormUI,Y as ChannelAttributes,it as ChannelBaseInfo,yt as ChannelDetailUI,Nt as ChannelDetailWidget,Hl as ChannelEditButton,ne as ChannelStats,sm as ChannelSubscribeButton,H as ChannelsContext,bd as ChannelsDetailPage,V as ChannelsEmptyUI,hd as ChannelsHomePage,lp as ChannelsProvider,Q as ChannelsSkeletonUI,M as ChannelsUI,li as CreateChannelWidget,gt as MyChannelsWidget,Ke as SocialsFormUI,ft as SubscribedChannelsWidget,qt as TradingUI,Hd as TradingWidget,ut as TrendingChannelsWidget,tt as UpdateChannelFormUI,bl as UpdateChannelWidget,Ye as WalletsFormUI,$e as WalletsListUI,jt as channelEventsQueryKey,F as channelQueryKey,ce as channelSourcesQueryKey,nn as channelsListQueryKey,mn as createChannel,Yt as fetchChannel,Xt as fetchChannelEvents,an as fetchChannelSources,on as fetchChannelsList,un as fetchMyChannelsList,xn as fetchSubscribedChannelsList,pn as myChannelsListQueryKey,Ge as parseWalletsText,gn as subscribeChannel,bn as subscribedChannelsListQueryKey,Sn as unsubscribeChannel,Nn as updateChannel,Fn as updateChannelSources,It as useChannelDetail,$t as useChannelEventsQuery,K as useChannelQuery,Be as useChannelSourcesQuery,d as useChannelsClient,Fe as useChannelsContext,Ae as useChannelsListQuery,Le as useCreateChannelMutation,cc as useMyChannels,G as useMyChannelsListQuery,De as useSubscribeChannelMutation,Ym as useSubscribedChannels,j as useSubscribedChannelsListQuery,_t as useTrading,pt as useTrendingChannels,Me as useUnsubscribeChannelMutation,_e as useUpdateBaseForm,We as useUpdateChannelMutation,Qe as useUpdateChannelSourcesMutation,st as useUpdateWalletsForm,Ve as useUpload,Rt as version};//# sourceMappingURL=index.mjs.map
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|