import { jsx as n, jsxs as S } from "react/jsx-runtime";
import { useFullScreenContext as T } from "../../../contexts/FullScreenContext.js";
import { UIButton as d } from "../../ui/Button.js";
import { FullScreenIcon as m } from "../../icons/FullScreenIcon.js";
import { useToolbarComponentContext as x } from "../../../contexts/ToolbarComponentContext.js";
import { useIconContext as C } from "../../../contexts/IconContext.js";
import { useViewportContext as F } from "../../../contexts/ViewportContext.js";
import { MenuItem as I } from "./MenuItem.js";
import i from "../../ui/RPTooltip.js";
import { useLocalizationContext as h } from "../../../contexts/LocalizationContext.js";
import { useIconToolContext as s } from "../../../contexts/IconToolContext.js";
import { useToolComponentContext as b } from "../../../contexts/ToolComponentContext.js";
const j = () => {
  const { fullScreenIcon: t } = C(), { fullScreenIcon: r } = s();
  return t || r || /* @__PURE__ */ n(m, {});
}, f = ({ children: t, className: r, localeMessages: o }) => /* @__PURE__ */ n(i, { className: r, content: o == null ? void 0 : o.fullScreenTooltip, children: t }), k = ({
  toggleFullScreen: t,
  isSupported: r,
  localeMessages: o
}) => /* @__PURE__ */ n(I, { onClick: t, disabled: !r, children: /* @__PURE__ */ S(f, { className: "rp-menu-item", localeMessages: o, children: [
  /* @__PURE__ */ n("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ n(m, {}) }),
  o == null ? void 0 : o.fullScreenTooltip
] }) }), V = () => {
  const { isFullScreen: t, toggleFullScreen: r, isSupported: o } = T(), { fullscreenTool: l = !0 } = x(), { fullscreenTool: c = !0 } = b(), { isSmallScreen: p } = F(), { localeMessages: e } = h(), u = e == null ? void 0 : e.fullScreenTooltip;
  return !l || !c ? null : p ? /* @__PURE__ */ n(
    k,
    {
      isFullScreen: t,
      toggleFullScreen: r,
      isSupported: o,
      localeMessages: e
    }
  ) : typeof l == "function" ? /* @__PURE__ */ n(i, { content: u, children: /* @__PURE__ */ n(
    l,
    {
      isFullScreen: t,
      toggleFullScreen: r,
      isSupported: o
    }
  ) }) : typeof c == "function" ? /* @__PURE__ */ n(i, { content: u, children: /* @__PURE__ */ n(
    c,
    {
      isFullScreen: t,
      toggleFullScreen: r,
      isSupported: o
    }
  ) }) : /* @__PURE__ */ n(f, { localeMessages: e, children: /* @__PURE__ */ n(
    d,
    {
      disabled: !o,
      onClick: r,
      "aria-label": t ? "Exit full screen" : "Enter full screen",
      children: /* @__PURE__ */ n(j, {})
    }
  ) });
};
export {
  V as FullScreenTool
};
