import{r as n,j as e,f as p}from"./index-DBKNDbnR.js";import{S as f}from"./StatusPill-pCkI_rtZ.js";import{m as h}from"./proxy-DMNsmhjP.js";function g({className:x=""}){const[t,u]=n.useState([]),[c,m]=n.useState(!0),[i,o]=n.useState("");n.useEffect(()=>{let s=!1;const r=async()=>{try{const a=await p("/ui/modules");if(s)return;u(Array.isArray(a.modules)?a.modules:[]),o("")}catch(a){if(s)return;o(a instanceof Error?a.message:"Module feed unavailable")}finally{s||m(!1)}};r();const l=window.setInterval(r,15e3);return()=>{s=!0,window.clearInterval(l)}},[]);const d=n.useMemo(()=>{const s=t.length,r=t.filter(l=>l.status==="active"||l.status==="running").length;return{total:s,active:r}},[t]);return e.jsx(h.section,{className:`hud-panel rounded-2xl p-4 ${x}`,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6,delay:.15},children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"font-display text-base text-neon-cyan",children:"Nexus Modules"}),e.jsxs("div",{className:"text-xs uppercase tracking-[0.3em] text-neon-cyan/60",children:[d.active,"/",d.total||"?"," up"]})]}),c&&e.jsx("p",{className:"text-xs text-neon-cyan/70",children:"Loading modules…"}),!!i&&e.jsx("p",{className:"text-xs text-rose-300",children:i}),e.jsxs("div",{className:"space-y-2",children:[t.map(s=>e.jsxs("div",{className:"rounded-xl border border-neon-cyan/15 bg-bg-800/70 p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm text-white",children:s.label}),e.jsx(f,{label:s.status,status:s.status})]}),s.description&&e.jsx("p",{className:"mt-1 text-xs text-slate-300",children:s.description})]},s.id)),!c&&!t.length&&!i&&e.jsx("p",{className:"text-xs text-slate-400",children:"No module data."})]})]})})}export{g as NexusModules};
