import { jsx as g, jsxs as w } from "react/jsx-runtime";
import { aS as v, aT as b, aU as M, B as T, aV as E, aW as S, aX as N, y as _, aY as D, aZ as F, a_ as I, a$ as B, b0 as G, b1 as O, b2 as U, b3 as P, aD as q, b4 as H, b5 as x, b6 as R, J as Y, b7 as $, b8 as K } from "./use-page-data.BYLN5MSa.js";
import { b as Z } from "./use-section-style.CqWLdjop.js";
import { T as y } from "./TextContent.i83ueo1A.js";
import { a as d } from "./twind.Cg2g8xBZ.js";
import { B as J } from "./BrickRoot.CQgjTuOI.js";
import { g as W } from "./get.D6Ij4kC_.js";
function X(n, e, r, t) {
  for (var s = n.length, l = r + -1; ++l < s; )
    if (e(n[l], l, n))
      return l;
  return -1;
}
function z(n) {
  return n !== n;
}
function Q(n, e, r) {
  for (var t = r - 1, s = n.length; ++t < s; )
    if (n[t] === e)
      return t;
  return -1;
}
function V(n, e, r) {
  return e === e ? Q(n, e, r) : X(n, z, r);
}
function k(n, e) {
  var r = n == null ? 0 : n.length;
  return !!r && V(n, e, 0) > -1;
}
var j = Math.min;
function nn(n, e, r) {
  for (var t = k, s = n[0].length, l = n.length, a = l, u = Array(l), i = 1 / 0, o = []; a--; ) {
    var f = n[a];
    i = j(f.length, i), u[a] = s >= 120 && f.length >= 120 ? new v(a && f) : void 0;
  }
  f = n[0];
  var h = -1, c = u[0];
  n:
    for (; ++h < s && o.length < i; ) {
      var m = f[h], p = m;
      if (m = m !== 0 ? m : 0, !(c ? b(c, p) : t(o, p))) {
        for (a = l; --a; ) {
          var A = u[a];
          if (!(A ? b(A, p) : t(n[a], p)))
            continue n;
        }
        c && c.push(p), o.push(m);
      }
    }
  return o;
}
function en(n) {
  return M(n) ? n : [];
}
var tn = T(function(n) {
  var e = E(n, en);
  return e.length && e[0] === n[0] ? nn(e) : [];
}), rn = 1, sn = 2;
function an(n, e, r, t) {
  var s = r.length, l = s;
  if (n == null)
    return !l;
  for (n = Object(n); s--; ) {
    var a = r[s];
    if (a[2] ? a[1] !== n[a[0]] : !(a[0] in n))
      return !1;
  }
  for (; ++s < l; ) {
    a = r[s];
    var u = a[0], i = n[u], o = a[1];
    if (a[2]) {
      if (i === void 0 && !(u in n))
        return !1;
    } else {
      var f = new S(), h;
      if (!(h === void 0 ? N(o, i, rn | sn, t, f) : h))
        return !1;
    }
  }
  return !0;
}
function L(n) {
  return n === n && !_(n);
}
function ln(n) {
  for (var e = D(n), r = e.length; r--; ) {
    var t = e[r], s = n[t];
    e[r] = [t, s, L(s)];
  }
  return e;
}
function C(n, e) {
  return function(r) {
    return r == null ? !1 : r[n] === e && (e !== void 0 || n in Object(r));
  };
}
function fn(n) {
  var e = ln(n);
  return e.length == 1 && e[0][2] ? C(e[0][0], e[0][1]) : function(r) {
    return r === n || an(r, n, e);
  };
}
function un(n, e) {
  return n != null && e in Object(n);
}
function on(n, e, r) {
  e = F(e, n);
  for (var t = -1, s = e.length, l = !1; ++t < s; ) {
    var a = I(e[t]);
    if (!(l = n != null && r(n, a)))
      break;
    n = n[a];
  }
  return l || ++t != s ? l : (s = n == null ? 0 : n.length, !!s && B(s) && G(a, s) && (O(n) || U(n)));
}
function hn(n, e) {
  return n != null && on(n, e, un);
}
var cn = 1, gn = 2;
function dn(n, e) {
  return P(n) && L(e) ? C(I(n), e) : function(r) {
    var t = W(r, n);
    return t === void 0 && t === e ? hn(r, n) : N(e, t, cn | gn);
  };
}
function mn(n) {
  return function(e) {
    return e?.[n];
  };
}
function pn(n) {
  return function(e) {
    return q(e, n);
  };
}
function xn(n) {
  return P(n) ? mn(I(n)) : pn(n);
}
function bn(n) {
  return typeof n == "function" ? n : n == null ? H : typeof n == "object" ? O(n) ? dn(n[0], n[1]) : fn(n) : xn(n);
}
function In() {
}
var An = 1 / 0, wn = x && 1 / R(new x([, -0]))[1] == An ? function(n) {
  return new x(n);
} : In, vn = 200;
function Nn(n, e, r) {
  var t = -1, s = k, l = n.length, a = !0, u = [], i = u;
  if (l >= vn) {
    var o = e ? null : wn(n);
    if (o)
      return R(o);
    a = !1, s = b, i = new v();
  } else
    i = e ? [] : u;
  n:
    for (; ++t < l; ) {
      var f = n[t], h = e ? e(f) : f;
      if (f = f !== 0 ? f : 0, a && h === h) {
        for (var c = i.length; c--; )
          if (i[c] === h)
            continue n;
        e && i.push(h), u.push(f);
      } else s(i, h, r) || (i !== u && i.push(h), u.push(f));
    }
  return u;
}
function On(n, e) {
  return n && n.length ? Nn(n, bn(e)) : [];
}
function En({ brick: n, editable: e }) {
  const r = Z(n), t = n.props, s = Y(), l = s.filter((i) => tn(i.tags, t.linksTagsFilter ?? []).length > 0).map((i) => ({
    urlOrPageId: i.id,
    label: i.label
  })) ?? [], a = On(
    [...l, ...t.staticNavItems ?? []].map((i) => ({
      href: s.find((f) => f.id === i.urlOrPageId)?.path ?? i.urlOrPageId,
      label: i.label
    })),
    (i) => i.href
  ), u = (i) => {
    e && i.preventDefault();
  };
  return /* @__PURE__ */ g(
    J,
    {
      brick: n,
      editable: e,
      manifest: $,
      as: "header",
      "data-brick-group": "container",
      "data-no-section-padding": !0,
      className: d("flex px-4 brick basis-full h-[60px]", Object.values(r)),
      children: /* @__PURE__ */ w(
        "div",
        {
          className: d(
            "flex flex-1 items-center justify-between @lg:justify-start",
            t.linksPosition !== "center" && "@lg:gap-4"
          ),
          children: [
            /* @__PURE__ */ w("div", { className: d("flex items-center gap-3"), "data-brick-group": "brand", "data-brick-menu-offset": "70", children: [
              t.logo?.src && /* @__PURE__ */ g(
                "img",
                {
                  src: t.logo.src,
                  alt: t.logo.alt ?? "Logo",
                  className: "h-full max-h-[60px] w-auto flex-1"
                }
              ),
              t.brand && !t.hideBrand && /* @__PURE__ */ g(
                y,
                {
                  as: "h1",
                  propPath: "brand.name",
                  className: d("text-2xl font-bold flex-1"),
                  brickId: n.id,
                  content: t.brand,
                  rawContent: t.brand,
                  editable: e,
                  noTextAlign: !0,
                  noTextType: !0,
                  noTextStrike: !0,
                  inline: !0
                }
              )
            ] }),
            /* @__PURE__ */ g(
              "nav",
              {
                "data-brick-group": "navigation",
                className: d(
                  "hidden @desktop:flex items-center gap-2",
                  t.linksPosition === "right" && "ml-auto",
                  t.linksPosition === "center" && "mx-auto"
                ),
                children: a.map((i, o) => /* @__PURE__ */ g(
                  "a",
                  {
                    onClick: u,
                    href: i.href,
                    className: d("font-semibold py-2 px-4 self-stretch rounded-md", "hover:brightness-125"),
                    children: i.label
                  },
                  o
                ))
              }
            ),
            /* @__PURE__ */ g("div", { role: "menu", className: "ml-auto @desktop:hidden items-center gap-4", "data-brick-group": "actions", children: /* @__PURE__ */ g(K, { className: "w-6 h-6" }) })
          ]
        }
      )
    }
  );
}
export {
  En as default
};
