import { useState as s, useCallback as n, useEffect as a } from "react";
const m = () => {
  const [t, r] = s(!1), l = typeof document < "u" && (document.fullscreenEnabled || document.webkitFullscreenEnabled), c = n(async (e) => {
    if (!document.fullscreenElement)
      try {
        await e.requestFullscreen();
      } catch (o) {
        console.error("Error attempting to enter fullscreen:", o);
      }
  }, []), u = n(async () => {
    if (document.fullscreenElement)
      try {
        await document.exitFullscreen();
      } catch (e) {
        console.error("Error attempting to exit fullscreen:", e);
      }
  }, []);
  return a(() => {
    const e = () => {
      r(!!document.fullscreenElement);
    };
    return document.addEventListener("fullscreenchange", e), () => {
      document.removeEventListener("fullscreenchange", e);
    };
  }, []), { isFullScreen: t, enterFullScreen: c, exitFullScreen: u, isSupported: l };
};
export {
  m as useFullScreen
};
