import{j as e,I as N,r as u,z as E}from"./vendor-tanstack-BpuysabX.js";import{E as h,t as d,v as x,w as j,x as v,D as k,bl as r,bm as F,bn as P,bo as O,aj as I,q as Q}from"./index-CREafGO4.js";import{D as _}from"./index-BrFctngX.js";import{D as z}from"./header-CcU71fLt.js";import"./vendor-radix-DIu41Ss_.js";import"./vendor-recharts-C2XeLr4O.js";import"./vendor-forms-Buh7U8Ay.js";import"./vendor-date-C1t37jsh.js";import"./use-quick-run-D8uL0_lf.js";import"./use-delete-confirmation-dialog-BgQibraR.js";import"./data-table-BX7QQ1sx.js";import"./delete-confirmation-dialog-DxI68qN2.js";import"./index-B4IVsJnG.js";import"./cronstrue-B5bn720s.js";import"./use-is-overflowing-Cq93g4co.js";import"./index-fMpmRfhu.js";import"./tags-input-Bd-BicQ9.js";import"./dropdown-menu-DZExFL3b.js";const A=()=>e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{id:"Workflow"}),e.jsx(d,{id:"MoreHorizontal"}),e.jsx(d,{id:"Rocket"})]}),e.jsx(x,{children:"Create a deployment to get started"}),e.jsx(j,{children:"Deployments elevate workflows from functions you call manually to API objects that can be remotely triggered."}),e.jsx(v,{children:e.jsx(k,{id:"deployments-guide"})})]}),M=({onClearFilters:t})=>e.jsxs(h,{children:[e.jsx(d,{id:"Search"}),e.jsx(x,{children:"No deployments match your filters"}),e.jsx(j,{children:"Try adjusting your search or tag filters."}),e.jsx(v,{children:e.jsx(Q,{variant:"outline",onClick:t,children:"Clear filters"})})]}),R=()=>{const t=r.useSearch(),o=r.useNavigate(),s=(t.page??1)-1,a=t.limit??10,n=u.useMemo(()=>({pageIndex:s,pageSize:a}),[s,a]),c=u.useCallback(i=>{o({to:".",search:m=>({...m,page:i.pageIndex+1,limit:i.pageSize}),replace:!0})},[o]);return[n,c]},T=()=>{const t=r.useSearch(),o=r.useNavigate(),s=a=>{o({to:".",search:n=>({...n,sort:a}),replace:!0})};return[t.sort,s]},q=()=>{const t=r.useSearch(),o=r.useNavigate(),s=u.useMemo(()=>[{id:"flowOrDeploymentName",value:t.flowOrDeploymentName},{id:"tags",value:t.tags}],[t.flowOrDeploymentName,t.tags]),a=u.useCallback(n=>{o({to:".",search:c=>{const i=n.find(p=>p.id==="flowOrDeploymentName")?.value,m=n.find(p=>p.id==="tags")?.value;return{...c,offset:0,flowOrDeploymentName:i,tags:m}},replace:!0})},[o]);return[s,a]},ne=function(){const o=r.useSearch(),s=r.useNavigate(),[a,n]=R(),[c,i]=T(),[m,p]=q(),[{data:y},{data:g}]=N({queries:[F(),P(O(o))]}),f=g?.results??[],C=g?.count??0,D=u.useCallback(()=>{s({to:".",search:l=>({...l,page:1,flowOrDeploymentName:void 0,tags:void 0}),replace:!0})},[s]),{data:S}=E(I({flows:{operator:"and_",id:{any_:[...new Set(f.map(l=>l.flow_id))]}},offset:0,sort:"NAME_ASC"})),w=f.map(l=>({...l,flow:S?.find(b=>b.id===l.flow_id)}));return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(z,{}),y===0?e.jsx(A,{}):C===0?e.jsx(M,{onClearFilters:D}):e.jsx(_,{deployments:w,currentDeploymentsCount:y,pageCount:g?.pages??0,pagination:a,sort:c,columnFilters:m,onPaginationChange:n,onSortChange:i,onColumnFiltersChange:p})]})};export{ne as component};
//# sourceMappingURL=index-Dy2Sfw_J.js.map
