@luciodale/react-searchable-dropdown
Version:
A reusable React searchable dropdown component.
1,604 lines (1,602 loc) • 191 kB
JavaScript
import * as B from "react";
import D, { useLayoutEffect as Io, createElement as Rn, useRef as rn, useCallback as ke, useEffect as dn, useState as ot, useMemo as en } from "react";
import * as Eo from "react-dom";
import fs from "react-dom";
var Ao = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function vr(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var ir = { exports: {} }, Qt = {};
/**
* @license React
* react-jsx-runtime.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 Wr;
function ds() {
if (Wr) return Qt;
Wr = 1;
var e = D, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 };
function s(l, a, c) {
var u, f = {}, p = null, g = null;
c !== void 0 && (p = "" + c), a.key !== void 0 && (p = "" + a.key), a.ref !== void 0 && (g = a.ref);
for (u in a) r.call(a, u) && !i.hasOwnProperty(u) && (f[u] = a[u]);
if (l && l.defaultProps) for (u in a = l.defaultProps, a) f[u] === void 0 && (f[u] = a[u]);
return { $$typeof: t, type: l, key: p, ref: g, props: f, _owner: o.current };
}
return Qt.Fragment = n, Qt.jsx = s, Qt.jsxs = s, Qt;
}
var Zt = {};
/**
* @license React
* react-jsx-runtime.development.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 Vr;
function hs() {
return Vr || (Vr = 1, process.env.NODE_ENV !== "production" && function() {
var e = D, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), l = Symbol.for("react.context"), a = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), x = Symbol.iterator, b = "@@iterator";
function v(d) {
if (d === null || typeof d != "object")
return null;
var I = x && d[x] || d[b];
return typeof I == "function" ? I : null;
}
var m = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function h(d) {
{
for (var I = arguments.length, F = new Array(I > 1 ? I - 1 : 0), $ = 1; $ < I; $++)
F[$ - 1] = arguments[$];
y("error", d, F);
}
}
function y(d, I, F) {
{
var $ = m.ReactDebugCurrentFrame, ce = $.getStackAddendum();
ce !== "" && (I += "%s", F = F.concat([ce]));
var de = F.map(function(re) {
return String(re);
});
de.unshift("Warning: " + I), Function.prototype.apply.call(console[d], console, de);
}
}
var C = !1, T = !1, w = !1, S = !1, R = !1, P;
P = Symbol.for("react.module.reference");
function M(d) {
return !!(typeof d == "string" || typeof d == "function" || d === r || d === i || R || d === o || d === c || d === u || S || d === g || C || T || w || typeof d == "object" && d !== null && (d.$$typeof === p || d.$$typeof === f || d.$$typeof === s || d.$$typeof === l || d.$$typeof === a || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
d.$$typeof === P || d.getModuleId !== void 0));
}
function L(d, I, F) {
var $ = d.displayName;
if ($)
return $;
var ce = I.displayName || I.name || "";
return ce !== "" ? F + "(" + ce + ")" : F;
}
function W(d) {
return d.displayName || "Context";
}
function N(d) {
if (d == null)
return null;
if (typeof d.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof d == "function")
return d.displayName || d.name || null;
if (typeof d == "string")
return d;
switch (d) {
case r:
return "Fragment";
case n:
return "Portal";
case i:
return "Profiler";
case o:
return "StrictMode";
case c:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof d == "object")
switch (d.$$typeof) {
case l:
var I = d;
return W(I) + ".Consumer";
case s:
var F = d;
return W(F._context) + ".Provider";
case a:
return L(d, d.render, "ForwardRef");
case f:
var $ = d.displayName || null;
return $ !== null ? $ : N(d.type) || "Memo";
case p: {
var ce = d, de = ce._payload, re = ce._init;
try {
return N(re(de));
} catch {
return null;
}
}
}
return null;
}
var k = Object.assign, V = 0, X, ae, U, K, se, be, Ce;
function ge() {
}
ge.__reactDisabledLog = !0;
function ye() {
{
if (V === 0) {
X = console.log, ae = console.info, U = console.warn, K = console.error, se = console.group, be = console.groupCollapsed, Ce = console.groupEnd;
var d = {
configurable: !0,
enumerable: !0,
value: ge,
writable: !0
};
Object.defineProperties(console, {
info: d,
log: d,
warn: d,
error: d,
group: d,
groupCollapsed: d,
groupEnd: d
});
}
V++;
}
}
function Me() {
{
if (V--, V === 0) {
var d = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: k({}, d, {
value: X
}),
info: k({}, d, {
value: ae
}),
warn: k({}, d, {
value: U
}),
error: k({}, d, {
value: K
}),
group: k({}, d, {
value: se
}),
groupCollapsed: k({}, d, {
value: be
}),
groupEnd: k({}, d, {
value: Ce
})
});
}
V < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var xe = m.ReactCurrentDispatcher, Te;
function A(d, I, F) {
{
if (Te === void 0)
try {
throw Error();
} catch (ce) {
var $ = ce.stack.trim().match(/\n( *(at )?)/);
Te = $ && $[1] || "";
}
return `
` + Te + d;
}
}
var z = !1, Q;
{
var fe = typeof WeakMap == "function" ? WeakMap : Map;
Q = new fe();
}
function ee(d, I) {
if (!d || z)
return "";
{
var F = Q.get(d);
if (F !== void 0)
return F;
}
var $;
z = !0;
var ce = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var de;
de = xe.current, xe.current = null, ye();
try {
if (I) {
var re = function() {
throw Error();
};
if (Object.defineProperty(re.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(re, []);
} catch (qe) {
$ = qe;
}
Reflect.construct(d, [], re);
} else {
try {
re.call();
} catch (qe) {
$ = qe;
}
d.call(re.prototype);
}
} else {
try {
throw Error();
} catch (qe) {
$ = qe;
}
d();
}
} catch (qe) {
if (qe && $ && typeof qe.stack == "string") {
for (var te = qe.stack.split(`
`), Ve = $.stack.split(`
`), Se = te.length - 1, Re = Ve.length - 1; Se >= 1 && Re >= 0 && te[Se] !== Ve[Re]; )
Re--;
for (; Se >= 1 && Re >= 0; Se--, Re--)
if (te[Se] !== Ve[Re]) {
if (Se !== 1 || Re !== 1)
do
if (Se--, Re--, Re < 0 || te[Se] !== Ve[Re]) {
var tt = `
` + te[Se].replace(" at new ", " at ");
return d.displayName && tt.includes("<anonymous>") && (tt = tt.replace("<anonymous>", d.displayName)), typeof d == "function" && Q.set(d, tt), tt;
}
while (Se >= 1 && Re >= 0);
break;
}
}
} finally {
z = !1, xe.current = de, Me(), Error.prepareStackTrace = ce;
}
var _t = d ? d.displayName || d.name : "", Pt = _t ? A(_t) : "";
return typeof d == "function" && Q.set(d, Pt), Pt;
}
function Ie(d, I, F) {
return ee(d, !1);
}
function Ye(d) {
var I = d.prototype;
return !!(I && I.isReactComponent);
}
function me(d, I, F) {
if (d == null)
return "";
if (typeof d == "function")
return ee(d, Ye(d));
if (typeof d == "string")
return A(d);
switch (d) {
case c:
return A("Suspense");
case u:
return A("SuspenseList");
}
if (typeof d == "object")
switch (d.$$typeof) {
case a:
return Ie(d.render);
case f:
return me(d.type, I, F);
case p: {
var $ = d, ce = $._payload, de = $._init;
try {
return me(de(ce), I, F);
} catch {
}
}
}
return "";
}
var Ne = Object.prototype.hasOwnProperty, Oe = {}, ze = m.ReactDebugCurrentFrame;
function Pe(d) {
if (d) {
var I = d._owner, F = me(d.type, d._source, I ? I.type : null);
ze.setExtraStackFrame(F);
} else
ze.setExtraStackFrame(null);
}
function Fe(d, I, F, $, ce) {
{
var de = Function.call.bind(Ne);
for (var re in d)
if (de(d, re)) {
var te = void 0;
try {
if (typeof d[re] != "function") {
var Ve = Error(($ || "React class") + ": " + F + " type `" + re + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof d[re] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw Ve.name = "Invariant Violation", Ve;
}
te = d[re](I, re, $, F, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (Se) {
te = Se;
}
te && !(te instanceof Error) && (Pe(ce), h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", $ || "React class", F, re, typeof te), Pe(null)), te instanceof Error && !(te.message in Oe) && (Oe[te.message] = !0, Pe(ce), h("Failed %s type: %s", F, te.message), Pe(null));
}
}
}
var lt = Array.isArray;
function at(d) {
return lt(d);
}
function je(d) {
{
var I = typeof Symbol == "function" && Symbol.toStringTag, F = I && d[Symbol.toStringTag] || d.constructor.name || "Object";
return F;
}
}
function Je(d) {
try {
return We(d), !1;
} catch {
return !0;
}
}
function We(d) {
return "" + d;
}
function ct(d) {
if (Je(d))
return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", je(d)), We(d);
}
var ut = m.ReactCurrentOwner, ie = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, _e, yt;
function Tt(d) {
if (Ne.call(d, "ref")) {
var I = Object.getOwnPropertyDescriptor(d, "ref").get;
if (I && I.isReactWarning)
return !1;
}
return d.ref !== void 0;
}
function St(d) {
if (Ne.call(d, "key")) {
var I = Object.getOwnPropertyDescriptor(d, "key").get;
if (I && I.isReactWarning)
return !1;
}
return d.key !== void 0;
}
function wn(d, I) {
typeof d.ref == "string" && ut.current;
}
function bn(d, I) {
{
var F = function() {
_e || (_e = !0, h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", I));
};
F.isReactWarning = !0, Object.defineProperty(d, "key", {
get: F,
configurable: !0
});
}
}
function Xn(d, I) {
{
var F = function() {
yt || (yt = !0, h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", I));
};
F.isReactWarning = !0, Object.defineProperty(d, "ref", {
get: F,
configurable: !0
});
}
}
var ne = function(d, I, F, $, ce, de, re) {
var te = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: d,
key: I,
ref: F,
props: re,
// Record the component responsible for creating this element.
_owner: de
};
return te._store = {}, Object.defineProperty(te._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(te, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: $
}), Object.defineProperty(te, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: ce
}), Object.freeze && (Object.freeze(te.props), Object.freeze(te)), te;
};
function Ge(d, I, F, $, ce) {
{
var de, re = {}, te = null, Ve = null;
F !== void 0 && (ct(F), te = "" + F), St(I) && (ct(I.key), te = "" + I.key), Tt(I) && (Ve = I.ref, wn(I, ce));
for (de in I)
Ne.call(I, de) && !ie.hasOwnProperty(de) && (re[de] = I[de]);
if (d && d.defaultProps) {
var Se = d.defaultProps;
for (de in Se)
re[de] === void 0 && (re[de] = Se[de]);
}
if (te || Ve) {
var Re = typeof d == "function" ? d.displayName || d.name || "Unknown" : d;
te && bn(re, Re), Ve && Xn(re, Re);
}
return ne(d, te, Ve, ce, $, ut.current, re);
}
}
var Ct = m.ReactCurrentOwner, Rt = m.ReactDebugCurrentFrame;
function ft(d) {
if (d) {
var I = d._owner, F = me(d.type, d._source, I ? I.type : null);
Rt.setExtraStackFrame(F);
} else
Rt.setExtraStackFrame(null);
}
var Xt;
Xt = !1;
function Jt(d) {
return typeof d == "object" && d !== null && d.$$typeof === t;
}
function yn() {
{
if (Ct.current) {
var d = N(Ct.current.type);
if (d)
return `
Check the render method of \`` + d + "`.";
}
return "";
}
}
function ts(d) {
return "";
}
var Dr = {};
function ns(d) {
{
var I = yn();
if (!I) {
var F = typeof d == "string" ? d : d.displayName || d.name;
F && (I = `
Check the top-level render call using <` + F + ">.");
}
return I;
}
}
function zr(d, I) {
{
if (!d._store || d._store.validated || d.key != null)
return;
d._store.validated = !0;
var F = ns(I);
if (Dr[F])
return;
Dr[F] = !0;
var $ = "";
d && d._owner && d._owner !== Ct.current && ($ = " It was passed a child from " + N(d._owner.type) + "."), ft(d), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', F, $), ft(null);
}
}
function _r(d, I) {
{
if (typeof d != "object")
return;
if (at(d))
for (var F = 0; F < d.length; F++) {
var $ = d[F];
Jt($) && zr($, I);
}
else if (Jt(d))
d._store && (d._store.validated = !0);
else if (d) {
var ce = v(d);
if (typeof ce == "function" && ce !== d.entries)
for (var de = ce.call(d), re; !(re = de.next()).done; )
Jt(re.value) && zr(re.value, I);
}
}
}
function rs(d) {
{
var I = d.type;
if (I == null || typeof I == "string")
return;
var F;
if (typeof I == "function")
F = I.propTypes;
else if (typeof I == "object" && (I.$$typeof === a || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
I.$$typeof === f))
F = I.propTypes;
else
return;
if (F) {
var $ = N(I);
Fe(F, d.props, "prop", $, d);
} else if (I.PropTypes !== void 0 && !Xt) {
Xt = !0;
var ce = N(I);
h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", ce || "Unknown");
}
typeof I.getDefaultProps == "function" && !I.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function os(d) {
{
for (var I = Object.keys(d.props), F = 0; F < I.length; F++) {
var $ = I[F];
if ($ !== "children" && $ !== "key") {
ft(d), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", $), ft(null);
break;
}
}
d.ref !== null && (ft(d), h("Invalid attribute `ref` supplied to `React.Fragment`."), ft(null));
}
}
var Br = {};
function Nr(d, I, F, $, ce, de) {
{
var re = M(d);
if (!re) {
var te = "";
(d === void 0 || typeof d == "object" && d !== null && Object.keys(d).length === 0) && (te += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var Ve = ts();
Ve ? te += Ve : te += yn();
var Se;
d === null ? Se = "null" : at(d) ? Se = "array" : d !== void 0 && d.$$typeof === t ? (Se = "<" + (N(d.type) || "Unknown") + " />", te = " Did you accidentally export a JSX literal instead of a component?") : Se = typeof d, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Se, te);
}
var Re = Ge(d, I, F, ce, de);
if (Re == null)
return Re;
if (re) {
var tt = I.children;
if (tt !== void 0)
if ($)
if (at(tt)) {
for (var _t = 0; _t < tt.length; _t++)
_r(tt[_t], d);
Object.freeze && Object.freeze(tt);
} else
h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
_r(tt, d);
}
if (Ne.call(I, "key")) {
var Pt = N(d), qe = Object.keys(I).filter(function(us) {
return us !== "key";
}), Jn = qe.length > 0 ? "{key: someKey, " + qe.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Br[Pt + Jn]) {
var cs = qe.length > 0 ? "{" + qe.join(": ..., ") + ": ...}" : "{}";
h(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Jn, Pt, cs, Pt), Br[Pt + Jn] = !0;
}
}
return d === r ? os(Re) : rs(Re), Re;
}
}
function is(d, I, F) {
return Nr(d, I, F, !0);
}
function ss(d, I, F) {
return Nr(d, I, F, !1);
}
var ls = ss, as = is;
Zt.Fragment = r, Zt.jsx = ls, Zt.jsxs = as;
}()), Zt;
}
process.env.NODE_ENV === "production" ? ir.exports = ds() : ir.exports = hs();
var H = ir.exports;
function Bn() {
return typeof window < "u";
}
function Yt(e) {
return Oo(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function Ke(e) {
var t;
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function vt(e) {
var t;
return (t = (Oo(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function Oo(e) {
return Bn() ? e instanceof Node || e instanceof Ke(e).Node : !1;
}
function De(e) {
return Bn() ? e instanceof Element || e instanceof Ke(e).Element : !1;
}
function mt(e) {
return Bn() ? e instanceof HTMLElement || e instanceof Ke(e).HTMLElement : !1;
}
function sr(e) {
return !Bn() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Ke(e).ShadowRoot;
}
function hn(e) {
const {
overflow: t,
overflowX: n,
overflowY: r,
display: o
} = it(e);
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
}
function gs(e) {
return ["table", "td", "th"].includes(Yt(e));
}
function Nn(e) {
return [":popover-open", ":modal"].some((t) => {
try {
return e.matches(t);
} catch {
return !1;
}
});
}
function xr(e) {
const t = wr(), n = De(e) ? it(e) : e;
return ["transform", "translate", "scale", "rotate", "perspective"].some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
}
function ms(e) {
let t = Et(e);
for (; mt(t) && !Wt(t); ) {
if (xr(t))
return t;
if (Nn(t))
return null;
t = Et(t);
}
return null;
}
function wr() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function Wt(e) {
return ["html", "body", "#document"].includes(Yt(e));
}
function it(e) {
return Ke(e).getComputedStyle(e);
}
function Wn(e) {
return De(e) ? {
scrollLeft: e.scrollLeft,
scrollTop: e.scrollTop
} : {
scrollLeft: e.scrollX,
scrollTop: e.scrollY
};
}
function Et(e) {
if (Yt(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.
sr(e) && e.host || // Fallback.
vt(e)
);
return sr(t) ? t.host : t;
}
function ko(e) {
const t = Et(e);
return Wt(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : mt(t) && hn(t) ? t : ko(t);
}
function on(e, t, n) {
var r;
t === void 0 && (t = []), n === void 0 && (n = !0);
const o = ko(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = Ke(o);
if (i) {
const l = lr(s);
return t.concat(s, s.visualViewport || [], hn(o) ? o : [], l && n ? on(l) : []);
}
return t.concat(o, on(o, [], n));
}
function lr(e) {
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
const Vt = Math.min, Qe = Math.max, On = Math.round, Tn = Math.floor, gt = (e) => ({
x: e,
y: e
}), ps = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, vs = {
start: "end",
end: "start"
};
function Ur(e, t, n) {
return Qe(e, Vt(t, n));
}
function gn(e, t) {
return typeof e == "function" ? e(t) : e;
}
function At(e) {
return e.split("-")[0];
}
function mn(e) {
return e.split("-")[1];
}
function Ho(e) {
return e === "x" ? "y" : "x";
}
function Mo(e) {
return e === "y" ? "height" : "width";
}
function bt(e) {
return ["top", "bottom"].includes(At(e)) ? "y" : "x";
}
function Po(e) {
return Ho(bt(e));
}
function xs(e, t, n) {
n === void 0 && (n = !1);
const r = mn(e), o = Po(e), i = Mo(o);
let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
return t.reference[i] > t.floating[i] && (s = kn(s)), [s, kn(s)];
}
function ws(e) {
const t = kn(e);
return [ar(e), t, ar(t)];
}
function ar(e) {
return e.replace(/start|end/g, (t) => vs[t]);
}
function bs(e, t, n) {
const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
switch (e) {
case "top":
case "bottom":
return n ? t ? o : r : t ? r : o;
case "left":
case "right":
return t ? i : s;
default:
return [];
}
}
function ys(e, t, n, r) {
const o = mn(e);
let i = bs(At(e), n === "start", r);
return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map(ar)))), i;
}
function kn(e) {
return e.replace(/left|right|bottom|top/g, (t) => ps[t]);
}
function Ts(e) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...e
};
}
function Ss(e) {
return typeof e != "number" ? Ts(e) : {
top: e,
right: e,
bottom: e,
left: e
};
}
function Hn(e) {
const {
x: t,
y: n,
width: r,
height: o
} = e;
return {
width: r,
height: o,
top: n,
left: t,
right: t + r,
bottom: n + o,
x: t,
y: n
};
}
/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
var Cs = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], cr = /* @__PURE__ */ Cs.join(","), Fo = typeof Element > "u", sn = Fo ? function() {
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Mn = !Fo && Element.prototype.getRootNode ? function(e) {
var t;
return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
} : function(e) {
return e == null ? void 0 : e.ownerDocument;
}, Pn = function e(t, n) {
var r;
n === void 0 && (n = !0);
var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), i = o === "" || o === "true", s = i || n && t && e(t.parentNode);
return s;
}, Rs = function(t) {
var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
return r === "" || r === "true";
}, Is = function(t, n, r) {
if (Pn(t))
return [];
var o = Array.prototype.slice.apply(t.querySelectorAll(cr));
return n && sn.call(t, cr) && o.unshift(t), o = o.filter(r), o;
}, Es = function e(t, n, r) {
for (var o = [], i = Array.from(t); i.length; ) {
var s = i.shift();
if (!Pn(s, !1))
if (s.tagName === "SLOT") {
var l = s.assignedElements(), a = l.length ? l : s.children, c = e(a, !0, r);
r.flatten ? o.push.apply(o, c) : o.push({
scopeParent: s,
candidates: c
});
} else {
var u = sn.call(s, cr);
u && r.filter(s) && (n || !t.includes(s)) && o.push(s);
var f = s.shadowRoot || // check for an undisclosed shadow
typeof r.getShadowRoot == "function" && r.getShadowRoot(s), p = !Pn(f, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
if (f && p) {
var g = e(f === !0 ? s.children : f.children, !0, r);
r.flatten ? o.push.apply(o, g) : o.push({
scopeParent: s,
candidates: g
});
} else
i.unshift.apply(i, s.children);
}
}
return o;
}, jo = function(t) {
return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
}, Lo = function(t) {
if (!t)
throw new Error("No node provided");
return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || Rs(t)) && !jo(t) ? 0 : t.tabIndex;
}, As = function(t, n) {
var r = Lo(t);
return r < 0 && n && !jo(t) ? 0 : r;
}, Os = function(t, n) {
return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
}, Do = function(t) {
return t.tagName === "INPUT";
}, ks = function(t) {
return Do(t) && t.type === "hidden";
}, Hs = function(t) {
var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
return r.tagName === "SUMMARY";
});
return n;
}, Ms = function(t, n) {
for (var r = 0; r < t.length; r++)
if (t[r].checked && t[r].form === n)
return t[r];
}, Ps = function(t) {
if (!t.name)
return !0;
var n = t.form || Mn(t), r = function(l) {
return n.querySelectorAll('input[type="radio"][name="' + l + '"]');
}, o;
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
o = r(window.CSS.escape(t.name));
else
try {
o = r(t.name);
} catch (s) {
return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
}
var i = Ms(o, t.form);
return !i || i === t;
}, Fs = function(t) {
return Do(t) && t.type === "radio";
}, js = function(t) {
return Fs(t) && !Ps(t);
}, Ls = function(t) {
var n, r = t && Mn(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
if (r && r !== t) {
var s, l, a;
for (i = !!((s = o) !== null && s !== void 0 && (l = s.ownerDocument) !== null && l !== void 0 && l.contains(o) || t != null && (a = t.ownerDocument) !== null && a !== void 0 && a.contains(t)); !i && o; ) {
var c, u, f;
r = Mn(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, i = !!((u = o) !== null && u !== void 0 && (f = u.ownerDocument) !== null && f !== void 0 && f.contains(o));
}
}
return i;
}, $r = function(t) {
var n = t.getBoundingClientRect(), r = n.width, o = n.height;
return r === 0 && o === 0;
}, Ds = function(t, n) {
var r = n.displayCheck, o = n.getShadowRoot;
if (getComputedStyle(t).visibility === "hidden")
return !0;
var i = sn.call(t, "details>summary:first-of-type"), s = i ? t.parentElement : t;
if (sn.call(s, "details:not([open]) *"))
return !0;
if (!r || r === "full" || r === "legacy-full") {
if (typeof o == "function") {
for (var l = t; t; ) {
var a = t.parentElement, c = Mn(t);
if (a && !a.shadowRoot && o(a) === !0)
return $r(t);
t.assignedSlot ? t = t.assignedSlot : !a && c !== t.ownerDocument ? t = c.host : t = a;
}
t = l;
}
if (Ls(t))
return !t.getClientRects().length;
if (r !== "legacy-full")
return !0;
} else if (r === "non-zero-area")
return $r(t);
return !1;
}, zs = function(t) {
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
for (var n = t.parentElement; n; ) {
if (n.tagName === "FIELDSET" && n.disabled) {
for (var r = 0; r < n.children.length; r++) {
var o = n.children.item(r);
if (o.tagName === "LEGEND")
return sn.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
}
return !0;
}
n = n.parentElement;
}
return !1;
}, _s = function(t, n) {
return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
// because we're limited in the type of selectors we can use in JSDom (see related
// note related to `candidateSelectors`)
Pn(n) || ks(n) || Ds(n, t) || // For a details element with a summary, the summary element gets the focus
Hs(n) || zs(n));
}, Yr = function(t, n) {
return !(js(n) || Lo(n) < 0 || !_s(t, n));
}, Bs = function(t) {
var n = parseInt(t.getAttribute("tabindex"), 10);
return !!(isNaN(n) || n >= 0);
}, Ns = function e(t) {
var n = [], r = [];
return t.forEach(function(o, i) {
var s = !!o.scopeParent, l = s ? o.scopeParent : o, a = As(l, s), c = s ? e(o.candidates) : l;
a === 0 ? s ? n.push.apply(n, c) : n.push(l) : r.push({
documentOrder: i,
tabIndex: a,
item: o,
isScope: s,
content: c
});
}), r.sort(Os).reduce(function(o, i) {
return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
}, []).concat(n);
}, zo = function(t, n) {
n = n || {};
var r;
return n.getShadowRoot ? r = Es([t], n.includeContainer, {
filter: Yr.bind(null, n),
flatten: !1,
getShadowRoot: n.getShadowRoot,
shadowRootFilter: Bs
}) : r = Is(t, n.includeContainer, Yr.bind(null, n)), Ns(r);
};
function Ws() {
return /apple/i.test(navigator.vendor);
}
function Vs(e) {
let t = e.activeElement;
for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
var n;
t = t.shadowRoot.activeElement;
}
return t;
}
function Us(e, t) {
if (!e || !t)
return !1;
const n = t.getRootNode == null ? void 0 : t.getRootNode();
if (e.contains(t))
return !0;
if (n && sr(n)) {
let r = t;
for (; r; ) {
if (e === r)
return !0;
r = r.parentNode || r.host;
}
}
return !1;
}
function br(e) {
return (e == null ? void 0 : e.ownerDocument) || document;
}
var $s = typeof document < "u", Ys = function() {
}, jt = $s ? Io : Ys;
const Gs = {
...B
}, qs = Gs.useInsertionEffect, Xs = qs || ((e) => e());
function Js(e) {
const t = B.useRef(() => {
if (process.env.NODE_ENV !== "production")
throw new Error("Cannot call an event handler while rendering.");
});
return Xs(() => {
t.current = e;
}), B.useCallback(function() {
for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
r[o] = arguments[o];
return t.current == null ? void 0 : t.current(...r);
}, []);
}
const _o = () => ({
getShadowRoot: !0,
displayCheck: (
// JSDOM does not support the `tabbable` library. To solve this we can
// check if `ResizeObserver` is a real function (not polyfilled), which
// determines if the current environment is JSDOM-like.
typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
)
});
function Bo(e, t) {
const n = zo(e, _o()), r = n.length;
if (r === 0) return;
const o = Vs(br(e)), i = n.indexOf(o), s = i === -1 ? t === 1 ? 0 : r - 1 : i + t;
return n[s];
}
function Qs(e) {
return Bo(br(e).body, 1) || e;
}
function Zs(e) {
return Bo(br(e).body, -1) || e;
}
function Qn(e, t) {
const n = t || e.currentTarget, r = e.relatedTarget;
return !r || !Us(n, r);
}
function Ks(e) {
zo(e, _o()).forEach((n) => {
n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
});
}
function Gr(e) {
e.querySelectorAll("[data-tabindex]").forEach((n) => {
const r = n.dataset.tabindex;
delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
});
}
function qr(e, t, n) {
let {
reference: r,
floating: o
} = e;
const i = bt(t), s = Po(t), l = Mo(s), a = At(t), c = i === "y", u = r.x + r.width / 2 - o.width / 2, f = r.y + r.height / 2 - o.height / 2, p = r[l] / 2 - o[l] / 2;
let g;
switch (a) {
case "top":
g = {
x: u,
y: r.y - o.height
};
break;
case "bottom":
g = {
x: u,
y: r.y + r.height
};
break;
case "right":
g = {
x: r.x + r.width,
y: f
};
break;
case "left":
g = {
x: r.x - o.width,
y: f
};
break;
default:
g = {
x: r.x,
y: r.y
};
}
switch (mn(t)) {
case "start":
g[s] -= p * (n && c ? -1 : 1);
break;
case "end":
g[s] += p * (n && c ? -1 : 1);
break;
}
return g;
}
const el = async (e, t, n) => {
const {
placement: r = "bottom",
strategy: o = "absolute",
middleware: i = [],
platform: s
} = n, l = i.filter(Boolean), a = await (s.isRTL == null ? void 0 : s.isRTL(t));
let c = await s.getElementRects({
reference: e,
floating: t,
strategy: o
}), {
x: u,
y: f
} = qr(c, r, a), p = r, g = {}, x = 0;
for (let b = 0; b < l.length; b++) {
const {
name: v,
fn: m
} = l[b], {
x: h,
y,
data: C,
reset: T
} = await m({
x: u,
y: f,
initialPlacement: r,
placement: p,
strategy: o,
middlewareData: g,
rects: c,
platform: s,
elements: {
reference: e,
floating: t
}
});
u = h ?? u, f = y ?? f, g = {
...g,
[v]: {
...g[v],
...C
}
}, T && x <= 50 && (x++, typeof T == "object" && (T.placement && (p = T.placement), T.rects && (c = T.rects === !0 ? await s.getElementRects({
reference: e,
floating: t,
strategy: o
}) : T.rects), {
x: u,
y: f
} = qr(c, p, a)), b = -1);
}
return {
x: u,
y: f,
placement: p,
strategy: o,
middlewareData: g
};
};
async function yr(e, t) {
var n;
t === void 0 && (t = {});
const {
x: r,
y: o,
platform: i,
rects: s,
elements: l,
strategy: a
} = e, {
boundary: c = "clippingAncestors",
rootBoundary: u = "viewport",
elementContext: f = "floating",
altBoundary: p = !1,
padding: g = 0
} = gn(t, e), x = Ss(g), v = l[p ? f === "floating" ? "reference" : "floating" : f], m = Hn(await i.getClippingRect({
element: (n = await (i.isElement == null ? void 0 : i.isElement(v))) == null || n ? v : v.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(l.floating)),
boundary: c,
rootBoundary: u,
strategy: a
})), h = f === "floating" ? {
x: r,
y: o,
width: s.floating.width,
height: s.floating.height
} : s.reference, y = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(l.floating)), C = await (i.isElement == null ? void 0 : i.isElement(y)) ? await (i.getScale == null ? void 0 : i.getScale(y)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, T = Hn(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: l,
rect: h,
offsetParent: y,
strategy: a
}) : h);
return {
top: (m.top - T.top + x.top) / C.y,
bottom: (T.bottom - m.bottom + x.bottom) / C.y,
left: (m.left - T.left + x.left) / C.x,
right: (T.right - m.right + x.right) / C.x
};
}
const tl = function(e) {
return e === void 0 && (e = {}), {
name: "flip",
options: e,
async fn(t) {
var n, r;
const {
placement: o,
middlewareData: i,
rects: s,
initialPlacement: l,
platform: a,
elements: c
} = t, {
mainAxis: u = !0,
crossAxis: f = !0,
fallbackPlacements: p,
fallbackStrategy: g = "bestFit",
fallbackAxisSideDirection: x = "none",
flipAlignment: b = !0,
...v
} = gn(e, t);
if ((n = i.arrow) != null && n.alignmentOffset)
return {};
const m = At(o), h = bt(l), y = At(l) === l, C = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), T = p || (y || !b ? [kn(l)] : ws(l)), w = x !== "none";
!p && w && T.push(...ys(l, b, x, C));
const S = [l, ...T], R = await yr(t, v), P = [];
let M = ((r = i.flip) == null ? void 0 : r.overflows) || [];
if (u && P.push(R[m]), f) {
const k = xs(o, s, C);
P.push(R[k[0]], R[k[1]]);
}
if (M = [...M, {
placement: o,
overflows: P
}], !P.every((k) => k <= 0)) {
var L, W;
const k = (((L = i.flip) == null ? void 0 : L.index) || 0) + 1, V = S[k];
if (V && (!(f === "alignment" ? h !== bt(V) : !1) || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
M.every((U) => U.overflows[0] > 0 && bt(U.placement) === h)))
return {
data: {
index: k,
overflows: M
},
reset: {
placement: V
}
};
let X = (W = M.filter((ae) => ae.overflows[0] <= 0).sort((ae, U) => ae.overflows[1] - U.overflows[1])[0]) == null ? void 0 : W.placement;
if (!X)
switch (g) {
case "bestFit": {
var N;
const ae = (N = M.filter((U) => {
if (w) {
const K = bt(U.placement);
return K === h || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
K === "y";
}
return !0;
}).map((U) => [U.placement, U.overflows.filter((K) => K > 0).reduce((K, se) => K + se, 0)]).sort((U, K) => U[1] - K[1])[0]) == null ? void 0 : N[0];
ae && (X = ae);
break;
}
case "initialPlacement":
X = l;
break;
}
if (o !== X)
return {
reset: {
placement: X
}
};
}
return {};
}
};
};
async function nl(e, t) {
const {
placement: n,
platform: r,
elements: o
} = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = At(n), l = mn(n), a = bt(n) === "y", c = ["left", "top"].includes(s) ? -1 : 1, u = i && a ? -1 : 1, f = gn(t, e);
let {
mainAxis: p,
crossAxis: g,
alignmentAxis: x
} = typeof f == "number" ? {
mainAxis: f,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: f.mainAxis || 0,
crossAxis: f.crossAxis || 0,
alignmentAxis: f.alignmentAxis
};
return l && typeof x == "number" && (g = l === "end" ? x * -1 : x), a ? {
x: g * u,
y: p * c
} : {
x: p * c,
y: g * u
};
}
const rl = function(e) {
return e === void 0 && (e = 0), {
name: "offset",
options: e,
async fn(t) {
var n, r;
const {
x: o,
y: i,
placement: s,
middlewareData: l
} = t, a = await nl(t, e);
return s === ((n = l.offset) == null ? void 0 : n.placement) && (r = l.arrow) != null && r.alignmentOffset ? {} : {
x: o + a.x,
y: i + a.y,
data: {
...a,
placement: s
}
};
}
};
}, ol = function(e) {
return e === void 0 && (e = {}), {
name: "shift",
options: e,
async fn(t) {
const {
x: n,
y: r,
placement: o
} = t, {
mainAxis: i = !0,
crossAxis: s = !1,
limiter: l = {
fn: (v) => {
let {
x: m,
y: h
} = v;
return {
x: m,
y: h
};
}
},
...a
} = gn(e, t), c = {
x: n,
y: r
}, u = await yr(t, a), f = bt(At(o)), p = Ho(f);
let g = c[p], x = c[f];
if (i) {
const v = p === "y" ? "top" : "left", m = p === "y" ? "bottom" : "right", h = g + u[v], y = g - u[m];
g = Ur(h, g, y);
}
if (s) {
const v = f === "y" ? "top" : "left", m = f === "y" ? "bottom" : "right", h = x + u[v], y = x - u[m];
x = Ur(h, x, y);
}
const b = l.fn({
...t,
[p]: g,
[f]: x
});
return {
...b,
data: {
x: b.x - n,
y: b.y - r,
enabled: {
[p]: i,
[f]: s
}
}
};
}
};
}, il = function(e) {
return e === void 0 && (e = {}), {
name: "size",
options: e,
async fn(t) {
var n, r;
const {
placement: o,
rects: i,
platform: s,
elements: l
} = t, {
apply: a = () => {
},
...c
} = gn(e, t), u = await yr(t, c), f = At(o), p = mn(o), g = bt(o) === "y", {
width: x,
height: b
} = i.floating;
let v, m;
f === "top" || f === "bottom" ? (v = f, m = p === (await (s.isRTL == null ? void 0 : s.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (m = f, v = p === "end" ? "top" : "bottom");
const h = b - u.top - u.bottom, y = x - u.left - u.right, C = Vt(b - u[v], h), T = Vt(x - u[m], y), w = !t.middlewareData.shift;
let S = C, R = T;
if ((n = t.middlewareData.shift) != null && n.enabled.x && (R = y), (r = t.middlewareData.shift) != null && r.enabled.y && (S = h), w && !p) {
const M = Qe(u.left, 0), L = Qe(u.right, 0), W = Qe(u.top, 0), N = Qe(u.bottom, 0);
g ? R = x - 2 * (M !== 0 || L !== 0 ? M + L : Qe(u.left, u.right)) : S = b - 2 * (W !== 0 || N !== 0 ? W + N : Qe(u.top, u.bottom));
}
await a({
...t,
availableWidth: R,
availableHeight: S
});
const P = await s.getDimensions(l.floating);
return x !== P.width || b !== P.height ? {
reset: {
rects: !0
}
} : {};
}
};
};
function No(e) {
const t = it(e);
let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
const o = mt(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, l = On(n) !== i || On(r) !== s;
return l && (n = i, r = s), {
width: n,
height: r,
$: l
};
}
function Tr(e) {
return De(e) ? e : e.contextElement;
}
function Bt(e) {
const t = Tr(e);
if (!mt(t))
return gt(1);
const n = t.getBoundingClientRect(), {
width: r,
height: o,
$: i
} = No(t);
let s = (i ? On(n.width) : n.width) / r, l = (i ? On(n.height) : n.height) / o;
return (!s || !Number.isFinite(s)) && (s = 1), (!l || !Number.isFinite(l)) && (l = 1), {
x: s,
y: l
};
}
const sl = /* @__PURE__ */ gt(0);
function Wo(e) {
const t = Ke(e);
return !wr() || !t.visualViewport ? sl : {
x: t.visualViewport.offsetLeft,
y: t.visualViewport.offsetTop
};
}
function ll(e, t, n) {
return t === void 0 && (t = !1), !n || t && n !== Ke(e) ? !1 : t;
}
function Lt(e, t, n, r) {
t === void 0 && (t = !1), n === void 0 && (n = !1);
const o = e.getBoundingClientRect(), i = Tr(e);
let s = gt(1);
t && (r ? De(r) && (s = Bt(r)) : s = Bt(e));
const l = ll(i, n, r) ? Wo(i) : gt(0);
let a = (o.left + l.x) / s.x, c = (o.top + l.y) / s.y, u = o.width / s.x, f = o.height / s.y;
if (i) {
const p = Ke(i), g = r && De(r) ? Ke(r) : r;
let x = p, b = lr(x);
for (; b && r && g !== x; ) {
const v = Bt(b), m = b.getBoundingClientRect(), h = it(b), y = m.left + (b.clientLeft + parseFloat(h.paddingLeft)) * v.x, C = m.top + (b.clientTop + parseFloat(h.paddingTop)) * v.y;
a *= v.x, c *= v.y, u *= v.x, f *= v.y, a += y, c += C, x = Ke(b), b = lr(x);
}
}
return Hn({
width: u,
height: f,
x: a,
y: c
});
}
function Sr(e, t) {
const n = Wn(e).scrollLeft;
return t ? t.left + n : Lt(vt(e)).left + n;
}
function Vo(e, t, n) {
n === void 0 && (n = !1);
const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
// RTL <body> scrollbar.
Sr(e, r)
)), i = r.top + t.scrollTop;
return {
x: o,
y: i
};
}
function al(e) {
let {
elements: t,
rect: n,
offsetParent: r,
strategy: o
} = e;
const i = o === "fixed", s = vt(r), l = t ? Nn(t.floating) : !1;
if (r === s || l && i)
return n;
let a = {
scrollLeft: 0,
scrollTop: 0
}, c = gt(1);
const u = gt(0), f = mt(r);
if ((f || !f && !i) && ((Yt(r) !== "body" || hn(s)) && (a = Wn(r)), mt(r))) {
const g = Lt(r);
c = Bt(r), u.x = g.x + r.clientLeft, u.y = g.y + r.clientTop;
}
const p = s && !f && !i ? Vo(s, a, !0) : gt(0);
return {
width: n.width * c.x,
height: n.height * c.y,
x: n.x * c.x - a.scrollLeft * c.x + u.x + p.x,
y: n.y * c.y - a.scrollTop * c.y + u.y + p.y
};
}
function cl(e) {
return Array.from(e.getClientRects());
}
function ul(e) {
const t = vt(e), n = Wn(e), r = e.ownerDocument.body, o = Qe(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = Qe(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
let s = -n.scrollLeft + Sr(e);
const l = -n.scrollTop;
return it(r).direction === "rtl" && (s += Qe(t.clientWidth, r.clientWidth) - o)