import{u as k,e as L,f as P,r as v,j as e,c as B}from"./index-_B-Zy6Ft.js";import{b as _}from"./constants-C8myDR0I.js";import{C as R}from"./collection-tab-Dv8h91Wb.js";import{a as z,b as A}from"./use-connection-CfqFbPzC.js";import{B as y}from"./button-B3OIs7uK.js";import{E as F}from"./empty-state-xyVUwDeF.js";import{C as M}from"./collection-header-D_CCDQAU.js";import{a as O,b as H}from"./use-binding-DqImux8H.js";import{i as T}from"./Loading01-CI_v2_GN.js";import"./generate-id-Dyweu44Y.js";import"./collection-display-button-D8FTMMt_.js";import"./dropdown-menu-FHEiqgML.js";import"./Grid01-CJ22jDcg.js";import"./ArrowUp-CGxVyOWd.js";import"./Check-BHH38JjB.js";import"./List-DiVbAsqI.js";import"./tooltip-CcGnpUG9.js";import"./view-mode-toggle-_E7g25j5.js";import"./collection-search-CGm1OZ8P.js";import"./SearchMd-D3oTiHfv.js";import"./input-BmJPL4BI.js";import"./card-D5OId4P6.js";import"./Copy01-EsrXj_WU.js";import"./DotsVertical-BEVZytd9.js";import"./Edit01-Ksah6atT.js";import"./use-list-state-HlmN6FmS.js";import"./use-mobile-nqgE3yx-.js";import"./Trash01-C3d1WEuz.js";import"./collection-table-wrapper-DyF74Zt4.js";import"./empty-state-C7cYTaGj.js";import"./Inbox01-D-6ikPt3.js";import"./avatar-Ll4kuTGx.js";import"./useQuery-CC8ASXOP.js";import"./pin-to-sidebar-button-ifJVs08O.js";import"./use-organization-settings-Dfijbjzn.js";import"./useMutation-EHy22ute.js";import"./use-collections-DGoeBGCb.js";import"./constants-D2PsHWWd.js";import"./alert-dialog-DWa3INCj.js";import"./Plus-CQ_pQZI1.js";import"./layout-CvrVUDjF.js";import"./ArrowLeft-CRql-3o8.js";import"./binder-BU8oZbeE.js";function V({title:i,description:t,wellKnownMcp:o,imageSrc:n,onConnected:s}){const r=z(),{org:{slug:m}}=k(),{data:h}=L.useSession(),p=P(),[a,w]=v.useState(!1),l=async()=>{if(!(!o||!h?.user?.id)){w(!0);try{const c=await r.create.mutateAsync(o);s?.(c.id),p({to:"/$org/mcps/$connectionId",params:{org:m,connectionId:c.id}})}finally{w(!1)}}},j=()=>{p({to:"/$org/mcps",params:{org:m},search:{action:"create"}})};return e.jsx(F,{image:n?e.jsx("img",{src:n,alt:i,width:336,height:320,className:"max-w-full h-auto"}):null,title:i,description:t,actions:e.jsxs(e.Fragment,{children:[e.jsxs(y,{variant:"outline",onClick:l,disabled:a||!o,children:[o?.icon&&e.jsx("img",{src:o.icon,alt:"",className:"size-4"}),a?"Installing...":`Install ${o?.title||"MCP"}`]}),e.jsx(y,{variant:"outline",onClick:j,children:"Custom Connection"})]})})}function q(i){const t=B.c(28),{bindingName:o,collectionName:n,title:s,emptyState:r,wellKnownMcp:m}=i,{org:h}=k(),p=A();let a;t[0]!==p||t[1]!==o?(a={connections:p,binding:o},t[0]=p,t[1]=o,t[2]=a):a=t[2];const l=O(a)[0],j=H(l);let c;if(t[3]!==n||t[4]!==j){let C;t[6]!==n?(C=$=>$.name.toLowerCase()===n.toLowerCase(),t[6]=n,t[7]=C):C=t[7],c=j.find(C),t[3]=n,t[4]=j,t[5]=c}else c=t[5];const S=c,[E,W]=v.useState(null),N=l&&S&&(l.id||E);let d;t[8]!==s?(d=e.jsx(M,{title:s}),t[8]=s,t[9]=d):d=t[9];let b;t[10]===Symbol.for("react.memo_cache_sentinel")?(b=e.jsx(T,{size:32,className:"animate-spin text-muted-foreground mb-4"}),t[10]=b):b=t[10];let f;t[11]!==s?(f=s.toLowerCase(),t[11]=s,t[12]=f):f=t[12];let u;t[13]!==f?(u=e.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[b,e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Loading ",f,"..."]})]}),t[13]=f,t[14]=u):u=t[14];let g;t[15]!==S||t[16]!==l||t[17]!==r||t[18]!==h||t[19]!==N||t[20]!==m?(g=N?e.jsx(R,{connectionId:l.id,org:h.slug,activeCollection:S}):e.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:e.jsx(V,{title:r.title,description:r.description,wellKnownMcp:m,imageSrc:r.imageSrc,onConnected:C=>{W(C)}})}),t[15]=S,t[16]=l,t[17]=r,t[18]=h,t[19]=N,t[20]=m,t[21]=g):g=t[21];let x;t[22]!==u||t[23]!==g?(x=e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(v.Suspense,{fallback:u,children:g})}),t[22]=u,t[23]=g,t[24]=x):x=t[24];let I;return t[25]!==d||t[26]!==x?(I=e.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[d,x]}),t[25]=d,t[26]=x,t[27]=I):I=t[27],I}function _t(){const i=B.c(1);let t;return i[0]===Symbol.for("react.memo_cache_sentinel")?(t=e.jsx(q,{bindingName:"WORKFLOW",collectionName:"workflow",title:"Workflows",emptyState:{title:"Create Workflows",description:"Install MCP Studio to create and manage automated workflows with multiple steps and integrations."},wellKnownMcp:_()}),i[0]=t):t=i[0],t}export{_t as default};
