import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{O as t,k as n}from"./vendor-markdown-DngssFHR.js";import{c as r,l as i}from"./vendor-react-Cts2Wj-s.js";import{L as a,M as o,N as s,Q as c,at as l,b as u,d,f,i as p,l as m,nt as h,p as g,pt as _,s as v,u as y,x as b}from"./vendor-mui-Ckcy4Lfd.js";import"./vendor-md-editor-DC6xr_29.js";import{ft as x,st as S}from"./vendor-mui-icons-606Bohdn.js";import{_ as C,f as w,i as T,p as E}from"./ui-BLXHSX1T.js";import{r as D}from"./api-DOzDCdFb.js";var O=e(n(),1),k=t(),A={docs:`primary`,code:`success`,knowledge:`warning`,tasks:`neutral`,skills:`primary`,files:`neutral`,context:`neutral`,"cross-graph":`error`};function j(){let{projectId:e}=i(),t=r(),{palette:n}=_(),[j,M]=(0,O.useState)([]),[N,P]=(0,O.useState)(!0),[F,I]=(0,O.useState)(``),[L,R]=(0,O.useState)(`all`);(0,O.useEffect)(()=>{e&&(P(!0),D(e).then(M).finally(()=>P(!1)))},[e]);let z=(0,O.useMemo)(()=>{let e=new Set(j.map(e=>e.category));return[`all`,...Array.from(e).sort()]},[j]),B=(0,O.useMemo)(()=>j.filter(e=>!(L!==`all`&&e.category!==L||F&&!e.name.toLowerCase().includes(F.toLowerCase())&&!e.description.toLowerCase().includes(F.toLowerCase()))),[j,F,L]),V=e=>{let t=e.inputSchema?.properties;return t?Object.keys(t).length:0};return N?(0,k.jsx)(c,{sx:{display:`flex`,justifyContent:`center`,py:8},children:(0,k.jsx)(l,{})}):(0,k.jsxs)(c,{children:[(0,k.jsx)(E,{breadcrumbs:[{label:`Tools`}]}),(0,k.jsxs)(w,{children:[(0,k.jsx)(p,{size:`small`,placeholder:`Search tools...`,value:F,onChange:e=>I(e.target.value),slotProps:{input:{startAdornment:(0,k.jsx)(s,{position:`start`,children:(0,k.jsx)(x,{fontSize:`small`})})}},sx:{minWidth:240}}),(0,k.jsxs)(a,{size:`small`,sx:{minWidth:140},children:[(0,k.jsx)(o,{children:`Category`}),(0,k.jsx)(u,{value:L,label:`Category`,onChange:e=>R(e.target.value),children:z.map(e=>(0,k.jsx)(b,{value:e,children:e===`all`?`All`:e},e))})]}),(0,k.jsxs)(h,{variant:`body2`,sx:{color:n.custom.textMuted,ml:`auto`},children:[B.length,` tool`,B.length===1?``:`s`]})]}),B.length===0?(0,k.jsx)(T,{icon:(0,k.jsx)(S,{}),title:`No tools found`,description:F||L!==`all`?`Try adjusting your filters`:`No MCP tools available for this project`}):(0,k.jsx)(y,{children:(0,k.jsxs)(g,{size:`small`,children:[(0,k.jsx)(m,{children:(0,k.jsxs)(v,{children:[(0,k.jsx)(d,{children:`Name`}),(0,k.jsx)(d,{children:`Category`}),(0,k.jsx)(d,{children:`Description`}),(0,k.jsx)(d,{align:`center`,children:`Params`})]})}),(0,k.jsx)(f,{children:B.map(r=>(0,k.jsxs)(v,{hover:!0,sx:{cursor:`pointer`},onClick:()=>t(`/${e}/tools/${r.name}`),children:[(0,k.jsx)(d,{children:(0,k.jsx)(h,{variant:`body2`,fontWeight:600,sx:{fontFamily:`monospace`},children:r.name})}),(0,k.jsx)(d,{children:(0,k.jsx)(C,{label:r.category,color:A[r.category]||`neutral`})}),(0,k.jsx)(d,{children:(0,k.jsx)(h,{variant:`body2`,sx:{color:n.custom.textMuted,maxWidth:500,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r.description})}),(0,k.jsx)(d,{align:`center`,children:(0,k.jsx)(h,{variant:`body2`,children:V(r)})})]},r.name))})]})})]})}export{j as default};