import{j as e}from"./@radix-DP6vWzyx.js";import{S as p}from"./refresh-BVu22P_C.js";import{c as d}from"./index-Bpmj40BI.js";import{a as x}from"./@tanstack-BUCbhJyH.js";import{ac as h,y as f,av as u,z as n,f as g,G as j,S as l}from"./index-QQb7wQEC.js";import{C as c}from"./CopyButton-C745BrKi.js";import{D as y}from"./DisplayDate-BeXgUG_C.js";import{I as b}from"./InlineAvatar-jEgodSgX.js";import{C as v}from"./ComponentBadge-DUiEYJHu.js";import{C}from"./ComponentFallbackDialog-BFoH5K4V.js";import{s as m}from"./url-D5le3J4q.js";import{c as N}from"./@react-router-BMhZulnd.js";import{S as P,P as F}from"./SearchField-DfUiGFVd.js";import"./@reactflow-8U9qNlMR.js";import"./copy-CaSMXwiU.js";import"./ComponentIcon-CAIoUis2.js";import"./layout-DCSYN7-C.js";import"./rocket-CONEmRmB.js";import"./CodeSnippet-CqybNv0k.js";import"./Infobox-BwisKifi.js";import"./dots-horizontal-DK5Duzx4.js";import"./chevron-right-double-DoD8iXWM.js";import"./index-BVJ8n2-j.js";function S(){return[{id:"name",header:"Component",accessorKey:"name",cell:({row:a})=>{var r,o;const t=a.original.id,s=a.original.name;return e.jsxs("div",{className:"group/copybutton flex items-center gap-2",children:[e.jsx("img",{width:32,height:32,src:m(((r=a.original.body)==null?void 0:r.logo_url)||""),alt:"Flavor Icon"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(C,{name:s,type:((o=a.original.body)==null?void 0:o.type)||"orchestrator",children:e.jsx("button",{children:e.jsx("h2",{className:"text-text-md font-semibold",children:s})})}),e.jsx(c,{copyText:s})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("p",{className:"text-text-xs text-theme-text-secondary",children:t.split("-")[0]}),e.jsx(c,{copyText:t})]})]})]})}},{id:"type",header:"Component Type",accessorFn:a=>{var t;return(t=a.body)==null?void 0:t.type},cell:({row:a})=>{var s;const t=((s=a.original.body)==null?void 0:s.type)||"orchestrator";return e.jsx(v,{type:t,children:h(t)})}},{id:"flavor",header:"Flavor",accessorFn:a=>{var t;return(t=a.body)==null?void 0:t.flavor},cell:({row:a})=>{var s,r;const t=(s=a.original.body)==null?void 0:s.flavor;return e.jsxs(f,{rounded:!1,className:"w-fit gap-1 text-theme-text-primary",color:"grey",emphasis:"minimal",children:[e.jsx("img",{width:20,height:20,src:m(((r=a.original.body)==null?void 0:r.logo_url)||""),alt:"Flavor Icon of Component"}),e.jsx("p",{children:t})]})}},{id:"author",header:"Author",accessorFn:a=>{var t,s;return(s=(t=a.body)==null?void 0:t.user)==null?void 0:s.name},cell:({row:a})=>{var s;const t=(s=a.original.body)==null?void 0:s.user;return t?e.jsx(b,{username:u(t)}):null}},{id:"created",header:"Created at",accessorFn:a=>{var t;return(t=a.body)==null?void 0:t.created},cell:({row:a})=>{var t;return e.jsx("p",{className:"text-text-sm text-theme-text-secondary",children:e.jsx(y,{dateString:((t=a.original.body)==null?void 0:t.created)||""})})}}]}const i=1,T=n.object({page:n.coerce.number().min(i).optional().default(i).catch(i),name:n.string().optional(),operator:n.enum(["and","or"]).optional()});function w(){const[a]=N(),{page:t,name:s,operator:r}=T.parse({page:a.get("page")||void 0,name:a.get("name")||void 0});return{page:t,name:s,logical_operator:r}}function D(){const a=w(),t=x({...d.componentList({...a,sort_by:"desc:updated"}),throwOnError:!0}),s=S();if(t.isError)return null;const{data:r,refetch:o}=t;return e.jsx("section",{children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-y-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(P,{searchParams:a})}),e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs(g,{intent:"primary",emphasis:"subtle",size:"md",onClick:()=>o(),children:[e.jsx(p,{className:"h-5 w-5 fill-theme-text-brand"}),"Refresh"]})})]}),e.jsxs("div",{className:"flex flex-col items-center gap-5",children:[e.jsx("div",{className:"w-full",children:r?e.jsx(j,{columns:s,data:r.items}):e.jsx(l,{className:"h-[500px] w-full"})}),r?r.total_pages>1&&e.jsx(F,{searchParams:a,paginate:r}):e.jsx(l,{className:"h-[36px] w-[300px]"})]})]})})}function $(){return e.jsx(D,{})}export{$ as default};
