"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[7521],{967521:(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var n=r(751115),a=r(767190),l=r(310581),i=r(263475),c=r(806915),s=r(135944);function u({height:e,width:t,echartOptions:r,formData:u,onContextMenu:o,setDataMask:d,filterState:h,emitCrossFilters:f,refs:v,coltypeMapping:p}){const m=e=>{if(null==e||!e.name||null==e||!e.col)return;const{name:t,col:r}=e,n=Object.values((null==h?void 0:h.selectedValues)||{});let a;return a=n.includes(t)?n.filter((e=>e!==t)):[t],{dataMask:{extraFormData:{filters:a.length?[{col:r,op:"IN",val:a}]:[]},filterState:{value:a.length?a:null,selectedValues:a.length?a:null}},isCurrentValueSelected:n.includes(t)}},N={click:e=>{var t;if(!f||!d)return;e.event.stop();const n=r.series[0].data.find((t=>t.id===e.data.id)),a=null==(t=m(n))?void 0:t.dataMask;a&&d(a)},contextmenu:e=>{if(o){e.event.stop();const t=e.event.event,i=r.series[0].data,s="node"===e.dataType?(t=>{const r=t.find((t=>t.id===e.data.id));if(null!=r&&r.name)return[{col:r.col,op:"==",val:r.name,formattedVal:r.name}]})(i):(t=>{var r,n;const a=null==(r=t.find((t=>t.id===e.data.source)))?void 0:r.name,l=null==(n=t.find((t=>t.id===e.data.target)))?void 0:n.name;if(a&&l)return[{col:u.source,op:"==",val:a,formattedVal:a},{col:u.target,op:"==",val:l,formattedVal:l}]})(i),d=i.find((t=>t.id===e.data.id));o(t.clientX,t.clientY,{drillToDetail:s,crossFilter:m(d),drillBy:d&&{filters:[{col:d.col,op:"==",val:d.name,formattedVal:(0,c.mj)(d.name,{timeFormatter:(0,n.bt)(u.dateFormat),numberFormatter:(0,a.JB)(u.numberFormat),coltype:null==p?void 0:p[(0,l.Z)(d.col)]})}],groupbyFieldName:d.col===u.source?"source":"target"}})}}};return(0,s.tZ)(i.Z,{refs:v,height:e,width:t,echartOptions:r,eventHandlers:N})}},263475:(e,t,r)=>{r.d(t,{Z:()=>H});var n=r(667294),a=r(751995),l=r(768023),i=r(281615),c=r(967021),s=r(358062),u=r(781836),o=r(873463),d=r(216026),h=r(259048),f=r(15746),v=r(126947),p=r(302907),m=r(516049),N=r(541969),g=r(938198),w=r(548785),b=r(557494),k=r(570012),y=r(730322),E=r(655958),F=r(603174),O=r(731281),V=r(210680),Z=r(347106),C=r(693450),M=r(499326),j=r(617813),x=r(129167),D=r(787164),I=r(135944);const R=a.iK.div`
  height: ${({height:e})=>e};
  width: ${({width:e})=>e};
`;function T({width:e,height:t,echartOptions:r,eventHandlers:a,zrEventHandlers:l,selectedValues:c={},refs:s},u){const o=(0,n.useRef)(null);s&&(s.divRef=o);const d=(0,n.useRef)(),h=(0,n.useMemo)((()=>Object.keys(c)||[]),[c]),f=(0,n.useRef)([]);(0,n.useImperativeHandle)(u,(()=>({getEchartInstance:()=>d.current}))),(0,n.useEffect)((()=>{o.current&&(d.current||(d.current=(0,i.S1)(o.current)),Object.entries(a||{}).forEach((([e,t])=>{var r,n;null==(r=d.current)||r.off(e),null==(n=d.current)||n.on(e,t)})),Object.entries(l||{}).forEach((([e,t])=>{var r,n;null==(r=d.current)||r.getZr().off(e),null==(n=d.current)||n.getZr().on(e,t)})),d.current.setOption(r,!0))}),[r,a,l]),(0,n.useEffect)((()=>{d.current&&(d.current.dispatchAction({type:"downplay",dataIndex:f.current.filter((e=>!h.includes(e)))}),h.length&&d.current.dispatchAction({type:"highlight",dataIndex:h}),f.current=h)}),[h]);const v=(0,n.useCallback)((({width:e,height:t})=>{d.current&&d.current.resize({width:e,height:t})}),[]);return(0,n.useEffect)((()=>(v({width:e,height:t}),()=>{var e;return null==(e=d.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{v({width:e,height:t})}),[e,t,v]),(0,I.tZ)(R,{ref:o,height:t,width:e})}(0,l.D)([k.N,c.N,s.N,u.N,o.N,d.N,h.N,f.N,v.N,p.N,m.N,N.N,g.N,w.N,b.N,y.N,E.N,F.N,O.N,V.N,Z.N,C.N,M.N,j.N,x.N,D.T]);const H=(0,n.forwardRef)(T)}}]);
//# sourceMappingURL=ebef8b838c218a09ba2a.chunk.js.map