'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var SingleNumber = require('./SingleNumber.cjs');
var props = require('./props.cjs');
var _class = require('../../../utils/dom/class.cjs');
var props$1 = require('../../../utils/vue/props.cjs');
var vnode = require('../../../utils/vue/vnode.cjs');

var ScrollNumber = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ScrollNumber",
  inheritAttrs: false,
  props: props.scrollNumberProps(),
  setup(props, {
    attrs,
    slots
  }) {
    const {
      prefixCls
    } = useConfigInject.default("scroll-number", props);
    return () => {
      var _a;
      const {
        count,
        title,
        component: Tag = "sup",
        class: className,
        style,
        ...restProps
      } = {
        ...props,
        ...attrs
      };
      const newProps = {
        ...restProps,
        style,
        "data-show": props.show,
        "class": _class.classNames(prefixCls.value, className),
        "title": title
      };
      let numberNodes = count;
      if (count && Number(count) % 1 === 0) {
        const numberList = String(count).split("");
        numberNodes = numberList.map((num, i) => {
          return vue.createVNode(SingleNumber.default, {
            "prefixCls": prefixCls.value,
            "count": Number(count),
            "value": num,
            "key": numberList.length - i
          }, null);
        });
      }
      if (style && style.borderColor) {
        newProps.style = {
          ...style,
          boxShadow: `0 0 0 1px ${style.borderColor} inset`
        };
      }
      const children = props$1.filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));
      if (children && children.length) {
        return vnode.cloneElement(children, {
          class: _class.classNames(`${prefixCls.value}-custom-component`)
        }, false);
      }
      return vue.createVNode(Tag, newProps, {
        default: () => [numberNodes]
      });
    };
  }
});

exports.default = ScrollNumber;
//# sourceMappingURL=ScrollNumber.cjs.map
