import { cn as e } from "../../../lib/utils.js";
import { t } from "../../../button-BNOmhdpM.js";
import { o as n, r, t as i } from "../../../avatar-BSYWkGGc.js";
import { h as a, o, r as s, t as c, u as l } from "../../../dropdown-menu-DCFuLDwH.js";
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
import { ChevronsUpDownIcon as p } from "lucide-react";
//#region lib/components/ui/molecules/user-nav.tsx
function m(e) {
	return e.split(" ").filter(Boolean).map((e) => e[0]).join("").slice(0, 2).toUpperCase();
}
var h = {
	sm: "size-9",
	lg: "size-10"
};
function g({ name: t, avatarUrl: a, avatarSize: o, avatarClassName: s, badge: c, secondaryContent: l, hideDetails: p = !1 }) {
	let g = m(t) || "U";
	return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
		className: "relative shrink-0",
		children: [/* @__PURE__ */ f(i, {
			className: e(h[o], "rounded-lg"),
			children: [a && /* @__PURE__ */ d(n, {
				alt: t,
				src: a
			}), /* @__PURE__ */ d(r, {
				className: e("rounded-lg bg-purple-600 font-semibold text-white text-xs", s),
				children: g
			})]
		}), c]
	}), /* @__PURE__ */ f("div", {
		className: e("flex min-w-0 flex-1 flex-col items-start gap-px text-left leading-tight", p && "hidden"),
		children: [/* @__PURE__ */ d("span", {
			className: "w-full truncate font-semibold text-foreground text-sm",
			children: t
		}), l]
	})] });
}
function _({ name: n, email: r, avatarUrl: i, avatarSize: u = "sm", avatarClassName: m, badge: h, menuBadge: _, secondary: v, menuSecondary: y, compact: b = !1, children: x, dropdownSide: S = "top", dropdownAlign: C = "end", className: w }) {
	let T = n ?? "User", E = null;
	v === void 0 ? r && (E = /* @__PURE__ */ d("span", {
		className: "w-full truncate text-muted-foreground text-xs",
		children: r
	})) : E = v;
	let D = y === void 0 ? E : y;
	return x ? /* @__PURE__ */ f(c, { children: [/* @__PURE__ */ f(a, {
		render: /* @__PURE__ */ d(t, {
			"aria-label": `${T} menu`,
			className: e("h-auto w-full cursor-pointer justify-start gap-3 overflow-visible rounded-lg px-1.5 py-2 transition-colors", "hover:bg-accent hover:text-accent-foreground", "data-open:bg-accent data-open:text-accent-foreground", b && "size-10 justify-center px-0", w),
			variant: "ghost"
		}),
		children: [/* @__PURE__ */ d(g, {
			avatarClassName: m,
			avatarSize: u,
			avatarUrl: i,
			badge: h,
			hideDetails: b,
			name: T,
			secondaryContent: E
		}), !b && /* @__PURE__ */ d(p, { className: "ml-auto size-4 shrink-0 text-muted-foreground" })]
	}), /* @__PURE__ */ f(s, {
		align: C,
		className: "w-(--anchor-width) min-w-56",
		side: S,
		sideOffset: 4,
		children: [
			/* @__PURE__ */ d(o, {
				className: "p-0 font-normal",
				children: /* @__PURE__ */ d("div", {
					className: "flex items-center gap-3 px-3 py-2.5",
					children: /* @__PURE__ */ d(g, {
						avatarClassName: m,
						avatarSize: u,
						avatarUrl: i,
						badge: _ ?? h,
						name: T,
						secondaryContent: D
					})
				})
			}),
			/* @__PURE__ */ d(l, {}),
			x
		]
	})] }) : /* @__PURE__ */ d("div", {
		className: e("flex w-full items-center gap-3 rounded-lg px-1.5 py-2", w),
		children: /* @__PURE__ */ d(g, {
			avatarClassName: m,
			avatarSize: u,
			avatarUrl: i,
			badge: h,
			hideDetails: b,
			name: T,
			secondaryContent: E
		})
	});
}
//#endregion
export { _ as UserNav };
