import{i as g,c as y}from"./app-a6cKceqE.js";import{e as B}from"./app-DUeSaIYz.js";import{W as I}from"./app-D7QVa3_6.js";import{C as k}from"./app-CLawzVMq.js";import{C as E}from"./app-s9q29Mor.js";import{C as L}from"./app-Biqm6MNM.js";import{C as z}from"./app-C14NbwKQ.js";import{o as f,c as N,w as n,u as s,g as _,b as c,f as p,a as b,h as v}from"./app-BYcXwl4U.js";import"./app-CO4sV-Ic.js";import"./app-yt37eDzA.js";import"./app-BG60hdvp.js";import"./app-BQ5ggxk2.js";import"./app-SxAW7vhf.js";import"./app-D3zbrzdO.js";import"./app-BeFNDz9n.js";import"./app-BDgR0DSb.js";function S(){const{utils:o}=g(this);o.setEcharts(B),this.$delay(function(){let e=this,r=this.processMaxUnit(this.providerStats);this.reloadChart("provider-chart","运营商",this.providerStats,function(t){return t.provider.name},function(t){return e.providerStats[t.dataIndex].provider.name+": "+o.formatNumber(e.providerStats[t.dataIndex].rawCount)},r),window.addEventListener("resize",function(){e.resizeChart("provider-chart")})}),this.reloadChart=function(e,r,t,i,a,l){let h=document.getElementById(e);h!=null&&o.initChart(h,void 0,d=>{let x=20,C=0;const u=o.xRotation(d,t.map(i));u!=null&&(x=u[0],C=u[1]);let w={xAxis:{data:t.map(i),axisLabel:{interval:0,color:o.chartLabelColor,rotate:C}},yAxis:{axisLabel:{formatter:function(m){return m+l},color:o.chartLabelColor}},tooltip:{show:!0,trigger:"item",formatter:a},grid:{left:40,top:10,right:20,bottom:x},series:[{name:r,type:"bar",data:t.map(function(m){return m.count}),itemStyle:{color:o.DefaultChartColor},barWidth:"10em"}],animation:!0};d.setOption(w),d.resize()})},this.resizeChart=function(e){let r=document.getElementById(e);r!=null&&o.initChart(r,void 0,t=>{t.resize()})},this.processMaxUnit=function(e){let r=e.$map(function(a,l){return l.count}).$max(),t=0,i="";return r>=1e3*1e3*1e3?(i="B",t=1e3*1e3*1e3):r>=1e3*1e3?(i="M",t=1e3*1e3):r>=1e3&&(i="K",t=1e3),e.forEach(function(a){a.rawCount=a.count,t>0&&(a.count/=t)}),i}}const V={key:0},M=["href"],O={key:1},R=b("div",{class:"chart-box",id:"provider-chart"},null,-1),Z={__name:"providers",setup(o){const e=y(new S);return(r,t)=>(f(),N(k,{ctx:s(e),"has-tab":!0},{default:n(()=>[s(e).statIsOn?v("",!0):(f(),_("div",V,[c(I,null,{default:n(()=>[p(" 要想查看统计数据，需要先开启统计功能，"),b("a",{href:"/servers/server/settings/stat?serverId="+s(e).serverId},"[点击这里]",8,M),p("修改配置。 ")]),_:1})])),s(e).statIsOn?(f(),_("div",O,[c(E,null,{default:n(()=>[c(L,{cols:"1"},{header:n(()=>[p("运营商排行")]),default:n(()=>[c(z,null,{value:n(()=>[R]),_:1})]),_:1})]),_:1})])):v("",!0)]),_:1},8,["ctx"]))}};export{Z as default};
