import { jsxs as n, jsx as e } from "react/jsx-runtime";
import g, { forwardRef as B, useRef as H, useImperativeHandle as S, useCallback as E } from "react";
import { isEmpty as m } from "es-toolkit/compat";
import W from "../../utils/classNames.js";
import j from "./AppMenu.js";
import b from "./ApplicationActionBar.js";
import F from "./MobileSubmoduleNavigation.js";
import k from "./MobileAppMenu.js";
import z from "../../hooks/useResizeObserver.js";
import { NavItems as D } from "./NavItems.js";
const O = 768, X = B((R, M) => {
  const {
    homeRoute: c = "",
    showHomeIcon: l = !0,
    label: o,
    className: p,
    appNavigator: d,
    appNavigatorClassName: A,
    appMenuItems: f,
    navItems: a,
    actionBarItems: t = [],
    onToggleAppMenu: u = () => {
    },
    ...I
  } = R, h = H(null), [i, w] = z(), s = w?.contentRect;
  S(M, () => i, [i]);
  const v = E(
    (y) => {
      if (s) {
        const N = s[y];
        return typeof N == "number" && Math.round(N);
      }
    },
    [s]
  )("width") || window.innerWidth, r = v <= O, x = !m(t), C = W(
    "ApplicationHeader",
    "user-select-none",
    r && "mobile",
    p && p
  );
  return /* @__PURE__ */ n("nav", { ...I, className: C, ref: i, children: [
    r && /* @__PURE__ */ n(g.Fragment, { children: [
      /* @__PURE__ */ e(
        k,
        {
          showHomeIcon: l,
          homeRoute: c,
          appMenuItems: f,
          appNavigator: d,
          onToggleAppMenu: u
        }
      ),
      /* @__PURE__ */ n("div", { className: "flex-1-1-0 display-flex gap-10", children: [
        /* @__PURE__ */ e(F, { className: "flex-1-1", label: o, navItems: a }),
        x && /* @__PURE__ */ e(P, {}),
        /* @__PURE__ */ e(b, { className: "mobile", nodeRef: h, items: t })
      ] })
    ] }),
    !r && /* @__PURE__ */ n(g.Fragment, { children: [
      /* @__PURE__ */ e("div", { className: "navbar-header", children: /* @__PURE__ */ e("span", { className: `navbar-brand ${l ? "home-icon" : ""}`, children: c }) }),
      o && /* @__PURE__ */ e(
        j,
        {
          label: o,
          appMenuItems: f,
          appNavigator: d,
          appNavigatorClassName: A,
          onToggleAppMenu: u
        },
        "AppMenu"
      ),
      m(a) && /* @__PURE__ */ e("ul", { className: "SubmoduleNavigation nav" }),
      !m(a) && /* @__PURE__ */ e(
        D,
        {
          navItems: a,
          containerWidth: v,
          actionBarItems: t
        },
        "NavItems"
      ),
      /* @__PURE__ */ e(b, { nodeRef: h, items: t })
    ] })
  ] });
}), P = () => /* @__PURE__ */ e("div", { className: "divider display-flex align-items-center", children: /* @__PURE__ */ e("div", { className: "width-3 height-20 bg-lighter" }) });
export {
  X as ApplicationHeader,
  X as default
};
//# sourceMappingURL=ApplicationHeader.js.map
