"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
require("../../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
require("../../../../../store/modules/designStore/designStore.js");
require("../../../../../settings/designSetting.js");
require("../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.js");
const throttle = require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/throttle.js");
require("../../../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.js");
require("../../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.js");
require("../../../../../enums/pageEnum.js");
require("../../../../../router/index.js");
require("../../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.js");
require("../../../../../components/GoSkeleton/index.vue.js");
require("../../../../../components/GoLoading/index.js");
const useChartDataFetch_hook = require("../../../../../hooks/useChartDataFetch.hook.js");
require("../../../../../api/axios.js");
require("../../../../../../node_modules/.pnpm/echarts@5.4.3/node_modules/echarts/index.js");
require("../../../../../store/modules/langStore/langStore.js");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
const Word = require("./code/world/Word.js");
const runtimeCore_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js");
const reactivity_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js");
const _sfc_main = /* @__PURE__ */ runtimeCore_esmBundler.defineComponent({
  __name: "index",
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const chartEditStore$1 = chartEditStore.useChartEditStore();
    const chartRef = reactivity_esmBundler.ref();
    const { w, h } = reactivity_esmBundler.toRefs(props.chartConfig.attr);
    let threeClassInstance;
    const init = () => {
      const dom = chartRef.value;
      if (dom) {
        threeClassInstance = new Word.default({
          dom,
          data: props.chartConfig.option.dataset,
          width: w.value,
          height: h.value
        });
      }
    };
    const updateData = (data) => {
      try {
        threeClassInstance.updateData(data);
      } catch (error) {
        console.log(error);
      }
    };
    runtimeCore_esmBundler.watch(
      () => [w.value, h.value],
      throttle.default(([newWidth], [newHeight]) => {
        threeClassInstance.updateSize(newWidth, newHeight);
      }, 100)
    );
    runtimeCore_esmBundler.watch(
      () => props.chartConfig.option.dataset,
      (newData) => {
        updateData(newData);
      },
      {
        deep: false
      }
    );
    runtimeCore_esmBundler.onMounted(() => {
      try {
        if (navigator.userAgent.indexOf("Chrome") < -1 || navigator.userAgent.indexOf("Edg") < -1) {
          window["$message"].error("三维地图组件仅在【谷歌】浏览器上能正常展示！");
          chartEditStore$1.removeComponentList(void 0, false);
          return;
        }
        init();
      } catch (error) {
        console.log(error);
      }
    });
    useChartDataFetch_hook.useChartDataFetch(props.chartConfig, chartEditStore.useChartEditStore, updateData);
    return (_ctx, _cache) => {
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createElementBlock("div", {
        ref_key: "chartRef",
        ref: chartRef
      }, null, 512);
    };
  }
});
exports.default = _sfc_main;
