import { cn } from "../../lib/utils.js";
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "../ui/breadcrumb.js";
import { c } from "react/compiler-runtime";
import { jsx, jsxs } from "react/jsx-runtime";
import { useNavigate } from "react-router-dom";
import { ChevronRight } from "lucide-react";
var PageBreadcrumbs_default = (p) => {
	let m = c(15), { breadcrumbData: h, className: g } = p, _ = useNavigate(), v;
	m[0] === _ ? v = m[1] : (v = (e, d) => {
		e.preventDefault(), _(d);
	}, m[0] = _, m[1] = v);
	let y = v, b;
	m[2] === g ? b = m[3] : (b = cn("ml-3 mb-2", g), m[2] = g, m[3] = b);
	let x;
	if (m[4] !== h || m[5] !== y) {
		let e;
		m[7] !== h.length || m[8] !== y ? (e = (e, d) => {
			let f = d === h.length - 1;
			return /* @__PURE__ */ jsxs("div", {
				className: "contents",
				children: [/* @__PURE__ */ jsx(BreadcrumbItem, { children: f || e.current ? /* @__PURE__ */ jsxs(BreadcrumbPage, {
					className: "flex items-center gap-2",
					children: [e.icon, e.label]
				}) : /* @__PURE__ */ jsxs(BreadcrumbLink, {
					href: e.href,
					onClick: (d) => e.href && y(d, e.href),
					className: "flex items-center gap-2",
					children: [e.icon, e.label]
				}) }), !f && /* @__PURE__ */ jsx(BreadcrumbSeparator, { children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) })]
			}, d);
		}, m[7] = h.length, m[8] = y, m[9] = e) : e = m[9], x = h.map(e), m[4] = h, m[5] = y, m[6] = x;
	} else x = m[6];
	let S;
	m[10] === x ? S = m[11] : (S = /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, { children: x }) }), m[10] = x, m[11] = S);
	let C;
	return m[12] !== b || m[13] !== S ? (C = /* @__PURE__ */ jsx("div", {
		className: b,
		children: S
	}), m[12] = b, m[13] = S, m[14] = C) : C = m[14], C;
};
export { PageBreadcrumbs_default as default };
