import d, { useRef as v, useCallback as p, useState as k, useContext as D, useEffect as j, useMemo as pe } from "react";
import { b as ve } from "./index-BmAFn37q.mjs";
const S = typeof document < "u" ? d.useLayoutEffect : () => {
};
var V;
const me = (V = d.useInsertionEffect) !== null && V !== void 0 ? V : S;
function G(e) {
  const t = v(null);
  return me(() => {
    t.current = e;
  }, [
    e
  ]), p((...n) => {
    const r = t.current;
    return r?.(...n);
  }, []);
}
function ge(e) {
  let [t, n] = k(e), r = v(null), o = G(() => {
    if (!r.current) return;
    let a = r.current.next();
    if (a.done) {
      r.current = null;
      return;
    }
    t === a.value ? o() : n(a.value);
  });
  S(() => {
    r.current && o();
  });
  let i = G((a) => {
    r.current = a(t), o();
  });
  return [
    t,
    i
  ];
}
const P = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
}, ne = /* @__PURE__ */ d.createContext(P), he = /* @__PURE__ */ d.createContext(!1);
let we = !!(typeof window < "u" && window.document && window.document.createElement), W = /* @__PURE__ */ new WeakMap();
function ye(e = !1) {
  let t = D(ne), n = v(null);
  if (n.current === null && !e) {
    var r, o;
    let i = (o = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
    if (i) {
      let a = W.get(i);
      a == null ? W.set(i, {
        id: t.current,
        state: i.memoizedState
      }) : i.memoizedState !== a.state && (t.current = a.id, W.delete(i));
    }
    n.current = ++t.current;
  }
  return n.current;
}
function Ee(e) {
  let t = D(ne);
  t === P && !we && process.env.NODE_ENV !== "production" && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
  let n = ye(!!e), r = t === P && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
  return e || `${r}-${n}`;
}
function Le(e) {
  let t = d.useId(), [n] = k(re()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${P.prefix}`;
  return e || `${r}-${t}`;
}
const xe = typeof d.useId == "function" ? Le : Ee;
function Se() {
  return !1;
}
function Te() {
  return !0;
}
function Me(e) {
  return () => {
  };
}
function re() {
  return typeof d.useSyncExternalStore == "function" ? d.useSyncExternalStore(Me, Se, Te) : D(he);
}
let Pe = !!(typeof window < "u" && window.document && window.document.createElement), h = /* @__PURE__ */ new Map(), y;
typeof FinalizationRegistry < "u" && (y = new FinalizationRegistry((e) => {
  h.delete(e);
}));
function Fe(e) {
  let [t, n] = k(e), r = v(null), o = xe(t), i = v(null);
  if (y && y.register(i, o), Pe) {
    const a = h.get(o);
    a && !a.includes(r) ? a.push(r) : h.set(o, [
      r
    ]);
  }
  return S(() => {
    let a = o;
    return () => {
      y && y.unregister(i), h.delete(a);
    };
  }, [
    o
  ]), j(() => {
    let a = r.current;
    return a && n(a), () => {
      a && (r.current = null);
    };
  }), o;
}
function Ce(e, t) {
  if (e === t) return e;
  let n = h.get(e);
  if (n)
    return n.forEach((o) => o.current = t), t;
  let r = h.get(t);
  return r ? (r.forEach((o) => o.current = e), e) : t;
}
function St(e = []) {
  let t = Fe(), [n, r] = ge(t), o = p(() => {
    r(function* () {
      yield t, yield document.getElementById(t) ? t : void 0;
    });
  }, [
    t,
    r
  ]);
  return S(o, [
    t,
    o,
    ...e
  ]), n;
}
function ke(...e) {
  return (...t) => {
    for (let n of e) typeof n == "function" && n(...t);
  };
}
const T = (e) => {
  var t;
  return (t = e?.ownerDocument) !== null && t !== void 0 ? t : document;
}, x = (e) => e && "window" in e && e.window === e ? e : T(e).defaultView || window;
function De(e) {
  return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number";
}
function Ae(e) {
  return De(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e;
}
let Ie = !1;
function z() {
  return Ie;
}
function Ne(e, t) {
  if (!z()) return t && e ? e.contains(t) : !1;
  if (!e || !t) return !1;
  let n = t;
  for (; n !== null; ) {
    if (n === e) return !0;
    n.tagName === "SLOT" && n.assignedSlot ? n = n.assignedSlot.parentNode : Ae(n) ? n = n.host : n = n.parentNode;
  }
  return !1;
}
const Oe = (e = document) => {
  var t;
  if (!z()) return e.activeElement;
  let n = e.activeElement;
  for (; n && "shadowRoot" in n && (!((t = n.shadowRoot) === null || t === void 0) && t.activeElement); ) n = n.shadowRoot.activeElement;
  return n;
};
function Ve(e) {
  return z() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target;
}
function Tt(...e) {
  let t = {
    ...e[0]
  };
  for (let n = 1; n < e.length; n++) {
    let r = e[n];
    for (let o in r) {
      let i = t[o], a = r[o];
      typeof i == "function" && typeof a == "function" && // This is a lot faster than a regex.
      o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= /* 'A' */
      65 && o.charCodeAt(2) <= /* 'Z' */
      90 ? t[o] = ke(i, a) : (o === "className" || o === "UNSAFE_className") && typeof i == "string" && typeof a == "string" ? t[o] = ve(i, a) : o === "id" && i && a ? t.id = Ce(i, a) : t[o] = a !== void 0 ? a : i;
    }
  }
  return t;
}
const We = /* @__PURE__ */ new Set([
  "id"
]), Ge = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]), He = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]), Re = /* @__PURE__ */ new Set([
  "dir",
  "lang",
  "hidden",
  "inert",
  "translate"
]), Q = /* @__PURE__ */ new Set([
  "onClick",
  "onAuxClick",
  "onContextMenu",
  "onDoubleClick",
  "onMouseDown",
  "onMouseEnter",
  "onMouseLeave",
  "onMouseMove",
  "onMouseOut",
  "onMouseOver",
  "onMouseUp",
  "onTouchCancel",
  "onTouchEnd",
  "onTouchMove",
  "onTouchStart",
  "onPointerDown",
  "onPointerMove",
  "onPointerUp",
  "onPointerCancel",
  "onPointerEnter",
  "onPointerLeave",
  "onPointerOver",
  "onPointerOut",
  "onGotPointerCapture",
  "onLostPointerCapture",
  "onScroll",
  "onWheel",
  "onAnimationStart",
  "onAnimationEnd",
  "onAnimationIteration",
  "onTransitionCancel",
  "onTransitionEnd",
  "onTransitionRun",
  "onTransitionStart"
]), je = /^(data-.*)$/;
function Mt(e, t = {}) {
  let { labelable: n, isLink: r, global: o, events: i = o, propNames: a } = t, l = {};
  for (const c in e) Object.prototype.hasOwnProperty.call(e, c) && (We.has(c) || n && Ge.has(c) || r && He.has(c) || o && Re.has(c) || i && Q.has(c) || c.endsWith("Capture") && Q.has(c.slice(0, -7)) || a?.has(c) || je.test(c)) && (l[c] = e[c]);
  return l;
}
function X(e) {
  if (ze()) e.focus({
    preventScroll: !0
  });
  else {
    let t = Be(e);
    e.focus(), Ue(t);
  }
}
let M = null;
function ze() {
  if (M == null) {
    M = !1;
    try {
      document.createElement("div").focus({
        get preventScroll() {
          return M = !0, !0;
        }
      });
    } catch {
    }
  }
  return M;
}
function Be(e) {
  let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
  for (; t instanceof HTMLElement && t !== r; )
    (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
      element: t,
      scrollTop: t.scrollTop,
      scrollLeft: t.scrollLeft
    }), t = t.parentNode;
  return r instanceof HTMLElement && n.push({
    element: r,
    scrollTop: r.scrollTop,
    scrollLeft: r.scrollLeft
  }), n;
}
function Ue(e) {
  for (let { element: t, scrollTop: n, scrollLeft: r } of e)
    t.scrollTop = n, t.scrollLeft = r;
}
function A(e) {
  var t;
  if (typeof window > "u" || window.navigator == null) return !1;
  let n = (t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands;
  return Array.isArray(n) && n.some((r) => e.test(r.brand)) || e.test(window.navigator.userAgent);
}
function B(e) {
  var t;
  return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
}
function $(e) {
  if (process.env.NODE_ENV === "test") return e;
  let t = null;
  return () => (t == null && (t = e()), t);
}
const U = $(function() {
  return B(/^Mac/i);
}), Ke = $(function() {
  return B(/^iPhone/i);
}), qe = $(function() {
  return B(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  U() && navigator.maxTouchPoints > 1;
}), Je = $(function() {
  return Ke() || qe();
});
$(function() {
  return U() || Je();
});
const Pt = $(function() {
  return A(/AppleWebKit/i) && !Qe();
}), Qe = $(function() {
  return A(/Chrome/i);
}), oe = $(function() {
  return A(/Android/i);
}), Ft = $(function() {
  return A(/Firefox/i);
});
function Xe() {
  let e = v(/* @__PURE__ */ new Map()), t = p((o, i, a, l) => {
    let c = l?.once ? (...b) => {
      e.current.delete(a), a(...b);
    } : a;
    e.current.set(a, {
      type: i,
      eventTarget: o,
      fn: c,
      options: l
    }), o.addEventListener(i, c, l);
  }, []), n = p((o, i, a, l) => {
    var c;
    let b = ((c = e.current.get(a)) === null || c === void 0 ? void 0 : c.fn) || a;
    o.removeEventListener(i, b, l), e.current.delete(a);
  }, []), r = p(() => {
    e.current.forEach((o, i) => {
      n(o.eventTarget, o.type, i, o.options);
    });
  }, [
    n
  ]);
  return j(() => r, [
    r
  ]), {
    addGlobalListener: t,
    removeGlobalListener: n,
    removeAllGlobalListeners: r
  };
}
function Ze(e) {
  return e.pointerType === "" && e.isTrusted ? !0 : oe() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
}
function Ct(e) {
  return !oe() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
}
const Ye = typeof Element < "u" && "checkVisibility" in Element.prototype;
function _e(e) {
  const t = x(e);
  if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement)) return !1;
  let { display: n, visibility: r } = e.style, o = n !== "none" && r !== "hidden" && r !== "collapse";
  if (o) {
    const { getComputedStyle: i } = e.ownerDocument.defaultView;
    let { display: a, visibility: l } = i(e);
    o = a !== "none" && l !== "hidden" && l !== "collapse";
  }
  return o;
}
function et(e, t) {
  return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
}
function ae(e, t) {
  return Ye ? e.checkVisibility({
    visibilityProperty: !0
  }) && !e.closest("[data-react-aria-prevent-focus]") : e.nodeName !== "#comment" && _e(e) && et(e, t) && (!e.parentElement || ae(e.parentElement, e));
}
const ie = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
], tt = ie.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
ie.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function nt(e) {
  return e.matches(tt) && ae(e) && !rt(e);
}
function rt(e) {
  let t = e;
  for (; t != null; ) {
    if (t instanceof t.ownerDocument.defaultView.HTMLElement && t.inert) return !0;
    t = t.parentElement;
  }
  return !1;
}
const ot = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]), at = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function it(e) {
  if (Intl.Locale) {
    let n = new Intl.Locale(e).maximize(), r = typeof n.getTextInfo == "function" ? n.getTextInfo() : n.textInfo;
    if (r) return r.direction === "rtl";
    if (n.script) return ot.has(n.script);
  }
  let t = e.split("-")[0];
  return at.has(t);
}
const ct = Symbol.for("react-aria.i18n.locale");
function ce() {
  let e = typeof window < "u" && window[ct] || typeof navigator < "u" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      e
    ]);
  } catch {
    e = "en-US";
  }
  return {
    locale: e,
    direction: it(e) ? "rtl" : "ltr"
  };
}
let H = ce(), E = /* @__PURE__ */ new Set();
function Z() {
  H = ce();
  for (let e of E) e(H);
}
function lt() {
  let e = re(), [t, n] = k(H);
  return j(() => (E.size === 0 && window.addEventListener("languagechange", Z), E.add(n), () => {
    E.delete(n), E.size === 0 && window.removeEventListener("languagechange", Z);
  }), []), e ? {
    locale: "en-US",
    direction: "ltr"
  } : t;
}
const ut = /* @__PURE__ */ d.createContext(null);
function st() {
  let e = lt();
  return D(ut) || e;
}
const ft = Symbol.for("react-aria.i18n.locale"), dt = Symbol.for("react-aria.i18n.strings");
let g;
class I {
  /** Returns a localized string for the given key and locale. */
  getStringForLocale(t, n) {
    let o = this.getStringsForLocale(n)[t];
    if (!o) throw new Error(`Could not find intl message ${t} in ${n} locale`);
    return o;
  }
  /** Returns all localized strings for the given locale. */
  getStringsForLocale(t) {
    let n = this.strings[t];
    return n || (n = $t(t, this.strings, this.defaultLocale), this.strings[t] = n), n;
  }
  static getGlobalDictionaryForPackage(t) {
    if (typeof window > "u") return null;
    let n = window[ft];
    if (g === void 0) {
      let o = window[dt];
      if (!o) return null;
      g = {};
      for (let i in o) g[i] = new I({
        [n]: o[i]
      }, n);
    }
    let r = g?.[t];
    if (!r) throw new Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
    return r;
  }
  constructor(t, n = "en-US") {
    this.strings = Object.fromEntries(Object.entries(t).filter(([, r]) => r)), this.defaultLocale = n;
  }
}
function $t(e, t, n = "en-US") {
  if (t[e]) return t[e];
  let r = bt(e);
  if (t[r]) return t[r];
  for (let o in t)
    if (o.startsWith(r + "-")) return t[o];
  return t[n];
}
function bt(e) {
  return Intl.Locale ? new Intl.Locale(e).language : e.split("-")[0];
}
const Y = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
class pt {
  /** Formats a localized string for the given key with the provided variables. */
  format(t, n) {
    let r = this.strings.getStringForLocale(t, this.locale);
    return typeof r == "function" ? r(n, this) : r;
  }
  plural(t, n, r = "cardinal") {
    let o = n["=" + t];
    if (o) return typeof o == "function" ? o() : o;
    let i = this.locale + ":" + r, a = Y.get(i);
    a || (a = new Intl.PluralRules(this.locale, {
      type: r
    }), Y.set(i, a));
    let l = a.select(t);
    return o = n[l] || n.other, typeof o == "function" ? o() : o;
  }
  number(t) {
    let n = _.get(this.locale);
    return n || (n = new Intl.NumberFormat(this.locale), _.set(this.locale, n)), n.format(t);
  }
  select(t, n) {
    let r = t[n] || t.other;
    return typeof r == "function" ? r() : r;
  }
  constructor(t, n) {
    this.locale = t, this.strings = n;
  }
}
const ee = /* @__PURE__ */ new WeakMap();
function vt(e) {
  let t = ee.get(e);
  return t || (t = new I(e), ee.set(e, t)), t;
}
function mt(e, t) {
  return t && I.getGlobalDictionaryForPackage(t) || vt(e);
}
function kt(e, t) {
  let { locale: n } = st(), r = mt(e, t);
  return pe(() => new pt(n, r), [
    n,
    r
  ]);
}
function le(e) {
  let t = e;
  return t.nativeEvent = e, t.isDefaultPrevented = () => t.defaultPrevented, t.isPropagationStopped = () => t.cancelBubble, t.persist = () => {
  }, t;
}
function gt(e, t) {
  Object.defineProperty(e, "target", {
    value: t
  }), Object.defineProperty(e, "currentTarget", {
    value: t
  });
}
function ht(e) {
  let t = v({
    isFocused: !1,
    observer: null
  });
  S(() => {
    const r = t.current;
    return () => {
      r.observer && (r.observer.disconnect(), r.observer = null);
    };
  }, []);
  let n = G((r) => {
    e?.(r);
  });
  return p((r) => {
    if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
      t.current.isFocused = !0;
      let o = r.target, i = (a) => {
        if (t.current.isFocused = !1, o.disabled) {
          let l = le(a);
          n(l);
        }
        t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
      };
      o.addEventListener("focusout", i, {
        once: !0
      }), t.current.observer = new MutationObserver(() => {
        if (t.current.isFocused && o.disabled) {
          var a;
          (a = t.current.observer) === null || a === void 0 || a.disconnect();
          let l = o === document.activeElement ? null : document.activeElement;
          o.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: l
          })), o.dispatchEvent(new FocusEvent("focusout", {
            bubbles: !0,
            relatedTarget: l
          }));
        }
      }), t.current.observer.observe(o, {
        attributes: !0,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    n
  ]);
}
let F = !1;
function Dt(e) {
  for (; e && !nt(e); ) e = e.parentElement;
  let t = x(e), n = t.document.activeElement;
  if (!n || n === e) return;
  F = !0;
  let r = !1, o = (u) => {
    (u.target === n || r) && u.stopImmediatePropagation();
  }, i = (u) => {
    (u.target === n || r) && (u.stopImmediatePropagation(), !e && !r && (r = !0, X(n), c()));
  }, a = (u) => {
    (u.target === e || r) && u.stopImmediatePropagation();
  }, l = (u) => {
    (u.target === e || r) && (u.stopImmediatePropagation(), r || (r = !0, X(n), c()));
  };
  t.addEventListener("blur", o, !0), t.addEventListener("focusout", i, !0), t.addEventListener("focusin", l, !0), t.addEventListener("focus", a, !0);
  let c = () => {
    cancelAnimationFrame(b), t.removeEventListener("blur", o, !0), t.removeEventListener("focusout", i, !0), t.removeEventListener("focusin", l, !0), t.removeEventListener("focus", a, !0), F = !1, r = !1;
  }, b = requestAnimationFrame(c);
  return c;
}
let w = null, wt = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Map(), m = !1, R = !1;
function N(e, t) {
  for (let n of wt) n(e, t);
}
function yt(e) {
  return !(e.metaKey || !U() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
}
function C(e) {
  m = !0, yt(e) && (w = "keyboard", N("keyboard", e));
}
function f(e) {
  w = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (m = !0, N("pointer", e));
}
function ue(e) {
  Ze(e) && (m = !0, w = "virtual");
}
function se(e) {
  e.target === window || e.target === document || F || !e.isTrusted || (!m && !R && (w = "virtual", N("virtual", e)), m = !1, R = !1);
}
function fe() {
  F || (m = !1, R = !0);
}
function te(e) {
  if (typeof window > "u" || typeof document > "u" || L.get(x(e))) return;
  const t = x(e), n = T(e);
  let r = t.HTMLElement.prototype.focus;
  t.HTMLElement.prototype.focus = function() {
    m = !0, r.apply(this, arguments);
  }, n.addEventListener("keydown", C, !0), n.addEventListener("keyup", C, !0), n.addEventListener("click", ue, !0), t.addEventListener("focus", se, !0), t.addEventListener("blur", fe, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", f, !0), n.addEventListener("pointermove", f, !0), n.addEventListener("pointerup", f, !0)) : process.env.NODE_ENV === "test" && (n.addEventListener("mousedown", f, !0), n.addEventListener("mousemove", f, !0), n.addEventListener("mouseup", f, !0)), t.addEventListener("beforeunload", () => {
    de(e);
  }, {
    once: !0
  }), L.set(t, {
    focus: r
  });
}
const de = (e, t) => {
  const n = x(e), r = T(e);
  t && r.removeEventListener("DOMContentLoaded", t), L.has(n) && (n.HTMLElement.prototype.focus = L.get(n).focus, r.removeEventListener("keydown", C, !0), r.removeEventListener("keyup", C, !0), r.removeEventListener("click", ue, !0), n.removeEventListener("focus", se, !0), n.removeEventListener("blur", fe, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", f, !0), r.removeEventListener("pointermove", f, !0), r.removeEventListener("pointerup", f, !0)) : process.env.NODE_ENV === "test" && (r.removeEventListener("mousedown", f, !0), r.removeEventListener("mousemove", f, !0), r.removeEventListener("mouseup", f, !0)), L.delete(n));
};
function Et(e) {
  const t = T(e);
  let n;
  return t.readyState !== "loading" ? te(e) : (n = () => {
    te(e);
  }, t.addEventListener("DOMContentLoaded", n)), () => de(e, n);
}
typeof document < "u" && Et();
function At() {
  return w;
}
function It(e) {
  w = e, N(e, null);
}
function Nt(e) {
  let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, i = v({
    isFocusWithin: !1
  }), { addGlobalListener: a, removeAllGlobalListeners: l } = Xe(), c = p((s) => {
    s.currentTarget.contains(s.target) && i.current.isFocusWithin && !s.currentTarget.contains(s.relatedTarget) && (i.current.isFocusWithin = !1, l(), n && n(s), o && o(!1));
  }, [
    n,
    o,
    i,
    l
  ]), b = ht(c), u = p((s) => {
    if (!s.currentTarget.contains(s.target)) return;
    const O = T(s.target), $e = Oe(O);
    if (!i.current.isFocusWithin && $e === Ve(s.nativeEvent)) {
      r && r(s), o && o(!0), i.current.isFocusWithin = !0, b(s);
      let K = s.currentTarget;
      a(O, "focus", (q) => {
        if (i.current.isFocusWithin && !Ne(K, q.target)) {
          let J = new O.defaultView.FocusEvent("blur", {
            relatedTarget: q.target
          });
          gt(J, K);
          let be = le(J);
          c(be);
        }
      }, {
        capture: !0
      });
    }
  }, [
    r,
    o,
    b,
    a,
    c
  ]);
  return t ? {
    focusWithinProps: {
      // These cannot be null, that would conflict in mergeProps
      onFocus: void 0,
      onBlur: void 0
    }
  } : {
    focusWithinProps: {
      onFocus: u,
      onBlur: c
    }
  };
}
export {
  Fe as $,
  Oe as A,
  ht as B,
  It as C,
  Ke as D,
  oe as E,
  St as a,
  kt as b,
  Mt as c,
  Xe as d,
  T as e,
  Ne as f,
  S as g,
  G as h,
  At as i,
  X as j,
  Nt as k,
  Tt as l,
  Ft as m,
  Pt as n,
  U as o,
  qe as p,
  st as q,
  Je as r,
  gt as s,
  le as t,
  Ve as u,
  Ct as v,
  Dt as w,
  Ze as x,
  x as y,
  ke as z
};
//# sourceMappingURL=useFocusWithin-CoL4390f.mjs.map
