import { defineComponent, useCssVars, unref, reactive, toRefs, watch, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, toDisplayString, createVNode } from "vue";
import { NStatistic, NNumberAnimation } from "naive-ui";
import "./index.vue_vue_type_style_index_0_scoped_true_lang.mjs";
import _export_sfc from "../../../../_virtual/plugin-vue_export-helper.mjs";
const __default__ = defineComponent({ name: "ENumber" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    useCssVars((_ctx) => ({
      "6969d365": `${unref(w)}px`,
      "689672d6": `${unref(h)}px`
    }));
    const option = reactive({
      from: 0,
      dataset: 0
    });
    const { w, h } = toRefs(props.chartConfig.attr);
    let {
      dur,
      showSeparator,
      prefixText,
      prefixColor,
      suffixText,
      suffixColor,
      precision,
      numberSize,
      numberColor
    } = toRefs(props.chartConfig.option);
    watch(
      () => props.chartConfig.option.from,
      () => {
        option.from = props.chartConfig.option.from;
      },
      { immediate: true }
    );
    watch(
      () => props.chartConfig.option.dataset,
      () => {
        option.dataset = props.chartConfig.option.dataset;
      },
      {
        immediate: true,
        deep: false
      }
    );
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(NStatistic), {
        "tabular-nums": "",
        class: "go-decorates-number"
      }, {
        prefix: withCtx(() => [
          createElementVNode("span", {
            style: normalizeStyle(`color:${unref(prefixColor)};font-size:${unref(numberSize)}px`)
          }, toDisplayString(unref(prefixText)), 5)
        ]),
        suffix: withCtx(() => [
          createElementVNode("span", {
            style: normalizeStyle(`color:${unref(suffixColor)};font-size:${unref(numberSize)}px`)
          }, toDisplayString(unref(suffixText)), 5)
        ]),
        default: withCtx(() => [
          createElementVNode("span", {
            style: normalizeStyle(`color:${unref(numberColor)};font-size:${unref(numberSize)}px`)
          }, [
            createVNode(unref(NNumberAnimation), {
              from: option.from,
              to: option.dataset,
              duration: unref(dur) * 1e3,
              "show-separator": unref(showSeparator),
              precision: unref(precision)
            }, null, 8, ["from", "to", "duration", "show-separator", "precision"])
          ], 4)
        ]),
        _: 1
      });
    };
  }
});
var _ENumber = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7d3cbda6"]]);
export { _ENumber as default };
