"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const localStorageManager = require("./color-scheme-managers/local-storage-manager.cjs");
const Mantine_context = require("./Mantine.context.cjs");
const MantineClasses = require("./MantineClasses/MantineClasses.cjs");
const MantineCssVariables = require("./MantineCssVariables/MantineCssVariables.cjs");
require("react");
const MantineThemeProvider = require("./MantineThemeProvider/MantineThemeProvider.cjs");
const suppressNextjsWarning = require("./suppress-nextjs-warning.cjs");
const useProviderColorScheme = require("./use-mantine-color-scheme/use-provider-color-scheme.cjs");
const useRespectReduceMotion = require("./use-respect-reduce-motion/use-respect-reduce-motion.cjs");
suppressNextjsWarning.suppressNextjsWarning();
function MantineProvider({
  theme,
  children,
  getStyleNonce,
  withStaticClasses = true,
  withGlobalClasses = true,
  deduplicateCssVariables = true,
  withCssVariables = true,
  cssVariablesSelector = ":root",
  classNamesPrefix = "mantine",
  colorSchemeManager = localStorageManager.localStorageColorSchemeManager(),
  defaultColorScheme = "light",
  getRootElement = () => document.documentElement,
  cssVariablesResolver,
  forceColorScheme,
  stylesTransform
}) {
  const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme.useProviderColorScheme({
    defaultColorScheme,
    forceColorScheme,
    manager: colorSchemeManager,
    getRootElement
  });
  useRespectReduceMotion.useRespectReduceMotion({
    respectReducedMotion: (theme == null ? void 0 : theme.respectReducedMotion) || false,
    getRootElement
  });
  return /* @__PURE__ */ jsxRuntime.jsx(
    Mantine_context.MantineContext.Provider,
    {
      value: {
        colorScheme,
        setColorScheme,
        clearColorScheme,
        getRootElement,
        classNamesPrefix,
        getStyleNonce,
        cssVariablesResolver,
        cssVariablesSelector,
        withStaticClasses,
        stylesTransform
      },
      children: /* @__PURE__ */ jsxRuntime.jsxs(MantineThemeProvider.MantineThemeProvider, { theme, children: [
        withCssVariables && /* @__PURE__ */ jsxRuntime.jsx(
          MantineCssVariables.MantineCssVariables,
          {
            cssVariablesSelector,
            deduplicateCssVariables
          }
        ),
        withGlobalClasses && /* @__PURE__ */ jsxRuntime.jsx(MantineClasses.MantineClasses, {}),
        children
      ] })
    }
  );
}
MantineProvider.displayName = "@mantine/core/MantineProvider";
exports.MantineProvider = MantineProvider;
