"use client";
import { rem } from "../../core/utils/units-converters/rem.mjs";
import { getDefaultZIndex } from "../../core/utils/get-default-z-index/get-default-z-index.mjs";
import { getRadius, getSize } from "../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.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 { ScrollArea } from "../ScrollArea/ScrollArea.mjs";
import { ModalBase } from "../ModalBase/ModalBase.mjs";
import { ModalProvider } from "./Modal.context.mjs";
import Modal_module_default from "./Modal.module.mjs";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Modal/ModalRoot.tsx
const defaultProps = {
	__staticSelector: "Modal",
	closeOnClickOutside: true,
	withinPortal: true,
	lockScroll: true,
	trapFocus: true,
	returnFocus: true,
	closeOnEscape: true,
	keepMounted: false,
	zIndex: getDefaultZIndex("modal"),
	transitionProps: {
		duration: 200,
		transition: "fade-down"
	},
	yOffset: "5dvh"
};
const varsResolver = createVarsResolver((_, { radius, size, yOffset, xOffset }) => ({ root: {
	"--modal-radius": radius === void 0 ? void 0 : getRadius(radius),
	"--modal-size": getSize(size, "modal-size"),
	"--modal-y-offset": rem(yOffset),
	"--modal-x-offset": rem(xOffset)
} }));
const ModalRoot = factory((_props) => {
	const props = useProps("ModalRoot", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, yOffset, scrollAreaComponent, radius, fullScreen, centered, xOffset, __staticSelector, attributes, ...others } = props;
	const getStyles = useStyles({
		name: __staticSelector,
		classes: Modal_module_default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	return /* @__PURE__ */ jsx(ModalProvider, {
		value: {
			yOffset,
			scrollAreaComponent,
			getStyles,
			fullScreen
		},
		children: /* @__PURE__ */ jsx(ModalBase, {
			...getStyles("root"),
			"data-full-screen": fullScreen || void 0,
			"data-centered": centered || void 0,
			"data-offset-scrollbars": scrollAreaComponent === ScrollArea.Autosize || void 0,
			unstyled,
			...others
		})
	});
});
ModalRoot.classes = Modal_module_default;
ModalRoot.varsResolver = varsResolver;
ModalRoot.displayName = "@mantine/core/ModalRoot";
//#endregion
export { ModalRoot };

//# sourceMappingURL=ModalRoot.mjs.map