"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const types = require("../../../utils/types.js");
const index = require("../../../hooks/use-namespace/index.js");
const statistic = require("./statistic.js");
const vue = require("vue");
const shared_esmBundler = require("../../../../../@vue/shared/dist/shared.esm-bundler.js");
var statistic_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  name: "ElStatistic",
  __name: "statistic",
  props: statistic.statisticProps,
  setup(__props, { expose: __expose }) {
    const props = __props;
    const ns = index.useNamespace("statistic");
    const displayValue = vue.computed(() => {
      const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
      if (shared_esmBundler.isFunction(formatter)) return formatter(value);
      if (!types.isNumber(value) || Number.isNaN(value)) return value;
      let [integer, decimal = ""] = String(value).split(".");
      decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
      integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
      return [integer, decimal].join(decimal ? decimalSeparator : "");
    });
    __expose({ displayValue });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(vue.unref(ns).b()) }, [_ctx.$slots.title || __props.title ? (vue.openBlock(), vue.createElementBlock("div", {
        key: 0,
        class: vue.normalizeClass(vue.unref(ns).e("head"))
      }, [vue.renderSlot(_ctx.$slots, "title", {}, () => [vue.createTextVNode(vue.toDisplayString(__props.title), 1)])], 2)) : vue.createCommentVNode("v-if", true), vue.createElementVNode("div", { class: vue.normalizeClass(vue.unref(ns).e("content")) }, [
        _ctx.$slots.prefix || __props.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
          key: 0,
          class: vue.normalizeClass(vue.unref(ns).e("prefix"))
        }, [vue.renderSlot(_ctx.$slots, "prefix", {}, () => [vue.createElementVNode("span", null, vue.toDisplayString(__props.prefix), 1)])], 2)) : vue.createCommentVNode("v-if", true),
        vue.createElementVNode("span", {
          class: vue.normalizeClass(vue.unref(ns).e("number")),
          style: vue.normalizeStyle(__props.valueStyle)
        }, vue.toDisplayString(displayValue.value), 7),
        _ctx.$slots.suffix || __props.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
          key: 1,
          class: vue.normalizeClass(vue.unref(ns).e("suffix"))
        }, [vue.renderSlot(_ctx.$slots, "suffix", {}, () => [vue.createElementVNode("span", null, vue.toDisplayString(__props.suffix), 1)])], 2)) : vue.createCommentVNode("v-if", true)
      ], 2)], 2);
    };
  }
});
exports.default = statistic_vue_vue_type_script_setup_true_lang_default;
