import { createVNode, defineComponent, inject, computed, mergeProps } from 'vue';
import classNames from '../_util/classNames.mjs';
import LocaleReceiver from '../locale-provider/LocaleReceiver.mjs';
import { filterEmpty } from '../_util/props-util/index.mjs';
import { objectType, anyType, withInstall } from '../_util/type.mjs';
import { configProviderKey, defaultConfigProvider } from '../config-provider/context.mjs';
import useStyle from './style/index.mjs';
import Empty$2 from './empty.mjs';
import Simple from './simple.mjs';

const defaultEmptyImg = createVNode(Empty$2, null, null);
const simpleEmptyImg = createVNode(Simple, null, null);
const emptyProps = () => ({
  prefixCls: String,
  imageStyle: objectType(),
  image: anyType(),
  description: anyType()
});
const Empty = /* @__PURE__ */ defineComponent({
  name: "AEmpty",
  compatConfig: {
    MODE: 3
  },
  inheritAttrs: false,
  props: emptyProps(),
  setup(props, {
    slots = {},
    attrs
  }) {
    const configProvider = inject(configProviderKey, defaultConfigProvider);
    const prefixClsRef = computed(() => configProvider.getPrefixCls("empty", props.prefixCls));
    const direction = computed(() => {
      var _a;
      return (_a = configProvider.direction) == null ? void 0 : _a.value;
    });
    const [wrapSSR, hashId] = useStyle(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(createVNode(LocaleReceiver, {
        "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 = createVNode("img", {
              "alt": alt,
              "src": image
            }, null);
          else
            imageNode = image;
          return createVNode("div", mergeProps({
            "class": classNames(prefixCls, className, hashId.value, {
              [`${prefixCls}-normal`]: image === simpleEmptyImg,
              [`${prefixCls}-rtl`]: direction.value === "rtl"
            })
          }, restProps), [createVNode("div", {
            "class": `${prefixCls}-image`,
            "style": imageStyle
          }, [imageNode]), des && createVNode("p", {
            "class": `${prefixCls}-description`
          }, [des]), slots.default && createVNode("div", {
            "class": `${prefixCls}-footer`
          }, [filterEmpty(slots.default())])]);
        }
      }, null));
    };
  }
});
Empty.PRESENTED_IMAGE_DEFAULT = defaultEmptyImg;
Empty.PRESENTED_IMAGE_SIMPLE = simpleEmptyImg;
var Empty$1 = withInstall(Empty);

export { Empty$1 as default, emptyProps };
//# sourceMappingURL=index.mjs.map
