'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 index = require('../style/index.cjs');
var constant = require('./constant.cjs');
var props = require('./props.cjs');
var _class = require('../../../utils/dom/class.cjs');

const ExceptionStatus = Object.keys(constant.ExceptionMap);
var AResult = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "AResult",
  inheritAttrs: false,
  props: props.resultProps(),
  PRESENTED_IMAGE_403: constant.ExceptionMap[403],
  PRESENTED_IMAGE_404: constant.ExceptionMap[404],
  PRESENTED_IMAGE_500: constant.ExceptionMap[500],
  slots: Object,
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject.default("result", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const className = vue.computed(() => _class.classNames(prefixCls.value, hashId.value, `${prefixCls.value}-${props.status}`, {
      [`${prefixCls.value}-rtl`]: direction.value === "rtl"
    }));
    const renderIcon = (prefixCls2, {
      status,
      icon
    }) => {
      if (ExceptionStatus.includes(`${status}`)) {
        const SVGComponent = constant.ExceptionMap[status];
        return vue.createVNode("div", {
          "class": `${prefixCls2}-icon ${prefixCls2}-image`
        }, [vue.createVNode(SVGComponent, null, null)]);
      }
      const IconComponent = constant.IconMap[status];
      const iconNode = icon || vue.createVNode(IconComponent, null, null);
      return vue.createVNode("div", {
        "class": `${prefixCls2}-icon`
      }, [iconNode]);
    };
    const renderExtra = (prefixCls2, extra) => extra && vue.createVNode("div", {
      "class": `${prefixCls2}-extra`
    }, [extra]);
    return () => {
      var _a, _b, _c, _d, _e, _f, _g, _h;
      const title = (_b = props.title) != null ? _b : (_a = slots.title) == null ? void 0 : _a.call(slots);
      const subTitle = (_d = props.subTitle) != null ? _d : (_c = slots.subTitle) == null ? void 0 : _c.call(slots);
      const icon = (_f = props.icon) != null ? _f : (_e = slots.icon) == null ? void 0 : _e.call(slots);
      const extra = (_h = props.extra) != null ? _h : (_g = slots.extra) == null ? void 0 : _g.call(slots);
      const pre = prefixCls.value;
      return wrapSSR(vue.createVNode("div", {
        ...attrs,
        "class": [className.value, attrs.class]
      }, [renderIcon(pre, {
        status: props.status,
        icon
      }), vue.createVNode("div", {
        "class": `${pre}-title`
      }, [title]), subTitle && vue.createVNode("div", {
        "class": `${pre}-subtitle`
      }, [subTitle]), renderExtra(pre, extra), slots.default && vue.createVNode("div", {
        "class": `${pre}-content`
      }, [slots.default()])]));
    };
  }
});

exports.default = AResult;
//# sourceMappingURL=Result.cjs.map
