import { jsx as G } from "react/jsx-runtime";
import { useFormFieldControl as Ti } from "../form-field/index.mjs";
import ke, { useEffect as W, useState as j, useRef as Y, useCallback as re, useMemo as O, useContext as he, createContext as yt } from "react";
import { InputGroup as Ae, Input as Di } from "../input/index.mjs";
import { m as Si, n as Li, o as Ve, p as Ci, j as me, $ as ae, g as ht, h as k, q as wi, r as Ke, e as H, d as Pt, s as Fi, t as Vi, f as B, u as I, v as Ni, w as Qe, x as et, y as ve, l as z, z as Et, A as $e, i as Ii, B as Mi, a as tt, C as Bi, c as Re, b as xt, k as Oi, D as ki, E as Ai } from "../useFocusWithin-CoL4390f.mjs";
import { flushSync as Ki } from "react-dom";
import { Minus as Ri } from "@spark-ui/icons/Minus";
import { Plus as _i } from "@spark-ui/icons/Plus";
import { I as Tt } from "../Icon-D1RueiPY.mjs";
import { I as Dt } from "../IconButton-BY3gYXtU.mjs";
import { useMergeRefs as Ui } from "@spark-ui/hooks/use-merge-refs";
function se(e, t, r = !0) {
  var i, a;
  let { metaKey: l, ctrlKey: s, altKey: u, shiftKey: f } = t;
  Si() && (!((a = window.event) === null || a === void 0 || (i = a.type) === null || i === void 0) && i.startsWith("key")) && e.target === "_blank" && (Ve() ? l = !0 : s = !0);
  let b = Li() && Ve() && !Ci() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey: l,
    ctrlKey: s,
    altKey: u,
    shiftKey: f
  }) : new MouseEvent("click", {
    metaKey: l,
    ctrlKey: s,
    altKey: u,
    shiftKey: f,
    bubbles: !0,
    cancelable: !0
  });
  se.isOpening = r, me(e), e.dispatchEvent(b), se.isOpening = !1;
}
se.isOpening = !1;
let Z = /* @__PURE__ */ new Map(), Ne = /* @__PURE__ */ new Set();
function rt() {
  if (typeof window > "u") return;
  function e(i) {
    return "propertyName" in i;
  }
  let t = (i) => {
    if (!e(i) || !i.target) return;
    let a = Z.get(i.target);
    a || (a = /* @__PURE__ */ new Set(), Z.set(i.target, a), i.target.addEventListener("transitioncancel", r, {
      once: !0
    })), a.add(i.propertyName);
  }, r = (i) => {
    if (!e(i) || !i.target) return;
    let a = Z.get(i.target);
    if (a && (a.delete(i.propertyName), a.size === 0 && (i.target.removeEventListener("transitioncancel", r), Z.delete(i.target)), Z.size === 0)) {
      for (let l of Ne) l();
      Ne.clear();
    }
  };
  document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", r);
}
typeof document < "u" && (document.readyState !== "loading" ? rt() : document.addEventListener("DOMContentLoaded", rt));
function ji() {
  for (const [e] of Z)
    "isConnected" in e && !e.isConnected && Z.delete(e);
}
function St(e) {
  requestAnimationFrame(() => {
    ji(), Z.size === 0 ? e() : Ne.add(e);
  });
}
function zi(e, t) {
  let { id: r, "aria-label": i, "aria-labelledby": a } = e;
  return r = ae(r), a && i ? a = [
    .../* @__PURE__ */ new Set([
      r,
      ...a.trim().split(/\s+/)
    ])
  ].join(" ") : a && (a = a.trim().split(/\s+/).join(" ")), !i && !a && t && (i = t), {
    id: r,
    "aria-label": i,
    "aria-labelledby": a
  };
}
function Lt(e, t) {
  ht(() => {
    if (e && e.ref && t)
      return e.ref.current = t.current, () => {
        e.ref && (e.ref.current = null);
      };
  });
}
function Wi(e, t, r, i) {
  let a = k(r), l = r == null;
  W(() => {
    if (l || !e.current) return;
    let s = e.current;
    return s.addEventListener(t, a, i), () => {
      s.removeEventListener(t, a, i);
    };
  }, [
    e,
    t,
    i,
    l,
    a
  ]);
}
function Ct(e, t, r) {
  let i = k(() => {
    r && r(t);
  });
  W(() => {
    var a;
    let l = e == null || (a = e.current) === null || a === void 0 ? void 0 : a.form;
    return l?.addEventListener("reset", i), () => {
      l?.removeEventListener("reset", i);
    };
  }, [
    e,
    i
  ]);
}
function wt(e, t, r) {
  let [i, a] = j(e || t), l = Y(e !== void 0), s = e !== void 0;
  W(() => {
    let b = l.current;
    b !== s && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${b ? "controlled" : "uncontrolled"} to ${s ? "controlled" : "uncontrolled"}.`), l.current = s;
  }, [
    s
  ]);
  let u = s ? e : i, f = re((b, ...v) => {
    let d = (c, ...g) => {
      r && (Object.is(u, c) || r(c, ...g)), s || (u = c);
    };
    typeof b == "function" ? (process.env.NODE_ENV !== "production" && console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), a((g, ...x) => {
      let L = b(s ? u : g, ...x);
      return d(L, ...v), s ? g : L;
    })) : (s || a(b), d(b, ...v));
  }, [
    s,
    u,
    r
  ]);
  return [
    u,
    f
  ];
}
function Te(e, t = -1 / 0, r = 1 / 0) {
  return Math.min(Math.max(e, t), r);
}
function ce(e, t) {
  let r = e, i = 0, a = t.toString(), l = a.toLowerCase().indexOf("e-");
  if (l > 0) i = Math.abs(Math.floor(Math.log10(Math.abs(t)))) + l;
  else {
    let s = a.indexOf(".");
    s >= 0 && (i = a.length - s);
  }
  if (i > 0) {
    let s = Math.pow(10, i);
    r = Math.round(r * s) / s;
  }
  return r;
}
function q(e, t, r, i) {
  t = Number(t), r = Number(r);
  let a = (e - (isNaN(t) ? 0 : t)) % i, l = ce(Math.abs(a) * 2 >= i ? e + Math.sign(a) * (i - Math.abs(a)) : e - a, i);
  return isNaN(t) ? !isNaN(r) && l > r && (l = Math.floor(ce(r / i, i)) * i) : l < t ? l = t : !isNaN(r) && l > r && (l = t + Math.floor(ce((r - t) / i, i)) * i), l = ce(l, i), l;
}
function Yi(e, t) {
  if (t.has(e))
    throw new TypeError("Cannot initialize the same private elements twice on an object");
}
function Gi(e, t, r) {
  Yi(e, t), t.set(e, r);
}
let De = /* @__PURE__ */ new Map(), Ie = !1;
try {
  Ie = new Intl.NumberFormat("de-DE", {
    signDisplay: "exceptZero"
  }).resolvedOptions().signDisplay === "exceptZero";
} catch {
}
let ge = !1;
try {
  ge = new Intl.NumberFormat("de-DE", {
    style: "unit",
    unit: "degree"
  }).resolvedOptions().style === "unit";
} catch {
}
const Ft = {
  degree: {
    narrow: {
      default: "°",
      "ja-JP": " 度",
      "zh-TW": "度",
      "sl-SI": " °"
    }
  }
};
class ye {
  /** Formats a number value as a string, according to the locale and options provided to the constructor. */
  format(t) {
    let r = "";
    if (!Ie && this.options.signDisplay != null ? r = Hi(this.numberFormatter, this.options.signDisplay, t) : r = this.numberFormatter.format(t), this.options.style === "unit" && !ge) {
      var i;
      let { unit: a, unitDisplay: l = "short", locale: s } = this.resolvedOptions();
      if (!a) return r;
      let u = (i = Ft[a]) === null || i === void 0 ? void 0 : i[l];
      r += u[s] || u.default;
    }
    return r;
  }
  /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
  formatToParts(t) {
    return this.numberFormatter.formatToParts(t);
  }
  /** Formats a number range as a string. */
  formatRange(t, r) {
    if (typeof this.numberFormatter.formatRange == "function") return this.numberFormatter.formatRange(t, r);
    if (r < t) throw new RangeError("End date must be >= start date");
    return `${this.format(t)} – ${this.format(r)}`;
  }
  /** Formats a number range as an array of parts. */
  formatRangeToParts(t, r) {
    if (typeof this.numberFormatter.formatRangeToParts == "function") return this.numberFormatter.formatRangeToParts(t, r);
    if (r < t) throw new RangeError("End date must be >= start date");
    let i = this.numberFormatter.formatToParts(t), a = this.numberFormatter.formatToParts(r);
    return [
      ...i.map((l) => ({
        ...l,
        source: "startRange"
      })),
      {
        type: "literal",
        value: " – ",
        source: "shared"
      },
      ...a.map((l) => ({
        ...l,
        source: "endRange"
      }))
    ];
  }
  /** Returns the resolved formatting options based on the values passed to the constructor. */
  resolvedOptions() {
    let t = this.numberFormatter.resolvedOptions();
    return !Ie && this.options.signDisplay != null && (t = {
      ...t,
      signDisplay: this.options.signDisplay
    }), !ge && this.options.style === "unit" && (t = {
      ...t,
      style: "unit",
      unit: this.options.unit,
      unitDisplay: this.options.unitDisplay
    }), t;
  }
  constructor(t, r = {}) {
    this.numberFormatter = qi(t, r), this.options = r;
  }
}
function qi(e, t = {}) {
  let { numberingSystem: r } = t;
  if (r && e.includes("-nu-") && (e.includes("-u-") || (e += "-u-"), e += `-nu-${r}`), t.style === "unit" && !ge) {
    var i;
    let { unit: s, unitDisplay: u = "short" } = t;
    if (!s) throw new Error('unit option must be provided with style: "unit"');
    if (!(!((i = Ft[s]) === null || i === void 0) && i[u])) throw new Error(`Unsupported unit ${s} with unitDisplay = ${u}`);
    t = {
      ...t,
      style: "decimal"
    };
  }
  let a = e + (t ? Object.entries(t).sort((s, u) => s[0] < u[0] ? -1 : 1).join() : "");
  if (De.has(a)) return De.get(a);
  let l = new Intl.NumberFormat(e, t);
  return De.set(a, l), l;
}
function Hi(e, t, r) {
  if (t === "auto") return e.format(r);
  if (t === "never") return e.format(Math.abs(r));
  {
    let i = !1;
    if (t === "always" ? i = r > 0 || Object.is(r, 0) : t === "exceptZero" && (Object.is(r, -0) || Object.is(r, 0) ? r = Math.abs(r) : i = r > 0), i) {
      let a = e.format(-r), l = e.format(r), s = a.replace(l, "").replace(/\u200e|\u061C/, "");
      return [
        ...s
      ].length !== 1 && console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"), a.replace(l, "!!!").replace(s, "+").replace("!!!", l);
    } else return e.format(r);
  }
}
const Xi = new RegExp("^.*\\(.*\\).*$"), Zi = [
  "latn",
  "arab",
  "hanidec",
  "deva",
  "beng",
  "fullwide"
];
class Vt {
  /**
  * Parses the given string to a number. Returns NaN if a valid number could not be parsed.
  */
  parse(t) {
    return Se(this.locale, this.options, t).parse(t);
  }
  /**
  * Returns whether the given string could potentially be a valid number. This should be used to
  * validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
  * of the minus/plus sign characters can be checked.
  */
  isValidPartialNumber(t, r, i) {
    return Se(this.locale, this.options, t).isValidPartialNumber(t, r, i);
  }
  /**
  * Returns a numbering system for which the given string is valid in the current locale.
  * If no numbering system could be detected, the default numbering system for the current
  * locale is returned.
  */
  getNumberingSystem(t) {
    return Se(this.locale, this.options, t).options.numberingSystem;
  }
  constructor(t, r = {}) {
    this.locale = t, this.options = r;
  }
}
const it = /* @__PURE__ */ new Map();
function Se(e, t, r) {
  let i = nt(e, t);
  if (!e.includes("-nu-") && !i.isValidPartialNumber(r)) {
    for (let a of Zi) if (a !== i.options.numberingSystem) {
      let l = nt(e + (e.includes("-u-") ? "-nu-" : "-u-nu-") + a, t);
      if (l.isValidPartialNumber(r)) return l;
    }
  }
  return i;
}
function nt(e, t) {
  let r = e + (t ? Object.entries(t).sort((a, l) => a[0] < l[0] ? -1 : 1).join() : ""), i = it.get(r);
  return i || (i = new Ji(e, t), it.set(r, i)), i;
}
class Ji {
  parse(t) {
    let r = this.sanitize(t);
    if (this.symbols.group && (r = ie(r, this.symbols.group, "")), this.symbols.decimal && (r = r.replace(this.symbols.decimal, ".")), this.symbols.minusSign && (r = r.replace(this.symbols.minusSign, "-")), r = r.replace(this.symbols.numeral, this.symbols.index), this.options.style === "percent") {
      let s = r.indexOf("-");
      r = r.replace("-", ""), r = r.replace("+", "");
      let u = r.indexOf(".");
      u === -1 && (u = r.length), r = r.replace(".", ""), u - 2 === 0 ? r = `0.${r}` : u - 2 === -1 ? r = `0.0${r}` : u - 2 === -2 ? r = "0.00" : r = `${r.slice(0, u - 2)}.${r.slice(u - 2)}`, s > -1 && (r = `-${r}`);
    }
    let i = r ? +r : NaN;
    if (isNaN(i)) return NaN;
    if (this.options.style === "percent") {
      var a, l;
      let s = {
        ...this.options,
        style: "decimal",
        minimumFractionDigits: Math.min(((a = this.options.minimumFractionDigits) !== null && a !== void 0 ? a : 0) + 2, 20),
        maximumFractionDigits: Math.min(((l = this.options.maximumFractionDigits) !== null && l !== void 0 ? l : 0) + 2, 20)
      };
      return new Vt(this.locale, s).parse(new ye(this.locale, s).format(i));
    }
    return this.options.currencySign === "accounting" && Xi.test(t) && (i = -1 * i), i;
  }
  sanitize(t) {
    return t = t.replace(this.symbols.literals, ""), this.symbols.minusSign && (t = t.replace("-", this.symbols.minusSign)), this.options.numberingSystem === "arab" && (this.symbols.decimal && (t = t.replace(",", this.symbols.decimal), t = t.replace("،", this.symbols.decimal)), this.symbols.group && (t = ie(t, ".", this.symbols.group))), this.symbols.group === "’" && t.includes("'") && (t = ie(t, "'", this.symbols.group)), this.options.locale === "fr-FR" && this.symbols.group && (t = ie(t, " ", this.symbols.group), t = ie(t, /\u00A0/g, this.symbols.group)), t;
  }
  isValidPartialNumber(t, r = -1 / 0, i = 1 / 0) {
    return t = this.sanitize(t), this.symbols.minusSign && t.startsWith(this.symbols.minusSign) && r < 0 ? t = t.slice(this.symbols.minusSign.length) : this.symbols.plusSign && t.startsWith(this.symbols.plusSign) && i > 0 && (t = t.slice(this.symbols.plusSign.length)), this.symbols.group && t.startsWith(this.symbols.group) || this.symbols.decimal && t.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0 ? !1 : (this.symbols.group && (t = ie(t, this.symbols.group, "")), t = t.replace(this.symbols.numeral, ""), this.symbols.decimal && (t = t.replace(this.symbols.decimal, "")), t.length === 0);
  }
  constructor(t, r = {}) {
    this.locale = t, r.roundingIncrement !== 1 && r.roundingIncrement != null && (r.maximumFractionDigits == null && r.minimumFractionDigits == null ? (r.maximumFractionDigits = 0, r.minimumFractionDigits = 0) : r.maximumFractionDigits == null ? r.maximumFractionDigits = r.minimumFractionDigits : r.minimumFractionDigits == null && (r.minimumFractionDigits = r.maximumFractionDigits)), this.formatter = new Intl.NumberFormat(t, r), this.options = this.formatter.resolvedOptions(), this.symbols = en(t, this.formatter, this.options, r);
    var i, a;
    this.options.style === "percent" && (((i = this.options.minimumFractionDigits) !== null && i !== void 0 ? i : 0) > 18 || ((a = this.options.maximumFractionDigits) !== null && a !== void 0 ? a : 0) > 18) && console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
  }
}
const at = /* @__PURE__ */ new Set([
  "decimal",
  "fraction",
  "integer",
  "minusSign",
  "plusSign",
  "group"
]), Qi = [
  0,
  4,
  2,
  1,
  11,
  20,
  3,
  7,
  100,
  21,
  0.1,
  1.1
];
function en(e, t, r, i) {
  var a, l, s, u;
  let f = new Intl.NumberFormat(e, {
    ...r,
    // Resets so we get the full range of symbols
    minimumSignificantDigits: 1,
    maximumSignificantDigits: 21,
    roundingIncrement: 1,
    roundingPriority: "auto",
    roundingMode: "halfExpand"
  }), b = f.formatToParts(-10000.111), v = f.formatToParts(10000.111), d = Qi.map(($) => f.formatToParts($));
  var c;
  let g = (c = (a = b.find(($) => $.type === "minusSign")) === null || a === void 0 ? void 0 : a.value) !== null && c !== void 0 ? c : "-", x = (l = v.find(($) => $.type === "plusSign")) === null || l === void 0 ? void 0 : l.value;
  !x && (i?.signDisplay === "exceptZero" || i?.signDisplay === "always") && (x = "+");
  let D = (s = new Intl.NumberFormat(e, {
    ...r,
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
  }).formatToParts(1e-3).find(($) => $.type === "decimal")) === null || s === void 0 ? void 0 : s.value, C = (u = b.find(($) => $.type === "group")) === null || u === void 0 ? void 0 : u.value, M = b.filter(($) => !at.has($.type)).map(($) => lt($.value)), h = d.flatMap(($) => $.filter((n) => !at.has(n.type)).map((n) => lt(n.value))), P = [
    .../* @__PURE__ */ new Set([
      ...M,
      ...h
    ])
  ].sort(($, n) => n.length - $.length), E = P.length === 0 ? new RegExp("[\\p{White_Space}]", "gu") : new RegExp(`${P.join("|")}|[\\p{White_Space}]`, "gu"), w = [
    ...new Intl.NumberFormat(r.locale, {
      useGrouping: !1
    }).format(9876543210)
  ].reverse(), V = new Map(w.map(($, n) => [
    $,
    n
  ])), K = new RegExp(`[${w.join("")}]`, "g");
  return {
    minusSign: g,
    plusSign: x,
    decimal: D,
    group: C,
    literals: E,
    numeral: K,
    index: ($) => String(V.get($))
  };
}
function ie(e, t, r) {
  return e.replaceAll ? e.replaceAll(t, r) : e.split(t).join(r);
}
function lt(e) {
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function ot(e = {}) {
  let { locale: t } = wi();
  return O(() => new ye(t, e), [
    t,
    e
  ]);
}
let ne = "default", Me = "", be = /* @__PURE__ */ new WeakMap();
function st(e) {
  if (Ke()) {
    if (ne === "default") {
      const t = H(e);
      Me = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
    }
    ne = "disabled";
  } else if (e instanceof HTMLElement || e instanceof SVGElement) {
    let t = "userSelect" in e.style ? "userSelect" : "webkitUserSelect";
    be.set(e, e.style[t]), e.style[t] = "none";
  }
}
function Le(e) {
  if (Ke()) {
    if (ne !== "disabled") return;
    ne = "restoring", setTimeout(() => {
      St(() => {
        if (ne === "restoring") {
          const t = H(e);
          t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = Me || ""), Me = "", ne = "default";
        }
      });
    }, 300);
  } else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && be.has(e)) {
    let t = be.get(e), r = "userSelect" in e.style ? "userSelect" : "webkitUserSelect";
    e.style[r] === "none" && (e.style[r] = t), e.getAttribute("style") === "" && e.removeAttribute("style"), be.delete(e);
  }
}
const Nt = ke.createContext({
  register: () => {
  }
});
Nt.displayName = "PressResponderContext";
function tn(e, t) {
  return t.get ? t.get.call(e) : t.value;
}
function It(e, t, r) {
  if (!t.has(e)) throw new TypeError("attempted to " + r + " private field on non-instance");
  return t.get(e);
}
function rn(e, t) {
  var r = It(e, t, "get");
  return tn(e, r);
}
function nn(e, t, r) {
  if (t.set) t.set.call(e, r);
  else {
    if (!t.writable)
      throw new TypeError("attempted to set read only private field");
    t.value = r;
  }
}
function ut(e, t, r) {
  var i = It(e, t, "set");
  return nn(e, i, r), r;
}
function an(e) {
  let t = he(Nt);
  if (t) {
    let { register: r, ...i } = t;
    e = z(i, e), r();
  }
  return Lt(t, e.ref), e;
}
var fe = /* @__PURE__ */ new WeakMap();
class pe {
  continuePropagation() {
    ut(this, fe, !1);
  }
  get shouldStopPropagation() {
    return rn(this, fe);
  }
  constructor(t, r, i, a) {
    Gi(this, fe, {
      writable: !0,
      value: void 0
    }), ut(this, fe, !0);
    var l;
    let s = (l = a?.target) !== null && l !== void 0 ? l : i.currentTarget;
    const u = s?.getBoundingClientRect();
    let f, b = 0, v, d = null;
    i.clientX != null && i.clientY != null && (v = i.clientX, d = i.clientY), u && (v != null && d != null ? (f = v - u.left, b = d - u.top) : (f = u.width / 2, b = u.height / 2)), this.type = t, this.pointerType = r, this.target = i.currentTarget, this.shiftKey = i.shiftKey, this.metaKey = i.metaKey, this.ctrlKey = i.ctrlKey, this.altKey = i.altKey, this.x = f, this.y = b;
  }
}
const dt = Symbol("linkClicked"), ct = "react-aria-pressable-style", ft = "data-react-aria-pressable";
function ln(e) {
  let { onPress: t, onPressChange: r, onPressStart: i, onPressEnd: a, onPressUp: l, onClick: s, isDisabled: u, isPressed: f, preventFocusOnPress: b, shouldCancelOnPointerExit: v, allowTextSelectionOnPress: d, ref: c, ...g } = an(e), [x, L] = j(!1), D = Y({
    isPressed: !1,
    ignoreEmulatedMouseEvents: !1,
    didFirePressStart: !1,
    isTriggeringEvent: !1,
    activePointerId: null,
    target: null,
    isOverTarget: !1,
    pointerType: null,
    disposables: []
  }), { addGlobalListener: C, removeAllGlobalListeners: M } = Pt(), h = k((n, m) => {
    let N = D.current;
    if (u || N.didFirePressStart) return !1;
    let p = !0;
    if (N.isTriggeringEvent = !0, i) {
      let S = new pe("pressstart", m, n);
      i(S), p = S.shouldStopPropagation;
    }
    return r && r(!0), N.isTriggeringEvent = !1, N.didFirePressStart = !0, L(!0), p;
  }), P = k((n, m, N = !0) => {
    let p = D.current;
    if (!p.didFirePressStart) return !1;
    p.didFirePressStart = !1, p.isTriggeringEvent = !0;
    let S = !0;
    if (a) {
      let o = new pe("pressend", m, n);
      a(o), S = o.shouldStopPropagation;
    }
    if (r && r(!1), L(!1), t && N && !u) {
      let o = new pe("press", m, n);
      t(o), S && (S = o.shouldStopPropagation);
    }
    return p.isTriggeringEvent = !1, S;
  }), E = k((n, m) => {
    let N = D.current;
    if (u) return !1;
    if (l) {
      N.isTriggeringEvent = !0;
      let p = new pe("pressup", m, n);
      return l(p), N.isTriggeringEvent = !1, p.shouldStopPropagation;
    }
    return !0;
  }), w = k((n) => {
    let m = D.current;
    if (m.isPressed && m.target) {
      m.didFirePressStart && m.pointerType != null && P(te(m.target, n), m.pointerType, !1), m.isPressed = !1, m.isOverTarget = !1, m.activePointerId = null, m.pointerType = null, M(), d || Le(m.target);
      for (let N of m.disposables) N();
      m.disposables = [];
    }
  }), V = k((n) => {
    v && w(n);
  }), K = k((n) => {
    u || s?.(n);
  }), A = k((n, m) => {
    if (!u && s) {
      let N = new MouseEvent("click", n);
      Fi(N, m), s(Vi(N));
    }
  }), $ = O(() => {
    let n = D.current, m = {
      onKeyDown(p) {
        if (Ce(p.nativeEvent, p.currentTarget) && B(p.currentTarget, I(p.nativeEvent))) {
          var S;
          mt(I(p.nativeEvent), p.key) && p.preventDefault();
          let o = !0;
          if (!n.isPressed && !p.repeat) {
            n.target = p.currentTarget, n.isPressed = !0, n.pointerType = "keyboard", o = h(p, "keyboard");
            let y = p.currentTarget, T = (R) => {
              Ce(R, y) && !R.repeat && B(y, I(R)) && n.target && E(te(n.target, R), "keyboard");
            };
            C(H(p.currentTarget), "keyup", Et(T, N), !0);
          }
          o && p.stopPropagation(), p.metaKey && Ve() && ((S = n.metaKeyEvents) === null || S === void 0 || S.set(p.key, p.nativeEvent));
        } else p.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
      },
      onClick(p) {
        if (!(p && !B(p.currentTarget, I(p.nativeEvent))) && p && p.button === 0 && !n.isTriggeringEvent && !se.isOpening) {
          let S = !0;
          if (u && p.preventDefault(), !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" || et(p.nativeEvent))) {
            let o = h(p, "virtual"), y = E(p, "virtual"), T = P(p, "virtual");
            K(p), S = o && y && T;
          } else if (n.isPressed && n.pointerType !== "keyboard") {
            let o = n.pointerType || p.nativeEvent.pointerType || "virtual", y = E(te(p.currentTarget, p), o), T = P(te(p.currentTarget, p), o, !0);
            S = y && T, n.isOverTarget = !1, K(p), w(p);
          }
          n.ignoreEmulatedMouseEvents = !1, S && p.stopPropagation();
        }
      }
    }, N = (p) => {
      var S;
      if (n.isPressed && n.target && Ce(p, n.target)) {
        var o;
        mt(I(p), p.key) && p.preventDefault();
        let T = I(p), R = B(n.target, I(p));
        P(te(n.target, p), "keyboard", R), R && A(p, n.target), M(), p.key !== "Enter" && _e(n.target) && B(n.target, T) && !p[dt] && (p[dt] = !0, se(n.target, p, !1)), n.isPressed = !1, (o = n.metaKeyEvents) === null || o === void 0 || o.delete(p.key);
      } else if (p.key === "Meta" && (!((S = n.metaKeyEvents) === null || S === void 0) && S.size)) {
        var y;
        let T = n.metaKeyEvents;
        n.metaKeyEvents = void 0;
        for (let R of T.values()) (y = n.target) === null || y === void 0 || y.dispatchEvent(new KeyboardEvent("keyup", R));
      }
    };
    if (typeof PointerEvent < "u") {
      m.onPointerDown = (o) => {
        if (o.button !== 0 || !B(o.currentTarget, I(o.nativeEvent))) return;
        if (Ni(o.nativeEvent)) {
          n.pointerType = "virtual";
          return;
        }
        n.pointerType = o.pointerType;
        let y = !0;
        if (!n.isPressed) {
          n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = o.pointerId, n.target = o.currentTarget, d || st(n.target), y = h(o, n.pointerType);
          let T = I(o.nativeEvent);
          "releasePointerCapture" in T && T.releasePointerCapture(o.pointerId), C(H(o.currentTarget), "pointerup", p, !1), C(H(o.currentTarget), "pointercancel", S, !1);
        }
        y && o.stopPropagation();
      }, m.onMouseDown = (o) => {
        if (B(o.currentTarget, I(o.nativeEvent)) && o.button === 0) {
          if (b) {
            let y = Qe(o.target);
            y && n.disposables.push(y);
          }
          o.stopPropagation();
        }
      }, m.onPointerUp = (o) => {
        !B(o.currentTarget, I(o.nativeEvent)) || n.pointerType === "virtual" || o.button === 0 && !n.isPressed && E(o, n.pointerType || o.pointerType);
      }, m.onPointerEnter = (o) => {
        o.pointerId === n.activePointerId && n.target && !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, h(te(n.target, o), n.pointerType));
      }, m.onPointerLeave = (o) => {
        o.pointerId === n.activePointerId && n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, P(te(n.target, o), n.pointerType, !1), V(o));
      };
      let p = (o) => {
        if (o.pointerId === n.activePointerId && n.isPressed && o.button === 0 && n.target) {
          if (B(n.target, I(o)) && n.pointerType != null) {
            let y = !1, T = setTimeout(() => {
              n.isPressed && n.target instanceof HTMLElement && (y ? w(o) : (me(n.target), n.target.click()));
            }, 80);
            C(o.currentTarget, "click", () => y = !0, !0), n.disposables.push(() => clearTimeout(T));
          } else w(o);
          n.isOverTarget = !1;
        }
      }, S = (o) => {
        w(o);
      };
      m.onDragStart = (o) => {
        B(o.currentTarget, I(o.nativeEvent)) && w(o);
      };
    } else if (process.env.NODE_ENV === "test") {
      m.onMouseDown = (o) => {
        if (o.button !== 0 || !B(o.currentTarget, I(o.nativeEvent))) return;
        if (n.ignoreEmulatedMouseEvents) {
          o.stopPropagation();
          return;
        }
        if (n.isPressed = !0, n.isOverTarget = !0, n.target = o.currentTarget, n.pointerType = et(o.nativeEvent) ? "virtual" : "mouse", Ki(() => h(o, n.pointerType)) && o.stopPropagation(), b) {
          let T = Qe(o.target);
          T && n.disposables.push(T);
        }
        C(H(o.currentTarget), "mouseup", p, !1);
      }, m.onMouseEnter = (o) => {
        if (!B(o.currentTarget, I(o.nativeEvent))) return;
        let y = !0;
        n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, y = h(o, n.pointerType)), y && o.stopPropagation();
      }, m.onMouseLeave = (o) => {
        if (!B(o.currentTarget, I(o.nativeEvent))) return;
        let y = !0;
        n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, y = P(o, n.pointerType, !1), V(o)), y && o.stopPropagation();
      }, m.onMouseUp = (o) => {
        B(o.currentTarget, I(o.nativeEvent)) && !n.ignoreEmulatedMouseEvents && o.button === 0 && !n.isPressed && E(o, n.pointerType || "mouse");
      };
      let p = (o) => {
        if (o.button === 0) {
          if (n.ignoreEmulatedMouseEvents) {
            n.ignoreEmulatedMouseEvents = !1;
            return;
          }
          n.target && n.target.contains(o.target) && n.pointerType != null || w(o), n.isOverTarget = !1;
        }
      };
      m.onTouchStart = (o) => {
        if (!B(o.currentTarget, I(o.nativeEvent))) return;
        let y = on(o.nativeEvent);
        if (!y) return;
        n.activePointerId = y.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = o.currentTarget, n.pointerType = "touch", d || st(n.target), h(X(n.target, o), n.pointerType) && o.stopPropagation(), C(ve(o.currentTarget), "scroll", S, !0);
      }, m.onTouchMove = (o) => {
        if (!B(o.currentTarget, I(o.nativeEvent))) return;
        if (!n.isPressed) {
          o.stopPropagation();
          return;
        }
        let y = pt(o.nativeEvent, n.activePointerId), T = !0;
        y && bt(y, o.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, T = h(X(n.target, o), n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, T = P(X(n.target, o), n.pointerType, !1), V(X(n.target, o))), T && o.stopPropagation();
      }, m.onTouchEnd = (o) => {
        if (!B(o.currentTarget, I(o.nativeEvent))) return;
        if (!n.isPressed) {
          o.stopPropagation();
          return;
        }
        let y = pt(o.nativeEvent, n.activePointerId), T = !0;
        y && bt(y, o.currentTarget) && n.pointerType != null ? (E(X(n.target, o), n.pointerType), T = P(X(n.target, o), n.pointerType), A(o.nativeEvent, n.target)) : n.isOverTarget && n.pointerType != null && (T = P(X(n.target, o), n.pointerType, !1)), T && o.stopPropagation(), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, n.target && !d && Le(n.target), M();
      }, m.onTouchCancel = (o) => {
        B(o.currentTarget, I(o.nativeEvent)) && (o.stopPropagation(), n.isPressed && w(X(n.target, o)));
      };
      let S = (o) => {
        n.isPressed && B(I(o), n.target) && w({
          currentTarget: n.target,
          shiftKey: !1,
          ctrlKey: !1,
          metaKey: !1,
          altKey: !1
        });
      };
      m.onDragStart = (o) => {
        B(o.currentTarget, I(o.nativeEvent)) && w(o);
      };
    }
    return m;
  }, [
    C,
    u,
    b,
    M,
    d,
    w,
    V,
    P,
    h,
    E,
    K,
    A
  ]);
  return W(() => {
    if (!c || process.env.NODE_ENV === "test") return;
    const n = H(c.current);
    if (!n || !n.head || n.getElementById(ct)) return;
    const m = n.createElement("style");
    m.id = ct, m.textContent = `
@layer {
  [${ft}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim(), n.head.prepend(m);
  }, [
    c
  ]), W(() => {
    let n = D.current;
    return () => {
      var m;
      d || Le((m = n.target) !== null && m !== void 0 ? m : void 0);
      for (let N of n.disposables) N();
      n.disposables = [];
    };
  }, [
    d
  ]), {
    isPressed: f || x,
    pressProps: z(g, $, {
      [ft]: !0
    })
  };
}
function _e(e) {
  return e.tagName === "A" && e.hasAttribute("href");
}
function Ce(e, t) {
  const { key: r, code: i } = e, a = t, l = a.getAttribute("role");
  return (r === "Enter" || r === " " || r === "Spacebar" || i === "Space") && !(a instanceof ve(a).HTMLInputElement && !Mt(a, r) || a instanceof ve(a).HTMLTextAreaElement || a.isContentEditable) && // Links should only trigger with Enter key
  !((l === "link" || !l && _e(a)) && r !== "Enter");
}
function on(e) {
  const { targetTouches: t } = e;
  return t.length > 0 ? t[0] : null;
}
function pt(e, t) {
  const r = e.changedTouches;
  for (let i = 0; i < r.length; i++) {
    const a = r[i];
    if (a.identifier === t) return a;
  }
  return null;
}
function X(e, t) {
  let r = 0, i = 0;
  return t.targetTouches && t.targetTouches.length === 1 && (r = t.targetTouches[0].clientX, i = t.targetTouches[0].clientY), {
    currentTarget: e,
    shiftKey: t.shiftKey,
    ctrlKey: t.ctrlKey,
    metaKey: t.metaKey,
    altKey: t.altKey,
    clientX: r,
    clientY: i
  };
}
function te(e, t) {
  let r = t.clientX, i = t.clientY;
  return {
    currentTarget: e,
    shiftKey: t.shiftKey,
    ctrlKey: t.ctrlKey,
    metaKey: t.metaKey,
    altKey: t.altKey,
    clientX: r,
    clientY: i
  };
}
function sn(e) {
  let t = 0, r = 0;
  return e.width !== void 0 ? t = e.width / 2 : e.radiusX !== void 0 && (t = e.radiusX), e.height !== void 0 ? r = e.height / 2 : e.radiusY !== void 0 && (r = e.radiusY), {
    top: e.clientY - r,
    right: e.clientX + t,
    bottom: e.clientY + r,
    left: e.clientX - t
  };
}
function un(e, t) {
  return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
}
function bt(e, t) {
  let r = t.getBoundingClientRect(), i = sn(e);
  return un(r, i);
}
function dn(e) {
  return e instanceof HTMLInputElement ? !1 : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !_e(e);
}
function mt(e, t) {
  return e instanceof HTMLInputElement ? !Mt(e, t) : dn(e);
}
const cn = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function Mt(e, t) {
  return e.type === "checkbox" || e.type === "radio" ? t === " " : cn.has(e.type);
}
function fn(e) {
  const t = H(e), r = $e(t);
  if (Ii() === "virtual") {
    let i = r;
    St(() => {
      $e(t) === i && e.isConnected && me(e);
    });
  } else me(e);
}
function Bt(e) {
  let { isDisabled: t, onFocus: r, onBlur: i, onFocusChange: a } = e;
  const l = re((f) => {
    if (f.target === f.currentTarget)
      return i && i(f), a && a(!1), !0;
  }, [
    i,
    a
  ]), s = Mi(l), u = re((f) => {
    const b = H(f.target), v = b ? $e(b) : $e();
    f.target === f.currentTarget && v === I(f.nativeEvent) && (r && r(f), a && a(!0), s(f));
  }, [
    a,
    r,
    s
  ]);
  return {
    focusProps: {
      onFocus: !t && (r || a || i) ? u : void 0,
      onBlur: !t && (i || a) ? l : void 0
    }
  };
}
function vt(e) {
  if (!e) return;
  let t = !0;
  return (r) => {
    let i = {
      ...r,
      preventDefault() {
        r.preventDefault();
      },
      isDefaultPrevented() {
        return r.isDefaultPrevented();
      },
      stopPropagation() {
        t && process.env.NODE_ENV !== "production" ? console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.") : t = !0;
      },
      continuePropagation() {
        t = !1;
      },
      isPropagationStopped() {
        return t;
      }
    };
    e(i), t && r.stopPropagation();
  };
}
function pn(e) {
  return {
    keyboardProps: e.isDisabled ? {} : {
      onKeyDown: vt(e.onKeyDown),
      onKeyUp: vt(e.onKeyUp)
    }
  };
}
let bn = /* @__PURE__ */ ke.createContext(null);
function mn(e) {
  let t = he(bn) || {};
  Lt(t, e);
  let { ref: r, ...i } = t;
  return i;
}
function Ot(e, t) {
  let { focusProps: r } = Bt(e), { keyboardProps: i } = pn(e), a = z(r, i), l = mn(t), s = e.isDisabled ? {} : l, u = Y(e.autoFocus);
  W(() => {
    u.current && t.current && fn(t.current), u.current = !1;
  }, [
    t
  ]);
  let f = e.excludeFromTabOrder ? -1 : 0;
  return e.isDisabled && (f = void 0), {
    focusableProps: z({
      ...a,
      tabIndex: f
    }, s)
  };
}
function vn(e, t) {
  let { onScroll: r, isDisabled: i } = e, a = re((l) => {
    l.ctrlKey || (l.preventDefault(), l.stopPropagation(), r && r({
      deltaX: l.deltaX,
      deltaY: l.deltaY
    }));
  }, [
    r
  ]);
  Wi(t, "wheel", i ? void 0 : a);
}
var kt = {};
kt = {
  decrease: (e) => `خفض ${e.fieldLabel}`,
  increase: (e) => `زيادة ${e.fieldLabel}`,
  numberField: "حقل رقمي"
};
var At = {};
At = {
  decrease: (e) => `Намаляване ${e.fieldLabel}`,
  increase: (e) => `Усилване ${e.fieldLabel}`,
  numberField: "Номер на полето"
};
var Kt = {};
Kt = {
  decrease: (e) => `Snížit ${e.fieldLabel}`,
  increase: (e) => `Zvýšit ${e.fieldLabel}`,
  numberField: "Číselné pole"
};
var Rt = {};
Rt = {
  decrease: (e) => `Reducer ${e.fieldLabel}`,
  increase: (e) => `Øg ${e.fieldLabel}`,
  numberField: "Talfelt"
};
var _t = {};
_t = {
  decrease: (e) => `${e.fieldLabel} verringern`,
  increase: (e) => `${e.fieldLabel} erhöhen`,
  numberField: "Nummernfeld"
};
var Ut = {};
Ut = {
  decrease: (e) => `Μείωση ${e.fieldLabel}`,
  increase: (e) => `Αύξηση ${e.fieldLabel}`,
  numberField: "Πεδίο αριθμού"
};
var jt = {};
jt = {
  decrease: (e) => `Decrease ${e.fieldLabel}`,
  increase: (e) => `Increase ${e.fieldLabel}`,
  numberField: "Number field"
};
var zt = {};
zt = {
  decrease: (e) => `Reducir ${e.fieldLabel}`,
  increase: (e) => `Aumentar ${e.fieldLabel}`,
  numberField: "Campo de número"
};
var Wt = {};
Wt = {
  decrease: (e) => `Vähenda ${e.fieldLabel}`,
  increase: (e) => `Suurenda ${e.fieldLabel}`,
  numberField: "Numbri väli"
};
var Yt = {};
Yt = {
  decrease: (e) => `Vähennä ${e.fieldLabel}`,
  increase: (e) => `Lisää ${e.fieldLabel}`,
  numberField: "Numerokenttä"
};
var Gt = {};
Gt = {
  decrease: (e) => `Diminuer ${e.fieldLabel}`,
  increase: (e) => `Augmenter ${e.fieldLabel}`,
  numberField: "Champ de nombre"
};
var qt = {};
qt = {
  decrease: (e) => `הקטן ${e.fieldLabel}`,
  increase: (e) => `הגדל ${e.fieldLabel}`,
  numberField: "שדה מספר"
};
var Ht = {};
Ht = {
  decrease: (e) => `Smanji ${e.fieldLabel}`,
  increase: (e) => `Povećaj ${e.fieldLabel}`,
  numberField: "Polje broja"
};
var Xt = {};
Xt = {
  decrease: (e) => `${e.fieldLabel} csökkentése`,
  increase: (e) => `${e.fieldLabel} növelése`,
  numberField: "Számmező"
};
var Zt = {};
Zt = {
  decrease: (e) => `Riduci ${e.fieldLabel}`,
  increase: (e) => `Aumenta ${e.fieldLabel}`,
  numberField: "Campo numero"
};
var Jt = {};
Jt = {
  decrease: (e) => `${e.fieldLabel}を縮小`,
  increase: (e) => `${e.fieldLabel}を拡大`,
  numberField: "数値フィールド"
};
var Qt = {};
Qt = {
  decrease: (e) => `${e.fieldLabel} 감소`,
  increase: (e) => `${e.fieldLabel} 증가`,
  numberField: "번호 필드"
};
var er = {};
er = {
  decrease: (e) => `Sumažinti ${e.fieldLabel}`,
  increase: (e) => `Padidinti ${e.fieldLabel}`,
  numberField: "Numerio laukas"
};
var tr = {};
tr = {
  decrease: (e) => `Samazināšana ${e.fieldLabel}`,
  increase: (e) => `Palielināšana ${e.fieldLabel}`,
  numberField: "Skaitļu lauks"
};
var rr = {};
rr = {
  decrease: (e) => `Reduser ${e.fieldLabel}`,
  increase: (e) => `Øk ${e.fieldLabel}`,
  numberField: "Tallfelt"
};
var ir = {};
ir = {
  decrease: (e) => `${e.fieldLabel} verlagen`,
  increase: (e) => `${e.fieldLabel} verhogen`,
  numberField: "Getalveld"
};
var nr = {};
nr = {
  decrease: (e) => `Zmniejsz ${e.fieldLabel}`,
  increase: (e) => `Zwiększ ${e.fieldLabel}`,
  numberField: "Pole numeru"
};
var ar = {};
ar = {
  decrease: (e) => `Diminuir ${e.fieldLabel}`,
  increase: (e) => `Aumentar ${e.fieldLabel}`,
  numberField: "Campo de número"
};
var lr = {};
lr = {
  decrease: (e) => `Diminuir ${e.fieldLabel}`,
  increase: (e) => `Aumentar ${e.fieldLabel}`,
  numberField: "Campo numérico"
};
var or = {};
or = {
  decrease: (e) => `Scădere ${e.fieldLabel}`,
  increase: (e) => `Creștere ${e.fieldLabel}`,
  numberField: "Câmp numeric"
};
var sr = {};
sr = {
  decrease: (e) => `Уменьшение ${e.fieldLabel}`,
  increase: (e) => `Увеличение ${e.fieldLabel}`,
  numberField: "Числовое поле"
};
var ur = {};
ur = {
  decrease: (e) => `Znížiť ${e.fieldLabel}`,
  increase: (e) => `Zvýšiť ${e.fieldLabel}`,
  numberField: "Číselné pole"
};
var dr = {};
dr = {
  decrease: (e) => `Upadati ${e.fieldLabel}`,
  increase: (e) => `Povečajte ${e.fieldLabel}`,
  numberField: "Številčno polje"
};
var cr = {};
cr = {
  decrease: (e) => `Smanji ${e.fieldLabel}`,
  increase: (e) => `Povećaj ${e.fieldLabel}`,
  numberField: "Polje broja"
};
var fr = {};
fr = {
  decrease: (e) => `Minska ${e.fieldLabel}`,
  increase: (e) => `Öka ${e.fieldLabel}`,
  numberField: "Nummerfält"
};
var pr = {};
pr = {
  decrease: (e) => `${e.fieldLabel} azalt`,
  increase: (e) => `${e.fieldLabel} arttır`,
  numberField: "Sayı alanı"
};
var br = {};
br = {
  decrease: (e) => `Зменшити ${e.fieldLabel}`,
  increase: (e) => `Збільшити ${e.fieldLabel}`,
  numberField: "Поле номера"
};
var mr = {};
mr = {
  decrease: (e) => `降低 ${e.fieldLabel}`,
  increase: (e) => `提高 ${e.fieldLabel}`,
  numberField: "数字字段"
};
var vr = {};
vr = {
  decrease: (e) => `縮小 ${e.fieldLabel}`,
  increase: (e) => `放大 ${e.fieldLabel}`,
  numberField: "數字欄位"
};
var $r = {};
$r = {
  "ar-AE": kt,
  "bg-BG": At,
  "cs-CZ": Kt,
  "da-DK": Rt,
  "de-DE": _t,
  "el-GR": Ut,
  "en-US": jt,
  "es-ES": zt,
  "et-EE": Wt,
  "fi-FI": Yt,
  "fr-FR": Gt,
  "he-IL": qt,
  "hr-HR": Ht,
  "hu-HU": Xt,
  "it-IT": Zt,
  "ja-JP": Jt,
  "ko-KR": Qt,
  "lt-LT": er,
  "lv-LV": tr,
  "nb-NO": rr,
  "nl-NL": ir,
  "pl-PL": nr,
  "pt-BR": ar,
  "pt-PT": lr,
  "ro-RO": or,
  "ru-RU": sr,
  "sk-SK": ur,
  "sl-SI": dr,
  "sr-SP": cr,
  "sv-SE": fr,
  "tr-TR": pr,
  "uk-UA": br,
  "zh-CN": mr,
  "zh-TW": vr
};
const gr = {
  badInput: !1,
  customError: !1,
  patternMismatch: !1,
  rangeOverflow: !1,
  rangeUnderflow: !1,
  stepMismatch: !1,
  tooLong: !1,
  tooShort: !1,
  typeMismatch: !1,
  valueMissing: !1,
  valid: !0
}, yr = {
  ...gr,
  customError: !0,
  valid: !1
}, oe = {
  isInvalid: !1,
  validationDetails: gr,
  validationErrors: []
}, $n = yt({}), Be = "__formValidationState" + Date.now();
function hr(e) {
  if (e[Be]) {
    let { realtimeValidation: t, displayValidation: r, updateValidation: i, resetValidation: a, commitValidation: l } = e[Be];
    return {
      realtimeValidation: t,
      displayValidation: r,
      updateValidation: i,
      resetValidation: a,
      commitValidation: l
    };
  }
  return gn(e);
}
function gn(e) {
  let { isInvalid: t, validationState: r, name: i, value: a, builtinValidation: l, validate: s, validationBehavior: u = "aria" } = e;
  r && (t || (t = r === "invalid"));
  let f = t !== void 0 ? {
    isInvalid: t,
    validationErrors: [],
    validationDetails: yr
  } : null, b = O(() => {
    if (!s || a == null) return null;
    let $ = yn(s, a);
    return $t($);
  }, [
    s,
    a
  ]);
  l?.validationDetails.valid && (l = void 0);
  let v = he($n), d = O(() => i ? Array.isArray(i) ? i.flatMap(($) => Oe(v[$])) : Oe(v[i]) : [], [
    v,
    i
  ]), [c, g] = j(v), [x, L] = j(!1);
  v !== c && (g(v), L(!1));
  let D = O(() => $t(x ? [] : d), [
    x,
    d
  ]), C = Y(oe), [M, h] = j(oe), P = Y(oe), E = () => {
    if (!w) return;
    V(!1);
    let $ = b || l || C.current;
    we($, P.current) || (P.current = $, h($));
  }, [w, V] = j(!1);
  return W(E), {
    realtimeValidation: f || D || b || l || oe,
    displayValidation: u === "native" ? f || D || M : f || D || b || l || M,
    updateValidation($) {
      u === "aria" && !we(M, $) ? h($) : C.current = $;
    },
    resetValidation() {
      let $ = oe;
      we($, P.current) || (P.current = $, h($)), u === "native" && V(!1), L(!0);
    },
    commitValidation() {
      u === "native" && V(!0), L(!0);
    }
  };
}
function Oe(e) {
  return e ? Array.isArray(e) ? e : [
    e
  ] : [];
}
function yn(e, t) {
  if (typeof e == "function") {
    let r = e(t);
    if (r && typeof r != "boolean") return Oe(r);
  }
  return [];
}
function $t(e) {
  return e.length ? {
    isInvalid: !0,
    validationErrors: e,
    validationDetails: yr
  } : null;
}
function we(e, t) {
  return e === t ? !0 : !!e && !!t && e.isInvalid === t.isInvalid && e.validationErrors.length === t.validationErrors.length && e.validationErrors.every((r, i) => r === t.validationErrors[i]) && Object.entries(e.validationDetails).every(([r, i]) => t.validationDetails[r] === i);
}
function hn(e) {
  let { id: t, label: r, "aria-labelledby": i, "aria-label": a, labelElementType: l = "label" } = e;
  t = ae(t);
  let s = ae(), u = {};
  r ? (i = i ? `${s} ${i}` : s, u = {
    id: s,
    htmlFor: l === "label" ? t : void 0
  }) : !i && !a && process.env.NODE_ENV !== "production" && console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
  let f = zi({
    id: t,
    "aria-label": a,
    "aria-labelledby": i
  });
  return {
    labelProps: u,
    fieldProps: f
  };
}
function Pn(e) {
  let { description: t, errorMessage: r, isInvalid: i, validationState: a } = e, { labelProps: l, fieldProps: s } = hn(e), u = tt([
    !!t,
    !!r,
    i,
    a
  ]), f = tt([
    !!t,
    !!r,
    i,
    a
  ]);
  return s = z(s, {
    "aria-describedby": [
      u,
      // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
      f,
      e["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  }), {
    labelProps: l,
    fieldProps: s,
    descriptionProps: {
      id: u
    },
    errorMessageProps: {
      id: f
    }
  };
}
function En(e, t, r) {
  let { validationBehavior: i, focus: a } = e;
  ht(() => {
    if (i === "native" && r?.current && !r.current.disabled) {
      let b = t.realtimeValidation.isInvalid ? t.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
      r.current.setCustomValidity(b), r.current.hasAttribute("title") || (r.current.title = ""), t.realtimeValidation.isInvalid || t.updateValidation(Tn(r.current));
    }
  });
  let l = Y(!1), s = k(() => {
    l.current || t.resetValidation();
  }), u = k((b) => {
    var v;
    t.displayValidation.isInvalid || t.commitValidation();
    let d = r == null || (v = r.current) === null || v === void 0 ? void 0 : v.form;
    if (!b.defaultPrevented && r && d && Dn(d) === r.current) {
      var c;
      a ? a() : (c = r.current) === null || c === void 0 || c.focus(), Bi("keyboard");
    }
    b.preventDefault();
  }), f = k(() => {
    t.commitValidation();
  });
  W(() => {
    let b = r?.current;
    if (!b) return;
    let v = b.form, d = v?.reset;
    return v && (v.reset = () => {
      l.current = !window.event || window.event.type === "message" && window.event.target instanceof MessagePort, d?.call(v), l.current = !1;
    }), b.addEventListener("invalid", u), b.addEventListener("change", f), v?.addEventListener("reset", s), () => {
      b.removeEventListener("invalid", u), b.removeEventListener("change", f), v?.removeEventListener("reset", s), v && (v.reset = d);
    };
  }, [
    r,
    u,
    f,
    s,
    i
  ]);
}
function xn(e) {
  let t = e.validity;
  return {
    badInput: t.badInput,
    customError: t.customError,
    patternMismatch: t.patternMismatch,
    rangeOverflow: t.rangeOverflow,
    rangeUnderflow: t.rangeUnderflow,
    stepMismatch: t.stepMismatch,
    tooLong: t.tooLong,
    tooShort: t.tooShort,
    typeMismatch: t.typeMismatch,
    valueMissing: t.valueMissing,
    valid: t.valid
  };
}
function Tn(e) {
  return {
    isInvalid: !e.validity.valid,
    validationDetails: xn(e),
    validationErrors: e.validationMessage ? [
      e.validationMessage
    ] : []
  };
}
function Dn(e) {
  for (let t = 0; t < e.elements.length; t++) {
    let r = e.elements[t];
    if (!r.validity.valid) return r;
  }
  return null;
}
function Sn(e, t) {
  let { inputElementType: r = "input", isDisabled: i = !1, isRequired: a = !1, isReadOnly: l = !1, type: s = "text", validationBehavior: u = "aria" } = e, [f, b] = wt(e.value, e.defaultValue || "", e.onChange), { focusableProps: v } = Ot(e, t), d = hr({
    ...e,
    value: f
  }), { isInvalid: c, validationErrors: g, validationDetails: x } = d.displayValidation, { labelProps: L, fieldProps: D, descriptionProps: C, errorMessageProps: M } = Pn({
    ...e,
    isInvalid: c,
    errorMessage: e.errorMessage || g
  }), h = Re(e, {
    labelable: !0
  });
  const P = {
    type: s,
    pattern: e.pattern
  };
  let [E] = j(f);
  var w;
  return Ct(t, (w = e.defaultValue) !== null && w !== void 0 ? w : E, b), En(e, d, t), W(() => {
    if (t.current instanceof ve(t.current).HTMLTextAreaElement) {
      let V = t.current;
      Object.defineProperty(V, "defaultValue", {
        get: () => V.value,
        set: () => {
        },
        configurable: !0
      });
    }
  }, [
    t
  ]), {
    labelProps: L,
    inputProps: z(h, r === "input" ? P : void 0, {
      disabled: i,
      readOnly: l,
      required: a && u === "native",
      "aria-required": a && u === "aria" || void 0,
      "aria-invalid": c || void 0,
      "aria-errormessage": e["aria-errormessage"],
      "aria-activedescendant": e["aria-activedescendant"],
      "aria-autocomplete": e["aria-autocomplete"],
      "aria-haspopup": e["aria-haspopup"],
      "aria-controls": e["aria-controls"],
      value: f,
      onChange: (V) => b(V.target.value),
      autoComplete: e.autoComplete,
      autoCapitalize: e.autoCapitalize,
      maxLength: e.maxLength,
      minLength: e.minLength,
      name: e.name,
      form: e.form,
      placeholder: e.placeholder,
      inputMode: e.inputMode,
      autoCorrect: e.autoCorrect,
      spellCheck: e.spellCheck,
      [parseInt(ke.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: e.enterKeyHint,
      // Clipboard events
      onCopy: e.onCopy,
      onCut: e.onCut,
      onPaste: e.onPaste,
      // Composition events
      onCompositionEnd: e.onCompositionEnd,
      onCompositionStart: e.onCompositionStart,
      onCompositionUpdate: e.onCompositionUpdate,
      // Selection events
      onSelect: e.onSelect,
      // Input events
      onBeforeInput: e.onBeforeInput,
      onInput: e.onInput,
      ...v,
      ...D
    }),
    descriptionProps: C,
    errorMessageProps: M,
    isInvalid: c,
    validationErrors: g,
    validationDetails: x
  };
}
function gt() {
  return typeof window < "u" && window.InputEvent && typeof InputEvent.prototype.getTargetRanges == "function";
}
function Ln(e, t, r) {
  let i = k((d) => {
    let c = r.current;
    if (!c) return;
    let g = null;
    switch (d.inputType) {
      case "historyUndo":
      case "historyRedo":
        return;
      case "insertLineBreak":
        return;
      case "deleteContent":
      case "deleteByCut":
      case "deleteByDrag":
        g = c.value.slice(0, c.selectionStart) + c.value.slice(c.selectionEnd);
        break;
      case "deleteContentForward":
        g = c.selectionEnd === c.selectionStart ? c.value.slice(0, c.selectionStart) + c.value.slice(c.selectionEnd + 1) : c.value.slice(0, c.selectionStart) + c.value.slice(c.selectionEnd);
        break;
      case "deleteContentBackward":
        g = c.selectionEnd === c.selectionStart ? c.value.slice(0, c.selectionStart - 1) + c.value.slice(c.selectionStart) : c.value.slice(0, c.selectionStart) + c.value.slice(c.selectionEnd);
        break;
      case "deleteSoftLineBackward":
      case "deleteHardLineBackward":
        g = c.value.slice(c.selectionStart);
        break;
      default:
        d.data != null && (g = c.value.slice(0, c.selectionStart) + d.data + c.value.slice(c.selectionEnd));
        break;
    }
    (g == null || !t.validate(g)) && d.preventDefault();
  });
  W(() => {
    if (!gt() || !r.current) return;
    let d = r.current;
    return d.addEventListener("beforeinput", i, !1), () => {
      d.removeEventListener("beforeinput", i, !1);
    };
  }, [
    r,
    i
  ]);
  let a = gt() ? null : (d) => {
    let c = d.target.value.slice(0, d.target.selectionStart) + d.data + d.target.value.slice(d.target.selectionEnd);
    t.validate(c) || d.preventDefault();
  }, { labelProps: l, inputProps: s, descriptionProps: u, errorMessageProps: f, ...b } = Sn(e, r), v = Y(null);
  return {
    inputProps: z(s, {
      onBeforeInput: a,
      onCompositionStart() {
        let { value: d, selectionStart: c, selectionEnd: g } = r.current;
        v.current = {
          value: d,
          selectionStart: c,
          selectionEnd: g
        };
      },
      onCompositionEnd() {
        if (r.current && !t.validate(r.current.value)) {
          let { value: d, selectionStart: c, selectionEnd: g } = v.current;
          r.current.value = d, r.current.setSelectionRange(c, g), t.setInputValue(d);
        }
      }
    }),
    labelProps: l,
    descriptionProps: u,
    errorMessageProps: f,
    ...b
  };
}
var Pr = {};
Pr = {
  Empty: "فارغ"
};
var Er = {};
Er = {
  Empty: "Изпразни"
};
var xr = {};
xr = {
  Empty: "Prázdné"
};
var Tr = {};
Tr = {
  Empty: "Tom"
};
var Dr = {};
Dr = {
  Empty: "Leer"
};
var Sr = {};
Sr = {
  Empty: "Άδειο"
};
var Lr = {};
Lr = {
  Empty: "Empty"
};
var Cr = {};
Cr = {
  Empty: "Vacío"
};
var wr = {};
wr = {
  Empty: "Tühjenda"
};
var Fr = {};
Fr = {
  Empty: "Tyhjä"
};
var Vr = {};
Vr = {
  Empty: "Vide"
};
var Nr = {};
Nr = {
  Empty: "ריק"
};
var Ir = {};
Ir = {
  Empty: "Prazno"
};
var Mr = {};
Mr = {
  Empty: "Üres"
};
var Br = {};
Br = {
  Empty: "Vuoto"
};
var Or = {};
Or = {
  Empty: "空"
};
var kr = {};
kr = {
  Empty: "비어 있음"
};
var Ar = {};
Ar = {
  Empty: "Tuščias"
};
var Kr = {};
Kr = {
  Empty: "Tukšs"
};
var Rr = {};
Rr = {
  Empty: "Tom"
};
var _r = {};
_r = {
  Empty: "Leeg"
};
var Ur = {};
Ur = {
  Empty: "Pusty"
};
var jr = {};
jr = {
  Empty: "Vazio"
};
var zr = {};
zr = {
  Empty: "Vazio"
};
var Wr = {};
Wr = {
  Empty: "Gol"
};
var Yr = {};
Yr = {
  Empty: "Не заполнено"
};
var Gr = {};
Gr = {
  Empty: "Prázdne"
};
var qr = {};
qr = {
  Empty: "Prazen"
};
var Hr = {};
Hr = {
  Empty: "Prazno"
};
var Xr = {};
Xr = {
  Empty: "Tomt"
};
var Zr = {};
Zr = {
  Empty: "Boş"
};
var Jr = {};
Jr = {
  Empty: "Пусто"
};
var Qr = {};
Qr = {
  Empty: "空"
};
var ei = {};
ei = {
  Empty: "空白"
};
var ti = {};
ti = {
  "ar-AE": Pr,
  "bg-BG": Er,
  "cs-CZ": xr,
  "da-DK": Tr,
  "de-DE": Dr,
  "el-GR": Sr,
  "en-US": Lr,
  "es-ES": Cr,
  "et-EE": wr,
  "fi-FI": Fr,
  "fr-FR": Vr,
  "he-IL": Nr,
  "hr-HR": Ir,
  "hu-HU": Mr,
  "it-IT": Br,
  "ja-JP": Or,
  "ko-KR": kr,
  "lt-LT": Ar,
  "lv-LV": Kr,
  "nb-NO": Rr,
  "nl-NL": _r,
  "pl-PL": Ur,
  "pt-BR": jr,
  "pt-PT": zr,
  "ro-RO": Wr,
  "ru-RU": Yr,
  "sk-SK": Gr,
  "sl-SI": qr,
  "sr-SP": Hr,
  "sv-SE": Xr,
  "tr-TR": Zr,
  "uk-UA": Jr,
  "zh-CN": Qr,
  "zh-TW": ei
};
const ri = 7e3;
let U = null;
function Cn(e, t = "assertive", r = ri) {
  U ? U.announce(e, t, r) : (U = new Fn(), (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") ? U.announce(e, t, r) : setTimeout(() => {
    U?.isAttached() && U?.announce(e, t, r);
  }, 100));
}
function wn(e) {
  U && U.clear(e);
}
class Fn {
  isAttached() {
    var t;
    return (t = this.node) === null || t === void 0 ? void 0 : t.isConnected;
  }
  createLog(t) {
    let r = document.createElement("div");
    return r.setAttribute("role", "log"), r.setAttribute("aria-live", t), r.setAttribute("aria-relevant", "additions"), r;
  }
  destroy() {
    this.node && (document.body.removeChild(this.node), this.node = null);
  }
  announce(t, r = "assertive", i = ri) {
    var a, l;
    if (!this.node) return;
    let s = document.createElement("div");
    typeof t == "object" ? (s.setAttribute("role", "img"), s.setAttribute("aria-labelledby", t["aria-labelledby"])) : s.textContent = t, r === "assertive" ? (a = this.assertiveLog) === null || a === void 0 || a.appendChild(s) : (l = this.politeLog) === null || l === void 0 || l.appendChild(s), t !== "" && setTimeout(() => {
      s.remove();
    }, i);
  }
  clear(t) {
    this.node && ((!t || t === "assertive") && this.assertiveLog && (this.assertiveLog.innerHTML = ""), (!t || t === "polite") && this.politeLog && (this.politeLog.innerHTML = ""));
  }
  constructor() {
    this.node = null, this.assertiveLog = null, this.politeLog = null, typeof document < "u" && (this.node = document.createElement("div"), this.node.dataset.liveAnnouncer = "true", Object.assign(this.node.style, {
      border: 0,
      clip: "rect(0 0 0 0)",
      clipPath: "inset(50%)",
      height: "1px",
      margin: "-1px",
      overflow: "hidden",
      padding: 0,
      position: "absolute",
      width: "1px",
      whiteSpace: "nowrap"
    }), this.assertiveLog = this.createLog("assertive"), this.node.appendChild(this.assertiveLog), this.politeLog = this.createLog("polite"), this.node.appendChild(this.politeLog), document.body.prepend(this.node));
  }
}
function Vn(e) {
  return e && e.__esModule ? e.default : e;
}
function Nn(e) {
  const t = Y(void 0);
  let { value: r, textValue: i, minValue: a, maxValue: l, isDisabled: s, isReadOnly: u, isRequired: f, onIncrement: b, onIncrementPage: v, onDecrement: d, onDecrementPage: c, onDecrementToMin: g, onIncrementToMax: x } = e;
  const L = xt(Vn(ti), "@react-aria/spinbutton"), D = () => clearTimeout(t.current);
  W(() => () => D(), []);
  let C = (n) => {
    if (!(n.ctrlKey || n.metaKey || n.shiftKey || n.altKey || u || n.nativeEvent.isComposing))
      switch (n.key) {
        case "PageUp":
          if (v) {
            n.preventDefault(), v?.();
            break;
          }
        // fallthrough!
        case "ArrowUp":
        case "Up":
          b && (n.preventDefault(), b?.());
          break;
        case "PageDown":
          if (c) {
            n.preventDefault(), c?.();
            break;
          }
        // fallthrough
        case "ArrowDown":
        case "Down":
          d && (n.preventDefault(), d?.());
          break;
        case "Home":
          g && (n.preventDefault(), g?.());
          break;
        case "End":
          x && (n.preventDefault(), x?.());
          break;
      }
  }, M = Y(!1), h = () => {
    M.current = !0;
  }, P = () => {
    M.current = !1;
  }, E = i === "" ? L.format("Empty") : (i || `${r}`).replace("-", "−");
  W(() => {
    M.current && (wn("assertive"), Cn(E, "assertive"));
  }, [
    E
  ]);
  const w = k((n) => {
    D(), b?.(), t.current = window.setTimeout(() => {
      (l === void 0 || isNaN(l) || r === void 0 || isNaN(r) || r < l) && w(60);
    }, n);
  }), V = k((n) => {
    D(), d?.(), t.current = window.setTimeout(() => {
      (a === void 0 || isNaN(a) || r === void 0 || isNaN(r) || r > a) && V(60);
    }, n);
  });
  let K = (n) => {
    n.preventDefault();
  }, { addGlobalListener: A, removeAllGlobalListeners: $ } = Pt();
  return {
    spinButtonProps: {
      role: "spinbutton",
      "aria-valuenow": r !== void 0 && !isNaN(r) ? r : void 0,
      "aria-valuetext": E,
      "aria-valuemin": a,
      "aria-valuemax": l,
      "aria-disabled": s || void 0,
      "aria-readonly": u || void 0,
      "aria-required": f || void 0,
      onKeyDown: C,
      onFocus: h,
      onBlur: P
    },
    incrementButtonProps: {
      onPressStart: () => {
        w(400), A(window, "contextmenu", K);
      },
      onPressEnd: () => {
        D(), $();
      },
      onFocus: h,
      onBlur: P
    },
    decrementButtonProps: {
      onPressStart: () => {
        V(400), A(window, "contextmenu", K);
      },
      onPressEnd: () => {
        D(), $();
      },
      onFocus: h,
      onBlur: P
    }
  };
}
function In(e) {
  return e && e.__esModule ? e.default : e;
}
function Mn(e, t, r) {
  let { id: i, decrementAriaLabel: a, incrementAriaLabel: l, isDisabled: s, isReadOnly: u, isRequired: f, minValue: b, maxValue: v, autoFocus: d, label: c, formatOptions: g, onBlur: x = () => {
  }, onFocus: L, onFocusChange: D, onKeyDown: C, onKeyUp: M, description: h, errorMessage: P, isWheelDisabled: E, ...w } = e, { increment: V, incrementToMax: K, decrement: A, decrementToMin: $, numberValue: n, inputValue: m, commit: N, commitValidation: p } = t;
  const S = xt(In($r), "@react-aria/numberfield");
  let o = ae(i), { focusProps: y } = Bt({
    onBlur() {
      N();
    }
  }), T = ot(g), R = O(() => T.resolvedOptions(), [
    T
  ]), ue = ot({
    ...g,
    currencySign: void 0
  }), je = O(() => isNaN(n) ? "" : ue.format(n), [
    ue,
    n
  ]), { spinButtonProps: F, incrementButtonProps: de, decrementButtonProps: J } = Nn({
    isDisabled: s,
    isReadOnly: u,
    isRequired: f,
    maxValue: v,
    minValue: b,
    onIncrement: V,
    onIncrementToMax: K,
    onDecrement: A,
    onDecrementToMin: $,
    value: n,
    textValue: je
  }), [Q, fi] = j(!1), { focusWithinProps: pi } = Oi({
    isDisabled: s,
    onFocusWithinChange: fi
  }), bi = re((_) => {
    Math.abs(_.deltaY) <= Math.abs(_.deltaX) || (_.deltaY > 0 ? V() : _.deltaY < 0 && A());
  }, [
    A,
    V
  ]);
  vn({
    onScroll: bi,
    isDisabled: E || s || u || !Q
  }, r);
  var Pe;
  let ze = ((Pe = R.maximumFractionDigits) !== null && Pe !== void 0 ? Pe : 0) > 0, We = t.minValue === void 0 || isNaN(t.minValue) || t.minValue < 0, le = "numeric";
  ki() ? We ? le = "text" : ze && (le = "decimal") : Ai() && (We ? le = "numeric" : ze && (le = "decimal"));
  let mi = (_) => {
    t.validate(_) && t.setInputValue(_);
  }, vi = Re(e), Ye = re((_) => {
    _.key === "Enter" ? (N(), p()) : _.continuePropagation();
  }, [
    N,
    p
  ]), { isInvalid: Ge, validationErrors: $i, validationDetails: gi } = t.displayValidation, { labelProps: qe, inputProps: yi, descriptionProps: hi, errorMessageProps: Pi } = Ln({
    ...w,
    ...vi,
    name: void 0,
    label: c,
    autoFocus: d,
    isDisabled: s,
    isReadOnly: u,
    isRequired: f,
    validate: void 0,
    [Be]: t,
    value: m,
    defaultValue: void 0,
    autoComplete: "off",
    "aria-label": e["aria-label"] || void 0,
    "aria-labelledby": e["aria-labelledby"] || void 0,
    id: o,
    type: "text",
    inputMode: le,
    onChange: mi,
    onBlur: x,
    onFocus: L,
    onFocusChange: D,
    onKeyDown: O(() => Et(Ye, C), [
      Ye,
      C
    ]),
    onKeyUp: M,
    description: h,
    errorMessage: P
  }, t, r);
  Ct(r, t.numberValue, t.setNumberValue);
  let He = z(F, y, yi, {
    // override the spinbutton role, we can't focus a spin button with VO
    role: null,
    // ignore aria-roledescription on iOS so that required state will announce when it is present
    "aria-roledescription": Ke() ? null : S.format("numberField"),
    "aria-valuemax": null,
    "aria-valuemin": null,
    "aria-valuenow": null,
    "aria-valuetext": null,
    autoCorrect: "off",
    spellCheck: "false"
  });
  e.validationBehavior === "native" && (He["aria-required"] = void 0);
  let Xe = (_) => {
    var xe;
    document.activeElement !== r.current && (_.pointerType === "mouse" ? (xe = r.current) === null || xe === void 0 || xe.focus() : _.target.focus());
  }, Ee = e["aria-label"] || (typeof e.label == "string" ? e.label : ""), ee;
  Ee || (ee = e.label != null ? qe.id : e["aria-labelledby"]);
  let Ze = ae(), Je = ae(), Ei = z(de, {
    "aria-label": l || S.format("increase", {
      fieldLabel: Ee
    }).trim(),
    id: ee && !l ? Ze : null,
    "aria-labelledby": ee && !l ? `${Ze} ${ee}` : null,
    "aria-controls": o,
    excludeFromTabOrder: !0,
    preventFocusOnPress: !0,
    allowFocusWhenDisabled: !0,
    isDisabled: !t.canIncrement,
    onPressStart: Xe
  }), xi = z(J, {
    "aria-label": a || S.format("decrease", {
      fieldLabel: Ee
    }).trim(),
    id: ee && !a ? Je : null,
    "aria-labelledby": ee && !a ? `${Je} ${ee}` : null,
    "aria-controls": o,
    excludeFromTabOrder: !0,
    preventFocusOnPress: !0,
    allowFocusWhenDisabled: !0,
    isDisabled: !t.canDecrement,
    onPressStart: Xe
  });
  return {
    groupProps: {
      ...pi,
      role: "group",
      "aria-disabled": s,
      "aria-invalid": Ge ? "true" : void 0
    },
    labelProps: qe,
    inputProps: He,
    incrementButtonProps: Ei,
    decrementButtonProps: xi,
    errorMessageProps: Pi,
    descriptionProps: hi,
    isInvalid: Ge,
    validationErrors: $i,
    validationDetails: gi
  };
}
function Bn(e) {
  let { minValue: t, maxValue: r, step: i, formatOptions: a, value: l, defaultValue: s = NaN, onChange: u, locale: f, isDisabled: b, isReadOnly: v } = e;
  l === null && (l = NaN), l !== void 0 && !isNaN(l) && (i !== void 0 && !isNaN(i) ? l = q(l, t, r, i) : l = Te(l, t, r)), isNaN(s) || (i !== void 0 && !isNaN(i) ? s = q(s, t, r, i) : s = Te(s, t, r));
  let [d, c] = wt(l, isNaN(s) ? NaN : s, u), [g, x] = j(() => isNaN(d) ? "" : new ye(f, a).format(d)), L = O(() => new Vt(f, a), [
    f,
    a
  ]), D = O(() => L.getNumberingSystem(g), [
    L,
    g
  ]), C = O(() => new ye(f, {
    ...a,
    numberingSystem: D
  }), [
    f,
    a,
    D
  ]), M = O(() => C.resolvedOptions(), [
    C
  ]), h = re((F) => isNaN(F) || F === null ? "" : C.format(F), [
    C
  ]), P = hr({
    ...e,
    value: d
  }), E = i !== void 0 && !isNaN(i) ? i : 1;
  M.style === "percent" && (i === void 0 || isNaN(i)) && (E = 0.01);
  let [w, V] = j(d), [K, A] = j(f), [$, n] = j(a);
  (!Object.is(d, w) || f !== K || a !== $) && (x(h(d)), V(d), A(f), n(a));
  let m = O(() => L.parse(g), [
    L,
    g
  ]), N = () => {
    if (!g.length) {
      c(NaN), x(l === void 0 ? "" : h(d));
      return;
    }
    if (isNaN(m)) {
      x(h(d));
      return;
    }
    let F;
    i === void 0 || isNaN(i) ? F = Te(m, t, r) : F = q(m, t, r, i), F = L.parse(h(F)), c(F), x(h(l === void 0 ? F : d));
  }, p = (F, de = 0) => {
    let J = m;
    if (isNaN(J)) {
      let Q = isNaN(de) ? 0 : de;
      return q(Q, t, r, E);
    } else {
      let Q = q(J, t, r, E);
      return F === "+" && Q > J || F === "-" && Q < J ? Q : q(Fe(F, J, E), t, r, E);
    }
  }, S = () => {
    let F = p("+", t);
    F === d && x(h(F)), c(F), P.commitValidation();
  }, o = () => {
    let F = p("-", r);
    F === d && x(h(F)), c(F), P.commitValidation();
  }, y = () => {
    r != null && (c(q(r, t, r, E)), P.commitValidation());
  }, T = () => {
    t != null && (c(t), P.commitValidation());
  }, R = O(() => !b && !v && (isNaN(m) || r === void 0 || isNaN(r) || q(m, t, r, E) > m || Fe("+", m, E) <= r), [
    b,
    v,
    t,
    r,
    E,
    m
  ]), ue = O(() => !b && !v && (isNaN(m) || t === void 0 || isNaN(t) || q(m, t, r, E) < m || Fe("-", m, E) >= t), [
    b,
    v,
    t,
    r,
    E,
    m
  ]);
  return {
    ...P,
    validate: (F) => L.isValidPartialNumber(F, t, r),
    increment: S,
    incrementToMax: y,
    decrement: o,
    decrementToMin: T,
    canIncrement: R,
    canDecrement: ue,
    minValue: t,
    maxValue: r,
    numberValue: m,
    setNumberValue: c,
    setInputValue: x,
    inputValue: g,
    commit: N
  };
}
function Fe(e, t, r) {
  let i = e === "+" ? t + r : t - r;
  if (t % 1 !== 0 || r % 1 !== 0) {
    const a = t.toString().split("."), l = r.toString().split("."), s = a[1] && a[1].length || 0, u = l[1] && l[1].length || 0, f = Math.pow(10, Math.max(s, u));
    t = Math.round(t * f), r = Math.round(r * f), i = e === "+" ? t + r : t - r, i /= f;
  }
  return i;
}
const On = ({
  inputRef: e,
  locale: t = "fr",
  ...r
}) => {
  const i = Bn({
    ...r,
    isDisabled: r.disabled,
    isReadOnly: r.readOnly,
    isRequired: r.required,
    locale: t
  }), { groupProps: a, inputProps: l, incrementButtonProps: s, decrementButtonProps: u } = Mn(
    {
      isWheelDisabled: !1,
      ...r,
      isDisabled: r.disabled,
      isReadOnly: r.readOnly,
      isRequired: r.required
    },
    i,
    e
  );
  return {
    groupProps: a,
    inputProps: l,
    incrementButtonProps: s,
    decrementButtonProps: u
  };
}, ii = yt(null), ni = ({
  children: e,
  formatOptions: t,
  minValue: r,
  maxValue: i,
  ref: a,
  ...l
}) => {
  const s = Y(null), {
    groupProps: u,
    inputProps: f,
    incrementButtonProps: b,
    decrementButtonProps: v
  } = On({
    ...l,
    /**
     * To enable the possibility to init the stepper with empty (undefined) value,
     * we need to force the empty value to NaN.
     * Cf. https://github.com/adobe/react-spectrum/issues/5524
     */
    ..."value" in l && { value: l.value ?? NaN },
    onChange: l.onValueChange,
    formatOptions: t,
    minValue: r,
    maxValue: i,
    inputRef: s
  }), d = Ti(), c = !!d.id, g = {
    ...b,
    ...c && { "aria-controls": d.id }
  }, x = {
    ...v,
    ...c && { "aria-controls": d.id }
  }, L = {
    ...f,
    ...c && {
      id: d.id,
      required: d.isRequired,
      "aria-invalid": d.isInvalid ? !0 : void 0
    }
  }, { onValueChange: D, ...C } = l;
  return /* @__PURE__ */ G(
    ii.Provider,
    {
      value: { incrementButtonProps: g, decrementButtonProps: x, inputProps: L, inputRef: s },
      children: /* @__PURE__ */ G(
        Ae,
        {
          ...C,
          ...u,
          "data-spark-component": "stepper",
          ref: a,
          children: e
        }
      )
    }
  );
};
ni.displayName = "Stepper";
const Ue = () => {
  const e = he(ii);
  if (!e)
    throw Error("useStepperContext must be used within a Stepper provider");
  return e;
};
function ai(e, t) {
  let { elementType: r = "button", isDisabled: i, onPress: a, onPressStart: l, onPressEnd: s, onPressUp: u, onPressChange: f, preventFocusOnPress: b, allowFocusWhenDisabled: v, onClick: d, href: c, target: g, rel: x, type: L = "button" } = e, D;
  r === "button" ? D = {
    type: L,
    disabled: i
  } : D = {
    role: "button",
    href: r === "a" && !i ? c : void 0,
    target: r === "a" ? g : void 0,
    type: r === "input" ? L : void 0,
    disabled: r === "input" ? i : void 0,
    "aria-disabled": !i || r === "input" ? void 0 : i,
    rel: r === "a" ? x : void 0
  };
  let { pressProps: C, isPressed: M } = ln({
    onPressStart: l,
    onPressEnd: s,
    onPressChange: f,
    onPress: a,
    onPressUp: u,
    onClick: d,
    isDisabled: i,
    preventFocusOnPress: b,
    ref: t
  }), { focusableProps: h } = Ot(e, t);
  v && (h.tabIndex = i ? -1 : h.tabIndex);
  let P = z(h, C, Re(e, {
    labelable: !0
  }));
  return {
    isPressed: M,
    buttonProps: z(D, P, {
      "aria-haspopup": e["aria-haspopup"],
      "aria-expanded": e["aria-expanded"],
      "aria-controls": e["aria-controls"],
      "aria-pressed": e["aria-pressed"],
      "aria-current": e["aria-current"]
    })
  };
}
const li = ({
  children: e,
  design: t = "ghost",
  intent: r = "neutral",
  className: i,
  ref: a,
  ...l
}) => {
  const s = Y(null), u = a && typeof a != "function" ? a : s, { incrementButtonProps: f } = Ue(), { buttonProps: b } = ai({ ...f, ...l }, u);
  return /* @__PURE__ */ G(Ae.TrailingAddon, { asChild: !0, "data-spark-component": "stepper-increment-button", children: /* @__PURE__ */ G(
    Dt,
    {
      ref: u,
      design: t,
      intent: r,
      className: i,
      "aria-label": b["aria-label"],
      ...b,
      disabled: l.disabled || b.disabled,
      children: e || /* @__PURE__ */ G(Tt, { children: /* @__PURE__ */ G(_i, {}) })
    }
  ) });
}, oi = ({
  children: e,
  design: t = "ghost",
  intent: r = "neutral",
  className: i,
  ref: a,
  ...l
}) => {
  const s = Y(null), u = a && typeof a != "function" ? a : s, { decrementButtonProps: f } = Ue(), { buttonProps: b } = ai({ ...f, ...l }, u);
  return /* @__PURE__ */ G(Ae.LeadingAddon, { asChild: !0, "data-spark-component": "stepper-decrement-button", children: /* @__PURE__ */ G(
    Dt,
    {
      ref: u,
      design: t,
      intent: r,
      className: i,
      "aria-label": b["aria-label"],
      ...b,
      disabled: l.disabled || b.disabled,
      children: e || /* @__PURE__ */ G(Tt, { children: /* @__PURE__ */ G(Ri, {}) })
    }
  ) });
}, si = Object.assign(li, {
  id: "TrailingAddon"
}), ui = Object.assign(oi, {
  id: "LeadingAddon"
});
li.displayName = "Stepper.DecrementButton";
oi.displayName = "Stepper.DecrementButton";
const di = ({ ref: e, ...t }) => {
  const { inputRef: r, inputProps: i } = Ue(), a = Ui(e, r), { className: l = "", ...s } = t;
  return /* @__PURE__ */ G(
    Di,
    {
      ref: a,
      ...s,
      ...i,
      className: `min-w-sz-56 text-center ${l}`
    }
  );
}, ci = Object.assign(di, {
  id: "Input"
});
di.displayName = "Stepper.Input";
const kn = Object.assign(ni, { IncrementButton: si, DecrementButton: ui, Input: ci });
kn.displayName = "Stepper";
si.displayName = "Stepper.IncrementButton";
ui.displayName = "Stepper.DecrementButton";
ci.displayName = "Stepper.Input";
export {
  kn as Stepper
};
//# sourceMappingURL=index.mjs.map
