'use strict';

var vue = require('vue');
var CloseOutlined = require('@ant-design/icons-vue');
require('../hooks/index.js');
var classNames = require('../_util/classNames.js');
var motionUtil = require('../vc-trigger/utils/motionUtil.js');
require('../vc-notification/index.js');
var index = require('./style/index.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');
var useNotification = require('../vc-notification/useNotification.js');

const DEFAULT_OFFSET = 8;
const DEFAULT_DURATION = 3;
const Holder = /* @__PURE__ */ vue.defineComponent({
  name: "Holder",
  inheritAttrs: false,
  props: ["top", "prefixCls", "getContainer", "maxCount", "duration", "rtl", "transitionName", "onAllRemoved"],
  setup(props, {
    expose
  }) {
    var _a;
    const {
      getPrefixCls,
      getPopupContainer
    } = useConfigInject.default("message", props);
    const prefixCls = vue.computed(() => getPrefixCls("message", props.prefixCls));
    const [, hashId] = index.default(prefixCls);
    const getStyles = () => {
      var _a2;
      const top = (_a2 = props.top) != null ? _a2 : DEFAULT_OFFSET;
      return {
        left: "50%",
        transform: "translateX(-50%)",
        top: typeof top === "number" ? `${top}px` : top
      };
    };
    const getClassName = () => classNames.default(hashId.value, props.rtl ? `${prefixCls.value}-rtl` : "");
    const getNotificationMotion = () => {
      var _a2;
      return motionUtil.getMotion({
        prefixCls: prefixCls.value,
        animation: (_a2 = props.animation) != null ? _a2 : "move-up",
        transitionName: props.transitionName
      });
    };
    const mergedCloseIcon = vue.createVNode("span", {
      "class": `${prefixCls.value}-close-x`
    }, [vue.createVNode(CloseOutlined, {
      "class": `${prefixCls.value}-close-icon`
    }, null)]);
    const [api, holder] = useNotification.default({
      getStyles,
      prefixCls: prefixCls.value,
      getClassName,
      motion: getNotificationMotion,
      closable: false,
      closeIcon: mergedCloseIcon,
      duration: (_a = props.duration) != null ? _a : DEFAULT_DURATION,
      getContainer: () => {
        var _a2, _b;
        return ((_a2 = props.staticGetContainer) == null ? void 0 : _a2.call(props)) || ((_b = getPopupContainer.value) == null ? void 0 : _b.call(getPopupContainer)) || document.body;
      },
      maxCount: props.maxCount,
      onAllRemoved: props.onAllRemoved
    });
    expose({
      ...api,
      prefixCls,
      hashId
    });
    return holder;
  }
});

exports.Holder = Holder;
//# sourceMappingURL=holder.js.map
