"use client";
import { jsx as n, jsxs as l, Fragment as U } from "react/jsx-runtime";
import * as s from "react";
import { r as W } from "./resolve-variant-gw6eh7fa4st8ej7m.js";
import { u as H } from "./link-provider-mn2voeohon7cj9o4.js";
import { u as J } from "./portal-provider-hwmkdmkpvct0cb76.js";
import { CheckIcon as f, CaretRightIcon as Q } from "@phosphor-icons/react";
import { c as r } from "./vendor-styling-ofvnbcuht98q88oo.js";
import { aD as q, aE as B, aF as X, aG as Y, aH as M, S as N, aI as y, aJ as Z, aK as $, aL as v, aM as ee, aN as te, aO as D, aP as ae, aQ as oe, aR as R, aS as k } from "./vendor-base-ui-elpbzr8xeffrz4h2.js";
const ne = {
  variant: {
    default: {
      classes: "",
      description: "Default dropdown item appearance"
    },
    danger: {
      classes: "text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger",
      description: "Destructive action item"
    }
  }
}, w = {
  variant: "default"
};
function I({
  variant: e = w.variant
} = {}) {
  return r(
    W(
      ne.variant,
      e,
      w.variant
    ).classes
  );
}
const S = s.forwardRef(({ className: e, inset: t, children: a, icon: o, ...i }, u) => /* @__PURE__ */ l(
  R,
  {
    ref: u,
    "data-kumo-component": "DropdownMenu",
    "data-kumo-part": "submenu-trigger",
    className: r(
      "flex cursor-default items-center rounded-sm text-base outline-hidden select-none",
      // base styles
      "px-2 py-1.5",
      // spacing
      "focus:bg-kumo-tint focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand",
      // focus state
      "data-[state=open]:bg-kumo-tint",
      // open state
      t && "pl-8",
      // conditional inset
      e
    ),
    ...i,
    children: [
      o && /* @__PURE__ */ n(o, { className: "mr-2 h-4 w-4" }),
      a,
      /* @__PURE__ */ n(Q, { className: "ml-auto h-4 w-4" })
    ]
  }
));
S.displayName = R.displayName;
const x = s.forwardRef(
  ({ className: e, sideOffset: t = 8, children: a, container: o, ...i }, u) => {
    const d = J();
    return /* @__PURE__ */ n(M, { container: o ?? d ?? void 0, children: /* @__PURE__ */ n(
      ae,
      {
        ref: u,
        sideOffset: t,
        ...i,
        children: /* @__PURE__ */ n(
          oe,
          {
            className: r(
              "overflow-hidden bg-kumo-control text-kumo-default",
              // background
              "max-h-[var(--available-height)] overflow-y-auto",
              // limit height when list is too long and might go off screen
              "rounded-lg shadow-lg ring ring-kumo-line",
              // border part
              "min-w-36 p-1.5",
              // spacing
              "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
              // open animation
              "data-[side=bottom]:slide-in-from-top-2",
              // bottom side animation
              "data-[side=left]:slide-in-from-right-2",
              // left side animation
              "data-[side=right]:slide-in-from-left-2",
              // right side animation
              "data-[side=top]:slide-in-from-bottom-2",
              // top side animation
              "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
              // close animation
              e
            ),
            children: a
          }
        )
      }
    ) });
  }
), g = (e) => e ? s.isValidElement(e) ? e : /* @__PURE__ */ n(e, { className: "mr-2 h-4 w-4" }) : null, C = s.forwardRef(
  ({
    className: e,
    inset: t,
    icon: a,
    children: o,
    selected: i,
    render: u,
    href: d,
    variant: m = "default",
    ...A
  }, j) => {
    const h = H(), c = s.useMemo(
      () => /* @__PURE__ */ l(U, { children: [
        a && g(a),
        o,
        i && /* @__PURE__ */ n("span", { className: "inline-flex", children: /* @__PURE__ */ n(f, {}) })
      ] }),
      [a, o, i]
    ), z = s.useMemo(() => {
      if (!d) return;
      const K = /^(https?:)?\/\//.test(d), b = r(
        "flex items-center",
        m === "danger" && "text-kumo-danger data-highlighted:bg-kumo-danger/5 data-highlighted:text-kumo-danger"
      );
      return K ? /* @__PURE__ */ n(
        "a",
        {
          className: r(b, "w-full text-inherit! no-underline!"),
          href: d,
          target: "_blank",
          rel: "noreferrer",
          onClick: (p) => p.stopPropagation(),
          children: c
        }
      ) : /* @__PURE__ */ n(
        h,
        {
          className: r(b, "w-full text-inherit! no-underline!"),
          href: d,
          to: d,
          onClick: (p) => p.stopPropagation(),
          children: c
        }
      );
    }, [d, c, m, h]), F = d || u;
    return /* @__PURE__ */ n(
      D,
      {
        ref: j,
        "data-kumo-component": "DropdownMenu",
        "data-kumo-part": "item",
        className: r(
          "relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay",
          t && "pl-8",
          I({ variant: m }),
          e
        ),
        render: d ? z : u,
        ...A,
        children: F ? void 0 : c
      }
    );
  }
);
C.displayName = D.displayName;
const L = s.forwardRef(
  ({
    className: e,
    inset: t,
    icon: a,
    children: o,
    variant: i = "default",
    ...u
  }, d) => /* @__PURE__ */ l(
    te,
    {
      ref: d,
      "data-kumo-component": "DropdownMenu",
      "data-kumo-part": "link-item",
      className: r(
        "relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none",
        "focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-overlay",
        "text-inherit no-underline",
        t && "pl-8",
        I({ variant: i }),
        e
      ),
      ...u,
      children: [
        a && g(a),
        o
      ]
    }
  )
);
L.displayName = "DropdownMenuLinkItem";
const P = s.forwardRef(({ className: e, children: t, checked: a, ...o }, i) => /* @__PURE__ */ l(
  v,
  {
    ref: i,
    "data-kumo-component": "DropdownMenu",
    "data-kumo-part": "checkbox-item",
    className: r(
      "relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-base outline-hidden transition-colors select-none focus:bg-kumo-tint focus:text-kumo-default focus:ring-kumo-focus/50 focus-visible:ring-2 focus-visible:ring-kumo-brand data-disabled:pointer-events-none data-disabled:opacity-50",
      e
    ),
    checked: a,
    ...o,
    children: [
      /* @__PURE__ */ n(ee, { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center text-inherit", children: /* @__PURE__ */ n(f, { weight: "bold", size: 12 }) }),
      t
    ]
  }
));
P.displayName = v.displayName;
const T = s.forwardRef(({ className: e, inset: t, ...a }, o) => /* @__PURE__ */ n(
  y,
  {
    ref: o,
    className: r(
      "px-2 py-1.5 text-base font-semibold",
      t && "pl-8",
      e
    ),
    ...a
  }
));
T.displayName = y.displayName;
const O = s.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ n(
  N,
  {
    ref: a,
    className: r("-mx-1 my-1 h-px bg-kumo-hairline", e),
    ...t
  }
));
O.displayName = N.displayName;
const E = ({
  className: e,
  ...t
}) => /* @__PURE__ */ n(
  "span",
  {
    className: r("ml-auto text-xs tracking-widest opacity-60", e),
    ...t
  }
);
E.displayName = "DropdownMenuShortcut";
const G = s.forwardRef(({ className: e, children: t, inset: a, icon: o, ...i }, u) => /* @__PURE__ */ l(
  $,
  {
    ref: u,
    "data-kumo-component": "DropdownMenu",
    "data-kumo-part": "radio-item",
    className: r(
      "relative flex cursor-default items-center rounded-md px-2 py-1.5 text-base outline-hidden select-none",
      "data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-kumo-tint",
      a && "pl-8",
      e
    ),
    ...i,
    children: [
      o && g(o),
      t
    ]
  }
));
G.displayName = "DropdownMenuRadioItem";
const V = s.forwardRef(({ className: e, children: t, ...a }, o) => /* @__PURE__ */ n(
  Z,
  {
    ref: o,
    className: r("ml-auto", e),
    ...a,
    children: t ?? /* @__PURE__ */ n(f, { className: "h-4 w-4" })
  }
));
V.displayName = "DropdownMenuRadioItemIndicator";
const _ = s.forwardRef(({ children: e, render: t, ...a }, o) => {
  if (t)
    return /* @__PURE__ */ n(k, { ref: o, ...a, render: t, children: e });
  const i = s.isValidElement(e) ? e : null;
  return /* @__PURE__ */ n(
    k,
    {
      ref: o,
      ...a,
      ...i && {
        render: i
      },
      children: i ? void 0 : e
    }
  );
});
_.displayName = "DropdownMenuTrigger";
const ce = Object.assign(q, {
  Trigger: _,
  Portal: M,
  Sub: Y,
  SubTrigger: S,
  SubContent: x,
  Content: x,
  Item: C,
  LinkItem: L,
  CheckboxItem: P,
  RadioGroup: X,
  RadioItem: G,
  RadioItemIndicator: V,
  Label: T,
  Separator: O,
  Shortcut: E,
  Group: B
});
export {
  ce as D
};
//# sourceMappingURL=dropdown-iey8f344rd5dgahz.js.map
