import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, normalizeStyle, withCtx } from "vue";
import { NGradientText, NNumberAnimation } from "naive-ui";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "refConfig_number",
  props: {
    config: {
      type: Object,
      required: true
    },
    showImg: {
      type: Boolean,
      default: () => true
    }
  },
  setup(__props) {
    const props = __props;
    const precision = computed(() => {
      let text = props.config.text;
      if (typeof text == "number") {
        let textArr = text.toString().split(".");
        if (textArr.length > 1)
          return textArr[1].length;
      }
      return 0;
    });
    let style = computed(() => {
      let a = props.config;
      let showshade = a.showshade;
      return {
        color: showshade ? null : a.color,
        fontSize: a.fontSize + "px",
        fontWeight: a.fontWeight,
        position: "relative",
        left: a.positionLeft ? a.positionLeft + "px" : null,
        top: a.positionTop ? a.positionTop + "px" : null
      };
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", null, [
        createVNode(unref(NGradientText), {
          gradient: __props.config.gradient || {},
          style: normalizeStyle({ ...unref(style) })
        }, {
          default: withCtx(() => [
            createVNode(unref(NNumberAnimation), {
              to: __props.config.text,
              precision: unref(precision),
              showSeparator: __props.config.showSeparator || false
            }, null, 8, ["to", "precision", "showSeparator"])
          ]),
          _: 1
        }, 8, ["gradient", "style"])
      ]);
    };
  }
});
export { _sfc_main as default };
