@ea-lab/reactive-json
Version:
A REACT-based lib that transforms JSON (or YAML) into interactive HTML markup.
1,769 lines (1,768 loc) • 116 kB
JavaScript
import I, { useLayoutEffect as tr, useEffect as j, useRef as z, useMemo as L, useCallback as U, useState as H, createContext as rt, memo as nr, useReducer as rr, useContext as Pe, forwardRef as pn, cloneElement as or } from "react";
var lt = { exports: {} }, J = {};
/**
* @license React
* react-dom.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Zt;
function ir() {
if (Zt) return J;
Zt = 1;
var e = I;
function t(s) {
var a = "https://react.dev/errors/" + s;
if (1 < arguments.length) {
a += "?args[]=" + encodeURIComponent(arguments[1]);
for (var f = 2; f < arguments.length; f++)
a += "&args[]=" + encodeURIComponent(arguments[f]);
}
return "Minified React error #" + s + "; visit " + a + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
function n() {
}
var r = {
d: {
f: n,
r: function() {
throw Error(t(522));
},
D: n,
C: n,
L: n,
m: n,
X: n,
S: n,
M: n
},
p: 0,
findDOMNode: null
}, o = Symbol.for("react.portal");
function i(s, a, f) {
var c = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
return {
$$typeof: o,
key: c == null ? null : "" + c,
children: s,
containerInfo: a,
implementation: f
};
}
var d = e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
function u(s, a) {
if (s === "font") return "";
if (typeof a == "string")
return a === "use-credentials" ? a : "";
}
return J.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = r, J.createPortal = function(s, a) {
var f = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
if (!a || a.nodeType !== 1 && a.nodeType !== 9 && a.nodeType !== 11)
throw Error(t(299));
return i(s, a, null, f);
}, J.flushSync = function(s) {
var a = d.T, f = r.p;
try {
if (d.T = null, r.p = 2, s) return s();
} finally {
d.T = a, r.p = f, r.d.f();
}
}, J.preconnect = function(s, a) {
typeof s == "string" && (a ? (a = a.crossOrigin, a = typeof a == "string" ? a === "use-credentials" ? a : "" : void 0) : a = null, r.d.C(s, a));
}, J.prefetchDNS = function(s) {
typeof s == "string" && r.d.D(s);
}, J.preinit = function(s, a) {
if (typeof s == "string" && a && typeof a.as == "string") {
var f = a.as, c = u(f, a.crossOrigin), l = typeof a.integrity == "string" ? a.integrity : void 0, g = typeof a.fetchPriority == "string" ? a.fetchPriority : void 0;
f === "style" ? r.d.S(
s,
typeof a.precedence == "string" ? a.precedence : void 0,
{
crossOrigin: c,
integrity: l,
fetchPriority: g
}
) : f === "script" && r.d.X(s, {
crossOrigin: c,
integrity: l,
fetchPriority: g,
nonce: typeof a.nonce == "string" ? a.nonce : void 0
});
}
}, J.preinitModule = function(s, a) {
if (typeof s == "string")
if (typeof a == "object" && a !== null) {
if (a.as == null || a.as === "script") {
var f = u(
a.as,
a.crossOrigin
);
r.d.M(s, {
crossOrigin: f,
integrity: typeof a.integrity == "string" ? a.integrity : void 0,
nonce: typeof a.nonce == "string" ? a.nonce : void 0
});
}
} else a == null && r.d.M(s);
}, J.preload = function(s, a) {
if (typeof s == "string" && typeof a == "object" && a !== null && typeof a.as == "string") {
var f = a.as, c = u(f, a.crossOrigin);
r.d.L(s, f, {
crossOrigin: c,
integrity: typeof a.integrity == "string" ? a.integrity : void 0,
nonce: typeof a.nonce == "string" ? a.nonce : void 0,
type: typeof a.type == "string" ? a.type : void 0,
fetchPriority: typeof a.fetchPriority == "string" ? a.fetchPriority : void 0,
referrerPolicy: typeof a.referrerPolicy == "string" ? a.referrerPolicy : void 0,
imageSrcSet: typeof a.imageSrcSet == "string" ? a.imageSrcSet : void 0,
imageSizes: typeof a.imageSizes == "string" ? a.imageSizes : void 0,
media: typeof a.media == "string" ? a.media : void 0
});
}
}, J.preloadModule = function(s, a) {
if (typeof s == "string")
if (a) {
var f = u(a.as, a.crossOrigin);
r.d.m(s, {
as: typeof a.as == "string" && a.as !== "script" ? a.as : void 0,
crossOrigin: f,
integrity: typeof a.integrity == "string" ? a.integrity : void 0
});
} else r.d.m(s);
}, J.requestFormReset = function(s) {
r.d.r(s);
}, J.unstable_batchedUpdates = function(s, a) {
return s(a);
}, J.useFormState = function(s, a, f) {
return d.H.useFormState(s, a, f);
}, J.useFormStatus = function() {
return d.H.useHostTransitionStatus();
}, J.version = "19.1.0", J;
}
var Z = {};
/**
* @license React
* react-dom.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Qt;
function ar() {
return Qt || (Qt = 1, process.env.NODE_ENV !== "production" && function() {
function e() {
}
function t(c) {
return "" + c;
}
function n(c, l, g) {
var b = 3 < arguments.length && arguments[3] !== void 0 ? arguments[3] : null;
try {
t(b);
var p = !1;
} catch {
p = !0;
}
return p && (console.error(
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
typeof Symbol == "function" && Symbol.toStringTag && b[Symbol.toStringTag] || b.constructor.name || "Object"
), t(b)), {
$$typeof: a,
key: b == null ? null : "" + b,
children: c,
containerInfo: l,
implementation: g
};
}
function r(c, l) {
if (c === "font") return "";
if (typeof l == "string")
return l === "use-credentials" ? l : "";
}
function o(c) {
return c === null ? "`null`" : c === void 0 ? "`undefined`" : c === "" ? "an empty string" : 'something with type "' + typeof c + '"';
}
function i(c) {
return c === null ? "`null`" : c === void 0 ? "`undefined`" : c === "" ? "an empty string" : typeof c == "string" ? JSON.stringify(c) : typeof c == "number" ? "`" + c + "`" : 'something with type "' + typeof c + '"';
}
function d() {
var c = f.H;
return c === null && console.error(
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
), c;
}
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
var u = I, s = {
d: {
f: e,
r: function() {
throw Error(
"Invalid form element. requestFormReset must be passed a form that was rendered by React."
);
},
D: e,
C: e,
L: e,
m: e,
X: e,
S: e,
M: e
},
p: 0,
findDOMNode: null
}, a = Symbol.for("react.portal"), f = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
typeof Map == "function" && Map.prototype != null && typeof Map.prototype.forEach == "function" && typeof Set == "function" && Set.prototype != null && typeof Set.prototype.clear == "function" && typeof Set.prototype.forEach == "function" || console.error(
"React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
), Z.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = s, Z.createPortal = function(c, l) {
var g = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : null;
if (!l || l.nodeType !== 1 && l.nodeType !== 9 && l.nodeType !== 11)
throw Error("Target container is not a DOM element.");
return n(c, l, null, g);
}, Z.flushSync = function(c) {
var l = f.T, g = s.p;
try {
if (f.T = null, s.p = 2, c)
return c();
} finally {
f.T = l, s.p = g, s.d.f() && console.error(
"flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."
);
}
}, Z.preconnect = function(c, l) {
typeof c == "string" && c ? l != null && typeof l != "object" ? console.error(
"ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.",
i(l)
) : l != null && typeof l.crossOrigin != "string" && console.error(
"ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.",
o(l.crossOrigin)
) : console.error(
"ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
o(c)
), typeof c == "string" && (l ? (l = l.crossOrigin, l = typeof l == "string" ? l === "use-credentials" ? l : "" : void 0) : l = null, s.d.C(c, l));
}, Z.prefetchDNS = function(c) {
if (typeof c != "string" || !c)
console.error(
"ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
o(c)
);
else if (1 < arguments.length) {
var l = arguments[1];
typeof l == "object" && l.hasOwnProperty("crossOrigin") ? console.error(
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
i(l)
) : console.error(
"ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.",
i(l)
);
}
typeof c == "string" && s.d.D(c);
}, Z.preinit = function(c, l) {
if (typeof c == "string" && c ? l == null || typeof l != "object" ? console.error(
"ReactDOM.preinit(): Expected the `options` argument (second) to be an object with an `as` property describing the type of resource to be preinitialized but encountered %s instead.",
i(l)
) : l.as !== "style" && l.as !== "script" && console.error(
'ReactDOM.preinit(): Expected the `as` property in the `options` argument (second) to contain a valid value describing the type of resource to be preinitialized but encountered %s instead. Valid values for `as` are "style" and "script".',
i(l.as)
) : console.error(
"ReactDOM.preinit(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.",
o(c)
), typeof c == "string" && l && typeof l.as == "string") {
var g = l.as, b = r(g, l.crossOrigin), p = typeof l.integrity == "string" ? l.integrity : void 0, h = typeof l.fetchPriority == "string" ? l.fetchPriority : void 0;
g === "style" ? s.d.S(
c,
typeof l.precedence == "string" ? l.precedence : void 0,
{
crossOrigin: b,
integrity: p,
fetchPriority: h
}
) : g === "script" && s.d.X(c, {
crossOrigin: b,
integrity: p,
fetchPriority: h,
nonce: typeof l.nonce == "string" ? l.nonce : void 0
});
}
}, Z.preinitModule = function(c, l) {
var g = "";
if (typeof c == "string" && c || (g += " The `href` argument encountered was " + o(c) + "."), l !== void 0 && typeof l != "object" ? g += " The `options` argument encountered was " + o(l) + "." : l && "as" in l && l.as !== "script" && (g += " The `as` option encountered was " + i(l.as) + "."), g)
console.error(
"ReactDOM.preinitModule(): Expected up to two arguments, a non-empty `href` string and, optionally, an `options` object with a valid `as` property.%s",
g
);
else
switch (g = l && typeof l.as == "string" ? l.as : "script", g) {
case "script":
break;
default:
g = i(g), console.error(
'ReactDOM.preinitModule(): Currently the only supported "as" type for this function is "script" but received "%s" instead. This warning was generated for `href` "%s". In the future other module types will be supported, aligning with the import-attributes proposal. Learn more here: (https://github.com/tc39/proposal-import-attributes)',
g,
c
);
}
typeof c == "string" && (typeof l == "object" && l !== null ? (l.as == null || l.as === "script") && (g = r(
l.as,
l.crossOrigin
), s.d.M(c, {
crossOrigin: g,
integrity: typeof l.integrity == "string" ? l.integrity : void 0,
nonce: typeof l.nonce == "string" ? l.nonce : void 0
})) : l == null && s.d.M(c));
}, Z.preload = function(c, l) {
var g = "";
if (typeof c == "string" && c || (g += " The `href` argument encountered was " + o(c) + "."), l == null || typeof l != "object" ? g += " The `options` argument encountered was " + o(l) + "." : typeof l.as == "string" && l.as || (g += " The `as` option encountered was " + o(l.as) + "."), g && console.error(
'ReactDOM.preload(): Expected two arguments, a non-empty `href` string and an `options` object with an `as` property valid for a `<link rel="preload" as="..." />` tag.%s',
g
), typeof c == "string" && typeof l == "object" && l !== null && typeof l.as == "string") {
g = l.as;
var b = r(
g,
l.crossOrigin
);
s.d.L(c, g, {
crossOrigin: b,
integrity: typeof l.integrity == "string" ? l.integrity : void 0,
nonce: typeof l.nonce == "string" ? l.nonce : void 0,
type: typeof l.type == "string" ? l.type : void 0,
fetchPriority: typeof l.fetchPriority == "string" ? l.fetchPriority : void 0,
referrerPolicy: typeof l.referrerPolicy == "string" ? l.referrerPolicy : void 0,
imageSrcSet: typeof l.imageSrcSet == "string" ? l.imageSrcSet : void 0,
imageSizes: typeof l.imageSizes == "string" ? l.imageSizes : void 0,
media: typeof l.media == "string" ? l.media : void 0
});
}
}, Z.preloadModule = function(c, l) {
var g = "";
typeof c == "string" && c || (g += " The `href` argument encountered was " + o(c) + "."), l !== void 0 && typeof l != "object" ? g += " The `options` argument encountered was " + o(l) + "." : l && "as" in l && typeof l.as != "string" && (g += " The `as` option encountered was " + o(l.as) + "."), g && console.error(
'ReactDOM.preloadModule(): Expected two arguments, a non-empty `href` string and, optionally, an `options` object with an `as` property valid for a `<link rel="modulepreload" as="..." />` tag.%s',
g
), typeof c == "string" && (l ? (g = r(
l.as,
l.crossOrigin
), s.d.m(c, {
as: typeof l.as == "string" && l.as !== "script" ? l.as : void 0,
crossOrigin: g,
integrity: typeof l.integrity == "string" ? l.integrity : void 0
})) : s.d.m(c));
}, Z.requestFormReset = function(c) {
s.d.r(c);
}, Z.unstable_batchedUpdates = function(c, l) {
return c(l);
}, Z.useFormState = function(c, l, g) {
return d().useFormState(c, l, g);
}, Z.useFormStatus = function() {
return d().useHostTransitionStatus();
}, Z.version = "19.1.0", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
}()), Z;
}
var en;
function sr() {
if (en) return lt.exports;
en = 1;
function e() {
if (!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ > "u" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE != "function")) {
if (process.env.NODE_ENV !== "production")
throw new Error("^_^");
try {
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e);
} catch (t) {
console.error(t);
}
}
}
return process.env.NODE_ENV === "production" ? (e(), lt.exports = ir()) : lt.exports = ar(), lt.exports;
}
var He = sr();
function bn(e) {
var t, n, r = "";
if (typeof e == "string" || typeof e == "number") r += e;
else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (n = bn(e[t])) && (r && (r += " "), r += n);
else for (t in e) e[t] && (r && (r += " "), r += t);
return r;
}
function _t() {
for (var e, t, n = 0, r = ""; n < arguments.length; ) (e = arguments[n++]) && (t = bn(e)) && (r && (r += " "), r += t);
return r;
}
function lr() {
for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
t[n] = arguments[n];
return L(
() => (r) => {
t.forEach((o) => o(r));
},
// eslint-disable-next-line react-hooks/exhaustive-deps
t
);
}
const yt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
function We(e) {
const t = Object.prototype.toString.call(e);
return t === "[object Window]" || // In Electron context the Window object serializes to [object global]
t === "[object global]";
}
function $t(e) {
return "nodeType" in e;
}
function ne(e) {
var t, n;
return e ? We(e) ? e : $t(e) && (t = (n = e.ownerDocument) == null ? void 0 : n.defaultView) != null ? t : window : window;
}
function Ft(e) {
const {
Document: t
} = ne(e);
return e instanceof t;
}
function ot(e) {
return We(e) ? !1 : e instanceof ne(e).HTMLElement;
}
function mn(e) {
return e instanceof ne(e).SVGElement;
}
function Ye(e) {
return e ? We(e) ? e.document : $t(e) ? Ft(e) ? e : ot(e) || mn(e) ? e.ownerDocument : document : document : document;
}
const be = yt ? tr : j;
function wt(e) {
const t = z(e);
return be(() => {
t.current = e;
}), U(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);
}, []);
}
function cr() {
const e = z(null), t = U((r, o) => {
e.current = setInterval(r, o);
}, []), n = U(() => {
e.current !== null && (clearInterval(e.current), e.current = null);
}, []);
return [t, n];
}
function et(e, t) {
t === void 0 && (t = [e]);
const n = z(e);
return be(() => {
n.current !== e && (n.current = e);
}, t), n;
}
function it(e, t) {
const n = z();
return L(
() => {
const r = e(n.current);
return n.current = r, r;
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[...t]
);
}
function ft(e) {
const t = wt(e), n = z(null), r = U(
(o) => {
o !== n.current && (t == null || t(o, n.current)), n.current = o;
},
//eslint-disable-next-line
[]
);
return [n, r];
}
function gt(e) {
const t = z();
return j(() => {
t.current = e;
}, [e]), t.current;
}
let It = {};
function at(e, t) {
return L(() => {
if (t)
return t;
const n = It[e] == null ? 0 : It[e] + 1;
return It[e] = n, e + "-" + n;
}, [e, t]);
}
function yn(e) {
return function(t) {
for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
r[o - 1] = arguments[o];
return r.reduce((i, d) => {
const u = Object.entries(d);
for (const [s, a] of u) {
const f = i[s];
f != null && (i[s] = f + e * a);
}
return i;
}, {
...t
});
};
}
const Ue = /* @__PURE__ */ yn(1), vt = /* @__PURE__ */ yn(-1);
function dr(e) {
return "clientX" in e && "clientY" in e;
}
function xt(e) {
if (!e)
return !1;
const {
KeyboardEvent: t
} = ne(e.target);
return t && e instanceof t;
}
function ur(e) {
if (!e)
return !1;
const {
TouchEvent: t
} = ne(e.target);
return t && e instanceof t;
}
function ht(e) {
if (ur(e)) {
if (e.touches && e.touches.length) {
const {
clientX: t,
clientY: n
} = e.touches[0];
return {
x: t,
y: n
};
} else if (e.changedTouches && e.changedTouches.length) {
const {
clientX: t,
clientY: n
} = e.changedTouches[0];
return {
x: t,
y: n
};
}
}
return dr(e) ? {
x: e.clientX,
y: e.clientY
} : null;
}
const De = /* @__PURE__ */ Object.freeze({
Translate: {
toString(e) {
if (!e)
return;
const {
x: t,
y: n
} = e;
return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
}
},
Scale: {
toString(e) {
if (!e)
return;
const {
scaleX: t,
scaleY: n
} = e;
return "scaleX(" + t + ") scaleY(" + n + ")";
}
},
Transform: {
toString(e) {
if (e)
return [De.Translate.toString(e), De.Scale.toString(e)].join(" ");
}
},
Transition: {
toString(e) {
let {
property: t,
duration: n,
easing: r
} = e;
return t + " " + n + "ms " + r;
}
}
}), tn = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
function fr(e) {
return e.matches(tn) ? e : e.querySelector(tn);
}
const gr = {
display: "none"
};
function vr(e) {
let {
id: t,
value: n
} = e;
return I.createElement("div", {
id: t,
style: gr
}, n);
}
function hr(e) {
let {
id: t,
announcement: n,
ariaLiveType: r = "assertive"
} = e;
const o = {
position: "fixed",
top: 0,
left: 0,
width: 1,
height: 1,
margin: -1,
border: 0,
padding: 0,
overflow: "hidden",
clip: "rect(0 0 0 0)",
clipPath: "inset(100%)",
whiteSpace: "nowrap"
};
return I.createElement("div", {
id: t,
style: o,
role: "status",
"aria-live": r,
"aria-atomic": !0
}, n);
}
function pr() {
const [e, t] = H("");
return {
announce: U((r) => {
r != null && t(r);
}, []),
announcement: e
};
}
const wn = /* @__PURE__ */ rt(null);
function br(e) {
const t = Pe(wn);
j(() => {
if (!t)
throw new Error("useDndMonitor must be used within a children of <DndContext>");
return t(e);
}, [e, t]);
}
function mr() {
const [e] = H(() => /* @__PURE__ */ new Set()), t = U((r) => (e.add(r), () => e.delete(r)), [e]);
return [U((r) => {
let {
type: o,
event: i
} = r;
e.forEach((d) => {
var u;
return (u = d[o]) == null ? void 0 : u.call(d, i);
});
}, [e]), t];
}
const yr = {
draggable: `
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`
}, wr = {
onDragStart(e) {
let {
active: t
} = e;
return "Picked up draggable item " + t.id + ".";
},
onDragOver(e) {
let {
active: t,
over: n
} = e;
return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
},
onDragEnd(e) {
let {
active: t,
over: n
} = e;
return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
},
onDragCancel(e) {
let {
active: t
} = e;
return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
}
};
function xr(e) {
let {
announcements: t = wr,
container: n,
hiddenTextDescribedById: r,
screenReaderInstructions: o = yr
} = e;
const {
announce: i,
announcement: d
} = pr(), u = at("DndLiveRegion"), [s, a] = H(!1);
if (j(() => {
a(!0);
}, []), br(L(() => ({
onDragStart(c) {
let {
active: l
} = c;
i(t.onDragStart({
active: l
}));
},
onDragMove(c) {
let {
active: l,
over: g
} = c;
t.onDragMove && i(t.onDragMove({
active: l,
over: g
}));
},
onDragOver(c) {
let {
active: l,
over: g
} = c;
i(t.onDragOver({
active: l,
over: g
}));
},
onDragEnd(c) {
let {
active: l,
over: g
} = c;
i(t.onDragEnd({
active: l,
over: g
}));
},
onDragCancel(c) {
let {
active: l,
over: g
} = c;
i(t.onDragCancel({
active: l,
over: g
}));
}
}), [i, t])), !s)
return null;
const f = I.createElement(I.Fragment, null, I.createElement(vr, {
id: r,
value: o.draggable
}), I.createElement(hr, {
id: u,
announcement: d
}));
return n ? He.createPortal(f, n) : f;
}
var F;
(function(e) {
e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
})(F || (F = {}));
function pt() {
}
function Dr(e, t) {
return L(
() => ({
sensor: e,
options: t ?? {}
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[e, t]
);
}
function Sr() {
for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
t[n] = arguments[n];
return L(
() => [...t].filter((r) => r != null),
// eslint-disable-next-line react-hooks/exhaustive-deps
[...t]
);
}
const me = /* @__PURE__ */ Object.freeze({
x: 0,
y: 0
});
function Cr(e, t) {
return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
}
function Or(e, t) {
const n = ht(e);
if (!n)
return "0 0";
const r = {
x: (n.x - t.left) / t.width * 100,
y: (n.y - t.top) / t.height * 100
};
return r.x + "% " + r.y + "%";
}
function Rr(e, t) {
let {
data: {
value: n
}
} = e, {
data: {
value: r
}
} = t;
return n - r;
}
function Er(e, t) {
let {
data: {
value: n
}
} = e, {
data: {
value: r
}
} = t;
return r - n;
}
function Tr(e, t) {
if (!e || e.length === 0)
return null;
const [n] = e;
return n[t];
}
function nn(e, t, n) {
return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
x: t + e.width * 0.5,
y: n + e.height * 0.5
};
}
const _r = (e) => {
let {
collisionRect: t,
droppableRects: n,
droppableContainers: r
} = e;
const o = nn(t, t.left, t.top), i = [];
for (const d of r) {
const {
id: u
} = d, s = n.get(u);
if (s) {
const a = Cr(nn(s), o);
i.push({
id: u,
data: {
droppableContainer: d,
value: a
}
});
}
}
return i.sort(Rr);
};
function Ir(e, t) {
const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height), d = o - r, u = i - n;
if (r < o && n < i) {
const s = t.width * t.height, a = e.width * e.height, f = d * u, c = f / (s + a - f);
return Number(c.toFixed(4));
}
return 0;
}
const Ar = (e) => {
let {
collisionRect: t,
droppableRects: n,
droppableContainers: r
} = e;
const o = [];
for (const i of r) {
const {
id: d
} = i, u = n.get(d);
if (u) {
const s = Ir(u, t);
s > 0 && o.push({
id: d,
data: {
droppableContainer: i,
value: s
}
});
}
}
return o.sort(Er);
};
function Nr(e, t, n) {
return {
...e,
scaleX: t && n ? t.width / n.width : 1,
scaleY: t && n ? t.height / n.height : 1
};
}
function xn(e, t) {
return e && t ? {
x: e.left - t.left,
y: e.top - t.top
} : me;
}
function Lr(e) {
return function(n) {
for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
o[i - 1] = arguments[i];
return o.reduce((d, u) => ({
...d,
top: d.top + e * u.y,
bottom: d.bottom + e * u.y,
left: d.left + e * u.x,
right: d.right + e * u.x
}), {
...n
});
};
}
const Mr = /* @__PURE__ */ Lr(1);
function Dn(e) {
if (e.startsWith("matrix3d(")) {
const t = e.slice(9, -1).split(/, /);
return {
x: +t[12],
y: +t[13],
scaleX: +t[0],
scaleY: +t[5]
};
} else if (e.startsWith("matrix(")) {
const t = e.slice(7, -1).split(/, /);
return {
x: +t[4],
y: +t[5],
scaleX: +t[0],
scaleY: +t[3]
};
}
return null;
}
function Pr(e, t, n) {
const r = Dn(t);
if (!r)
return e;
const {
scaleX: o,
scaleY: i,
x: d,
y: u
} = r, s = e.left - d - (1 - o) * parseFloat(n), a = e.top - u - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), f = o ? e.width / o : e.width, c = i ? e.height / i : e.height;
return {
width: f,
height: c,
top: a,
right: s + f,
bottom: a + c,
left: s
};
}
const kr = {
ignoreTransform: !1
};
function Xe(e, t) {
t === void 0 && (t = kr);
let n = e.getBoundingClientRect();
if (t.ignoreTransform) {
const {
transform: a,
transformOrigin: f
} = ne(e).getComputedStyle(e);
a && (n = Pr(n, a, f));
}
const {
top: r,
left: o,
width: i,
height: d,
bottom: u,
right: s
} = n;
return {
top: r,
left: o,
width: i,
height: d,
bottom: u,
right: s
};
}
function rn(e) {
return Xe(e, {
ignoreTransform: !0
});
}
function zr(e) {
const t = e.innerWidth, n = e.innerHeight;
return {
top: 0,
left: 0,
right: t,
bottom: n,
width: t,
height: n
};
}
function jr(e, t) {
return t === void 0 && (t = ne(e).getComputedStyle(e)), t.position === "fixed";
}
function Br(e, t) {
t === void 0 && (t = ne(e).getComputedStyle(e));
const n = /(auto|scroll|overlay)/;
return ["overflow", "overflowX", "overflowY"].some((o) => {
const i = t[o];
return typeof i == "string" ? n.test(i) : !1;
});
}
function Ht(e, t) {
const n = [];
function r(o) {
if (t != null && n.length >= t || !o)
return n;
if (Ft(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
return n.push(o.scrollingElement), n;
if (!ot(o) || mn(o) || n.includes(o))
return n;
const i = ne(e).getComputedStyle(o);
return o !== e && Br(o, i) && n.push(o), jr(o, i) ? n : r(o.parentNode);
}
return e ? r(e) : n;
}
function Sn(e) {
const [t] = Ht(e, 1);
return t ?? null;
}
function At(e) {
return !yt || !e ? null : We(e) ? e : $t(e) ? Ft(e) || e === Ye(e).scrollingElement ? window : ot(e) ? e : null : null;
}
function Cn(e) {
return We(e) ? e.scrollX : e.scrollLeft;
}
function On(e) {
return We(e) ? e.scrollY : e.scrollTop;
}
function kt(e) {
return {
x: Cn(e),
y: On(e)
};
}
var X;
(function(e) {
e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
})(X || (X = {}));
function Rn(e) {
return !yt || !e ? !1 : e === document.scrollingElement;
}
function En(e) {
const t = {
x: 0,
y: 0
}, n = Rn(e) ? {
height: window.innerHeight,
width: window.innerWidth
} : {
height: e.clientHeight,
width: e.clientWidth
}, r = {
x: e.scrollWidth - n.width,
y: e.scrollHeight - n.height
}, o = e.scrollTop <= t.y, i = e.scrollLeft <= t.x, d = e.scrollTop >= r.y, u = e.scrollLeft >= r.x;
return {
isTop: o,
isLeft: i,
isBottom: d,
isRight: u,
maxScroll: r,
minScroll: t
};
}
const $r = {
x: 0.2,
y: 0.2
};
function Fr(e, t, n, r, o) {
let {
top: i,
left: d,
right: u,
bottom: s
} = n;
r === void 0 && (r = 10), o === void 0 && (o = $r);
const {
isTop: a,
isBottom: f,
isLeft: c,
isRight: l
} = En(e), g = {
x: 0,
y: 0
}, b = {
x: 0,
y: 0
}, p = {
height: t.height * o.y,
width: t.width * o.x
};
return !a && i <= t.top + p.height ? (g.y = X.Backward, b.y = r * Math.abs((t.top + p.height - i) / p.height)) : !f && s >= t.bottom - p.height && (g.y = X.Forward, b.y = r * Math.abs((t.bottom - p.height - s) / p.height)), !l && u >= t.right - p.width ? (g.x = X.Forward, b.x = r * Math.abs((t.right - p.width - u) / p.width)) : !c && d <= t.left + p.width && (g.x = X.Backward, b.x = r * Math.abs((t.left + p.width - d) / p.width)), {
direction: g,
speed: b
};
}
function Hr(e) {
if (e === document.scrollingElement) {
const {
innerWidth: i,
innerHeight: d
} = window;
return {
top: 0,
left: 0,
right: i,
bottom: d,
width: i,
height: d
};
}
const {
top: t,
left: n,
right: r,
bottom: o
} = e.getBoundingClientRect();
return {
top: t,
left: n,
right: r,
bottom: o,
width: e.clientWidth,
height: e.clientHeight
};
}
function Tn(e) {
return e.reduce((t, n) => Ue(t, kt(n)), me);
}
function Ur(e) {
return e.reduce((t, n) => t + Cn(n), 0);
}
function Wr(e) {
return e.reduce((t, n) => t + On(n), 0);
}
function _n(e, t) {
if (t === void 0 && (t = Xe), !e)
return;
const {
top: n,
left: r,
bottom: o,
right: i
} = t(e);
Sn(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
block: "center",
inline: "center"
});
}
const Yr = [["x", ["left", "right"], Ur], ["y", ["top", "bottom"], Wr]];
class Ut {
constructor(t, n) {
this.rect = void 0, this.width = void 0, this.height = void 0, this.top = void 0, this.bottom = void 0, this.right = void 0, this.left = void 0;
const r = Ht(n), o = Tn(r);
this.rect = {
...t
}, this.width = t.width, this.height = t.height;
for (const [i, d, u] of Yr)
for (const s of d)
Object.defineProperty(this, s, {
get: () => {
const a = u(r), f = o[i] - a;
return this.rect[s] + f;
},
enumerable: !0
});
Object.defineProperty(this, "rect", {
enumerable: !1
});
}
}
class Je {
constructor(t) {
this.target = void 0, this.listeners = [], this.removeAll = () => {
this.listeners.forEach((n) => {
var r;
return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
});
}, this.target = t;
}
add(t, n, r) {
var o;
(o = this.target) == null || o.addEventListener(t, n, r), this.listeners.push([t, n, r]);
}
}
function Xr(e) {
const {
EventTarget: t
} = ne(e);
return e instanceof t ? e : Ye(e);
}
function Nt(e, t) {
const n = Math.abs(e.x), r = Math.abs(e.y);
return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
}
var ge;
(function(e) {
e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
})(ge || (ge = {}));
function on(e) {
e.preventDefault();
}
function Kr(e) {
e.stopPropagation();
}
var k;
(function(e) {
e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter", e.Tab = "Tab";
})(k || (k = {}));
const In = {
start: [k.Space, k.Enter],
cancel: [k.Esc],
end: [k.Space, k.Enter, k.Tab]
}, Gr = (e, t) => {
let {
currentCoordinates: n
} = t;
switch (e.code) {
case k.Right:
return {
...n,
x: n.x + 25
};
case k.Left:
return {
...n,
x: n.x - 25
};
case k.Down:
return {
...n,
y: n.y + 25
};
case k.Up:
return {
...n,
y: n.y - 25
};
}
};
class An {
constructor(t) {
this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = t;
const {
event: {
target: n
}
} = t;
this.props = t, this.listeners = new Je(Ye(n)), this.windowListeners = new Je(ne(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
}
attach() {
this.handleStart(), this.windowListeners.add(ge.Resize, this.handleCancel), this.windowListeners.add(ge.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(ge.Keydown, this.handleKeyDown));
}
handleStart() {
const {
activeNode: t,
onStart: n
} = this.props, r = t.node.current;
r && _n(r), n(me);
}
handleKeyDown(t) {
if (xt(t)) {
const {
active: n,
context: r,
options: o
} = this.props, {
keyboardCodes: i = In,
coordinateGetter: d = Gr,
scrollBehavior: u = "smooth"
} = o, {
code: s
} = t;
if (i.end.includes(s)) {
this.handleEnd(t);
return;
}
if (i.cancel.includes(s)) {
this.handleCancel(t);
return;
}
const {
collisionRect: a
} = r.current, f = a ? {
x: a.left,
y: a.top
} : me;
this.referenceCoordinates || (this.referenceCoordinates = f);
const c = d(t, {
active: n,
context: r.current,
currentCoordinates: f
});
if (c) {
const l = vt(c, f), g = {
x: 0,
y: 0
}, {
scrollableAncestors: b
} = r.current;
for (const p of b) {
const h = t.code, {
isTop: S,
isRight: w,
isLeft: x,
isBottom: C,
maxScroll: D,
minScroll: R
} = En(p), O = Hr(p), m = {
x: Math.min(h === k.Right ? O.right - O.width / 2 : O.right, Math.max(h === k.Right ? O.left : O.left + O.width / 2, c.x)),
y: Math.min(h === k.Down ? O.bottom - O.height / 2 : O.bottom, Math.max(h === k.Down ? O.top : O.top + O.height / 2, c.y))
}, P = h === k.Right && !w || h === k.Left && !x, N = h === k.Down && !C || h === k.Up && !S;
if (P && m.x !== c.x) {
const E = p.scrollLeft + l.x, M = h === k.Right && E <= D.x || h === k.Left && E >= R.x;
if (M && !l.y) {
p.scrollTo({
left: E,
behavior: u
});
return;
}
M ? g.x = p.scrollLeft - E : g.x = h === k.Right ? p.scrollLeft - D.x : p.scrollLeft - R.x, g.x && p.scrollBy({
left: -g.x,
behavior: u
});
break;
} else if (N && m.y !== c.y) {
const E = p.scrollTop + l.y, M = h === k.Down && E <= D.y || h === k.Up && E >= R.y;
if (M && !l.x) {
p.scrollTo({
top: E,
behavior: u
});
return;
}
M ? g.y = p.scrollTop - E : g.y = h === k.Down ? p.scrollTop - D.y : p.scrollTop - R.y, g.y && p.scrollBy({
top: -g.y,
behavior: u
});
break;
}
}
this.handleMove(t, Ue(vt(c, this.referenceCoordinates), g));
}
}
}
handleMove(t, n) {
const {
onMove: r
} = this.props;
t.preventDefault(), r(n);
}
handleEnd(t) {
const {
onEnd: n
} = this.props;
t.preventDefault(), this.detach(), n();
}
handleCancel(t) {
const {
onCancel: n
} = this.props;
t.preventDefault(), this.detach(), n();
}
detach() {
this.listeners.removeAll(), this.windowListeners.removeAll();
}
}
An.activators = [{
eventName: "onKeyDown",
handler: (e, t, n) => {
let {
keyboardCodes: r = In,
onActivation: o
} = t, {
active: i
} = n;
const {
code: d
} = e.nativeEvent;
if (r.start.includes(d)) {
const u = i.activatorNode.current;
return u && e.target !== u ? !1 : (e.preventDefault(), o == null || o({
event: e.nativeEvent
}), !0);
}
return !1;
}
}];
function an(e) {
return !!(e && "distance" in e);
}
function sn(e) {
return !!(e && "delay" in e);
}
class Wt {
constructor(t, n, r) {
var o;
r === void 0 && (r = Xr(t.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = t, this.events = n;
const {
event: i
} = t, {
target: d
} = i;
this.props = t, this.events = n, this.document = Ye(d), this.documentListeners = new Je(this.document), this.listeners = new Je(r), this.windowListeners = new Je(ne(d)), this.initialCoordinates = (o = ht(i)) != null ? o : me, this.handleStart = this.handleStart.bind(this), this.handleMove = this.handleMove.bind(this), this.handleEnd = this.handleEnd.bind(this), this.handleCancel = this.handleCancel.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.removeTextSelection = this.removeTextSelection.bind(this), this.attach();
}
attach() {
const {
events: t,
props: {
options: {
activationConstraint: n,
bypassActivationConstraint: r
}
}
} = this;
if (this.listeners.add(t.move.name, this.handleMove, {
passive: !1
}), this.listeners.add(t.end.name, this.handleEnd), t.cancel && this.listeners.add(t.cancel.name, this.handleCancel), this.windowListeners.add(ge.Resize, this.handleCancel), this.windowListeners.add(ge.DragStart, on), this.windowListeners.add(ge.VisibilityChange, this.handleCancel), this.windowListeners.add(ge.ContextMenu, on), this.documentListeners.add(ge.Keydown, this.handleKeydown), n) {
if (r != null && r({
event: this.props.event,
activeNode: this.props.activeNode,
options: this.props.options
}))
return this.handleStart();
if (sn(n)) {
this.timeoutId = setTimeout(this.handleStart, n.delay), this.handlePending(n);
return;
}
if (an(n)) {
this.handlePending(n);
return;
}
}
this.handleStart();
}
detach() {
this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
}
handlePending(t, n) {
const {
active: r,
onPending: o
} = this.props;
o(r, t, this.initialCoordinates, n);
}
handleStart() {
const {
initialCoordinates: t
} = this, {
onStart: n
} = this.props;
t && (this.activated = !0, this.documentListeners.add(ge.Click, Kr, {
capture: !0
}), this.removeTextSelection(), this.documentListeners.add(ge.SelectionChange, this.removeTextSelection), n(t));
}
handleMove(t) {
var n;
const {
activated: r,
initialCoordinates: o,
props: i
} = this, {
onMove: d,
options: {
activationConstraint: u
}
} = i;
if (!o)
return;
const s = (n = ht(t)) != null ? n : me, a = vt(o, s);
if (!r && u) {
if (an(u)) {
if (u.tolerance != null && Nt(a, u.tolerance))
return this.handleCancel();
if (Nt(a, u.distance))
return this.handleStart();
}
if (sn(u) && Nt(a, u.tolerance))
return this.handleCancel();
this.handlePending(u, a);
return;
}
t.cancelable && t.preventDefault(), d(s);
}
handleEnd() {
const {
onAbort: t,
onEnd: n
} = this.props;
this.detach(), this.activated || t(this.props.active), n();
}
handleCancel() {
const {
onAbort: t,
onCancel: n
} = this.props;
this.detach(), this.activated || t(this.props.active), n();
}
handleKeydown(t) {
t.code === k.Esc && this.handleCancel();
}
removeTextSelection() {
var t;
(t = this.document.getSelection()) == null || t.removeAllRanges();
}
}
const Vr = {
cancel: {
name: "pointercancel"
},
move: {
name: "pointermove"
},
end: {
name: "pointerup"
}
};
class Yt extends Wt {
constructor(t) {
const {
event: n
} = t, r = Ye(n.target);
super(t, Vr, r);
}
}
Yt.activators = [{
eventName: "onPointerDown",
handler: (e, t) => {
let {
nativeEvent: n
} = e, {
onActivation: r
} = t;
return !n.isPrimary || n.button !== 0 ? !1 : (r == null || r({
event: n
}), !0);
}
}];
const qr = {
move: {
name: "mousemove"
},
end: {
name: "mouseup"
}
};
var zt;
(function(e) {
e[e.RightClick = 2] = "RightClick";
})(zt || (zt = {}));
class Jr extends Wt {
constructor(t) {
super(t, qr, Ye(t.event.target));
}
}
Jr.activators = [{
eventName: "onMouseDown",
handler: (e, t) => {
let {
nativeEvent: n
} = e, {
onActivation: r
} = t;
return n.button === zt.RightClick ? !1 : (r == null || r({
event: n
}), !0);
}
}];
const Lt = {
cancel: {
name: "touchcancel"
},
move: {
name: "touchmove"
},
end: {
name: "touchend"
}
};
class Zr extends Wt {
constructor(t) {
super(t, Lt);
}
static setup() {
return window.addEventListener(Lt.move.name, t, {
capture: !1,
passive: !1
}), function() {
window.removeEventListener(Lt.move.name, t);
};
function t() {
}
}
}
Zr.activators = [{
eventName: "onTouchStart",
handler: (e, t) => {
let {
nativeEvent: n
} = e, {
onActivation: r
} = t;
const {
touches: o
} = n;
return o.length > 1 ? !1 : (r == null || r({
event: n
}), !0);
}
}];
var Ze;
(function(e) {
e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
})(Ze || (Ze = {}));
var bt;
(function(e) {
e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
})(bt || (bt = {}));
function Qr(e) {
let {
acceleration: t,
activator: n = Ze.Pointer,
canScroll: r,
draggingRect: o,
enabled: i,
interval: d = 5,
order: u = bt.TreeOrder,
pointerCoordinates: s,
scrollableAncestors: a,
scrollableAncestorRects: f,
delta: c,
threshold: l
} = e;
const g = to({
delta: c,
disabled: !i
}), [b, p] = cr(), h = z({
x: 0,
y: 0
}), S = z({
x: 0,
y: 0
}), w = L(() => {
switch (n) {
case Ze.Pointer:
return s ? {
top: s.y,
bottom: s.y,
left: s.x,
right: s.x
} : null;
case Ze.DraggableRect:
return o;
}
}, [n, o, s]), x = z(null), C = U(() => {
const R = x.current;
if (!R)
return;
const O = h.current.x * S.current.x, m = h.current.y * S.current.y;
R.scrollBy(O, m);
}, []), D = L(() => u === bt.TreeOrder ? [...a].reverse() : a, [u, a]);
j(
() => {
if (!i || !a.length || !w) {
p();
return;
}
for (const R of D) {
if ((r == null ? void 0 : r(R)) === !1)
continue;
const O = a.indexOf(R), m = f[O];
if (!m)
continue;
const {
direction: P,
speed: N
} = Fr(R, m, w, t, l);
for (const E of ["x", "y"])
g[E][P[E]] || (N[E] = 0, P[E] = 0);
if (N.x > 0 || N.y > 0) {
p(), x.current = R, b(C, d), h.current = N, S.current = P;
return;
}
}
h.current = {
x: 0,
y: 0
}, S.current = {
x: 0,
y: 0
}, p();
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[
t,
C,
r,
p,
i,
d,
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(w),
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(g),
b,
a,
D,
f,
// eslint-disable-next-line react-hooks/exhaustive-deps
JSON.stringify(l)
]
);
}
const eo = {
x: {
[X.Backward]: !1,
[X.Forward]: !1
},
y: {
[X.Backward]: !1,
[X.Forward]: !1
}
};
function to(e) {
let {
delta: t,
disabled: n