"use client";
"use client";
import { r as e } from "../../../useRenderElement-CmuWsiNa.js";
import { cn as t } from "../../../lib/utils.js";
import { t as n } from "../../../dist-Ber_p4PA.js";
import { i as r, n as i, t as a } from "../../../tooltip-34vRSwJG.js";
import { t as o } from "../../../button-BNOmhdpM.js";
import { t as s } from "../../../useRender-B4Oazk_w.js";
import { t as c } from "../../../input-CSc-AfAa.js";
import { Separator as l } from "./separator.js";
import { Sheet as u, SheetContent as d, SheetDescription as f, SheetHeader as p, SheetTitle as m } from "./sheet.js";
import { Skeleton as h } from "./skeleton.js";
import { useIsMobile as g } from "../../../hooks/use-mobile.js";
import * as _ from "react";
import { jsx as v, jsxs as y } from "react/jsx-runtime";
import { PanelLeftIcon as b } from "lucide-react";
//#region lib/components/ui/atoms/sidebar.tsx
var x = "sidebar_state", S = 3600 * 24 * 7, C = "16rem", w = "18rem", T = "3rem", E = "b", D = _.createContext(null);
function O() {
	let e = _.useContext(D);
	if (!e) throw Error("useSidebar must be used within a SidebarProvider.");
	return e;
}
function k({ defaultOpen: e = !0, open: n, onOpenChange: r, className: i, style: a, children: o, ...s }) {
	let c = g(), [l, u] = _.useState(!1), [d, f] = _.useState(e), p = n ?? d, m = _.useCallback((e) => {
		let t = typeof e == "function" ? e(p) : e;
		r ? r(t) : f(t), document.cookie = `${x}=${t}; path=/; max-age=${S}`;
	}, [r, p]), h = _.useCallback(() => c ? u((e) => !e) : m((e) => !e), [c, m]);
	_.useEffect(() => {
		let e = (e) => {
			e.key === E && (e.metaKey || e.ctrlKey) && (e.preventDefault(), h());
		};
		return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
	}, [h]);
	let y = p ? "expanded" : "collapsed", b = _.useMemo(() => ({
		state: y,
		open: p,
		setOpen: m,
		isMobile: c,
		openMobile: l,
		setOpenMobile: u,
		toggleSidebar: h
	}), [
		y,
		p,
		m,
		c,
		l,
		h
	]);
	return /* @__PURE__ */ v(D.Provider, {
		value: b,
		children: /* @__PURE__ */ v("div", {
			className: t("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", i),
			"data-slot": "sidebar-wrapper",
			style: {
				"--sidebar-width": C,
				"--sidebar-width-icon": T,
				...a
			},
			...s,
			children: o
		})
	});
}
function A({ side: e = "left", variant: n = "sidebar", collapsible: r = "offcanvas", className: i, children: a, dir: o, ...s }) {
	let { isMobile: c, state: l, openMobile: h, setOpenMobile: g } = O();
	return r === "none" ? /* @__PURE__ */ v("div", {
		className: t("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", i),
		"data-slot": "sidebar",
		...s,
		children: a
	}) : c ? /* @__PURE__ */ v(u, {
		onOpenChange: g,
		open: h,
		...s,
		children: /* @__PURE__ */ y(d, {
			className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
			"data-mobile": "true",
			"data-sidebar": "sidebar",
			"data-slot": "sidebar",
			dir: o,
			side: e,
			style: { "--sidebar-width": w },
			children: [/* @__PURE__ */ y(p, {
				className: "sr-only",
				children: [/* @__PURE__ */ v(m, { children: "Sidebar" }), /* @__PURE__ */ v(f, { children: "Displays the mobile sidebar." })]
			}), /* @__PURE__ */ v("div", {
				className: "flex h-full w-full flex-col",
				children: a
			})]
		})
	}) : /* @__PURE__ */ y("div", {
		className: "group peer hidden text-sidebar-foreground md:block",
		"data-collapsible": l === "collapsed" ? r : "",
		"data-side": e,
		"data-slot": "sidebar",
		"data-state": l,
		"data-variant": n,
		children: [/* @__PURE__ */ v("div", {
			className: t("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", n === "floating" || n === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"),
			"data-slot": "sidebar-gap"
		}), /* @__PURE__ */ v("div", {
			className: t("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=right]:right-0 data-[side=left]:left-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] md:flex", n === "floating" || n === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", i),
			"data-side": e,
			"data-slot": "sidebar-container",
			...s,
			children: /* @__PURE__ */ v("div", {
				className: "flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",
				"data-sidebar": "sidebar",
				"data-slot": "sidebar-inner",
				children: a
			})
		})]
	});
}
function j({ className: e, onClick: n, ...r }) {
	let { toggleSidebar: i } = O();
	return /* @__PURE__ */ y(o, {
		className: t(e),
		"data-sidebar": "trigger",
		"data-slot": "sidebar-trigger",
		onClick: (e) => {
			n?.(e), i();
		},
		size: "icon-sm",
		variant: "ghost",
		...r,
		children: [/* @__PURE__ */ v(b, {}), /* @__PURE__ */ v("span", {
			className: "sr-only",
			children: "Toggle Sidebar"
		})]
	});
}
function M({ className: e, ...n }) {
	let { toggleSidebar: r } = O();
	return /* @__PURE__ */ v("button", {
		"aria-label": "Toggle Sidebar",
		className: t("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:after:left-full", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", e),
		"data-sidebar": "rail",
		"data-slot": "sidebar-rail",
		onClick: r,
		tabIndex: -1,
		title: "Toggle Sidebar",
		...n
	});
}
function N({ className: e, ...n }) {
	return /* @__PURE__ */ v("main", {
		className: t("relative flex w-full min-w-0 flex-1 flex-col bg-background md:peer-data-[variant=inset]:peer-data-collapsed:ml-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm", e),
		"data-slot": "sidebar-inset",
		...n
	});
}
function P({ className: e, ...n }) {
	return /* @__PURE__ */ v(c, {
		className: t("h-8 w-full bg-background shadow-none", e),
		"data-sidebar": "input",
		"data-slot": "sidebar-input",
		...n
	});
}
function F({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("flex flex-col gap-2 p-2", e),
		"data-sidebar": "header",
		"data-slot": "sidebar-header",
		...n
	});
}
function I({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("flex flex-col gap-2 p-2", e),
		"data-sidebar": "footer",
		"data-slot": "sidebar-footer",
		...n
	});
}
function L({ className: e, ...n }) {
	return /* @__PURE__ */ v(l, {
		className: t("mx-2 w-auto bg-sidebar-border", e),
		"data-sidebar": "separator",
		"data-slot": "sidebar-separator",
		...n
	});
}
function R({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden", e),
		"data-sidebar": "content",
		"data-slot": "sidebar-content",
		...n
	});
}
function z({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("relative flex w-full min-w-0 flex-col p-2", e),
		"data-sidebar": "group",
		"data-slot": "sidebar-group",
		...n
	});
}
function B({ className: n, render: r, ...i }) {
	return s({
		defaultTagName: "div",
		props: e({ className: t("flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs outline-hidden ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 [&>svg]:size-4 [&>svg]:shrink-0", n) }, i),
		render: r,
		state: {
			slot: "sidebar-group-label",
			sidebar: "group-label"
		}
	});
}
function V({ className: n, render: r, ...i }) {
	return s({
		defaultTagName: "button",
		props: e({ className: t("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 group-data-[collapsible=icon]:hidden md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", n) }, i),
		render: r,
		state: {
			slot: "sidebar-group-action",
			sidebar: "group-action"
		}
	});
}
function H({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("w-full text-sm", e),
		"data-sidebar": "group-content",
		"data-slot": "sidebar-group-content",
		...n
	});
}
function U({ className: e, ...n }) {
	return /* @__PURE__ */ v("ul", {
		className: t("flex w-full min-w-0 flex-col gap-0", e),
		"data-sidebar": "menu",
		"data-slot": "sidebar-menu",
		...n
	});
}
function W({ className: e, ...n }) {
	return /* @__PURE__ */ v("li", {
		className: t("group/menu-item relative", e),
		"data-sidebar": "menu-item",
		"data-slot": "sidebar-menu-item",
		...n
	});
}
var G = n("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0", {
	variants: {
		variant: {
			default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
			outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
		},
		size: {
			default: "h-8 text-sm",
			sm: "h-7 text-xs",
			lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
		}
	},
	defaultVariants: {
		variant: "default",
		size: "default"
	}
});
function K({ render: n, isActive: o = !1, variant: c = "default", size: l = "default", tooltip: u, className: d, ...f }) {
	let { isMobile: p, state: m } = O(), h = s({
		defaultTagName: "button",
		props: e({ className: t(G({
			variant: c,
			size: l
		}), d) }, f),
		render: u ? /* @__PURE__ */ v(r, { render: n }) : n,
		state: {
			slot: "sidebar-menu-button",
			sidebar: "menu-button",
			size: l,
			active: o
		}
	});
	return u ? (typeof u == "string" && (u = { children: u }), /* @__PURE__ */ y(a, { children: [h, /* @__PURE__ */ v(i, {
		align: "center",
		hidden: m !== "collapsed" || p,
		side: "right",
		...u
	})] })) : h;
}
function q({ className: n, render: r, showOnHover: i = !1, ...a }) {
	return s({
		defaultTagName: "button",
		props: e({ className: t("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0", i && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground md:opacity-0", n) }, a),
		render: r,
		state: {
			slot: "sidebar-menu-action",
			sidebar: "menu-action"
		}
	});
}
function J({ className: e, ...n }) {
	return /* @__PURE__ */ v("div", {
		className: t("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 font-medium text-sidebar-foreground text-xs tabular-nums peer-hover/menu-button:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground", e),
		"data-sidebar": "menu-badge",
		"data-slot": "sidebar-menu-badge",
		...n
	});
}
function Y({ className: e, showIcon: n = !1, ...r }) {
	let [i] = _.useState(() => `${Math.floor(Math.random() * 40) + 50}%`);
	return /* @__PURE__ */ y("div", {
		className: t("flex h-8 items-center gap-2 rounded-md px-2", e),
		"data-sidebar": "menu-skeleton",
		"data-slot": "sidebar-menu-skeleton",
		...r,
		children: [n && /* @__PURE__ */ v(h, {
			className: "size-4 rounded-md",
			"data-sidebar": "menu-skeleton-icon"
		}), /* @__PURE__ */ v(h, {
			className: "h-4 max-w-(--skeleton-width) flex-1",
			"data-sidebar": "menu-skeleton-text",
			style: { "--skeleton-width": i }
		})]
	});
}
function X({ className: e, ...n }) {
	return /* @__PURE__ */ v("ul", {
		className: t("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-sidebar-border border-l px-2.5 py-0.5 group-data-[collapsible=icon]:hidden", e),
		"data-sidebar": "menu-sub",
		"data-slot": "sidebar-menu-sub",
		...n
	});
}
function Z({ className: e, ...n }) {
	return /* @__PURE__ */ v("li", {
		className: t("group/menu-sub-item relative", e),
		"data-sidebar": "menu-sub-item",
		"data-slot": "sidebar-menu-sub-item",
		...n
	});
}
function Q({ render: n, size: r = "md", isActive: i = !1, className: a, ...o }) {
	return s({
		defaultTagName: "a",
		props: e({ className: t("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-active:bg-sidebar-accent data-[size=md]:text-sm data-[size=sm]:text-xs data-active:text-sidebar-accent-foreground group-data-[collapsible=icon]:hidden [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground", a) }, o),
		render: n,
		state: {
			slot: "sidebar-menu-sub-button",
			sidebar: "menu-sub-button",
			size: r,
			active: i
		}
	});
}
//#endregion
export { A as Sidebar, R as SidebarContent, I as SidebarFooter, z as SidebarGroup, V as SidebarGroupAction, H as SidebarGroupContent, B as SidebarGroupLabel, F as SidebarHeader, P as SidebarInput, N as SidebarInset, U as SidebarMenu, q as SidebarMenuAction, J as SidebarMenuBadge, K as SidebarMenuButton, W as SidebarMenuItem, Y as SidebarMenuSkeleton, X as SidebarMenuSub, Q as SidebarMenuSubButton, Z as SidebarMenuSubItem, k as SidebarProvider, M as SidebarRail, L as SidebarSeparator, j as SidebarTrigger, O as useSidebar };
