"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");
const chartEditStore = require("../../../../../store/modules/chartEditStore/chartEditStore.js");
require("../../../../../store/modules/designStore/designStore.js");
require("../../../../../settings/designSetting.js");
require("../../../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
require("../../../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.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 index = require("../../../../../components/Pages/Flipper/index.vue.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 runtimeDom_esmBundler = require("../../../../../../node_modules/.pnpm/@vue_runtime-dom@3.3.4/node_modules/@vue/runtime-dom/dist/runtime-dom.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;
    runtimeDom_esmBundler.useCssVars((_ctx) => ({
      "0aa6998a": `${reactivity_esmBundler.unref(w)}px`,
      "09d338fb": `${reactivity_esmBundler.unref(h)}px`
    }));
    const { w, h } = reactivity_esmBundler.toRefs(props.chartConfig.attr);
    const {
      flipperLength,
      flipperBgColor,
      flipperTextColor,
      flipperWidth,
      flipperHeight,
      flipperRadius,
      flipperGap,
      flipperType,
      flipperSpeed,
      flipperBorderWidth
    } = reactivity_esmBundler.toRefs(props.chartConfig.option);
    const flipperData = reactivity_esmBundler.ref([]);
    const getFlipperData = (val) => {
      return val.toString().padStart(flipperLength.value, "0").split("").slice(flipperLength.value * -1);
    };
    const updateDatasetHandler = (newVal) => {
      flipperData.value = getFlipperData(newVal);
    };
    runtimeCore_esmBundler.watch(
      () => props.chartConfig.option,
      (newVal) => {
        try {
          updateDatasetHandler(newVal.dataset);
        } catch (error) {
          console.log(error);
        }
      },
      {
        immediate: true,
        deep: true
      }
    );
    useChartDataFetch_hook.useChartDataFetch(props.chartConfig, chartEditStore.useChartEditStore, (newVal) => {
      updateDatasetHandler(newVal);
    });
    return (_ctx, _cache) => {
      const _component_n_space = runtimeCore_esmBundler.resolveComponent("n-space");
      return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(_component_n_space, {
        class: "go-decorates-flipper-number",
        size: reactivity_esmBundler.unref(flipperGap),
        align: "center",
        justify: "center"
      }, {
        default: runtimeCore_esmBundler.withCtx(() => [
          (runtimeCore_esmBundler.openBlock(true), runtimeCore_esmBundler.createElementBlock(runtimeCore_esmBundler.Fragment, null, runtimeCore_esmBundler.renderList(flipperData.value, (item, index$1) => {
            return runtimeCore_esmBundler.openBlock(), runtimeCore_esmBundler.createBlock(reactivity_esmBundler.unref(index.default), {
              count: item,
              width: reactivity_esmBundler.unref(flipperWidth),
              height: reactivity_esmBundler.unref(flipperHeight),
              "front-color": reactivity_esmBundler.unref(flipperTextColor),
              "back-color": reactivity_esmBundler.unref(flipperBgColor),
              radius: reactivity_esmBundler.unref(flipperRadius),
              "flip-type": reactivity_esmBundler.unref(flipperType),
              duration: reactivity_esmBundler.unref(flipperSpeed),
              "border-width": reactivity_esmBundler.unref(flipperBorderWidth),
              key: index$1,
              class: "go-d-block"
            }, null, 8, ["count", "width", "height", "front-color", "back-color", "radius", "flip-type", "duration", "border-width"]);
          }), 128))
        ]),
        _: 1
      }, 8, ["size"]);
    };
  }
});
exports.default = _sfc_main;
