"use client";
import { jsx as ye, jsxs as Qe } from "react/jsx-runtime";
import { cn as Pt } from "../../../lib/utils.js";
import * as l from "react";
import { o as Te } from "../../../owner-rKN292Q9.js";
import { u as wt } from "../../../useControlled-Sx-_x7Sz.js";
import { u as U } from "../../../useStableCallback-CudqoENs.js";
import { u as Ze } from "../../../useValueAsRef-LhoZc6As.js";
import { u as Ke } from "../../../useIsoLayoutEffect-DpJo20by.js";
import { f as Et, w as Nt, u as Oe, m as At, c as Vt } from "../../../useRenderElement-DNB2vtF1.js";
import { c as Me, n as Tt, h as et, k as Mt, j as Ot, m as Lt, p as Ge } from "../../../createBaseUIEventDetails-CqidROtw.js";
import { u as Ft } from "../../../useValueChanged-Bissqjjn.js";
import { u as qe } from "../../../useBaseUiId-C8Dq0BQq.js";
import { c as le, u as Bt } from "../../../clamp-BxE4ZAuA.js";
import { C as Dt } from "../../../CompositeList-yq5K_yj6.js";
import { f as kt, c as _t, a as tt, u as $t, b as Ht } from "../../../LabelableContext-Dzw1DWuj.js";
import { g as zt, r as Ut } from "../../../resolveAriaLabelledBy-B5vw-szP.js";
import { a as nt, c as Wt } from "../../../element-DSo91iOi.js";
import { a as We } from "../../../floating-ui.utils.dom-jr2suqy2.js";
import { u as Kt } from "../../../useAnimationFrame-DIc6eFHa.js";
import { u as rt } from "../../../DirectionContext-BSOheMwC.js";
import { u as ot } from "../../../useOnMount-JHtE6teb.js";
import { a as _e, v as Ye } from "../../../valueToPercent-BBgE4D3L.js";
import { a as Xe } from "../../../visuallyHidden-PuyyGHVF.js";
import { C as qt, H as it, E as st, d as at, b as lt, c as ut, e as ct } from "../../../composite-BSpUD7nI.js";
import { u as Yt } from "../../../useCompositeListItem-CYQrZg5-.js";
import { u as jt } from "../../../useLabelableId-DF_d91GP.js";
function dt(e, t, r = (i, o) => i === o) {
  return e.length === t.length && e.every((i, o) => r(i, t[o]));
}
function ft(e, t) {
  return e - t;
}
function Gt(e, t, r) {
  const i = e.slice();
  return i[t] = r, i.sort(ft);
}
function mt(e, t, r, i, o, u) {
  let a = e;
  return a = le(a, r, i), o && (a = Gt(
    u,
    t,
    // Bound the new value to the thumb's neighbours.
    le(a, u[t - 1] || -1 / 0, u[t + 1] || 1 / 0)
  )), a;
}
function pt(e, t, r) {
  if (!Array.isArray(e))
    return !0;
  const i = e.reduce((o, u, a, p) => (a === p.length - 1 || o.push(Math.abs(u - p[a + 1])), o), []);
  return Math.min(...i) >= t * r;
}
const Le = {
  activeThumbIndex: () => null,
  max: () => null,
  min: () => null,
  minStepsBetweenValues: () => null,
  step: () => null,
  values: () => null,
  ...kt
}, je = /* @__PURE__ */ l.createContext(void 0);
process.env.NODE_ENV !== "production" && (je.displayName = "SliderRootContext");
function $e() {
  const e = l.useContext(je);
  if (e === void 0)
    throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>." : Et(62));
  return e;
}
function Xt(e) {
  return "key" in e ? Mt : Ot;
}
function Jt(e, t) {
  return typeof e == "number" && typeof t == "number" ? e === t : Array.isArray(e) && Array.isArray(t) ? dt(e, t) : !1;
}
const ht = /* @__PURE__ */ l.forwardRef(function(t, r) {
  const {
    "aria-labelledby": i,
    className: o,
    defaultValue: u,
    disabled: a = !1,
    id: p,
    format: f,
    largeStep: N = 10,
    locale: b,
    render: F,
    max: A = 100,
    min: g = 0,
    minStepsBetweenValues: s = 0,
    name: V,
    onValueChange: I,
    onValueCommitted: w,
    orientation: v = "horizontal",
    step: k = 1,
    thumbCollisionBehavior: he = "push",
    thumbAlignment: fe = "center",
    value: J,
    ...Q
  } = t, Z = qe(p), ee = zt(Z), te = U(I), z = U(w), {
    clearErrors: K
  } = _t(), {
    state: P,
    disabled: q,
    name: O,
    setTouched: W,
    setDirty: h,
    validityData: S,
    shouldValidateOnChange: ue,
    validation: _
  } = tt(), {
    labelId: Y
  } = $t(), [Re, ce] = l.useState(), be = i ?? Ut(Y, Re), $ = q || a, ne = O ?? V, [E, ge] = wt({
    controlled: J,
    default: u ?? g,
    name: "Slider"
  }), B = l.useRef(null), L = l.useRef(null), j = l.useRef([]), ve = l.useRef(null), re = l.useRef(null), n = l.useRef(-1), d = l.useRef(null), c = l.useRef(null), y = l.useRef("none"), m = Ze(f), [T, G] = l.useState(-1), [oe, me] = l.useState(-1), [de, Ie] = l.useState(!1), [Se, Ae] = l.useState(() => /* @__PURE__ */ new Map()), [x, Ce] = l.useState([void 0, void 0]), D = U((C) => {
    G(C), C !== -1 && me(C);
  });
  Ht({
    id: Z,
    commit: _.commit,
    value: E,
    controlRef: L,
    name: ne,
    getValue: () => E
  }), Ft(E, () => {
    K(ne), ue() ? _.commit(E) : _.commit(E, !0);
    const C = S.initialValue;
    let se;
    Array.isArray(E) && Array.isArray(C) ? se = !dt(E, C) : se = E !== C, h(se);
  });
  const ie = U((C) => {
    C && (L.current = C);
  }), X = Array.isArray(E), xe = l.useMemo(() => X ? E.slice().sort(ft) : [le(E, g, A)], [A, g, X, E]), Pe = U((C, se) => {
    if (Number.isNaN(C) || Jt(C, E))
      return;
    const ae = se ?? Me(Tt, void 0, void 0, {
      activeThumbIndex: -1
    });
    y.current = ae.reason;
    const pe = ae.event, Ve = pe.constructor ?? Event, R = new Ve(pe.type, pe);
    Object.defineProperty(R, "target", {
      writable: !0,
      value: {
        value: C,
        name: ne
      }
    }), ae.event = R, c.current = C, te(C, ae), !ae.isCanceled && ge(C);
  }), Fe = U((C, se, ae) => {
    const pe = mt(C, se, g, A, X, xe);
    if (pt(pe, k, s)) {
      const Ve = Xt(ae);
      Pe(pe, Me(Ve, ae.nativeEvent, void 0, {
        activeThumbIndex: se
      })), W(!0);
      const R = c.current ?? pe;
      z(R, et(Ve, ae.nativeEvent));
    }
  });
  process.env.NODE_ENV !== "production" && g >= A && Nt("Slider `max` must be greater than `min`."), Ke(() => {
    const C = nt(Te(B.current));
    $ && C && B.current?.contains(C) && C.blur();
  }, [$]), $ && T !== -1 && D(-1);
  const we = l.useMemo(() => ({
    ...P,
    activeThumbIndex: T,
    disabled: $,
    dragging: de,
    orientation: v,
    max: A,
    min: g,
    minStepsBetweenValues: s,
    step: k,
    values: xe
  }), [P, T, $, de, A, g, s, v, k, xe]), Ee = l.useMemo(() => ({
    active: T,
    controlRef: L,
    disabled: $,
    dragging: de,
    validation: _,
    formatOptionsRef: m,
    handleInputChange: Fe,
    indicatorPosition: x,
    inset: fe !== "center",
    labelId: be,
    rootLabelId: ee,
    largeStep: N,
    lastUsedThumbIndex: oe,
    lastChangedValueRef: c,
    lastChangeReasonRef: y,
    locale: b,
    max: A,
    min: g,
    minStepsBetweenValues: s,
    name: ne,
    onValueCommitted: z,
    orientation: v,
    pressedInputRef: ve,
    pressedThumbCenterOffsetRef: re,
    pressedThumbIndexRef: n,
    pressedValuesRef: d,
    registerFieldControlRef: ie,
    renderBeforeHydration: fe === "edge",
    setActive: D,
    setDragging: Ie,
    setIndicatorPosition: Ce,
    setLabelId: ce,
    setValue: Pe,
    state: we,
    step: k,
    thumbCollisionBehavior: he,
    thumbMap: Se,
    thumbRefs: j,
    values: xe
  }), [T, L, be, ee, $, de, _, m, Fe, x, N, oe, c, y, b, A, g, s, ne, z, v, ve, re, n, d, ie, D, Ie, Ce, ce, Pe, we, k, he, fe, Se, j, xe]), He = Oe("div", t, {
    state: we,
    ref: [r, B],
    props: [{
      "aria-labelledby": be,
      id: Z,
      role: "group"
    }, _.getValidationProps, Q],
    stateAttributesMapping: Le
  });
  return /* @__PURE__ */ ye(je.Provider, {
    value: Ee,
    children: /* @__PURE__ */ ye(Dt, {
      elementsRef: j,
      onMapChange: Ae,
      children: He
    })
  });
});
process.env.NODE_ENV !== "production" && (ht.displayName = "SliderRoot");
function bt(e) {
  const t = e.getBoundingClientRect();
  return {
    x: (t.left + t.right) / 2,
    y: (t.top + t.bottom) / 2
  };
}
function Qt(e) {
  if (Math.abs(e) < 1) {
    const r = e.toExponential().split("e-"), i = r[0].split(".")[1];
    return (i ? i.length : 0) + parseInt(r[1], 10);
  }
  const t = e.toString().split(".")[1];
  return t ? t.length : 0;
}
function gt(e, t, r) {
  const i = Math.round((e - r) / t) * t + r;
  return Number(i.toFixed(Qt(t)));
}
function Je({
  values: e,
  index: t,
  nextValue: r,
  min: i,
  max: o,
  step: u,
  minStepsBetweenValues: a,
  initialValues: p
}) {
  if (e.length === 0)
    return [];
  const f = e.slice(), N = u * a, b = f.length - 1, F = p ?? e, A = i + t * N, g = o - (b - t) * N;
  f[t] = le(r, A, g);
  for (let s = t + 1; s <= b; s += 1) {
    const V = f[s - 1] + N, I = o - (b - s) * N, w = F[s] ?? f[s];
    let v = Math.max(f[s], V);
    w < v && (v = Math.max(w, V)), f[s] = le(v, V, I);
  }
  for (let s = t - 1; s >= 0; s -= 1) {
    const V = f[s + 1] - N, I = i + s * N, w = F[s] ?? f[s];
    let v = Math.min(f[s], V);
    w > v && (v = Math.min(w, V)), f[s] = le(v, I, V);
  }
  for (let s = 0; s <= b; s += 1)
    f[s] = Number(f[s].toFixed(12));
  return f;
}
function Zt({
  behavior: e,
  values: t,
  currentValues: r,
  initialValues: i,
  pressedIndex: o,
  nextValue: u,
  min: a,
  max: p,
  step: f,
  minStepsBetweenValues: N
}) {
  const b = r ?? t, F = i ?? t;
  if (!(b.length > 1))
    return {
      value: u,
      thumbIndex: 0,
      didSwap: !1
    };
  const g = f * N;
  switch (e) {
    case "swap": {
      const s = b[o], V = 1e-7, I = b.slice(), w = I[o - 1], v = I[o + 1], k = w != null ? w + g : a, he = v != null ? v - g : p, fe = le(u, k, he), J = Number(fe.toFixed(12));
      I[o] = J;
      const Q = u > s, Z = u < s, ee = Q && v != null && u >= v - V, te = Z && w != null && u <= w + V;
      if (!ee && !te)
        return {
          value: I,
          thumbIndex: o,
          didSwap: !1
        };
      const z = ee ? o + 1 : o - 1, K = I.map((W, h) => {
        if (h === o)
          return J;
        const S = F[h];
        return S ?? b[h];
      });
      let P = u;
      ee ? P = Math.max(u, I[z]) : P = Math.min(u, I[z]);
      const q = Je({
        values: I,
        index: z,
        nextValue: P,
        min: a,
        max: p,
        step: f,
        minStepsBetweenValues: N,
        initialValues: K
      }), O = ee ? z - 1 : z + 1;
      if (O >= 0 && O < q.length) {
        const W = q[O - 1], h = q[O + 1];
        let S = W != null ? W + g : a;
        S = Math.max(S, a + O * g);
        let ue = h != null ? h - g : p;
        ue = Math.min(ue, p - (q.length - 1 - O) * g);
        const _ = le(J, S, ue);
        q[O] = Number(_.toFixed(12));
      }
      return {
        value: q,
        thumbIndex: z,
        didSwap: !0
      };
    }
    case "push":
      return {
        value: Je({
          values: b,
          index: o,
          nextValue: u,
          min: a,
          max: p,
          step: f,
          minStepsBetweenValues: N
        }),
        thumbIndex: o,
        didSwap: !1
      };
    default: {
      const s = b.slice(), V = s[o - 1], I = s[o + 1], w = V != null ? V + g : a, v = I != null ? I - g : p, k = le(u, w, v);
      return s[o] = Number(k.toFixed(12)), {
        value: s,
        thumbIndex: o,
        didSwap: !1
      };
    }
  }
}
const en = 2;
function tn(e, t) {
  if (!e)
    return {
      start: 0,
      end: 0
    };
  function r(u) {
    const a = u != null ? parseFloat(u) : 0;
    return Number.isNaN(a) ? 0 : a;
  }
  const i = t ? "Top" : "InlineStart", o = t ? "Bottom" : "InlineEnd";
  return {
    start: r(e[`border${i}Width`]) + r(e[`padding${i}`]),
    end: r(e[`border${o}Width`]) + r(e[`padding${o}`])
  };
}
function ke(e, t) {
  if (t.current != null && e.changedTouches) {
    const r = e;
    for (let i = 0; i < r.changedTouches.length; i += 1) {
      const o = r.changedTouches[i];
      if (o.identifier === t.current)
        return {
          x: o.clientX,
          y: o.clientY
        };
    }
    return null;
  }
  return {
    x: e.clientX,
    y: e.clientY
  };
}
const vt = /* @__PURE__ */ l.forwardRef(function(t, r) {
  const {
    render: i,
    className: o,
    ...u
  } = t, {
    disabled: a,
    dragging: p,
    inset: f,
    lastChangedValueRef: N,
    lastChangeReasonRef: b,
    max: F,
    min: A,
    minStepsBetweenValues: g,
    onValueCommitted: s,
    orientation: V,
    pressedInputRef: I,
    pressedThumbCenterOffsetRef: w,
    pressedThumbIndexRef: v,
    pressedValuesRef: k,
    registerFieldControlRef: he,
    renderBeforeHydration: fe,
    setActive: J,
    setDragging: Q,
    setValue: Z,
    state: ee,
    step: te,
    thumbCollisionBehavior: z,
    thumbRefs: K,
    values: P
  } = $e(), q = rt(), O = P.length > 1, W = V === "vertical", h = l.useRef(null), S = l.useRef(null), ue = U((n) => {
    n && S.current == null && S.current == null && (S.current = getComputedStyle(n));
  }), _ = l.useRef(null), Y = l.useRef(0), Re = l.useRef(0), ce = Ze(P), be = U((n) => {
    v.current !== n && (v.current = n);
    const d = K.current[n];
    if (!d) {
      w.current = null, I.current = null;
      return;
    }
    I.current = d.querySelector('input[type="range"]');
  }), $ = U((n) => {
    const d = h.current;
    if (!d)
      return null;
    const {
      width: c,
      height: y,
      bottom: m,
      left: T,
      right: G
    } = d.getBoundingClientRect(), oe = tn(S.current, W), me = Re.current, de = (W ? y : c) - oe.start - oe.end - me * 2, Ie = w.current ?? 0, Se = n.x - Ie, Ae = n.y - Ie, x = W ? m - Ae - oe.end : (q === "rtl" ? G - Se : Se - T) - oe.start, Ce = le((x - me) / de, 0, 1);
    let D = (F - A) * Ce + A;
    if (D = gt(D, te, A), D = le(D, A, F), !O)
      return {
        value: D,
        thumbIndex: 0,
        didSwap: !1
      };
    const ie = v.current;
    if (ie < 0)
      return null;
    const X = Zt({
      behavior: z,
      values: P,
      currentValues: ce.current ?? P,
      initialValues: k.current,
      pressedIndex: ie,
      nextValue: D,
      min: A,
      max: F,
      step: te,
      minStepsBetweenValues: g
    });
    return z === "swap" && X.didSwap ? be(X.thumbIndex) : v.current = X.thumbIndex, X;
  }), ne = U((n) => {
    k.current = O ? P.slice() : null, ce.current = P;
    const d = v.current;
    let c = d;
    if (d > -1 && d < P.length) {
      if (P[d] === F) {
        let y = d;
        for (; y > 0 && P[y - 1] === F; )
          y -= 1;
        c = y;
      }
    } else {
      const y = W ? "y" : "x";
      let m;
      c = -1;
      for (let T = 0; T < K.current.length; T += 1) {
        const G = K.current[T];
        if (We(G)) {
          const oe = bt(G), me = Math.abs(n[y] - oe[y]);
          (m === void 0 || me <= m) && (c = T, m = me);
        }
      }
    }
    if (c > -1 && c !== d && be(c), f) {
      const y = K.current[c];
      if (We(y)) {
        const m = y.getBoundingClientRect(), T = W ? "height" : "width";
        Re.current = m[T] / 2;
      }
    }
  }), E = U((n) => {
    K.current?.[n]?.querySelector('input[type="range"]')?.focus({
      preventScroll: !0
    });
  }), ge = U((n) => {
    const d = ke(n, _);
    if (d == null)
      return;
    if (Y.current += 1, n.type === "pointermove" && n.buttons === 0) {
      B(n);
      return;
    }
    const c = $(d);
    c != null && pt(c.value, te, g) && (!p && Y.current > en && Q(!0), Z(c.value, Me(Lt, n, void 0, {
      activeThumbIndex: c.thumbIndex
    })), ce.current = Array.isArray(c.value) ? c.value : [c.value], c.didSwap && E(c.thumbIndex));
  });
  function B(n) {
    J(-1), Q(!1), I.current = null, w.current = null;
    const d = ke(n, _), c = d != null ? $(d) : null;
    if (c != null) {
      const y = b.current;
      s(N.current ?? c.value, et(y, n));
    }
    "pointerType" in n && h.current?.hasPointerCapture(n.pointerId) && h.current?.releasePointerCapture(n.pointerId), v.current = -1, _.current = null, k.current = null, j();
  }
  const L = U((n) => {
    if (a)
      return;
    const d = n.changedTouches[0];
    d != null && (_.current = d.identifier);
    const c = ke(n, _);
    if (c != null) {
      ne(c);
      const m = $(c);
      if (m == null)
        return;
      E(m.thumbIndex), Z(m.value, Me(Ge, n, void 0, {
        activeThumbIndex: m.thumbIndex
      })), ce.current = Array.isArray(m.value) ? m.value : [m.value], m.didSwap && E(m.thumbIndex);
    }
    Y.current = 0;
    const y = Te(h.current);
    y.addEventListener("touchmove", ge, {
      passive: !0
    }), y.addEventListener("touchend", B, {
      passive: !0
    });
  }), j = U(() => {
    const n = Te(h.current);
    n.removeEventListener("pointermove", ge), n.removeEventListener("pointerup", B), n.removeEventListener("touchmove", ge), n.removeEventListener("touchend", B), k.current = null;
  }), ve = Kt();
  return l.useEffect(() => {
    const n = h.current;
    return n ? (n.addEventListener("touchstart", L, {
      passive: !0
    }), () => {
      n.removeEventListener("touchstart", L), ve.cancel(), j();
    }) : () => j();
  }, [j, L, h, ve]), l.useEffect(() => {
    a && j();
  }, [a, j]), Oe("div", t, {
    state: ee,
    ref: [r, he, h, ue],
    props: [{
      "data-base-ui-slider-control": fe ? "" : void 0,
      onPointerDown(n) {
        const d = h.current;
        if (!d || a || n.defaultPrevented || !We(n.target) || // Only handle left clicks
        n.button !== 0)
          return;
        const c = ke(n, _);
        if (c != null) {
          ne(c);
          const m = $(c);
          if (m == null)
            return;
          Wt(K.current[m.thumbIndex], nt(Te(d))) ? n.preventDefault() : ve.request(() => {
            E(m.thumbIndex);
          }), Q(!0), w.current != null || (Z(m.value, Me(Ge, n.nativeEvent, void 0, {
            activeThumbIndex: m.thumbIndex
          })), ce.current = Array.isArray(m.value) ? m.value : [m.value], m.didSwap && E(m.thumbIndex));
        }
        n.nativeEvent.pointerId && d.setPointerCapture(n.nativeEvent.pointerId), Y.current = 0;
        const y = Te(h.current);
        y.addEventListener("pointermove", ge, {
          passive: !0
        }), y.addEventListener("pointerup", B, {
          once: !0
        });
      },
      tabIndex: -1
    }, u],
    stateAttributesMapping: Le
  });
});
process.env.NODE_ENV !== "production" && (vt.displayName = "SliderControl");
const yt = /* @__PURE__ */ l.forwardRef(function(t, r) {
  const {
    render: i,
    className: o,
    ...u
  } = t, {
    state: a
  } = $e();
  return Oe("div", t, {
    state: a,
    ref: r,
    props: [{
      style: {
        position: "relative"
      }
    }, u],
    stateAttributesMapping: Le
  });
});
process.env.NODE_ENV !== "production" && (yt.displayName = "SliderTrack");
let nn = /* @__PURE__ */ (function(e) {
  return e.index = "data-index", e.dragging = "data-dragging", e.orientation = "data-orientation", e.disabled = "data-disabled", e.valid = "data-valid", e.invalid = "data-invalid", e.touched = "data-touched", e.dirty = "data-dirty", e.focused = "data-focused", e;
})({});
const rn = '!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();', Rt = "PageUp", It = "PageDown", on = /* @__PURE__ */ new Set([ct, lt, at, ut, it, st, Rt, It]);
function sn(e, t, r, i) {
  if (!(t < 0))
    return e.length === 2 ? t === 0 ? `${_e(e[t], i, r)} start range` : `${_e(e[t], i, r)} end range` : r ? _e(e[t], i, r) : void 0;
}
function Ne(e, t, r, i, o) {
  return r === 1 ? Math.min(e + t, o) : Math.max(e - t, i);
}
const St = /* @__PURE__ */ l.forwardRef(function(t, r) {
  const {
    render: i,
    children: o,
    className: u,
    "aria-describedby": a,
    "aria-label": p,
    "aria-labelledby": f,
    disabled: N = !1,
    getAriaLabel: b,
    getAriaValueText: F,
    id: A,
    index: g,
    inputRef: s,
    onBlur: V,
    onFocus: I,
    onKeyDown: w,
    tabIndex: v,
    ...k
  } = t, {
    nonce: he
  } = Bt(), fe = qe(A), {
    active: J,
    lastUsedThumbIndex: Q,
    controlRef: Z,
    disabled: ee,
    validation: te,
    formatOptionsRef: z,
    handleInputChange: K,
    inset: P,
    labelId: q,
    largeStep: O,
    locale: W,
    max: h,
    min: S,
    minStepsBetweenValues: ue,
    name: _,
    orientation: Y,
    pressedInputRef: Re,
    pressedThumbCenterOffsetRef: ce,
    pressedThumbIndexRef: be,
    renderBeforeHydration: $,
    setActive: ne,
    setIndicatorPosition: E,
    state: ge,
    step: B,
    values: L
  } = $e(), j = rt(), ve = N || ee, re = L.length > 1, n = Y === "vertical", d = j === "rtl", {
    setTouched: c,
    setFocused: y,
    validationMode: m
  } = tt(), T = l.useRef(null), G = l.useRef(null), oe = qe(), me = jt(), de = re ? oe : me, Ie = l.useMemo(() => ({
    inputId: de
  }), [de]), {
    ref: Se,
    index: Ae
  } = Yt({
    metadata: Ie
  }), x = re ? g ?? Ae : 0, Ce = x === L.length - 1, D = L[x], ie = Ye(D, S, h), [X, xe] = l.useState(!1), [Pe, Fe] = l.useState();
  ot(() => xe(!0));
  const we = Q >= 0 && Q < L.length ? Q : -1, Ee = U(() => {
    const R = Z.current, M = T.current;
    if (!R || !M)
      return;
    const H = M.getBoundingClientRect(), Be = R.getBoundingClientRect(), De = n ? "height" : "width", xt = Be[De] - H[De], ze = (H[De] / 2 + xt * ie / 100) / Be[De] * 100;
    Fe(ze), x === 0 ? E((Ue) => [ze, Ue[1]]) : Ce && E((Ue) => [Ue[0], ze]);
  });
  Ke(() => {
    P && queueMicrotask(Ee);
  }, [Ee, P]), Ke(() => {
    P && Ee();
  }, [Ee, P, ie]);
  const He = l.useCallback(() => {
    const R = n ? "bottom" : "insetInlineStart", M = n ? "left" : "top";
    let H;
    return re ? J === x ? H = 2 : we === x && (H = 1) : J === x && (H = 1), P ? {
      "--position": `${Pe}%`,
      visibility: $ && !X || Pe === void 0 ? "hidden" : void 0,
      position: "absolute",
      [R]: "var(--position)",
      [M]: "50%",
      translate: `${(n || !d ? -1 : 1) * 50}% ${(n ? 1 : -1) * 50}%`,
      zIndex: H
    } : Number.isFinite(ie) ? {
      position: "absolute",
      [R]: `${ie}%`,
      [M]: "50%",
      translate: `${(n || !d ? -1 : 1) * 50}% ${(n ? 1 : -1) * 50}%`,
      zIndex: H
    } : Xe;
  }, [J, x, P, X, Pe, re, $, d, we, ie, n]);
  let C;
  Y === "vertical" && (C = d ? "vertical-rl" : "vertical-lr");
  const se = typeof b == "function" ? b(x) : p, ae = At({
    "aria-label": se,
    "aria-labelledby": f ?? (se == null ? q : void 0),
    "aria-describedby": a,
    "aria-orientation": Y,
    "aria-valuenow": D,
    "aria-valuetext": typeof F == "function" ? F(_e(D, W, z.current ?? void 0), D, x) : sn(L, x, z.current ?? void 0, W),
    disabled: ve,
    id: de,
    max: h,
    min: S,
    name: _,
    onChange(R) {
      K(R.target.valueAsNumber, x, R);
    },
    onFocus() {
      ne(x), y(!0);
    },
    onBlur() {
      T.current && (ne(-1), c(!0), y(!1), m === "onBlur" && te.commit(mt(D, x, S, h, re, L)));
    },
    onKeyDown(R) {
      if (!on.has(R.key))
        return;
      qt.has(R.key) && R.stopPropagation();
      let M = null;
      const H = gt(D, B, S);
      switch (R.key) {
        case ct:
          M = Ne(H, R.shiftKey ? O : B, 1, S, h);
          break;
        case ut:
          M = Ne(H, R.shiftKey ? O : B, d ? -1 : 1, S, h);
          break;
        case lt:
          M = Ne(H, R.shiftKey ? O : B, -1, S, h);
          break;
        case at:
          M = Ne(H, R.shiftKey ? O : B, d ? 1 : -1, S, h);
          break;
        case Rt:
          M = Ne(H, O, 1, S, h);
          break;
        case It:
          M = Ne(H, O, -1, S, h);
          break;
        case st:
          M = h, re && (M = Number.isFinite(L[x + 1]) ? L[x + 1] - B * ue : h);
          break;
        case it:
          M = S, re && (M = Number.isFinite(L[x - 1]) ? L[x - 1] + B * ue : S);
          break;
      }
      M !== null && (K(M, x, R), R.preventDefault());
    },
    step: B,
    style: {
      ...Xe,
      // So that VoiceOver's focus indicator matches the thumb's dimensions
      width: "100%",
      height: "100%",
      writingMode: C
    },
    tabIndex: v ?? void 0,
    type: "range",
    value: D ?? ""
  }, te.getInputValidationProps), pe = Vt(G, te.inputRef, s);
  return Oe("div", t, {
    state: ge,
    ref: [r, Se, T],
    props: [{
      [nn.index]: x,
      children: /* @__PURE__ */ Qe(l.Fragment, {
        children: [o, /* @__PURE__ */ ye("input", {
          ref: pe,
          ...ae
        }), P && !X && $ && // this must be rendered with the last thumb to ensure all
        // preceding thumbs are already rendered in the DOM
        Ce && /* @__PURE__ */ ye("script", {
          nonce: he,
          dangerouslySetInnerHTML: {
            __html: rn
          },
          suppressHydrationWarning: !0
        })]
      }),
      id: fe,
      onBlur: V,
      onFocus: I,
      onPointerDown(R) {
        if (be.current = x, T.current != null) {
          const M = Y === "horizontal" ? "x" : "y", H = bt(T.current), Be = (Y === "horizontal" ? R.clientX : R.clientY) - H[M];
          ce.current = Be;
        }
        G.current != null && Re.current !== G.current && (Re.current = G.current);
      },
      style: He(),
      suppressHydrationWarning: $ || void 0,
      tabIndex: -1
    }, k],
    stateAttributesMapping: Le
  });
});
process.env.NODE_ENV !== "production" && (St.displayName = "SliderThumb");
function an(e, t, r, i, o, u) {
  const a = r === void 0 || t && i === void 0 ? "hidden" : void 0, p = e ? "bottom" : "insetInlineStart", f = e ? "height" : "width", b = {
    visibility: o && !u ? "hidden" : a,
    position: e ? "absolute" : "relative",
    [e ? "width" : "height"]: "inherit"
  };
  return b["--start-position"] = `${r ?? 0}%`, t ? (b["--relative-size"] = `${(i ?? 0) - (r ?? 0)}%`, b[p] = "var(--start-position)", b[f] = "var(--relative-size)", b) : (b[p] = 0, b[f] = "var(--start-position)", b);
}
function ln(e, t, r, i) {
  const o = e ? "bottom" : "insetInlineStart", u = e ? "height" : "width", p = {
    position: e ? "absolute" : "relative",
    [e ? "width" : "height"]: "inherit"
  };
  if (!t)
    return p[o] = 0, p[u] = `${r}%`, p;
  const f = i - r;
  return p[o] = `${r}%`, p[u] = `${f}%`, p;
}
const Ct = /* @__PURE__ */ l.forwardRef(function(t, r) {
  const {
    render: i,
    className: o,
    ...u
  } = t, {
    indicatorPosition: a,
    inset: p,
    max: f,
    min: N,
    orientation: b,
    renderBeforeHydration: F,
    state: A,
    values: g
  } = $e(), [s, V] = l.useState(!1);
  ot(() => V(!0));
  const I = b === "vertical", w = g.length > 1, v = p ? an(I, w, a[0], a[1], F, s) : ln(I, w, Ye(g[0], N, f), Ye(g[g.length - 1], N, f));
  return Oe("div", t, {
    state: A,
    ref: r,
    props: [{
      "data-base-ui-slider-indicator": F ? "" : void 0,
      style: v,
      suppressHydrationWarning: F || void 0
    }, u],
    stateAttributesMapping: Le
  });
});
process.env.NODE_ENV !== "production" && (Ct.displayName = "SliderIndicator");
function Fn({
  className: e,
  defaultValue: t,
  value: r,
  min: i = 0,
  max: o = 100,
  ...u
}) {
  let a;
  return Array.isArray(r) ? a = r : Array.isArray(t) ? a = t : a = [i, o], /* @__PURE__ */ ye(
    ht,
    {
      className: Pt("w-full data-[orientation=vertical]:h-full", e),
      "data-slot": "slider",
      defaultValue: t,
      max: o,
      min: i,
      thumbAlignment: "edge",
      value: r,
      ...u,
      children: /* @__PURE__ */ Qe(vt, { className: "relative flex w-full touch-none select-none items-center data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col data-disabled:opacity-50", children: [
        /* @__PURE__ */ ye(
          yt,
          {
            className: "relative h-1.5 w-full grow select-none overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5",
            "data-slot": "slider-track",
            children: /* @__PURE__ */ ye(
              Ct,
              {
                className: "h-full select-none bg-primary data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-full",
                "data-slot": "slider-range"
              }
            )
          }
        ),
        Array.from({ length: a.length }, (p, f) => /* @__PURE__ */ ye(
          St,
          {
            className: "relative block size-3 shrink-0 select-none rounded-full border border-primary bg-primary ring-ring/50 transition-[color,box-shadow] after:absolute after:-inset-2 hover:ring-3 focus-visible:outline-hidden focus-visible:ring-3 active:ring-3 disabled:pointer-events-none disabled:opacity-50",
            "data-slot": "slider-thumb"
          },
          f
        ))
      ] })
    }
  );
}
export {
  Fn as Slider
};
