"use strict";
const React = require("react");
const sideEffects_lib_components_BraidProvider_BraidProvider_cjs = require("../../../../side-effects/lib/components/BraidProvider/BraidProvider.cjs");
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../css/atoms/sprinkles.css.cjs");
const backgroundContext = React.createContext({
  lightMode: "body",
  darkMode: "bodyDark"
});
const BackgroundProvider = backgroundContext.Provider;
const useBackground = () => React.useContext(backgroundContext);
const useBackgroundLightness = (backgroundOverride) => {
  const backgroundFromContext = useBackground();
  const background = backgroundOverride || backgroundFromContext;
  const { backgroundLightness } = sideEffects_lib_components_BraidProvider_BraidProvider_cjs.useBraidTheme();
  const lightnessMap = {
    ...backgroundLightness,
    customDark: "dark",
    customLight: "light"
  };
  return {
    lightMode: lightnessMap[background.lightMode],
    darkMode: lightnessMap[background.darkMode]
  };
};
const useColorContrast = () => {
  const background = useBackground();
  const backgroundLightness = useBackgroundLightness();
  return (map) => styles_lib_css_atoms_sprinkles_css_cjs.mapColorModeValue(
    backgroundLightness,
    (lightness, mode) => typeof map === "function" ? map(lightness, background[mode]) : map[lightness]
  );
};
exports.BackgroundProvider = BackgroundProvider;
exports.useBackground = useBackground;
exports.useBackgroundLightness = useBackgroundLightness;
exports.useColorContrast = useColorContrast;
