"use client";
import { getDefaultZIndex } from "../../core/utils/get-default-z-index/get-default-z-index.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { useMantineTheme } from "../../core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { factory } from "../../core/factory/factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import { Overlay } from "../Overlay/Overlay.mjs";
import { Transition } from "../Transition/Transition.mjs";
import { Loader } from "../Loader/Loader.mjs";
import LoadingOverlay_module_default from "./LoadingOverlay.module.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/LoadingOverlay/LoadingOverlay.tsx
const defaultProps = {
	transitionProps: {
		transition: "fade",
		duration: 0
	},
	overlayProps: { backgroundOpacity: .75 },
	zIndex: getDefaultZIndex("overlay")
};
const varsResolver = createVarsResolver((_, { zIndex }) => ({ root: { "--lo-z-index": zIndex?.toString() } }));
const LoadingOverlay = factory((_props) => {
	const props = useProps("LoadingOverlay", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, transitionProps, loaderProps, overlayProps, visible, zIndex, attributes, onEnter, onEntered, onExit, onExited, ...others } = props;
	const theme = useMantineTheme();
	const getStyles = useStyles({
		name: "LoadingOverlay",
		classes: LoadingOverlay_module_default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	const _overlayProps = {
		...defaultProps.overlayProps,
		...overlayProps
	};
	return /* @__PURE__ */ jsx(Transition, {
		transition: "fade",
		...transitionProps,
		mounted: !!visible,
		onEnter,
		onEntered,
		onExit,
		onExited,
		children: (transitionStyles) => /* @__PURE__ */ jsxs(Box, {
			...getStyles("root", { style: transitionStyles }),
			...others,
			children: [
				/* @__PURE__ */ jsx(Loader, {
					unstyled,
					...loaderProps,
					...getStyles("loader", {
						className: loaderProps?.className,
						style: loaderProps?.style
					})
				}),
				/* @__PURE__ */ jsx(Overlay, {
					..._overlayProps,
					...getStyles("overlay", {
						className: _overlayProps?.className,
						style: _overlayProps?.style
					}),
					darkHidden: true,
					unstyled,
					color: overlayProps?.color || theme.white
				}),
				/* @__PURE__ */ jsx(Overlay, {
					..._overlayProps,
					...getStyles("overlay", {
						className: _overlayProps?.className,
						style: _overlayProps?.style
					}),
					lightHidden: true,
					unstyled,
					color: overlayProps?.color || theme.colors.dark[5]
				})
			]
		})
	});
});
LoadingOverlay.classes = LoadingOverlay_module_default;
LoadingOverlay.varsResolver = varsResolver;
LoadingOverlay.displayName = "@mantine/core/LoadingOverlay";
//#endregion
export { LoadingOverlay };

//# sourceMappingURL=LoadingOverlay.mjs.map