import { defineComponent, createVNode } from 'vue';
import '../../../utils/index.mjs';
import { Skeleton } from '../../skeleton/index.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import useStyle from '../style/index.mjs';
import StatisticNumber from './Number.mjs';
import { statisticProps } from './props.mjs';
import { initDefaultProps } from '../../../utils/vue/initDefaultProps.mjs';

var AStatistic = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "AStatistic",
  inheritAttrs: false,
  props: initDefaultProps(statisticProps(), {
    decimalSeparator: ".",
    groupSeparator: ",",
    loading: false
  }),
  slots: Object,
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject("statistic", props);
    const [wrapSSR, hashId] = useStyle(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 = createVNode(StatisticNumber, {
        "data-for-update": Date.now(),
        ...props,
        prefixCls: pre,
        value,
        formatter
      }, null);
      if (valueRender)
        valueNode = valueRender(valueNode);
      return wrapSSR(createVNode("div", {
        ...attrs,
        "class": [pre, {
          [`${pre}-rtl`]: direction.value === "rtl"
        }, attrs.class, hashId.value]
      }, [title && createVNode("div", {
        "class": `${pre}-title`
      }, [title]), createVNode(Skeleton, {
        "paragraph": false,
        "loading": props.loading
      }, {
        default: () => [createVNode("div", {
          "style": valueStyle,
          "class": `${pre}-content`
        }, [prefix && createVNode("span", {
          "class": `${pre}-content-prefix`
        }, [prefix]), valueNode, suffix && createVNode("span", {
          "class": `${pre}-content-suffix`
        }, [suffix])])]
      })]));
    };
  }
});

export { AStatistic as default };
//# sourceMappingURL=Statistic.mjs.map
