@meltdownjs/droppy
Version:
@meltdownjs/droppy is a react library which provides hooks for creating virtualized Select-, MultiSelect-, ComboBox- & MultiComboBox-Components easily.
1,697 lines (1,695 loc) • 952 kB
JavaScript
var gr = (e) => {
throw TypeError(e);
};
var wn = (e, t, n) => t.has(e) || gr("Cannot " + n);
var y = (e, t, n) => (wn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), ee = (e, t, n) => t.has(e) ? gr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), W = (e, t, n, r) => (wn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), ie = (e, t, n) => (wn(e, t, "access private method"), n);
import * as b from "react";
import ni, { useLayoutEffect as ri, useEffect as ct, useRef as Ut, useState as De, useCallback as Ot, isValidElement as $i, cloneElement as Bi } from "react";
import * as Ui from "react-dom";
import { flushSync as Ki } from "react-dom";
function an() {
return typeof window < "u";
}
function It(e) {
return ii(e) ? (e.nodeName || "").toLowerCase() : "#document";
}
function ye(e) {
var t;
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
}
function ke(e) {
var t;
return (t = (ii(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
}
function ii(e) {
return an() ? e instanceof Node || e instanceof ye(e).Node : !1;
}
function te(e) {
return an() ? e instanceof Element || e instanceof ye(e).Element : !1;
}
function ve(e) {
return an() ? e instanceof HTMLElement || e instanceof ye(e).HTMLElement : !1;
}
function Mn(e) {
return !an() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof ye(e).ShadowRoot;
}
function Kt(e) {
const {
overflow: t,
overflowX: n,
overflowY: r,
display: i
} = Oe(e);
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(i);
}
function Hi(e) {
return ["table", "td", "th"].includes(It(e));
}
function ln(e) {
return [":popover-open", ":modal"].some((t) => {
try {
return e.matches(t);
} catch {
return !1;
}
});
}
function Jn(e) {
const t = un(), n = te(e) ? Oe(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 qi(e) {
let t = Ve(e);
for (; ve(t) && !ze(t); ) {
if (Jn(t))
return t;
if (ln(t))
return null;
t = Ve(t);
}
return null;
}
function un() {
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
}
function ze(e) {
return ["html", "body", "#document"].includes(It(e));
}
function Oe(e) {
return ye(e).getComputedStyle(e);
}
function fn(e) {
return te(e) ? {
scrollLeft: e.scrollLeft,
scrollTop: e.scrollTop
} : {
scrollLeft: e.scrollX,
scrollTop: e.scrollY
};
}
function Ve(e) {
if (It(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.
Mn(e) && e.host || // Fallback.
ke(e)
);
return Mn(t) ? t.host : t;
}
function si(e) {
const t = Ve(e);
return ze(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : ve(t) && Kt(t) ? t : si(t);
}
function Ye(e, t, n) {
var r;
t === void 0 && (t = []), n === void 0 && (n = !0);
const i = si(e), o = i === ((r = e.ownerDocument) == null ? void 0 : r.body), s = ye(i);
if (o) {
const c = Fn(s);
return t.concat(s, s.visualViewport || [], Kt(i) ? i : [], c && n ? Ye(c) : []);
}
return t.concat(i, Ye(i, [], n));
}
function Fn(e) {
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
}
function pr(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 Dn(e, t) {
if (!e || !t)
return !1;
const n = t.getRootNode == null ? void 0 : t.getRootNode();
if (e.contains(t))
return !0;
if (n && Mn(n)) {
let r = t;
for (; r; ) {
if (e === r)
return !0;
r = r.parentNode || r.host;
}
}
return !1;
}
function Qi() {
const e = navigator.userAgentData;
return e != null && e.platform ? e.platform : navigator.platform;
}
function oi() {
const e = navigator.userAgentData;
return e && Array.isArray(e.brands) ? e.brands.map((t) => {
let {
brand: n,
version: r
} = t;
return n + "/" + r;
}).join(" ") : navigator.userAgent;
}
function Yi(e) {
return e.mozInputSource === 0 && e.isTrusted ? !0 : kn() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
}
function Ji(e) {
return Gi() ? !1 : !kn() && e.width === 0 && e.height === 0 || kn() && e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
e.width < 1 && e.height < 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "touch";
}
function kn() {
const e = /android/i;
return e.test(Qi()) || e.test(oi());
}
function Gi() {
return oi().includes("jsdom/");
}
function mr(e, t) {
return ["mouse", "pen"].includes(e);
}
function Xi(e) {
return "nativeEvent" in e;
}
function Zi(e) {
return e.matches("html,body");
}
function An(e) {
return (e == null ? void 0 : e.ownerDocument) || document;
}
function Rn(e, t) {
if (t == null)
return !1;
if ("composedPath" in e)
return e.composedPath().includes(t);
const n = e;
return n.target != null && t.contains(n.target);
}
function Mt(e) {
return "composedPath" in e ? e.composedPath()[0] : e.target;
}
const es = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
function ci(e) {
return ve(e) && e.matches(es);
}
function Ee(e) {
e.preventDefault(), e.stopPropagation();
}
function ts(e) {
return e ? e.getAttribute("role") === "combobox" && ci(e) : !1;
}
const Nt = Math.min, xe = Math.max, nn = Math.round, pt = Math.floor, Fe = (e) => ({
x: e,
y: e
}), ns = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, rs = {
start: "end",
end: "start"
};
function Gn(e, t) {
return typeof e == "function" ? e(t) : e;
}
function St(e) {
return e.split("-")[0];
}
function dn(e) {
return e.split("-")[1];
}
function is(e) {
return e === "x" ? "y" : "x";
}
function ai(e) {
return e === "y" ? "height" : "width";
}
function zt(e) {
return ["top", "bottom"].includes(St(e)) ? "y" : "x";
}
function li(e) {
return is(zt(e));
}
function ss(e, t, n) {
n === void 0 && (n = !1);
const r = dn(e), i = li(e), o = ai(i);
let s = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
return t.reference[o] > t.floating[o] && (s = rn(s)), [s, rn(s)];
}
function os(e) {
const t = rn(e);
return [Ln(e), t, Ln(t)];
}
function Ln(e) {
return e.replace(/start|end/g, (t) => rs[t]);
}
function cs(e, t, n) {
const r = ["left", "right"], i = ["right", "left"], o = ["top", "bottom"], s = ["bottom", "top"];
switch (e) {
case "top":
case "bottom":
return n ? t ? i : r : t ? r : i;
case "left":
case "right":
return t ? o : s;
default:
return [];
}
}
function as(e, t, n, r) {
const i = dn(e);
let o = cs(St(e), n === "start", r);
return i && (o = o.map((s) => s + "-" + i), t && (o = o.concat(o.map(Ln)))), o;
}
function rn(e) {
return e.replace(/left|right|bottom|top/g, (t) => ns[t]);
}
function ls(e) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...e
};
}
function us(e) {
return typeof e != "number" ? ls(e) : {
top: e,
right: e,
bottom: e,
left: e
};
}
function sn(e) {
const {
x: t,
y: n,
width: r,
height: i
} = e;
return {
width: r,
height: i,
top: n,
left: t,
right: t + r,
bottom: n + i,
x: t,
y: n
};
}
var Jt = { exports: {} }, Ft = {};
/**
* @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 vr;
function fs() {
if (vr) return Ft;
vr = 1;
var e = ni, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
function s(c, l, f) {
var u, d = {}, h = null, g = null;
f !== void 0 && (h = "" + f), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (g = l.ref);
for (u in l) r.call(l, u) && !o.hasOwnProperty(u) && (d[u] = l[u]);
if (c && c.defaultProps) for (u in l = c.defaultProps, l) d[u] === void 0 && (d[u] = l[u]);
return { $$typeof: t, type: c, key: h, ref: g, props: d, _owner: i.current };
}
return Ft.Fragment = n, Ft.jsx = s, Ft.jsxs = s, Ft;
}
var Dt = {};
/**
* @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 br;
function ds() {
return br || (br = 1, process.env.NODE_ENV !== "production" && function() {
var e = ni, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), c = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), g = Symbol.for("react.offscreen"), m = Symbol.iterator, p = "@@iterator";
function w(a) {
if (a === null || typeof a != "object")
return null;
var v = m && a[m] || a[p];
return typeof v == "function" ? v : null;
}
var E = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function x(a) {
{
for (var v = arguments.length, O = new Array(v > 1 ? v - 1 : 0), k = 1; k < v; k++)
O[k - 1] = arguments[k];
R("error", a, O);
}
}
function R(a, v, O) {
{
var k = E.ReactDebugCurrentFrame, Q = k.getStackAddendum();
Q !== "" && (v += "%s", O = O.concat([Q]));
var Z = O.map(function(B) {
return String(B);
});
Z.unshift("Warning: " + v), Function.prototype.apply.call(console[a], console, Z);
}
}
var I = !1, F = !1, C = !1, _ = !1, K = !1, A;
A = Symbol.for("react.module.reference");
function J(a) {
return !!(typeof a == "string" || typeof a == "function" || a === r || a === o || K || a === i || a === f || a === u || _ || a === g || I || F || C || typeof a == "object" && a !== null && (a.$$typeof === h || a.$$typeof === d || a.$$typeof === s || a.$$typeof === c || a.$$typeof === l || // 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.
a.$$typeof === A || a.getModuleId !== void 0));
}
function q(a, v, O) {
var k = a.displayName;
if (k)
return k;
var Q = v.displayName || v.name || "";
return Q !== "" ? O + "(" + Q + ")" : O;
}
function z(a) {
return a.displayName || "Context";
}
function N(a) {
if (a == null)
return null;
if (typeof a.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
return a.displayName || a.name || null;
if (typeof a == "string")
return a;
switch (a) {
case r:
return "Fragment";
case n:
return "Portal";
case o:
return "Profiler";
case i:
return "StrictMode";
case f:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof a == "object")
switch (a.$$typeof) {
case c:
var v = a;
return z(v) + ".Consumer";
case s:
var O = a;
return z(O._context) + ".Provider";
case l:
return q(a, a.render, "ForwardRef");
case d:
var k = a.displayName || null;
return k !== null ? k : N(a.type) || "Memo";
case h: {
var Q = a, Z = Q._payload, B = Q._init;
try {
return N(B(Z));
} catch {
return null;
}
}
}
return null;
}
var X = Object.assign, P = 0, S, U, D, T, H, se, oe;
function Ce() {
}
Ce.__reactDisabledLog = !0;
function Ae() {
{
if (P === 0) {
S = console.log, U = console.info, D = console.warn, T = console.error, H = console.group, se = console.groupCollapsed, oe = console.groupEnd;
var a = {
configurable: !0,
enumerable: !0,
value: Ce,
writable: !0
};
Object.defineProperties(console, {
info: a,
log: a,
warn: a,
error: a,
group: a,
groupCollapsed: a,
groupEnd: a
});
}
P++;
}
}
function at() {
{
if (P--, P === 0) {
var a = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: X({}, a, {
value: S
}),
info: X({}, a, {
value: U
}),
warn: X({}, a, {
value: D
}),
error: X({}, a, {
value: T
}),
group: X({}, a, {
value: H
}),
groupCollapsed: X({}, a, {
value: se
}),
groupEnd: X({}, a, {
value: oe
})
});
}
P < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var ce = E.ReactCurrentDispatcher, le;
function de(a, v, O) {
{
if (le === void 0)
try {
throw Error();
} catch (Q) {
var k = Q.stack.trim().match(/\n( *(at )?)/);
le = k && k[1] || "";
}
return `
` + le + a;
}
}
var Xe = !1, Le;
{
var lt = typeof WeakMap == "function" ? WeakMap : Map;
Le = new lt();
}
function We(a, v) {
if (!a || Xe)
return "";
{
var O = Le.get(a);
if (O !== void 0)
return O;
}
var k;
Xe = !0;
var Q = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var Z;
Z = ce.current, ce.current = null, Ae();
try {
if (v) {
var B = function() {
throw Error();
};
if (Object.defineProperty(B.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(B, []);
} catch (pe) {
k = pe;
}
Reflect.construct(a, [], B);
} else {
try {
B.call();
} catch (pe) {
k = pe;
}
a.call(B.prototype);
}
} else {
try {
throw Error();
} catch (pe) {
k = pe;
}
a();
}
} catch (pe) {
if (pe && k && typeof pe.stack == "string") {
for (var V = pe.stack.split(`
`), he = k.stack.split(`
`), ne = V.length - 1, re = he.length - 1; ne >= 1 && re >= 0 && V[ne] !== he[re]; )
re--;
for (; ne >= 1 && re >= 0; ne--, re--)
if (V[ne] !== he[re]) {
if (ne !== 1 || re !== 1)
do
if (ne--, re--, re < 0 || V[ne] !== he[re]) {
var Re = `
` + V[ne].replace(" at new ", " at ");
return a.displayName && Re.includes("<anonymous>") && (Re = Re.replace("<anonymous>", a.displayName)), typeof a == "function" && Le.set(a, Re), Re;
}
while (ne >= 1 && re >= 0);
break;
}
}
} finally {
Xe = !1, ce.current = Z, at(), Error.prepareStackTrace = Q;
}
var ht = a ? a.displayName || a.name : "", tt = ht ? de(ht) : "";
return typeof a == "function" && Le.set(a, tt), tt;
}
function ut(a, v, O) {
return We(a, !1);
}
function Ze(a) {
var v = a.prototype;
return !!(v && v.isReactComponent);
}
function we(a, v, O) {
if (a == null)
return "";
if (typeof a == "function")
return We(a, Ze(a));
if (typeof a == "string")
return de(a);
switch (a) {
case f:
return de("Suspense");
case u:
return de("SuspenseList");
}
if (typeof a == "object")
switch (a.$$typeof) {
case l:
return ut(a.render);
case d:
return we(a.type, v, O);
case h: {
var k = a, Q = k._payload, Z = k._init;
try {
return we(Z(Q), v, O);
} catch {
}
}
}
return "";
}
var Te = Object.prototype.hasOwnProperty, Ct = {}, Tt = E.ReactDebugCurrentFrame;
function L(a) {
if (a) {
var v = a._owner, O = we(a.type, a._source, v ? v.type : null);
Tt.setExtraStackFrame(O);
} else
Tt.setExtraStackFrame(null);
}
function G(a, v, O, k, Q) {
{
var Z = Function.call.bind(Te);
for (var B in a)
if (Z(a, B)) {
var V = void 0;
try {
if (typeof a[B] != "function") {
var he = Error((k || "React class") + ": " + O + " type `" + B + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[B] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw he.name = "Invariant Violation", he;
}
V = a[B](v, B, k, O, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (ne) {
V = ne;
}
V && !(V instanceof Error) && (L(Q), x("%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).", k || "React class", O, B, typeof V), L(null)), V instanceof Error && !(V.message in Ct) && (Ct[V.message] = !0, L(Q), x("Failed %s type: %s", O, V.message), L(null));
}
}
}
var M = Array.isArray;
function j(a) {
return M(a);
}
function ue(a) {
{
var v = typeof Symbol == "function" && Symbol.toStringTag, O = v && a[Symbol.toStringTag] || a.constructor.name || "Object";
return O;
}
}
function ae(a) {
try {
return ft(a), !1;
} catch {
return !0;
}
}
function ft(a) {
return "" + a;
}
function et(a) {
if (ae(a))
return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ue(a)), ft(a);
}
var $e = E.ReactCurrentOwner, be = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, Se, Be;
function mn(a) {
if (Te.call(a, "ref")) {
var v = Object.getOwnPropertyDescriptor(a, "ref").get;
if (v && v.isReactWarning)
return !1;
}
return a.ref !== void 0;
}
function qt(a) {
if (Te.call(a, "key")) {
var v = Object.getOwnPropertyDescriptor(a, "key").get;
if (v && v.isReactWarning)
return !1;
}
return a.key !== void 0;
}
function Qt(a, v) {
typeof a.ref == "string" && $e.current;
}
function Yt(a, v) {
{
var O = function() {
Se || (Se = !0, x("%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)", v));
};
O.isReactWarning = !0, Object.defineProperty(a, "key", {
get: O,
configurable: !0
});
}
}
function Ue(a, v) {
{
var O = function() {
Be || (Be = !0, x("%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)", v));
};
O.isReactWarning = !0, Object.defineProperty(a, "ref", {
get: O,
configurable: !0
});
}
}
var Pe = function(a, v, O, k, Q, Z, B) {
var V = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: a,
key: v,
ref: O,
props: B,
// Record the component responsible for creating this element.
_owner: Z
};
return V._store = {}, Object.defineProperty(V._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(V, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: k
}), Object.defineProperty(V, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: Q
}), Object.freeze && (Object.freeze(V.props), Object.freeze(V)), V;
};
function dt(a, v, O, k, Q) {
{
var Z, B = {}, V = null, he = null;
O !== void 0 && (et(O), V = "" + O), qt(v) && (et(v.key), V = "" + v.key), mn(v) && (he = v.ref, Qt(v, Q));
for (Z in v)
Te.call(v, Z) && !be.hasOwnProperty(Z) && (B[Z] = v[Z]);
if (a && a.defaultProps) {
var ne = a.defaultProps;
for (Z in ne)
B[Z] === void 0 && (B[Z] = ne[Z]);
}
if (V || he) {
var re = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
V && Yt(B, re), he && Ue(B, re);
}
return Pe(a, V, he, Q, k, $e.current, B);
}
}
var Pt = E.ReactCurrentOwner, _t = E.ReactDebugCurrentFrame;
function je(a) {
if (a) {
var v = a._owner, O = we(a.type, a._source, v ? v.type : null);
_t.setExtraStackFrame(O);
} else
_t.setExtraStackFrame(null);
}
var vn;
vn = !1;
function bn(a) {
return typeof a == "object" && a !== null && a.$$typeof === t;
}
function ar() {
{
if (Pt.current) {
var a = N(Pt.current.type);
if (a)
return `
Check the render method of \`` + a + "`.";
}
return "";
}
}
function Fi(a) {
return "";
}
var lr = {};
function Di(a) {
{
var v = ar();
if (!v) {
var O = typeof a == "string" ? a : a.displayName || a.name;
O && (v = `
Check the top-level render call using <` + O + ">.");
}
return v;
}
}
function ur(a, v) {
{
if (!a._store || a._store.validated || a.key != null)
return;
a._store.validated = !0;
var O = Di(v);
if (lr[O])
return;
lr[O] = !0;
var k = "";
a && a._owner && a._owner !== Pt.current && (k = " It was passed a child from " + N(a._owner.type) + "."), je(a), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', O, k), je(null);
}
}
function fr(a, v) {
{
if (typeof a != "object")
return;
if (j(a))
for (var O = 0; O < a.length; O++) {
var k = a[O];
bn(k) && ur(k, v);
}
else if (bn(a))
a._store && (a._store.validated = !0);
else if (a) {
var Q = w(a);
if (typeof Q == "function" && Q !== a.entries)
for (var Z = Q.call(a), B; !(B = Z.next()).done; )
bn(B.value) && ur(B.value, v);
}
}
}
function ki(a) {
{
var v = a.type;
if (v == null || typeof v == "string")
return;
var O;
if (typeof v == "function")
O = v.propTypes;
else if (typeof v == "object" && (v.$$typeof === l || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
v.$$typeof === d))
O = v.propTypes;
else
return;
if (O) {
var k = N(v);
G(O, a.props, "prop", k, a);
} else if (v.PropTypes !== void 0 && !vn) {
vn = !0;
var Q = N(v);
x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Q || "Unknown");
}
typeof v.getDefaultProps == "function" && !v.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Ai(a) {
{
for (var v = Object.keys(a.props), O = 0; O < v.length; O++) {
var k = v[O];
if (k !== "children" && k !== "key") {
je(a), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", k), je(null);
break;
}
}
a.ref !== null && (je(a), x("Invalid attribute `ref` supplied to `React.Fragment`."), je(null));
}
}
var dr = {};
function hr(a, v, O, k, Q, Z) {
{
var B = J(a);
if (!B) {
var V = "";
(a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (V += " 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 he = Fi();
he ? V += he : V += ar();
var ne;
a === null ? ne = "null" : j(a) ? ne = "array" : a !== void 0 && a.$$typeof === t ? (ne = "<" + (N(a.type) || "Unknown") + " />", V = " Did you accidentally export a JSX literal instead of a component?") : ne = typeof a, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ne, V);
}
var re = dt(a, v, O, Q, Z);
if (re == null)
return re;
if (B) {
var Re = v.children;
if (Re !== void 0)
if (k)
if (j(Re)) {
for (var ht = 0; ht < Re.length; ht++)
fr(Re[ht], a);
Object.freeze && Object.freeze(Re);
} else
x("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
fr(Re, a);
}
if (Te.call(v, "key")) {
var tt = N(a), pe = Object.keys(v).filter(function(Wi) {
return Wi !== "key";
}), yn = pe.length > 0 ? "{key: someKey, " + pe.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!dr[tt + yn]) {
var Vi = pe.length > 0 ? "{" + pe.join(": ..., ") + ": ...}" : "{}";
x(`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} />`, yn, tt, Vi, tt), dr[tt + yn] = !0;
}
}
return a === r ? Ai(re) : ki(re), re;
}
}
function Li(a, v, O) {
return hr(a, v, O, !0);
}
function ji(a, v, O) {
return hr(a, v, O, !1);
}
var Ni = ji, zi = Li;
Dt.Fragment = r, Dt.jsx = Ni, Dt.jsxs = zi;
}()), Dt;
}
var yr;
function hs() {
return yr || (yr = 1, process.env.NODE_ENV === "production" ? Jt.exports = fs() : Jt.exports = ds()), Jt.exports;
}
var gs = hs();
function wr(e, t, n) {
let {
reference: r,
floating: i
} = e;
const o = zt(t), s = li(t), c = ai(s), l = St(t), f = o === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, h = r[c] / 2 - i[c] / 2;
let g;
switch (l) {
case "top":
g = {
x: u,
y: r.y - i.height
};
break;
case "bottom":
g = {
x: u,
y: r.y + r.height
};
break;
case "right":
g = {
x: r.x + r.width,
y: d
};
break;
case "left":
g = {
x: r.x - i.width,
y: d
};
break;
default:
g = {
x: r.x,
y: r.y
};
}
switch (dn(t)) {
case "start":
g[s] -= h * (n && f ? -1 : 1);
break;
case "end":
g[s] += h * (n && f ? -1 : 1);
break;
}
return g;
}
const ps = async (e, t, n) => {
const {
placement: r = "bottom",
strategy: i = "absolute",
middleware: o = [],
platform: s
} = n, c = o.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
let f = await s.getElementRects({
reference: e,
floating: t,
strategy: i
}), {
x: u,
y: d
} = wr(f, r, l), h = r, g = {}, m = 0;
for (let p = 0; p < c.length; p++) {
const {
name: w,
fn: E
} = c[p], {
x,
y: R,
data: I,
reset: F
} = await E({
x: u,
y: d,
initialPlacement: r,
placement: h,
strategy: i,
middlewareData: g,
rects: f,
platform: s,
elements: {
reference: e,
floating: t
}
});
u = x ?? u, d = R ?? d, g = {
...g,
[w]: {
...g[w],
...I
}
}, F && m <= 50 && (m++, typeof F == "object" && (F.placement && (h = F.placement), F.rects && (f = F.rects === !0 ? await s.getElementRects({
reference: e,
floating: t,
strategy: i
}) : F.rects), {
x: u,
y: d
} = wr(f, h, l)), p = -1);
}
return {
x: u,
y: d,
placement: h,
strategy: i,
middlewareData: g
};
};
async function ui(e, t) {
var n;
t === void 0 && (t = {});
const {
x: r,
y: i,
platform: o,
rects: s,
elements: c,
strategy: l
} = e, {
boundary: f = "clippingAncestors",
rootBoundary: u = "viewport",
elementContext: d = "floating",
altBoundary: h = !1,
padding: g = 0
} = Gn(t, e), m = us(g), w = c[h ? d === "floating" ? "reference" : "floating" : d], E = sn(await o.getClippingRect({
element: (n = await (o.isElement == null ? void 0 : o.isElement(w))) == null || n ? w : w.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(c.floating)),
boundary: f,
rootBoundary: u,
strategy: l
})), x = d === "floating" ? {
x: r,
y: i,
width: s.floating.width,
height: s.floating.height
} : s.reference, R = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c.floating)), I = await (o.isElement == null ? void 0 : o.isElement(R)) ? await (o.getScale == null ? void 0 : o.getScale(R)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, F = sn(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: c,
rect: x,
offsetParent: R,
strategy: l
}) : x);
return {
top: (E.top - F.top + m.top) / I.y,
bottom: (F.bottom - E.bottom + m.bottom) / I.y,
left: (E.left - F.left + m.left) / I.x,
right: (F.right - E.right + m.right) / I.x
};
}
const ms = function(e) {
return e === void 0 && (e = {}), {
name: "flip",
options: e,
async fn(t) {
var n, r;
const {
placement: i,
middlewareData: o,
rects: s,
initialPlacement: c,
platform: l,
elements: f
} = t, {
mainAxis: u = !0,
crossAxis: d = !0,
fallbackPlacements: h,
fallbackStrategy: g = "bestFit",
fallbackAxisSideDirection: m = "none",
flipAlignment: p = !0,
...w
} = Gn(e, t);
if ((n = o.arrow) != null && n.alignmentOffset)
return {};
const E = St(i), x = zt(c), R = St(c) === c, I = await (l.isRTL == null ? void 0 : l.isRTL(f.floating)), F = h || (R || !p ? [rn(c)] : os(c)), C = m !== "none";
!h && C && F.push(...as(c, p, m, I));
const _ = [c, ...F], K = await ui(t, w), A = [];
let J = ((r = o.flip) == null ? void 0 : r.overflows) || [];
if (u && A.push(K[E]), d) {
const X = ss(i, s, I);
A.push(K[X[0]], K[X[1]]);
}
if (J = [...J, {
placement: i,
overflows: A
}], !A.every((X) => X <= 0)) {
var q, z;
const X = (((q = o.flip) == null ? void 0 : q.index) || 0) + 1, P = _[X];
if (P)
return {
data: {
index: X,
overflows: J
},
reset: {
placement: P
}
};
let S = (z = J.filter((U) => U.overflows[0] <= 0).sort((U, D) => U.overflows[1] - D.overflows[1])[0]) == null ? void 0 : z.placement;
if (!S)
switch (g) {
case "bestFit": {
var N;
const U = (N = J.filter((D) => {
if (C) {
const T = zt(D.placement);
return T === x || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
T === "y";
}
return !0;
}).map((D) => [D.placement, D.overflows.filter((T) => T > 0).reduce((T, H) => T + H, 0)]).sort((D, T) => D[1] - T[1])[0]) == null ? void 0 : N[0];
U && (S = U);
break;
}
case "initialPlacement":
S = c;
break;
}
if (i !== S)
return {
reset: {
placement: S
}
};
}
return {};
}
};
}, vs = function(e) {
return e === void 0 && (e = {}), {
name: "size",
options: e,
async fn(t) {
var n, r;
const {
placement: i,
rects: o,
platform: s,
elements: c
} = t, {
apply: l = () => {
},
...f
} = Gn(e, t), u = await ui(t, f), d = St(i), h = dn(i), g = zt(i) === "y", {
width: m,
height: p
} = o.floating;
let w, E;
d === "top" || d === "bottom" ? (w = d, E = h === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (E = d, w = h === "end" ? "top" : "bottom");
const x = p - u.top - u.bottom, R = m - u.left - u.right, I = Nt(p - u[w], x), F = Nt(m - u[E], R), C = !t.middlewareData.shift;
let _ = I, K = F;
if ((n = t.middlewareData.shift) != null && n.enabled.x && (K = R), (r = t.middlewareData.shift) != null && r.enabled.y && (_ = x), C && !h) {
const J = xe(u.left, 0), q = xe(u.right, 0), z = xe(u.top, 0), N = xe(u.bottom, 0);
g ? K = m - 2 * (J !== 0 || q !== 0 ? J + q : xe(u.left, u.right)) : _ = p - 2 * (z !== 0 || N !== 0 ? z + N : xe(u.top, u.bottom));
}
await l({
...t,
availableWidth: K,
availableHeight: _
});
const A = await s.getDimensions(c.floating);
return m !== A.width || p !== A.height ? {
reset: {
rects: !0
}
} : {};
}
};
};
function fi(e) {
const t = Oe(e);
let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
const i = ve(e), o = i ? e.offsetWidth : n, s = i ? e.offsetHeight : r, c = nn(n) !== o || nn(r) !== s;
return c && (n = o, r = s), {
width: n,
height: r,
$: c
};
}
function Xn(e) {
return te(e) ? e : e.contextElement;
}
function mt(e) {
const t = Xn(e);
if (!ve(t))
return Fe(1);
const n = t.getBoundingClientRect(), {
width: r,
height: i,
$: o
} = fi(t);
let s = (o ? nn(n.width) : n.width) / r, c = (o ? nn(n.height) : n.height) / i;
return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
x: s,
y: c
};
}
const bs = /* @__PURE__ */ Fe(0);
function di(e) {
const t = ye(e);
return !un() || !t.visualViewport ? bs : {
x: t.visualViewport.offsetLeft,
y: t.visualViewport.offsetTop
};
}
function ys(e, t, n) {
return t === void 0 && (t = !1), !n || t && n !== ye(e) ? !1 : t;
}
function ot(e, t, n, r) {
t === void 0 && (t = !1), n === void 0 && (n = !1);
const i = e.getBoundingClientRect(), o = Xn(e);
let s = Fe(1);
t && (r ? te(r) && (s = mt(r)) : s = mt(e));
const c = ys(o, n, r) ? di(o) : Fe(0);
let l = (i.left + c.x) / s.x, f = (i.top + c.y) / s.y, u = i.width / s.x, d = i.height / s.y;
if (o) {
const h = ye(o), g = r && te(r) ? ye(r) : r;
let m = h, p = Fn(m);
for (; p && r && g !== m; ) {
const w = mt(p), E = p.getBoundingClientRect(), x = Oe(p), R = E.left + (p.clientLeft + parseFloat(x.paddingLeft)) * w.x, I = E.top + (p.clientTop + parseFloat(x.paddingTop)) * w.y;
l *= w.x, f *= w.y, u *= w.x, d *= w.y, l += R, f += I, m = ye(p), p = Fn(m);
}
}
return sn({
width: u,
height: d,
x: l,
y: f
});
}
function Zn(e, t) {
const n = fn(e).scrollLeft;
return t ? t.left + n : ot(ke(e)).left + n;
}
function hi(e, t, n) {
n === void 0 && (n = !1);
const r = e.getBoundingClientRect(), i = r.left + t.scrollLeft - (n ? 0 : (
// RTL <body> scrollbar.
Zn(e, r)
)), o = r.top + t.scrollTop;
return {
x: i,
y: o
};
}
function ws(e) {
let {
elements: t,
rect: n,
offsetParent: r,
strategy: i
} = e;
const o = i === "fixed", s = ke(r), c = t ? ln(t.floating) : !1;
if (r === s || c && o)
return n;
let l = {
scrollLeft: 0,
scrollTop: 0
}, f = Fe(1);
const u = Fe(0), d = ve(r);
if ((d || !d && !o) && ((It(r) !== "body" || Kt(s)) && (l = fn(r)), ve(r))) {
const g = ot(r);
f = mt(r), u.x = g.x + r.clientLeft, u.y = g.y + r.clientTop;
}
const h = s && !d && !o ? hi(s, l, !0) : Fe(0);
return {
width: n.width * f.x,
height: n.height * f.y,
x: n.x * f.x - l.scrollLeft * f.x + u.x + h.x,
y: n.y * f.y - l.scrollTop * f.y + u.y + h.y
};
}
function Rs(e) {
return Array.from(e.getClientRects());
}
function Es(e) {
const t = ke(e), n = fn(e), r = e.ownerDocument.body, i = xe(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), o = xe(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
let s = -n.scrollLeft + Zn(e);
const c = -n.scrollTop;
return Oe(r).direction === "rtl" && (s += xe(t.clientWidth, r.clientWidth) - i), {
width: i,
height: o,
x: s,
y: c
};
}
function xs(e, t) {
const n = ye(e), r = ke(e), i = n.visualViewport;
let o = r.clientWidth, s = r.clientHeight, c = 0, l = 0;
if (i) {
o = i.width, s = i.height;
const f = un();
(!f || f && t === "fixed") && (c = i.offsetLeft, l = i.offsetTop);
}
return {
width: o,
height: s,
x: c,
y: l
};
}
function Os(e, t) {
const n = ot(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, o = ve(e) ? mt(e) : Fe(1), s = e.clientWidth * o.x, c = e.clientHeight * o.y, l = i * o.x, f = r * o.y;
return {
width: s,
height: c,
x: l,
y: f
};
}
function Rr(e, t, n) {
let r;
if (t === "viewport")
r = xs(e, n);
else if (t === "document")
r = Es(ke(e));
else if (te(t))
r = Os(t, n);
else {
const i = di(e);
r = {
x: t.x - i.x,
y: t.y - i.y,
width: t.width,
height: t.height
};
}
return sn(r);
}
function gi(e, t) {
const n = Ve(e);
return n === t || !te(n) || ze(n) ? !1 : Oe(n).position === "fixed" || gi(n, t);
}
function Ss(e, t) {
const n = t.get(e);
if (n)
return n;
let r = Ye(e, [], !1).filter((c) => te(c) && It(c) !== "body"), i = null;
const o = Oe(e).position === "fixed";
let s = o ? Ve(e) : e;
for (; te(s) && !ze(s); ) {
const c = Oe(s), l = Jn(s);
!l && c.position === "fixed" && (i = null), (o ? !l && !i : !l && c.position === "static" && !!i && ["absolute", "fixed"].includes(i.position) || Kt(s) && !l && gi(e, s)) ? r = r.filter((u) => u !== s) : i = c, s = Ve(s);
}
return t.set(e, r), r;
}
function Is(e) {
let {
element: t,
boundary: n,
rootBoundary: r,
strategy: i
} = e;
const s = [...n === "clippingAncestors" ? ln(t) ? [] : Ss(t, this._c) : [].concat(n), r], c = s[0], l = s.reduce((f, u) => {
const d = Rr(t, u, i);
return f.top = xe(d.top, f.top), f.right = Nt(d.right, f.right), f.bottom = Nt(d.bottom, f.bottom), f.left = xe(d.left, f.left), f;
}, Rr(t, c, i));
return {
width: l.right - l.left,
height: l.bottom - l.top,
x: l.left,
y: l.top
};
}
function Cs(e) {
const {
width: t,
height: n
} = fi(e);
return {
width: t,
height: n
};
}
function Ts(e, t, n) {
const r = ve(t), i = ke(t), o = n === "fixed", s = ot(e, !0, o, t);
let c = {
scrollLeft: 0,
scrollTop: 0
};
const l = Fe(0);
if (r || !r && !o)
if ((It(t) !== "body" || Kt(i)) && (c = fn(t)), r) {
const h = ot(t, !0, o, t);
l.x = h.x + t.clientLeft, l.y = h.y + t.clientTop;
} else i && (l.x = Zn(i));
const f = i && !r && !o ? hi(i, c) : Fe(0), u = s.left + c.scrollLeft - l.x - f.x, d = s.top + c.scrollTop - l.y - f.y;
return {
x: u,
y: d,
width: s.width,
height: s.height
};
}
function En(e) {
return Oe(e).position === "static";
}
function Er(e, t) {
if (!ve(e) || Oe(e).position === "fixed")
return null;
if (t)
return t(e);
let n = e.offsetParent;
return ke(e) === n && (n = n.ownerDocument.body), n;
}
function pi(e, t) {
const n = ye(e);
if (ln(e))
return n;
if (!ve(e)) {
let i = Ve(e);
for (; i && !ze(i); ) {
if (te(i) && !En(i))
return i;
i = Ve(i);
}
return n;
}
let r = Er(e, t);
for (; r && Hi(r) && En(r); )
r = Er(r, t);
return r && ze(r) && En(r) && !Jn(r) ? n : r || qi(e) || n;
}
const Ps = async function(e) {
const t = this.getOffsetParent || pi, n = this.getDimensions, r = await n(e.floating);
return {
reference: Ts(e.reference, await t(e.floating), e.strategy),
floating: {
x: 0,
y: 0,
width: r.width,
height: r.height
}
};
};
function _s(e) {
return Oe(e).direction === "rtl";
}
const Ms = {
convertOffsetParentRelativeRectToViewportRelativeRect: ws,
getDocumentElement: ke,
getClippingRect: Is,
getOffsetParent: pi,
getElementRects: Ps,
getClientRects: Rs,
getDimensions: Cs,
getScale: mt,
isElement: te,
isRTL: _s
};
function mi(e, t) {
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
}
function Fs(e, t) {
let n = null, r;
const i = ke(e);
function o() {
var c;
clearTimeout(r), (c = n) == null || c.disconnect(), n = null;
}
function s(c, l) {
c === void 0 && (c = !1), l === void 0 && (l = 1), o();
const f = e.getBoundingClientRect(), {
left: u,
top: d,
width: h,
height: g
} = f;
if (c || t(), !h || !g)
return;
const m = pt(d), p = pt(i.clientWidth - (u + h)), w = pt(i.clientHeight - (d + g)), E = pt(u), R = {
rootMargin: -m + "px " + -p + "px " + -w + "px " + -E + "px",
threshold: xe(0, Nt(1, l)) || 1
};
let I = !0;
function F(C) {
const _ = C[0].intersectionRatio;
if (_ !== l) {
if (!I)
return s();
_ ? s(!1, _) : r = setTimeout(() => {
s(!1, 1e-7);
}, 1e3);
}
_ === 1 && !mi(f, e.getBoundingClientRect()) && s(), I = !1;
}
try {
n = new IntersectionObserver(F, {
...R,
// Handle <iframe>s
root: i.ownerDocument
});
} catch {
n = new IntersectionObserver(F, R);
}
n.observe(e);
}
return s(!0), o;
}
function Ds(e, t, n, r) {
r === void 0 && (r = {});
const {
ancestorScroll: i = !0,
ancestorResize: o = !0,
elementResize: s = typeof ResizeObserver == "function",
layoutShift: c = typeof IntersectionObserver == "function",
animationFrame: l = !1
} = r, f = Xn(e), u = i || o ? [...f ? Ye(f) : [], ...Ye(t)] : [];
u.forEach((E) => {
i && E.addEventListener("scroll", n, {
passive: !0
}), o && E.addEventListener("resize", n);
});
const d = f && c ? Fs(f, n) : null;
let h = -1, g = null;
s && (g = new ResizeObserver((E) => {
let [x] = E;
x && x.target === f && g && (g.unobserve(t), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
var R;
(R = g) == null || R.observe(t);
})), n();
}), f && !l && g.observe(f), g.observe(t));
let m, p = l ? ot(e) : null;
l && w();
function w() {
const E = ot(e);
p && !mi(p, E) && n(), p = E, m = requestAnimationFrame(w);
}
return n(), () => {
var E;
u.forEach((x) => {
i && x.removeEventListener("scroll", n), o && x.removeEventListener("resize", n);
}), d == null || d(), (E = g) == null || E.disconnect(), g = null, l && cancelAnimationFrame(m);
};
}
const ks = ms, As = vs, Ls = (e, t, n) => {
const r = /* @__PURE__ */ new Map(), i = {
platform: Ms,
...n
}, o = {
...i.platform,
_c: r
};
return ps(e, t, {
...i,
platform: o
});
};
var Xt = typeof document < "u" ? ri : ct;
function on(e, t) {
if (e === t)
return !0;
if (typeof e != typeof t)
return !1;
if (typeof e == "function" && e.toString() === t.toString())
return !0;
let n, r, i;
if (e && t && typeof e == "object") {
if (Array.isArray(e)) {
if (n = e.length, n !== t.length) return !1;
for (r = n; r-- !== 0; )
if (!on(e[r], t[r]))
return !1;
return !0;
}
if (i = Object.keys(e), n = i.length, n !== Object.keys(t).length)
return !1;
for (r = n; r-- !== 0; )
if (!{}.hasOwnProperty.call(t, i[r]))
return !1;
for (r = n; r-- !== 0; ) {
const o = i[r];
if (!(o === "_owner" && e.$$typeof) && !on(e[o], t[o]))
return !1;
}
return !0;
}
return e !== e && t !== t;
}
function vi(e) {
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
}
function xr(e, t) {
const n = vi(e);
return Math.round(t * n) / n;
}
function xn(e) {
const t = b.useRef(e);
return Xt(() => {
t.current = e;
}), t;
}
function js(e) {
e === void 0 && (e = {});
const {
placement: t = "bottom",
strategy: n = "absolute",
middleware: r = [],
platform: i,
elements: {
reference: o,
floating: s
} = {},
transform: c = !0,
whileElementsMounted: l,
open: f
} = e, [u, d] = b.useState({
x: 0,
y: 0,
strategy: n,
placement: t,
middlewareData: {},
isPositioned: !1
}), [h, g] = b.useState(r);
on(h, r) || g(r);
const [m, p] = b.useState(null), [w, E] = b.useState(null), x = b.useCallback((D) => {
D !== C.current && (C.current = D, p(D));
}, []), R = b.useCallback((D) => {
D !== _.current && (_.current = D, E(D));
}, []), I = o || m, F = s || w, C = b.useRef(null), _ = b.useRef(null), K = b.useRef(u), A = l != null, J = xn(l), q = xn(i), z = xn(f), N = b.useCallback(() => {
if (!C.current || !_.current)
return;
const D = {
placement: t,
strategy: n,
middleware: h
};
q.current && (D.platform = q.current), Ls(C.current, _.current, D).then((T) => {
const H = {
...T,
// 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: z.current !== !1
};
X.current && !on(K.current, H) && (K.current = H, Ui.flushSync(() => {
d(H);
}));
});
}, [h, t, n, q, z]);
Xt(() => {
f === !1 && K.current.isPositioned && (K.current.isPositioned = !1, d((D) => ({
...D,
isPositioned: !1
})));
}, [f]);
const X = b.useRef(!1);
Xt(() => (X.current = !0, () => {
X.current = !1;
}), []), Xt(() => {
if (I && (C.current = I), F && (_.current = F), I && F) {
if (J.current)
return J.current(I, F, N);
N();
}
}, [I, F, N, J, A]);
con