"use client";
import { jsxs as n, jsx as e, Fragment as j } from "react/jsx-runtime";
import { CaretUpDownIcon as F, CheckIcon as C } from "@phosphor-icons/react";
import { useId as A } from "react";
import { c as g } from "./cn-Bhsu1vx2.js";
import { b as O } from "./button-E2-hZMZE.js";
import { S as P } from "./skeleton-line-CtpS1u1J.js";
import { F as z } from "./field-V3J0Ql_V.js";
import { aC as D, aD as T, aE as V, aF as B, aG as E, aH as G, aI as H, aJ as J, aK as K, aL as R } from "./vendor-base-ui-DWIDNgE1.js";
function U({
  children: r,
  className: s,
  renderValue: p,
  label: t,
  hideLabel: y = !0,
  placeholder: i,
  loading: c,
  labelTooltip: h,
  description: S,
  error: o,
  required: v,
  ...l
}) {
  const m = A(), u = l, x = u["aria-label"], I = u["aria-labelledby"], k = typeof t == "string" ? t : i, d = t && !y, f = d ? void 0 : I ?? (t ? m : void 0), w = x ?? (f ? void 0 : k);
  let a = l.items;
  i && (a ? typeof a == "object" ? a = [
    {
      value: null,
      label: i
    },
    ...Object.entries(a).map(([L, N]) => ({
      value: L,
      label: N
    }))
  ] : Array.isArray(a) && (a = [
    {
      value: null,
      label: i
    },
    ...a
  ]) : a = [
    {
      value: null,
      label: i
    }
  ]);
  const b = /* @__PURE__ */ n(
    D,
    {
      ...l,
      items: a,
      disabled: c || l.disabled,
      children: [
        /* @__PURE__ */ n(
          T,
          {
            className: g(
              O(),
              "justify-between font-normal",
              "outline-none focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-ring *:in-focus:opacity-100",
              l.disabled && "cursor-not-allowed opacity-50",
              s
            ),
            "aria-label": w,
            "aria-labelledby": f,
            children: [
              c ? /* @__PURE__ */ e(P, { className: "w-32" }) : /* @__PURE__ */ e(V, { children: p }),
              /* @__PURE__ */ e(B, { className: "flex items-center", children: /* @__PURE__ */ e(F, {}) })
            ]
          }
        ),
        /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(G, { className: "z-50", children: /* @__PURE__ */ e(
          H,
          {
            className: g(
              "z-50 overflow-hidden bg-kumo-control text-kumo-default",
              // background
              "rounded-lg shadow-lg ring ring-kumo-line",
              // border part
              // 3px adjustment to account for padding + border differences
              "min-w-[calc(var(--anchor-width)+3px)] p-1.5"
              // spacing
            ),
            children: r
          }
        ) }) })
      ]
    }
  );
  return d ? /* @__PURE__ */ e(
    z,
    {
      label: t,
      required: v,
      labelTooltip: h,
      description: S,
      error: o ? typeof o == "string" ? { message: o, match: !0 } : o : void 0,
      children: b
    }
  ) : /* @__PURE__ */ n(j, { children: [
    t && /* @__PURE__ */ e("span", { id: m, className: "sr-only", children: t }),
    b
  ] });
}
function W({ children: r, value: s }) {
  return /* @__PURE__ */ n(
    J,
    {
      value: s,
      className: "group flex cursor-pointer items-center justify-between gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-overlay",
      children: [
        /* @__PURE__ */ e(K, { children: r }),
        /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(C, {}) })
      ]
    }
  );
}
U.Option = W;
export {
  U as S
};
//# sourceMappingURL=select-B5Vb3zou.js.map
