import { jsx as Ae, jsxs as Fn, Fragment as So } from "react/jsx-runtime";
import * as I from "react";
import V, { useRef as Q, useCallback as ae, useEffect as fe, useState as le, useMemo as ce, useLayoutEffect as Vr, useContext as ue, createContext as be, forwardRef as Us, Fragment as Re, isValidElement as Vs, cloneElement as Ys, createElement as Gs, useId as Ot, useReducer as qs, useSyncExternalStore as Ks } from "react";
import * as un from "react-dom";
import { createPortal as Wi, flushSync as st } from "react-dom";
const Bi = typeof document < "u" ? V.useLayoutEffect : () => {
};
function Xs(e) {
const t = Q(null);
return Bi(() => {
t.current = e;
}, [
e
]), ae((...n) => {
const r = t.current;
return r == null ? void 0 : r(...n);
}, []);
}
const rt = (e) => {
var t;
return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
}, ot = (e) => e && "window" in e && e.window === e ? e : rt(e).defaultView || window;
function Qs(e) {
return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number";
}
function Js(e) {
return Qs(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e;
}
let Zs = !1;
function Yr() {
return Zs;
}
function Ui(e, t) {
if (!Yr()) 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 : Js(n) ? n = n.host : n = n.parentNode;
}
return !1;
}
const ur = (e = document) => {
var t;
if (!Yr()) 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 Vi(e) {
return Yr() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target;
}
function el(e) {
var t;
return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
}
function tl(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 Yi(e) {
let t = null;
return () => (t == null && (t = e()), t);
}
const nl = Yi(function() {
return tl(/^Mac/i);
}), rl = Yi(function() {
return el(/Android/i);
});
function Gi() {
let e = Q(/* @__PURE__ */ new Map()), t = ae((o, i, a, s) => {
let l = s != null && s.once ? (...c) => {
e.current.delete(a), a(...c);
} : a;
e.current.set(a, {
type: i,
eventTarget: o,
fn: l,
options: s
}), o.addEventListener(i, l, s);
}, []), n = ae((o, i, a, s) => {
var l;
let c = ((l = e.current.get(a)) === null || l === void 0 ? void 0 : l.fn) || a;
o.removeEventListener(i, c, s), e.current.delete(a);
}, []), r = ae(() => {
e.current.forEach((o, i) => {
n(o.eventTarget, o.type, i, o.options);
});
}, [
n
]);
return fe(() => r, [
r
]), {
addGlobalListener: t,
removeGlobalListener: n,
removeAllGlobalListeners: r
};
}
function ol(e) {
return e.mozInputSource === 0 && e.isTrusted ? !0 : rl() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
}
class qi {
isDefaultPrevented() {
return this.nativeEvent.defaultPrevented;
}
preventDefault() {
this.defaultPrevented = !0, this.nativeEvent.preventDefault();
}
stopPropagation() {
this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
}
isPropagationStopped() {
return !1;
}
persist() {
}
constructor(t, n) {
this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
}
}
function Ki(e) {
let t = Q({
isFocused: !1,
observer: null
});
Bi(() => {
const r = t.current;
return () => {
r.observer && (r.observer.disconnect(), r.observer = null);
};
}, []);
let n = Xs((r) => {
e == null || e(r);
});
return ae((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) => {
t.current.isFocused = !1, o.disabled && n(new qi("blur", a)), 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 s = o === document.activeElement ? null : document.activeElement;
o.dispatchEvent(new FocusEvent("blur", {
relatedTarget: s
})), o.dispatchEvent(new FocusEvent("focusout", {
bubbles: !0,
relatedTarget: s
}));
}
}), t.current.observer.observe(o, {
attributes: !0,
attributeFilter: [
"disabled"
]
});
}
}, [
n
]);
}
let il = !1, Vt = null, fr = /* @__PURE__ */ new Set(), _t = /* @__PURE__ */ new Map(), ct = !1, dr = !1;
const al = {
Tab: !0,
Escape: !0
};
function Gr(e, t) {
for (let n of fr) n(e, t);
}
function sl(e) {
return !(e.metaKey || !nl() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
}
function fn(e) {
ct = !0, sl(e) && (Vt = "keyboard", Gr("keyboard", e));
}
function Se(e) {
Vt = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (ct = !0, Gr("pointer", e));
}
function Xi(e) {
ol(e) && (ct = !0, Vt = "virtual");
}
function Qi(e) {
e.target === window || e.target === document || il || !e.isTrusted || (!ct && !dr && (Vt = "virtual", Gr("virtual", e)), ct = !1, dr = !1);
}
function Ji() {
ct = !1, dr = !0;
}
function pr(e) {
if (typeof window > "u" || _t.get(ot(e))) return;
const t = ot(e), n = rt(e);
let r = t.HTMLElement.prototype.focus;
t.HTMLElement.prototype.focus = function() {
ct = !0, r.apply(this, arguments);
}, n.addEventListener("keydown", fn, !0), n.addEventListener("keyup", fn, !0), n.addEventListener("click", Xi, !0), t.addEventListener("focus", Qi, !0), t.addEventListener("blur", Ji, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", Se, !0), n.addEventListener("pointermove", Se, !0), n.addEventListener("pointerup", Se, !0)) : (n.addEventListener("mousedown", Se, !0), n.addEventListener("mousemove", Se, !0), n.addEventListener("mouseup", Se, !0)), t.addEventListener("beforeunload", () => {
Zi(e);
}, {
once: !0
}), _t.set(t, {
focus: r
});
}
const Zi = (e, t) => {
const n = ot(e), r = rt(e);
t && r.removeEventListener("DOMContentLoaded", t), _t.has(n) && (n.HTMLElement.prototype.focus = _t.get(n).focus, r.removeEventListener("keydown", fn, !0), r.removeEventListener("keyup", fn, !0), r.removeEventListener("click", Xi, !0), n.removeEventListener("focus", Qi, !0), n.removeEventListener("blur", Ji, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", Se, !0), r.removeEventListener("pointermove", Se, !0), r.removeEventListener("pointerup", Se, !0)) : (r.removeEventListener("mousedown", Se, !0), r.removeEventListener("mousemove", Se, !0), r.removeEventListener("mouseup", Se, !0)), _t.delete(n));
};
function ll(e) {
const t = rt(e);
let n;
return t.readyState !== "loading" ? pr(e) : (n = () => {
pr(e);
}, t.addEventListener("DOMContentLoaded", n)), () => Zi(e, n);
}
typeof document < "u" && ll();
function ea() {
return Vt !== "pointer";
}
const cl = /* @__PURE__ */ new Set([
"checkbox",
"radio",
"range",
"color",
"file",
"image",
"button",
"submit",
"reset"
]);
function ul(e, t, n) {
let r = rt(n == null ? void 0 : n.target);
const o = typeof window < "u" ? ot(n == null ? void 0 : n.target).HTMLInputElement : HTMLInputElement, i = typeof window < "u" ? ot(n == null ? void 0 : n.target).HTMLTextAreaElement : HTMLTextAreaElement, a = typeof window < "u" ? ot(n == null ? void 0 : n.target).HTMLElement : HTMLElement, s = typeof window < "u" ? ot(n == null ? void 0 : n.target).KeyboardEvent : KeyboardEvent;
return e = e || r.activeElement instanceof o && !cl.has(r.activeElement.type) || r.activeElement instanceof i || r.activeElement instanceof a && r.activeElement.isContentEditable, !(e && t === "keyboard" && n instanceof s && !al[n.key]);
}
function fl(e, t, n) {
pr(), fe(() => {
let r = (o, i) => {
ul(!!(n != null && n.isTextInput), o, i) && e(ea());
};
return fr.add(r), () => {
fr.delete(r);
};
}, t);
}
function dl(e) {
let { isDisabled: t, onFocus: n, onBlur: r, onFocusChange: o } = e;
const i = ae((l) => {
if (l.target === l.currentTarget)
return r && r(l), o && o(!1), !0;
}, [
r,
o
]), a = Ki(i), s = ae((l) => {
const c = rt(l.target), u = c ? ur(c) : ur();
l.target === l.currentTarget && u === Vi(l.nativeEvent) && (n && n(l), o && o(!0), a(l));
}, [
o,
n,
a
]);
return {
focusProps: {
onFocus: !t && (n || o || r) ? s : void 0,
onBlur: !t && (r || o) ? i : void 0
}
};
}
function pl(e) {
let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, i = Q({
isFocusWithin: !1
}), { addGlobalListener: a, removeAllGlobalListeners: s } = Gi(), l = ae((d) => {
d.currentTarget.contains(d.target) && i.current.isFocusWithin && !d.currentTarget.contains(d.relatedTarget) && (i.current.isFocusWithin = !1, s(), n && n(d), o && o(!1));
}, [
n,
o,
i,
s
]), c = Ki(l), u = ae((d) => {
if (!d.currentTarget.contains(d.target)) return;
const p = rt(d.target), f = ur(p);
if (!i.current.isFocusWithin && f === Vi(d.nativeEvent)) {
r && r(d), o && o(!0), i.current.isFocusWithin = !0, c(d);
let m = d.currentTarget;
a(p, "focus", (g) => {
if (i.current.isFocusWithin && !Ui(m, g.target)) {
let h = new qi("blur", new p.defaultView.FocusEvent("blur", {
relatedTarget: g.target
}));
h.target = m, h.currentTarget = m, l(h);
}
}, {
capture: !0
});
}
}, [
r,
o,
c,
a,
l
]);
return t ? {
focusWithinProps: {
// These cannot be null, that would conflict in mergeProps
onFocus: void 0,
onBlur: void 0
}
} : {
focusWithinProps: {
onFocus: u,
onBlur: l
}
};
}
let dn = !1, _n = 0;
function mr() {
dn = !0, setTimeout(() => {
dn = !1;
}, 50);
}
function To(e) {
e.pointerType === "touch" && mr();
}
function ml() {
if (!(typeof document > "u"))
return typeof PointerEvent < "u" ? document.addEventListener("pointerup", To) : document.addEventListener("touchend", mr), _n++, () => {
_n--, !(_n > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", To) : document.removeEventListener("touchend", mr));
};
}
function gl(e) {
let { onHoverStart: t, onHoverChange: n, onHoverEnd: r, isDisabled: o } = e, [i, a] = le(!1), s = Q({
isHovered: !1,
ignoreEmulatedMouseEvents: !1,
pointerType: "",
target: null
}).current;
fe(ml, []);
let { addGlobalListener: l, removeAllGlobalListeners: c } = Gi(), { hoverProps: u, triggerHoverEnd: d } = ce(() => {
let p = (g, h) => {
if (s.pointerType = h, o || h === "touch" || s.isHovered || !g.currentTarget.contains(g.target)) return;
s.isHovered = !0;
let b = g.currentTarget;
s.target = b, l(rt(g.target), "pointerover", (x) => {
s.isHovered && s.target && !Ui(s.target, x.target) && f(x, x.pointerType);
}, {
capture: !0
}), t && t({
type: "hoverstart",
target: b,
pointerType: h
}), n && n(!0), a(!0);
}, f = (g, h) => {
let b = s.target;
s.pointerType = "", s.target = null, !(h === "touch" || !s.isHovered || !b) && (s.isHovered = !1, c(), r && r({
type: "hoverend",
target: b,
pointerType: h
}), n && n(!1), a(!1));
}, m = {};
return typeof PointerEvent < "u" ? (m.onPointerEnter = (g) => {
dn && g.pointerType === "mouse" || p(g, g.pointerType);
}, m.onPointerLeave = (g) => {
!o && g.currentTarget.contains(g.target) && f(g, g.pointerType);
}) : (m.onTouchStart = () => {
s.ignoreEmulatedMouseEvents = !0;
}, m.onMouseEnter = (g) => {
!s.ignoreEmulatedMouseEvents && !dn && p(g, "mouse"), s.ignoreEmulatedMouseEvents = !1;
}, m.onMouseLeave = (g) => {
!o && g.currentTarget.contains(g.target) && f(g, "mouse");
}), {
hoverProps: m,
triggerHoverEnd: f
};
}, [
t,
n,
r,
o,
s,
l,
c
]);
return fe(() => {
o && d({
currentTarget: s.target
}, s.pointerType);
}, [
o
]), {
hoverProps: u,
isHovered: i
};
}
function hl(e = {}) {
let { autoFocus: t = !1, isTextInput: n, within: r } = e, o = Q({
isFocused: !1,
isFocusVisible: t || ea()
}), [i, a] = le(!1), [s, l] = le(() => o.current.isFocused && o.current.isFocusVisible), c = ae(() => l(o.current.isFocused && o.current.isFocusVisible), []), u = ae((f) => {
o.current.isFocused = f, a(f), c();
}, [
c
]);
fl((f) => {
o.current.isFocusVisible = f, c();
}, [], {
isTextInput: n
});
let { focusProps: d } = dl({
isDisabled: r,
onFocusChange: u
}), { focusWithinProps: p } = pl({
isDisabled: !r,
onFocusWithinChange: u
});
return {
isFocused: i,
isFocusVisible: s,
focusProps: r ? p : d
};
}
var vl = Object.defineProperty, bl = (e, t, n) => t in e ? vl(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Nn = (e, t, n) => (bl(e, typeof t != "symbol" ? t + "" : t, n), n);
let yl = class {
constructor() {
Nn(this, "current", this.detect()), Nn(this, "handoffState", "pending"), Nn(this, "currentId", 0);
}
set(t) {
this.current !== t && (this.handoffState = "pending", this.currentId = 0, this.current = t);
}
reset() {
this.set(this.detect());
}
nextId() {
return ++this.currentId;
}
get isServer() {
return this.current === "server";
}
get isClient() {
return this.current === "client";
}
detect() {
return typeof window > "u" || typeof document > "u" ? "server" : "client";
}
handoff() {
this.handoffState === "pending" && (this.handoffState = "complete");
}
get isHandoffComplete() {
return this.handoffState === "complete";
}
}, lt = new yl();
function Yt(e) {
var t, n;
return lt.isServer ? null : e ? "ownerDocument" in e ? e.ownerDocument : "current" in e ? (n = (t = e.current) == null ? void 0 : t.ownerDocument) != null ? n : document : null : document;
}
function ta(e) {
typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
throw t;
}));
}
function ze() {
let e = [], t = { addEventListener(n, r, o, i) {
return n.addEventListener(r, o, i), t.add(() => n.removeEventListener(r, o, i));
}, requestAnimationFrame(...n) {
let r = requestAnimationFrame(...n);
return t.add(() => cancelAnimationFrame(r));
}, nextFrame(...n) {
return t.requestAnimationFrame(() => t.requestAnimationFrame(...n));
}, setTimeout(...n) {
let r = setTimeout(...n);
return t.add(() => clearTimeout(r));
}, microTask(...n) {
let r = { current: !0 };
return ta(() => {
r.current && n[0]();
}), t.add(() => {
r.current = !1;
});
}, style(n, r, o) {
let i = n.style.getPropertyValue(r);
return Object.assign(n.style, { [r]: o }), this.add(() => {
Object.assign(n.style, { [r]: i });
});
}, group(n) {
let r = ze();
return n(r), this.add(() => r.dispose());
}, add(n) {
return e.includes(n) || e.push(n), () => {
let r = e.indexOf(n);
if (r >= 0) for (let o of e.splice(r, 1)) o();
};
}, dispose() {
for (let n of e.splice(0)) n();
} };
return t;
}
function St() {
let [e] = le(ze);
return fe(() => () => e.dispose(), [e]), e;
}
let se = (e, t) => {
lt.isServer ? fe(e, t) : Vr(e, t);
};
function gt(e) {
let t = Q(e);
return se(() => {
t.current = e;
}, [e]), t;
}
let Z = function(e) {
let t = gt(e);
return V.useCallback((...n) => t.current(...n), [t]);
};
function xl(e) {
let t = e.width / 2, n = e.height / 2;
return { top: e.clientY - n, right: e.clientX + t, bottom: e.clientY + n, left: e.clientX - t };
}
function wl(e, t) {
return !(!e || !t || e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
}
function El({ disabled: e = !1 } = {}) {
let t = Q(null), [n, r] = le(!1), o = St(), i = Z(() => {
t.current = null, r(!1), o.dispose();
}), a = Z((s) => {
if (o.dispose(), t.current === null) {
t.current = s.currentTarget, r(!0);
{
let l = Yt(s.currentTarget);
o.addEventListener(l, "pointerup", i, !1), o.addEventListener(l, "pointermove", (c) => {
if (t.current) {
let u = xl(c);
r(wl(u, t.current.getBoundingClientRect()));
}
}, !1), o.addEventListener(l, "pointercancel", i, !1);
}
}
});
return { pressed: n, pressProps: e ? {} : { onPointerDown: a, onPointerUp: i, onClick: i } };
}
let Ol = be(void 0);
function qr() {
return ue(Ol);
}
function gr(...e) {
return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
}
function ke(e, t, ...n) {
if (e in t) {
let o = t[e];
return typeof o == "function" ? o(...n) : o;
}
let r = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((o) => `"${o}"`).join(", ")}.`);
throw Error.captureStackTrace && Error.captureStackTrace(r, ke), r;
}
var pn = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(pn || {}), Qe = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(Qe || {});
function Ee() {
let e = Tl();
return ae((t) => Sl({ mergeRefs: e, ...t }), [e]);
}
function Sl({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: o, visible: i = !0, name: a, mergeRefs: s }) {
s = s ?? Al;
let l = na(t, e);
if (i) return Zt(l, n, r, a, s);
let c = o ?? 0;
if (c & 2) {
let { static: u = !1, ...d } = l;
if (u) return Zt(d, n, r, a, s);
}
if (c & 1) {
let { unmount: u = !0, ...d } = l;
return ke(u ? 0 : 1, { 0() {
return null;
}, 1() {
return Zt({ ...d, hidden: !0, style: { display: "none" } }, n, r, a, s);
} });
}
return Zt(l, n, r, a, s);
}
function Zt(e, t = {}, n, r, o) {
let { as: i = n, children: a, refName: s = "ref", ...l } = Dn(e, ["unmount", "static"]), c = e.ref !== void 0 ? { [s]: e.ref } : {}, u = typeof a == "function" ? a(t) : a;
"className" in l && l.className && typeof l.className == "function" && (l.className = l.className(t)), l["aria-labelledby"] && l["aria-labelledby"] === l.id && (l["aria-labelledby"] = void 0);
let d = {};
if (t) {
let p = !1, f = [];
for (let [m, g] of Object.entries(t)) typeof g == "boolean" && (p = !0), g === !0 && f.push(m.replace(/([A-Z])/g, (h) => `-${h.toLowerCase()}`));
if (p) {
d["data-headlessui-state"] = f.join(" ");
for (let m of f) d[`data-${m}`] = "";
}
}
if (i === Re && (Object.keys(Xe(l)).length > 0 || Object.keys(Xe(d)).length > 0)) if (!Vs(u) || Array.isArray(u) && u.length > 1) {
if (Object.keys(Xe(l)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(Xe(l)).concat(Object.keys(Xe(d))).map((p) => ` - ${p}`).join(`
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((p) => ` - ${p}`).join(`
`)].join(`
`));
} else {
let p = u.props, f = p == null ? void 0 : p.className, m = typeof f == "function" ? (...b) => gr(f(...b), l.className) : gr(f, l.className), g = m ? { className: m } : {}, h = na(u.props, Xe(Dn(l, ["ref"])));
for (let b in d) b in h && delete d[b];
return Ys(u, Object.assign({}, h, d, c, { ref: o(Pl(u), c.ref) }, g));
}
return Gs(i, Object.assign({}, Dn(l, ["ref"]), i !== Re && c, i !== Re && d), u);
}
function Tl() {
let e = Q([]), t = ae((n) => {
for (let r of e.current) r != null && (typeof r == "function" ? r(n) : r.current = n);
}, []);
return (...n) => {
if (!n.every((r) => r == null)) return e.current = n, t;
};
}
function Al(...e) {
return e.every((t) => t == null) ? void 0 : (t) => {
for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
};
}
function na(...e) {
if (e.length === 0) return {};
if (e.length === 1) return e[0];
let t = {}, n = {};
for (let r of e) for (let o in r) o.startsWith("on") && typeof r[o] == "function" ? (n[o] != null || (n[o] = []), n[o].push(r[o])) : t[o] = r[o];
if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(o) => {
var i;
return (i = o == null ? void 0 : o.preventDefault) == null ? void 0 : i.call(o);
}]);
for (let r in n) Object.assign(t, { [r](o, ...i) {
let a = n[r];
for (let s of a) {
if ((o instanceof Event || (o == null ? void 0 : o.nativeEvent) instanceof Event) && o.defaultPrevented) return;
s(o, ...i);
}
} });
return t;
}
function ra(...e) {
if (e.length === 0) return {};
if (e.length === 1) return e[0];
let t = {}, n = {};
for (let r of e) for (let o in r) o.startsWith("on") && typeof r[o] == "function" ? (n[o] != null || (n[o] = []), n[o].push(r[o])) : t[o] = r[o];
for (let r in n) Object.assign(t, { [r](...o) {
let i = n[r];
for (let a of i) a == null || a(...o);
} });
return t;
}
function xe(e) {
var t;
return Object.assign(Us(e), { displayName: (t = e.displayName) != null ? t : e.name });
}
function Xe(e) {
let t = Object.assign({}, e);
for (let n in t) t[n] === void 0 && delete t[n];
return t;
}
function Dn(e, t = []) {
let n = Object.assign({}, e);
for (let r of t) r in n && delete n[r];
return n;
}
function Pl(e) {
return V.version.split(".")[0] >= "19" ? e.props.ref : e.ref;
}
function Cl(e, t, n) {
let [r, o] = le(n), i = e !== void 0, a = Q(i), s = Q(!1), l = Q(!1);
return i && !a.current && !s.current ? (s.current = !0, a.current = i, console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")) : !i && a.current && !l.current && (l.current = !0, a.current = i, console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")), [i ? e : r, Z((c) => (i || o(c), t == null ? void 0 : t(c)))];
}
function $l(e) {
let [t] = le(e);
return t;
}
function oa(e = {}, t = null, n = []) {
for (let [r, o] of Object.entries(e)) aa(n, ia(t, r), o);
return n;
}
function ia(e, t) {
return e ? e + "[" + t + "]" : t;
}
function aa(e, t, n) {
if (Array.isArray(n)) for (let [r, o] of n.entries()) aa(e, ia(t, r.toString()), o);
else n instanceof Date ? e.push([t, n.toISOString()]) : typeof n == "boolean" ? e.push([t, n ? "1" : "0"]) : typeof n == "string" ? e.push([t, n]) : typeof n == "number" ? e.push([t, `${n}`]) : n == null ? e.push([t, ""]) : oa(n, t, e);
}
function Rl(e) {
var t, n;
let r = (t = e == null ? void 0 : e.form) != null ? t : e.closest("form");
if (r) {
for (let o of r.elements) if (o !== e && (o.tagName === "INPUT" && o.type === "submit" || o.tagName === "BUTTON" && o.type === "submit" || o.nodeName === "INPUT" && o.type === "image")) {
o.click();
return;
}
(n = r.requestSubmit) == null || n.call(r);
}
}
let kl = "span";
var Kr = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(Kr || {});
function Il(e, t) {
var n;
let { features: r = 1, ...o } = e, i = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = o["aria-hidden"]) != null ? n : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
return Ee()({ ourProps: i, theirProps: o, slot: {}, defaultTag: kl, name: "Hidden" });
}
let sa = xe(Il), Ll = be(null);
function Ml({ children: e }) {
let t = ue(Ll);
if (!t) return V.createElement(V.Fragment, null, e);
let { target: n } = t;
return n ? Wi(V.createElement(V.Fragment, null, e), n) : null;
}
function Fl({ data: e, form: t, disabled: n, onReset: r, overrides: o }) {
let [i, a] = le(null), s = St();
return fe(() => {
if (r && i) return s.addEventListener(i, "reset", r);
}, [i, t, r]), V.createElement(Ml, null, V.createElement(_l, { setForm: a, formId: t }), oa(e).map(([l, c]) => V.createElement(sa, { features: Kr.Hidden, ...Xe({ key: l, as: "input", type: "hidden", hidden: !0, readOnly: !0, form: t, disabled: n, name: l, value: c, ...o }) })));
}
function _l({ setForm: e, formId: t }) {
return fe(() => {
if (t) {
let n = document.getElementById(t);
n && e(n);
}
}, [e, t]), t ? null : V.createElement(sa, { features: Kr.Hidden, as: "input", type: "hidden", hidden: !0, readOnly: !0, ref: (n) => {
if (!n) return;
let r = n.closest("form");
r && e(r);
} });
}
let Nl = be(void 0);
function la() {
return ue(Nl);
}
function Dl(e) {
let t = e.parentElement, n = null;
for (; t && !(t instanceof HTMLFieldSetElement); ) t instanceof HTMLLegendElement && (n = t), t = t.parentElement;
let r = (t == null ? void 0 : t.getAttribute("disabled")) === "";
return r && jl(n) ? !1 : r;
}
function jl(e) {
if (!e) return !1;
let t = e.previousElementSibling;
for (; t !== null; ) {
if (t instanceof HTMLLegendElement) return !1;
t = t.previousElementSibling;
}
return !0;
}
let ca = Symbol();
function zl(e, t = !0) {
return Object.assign(e, { [ca]: t });
}
function Te(...e) {
let t = Q(e);
fe(() => {
t.current = e;
}, [e]);
let n = Z((r) => {
for (let o of t.current) o != null && (typeof o == "function" ? o(r) : o.current = r);
});
return e.every((r) => r == null || (r == null ? void 0 : r[ca])) ? void 0 : n;
}
let Xr = be(null);
Xr.displayName = "DescriptionContext";
function ua() {
let e = ue(Xr);
if (e === null) {
let t = new Error("You used a component, but it is not inside a relevant parent.");
throw Error.captureStackTrace && Error.captureStackTrace(t, ua), t;
}
return e;
}
function Hl() {
var e, t;
return (t = (e = ue(Xr)) == null ? void 0 : e.value) != null ? t : void 0;
}
let Wl = "p";
function Bl(e, t) {
let n = Ot(), r = qr(), { id: o = `headlessui-description-${n}`, ...i } = e, a = ua(), s = Te(t);
se(() => a.register(o), [o, a.register]);
let l = r || !1, c = ce(() => ({ ...a.slot, disabled: l }), [a.slot, l]), u = { ref: s, ...a.props, id: o };
return Ee()({ ourProps: u, theirProps: i, slot: c, defaultTag: Wl, name: a.name || "Description" });
}
let Ul = xe(Bl);
Object.assign(Ul, {});
var de = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(de || {});
let wn = be(null);
wn.displayName = "LabelContext";
function fa() {
let e = ue(wn);
if (e === null) {
let t = new Error("You used a component, but it is not inside a relevant parent.");
throw Error.captureStackTrace && Error.captureStackTrace(t, fa), t;
}
return e;
}
function da(e) {
var t, n, r;
let o = (n = (t = ue(wn)) == null ? void 0 : t.value) != null ? n : void 0;
return ((r = e == null ? void 0 : e.length) != null ? r : 0) > 0 ? [o, ...e].filter(Boolean).join(" ") : o;
}
function Vl({ inherit: e = !1 } = {}) {
let t = da(), [n, r] = le([]), o = e ? [t, ...n].filter(Boolean) : n;
return [o.length > 0 ? o.join(" ") : void 0, ce(() => function(i) {
let a = Z((l) => (r((c) => [...c, l]), () => r((c) => {
let u = c.slice(), d = u.indexOf(l);
return d !== -1 && u.splice(d, 1), u;
}))), s = ce(() => ({ register: a, slot: i.slot, name: i.name, props: i.props, value: i.value }), [a, i.slot, i.name, i.props, i.value]);
return V.createElement(wn.Provider, { value: s }, i.children);
}, [r])];
}
let Yl = "label";
function Gl(e, t) {
var n;
let r = Ot(), o = fa(), i = la(), a = qr(), { id: s = `headlessui-label-${r}`, htmlFor: l = i ?? ((n = o.props) == null ? void 0 : n.htmlFor), passive: c = !1, ...u } = e, d = Te(t);
se(() => o.register(s), [s, o.register]);
let p = Z((h) => {
let b = h.currentTarget;
if (b instanceof HTMLLabelElement && h.preventDefault(), o.props && "onClick" in o.props && typeof o.props.onClick == "function" && o.props.onClick(h), b instanceof HTMLLabelElement) {
let x = document.getElementById(b.htmlFor);
if (x) {
let y = x.getAttribute("disabled");
if (y === "true" || y === "") return;
let E = x.getAttribute("aria-disabled");
if (E === "true" || E === "") return;
(x instanceof HTMLInputElement && (x.type === "radio" || x.type === "checkbox") || x.role === "radio" || x.role === "checkbox" || x.role === "switch") && x.click(), x.focus({ preventScroll: !0 });
}
}
}), f = a || !1, m = ce(() => ({ ...o.slot, disabled: f }), [o.slot, f]), g = { ref: d, ...o.props, id: s, htmlFor: l, onClick: p };
return c && ("onClick" in g && (delete g.htmlFor, delete g.onClick), "onClick" in u && delete u.onClick), Ee()({ ourProps: g, theirProps: u, slot: m, defaultTag: l ? Yl : "div", name: o.name || "Label" });
}
let ql = xe(Gl), Kl = Object.assign(ql, {});
function Xl(e, t) {
return e !== null && t !== null && typeof e == "object" && typeof t == "object" && "id" in e && "id" in t ? e.id === t.id : e === t;
}
function Ql(e = Xl) {
return ae((t, n) => {
if (typeof e == "string") {
let r = e;
return (t == null ? void 0 : t[r]) === (n == null ? void 0 : n[r]);
}
return e(t, n);
}, [e]);
}
function Jl(e) {
if (e === null) return { width: 0, height: 0 };
let { width: t, height: n } = e.getBoundingClientRect();
return { width: t, height: n };
}
function Zl(e, t = !1) {
let [n, r] = qs(() => ({}), {}), o = ce(() => Jl(e), [e, n]);
return se(() => {
if (!e) return;
let i = new ResizeObserver(r);
return i.observe(e), () => {
i.disconnect();
};
}, [e]), t ? { width: `${o.width}px`, height: `${o.height}px` } : o;
}
let pa = class extends Map {
constructor(t) {
super(), this.factory = t;
}
get(t) {
let n = super.get(t);
return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
}
};
function ma(e, t) {
let n = e(), r = /* @__PURE__ */ new Set();
return { getSnapshot() {
return n;
}, subscribe(o) {
return r.add(o), () => r.delete(o);
}, dispatch(o, ...i) {
let a = t[o].call(n, ...i);
a && (n = a, r.forEach((s) => s()));
} };
}
function ga(e) {
return Ks(e.subscribe, e.getSnapshot, e.getSnapshot);
}
let ec = new pa(() => ma(() => [], { ADD(e) {
return this.includes(e) ? this : [...this, e];
}, REMOVE(e) {
let t = this.indexOf(e);
if (t === -1) return this;
let n = this.slice();
return n.splice(t, 1), n;
} }));
function Qr(e, t) {
let n = ec.get(t), r = Ot(), o = ga(n);
if (se(() => {
if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
}, [n, e]), !e) return !1;
let i = o.indexOf(r), a = o.length;
return i === -1 && (i = a, a += 1), i === a - 1;
}
let hr = /* @__PURE__ */ new Map(), Nt = /* @__PURE__ */ new Map();
function Ao(e) {
var t;
let n = (t = Nt.get(e)) != null ? t : 0;
return Nt.set(e, n + 1), n !== 0 ? () => Po(e) : (hr.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Po(e));
}
function Po(e) {
var t;
let n = (t = Nt.get(e)) != null ? t : 1;
if (n === 1 ? Nt.delete(e) : Nt.set(e, n - 1), n !== 1) return;
let r = hr.get(e);
r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, hr.delete(e));
}
function tc(e, { allowed: t, disallowed: n } = {}) {
let r = Qr(e, "inert-others");
se(() => {
var o, i;
if (!r) return;
let a = ze();
for (let l of (o = n == null ? void 0 : n()) != null ? o : []) l && a.add(Ao(l));
let s = (i = t == null ? void 0 : t()) != null ? i : [];
for (let l of s) {
if (!l) continue;
let c = Yt(l);
if (!c) continue;
let u = l.parentElement;
for (; u && u !== c.body; ) {
for (let d of u.children) s.some((p) => d.contains(p)) || a.add(Ao(d));
u = u.parentElement;
}
}
return a.dispose;
}, [r, t, n]);
}
function nc(e, t, n) {
let r = gt((o) => {
let i = o.getBoundingClientRect();
i.x === 0 && i.y === 0 && i.width === 0 && i.height === 0 && n();
});
fe(() => {
if (!e) return;
let o = t === null ? null : t instanceof HTMLElement ? t : t.current;
if (!o) return;
let i = ze();
if (typeof ResizeObserver < "u") {
let a = new ResizeObserver(() => r.current(o));
a.observe(o), i.add(() => a.disconnect());
}
if (typeof IntersectionObserver < "u") {
let a = new IntersectionObserver(() => r.current(o));
a.observe(o), i.add(() => a.disconnect());
}
return () => i.dispose();
}, [t, r, e]);
}
let vr = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(","), rc = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
var br = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e[e.AutoFocus = 64] = "AutoFocus", e))(br || {}), oc = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(oc || {}), ic = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(ic || {});
function ha(e = document.body) {
return e == null ? [] : Array.from(e.querySelectorAll(vr)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
}
function ac(e = document.body) {
return e == null ? [] : Array.from(e.querySelectorAll(rc)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
}
var Jr = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Jr || {});
function va(e, t = 0) {
var n;
return e === ((n = Yt(e)) == null ? void 0 : n.body) ? !1 : ke(t, { 0() {
return e.matches(vr);
}, 1() {
let r = e;
for (; r !== null; ) {
if (r.matches(vr)) return !0;
r = r.parentElement;
}
return !1;
} });
}
var sc = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(sc || {});
typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
}, !0), document.addEventListener("click", (e) => {
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
}, !0));
let lc = ["textarea", "input"].join(",");
function cc(e) {
var t, n;
return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, lc)) != null ? n : !1;
}
function ba(e, t = (n) => n) {
return e.slice().sort((n, r) => {
let o = t(n), i = t(r);
if (o === null || i === null) return 0;
let a = o.compareDocumentPosition(i);
return a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
});
}
function uc(e, t) {
return fc(ha(), t, { relativeTo: e });
}
function fc(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: o = [] } = {}) {
let i = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, a = Array.isArray(e) ? n ? ba(e) : e : t & 64 ? ac(e) : ha(e);
o.length > 0 && a.length > 1 && (a = a.filter((f) => !o.some((m) => m != null && "current" in m ? (m == null ? void 0 : m.current) === f : m === f))), r = r ?? i.activeElement;
let s = (() => {
if (t & 5) return 1;
if (t & 10) return -1;
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
})(), l = (() => {
if (t & 1) return 0;
if (t & 2) return Math.max(0, a.indexOf(r)) - 1;
if (t & 4) return Math.max(0, a.indexOf(r)) + 1;
if (t & 8) return a.length - 1;
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
})(), c = t & 32 ? { preventScroll: !0 } : {}, u = 0, d = a.length, p;
do {
if (u >= d || u + d <= 0) return 0;
let f = l + u;
if (t & 16) f = (f + d) % d;
else {
if (f < 0) return 3;
if (f >= d) return 1;
}
p = a[f], p == null || p.focus(c), u += s;
} while (p !== i.activeElement);
return t & 6 && cc(p) && p.select(), 2;
}
function ya() {
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
}
function dc() {
return /Android/gi.test(window.navigator.userAgent);
}
function pc() {
return ya() || dc();
}
function Rt(e, t, n, r) {
let o = gt(n);
fe(() => {
if (!e) return;
function i(a) {
o.current(a);
}
return document.addEventListener(t, i, r), () => document.removeEventListener(t, i, r);
}, [e, t, r]);
}
function mc(e, t, n, r) {
let o = gt(n);
fe(() => {
if (!e) return;
function i(a) {
o.current(a);
}
return window.addEventListener(t, i, r), () => window.removeEventListener(t, i, r);
}, [e, t, r]);
}
const Co = 30;
function gc(e, t, n) {
let r = Qr(e, "outside-click"), o = gt(n), i = ae(function(l, c) {
if (l.defaultPrevented) return;
let u = c(l);
if (u === null || !u.getRootNode().contains(u) || !u.isConnected) return;
let d = function p(f) {
return typeof f == "function" ? p(f()) : Array.isArray(f) || f instanceof Set ? f : [f];
}(t);
for (let p of d) if (p !== null && (p.contains(u) || l.composed && l.composedPath().includes(p))) return;
return !va(u, Jr.Loose) && u.tabIndex !== -1 && l.preventDefault(), o.current(l, u);
}, [o, t]), a = Q(null);
Rt(r, "pointerdown", (l) => {
var c, u;
a.current = ((u = (c = l.composedPath) == null ? void 0 : c.call(l)) == null ? void 0 : u[0]) || l.target;
}, !0), Rt(r, "mousedown", (l) => {
var c, u;
a.current = ((u = (c = l.composedPath) == null ? void 0 : c.call(l)) == null ? void 0 : u[0]) || l.target;
}, !0), Rt(r, "click", (l) => {
pc() || a.current && (i(l, () => a.current), a.current = null);
}, !0);
let s = Q({ x: 0, y: 0 });
Rt(r, "touchstart", (l) => {
s.current.x = l.touches[0].clientX, s.current.y = l.touches[0].clientY;
}, !0), Rt(r, "touchend", (l) => {
let c = { x: l.changedTouches[0].clientX, y: l.changedTouches[0].clientY };
if (!(Math.abs(c.x - s.current.x) >= Co || Math.abs(c.y - s.current.y) >= Co)) return i(l, () => l.target instanceof HTMLElement ? l.target : null);
}, !0), mc(r, "blur", (l) => i(l, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
}
function yr(...e) {
return ce(() => Yt(...e), [...e]);
}
function hc(e, t) {
return ce(() => {
var n;
if (e.type) return e.type;
let r = (n = e.as) != null ? n : "button";
if (typeof r == "string" && r.toLowerCase() === "button" || (t == null ? void 0 : t.tagName) === "BUTTON" && !t.hasAttribute("type")) return "button";
}, [e.type, e.as, t]);
}
function vc() {
let e;
return { before({ doc: t }) {
var n;
let r = t.documentElement, o = (n = t.defaultView) != null ? n : window;
e = Math.max(0, o.innerWidth - r.clientWidth);
}, after({ doc: t, d: n }) {
let r = t.documentElement, o = Math.max(0, r.clientWidth - r.offsetWidth), i = Math.max(0, e - o);
n.style(r, "paddingRight", `${i}px`);
} };
}
function bc() {
return ya() ? { before({ doc: e, d: t, meta: n }) {
function r(o) {
return n.containers.flatMap((i) => i()).some((i) => i.contains(o));
}
t.microTask(() => {
var o;
if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
let s = ze();
s.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => s.dispose()));
}
let i = (o = window.scrollY) != null ? o : window.pageYOffset, a = null;
t.addEventListener(e, "click", (s) => {
if (s.target instanceof HTMLElement) try {
let l = s.target.closest("a");
if (!l) return;
let { hash: c } = new URL(l.href), u = e.querySelector(c);
u && !r(u) && (a = u);
} catch {
}
}, !0), t.addEventListener(e, "touchstart", (s) => {
if (s.target instanceof HTMLElement) if (r(s.target)) {
let l = s.target;
for (; l.parentElement && r(l.parentElement); ) l = l.parentElement;
t.style(l, "overscrollBehavior", "contain");
} else t.style(s.target, "touchAction", "none");
}), t.addEventListener(e, "touchmove", (s) => {
if (s.target instanceof HTMLElement) {
if (s.target.tagName === "INPUT") return;
if (r(s.target)) {
let l = s.target;
for (; l.parentElement && l.dataset.headlessuiPortal !== "" && !(l.scrollHeight > l.clientHeight || l.scrollWidth > l.clientWidth); ) l = l.parentElement;
l.dataset.headlessuiPortal === "" && s.preventDefault();
} else s.preventDefault();
}
}, { passive: !1 }), t.add(() => {
var s;
let l = (s = window.scrollY) != null ? s : window.pageYOffset;
i !== l && window.scrollTo(0, i), a && a.isConnected && (a.scrollIntoView({ block: "nearest" }), a = null);
});
});
} } : {};
}
function yc() {
return { before({ doc: e, d: t }) {
t.style(e.documentElement, "overflow", "hidden");
} };
}
function xc(e) {
let t = {};
for (let n of e) Object.assign(t, n(t));
return t;
}
let it = ma(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
var n;
let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: ze(), meta: /* @__PURE__ */ new Set() };
return r.count++, r.meta.add(t), this.set(e, r), this;
}, POP(e, t) {
let n = this.get(e);
return n && (n.count--, n.meta.delete(t)), this;
}, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
let r = { doc: e, d: t, meta: xc(n) }, o = [bc(), vc(), yc()];
o.forEach(({ before: i }) => i == null ? void 0 : i(r)), o.forEach(({ after: i }) => i == null ? void 0 : i(r));
}, SCROLL_ALLOW({ d: e }) {
e.dispose();
}, TEARDOWN({ doc: e }) {
this.delete(e);
} });
it.subscribe(() => {
let e = it.getSnapshot(), t = /* @__PURE__ */ new Map();
for (let [n] of e) t.set(n, n.documentElement.style.overflow);
for (let n of e.values()) {
let r = t.get(n.doc) === "hidden", o = n.count !== 0;
(o && !r || !o && r) && it.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && it.dispatch("TEARDOWN", n);
}
});
function wc(e, t, n = () => ({ containers: [] })) {
let r = ga(it), o = t ? r.get(t) : void 0, i = o ? o.count > 0 : !1;
return se(() => {
if (!(!t || !e)) return it.dispatch("PUSH", t, n), () => it.dispatch("POP", t, n);
}, [e, t]), i;
}
function Ec(e, t, n = () => [document.body]) {
let r = Qr(e, "scroll-lock");
wc(r, t, (o) => {
var i;
return { containers: [...(i = o.containers) != null ? i : [], n] };
});
}
function $o(e) {
return [e.screenX, e.screenY];
}
function Oc() {
let e = Q([-1, -1]);
return { wasMoved(t) {
let n = $o(t);
return e.current[0] === n[0] && e.current[1] === n[1] ? !1 : (e.current = n, !0);
}, update(t) {
e.current = $o(t);
} };
}
function Sc(e = 0) {
let [t, n] = le(e), r = ae((l) => n(l), [t]), o = ae((l) => n((c) => c | l), [t]), i = ae((l) => (t & l) === l, [t]), a = ae((l) => n((c) => c & ~l), [n]), s = ae((l) => n((c) => c ^ l), [n]);
return { flags: t, setFlag: r, addFlag: o, hasFlag: i, removeFlag: a, toggleFlag: s };
}
var Ro, ko;
typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Ro = process == null ? void 0 : process.env) == null ? void 0 : Ro.NODE_ENV) === "test" && typeof ((ko = Element == null ? void 0 : Element.prototype) == null ? void 0 : ko.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(`
`)), [];
});
var Tc = ((e) => (e[e.None = 0] = "None", e[e.Closed = 1] = "Closed", e[e.Enter = 2] = "Enter", e[e.Leave = 4] = "Leave", e))(Tc || {});
function xa(e) {
let t = {};
for (let n in e) e[n] === !0 && (t[`data-${n}`] = "");
return t;
}
function wa(e, t, n, r) {
let [o, i] = le(n), { hasFlag: a, addFlag: s, removeFlag: l } = Sc(e && o ? 3 : 0), c = Q(!1), u = Q(!1), d = St();
return se(() => {
var p;
if (e) {
if (n && i(!0), !t) {
n && s(3);
return;
}
return (p = r == null ? void 0 : r.start) == null || p.call(r, n), Ac(t, { inFlight: c, prepare() {
u.current ? u.current = !1 : u.current = c.current, c.current = !0, !u.current && (n ? (s(3), l(4)) : (s(4), l(2)));
}, run() {
u.current ? n ? (l(3), s(4)) : (l(4), s(3)) : n ? l(1) : s(1);
}, done() {
var f;
u.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (c.current = !1, l(7), n || i(!1), (f = r == null ? void 0 : r.end) == null || f.call(r, n));
} });
}
}, [e, n, t, d]), e ? [o, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
}
function Ac(e, { prepare: t, run: n, done: r, inFlight: o }) {
let i = ze();
return Cc(e, { prepare: t, inFlight: o }), i.nextFrame(() => {
n(), i.requestAnimationFrame(() => {
i.add(Pc(e, r));
});
}), i.dispose;
}
function Pc(e, t) {
var n, r;
let o = ze();
if (!e) return o.dispose;
let i = !1;
o.add(() => {
i = !0;
});
let a = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((s) => s instanceof CSSTransition)) != null ? r : [];
return a.length === 0 ? (t(), o.dispose) : (Promise.allSettled(a.map((s) => s.finished)).then(() => {
i || t();
}), o.dispose);
}
function Cc(e, { inFlight: t, prepare: n }) {
if (t != null && t.current) {
n();
return;
}
let r = e.style.transition;
e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
}
function En() {
return typeof window < "u";
}
function Tt(e) {
return Ea(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function we(e) {
var t;
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function He(e) {
var t;
return (t = (Ea(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function Ea(e) {
return En() ? e instanceof Node || e instanceof we(e).Node : !1;
}
function he(e) {
return En() ? e instanceof Element || e instanceof we(e).Element : !1;
}
function je(e) {
return En() ? e instanceof HTMLElement || e instanceof we(e).HTMLElement : !1;
}
function Io(e) {
return !En() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof we(e).ShadowRoot;
}
function Gt(e) {
const {
overflow: t,
overflowX: n,
overflowY: r,
display: o
} = Ie(e);
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
}
function $c(e) {
return ["table", "td", "th"].includes(Tt(e));
}
function On(e) {
return [":popover-open", ":modal"].some((t) => {
try {
return e.matches(t);
} catch {
return !1;
}
});
}
function Zr(e) {
const t = eo(), n = he(e) ? Ie(e) : e;
return ["transform", "translate", "scale", "rotate", "perspective"].some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
}
function Rc(e) {
let t = Je(e);
for (; je(t) && !wt(t); ) {
if (Zr(t))
return t;
if (On(t))
return null;
t = Je(t);
}
return null;
}
function eo() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function wt(e) {
return ["html", "body", "#document"].includes(Tt(e));
}
function Ie(e) {
return we(e).getComputedStyle(e);
}
function Sn(e) {
return he(e) ? {
scrollLeft: e.scrollLeft,
scrollTop: e.scrollTop
} : {
scrollLeft: e.scrollX,
scrollTop: e.scrollY
};
}
function Je(e) {
if (Tt(e) === "html")
return e;
const t = (
// Step into the shadow DOM of the parent of a slotted node.
e.assignedSlot || // DOM Element detected.
e.parentNode || // ShadowRoot detected.
Io(e) && e.host || // Fallback.
He(e)
);
return Io(t) ? t.host : t;
}
function Oa(e) {
const t = Je(e);
return wt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : je(t) && Gt(t) ? t : Oa(t);
}
function zt(e, t, n) {
var r;
t === void 0 && (t = []), n === void 0 && (n = !0);
const o = Oa(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), a = we(o);
if (i) {
const s = xr(a);
return t.concat(a, a.visualViewport || [], Gt(o) ? o : [], s && n ? zt(s) : []);
}
return t.concat(o, zt(o, [], n));
}
function xr(e) {
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
function kc() {
const e = navigator.userAgentData;
return e && Array.isArray(e.brands) ? e.brands.map((t) => {
let {
brand: n,
version: r
} = t;
return n + "/" + r;
}).join(" ") : navigator.userAgent;
}
const ut = Math.min, ge = Math.max, Ht = Math.round, en = Math.floor, De = (e) => ({
x: e,
y: e
}), Ic = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, Lc = {
start: "end",
end: "start"
};
function Lo(e, t, n) {
return ge(e, ut(t, n));
}
function At(e, t) {
return typeof e == "function" ? e(t) : e;
}
function Ze(e) {
return e.split("-")[0];
}
function qt(e) {
return e.split("-")[1];
}
function Sa(e) {
return e === "x" ? "y" : "x";
}
function Ta(e) {
return e === "y" ? "height" : "width";
}
function ft(e) {
return ["top", "bottom"].includes(Ze(e)) ? "y" : "x";
}
function Aa(e) {
return Sa(ft(e));
}
function Mc(e, t, n) {
n === void 0 && (n = !1);
const r = qt(e), o = Aa(e), i = Ta(o);
let a = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
return t.reference[i] > t.floating[i] && (a = mn(a)), [a, mn(a)];
}
function Fc(e) {
const t = mn(e);
return [wr(e), t, wr(t)];
}
function wr(e) {
return e.replace(/start|end/g, (t) => Lc[t]);
}
function _c(e, t, n) {
const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], a = ["bottom", "top"];
switch (e) {
case "top":
case "bottom":
return n ? t ? o : r : t ? r : o;
case "left":
case "right":
return t ? i : a;
default:
return [];
}
}
function Nc(e, t, n, r) {
const o = qt(e);
let i = _c(Ze(e), n === "start", r);
return o && (i = i.map((a) => a + "-" + o), t && (i = i.concat(i.map(wr)))), i;
}
function mn(e) {
return e.replace(/left|right|bottom|top/g, (t) => Ic[t]);
}
function Dc(e) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...e
};
}
function jc(e) {
return typeof e != "number" ? Dc(e) : {
top: e,
right: e,
bottom: e,
left: e
};
}
function gn(e) {
const {
x: t,
y: n,
width: r,
height: o
} = e;
return {
width: r,
height: o,
top: n,
left: t,
right: t + r,
bottom: n + o,
x: t,
y: n
};
}
function Mo(e, t, n) {
let {
reference: r,
floating: o
} = e;
const i = ft(t), a = Aa(t), s = Ta(a), l = Ze(t), c = i === "y", u = r.x + r.width / 2 - o.width / 2, d = r.y + r.height / 2 - o.height / 2, p = r[s] / 2 - o[s] / 2;
let f;
switch (l) {
case "top":
f = {
x: u,
y: r.y - o.height
};
break;
case "bottom":
f = {
x: u,
y: r.y + r.height
};
break;
case "right":
f = {
x: r.x + r.width,
y: d
};
break;
case "left":
f = {
x: r.x - o.width,
y: d
};
break;
default:
f = {
x: r.x,
y: r.y
};
}
switch (qt(t)) {
case "start":
f[a] -= p * (n && c ? -1 : 1);
break;
case "end":
f[a] += p * (n && c ? -1 : 1);
break;
}
return f;
}
const zc = async (e, t, n) => {
const {
placement: r = "bottom",
strategy: o = "absolute",
middleware: i = [],
platform: a
} = n, s = i.filter(Boolean), l = await (a.isRTL == null ? void 0 : a.isRTL(t));
let c = await a.getElementRects({
reference: e,
floating: t,
strategy: o
}), {
x: u,
y: d
} = Mo(c, r, l), p = r, f = {}, m = 0;
for (let g = 0; g < s.length; g++) {
const {
name: h,
fn: b
} = s[g], {
x,
y,
data: E,
reset: v
} = await b({
x: u,
y: d,
initialPlacement: r,
placement: p,
strategy: o,
middlewareData: f,
rects: c,
platform: a,
elements: {
reference: e,
floating: t
}
});
u = x ?? u, d = y ?? d, f = {
...f,
[h]: {
...f[h],
...E
}
}, v && m <= 50 && (m++, typeof v == "object" && (v.placement && (p = v.placement), v.rects && (c = v.rects === !0 ? await a.getElementRects({
reference: e,
floating: t,
strategy: o
}) : v.rects), {
x: u,
y: d
} = Mo(c, p, l)), g = -1);
}
return {
x: u,
y: d,
placement: p,
strategy: o,
middlewareData: f
};
};
async function Tn(e, t) {
var n;
t === void 0 && (t = {});
const {
x: r,
y: o,
platform: i,
rects: a,
elements: s,
strategy: l
} = e, {
boundary: c = "clippingAncestors",
rootBoundary: u = "viewport",
elementContext: d = "floating",
altBoundary: p = !1,
padding: f = 0
} = At(t, e), m = jc(f), h = s[p ? d === "floating" ? "reference" : "floating" : d], b = gn(await i.getClippingRect({
element: (n = await (i.isElement == null ? void 0 : i.isElement(h))) == null || n ? h : h.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(s.floating)),
boundary: c,
rootBoundary: u,
strategy: l
})), x = d === "floating" ? {
x: r,
y: o,
width: a.floating.width,
height: a.floating.height
} : a.reference, y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(s.floating)), E = await (i.isElement == null ? void 0 : i.isElement(y)) ? await (i.getScale == null ? void 0 : i.getScale(y)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, v = gn(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: s,
rect: x,
offsetParent: y,
strategy: l
}) : x);
return {
top: (b.top - v.top + m.top) / E.y,
bottom: (v.bottom - b.bottom + m.bottom) / E.y,
left: (b.left - v.left + m.left) / E.x,
right: (v.right - b.right + m.right) / E.x
};
}
const Hc = function(e) {
return e === void 0 && (e = {}), {
name: "flip",
options: e,
async fn(t) {
var n, r;
const {
placement: o,
middlewareData: i,
rects: a,
initialPlacement: s,
platform: l,
elements: c
} = t, {
mainAxis: u = !0,
crossAxis: d = !0,
fallbackPlacements: p,
fallbackStrategy: f = "bestFit",
fallbackAxisSideDirection: m = "none",
flipAlignment: g = !0,
...h
} = At(e, t);
if ((n = i.arrow) != null && n.alignmentOffset)
return {};
const b = Ze(o), x = ft(s), y = Ze(s) === s, E = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), v = p || (y || !g ? [mn(s)] : Fc(s)), C = m !== "none";
!p && C && v.push(...Nc(s, g, m, E));
const $ = [s, ...v], G = await Tn(t, h), J = [];
let P = ((r = i.flip) == null ? void 0 : r.overflows) || [];
if (u && J.push(G[b]), d) {
const R = Mc(o, a, E);
J.push(G[R[0]], G[R[1]]);
}
if (P = [...P, {
placement: o,
overflows: J
}], !J.every((R) => R <= 0)) {
var _, L;
const R = (((_ = i.flip) == null ? void 0 : _.index) || 0) + 1, re = $[R];
if (re)
return {
data: {
index: R,
overflows: P
},
reset: {
placement: re
}
};
let Y = (L = P.filter((ee) => ee.overflows[0] <= 0).sort((ee, N) => ee.overflows[1] - N.overflows[1])[0]) == null ? void 0 : L.placement;
if (!Y)
switch (f) {
case "bestFit": {
var K;
const ee = (K = P.filter((N) => {
if (C) {
const B = ft(N.placement);
return B === x || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
B === "y";
}
return !0;
}).map((N) => [N.placement, N.overflows.filter((B) => B > 0).reduce((B, w) => B + w, 0)]).sort((N, B) => N[1] - B[1])[0]) == null ? void 0 : K[0];
ee && (Y = ee);
break;
}
case "initialPlacement":
Y = s;
break;
}
if (o !== Y)
return {
reset: {
placement: Y
}
};
}
return {};
}
};
};
async function Wc(e, t) {
const {
placement: n,
platform: r,
elements: o
} = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), a = Ze(n), s = qt(n), l = ft(n) === "y", c = ["left", "top"].includes(a) ? -1 : 1, u = i && l ? -1 : 1, d = At(t, e);
let {
mainAxis: p,
crossAxis: f,
alignmentAxis: m
} = typeof d == "number" ? {
mainAxis: d,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: d.mainAxis || 0,
crossAxis: d.crossAxis || 0,
alignmentAxis: d.alignmentAxis
};
return s && typeof m == "number" && (f = s === "end" ? m * -1 : m), l ? {
x: f * u,
y: p * c
} : {
x: p * c,
y: f * u
};
}
const Bc = function(e) {
return e === void 0 && (e = 0), {
name: "offset",
options: e,
async fn(t) {
var n, r;
const {
x: o,
y: i,
placement: a,
middlewareData: s
} = t, l = await Wc(t, e);
return a === ((n = s.offset) == null ? void 0 : n.placement) && (r = s.arrow) != null && r.alignmentOffset ? {} : {
x: o + l.x,
y: i + l.y,
data: {
...l,
placement: a
}
};
}
};
}, Uc = function(e) {
return e === void 0 && (e = {}), {
name: "shift",
options: e,
async fn(t) {
const {
x: n,
y: r,
placement: o
} = t, {
mainAxis: i = !0,
crossAxis: a = !1,
limiter: s = {
fn: (h) => {
let {
x: b,
y: x
} = h;
return {
x: b,
y: x
};
}
},
...l
} = At(e, t), c = {
x: n,
y: r
}, u = await Tn(t, l), d = ft(Ze(o)), p = Sa(d);
let f = c[p], m = c[d];
if (i) {
const h = p === "y" ? "top" : "left", b = p === "y" ? "bottom" : "right", x = f + u[h], y = f - u[b];
f = Lo(x, f, y);
}
if (a) {
const h = d === "y" ? "top" : "left", b = d === "y" ? "bottom" : "right", x = m + u[h], y = m - u[b];
m = Lo(x, m, y);
}
const g = s.fn({
...t,
[p]: f,
[d]: m
});
return {
...g,
data: {
x: g.x - n,
y: g.y - r,
enabled: {
[p]: i,
[d]: a
}
}
};
}
};
}, Vc = function(e) {
return e === void 0 && (e = {}), {
name: "size",
options: e,
async fn(t) {
var n, r;
const {
placement: o,
rects: i,
platform: a,
elements: s
} = t, {
apply: l = () => {
},
...c
} = At(e, t), u = await Tn(t, c), d = Ze(o), p = qt(o), f = ft(o) === "y", {
width: m,
height: g
} = i.floating;
let h, b;
d === "top" || d === "bottom" ? (h = d, b = p === (await (a.isRTL == null ? void 0 : a.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (b = d, h = p === "end" ? "top" : "bottom");
const x = g - u.top - u.bottom, y = m - u.left - u.right, E = ut(g - u[h], x), v = ut(m - u[b], y), C = !t.middlewareData.shift;
let $ = E, G = v;
if ((n = t.middlewareData.shift) != null && n.enabled.x && (G = y), (r = t.middlewareData.shift) != null && r.enabled.y && ($ = x), C && !p) {
const P = ge(u.left, 0), _ = ge(u.right, 0), L = ge(u.top, 0), K = ge(u.bottom, 0);
f ? G = m - 2 * (P !== 0 || _ !== 0 ? P + _ : ge(u.left, u.right)) : $ = g - 2 * (L !== 0 || K !== 0 ? L + K : ge(u.top, u.bottom));
}
await l({
...t,
availableWidth: G,
availableHeight: $
});
const J = await a.getDimensions(s.floating);
return m !== J.width || g !== J.height ? {
reset: {
rects: !0
}
} : {};
}
};
};
function Pa(e) {
const t = Ie(e);
let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
const o = je(e), i = o ? e.offsetWidth : n, a = o ? e.offsetHeight : r, s = Ht(n) !== i || Ht(r) !== a;
return s && (n = i, r = a), {
width: n,
height: r,
$: s
};
}
function to(e) {
return he(e) ? e : e.contextElement;
}
function bt(e) {
const t = to(e);
if (!je(t))
return De(1);
const n = t.getBoundingClientRect(), {
width: r,
height: o,
$: i
} = Pa(t);
let a = (i ? Ht(n.width) : n.width) / r, s = (i ? Ht(n.height) : n.height) / o;
return (!a || !Number.isFinite(a)) && (a = 1), (!s || !Number.isFinite(s)) && (s = 1), {
x: a,
y: s
};
}
const Yc = /* @__PURE__ */ De(0);
function Ca(e) {
const t = we(e);
return !eo() || !t.visualViewport ? Yc : {
x: t.visualViewport.offsetLeft,
y: t.visualViewport.offsetTop
};
}
function Gc(e, t, n) {
return t === void 0 && (t = !1), !n || t && n !== we(e) ? !1 : t;
}
function dt(e, t, n, r) {
t === void 0 && (t = !1), n === void 0 && (n = !1);
const o = e.getBoundingClientRect(), i = to(e);
let a = De(1);
t && (r ? he(r) && (a = bt(r)) : a = bt(e));
const s = Gc(i, n, r) ? Ca(i) : De(0);
let l = (o.left + s.x) / a.x, c = (o.top + s.y) / a.y, u = o.width / a.x, d = o.height / a.y;
if (i) {
const p = we(i), f = r && he(r) ? we(r) : r;
let m = p, g = xr(m);
for (; g && r && f !== m; ) {
const h = bt(g), b = g.getBoundingClientRect(), x = Ie(g), y = b.left + (g.clientLeft + parseFloat(x.paddingLeft)) * h.x, E = b.top + (g.clientTop + parseFloat(x.paddingTop)) * h.y;
l *= h.x, c *= h.y, u *= h.x, d *= h.y, l += y, c += E, m = we(g), g = xr(m);
}
}
return gn({
width: u,
height: d,
x: l,
y: c
});
}
function no(e, t) {
const n = Sn(e).scrollLeft;
return t ? t.left + n : dt(He(e)).left + n;
}
function $a(e, t, n) {
n === void 0 && (n = !1);
const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
// RTL
scrollbar.
no(e, r)
)), i = r.top + t.scrollTop;
return {
x: o,
y: i
};
}
function qc(e) {
let {
elements: t,
rect: n,
offsetParent: r,
strategy: o
} = e;
const i = o === "fixed", a = He(r), s = t ? On(t.floating) : !1;
if (r === a || s && i)
return n;
let l = {
scrollLeft: 0,
scrollTop: 0
}, c = De(1);
const u = De(0), d = je(r);
if ((d || !d && !i) && ((Tt(r) !== "body" || Gt(a)) && (l = Sn(r)), je(r))) {
const f = dt(r);
c = bt(r), u.x = f.x + r.clientLeft, u.y = f.y + r.clientTop;
}
const p = a && !d && !i ? $a(a, l, !0) : De(0);
return {
width: n.width * c.x,
height: n.height * c.y,
x: n.x * c.x - l.scrollLeft * c.x + u.x + p.x,
y: n.y * c.y - l.scrollTop * c.y + u.y + p.y
};
}
function Kc(e) {
return Array.from(e.getClientRects());
}
function Xc(e) {
const t = He(e), n = Sn(e), r = e.ownerDocument.body, o = ge(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = ge(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
let a = -n.scrollLeft + no(e);
const s = -n.scrollTop;
return Ie(r).direction === "rtl" && (a += ge(t.clientWidth, r.clientWidth) - o), {
width: o,
height: i,
x: a,
y: s
};
}
function Qc(e, t) {
const n = we(e), r = He(e), o = n.visualViewport;
let i = r.clientWidth, a = r.clientHeight, s = 0, l = 0;
if (o) {
i = o.width, a = o.height;
const c = eo();
(!c || c && t === "fixed") && (s = o.offsetLeft, l = o.offsetTop);
}
return {
width: i,
height: a,
x: s,
y: l
};
}
function Jc(e, t) {
const n = dt(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = je(e) ? bt(e) : De(1), a = e.clientWidth * i.x, s = e.clientHeight * i.y, l = o * i.x, c = r * i.y;
return {
width: a,
height: s,
x: l,
y: c
};
}
function Fo(e, t, n) {
let r;
if (t === "viewport")
r = Qc(e, n);
else if (t === "document")
r = Xc(He(e));
else if (he(t))
r = Jc(t, n);
else {
const o = Ca(e);
r = {
x: t.x - o.x,
y: t.y - o.y,
width: t.width,
height: t.height
};
}
return gn(r);
}
function Ra(e, t) {
const n = Je(e);
return n === t || !he(n) || wt(n) ? !1 : Ie(n).position === "fixed" || Ra(n, t);
}
function Zc(e, t) {
const n = t.get(e);
if (n)
return n;
let r = zt(e, [], !1).filter((s) => he(s) && Tt(s) !== "body"), o = null;
const i = Ie(e).position === "fixed";
let a = i ? Je(e) : e;
for (; he(a) && !wt(a); ) {
const s = Ie(a), l = Zr(a);
!l && s.position === "fixed" && (o = null), (i ? !l && !o : !l && s.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || Gt(a) && !l && Ra(e, a)) ? r = r.filter((u) => u !== a) : o = s, a = Je(a);
}
return t.set(e, r), r;
}
function eu(e) {
let {
element: t,
boundary: n,
rootBoundary: r,
strategy: o
} = e;
const a = [...n === "clippingAncestors" ? On(t) ? [] : Zc(t, this._c) : [].concat(n), r], s = a[0], l = a.reduce((c, u) => {
const d = Fo(t, u, o);
return c.top = ge(d.top, c.top), c.right = ut(d.right, c.right), c.bottom = ut(d.bottom, c.bottom), c.left = ge(d.left, c.left), c;
}, Fo(t, s, o));
return {
width: l.right - l.left,
height: l.bottom - l.top,
x: l.left,
y: l.top
};
}
function tu(e) {
const {
width: t,
height: n
} = Pa(e);
return {
width: t,
height: n
};
}
function nu(e, t, n) {
const r = je(t), o = He(t), i = n === "fixed", a = dt(e, !0, i, t);
let s = {
scrollLeft: 0,
scrollTop: 0
};
const l = De(0);
if (r || !r && !i)
if ((Tt(t) !== "body" || Gt(o)) && (s = Sn(t)), r) {
const p = dt(t, !0, i, t);
l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
} else o && (l.x = no(o));
const c = o && !r && !i ? $a(o, s) : De(0), u = a.left + s.scrollLeft - l.x - c.x, d = a.top + s.scrollTop - l.y - c.y;
return {
x: u,
y: d,
width: a.width,
height: a.height
};
}
function jn(e) {
return Ie(e).position === "static";
}
function _o(e, t) {
if (!je(e) || Ie(e).position === "fixed")
return null;
if (t)
return t(e);
let n = e.offsetParent;
return He(e) === n && (n = n.ownerDocument.body), n;
}
function ka(e, t) {
const n = we(e);
if (On(e))
return n;
if (!je(e)) {
let o = Je(e);
for (; o && !wt(o); ) {
if (he(o) && !jn(o))
return o;
o = Je(o);
}
return n;
}
let r = _o(e, t);
for (; r && $c(r) && jn(r); )
r = _o(r, t);
return r && wt(r) && jn(r) && !Zr(r) ? n : r || Rc(e) || n;
}
const ru = async function(e) {
const t = this.getOffsetParent || ka, n = this.getDimensions, r = await n(e.floating);
return {
reference: nu(e.reference, await t(e.floating), e.strategy),
floating: {
x: 0,
y: 0,
width: r.width,
height: r.height
}
};
};
function ou(e) {
return Ie(e).direction === "rtl";
}
const iu = {
convertOffsetParentRelativeRectToViewportRelativeRect: qc,
getDocumentElement: He,
getClippingRect: eu,
getOffsetParent: ka,
getElementRects: ru,
getClientRects: Kc,
getDimensions: tu,
getScale: bt,
isElement: he,
isRTL: ou
};
function Ia(e, t) {
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
}
function au(e, t) {
let n = null, r;
const o = He(e);
function i() {
var s;
clearTimeout(r), (s = n) == null || s.disconnect(), n = null;
}
function a(s, l) {
s === void 0 && (s = !1), l === void 0 && (l = 1), i();
const c = e.getBoundingClientRect(), {
left: u,
top: d,
width: p,
height: f
} = c;
if (s || t(), !p || !f)
return;
const m = en(d), g = en(o.clientWidth - (u + p)), h = en(o.clientHeight - (d + f)), b = en(u), y = {
rootMargin: -m + "px " + -g + "px " + -h + "px " + -b + "px",
threshold: ge(0, ut(1, l)) || 1
};
let E = !0;
function v(C) {
const $ = C[0].intersectionRatio;
if ($ !== l) {
if (!E)
return a();
$ ? a(!1, $) : r = setTimeout(() => {
a(!1, 1e-7);
}, 1e3);
}
$ === 1 && !Ia(c, e.getBoundingClientRect()) && a(), E = !1;
}
try {
n = new IntersectionObserver(v, {
...y,
// Handle