"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const clsx = require("clsx");
const FocusTrap = require("../FocusTrap/FocusTrap.cjs");
const Paper = require("../Paper/Paper.cjs");
const Transition = require("../Transition/Transition.cjs");
const ModalBase_context = require("./ModalBase.context.cjs");
const ModalBase_module_css = require("./ModalBase.module.css.cjs");
const ModalBaseContent = React.forwardRef(
  ({ transitionProps, className, innerProps, onKeyDown, style, ...others }, ref) => {
    const ctx = ModalBase_context.useModalBaseContext();
    return /* @__PURE__ */ jsxRuntime.jsx(
      Transition.Transition,
      {
        mounted: ctx.opened,
        transition: "pop",
        ...ctx.transitionProps,
        onExited: () => {
          var _a, _b, _c;
          (_a = ctx.onExitTransitionEnd) == null ? void 0 : _a.call(ctx);
          (_c = (_b = ctx.transitionProps) == null ? void 0 : _b.onExited) == null ? void 0 : _c.call(_b);
        },
        onEntered: () => {
          var _a, _b, _c;
          (_a = ctx.onEnterTransitionEnd) == null ? void 0 : _a.call(ctx);
          (_c = (_b = ctx.transitionProps) == null ? void 0 : _b.onEntered) == null ? void 0 : _c.call(_b);
        },
        ...transitionProps,
        children: (transitionStyles) => /* @__PURE__ */ jsxRuntime.jsx(
          "div",
          {
            ...innerProps,
            className: clsx({ [ModalBase_module_css.default.inner]: !ctx.unstyled }, innerProps.className),
            children: /* @__PURE__ */ jsxRuntime.jsx(FocusTrap.FocusTrap, { active: ctx.opened && ctx.trapFocus, innerRef: ref, children: /* @__PURE__ */ jsxRuntime.jsx(
              Paper.Paper,
              {
                ...others,
                component: "section",
                role: "dialog",
                tabIndex: -1,
                "aria-modal": true,
                "aria-describedby": ctx.bodyMounted ? ctx.getBodyId() : void 0,
                "aria-labelledby": ctx.titleMounted ? ctx.getTitleId() : void 0,
                style: [style, transitionStyles],
                className: clsx({ [ModalBase_module_css.default.content]: !ctx.unstyled }, className),
                unstyled: ctx.unstyled,
                children: others.children
              }
            ) })
          }
        )
      }
    );
  }
);
ModalBaseContent.displayName = "@mantine/core/ModalBaseContent";
exports.ModalBaseContent = ModalBaseContent;
