"use client";
import { j as o } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import { createPolymorphicComponent as P, Menu as h } from "@mantine/core";
import e from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import "react";
import { ReactComponent as y } from "../../assets/images/DownArrow.svg.mjs";
import n from "./NavItem.module.scss.mjs";
function E({
  title: p,
  selected: g,
  icon: I,
  alertNumber: w,
  collapsed: t,
  classNames: r,
  component: A,
  secondaryTag: s,
  subLinks: i,
  subLinksCollapsed: c = !1,
  setSubLinksCollapsed: d,
  key: D,
  ...N
}) {
  let l = "";
  w ? l = w.toString() : s && (l = s);
  const m = {};
  m[n.collapsed] = !!t;
  const M = A || "button", x = {};
  x[n.selected] = !!g;
  const a = {};
  a[n.hide] = l === "", a[n.secondary] = !!s;
  let u = null;
  const j = i && i.length > 0;
  if (j) {
    const f = {};
    f[n.subMenuCollapsed] = c, u = /* @__PURE__ */ o.jsx(
      "button",
      {
        className: e(n.submenuCollapseIcon, f),
        onClick: (C) => {
          d == null || d(!c), C.preventDefault(), C.stopPropagation();
        },
        children: /* @__PURE__ */ o.jsx(y, {})
      }
    );
  }
  const v = t && j;
  return /* @__PURE__ */ o.jsxs(
    h,
    {
      trigger: v ? "hover" : void 0,
      position: "right",
      withArrow: !0,
      arrowPosition: "center",
      classNames: { dropdown: n.menuDropdown, arrow: n.menuArrow },
      unstyled: !0,
      disabled: !v,
      children: [
        /* @__PURE__ */ o.jsx(h.Target, { children: /* @__PURE__ */ o.jsxs("div", { className: n.root, children: [
          /* @__PURE__ */ o.jsxs(
            M,
            {
              className: e(
                "menu-item",
                n.link,
                x,
                r == null ? void 0 : r.link
              ),
              ...N,
              children: [
                I,
                /* @__PURE__ */ o.jsx("div", { className: e(n.linkTitle, m), children: p }),
                /* @__PURE__ */ o.jsx(
                  "div",
                  {
                    className: e(
                      n.alertIconContainer,
                      m,
                      r == null ? void 0 : r.alertIconContainer
                    ),
                    children: /* @__PURE__ */ o.jsx(
                      "div",
                      {
                        className: e(
                          "caption",
                          n.alertContainer,
                          a
                        ),
                        children: l
                      }
                    )
                  }
                ),
                t ? null : u
              ]
            }
          ),
          c || t ? null : /* @__PURE__ */ o.jsx("div", { className: n.sublinksContainer, children: i })
        ] }, D) }),
        /* @__PURE__ */ o.jsxs(h.Dropdown, { children: [
          /* @__PURE__ */ o.jsx("div", { className: e("menu-item", n.dropdownTitle), children: p }),
          /* @__PURE__ */ o.jsx("div", { className: n.dropdownSublinksContainer, children: i })
        ] })
      ]
    }
  );
}
const z = P(E);
export {
  z as NavItem
};
//# sourceMappingURL=index.mjs.map
