"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),o=require("lodash"),O=require("../../commons/core/datasource/index.js"),w=require("../../commons/core/useChart.js"),f=require("../../commons/utils/parseDataset.js"),g=require("../../commons/utils/cloneSeries.js"),q={class:"zerov-widget"},x=["id"],S=c.defineComponent({name:"zv-chart-other-radar"}),k=c.defineComponent({...S,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["chart-click","chart-dblclick","chart-mousedown","chart-mouseover","chart-mouseout","chart-contextmenu"],setup(m,{expose:b,emit:E}){const e=m,_=E,{id:v,setOption:h,chart:D,renderChart:u,renderData:i}=w.useChart({basicOption:o.cloneDeep(e.basicOption),useEvents:o.cloneDeep(e.useEvents),customRenderData:s=>{s=o.cloneDeep(s),O.SHJDatasourceV2.parse({tId:e.uuid,sources:e.sources,callback:({data:a})=>{try{let d=function(t){return t.reduce((r,n)=>r.includes(n)?r:[...r,n],[])};window.SHJParseEvent(e.useEvents,"dataListener",a),s.dataset=f.parseDataset(o.cloneDeep(a)),s.series=g.cloneSeries(a,s.series);const l=[],p=[];s.dataset.source.forEach(t=>{for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const n=t[r];Number(n)&&(p.push(Number(n)),l.push(r))}}),s.radar.indicator=[],d(l).forEach(t=>{s.radar.indicator.push({text:t,max:2e3})}),s.radar.indicator.forEach(t=>{t.max=p.sort((r,n)=>n-r)[0]}),s.dataset=f.parseDataset(o.cloneDeep(a),d(l)),h(s)}catch{window.SHJParseEvent(e.useEvents,"dataListener",null),h(s)}}})},emit:_});return c.watch(()=>e.sources,()=>{e.sources&&e.sources.length>0&&i(e.basicOption)},{deep:!0}),c.watch(()=>o.cloneDeep(e.basicOption),(s,a)=>{o.isEqual(s,a)||u(s)},{deep:!0}),b({getEchartsInstance:()=>D.value,refresh:()=>{e.sources&&e.sources.length>0&&u(e.basicOption),i(e.basicOption)},refreshView:()=>{e.sources&&e.sources.length>0&&u(e.basicOption)},refreshData:()=>{i(e.basicOption)}}),(s,a)=>(c.openBlock(),c.createElementBlock("div",q,[c.createElementVNode("div",{id:c.unref(v),class:"widget"},null,8,x)]))}});exports.default=k;
