'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.cjs');
var index$1 = require('../../skeleton/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index = require('../style/index.cjs');
var Number = require('./Number.cjs');
var props = require('./props.cjs');
var initDefaultProps = require('../../../utils/vue/initDefaultProps.cjs');

var AStatistic = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "AStatistic",
  inheritAttrs: false,
  props: initDefaultProps.initDefaultProps(props.statisticProps(), {
    decimalSeparator: ".",
    groupSeparator: ",",
    loading: false
  }),
  slots: Object,
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject.default("statistic", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    return () => {
      var _a, _b, _c, _d, _e, _f, _g;
      const {
        value = 0,
        valueStyle,
        valueRender
      } = props;
      const pre = prefixCls.value;
      const title = (_b = props.title) != null ? _b : (_a = slots.title) == null ? void 0 : _a.call(slots);
      const prefix = (_d = props.prefix) != null ? _d : (_c = slots.prefix) == null ? void 0 : _c.call(slots);
      const suffix = (_f = props.suffix) != null ? _f : (_e = slots.suffix) == null ? void 0 : _e.call(slots);
      const formatter = (_g = props.formatter) != null ? _g : slots.formatter;
      let valueNode = vue.createVNode(Number.default, {
        "data-for-update": Date.now(),
        ...props,
        prefixCls: pre,
        value,
        formatter
      }, null);
      if (valueRender)
        valueNode = valueRender(valueNode);
      return wrapSSR(vue.createVNode("div", {
        ...attrs,
        "class": [pre, {
          [`${pre}-rtl`]: direction.value === "rtl"
        }, attrs.class, hashId.value]
      }, [title && vue.createVNode("div", {
        "class": `${pre}-title`
      }, [title]), vue.createVNode(index$1.Skeleton, {
        "paragraph": false,
        "loading": props.loading
      }, {
        default: () => [vue.createVNode("div", {
          "style": valueStyle,
          "class": `${pre}-content`
        }, [prefix && vue.createVNode("span", {
          "class": `${pre}-content-prefix`
        }, [prefix]), valueNode, suffix && vue.createVNode("span", {
          "class": `${pre}-content-suffix`
        }, [suffix])])]
      })]));
    };
  }
});

exports.default = AStatistic;
//# sourceMappingURL=Statistic.cjs.map
