import { defineComponent, computed, createVNode } from 'vue';
import '../../../utils/index.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import '../../message/index.mjs';
import '../../modal/index.mjs';
import '../../notification/index.mjs';
import useStyle from '../style/index.mjs';
import { useInjectAppContext, useInjectAppConfigContext, useProvideAppConfigContext, useProvideAppContext } from './context.mjs';
import { appProps } from './props.mjs';
import { initDefaultProps } from '../../../utils/vue/initDefaultProps.mjs';
import { classNames } from '../../../utils/dom/class.mjs';
import useMessage from '../../message/src/useMessage.mjs';
import useNotification from '../../notification/src/useNotification.mjs';
import useModal from '../../modal/src/useModal/index.mjs';

function useApp() {
  return useInjectAppContext();
}
var AApp = /* @__PURE__ */ defineComponent({
  name: "AApp",
  useApp,
  props: initDefaultProps(appProps(), {}),
  setup(props, {
    slots
  }) {
    const {
      prefixCls
    } = useConfigInject("app", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const customClassName = computed(() => {
      return classNames(hashId.value, prefixCls.value, props.rootClassName);
    });
    const appConfig = useInjectAppConfigContext();
    const mergedAppConfig = computed(() => ({
      message: {
        ...appConfig.message,
        ...props.message
      },
      notification: {
        ...appConfig.notification,
        ...props.notification
      }
    }));
    useProvideAppConfigContext(mergedAppConfig.value);
    const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.value.message);
    const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.value.notification);
    const [ModalApi, ModalContextHolder] = useModal();
    const memoizedContextValue = computed(() => ({
      message: messageApi,
      notification: notificationApi,
      modal: ModalApi
    }));
    useProvideAppContext(memoizedContextValue.value);
    return () => {
      var _a;
      return wrapSSR(createVNode("div", {
        "class": customClassName.value
      }, [ModalContextHolder(), messageContextHolder(), notificationContextHolder(), (_a = slots.default) == null ? void 0 : _a.call(slots)]));
    };
  }
});

export { AApp as default };
//# sourceMappingURL=App.mjs.map
