import{i as B,c as S}from"./app-DckefXYL.js";import{e as g}from"./app-DUeSaIYz.js";import{C as z}from"./app-B2-Q9WJQ.js";import{W as E}from"./app-C7P1WxYu.js";import{C as L}from"./app-DFt3cvWa.js";import{C as b}from"./app-DR6MAZZy.js";import{C as w}from"./app-BQ_EeKjW.js";import{o as f,c as k,w as s,u as c,g as y,b as n,f as l,a as p,h as v}from"./app-DnroACXc.js";import"./app-DAKlLAys.js";import"./app-xECxwo4T.js";import"./app-BBDtZW3a.js";import"./app-R-vSvFIF.js";import"./app-HaDoyrq5.js";import"./app-CYYQ_Zep.js";import"./app-Cmxxk_WX.js";import"./app-CF8nmC-F.js";import"./app-B09rlSqG.js";function N(){const{utils:a}=B(this);a.setEcharts(g),this.$delay(function(){let t=this,o=this.processMaxUnit(this.systemStats);this.reloadChart("system-chart","操作系统",this.systemStats,function(e){return e.system.name},function(e){return t.systemStats[e.dataIndex].system.name+": "+a.formatNumber(t.systemStats[e.dataIndex].rawCount)},o),window.addEventListener("resize",function(){t.resizeChart("system-chart")});let r=this.processMaxUnit(this.browserStats);this.reloadChart("browser-chart","浏览器",this.browserStats,function(e){return e.browser.name},function(e){return t.browserStats[e.dataIndex].browser.name+": "+a.formatNumber(t.browserStats[e.dataIndex].rawCount)},r),window.addEventListener("resize",function(){t.resizeChart("system-chart"),t.resizeChart("browser-chart")})}),this.reloadChart=function(t,o,r,e,i,m){let x=document.getElementById(t);x!=null&&a.initChart(x,void 0,u=>{let C=20,_=0;const d=a.xRotation(u,r.map(e));d!=null&&(C=d[0],_=d[1]);let I={xAxis:{data:r.map(e),axisLabel:{interval:0,color:a.chartLabelColor,rotate:_}},yAxis:{axisLabel:{formatter:function(h){return h+m},color:a.chartLabelColor}},tooltip:{show:!0,trigger:"item",formatter:i},grid:{left:40,top:10,right:20,bottom:C},series:[{name:o,type:"bar",data:r.map(function(h){return h.count}),itemStyle:{color:a.DefaultChartColor},barWidth:"10em"}],animation:!0};u.setOption(I),u.resize()})},this.resizeChart=function(t){let o=document.getElementById(t);o!=null&&a.initChart(o,void 0,r=>{r.resize()})},this.processMaxUnit=function(t){let o=t.$map(function(i,m){return m.count}).$max(),r=0,e="";return o>=1e3*1e3*1e3?(e="B",r=1e3*1e3*1e3):o>=1e3*1e3?(e="M",r=1e3*1e3):o>=1e3&&(e="K",r=1e3),t.forEach(function(i){i.rawCount=i.count,r>0&&(i.count/=r)}),e}}const M={key:0},U=["href"],V={key:1},O=p("div",{class:"chart-box",id:"system-chart"},null,-1),R=p("div",{class:"chart-box",id:"browser-chart"},null,-1),tt={__name:"clients",setup(a){const t=S(new N);return(o,r)=>(f(),k(z,{ctx:c(t),"has-tab":!0},{default:s(()=>[c(t).statIsOn?v("",!0):(f(),y("div",M,[n(E,null,{default:s(()=>[l(" 要想查看统计数据，需要先开启统计功能，"),p("a",{href:"/servers/server/settings/stat?serverId="+c(t).serverId},"[点击这里]",8,U),l("修改配置。 ")]),_:1})])),c(t).statIsOn?(f(),y("div",V,[n(L,null,{default:s(()=>[n(b,{cols:"1"},{header:s(()=>[l("操作系统排行")]),default:s(()=>[n(w,null,{value:s(()=>[O]),_:1})]),_:1}),n(b,{cols:"1"},{header:s(()=>[l("浏览器排行")]),default:s(()=>[n(w,null,{value:s(()=>[R]),_:1})]),_:1})]),_:1})])):v("",!0)]),_:1},8,["ctx"]))}};export{tt as default};
