import{V as k,f as w,av as m,j as l,fF as M,o as e,k as L,K as P}from"./index-CCv_8omK.js";import{B as F}from"./base-chart-AQkuFrPC.js";import{x as E}from"./index-DRYJ0xIl.js";function R({title:h="",cpus:b=[],currentLoad:r=0,history:c=[],empty:v=null,onHover:g=()=>{},hoverIndex:$=null}){const{t:x,locale:d}=k(),t=w(),o=`${h||x("common.cpu")} (${Math.floor(r||0)}%)`,f=100,a=80,p=y=>`${y}%`,T=[{max:a,color:m(t.palette.primary.main,t.palette.mode==="dark"?.15:.08)},{min:a,max:100,color:m(t.palette.warning.main,t.palette.mode==="dark"?.18:.12)},{min:100,color:m(t.palette.error.main,t.palette.mode==="dark"?.25:.18)}],i={silent:!0,symbol:["none","none"],data:[{yAxis:100,lineStyle:{color:t.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${p(100)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:a,lineStyle:{color:t.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${p(a)}`,position:"insideEndTop",color:t.palette.text.secondary,padding:[2,4],borderRadius:2}}]},s=l.jsx("span",{children:`${x("system.cores")}: ${b?.length||0}`}),u=y=>M(Number(y),"HH:mm",d);return l.jsx(F,{title:o,total:f,history:c,valueFn:p,xAxisFormat:u,visualMapPieces:T,markLineData:i,extraInfo:s,empty:v,onHover:g,hoverIndex:$})}R.propTypes={title:e.string,cpus:e.array,currentLoad:e.number,history:e.array,empty:e.node,onHover:e.func,hoverIndex:e.number};function D({instanceCount:h=null,title:b="",total:r=null,used:c=null,history:v=[],empty:g=null,onHover:$=()=>{},hoverIndex:x=null}){const{t:d,locale:t}=k(),o=w(),f=!!r,a=r-c,p=f?`(${L(c)}, ${Math.floor(c/r*100)}%)`:"",T=`${b||d("common.memory")} ${p}`,i=Math.ceil(r*.8),s=n=>E(n,{short:!0,iec:!0}),u=[];h&&u.push({title:d("system.instances"),metric:h}),f&&u.push({title:d("system.free"),metric:s(a)});const y=[{max:i,color:m(o.palette.primary.main,o.palette.mode==="dark"?.15:.08)},{min:i,max:r,color:m(o.palette.warning.main,o.palette.mode==="dark"?.18:.12)},{min:r,color:m(o.palette.error.main,o.palette.mode==="dark"?.25:.18)}],I={silent:!0,symbol:["none","none"],data:[{yAxis:r,lineStyle:{color:o.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${s(r)}`,position:"insideEndTop",color:o.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:i,lineStyle:{color:o.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${s(i)}`,position:"insideEndTop",color:o.palette.text.secondary,padding:[2,4],borderRadius:2}}]},A=l.jsx(l.Fragment,{children:u.map((n,j)=>l.jsxs(P,{sx:{marginLeft:j===0?0:1,display:"inline-flex"},children:[n.title,": ",n.metric]},n.title))}),H=n=>M(Number(n),"HH:mm",t);return l.jsx(F,{title:T,total:r,history:v,valueFn:s,xAxisFormat:H,visualMapPieces:y,markLineData:I,extraInfo:A,empty:g,onHover:$,hoverIndex:x})}D.propTypes={title:e.string,instanceCount:e.number,total:e.number,used:e.number,history:e.array,empty:e.node,onHover:e.func,hoverIndex:e.number};export{R as C,D as M};
