"use client";
import { jsx } from "react/jsx-runtime";
import { useColorMode } from "./use-color-mode.js";
const colorModeScript = `(function() {
  try {
    var cookie = document.cookie.match(/color-mode=([^;]*)/) || document.cookie.match(/theme=([^;]*)/);
    var stored = cookie ? JSON.parse(decodeURIComponent(cookie[1])) : null;
    var preference = stored ? stored.preference : 'system';
    var mode = preference === 'system'
      ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
      : preference;
    if (mode === 'dark') {
      document.documentElement.classList.add('dark');
    } else {
      document.documentElement.classList.remove('dark');
    }
    document.documentElement.style.colorScheme = mode;
  } catch (e) {
    document.documentElement.classList.remove('dark');
    document.documentElement.style.colorScheme = 'light';
  }
})();`;
function ColorModeInitializer() {
  useColorMode();
  return /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: colorModeScript } });
}
export {
  ColorModeInitializer
};
//# sourceMappingURL=color-mode-initializer.js.map
