'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const React = require('react');

function _interopNamespaceCompat(e) {
  if (e && typeof e === 'object' && 'default' in e) return e;
  const n = Object.create(null);
  if (e) {
    for (const k in e) {
      n[k] = e[k];
    }
  }
  n.default = e;
  return n;
}

const React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);

const useTheme = () => {
  const [isDarkMode, setIsDarkMode] = React__namespace.useState(false);
  React__namespace.useEffect(() => {
    const darkModeMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
    setIsDarkMode(darkModeMediaQuery.matches);
    const handleChange = (e) => {
      const newDarkMode = e.matches;
      setIsDarkMode(newDarkMode);
    };
    darkModeMediaQuery.addEventListener("change", handleChange);
    return () => {
      darkModeMediaQuery.removeEventListener("change", handleChange);
    };
  }, []);
  return isDarkMode;
};

exports.default = useTheme;
exports.useTheme = useTheme;
