import { jsxs as u, jsx as r } from "react/jsx-runtime";
import * as o from "@radix-ui/react-popover";
import { useState as g, useRef as h, useMemo as x, useEffect as C, useCallback as c } from "react";
import { useSidebarContext as M, SidebarContext as P } from "../../context/sidebarContext.js";
import { c as n } from "../../../../index-BtlgVD4m.js";
const T = ({ label: d, menuChildren: p, children: m, className: v }) => {
  const { onCollapsedChange: s } = M(), [f, a] = g(!1), e = h(null), b = x(() => ({ collapsed: !1, onCollapsedChange: s }), [s]);
  C(() => () => {
    e.current && clearTimeout(e.current);
  }, []);
  const i = c(() => {
    e.current && clearTimeout(e.current), e.current = setTimeout(() => a(!0), 200);
  }, []), l = c(() => {
    e.current && clearTimeout(e.current), e.current = setTimeout(() => a(!1), 100);
  }, []);
  return /* @__PURE__ */ u(o.Root, { open: f, onOpenChange: a, children: [
    /* @__PURE__ */ r(o.Trigger, { asChild: !0, children: /* @__PURE__ */ r("div", { onMouseEnter: i, onMouseLeave: l, children: m }) }),
    /* @__PURE__ */ r(o.Portal, { children: /* @__PURE__ */ u(
      o.Content,
      {
        side: "right",
        sideOffset: 8,
        align: "start",
        onMouseEnter: i,
        onMouseLeave: l,
        onOpenAutoFocus: (t) => t.preventDefault(),
        onCloseAutoFocus: (t) => t.preventDefault(),
        className: n(
          "z-50",
          "min-w-[180px]",
          "rounded-[var(--border-radius-lg)]",
          "bg-[var(--base-background)]",
          "p-[var(--spacing-2)]",
          "shadow-[0px_4px_12px_0px_var(--base-shadow-10)]",
          "border",
          "border-[var(--base-border)]",
          "animate-in",
          "fade-in-0",
          "zoom-in-95",
          v
        ),
        children: [
          /* @__PURE__ */ r(
            "div",
            {
              className: n(
                "px-[var(--spacing-2)]",
                "py-[var(--spacing-1)]",
                "font-[number:var(--font-weight-medium)]",
                "text-[length:var(--typography-base-sizes-small-font-size)]",
                "text-[var(--base-foreground)]"
              ),
              children: d
            }
          ),
          /* @__PURE__ */ r(P.Provider, { value: b, children: /* @__PURE__ */ r(
            "ul",
            {
              className: n(
                "flex",
                "flex-col",
                "border-l",
                "border-[var(--base-border)]",
                "ml-[var(--spacing-2)]",
                "mt-[var(--spacing-1)]",
                "pl-[var(--spacing-2)]",
                "py-[var(--spacing-0-5)]"
              ),
              children: p
            }
          ) })
        ]
      }
    ) })
  ] });
};
T.displayName = "SidebarCollapsedPopover";
export {
  T as default
};
//# sourceMappingURL=SidebarCollapsedPopover.js.map
