"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
require("clsx");
const Mantine_context = require("../../core/MantineProvider/Mantine.context.cjs");
const factory = require("../../core/factory/factory.cjs");
const Portal = require("./Portal.cjs");
const OptionalPortal = factory.factory(
  ({ withinPortal = true, children, ...others }, ref) => {
    const env = Mantine_context.useMantineEnv();
    if (env === "test" || !withinPortal) {
      return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
    }
    return /* @__PURE__ */ jsxRuntime.jsx(Portal.Portal, { ref, ...others, children });
  }
);
OptionalPortal.displayName = "@mantine/core/OptionalPortal";
exports.OptionalPortal = OptionalPortal;
