"use client";
import { jsx as R, jsxs as ze } from "react/jsx-runtime";
import { CheckIcon as ln, ChevronDownIcon as Ct, ChevronUpIcon as an } from "lucide-react";
import { cn as Pe } from "../../../lib/utils.js";
import * as n from "react";
import { v as cn, a as un } from "../../../visuallyHidden-PuyyGHVF.js";
import { f as Xe, b as Rt, a as dn, m as Vt, E as fn, c as Pt, u as be } from "../../../useRenderElement-DNB2vtF1.js";
import { u as pn } from "../../../useOnFirstRender-B4aruaIA.js";
import { u as Et } from "../../../useControlled-Sx-_x7Sz.js";
import { u as Se } from "../../../useIsoLayoutEffect-DpJo20by.js";
import { u as Ce } from "../../../useStableCallback-CudqoENs.js";
import { u as pt } from "../../../useValueAsRef-LhoZc6As.js";
import { c as mn, a as Dt, b as gn, u as hn, f as Sn } from "../../../LabelableContext-Dzw1DWuj.js";
import { u as Ot } from "../../../useLabelableId-DF_d91GP.js";
import { u as mt, a as ot, t as Lt } from "../../../useOpenChangeComplete-DkeH9FGJ.js";
import { s as ut } from "../../../serializeValue-BebmSzW3.js";
import { d as A, S as bn, K as f, p as xn, q as vn, B as yn, r as In, z as wn, L as Rn, x as Ht } from "../../../popupStateMapping-BT9Y_jIq.js";
import { f as En, o as Tn, c as Ve, n as gt, q as Mn, w as Nn, r as it } from "../../../createBaseUIEventDetails-CqidROtw.js";
import { u as An } from "../../../useValueChanged-Bissqjjn.js";
import { u as Cn, b as Vn, a as Pn, I as Dn, F as On } from "../../../InternalBackdrop-BVEfe6O1.js";
import { b as Ln, u as Hn, g as Ut, p as Un } from "../../../getDisabledMountTransitionStyles-fmnaQYVj.js";
import { u as Bn, a as Fn, g as _n } from "../../../getPseudoElementBounds-B4_miSEJ.js";
import { i as kn } from "../../../inertValue-kpZZDBEy.js";
import { C as zn } from "../../../CompositeList-yq5K_yj6.js";
import * as Wn from "react-dom";
import { r as qn } from "../../../floating-ui.utils-48URp89E.js";
import { u as Le } from "../../../useTimeout-DAqPwigF.js";
import { e as Yn } from "../../../detectBrowser-Dn2N72k1.js";
import { o as dt } from "../../../owner-rKN292Q9.js";
import { u as Gn } from "../../../useAnimationFrame-DIc6eFHa.js";
import { s as ft } from "../../../styles-DU5BO7fS.js";
import { u as $n } from "../../../ToolbarRootContext-D7EsmJ5f.js";
import { C as jn } from "../../../composite-BSpUD7nI.js";
import { u as Xn, c as at } from "../../../clamp-BxE4ZAuA.js";
import { g as Tt } from "../../../floating-ui.utils.dom-jr2suqy2.js";
import { u as Kn, I as Jn } from "../../../useCompositeListItem-CYQrZg5-.js";
import { a as Bt } from "../../../useButton-JYPKQKj4.js";
import { u as Zn } from "../../../useBaseUiId-C8Dq0BQq.js";
import { S as Qn } from "../../../Separator-CswSYAXX.js";
import { r as eo } from "../../../resolveAriaLabelledBy-B5vw-szP.js";
import { g as to, c as ct } from "../../../element-DSo91iOi.js";
const ht = /* @__PURE__ */ n.createContext(null);
process.env.NODE_ENV !== "production" && (ht.displayName = "SelectRootContext");
const St = /* @__PURE__ */ n.createContext(null);
process.env.NODE_ENV !== "production" && (St.displayName = "SelectFloatingContext");
function Ee() {
  const e = n.useContext(ht);
  if (e === null)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>." : Xe(60));
  return e;
}
function Ft() {
  const e = n.useContext(St);
  if (e === null)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>." : Xe(61));
  return e;
}
const no = (e, t) => Object.is(e, t);
function ke(e, t, o) {
  return e == null || t == null ? Object.is(e, t) : o(e, t);
}
function oo(e, t, o) {
  return !e || e.length === 0 ? !1 : e.some((s) => s === void 0 ? !1 : ke(t, s, o));
}
function je(e, t, o) {
  return !e || e.length === 0 ? -1 : e.findIndex((s) => s === void 0 ? !1 : ke(s, t, o));
}
function ro(e, t, o) {
  return e.filter((s) => !ke(t, s, o));
}
function _t(e) {
  return e != null && e.length > 0 && typeof e[0] == "object" && e[0] != null && "items" in e[0];
}
function so(e) {
  if (!Array.isArray(e))
    return e != null && "null" in e;
  const t = e;
  if (_t(t)) {
    for (const o of t)
      for (const s of o.items)
        if (s && s.value == null && s.label != null)
          return !0;
    return !1;
  }
  for (const o of t)
    if (o && o.value == null && o.label != null)
      return !0;
  return !1;
}
function lo(e, t) {
  if (t && e != null)
    return t(e) ?? "";
  if (e && typeof e == "object") {
    if ("label" in e && e.label != null)
      return String(e.label);
    if ("value" in e)
      return String(e.value);
  }
  return ut(e);
}
function _e(e, t) {
  return t && e != null ? t(e) ?? "" : e && typeof e == "object" && "value" in e && "label" in e ? ut(e.value) : ut(e);
}
function kt(e, t, o) {
  function s() {
    return lo(e, o);
  }
  if (o && e != null)
    return o(e);
  if (e && typeof e == "object" && "label" in e && e.label != null)
    return e.label;
  if (t && !Array.isArray(t))
    return t[e] ?? s();
  if (Array.isArray(t)) {
    const x = t, l = _t(x) ? x.flatMap((c) => c.items) : x;
    if (e == null || typeof e != "object") {
      const c = l.find((u) => u.value === e);
      return c && c.label != null ? c.label : s();
    }
    if ("value" in e) {
      const c = l.find((u) => u && u.value === e.value);
      if (c && c.label != null)
        return c.label;
    }
  }
  return s();
}
function io(e, t, o) {
  return e.reduce((s, x, l) => (l > 0 && s.push(", "), s.push(/* @__PURE__ */ R(n.Fragment, {
    children: kt(x, t, o)
  }, l)), s), []);
}
const a = {
  id: A((e) => e.id),
  labelId: A((e) => e.labelId),
  modal: A((e) => e.modal),
  multiple: A((e) => e.multiple),
  items: A((e) => e.items),
  itemToStringLabel: A((e) => e.itemToStringLabel),
  itemToStringValue: A((e) => e.itemToStringValue),
  isItemEqualToValue: A((e) => e.isItemEqualToValue),
  value: A((e) => e.value),
  hasSelectedValue: A((e) => {
    const {
      value: t,
      multiple: o,
      itemToStringValue: s
    } = e;
    return t == null ? !1 : o && Array.isArray(t) ? t.length > 0 : _e(t, s) !== "";
  }),
  hasNullItemLabel: A((e, t) => t ? so(e.items) : !1),
  open: A((e) => e.open),
  mounted: A((e) => e.mounted),
  forceMount: A((e) => e.forceMount),
  transitionStatus: A((e) => e.transitionStatus),
  openMethod: A((e) => e.openMethod),
  activeIndex: A((e) => e.activeIndex),
  selectedIndex: A((e) => e.selectedIndex),
  isActive: A((e, t) => e.activeIndex === t),
  isSelected: A((e, t, o) => {
    const s = e.isItemEqualToValue, x = e.value;
    return e.multiple ? Array.isArray(x) && x.some((l) => ke(o, l, s)) : e.selectedIndex === t && e.selectedIndex !== null ? !0 : ke(o, x, s);
  }),
  isSelectedByFocus: A((e, t) => e.selectedIndex === t),
  popupProps: A((e) => e.popupProps),
  triggerProps: A((e) => e.triggerProps),
  triggerElement: A((e) => e.triggerElement),
  positionerElement: A((e) => e.positionerElement),
  listElement: A((e) => e.listElement),
  scrollUpArrowVisible: A((e) => e.scrollUpArrowVisible),
  scrollDownArrowVisible: A((e) => e.scrollDownArrowVisible),
  hasScrollArrows: A((e) => e.hasScrollArrows)
};
function ao(e) {
  const {
    id: t,
    value: o,
    defaultValue: s = null,
    onValueChange: x,
    open: l,
    defaultOpen: c = !1,
    onOpenChange: u,
    name: d,
    autoComplete: U,
    disabled: N = !1,
    readOnly: T = !1,
    required: S = !1,
    modal: B = !0,
    actionsRef: te,
    inputRef: v,
    onOpenChangeComplete: $,
    items: C,
    multiple: y = !1,
    itemToStringLabel: h,
    itemToStringValue: b,
    isItemEqualToValue: q = no,
    highlightItemOnHover: ge = !0,
    children: oe
  } = e, {
    clearErrors: k
  } = mn(), {
    setDirty: K,
    setTouched: ie,
    setFocused: z,
    shouldValidateOnChange: Y,
    validityData: j,
    setFilled: m,
    name: ce,
    disabled: W,
    validation: F,
    validationMode: V
  } = Dt(), r = Ot({
    id: t
  }), M = W || N, O = ce ?? d, [i, P] = Et({
    controlled: o,
    default: y ? s ?? Rt : s,
    name: "Select",
    state: "value"
  }), [I, re] = Et({
    controlled: l,
    default: c,
    name: "Select",
    state: "open"
  }), p = n.useRef([]), L = n.useRef([]), se = n.useRef(null), ue = n.useRef(null), Te = n.useRef(0), w = n.useRef(null), J = n.useRef([]), ae = n.useRef(!1), _ = n.useRef(!1), xe = n.useRef(null), ye = n.useRef({
    allowSelectedMouseUp: !1,
    allowUnselectedMouseUp: !1
  }), H = n.useRef(!1), {
    mounted: X,
    setMounted: Z,
    transitionStatus: G
  } = mt(I), {
    openMethod: ne,
    triggerProps: Q
  } = Cn(I), g = dn(() => new bn({
    id: r,
    labelId: void 0,
    modal: B,
    multiple: y,
    itemToStringLabel: h,
    itemToStringValue: b,
    isItemEqualToValue: q,
    value: i,
    open: I,
    mounted: X,
    transitionStatus: G,
    items: C,
    forceMount: !1,
    openMethod: null,
    activeIndex: null,
    selectedIndex: null,
    popupProps: {},
    triggerProps: {},
    triggerElement: null,
    positionerElement: null,
    listElement: null,
    scrollUpArrowVisible: !1,
    scrollDownArrowVisible: !1,
    hasScrollArrows: !1
  })).current, Me = f(g, a.activeIndex), Ie = f(g, a.selectedIndex), we = f(g, a.triggerElement), De = f(g, a.positionerElement), He = n.useMemo(() => y && Array.isArray(i) && i.length === 0 ? "" : _e(i, b), [y, i, b]), ee = n.useMemo(() => y && Array.isArray(i) ? i.map((E) => _e(E, b)) : _e(i, b), [y, i, b]), de = pt(g.state.triggerElement);
  gn({
    id: r,
    commit: F.commit,
    value: i,
    controlRef: de,
    name: O,
    getValue: () => ee
  });
  const le = n.useRef(i);
  Se(() => {
    i !== le.current && g.set("forceMount", !0);
  }, [g, i]), Se(() => {
    m(y ? Array.isArray(i) && i.length > 0 : i != null);
  }, [y, i, m]), Se(function() {
    if (I)
      return;
    const D = J.current;
    if (y) {
      const he = Array.isArray(i) ? i : [];
      if (he.length === 0) {
        g.set("selectedIndex", null);
        return;
      }
      const me = he[he.length - 1], Oe = je(D, me, q);
      g.set("selectedIndex", Oe === -1 ? null : Oe);
      return;
    }
    const pe = je(D, i, q);
    g.set("selectedIndex", pe === -1 ? null : pe);
  }, [y, I, i, J, q, g]), An(i, () => {
    k(O), K(i !== j.initialValue), Y() ? F.commit(i) : F.commit(i, !0);
  });
  const fe = Ce((E, D) => {
    if (u?.(E, D), !D.isCanceled && (re(E), !E && (D.reason === En || D.reason === Tn) && (ie(!0), z(!1), V === "onBlur" && F.commit(i)), !E && g.state.activeIndex !== null)) {
      const pe = p.current[g.state.activeIndex];
      queueMicrotask(() => {
        pe?.setAttribute("tabindex", "-1");
      });
    }
  }), We = Ce(() => {
    Z(!1), g.set("activeIndex", null), $?.(!1);
  });
  ot({
    enabled: !te,
    open: I,
    ref: se,
    onComplete() {
      I || We();
    }
  }), n.useImperativeHandle(te, () => ({
    unmount: We
  }), [We]);
  const Ue = Ce((E, D) => {
    x?.(E, D), !D.isCanceled && P(E);
  }), qe = Ce(() => {
    const E = g.state.listElement || se.current;
    if (!E)
      return;
    const D = E.scrollTop, pe = E.scrollTop + E.clientHeight, he = D > 1, me = pe < E.scrollHeight - 1;
    g.state.scrollUpArrowVisible !== he && g.set("scrollUpArrowVisible", he), g.state.scrollDownArrowVisible !== me && g.set("scrollDownArrowVisible", me);
  }), Re = Ln({
    open: I,
    onOpenChange: fe,
    elements: {
      reference: we,
      floating: De
    }
  }), Ne = Vn(Re, {
    enabled: !T && !M,
    event: "mousedown"
  }), Ke = xn(Re, {
    bubbles: !1
  }), Je = Bn(Re, {
    enabled: !T && !M,
    listRef: p,
    activeIndex: Me,
    selectedIndex: Ie,
    disabledIndices: Rt,
    onNavigate(E) {
      E === null && !I || g.set("activeIndex", E);
    },
    // Implement our own listeners since `onPointerLeave` on each option fires while scrolling with
    // the `alignItemWithTrigger=true`, causing a performance issue on Chrome.
    focusItemOnHover: !1
  }), Ye = Fn(Re, {
    enabled: !T && !M && (I || !y),
    listRef: L,
    activeIndex: Me,
    selectedIndex: Ie,
    onMatch(E) {
      I ? g.set("activeIndex", E) : Ue(J.current[E], Ve("none"));
    },
    onTypingChange(E) {
      ae.current = E;
    }
  }), {
    getReferenceProps: ve,
    getFloatingProps: Ge,
    getItemProps: Be
  } = vn([Ne, Ke, Je, Ye]), Fe = n.useMemo(() => Vt(ve(), Q, r ? {
    id: r
  } : fn), [ve, Q, r]);
  pn(() => {
    g.update({
      popupProps: Ge(),
      triggerProps: Fe
    });
  }), Se(() => {
    g.update({
      id: r,
      modal: B,
      multiple: y,
      value: i,
      open: I,
      mounted: X,
      transitionStatus: G,
      popupProps: Ge(),
      triggerProps: Fe,
      items: C,
      itemToStringLabel: h,
      itemToStringValue: b,
      isItemEqualToValue: q,
      openMethod: ne
    });
  }, [g, r, B, y, i, I, X, G, Ge, Fe, C, h, b, q, ne]);
  const rt = n.useMemo(() => ({
    store: g,
    name: O,
    required: S,
    disabled: M,
    readOnly: T,
    multiple: y,
    itemToStringLabel: h,
    itemToStringValue: b,
    highlightItemOnHover: ge,
    setValue: Ue,
    setOpen: fe,
    listRef: p,
    popupRef: se,
    scrollHandlerRef: ue,
    handleScrollArrowVisibility: qe,
    scrollArrowsMountedCountRef: Te,
    getItemProps: Be,
    events: Re.context.events,
    valueRef: w,
    valuesRef: J,
    labelsRef: L,
    typingRef: ae,
    selectionRef: ye,
    selectedItemTextRef: xe,
    validation: F,
    onOpenChangeComplete: $,
    keyboardActiveRef: _,
    alignItemWithTriggerActiveRef: H,
    initialValueRef: le
  }), [g, O, S, M, T, y, h, b, ge, Ue, fe, Be, Re.context.events, F, $, qe]), st = Pt(v, F.inputRef), Ze = y && Array.isArray(i) && i.length > 0, $e = y ? void 0 : O, lt = n.useMemo(() => !y || !Array.isArray(i) || !O ? null : i.map((E) => {
    const D = _e(E, b);
    return /* @__PURE__ */ R("input", {
      type: "hidden",
      name: O,
      value: D
    }, D);
  }), [y, i, O, b]);
  return /* @__PURE__ */ R(ht.Provider, {
    value: rt,
    children: /* @__PURE__ */ ze(St.Provider, {
      value: Re,
      children: [oe, /* @__PURE__ */ R("input", {
        ...F.getInputValidationProps({
          onFocus() {
            g.state.triggerElement?.focus({
              // Supported in Chrome from 144 (January 2026)
              // @ts-expect-error - focusVisible is not yet in the lib.dom.d.ts
              focusVisible: !0
            });
          },
          // Handle browser autofill.
          onChange(E) {
            if (E.nativeEvent.defaultPrevented)
              return;
            const D = E.target.value, pe = Ve(gt, E.nativeEvent);
            function he() {
              if (y)
                return;
              const me = J.current.find((Oe) => _e(Oe, b).toLowerCase() === D.toLowerCase());
              me != null && (K(me !== j.initialValue), Ue(me, pe), Y() && F.commit(me));
            }
            g.set("forceMount", !0), queueMicrotask(he);
          }
        }),
        id: r && $e == null ? `${r}-hidden-input` : void 0,
        name: $e,
        autoComplete: U,
        value: He,
        disabled: M,
        required: S && !Ze,
        readOnly: T,
        ref: st,
        style: O ? cn : un,
        tabIndex: -1,
        "aria-hidden": !0
      }), lt]
    })
  });
}
const Qe = 2, co = 400, Mt = 200, uo = {
  ...yn,
  ...Sn,
  value: () => null
}, zt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    render: s,
    className: x,
    id: l,
    disabled: c = !1,
    nativeButton: u = !0,
    ...d
  } = t, {
    setTouched: U,
    setFocused: N,
    validationMode: T,
    state: S,
    disabled: B
  } = Dt(), {
    labelId: te
  } = hn(), {
    store: v,
    setOpen: $,
    selectionRef: C,
    validation: y,
    readOnly: h,
    required: b,
    alignItemWithTriggerActiveRef: q,
    disabled: ge,
    keyboardActiveRef: oe
  } = Ee(), k = B || ge || c, K = f(v, a.open), ie = f(v, a.value), z = f(v, a.triggerProps), Y = f(v, a.positionerElement), j = f(v, a.listElement), m = f(v, a.id), ce = f(v, a.labelId), W = f(v, a.hasSelectedValue), F = !W && K, V = f(v, a.hasNullItemLabel, F), r = l ?? m, M = eo(te, ce);
  Ot({
    id: r
  });
  const O = pt(Y), i = n.useRef(null), {
    getButtonProps: P,
    buttonRef: I
  } = Bt({
    disabled: k,
    native: u
  }), re = Ce((_) => {
    v.set("triggerElement", _);
  }), p = Pt(o, i, I, re), L = Le(), se = Le(), ue = Le(), Te = Le();
  n.useEffect(() => {
    if (K)
      return !(W || V) ? ue.start(co, () => {
        C.current.allowUnselectedMouseUp = !0, C.current.allowSelectedMouseUp = !0;
      }) : Te.start(Mt, () => {
        C.current.allowUnselectedMouseUp = !0, ue.start(Mt, () => {
          C.current.allowSelectedMouseUp = !0;
        });
      }), () => {
        ue.clear(), Te.clear();
      };
    C.current = {
      allowSelectedMouseUp: !1,
      allowUnselectedMouseUp: !1
    }, se.clear();
  }, [K, W, V, C, se, ue, Te]);
  const w = n.useMemo(() => j?.id ?? to(Y)?.id, [j, Y]), J = Vt(z, {
    id: r,
    role: "combobox",
    "aria-expanded": K ? "true" : "false",
    "aria-haspopup": "listbox",
    "aria-controls": K ? w : void 0,
    "aria-labelledby": M,
    "aria-readonly": h || void 0,
    "aria-required": b || void 0,
    tabIndex: k ? -1 : 0,
    ref: p,
    onFocus(_) {
      N(!0), K && q.current && $(!1, Ve(gt, _.nativeEvent)), L.start(0, () => {
        v.set("forceMount", !0);
      });
    },
    onBlur(_) {
      ct(Y, _.relatedTarget) || (U(!0), N(!1), T === "onBlur" && y.commit(ie));
    },
    onPointerMove() {
      oe.current = !1;
    },
    onKeyDown() {
      oe.current = !0;
    },
    onMouseDown(_) {
      if (K)
        return;
      const xe = dt(_.currentTarget);
      function ye(H) {
        if (!i.current)
          return;
        const X = H.target;
        if (ct(i.current, X) || ct(O.current, X) || X === i.current)
          return;
        const Z = _n(i.current);
        H.clientX >= Z.left - Qe && H.clientX <= Z.right + Qe && H.clientY >= Z.top - Qe && H.clientY <= Z.bottom + Qe || $(!1, Ve(Mn, H));
      }
      se.start(0, () => {
        xe.addEventListener("mouseup", ye, {
          once: !0
        });
      });
    }
  }, y.getValidationProps, d, P);
  J.role = "combobox";
  const ae = {
    ...S,
    open: K,
    disabled: k,
    value: ie,
    readOnly: h,
    placeholder: !W
  };
  return be("button", t, {
    ref: [o, i],
    state: ae,
    stateAttributesMapping: uo,
    props: J
  });
});
process.env.NODE_ENV !== "production" && (zt.displayName = "SelectTrigger");
const fo = {
  value: () => null
}, Wt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    className: s,
    render: x,
    children: l,
    placeholder: c,
    ...u
  } = t, {
    store: d,
    valueRef: U
  } = Ee(), N = f(d, a.value), T = f(d, a.items), S = f(d, a.itemToStringLabel), B = f(d, a.hasSelectedValue), te = !B && c != null && l == null, v = f(d, a.hasNullItemLabel, te), $ = {
    value: N,
    placeholder: !B
  };
  let C = null;
  return typeof l == "function" ? C = l(N) : l != null ? C = l : !B && c != null && !v ? C = c : Array.isArray(N) ? C = io(N, T, S) : C = kt(N, T, S), be("span", t, {
    state: $,
    ref: [o, U],
    props: [{
      children: C
    }, u],
    stateAttributesMapping: fo
  });
});
process.env.NODE_ENV !== "production" && (Wt.displayName = "SelectValue");
const qt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    className: s,
    render: x,
    ...l
  } = t, {
    store: c
  } = Ee(), d = {
    open: f(c, a.open)
  };
  return be("span", t, {
    state: d,
    ref: o,
    props: [{
      "aria-hidden": !0,
      children: "▼"
    }, l],
    stateAttributesMapping: In
  });
});
process.env.NODE_ENV !== "production" && (qt.displayName = "SelectIcon");
const Yt = /* @__PURE__ */ n.createContext(void 0);
process.env.NODE_ENV !== "production" && (Yt.displayName = "SelectPortalContext");
const Gt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    store: s
  } = Ee(), x = f(s, a.mounted), l = f(s, a.forceMount);
  return x || l ? /* @__PURE__ */ R(Yt.Provider, {
    value: !0,
    children: /* @__PURE__ */ R(wn, {
      ref: o,
      ...t
    })
  }) : null;
});
process.env.NODE_ENV !== "production" && (Gt.displayName = "SelectPortal");
const bt = /* @__PURE__ */ n.createContext(void 0);
process.env.NODE_ENV !== "production" && (bt.displayName = "SelectPositionerContext");
function xt() {
  const e = n.useContext(bt);
  if (!e)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>." : Xe(59));
  return e;
}
function nt(e, t) {
  e && Object.assign(e.style, t);
}
const $t = {
  position: "relative",
  maxHeight: "100%",
  overflowX: "hidden",
  overflowY: "auto"
}, po = {
  position: "fixed"
}, jt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    anchor: s,
    positionMethod: x = "absolute",
    className: l,
    render: c,
    side: u = "bottom",
    align: d = "center",
    sideOffset: U = 0,
    alignOffset: N = 0,
    collisionBoundary: T = "clipping-ancestors",
    collisionPadding: S,
    arrowPadding: B = 5,
    sticky: te = !1,
    disableAnchorTracking: v,
    alignItemWithTrigger: $ = !0,
    collisionAvoidance: C = Rn,
    ...y
  } = t, {
    store: h,
    listRef: b,
    labelsRef: q,
    alignItemWithTriggerActiveRef: ge,
    selectedItemTextRef: oe,
    valuesRef: k,
    initialValueRef: K,
    popupRef: ie,
    setValue: z
  } = Ee(), Y = Ft(), j = f(h, a.open), m = f(h, a.mounted), ce = f(h, a.modal), W = f(h, a.value), F = f(h, a.openMethod), V = f(h, a.positionerElement), r = f(h, a.triggerElement), M = f(h, a.isItemEqualToValue), O = f(h, a.transitionStatus), i = n.useRef(null), P = n.useRef(null), [I, re] = n.useState($), p = m && I && F !== "touch";
  !m && I !== $ && re($), Se(() => {
    m || (a.scrollUpArrowVisible(h.state) && h.set("scrollUpArrowVisible", !1), a.scrollDownArrowVisible(h.state) && h.set("scrollDownArrowVisible", !1));
  }, [h, m]), n.useImperativeHandle(ge, () => p), Pn((p || ce) && j && F !== "touch", r);
  const L = Hn({
    anchor: s,
    floatingRootContext: Y,
    positionMethod: x,
    mounted: m,
    side: u,
    sideOffset: U,
    align: d,
    alignOffset: N,
    arrowPadding: B,
    collisionBoundary: T,
    collisionPadding: S,
    sticky: te,
    disableAnchorTracking: v ?? p,
    collisionAvoidance: C,
    keepMounted: !0
  }), se = p ? "none" : L.side, ue = p ? po : L.positionerStyles, Te = n.useMemo(() => {
    const H = {};
    return j || (H.pointerEvents = "none"), {
      role: "presentation",
      hidden: !m,
      style: {
        ...ue,
        ...H
      }
    };
  }, [j, m, ue]), w = {
    open: j,
    side: se,
    align: L.align,
    anchorHidden: L.anchorHidden
  }, J = Ce((H) => {
    h.set("positionerElement", H);
  }), ae = be("div", t, {
    ref: [o, J],
    state: w,
    stateAttributesMapping: Ht,
    props: [Te, Ut(O), y]
  }), _ = n.useRef(0), xe = Ce((H) => {
    if (H.size === 0 && _.current === 0 || k.current.length === 0)
      return;
    const X = _.current;
    if (_.current = H.size, H.size === X)
      return;
    const Z = Ve(gt);
    if (X !== 0 && !h.state.multiple && W !== null && je(k.current, W, M) === -1) {
      const ne = K.current, g = ne != null && je(k.current, ne, M) !== -1 ? ne : null;
      z(g, Z), g === null && (h.set("selectedIndex", null), oe.current = null);
    }
    if (X !== 0 && h.state.multiple && Array.isArray(W)) {
      const G = (Q) => je(k.current, Q, M) !== -1, ne = W.filter((Q) => G(Q));
      (ne.length !== W.length || ne.some((Q) => !oo(W, Q, M))) && (z(ne, Z), ne.length === 0 && (h.set("selectedIndex", null), oe.current = null));
    }
    if (j && p) {
      h.update({
        scrollUpArrowVisible: !1,
        scrollDownArrowVisible: !1
      });
      const G = {
        height: ""
      };
      nt(V, G), nt(ie.current, G);
    }
  }), ye = n.useMemo(() => ({
    ...L,
    side: se,
    alignItemWithTriggerActive: p,
    setControlledAlignItemWithTrigger: re,
    scrollUpArrowRef: i,
    scrollDownArrowRef: P
  }), [L, se, p, re]);
  return /* @__PURE__ */ R(zn, {
    elementsRef: b,
    labelsRef: q,
    onMapChange: xe,
    children: /* @__PURE__ */ ze(bt.Provider, {
      value: ye,
      children: [m && ce && /* @__PURE__ */ R(Dn, {
        inert: kn(!j),
        cutout: r
      }), ae]
    })
  });
});
process.env.NODE_ENV !== "production" && (jt.displayName = "SelectPositioner");
function Xt(e) {
  const t = e.currentTarget.getBoundingClientRect();
  return t.top + 1 <= e.clientY && e.clientY <= t.bottom - 1 && t.left + 1 <= e.clientX && e.clientX <= t.right - 1;
}
const Ae = 1, mo = {
  ...Ht,
  ...Lt
}, Kt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    render: s,
    className: x,
    finalFocus: l,
    ...c
  } = t, {
    store: u,
    popupRef: d,
    onOpenChangeComplete: U,
    setOpen: N,
    valueRef: T,
    selectedItemTextRef: S,
    keyboardActiveRef: B,
    multiple: te,
    handleScrollArrowVisibility: v,
    scrollHandlerRef: $,
    highlightItemOnHover: C
  } = Ee(), {
    side: y,
    align: h,
    alignItemWithTriggerActive: b,
    setControlledAlignItemWithTrigger: q,
    scrollDownArrowRef: ge,
    scrollUpArrowRef: oe
  } = xt(), k = $n() != null, K = Ft(), {
    nonce: ie,
    disableStyleElements: z
  } = Xn(), Y = Le(), j = f(u, a.id), m = f(u, a.open), ce = f(u, a.mounted), W = f(u, a.popupProps), F = f(u, a.transitionStatus), V = f(u, a.triggerElement), r = f(u, a.positionerElement), M = f(u, a.listElement), O = n.useRef(0), i = n.useRef(!1), P = n.useRef(0), I = n.useRef(!1), re = n.useRef({}), p = Gn(), L = Ce((w) => {
    if (!r || !d.current || !I.current)
      return;
    if (i.current || !b) {
      v();
      return;
    }
    const J = r.style.top === "0px", ae = r.style.bottom === "0px", _ = r.getBoundingClientRect().height, xe = dt(r), ye = getComputedStyle(r), H = parseFloat(ye.marginTop), X = parseFloat(ye.marginBottom), Z = Nt(getComputedStyle(d.current)), G = Math.min(xe.documentElement.clientHeight - H - X, Z), ne = w.scrollTop, Q = et(w);
    let g = 0, Me = null, Ie = !1, we = !1;
    const De = (ee) => {
      r.style.height = `${ee}px`;
    }, He = (ee, de) => {
      const le = at(ee, 0, G - _);
      le > 0 && De(_ + le), w.scrollTop = de, G - (_ + le) <= Ae && (i.current = !0), v();
    };
    if (J) {
      const ee = Q - ne, de = _ + ee, le = Math.min(de, G);
      if (g = le, ee <= Ae) {
        He(ee, Q);
        return;
      }
      G - le > Ae ? we = !0 : Ie = !0;
    } else if (ae) {
      const ee = ne, de = _ + ee, le = Math.min(de, G), fe = de - G;
      if (g = le, ee <= Ae) {
        He(ee, 0);
        return;
      }
      G - le > Ae ? Me = 0 : (Ie = !0, ne < Q && (Me = ne - (ee - fe)));
    }
    if (g = Math.ceil(g), g !== 0 && De(g), we || Me != null) {
      const ee = et(w), de = we ? ee : at(Me, 0, ee);
      Math.abs(w.scrollTop - de) > Ae && (w.scrollTop = de);
    }
    (Ie || g >= G - Ae) && (i.current = !0), v();
  });
  n.useImperativeHandle($, () => L, [L]), ot({
    open: m,
    ref: d,
    onComplete() {
      m && U?.(!0);
    }
  });
  const se = {
    open: m,
    transitionStatus: F,
    side: y,
    align: h
  };
  Se(() => {
    !r || !d.current || Object.keys(re.current).length || (re.current = {
      top: r.style.top || "0",
      left: r.style.left || "0",
      right: r.style.right,
      height: r.style.height,
      bottom: r.style.bottom,
      minHeight: r.style.minHeight,
      maxHeight: r.style.maxHeight,
      marginTop: r.style.marginTop,
      marginBottom: r.style.marginBottom
    });
  }, [d, r]), Se(() => {
    m || b || (I.current = !1, i.current = !1, O.current = 0, P.current = 0, nt(r, re.current));
  }, [m, b, r, d]), Se(() => {
    const w = d.current;
    if (!(!m || !V || !r || !w || u.state.transitionStatus === "ending")) {
      if (!b) {
        I.current = !0, p.request(v), w.style.removeProperty("--transform-origin");
        return;
      }
      queueMicrotask(() => {
        const J = ho(w);
        w.style.removeProperty("--transform-origin");
        try {
          const ae = getComputedStyle(r), _ = getComputedStyle(w), xe = dt(V), ye = Tt(r), H = go(V), X = tt(V.getBoundingClientRect(), H), Z = tt(r.getBoundingClientRect(), H), G = X.left, ne = X.height, Q = M || w, g = Q.scrollHeight, Me = parseFloat(_.borderBottomWidth), Ie = parseFloat(ae.marginTop) || 10, we = parseFloat(ae.marginBottom) || 10, De = parseFloat(ae.minHeight) || 100, He = Nt(_), ee = 5, de = 5, le = 20, fe = xe.documentElement.clientHeight - Ie - we, We = xe.documentElement.clientWidth, Ue = fe - X.bottom + ne, qe = S.current, Re = T.current;
          let Ne, Ke = 0, Je = 0;
          if (qe && Re) {
            const D = tt(Re.getBoundingClientRect(), H);
            Ne = tt(qe.getBoundingClientRect(), H);
            const pe = D.left - G, he = Ne.left - Z.left, me = D.top - X.top + D.height / 2, Oe = Ne.top - Z.top + Ne.height / 2;
            Ke = pe - he, Je = Oe - me;
          }
          const Ye = Ue + Je + we + Me;
          let ve = Math.min(fe, Ye);
          const Ge = fe - Ie - we, Be = Ye - ve, Fe = Math.max(ee, G + Ke), rt = We - de, st = Math.max(0, Fe + Z.width - rt);
          r.style.left = `${Fe - st}px`, r.style.height = `${ve}px`, r.style.maxHeight = "auto", r.style.marginTop = `${Ie}px`, r.style.marginBottom = `${we}px`, w.style.height = "100%";
          const Ze = et(Q), $e = Be >= Ze - Ae;
          $e && (ve = Math.min(fe, Z.height) - (Be - Ze));
          const lt = X.top < le || X.bottom > fe - le || Math.ceil(ve) + Ae < Math.min(g, De), E = (ye.visualViewport?.scale ?? 1) !== 1 && Yn;
          if (lt || E) {
            I.current = !0, nt(r, re.current), Wn.flushSync(() => q(!1));
            return;
          }
          if ($e) {
            const D = Math.max(0, fe - Ye);
            r.style.top = Z.height >= Ge ? "0" : `${D}px`, r.style.height = `${ve}px`, Q.scrollTop = et(Q), O.current = Math.max(De, ve);
          } else
            r.style.bottom = "0", O.current = Math.max(De, ve), Q.scrollTop = Be;
          if (Ne) {
            const D = Z.top, pe = Z.height, he = Ne.top + Ne.height / 2, me = pe > 0 ? (he - D) / pe * 100 : 50, Oe = at(me, 0, 100);
            w.style.setProperty("--transform-origin", `50% ${Oe}%`);
          }
          (O.current === fe || ve >= He) && (i.current = !0), v(), setTimeout(() => {
            I.current = !0;
          });
        } finally {
          J();
        }
      });
    }
  }, [u, m, r, V, T, S, d, v, b, q, p, ge, oe, M]), n.useEffect(() => {
    if (!b || !r || !m)
      return;
    const w = Tt(r);
    function J(ae) {
      N(!1, Ve(Nn, ae));
    }
    return w.addEventListener("resize", J), () => {
      w.removeEventListener("resize", J);
    };
  }, [N, b, r, m]);
  const ue = {
    ...M ? {
      role: "presentation",
      "aria-orientation": void 0
    } : {
      role: "listbox",
      "aria-multiselectable": te || void 0,
      id: `${j}-list`
    },
    onKeyDown(w) {
      B.current = !0, k && jn.has(w.key) && w.stopPropagation();
    },
    onMouseMove() {
      B.current = !1;
    },
    onPointerLeave(w) {
      if (!C || Xt(w) || w.pointerType === "touch")
        return;
      const J = w.currentTarget;
      Y.start(0, () => {
        u.set("activeIndex", null), J.focus({
          preventScroll: !0
        });
      });
    },
    onScroll(w) {
      M || L(w.currentTarget);
    },
    ...b && {
      style: M ? {
        height: "100%"
      } : $t
    }
  }, Te = be("div", t, {
    ref: [o, d],
    state: se,
    stateAttributesMapping: mo,
    props: [W, ue, Ut(F), {
      className: !M && b ? ft.className : void 0
    }, c]
  });
  return /* @__PURE__ */ ze(n.Fragment, {
    children: [!z && ft.getElement(ie), /* @__PURE__ */ R(On, {
      context: K,
      modal: !1,
      disabled: !ce,
      returnFocus: l,
      restoreFocus: !0,
      children: Te
    })]
  });
});
process.env.NODE_ENV !== "production" && (Kt.displayName = "SelectPopup");
function Nt(e) {
  const t = e.maxHeight || "";
  return t.endsWith("px") && parseFloat(t) || 1 / 0;
}
function et(e) {
  return Math.max(0, e.scrollHeight - e.clientHeight);
}
function go(e) {
  return Un.getScale(e);
}
function tt(e, t) {
  return qn({
    x: e.x / t.x,
    y: e.y / t.y,
    width: e.width / t.x,
    height: e.height / t.y
  });
}
const At = [["transform", "none"], ["scale", "1"], ["translate", "0 0"]];
function ho(e) {
  const {
    style: t
  } = e, o = {};
  for (const [s, x] of At)
    o[s] = t.getPropertyValue(s), t.setProperty(s, x, "important");
  return () => {
    for (const [s] of At) {
      const x = o[s];
      x ? t.setProperty(s, x) : t.removeProperty(s);
    }
  };
}
const Jt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    className: s,
    render: x,
    ...l
  } = t, {
    store: c,
    scrollHandlerRef: u
  } = Ee(), {
    alignItemWithTriggerActive: d
  } = xt(), U = f(c, a.hasScrollArrows), N = f(c, a.openMethod), T = f(c, a.multiple), B = {
    id: `${f(c, a.id)}-list`,
    role: "listbox",
    "aria-multiselectable": T || void 0,
    onScroll(v) {
      u.current?.(v.currentTarget);
    },
    ...d && {
      style: $t
    },
    className: U && N !== "touch" ? ft.className : void 0
  }, te = Ce((v) => {
    c.set("listElement", v);
  });
  return be("div", t, {
    ref: [o, te],
    props: [B, l]
  });
});
process.env.NODE_ENV !== "production" && (Jt.displayName = "SelectList");
const vt = /* @__PURE__ */ n.createContext(void 0);
process.env.NODE_ENV !== "production" && (vt.displayName = "SelectItemContext");
function yt() {
  const e = n.useContext(vt);
  if (!e)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>." : Xe(57));
  return e;
}
const Zt = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    render: s,
    className: x,
    value: l = null,
    label: c,
    disabled: u = !1,
    nativeButton: d = !1,
    ...U
  } = t, N = n.useRef(null), T = Kn({
    label: c,
    textRef: N,
    indexGuessBehavior: Jn.GuessFromOrder
  }), {
    store: S,
    getItemProps: B,
    setOpen: te,
    setValue: v,
    selectionRef: $,
    typingRef: C,
    valuesRef: y,
    keyboardActiveRef: h,
    multiple: b,
    highlightItemOnHover: q
  } = Ee(), ge = Le(), oe = f(S, a.isActive, T.index), k = f(S, a.isSelected, T.index, l), K = f(S, a.isSelectedByFocus, T.index), ie = f(S, a.isItemEqualToValue), z = T.index, Y = z !== -1, j = n.useRef(null), m = pt(z);
  Se(() => {
    if (!Y)
      return;
    const p = y.current;
    return p[z] = l, () => {
      delete p[z];
    };
  }, [Y, z, l, y]), Se(() => {
    if (!Y)
      return;
    const p = S.state.value;
    let L = p;
    b && Array.isArray(p) && p.length > 0 && (L = p[p.length - 1]), L !== void 0 && ke(l, L, ie) && S.set("selectedIndex", z);
  }, [Y, z, b, ie, S, l]);
  const ce = {
    disabled: u,
    selected: k,
    highlighted: oe
  }, W = B({
    active: oe,
    selected: k
  });
  W.onFocus = void 0, W.id = void 0;
  const F = n.useRef(null), V = n.useRef("mouse"), r = n.useRef(!1), {
    getButtonProps: M,
    buttonRef: O
  } = Bt({
    disabled: u,
    focusableWhenDisabled: !0,
    native: d,
    composite: !0
  });
  function i(p) {
    const L = S.state.value;
    if (b) {
      const se = Array.isArray(L) ? L : [], ue = k ? ro(se, l, ie) : [...se, l];
      v(ue, Ve(it, p));
    } else
      v(l, Ve(it, p)), te(!1, Ve(it, p));
  }
  const P = {
    role: "option",
    "aria-selected": k,
    tabIndex: oe ? 0 : -1,
    onFocus() {
      S.set("activeIndex", z);
    },
    onMouseEnter() {
      !h.current && S.state.selectedIndex === null && q && S.set("activeIndex", z);
    },
    onMouseMove() {
      q && S.set("activeIndex", z);
    },
    onMouseLeave(p) {
      !q || h.current || Xt(p) || ge.start(0, () => {
        S.state.activeIndex === z && S.set("activeIndex", null);
      });
    },
    onTouchStart() {
      $.current = {
        allowSelectedMouseUp: !1,
        allowUnselectedMouseUp: !1
      };
    },
    onKeyDown(p) {
      F.current = p.key, S.set("activeIndex", z), p.key === " " && C.current && p.preventDefault();
    },
    onClick(p) {
      r.current = !1, !(p.type === "keydown" && F.current === null) && (u || p.type === "keydown" && F.current === " " && C.current || V.current !== "touch" && !oe || (F.current = null, i(p.nativeEvent)));
    },
    onPointerEnter(p) {
      V.current = p.pointerType;
    },
    onPointerDown(p) {
      V.current = p.pointerType, r.current = !0;
    },
    onMouseUp() {
      if (u)
        return;
      if (r.current) {
        r.current = !1;
        return;
      }
      const p = !$.current.allowSelectedMouseUp && k, L = !$.current.allowUnselectedMouseUp && !k;
      p || L || V.current !== "touch" && !oe || j.current?.click();
    }
  }, I = be("div", t, {
    ref: [O, o, T.ref, j],
    state: ce,
    props: [W, P, U, M]
  }), re = n.useMemo(() => ({
    selected: k,
    indexRef: m,
    textRef: N,
    selectedByFocus: K,
    hasRegistered: Y
  }), [k, m, N, K, Y]);
  return /* @__PURE__ */ R(vt.Provider, {
    value: re,
    children: I
  });
}));
process.env.NODE_ENV !== "production" && (Zt.displayName = "SelectItem");
const Qt = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const s = t.keepMounted ?? !1, {
    selected: x
  } = yt();
  return s || x ? /* @__PURE__ */ R(en, {
    ...t,
    ref: o
  }) : null;
});
process.env.NODE_ENV !== "production" && (Qt.displayName = "SelectItemIndicator");
const en = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef((e, t) => {
  const {
    render: o,
    className: s,
    keepMounted: x,
    ...l
  } = e, {
    selected: c
  } = yt(), u = n.useRef(null), {
    transitionStatus: d,
    setMounted: U
  } = mt(c), T = be("span", e, {
    ref: [t, u],
    state: {
      selected: c,
      transitionStatus: d
    },
    props: [{
      "aria-hidden": !0,
      children: "✔️"
    }, l],
    stateAttributesMapping: Lt
  });
  return ot({
    open: c,
    ref: u,
    onComplete() {
      c || U(!1);
    }
  }), T;
}));
process.env.NODE_ENV !== "production" && (en.displayName = "Inner");
const tn = /* @__PURE__ */ n.memo(/* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    indexRef: s,
    textRef: x,
    selectedByFocus: l,
    hasRegistered: c
  } = yt(), {
    selectedItemTextRef: u
  } = Ee(), {
    className: d,
    render: U,
    ...N
  } = t, T = n.useCallback((B) => {
    if (!B || !c)
      return;
    const te = u.current === null || !u.current.isConnected;
    (l || te && s.current === 0) && (u.current = B);
  }, [u, s, l, c]);
  return be("div", t, {
    ref: [T, o, x],
    props: N
  });
}));
process.env.NODE_ENV !== "production" && (tn.displayName = "SelectItemText");
const It = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    render: s,
    className: x,
    direction: l,
    keepMounted: c = !1,
    ...u
  } = t, {
    store: d,
    popupRef: U,
    listRef: N,
    handleScrollArrowVisibility: T,
    scrollArrowsMountedCountRef: S
  } = Ee(), {
    side: B,
    scrollDownArrowRef: te,
    scrollUpArrowRef: v
  } = xt(), $ = l === "up" ? a.scrollUpArrowVisible : a.scrollDownArrowVisible, C = f(d, $), y = f(d, a.openMethod), h = C && y !== "touch", b = Le(), q = l === "up" ? v : te, {
    transitionStatus: ge,
    setMounted: oe
  } = mt(h);
  Se(() => (S.current += 1, d.state.hasScrollArrows || d.set("hasScrollArrows", !0), () => {
    S.current = Math.max(0, S.current - 1), S.current === 0 && d.state.hasScrollArrows && d.set("hasScrollArrows", !1);
  }), [d, S]), ot({
    open: h,
    ref: q,
    onComplete() {
      h || oe(!1);
    }
  });
  const ie = be("div", t, {
    ref: [o, q],
    state: {
      direction: l,
      visible: h,
      side: B,
      transitionStatus: ge
    },
    props: [{
      "aria-hidden": !0,
      children: l === "up" ? "▲" : "▼",
      style: {
        position: "absolute"
      },
      onMouseMove(Y) {
        if (Y.movementX === 0 && Y.movementY === 0 || b.isStarted())
          return;
        d.set("activeIndex", null);
        function j() {
          const m = d.state.listElement ?? U.current;
          if (!m)
            return;
          d.set("activeIndex", null), T();
          const ce = m.scrollTop === 0, W = Math.round(m.scrollTop + m.clientHeight) >= m.scrollHeight;
          if (N.current.length === 0 && (l === "up" ? d.set("scrollUpArrowVisible", !ce) : d.set("scrollDownArrowVisible", !W)), l === "up" && ce || l === "down" && W) {
            b.clear();
            return;
          }
          if ((d.state.listElement || U.current) && N.current && N.current.length > 0) {
            const V = N.current, r = q.current?.offsetHeight || 0;
            if (l === "up") {
              let M = 0;
              const O = m.scrollTop + r;
              for (let P = 0; P < V.length; P += 1) {
                const I = V[P];
                if (I && I.offsetTop >= O) {
                  M = P;
                  break;
                }
              }
              const i = Math.max(0, M - 1);
              if (i < M) {
                const P = V[i];
                P && (m.scrollTop = Math.max(0, P.offsetTop - r));
              } else
                m.scrollTop = 0;
            } else {
              let M = V.length - 1;
              const O = m.scrollTop + m.clientHeight - r;
              for (let P = 0; P < V.length; P += 1) {
                const I = V[P];
                if (I && I.offsetTop + I.offsetHeight > O) {
                  M = Math.max(0, P - 1);
                  break;
                }
              }
              const i = Math.min(V.length - 1, M + 1);
              if (i > M) {
                const P = V[i];
                P && (m.scrollTop = P.offsetTop + P.offsetHeight - m.clientHeight + r);
              } else
                m.scrollTop = m.scrollHeight - m.clientHeight;
            }
          }
          b.start(40, j);
        }
        b.start(40, j);
      },
      onMouseLeave() {
        b.clear();
      }
    }, u]
  });
  return h || c ? ie : null;
});
process.env.NODE_ENV !== "production" && (It.displayName = "SelectScrollArrow");
const nn = /* @__PURE__ */ n.forwardRef(function(t, o) {
  return /* @__PURE__ */ R(It, {
    ...t,
    ref: o,
    direction: "down"
  });
});
process.env.NODE_ENV !== "production" && (nn.displayName = "SelectScrollDownArrow");
const on = /* @__PURE__ */ n.forwardRef(function(t, o) {
  return /* @__PURE__ */ R(It, {
    ...t,
    ref: o,
    direction: "up"
  });
});
process.env.NODE_ENV !== "production" && (on.displayName = "SelectScrollUpArrow");
const wt = /* @__PURE__ */ n.createContext(void 0);
process.env.NODE_ENV !== "production" && (wt.displayName = "SelectGroupContext");
function So() {
  const e = n.useContext(wt);
  if (e === void 0)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>." : Xe(56));
  return e;
}
const rn = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    className: s,
    render: x,
    ...l
  } = t, [c, u] = n.useState(), d = n.useMemo(() => ({
    labelId: c,
    setLabelId: u
  }), [c, u]), U = be("div", t, {
    ref: o,
    props: [{
      role: "group",
      "aria-labelledby": c
    }, l]
  });
  return /* @__PURE__ */ R(wt.Provider, {
    value: d,
    children: U
  });
});
process.env.NODE_ENV !== "production" && (rn.displayName = "SelectGroup");
const sn = /* @__PURE__ */ n.forwardRef(function(t, o) {
  const {
    className: s,
    render: x,
    id: l,
    ...c
  } = t, {
    setLabelId: u
  } = So(), d = Zn(l);
  return Se(() => {
    u(d);
  }, [d, u]), be("div", t, {
    ref: o,
    props: [{
      id: d
    }, c]
  });
});
process.env.NODE_ENV !== "production" && (sn.displayName = "SelectGroupLabel");
const sr = ao;
function lr({ className: e, ...t }) {
  return /* @__PURE__ */ R(
    rn,
    {
      className: Pe("scroll-my-1 p-1", e),
      "data-slot": "select-group",
      ...t
    }
  );
}
function ir({ className: e, ...t }) {
  return /* @__PURE__ */ R(
    Wt,
    {
      className: Pe("flex flex-1 text-left", e),
      "data-slot": "select-value",
      ...t
    }
  );
}
function ar({
  className: e,
  size: t = "default",
  children: o,
  ...s
}) {
  return /* @__PURE__ */ ze(
    zt,
    {
      className: Pe(
        "flex w-fit items-center justify-between gap-1.5 whitespace-nowrap rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 data-placeholder:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
        e
      ),
      "data-size": t,
      "data-slot": "select-trigger",
      ...s,
      children: [
        o,
        /* @__PURE__ */ R(
          qt,
          {
            render: /* @__PURE__ */ R(Ct, { className: "pointer-events-none size-4 text-muted-foreground" })
          }
        )
      ]
    }
  );
}
function cr({
  className: e,
  children: t,
  side: o = "bottom",
  sideOffset: s = 4,
  align: x = "center",
  alignOffset: l = 0,
  alignItemWithTrigger: c = !1,
  ...u
}) {
  return /* @__PURE__ */ R(Gt, { children: /* @__PURE__ */ R(
    jt,
    {
      align: x,
      alignItemWithTrigger: c,
      alignOffset: l,
      className: "isolate z-50",
      side: o,
      sideOffset: s,
      children: /* @__PURE__ */ ze(
        Kt,
        {
          className: Pe(
            "data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:fade-in-0 data-open:zoom-in-95 data-closed:fade-out-0 data-closed:zoom-out-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in",
            e
          ),
          "data-align-trigger": c,
          "data-slot": "select-content",
          ...u,
          children: [
            /* @__PURE__ */ R(bo, {}),
            /* @__PURE__ */ R(Jt, { children: t }),
            /* @__PURE__ */ R(xo, {})
          ]
        }
      )
    }
  ) });
}
function ur({
  className: e,
  ...t
}) {
  return /* @__PURE__ */ R(
    sn,
    {
      className: Pe("px-2 py-1.5 text-muted-foreground text-xs", e),
      "data-slot": "select-label",
      ...t
    }
  );
}
function dr({
  className: e,
  children: t,
  ...o
}) {
  return /* @__PURE__ */ ze(
    Zt,
    {
      className: Pe(
        "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
        e
      ),
      "data-slot": "select-item",
      ...o,
      children: [
        /* @__PURE__ */ R(tn, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children: t }),
        /* @__PURE__ */ R(
          Qt,
          {
            render: /* @__PURE__ */ R("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center" }),
            children: /* @__PURE__ */ R(ln, { className: "pointer-events-none" })
          }
        )
      ]
    }
  );
}
function fr({
  className: e,
  ...t
}) {
  return /* @__PURE__ */ R(
    Qn,
    {
      className: Pe("pointer-events-none -mx-1 my-1 h-px bg-border", e),
      "data-slot": "select-separator",
      ...t
    }
  );
}
function bo({
  className: e,
  ...t
}) {
  return /* @__PURE__ */ R(
    on,
    {
      className: Pe(
        "top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
        e
      ),
      "data-slot": "select-scroll-up-button",
      ...t,
      children: /* @__PURE__ */ R(an, {})
    }
  );
}
function xo({
  className: e,
  ...t
}) {
  return /* @__PURE__ */ R(
    nn,
    {
      className: Pe(
        "bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",
        e
      ),
      "data-slot": "select-scroll-down-button",
      ...t,
      children: /* @__PURE__ */ R(Ct, {})
    }
  );
}
export {
  sr as Select,
  cr as SelectContent,
  lr as SelectGroup,
  dr as SelectItem,
  ur as SelectLabel,
  xo as SelectScrollDownButton,
  bo as SelectScrollUpButton,
  fr as SelectSeparator,
  ar as SelectTrigger,
  ir as SelectValue
};
