import{j as t,D as h,t as D,r as u}from"./vendor-tanstack-BVzzyDEt.js";import{E as S,m as d,n as C,o as j,p as v,D as w,ba as r,bb as b,bc as N,U as _}from"./index-BJkJ93Lr.js";import{D as E}from"./index-Bgtl8EVd.js";import{D as k}from"./header-BAPAjM__.js";import"./vendor-react-Bce9NwRC.js";import"./vendor-radix-CTAic6HB.js";import"./vendor-recharts-Mwm2qLZp.js";import"./vendor-forms-BN3tpxM2.js";import"./vendor-date-2jFo9aCm.js";import"./use-quick-run-mT_ozfi2.js";import"./use-delete-confirmation-dialog-DDTCxOIv.js";import"./delete-confirmation-dialog-Baib9xiM.js";import"./index-DcdvPWsR.js";import"./cronstrue-qXVYKoA_.js";import"./index-HTfhyme4.js";const P=()=>t.jsxs(S,{children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(d,{id:"Workflow"}),t.jsx(d,{id:"MoreHorizontal"}),t.jsx(d,{id:"Rocket"})]}),t.jsx(C,{children:"Create a deployment to get started"}),t.jsx(j,{children:"Deployments elevate workflows from functions you call manually to API objects that can be remotely triggered."}),t.jsx(v,{children:t.jsx(w,{id:"deployments-guide"})})]}),A=e=>({page:e?.page??1,limit:e?.limit??10,sort:e?.sort??"NAME_ASC",deployments:{operator:"and_",flow_or_deployment_name:{like_:e?.flowOrDeploymentName??""},tags:{operator:"and_",all_:e?.tags??[]}}}),F=()=>{const e=r.useSearch(),o=r.useNavigate(),s=(e.page??1)-1,a=e.limit??10,n=u.useMemo(()=>({pageIndex:s,pageSize:a}),[s,a]),p=u.useCallback(i=>{o({to:".",search:l=>({...l,page:i.pageIndex+1,limit:i.pageSize}),replace:!0})},[o]);return[n,p]},O=()=>{const e=r.useSearch(),o=r.useNavigate(),s=a=>{o({to:".",search:n=>({...n,sort:a}),replace:!0})};return[e.sort,s]},M=()=>{const e=r.useSearch(),o=r.useNavigate(),s=u.useMemo(()=>[{id:"flowOrDeploymentName",value:e.flowOrDeploymentName},{id:"tags",value:e.tags}],[e.flowOrDeploymentName,e.tags]),a=u.useCallback(n=>{o({to:".",search:p=>{const i=n.find(m=>m.id==="flowOrDeploymentName")?.value,l=n.find(m=>m.id==="tags")?.value;return{...p,offset:0,flowOrDeploymentName:i,tags:l}},replace:!0})},[o]);return[s,a]};function X(){const e=r.useSearch(),[o,s]=F(),[a,n]=O(),[p,i]=M(),[{data:l},{data:m}]=h({queries:[b(),N(A(e))]}),g=m?.results??[],{data:y}=D(_({flows:{operator:"and_",id:{any_:[...new Set(g.map(c=>c.flow_id))]}},offset:0,sort:"NAME_ASC"})),f=g.map(c=>({...c,flow:y?.find(x=>x.id===c.flow_id)}));return t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(k,{}),l===0?t.jsx(P,{}):t.jsx(E,{deployments:f,currentDeploymentsCount:l,pageCount:m?.pages??0,pagination:o,sort:a,columnFilters:p,onPaginationChange:s,onSortChange:n,onColumnFiltersChange:i})]})}export{X as component};
//# sourceMappingURL=index-BGaIahWF.js.map
