'use strict';

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

var vue = require('vue');
var classNames = require('../_util/classNames.js');
var LocaleReceiver = require('../locale-provider/LocaleReceiver.js');
var index$1 = require('../_util/props-util/index.js');
var type = require('../_util/type.js');
var context = require('../config-provider/context.js');
var index = require('./style/index.js');
var empty = require('./empty.js');
var simple = require('./simple.js');

const defaultEmptyImg = vue.createVNode(empty.default, null, null);
const simpleEmptyImg = vue.createVNode(simple.default, null, null);
const emptyProps = () => ({
  prefixCls: String,
  imageStyle: type.objectType(),
  image: type.anyType(),
  description: type.anyType()
});
const Empty = /* @__PURE__ */ vue.defineComponent({
  name: "AEmpty",
  compatConfig: {
    MODE: 3
  },
  inheritAttrs: false,
  props: emptyProps(),
  setup(props, {
    slots = {},
    attrs
  }) {
    const configProvider = vue.inject(context.configProviderKey, context.defaultConfigProvider);
    const prefixClsRef = vue.computed(() => configProvider.getPrefixCls("empty", props.prefixCls));
    const direction = vue.computed(() => {
      var _a;
      return (_a = configProvider.direction) == null ? void 0 : _a.value;
    });
    const [wrapSSR, hashId] = index.default(prefixClsRef);
    return () => {
      var _a, _b;
      const prefixCls = prefixClsRef.value;
      const {
        image = ((_a = slots.image) == null ? void 0 : _a.call(slots)) || defaultEmptyImg,
        description = ((_b = slots.description) == null ? void 0 : _b.call(slots)) || void 0,
        imageStyle,
        class: className = "",
        ...restProps
      } = {
        ...props,
        ...attrs
      };
      return wrapSSR(vue.createVNode(LocaleReceiver.default, {
        "componentName": "Empty",
        "children": (locale) => {
          const des = typeof description !== "undefined" ? description : locale.description;
          const alt = typeof des === "string" ? des : "empty";
          let imageNode = null;
          if (typeof image === "string")
            imageNode = vue.createVNode("img", {
              "alt": alt,
              "src": image
            }, null);
          else
            imageNode = image;
          return vue.createVNode("div", vue.mergeProps({
            "class": classNames.default(prefixCls, className, hashId.value, {
              [`${prefixCls}-normal`]: image === simpleEmptyImg,
              [`${prefixCls}-rtl`]: direction.value === "rtl"
            })
          }, restProps), [vue.createVNode("div", {
            "class": `${prefixCls}-image`,
            "style": imageStyle
          }, [imageNode]), des && vue.createVNode("p", {
            "class": `${prefixCls}-description`
          }, [des]), slots.default && vue.createVNode("div", {
            "class": `${prefixCls}-footer`
          }, [index$1.filterEmpty(slots.default())])]);
        }
      }, null));
    };
  }
});
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
var Empty$1 = type.withInstall(Empty);

exports.default = Empty$1;
exports.emptyProps = emptyProps;
//# sourceMappingURL=index.js.map
