mongodb-chatbot-ui
Version:
UI React components for the MongoDB Chatbot Framework
1,509 lines (1,499 loc) • 46.3 kB
JavaScript
import * as h from "react";
import _, { useLayoutEffect as He, useEffect as We, forwardRef as jn, useRef as Dn, useState as ee, useMemo as Fn, Fragment as In } from "react";
import { p as Ht } from "./jsx-runtime.js";
import * as kn from "react-dom";
import { ac as $n, m as C, aG as Vn, aH as Bn, aC as zn, I as Hn, P as Wn, aI as _n, n as Zn, aJ as Xn, M as Yn, o as U, e as Un } from "./index2.js";
import { u as qn } from "./index9.js";
import { s as Gn } from "./Transition.js";
function Mt() {
return typeof window < "u";
}
function tt(t) {
return _e(t) ? (t.nodeName || "").toLowerCase() : "#document";
}
function $(t) {
var e;
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
}
function q(t) {
var e;
return (e = (_e(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
}
function _e(t) {
return Mt() ? t instanceof Node || t instanceof $(t).Node : !1;
}
function F(t) {
return Mt() ? t instanceof Element || t instanceof $(t).Element : !1;
}
function X(t) {
return Mt() ? t instanceof HTMLElement || t instanceof $(t).HTMLElement : !1;
}
function ne(t) {
return !Mt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof $(t).ShadowRoot;
}
function gt(t) {
const {
overflow: e,
overflowX: n,
overflowY: o,
display: r
} = B(t);
return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && !["inline", "contents"].includes(r);
}
function Jn(t) {
return ["table", "td", "th"].includes(tt(t));
}
function Kn(t) {
return [":popover-open", ":modal"].some((e) => {
try {
return t.matches(e);
} catch {
return !1;
}
});
}
function Wt(t) {
const e = _t(), n = F(t) ? B(t) : t;
return ["transform", "translate", "scale", "rotate", "perspective"].some((o) => n[o] ? n[o] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
}
function Qn(t) {
let e = ct(t);
for (; X(e) && !Pt(e); ) {
if (Wt(e))
return e;
if (Kn(e))
return null;
e = ct(e);
}
return null;
}
function _t() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function Pt(t) {
return ["html", "body", "#document"].includes(tt(t));
}
function B(t) {
return $(t).getComputedStyle(t);
}
function At(t) {
return F(t) ? {
scrollLeft: t.scrollLeft,
scrollTop: t.scrollTop
} : {
scrollLeft: t.scrollX,
scrollTop: t.scrollY
};
}
function ct(t) {
if (tt(t) === "html")
return t;
const e = (
// Step into the shadow DOM of the parent of a slotted node.
t.assignedSlot || // DOM Element detected.
t.parentNode || // ShadowRoot detected.
ne(t) && t.host || // Fallback.
q(t)
);
return ne(e) ? e.host : e;
}
function Ze(t) {
const e = ct(t);
return Pt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && gt(e) ? e : Ze(e);
}
function pt(t, e, n) {
var o;
e === void 0 && (e = []), n === void 0 && (n = !0);
const r = Ze(t), i = r === ((o = t.ownerDocument) == null ? void 0 : o.body), s = $(r);
if (i) {
const l = to(s);
return e.concat(s, s.visualViewport || [], gt(r) ? r : [], l && n ? pt(l) : []);
}
return e.concat(r, pt(r, [], n));
}
function to(t) {
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
}
const Ft = Math.min, st = Math.max, bt = Math.round, yt = Math.floor, et = (t) => ({
x: t,
y: t
}), eo = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, no = {
start: "end",
end: "start"
};
function Zt(t, e) {
return typeof t == "function" ? t(e) : t;
}
function at(t) {
return t.split("-")[0];
}
function Tt(t) {
return t.split("-")[1];
}
function oo(t) {
return t === "x" ? "y" : "x";
}
function Xe(t) {
return t === "y" ? "height" : "width";
}
function Xt(t) {
return ["top", "bottom"].includes(at(t)) ? "y" : "x";
}
function Ye(t) {
return oo(Xt(t));
}
function ro(t, e, n) {
n === void 0 && (n = !1);
const o = Tt(t), r = Ye(t), i = Xe(r);
let s = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
return e.reference[i] > e.floating[i] && (s = Et(s)), [s, Et(s)];
}
function io(t) {
const e = Et(t);
return [It(t), e, It(e)];
}
function It(t) {
return t.replace(/start|end/g, (e) => no[e]);
}
function so(t, e, n) {
const o = ["left", "right"], r = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
switch (t) {
case "top":
case "bottom":
return n ? e ? r : o : e ? o : r;
case "left":
case "right":
return e ? i : s;
default:
return [];
}
}
function lo(t, e, n, o) {
const r = Tt(t);
let i = so(at(t), n === "start", o);
return r && (i = i.map((s) => s + "-" + r), e && (i = i.concat(i.map(It)))), i;
}
function Et(t) {
return t.replace(/left|right|bottom|top/g, (e) => eo[e]);
}
function co(t) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...t
};
}
function ao(t) {
return typeof t != "number" ? co(t) : {
top: t,
right: t,
bottom: t,
left: t
};
}
function Rt(t) {
const {
x: e,
y: n,
width: o,
height: r
} = t;
return {
width: o,
height: r,
top: n,
left: e,
right: e + o,
bottom: n + r,
x: e,
y: n
};
}
function oe(t, e, n) {
let {
reference: o,
floating: r
} = t;
const i = Xt(e), s = Ye(e), l = Xe(s), a = at(e), c = i === "y", f = o.x + o.width / 2 - r.width / 2, u = o.y + o.height / 2 - r.height / 2, m = o[l] / 2 - r[l] / 2;
let d;
switch (a) {
case "top":
d = {
x: f,
y: o.y - r.height
};
break;
case "bottom":
d = {
x: f,
y: o.y + o.height
};
break;
case "right":
d = {
x: o.x + o.width,
y: u
};
break;
case "left":
d = {
x: o.x - r.width,
y: u
};
break;
default:
d = {
x: o.x,
y: o.y
};
}
switch (Tt(e)) {
case "start":
d[s] -= m * (n && c ? -1 : 1);
break;
case "end":
d[s] += m * (n && c ? -1 : 1);
break;
}
return d;
}
const fo = async (t, e, n) => {
const {
placement: o = "bottom",
strategy: r = "absolute",
middleware: i = [],
platform: s
} = n, l = i.filter(Boolean), a = await (s.isRTL == null ? void 0 : s.isRTL(e));
let c = await s.getElementRects({
reference: t,
floating: e,
strategy: r
}), {
x: f,
y: u
} = oe(c, o, a), m = o, d = {}, v = 0;
for (let y = 0; y < l.length; y++) {
const {
name: b,
fn: g
} = l[y], {
x: E,
y: p,
data: R,
reset: w
} = await g({
x: f,
y: u,
initialPlacement: o,
placement: m,
strategy: r,
middlewareData: d,
rects: c,
platform: s,
elements: {
reference: t,
floating: e
}
});
f = E ?? f, u = p ?? u, d = {
...d,
[b]: {
...d[b],
...R
}
}, w && v <= 50 && (v++, typeof w == "object" && (w.placement && (m = w.placement), w.rects && (c = w.rects === !0 ? await s.getElementRects({
reference: t,
floating: e,
strategy: r
}) : w.rects), {
x: f,
y: u
} = oe(c, m, a)), y = -1);
}
return {
x: f,
y: u,
placement: m,
strategy: r,
middlewareData: d
};
};
async function uo(t, e) {
var n;
e === void 0 && (e = {});
const {
x: o,
y: r,
platform: i,
rects: s,
elements: l,
strategy: a
} = t, {
boundary: c = "clippingAncestors",
rootBoundary: f = "viewport",
elementContext: u = "floating",
altBoundary: m = !1,
padding: d = 0
} = Zt(e, t), v = ao(d), b = l[m ? u === "floating" ? "reference" : "floating" : u], g = Rt(await i.getClippingRect({
element: (n = await (i.isElement == null ? void 0 : i.isElement(b))) == null || n ? b : b.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(l.floating)),
boundary: c,
rootBoundary: f,
strategy: a
})), E = u === "floating" ? {
...s.floating,
x: o,
y: r
} : s.reference, p = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l.floating)), R = await (i.isElement == null ? void 0 : i.isElement(p)) ? await (i.getScale == null ? void 0 : i.getScale(p)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, w = Rt(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: l,
rect: E,
offsetParent: p,
strategy: a
}) : E);
return {
top: (g.top - w.top + v.top) / R.y,
bottom: (w.bottom - g.bottom + v.bottom) / R.y,
left: (g.left - w.left + v.left) / R.x,
right: (w.right - g.right + v.right) / R.x
};
}
const mo = function(t) {
return t === void 0 && (t = {}), {
name: "flip",
options: t,
async fn(e) {
var n, o;
const {
placement: r,
middlewareData: i,
rects: s,
initialPlacement: l,
platform: a,
elements: c
} = e, {
mainAxis: f = !0,
crossAxis: u = !0,
fallbackPlacements: m,
fallbackStrategy: d = "bestFit",
fallbackAxisSideDirection: v = "none",
flipAlignment: y = !0,
...b
} = Zt(t, e);
if ((n = i.arrow) != null && n.alignmentOffset)
return {};
const g = at(r), E = at(l) === l, p = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), R = m || (E || !y ? [Et(l)] : io(l));
!m && v !== "none" && R.push(...lo(l, y, v, p));
const w = [l, ...R], A = await uo(e, b), S = [];
let N = ((o = i.flip) == null ? void 0 : o.overflows) || [];
if (f && S.push(A[g]), u) {
const V = ro(r, s, p);
S.push(A[V[0]], A[V[1]]);
}
if (N = [...N, {
placement: r,
overflows: S
}], !S.every((V) => V <= 0)) {
var it, G;
const V = (((it = i.flip) == null ? void 0 : it.index) || 0) + 1, z = w[V];
if (z)
return {
data: {
index: V,
overflows: N
},
reset: {
placement: z
}
};
let I = (G = N.filter((H) => H.overflows[0] <= 0).sort((H, L) => H.overflows[1] - L.overflows[1])[0]) == null ? void 0 : G.placement;
if (!I)
switch (d) {
case "bestFit": {
var Y;
const H = (Y = N.map((L) => [L.placement, L.overflows.filter((W) => W > 0).reduce((W, T) => W + T, 0)]).sort((L, W) => L[1] - W[1])[0]) == null ? void 0 : Y[0];
H && (I = H);
break;
}
case "initialPlacement":
I = l;
break;
}
if (r !== I)
return {
reset: {
placement: I
}
};
}
return {};
}
};
};
async function po(t, e) {
const {
placement: n,
platform: o,
elements: r
} = t, i = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), s = at(n), l = Tt(n), a = Xt(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, f = i && a ? -1 : 1, u = Zt(e, t);
let {
mainAxis: m,
crossAxis: d,
alignmentAxis: v
} = typeof u == "number" ? {
mainAxis: u,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: 0,
crossAxis: 0,
alignmentAxis: null,
...u
};
return l && typeof v == "number" && (d = l === "end" ? v * -1 : v), a ? {
x: d * f,
y: m * c
} : {
x: m * c,
y: d * f
};
}
const go = function(t) {
return t === void 0 && (t = 0), {
name: "offset",
options: t,
async fn(e) {
var n, o;
const {
x: r,
y: i,
placement: s,
middlewareData: l
} = e, a = await po(e, t);
return s === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
x: r + a.x,
y: i + a.y,
data: {
...a,
placement: s
}
};
}
};
};
function Ue(t) {
const e = B(t);
let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
const r = X(t), i = r ? t.offsetWidth : n, s = r ? t.offsetHeight : o, l = bt(n) !== i || bt(o) !== s;
return l && (n = i, o = s), {
width: n,
height: o,
$: l
};
}
function Yt(t) {
return F(t) ? t : t.contextElement;
}
function lt(t) {
const e = Yt(t);
if (!X(e))
return et(1);
const n = e.getBoundingClientRect(), {
width: o,
height: r,
$: i
} = Ue(e);
let s = (i ? bt(n.width) : n.width) / o, l = (i ? bt(n.height) : n.height) / r;
return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
x: s,
y: l
};
}
const ho = /* @__PURE__ */ et(0);
function qe(t) {
const e = $(t);
return !_t() || !e.visualViewport ? ho : {
x: e.visualViewport.offsetLeft,
y: e.visualViewport.offsetTop
};
}
function vo(t, e, n) {
return e === void 0 && (e = !1), !n || e && n !== $(t) ? !1 : e;
}
function rt(t, e, n, o) {
e === void 0 && (e = !1), n === void 0 && (n = !1);
const r = t.getBoundingClientRect(), i = Yt(t);
let s = et(1);
e && (o ? F(o) && (s = lt(o)) : s = lt(t));
const l = vo(i, n, o) ? qe(i) : et(0);
let a = (r.left + l.x) / s.x, c = (r.top + l.y) / s.y, f = r.width / s.x, u = r.height / s.y;
if (i) {
const m = $(i), d = o && F(o) ? $(o) : o;
let v = m, y = v.frameElement;
for (; y && o && d !== v; ) {
const b = lt(y), g = y.getBoundingClientRect(), E = B(y), p = g.left + (y.clientLeft + parseFloat(E.paddingLeft)) * b.x, R = g.top + (y.clientTop + parseFloat(E.paddingTop)) * b.y;
a *= b.x, c *= b.y, f *= b.x, u *= b.y, a += p, c += R, v = $(y), y = v.frameElement;
}
}
return Rt({
width: f,
height: u,
x: a,
y: c
});
}
const yo = [":popover-open", ":modal"];
function Ge(t) {
return yo.some((e) => {
try {
return t.matches(e);
} catch {
return !1;
}
});
}
function wo(t) {
let {
elements: e,
rect: n,
offsetParent: o,
strategy: r
} = t;
const i = r === "fixed", s = q(o), l = e ? Ge(e.floating) : !1;
if (o === s || l && i)
return n;
let a = {
scrollLeft: 0,
scrollTop: 0
}, c = et(1);
const f = et(0), u = X(o);
if ((u || !u && !i) && ((tt(o) !== "body" || gt(s)) && (a = At(o)), X(o))) {
const m = rt(o);
c = lt(o), f.x = m.x + o.clientLeft, f.y = m.y + o.clientTop;
}
return {
width: n.width * c.x,
height: n.height * c.y,
x: n.x * c.x - a.scrollLeft * c.x + f.x,
y: n.y * c.y - a.scrollTop * c.y + f.y
};
}
function xo(t) {
return Array.from(t.getClientRects());
}
function Je(t) {
return rt(q(t)).left + At(t).scrollLeft;
}
function bo(t) {
const e = q(t), n = At(t), o = t.ownerDocument.body, r = st(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), i = st(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
let s = -n.scrollLeft + Je(t);
const l = -n.scrollTop;
return B(o).direction === "rtl" && (s += st(e.clientWidth, o.clientWidth) - r), {
width: r,
height: i,
x: s,
y: l
};
}
function Eo(t, e) {
const n = $(t), o = q(t), r = n.visualViewport;
let i = o.clientWidth, s = o.clientHeight, l = 0, a = 0;
if (r) {
i = r.width, s = r.height;
const c = _t();
(!c || c && e === "fixed") && (l = r.offsetLeft, a = r.offsetTop);
}
return {
width: i,
height: s,
x: l,
y: a
};
}
function Ro(t, e) {
const n = rt(t, !0, e === "fixed"), o = n.top + t.clientTop, r = n.left + t.clientLeft, i = X(t) ? lt(t) : et(1), s = t.clientWidth * i.x, l = t.clientHeight * i.y, a = r * i.x, c = o * i.y;
return {
width: s,
height: l,
x: a,
y: c
};
}
function re(t, e, n) {
let o;
if (e === "viewport")
o = Eo(t, n);
else if (e === "document")
o = bo(q(t));
else if (F(e))
o = Ro(e, n);
else {
const r = qe(t);
o = {
...e,
x: e.x - r.x,
y: e.y - r.y
};
}
return Rt(o);
}
function Ke(t, e) {
const n = ct(t);
return n === e || !F(n) || Pt(n) ? !1 : B(n).position === "fixed" || Ke(n, e);
}
function Co(t, e) {
const n = e.get(t);
if (n)
return n;
let o = pt(t, [], !1).filter((l) => F(l) && tt(l) !== "body"), r = null;
const i = B(t).position === "fixed";
let s = i ? ct(t) : t;
for (; F(s) && !Pt(s); ) {
const l = B(s), a = Wt(s);
!a && l.position === "fixed" && (r = null), (i ? !a && !r : !a && l.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || gt(s) && !a && Ke(t, s)) ? o = o.filter((f) => f !== s) : r = l, s = ct(s);
}
return e.set(t, o), o;
}
function Oo(t) {
let {
element: e,
boundary: n,
rootBoundary: o,
strategy: r
} = t;
const s = [...n === "clippingAncestors" ? Co(e, this._c) : [].concat(n), o], l = s[0], a = s.reduce((c, f) => {
const u = re(e, f, r);
return c.top = st(u.top, c.top), c.right = Ft(u.right, c.right), c.bottom = Ft(u.bottom, c.bottom), c.left = st(u.left, c.left), c;
}, re(e, l, r));
return {
width: a.right - a.left,
height: a.bottom - a.top,
x: a.left,
y: a.top
};
}
function Mo(t) {
const {
width: e,
height: n
} = Ue(t);
return {
width: e,
height: n
};
}
function Po(t, e, n) {
const o = X(e), r = q(e), i = n === "fixed", s = rt(t, !0, i, e);
let l = {
scrollLeft: 0,
scrollTop: 0
};
const a = et(0);
if (o || !o && !i)
if ((tt(e) !== "body" || gt(r)) && (l = At(e)), o) {
const u = rt(e, !0, i, e);
a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
} else
r && (a.x = Je(r));
const c = s.left + l.scrollLeft - a.x, f = s.top + l.scrollTop - a.y;
return {
x: c,
y: f,
width: s.width,
height: s.height
};
}
function ie(t, e) {
return !X(t) || B(t).position === "fixed" ? null : e ? e(t) : t.offsetParent;
}
function Qe(t, e) {
const n = $(t);
if (!X(t) || Ge(t))
return n;
let o = ie(t, e);
for (; o && Jn(o) && B(o).position === "static"; )
o = ie(o, e);
return o && (tt(o) === "html" || tt(o) === "body" && B(o).position === "static" && !Wt(o)) ? n : o || Qn(t) || n;
}
const Ao = async function(t) {
const e = this.getOffsetParent || Qe, n = this.getDimensions;
return {
reference: Po(t.reference, await e(t.floating), t.strategy),
floating: {
x: 0,
y: 0,
...await n(t.floating)
}
};
};
function To(t) {
return B(t).direction === "rtl";
}
const So = {
convertOffsetParentRelativeRectToViewportRelativeRect: wo,
getDocumentElement: q,
getClippingRect: Oo,
getOffsetParent: Qe,
getElementRects: Ao,
getClientRects: xo,
getDimensions: Mo,
getScale: lt,
isElement: F,
isRTL: To
};
function Lo(t, e) {
let n = null, o;
const r = q(t);
function i() {
var l;
clearTimeout(o), (l = n) == null || l.disconnect(), n = null;
}
function s(l, a) {
l === void 0 && (l = !1), a === void 0 && (a = 1), i();
const {
left: c,
top: f,
width: u,
height: m
} = t.getBoundingClientRect();
if (l || e(), !u || !m)
return;
const d = yt(f), v = yt(r.clientWidth - (c + u)), y = yt(r.clientHeight - (f + m)), b = yt(c), E = {
rootMargin: -d + "px " + -v + "px " + -y + "px " + -b + "px",
threshold: st(0, Ft(1, a)) || 1
};
let p = !0;
function R(w) {
const A = w[0].intersectionRatio;
if (A !== a) {
if (!p)
return s();
A ? s(!1, A) : o = setTimeout(() => {
s(!1, 1e-7);
}, 100);
}
p = !1;
}
try {
n = new IntersectionObserver(R, {
...E,
// Handle <iframe>s
root: r.ownerDocument
});
} catch {
n = new IntersectionObserver(R, E);
}
n.observe(t);
}
return s(!0), i;
}
function No(t, e, n, o) {
o === void 0 && (o = {});
const {
ancestorScroll: r = !0,
ancestorResize: i = !0,
elementResize: s = typeof ResizeObserver == "function",
layoutShift: l = typeof IntersectionObserver == "function",
animationFrame: a = !1
} = o, c = Yt(t), f = r || i ? [...c ? pt(c) : [], ...pt(e)] : [];
f.forEach((g) => {
r && g.addEventListener("scroll", n, {
passive: !0
}), i && g.addEventListener("resize", n);
});
const u = c && l ? Lo(c, n) : null;
let m = -1, d = null;
s && (d = new ResizeObserver((g) => {
let [E] = g;
E && E.target === c && d && (d.unobserve(e), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
var p;
(p = d) == null || p.observe(e);
})), n();
}), c && !a && d.observe(c), d.observe(e));
let v, y = a ? rt(t) : null;
a && b();
function b() {
const g = rt(t);
y && (g.x !== y.x || g.y !== y.y || g.width !== y.width || g.height !== y.height) && n(), y = g, v = requestAnimationFrame(b);
}
return n(), () => {
var g;
f.forEach((E) => {
r && E.removeEventListener("scroll", n), i && E.removeEventListener("resize", n);
}), u == null || u(), (g = d) == null || g.disconnect(), d = null, a && cancelAnimationFrame(v);
};
}
const jo = mo, Do = (t, e, n) => {
const o = /* @__PURE__ */ new Map(), r = {
platform: So,
...n
}, i = {
...r.platform,
_c: o
};
return fo(t, e, {
...r,
platform: i
});
};
var wt = typeof document < "u" ? He : We;
function Ct(t, e) {
if (t === e)
return !0;
if (typeof t != typeof e)
return !1;
if (typeof t == "function" && t.toString() === e.toString())
return !0;
let n, o, r;
if (t && e && typeof t == "object") {
if (Array.isArray(t)) {
if (n = t.length, n !== e.length)
return !1;
for (o = n; o-- !== 0; )
if (!Ct(t[o], e[o]))
return !1;
return !0;
}
if (r = Object.keys(t), n = r.length, n !== Object.keys(e).length)
return !1;
for (o = n; o-- !== 0; )
if (!{}.hasOwnProperty.call(e, r[o]))
return !1;
for (o = n; o-- !== 0; ) {
const i = r[o];
if (!(i === "_owner" && t.$$typeof) && !Ct(t[i], e[i]))
return !1;
}
return !0;
}
return t !== t && e !== e;
}
function tn(t) {
return typeof window > "u" ? 1 : (t.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function se(t, e) {
const n = tn(t);
return Math.round(e * n) / n;
}
function Lt(t) {
const e = h.useRef(t);
return wt(() => {
e.current = t;
}), e;
}
function Fo(t) {
t === void 0 && (t = {});
const {
placement: e = "bottom",
strategy: n = "absolute",
middleware: o = [],
platform: r,
elements: {
reference: i,
floating: s
} = {},
transform: l = !0,
whileElementsMounted: a,
open: c
} = t, [f, u] = h.useState({
x: 0,
y: 0,
strategy: n,
placement: e,
middlewareData: {},
isPositioned: !1
}), [m, d] = h.useState(o);
Ct(m, o) || d(o);
const [v, y] = h.useState(null), [b, g] = h.useState(null), E = h.useCallback((T) => {
T !== A.current && (A.current = T, y(T));
}, []), p = h.useCallback((T) => {
T !== S.current && (S.current = T, g(T));
}, []), R = i || v, w = s || b, A = h.useRef(null), S = h.useRef(null), N = h.useRef(f), it = a != null, G = Lt(a), Y = Lt(r), V = Lt(c), z = h.useCallback(() => {
if (!A.current || !S.current)
return;
const T = {
placement: e,
strategy: n,
middleware: m
};
Y.current && (T.platform = Y.current), Do(A.current, S.current, T).then((J) => {
const K = {
...J,
// The floating element's position may be recomputed while it's closed
// but still mounted (such as when transitioning out). To ensure
// `isPositioned` will be `false` initially on the next open, avoid
// setting it to `true` when `open === false` (must be specified).
isPositioned: V.current !== !1
};
I.current && !Ct(N.current, K) && (N.current = K, kn.flushSync(() => {
u(K);
}));
});
}, [m, e, n, Y, V]);
wt(() => {
c === !1 && N.current.isPositioned && (N.current.isPositioned = !1, u((T) => ({
...T,
isPositioned: !1
})));
}, [c]);
const I = h.useRef(!1);
wt(() => (I.current = !0, () => {
I.current = !1;
}), []), wt(() => {
if (R && (A.current = R), w && (S.current = w), R && w) {
if (G.current)
return G.current(R, w, z);
z();
}
}, [R, w, z, G, it]);
const H = h.useMemo(() => ({
reference: A,
floating: S,
setReference: E,
setFloating: p
}), [E, p]), L = h.useMemo(() => ({
reference: R,
floating: w
}), [R, w]), W = h.useMemo(() => {
const T = {
position: n,
left: 0,
top: 0
};
if (!L.floating)
return T;
const J = se(L.floating, f.x), K = se(L.floating, f.y);
return l ? {
...T,
transform: "translate(" + J + "px, " + K + "px)",
...tn(L.floating) >= 1.5 && {
willChange: "transform"
}
} : {
position: n,
left: J,
top: K
};
}, [n, l, L.floating, f.x, f.y]);
return h.useMemo(() => ({
...f,
update: z,
refs: H,
elements: L,
floatingStyles: W
}), [f, z, H, L, W]);
}
const Io = (t, e) => ({
...go(t),
options: [t, e]
}), ko = (t, e) => ({
...jo(t),
options: [t, e]
}), en = {
...h
}, $o = en.useInsertionEffect, Vo = $o || ((t) => t());
function Bo(t) {
const e = h.useRef(() => {
if (Ht.env.NODE_ENV !== "production")
throw new Error("Cannot call an event handler while rendering.");
});
return Vo(() => {
e.current = t;
}), h.useCallback(function() {
for (var n = arguments.length, o = new Array(n), r = 0; r < n; r++)
o[r] = arguments[r];
return e.current == null ? void 0 : e.current(...o);
}, []);
}
var kt = typeof document < "u" ? He : We;
let le = !1, zo = 0;
const ce = () => (
// Ensure the id is unique with multiple independent versions of Floating UI
// on <React 18
"floating-ui-" + Math.random().toString(36).slice(2, 6) + zo++
);
function Ho() {
const [t, e] = h.useState(() => le ? ce() : void 0);
return kt(() => {
t == null && e(ce());
}, []), h.useEffect(() => {
le = !0;
}, []), t;
}
const Wo = en.useId, _o = Wo || Ho;
let $t;
Ht.env.NODE_ENV !== "production" && ($t = /* @__PURE__ */ new Set());
function Zo() {
for (var t, e = arguments.length, n = new Array(e), o = 0; o < e; o++)
n[o] = arguments[o];
const r = "Floating UI: " + n.join(" ");
if (!((t = $t) != null && t.has(r))) {
var i;
(i = $t) == null || i.add(r), console.error(r);
}
}
function Xo() {
const t = /* @__PURE__ */ new Map();
return {
emit(e, n) {
var o;
(o = t.get(e)) == null || o.forEach((r) => r(n));
},
on(e, n) {
t.set(e, [...t.get(e) || [], n]);
},
off(e, n) {
var o;
t.set(e, ((o = t.get(e)) == null ? void 0 : o.filter((r) => r !== n)) || []);
}
};
}
const Yo = /* @__PURE__ */ h.createContext(null), Uo = /* @__PURE__ */ h.createContext(null), qo = () => {
var t;
return ((t = h.useContext(Yo)) == null ? void 0 : t.id) || null;
}, Go = () => h.useContext(Uo);
function Jo(t) {
const {
open: e = !1,
onOpenChange: n,
elements: o
} = t, r = _o(), i = h.useRef({}), [s] = h.useState(() => Xo()), l = qo() != null;
if (Ht.env.NODE_ENV !== "production") {
const d = o.reference;
d && !F(d) && Zo("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
}
const [a, c] = h.useState(o.reference), f = Bo((d, v, y) => {
i.current.openEvent = d ? v : void 0, s.emit("openchange", {
open: d,
event: v,
reason: y,
nested: l
}), n == null || n(d, v, y);
}), u = h.useMemo(() => ({
setPositionReference: c
}), []), m = h.useMemo(() => ({
reference: a || o.reference || null,
floating: o.floating || null,
domReference: o.reference
}), [a, o.reference, o.floating]);
return h.useMemo(() => ({
dataRef: i,
open: e,
onOpenChange: f,
elements: m,
events: s,
floatingId: r,
refs: u
}), [e, f, m, s, r, u]);
}
function Ko(t) {
t === void 0 && (t = {});
const {
nodeId: e
} = t, n = Jo({
...t,
elements: {
reference: null,
floating: null,
...t.elements
}
}), o = t.rootContext || n, r = o.elements, [i, s] = h.useState(null), [l, a] = h.useState(null), f = (r == null ? void 0 : r.domReference) || i, u = h.useRef(null), m = Go();
kt(() => {
f && (u.current = f);
}, [f]);
const d = Fo({
...t,
elements: {
...r,
...l && {
reference: l
}
}
}), v = h.useCallback((p) => {
const R = F(p) ? {
getBoundingClientRect: () => p.getBoundingClientRect(),
contextElement: p
} : p;
a(R), d.refs.setReference(R);
}, [d.refs]), y = h.useCallback((p) => {
(F(p) || p === null) && (u.current = p, s(p)), (F(d.refs.reference.current) || d.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
// `null` to support `positionReference` + an unstable `reference`
// callback ref.
p !== null && !F(p)) && d.refs.setReference(p);
}, [d.refs]), b = h.useMemo(() => ({
...d.refs,
setReference: y,
setPositionReference: v,
domReference: u
}), [d.refs, y, v]), g = h.useMemo(() => ({
...d.elements,
domReference: f
}), [d.elements, f]), E = h.useMemo(() => ({
...d,
...o,
refs: b,
elements: g,
nodeId: e
}), [d, b, g, e, o]);
return kt(() => {
o.dataRef.current.floatingContext = E;
const p = m == null ? void 0 : m.nodesRef.current.find((R) => R.id === e);
p && (p.context = E);
}), h.useMemo(() => ({
...d,
context: E,
refs: b,
elements: g
}), [d, b, g, E]);
}
function ae(t, e) {
var n = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(t);
e && (o = o.filter(function(r) {
return Object.getOwnPropertyDescriptor(t, r).enumerable;
})), n.push.apply(n, o);
}
return n;
}
function ft(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e] != null ? arguments[e] : {};
e % 2 ? ae(Object(n), !0).forEach(function(o) {
xt(t, o, n[o]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ae(Object(n)).forEach(function(o) {
Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(n, o));
});
}
return t;
}
function Qo(t) {
var e = function(n, o) {
if (typeof n != "object" || !n)
return n;
var r = n[Symbol.toPrimitive];
if (r !== void 0) {
var i = r.call(n, o);
if (typeof i != "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(n);
}(t, "string");
return typeof e == "symbol" ? e : e + "";
}
function xt(t, e, n) {
return (e = Qo(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
}
function Vt() {
return Vt = Object.assign ? Object.assign.bind() : function(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e];
for (var o in n)
Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
}
return t;
}, Vt.apply(this, arguments);
}
function Nt(t, e) {
if (t == null)
return {};
var n, o, r = function(s, l) {
if (s == null)
return {};
var a, c, f = {}, u = Object.keys(s);
for (c = 0; c < u.length; c++)
a = u[c], l.indexOf(a) >= 0 || (f[a] = s[a]);
return f;
}(t, e);
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(t);
for (o = 0; o < i.length; o++)
n = i[o], e.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(t, n) && (r[n] = t[n]);
}
return r;
}
function O(t, e) {
return e || (e = t.slice(0)), Object.freeze(Object.defineProperties(t, { raw: { value: Object.freeze(e) } }));
}
function mt(t, e) {
return function(n) {
if (Array.isArray(n))
return n;
}(t) || function(n, o) {
var r = n == null ? null : typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"];
if (r != null) {
var i, s, l, a, c = [], f = !0, u = !1;
try {
if (l = (r = r.call(n)).next, o !== 0)
for (; !(f = (i = l.call(r)).done) && (c.push(i.value), c.length !== o); f = !0)
;
} catch (m) {
u = !0, s = m;
} finally {
try {
if (!f && r.return != null && (a = r.return(), Object(a) !== a))
return;
} finally {
if (u)
throw s;
}
}
return c;
}
}(t, e) || function(n, o) {
if (n) {
if (typeof n == "string")
return fe(n, o);
var r = Object.prototype.toString.call(n).slice(8, -1);
if (r === "Object" && n.constructor && (r = n.constructor.name), r === "Map" || r === "Set")
return Array.from(n);
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
return fe(n, o);
}
}(t, e) || function() {
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}();
}
function fe(t, e) {
e > t.length && (e = t.length);
for (var n = 0, o = new Array(e); n < e; n++)
o[n] = t[n];
return o;
}
var Z = { Inline: "inline", Portal: "portal", TopLayer: "top-layer" }, tr = { Auto: "auto", Manual: "manual" }, k = { Top: "top", Bottom: "bottom", Left: "left", Right: "right", CenterVertical: "center-vertical", CenterHorizontal: "center-horizontal" }, dt = { Start: "start", Middle: "middle", End: "end" }, ue = "top", de = "bottom", Bt = "left", zt = "right", jt = "center", er = { top: 0, bottom: 0, left: 0, right: 0, height: 0, width: 0 }, nr = function(t, e) {
var n = t.getBoundingClientRect(), o = n.top, r = n.bottom, i = n.left, s = n.right, l = n.width;
return { top: o, bottom: r, left: i, right: s, height: t.offsetHeight, width: l };
}, me, pe, ge, he, ve, ye, we, xe, be, Ee, Re, Ce, Oe, Me, Pe, Ae, Te, Se, Le, Ne, je, De, Fe, Ie, ke, $e, Ve, Be, ze, or = function(t, e) {
return t === k.CenterHorizontal && (t = k.Right), t === k.CenterVertical && (t = k.Bottom), e === dt.Middle ? t : "".concat(t, "-").concat(e);
}, rr = ["renderMode", "dismissMode", "onToggle", "portalClassName", "portalContainer", "portalRef", "scrollContainer", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "popoverZIndex", "spacing"];
function ir(t, e) {
var n = mt(ee(null), 2), o = n[0], r = n[1], i = mt(ee(null), 2), s = i[0], l = i[1];
Zn(function() {
if (t && t.current)
l(t.current);
else {
var c = o !== null && o.parentNode;
c && c instanceof HTMLElement && l(c);
}
}, [o, t]);
var a = Xn(Fn(function() {
return function(c, f, u) {
if (!c)
return er;
var m = nr(c), d = m.top, v = m.bottom, y = m.left, b = m.right, g = m.height, E = m.width;
if (f) {
var p = f.scrollTop, R = f.scrollLeft, w = f.getBoundingClientRect();
return { top: d + p - w.top, bottom: v + p - w.bottom, left: y + R - w.left, right: b + R - w.right, height: g, width: E };
}
var A = window, S = A.scrollX, N = A.scrollY;
return { top: d + N, bottom: v + N, left: y + S, right: b + S, height: g, width: E };
}(s, e);
}, [s, e]));
return { referenceElement: s, referenceElDocumentPos: a, setPlaceholderElement: r };
}
var ot = 0.8, Ot = Yn.default, sr = $n("popover-content"), lr = C(me || (me = O([`
display: none;
`]))), cr = C(pe || (pe = O([`
margin: 0;
border: none;
padding: 0;
overflow: visible;
background-color: transparent;
width: max-content;
transition-property: opacity, transform, overlay, display;
transition-duration: `, `ms;
transition-timing-function: ease-in-out;
transition-behavior: allow-discrete;
opacity: 0;
transform: scale(`, `);
&::backdrop {
transition-property: background, overlay, display;
transition-duration: `, `ms;
transition-timing-function: ease-in-out;
transition-behavior: allow-discrete;
}
@starting-style {
:popover-open {
opacity: 0;
transform: scale(`, `);
}
}
`])), Ot, ot, Ot, ot), ar = { top: C(he || (he = O([`
transform-origin: bottom;
`]))), "top-start": C(ve || (ve = O([`
transform-origin: bottom left;
`]))), "top-end": C(ye || (ye = O([`
transform-origin: bottom right;
`]))), bottom: C(we || (we = O([`
transform-origin: top;
`]))), "bottom-start": C(xe || (xe = O([`
transform-origin: top left;
`]))), "bottom-end": C(be || (be = O([`
transform-origin: top right;
`]))), left: C(Ee || (Ee = O([`
transform-origin: right;
`]))), "left-start": C(Re || (Re = O([`
transform-origin: right top;
`]))), "left-end": C(Ce || (Ce = O([`
transform-origin: right bottom;
`]))), right: C(Oe || (Oe = O([`
transform-origin: left;
`]))), "right-start": C(Me || (Me = O([`
transform-origin: left top;
`]))), "right-end": C(Pe || (Pe = O([`
transform-origin: left bottom;
`]))), center: C(Ae || (Ae = O([`
transform-origin: center;
`]))), "center-start": C(Te || (Te = O([`
transform-origin: top;
`]))), "center-end": C(Se || (Se = O([`
transform-origin: bottom;
`]))) }, ut = C(Le || (Le = O([`
opacity: 0;
`]))), Dt = C(ke || (ke = O([`
opacity: 1;
pointer-events: initial;
&:popover-open {
opacity: 1;
pointer-events: initial;
}
`]))), fr = function(t) {
var e = t.className, n = t.left, o = t.placement, r = t.popoverZIndex, i = t.position, s = t.spacing, l = t.state, a = t.top, c = t.transformAlign;
return U(cr, function(f) {
var u = f.left, m = f.position, d = f.top;
return C(ge || (ge = O([`
left: `, `px;
position: `, `;
top: `, `px;
`])), u, m, d);
}({ left: n, position: i, top: a }), ar[o], xt(xt(xt({}, function(f, u) {
switch (u) {
case ue:
return U(ut, C(Ne || (Ne = O([`
transform: translate3d(0, `, `px, 0)
scale(`, `);
`])), f, ot));
case de:
return U(ut, C(je || (je = O([`
transform: translate3d(0, -`, `px, 0)
scale(`, `);
`])), f, ot));
case Bt:
return U(ut, C(De || (De = O([`
transform: translate3d(`, `px, 0, 0)
scale(`, `);
`])), f, ot));
case zt:
return U(ut, C(Fe || (Fe = O([`
transform: translate3d(-`, `px, 0, 0)
scale(`, `);
`])), f, ot));
default:
return U(ut, C(Ie || (Ie = O([`
transform: scale(`, `);
`])), ot));
}
}(s, c), l !== "entered"), function(f) {
switch (f) {
case ue:
case de:
return U(Dt, C($e || ($e = O([`
transform: translateY(0) scale(1);
&:popover-open {
transform: translateY(0) scale(1);
}
`]))));
case Bt:
case zt:
return U(Dt, C(Ve || (Ve = O([`
transform: translateX(0) scale(1);
&:popover-open {
transform: translateX(0) scale(1);
}
`]))));
default:
return U(Dt, C(Be || (Be = O([`
transform: scale(1);
&:popover-open {
transform: scale(1);
}
`]))));
}
}(c), l === "entered"), C(ze || (ze = O([`
z-index: `, `;
`])), r), typeof r == "number"), e);
}, ur = ["active", "adjustOnMutation", "align", "children", "className", "justify", "refEl"], dr = ["renderMode", "dismissMode", "onToggle", "usePortal", "portalClassName", "portalContainer", "portalRef", "scrollContainer", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "popoverZIndex", "spacing"], mr = jn(function(t, e) {
var n = t.active, o = n !== void 0 && n;
t.adjustOnMutation;
var r = t.align, i = r === void 0 ? k.Bottom : r, s = t.children, l = t.className, a = t.justify, c = a === void 0 ? dt.Start : a, f = t.refEl, u = function(x) {
var P = x.renderMode, M = x.dismissMode, j = x.onToggle, Q = x.portalClassName, vt = x.portalContainer, vn = x.portalRef, yn = x.scrollContainer, wn = x.onEnter, xn = x.onEntering, bn = x.onEntered, En = x.onExit, Rn = x.onExiting, Cn = x.onExited, On = x.popoverZIndex, Mn = x.spacing, Pn = Nt(x, rr), An = Vn().forceUseTopLayer, D = Bn(), Kt = zn(), St = An ? Z.TopLayer : P || D.renderMode, Qt = St === Z.Portal, te = St === Z.TopLayer, Tn = te ? { dismissMode: M || D.dismissMode, onToggle: j || D.onToggle } : {}, Sn = Qt ? { portalClassName: Q || D.portalClassName, portalContainer: vt || D.portalContainer || Kt.portalContainer, portalRef: vn || D.portalRef, scrollContainer: yn || D.scrollContainer || Kt.scrollContainer } : {}, Ln = { onEnter: wn || D.onEnter, onEntering: xn || D.onEntering, onEntered: bn || D.onEntered, onExit: En || D.onExit, onExiting: Rn || D.onExiting, onExited: Cn || D.onExited }, Nn = { popoverZIndex: te ? void 0 : On || D.popoverZIndex, spacing: Mn || D.spacing };
return ft(ft(ft(ft(ft({ renderMode: St, usePortal: Qt }, Tn), Sn), Ln), Nn), Pn);
}(Nt(t, ur)), m = u.renderMode, d = m === void 0 ? Z.TopLayer : m, v = u.dismissMode, y = v === void 0 ? tr.Auto : v, b = u.onToggle, g = u.usePortal, E = u.portalClassName, p = u.portalContainer, R = u.portalRef, w = u.scrollContainer, A = u.onEnter, S = u.onEntering, N = u.onEntered, it = u.onExit, G = u.onExiting, Y = u.onExited, V = u.popoverZIndex, z = u.spacing, I = z === void 0 ? Un[100] : z, H = Nt(u, dr), L = Hn().setIsPopoverOpen;
g && w && (w.contains(p) || Wn.warn("To ensure correct positioning make sure that the portalContainer element is inside of the scrollContainer"));
var W = g ? qn : In, T = g ? { className: p ? void 0 : E, container: p ?? void 0, portalRef: R } : {}, J = ir(f, w), K = J.referenceElement, nn = J.referenceElDocumentPos, on = J.setPlaceholderElement, Ut = function() {
var x = mt(_.useState(null), 2), P = x[0], M = x[1], j = Dn(P);
return j.current = P, { contentNode: P, contentNodeRef: j, setContentNode: M };
}(), rn = Ut.contentNodeRef, sn = Ut.setContentNode, nt = Ko({ elements: { reference: K }, middleware: [Io(function(x) {
var P = x.rects;
return function(M, j, Q) {
return M === k.CenterHorizontal ? -Q.reference.width / 2 - Q.floating.width / 2 : M === k.CenterVertical ? -Q.reference.height / 2 - Q.floating.height / 2 : j;
}(i, I, P);
}, [i, I]), ko({ boundary: w ?? "clippingAncestors" })], open: o, placement: or(i, c), strategy: d === Z.TopLayer ? "fixed" : "absolute", transform: !1, whileElementsMounted: No }), ln = nt.context, ht = nt.elements, qt = nt.placement, cn = nt.refs, an = nt.strategy, fn = nt.x, un = nt.y, dn = _n([cn.setFloating, e]), Gt = function(x) {
var P = mt(x.split("-"), 2), M = P[0], j = P[1];
return { align: M, justify: j || dt.Middle };
}(qt), mn = Gt.align, pn = Gt.justify, Jt = function(x) {
var P = x.placement, M = x.align, j = mt(P.split("-"), 2), Q = j[0], vt = j[1];
if (M !== k.CenterHorizontal && M !== k.CenterVertical)
return { placement: P, transformAlign: Q };
if (vt === dt.Start) {
if (M === k.CenterHorizontal)
return { placement: "center-start", transformAlign: jt };
if (M === k.CenterVertical)
return { placement: "right", transformAlign: zt };
}
if (vt === dt.End) {
if (M === k.CenterHorizontal)
return { placement: "center-end", transformAlign: jt };
if (M === k.CenterVertical)
return { placement: "left", transformAlign: Bt };
}
return { placement: "center", transformAlign: jt };
}({ placement: qt, align: i }), gn = Jt.placement, hn = Jt.transformAlign;
return _.createElement(_.Fragment, null, _.createElement("span", { ref: on, className: lr }), _.createElement(Gn, { nodeRef: rn, in: ln.open, timeout: { appear: 0, enter: Ot, exit: Ot }, onEnter: A, onEntering: function(x) {
var P, M, j;
d === Z.TopLayer && ((P = ht.floating) === null || P === void 0 || P.addEventListener("toggle", b), (M = ht.floating) === null || M === void 0 || (j = M.showPopover) === null || j === void 0 || j.call(M)), S == null || S(x);
}, onEntered: function(x) {
L(!0), N == null || N(x);
}, onExit: it, onExiting: G, onExited: function() {
var x, P, M;
L(!1), d === Z.TopLayer && ((x = ht.floating) === null || x === void 0 || x.removeEventListener("toggle", b), (P = ht.floating) === null || P === void 0 || (M = P.hidePopover) === null || M === void 0 || M.call(P)), Y == null || Y();
}, mountOnEnter: !0, unmountOnExit: !0, appear: !0 }, function(x) {
return _.createElement(_.Fragment, null, _.createElement(W, T, _.createElement("div", Vt({ ref: dn, className: fr({ className: l, left: fn, placement: gn, popoverZIndex: V, position: an, spacing: I, state: x, top: un, transformAlign: hn }), popover: d === Z.TopLayer ? y : void 0 }, H), _.createElement("div", { ref: sn, className: sr }, s === null ? null : typeof s == "function" ? s({ align: mn, justify: pn, referenceElPos: nn }) : s))));
}));
});
mr.displayName = "Popover";
var wr = function(t) {
var e = t.dismissMode, n = t.onToggle, o = t.portalClassName, r = t.portalContainer, i = t.portalRef, s = t.renderMode, l = t.scrollContainer;
return s === Z.Inline ? { renderMode: s } : s === Z.Portal ? { renderMode: s, portalClassName: o, portalContainer: r, portalRef: i, scrollContainer: l } : { dismissMode: e, onToggle: n, renderMode: s };
};
export {
dt as H,
Z as L,
tr as a,
wr as b,
k,
mr as z
};