import { j as jsxRuntimeExports } from "../../../../../_virtual/jsx-runtime.js";
import { a as b } from "../../../../sdk/dist/shared/chunk-SY6DZLTC.js";
import "@sinclair/typebox";
import "../../../../sdk/dist/shared/chunk-3YVJ2ELD.js";
import "../../../../sdk/dist/shared/chunk-AFVJZPLS.js";
import "../../../../sdk/dist/shared/chunk-A3GF4PYW.js";
import "../../../../sdk/dist/shared/chunk-W33JMRRN.js";
import { useBrickStyle } from "../hooks/use-brick-style.js";
import TextContent from "../components/TextContent.js";
import { RxHamburgerMenu } from "../../../../../node_modules/.pnpm/react-icons@5.5.0_react@19.1.1/node_modules/react-icons/rx/index.js";
import { tx as D } from "../../../../style-system/dist/twind.js";
import BrickRoot from "../components/BrickRoot.js";
import { useSitemap } from "../../../../../use-page-data.js";
import intersection from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/intersection.js";
import uniqBy from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqBy.js";
function Navbar({ brick, editable }) {
  const classes = useBrickStyle(brick);
  const props = brick.props;
  const pages = useSitemap();
  const navItems = pages.filter((p) => intersection(p.attributes.tags, props.linksTagsFilter ?? []).length > 0).map((p) => ({
    urlOrPageId: p.id,
    label: p.label
  })) ?? [];
  const allItems = uniqBy(
    [...navItems, ...props.staticNavItems ?? []].map((item) => {
      const href = pages.find((p) => p.id === item.urlOrPageId)?.attributes.path ?? item.urlOrPageId;
      return {
        href,
        label: item.label
      };
    }),
    (item) => item.href
  );
  const onClickNav = (e) => {
    if (editable) {
      e.preventDefault();
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    BrickRoot,
    {
      brick,
      editable,
      manifest: b,
      as: "header",
      "data-brick-group": "container",
      "data-no-section-padding": true,
      className: D("flex px-4 brick basis-full h-[60px]", Object.values(classes)),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: D(
            "flex flex-1 items-center justify-between @lg:justify-start",
            props.linksPosition !== "center" && "@lg:gap-4"
          ),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: D("flex items-center gap-3"), "data-brick-group": "brand", "data-brick-menu-offset": "70", children: [
              props.logo?.src && /* @__PURE__ */ jsxRuntimeExports.jsx(
                "img",
                {
                  src: props.logo.src,
                  alt: props.logo.alt ?? "Logo",
                  className: `h-full max-h-[60px] w-auto flex-1`
                }
              ),
              props.brand && !props.hideBrand && /* @__PURE__ */ jsxRuntimeExports.jsx(
                TextContent,
                {
                  as: "h1",
                  propPath: "brand.name",
                  className: D("text-2xl font-bold flex-1"),
                  brickId: brick.id,
                  content: props.brand,
                  rawContent: props.brand,
                  editable,
                  noTextAlign: true,
                  noTextType: true,
                  noTextStrike: true,
                  inline: true
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "nav",
              {
                "data-brick-group": "navigation",
                className: D(
                  "hidden @desktop:flex items-center gap-2",
                  props.linksPosition === "right" && "ml-auto",
                  props.linksPosition === "center" && "mx-auto"
                ),
                children: allItems.map((item, index) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "a",
                    {
                      onClick: onClickNav,
                      href: item.href,
                      className: D("font-semibold py-2 px-4 self-stretch rounded-md", "hover:brightness-125"),
                      children: item.label
                    },
                    index
                  );
                })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { role: "menu", className: "ml-auto @desktop:hidden items-center gap-4", "data-brick-group": "actions", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RxHamburgerMenu, { className: "w-6 h-6" }) })
          ]
        }
      )
    }
  );
}
export {
  Navbar as default
};
//# sourceMappingURL=navbar.js.map
