"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const rem = require("../../core/utils/units-converters/rem.cjs");
require("react");
const getDefaultZIndex = require("../../core/utils/get-default-z-index/get-default-z-index.cjs");
const getSize = require("../../core/utils/get-size/get-size.cjs");
const createVarsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
require("clsx");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../core/styles-api/use-styles/use-styles.cjs");
const factory = require("../../core/factory/factory.cjs");
const ModalBase = require("../ModalBase/ModalBase.cjs");
const Modal_context = require("./Modal.context.cjs");
const Modal_module_css = require("./Modal.module.css.cjs");
const defaultProps = {
  __staticSelector: "Modal",
  closeOnClickOutside: true,
  withinPortal: true,
  lockScroll: true,
  trapFocus: true,
  returnFocus: true,
  closeOnEscape: true,
  keepMounted: false,
  zIndex: getDefaultZIndex.getDefaultZIndex("modal"),
  transitionProps: { duration: 200, transition: "fade-down" },
  yOffset: "5dvh"
};
const varsResolver = createVarsResolver.createVarsResolver(
  (_, { radius, size, yOffset, xOffset }) => ({
    root: {
      "--modal-radius": radius === void 0 ? void 0 : getSize.getRadius(radius),
      "--modal-size": getSize.getSize(size, "modal-size"),
      "--modal-y-offset": rem.rem(yOffset),
      "--modal-x-offset": rem.rem(xOffset)
    }
  })
);
const ModalRoot = factory.factory((_props, ref) => {
  const props = useProps.useProps("ModalRoot", defaultProps, _props);
  const {
    classNames,
    className,
    style,
    styles,
    unstyled,
    vars,
    yOffset,
    scrollAreaComponent,
    radius,
    fullScreen,
    centered,
    xOffset,
    __staticSelector,
    ...others
  } = props;
  const getStyles = useStyles.useStyles({
    name: __staticSelector,
    classes: Modal_module_css.default,
    props,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  return /* @__PURE__ */ jsxRuntime.jsx(Modal_context.ModalProvider, { value: { yOffset, scrollAreaComponent, getStyles, fullScreen }, children: /* @__PURE__ */ jsxRuntime.jsx(
    ModalBase.ModalBase,
    {
      ref,
      ...getStyles("root"),
      "data-full-screen": fullScreen || void 0,
      "data-centered": centered || void 0,
      unstyled,
      ...others
    }
  ) });
});
ModalRoot.classes = Modal_module_css.default;
ModalRoot.displayName = "@mantine/core/ModalRoot";
exports.ModalRoot = ModalRoot;
