import{j as t,r as H}from"./vendor-codemirror-B1SGo4xl.js";import{f as Et,J as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,av as Kt}from"./index-lgmWPQDG.js";import{a as B}from"./agent-DtywswSX.js";import{u as ct,q as K,b as pt}from"./unwrap-D5KlViZc.js";import{C,a as k}from"./card-CdN7vcLa.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-Bv_WioDg.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-CVrkiNvd.js";import{B as Q}from"./badge-Ca5YHtna.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-BeGS9sLt.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aJ as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b2 as _t,I as Jt,b3 as Yt,g as Zt,b4 as lt}from"./vendor-icons-BlY7QrxS.js";import"./index-5FEebgvX.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await B.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await B.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await B.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await B.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;nM+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],E=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),E.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(E,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=null?`${rt(i.read_bps)}`:c:n==="ioW"?i.write_bps!=null?`${rt(i.write_bps)}`:c:n==="swap"?l?.usage_percent!=null?`${l.usage_percent.toFixed(1)}%`:c:n==="fd"&&p?.usage_pct!=null?`${p.usage_pct.toFixed(1)}%`:c:c}function y({title:e,value:a,icon:i,data:l,color:p,unit:n,domain:c,aggType:d}){const m=l.map(s=>({...s,value:s[d]}));return t.jsx(C,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:26:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:27:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:28:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:11",className:"flex items-center gap-1.5",children:[i,t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:e})]})}),t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:31:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:32:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:a}),n&&t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:33:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:n})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:35:9",className:"h-48",children:m.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:37:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:39:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:40:15",data:m,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:41:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:42:19",id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:43:21",offset:"5%",stopColor:p,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:44:21",offset:"95%",stopColor:p,stopOpacity:0})]})}),t.jsx(ut,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:47:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:48:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:49:17",hide:!0,domain:c[1]==="auto"?[0,s=>s*1.1]:c}),t.jsx(vt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:50:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:s=>[`${s.toFixed(2)} ${n}`,e.replace(/\(.+\)/,"")],labelFormatter:s=>`时间: ${s}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:53:17",type:"monotone",dataKey:"value",stroke:p,strokeWidth:1.5,fill:`url(#grad-${e})`}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:54:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,m.length-Math.min(20,m.length))})]})})})]})})}function ce({title:e,currentRx:a,currentTx:i,rxData:l,txData:p,aggType:n,unit:c}){const d=l.map((x,N)=>({time:x.time,timestamp:x.timestamp,rx:x[n]??0,tx:p[N]?.[n]??0})),m=`grad-rx-${e.replace(/\s/g,"")}`,s=`grad-tx-${e.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:32:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:33:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:34:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:35:11",className:"flex items-center gap-1.5",children:[t.jsx(st,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:36:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:37:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:e})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:39:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-blue-400 mr-1 align-middle"}),"接收 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:108",className:"text-blue-300",children:a})]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-emerald-400 mr-1 align-middle"}),"发送 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:111",className:"text-emerald-300",children:i})]})]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:44:9",className:"h-56",children:d.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:46:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:48:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:49:15",data:d,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:50:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:51:19",id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:52:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:53:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:55:19",id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:56:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:57:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(ut,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:60:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:61:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:62:17",hide:!0,domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:63:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(x,N)=>[`${x.toFixed(2)} ${c}`,N==="rx"?"接收":"发送"],labelFormatter:x=>`时间: ${x}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:66:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${m})`,name:"rx"}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:67:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${s})`,name:"tx"}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:68:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,d.length-Math.min(20,d.length))})]})})})]})})}function ie({selectedHost:e}){const a=Et(),i=Mt(),{data:l=[],refetch:p}=se(e),[n,c]=H.useState(!1),[d,m]=H.useState(null),[s,x]=H.useState(St()),N=()=>{m(null),x(St(e)),c(!0)},D=o=>{m(o),x({name:String(o.name||""),hostname:String(o.hostname||""),probe_type:String(o.probe_type||"http_get"),http_url:String(o.http_url||""),http_method:String(o.http_method||"GET"),http_expect_code:Number(o.http_expect_code)||200,http_expect_body:String(o.http_expect_body||""),tcp_host:String(o.tcp_host||""),tcp_port:Number(o.tcp_port)||3306,exec_command:String(o.exec_command||""),timeout:Number(o.timeout)||10,interval:Number(o.interval)||60,description:String(o.description||"")}),c(!0)},M=async()=>{if(!(!s.name||!s.hostname))try{d?await B.updateHealthProbe(d.id,s):await B.createHealthProbe(s),c(!1),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)})}catch{qt.error("保存失败")}},F=async o=>{await a({title:"删除探针",description:`确定删除探针「${o.name}」?`,confirmText:"删除",variant:"destructive"})&&(await B.deleteHealthProbe(o.id),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)}))};return t.jsxs(t.Fragment,{children:[t.jsxs(q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:88:7",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:89:9",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:90:11",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:91:11",className:"flex gap-2",children:[t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:92:13",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:()=>p(),children:[t.jsx(Ft,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:93:15",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:95:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:N,children:[t.jsx(Wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:96:15",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),l.length===0?t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:101:11",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:102:13",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:107:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:l.map(o=>t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:109:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${o.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:110:17",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:111:19",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:112:21",className:"flex items-center gap-2",children:[o.last_status==="up"?t.jsx(zt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:113:49",className:"w-4 h-4 text-emerald-400"}):o.last_status==="down"?t.jsx(ht,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:114:51",className:"w-4 h-4 text-red-400"}):t.jsx(ot,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:115:24",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:116:23",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:String(o.name)}),t.jsx(Q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:117:23",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:o.probe_type==="http_get"?"HTTP":o.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:121:21",className:"flex gap-1",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:122:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>D(o),children:t.jsx(Ut,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:123:25",className:"w-3 h-3"})}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:125:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:()=>F(o),children:t.jsx(Vt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:126:25",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:130:19",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[o.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:132:23",className:"truncate",children:["URL: ",String(o.http_url)]}),o.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:135:23",children:[String(o.tcp_host),":",String(o.tcp_port)]}),o.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:138:23",className:"truncate font-mono",children:String(o.exec_command)}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:140:21",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:23",children:["状态: ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:33",className:o.last_status==="up"?"text-emerald-400":o.last_status==="down"?"text-red-400":"text-slate-400",children:o.last_status?String(o.last_status).toUpperCase():"未检测"})]}),Number(o.last_latency_ms)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:144:57",children:["延迟: ",String(o.last_latency_ms),"ms"]}),Number(o.fail_count)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:145:52",className:"text-red-400",children:["连续失败: ",String(o.fail_count),"次"]}),o.last_checked_at&&t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:146:45",className:"text-[10px]",children:new Date(String(o.last_checked_at)).toLocaleString("zh-CN")})]})]})]})},String(o.id)))})]}),t.jsx(wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:156:7",open:n,onOpenChange:c,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:157:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:158:11",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:159:13",className:"text-[var(--dg-text-primary)]",children:d?"编辑探针":"添加探针"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:162:13",className:"text-[var(--dg-text-secondary)]",children:d?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:166:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:167:13",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:169:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.name,onChange:o=>x({...s,name:o.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:171:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:172:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:173:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.hostname,onChange:o=>x({...s,hostname:o.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:175:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:176:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:177:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.probe_type,onChange:o=>x({...s,probe_type:o.target.value}),children:[t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:178:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:179:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:180:17",value:"exec_command",children:"Exec Command"})]})]}),s.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:17",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:187:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_url,onChange:o=>x({...s,http_url:o.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:188:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:190:21",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_code,onChange:o=>x({...s,http_expect_code:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:192:21",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_body,onChange:o=>x({...s,http_expect_body:o.target.value})})]})]})]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:198:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:200:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_host,onChange:o=>x({...s,tcp_host:o.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:202:19",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_port,onChange:o=>x({...s,tcp_port:Number(o.target.value)})})]})]}),s.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:15",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:208:17",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs font-mono text-[var(--dg-text-primary)]",value:s.exec_command,onChange:o=>x({...s,exec_command:o.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:211:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:213:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.timeout,onChange:o=>x({...s,timeout:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:215:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.interval,onChange:o=>x({...s,interval:Number(o.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:219:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.description,onChange:o=>x({...s,description:o.target.value})})]})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:221:11",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:222:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>c(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:223:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:M,disabled:!s.name||!s.hostname,children:d?"保存":"创建"})]})]})})]})}function ne(e){const a=Number(e);return Number.isInteger(a)&&a>0&&a<=65535}function de(e){return e.split(",").map(a=>parseInt(a.trim(),10)).filter(a=>ne(a))}function le({open:e,onOpenChange:a,portPolicyMode:i,onModeChange:l,portWhitelist:p,onWhitelistChange:n,onSave:c,saving:d}){return t.jsx(wt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:30:5",open:e,onOpenChange:a,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:31:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:32:9",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:33:11",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:34:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:36:9",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:37:11",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:38:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:39:13",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:40:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="whitelist"?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:46:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="blacklist"?"bg-amber-500/20 border-amber-500 text-amber-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:53:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:i==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:60:11",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:61:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:62:20",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),i==="whitelist"&&t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:63:50",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:65:13",className:`w-full h-20 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 py-1.5 text-xs font-mono resize-none ${i==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:p.join(","),onChange:m=>{if(i==="whitelist")return;const s=m.target.value;n(de(s))},placeholder:i==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:i==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:78:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",p.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:83:11",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:84:13",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:85:35",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:89:9",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:90:11",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>a(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:91:11",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:c,disabled:d,children:d?"保存中…":"保存策略"})]})]})})}function xe({selectedHost:e,serverInfo:a,latest:i,heartbeatInfo:l,portInfoCount:p}){const n=i?.disk_info?v(i.disk_info):null,c=n?Array.isArray(n)?n:n.partitions||[]:[];return t.jsxs(q,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:22:5",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:23:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:24:9",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:25:11",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",a?.hostname||e],["IP 地址",a?.ip||"—"],["操作系统",a?.os||"—"],["内核版本",a?.kernel||"—"],["CPU 核心数",a?.cpu_cores||"—"],["总内存",a?.mem_total?`${a.mem_total.toFixed(0)} GB`:"—"],["已用内存",a?.mem_used?`${a.mem_used.toFixed(1)} GB`:"—"],["运行时长",a?.uptime?`${Math.floor(a.uptime/86400)}天 ${Math.floor(a.uptime%86400/3600)}时`:"—"],["Agent 版本",l?.version||a?.agent_version||"—"],["Agent 序列号",l?.report_seq!=null?String(l.report_seq):"—"],["监听端口数",p>0?`${p}`:"—"],["Agent RSS",l?.self_rss_mb?`${l.self_rss_mb.toFixed(1)} MB`:"—"]].map(([d,m])=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:40:15",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:41:17",className:"text-[var(--dg-text-muted)]",children:[d,":"]}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:42:17",className:"text-[var(--dg-text-primary)] font-mono",children:m})]},d))})})}),i&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:50:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:51:11",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:52:13",className:"flex items-center gap-2 mb-2",children:[t.jsx($t,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:53:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:54:15",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:56:13",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:20",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:78",className:"text-sm font-bold text-slate-200",children:i.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:20",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:78",className:"text-sm font-bold text-slate-200",children:i.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:20",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:79",className:"text-sm font-bold text-slate-200",children:i.load15??"--"})]})]})]})}),c.length>0&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:66:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:67:11",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:13",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-2 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:108",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:69:13",className:"space-y-1.5",children:c.map((d,m)=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:71:17",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:72:19",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:d.mount||d.mountpoint||d.device||`disk${m}`}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:73:19",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:74:21",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(d.usage_percent||d.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:76:19",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(d.used_gb??0).toFixed(1),"/",(d.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:77:19",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(d.usage_percent??d.used_percent??0).toFixed(1),"%"]})]},m))})]})})]})}function He(){const e=Mt(),[a]=Kt(),i=a.get("host")||"",[l,p]=H.useState(i),[n,c]=H.useState("basic"),[d,m]=H.useState(1),[s,x]=H.useState("avg"),[N,D]=H.useState("whitelist"),[M,F]=H.useState([]),[o,E]=H.useState(!1),[X,z]=H.useState(!1),{data:$=[],isLoading:J}=te(),{data:w=[],isLoading:g}=ee(l,d),{data:h,refetch:it}=oe(l);H.useEffect(()=>{h&&(D(h.port_filter_mode),F(h.port_whitelist))},[h]),H.useEffect(()=>{if($.length>0&&!l){const r=i?$.find(T=>T.hostname===i):null;p(String(r?.hostname||$[0]?.hostname||""))}},[$,l,i]);const O=async()=>{if(l){z(!0);try{await B.savePortPolicy(l,{port_filter_mode:N,port_whitelist:M}),E(!1),e.invalidateQueries({queryKey:K.hostMonitor.portPolicy(l)})}catch{}finally{z(!1)}}},_=xt.find(r=>r.hours===d)||xt[0],U=J||g,P=$.find(r=>r.hostname===l)||null,b=H.useMemo(()=>{const r=P||{};return w.length===0?r:{...r,...w[w.length-1]}},[P,w]),u=H.useMemo(()=>ae(w,_),[w,_]),f=v(b?.net_info),Y=Array.isArray(b?.port_info)?b.port_info:Array.isArray(v(b?.port_info))?v(b?.port_info):[],nt=v(b?.disk_io_info),At=v(b?.swap_info),dt=Array.isArray(v(b?.process_top_info))?v(b?.process_top_info):[],I=v(b?.fd_info),S=v(b?.cs_info),It=v(b?.heartbeat_info),A=(r,T="--")=>re(b,f,nt,At,I,r,T);return U&&!w.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:98:12",className:"flex items-center justify-center h-64",children:t.jsx(Qt,{"code-path":"src/pages/HostMonitor.tsx:98:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:102:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:103:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:104:9",className:"flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:105:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:106:11",value:l,onValueChange:p,children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:107:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:108:15",placeholder:"选择主机..."})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:110:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:$.map(r=>t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:112:17",value:r.hostname,children:r.hostname},r.hostname))})]}),P&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:117:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[String(P.os||""),P.cpu_cores?` | ${P.cpu_cores} 核`:"",P.mem_total?` | ${P.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:122:9",className:"flex items-center gap-2",children:[t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:123:11",value:s,onValueChange:r=>x(r),children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:124:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:125:15"})}),t.jsxs(Ht,{"code-path":"src/pages/HostMonitor.tsx:127:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:128:15",value:"avg",children:"平均值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:129:15",value:"max",children:"最大值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:130:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:133:11",className:"flex items-center gap-1",children:xt.map(r=>t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:135:15",variant:d===r.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>m(r.hours),children:r.label},r.hours))})]})]}),t.jsxs(Ot,{"code-path":"src/pages/HostMonitor.tsx:142:7",value:n,onValueChange:c,children:[t.jsx(Rt,{"code-path":"src/pages/HostMonitor.tsx:143:9",className:"h-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] gap-0 overflow-x-auto",children:[{id:"basic",label:"基础监控",icon:t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:145:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:146:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:147:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:148:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:149:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(Jt,{"code-path":"src/pages/HostMonitor.tsx:150:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:151:57",className:"w-3 h-3"})}].map(r=>t.jsxs(Gt,{"code-path":"src/pages/HostMonitor.tsx:153:13",value:r.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[r.icon,r.label]},r.id))}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:159:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:160:11",title:"CPU 使用率(%)",value:A("cpu"),icon:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:160:79",className:"h-4 w-4 text-blue-400"}),data:u.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:162:11",title:"CPU IO等待(%)",value:b?.cpu_iowait!=null?`${b.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:162:145",className:"h-4 w-4 text-orange-400"}),data:u.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:164:11",title:"内存使用率(%)",value:A("mem"),icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:164:77",className:"h-4 w-4 text-emerald-400"}),data:u.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:166:11",title:"可用内存(GB)",value:b?.mem_available!=null?`${b.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:166:149",className:"h-4 w-4 text-emerald-400"}),data:u.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:168:11",title:"Swap 使用率(%)",value:A("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:168:81",className:"h-4 w-4 text-red-400"}),data:u.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:170:11",title:"系统负载(1m)",value:A("load1"),icon:t.jsx($t,{"code-path":"src/pages/HostMonitor.tsx:170:79",className:"h-4 w-4 text-purple-400"}),data:u.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:s})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:174:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:175:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:176:13",title:"磁盘使用率(%)",value:A("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:176:80",className:"h-4 w-4 text-orange-400"}),data:u.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:178:13",title:"Inode 使用率(%)",value:(()=>{const r=Array.isArray(v(b?.disk_info))?v(b?.disk_info):[],T=r.find(R=>R.mount==="/")||r[0];return T?.inode_usage_pct!=null?`${T.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:182:25",className:"h-4 w-4 text-purple-400"}),data:u.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:184:13",title:"磁盘读取(KB/s)",value:A("ioR"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:184:81",className:"h-4 w-4 text-blue-400"}),data:u.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:186:13",title:"磁盘写入(KB/s)",value:A("ioW"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:186:81",className:"h-4 w-4 text-emerald-400"}),data:u.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:188:13",title:"磁盘IO繁忙度(%)",value:nt?.util!=null?`${nt.util.toFixed(1)}%`:"--",icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:188:130",className:"h-4 w-4 text-red-400"}),data:u.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:s})]})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:193:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:194:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:195:13",title:"TCP EST",value:A("tcp"),icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:195:78",className:"h-4 w-4 text-purple-400"}),data:u.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:197:13",title:"TCP TIME_WAIT",value:A("tw"),icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:197:83",className:"h-4 w-4 text-amber-400"}),data:u.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:199:13",title:"TCP CLOSE_WAIT",value:f?.tcp_close_wait!=null?String(f.tcp_close_wait):"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:199:139",className:"h-4 w-4 text-red-400"}),data:u.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:201:13",title:"TCP 总连接",value:f?String((f.tcp_established||0)+(f.tcp_time_wait||0)+(f.tcp_close_wait||0)):"--",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:201:169",className:"h-4 w-4 text-cyan-400"}),data:u.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:s})]}),t.jsx(ce,{"code-path":"src/pages/HostMonitor.tsx:204:11",title:"网卡带宽吞吐",currentRx:f?.net_rx_bps!=null?rt(f.net_rx_bps):"--",currentTx:f?.net_tx_bps!=null?rt(f.net_tx_bps):"--",rxData:u.rx,txData:u.tx,aggType:s,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:211:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:212:13",title:"网卡接收错误",value:f?.net_rx_errors!=null?String(f.net_rx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:212:129",className:"h-4 w-4 text-red-400"}),data:u.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:214:13",title:"网卡发送错误",value:f?.net_tx_errors!=null?String(f.net_tx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:214:129",className:"h-4 w-4 text-orange-400"}),data:u.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:s})]})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:219:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:220:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:221:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:222:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:223:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",Y.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:224:17",className:"ml-auto flex items-center gap-2",children:[N==="blacklist"&&M.length>0&&t.jsxs(Q,{"code-path":"src/pages/HostMonitor.tsx:226:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",M.join(",")]}),N==="whitelist"&&t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:231:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:235:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{it(),E(!0)},children:"策略配置"})]})]}),Y.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:242:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无端口数据"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:246:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:247:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:248:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:249:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:250:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:251:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:252:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:253:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:256:21",children:Y.map((r,T)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:258:25",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:259:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:r.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:260:27",className:"py-1.5",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:261:29",variant:"outline",className:"text-[10px] font-mono",children:r.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:265:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:r.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:266:27",className:"py-1.5 text-right",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:267:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},T))})]})})]})})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:281:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:282:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:283:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:284:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:285:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",dt.length]}),dt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:288:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"Agent v2.0+ 支持,等待数据上报…"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:292:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:293:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:294:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:295:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:296:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:297:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:298:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:299:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:300:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:303:21",children:dt.map((r,T)=>{const R=r.cmdline||r.name||"?",Z=r.cpu_pct!=null?Number(r.cpu_pct):null,tt=r.mem_pct!=null?Number(r.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:309:27",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:310:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:311:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:312:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:R,children:R}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:315:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async Bt=>{Bt.stopPropagation();try{await navigator.clipboard.writeText(R)}catch{const G=document.createElement("textarea");G.value=R,G.style.position="fixed",G.style.opacity="0",document.body.appendChild(G),G.select(),document.execCommand("copy"),document.body.removeChild(G)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:330:35",className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{"code-path":"src/pages/HostMonitor.tsx:331:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:332:37",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:337:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:338:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:339:31",className:tt!=null&&tt>50?"text-rose-400":"text-cyan-400",children:tt!=null?tt.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:343:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:344:31",className:Z!=null&&Z>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:Z!=null?Z.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:348:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.fd_count??"--"})]},T)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:360:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:361:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:362:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:363:19",className:"h-4 w-4 text-violet-400"}),"FD 文件句柄"]}),I?.allocated!=null?t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:367:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:368:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:369:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:370:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:372:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:373:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:374:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.max===-1?"无限制":I.max?.toLocaleString()||"—"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:376:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:377:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:378:25",className:`font-mono font-semibold ${I.usage_pct>80?"text-rose-400":"text-violet-400"}`,children:I.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:"—"})]})]}),u.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:384:23",className:"h-[120px]",children:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:385:25",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/HostMonitor.tsx:386:27",data:u.fd,children:[t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:387:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(bt,{"code-path":"src/pages/HostMonitor.tsx:388:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:389:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:390:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:391:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:392:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:393:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:394:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:397:29",type:"monotone",dataKey:s,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:404:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:409:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:410:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Ft,{"code-path":"src/pages/HostMonitor.tsx:412:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),S?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:415:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:416:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:417:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:418:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:419:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(S.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:420:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:422:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:424:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:425:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:426:25",className:"text-lg font-bold font-mono text-amber-400",children:[(S.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:427:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:429:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:432:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:433:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:434:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:435:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:437:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:S.ctx_per_sec+S.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:440:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(S.ctx_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:442:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(S.irq_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:450:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsx(xe,{"code-path":"src/pages/HostMonitor.tsx:457:9",selectedHost:l,serverInfo:P,latest:b,heartbeatInfo:It,portInfoCount:Y.length}),t.jsx(ie,{"code-path":"src/pages/HostMonitor.tsx:465:9",selectedHost:l})]}),t.jsx(le,{"code-path":"src/pages/HostMonitor.tsx:468:7",open:o,onOpenChange:E,portPolicyMode:N,onModeChange:D,portWhitelist:M,onWhitelistChange:F,onSave:O,saving:X})]})}export{He as HostMonitor};