"use client";
import { jsx as e, jsxs as m } from "react/jsx-runtime";
import { CheckIcon as S, XIcon as h, CaretDownIcon as x } from "@phosphor-icons/react";
import { createContext as T, useContext as u, Fragment as P } from "react";
import { i as p, K as V } from "./input-lpa5fc75tgrraafv.js";
import { c as t } from "./cn-ct4n7r74mh8y0f48.js";
import { F as j } from "./field-lnj619xpe8zjd26r.js";
import { u as G } from "./portal-provider-hwmkdmkpvct0cb76.js";
import { a6 as L, a7 as M, a8 as F, a9 as _, aa as A, ab as E, ac as b, ad as K, ae as O, af as U, ag as W, ah as D, ai as f, aj as H, ak as C, al as N, am as X, an as q, ao as B } from "./vendor-base-ui-ie71jahf0czyf58j.js";
V.size;
const g = T("base");
function y({
  label: o,
  required: a,
  labelTooltip: r,
  description: n,
  error: i,
  children: c,
  size: s = "base",
  ...l
}) {
  const d = /* @__PURE__ */ e(g.Provider, { value: s, children: /* @__PURE__ */ e(M, { ...l, children: c }) });
  return o ? /* @__PURE__ */ e(
    j,
    {
      label: o,
      required: a,
      labelTooltip: r,
      description: n,
      error: i ? typeof i == "string" ? { message: i, match: !0 } : i : void 0,
      children: d
    }
  ) : d;
}
function v({
  children: o,
  className: a,
  align: r = "start",
  sideOffset: n = 4,
  alignOffset: i,
  side: c,
  container: s
}) {
  const l = G();
  return /* @__PURE__ */ e(X, { container: s ?? l ?? void 0, children: /* @__PURE__ */ e(
    q,
    {
      className: "",
      align: r,
      sideOffset: n,
      alignOffset: i,
      side: c,
      children: /* @__PURE__ */ e(
        B,
        {
          className: t(
            "flex flex-col",
            // flexbox layout for sticky input + scrollable list
            "max-h-[min(var(--available-height),24rem)] max-w-(--available-width) min-w-(--anchor-width) py-1.5",
            "bg-kumo-base text-kumo-default",
            // background
            "rounded-lg shadow-lg ring ring-kumo-line",
            // border part
            a
          ),
          children: o
        }
      )
    }
  ) });
}
const J = {
  xs: { padding: "pr-5", iconSize: 12, iconRight: "right-1" },
  sm: { padding: "pr-6", iconSize: 14, iconRight: "right-1.5" },
  base: { padding: "pr-8", iconSize: 16, iconRight: "right-2" },
  lg: { padding: "pr-10", iconSize: 18, iconRight: "right-3" }
};
function z({
  className: o,
  ...a
}) {
  const r = u(g), n = J[r];
  return /* @__PURE__ */ m(
    C,
    {
      className: t(
        p({ size: r }),
        "relative flex items-center",
        "data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed",
        n.padding,
        o
      ),
      children: [
        /* @__PURE__ */ e(f, { children: a.children }),
        /* @__PURE__ */ e(
          N,
          {
            className: t(
              "absolute top-1/2 -translate-y-1/2 flex items-center text-kumo-subtle",
              n.iconRight
            ),
            children: /* @__PURE__ */ e(x, { size: n.iconSize, className: "fill-current" })
          }
        )
      ]
    }
  );
}
const Q = {
  xs: {
    padding: "pr-7",
    iconSize: 12,
    clearRight: "right-5",
    caretRight: "right-1"
  },
  sm: {
    padding: "pr-9",
    iconSize: 14,
    clearRight: "right-6",
    caretRight: "right-1.5"
  },
  base: {
    padding: "pr-12",
    iconSize: 16,
    clearRight: "right-8",
    caretRight: "right-2"
  },
  lg: {
    padding: "pr-14",
    iconSize: 18,
    clearRight: "right-9",
    caretRight: "right-3"
  }
};
function R({
  clearLabel: o = "Clear selection",
  showOptionsLabel: a = "Show options",
  ...r
}) {
  const n = u(g), i = Q[n];
  return /* @__PURE__ */ m(
    "div",
    {
      className: t(
        "relative inline-block w-full max-w-xs",
        "has-[:disabled]:opacity-50 has-[:disabled]:cursor-not-allowed",
        r.className
      ),
      children: [
        /* @__PURE__ */ e(
          b,
          {
            ...r,
            className: t(
              p({ size: n }),
              "w-full",
              i.padding,
              "disabled:cursor-not-allowed"
            )
          }
        ),
        /* @__PURE__ */ e(
          H,
          {
            "aria-label": o,
            className: t(
              "absolute top-1/2 flex -translate-y-1/2 cursor-pointer bg-transparent p-0",
              "data-[disabled]:pointer-events-none data-[disabled]:opacity-0",
              i.clearRight
            ),
            children: /* @__PURE__ */ e(h, { size: i.iconSize })
          }
        ),
        /* @__PURE__ */ e(
          C,
          {
            "aria-label": a,
            className: t(
              "absolute top-1/2 -translate-y-1/2 flex items-center justify-center cursor-pointer text-kumo-subtle",
              "m-0 bg-transparent p-0",
              // Reset Stratus global button styles
              i.caretRight
            ),
            children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(x, { size: i.iconSize, className: "fill-current" }) })
          }
        )
      ]
    }
  );
}
function w({
  children: o,
  className: a,
  ...r
}) {
  return /* @__PURE__ */ m(
    K,
    {
      ...r,
      className: t(
        "group mx-1.5 grid grid-cols-[1fr_16px] gap-2 rounded px-2 py-1.5 text-base",
        "cursor-pointer data-highlighted:bg-kumo-tint",
        // Disabled rows: muted text, no pointer, suppress highlight bg even
        // when keyboard nav lands on them. Base UI sets `data-disabled` on
        // the element when the `disabled` prop is true.
        "data-[disabled]:cursor-not-allowed data-[disabled]:text-kumo-subtle data-[disabled]:opacity-60 data-[disabled]:data-highlighted:bg-transparent",
        a
      ),
      children: [
        /* @__PURE__ */ e("div", { className: "col-start-1", children: o }),
        /* @__PURE__ */ e(O, { className: "col-start-2 flex items-center", children: /* @__PURE__ */ e(S, {}) })
      ]
    }
  );
}
function Y(o) {
  return /* @__PURE__ */ e(
    E,
    {
      ...o,
      className: t(
        "mx-1.5 shrink-0 px-4 py-2 text-[0.925rem] leading-4 text-kumo-subtle empty:m-0 empty:p-0"
      ),
      children: o.children ?? "No labels found."
    }
  );
}
function Z(o) {
  return /* @__PURE__ */ e(
    b,
    {
      ...o,
      className: t(
        p(),
        "mx-1.5 w-[calc(100%-0.75rem)] shrink-0 first:mb-2",
        o.className
      )
    }
  );
}
function $({
  className: o,
  ...a
}) {
  return /* @__PURE__ */ e(
    F,
    {
      ...a,
      className: t(
        "min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pt-2 scroll-pb-2",
        o
      )
    }
  );
}
function ee(o) {
  return /* @__PURE__ */ e(
    A,
    {
      ...o,
      className: t(
        "mx-1.5 px-2 py-1.5 text-sm text-kumo-strong",
        o.className
      )
    }
  );
}
function oe(o) {
  return /* @__PURE__ */ e(
    _,
    {
      ...o,
      className: "border-t border-kumo-hairline mt-2 pt-2 first:border-t-0 first:mt-0 first:pt-0"
    }
  );
}
function I({
  removeLabel: o = "Remove",
  ...a
}) {
  return /* @__PURE__ */ m(
    U,
    {
      ...a,
      className: t(
        "flex items-center gap-2.5",
        // Layout
        "h-6 pl-2 pr-[3px]",
        // Dimensions
        "rounded-sm ring-1 ring-kumo-hairline",
        // Border
        "bg-kumo-overlay",
        // Background
        "text-sm"
        // Typography
      ),
      children: [
        a.children,
        /* @__PURE__ */ e(
          W,
          {
            "aria-label": o,
            className: t(
              "cursor-pointer rounded-md p-1 hover:bg-kumo-fill-hover",
              "bg-transparent flex"
            ),
            children: /* @__PURE__ */ e(h, { size: 10 })
          }
        )
      ]
    }
  );
}
const ae = {
  xs: "min-h-5",
  sm: "min-h-6.5",
  base: "min-h-9",
  lg: "min-h-10"
};
function k({
  placeholder: o,
  renderItem: a,
  className: r,
  inputSide: n = "right",
  value: i
}) {
  const c = u(g), s = i;
  return /* @__PURE__ */ m(
    D,
    {
      className: t(
        p({ size: c }),
        "flex flex-col",
        "gap-1 py-1 px-1.5",
        ae[c],
        "h-auto",
        "data-[disabled]:opacity-50 data-[disabled]:cursor-not-allowed",
        r
      ),
      children: [
        n === "top" && /* @__PURE__ */ e(
          b,
          {
            placeholder: o,
            className: "w-full px-2 py-1 border-0 bg-inherit"
          }
        ),
        /* @__PURE__ */ m("div", { className: "flex items-center flex-wrap gap-1.5 flex-1", children: [
          s !== void 0 && s.length > 0 && s.map((l) => a(l)),
          /* @__PURE__ */ e(f, { children: (l) => s !== void 0 ? null : /* @__PURE__ */ e(P, { children: l.map((d) => a(d)) }) }),
          n === "right" && /* @__PURE__ */ e(
            b,
            {
              placeholder: o,
              className: "min-w-[100px] flex-1 px-2 py-1 border-0 bg-inherit"
            }
          )
        ] })
      ]
    }
  );
}
y.displayName = "Combobox.Root";
v.displayName = "Combobox.Content";
z.displayName = "Combobox.TriggerValue";
R.displayName = "Combobox.TriggerInput";
w.displayName = "Combobox.Item";
I.displayName = "Combobox.Chip";
k.displayName = "Combobox.TriggerMultipleWithInput";
const de = Object.assign(y, {
  // Helper components
  Content: v,
  TriggerValue: z,
  TriggerInput: R,
  TriggerMultipleWithInput: k,
  // Slightly modified BaseUI
  Chip: I,
  Item: w,
  // Styled BaseUI
  Input: Z,
  Empty: Y,
  GroupLabel: ee,
  Group: oe,
  // Styled BaseUI
  List: $,
  // BaseUI
  Collection: L
});
export {
  de as C
};
//# sourceMappingURL=combobox-n9qht9h9ag6kh5sn.js.map
