{"ast":null,"code":"var __jsx = React.createElement;\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport React, { useEffect, useMemo } from 'react';\nimport { position, primaryColor, size } from '~/utils/style';\nimport GridLoader from 'react-spinners/GridLoader';\nimport styled from 'styled-components';\nimport useECharts from '~/hooks/useECharts';\nconst Wrapper = styled.div.withConfig({\n  displayName: \"ScatterChart__Wrapper\",\n  componentId: \"sc-1g9e1vm-0\"\n})([\"position:relative;> .echarts{height:100%;}> .loading{\", \" \", \" display:flex;justify-content:center;align-items:center;}\"], position('absolute', 0, null, null, 0), size('100%'));\nconst SYMBOL_SIZE = 12;\nconst options2D = {\n  xAxis: {},\n  yAxis: {},\n  toolbox: {\n    show: true,\n    showTitle: false,\n    itemSize: 0,\n    feature: {\n      dataZoom: {},\n      restore: {},\n      saveAsImage: {}\n    }\n  }\n};\nconst options3D = {\n  grid3D: {},\n  xAxis3D: {},\n  yAxis3D: {},\n  zAxis3D: {}\n};\nconst series2D = {\n  symbolSize: SYMBOL_SIZE,\n  type: 'scatter'\n};\nconst series3D = {\n  symbolSize: SYMBOL_SIZE,\n  type: 'scatter3D'\n};\n\nconst ScatterChart = ({\n  data,\n  loading,\n  gl,\n  className\n}) => {\n  const {\n    ref,\n    echart\n  } = useECharts({\n    loading,\n    gl\n  });\n  const chartOptions = useMemo(() => {\n    var _data$map;\n\n    return _objectSpread({}, gl ? options3D : options2D, {\n      series: (_data$map = data === null || data === void 0 ? void 0 : data.map(series => _objectSpread({}, gl ? series3D : series2D, {}, series))) !== null && _data$map !== void 0 ? _data$map : []\n    });\n  }, [gl, data]);\n  useEffect(() => {\n    if (false) {\n      var _echart$current;\n\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      echart === null || echart === void 0 ? void 0 : (_echart$current = echart.current) === null || _echart$current === void 0 ? void 0 : _echart$current.setOption(chartOptions, {\n        notMerge: true\n      });\n    }\n  }, [chartOptions, echart]);\n  return __jsx(Wrapper, {\n    className: className\n  }, !echart && __jsx(\"div\", {\n    className: \"loading\"\n  }, __jsx(GridLoader, {\n    color: primaryColor,\n    size: \"10px\"\n  })), __jsx(\"div\", {\n    className: \"echarts\",\n    ref: ref\n  }));\n};\n\nexport default ScatterChart;","map":null,"metadata":{},"sourceType":"module"}