import{j as e}from"./vendor-query-B2UbickB.js";import{u as x}from"./topics-DIziCjqg.js";import{u as m}from"./useFilterParams-x-Dg0Vgz.js";import{D as g}from"./DataTable-D9yuBv0w.js";import{S as u}from"./StickyPagination-BWhFSr2d.js";import{F as d,b}from"./FilterBar-Ck4K4rzu.js";import{P as f}from"./PageHeader-CR6TpJG_.js";import{L as y}from"./ListToolbar-4lObXT3_.js";import{d as h}from"./index-BZu5zewH.js";import{R as j}from"./vendor-icons-CrrAvF2g.js";import{c as v}from"./vendor-react-CXumBFUA.js";import"./EmptyState-BcsfPq9T.js";const k={task:"bg-blue-400/15 text-blue-400",workflow:"bg-accent/15 text-accent",escalation:"bg-amber-400/15 text-amber-400",activity:"bg-cyan-400/15 text-cyan-400",knowledge:"bg-violet-400/15 text-violet-400",agent:"bg-emerald-400/15 text-emerald-400",app:"bg-rose-400/15 text-rose-400",milestone:"bg-violet-400/15 text-violet-400"},N=[{value:"task",label:"Task"},{value:"workflow",label:"Workflow"},{value:"escalation",label:"Escalation"},{value:"activity",label:"Activity"},{value:"knowledge",label:"Knowledge"},{value:"agent",label:"Agent"},{value:"app",label:"App"},{value:"milestone",label:"Milestone"}];function w({category:t}){const a=k[t]??"bg-zinc-400/15 text-zinc-400";return e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-[10px] font-medium ${a}`,children:t})}const P=[{key:"topic",label:"Topic",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(j,{className:"w-3 h-3 shrink-0 text-text-quaternary",strokeWidth:1.5}),e.jsx("span",{className:"text-xs font-mono text-text-primary truncate",children:t.topic})]})},{key:"category",label:"Category",render:t=>e.jsx(w,{category:t.category}),className:"w-28"},{key:"description",label:"Description",render:t=>t.description?e.jsx("span",{className:"text-[11px] text-text-secondary truncate block max-w-xs",children:t.description}):e.jsx("span",{className:"text-text-quaternary",children:"—"})},{key:"source",label:"Source",render:t=>e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary",children:t.source}),className:"w-24"},{key:"subscriber_count",label:"Subscribers",render:t=>{const a=t.subscriber_count??0;return a?e.jsx("span",{className:"inline-flex items-center justify-center min-w-[20px] px-1.5 py-0.5 rounded-full text-[10px] font-medium bg-accent/15 text-accent",children:a}):e.jsx("span",{className:"text-text-quaternary",children:"—"})},className:"w-24 text-center"},{key:"last_seen_at",label:"Last Seen",render:t=>t.last_seen_at?e.jsx("span",{className:"whitespace-nowrap",children:e.jsx(h,{date:t.last_seen_at})}):e.jsx("span",{className:"text-text-quaternary",children:"—"}),className:"w-28"}];function D(){const t=v(),{filters:a,setFilter:n,pagination:s}=m({filters:{category:""}}),{data:o,isLoading:l,refetch:c,isFetching:p}=x({category:a.category||void 0,limit:s.pageSize,offset:s.offset}),i=(o==null?void 0:o.total)??0;return e.jsxs("div",{children:[e.jsx(f,{title:"Topic Catalog",docsHash:"#docs:topics.md"}),e.jsx(d,{actions:e.jsx(y,{onRefresh:()=>c(),isFetching:p,apiPath:`/topics?limit=${s.pageSize}&offset=${s.offset}${a.category?`&category=${a.category}`:""}`}),children:e.jsx(b,{label:"Category",value:a.category,onChange:r=>n("category",r),options:N})}),e.jsx(g,{columns:P,data:(o==null?void 0:o.topics)??[],keyFn:r=>r.topic,onRowClick:r=>t(`/topics/${encodeURIComponent(r.topic)}`),isLoading:l,emptyMessage:"No topics registered yet"}),e.jsx(u,{page:s.page,totalPages:s.totalPages(i),onPageChange:s.setPage,total:i,pageSize:s.pageSize,onPageSizeChange:s.setPageSize})]})}export{D as TopicsPage};
//# sourceMappingURL=TopicsPage-DLyRlo0A.js.map
