import{d as x}from"./debounce-Xd493GvO.js";import{r as q}from"./request-CEvu378m.js";import{ar as S}from"./echarts-DB130vfq.js";import{ax as A,r as w,s as D,c,j as K,w as g,S as j,B as k,z}from"./vue-BJk78QHK.js";import"./index-M_JNBppB.js";import"./element-3_pOinej.js";import"./utils-YI6ye1sf.js";import"./threejs-BafxXW5-.js";import"./vxe-Dx3zSILm.js";const H=Object.assign({name:"Bar1"},{__name:"Bar1",props:{propValue:{type:Object,required:!0},request:{type:Object,default:()=>{}},element:{type:Object,default:()=>{}}},setup(O){const e=O,p=A(),y=w(null),a=D(null),o=w(null),d=c(()=>e.propValue.data.data),b=c(()=>e.propValue.data.color),m=c(()=>e.propValue.data.max),V=c(()=>{const r=e.element.style.width,l=e.element.style.height;return{width:r,height:l}}),f=c(()=>{const r=[...d.value].reverse(),l=r.map(i=>i.name),h=r.map(i=>i.value),n=Array.from({length:d.value.length}).fill(m.value-.5),s=Array.from({length:d.value.length}).fill(m.value),t=JSON.parse(JSON.stringify(e.propValue.option));t.yAxis[0].data=l,t.xAxis[0].max=m.value,t.series[0].data=h,t.series[1].data=n,t.series[2].data=s,t.series[3].data=Array.from({length:d.value.length}).fill(0);const u=i=>{const B=b.value.length;return b.value[i.dataIndex%B]};return t.series[0].itemStyle.color=u,t.series[2].itemStyle.color=u,t.series[3].itemStyle.color=u,t});function _(){a.value&&a.value.dispose(),a.value=S(y.value),a.value.setOption(f.value)}function v(){a.value&&a.value.resize()}return K(()=>{var r,l;e.request&&(o.value=q(e.request,e.propValue,"data")),((l=(r=e.request)==null?void 0:r.global)==null?void 0:l.length)>0&&g(()=>p.state.globalKey,()=>{e.request.global.forEach(h=>{const n=p.state.globalKey.findIndex(s=>s.globalKey===h);if(n>-1){const s=[p.state.globalKey[n].globalKey,p.state.globalKey[n].globalValue],t=e.request.data.findIndex(u=>u[0]===s[0]);t>-1?e.request.data[t][1]=s[1]:e.request.data.push(s)}}),o.value(),o.value=q(e.request,e.propValue,"data")},{deep:!0}),_(),window.addEventListener("resize",v)}),j(()=>{window.removeEventListener("resize",v),e.propValue.request&&o.value&&o.value(),a.value&&(a.value.dispose(),a.value=null)}),g(()=>f,x(()=>{a.value&&a.value.setOption(f.value,!0)},300),{deep:!0}),g(V,x(()=>{v()},300),{deep:!0}),(r,l)=>(z(),k("div",{ref_key:"chartRef",ref:y,style:{width:"100%",height:"100%"}},null,512))}});export{H as default};
