"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[2580],{62580:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s}),r(67294);var n=r(63475),c=r(11965);function s(e){const{height:t,width:r,echartOptions:s,refs:u,onLegendStateChanged:l}=e,h={legendselectchanged:e=>{null==l||l(e.selected)},legendselectall:e=>{null==l||l(e.selected)},legendinverseselect:e=>{null==l||l(e.selected)}};return(0,c.tZ)(n.Z,{refs:u,height:t,width:r,echartOptions:s,eventHandlers:h})}},63475:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),c=r(51995),s=r(31431),u=r(11965);const l=c.iK.div`
  height: ${e=>{let{height:t}=e;return t}};
  width: ${e=>{let{width:t}=e;return t}};
`;function h(e,t){let{width:r,height:c,echartOptions:h,eventHandlers:i,zrEventHandlers:d,selectedValues:a={},refs:o}=e;const f=(0,n.useRef)(null);o&&(o.divRef=f);const g=(0,n.useRef)(),p=(0,n.useMemo)((()=>Object.keys(a)||[]),[a]),w=(0,n.useRef)([]);(0,n.useImperativeHandle)(t,(()=>({getEchartInstance:()=>g.current}))),(0,n.useEffect)((()=>{f.current&&(g.current||(g.current=(0,s.S1)(f.current)),Object.entries(i||{}).forEach((e=>{var t,r;let[n,c]=e;null==(t=g.current)||t.off(n),null==(r=g.current)||r.on(n,c)})),Object.entries(d||{}).forEach((e=>{var t,r;let[n,c]=e;null==(t=g.current)||t.getZr().off(n),null==(r=g.current)||r.getZr().on(n,c)})),g.current.setOption(h,!0))}),[h,i,d]),(0,n.useEffect)((()=>{g.current&&(g.current.dispatchAction({type:"downplay",dataIndex:w.current.filter((e=>!p.includes(e)))}),p.length&&g.current.dispatchAction({type:"highlight",dataIndex:p}),w.current=p)}),[p]);const v=(0,n.useCallback)((e=>{let{width:t,height:r}=e;g.current&&g.current.resize({width:t,height:r})}),[]);return(0,n.useEffect)((()=>(v({width:r,height:c}),()=>{var e;return null==(e=g.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{v({width:r,height:c})}),[r,c,v]),(0,u.tZ)(l,{ref:f,height:c,width:r})}const i=(0,n.forwardRef)(h)}}]);
//# sourceMappingURL=4c1599a194b3d4787f35.chunk.js.map