import{c as e,s as t,g as a,q as s,a6 as o,v as l,x as r,e as i,B as n,z as c,y as d,A as p,I as u,F as f,L as m,C as v,J as h,N as x,K as y,M as b,b5 as g,az as w,c2 as _}from"./base-lib.js?v=1761009159";import{H as j,a as k}from"./index48.js?v=1761009159";import{_ as M}from"./utils-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./index112.js?v=1761009159";import"./index107.js?v=1761009159";import"./store3.js?v=1761009159";import"./store4.js?v=1761009159";import"./config.js?v=1761009159";import"./store5.js?v=1761009159";import"./hooks.js?v=1761009159";const B={class:"module-ui relative"},L={class:"flex flex-shrink-0 w-full"},C={class:"flex flex-col justify-end flex-shrink-0 w-full home-load-status-title"},N=["title"],z={class:"text-extraLarge text-default font-alibaba-heavy 2xl:text-subtitleLarge whitespace-nowrap",style:{fontSize:"var(--bt-home-overview-font-size)"}},T={class:"text-small"},$={class:"text-small"},H={class:"flex flex-col items-center text-small font-alibaba-semibold"},A={class:"font-800 md:text-subtitleLarge lg:text-iconLarge 2xl:text-titleLarge"},D=M(e({__name:"main",props:{visible:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},showDesc:{type:Boolean,default:!0},href:{default:""},info:{default:()=>({type:"",title:"",range:0})},disk:{type:Boolean,default:!1},data:{default:()=>({})},type:{default:""},alert:{type:Boolean,default:!1},mainWidth:{default:200}},emits:["update:visible","openPopover","show","hide"],setup(e,{emit:M}){const D=j(),{tagsType:F}=t(D),I=e,S=k(),{virtualRef:W,popoverContent:q}=t(S),J=a(()=>{const e=I.mainWidth||200;let t=0;return t=e<=200?Math.max(80,Math.min(100,Math.floor(.35*e)-20)):e<=300?Math.max(100,Math.min(120,Math.floor(.33*e)-20)):Math.max(120,Math.min(140,Math.floor(.3*e)-20)),t}),K=a(()=>{const{info:e,alert:t}=I,{desc:a,title:s,range:o,rangeText:l,disabled:r,type:i}=e,n=S.chartColorActive(o,t);let c=a,{color:d}=n;if("disk"===I.type&&"var(--el-color-primary)"===d){const{data:e}=I;d=Number(e.inodes[3].replace("%",""))>90?"#ef0808":Number(e.inodes[3].replace("%",""))>80?"#ff9900":"var(--el-color-primary)"}if("object"==typeof a&&("disk"===i||"mem"===i))try{c={used:a.used?a.used:"0",used_unit:a.used_unit?a.used_unit:"0",total:a.total?a.total:"0",total_unit:a.total_unit?a.total_unit:"0"}}catch(p){c="获取中"}return{type:i,title:s,color:d,range:o,disabled:!!r,desc:c||n.desc,rangeText:l||"",position:"bottom-start"}}),P=e=>{const{rangeText:t}=K.value;return t||"".concat(e,"%")};a(()=>R.value?{backgroundColor:K.value.color}:{});const R=a(()=>"load"===K.value.type&&"success"!==F.value.load);return s(()=>{S.init()}),o(()=>{S.$reset()}),(e,t)=>{const a=g,s=w,o=_;return l(),r("div",B,[i(s,{trigger:"hover","virtual-ref":d(W),width:400,offset:e.custom?1:0,placement:d(K).position,teleported:!1,"show-after":100,"auto-close":0,"popper-class":"el-popover-shadow",onShow:t[0]||(t[0]=t=>e.$emit("show")),onHide:t[1]||(t[1]=t=>e.$emit("hide"))},{reference:n(()=>{var s,i,b,g;return[c("div",{ref_key:"popoverContent",ref:q,class:"flex flex-row items-end justify-between w-full h-full"},[c("div",L,[c("div",C,[c("span",{class:"pb-[.6rem] text-base truncate block w-[50%] font-alibaba-semibold",title:d(K).title},p(d(K).title),9,N),u(c("span",z,["object"!=typeof d(K).desc||"disk"!==d(K).type&&"mem"!==d(K).type?(l(),r(f,{key:1},[v(p(d(K).desc),1)],64)):(l(),r(f,{key:0},[c("span",{style:m({color:d(K).color})},[c("span",null,p(null==(s=d(K).desc)?void 0:s.used),1),c("span",T,p(null==(i=d(K).desc)?void 0:i.used_unit),1)],4),t[2]||(t[2]=c("span",null," / ",-1)),c("span",null,p(null==(b=d(K).desc)?void 0:b.total),1),c("span",$,p(null==(g=d(K).desc)?void 0:g.total_unit),1)],64))],512),[[h,e.showDesc]])])]),u((l(),x(a,{class:y(["status-main-progress",{"mount-progress":"None"===e.data.path}]),type:"circle",width:d(J),"stroke-width":8,color:d(K).color,percentage:d(K).range||0,format:P,style:m("color:"+d(K).color)},{default:n(({percentage:e})=>[c("div",H,[c("span",{class:"percentage-value",style:m({color:d(K).color})},[c("span",A,p(Number(e).toFixed(0)),1),t[3]||(t[3]=v("% ",-1))],4)])]),_:1},8,["width","class","color","percentage","style"])),[[o,void 0,"popover"]])],512)]}),default:n(()=>[b(e.$slots,"default",{},void 0,!0)]),_:3},8,["virtual-ref","offset","placement"])])}}}),[["__scopeId","data-v-b60c832a"]]);export{D as default};
