// src/theming/useTheme.tsx
import { createContext, useContext, useEffect, useState } from "react";

// src/util/noop.ts
var noop = () => void 0;

// src/theming/useTheme.tsx
import { jsx } from "react/jsx-runtime";
var themes = ["light", "dark"];
var defaultThemeTypeTranslation = {
  en: {
    dark: "Dark",
    light: "Light",
    theme: {
      one: "Theme",
      other: "Themes"
    }
  },
  de: {
    dark: "Dunkel",
    light: "Hell",
    theme: {
      one: "Farbschema",
      other: "Farbschemas"
    }
  }
};
var ThemeUtil = {
  themes,
  translation: defaultThemeTypeTranslation
};
var ThemeContext = createContext({
  theme: "light",
  setTheme: noop
});
var ThemeProvider = ({ children, initialTheme = "light" }) => {
  const [theme, setTheme] = useState(initialTheme);
  useEffect(() => {
    if (theme !== initialTheme) {
      console.warn("ThemeProvider initial state changed: Prefer using useTheme's setTheme instead");
      setTheme(initialTheme);
    }
  }, [initialTheme]);
  useEffect(() => {
    document.documentElement.setAttribute("data-theme", theme);
  }, [theme]);
  return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: { theme, setTheme }, children });
};
var useTheme = () => useContext(ThemeContext);
export {
  ThemeContext,
  ThemeProvider,
  ThemeUtil,
  useTheme
};
//# sourceMappingURL=useTheme.mjs.map