import{a1 as C,k as A,aR as R,a0 as S,a as Y}from"./index.17037962789732.js";import"./index.170379627897317.js";import"./index.170379627897336.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897315.js";import"./index.1703796278973301.js";import{i as j}from"./index.1703796278973314.js";import{h as o}from"./moment.1703796278973.js";import{d as z,k as _,m as f,o as v,x as g,z as y,A as B,b as r,a as n,u as k,M as b,t as c,c as M,V}from"./vue.1703796278973.js";import{_ as E}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";const N={class:"card-wrapper"},H={class:"card-header"},J={class:"title"},L={class:"tools"},O=z({__name:"Card",props:{title:{type:String,default:""},chartData:{type:Array,default:()=>[]}},emits:["change"],setup(m,{emit:h}){const u=m,i=_("week"),e=_([o().subtract(1,"week").format("x"),o().format("x")]),x=_(),F=()=>{V(()=>{const t=j(x.value),a=u.chartData.map(s=>s.value&&s.value.toFixed(0)),p={grid:{left:Math.max.apply(null,a.length?a:[0])>1e5?90:50,right:"5%",top:"5%",bottom:"5%"},tooltip:{trigger:"axis",formatter:"{b0}
{a0}: {c0}"},xAxis:{type:"category",data:u.chartData.map(s=>s.x)},yAxis:{type:"value"},series:[{name:"播放数量(人次)",data:a,type:"line",smooth:!0,symbolSize:0,color:"#ADC6FF",areaStyle:{color:{type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:"#ADC6FF"},{offset:1,color:"#FFFFFF"}],global:!1}}}]};t.setOption(p),window.addEventListener("resize",function(){t.resize()})})};return f(()=>u.chartData,t=>{F()},{deep:!0}),f(()=>e.value,t=>{h("change",{time:{start:t[0],end:t[1]}})},{immediate:!0,deep:!0}),f(()=>i.value,t=>{t==="today"&&(e.value[0]=o().startOf("day").format("x")),t==="week"&&(e.value[0]=o().subtract(1,"week").format("x")),t==="month"&&(e.value[0]=o().subtract(1,"month").format("x")),t==="year"&&(e.value[0]=o().subtract(1,"year").format("x")),e.value[1]=o().format("x"),h("change",{time:{start:e.value[0],end:e.value[1]}})}),(t,a)=>{const l=C,p=A,s=R,D=S,w=Y;return v(),g("div",N,[y("div",H,[y("div",J,B(m.title),1),y("div",L,[r(D,null,{default:n(()=>[r(p,{value:k(i),"onUpdate:value":a[0]||(a[0]=d=>b(i)?i.value=d:null),"button-style":"solid"},{default:n(()=>[r(l,{value:"today"},{default:n(()=>[c("今日")]),_:1}),r(l,{value:"week"},{default:n(()=>[c("近一周")]),_:1}),r(l,{value:"month"},{default:n(()=>[c("近一月")]),_:1}),r(l,{value:"year"},{default:n(()=>[c("近一年")]),_:1})]),_:1},8,["value"]),r(s,{format:"YYYY-MM-DD HH:mm:ss",valueFormat:"x",value:k(e),"onUpdate:value":a[1]||(a[1]=d=>b(e)?e.value=d:null)},null,8,["value"])]),_:1})])]),m.chartData.length?(v(),g("div",{key:0,class:"chart",ref_key:"chartRef",ref:x},null,512)):(v(),M(w,{key:1,class:"no-data",description:"暂无数据"}))])}}});const st=E(O,[["__scopeId","data-v-75f41adc"]]);export{st as default};