"use client";
import { t as e } from "./useIsoLayoutEffect-CKOv1bV_.js";
import { f as t, o as n, t as r } from "./useRenderElement-CmuWsiNa.js";
import { t as i } from "./useStableCallback-CqEVb76s.js";
import { t as a } from "./DirectionContext-B4CbbM--.js";
import { n as o } from "./useBaseUiId-DOm5ACje.js";
import { _ as s, a as c, c as l, d as u, f as d, h as f, i as p, l as m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, y as C } from "./floating-ui.utils.dom-5U5b4xPf.js";
import { F as w, O as T, _ as E, k as D, o as O, r as k } from "./popupStateMapping-PdIQcWEz.js";
import { A, C as ee, D as j, E as M, O as N, S as te, T as P, _ as F, b as ne, d as re, f as I, g as ie, h as L, k as R, m as z, p as B, v as V, w as H, x as U, y as ae } from "./composite-HOje5ugx.js";
import { t as oe } from "./owner-BrzQrszh.js";
import { t as se } from "./useValueAsRef-CCU3eUYq.js";
import * as W from "react";
import { useLayoutEffect as ce } from "react";
import * as le from "react-dom";
//#region ../../node_modules/.bun/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
function ue(e, t, n) {
	let { reference: r, floating: i } = e, a = P(t), o = ie(t), s = V(o), c = H(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
	switch (c) {
		case "top":
			p = {
				x: u,
				y: r.y - i.height
			};
			break;
		case "bottom":
			p = {
				x: u,
				y: r.y + r.height
			};
			break;
		case "right":
			p = {
				x: r.x + r.width,
				y: d
			};
			break;
		case "left":
			p = {
				x: r.x - i.width,
				y: d
			};
			break;
		default: p = {
			x: r.x,
			y: r.y
		};
	}
	switch (L(t)) {
		case "start":
			p[o] -= f * (n && l ? -1 : 1);
			break;
		case "end":
			p[o] += f * (n && l ? -1 : 1);
			break;
	}
	return p;
}
async function G(e, t) {
	t === void 0 && (t = {});
	let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = B(t, e), p = ee(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = N(await i.getClippingRect({
		element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
		boundary: c,
		rootBoundary: l,
		strategy: s
	})), g = u === "floating" ? {
		x: n,
		y: r,
		width: a.floating.width,
		height: a.floating.height
	} : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
		x: 1,
		y: 1
	}, y = N(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
		elements: o,
		rect: g,
		offsetParent: _,
		strategy: s
	}) : g);
	return {
		top: (h.top - y.top + p.top) / v.y,
		bottom: (y.bottom - h.bottom + p.bottom) / v.y,
		left: (h.left - y.left + p.left) / v.x,
		right: (y.right - h.right + p.right) / v.x
	};
}
var de = 50, fe = async (e, t, n) => {
	let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = o.detectOverflow ? o : {
		...o,
		detectOverflow: G
	}, c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
		reference: e,
		floating: t,
		strategy: i
	}), { x: u, y: d } = ue(l, r, c), f = r, p = 0, m = {};
	for (let n = 0; n < a.length; n++) {
		let h = a[n];
		if (!h) continue;
		let { name: g, fn: _ } = h, { x: v, y, data: b, reset: x } = await _({
			x: u,
			y: d,
			initialPlacement: r,
			placement: f,
			strategy: i,
			middlewareData: m,
			rects: l,
			platform: s,
			elements: {
				reference: e,
				floating: t
			}
		});
		u = v ?? u, d = y ?? d, m[g] = {
			...m[g],
			...b
		}, x && p < de && (p++, typeof x == "object" && (x.placement && (f = x.placement), x.rects && (l = x.rects === !0 ? await o.getElementRects({
			reference: e,
			floating: t,
			strategy: i
		}) : x.rects), {x: u, y: d} = ue(l, f, c)), n = -1);
	}
	return {
		x: u,
		y: d,
		placement: f,
		strategy: i,
		middlewareData: m
	};
}, pe = function(e) {
	return e === void 0 && (e = {}), {
		name: "flip",
		options: e,
		async fn(t) {
			var n;
			let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = B(e, t);
			if ((n = i.arrow) != null && n.alignmentOffset) return {};
			let g = H(r), _ = P(o), v = H(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [te(o)] : ae(o)), x = p !== "none";
			!d && x && b.push(...U(o, m, p, y));
			let S = [o, ...b], C = await s.detectOverflow(t, h), w = [], T = i.flip?.overflows || [];
			if (l && w.push(C[g]), u) {
				let e = F(r, a, y);
				w.push(C[e[0]], C[e[1]]);
			}
			if (T = [...T, {
				placement: r,
				overflows: w
			}], !w.every((e) => e <= 0)) {
				let e = (i.flip?.index || 0) + 1, t = S[e];
				if (t && (!(u === "alignment" && _ !== P(t)) || T.every((e) => P(e.placement) === _ ? e.overflows[0] > 0 : !0))) return {
					data: {
						index: e,
						overflows: T
					},
					reset: { placement: t }
				};
				let n = T.filter((e) => e.overflows[0] <= 0).sort((e, t) => e.overflows[1] - t.overflows[1])[0]?.placement;
				if (!n) switch (f) {
					case "bestFit": {
						let e = T.filter((e) => {
							if (x) {
								let t = P(e.placement);
								return t === _ || t === "y";
							}
							return !0;
						}).map((e) => [e.placement, e.overflows.filter((e) => e > 0).reduce((e, t) => e + t, 0)]).sort((e, t) => e[1] - t[1])[0]?.[0];
						e && (n = e);
						break;
					}
					case "initialPlacement":
						n = o;
						break;
				}
				if (r !== n) return { reset: { placement: n } };
			}
			return {};
		}
	};
};
function me(e, t) {
	return {
		top: e.top - t.height,
		right: e.right - t.width,
		bottom: e.bottom - t.height,
		left: e.left - t.width
	};
}
function he(e) {
	return A.some((t) => e[t] >= 0);
}
var K = function(e) {
	return e === void 0 && (e = {}), {
		name: "hide",
		options: e,
		async fn(t) {
			let { rects: n, platform: r } = t, { strategy: i = "referenceHidden", ...a } = B(e, t);
			switch (i) {
				case "referenceHidden": {
					let e = me(await r.detectOverflow(t, {
						...a,
						elementContext: "reference"
					}), n.reference);
					return { data: {
						referenceHiddenOffsets: e,
						referenceHidden: he(e)
					} };
				}
				case "escaped": {
					let e = me(await r.detectOverflow(t, {
						...a,
						altBoundary: !0
					}), n.floating);
					return { data: {
						escapedOffsets: e,
						escaped: he(e)
					} };
				}
				default: return {};
			}
		}
	};
}, q = /*#__PURE__*/ new Set(["left", "top"]);
async function ge(e, t) {
	let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = H(n), s = L(n), c = P(n) === "y", l = q.has(o) ? -1 : 1, u = a && c ? -1 : 1, d = B(t, e), { mainAxis: f, crossAxis: p, 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" && (p = s === "end" ? m * -1 : m), c ? {
		x: p * u,
		y: f * l
	} : {
		x: f * l,
		y: p * u
	};
}
var _e = function(e) {
	return e === void 0 && (e = 0), {
		name: "offset",
		options: e,
		async fn(t) {
			var n;
			let { x: r, y: i, placement: a, middlewareData: o } = t, s = await ge(t, e);
			return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
				x: r + s.x,
				y: i + s.y,
				data: {
					...s,
					placement: a
				}
			};
		}
	};
}, J = function(e) {
	return e === void 0 && (e = {}), {
		name: "shift",
		options: e,
		async fn(t) {
			let { x: n, y: r, placement: i, platform: a } = t, { mainAxis: o = !0, crossAxis: s = !1, limiter: c = { fn: (e) => {
				let { x: t, y: n } = e;
				return {
					x: t,
					y: n
				};
			} }, ...l } = B(e, t), u = {
				x: n,
				y: r
			}, d = await a.detectOverflow(t, l), f = P(H(i)), p = ne(f), m = u[p], h = u[f];
			if (o) {
				let e = p === "y" ? "top" : "left", t = p === "y" ? "bottom" : "right", n = m + d[e], r = m - d[t];
				m = re(n, m, r);
			}
			if (s) {
				let e = f === "y" ? "top" : "left", t = f === "y" ? "bottom" : "right", n = h + d[e], r = h - d[t];
				h = re(n, h, r);
			}
			let g = c.fn({
				...t,
				[p]: m,
				[f]: h
			});
			return {
				...g,
				data: {
					x: g.x - n,
					y: g.y - r,
					enabled: {
						[p]: o,
						[f]: s
					}
				}
			};
		}
	};
}, ve = function(e) {
	return e === void 0 && (e = {}), {
		options: e,
		fn(t) {
			let { x: n, y: r, placement: i, rects: a, middlewareData: o } = t, { offset: s = 0, mainAxis: c = !0, crossAxis: l = !0 } = B(e, t), u = {
				x: n,
				y: r
			}, d = P(i), f = ne(d), p = u[f], m = u[d], h = B(s, t), g = typeof h == "number" ? {
				mainAxis: h,
				crossAxis: 0
			} : {
				mainAxis: 0,
				crossAxis: 0,
				...h
			};
			if (c) {
				let e = f === "y" ? "height" : "width", t = a.reference[f] - a.floating[e] + g.mainAxis, n = a.reference[f] + a.reference[e] - g.mainAxis;
				p < t ? p = t : p > n && (p = n);
			}
			if (l) {
				let e = f === "y" ? "width" : "height", t = q.has(H(i)), n = a.reference[d] - a.floating[e] + (t && o.offset?.[d] || 0) + (t ? 0 : g.crossAxis), r = a.reference[d] + a.reference[e] + (t ? 0 : o.offset?.[d] || 0) - (t ? g.crossAxis : 0);
				m < n ? m = n : m > r && (m = r);
			}
			return {
				[f]: p,
				[d]: m
			};
		}
	};
}, ye = function(e) {
	return e === void 0 && (e = {}), {
		name: "size",
		options: e,
		async fn(t) {
			var n, r;
			let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } = B(e, t), u = await o.detectOverflow(t, l), d = H(i), f = L(i), p = P(i) === "y", { width: m, height: h } = a.floating, g, _;
			d === "top" || d === "bottom" ? (g = d, _ = f === (await (o.isRTL == null ? void 0 : o.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (_ = d, g = f === "end" ? "top" : "bottom");
			let v = h - u.top - u.bottom, y = m - u.left - u.right, b = j(h - u[g], v), x = j(m - u[_], y), S = !t.middlewareData.shift, C = b, w = x;
			if ((n = t.middlewareData.shift) != null && n.enabled.x && (w = y), (r = t.middlewareData.shift) != null && r.enabled.y && (C = v), S && !f) {
				let e = M(u.left, 0), t = M(u.right, 0), n = M(u.top, 0), r = M(u.bottom, 0);
				p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t : M(u.left, u.right)) : C = h - 2 * (n !== 0 || r !== 0 ? n + r : M(u.top, u.bottom));
			}
			await c({
				...t,
				availableWidth: w,
				availableHeight: C
			});
			let T = await o.getDimensions(s.floating);
			return m !== T.width || h !== T.height ? { reset: { rects: !0 } } : {};
		}
	};
};
//#endregion
//#region ../../node_modules/.bun/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
function be(e) {
	let t = b(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = d(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = R(n) !== a || R(r) !== o;
	return s && (n = a, r = o), {
		width: n,
		height: r,
		$: s
	};
}
function Y(e) {
	return u(e) ? e : e.contextElement;
}
function X(e) {
	let t = Y(e);
	if (!d(t)) return I(1);
	let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = be(t), o = (a ? R(n.width) : n.width) / r, s = (a ? R(n.height) : n.height) / i;
	return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
		x: o,
		y: s
	};
}
var xe = /*#__PURE__*/ I(0);
function Se(e) {
	let t = m(e);
	return !C() || !t.visualViewport ? xe : {
		x: t.visualViewport.offsetLeft,
		y: t.visualViewport.offsetTop
	};
}
function Ce(e, t, n) {
	return t === void 0 && (t = !1), !n || t && n !== m(e) ? !1 : t;
}
function Z(e, t, n, r) {
	t === void 0 && (t = !1), n === void 0 && (n = !1);
	let i = e.getBoundingClientRect(), a = Y(e), o = I(1);
	t && (r ? u(r) && (o = X(r)) : o = X(e));
	let s = Ce(a, n, r) ? Se(a) : I(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, d = i.width / o.x, f = i.height / o.y;
	if (a) {
		let e = m(a), t = r && u(r) ? m(r) : r, n = e, i = p(n);
		for (; i && r && t !== n;) {
			let e = X(i), t = i.getBoundingClientRect(), r = b(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
			c *= e.x, l *= e.y, d *= e.x, f *= e.y, c += a, l += o, n = m(i), i = p(n);
		}
	}
	return N({
		width: d,
		height: f,
		x: c,
		y: l
	});
}
function Q(e, t) {
	let n = g(e).scrollLeft;
	return t ? t.left + n : Z(v(e)).left + n;
}
function $(e, t) {
	let n = e.getBoundingClientRect();
	return {
		x: n.left + t.scrollLeft - Q(e, n),
		y: n.top + t.scrollTop
	};
}
function we(e) {
	let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = v(r), s = t ? S(t.floating) : !1;
	if (r === o || s && a) return n;
	let l = {
		scrollLeft: 0,
		scrollTop: 0
	}, u = I(1), p = I(0), m = d(r);
	if ((m || !m && !a) && ((c(r) !== "body" || f(o)) && (l = g(r)), m)) {
		let e = Z(r);
		u = X(r), p.x = e.x + r.clientLeft, p.y = e.y + r.clientTop;
	}
	let h = o && !m && !a ? $(o, l) : I(0);
	return {
		width: n.width * u.x,
		height: n.height * u.y,
		x: n.x * u.x - l.scrollLeft * u.x + p.x + h.x,
		y: n.y * u.y - l.scrollTop * u.y + p.y + h.y
	};
}
function Te(e) {
	return Array.from(e.getClientRects());
}
function Ee(e) {
	let t = v(e), n = g(e), r = e.ownerDocument.body, i = M(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = M(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + Q(e), s = -n.scrollTop;
	return b(r).direction === "rtl" && (o += M(t.clientWidth, r.clientWidth) - i), {
		width: i,
		height: a,
		x: o,
		y: s
	};
}
var De = 25;
function Oe(e, t) {
	let n = m(e), r = v(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
	if (i) {
		a = i.width, o = i.height;
		let e = C();
		(!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
	}
	let l = Q(r);
	if (l <= 0) {
		let e = r.ownerDocument, t = e.body, n = getComputedStyle(t), i = e.compatMode === "CSS1Compat" && parseFloat(n.marginLeft) + parseFloat(n.marginRight) || 0, o = Math.abs(r.clientWidth - t.clientWidth - i);
		o <= De && (a -= o);
	} else l <= De && (a += l);
	return {
		width: a,
		height: o,
		x: s,
		y: c
	};
}
function ke(e, t) {
	let n = Z(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = d(e) ? X(e) : I(1);
	return {
		width: e.clientWidth * a.x,
		height: e.clientHeight * a.y,
		x: i * a.x,
		y: r * a.y
	};
}
function Ae(e, t, n) {
	let r;
	if (t === "viewport") r = Oe(e, n);
	else if (t === "document") r = Ee(v(e));
	else if (u(t)) r = ke(t, n);
	else {
		let n = Se(e);
		r = {
			x: t.x - n.x,
			y: t.y - n.y,
			width: t.width,
			height: t.height
		};
	}
	return N(r);
}
function je(e, t) {
	let n = l(e);
	return n === t || !u(n) || _(n) ? !1 : b(n).position === "fixed" || je(n, t);
}
function Me(e, t) {
	let n = t.get(e);
	if (n) return n;
	let r = y(e, [], !1).filter((e) => u(e) && c(e) !== "body"), i = null, a = b(e).position === "fixed", o = a ? l(e) : e;
	for (; u(o) && !_(o);) {
		let t = b(o), n = x(o);
		!n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && (i.position === "absolute" || i.position === "fixed") || f(o) && !n && je(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = l(o);
	}
	return t.set(e, r), r;
}
function Ne(e) {
	let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? S(t) ? [] : Me(t, this._c) : [].concat(n), r], o = Ae(t, a[0], i), s = o.top, c = o.right, l = o.bottom, u = o.left;
	for (let e = 1; e < a.length; e++) {
		let n = Ae(t, a[e], i);
		s = M(n.top, s), c = j(n.right, c), l = j(n.bottom, l), u = M(n.left, u);
	}
	return {
		width: c - u,
		height: l - s,
		x: u,
		y: s
	};
}
function Pe(e) {
	let { width: t, height: n } = be(e);
	return {
		width: t,
		height: n
	};
}
function Fe(e, t, n) {
	let r = d(t), i = v(t), a = n === "fixed", o = Z(e, !0, a, t), s = {
		scrollLeft: 0,
		scrollTop: 0
	}, l = I(0);
	function u() {
		l.x = Q(i);
	}
	if (r || !r && !a) if ((c(t) !== "body" || f(i)) && (s = g(t)), r) {
		let e = Z(t, !0, a, t);
		l.x = e.x + t.clientLeft, l.y = e.y + t.clientTop;
	} else i && u();
	a && !r && i && u();
	let p = i && !r && !a ? $(i, s) : I(0);
	return {
		x: o.left + s.scrollLeft - l.x - p.x,
		y: o.top + s.scrollTop - l.y - p.y,
		width: o.width,
		height: o.height
	};
}
function Ie(e) {
	return b(e).position === "static";
}
function Le(e, t) {
	if (!d(e) || b(e).position === "fixed") return null;
	if (t) return t(e);
	let n = e.offsetParent;
	return v(e) === n && (n = n.ownerDocument.body), n;
}
function Re(e, t) {
	let n = m(e);
	if (S(e)) return n;
	if (!d(e)) {
		let t = l(e);
		for (; t && !_(t);) {
			if (u(t) && !Ie(t)) return t;
			t = l(t);
		}
		return n;
	}
	let r = Le(e, t);
	for (; r && s(r) && Ie(r);) r = Le(r, t);
	return r && _(r) && Ie(r) && !x(r) ? n : r || h(e) || n;
}
var ze = async function(e) {
	let t = this.getOffsetParent || Re, n = this.getDimensions, r = await n(e.floating);
	return {
		reference: Fe(e.reference, await t(e.floating), e.strategy),
		floating: {
			x: 0,
			y: 0,
			width: r.width,
			height: r.height
		}
	};
};
function Be(e) {
	return b(e).direction === "rtl";
}
var Ve = {
	convertOffsetParentRelativeRectToViewportRelativeRect: we,
	getDocumentElement: v,
	getClippingRect: Ne,
	getOffsetParent: Re,
	getElementRects: ze,
	getClientRects: Te,
	getDimensions: Pe,
	getScale: X,
	isElement: u,
	isRTL: Be
};
function He(e, t) {
	return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
}
function Ue(e, t) {
	let n = null, r, i = v(e);
	function a() {
		var e;
		clearTimeout(r), (e = n) == null || e.disconnect(), n = null;
	}
	function o(s, c) {
		s === void 0 && (s = !1), c === void 0 && (c = 1), a();
		let l = e.getBoundingClientRect(), { left: u, top: d, width: f, height: p } = l;
		if (s || t(), !f || !p) return;
		let m = z(d), h = z(i.clientWidth - (u + f)), g = z(i.clientHeight - (d + p)), _ = z(u), v = {
			rootMargin: -m + "px " + -h + "px " + -g + "px " + -_ + "px",
			threshold: M(0, j(1, c)) || 1
		}, y = !0;
		function b(t) {
			let n = t[0].intersectionRatio;
			if (n !== c) {
				if (!y) return o();
				n ? o(!1, n) : r = setTimeout(() => {
					o(!1, 1e-7);
				}, 1e3);
			}
			n === 1 && !He(l, e.getBoundingClientRect()) && o(), y = !1;
		}
		try {
			n = new IntersectionObserver(b, {
				...v,
				root: i.ownerDocument
			});
		} catch {
			n = new IntersectionObserver(b, v);
		}
		n.observe(e);
	}
	return o(!0), a;
}
function We(e, t, n, r) {
	r === void 0 && (r = {});
	let { ancestorScroll: i = !0, ancestorResize: a = !0, elementResize: o = typeof ResizeObserver == "function", layoutShift: s = typeof IntersectionObserver == "function", animationFrame: c = !1 } = r, l = Y(e), u = i || a ? [...l ? y(l) : [], ...t ? y(t) : []] : [];
	u.forEach((e) => {
		i && e.addEventListener("scroll", n, { passive: !0 }), a && e.addEventListener("resize", n);
	});
	let d = l && s ? Ue(l, n) : null, f = -1, p = null;
	o && (p = new ResizeObserver((e) => {
		let [r] = e;
		r && r.target === l && p && t && (p.unobserve(t), cancelAnimationFrame(f), f = requestAnimationFrame(() => {
			var e;
			(e = p) == null || e.observe(t);
		})), n();
	}), l && !c && p.observe(l), t && p.observe(t));
	let m, h = c ? Z(e) : null;
	c && g();
	function g() {
		let t = Z(e);
		h && !He(h, t) && n(), h = t, m = requestAnimationFrame(g);
	}
	return n(), () => {
		var e;
		u.forEach((e) => {
			i && e.removeEventListener("scroll", n), a && e.removeEventListener("resize", n);
		}), d?.(), (e = p) == null || e.disconnect(), p = null, c && cancelAnimationFrame(m);
	};
}
var Ge = _e, Ke = J, qe = pe, Je = ye, Ye = K, Xe = ve, Ze = (e, t, n) => {
	let r = /* @__PURE__ */ new Map(), i = {
		platform: Ve,
		...n
	}, a = {
		...i.platform,
		_c: r
	};
	return fe(e, t, {
		...i,
		platform: a
	});
}, Qe = typeof document < "u" ? ce : function() {};
function $e(e, t) {
	if (e === t) return !0;
	if (typeof e != typeof t) return !1;
	if (typeof e == "function" && e.toString() === t.toString()) return !0;
	let n, r, i;
	if (e && t && typeof e == "object") {
		if (Array.isArray(e)) {
			if (n = e.length, n !== t.length) return !1;
			for (r = n; r-- !== 0;) if (!$e(e[r], t[r])) return !1;
			return !0;
		}
		if (i = Object.keys(e), n = i.length, n !== Object.keys(t).length) return !1;
		for (r = n; r-- !== 0;) if (!{}.hasOwnProperty.call(t, i[r])) return !1;
		for (r = n; r-- !== 0;) {
			let n = i[r];
			if (!(n === "_owner" && e.$$typeof) && !$e(e[n], t[n])) return !1;
		}
		return !0;
	}
	return e !== e && t !== t;
}
function et(e) {
	return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function tt(e, t) {
	let n = et(e);
	return Math.round(t * n) / n;
}
function nt(e) {
	let t = W.useRef(e);
	return Qe(() => {
		t.current = e;
	}), t;
}
function rt(e) {
	e === void 0 && (e = {});
	let { placement: t = "bottom", strategy: n = "absolute", middleware: r = [], platform: i, elements: { reference: a, floating: o } = {}, transform: s = !0, whileElementsMounted: c, open: l } = e, [u, d] = W.useState({
		x: 0,
		y: 0,
		strategy: n,
		placement: t,
		middlewareData: {},
		isPositioned: !1
	}), [f, p] = W.useState(r);
	$e(f, r) || p(r);
	let [m, h] = W.useState(null), [g, _] = W.useState(null), v = W.useCallback((e) => {
		e !== S.current && (S.current = e, h(e));
	}, []), y = W.useCallback((e) => {
		e !== C.current && (C.current = e, _(e));
	}, []), b = a || m, x = o || g, S = W.useRef(null), C = W.useRef(null), w = W.useRef(u), T = c != null, E = nt(c), D = nt(i), O = nt(l), k = W.useCallback(() => {
		if (!S.current || !C.current) return;
		let e = {
			placement: t,
			strategy: n,
			middleware: f
		};
		D.current && (e.platform = D.current), Ze(S.current, C.current, e).then((e) => {
			let t = {
				...e,
				isPositioned: O.current !== !1
			};
			A.current && !$e(w.current, t) && (w.current = t, le.flushSync(() => {
				d(t);
			}));
		});
	}, [
		f,
		t,
		n,
		D,
		O
	]);
	Qe(() => {
		l === !1 && w.current.isPositioned && (w.current.isPositioned = !1, d((e) => ({
			...e,
			isPositioned: !1
		})));
	}, [l]);
	let A = W.useRef(!1);
	Qe(() => (A.current = !0, () => {
		A.current = !1;
	}), []), Qe(() => {
		if (b && (S.current = b), x && (C.current = x), b && x) {
			if (E.current) return E.current(b, x, k);
			k();
		}
	}, [
		b,
		x,
		k,
		E,
		T
	]);
	let ee = W.useMemo(() => ({
		reference: S,
		floating: C,
		setReference: v,
		setFloating: y
	}), [v, y]), j = W.useMemo(() => ({
		reference: b,
		floating: x
	}), [b, x]), M = W.useMemo(() => {
		let e = {
			position: n,
			left: 0,
			top: 0
		};
		if (!j.floating) return e;
		let t = tt(j.floating, u.x), r = tt(j.floating, u.y);
		return s ? {
			...e,
			transform: "translate(" + t + "px, " + r + "px)",
			...et(j.floating) >= 1.5 && { willChange: "transform" }
		} : {
			position: n,
			left: t,
			top: r
		};
	}, [
		n,
		s,
		j.floating,
		u.x,
		u.y
	]);
	return W.useMemo(() => ({
		...u,
		update: k,
		refs: ee,
		elements: j,
		floatingStyles: M
	}), [
		u,
		k,
		ee,
		j,
		M
	]);
}
var it = (e, t) => {
	let n = Ge(e);
	return {
		name: n.name,
		fn: n.fn,
		options: [e, t]
	};
}, at = (e, t) => {
	let n = Ke(e);
	return {
		name: n.name,
		fn: n.fn,
		options: [e, t]
	};
}, ot = (e, t) => ({
	fn: Xe(e).fn,
	options: [e, t]
}), st = (e, t) => {
	let n = qe(e);
	return {
		name: n.name,
		fn: n.fn,
		options: [e, t]
	};
}, ct = (e, t) => {
	let n = Je(e);
	return {
		name: n.name,
		fn: n.fn,
		options: [e, t]
	};
}, lt = (e, t) => {
	let n = Ye(e);
	return {
		name: n.name,
		fn: n.fn,
		options: [e, t]
	};
};
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js
function ut(n) {
	let { open: r = !1, onOpenChange: i, elements: a = {} } = n, s = o(), c = T() != null;
	if (process.env.NODE_ENV !== "production") {
		let e = a.reference;
		e && !u(e) && console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead.");
	}
	let l = t(() => new E({
		open: r,
		transitionStatus: void 0,
		onOpenChange: i,
		referenceElement: a.reference ?? null,
		floatingElement: a.floating ?? null,
		triggerElements: new O(),
		floatingId: s,
		syncOnly: !1,
		nested: c
	})).current;
	return e(() => {
		let e = {
			open: r,
			floatingId: s
		};
		a.reference !== void 0 && (e.referenceElement = a.reference, e.domReferenceElement = u(a.reference) ? a.reference : null), a.floating !== void 0 && (e.floatingElement = a.floating), l.update(e);
	}, [
		r,
		s,
		a.reference,
		a.floating,
		l
	]), l.context.onOpenChange = i, l.context.nested = c, l;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js
function dt(t = {}) {
	let { nodeId: n, externalTree: r } = t, i = ut(t), a = t.rootContext || i, o = a.useState("referenceElement"), s = a.useState("floatingElement"), c = a.useState("domReferenceElement"), l = a.useState("open"), d = a.useState("floatingId"), [f, p] = W.useState(null), [m, h] = W.useState(void 0), [g, _] = W.useState(void 0), v = W.useRef(null), y = D(r), b = W.useMemo(() => ({
		reference: o,
		floating: s,
		domReference: c
	}), [
		o,
		s,
		c
	]), x = rt({
		...t,
		elements: {
			...b,
			...f && { reference: f }
		}
	}), S = u(m) ? m : null, C = g === void 0 ? a.state.floatingElement : g;
	a.useSyncedValue("referenceElement", m ?? null), a.useSyncedValue("domReferenceElement", m === void 0 ? c : S), a.useSyncedValue("floatingElement", C);
	let w = W.useCallback((e) => {
		let t = u(e) ? {
			getBoundingClientRect: () => e.getBoundingClientRect(),
			getClientRects: () => e.getClientRects(),
			contextElement: e
		} : e;
		p(t), x.refs.setReference(t);
	}, [x.refs]), T = W.useCallback((e) => {
		(u(e) || e === null) && (v.current = e, h(e)), (u(x.refs.reference.current) || x.refs.reference.current === null || e !== null && !u(e)) && x.refs.setReference(e);
	}, [x.refs, h]), E = W.useCallback((e) => {
		_(e), x.refs.setFloating(e);
	}, [x.refs]), O = W.useMemo(() => ({
		...x.refs,
		setReference: T,
		setFloating: E,
		setPositionReference: w,
		domReference: v
	}), [
		x.refs,
		T,
		E,
		w
	]), k = W.useMemo(() => ({
		...x.elements,
		domReference: c
	}), [x.elements, c]), A = W.useMemo(() => ({
		...x,
		dataRef: a.context.dataRef,
		open: l,
		onOpenChange: a.setOpen,
		events: a.context.events,
		floatingId: d,
		refs: O,
		elements: k,
		nodeId: n,
		rootStore: a
	}), [
		x,
		O,
		k,
		n,
		a,
		l,
		d
	]);
	return e(() => {
		c && (v.current = c);
	}, [c]), e(() => {
		a.context.dataRef.current.floatingContext = A;
		let e = y?.nodesRef.current.find((e) => e.id === n);
		e && (e.context = A);
	}), W.useMemo(() => ({
		...x,
		context: A,
		refs: O,
		elements: k,
		rootStore: a
	}), [
		x,
		O,
		k,
		A,
		a
	]);
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js
var ft = (e) => ({
	name: "arrow",
	options: e,
	async fn(t) {
		let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0, offsetParent: d = "real" } = B(e, t) || {};
		if (l == null) return {};
		let f = ee(u), p = {
			x: n,
			y: r
		}, m = ie(i), h = V(m), g = await o.getDimensions(l), _ = m === "y", v = _ ? "top" : "left", y = _ ? "bottom" : "right", b = _ ? "clientHeight" : "clientWidth", x = a.reference[h] + a.reference[m] - p[m] - a.floating[h], S = p[m] - a.reference[m], C = d === "real" ? await o.getOffsetParent?.(l) : s.floating, w = s.floating[b] || a.floating[h];
		(!w || !await o.isElement?.(C)) && (w = s.floating[b] || a.floating[h]);
		let T = x / 2 - S / 2, E = w / 2 - g[h] / 2 - 1, D = Math.min(f[v], E), O = Math.min(f[y], E), k = D, A = w - g[h] - O, j = w / 2 - g[h] / 2 + T, M = re(k, j, A), N = !c.arrow && L(i) != null && j !== M && a.reference[h] / 2 - (j < k ? D : O) - g[h] / 2 < 0, te = N ? j < k ? j - k : j - A : 0;
		return {
			[m]: p[m] + te,
			data: {
				[m]: M,
				centerOffset: j - M - te,
				...N && { alignmentOffset: te }
			},
			reset: N
		};
	}
}), pt = (e, t) => ({
	...ft(e),
	options: [e, t]
}), mt = {
	name: "hide",
	async fn(e) {
		let { width: t, height: n, x: r, y: i } = e.rects.reference, a = t === 0 && n === 0 && r === 0 && i === 0;
		return { data: { referenceHidden: (await lt().fn(e)).data?.referenceHidden || a } };
	}
}, ht = {
	sideX: "left",
	sideY: "top"
}, gt = {
	name: "adaptiveOrigin",
	async fn(e) {
		let { x: t, y: n, rects: { floating: r }, elements: { floating: i }, platform: a, strategy: o, placement: s } = e, c = m(i), l = c.getComputedStyle(i);
		if (!(l.transitionDuration !== "0s" && l.transitionDuration !== "")) return {
			x: t,
			y: n,
			data: ht
		};
		let u = await a.getOffsetParent?.(i), d = {
			width: 0,
			height: 0
		};
		if (o === "fixed" && c?.visualViewport) d = {
			width: c.visualViewport.width,
			height: c.visualViewport.height
		};
		else if (u === c) {
			let e = oe(i);
			d = {
				width: e.documentElement.clientWidth,
				height: e.documentElement.clientHeight
			};
		} else await a.isElement?.(u) && (d = await a.getDimensions(u));
		let f = H(s), p = t, h = n;
		f === "left" && (p = d.width - (t + r.width)), f === "top" && (h = d.height - (n + r.height));
		let g = f === "left" ? "right" : ht.sideX, _ = f === "top" ? "bottom" : ht.sideY;
		return {
			x: p,
			y: h,
			data: {
				sideX: g,
				sideY: _
			}
		};
	}
};
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js
function _t(e, t, n) {
	let r = e === "inline-start" || e === "inline-end";
	return {
		top: "top",
		right: r ? n ? "inline-start" : "inline-end" : "right",
		bottom: "bottom",
		left: r ? n ? "inline-end" : "inline-start" : "left"
	}[t];
}
function vt(e, t, n) {
	let { rects: r, placement: i } = e;
	return {
		side: _t(t, H(i), n),
		align: L(i) || "center",
		anchor: {
			width: r.reference.width,
			height: r.reference.height
		},
		positioner: {
			width: r.floating.width,
			height: r.floating.height
		}
	};
}
function yt(t) {
	let { anchor: n, positionMethod: r = "absolute", side: o = "bottom", sideOffset: s = 0, align: c = "center", alignOffset: l = 0, collisionBoundary: u, collisionPadding: d = 5, sticky: f = !1, arrowPadding: p = 5, disableAnchorTracking: h = !1, inline: g, keepMounted: _ = !1, floatingRootContext: v, mounted: y, collisionAvoidance: b, shiftCrossAxis: x = !1, nodeId: S, adaptiveOrigin: C, lazyFlip: w = !1, externalTree: T } = t, [E, D] = W.useState(null);
	!y && E !== null && D(null);
	let O = b.side || "flip", k = b.align || "flip", A = b.fallbackAxisSide || "end", ee = typeof n == "function" ? n : void 0, j = i(ee), M = ee ? j : n, N = se(n), te = se(y), F = a() === "rtl", ne = E || {
		top: "top",
		right: "right",
		bottom: "bottom",
		left: "left",
		"inline-end": F ? "left" : "right",
		"inline-start": F ? "right" : "left"
	}[o], re = c === "center" ? ne : `${ne}-${c}`, I = d, ie = +(o === "bottom"), R = +(o === "top"), z = +(o === "right"), B = +(o === "left");
	typeof I == "number" ? I = {
		top: I + ie,
		right: I + B,
		bottom: I + R,
		left: I + z
	} : I &&= {
		top: (I.top || 0) + ie,
		right: (I.right || 0) + B,
		bottom: (I.bottom || 0) + R,
		left: (I.left || 0) + z
	};
	let V = {
		boundary: u === "clipping-ancestors" ? "clippingAncestors" : u,
		padding: I
	}, U = W.useRef(null), ae = se(s), ce = se(l), le = typeof s == "function" ? 0 : s, ue = typeof l == "function" ? 0 : l, G = [];
	g && G.push(g), G.push(it((e) => {
		let t = vt(e, o, F), n = typeof ae.current == "function" ? ae.current(t) : ae.current, r = typeof ce.current == "function" ? ce.current(t) : ce.current;
		return {
			mainAxis: n,
			crossAxis: r,
			alignmentAxis: r
		};
	}, [
		le,
		ue,
		F,
		o
	]));
	let de = k === "none" && O !== "shift", fe = !de && (f || x || O === "shift"), pe = O === "none" ? null : st({
		...V,
		padding: {
			top: I.top + 1,
			right: I.right + 1,
			bottom: I.bottom + 1,
			left: I.left + 1
		},
		mainAxis: !x && O === "flip",
		crossAxis: k === "flip" ? "alignment" : !1,
		fallbackAxisSideDirection: A
	}), me = de ? null : at((e) => {
		let t = oe(e.elements.floating).documentElement;
		return {
			...V,
			rootBoundary: x ? {
				x: 0,
				y: 0,
				width: t.clientWidth,
				height: t.clientHeight
			} : void 0,
			mainAxis: k !== "none",
			crossAxis: fe,
			limiter: f || x ? void 0 : ot((e) => {
				if (!U.current) return {};
				let { width: t, height: n } = U.current.getBoundingClientRect(), r = P(H(e.placement)), i = r === "y" ? t : n, a = r === "y" ? I.left + I.right : I.top + I.bottom;
				return { offset: i / 2 + a / 2 };
			})
		};
	}, [
		V,
		f,
		x,
		I,
		k
	]);
	O === "shift" || k === "shift" || c === "center" ? G.push(me, pe) : G.push(pe, me), G.push(ct({
		...V,
		apply({ elements: { floating: e }, availableWidth: t, availableHeight: n, rects: r }) {
			if (!te.current) return;
			let i = e.style;
			i.setProperty("--available-width", `${t}px`), i.setProperty("--available-height", `${n}px`);
			let a = m(e).devicePixelRatio || 1, { x: o, y: s, width: c, height: l } = r.reference, u = (Math.round((o + c) * a) - Math.round(o * a)) / a, d = (Math.round((s + l) * a) - Math.round(s * a)) / a;
			i.setProperty("--anchor-width", `${u}px`), i.setProperty("--anchor-height", `${d}px`);
		}
	}), pt((e) => ({
		element: U.current || oe(e.elements.floating).createElement("div"),
		padding: p,
		offsetParent: "floating"
	}), [p]), {
		name: "transformOrigin",
		fn(e) {
			let { elements: t, middlewareData: n, placement: r, rects: i, y: a } = e, c = H(r), l = P(c), u = U.current, d = n.arrow?.x || 0, f = n.arrow?.y || 0, p = u?.clientWidth || 0, m = u?.clientHeight || 0, h = d + p / 2, g = f + m / 2, _ = Math.abs(n.shift?.y || 0), v = i.reference.height / 2, y = typeof s == "function" ? s(vt(e, o, F)) : s, b = _ > y, x = {
				top: `${h}px calc(100% + ${y}px)`,
				bottom: `${h}px ${-y}px`,
				left: `calc(100% + ${y}px) ${g}px`,
				right: `${-y}px ${g}px`
			}[c], S = `${h}px ${i.reference.y + v - a}px`;
			return t.floating.style.setProperty("--transform-origin", fe && l === "y" && b ? S : x), {};
		}
	}, mt, C), e(() => {
		!y && v && v.update({
			referenceElement: null,
			floatingElement: null,
			domReferenceElement: null,
			positionReference: null
		});
	}, [y, v]);
	let he = W.useMemo(() => ({
		elementResize: !h && typeof ResizeObserver < "u",
		layoutShift: !h && typeof IntersectionObserver < "u"
	}), [h]), { refs: K, elements: q, x: ge, y: _e, middlewareData: J, update: ve, placement: ye, context: be, isPositioned: Y, floatingStyles: X } = dt({
		rootContext: v,
		open: _ ? y : void 0,
		placement: re,
		middleware: G,
		strategy: r,
		whileElementsMounted: _ ? void 0 : (...e) => We(...e, he),
		nodeId: S,
		externalTree: T
	}), { sideX: xe, sideY: Se } = J.adaptiveOrigin || ht, Ce = Y ? r : "fixed", Z = W.useMemo(() => {
		let e = C ? {
			position: Ce,
			[xe]: ge,
			[Se]: _e
		} : {
			position: Ce,
			...X
		};
		return Y || (e.opacity = 0), e;
	}, [
		C,
		Ce,
		xe,
		ge,
		Se,
		_e,
		X,
		Y
	]), Q = W.useRef(null);
	e(() => {
		if (!y) return;
		let e = N.current, t = typeof e == "function" ? e() : e, n = (bt(t) ? t.current : t) || null;
		n !== Q.current && (K.setPositionReference(n), Q.current = n);
	}, [
		y,
		K,
		M,
		N
	]), W.useEffect(() => {
		if (!y) return;
		let e = N.current;
		typeof e != "function" && bt(e) && e.current !== Q.current && (K.setPositionReference(e.current), Q.current = e.current);
	}, [
		y,
		K,
		M,
		N
	]), W.useEffect(() => {
		if (_ && y && q.domReference && q.floating) return We(q.domReference, q.floating, ve, he);
	}, [
		_,
		y,
		q,
		ve,
		he
	]);
	let $ = H(ye), we = _t(o, $, F), Te = L(ye) || "center", Ee = !!J.hide?.referenceHidden;
	e(() => {
		w && y && Y && D($);
	}, [
		w,
		y,
		Y,
		$
	]);
	let De = W.useMemo(() => ({
		position: "absolute",
		top: J.arrow?.y,
		left: J.arrow?.x
	}), [J.arrow]), Oe = J.arrow?.centerOffset !== 0;
	return W.useMemo(() => ({
		positionerStyles: Z,
		arrowStyles: De,
		arrowRef: U,
		arrowUncentered: Oe,
		side: we,
		align: Te,
		physicalSide: $,
		anchorHidden: Ee,
		refs: K,
		context: be,
		isPositioned: Y,
		update: ve
	}), [
		Z,
		De,
		U,
		Oe,
		we,
		Te,
		$,
		Ee,
		K,
		be,
		Y,
		ve
	]);
}
function bt(e) {
	return e != null && "current" in e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js
function xt(e) {
	return e === "starting" ? w : n;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/usePositioner.js
function St(e, t, { styles: n, transitionStatus: i, props: a, refs: o, hidden: s, inert: c = !1 }) {
	let l = { ...n };
	return c && (l.pointerEvents = "none"), r("div", e, {
		state: t,
		ref: o,
		props: [
			{
				role: "presentation",
				hidden: s,
				style: l
			},
			xt(i),
			a
		],
		stateAttributesMapping: k
	});
}
//#endregion
export { ut as a, gt as i, xt as n, Ve as o, yt as r, St as t };
