import { createVNode, Fragment, mergeProps } from "vue";
import "./styles/notification-provider.scss";
import { filterAlertProps, Alert } from "../alert/alert.mjs";
import { NotificationKey, notification, useNotification, provideNotification } from "../../composables/message/index.mjs";
import { Overlay } from "../overlay/overlay.mjs";
import { SlideRightFadeInExpandTransition } from "../transition/slide-right-fade-in-expand-transition.mjs";
import { defineComponent } from "../../utils/define-component.mjs";
import { useRender } from "../../utils/dist/index.mjs";
const NotificationProvider = defineComponent({
  name: "VeNotificationProvider",
  register(app) {
    app.provide(NotificationKey, notification);
  },
  props: {
    registered: Boolean
  },
  setup(props, {
    slots
  }) {
    const notification2 = props.registered ? useNotification() : provideNotification();
    const {
      items,
      remove
    } = notification2;
    useRender(() => {
      var _a;
      return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots), createVNode(Overlay, {
        "modelValue": items.value.length > 0,
        "scrim": false,
        "scrollStrategy": "none",
        "class": ["ve-notification-provider"]
      }, {
        ...slots,
        default: () => createVNode("ul", null, [items.value.map((item) => {
          const [alertProps] = filterAlertProps(item);
          return createVNode(Alert, mergeProps({
            "key": item.id,
            "tag": "li",
            "appear": true,
            "modelValue": item.modelValue,
            "onUpdate:modelValue": ($event) => item.modelValue = $event,
            "on-after-leave": () => remove(item.id),
            "min-width": "300",
            "transition": {
              component: SlideRightFadeInExpandTransition
            }
          }, alertProps), null);
        })])
      })]);
    });
    return notification2;
  }
});
export {
  NotificationProvider
};
//# sourceMappingURL=notification-provider.mjs.map
