import{j as t,E as h,t as D,r as u}from"./vendor-tanstack-DE4ALVGD.js";import{E as S,t as d,v as C,w as v,x as w,D as j,bf as r,bg as N,bh as _,af as b}from"./index-CNL5pSma.js";import{D as E}from"./index-DtYWHQKy.js";import{D as k}from"./header-BddV4oks.js";import"./vendor-react-HBv6Kpyp.js";import"./vendor-radix-K8EF6rBE.js";import"./vendor-recharts-B3wzJa9e.js";import"./vendor-forms-BvpM0AtX.js";import"./vendor-date-Bck8LDfw.js";import"./use-quick-run-CVHAP31y.js";import"./use-delete-confirmation-dialog-mtiBAiyE.js";import"./data-table-DDT7Ownu.js";import"./table-CyGcvvjD.js";import"./delete-confirmation-dialog-Blb6Fypx.js";import"./index-DpZOgCYZ.js";import"./cronstrue-Dgg2IuMf.js";import"./use-is-overflowing-CSPqjSAE.js";import"./index-D4OtcoMT.js";import"./tags-input-CZLIJjbu.js";import"./dropdown-menu-D34zumpn.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(v,{children:"Deployments elevate workflows from functions you call manually to API objects that can be remotely triggered."}),t.jsx(w,{children:t.jsx(j,{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 te(){const e=r.useSearch(),[o,s]=F(),[a,n]=O(),[p,i]=M(),[{data:l},{data:m}]=h({queries:[N(),_(A(e))]}),g=m?.results??[],{data:y}=D(b({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{te as component};
//# sourceMappingURL=index-BtEbjFql.js.map
