import{j as s}from"./vendor-motion-k_x_E260.js";import{a as c,L as o,C as i,B as x,s as m,P as t,R as g,f as p,c as j,G as r}from"./index-Buswmged.js";import{M as u}from"./vendor-icons-BDy0XSiX.js";import"./vendor-react-BaJ9Uc06.js";function v(){const l=c();if(l._loading)return s.jsx(o,{label:"Loading nodes…"});const n=l.heartbeats,d=l.local_gpus;return s.jsxs("div",{className:"space-y-6",children:[s.jsx("h2",{className:"text-lg font-bold",children:"Nodes"}),n.length===0&&s.jsx(i,{children:s.jsx("p",{className:"text-sm text-gray-500",children:"No hosts reporting. Waiting for heartbeats..."})}),n.map(e=>s.jsxs(i,{children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(u,{size:16,className:"text-gray-400"}),s.jsx("span",{className:"font-bold text-sm",children:e.host}),s.jsx(x,{color:m(e.status),children:e.status})]}),s.jsxs("span",{className:"text-[10px] text-gray-500",children:["heartbeat ",Math.round(e.heartbeat_age_sec),"s ago"]})]}),s.jsxs("div",{className:"flex gap-6 mb-3",children:[s.jsx(t,{label:"PID",value:e.pid}),s.jsx(t,{label:"Free GPUs",value:e.free_gpus.join(", ")||"none"}),e.disk_free_gb!=null&&s.jsx(t,{label:"Disk Free",value:`${e.disk_free_gb.toFixed(0)} GB`}),e.os&&s.jsx(t,{label:"OS",value:e.os})]}),e.active.length>0&&s.jsx(g,{title:`Active Runs (${e.active.length})`,defaultOpen:!0,children:s.jsx("div",{className:"space-y-1",children:e.active.map(a=>s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-gray-300",children:p(a.idea_id)}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("span",{className:"text-gray-500",children:["GPU ",a.gpu]}),s.jsx("span",{className:"text-gray-500",children:j(a.elapsed_min)})]})]},`${a.idea_id}-${a.gpu}`))})}),e.gpu_info&&e.gpu_info.length>0&&s.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 sm:grid-cols-4",children:e.gpu_info.map(a=>s.jsx(r,{gpu:a},a.index))})]},e.host)),d.length>0&&s.jsxs(i,{children:[s.jsx("h3",{className:"mb-3 text-sm font-bold",children:"Local GPUs (this host)"}),s.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:d.map(e=>s.jsx(r,{gpu:e},e.index))})]})]})}export{v as default};
