import{c as g,u as C,n as W,K as x,t as _,j as i,B as I}from"./index-oE_2MbI2.js";import{a as w,u as L}from"./constants-uA8MqaDa.js";import{C as k}from"./collection-tab-BrrpLl8S.js";import{E as O}from"./collection-search-Dpb-MiLc.js";import{u as S}from"./useMutation-DdGCKlze.js";import{P as u}from"./index-nULh3Jbz.js";import{B as b,a as h,b as P,c as y}from"./breadcrumb-Bq33GatY.js";import{e as T}from"./Dataflow03-w5UTvR4Y.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-Coo-60zD.js";import"./dropdown-menu-CrI0GFHN.js";import"./Check-_ISbUca5.js";import"./ChevronRight-BvDz0sNw.js";import"./ArrowDown-Day-BlQM.js";import"./ArrowUp-Bc1LEzvX.js";import"./Grid01-Bh1lnye-.js";import"./List-BxL8IDCE.js";import"./tooltip-CfJyDfiQ.js";import"./index-C61JJs1z.js";import"./badge-DHsu3lW8.js";import"./card-BnXBsAYW.js";import"./integration-icon-DDvj2Mai.js";import"./Container-JazsSIaU.js";import"./Copy01-Bc3vF4AL.js";import"./DotsVertical-CaacL-UQ.js";import"./Edit01-VBYk6Owq.js";import"./Eye-ARGTvinm.js";import"./Trash01-CNXXoz2j.js";import"./collection-table-wrapper-ukh1uFNi.js";import"./table-BFE5Uyhx.js";import"./empty-state-CoKcoPlD.js";import"./Inbox01-aA-lE1QX.js";import"./user-B5rWHRLV.js";import"./avatar-D_GwJ74E.js";import"./useQuery-B63y3s7J.js";import"./use-list-state-BGESvuo1.js";import"./use-view-mode-DQb4yKWd.js";import"./use-mobile-Bu4jzm8F.js";import"./constants-BhYNqKbk.js";import"./alert-dialog-4uvZEEFx.js";import"./use-collections-BV71cmYk.js";import"./Plus-DwHqymxX.js";import"./layout-BfzXWUCI.js";import"./Loading01-C5CNb3s-.js";import"./SearchMd-BrEq0pjT.js";import"./input-BC5yyfKN.js";import"./localstorage-keys-CKFbpBwk.js";function B(){const e=g.c(12),{org:t,project:r}=C(),a=W();let c;e[0]!==t.id?(c={connectionId:w,orgId:t.id},e[0]=t.id,e[1]=c):c=e[1];const l=L(c);let o;e[2]!==l||e[3]!==r?(o=async d=>{const m=r.enabledPlugins??[];if(m.includes(d))return;const p=[...m,d],j=await l.callTool({name:"PROJECT_UPDATE",arguments:{projectId:r.id,enabledPlugins:p}});return j.structuredContent??j},e[2]=l,e[3]=r,e[4]=o):o=e[4];let n;e[5]!==t.id||e[6]!==r||e[7]!==a?(n=()=>{a.invalidateQueries({queryKey:x.project(t.id,r.slug)}),a.invalidateQueries({queryKey:x.projects(t.id)})},e[5]=t.id,e[6]=r,e[7]=a,e[8]=n):n=e[8];let s;return e[9]!==o||e[10]!==n?(s={mutationFn:o,onSuccess:n,onError:K},e[9]=o,e[10]=n,e[11]=s):s=e[11],S(s)}function K(e){_.error("Failed to enable plugin: "+(e instanceof Error?e.message:"Unknown error"))}function N(e){const t=g.c(12),{pluginId:r,title:a,description:c,icon:l}=e,o=B();let n;t[0]!==o||t[1]!==r?(n=async()=>{try{await o.mutateAsync(r),_.success("Plugin enabled!")}catch{}},t[0]=o,t[1]=r,t[2]=n):n=t[2];const s=n,f=l??null,d=o.isPending?"Enabling…":"Enable plugin";let m;t[3]!==o.isPending||t[4]!==s||t[5]!==d?(m=i.jsx(I,{onClick:s,disabled:o.isPending,children:d}),t[3]=o.isPending,t[4]=s,t[5]=d,t[6]=m):m=t[6];let p;return t[7]!==c||t[8]!==f||t[9]!==m||t[10]!==a?(p=i.jsx(O,{image:f,title:a,description:c,actions:m}),t[7]=c,t[8]=f,t[9]=m,t[10]=a,t[11]=p):p=t[11],p}const E="workflows",F={name:"WORKFLOW",displayName:"Workflow",hasCreateTool:!0,hasUpdateTool:!0,hasDeleteTool:!0};function Se(){const e=g.c(5),{project:t,org:r}=C();if(!(t.enabledPlugins??[]).includes(E)){let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(u.Header,{children:i.jsx(u.Header.Left,{children:i.jsx(b,{children:i.jsx(h,{children:i.jsx(P,{children:i.jsx(y,{children:"Workflows"})})})})})}),e[0]=n):n=e[0];let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs(u,{children:[n,i.jsx(u.Content,{children:i.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:i.jsx(N,{pluginId:E,title:"Enable Workflows",description:"Automate multi-step processes by enabling the Workflows plugin. Once enabled you can create, run, and monitor workflows.",icon:i.jsx("div",{className:"bg-muted p-4 rounded-full",children:i.jsx(T,{className:"size-8 text-muted-foreground"})})})})})]}),e[1]=s):s=e[1],s}let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(u.Header,{children:i.jsx(u.Header.Left,{children:i.jsx(b,{children:i.jsx(h,{children:i.jsx(P,{children:i.jsx(y,{children:"Workflows"})})})})})}),e[2]=l):l=e[2];let o;return e[3]!==r.slug?(o=i.jsxs(u,{children:[l,i.jsx(u.Content,{children:i.jsx(k,{connectionId:w,org:r.slug,activeCollection:F})})]}),e[3]=r.slug,e[4]=o):o=e[4],o}export{Se as default};
