mongodb-chatbot-ui
Version:
UI React components for the MongoDB Assistant
1,557 lines • 95.8 kB
JavaScript
import * as k from "react";
import he, { useLayoutEffect as fr, useEffect as Ur, forwardRef as Xr, useState as cn, useRef as Zr, useCallback as Gr, useMemo as Jr, Fragment as Kr } from "react";
import { a as de, ax as Qr, O as eo, ao as Kt, w as be, F as V, X as to, m as X, ay as no, az as ro, aq as oo, Q as io, an as ao, $ as so, aA as lo, z as co, aB as uo, n as Ae } from "./index2.js";
import * as fo from "react-dom";
import gt, { createPortal as po } from "react-dom";
import { a as mo } from "./polished.esm.js";
function go(e, t) {
if (e == null)
return {};
var r = {};
for (var o in e)
if ({}.hasOwnProperty.call(e, o)) {
if (t.indexOf(o) !== -1)
continue;
r[o] = e[o];
}
return r;
}
var zt = { exports: {} }, ht = { exports: {} }, Y = {};
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var un;
function ho() {
if (un)
return Y;
un = 1;
var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, i = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, l = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, u = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, y = e ? Symbol.for("react.suspense_list") : 60120, p = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, x = e ? Symbol.for("react.block") : 60121, R = e ? Symbol.for("react.fundamental") : 60117, T = e ? Symbol.for("react.responder") : 60118, D = e ? Symbol.for("react.scope") : 60119;
function E(g) {
if (typeof g == "object" && g !== null) {
var K = g.$$typeof;
switch (K) {
case t:
switch (g = g.type, g) {
case f:
case d:
case o:
case a:
case i:
case m:
return g;
default:
switch (g = g && g.$$typeof, g) {
case c:
case u:
case S:
case p:
case l:
return g;
default:
return K;
}
}
case r:
return K;
}
}
}
function C(g) {
return E(g) === d;
}
return Y.AsyncMode = f, Y.ConcurrentMode = d, Y.ContextConsumer = c, Y.ContextProvider = l, Y.Element = t, Y.ForwardRef = u, Y.Fragment = o, Y.Lazy = S, Y.Memo = p, Y.Portal = r, Y.Profiler = a, Y.StrictMode = i, Y.Suspense = m, Y.isAsyncMode = function(g) {
return C(g) || E(g) === f;
}, Y.isConcurrentMode = C, Y.isContextConsumer = function(g) {
return E(g) === c;
}, Y.isContextProvider = function(g) {
return E(g) === l;
}, Y.isElement = function(g) {
return typeof g == "object" && g !== null && g.$$typeof === t;
}, Y.isForwardRef = function(g) {
return E(g) === u;
}, Y.isFragment = function(g) {
return E(g) === o;
}, Y.isLazy = function(g) {
return E(g) === S;
}, Y.isMemo = function(g) {
return E(g) === p;
}, Y.isPortal = function(g) {
return E(g) === r;
}, Y.isProfiler = function(g) {
return E(g) === a;
}, Y.isStrictMode = function(g) {
return E(g) === i;
}, Y.isSuspense = function(g) {
return E(g) === m;
}, Y.isValidElementType = function(g) {
return typeof g == "string" || typeof g == "function" || g === o || g === d || g === a || g === i || g === m || g === y || typeof g == "object" && g !== null && (g.$$typeof === S || g.$$typeof === p || g.$$typeof === l || g.$$typeof === c || g.$$typeof === u || g.$$typeof === R || g.$$typeof === T || g.$$typeof === D || g.$$typeof === x);
}, Y.typeOf = E, Y;
}
var B = {}, fn;
function vo() {
return fn || (fn = 1, de.env.NODE_ENV !== "production" && function() {
var e = typeof Symbol == "function" && Symbol.for, t = e ? Symbol.for("react.element") : 60103, r = e ? Symbol.for("react.portal") : 60106, o = e ? Symbol.for("react.fragment") : 60107, i = e ? Symbol.for("react.strict_mode") : 60108, a = e ? Symbol.for("react.profiler") : 60114, l = e ? Symbol.for("react.provider") : 60109, c = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, d = e ? Symbol.for("react.concurrent_mode") : 60111, u = e ? Symbol.for("react.forward_ref") : 60112, m = e ? Symbol.for("react.suspense") : 60113, y = e ? Symbol.for("react.suspense_list") : 60120, p = e ? Symbol.for("react.memo") : 60115, S = e ? Symbol.for("react.lazy") : 60116, x = e ? Symbol.for("react.block") : 60121, R = e ? Symbol.for("react.fundamental") : 60117, T = e ? Symbol.for("react.responder") : 60118, D = e ? Symbol.for("react.scope") : 60119;
function E(b) {
return typeof b == "string" || typeof b == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
b === o || b === d || b === a || b === i || b === m || b === y || typeof b == "object" && b !== null && (b.$$typeof === S || b.$$typeof === p || b.$$typeof === l || b.$$typeof === c || b.$$typeof === u || b.$$typeof === R || b.$$typeof === T || b.$$typeof === D || b.$$typeof === x);
}
function C(b) {
if (typeof b == "object" && b !== null) {
var Te = b.$$typeof;
switch (Te) {
case t:
var Ve = b.type;
switch (Ve) {
case f:
case d:
case o:
case a:
case i:
case m:
return Ve;
default:
var pt = Ve && Ve.$$typeof;
switch (pt) {
case c:
case u:
case S:
case p:
case l:
return pt;
default:
return Te;
}
}
case r:
return Te;
}
}
}
var g = f, K = d, q = c, te = l, pe = t, ne = u, me = o, xe = S, ue = p, re = r, Ee = a, G = i, oe = m, H = !1;
function ae(b) {
return H || (H = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), h(b) || C(b) === f;
}
function h(b) {
return C(b) === d;
}
function w(b) {
return C(b) === c;
}
function F(b) {
return C(b) === l;
}
function M(b) {
return typeof b == "object" && b !== null && b.$$typeof === t;
}
function P(b) {
return C(b) === u;
}
function $(b) {
return C(b) === o;
}
function A(b) {
return C(b) === S;
}
function _(b) {
return C(b) === p;
}
function j(b) {
return C(b) === r;
}
function I(b) {
return C(b) === a;
}
function W(b) {
return C(b) === i;
}
function se(b) {
return C(b) === m;
}
B.AsyncMode = g, B.ConcurrentMode = K, B.ContextConsumer = q, B.ContextProvider = te, B.Element = pe, B.ForwardRef = ne, B.Fragment = me, B.Lazy = xe, B.Memo = ue, B.Portal = re, B.Profiler = Ee, B.StrictMode = G, B.Suspense = oe, B.isAsyncMode = ae, B.isConcurrentMode = h, B.isContextConsumer = w, B.isContextProvider = F, B.isElement = M, B.isForwardRef = P, B.isFragment = $, B.isLazy = A, B.isMemo = _, B.isPortal = j, B.isProfiler = I, B.isStrictMode = W, B.isSuspense = se, B.isValidElementType = E, B.typeOf = C;
}()), B;
}
var dn;
function dr() {
return dn || (dn = 1, de.env.NODE_ENV === "production" ? ht.exports = ho() : ht.exports = vo()), ht.exports;
}
var Mt, pn;
function Qt() {
if (pn)
return Mt;
pn = 1;
var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return Mt = e, Mt;
}
var _t, mn;
function pr() {
return mn || (mn = 1, _t = Function.call.bind(Object.prototype.hasOwnProperty)), _t;
}
var Lt, gn;
function yo() {
if (gn)
return Lt;
gn = 1;
var e = function() {
};
if (de.env.NODE_ENV !== "production") {
var t = Qt(), r = {}, o = pr();
e = function(a) {
var l = "Warning: " + a;
typeof console < "u" && console.error(l);
try {
throw new Error(l);
} catch {
}
};
}
function i(a, l, c, f, d) {
if (de.env.NODE_ENV !== "production") {
for (var u in a)
if (o(a, u)) {
var m;
try {
if (typeof a[u] != "function") {
var y = Error(
(f || "React class") + ": " + c + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw y.name = "Invariant Violation", y;
}
m = a[u](l, u, f, c, null, t);
} catch (S) {
m = S;
}
if (m && !(m instanceof Error) && e(
(f || "React class") + ": type specification of " + c + " `" + u + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof m + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), m instanceof Error && !(m.message in r)) {
r[m.message] = !0;
var p = d ? d() : "";
e(
"Failed " + c + " type: " + m.message + (p ?? "")
);
}
}
}
}
return i.resetWarningCache = function() {
de.env.NODE_ENV !== "production" && (r = {});
}, Lt = i, Lt;
}
var It, hn;
function bo() {
if (hn)
return It;
hn = 1;
var e = dr(), t = Qr, r = Qt(), o = pr(), i = yo(), a = function() {
};
de.env.NODE_ENV !== "production" && (a = function(c) {
var f = "Warning: " + c;
typeof console < "u" && console.error(f);
try {
throw new Error(f);
} catch {
}
});
function l() {
return null;
}
return It = function(c, f) {
var d = typeof Symbol == "function" && Symbol.iterator, u = "@@iterator";
function m(h) {
var w = h && (d && h[d] || h[u]);
if (typeof w == "function")
return w;
}
var y = "<<anonymous>>", p = {
array: T("array"),
bigint: T("bigint"),
bool: T("boolean"),
func: T("function"),
number: T("number"),
object: T("object"),
string: T("string"),
symbol: T("symbol"),
any: D(),
arrayOf: E,
element: C(),
elementType: g(),
instanceOf: K,
node: ne(),
objectOf: te,
oneOf: q,
oneOfType: pe,
shape: xe,
exact: ue
};
function S(h, w) {
return h === w ? h !== 0 || 1 / h === 1 / w : h !== h && w !== w;
}
function x(h, w) {
this.message = h, this.data = w && typeof w == "object" ? w : {}, this.stack = "";
}
x.prototype = Error.prototype;
function R(h) {
if (de.env.NODE_ENV !== "production")
var w = {}, F = 0;
function M($, A, _, j, I, W, se) {
if (j = j || y, W = W || _, se !== r) {
if (f) {
var b = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw b.name = "Invariant Violation", b;
} else if (de.env.NODE_ENV !== "production" && typeof console < "u") {
var Te = j + ":" + _;
!w[Te] && // Avoid spamming the console because they are often not actionable except for lib authors
F < 3 && (a(
"You are manually calling a React.PropTypes validation function for the `" + W + "` prop on `" + j + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), w[Te] = !0, F++);
}
}
return A[_] == null ? $ ? A[_] === null ? new x("The " + I + " `" + W + "` is marked as required " + ("in `" + j + "`, but its value is `null`.")) : new x("The " + I + " `" + W + "` is marked as required in " + ("`" + j + "`, but its value is `undefined`.")) : null : h(A, _, j, I, W);
}
var P = M.bind(null, !1);
return P.isRequired = M.bind(null, !0), P;
}
function T(h) {
function w(F, M, P, $, A, _) {
var j = F[M], I = G(j);
if (I !== h) {
var W = oe(j);
return new x(
"Invalid " + $ + " `" + A + "` of type " + ("`" + W + "` supplied to `" + P + "`, expected ") + ("`" + h + "`."),
{ expectedType: h }
);
}
return null;
}
return R(w);
}
function D() {
return R(l);
}
function E(h) {
function w(F, M, P, $, A) {
if (typeof h != "function")
return new x("Property `" + A + "` of component `" + P + "` has invalid PropType notation inside arrayOf.");
var _ = F[M];
if (!Array.isArray(_)) {
var j = G(_);
return new x("Invalid " + $ + " `" + A + "` of type " + ("`" + j + "` supplied to `" + P + "`, expected an array."));
}
for (var I = 0; I < _.length; I++) {
var W = h(_, I, P, $, A + "[" + I + "]", r);
if (W instanceof Error)
return W;
}
return null;
}
return R(w);
}
function C() {
function h(w, F, M, P, $) {
var A = w[F];
if (!c(A)) {
var _ = G(A);
return new x("Invalid " + P + " `" + $ + "` of type " + ("`" + _ + "` supplied to `" + M + "`, expected a single ReactElement."));
}
return null;
}
return R(h);
}
function g() {
function h(w, F, M, P, $) {
var A = w[F];
if (!e.isValidElementType(A)) {
var _ = G(A);
return new x("Invalid " + P + " `" + $ + "` of type " + ("`" + _ + "` supplied to `" + M + "`, expected a single ReactElement type."));
}
return null;
}
return R(h);
}
function K(h) {
function w(F, M, P, $, A) {
if (!(F[M] instanceof h)) {
var _ = h.name || y, j = ae(F[M]);
return new x("Invalid " + $ + " `" + A + "` of type " + ("`" + j + "` supplied to `" + P + "`, expected ") + ("instance of `" + _ + "`."));
}
return null;
}
return R(w);
}
function q(h) {
if (!Array.isArray(h))
return de.env.NODE_ENV !== "production" && (arguments.length > 1 ? a(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : a("Invalid argument supplied to oneOf, expected an array.")), l;
function w(F, M, P, $, A) {
for (var _ = F[M], j = 0; j < h.length; j++)
if (S(_, h[j]))
return null;
var I = JSON.stringify(h, function(se, b) {
var Te = oe(b);
return Te === "symbol" ? String(b) : b;
});
return new x("Invalid " + $ + " `" + A + "` of value `" + String(_) + "` " + ("supplied to `" + P + "`, expected one of " + I + "."));
}
return R(w);
}
function te(h) {
function w(F, M, P, $, A) {
if (typeof h != "function")
return new x("Property `" + A + "` of component `" + P + "` has invalid PropType notation inside objectOf.");
var _ = F[M], j = G(_);
if (j !== "object")
return new x("Invalid " + $ + " `" + A + "` of type " + ("`" + j + "` supplied to `" + P + "`, expected an object."));
for (var I in _)
if (o(_, I)) {
var W = h(_, I, P, $, A + "." + I, r);
if (W instanceof Error)
return W;
}
return null;
}
return R(w);
}
function pe(h) {
if (!Array.isArray(h))
return de.env.NODE_ENV !== "production" && a("Invalid argument supplied to oneOfType, expected an instance of array."), l;
for (var w = 0; w < h.length; w++) {
var F = h[w];
if (typeof F != "function")
return a(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + H(F) + " at index " + w + "."
), l;
}
function M(P, $, A, _, j) {
for (var I = [], W = 0; W < h.length; W++) {
var se = h[W], b = se(P, $, A, _, j, r);
if (b == null)
return null;
b.data && o(b.data, "expectedType") && I.push(b.data.expectedType);
}
var Te = I.length > 0 ? ", expected one of type [" + I.join(", ") + "]" : "";
return new x("Invalid " + _ + " `" + j + "` supplied to " + ("`" + A + "`" + Te + "."));
}
return R(M);
}
function ne() {
function h(w, F, M, P, $) {
return re(w[F]) ? null : new x("Invalid " + P + " `" + $ + "` supplied to " + ("`" + M + "`, expected a ReactNode."));
}
return R(h);
}
function me(h, w, F, M, P) {
return new x(
(h || "React class") + ": " + w + " type `" + F + "." + M + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + P + "`."
);
}
function xe(h) {
function w(F, M, P, $, A) {
var _ = F[M], j = G(_);
if (j !== "object")
return new x("Invalid " + $ + " `" + A + "` of type `" + j + "` " + ("supplied to `" + P + "`, expected `object`."));
for (var I in h) {
var W = h[I];
if (typeof W != "function")
return me(P, $, A, I, oe(W));
var se = W(_, I, P, $, A + "." + I, r);
if (se)
return se;
}
return null;
}
return R(w);
}
function ue(h) {
function w(F, M, P, $, A) {
var _ = F[M], j = G(_);
if (j !== "object")
return new x("Invalid " + $ + " `" + A + "` of type `" + j + "` " + ("supplied to `" + P + "`, expected `object`."));
var I = t({}, F[M], h);
for (var W in I) {
var se = h[W];
if (o(h, W) && typeof se != "function")
return me(P, $, A, W, oe(se));
if (!se)
return new x(
"Invalid " + $ + " `" + A + "` key `" + W + "` supplied to `" + P + "`.\nBad object: " + JSON.stringify(F[M], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(h), null, " ")
);
var b = se(_, W, P, $, A + "." + W, r);
if (b)
return b;
}
return null;
}
return R(w);
}
function re(h) {
switch (typeof h) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !h;
case "object":
if (Array.isArray(h))
return h.every(re);
if (h === null || c(h))
return !0;
var w = m(h);
if (w) {
var F = w.call(h), M;
if (w !== h.entries) {
for (; !(M = F.next()).done; )
if (!re(M.value))
return !1;
} else
for (; !(M = F.next()).done; ) {
var P = M.value;
if (P && !re(P[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function Ee(h, w) {
return h === "symbol" ? !0 : w ? w["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && w instanceof Symbol : !1;
}
function G(h) {
var w = typeof h;
return Array.isArray(h) ? "array" : h instanceof RegExp ? "object" : Ee(w, h) ? "symbol" : w;
}
function oe(h) {
if (typeof h > "u" || h === null)
return "" + h;
var w = G(h);
if (w === "object") {
if (h instanceof Date)
return "date";
if (h instanceof RegExp)
return "regexp";
}
return w;
}
function H(h) {
var w = oe(h);
switch (w) {
case "array":
case "object":
return "an " + w;
case "boolean":
case "date":
case "regexp":
return "a " + w;
default:
return w;
}
}
function ae(h) {
return !h.constructor || !h.constructor.name ? y : h.constructor.name;
}
return p.checkPropTypes = i, p.resetWarningCache = i.resetWarningCache, p.PropTypes = p, p;
}, It;
}
var Ht, vn;
function xo() {
if (vn)
return Ht;
vn = 1;
var e = Qt();
function t() {
}
function r() {
}
return r.resetWarningCache = t, Ht = function() {
function o(l, c, f, d, u, m) {
if (m !== e) {
var y = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw y.name = "Invariant Violation", y;
}
}
o.isRequired = o;
function i() {
return o;
}
var a = {
array: o,
bigint: o,
bool: o,
func: o,
number: o,
object: o,
string: o,
symbol: o,
any: o,
arrayOf: i,
element: o,
elementType: o,
instanceOf: i,
node: o,
objectOf: i,
oneOf: i,
oneOfType: i,
shape: i,
exact: i,
checkPropTypes: r,
resetWarningCache: t
};
return a.PropTypes = a, a;
}, Ht;
}
if (de.env.NODE_ENV !== "production") {
var Eo = dr(), wo = !0;
zt.exports = bo()(Eo.isElement, wo);
} else
zt.exports = xo()();
var So = zt.exports;
const L = /* @__PURE__ */ eo(So), yn = {
disabled: !1
};
var Ro = de.env.NODE_ENV !== "production" ? L.oneOfType([L.number, L.shape({
enter: L.number,
exit: L.number,
appear: L.number
}).isRequired]) : null, ma = de.env.NODE_ENV !== "production" ? L.oneOfType([L.string, L.shape({
enter: L.string,
exit: L.string,
active: L.string
}), L.shape({
enter: L.string,
enterDone: L.string,
enterActive: L.string,
exit: L.string,
exitDone: L.string,
exitActive: L.string
})]) : null;
const mr = he.createContext(null);
var To = function(t) {
return t.scrollTop;
}, st = "unmounted", $e = "exited", Ne = "entering", Ge = "entered", Yt = "exiting", Me = /* @__PURE__ */ function(e) {
mo(t, e);
function t(o, i) {
var a;
a = e.call(this, o, i) || this;
var l = i, c = l && !l.isMounting ? o.enter : o.appear, f;
return a.appearStatus = null, o.in ? c ? (f = $e, a.appearStatus = Ne) : f = Ge : o.unmountOnExit || o.mountOnEnter ? f = st : f = $e, a.state = {
status: f
}, a.nextCallback = null, a;
}
t.getDerivedStateFromProps = function(i, a) {
var l = i.in;
return l && a.status === st ? {
status: $e
} : null;
};
var r = t.prototype;
return r.componentDidMount = function() {
this.updateStatus(!0, this.appearStatus);
}, r.componentDidUpdate = function(i) {
var a = null;
if (i !== this.props) {
var l = this.state.status;
this.props.in ? l !== Ne && l !== Ge && (a = Ne) : (l === Ne || l === Ge) && (a = Yt);
}
this.updateStatus(!1, a);
}, r.componentWillUnmount = function() {
this.cancelNextCallback();
}, r.getTimeouts = function() {
var i = this.props.timeout, a, l, c;
return a = l = c = i, i != null && typeof i != "number" && (a = i.exit, l = i.enter, c = i.appear !== void 0 ? i.appear : l), {
exit: a,
enter: l,
appear: c
};
}, r.updateStatus = function(i, a) {
if (i === void 0 && (i = !1), a !== null)
if (this.cancelNextCallback(), a === Ne) {
if (this.props.unmountOnExit || this.props.mountOnEnter) {
var l = this.props.nodeRef ? this.props.nodeRef.current : gt.findDOMNode(this);
l && To(l);
}
this.performEnter(i);
} else
this.performExit();
else
this.props.unmountOnExit && this.state.status === $e && this.setState({
status: st
});
}, r.performEnter = function(i) {
var a = this, l = this.props.enter, c = this.context ? this.context.isMounting : i, f = this.props.nodeRef ? [c] : [gt.findDOMNode(this), c], d = f[0], u = f[1], m = this.getTimeouts(), y = c ? m.appear : m.enter;
if (!i && !l || yn.disabled) {
this.safeSetState({
status: Ge
}, function() {
a.props.onEntered(d);
});
return;
}
this.props.onEnter(d, u), this.safeSetState({
status: Ne
}, function() {
a.props.onEntering(d, u), a.onTransitionEnd(y, function() {
a.safeSetState({
status: Ge
}, function() {
a.props.onEntered(d, u);
});
});
});
}, r.performExit = function() {
var i = this, a = this.props.exit, l = this.getTimeouts(), c = this.props.nodeRef ? void 0 : gt.findDOMNode(this);
if (!a || yn.disabled) {
this.safeSetState({
status: $e
}, function() {
i.props.onExited(c);
});
return;
}
this.props.onExit(c), this.safeSetState({
status: Yt
}, function() {
i.props.onExiting(c), i.onTransitionEnd(l.exit, function() {
i.safeSetState({
status: $e
}, function() {
i.props.onExited(c);
});
});
});
}, r.cancelNextCallback = function() {
this.nextCallback !== null && (this.nextCallback.cancel(), this.nextCallback = null);
}, r.safeSetState = function(i, a) {
a = this.setNextCallback(a), this.setState(i, a);
}, r.setNextCallback = function(i) {
var a = this, l = !0;
return this.nextCallback = function(c) {
l && (l = !1, a.nextCallback = null, i(c));
}, this.nextCallback.cancel = function() {
l = !1;
}, this.nextCallback;
}, r.onTransitionEnd = function(i, a) {
this.setNextCallback(a);
var l = this.props.nodeRef ? this.props.nodeRef.current : gt.findDOMNode(this), c = i == null && !this.props.addEndListener;
if (!l || c) {
setTimeout(this.nextCallback, 0);
return;
}
if (this.props.addEndListener) {
var f = this.props.nodeRef ? [this.nextCallback] : [l, this.nextCallback], d = f[0], u = f[1];
this.props.addEndListener(d, u);
}
i != null && setTimeout(this.nextCallback, i);
}, r.render = function() {
var i = this.state.status;
if (i === st)
return null;
var a = this.props, l = a.children;
a.in, a.mountOnEnter, a.unmountOnExit, a.appear, a.enter, a.exit, a.timeout, a.addEndListener, a.onEnter, a.onEntering, a.onEntered, a.onExit, a.onExiting, a.onExited, a.nodeRef;
var c = go(a, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
return (
// allows for nested Transitions
/* @__PURE__ */ he.createElement(mr.Provider, {
value: null
}, typeof l == "function" ? l(i, c) : he.cloneElement(he.Children.only(l), c))
);
}, t;
}(he.Component);
Me.contextType = mr;
Me.propTypes = de.env.NODE_ENV !== "production" ? {
/**
* A React reference to DOM element that need to transition:
* https://stackoverflow.com/a/51127130/4671932
*
* - When `nodeRef` prop is used, `node` is not passed to callback functions
* (e.g. `onEnter`) because user already has direct access to the node.
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
* `nodeRef` need to be provided to `Transition` with changed `key` prop
* (see
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
*/
nodeRef: L.shape({
current: typeof Element > "u" ? L.any : function(e, t, r, o, i, a) {
var l = e[t];
return L.instanceOf(l && "ownerDocument" in l ? l.ownerDocument.defaultView.Element : Element)(e, t, r, o, i, a);
}
}),
/**
* A `function` child can be used instead of a React element. This function is
* called with the current transition status (`'entering'`, `'entered'`,
* `'exiting'`, `'exited'`), which can be used to apply context
* specific props to a component.
*
* ```jsx
* <Transition in={this.state.in} timeout={150}>
* {state => (
* <MyComponent className={`fade fade-${state}`} />
* )}
* </Transition>
* ```
*/
children: L.oneOfType([L.func.isRequired, L.element.isRequired]).isRequired,
/**
* Show the component; triggers the enter or exit states
*/
in: L.bool,
/**
* By default the child component is mounted immediately along with
* the parent `Transition` component. If you want to "lazy mount" the component on the
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
* mounted, even on "exited", unless you also specify `unmountOnExit`.
*/
mountOnEnter: L.bool,
/**
* By default the child component stays mounted after it reaches the `'exited'` state.
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
*/
unmountOnExit: L.bool,
/**
* By default the child component does not perform the enter transition when
* it first mounts, regardless of the value of `in`. If you want this
* behavior, set both `appear` and `in` to `true`.
*
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
* > only adds an additional enter transition. However, in the
* > `<CSSTransition>` component that first enter transition does result in
* > additional `.appear-*` classes, that way you can choose to style it
* > differently.
*/
appear: L.bool,
/**
* Enable or disable enter transitions.
*/
enter: L.bool,
/**
* Enable or disable exit transitions.
*/
exit: L.bool,
/**
* The duration of the transition, in milliseconds.
* Required unless `addEndListener` is provided.
*
* You may specify a single timeout for all transitions:
*
* ```jsx
* timeout={500}
* ```
*
* or individually:
*
* ```jsx
* timeout={{
* appear: 500,
* enter: 300,
* exit: 500,
* }}
* ```
*
* - `appear` defaults to the value of `enter`
* - `enter` defaults to `0`
* - `exit` defaults to `0`
*
* @type {number | { enter?: number, exit?: number, appear?: number }}
*/
timeout: function(t) {
var r = Ro;
t.addEndListener || (r = r.isRequired);
for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), a = 1; a < o; a++)
i[a - 1] = arguments[a];
return r.apply(void 0, [t].concat(i));
},
/**
* Add a custom transition end trigger. Called with the transitioning
* DOM node and a `done` callback. Allows for more fine grained transition end
* logic. Timeouts are still used as a fallback if provided.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* ```jsx
* addEndListener={(node, done) => {
* // use the css transitionend event to mark the finish of a transition
* node.addEventListener('transitionend', done, false);
* }}
* ```
*/
addEndListener: L.func,
/**
* Callback fired before the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEnter: L.func,
/**
* Callback fired after the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEntering: L.func,
/**
* Callback fired after the "entered" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEntered: L.func,
/**
* Callback fired before the "exiting" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement) -> void
*/
onExit: L.func,
/**
* Callback fired after the "exiting" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement) -> void
*/
onExiting: L.func,
/**
* Callback fired after the "exited" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed
*
* @type Function(node: HtmlElement) -> void
*/
onExited: L.func
} : {};
function Ye() {
}
Me.defaultProps = {
in: !1,
mountOnEnter: !1,
unmountOnExit: !1,
appear: !1,
enter: !0,
exit: !0,
onEnter: Ye,
onEntering: Ye,
onEntered: Ye,
onExit: Ye,
onExiting: Ye,
onExited: Ye
};
Me.UNMOUNTED = st;
Me.EXITED = $e;
Me.ENTERING = Ne;
Me.ENTERED = Ge;
Me.EXITING = Yt;
const Co = Me;
function Ot() {
return typeof window < "u";
}
function et(e) {
return gr(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function Re(e) {
var t;
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function ke(e) {
var t;
return (t = (gr(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function gr(e) {
return Ot() ? e instanceof Node || e instanceof Re(e).Node : !1;
}
function ve(e) {
return Ot() ? e instanceof Element || e instanceof Re(e).Element : !1;
}
function Pe(e) {
return Ot() ? e instanceof HTMLElement || e instanceof Re(e).HTMLElement : !1;
}
function bn(e) {
return !Ot() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Re(e).ShadowRoot;
}
const Oo = /* @__PURE__ */ new Set(["inline", "contents"]);
function ft(e) {
const {
overflow: t,
overflowX: r,
overflowY: o,
display: i
} = Oe(e);
return /auto|scroll|overlay|hidden|clip/.test(t + o + r) && !Oo.has(i);
}
const Do = /* @__PURE__ */ new Set(["table", "td", "th"]);
function Po(e) {
return Do.has(et(e));
}
const ko = [":popover-open", ":modal"];
function Dt(e) {
return ko.some((t) => {
try {
return e.matches(t);
} catch {
return !1;
}
});
}
const Ao = ["transform", "translate", "scale", "rotate", "perspective"], Fo = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Mo = ["paint", "layout", "strict", "content"];
function en(e) {
const t = tn(), r = ve(e) ? Oe(e) : e;
return Ao.some((o) => r[o] ? r[o] !== "none" : !1) || (r.containerType ? r.containerType !== "normal" : !1) || !t && (r.backdropFilter ? r.backdropFilter !== "none" : !1) || !t && (r.filter ? r.filter !== "none" : !1) || Fo.some((o) => (r.willChange || "").includes(o)) || Mo.some((o) => (r.contain || "").includes(o));
}
function _o(e) {
let t = Ie(e);
for (; Pe(t) && !Qe(t); ) {
if (en(t))
return t;
if (Dt(t))
return null;
t = Ie(t);
}
return null;
}
function tn() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
const Lo = /* @__PURE__ */ new Set(["html", "body", "#document"]);
function Qe(e) {
return Lo.has(et(e));
}
function Oe(e) {
return Re(e).getComputedStyle(e);
}
function Pt(e) {
return ve(e) ? {
scrollLeft: e.scrollLeft,
scrollTop: e.scrollTop
} : {
scrollLeft: e.scrollX,
scrollTop: e.scrollY
};
}
function Ie(e) {
if (et(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.
bn(e) && e.host || // Fallback.
ke(e)
);
return bn(t) ? t.host : t;
}
function hr(e) {
const t = Ie(e);
return Qe(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : Pe(t) && ft(t) ? t : hr(t);
}
function ct(e, t, r) {
var o;
t === void 0 && (t = []), r === void 0 && (r = !0);
const i = hr(e), a = i === ((o = e.ownerDocument) == null ? void 0 : o.body), l = Re(i);
if (a) {
const c = Bt(l);
return t.concat(l, l.visualViewport || [], ft(i) ? i : [], c && r ? ct(c) : []);
}
return t.concat(i, ct(i, [], r));
}
function Bt(e) {
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
const ut = Math.min, Ce = Math.max, xt = Math.round, vt = Math.floor, De = (e) => ({
x: e,
y: e
}), Io = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, Ho = {
start: "end",
end: "start"
};
function kt(e, t) {
return typeof e == "function" ? e(t) : e;
}
function je(e) {
return e.split("-")[0];
}
function dt(e) {
return e.split("-")[1];
}
function $o(e) {
return e === "x" ? "y" : "x";
}
function vr(e) {
return e === "y" ? "height" : "width";
}
const No = /* @__PURE__ */ new Set(["top", "bottom"]);
function Le(e) {
return No.has(je(e)) ? "y" : "x";
}
function yr(e) {
return $o(Le(e));
}
function jo(e, t, r) {
r === void 0 && (r = !1);
const o = dt(e), i = yr(e), a = vr(i);
let l = i === "x" ? o === (r ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
return t.reference[a] > t.floating[a] && (l = Et(l)), [l, Et(l)];
}
function Wo(e) {
const t = Et(e);
return [qt(e), t, qt(t)];
}
function qt(e) {
return e.replace(/start|end/g, (t) => Ho[t]);
}
const xn = ["left", "right"], En = ["right", "left"], Vo = ["top", "bottom"], zo = ["bottom", "top"];
function Yo(e, t, r) {
switch (e) {
case "top":
case "bottom":
return r ? t ? En : xn : t ? xn : En;
case "left":
case "right":
return t ? Vo : zo;
default:
return [];
}
}
function Bo(e, t, r, o) {
const i = dt(e);
let a = Yo(je(e), r === "start", o);
return i && (a = a.map((l) => l + "-" + i), t && (a = a.concat(a.map(qt)))), a;
}
function Et(e) {
return e.replace(/left|right|bottom|top/g, (t) => Io[t]);
}
function qo(e) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...e
};
}
function Uo(e) {
return typeof e != "number" ? qo(e) : {
top: e,
right: e,
bottom: e,
left: e
};
}
function wt(e) {
const {
x: t,
y: r,
width: o,
height: i
} = e;
return {
width: o,
height: i,
top: r,
left: t,
right: t + o,
bottom: r + i,
x: t,
y: r
};
}
function wn(e, t, r) {
let {
reference: o,
floating: i
} = e;
const a = Le(t), l = yr(t), c = vr(l), f = je(t), d = a === "y", u = o.x + o.width / 2 - i.width / 2, m = o.y + o.height / 2 - i.height / 2, y = o[c] / 2 - i[c] / 2;
let p;
switch (f) {
case "top":
p = {
x: u,
y: o.y - i.height
};
break;
case "bottom":
p = {
x: u,
y: o.y + o.height
};
break;
case "right":
p = {
x: o.x + o.width,
y: m
};
break;
case "left":
p = {
x: o.x - i.width,
y: m
};
break;
default:
p = {
x: o.x,
y: o.y
};
}
switch (dt(t)) {
case "start":
p[l] -= y * (r && d ? -1 : 1);
break;
case "end":
p[l] += y * (r && d ? -1 : 1);
break;
}
return p;
}
const Xo = async (e, t, r) => {
const {
placement: o = "bottom",
strategy: i = "absolute",
middleware: a = [],
platform: l
} = r, c = a.filter(Boolean), f = await (l.isRTL == null ? void 0 : l.isRTL(t));
let d = await l.getElementRects({
reference: e,
floating: t,
strategy: i
}), {
x: u,
y: m
} = wn(d, o, f), y = o, p = {}, S = 0;
for (let x = 0; x < c.length; x++) {
const {
name: R,
fn: T
} = c[x], {
x: D,
y: E,
data: C,
reset: g
} = await T({
x: u,
y: m,
initialPlacement: o,
placement: y,
strategy: i,
middlewareData: p,
rects: d,
platform: l,
elements: {
reference: e,
floating: t
}
});
u = D ?? u, m = E ?? m, p = {
...p,
[R]: {
...p[R],
...C
}
}, g && S <= 50 && (S++, typeof g == "object" && (g.placement && (y = g.placement), g.rects && (d = g.rects === !0 ? await l.getElementRects({
reference: e,
floating: t,
strategy: i
}) : g.rects), {
x: u,
y: m
} = wn(d, y, f)), x = -1);
}
return {
x: u,
y: m,
placement: y,
strategy: i,
middlewareData: p
};
};
async function br(e, t) {
var r;
t === void 0 && (t = {});
const {
x: o,
y: i,
platform: a,
rects: l,
elements: c,
strategy: f
} = e, {
boundary: d = "clippingAncestors",
rootBoundary: u = "viewport",
elementContext: m = "floating",
altBoundary: y = !1,
padding: p = 0
} = kt(t, e), S = Uo(p), R = c[y ? m === "floating" ? "reference" : "floating" : m], T = wt(await a.getClippingRect({
element: (r = await (a.isElement == null ? void 0 : a.isElement(R))) == null || r ? R : R.contextElement || await (a.getDocumentElement == null ? void 0 : a.getDocumentElement(c.floating)),
boundary: d,
rootBoundary: u,
strategy: f
})), D = m === "floating" ? {
x: o,
y: i,
width: l.floating.width,
height: l.floating.height
} : l.reference, E = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(c.floating)), C = await (a.isElement == null ? void 0 : a.isElement(E)) ? await (a.getScale == null ? void 0 : a.getScale(E)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, g = wt(a.convertOffsetParentRelativeRectToViewportRelativeRect ? await a.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: c,
rect: D,
offsetParent: E,
strategy: f
}) : D);
return {
top: (T.top - g.top + S.top) / C.y,
bottom: (g.bottom - T.bottom + S.bottom) / C.y,
left: (T.left - g.left + S.left) / C.x,
right: (g.right - T.right + S.right) / C.x
};
}
const Zo = function(e) {
return e === void 0 && (e = {}), {
name: "flip",
options: e,
async fn(t) {
var r, o;
const {
placement: i,
middlewareData: a,
rects: l,
initialPlacement: c,
platform: f,
elements: d
} = t, {
mainAxis: u = !0,
crossAxis: m = !0,
fallbackPlacements: y,
fallbackStrategy: p = "bestFit",
fallbackAxisSideDirection: S = "none",
flipAlignment: x = !0,
...R
} = kt(e, t);
if ((r = a.arrow) != null && r.alignmentOffset)
return {};
const T = je(i), D = Le(c), E = je(c) === c, C = await (f.isRTL == null ? void 0 : f.isRTL(d.floating)), g = y || (E || !x ? [Et(c)] : Wo(c)), K = S !== "none";
!y && K && g.push(...Bo(c, x, S, C));
const q = [c, ...g], te = await br(t, R), pe = [];
let ne = ((o = a.flip) == null ? void 0 : o.overflows) || [];
if (u && pe.push(te[T]), m) {
const re = jo(i, l, C);
pe.push(te[re[0]], te[re[1]]);
}
if (ne = [...ne, {
placement: i,
overflows: pe
}], !pe.every((re) => re <= 0)) {
var me, xe;
const re = (((me = a.flip) == null ? void 0 : me.index) || 0) + 1, Ee = q[re];
if (Ee && (!(m === "alignment" ? D !== Le(Ee) : !1) || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
ne.every((H) => Le(H.placement) === D ? H.overflows[0] > 0 : !0)))
return {
data: {
index: re,
overflows: ne
},
reset: {
placement: Ee
}
};
let G = (xe = ne.filter((oe) => oe.overflows[0] <= 0).sort((oe, H) => oe.overflows[1] - H.overflows[1])[0]) == null ? void 0 : xe.placement;
if (!G)
switch (p) {
case "bestFit": {
var ue;
const oe = (ue = ne.filter((H) => {
if (K) {
const ae = Le(H.placement);
return ae === D || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
ae === "y";
}
return !0;
}).map((H) => [H.placement, H.overflows.filter((ae) => ae > 0).reduce((ae, h) => ae + h, 0)]).sort((H, ae) => H[1] - ae[1])[0]) == null ? void 0 : ue[0];
oe && (G = oe);
break;
}
case "initialPlacement":
G = c;
break;
}
if (i !== G)
return {
reset: {
placement: G
}
};
}
return {};
}
};
}, Go = /* @__PURE__ */ new Set(["left", "top"]);
async function Jo(e, t) {
const {
placement: r,
platform: o,
elements: i
} = e, a = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), l = je(r), c = dt(r), f = Le(r) === "y", d = Go.has(l) ? -1 : 1, u = a && f ? -1 : 1, m = kt(t, e);
let {
mainAxis: y,
crossAxis: p,
alignmentAxis: S
} = typeof m == "number" ? {
mainAxis: m,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: m.mainAxis || 0,
crossAxis: m.crossAxis || 0,
alignmentAxis: m.alignmentAxis
};
return c && typeof S == "number" && (p = c === "end" ? S * -1 : S), f ? {
x: p * u,
y: y * d
} : {
x: y * d,
y: p * u
};
}
const Ko = function(e) {
return e === void 0 && (e = 0), {
name: "offset",
options: e,
async fn(t) {
var r, o;
const {
x: i,
y: a,
placement: l,
middlewareData: c
} = t, f = await Jo(t, e);
return l === ((r = c.offset) == null ? void 0 : r.placement) && (o = c.arrow) != null && o.alignmentOffset ? {} : {
x: i + f.x,
y: a + f.y,
data: {
...f,
placement: l
}
};
}
};
}, Qo = function(e) {
return e === void 0 && (e = {}), {
name: "size",
options: e,
async fn(t) {
var r, o;
const {
placement: i,
rects: a,
platform: l,
elements: c
} = t, {
apply: f = () => {
},
...d
} = kt(e, t), u = await br(t, d), m = je(i), y = dt(i), p = Le(i) === "y", {
width: S,
height: x
} = a.floating;
let R, T;
m === "top" || m === "bottom" ? (R = m, T = y === (await (l.isRTL == null ? void 0 : l.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (T = m, R = y === "end" ? "top" : "bottom");
const D = x - u.top - u.bottom, E = S - u.left - u.right, C = ut(x - u[R], D), g = ut(S - u[T], E), K = !t.middlewareData.shift;
let q = C, te = g;
if ((r = t.middlewareData.shift) != null && r.enabled.x && (te = E), (o = t.middlewareData.shift) != null && o.enabled.y && (q = D), K && !y) {
const ne = Ce(u.left, 0), me = Ce(u.right, 0), xe = Ce(u.top, 0), ue = Ce(u.bottom, 0);
p ? te = S - 2 * (ne !== 0 || me !== 0 ? ne + me : Ce(u.left, u.right)) : q = x - 2 * (xe !== 0 || ue !== 0 ? xe + ue : Ce(u.top, u.bottom));
}
await f({
...t,
availableWidth: te,
availableHeight: q
});
const pe = await l.getDimensions(c.floating);
return S !== pe.width || x !== pe.height ? {
reset: {
rects: !0
}
} : {};
}
};
};
function xr(e) {
const t = Oe(e);
let r = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
const i = Pe(e), a = i ? e.offsetWidth : r, l = i ? e.offsetHeight : o, c = xt(r) !== a || xt(o) !== l;
return c && (r = a, o = l), {
width: r,
height: o,
$: c
};
}
function nn(e) {
return ve(e) ? e : e.contextElement;
}
function Ke(e) {
const t = nn(e);
if (!Pe(t))
return De(1);
const r = t.getBoundingClientRect(), {
width: o,
height: i,
$: a
} = xr(t);
let l = (a ? xt(r.width) : r.width) / o, c = (a ? xt(r.height) : r.height) / i;
return (!l || !Number.isFinite(l)) && (l = 1), (!c || !Number.isFinite(c)) && (c = 1), {
x: l,
y: c
};
}
const ei = /* @__PURE__ */ De(0);
function Er(e) {
const t = Re(e);
return !tn() || !t.visualViewport ? ei : {
x: t.visualViewport.offsetLeft,
y: t.visualViewport.offsetTop
};
}
function ti(e, t, r) {
return t === void 0 && (t = !1), !r || t && r !== Re(e) ? !1 : t;
}
function We(e, t, r, o) {
t === void 0 && (t = !1), r === void 0 && (r = !1);
const i = e.getBoundingClientRect(), a = nn(e);
let l = De(1);
t && (o ? ve(o) && (l = Ke(o)) : l = Ke(e));
const c = ti(a, r, o) ? Er(a) : De(0);
let f = (i.left + c.x) / l.x, d = (i.top + c.y) / l.y, u = i.width / l.x, m = i.height / l.y;
if (a) {
const y = Re(a), p = o && ve(o) ? Re(o) : o;
let S = y, x = Bt(S);
for (; x && o && p !== S; ) {
const R = Ke(x), T = x.getBoundingClientRect(), D = Oe(x), E = T.left + (x.