import{i as os,aG as gs,r as i,j as t,L as ms,S as Y,B as A,aH as us,N as dt,I as bs,p as Ms,C as at,A as Wt,P as Hs,D as Kt,a as qt,b as Ut,c as Vt,d as Xt,e as Jt}from"./index-Dmami9WE.js";import{a as G}from"./agent-B3ElXCx8.js";import{C,a as S}from"./card-CIfC-8Rh.js";import{S as Qt,a as Yt,b as Zt,c as ts,d as rt}from"./select-DUbxjT0z.js";import{T as js,a as vs,b as fs,c as z}from"./tabs-lV44z_UR.js";import{B as Z}from"./badge-3UzCvU7L.js";import{H as W}from"./hard-drive-DmC04Y5r.js";import{D as mt}from"./disc-BPxL4arn.js";import{C as ut}from"./circle-x-BBQeW1R3.js";import{R as Mt,C as Ht,X as jt,Y as vt,T as ft,q as as}from"./generateCategoricalChart-ZqCvxO-S.js";import{A as Nt,a as it}from"./AreaChart-CrvX3B0s.js";import{R as ss}from"./refresh-cw-CTBERyFc.js";import{P as Ns}from"./plus-O65gX7Qz.js";import{S as _s}from"./square-pen-B3dPIBrm.js";import{T as ys}from"./trash-2-DWVnIU6o.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const ws=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],ks=os("heart-pulse",ws);const Cs=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],es=os("list",Cs),bt=[{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}];function u(r,T,O){if(!r||r.length===0)return[];const F=Math.max(1,Math.ceil(r.length/O)),d=[];for(let j=0;jnt+K,0)/y.length,f=Math.max(...y),R=Math.min(...y),n=w[Math.floor(w.length/2)]||0;d.push({time:new Date(n*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:n,avg:Number(v.toFixed(2)),max:Number(f.toFixed(2)),min:Number(R.toFixed(2)),count:y.length})}return d.slice(-O)}function M(r){if(!r)return{};if(typeof r=="object")return r;try{return JSON.parse(r)}catch{return{}}}function ct(r){return r>=1024*1024*1024?`${(r/1024/1024/1024).toFixed(1)} GB/s`:r>=1024*1024?`${(r/1024/1024).toFixed(1)} MB/s`:r>=1024?`${(r/1024).toFixed(1)} KB/s`:`${r.toFixed(1)} B/s`}function Us(){const[r]=gs(),T=r.get("host")||"",[O,F]=i.useState([]),[d,j]=i.useState(T),[y,w]=i.useState(!0),[P,v]=i.useState("basic"),[f,R]=i.useState(1),[n,nt]=i.useState("avg"),[K,_t]=i.useState([]),[o,yt]=i.useState(null),[b,rs]=i.useState(null),[wt,tt]=i.useState([]),[cs,q]=i.useState(!1),[U,kt]=i.useState(null),[a,N]=i.useState({name:"",hostname:"",probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""}),V=i.useCallback(()=>{d&&G.getHealthProbes({hostname:d}).then(s=>{Array.isArray(s)?tt(s):s?.list?tt(s.list):tt([])}).catch(()=>tt([]))},[d]),[k,xt]=i.useState("whitelist"),[X,Ct]=i.useState([]),[ds,st]=i.useState(!1),[St,Tt]=i.useState(!1),pt=i.useCallback(()=>{d&&G.getPortPolicy(d).then(s=>{s?.data&&(xt(s.data.port_filter_mode||"blacklist"),Ct(s.data.port_whitelist||[]))}).catch(()=>{})},[d]);i.useEffect(()=>{pt()},[pt]);const is=async()=>{if(d){Tt(!0);try{await G.savePortPolicy(d,{port_filter_mode:k,port_whitelist:X}),st(!1)}catch{}finally{Tt(!1)}}};i.useEffect(()=>{V()},[V]);const h=bt.find(s=>s.hours===f)||bt[0];i.useEffect(()=>{G.getLatest().then(s=>{const e=Array.isArray(s)?s:s?.data||s?.list||[];if(F(e),e.length>0&&!d){const l=T?e.find(E=>E.hostname===T):null;j(l?.hostname||e[0]?.hostname||"")}const c=e.find(l=>l.hostname===(d||T));c&&(yt(c),rs(c))}).catch(()=>{}).finally(()=>w(!1))},[d]),i.useEffect(()=>{d&&G.getHistory(d,f).then(s=>{const e=Array.isArray(s)?s:s?.data||s?.list||[];if(_t(e),e.length>0){const c=e[e.length-1];yt(l=>({...l,...c}))}}).catch(()=>_t([])).finally(()=>w(!1))},[d,f]);const g=i.useMemo(()=>{const s=[],e=[],c=[],l=[],E=[],et=[],B=[],$t=[],At=[],Ft=[],It=[],Dt=[],Et=[],Bt=[],Ot=[],Gt=[],Rt=[],zt=[],Lt=[],ht=[],m=[];for(const x of K){const ns=x.report_time?new Date(x.report_time).getTime()/1e3:x.created_at?new Date(x.created_at).getTime()/1e3:0;m.push(ns),s.push(x.cpu_usage||0),Bt.push(x.cpu_iowait||0),e.push(x.mem_usage||0),Ot.push(x.mem_available||0),c.push(x.load1||0),l.push(x.disk_usage||0);const ot=M(x.disk_info);if(Array.isArray(ot)&&ot.length>0){const ls=ot.find(hs=>hs.mount==="/")||ot[0];ht.push(ls?.inode_usage_pct||0)}else ht.push(0);const $=M(x.net_info);E.push($.tcp_established||0),et.push($.tcp_time_wait||0),B.push($.tcp_close_wait||0),Rt.push(($.tcp_established||0)+($.tcp_time_wait||0)+($.tcp_close_wait||0)),$t.push($.net_rx_bps||0),At.push($.net_tx_bps||0),zt.push($.net_rx_errors||0),Lt.push($.net_tx_errors||0);const gt=M(x.disk_io_info);Ft.push(gt.read_bps||0),It.push(gt.write_bps||0),Gt.push(gt.util||0);const xs=M(x.swap_info);Dt.push(xs?.usage_percent||0);const ps=M(x.fd_info);Et.push(ps?.usage_pct||0)}return{cpu:u(s,m,h.buckets),mem:u(e,m,h.buckets),load1:u(c,m,h.buckets),disk:u(l,m,h.buckets),tcpEst:u(E,m,h.buckets),tcpTW:u(et,m,h.buckets),tcpCW:u(B,m,h.buckets),rx:u($t.map(x=>x/1024),m,h.buckets),tx:u(At.map(x=>x/1024),m,h.buckets),ioRead:u(Ft.map(x=>x/1024),m,h.buckets),ioWrite:u(It.map(x=>x/1024),m,h.buckets),swap:u(Dt,m,h.buckets),fd:u(Et,m,h.buckets),iowait:u(Bt,m,h.buckets),memAvail:u(Ot,m,h.buckets),ioUtil:u(Gt,m,h.buckets),connTotal:u(Rt,m,h.buckets),rxErr:u(zt,m,h.buckets),txErr:u(Lt,m,h.buckets),inode:u(ht,m,h.buckets)}},[K,h]),p=M(o?.net_info),J=Array.isArray(o?.port_info)?o.port_info:Array.isArray(M(o?.port_info))?M(o?.port_info):[],L=M(o?.disk_io_info),Pt=M(o?.swap_info),lt=Array.isArray(M(o?.process_top_info))?M(o?.process_top_info):[],I=M(o?.fd_info),_=M(o?.cs_info),Q=M(o?.heartbeat_info),D=(s,e="--")=>o?s==="cpu"?o.cpu_usage!=null?`${o.cpu_usage.toFixed(1)}%`:e:s==="mem"?o.mem_usage!=null?`${o.mem_usage.toFixed(1)}%`:e:s==="disk"?o.disk_usage!=null?`${o.disk_usage.toFixed(1)}%`:e:s==="load1"?o.load1!=null?String(o.load1):e:s==="tcp"?p.tcp_established!=null?String(p.tcp_established):e:s==="tw"?p.tcp_time_wait!=null?String(p.tcp_time_wait):e:s==="rx"?p.net_rx_bps!=null?`${(p.net_rx_bps/1024).toFixed(1)} KB/s`:e:s==="tx"?p.net_tx_bps!=null?`${(p.net_tx_bps/1024).toFixed(1)} KB/s`:e:s==="ioR"?L.read_bps!=null?`${ct(L.read_bps)}`:e:s==="ioW"?L.write_bps!=null?`${ct(L.write_bps)}`:e:s==="swap"?Pt?.usage_percent!=null?`${Pt.usage_percent.toFixed(1)}%`:e:s==="fd"&&I?.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:e:e;return y&&!K.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:278:12",className:"flex items-center justify-center h-64",children:t.jsx(ms,{"code-path":"src/pages/HostMonitor.tsx:278:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:282:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:284:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:285:9",className:"flex items-center gap-2",children:[t.jsx(Y,{"code-path":"src/pages/HostMonitor.tsx:286:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(Qt,{"code-path":"src/pages/HostMonitor.tsx:287:11",value:d,onValueChange:j,children:[t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:288:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:289:15",placeholder:"选择主机..."})}),t.jsx(ts,{"code-path":"src/pages/HostMonitor.tsx:291:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:O.map(s=>t.jsx(rt,{"code-path":"src/pages/HostMonitor.tsx:293:17",value:s.hostname,children:s.hostname},s.hostname))})]}),b&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:298:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[b.os||"",b.cpu_cores?` | ${b.cpu_cores} 核`:"",b.mem_total?` | ${b.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:303:9",className:"flex items-center gap-2",children:[t.jsxs(Qt,{"code-path":"src/pages/HostMonitor.tsx:304:11",value:n,onValueChange:s=>nt(s),children:[t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:305:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:306:15"})}),t.jsxs(ts,{"code-path":"src/pages/HostMonitor.tsx:308:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(rt,{"code-path":"src/pages/HostMonitor.tsx:309:15",value:"avg",children:"平均值"}),t.jsx(rt,{"code-path":"src/pages/HostMonitor.tsx:310:15",value:"max",children:"最大值"}),t.jsx(rt,{"code-path":"src/pages/HostMonitor.tsx:311:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:314:11",className:"flex items-center gap-1",children:bt.map(s=>t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:316:15",variant:f===s.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>R(s.hours),children:s.label},s.hours))})]})]}),t.jsxs(js,{"code-path":"src/pages/HostMonitor.tsx:324:7",value:P,onValueChange:v,children:[t.jsx(vs,{"code-path":"src/pages/HostMonitor.tsx:325: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(us,{"code-path":"src/pages/HostMonitor.tsx:327:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:328:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(dt,{"code-path":"src/pages/HostMonitor.tsx:329:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(Y,{"code-path":"src/pages/HostMonitor.tsx:330:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(es,{"code-path":"src/pages/HostMonitor.tsx:331:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(bs,{"code-path":"src/pages/HostMonitor.tsx:332:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(ks,{"code-path":"src/pages/HostMonitor.tsx:333:57",className:"w-3 h-3"})}].map(s=>t.jsxs(fs,{"code-path":"src/pages/HostMonitor.tsx:335:13",value:s.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[s.icon,s.label]},s.id))}),t.jsxs(z,{"code-path":"src/pages/HostMonitor.tsx:342:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:343:11",title:"CPU 使用率(%)",value:D("cpu"),icon:t.jsx(Ms,{"code-path":"src/pages/HostMonitor.tsx:343:79",className:"h-4 w-4 text-blue-400"}),data:g.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:345:11",title:"CPU IO等待(%)",value:o?.cpu_iowait!=null?`${o.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:345:133",className:"h-4 w-4 text-orange-400"}),data:g.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:347:11",title:"内存使用率(%)",value:D("mem"),icon:t.jsx(Y,{"code-path":"src/pages/HostMonitor.tsx:347:77",className:"h-4 w-4 text-emerald-400"}),data:g.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:349:11",title:"可用内存(GB)",value:o?.mem_available!=null?`${o.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(Y,{"code-path":"src/pages/HostMonitor.tsx:349:137",className:"h-4 w-4 text-emerald-400"}),data:g.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:351:11",title:"Swap 使用率(%)",value:D("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:351:81",className:"h-4 w-4 text-red-400"}),data:g.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:353:11",title:"系统负载(1m)",value:D("load1"),icon:t.jsx(Wt,{"code-path":"src/pages/HostMonitor.tsx:353:79",className:"h-4 w-4 text-purple-400"}),data:g.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:n})]}),t.jsx(z,{"code-path":"src/pages/HostMonitor.tsx:358:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:360:13",title:"磁盘使用率(%)",value:D("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:360:80",className:"h-4 w-4 text-orange-400"}),data:g.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:362:13",title:"Inode 使用率(%)",value:(()=>{const s=Array.isArray(M(o?.disk_info))?M(o?.disk_info):[],e=s.find(c=>c.mount==="/")||s[0];return e?.inode_usage_pct!=null?`${e.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:366:25",className:"h-4 w-4 text-purple-400"}),data:g.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:368:13",title:"磁盘读取(KB/s)",value:D("ioR"),icon:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:368:81",className:"h-4 w-4 text-blue-400"}),data:g.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:370:13",title:"磁盘写入(KB/s)",value:D("ioW"),icon:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:370:81",className:"h-4 w-4 text-emerald-400"}),data:g.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:372:13",title:"磁盘IO繁忙度(%)",value:L?.util!=null?`${L.util.toFixed(1)}%`:"--",icon:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:372:130",className:"h-4 w-4 text-red-400"}),data:g.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:n})]})}),t.jsxs(z,{"code-path":"src/pages/HostMonitor.tsx:378:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:379:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:380:13",title:"TCP EST",value:D("tcp"),icon:t.jsx(dt,{"code-path":"src/pages/HostMonitor.tsx:380:78",className:"h-4 w-4 text-purple-400"}),data:g.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:382:13",title:"TCP TIME_WAIT",value:D("tw"),icon:t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:382:83",className:"h-4 w-4 text-amber-400"}),data:g.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:384:13",title:"TCP CLOSE_WAIT",value:p?.tcp_close_wait!=null?String(p.tcp_close_wait):"--",icon:t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:384:139",className:"h-4 w-4 text-red-400"}),data:g.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:386:13",title:"TCP 总连接",value:p?String((p.tcp_established||0)+(p.tcp_time_wait||0)+(p.tcp_close_wait||0)):"--",icon:t.jsx(dt,{"code-path":"src/pages/HostMonitor.tsx:386:169",className:"h-4 w-4 text-cyan-400"}),data:g.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:n})]}),t.jsx(Ss,{"code-path":"src/pages/HostMonitor.tsx:390:11",title:"网卡带宽吞吐",currentRx:p?.net_rx_bps!=null?ct(p.net_rx_bps):"--",currentTx:p?.net_tx_bps!=null?ct(p.net_tx_bps):"--",rxData:g.rx,txData:g.tx,aggType:n,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:397:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:398:13",title:"网卡接收错误",value:p?.net_rx_errors!=null?String(p.net_rx_errors):"--",icon:t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:398:129",className:"h-4 w-4 text-red-400"}),data:g.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:n}),t.jsx(H,{"code-path":"src/pages/HostMonitor.tsx:400:13",title:"网卡发送错误",value:p?.net_tx_errors!=null?String(p.net_tx_errors):"--",icon:t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:400:129",className:"h-4 w-4 text-orange-400"}),data:g.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:n})]})]}),t.jsx(z,{"code-path":"src/pages/HostMonitor.tsx:406:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:407:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:408:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:409:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Y,{"code-path":"src/pages/HostMonitor.tsx:410:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",J.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"ml-auto flex items-center gap-2",children:[k==="blacklist"&&X.length>0&&t.jsxs(Z,{"code-path":"src/pages/HostMonitor.tsx:413:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",X.join(",")]}),k==="whitelist"&&t.jsx(Z,{"code-path":"src/pages/HostMonitor.tsx:418:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:422:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{pt(),st(!0)},children:"策略配置"})]})]}),J.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:429: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:433:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:434:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:435:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:436:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:437:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:438:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:439:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:440:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:443:21",children:J.map((s,e)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:445: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:446:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:s.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:447:27",className:"py-1.5",children:t.jsx(Z,{"code-path":"src/pages/HostMonitor.tsx:448:29",variant:"outline",className:"text-[10px] font-mono",children:s.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:452:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:s.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:453:27",className:"py-1.5 text-right",children:t.jsx(Z,{"code-path":"src/pages/HostMonitor.tsx:454:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},e))})]})})]})})}),t.jsxs(z,{"code-path":"src/pages/HostMonitor.tsx:469:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:471:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:472:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:473:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(es,{"code-path":"src/pages/HostMonitor.tsx:474:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",lt.length]}),lt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:477: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:481:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:482:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:483:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:484:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:485:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:486:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:487:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:488:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:489:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:492:21",children:lt.map((s,e)=>{const c=s.cmdline||s.name||"?",l=s.cpu_pct!=null?Number(s.cpu_pct):null,E=s.mem_pct!=null?Number(s.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:498: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:499:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:500:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:501:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:c,children:c}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:507:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async et=>{et.stopPropagation();try{await navigator.clipboard.writeText(c)}catch{const B=document.createElement("textarea");B.value=c,B.style.position="fixed",B.style.opacity="0",document.body.appendChild(B),B.select(),document.execCommand("copy"),document.body.removeChild(B)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:523: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:524:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:525: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:530:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:s.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:531:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:532:31",className:E!=null&&E>50?"text-rose-400":"text-cyan-400",children:E!=null?E.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:536:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:537:31",className:l!=null&&l>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:l!=null?l.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:541:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:s.fd_count??"--"})]},e)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:553:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:555:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:556:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:557: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:558: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:562:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:563:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:564:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:565:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:567:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:568:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:569: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:571:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:572:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:573: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)}%`:"—"})]})]}),g.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:579:23",className:"h-[120px]",children:t.jsx(Mt,{"code-path":"src/pages/HostMonitor.tsx:580:25",width:"100%",height:"100%",children:t.jsxs(Nt,{"code-path":"src/pages/HostMonitor.tsx:581:27",data:g.fd,children:[t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:582:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:583:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:584:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(ft,{"code-path":"src/pages/HostMonitor.tsx:585:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:586:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:587:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:588:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:589:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(it,{"code-path":"src/pages/HostMonitor.tsx:592:29",type:"monotone",dataKey:n,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:599:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:605:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:606:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:607:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(ss,{"code-path":"src/pages/HostMonitor.tsx:608:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),_?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:611:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:612:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:613:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:614:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:615:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(_.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:616: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:618:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[_.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:620:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:621:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:622:25",className:"text-lg font-bold font-mono text-amber-400",children:[(_.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:623: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:625:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[_.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:629:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:630:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:631:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:632:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:634:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:_.ctx_per_sec+_.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:637:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(_.ctx_per_sec/(_.ctx_per_sec+_.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:639:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(_.irq_per_sec/(_.ctx_per_sec+_.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:647:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsxs(z,{"code-path":"src/pages/HostMonitor.tsx:655:9",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:656:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(S,{"code-path":"src/pages/HostMonitor.tsx:657:13",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:658:15",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",b?.hostname||d],["IP 地址",b?.ip||"—"],["操作系统",b?.os||"—"],["内核版本",b?.kernel||"—"],["CPU 核心数",b?.cpu_cores||"—"],["总内存",b?.mem_total?`${b.mem_total.toFixed(0)} GB`:"—"],["已用内存",b?.mem_used?`${b.mem_used.toFixed(1)} GB`:"—"],["运行时长",b?.uptime?`${Math.floor(b.uptime/86400)}天 ${Math.floor(b.uptime%86400/3600)}时`:"—"],["Agent 版本",Q?.version||b?.agent_version||"—"],["Agent 序列号",Q?.report_seq!=null?String(Q.report_seq):"—"],["监听端口数",J.length>0?`${J.length}`:"—"],["Agent RSS",Q?.self_rss_mb?`${Q.self_rss_mb.toFixed(1)} MB`:"—"]].map(([s,e])=>t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:673:19",children:[t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:674:21",className:"text-[var(--dg-text-muted)]",children:[s,":"]}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:675:21",className:"text-[var(--dg-text-primary)] font-mono",children:e})]},s))})})}),o&&t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:684:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:685:15",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:686:17",className:"flex items-center gap-2 mb-2",children:[t.jsx(Wt,{"code-path":"src/pages/HostMonitor.tsx:687:19",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/HostMonitor.tsx:688:19",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:690:17",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:691:19",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:691:24",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:691:82",className:"text-sm font-bold text-slate-200",children:o.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:692:19",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:692:24",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:692:82",className:"text-sm font-bold text-slate-200",children:o.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:693:19",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:693:24",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:693:83",className:"text-sm font-bold text-slate-200",children:o.load15??"--"})]})]})]})}),o?.disk_info&&(()=>{const s=M(o.disk_info),e=Array.isArray(s)?s:s.partitions||[];return e.length?t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:705:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:706:17",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:707:19",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/HostMonitor.tsx:707:114",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:708:19",className:"space-y-1.5",children:e.map((c,l)=>t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:710:23",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:711:25",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:c.mount||c.mountpoint||c.device||`disk${l}`}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:712:25",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:713:27",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(c.usage_percent||c.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:715:25",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(c.used_gb??0).toFixed(1),"/",(c.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:716:25",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(c.usage_percent??c.used_percent??0).toFixed(1),"%"]})]},l))})]})}):null})()]}),t.jsxs(z,{"code-path":"src/pages/HostMonitor.tsx:727:9",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:728:11",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/HostMonitor.tsx:729:13",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:730:13",className:"flex gap-2",children:[t.jsxs(A,{"code-path":"src/pages/HostMonitor.tsx:731:15",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:V,children:[t.jsx(ss,{"code-path":"src/pages/HostMonitor.tsx:732:17",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(A,{"code-path":"src/pages/HostMonitor.tsx:734:15",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:()=>{kt(null),N({name:"",hostname:d,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:""}),q(!0)},children:[t.jsx(Ns,{"code-path":"src/pages/HostMonitor.tsx:743:17",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),wt.length===0?t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:748:13",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(S,{"code-path":"src/pages/HostMonitor.tsx:749:15",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:754:13",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:wt.map(s=>t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:756:17",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${s.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:757:19",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:758:21",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:759:23",className:"flex items-center gap-2",children:[s.last_status==="up"?t.jsx(Hs,{"code-path":"src/pages/HostMonitor.tsx:760:51",className:"w-4 h-4 text-emerald-400"}):s.last_status==="down"?t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:761:53",className:"w-4 h-4 text-red-400"}):t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:762:26",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:763:25",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:s.name}),t.jsx(Z,{"code-path":"src/pages/HostMonitor.tsx:764:25",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:s.probe_type==="http_get"?"HTTP":s.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:768:23",className:"flex gap-1",children:[t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:769:25",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>{kt(s),N({name:s.name,hostname:s.hostname,probe_type:s.probe_type,http_url:s.http_url||"",http_method:s.http_method||"GET",http_expect_code:s.http_expect_code||200,http_expect_body:s.http_expect_body||"",tcp_host:s.tcp_host||"",tcp_port:s.tcp_port||3306,exec_command:s.exec_command||"",timeout:s.timeout||10,interval:s.interval||60,description:s.description||""}),q(!0)},children:t.jsx(_s,{"code-path":"src/pages/HostMonitor.tsx:781:27",className:"w-3 h-3"})}),t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:783:25",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:async()=>{confirm(`确定删除探针"${s.name}"?`)&&(await G.deleteHealthProbe(s.id),V())},children:t.jsx(ys,{"code-path":"src/pages/HostMonitor.tsx:789:27",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:793:21",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[s.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:795:25",className:"truncate",children:["URL: ",s.http_url]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:798:25",children:[s.tcp_host,":",s.tcp_port]}),s.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:801:25",className:"truncate font-mono",children:s.exec_command}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:803:23",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:804:25",children:["状态: ",t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:804:35",className:s.last_status==="up"?"text-emerald-400":s.last_status==="down"?"text-red-400":"text-slate-400",children:s.last_status?s.last_status.toUpperCase():"未检测"})]}),s.last_latency_ms>0&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:807:51",children:["延迟: ",s.last_latency_ms,"ms"]}),s.fail_count>0&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:808:46",className:"text-red-400",children:["连续失败: ",s.fail_count,"次"]}),s.last_checked_at&&t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:809:47",className:"text-[10px]",children:new Date(s.last_checked_at).toLocaleString("zh-CN")})]})]})]})},s.id))})]})]}),t.jsx(Kt,{"code-path":"src/pages/HostMonitor.tsx:821:7",open:cs,onOpenChange:q,children:t.jsxs(qt,{"code-path":"src/pages/HostMonitor.tsx:822:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ut,{"code-path":"src/pages/HostMonitor.tsx:823:11",children:[t.jsx(Vt,{"code-path":"src/pages/HostMonitor.tsx:824:13",className:"text-[var(--dg-text-primary)]",children:U?"编辑探针":"添加探针"}),t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:827:13",className:"text-[var(--dg-text-secondary)]",children:U?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:831:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:832:13",children:[t.jsxs("label",{"code-path":"src/pages/HostMonitor.tsx:833:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:833:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:834: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:a.name,onChange:s=>N({...a,name:s.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:836:13",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:837:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:838: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:a.hostname,onChange:s=>N({...a,hostname:s.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:840:13",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:841:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/HostMonitor.tsx:842: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:a.probe_type,onChange:s=>N({...a,probe_type:s.target.value}),children:[t.jsx("option",{"code-path":"src/pages/HostMonitor.tsx:843:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/HostMonitor.tsx:844:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/HostMonitor.tsx:845:17",value:"exec_command",children:"Exec Command"})]})]}),a.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:851:17",children:[t.jsxs("label",{"code-path":"src/pages/HostMonitor.tsx:851:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:851:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:852: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:a.http_url,onChange:s=>N({...a,http_url:s.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:853:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:854:19",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:854:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:855: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:a.http_expect_code,onChange:s=>N({...a,http_expect_code:Number(s.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:856:19",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:856:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:857: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:a.http_expect_body,onChange:s=>N({...a,http_expect_body:s.target.value})})]})]})]}),a.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:863:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:864:17",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:864:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:865: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:a.tcp_host,onChange:s=>N({...a,tcp_host:s.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:866:19",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:866:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:867: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:a.tcp_port,onChange:s=>N({...a,tcp_port:Number(s.target.value)})})]})]}),a.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:872:15",children:[t.jsxs("label",{"code-path":"src/pages/HostMonitor.tsx:872:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:872:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:873: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:a.exec_command,onChange:s=>N({...a,exec_command:s.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:876:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:877:15",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:877:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:878: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:a.timeout,onChange:s=>N({...a,timeout:Number(s.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:879:15",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:879:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:880: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:a.interval,onChange:s=>N({...a,interval:Number(s.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:883:13",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:883:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/HostMonitor.tsx:884: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:a.description,onChange:s=>N({...a,description:s.target.value})})]})]}),t.jsxs(Jt,{"code-path":"src/pages/HostMonitor.tsx:886:11",children:[t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:887:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>q(!1),children:"取消"}),t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:888:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:async()=>{if(!(!a.name||!a.hostname))try{U?await G.updateHealthProbe(U.id,a):await G.createHealthProbe(a),q(!1),V()}catch{alert("保存失败")}},disabled:!a.name||!a.hostname,children:U?"保存":"创建"})]})]})}),t.jsx(Kt,{"code-path":"src/pages/HostMonitor.tsx:907:7",open:ds,onOpenChange:st,children:t.jsxs(qt,{"code-path":"src/pages/HostMonitor.tsx:908:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ut,{"code-path":"src/pages/HostMonitor.tsx:909:11",children:[t.jsx(Vt,{"code-path":"src/pages/HostMonitor.tsx:910:13",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:911:13",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:913:11",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:915:13",children:[t.jsx("label",{"code-path":"src/pages/HostMonitor.tsx:916:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:917:15",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:918:17",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${k==="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:()=>xt("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:924:17",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${k==="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:()=>xt("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/HostMonitor.tsx:931:15",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:k==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:939:13",children:[t.jsxs("label",{"code-path":"src/pages/HostMonitor.tsx:940:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:941:22",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),k==="whitelist"&&t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:942:52",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/HostMonitor.tsx:944:15",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 ${k==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:X.join(","),onChange:s=>{if(k==="whitelist")return;const c=s.target.value.split(",").map(l=>parseInt(l.trim())).filter(l=>!isNaN(l)&&l>0&&l<=65535);Ct(c)},placeholder:k==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:k==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/HostMonitor.tsx:958:15",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",X.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:964:13",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/HostMonitor.tsx:965:15",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/HostMonitor.tsx:966:37",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Jt,{"code-path":"src/pages/HostMonitor.tsx:970:11",children:[t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:971:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>st(!1),children:"取消"}),t.jsx(A,{"code-path":"src/pages/HostMonitor.tsx:972:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:is,disabled:St,children:St?"保存中…":"保存策略"})]})]})})]})}function H({title:r,value:T,icon:O,data:F,color:d,unit:j,domain:y,aggType:w}){const P=F.map(v=>({...v,value:v[w]}));return t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:992:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:993:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:994:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:995:11",className:"flex items-center gap-1.5",children:[O,t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:995:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:r})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:997:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:998:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:T}),j&&t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:999:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:j})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:1001:9",className:"h-48",children:P.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:1003: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/HostMonitor.tsx:1005:13",width:"100%",height:"100%",children:t.jsxs(Nt,{"code-path":"src/pages/HostMonitor.tsx:1006:15",data:P,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:1007:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:1008:19",id:`grad-${r}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1009:21",offset:"5%",stopColor:d,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1010:21",offset:"95%",stopColor:d,stopOpacity:0})]})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:1013:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:1014:17",dataKey:"time",hide:!0}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:1015:17",hide:!0,domain:y[1]==="auto"?[0,v=>v*1.1]:y}),t.jsx(ft,{"code-path":"src/pages/HostMonitor.tsx:1016:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:v=>[`${v.toFixed(2)} ${j}`,r.replace(/\(.+\)/,"")],labelFormatter:v=>`时间: ${v}`}),t.jsx(it,{"code-path":"src/pages/HostMonitor.tsx:1019:17",type:"monotone",dataKey:"value",stroke:d,strokeWidth:1.5,fill:`url(#grad-${r})`}),t.jsx(as,{"code-path":"src/pages/HostMonitor.tsx:1020:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,P.length-Math.min(20,P.length))})]})})})]})})}function Ss({title:r,currentRx:T,currentTx:O,rxData:F,txData:d,aggType:j,unit:y}){const w=F.map((f,R)=>({time:f.time,timestamp:f.timestamp,rx:f[j]??0,tx:d[R]?.[j]??0})),P=`grad-rx-${r.replace(/\s/g,"")}`,v=`grad-tx-${r.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:1049:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(S,{"code-path":"src/pages/HostMonitor.tsx:1050:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:1051:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:1052:11",className:"flex items-center gap-1.5",children:[t.jsx(dt,{"code-path":"src/pages/HostMonitor.tsx:1053:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:1054:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:r})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:1056:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:1057:13",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:1057: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/HostMonitor.tsx:1057:108",className:"text-blue-300",children:T})]}),t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:1058:13",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:1058: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/HostMonitor.tsx:1058:111",className:"text-emerald-300",children:O})]})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:1061:9",className:"h-56",children:w.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:1063: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/HostMonitor.tsx:1065:13",width:"100%",height:"100%",children:t.jsxs(Nt,{"code-path":"src/pages/HostMonitor.tsx:1066:15",data:w,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/HostMonitor.tsx:1067:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:1068:19",id:P,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1069:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1070:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:1072:19",id:v,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1073:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:1074:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:1077:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:1078:17",dataKey:"time",hide:!0}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:1079:17",hide:!0,domain:[0,"auto"]}),t.jsx(ft,{"code-path":"src/pages/HostMonitor.tsx:1080:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(f,R)=>[`${f.toFixed(2)} ${y}`,R==="rx"?"接收":"发送"],labelFormatter:f=>`时间: ${f}`}),t.jsx(it,{"code-path":"src/pages/HostMonitor.tsx:1083:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${P})`,name:"rx"}),t.jsx(it,{"code-path":"src/pages/HostMonitor.tsx:1084:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${v})`,name:"tx"}),t.jsx(as,{"code-path":"src/pages/HostMonitor.tsx:1085:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,w.length-Math.min(20,w.length))})]})})})]})})}export{Us as HostMonitor};