@sheetxl/utils-react 0.3.18 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,707 +1,736 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { jsx as L, jsxs as bt, Fragment as Mt } from "react/jsx-runtime";
3
- import ft, { useLayoutEffect as Vt, useEffect as V, useState as Q, useMemo as N, useCallback as R, useRef as k, memo as St, forwardRef as Lt, useImperativeHandle as en, version as nn, createElement as on, useReducer as rn } from "react";
4
- import { CommonUtils as et, ClipboardUtils as It, MimeType as Nt, InternalClipboard as Kt } from "@sheetxl/utils";
5
- import { createRoot as sn } from "react-dom/client";
6
- import { unstable_batchedUpdates as ln } from "react-dom";
2
+ import { jsx as L, jsxs as be, Fragment as Me } from "react/jsx-runtime";
3
+ import me, { useLayoutEffect as Ve, useEffect as V, useState as Q, useMemo as N, useCallback as R, useRef as A, memo as Se, forwardRef as Le, useImperativeHandle as en, version as tn, createElement as nn, useReducer as on } from "react";
4
+ import { CommonUtils as te, ClipboardUtils as Ie, MimeType as Ne, InternalClipboard as Ke } from "@sheetxl/utils";
5
+ import { createRoot as rn } from "react-dom/client";
6
+ import { unstable_batchedUpdates as sn } from "react-dom";
7
7
  /**
8
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.3.18
8
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.3.19
9
9
  *
10
10
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
11
11
  * License: The license can be found at https://www.sheetxl.com/license.
12
12
  */
13
- const to = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, Z = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, eo = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, no = { Left: 1, Middle: 2, Right: 3 }, rt = { Horizontal: "horizontal", Vertical: "vertical" };
14
- function Le(e) {
15
- var t, n, o = "";
16
- if (typeof e == "string" || typeof e == "number") o += e;
17
- else if (typeof e == "object") if (Array.isArray(e)) {
18
- var i = e.length;
19
- for (t = 0; t < i; t++) e[t] && (n = Le(e[t])) && (o && (o += " "), o += n);
20
- } else for (n in e) e[n] && (o && (o += " "), o += n);
21
- return o;
13
+ const Qn = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, Z = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, eo = { BackSpace: 8, Tab: 9, Clear: 12, Enter: 13, Shift: 16, Control: 17, Alt: 18, Pause: 19, CapsLock: 20, Escape: 27, Space: 32, PageUp: 33, PageDown: 34, End: 35, Home: 36, Left: 37, Up: 38, Right: 39, Down: 40, Insert: 45, Delete: 46, Digit_8: 56, Y: 89, Z: 90, Meta: 91, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, NumLock: 144, ScrollLock: 145, BackSlash: 220, Slash: 191, BracketRight: 221, BracketLeft: 219 }, to = { Left: 1, Middle: 2, Right: 3 }, re = { Horizontal: "horizontal", Vertical: "vertical" };
14
+ function Lt(i) {
15
+ var e, t, n = "";
16
+ if (typeof i == "string" || typeof i == "number") n += i;
17
+ else if (typeof i == "object") if (Array.isArray(i)) {
18
+ var o = i.length;
19
+ for (e = 0; e < o; e++) i[e] && (t = Lt(i[e])) && (n && (n += " "), n += t);
20
+ } else for (t in i) i[t] && (n && (n += " "), n += t);
21
+ return n;
22
22
  }
23
- function vt() {
24
- for (var e, t, n = 0, o = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Le(e)) && (o && (o += " "), o += t);
25
- return o;
23
+ function ve() {
24
+ for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e = Lt(i)) && (n && (n += " "), n += e);
25
+ return n;
26
26
  }
27
- var an = function() {
28
- }, Ce = typeof window < "u", cn = Ce ? Vt : V, ue = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
29
- const mt = Ce && window.ResizeObserver !== void 0 ? function() {
30
- var e = Q(null), t = e[0], n = e[1], o = Q(ue), i = o[0], r = o[1], s = N(function() {
31
- return new window.ResizeObserver(function(a) {
32
- if (a[0]) {
33
- var l = a[0].contentRect, c = l.x, h = l.y, u = l.width, p = l.height, w = l.top, b = l.left, S = l.bottom, v = l.right;
34
- r({ x: c, y: h, width: u, height: p, top: w, left: b, bottom: S, right: v });
27
+ var ln = function() {
28
+ }, Ct = typeof window < "u", an = Ct ? Ve : V, ut = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
29
+ const fe = Ct && window.ResizeObserver !== void 0 ? function() {
30
+ var i = Q(null), e = i[0], t = i[1], n = Q(ut), o = n[0], r = n[1], s = N(function() {
31
+ return new window.ResizeObserver(function(l) {
32
+ if (l[0]) {
33
+ var a = l[0].contentRect, c = a.x, h = a.y, u = a.width, d = a.height, w = a.top, b = a.left, x = a.bottom, S = a.right;
34
+ r({ x: c, y: h, width: u, height: d, top: w, left: b, bottom: x, right: S });
35
35
  }
36
36
  });
37
37
  }, []);
38
- return cn(function() {
39
- if (t) return s.observe(t), function() {
38
+ return an(function() {
39
+ if (e) return s.observe(e), function() {
40
40
  s.disconnect();
41
41
  };
42
- }, [t]), [n, i];
42
+ }, [e]), [t, o];
43
43
  } : function() {
44
- return [an, ue];
45
- }, T = (e, t) => {
46
- const n = R((...r) => e?.(...r), t), o = k(null);
47
- o.current = n;
48
- const i = R((...r) => o.current?.(...r), []);
49
- if (o.current) return i;
50
- }, hn = (e) => {
51
- const { style: t, orientation: n = rt.Vertical, ...o } = e, i = n === rt.Vertical;
52
- return L("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: i ? "0px" : "3px", paddingTop: i ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${i ? "vertical" : "horizontal"} single-button start`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: i ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
53
- }, un = (e) => {
54
- const { style: t, orientation: n = rt.Vertical, ...o } = e, i = n === rt.Vertical;
55
- return L("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: i ? "0px" : "3px", paddingBottom: i ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...t }, ...o, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${i ? "vertical" : "horizontal"} single-button end`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: i ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
56
- }, oo = (e) => {
57
- const { style: t, orientation: n = rt.Vertical, ...o } = e, i = n === rt.Vertical;
58
- return L("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...t }, className: `scrollbar-button ${i ? "vertical" : "horizontal"} edge`, ...o, children: L("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: i ? "rotate(90) " : "", children: L("path", { style: { transition: "opacity 240ms ease 0s", opacity: e.disabled ? 0 : 1 }, d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" }) }) });
59
- }, Ut = (e, t, n, o, i = 0) => {
60
- for (let r = 0; r < n.length; r++) {
61
- const s = n[r].getBoundingClientRect();
62
- let a = s.left - t, l = a + s.width;
63
- if (o) {
64
- if (a < e && l >= e) return a;
65
- } else if (Math.ceil(l) > Math.ceil(e) + 2) return l;
44
+ return [ln, ut];
45
+ }, T = (i, e) => {
46
+ const t = R((...r) => i?.(...r), e), n = A(null);
47
+ n.current = t;
48
+ const o = R((...r) => n.current?.(...r), []);
49
+ if (n.current) return o;
50
+ }, cn = (i) => {
51
+ const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
52
+ return L("div", { style: { paddingBottom: "0px", paddingRight: "0px", paddingLeft: o ? "0px" : "3px", paddingTop: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button start`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z" : "m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z" }) }) }) });
53
+ }, hn = (i) => {
54
+ const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
55
+ return L("div", { style: { paddingLeft: "0px", paddingTop: "0px", paddingRight: o ? "0px" : "3px", paddingBottom: o ? "3px" : "0px", display: "flex", alignItems: "center", justifyContent: "center", ...e }, ...n, children: L("button", { style: { padding: "0", display: "flex", alignItems: "center", justifyContent: "center", border: "none" }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} single-button end`, children: L("svg", { width: "9", height: "9", viewBox: "0 0 6 6", style: { opacity: "inherit" }, children: L("path", { d: o ? "M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z" : "m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z" }) }) }) });
56
+ }, no = (i) => {
57
+ const { style: e, orientation: t = re.Vertical, ...n } = i, o = t === re.Vertical;
58
+ return L("div", { style: { display: "flex", justifyContent: "center", alignItems: "end", transition: "fill-opacity 1s", zIndex: 1, width: "24px", height: "24px", ...e }, className: `scrollbar-button ${o ? "vertical" : "horizontal"} edge`, ...n, children: L("svg", { width: "24", height: "24", viewBox: "0 0 24 24", transform: o ? "rotate(90) " : "", children: L("path", { style: { transition: "opacity 240ms ease 0s", opacity: i.disabled ? 0 : 1 }, d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" }) }) });
59
+ }, Ue = (i, e, t, n, o = 0) => {
60
+ for (let r = 0; r < t.length; r++) {
61
+ const s = t[r].getBoundingClientRect();
62
+ let l = s.left - e, a = l + s.width;
63
+ if (n) {
64
+ if (l < i && a >= i) return l;
65
+ } else if (Math.ceil(a) > Math.ceil(i) + 2) return a;
66
66
  }
67
- return i;
68
- }, io = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ut }, Symbol.toStringTag, { value: "Module" })), dn = "_sheetxl-scrollbar_eblx4_6", te = St(Lt((e, t) => {
69
- const { offset: n = 0, totalSize: o = 0, viewportSize: i = 0, style: r, className: s, orientation: a = rt.Vertical, onScrollOffset: l, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: p = 260, scrollButtonAdditionalRepeatDelay: w = 120, createScrollStartButton: b = hn, createScrollEndButton: S = un, ...v } = e, $ = T(c, [c]), _ = k(null), [y, { width: m, height: z }] = mt(), [P, { width: O, height: F }] = mt(), g = a === rt.Vertical, x = g ? "top" : "left", A = g ? "scrollTop" : "scrollLeft", d = g ? z : m, C = g ? F : O, [f, E] = Q(null);
67
+ return o;
68
+ }, oo = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ue }, Symbol.toStringTag, { value: "Module" })), un = "_sheetxl-scrollbar_eblx4_6", et = Se(Le((i, e) => {
69
+ const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: s, orientation: l = re.Vertical, onScrollOffset: a, onScroll: c, showCustomScrollButtons: h = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay: w = 120, createScrollStartButton: b = cn, createScrollEndButton: x = hn, ...S } = i, P = T(c, [c]), _ = A(null), [y, { width: f, height: k }] = fe(), [z, { width: O, height: F }] = fe(), g = l === re.Vertical, v = g ? "top" : "left", B = g ? "scrollTop" : "scrollLeft", p = g ? k : f, C = g ? F : O, [m, E] = Q(null);
70
70
  V(() => {
71
- f !== null && _.current && _.current.scrollTo({ behavior: "smooth", [x]: f });
72
- }, [f, g]);
73
- const D = R((K, st = !1) => {
71
+ m !== null && _.current && _.current.scrollTo({ behavior: "smooth", [v]: m });
72
+ }, [m, g]);
73
+ const D = R((K, se = !1) => {
74
74
  if (!_.current) return 0;
75
- const it = _.current.querySelector(".scrollbar-viewport"), pt = it.getBoundingClientRect(), lt = it.children, ct = st ? 0 : Ut(K, pt[x], lt, !0, Math.max(0, K - u));
76
- return E(ct), Math.max(0, ct);
77
- }, []), G = R((K, st = !1) => {
75
+ const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = se ? 0 : Ue(K, pe[v], le, !0, Math.max(0, K - u));
76
+ return E(ce), Math.max(0, ce);
77
+ }, []), G = R((K, se = !1) => {
78
78
  if (!_.current) return 0;
79
- const it = _.current.querySelector(".scrollbar-viewport"), pt = it.getBoundingClientRect(), lt = it.children, ct = Math.ceil(C - d), Ct = st ? ct : Ut(K, pt[x], lt, !1, Math.max(0, K + u));
80
- return E(Ct), Math.min(ct, Ct);
81
- }, [C, d]), W = k(null), Y = R((K) => {
82
- W.current = n;
83
- const st = K.target[A];
84
- l(st, i, o), $?.(K);
85
- }, [l, i, o, n]);
79
+ const ie = _.current.querySelector(".scrollbar-viewport"), pe = ie.getBoundingClientRect(), le = ie.children, ce = Math.ceil(C - p), Ce = se ? ce : Ue(K, pe[v], le, !1, Math.max(0, K + u));
80
+ return E(Ce), Math.min(ce, Ce);
81
+ }, [C, p]), W = A(null), Y = R((K) => {
82
+ W.current = t;
83
+ const se = K.target[B];
84
+ a(se, o, n), P?.(K);
85
+ }, [a, o, n, t]);
86
86
  V(() => {
87
87
  const K = W.current;
88
- W.current = null, n !== K && (_.current[A] = n);
89
- }, [n, A]);
90
- const j = k(null), B = k(null), I = R(() => {
91
- j.current && (clearTimeout(j.current), j.current = null, B.current = null);
92
- }, []), X = R((K, st, it, pt = p) => {
93
- B.current = K, j.current = setTimeout(() => {
94
- const lt = it ? D(B.current || K) : G(B.current || K);
95
- lt !== B.current ? X(lt, !1, it, w) : I();
96
- }, st ? 0 : pt);
88
+ W.current = null, t !== K && (_.current[B] = t);
89
+ }, [t, B]);
90
+ const X = A(null), $ = A(null), I = R(() => {
91
+ X.current && (clearTimeout(X.current), X.current = null, $.current = null);
92
+ }, []), j = R((K, se, ie, pe = d) => {
93
+ $.current = K, X.current = setTimeout(() => {
94
+ const le = ie ? D($.current || K) : G($.current || K);
95
+ le !== $.current ? j(le, !1, ie, w) : I();
96
+ }, se ? 0 : pe);
97
97
  }, [D, G, I]);
98
98
  V(() => () => I(), [I]);
99
- const nt = n, gt = N(() => {
99
+ const ne = t, ge = N(() => {
100
100
  if (!h) return null;
101
- const K = { orientation: a, disabled: Math.floor(nt) <= 0 || Math.floor(C - d) === 0, onMouseUp: I, onMouseLeave: I, onMouseDown: () => X(nt, !0, !0) };
101
+ const K = { orientation: l, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !0) };
102
102
  return b?.(K);
103
- }, [h, a, nt, f, C, d]), yt = N(() => {
103
+ }, [h, l, ne, m, C, p]), ye = N(() => {
104
104
  if (!h) return null;
105
- const K = { orientation: a, disabled: Math.floor(C - d) <= Math.ceil(nt), onMouseUp: I, onMouseLeave: I, onMouseDown: () => X(nt, !0, !1) };
106
- return S?.(K);
107
- }, [h, a, nt, f, C, d]);
108
- return bt("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: vt(dn, s), ...v, children: [gt, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: g ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: y, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: g ? "scroll" : "hidden", overflowX: g ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: Y, ref: _, children: L("div", { ref: P, style: { position: "absolute", height: g ? o - i + (z ?? 0) : 1, width: g ? 1 : o - i + (m ?? 0) }, className: "scrollbar-viewport" }) }) }), yt] });
105
+ const K = { orientation: l, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: I, onMouseLeave: I, onMouseDown: () => j(ne, !0, !1) };
106
+ return x?.(K);
107
+ }, [h, l, ne, m, C, p]);
108
+ return be("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: g ? "column" : "row", padding: "0", ...r }, className: ve(un, s), ...S, children: [ge, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: g ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: y, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: g ? "scroll" : "hidden", overflowX: g ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: Y, ref: _, children: L("div", { ref: z, style: { position: "absolute", height: g ? n - o + (k ?? 0) : 1, width: g ? 1 : n - o + (f ?? 0) }, className: "scrollbar-viewport" }) }) }), ye] });
109
109
  }));
110
- te.displayName = "Scrollbar";
111
- let de = Date.now, pe = 1e3, dt = {}, pn = 1;
112
- const Et = (e) => {
113
- let t = dt[e] !== null;
114
- return t && (dt[e] = null), t;
115
- }, _e = (e, t, n, o = 0, i) => {
116
- let r = de(), s = r, a = 0, l = 0, c = pn++;
117
- if (c % 20 == 0) {
118
- const u = {};
119
- for (let p in dt) u[p] = !0;
120
- dt = u;
110
+ et.displayName = "Scrollbar";
111
+ let dt = Date.now, pt = 1e3, de = {}, dn = 1;
112
+ const Ee = (i) => {
113
+ let e = de[i] !== null;
114
+ return e && (de[i] = null), e;
115
+ }, _t = (i, e, t, n = 0, o) => {
116
+ let r = dt(), s = r, l = 0, a = 0, c = 0, h = dn++;
117
+ if (h % 20 == 0) {
118
+ const d = {};
119
+ for (let w in de) d[w] = !0;
120
+ de = d;
121
121
  }
122
- const h = function(u) {
123
- const p = u !== !0, w = de();
124
- if (!dt[c] || t && !t(c)) return dt[c] = null, void n(60 - l / ((w - r) / pe), c, !1);
125
- if (p) {
126
- const S = Math.round((w - s) / 16.666666666666668) - 1;
127
- for (let v = 0; v < Math.min(S, 4); v++) h(!0), l++;
122
+ const u = function(d) {
123
+ let w = d !== !0, b = dt(), x = !0;
124
+ try {
125
+ x = (!e || e(h)) ?? !0;
126
+ } catch {
127
+ x = !1;
128
+ }
129
+ if (!de[h] || !x) return de[h] = null, void t?.(60 - a / ((b - r) / pt), h, !1);
130
+ if (w) {
131
+ c = Math.round((b - s) / 16.666666666666668) - 1;
132
+ for (let _ = 0; _ < Math.min(c, 4); _++) u(!0), a++;
128
133
  }
129
- o && (a = (w - r) / o, a > 1 && (a = 1));
130
- const b = i ? i(a) : a;
131
- e(b, w, p) !== !1 && a !== 1 || !p ? p && (s = w, requestAnimationFrame(h)) : (dt[c] = null, n(60 - l / ((w - r) / pe), c, a === 1 || o === void 0));
134
+ n && (l = (b - r) / n, l > 1 && (l = 1));
135
+ let S = o ? o(l) : l, P = !1;
136
+ try {
137
+ P = i(S, b, w);
138
+ } catch {
139
+ P = !1;
140
+ }
141
+ P !== !1 && l !== 1 || !w ? w && (s = b, requestAnimationFrame(u)) : (de[h] = null, t?.(60 - a / ((b - r) / pt), h, l === 1 || n == null));
132
142
  };
133
- return dt[c] = !0, requestAnimationFrame(h), c;
134
- };
135
- var _n = function() {
136
- }, fn = function(e) {
137
- return Math.pow(e - 1, 3) + 1;
138
- }, mn = function(e) {
139
- return (e /= 0.5) < 1 ? 0.5 * Math.pow(e, 3) : 0.5 * (Math.pow(e - 2, 3) + 2);
140
- }, Ee = function(e, t) {
141
- for (var n in this.__callback = e, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: _n, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08 }, t) this.options[n] = t[n];
143
+ return de[h] = !0, requestAnimationFrame(u), h;
144
+ }, pn = function(i) {
145
+ return Math.pow(i - 1, 3) + 1;
146
+ }, _n = function(i) {
147
+ return (i /= 0.5) < 1 ? 0.5 * Math.pow(i, 3) : 0.5 * (Math.pow(i - 2, 3) + 2);
142
148
  };
143
- Ee.prototype = { __isSingleTouch: !1, __isTracking: !1, __didDecelerationComplete: !1, __isGesturing: !1, __isDragging: !1, __isDecelerating: !1, __isAnimating: !1, __clientLeft: 0, __clientTop: 0, __clientWidth: 0, __clientHeight: 0, __contentWidth: 0, __contentHeight: 0, __snapWidth: 100, __snapHeight: 100, __zoomLevel: 1, __scrollLeft: 0, __scrollTop: 0, __maxScrollLeft: 0, __maxScrollTop: 0, __scheduledLeft: 0, __scheduledTop: 0, __scheduledZoom: 0, __lastTouchLeft: null, __lastTouchTop: null, __lastTouchMove: null, __positions: null, __minDecelerationScrollLeft: null, __minDecelerationScrollTop: null, __maxDecelerationScrollLeft: null, __maxDecelerationScrollTop: null, __decelerationVelocityX: null, __decelerationVelocityY: null, setDimensions: function(e, t, n, o) {
144
- e !== null && (this.__clientWidth = e), t !== null && (this.__clientHeight = t), n !== null && (this.__contentWidth = n), o !== null && (this.__contentHeight = o), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0);
145
- }, setPosition: function(e, t) {
146
- this.__clientLeft = e || 0, this.__clientTop = t || 0;
147
- }, setSnapSize: function(e, t) {
148
- this.__snapWidth = e, this.__snapHeight = t;
149
- }, getValues: function() {
150
- return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
151
- }, getPoint: function(e, t) {
152
- var n = this.getValues();
153
- return { left: e / n.zoom, top: t / n.zoom };
154
- }, getScrollMax: function() {
155
- return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
156
- }, zoomTo: function(e, t, n, o, i) {
157
- if (!this.options.zooming) throw new Error("Zooming is not enabled!");
158
- i && (this.__zoomComplete = i), this.__isDecelerating && (Et(this.__isDecelerating), this.__isDecelerating = !1);
159
- var r = this.__zoomLevel;
160
- n === void 0 && (n = this.__clientWidth / 2), o === void 0 && (o = this.__clientHeight / 2), e = Math.max(Math.min(e, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e);
161
- var s = e / r, a = s * (this.__scrollLeft + n) - n, l = s * (this.__scrollTop + o) - o;
162
- a > this.__maxScrollLeft ? a = this.__maxScrollLeft : a < 0 && (a = 0), l > this.__maxScrollTop ? l = this.__maxScrollTop : l < 0 && (l = 0), this.__publish(a, l, e, t);
163
- }, zoomBy: function(e, t, n, o, i) {
164
- this.zoomTo(this.__zoomLevel * e, t, n, o, i);
165
- }, scrollTo: function(e, t, n, o) {
166
- if (this.__isDecelerating && (Et(this.__isDecelerating), this.__isDecelerating = !1), o !== void 0 && o !== this.__zoomLevel) {
149
+ class mn {
150
+ constructor(e, t) {
151
+ this.__isSingleTouch = !1, this.__isTracking = !1, this.__didDecelerationComplete = !1, this.__isGesturing = !1, this.__isDragging = !1, this.__isDecelerating = 0, this.__isAnimating = 0, this.__interruptedAnimation = !1, this.__lastScale = 1, this.__enableScrollX = !0, this.__enableScrollY = !0, this.__clientLeft = 0, this.__clientTop = 0, this.__clientWidth = 0, this.__clientHeight = 0, this.__contentWidth = 0, this.__contentHeight = 0, this.__snapWidth = 100, this.__snapHeight = 100, this.__zoomLevel = 1, this.__scrollLeft = 0, this.__scrollTop = 0, this.__maxScrollLeft = 0, this.__maxScrollTop = 0, this.__scheduledLeft = 0, this.__scheduledTop = 0, this.__scheduledZoom = 0, this.__lastTouchLeft = 0, this.__lastTouchTop = 0, this.__lastTouchMove = 0, this.__positions = [], this.__initialTouchLeft = 0, this.__initialTouchTop = 0, this.__zoomLevelStart = 1, this.__minDecelerationScrollLeft = null, this.__minDecelerationScrollTop = null, this.__maxDecelerationScrollLeft = null, this.__maxDecelerationScrollTop = null, this.__decelerationVelocityX = null, this.__decelerationVelocityY = 0, this.__callback = e, this.options = { scrollingX: !0, scrollingY: !0, animating: !0, animationDuration: 250, bouncing: !0, locking: !0, paging: !1, snapping: !1, zooming: !1, minZoom: 0.5, maxZoom: 3, speedMultiplier: 1, scrollingComplete: void 0, penetrationDeceleration: 0.03, penetrationAcceleration: 0.08, ...t };
152
+ }
153
+ setDimensions(e, t, n, o) {
154
+ e !== null && (this.__clientWidth = e), t !== null && (this.__clientHeight = t), n !== null && (this.__contentWidth = n), o !== null && (this.__contentHeight = o), this.__computeScrollMax(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0);
155
+ }
156
+ setPosition(e, t) {
157
+ this.__clientLeft = e || 0, this.__clientTop = t || 0;
158
+ }
159
+ setSnapSize(e, t) {
160
+ this.__snapWidth = e, this.__snapHeight = t;
161
+ }
162
+ getValues() {
163
+ return { left: this.__scrollLeft, top: this.__scrollTop, right: this.__scrollLeft + this.__clientWidth / this.__zoomLevel, bottom: this.__scrollTop + this.__clientHeight / this.__zoomLevel, zoom: this.__zoomLevel };
164
+ }
165
+ getPoint(e, t) {
166
+ const n = this.getValues();
167
+ return { left: e / n.zoom, top: t / n.zoom };
168
+ }
169
+ getScrollMax() {
170
+ return { left: this.__maxScrollLeft, top: this.__maxScrollTop };
171
+ }
172
+ zoomTo(e, t = !1, n, o, r) {
167
173
  if (!this.options.zooming) throw new Error("Zooming is not enabled!");
168
- e *= o, t *= o, this.__computeScrollMax(o);
169
- } else o = this.__zoomLevel;
170
- this.options.scrollingX ? this.options.paging ? e = Math.round(e / this.__clientWidth) * this.__clientWidth : this.options.snapping && (e = Math.round(e / this.__snapWidth) * this.__snapWidth) : e = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? t = Math.round(t / this.__clientHeight) * this.__clientHeight : this.options.snapping && (t = Math.round(t / this.__snapHeight) * this.__snapHeight) : t = this.__scrollTop, e = Math.max(Math.min(this.__maxScrollLeft, e), 0), t = Math.max(Math.min(this.__maxScrollTop, t), 0), e === this.__scrollLeft && t === this.__scrollTop && (n = !1), this.__publish(e, t, o, n);
171
- }, scrollBy: function(e, t, n) {
172
- var o = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, i = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
173
- this.scrollTo(o + (e || 0), i + (t || 0), n);
174
- }, doMouseZoom: function(e, t, n, o) {
175
- var i = e > 0 ? 0.97 : 1.03;
176
- return this.zoomTo(this.__zoomLevel * i, !1, n - this.__clientLeft, o - this.__clientTop);
177
- }, doTouchStart: function(e, t) {
178
- if (e.length === void 0) throw new Error("Invalid touch list: " + e);
179
- if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
180
- var n, o;
181
- this.__interruptedAnimation = !0, this.__isDecelerating && (Et(this.__isDecelerating), this.__isDecelerating = !1, this.__interruptedAnimation = !0), this.__isAnimating && (Et(this.__isAnimating), this.__isAnimating = !1, this.__interruptedAnimation = !0);
182
- var i = e.length === 1;
183
- i ? (n = e[0].pageX, o = e[0].pageY) : (n = Math.abs(e[0].pageX + e[1].pageX) / 2, o = Math.abs(e[0].pageY + e[1].pageY) / 2), this.__initialTouchLeft = n, this.__initialTouchTop = o, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n, this.__lastTouchTop = o, this.__lastTouchMove = t, this.__lastScale = 1, this.__enableScrollX = !i && this.options.scrollingX, this.__enableScrollY = !i && this.options.scrollingY, this.__isTracking = !0, this.__didDecelerationComplete = !1, this.__isDragging = !i, this.__isSingleTouch = i, this.__positions = [];
184
- }, doTouchMove: function(e, t, n) {
185
- if (e.length === void 0) throw new Error("Invalid touch list: " + e);
186
- if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
187
- if (this.__isTracking) {
188
- var o, i;
189
- e.length === 2 ? (o = Math.abs(e[0].pageX + e[1].pageX) / 2, i = Math.abs(e[0].pageY + e[1].pageY) / 2) : (o = e[0].pageX, i = e[0].pageY);
190
- var r = this.__positions;
174
+ r && (this.__zoomComplete = r), this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0);
175
+ const s = this.__zoomLevel;
176
+ n === void 0 && (n = this.__clientWidth / 2), o === void 0 && (o = this.__clientHeight / 2), e = Math.max(Math.min(e, this.options.maxZoom), this.options.minZoom), this.__computeScrollMax(e);
177
+ const l = e / s;
178
+ let a = l * (this.__scrollLeft + n) - n, c = l * (this.__scrollTop + o) - o;
179
+ a > this.__maxScrollLeft ? a = this.__maxScrollLeft : a < 0 && (a = 0), c > this.__maxScrollTop ? c = this.__maxScrollTop : c < 0 && (c = 0), this.__publish(a, c, e, t);
180
+ }
181
+ zoomBy(e, t = !1, n = 0, o = 0, r) {
182
+ this.zoomTo(this.__zoomLevel * e, t, n, o, r);
183
+ }
184
+ scrollTo(e, t, n = !1, o = 1) {
185
+ if (this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0), o !== void 0 && o !== this.__zoomLevel) {
186
+ if (!this.options.zooming) throw new Error("Zooming is not enabled!");
187
+ e *= o, t *= o, this.__computeScrollMax(o);
188
+ } else o = this.__zoomLevel;
189
+ this.options.scrollingX ? this.options.paging ? e = Math.round(e / this.__clientWidth) * this.__clientWidth : this.options.snapping && (e = Math.round(e / this.__snapWidth) * this.__snapWidth) : e = this.__scrollLeft, this.options.scrollingY ? this.options.paging ? t = Math.round(t / this.__clientHeight) * this.__clientHeight : this.options.snapping && (t = Math.round(t / this.__snapHeight) * this.__snapHeight) : t = this.__scrollTop, e = Math.max(Math.min(this.__maxScrollLeft, e), 0), t = Math.max(Math.min(this.__maxScrollTop, t), 0), e === this.__scrollLeft && t === this.__scrollTop && (n = !1), this.__publish(e, t, o, n);
190
+ }
191
+ scrollBy(e = 0, t = 0, n = !1) {
192
+ const o = this.__isAnimating ? this.__scheduledLeft : this.__scrollLeft, r = this.__isAnimating ? this.__scheduledTop : this.__scrollTop;
193
+ this.scrollTo(o + (e || 0), r + (t || 0), n);
194
+ }
195
+ doMouseZoom(e, t, n, o) {
196
+ const r = e > 0 ? 0.97 : 1.03;
197
+ return this.zoomTo(this.__zoomLevel * r, !1, n - this.__clientLeft, o - this.__clientTop);
198
+ }
199
+ doTouchStart(e, t) {
200
+ if (e.length === void 0) throw new Error("Invalid touch list: " + e);
201
+ if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
202
+ let n, o;
203
+ this.__interruptedAnimation = !0, this.__isDecelerating && (Ee(this.__isDecelerating), this.__isDecelerating = 0, this.__interruptedAnimation = !0), this.__isAnimating && (Ee(this.__isAnimating), this.__isAnimating = 0, this.__interruptedAnimation = !0);
204
+ let r = e.length === 1;
205
+ r ? (n = e[0].pageX, o = e[0].pageY) : (n = Math.abs(e[0].pageX + e[1].pageX) / 2, o = Math.abs(e[0].pageY + e[1].pageY) / 2), this.__initialTouchLeft = n, this.__initialTouchTop = o, this.__zoomLevelStart = this.__zoomLevel, this.__lastTouchLeft = n, this.__lastTouchTop = o, this.__lastTouchMove = t, this.__lastScale = 1, this.__enableScrollX = !r && this.options.scrollingX, this.__enableScrollY = !r && this.options.scrollingY, this.__isTracking = !0, this.__didDecelerationComplete = !1, this.__isDragging = !r, this.__isSingleTouch = r, this.__positions = [];
206
+ }
207
+ doTouchMove(e, t, n = 1) {
208
+ if (e.length === void 0) throw new Error("Invalid touch list: " + e);
209
+ if (t instanceof Date && (t = t.valueOf()), typeof t != "number") throw new Error("Invalid timestamp value: " + t);
210
+ if (!this.__isTracking) return;
211
+ let o, r;
212
+ e.length === 2 ? (o = Math.abs(e[0].pageX + e[1].pageX) / 2, r = Math.abs(e[0].pageY + e[1].pageY) / 2) : (o = e[0].pageX, r = e[0].pageY);
213
+ let s = this.__positions;
191
214
  if (this.__isDragging) {
192
- var s = o - this.__lastTouchLeft, a = i - this.__lastTouchTop, l = this.__scrollLeft, c = this.__scrollTop, h = this.__zoomLevel;
215
+ let l = o - this.__lastTouchLeft, a = r - this.__lastTouchTop, c = this.__scrollLeft, h = this.__scrollTop, u = this.__zoomLevel;
193
216
  if (n !== void 0 && this.options.zooming) {
194
- var u = h;
195
- if (h = h / this.__lastScale * n, u !== (h = Math.max(Math.min(h, this.options.maxZoom), this.options.minZoom))) {
196
- var p = o - this.__clientLeft, w = i - this.__clientTop;
197
- l = (p + l) * h / u - p, c = (w + c) * h / u - w, this.__computeScrollMax(h);
217
+ let d = u;
218
+ if (u = u / this.__lastScale * n, u = Math.max(Math.min(u, this.options.maxZoom), this.options.minZoom), d !== u) {
219
+ let w = o - this.__clientLeft, b = r - this.__clientTop;
220
+ c = (w + c) * u / d - w, h = (b + h) * u / d - b, this.__computeScrollMax(u);
198
221
  }
199
222
  }
200
223
  if (this.__enableScrollX) {
201
- l -= s * this.options.speedMultiplier;
202
- var b = this.__maxScrollLeft;
203
- (l > b || l < 0) && (this.options.bouncing ? l += s / 2 * this.options.speedMultiplier : l = l > b ? b : 0);
224
+ c -= l * this.options.speedMultiplier;
225
+ let d = this.__maxScrollLeft;
226
+ (c > d || c < 0) && (this.options.bouncing ? c += l / 2 * this.options.speedMultiplier : c = c > d ? d : 0);
204
227
  }
205
228
  if (this.__enableScrollY) {
206
- c -= a * this.options.speedMultiplier;
207
- var S = this.__maxScrollTop;
208
- (c > S || c < 0) && (this.options.bouncing ? c += a / 2 * this.options.speedMultiplier : c = c > S ? S : 0);
229
+ h -= a * this.options.speedMultiplier;
230
+ const d = this.__maxScrollTop;
231
+ (h > d || h < 0) && (this.options.bouncing ? h += a / 2 * this.options.speedMultiplier : h = h > d ? d : 0);
209
232
  }
210
- r.length > 60 && r.splice(0, 30), r.push(l, c, t), this.__publish(l, c, h);
233
+ s.length > 60 && s.splice(0, 30), s.push(c, h, t), this.__publish(c, h, u);
211
234
  } else {
212
- var v = this.options.locking ? 3 : 0, $ = Math.abs(o - this.__initialTouchLeft), _ = Math.abs(i - this.__initialTouchTop);
213
- this.__enableScrollX = this.options.scrollingX && $ >= v, this.__enableScrollY = this.options.scrollingY && _ >= v, r.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && ($ >= 5 || _ >= 5), this.__isDragging && (this.__interruptedAnimation = !1);
235
+ let l = this.options.locking ? 3 : 0, a = 5, c = Math.abs(o - this.__initialTouchLeft), h = Math.abs(r - this.__initialTouchTop);
236
+ this.__enableScrollX = this.options.scrollingX && c >= l, this.__enableScrollY = this.options.scrollingY && h >= l, s.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (c >= a || h >= a), this.__isDragging && (this.__interruptedAnimation = !1);
237
+ }
238
+ this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = t, this.__lastScale = n;
239
+ }
240
+ doTouchEnd(e) {
241
+ if (e instanceof Date && (e = e.valueOf()), typeof e != "number") throw new Error("Invalid timestamp value: " + e);
242
+ if (this.__isTracking) {
243
+ if (this.__isTracking = !1, this.__isDragging) if (this.__isDragging = !1, this.__isSingleTouch && this.options.animating && e - this.__lastTouchMove <= 100) {
244
+ let t = this.__positions, n = t.length - 1, o = n;
245
+ for (let r = n; r > 0 && t[r] > this.__lastTouchMove - 100; r -= 3) o = r;
246
+ if (o !== n) {
247
+ const r = t[n] - t[o], s = this.__scrollLeft - t[o - 2], l = this.__scrollTop - t[o - 1];
248
+ this.__decelerationVelocityX = s / r * (1e3 / 60), this.__decelerationVelocityY = l / r * (1e3 / 60);
249
+ const a = this.options.paging || this.options.snapping ? 4 : 1;
250
+ (Math.abs(this.__decelerationVelocityX) > a || Math.abs(this.__decelerationVelocityY) > a) && this.__startDeceleration(e);
251
+ } else this.options.scrollingComplete?.();
252
+ } else e - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
253
+ this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0;
214
254
  }
215
- this.__lastTouchLeft = o, this.__lastTouchTop = i, this.__lastTouchMove = t, this.__lastScale = n;
216
255
  }
217
- }, doTouchEnd: function(e) {
218
- if (e instanceof Date && (e = e.valueOf()), typeof e != "number") throw new Error("Invalid timestamp value: " + e);
219
- if (this.__isTracking) {
220
- if (this.__isTracking = !1, this.__isDragging) if (this.__isDragging = !1, this.__isSingleTouch && this.options.animating && e - this.__lastTouchMove <= 100) {
221
- for (var t = this.__positions, n = t.length - 1, o = n, i = n; i > 0 && t[i] > this.__lastTouchMove - 100; i -= 3) o = i;
222
- if (o !== n) {
223
- var r = t[n] - t[o], s = this.__scrollLeft - t[o - 2], a = this.__scrollTop - t[o - 1];
224
- this.__decelerationVelocityX = s / r * (1e3 / 60), this.__decelerationVelocityY = a / r * (1e3 / 60);
225
- var l = this.options.paging || this.options.snapping ? 4 : 1;
226
- (Math.abs(this.__decelerationVelocityX) > l || Math.abs(this.__decelerationVelocityY) > l) && this.__startDeceleration(e);
227
- } else this.options.scrollingComplete();
228
- } else e - this.__lastTouchMove > 100 && this.options.scrollingComplete();
229
- this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0;
256
+ __publish(e, t, n, o = !1) {
257
+ const r = this.__isAnimating;
258
+ if (r && (Ee(r), this.__isAnimating = 0), o && this.options.animating) {
259
+ this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
260
+ const s = this.__scrollLeft, l = this.__scrollTop, a = this.__zoomLevel, c = e - s, h = t - l, u = n - a, d = function(x, S, P) {
261
+ P && (this.__scrollLeft = s + c * x, this.__scrollTop = l + h * x, this.__zoomLevel = a + u * x, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
262
+ }.bind(this), w = function(x) {
263
+ return this.__isAnimating === x;
264
+ }.bind(this), b = function(x, S, P) {
265
+ S === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || P) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
266
+ }.bind(this);
267
+ this.__isAnimating = _t(d, w, b, this.options.animationDuration, r ? pn : _n);
268
+ } else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
230
269
  }
231
- }, __publish: function(e, t, n, o) {
232
- var i = this.__isAnimating;
233
- if (i && (Et(i), this.__isAnimating = !1), o && this.options.animating) {
234
- this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
235
- var r = this.__scrollLeft, s = this.__scrollTop, a = this.__zoomLevel, l = e - r, c = t - s, h = n - a, u = function(b, S, v) {
236
- v && (this.__scrollLeft = r + l * b, this.__scrollTop = s + c * b, this.__zoomLevel = a + h * b, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
237
- }.bind(this), p = function(b) {
238
- return this.__isAnimating === b;
239
- }.bind(this), w = function(b, S, v) {
240
- S === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || v) && this.options.scrollingComplete(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
270
+ __computeScrollMax(e = this.__zoomLevel) {
271
+ this.__maxScrollLeft = Math.max(this.__contentWidth * e - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e - this.__clientHeight, 0);
272
+ }
273
+ __startDeceleration(e) {
274
+ if (this.options.paging) {
275
+ const s = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), l = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), a = this.__clientWidth, c = this.__clientHeight;
276
+ this.__minDecelerationScrollLeft = Math.floor(s / a) * a, this.__minDecelerationScrollTop = Math.floor(l / c) * c, this.__maxDecelerationScrollLeft = Math.ceil(s / a) * a, this.__maxDecelerationScrollTop = Math.ceil(l / c) * c;
277
+ } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
278
+ const t = function(s, l, a) {
279
+ this.__stepThroughDeceleration(a);
280
+ }.bind(this), n = this.options.snapping ? 4 : 0.1, o = function() {
281
+ const s = Math.abs(this.__decelerationVelocityX) >= n || Math.abs(this.__decelerationVelocityY) >= n;
282
+ return s || (this.__didDecelerationComplete = !0), s;
283
+ }.bind(this), r = function(s, l, a) {
284
+ this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
241
285
  }.bind(this);
242
- this.__isAnimating = _e(u, p, w, this.options.animationDuration, i ? fn : mn);
243
- } else this.__scheduledLeft = this.__scrollLeft = e, this.__scheduledTop = this.__scrollTop = t, this.__scheduledZoom = this.__zoomLevel = n, this.__callback && this.__callback(e, t, n), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
244
- }, __computeScrollMax: function(e) {
245
- e === void 0 && (e = this.__zoomLevel), this.__maxScrollLeft = Math.max(this.__contentWidth * e - this.__clientWidth, 0), this.__maxScrollTop = Math.max(this.__contentHeight * e - this.__clientHeight, 0);
246
- }, __startDeceleration: function(e) {
247
- if (this.options.paging) {
248
- var t = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), n = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), o = this.__clientWidth, i = this.__clientHeight;
249
- this.__minDecelerationScrollLeft = Math.floor(t / o) * o, this.__minDecelerationScrollTop = Math.floor(n / i) * i, this.__maxDecelerationScrollLeft = Math.ceil(t / o) * o, this.__maxDecelerationScrollTop = Math.ceil(n / i) * i;
250
- } else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
251
- var r = function(c, h, u) {
252
- this.__stepThroughDeceleration(u);
253
- }.bind(this), s = this.options.snapping ? 4 : 0.1, a = function() {
254
- var c = Math.abs(this.__decelerationVelocityX) >= s || Math.abs(this.__decelerationVelocityY) >= s;
255
- return c || (this.__didDecelerationComplete = !0), c;
256
- }.bind(this), l = function(c, h, u) {
257
- this.__isDecelerating = !1, this.__didDecelerationComplete && this.options.scrollingComplete(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
258
- }.bind(this);
259
- this.__isDecelerating = _e(r, a, l);
260
- }, __stepThroughDeceleration: function(e) {
261
- var t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
262
- if (!this.options.bouncing) {
263
- var o = Math.max(Math.min(this.__maxDecelerationScrollLeft, t), this.__minDecelerationScrollLeft);
264
- o !== t && (t = o, this.__decelerationVelocityX = 0);
265
- var i = Math.max(Math.min(this.__maxDecelerationScrollTop, n), this.__minDecelerationScrollTop);
266
- i !== n && (n = i, this.__decelerationVelocityY = 0);
286
+ this.__isDecelerating = _t(t, o, r);
267
287
  }
268
- if (e ? this.__publish(t, n, this.__zoomLevel) : (this.__scrollLeft = t, this.__scrollTop = n), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) {
269
- var r = 0, s = 0, a = this.options.penetrationDeceleration, l = this.options.penetrationAcceleration;
270
- t < this.__minDecelerationScrollLeft ? r = this.__minDecelerationScrollLeft - t : t > this.__maxDecelerationScrollLeft && (r = this.__maxDecelerationScrollLeft - t), n < this.__minDecelerationScrollTop ? s = this.__minDecelerationScrollTop - n : n > this.__maxDecelerationScrollTop && (s = this.__maxDecelerationScrollTop - n), r !== 0 && (r * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += r * a : this.__decelerationVelocityX = r * l), s !== 0 && (s * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += s * a : this.__decelerationVelocityY = s * l);
288
+ __stepThroughDeceleration(e) {
289
+ let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
290
+ if (!this.options.bouncing) {
291
+ const o = Math.max(Math.min(this.__maxDecelerationScrollLeft, t), this.__minDecelerationScrollLeft);
292
+ o !== t && (t = o, this.__decelerationVelocityX = 0);
293
+ const r = Math.max(Math.min(this.__maxDecelerationScrollTop, n), this.__minDecelerationScrollTop);
294
+ r !== n && (n = r, this.__decelerationVelocityY = 0);
295
+ }
296
+ if (e ? this.__publish(t, n, this.__zoomLevel) : (this.__scrollLeft = t, this.__scrollTop = n), !this.options.paging && (this.__decelerationVelocityX *= 0.95, this.__decelerationVelocityY *= 0.95), this.options.bouncing) {
297
+ let o = 0, r = 0, s = this.options.penetrationDeceleration, l = this.options.penetrationAcceleration;
298
+ t < this.__minDecelerationScrollLeft ? o = this.__minDecelerationScrollLeft - t : t > this.__maxDecelerationScrollLeft && (o = this.__maxDecelerationScrollLeft - t), n < this.__minDecelerationScrollTop ? r = this.__minDecelerationScrollTop - n : n > this.__maxDecelerationScrollTop && (r = this.__maxDecelerationScrollTop - n), o !== 0 && (o * this.__decelerationVelocityX <= 0 ? this.__decelerationVelocityX += o * s : this.__decelerationVelocityX = o * l), r !== 0 && (r * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += r * s : this.__decelerationVelocityY = r * l);
299
+ }
271
300
  }
272
- } };
273
- var J = typeof window < "u" ? window : { screen: {}, navigator: {} }, wt = (J.matchMedia || function() {
301
+ }
302
+ var J = typeof window < "u" ? window : { screen: {}, navigator: {} }, we = (J.matchMedia || function() {
274
303
  return { matches: !1 };
275
- }).bind(J), Te = !1, gn = { get passive() {
276
- return Te = !0;
277
- } }, fe = function() {
304
+ }).bind(J), Et = !1, fn = { get passive() {
305
+ return Et = !0;
306
+ } }, mt = function() {
278
307
  };
279
- J.addEventListener && J.addEventListener("p", fe, gn), J.removeEventListener && J.removeEventListener("p", fe, !1);
280
- var yn = Te, vn = "PointerEvent" in J, ee = "ontouchstart" in J, Me = ee || "TouchEvent" in J && wt("(any-pointer: coarse)").matches, me = (J.navigator.maxTouchPoints || 0) > 0 || Me, De = J.navigator.userAgent || "", xn = wt("(pointer: coarse)").matches && /iPad|Macintosh/.test(De) && Math.min(J.screen.width || 0, J.screen.height || 0) >= 768, Pe = (wt("(pointer: coarse)").matches || !wt("(pointer: fine)").matches && ee) && !/Windows.*Firefox/.test(De), bn = wt("(any-pointer: fine)").matches || wt("(any-hover: hover)").matches || xn || !ee, Zt = !me || !bn && Pe ? me ? "touchOnly" : "mouseOnly" : "hybrid", wn = Zt === "mouseOnly" ? "mouse" : Zt === "touchOnly" || Pe ? "touch" : "mouse";
281
- const Sn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Zt, primaryInput: wn, supportsPassiveEvents: yn, supportsPointerEvents: vn, supportsTouchEvents: Me }, Symbol.toStringTag, { value: "Module" })), Ln = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), ze = {};
282
- function Gt() {
283
- return Sn;
308
+ J.addEventListener && J.addEventListener("p", mt, fn), J.removeEventListener && J.removeEventListener("p", mt, !1);
309
+ var gn = Et, yn = "PointerEvent" in J, tt = "ontouchstart" in J, Tt = tt || "TouchEvent" in J && we("(any-pointer: coarse)").matches, ft = (J.navigator.maxTouchPoints || 0) > 0 || Tt, Mt = J.navigator.userAgent || "", vn = we("(pointer: coarse)").matches && /iPad|Macintosh/.test(Mt) && Math.min(J.screen.width || 0, J.screen.height || 0) >= 768, Dt = (we("(pointer: coarse)").matches || !we("(pointer: fine)").matches && tt) && !/Windows.*Firefox/.test(Mt), xn = we("(any-pointer: fine)").matches || we("(any-hover: hover)").matches || vn || !tt, Ze = !ft || !xn && Dt ? ft ? "touchOnly" : "mouseOnly" : "hybrid", bn = Ze === "mouseOnly" ? "mouse" : Ze === "touchOnly" || Dt ? "touch" : "mouse";
310
+ const wn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Ze, primaryInput: bn, supportsPassiveEvents: gn, supportsPointerEvents: yn, supportsTouchEvents: Tt }, Symbol.toStringTag, { value: "Module" })), Sn = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), Pt = {};
311
+ function Ge() {
312
+ return wn;
284
313
  }
285
- const ke = (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : et.camelToPrettyCase(e), ro = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: ze, boundPixel: function(e, t = !1, n = 0) {
286
- return e;
287
- }, createSyntheticEvent: (e) => {
288
- let t = !1, n = !1;
289
- return { nativeEvent: e, currentTarget: e.currentTarget, target: e.target, bubbles: e.bubbles, cancelable: e.cancelable, defaultPrevented: e.defaultPrevented, eventPhase: e.eventPhase, isTrusted: e.isTrusted, preventDefault: () => {
290
- t = !0, e.preventDefault();
291
- }, isDefaultPrevented: () => t, stopPropagation: () => {
292
- n = !0, e.stopPropagation();
293
- }, isPropagationStopped: () => n, persist: () => {
294
- }, timeStamp: e.timeStamp, type: e.type };
295
- }, detectIt: Gt, focusableNodeNames: Ln, toPrettyKeyCode: ke }, Symbol.toStringTag, { value: "Module" })), Cn = [];
296
- function Ae(e, t, n = Cn) {
297
- const o = k(null);
298
- return en(e, () => {
299
- if (!o.current) return;
300
- const i = o.current, r = t?.();
314
+ const zt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.camelToPrettyCase(i), io = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: Pt, boundPixel: function(i, e = !1, t = 0) {
315
+ return i;
316
+ }, createSyntheticEvent: (i) => {
317
+ let e = !1, t = !1;
318
+ return { nativeEvent: i, currentTarget: i.currentTarget, target: i.target, bubbles: i.bubbles, cancelable: i.cancelable, defaultPrevented: i.defaultPrevented, eventPhase: i.eventPhase, isTrusted: i.isTrusted, preventDefault: () => {
319
+ e = !0, i.preventDefault();
320
+ }, isDefaultPrevented: () => e, stopPropagation: () => {
321
+ t = !0, i.stopPropagation();
322
+ }, isPropagationStopped: () => t, persist: () => {
323
+ }, timeStamp: i.timeStamp, type: i.type };
324
+ }, detectIt: Ge, focusableNodeNames: Sn, toPrettyKeyCode: zt }, Symbol.toStringTag, { value: "Module" })), Ln = [];
325
+ function kt(i, e, t = Ln) {
326
+ const n = A(null);
327
+ return en(i, () => {
328
+ if (!n.current) return;
329
+ const o = n.current, r = e?.();
301
330
  if (!r || typeof r != "object") throw new Error("attributes must return a plain object of values");
302
- const s = Object.keys(r), a = s.length;
303
- for (let l = 0; l < a; l++) {
304
- const c = s[l], h = r[c];
305
- Object.defineProperty(i, c, { value: h, writable: !0, configurable: !0, enumerable: !0 });
331
+ const s = Object.keys(r), l = s.length;
332
+ for (let a = 0; a < l; a++) {
333
+ const c = s[a], h = r[c];
334
+ Object.defineProperty(o, c, { value: h, writable: !0, configurable: !0, enumerable: !0 });
306
335
  }
307
- return i;
308
- }, n), o;
336
+ return o;
337
+ }, t), n;
309
338
  }
310
- const ge = (e) => L(te, { ...e }), En = ({ width: e, height: t }) => L("div", { className: "corner", style: { minWidth: `${e}px`, width: `${e}px`, minHeight: `${t}px`, height: `${t}px` } }), Tn = St(Lt((e, t) => {
311
- const { children: n, viewport: o, onScrollViewport: i, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: a = En, createHorizontalScrollbar: l = ge, createVerticalScrollbar: c = ge, style: h, touchElement: u, disableTouch: p, ...w } = e, b = T(i, [i]), S = Ae(t, () => ({ isScrollPane: () => !0 }), []), v = k(null);
339
+ const gt = (i) => L(et, { ...i }), Cn = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), En = Se(Le((i, e) => {
340
+ const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: s = !0, createScrollCorner: l = Cn, createHorizontalScrollbar: a = gt, createVerticalScrollbar: c = gt, style: h, touchElement: u, disableTouch: d, ...w } = i, b = T(o, [o]), x = kt(e, () => ({ isScrollPane: () => !0 }), []), S = A(null);
312
341
  V(() => {
313
- v.current && (v.current.__scrollTop === o?.top && v.current.__scrollLeft !== !o?.left || v.current?.scrollTo(o?.left, o?.top, !1));
314
- }, [o?.left, o?.top, u]);
315
- const $ = R((d, C) => {
316
- b?.({ left: d, top: C });
317
- }, []), _ = R((d) => {
318
- v.current?.doTouchStart(d.touches, d.timeStamp);
319
- }, []), y = R((d) => {
320
- d.preventDefault(), v.current?.doTouchMove(d.touches, d.timeStamp);
321
- }, []), m = R((d) => {
322
- v.current?.doTouchEnd(d.timeStamp);
323
- }, []), z = R(({ containerWidth: d, containerHeight: C, totalWidth: f, totalHeight: E }) => {
324
- v.current.setDimensions(d, C, f, E);
342
+ S.current && (S.current.__scrollTop === n?.top && S.current.__scrollLeft === n?.left || S.current.__isDecelerating || S.current?.scrollTo(n?.left, n?.top, !1));
343
+ }, [n?.left, n?.top, u]);
344
+ const P = R((p, C) => {
345
+ b?.({ left: p, top: C });
346
+ }, []), _ = R((p) => {
347
+ S.current?.doTouchStart(p.touches, p.timeStamp);
348
+ }, []), y = R((p) => {
349
+ p.preventDefault(), S.current?.doTouchMove(p.touches, p.timeStamp);
350
+ }, []), f = R((p) => {
351
+ S.current?.doTouchEnd(p.timeStamp);
352
+ }, []), k = R(({ containerWidth: p, containerHeight: C, totalWidth: m, totalHeight: E }) => {
353
+ S.current.setDimensions(p, C, m, E);
325
354
  }, []);
326
355
  V(() => {
327
- const d = u ?? S.current;
328
- if (!p && Gt().supportsTouchEvents && d && o) {
329
- if (!v.current) {
356
+ const p = u ?? x.current;
357
+ if (!d && Ge().supportsTouchEvents && p && n) {
358
+ if (!S.current) {
330
359
  const C = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
331
- v.current = new Ee($, C);
360
+ S.current = new mn(P, C);
332
361
  }
333
- Gt().supportsTouchEvents && (d.addEventListener("touchstart", _), d.addEventListener("touchend", m), d.addEventListener("touchmove", y)), z({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
362
+ Ge().supportsTouchEvents && (p.addEventListener("touchstart", _), p.addEventListener("touchend", f), p.addEventListener("touchmove", y)), k({ containerWidth: n?.width, containerHeight: n?.height, totalWidth: n?.totalWidth, totalHeight: n?.totalHeight });
334
363
  }
335
364
  return () => {
336
- d?.removeEventListener("touchstart", _), d?.removeEventListener("touchend", m), d?.removeEventListener("touchmove", y);
365
+ p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend", f), p?.removeEventListener("touchmove", y);
337
366
  };
338
- }, [o?.width, o?.height, o?.totalWidth, o?.totalHeight, p, u]);
339
- const [P, { width: O }] = mt(), [F, { height: g }] = mt(), x = N(() => {
340
- const d = c({ orientation: rt.Vertical, offset: o?.top, viewportSize: o?.height, totalSize: o?.totalHeight, onScrollOffset: (C) => {
367
+ }, [n?.width, n?.height, n?.totalWidth, n?.totalHeight, d, u]);
368
+ const [z, { width: O }] = fe(), [F, { height: g }] = fe(), v = N(() => {
369
+ const p = c({ orientation: re.Vertical, offset: n?.top, viewportSize: n?.height, totalSize: n?.totalHeight, onScrollOffset: (C) => {
341
370
  b?.({ top: C });
342
371
  } });
343
- return L("div", { style: { display: "flex", flex: "0" }, ref: P, children: d });
344
- }, [c, o?.top, o?.height, o?.totalHeight]), A = N(() => {
345
- const d = l({ orientation: rt.Horizontal, offset: o?.left, viewportSize: o?.width, totalSize: o?.totalWidth, onScrollOffset: (C) => b?.({ left: C }) });
346
- return bt("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${O}px)` }, children: L("div", { ref: F, className: "sizer", children: d }) }), s ? a({ width: O, height: g }) : L(Mt, {})] });
347
- }, [l, o?.left, o?.width, o?.totalWidth, s, a, O, g]);
348
- return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${O}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...w, ref: S, children: bt("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [bt("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: n }), s ? x : L(Mt, {})] }), r ? A : L(Mt, {})] }) });
372
+ return L("div", { style: { display: "flex", flex: "0" }, ref: z, children: p });
373
+ }, [c, n?.top, n?.height, n?.totalHeight]), B = N(() => {
374
+ const p = a({ orientation: re.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) => b?.({ left: C }) });
375
+ return be("div", { style: { display: "flex", flex: "none", flexDirection: "row", alignItems: "stretch", justifyContent: "center" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", flexDirection: "column", width: `calc(100% - ${O}px)` }, children: L("div", { ref: F, className: "sizer", children: p }) }), s ? l({ width: O, height: g }) : L(Me, {})] });
376
+ }, [a, n?.left, n?.width, n?.totalWidth, s, l, O, g]);
377
+ return L("div", { style: { position: "relative", display: "flex", minWidth: s ? `${O}px` : void 0, minHeight: r ? `${g}px` : void 0, ...h }, ...w, ref: x, children: be("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [be("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: t }), s ? v : L(Me, {})] }), r ? B : L(Me, {})] }) });
349
378
  }));
350
- Tn.displayName = "ScrollPane";
351
- const ye = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, ve = /* @__PURE__ */ new Set(), Be = { showMessage: (e, t) => {
352
- if (t?.onceKey) {
353
- if (ve.has(t.onceKey)) return;
354
- ve.add(t.onceKey);
379
+ En.displayName = "ScrollPane";
380
+ const yt = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" }, vt = /* @__PURE__ */ new Set(), At = { showMessage: (i, e) => {
381
+ if (e?.onceKey) {
382
+ if (vt.has(e.onceKey)) return;
383
+ vt.add(e.onceKey);
355
384
  }
356
- let n = console.log;
357
- t?.type !== ye.Warning && t?.type !== ye.Error || (n = console.warn), n(e);
358
- }, showBusy: (e, t) => new Promise((n) => {
359
- n(() => {
385
+ let t = console.log;
386
+ e?.type !== yt.Warning && e?.type !== yt.Error || (t = console.warn), t(i);
387
+ }, showBusy: (i, e) => new Promise((t) => {
388
+ t(() => {
360
389
  });
361
- }), showError: (e) => {
362
- console.error(e);
363
- } }, Mn = () => {
364
- const e = document.fullscreenElement;
365
- return e ? e.querySelector(".fullscreen-portal-root") || e : document.body;
390
+ }), showError: (i) => {
391
+ console.error(i);
392
+ } }, Tn = () => {
393
+ const i = document.fullscreenElement;
394
+ return i ? i.querySelector(".fullscreen-portal-root") || i : document.body;
366
395
  };
367
- let kt = 0;
368
- function so() {
396
+ let ke = 0;
397
+ function ro() {
369
398
  return V(() => {
370
- function e() {
371
- const t = document.fullscreenElement;
372
- if (!t) return;
373
- let n = t.querySelector(".fullscreen-portal-root");
374
- n || (n = document.createElement("div"), n.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t.appendChild(n));
399
+ function i() {
400
+ const e = document.fullscreenElement;
401
+ if (!e) return;
402
+ let t = e.querySelector(".fullscreen-portal-root");
403
+ t || (t = document.createElement("div"), t.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", e.appendChild(t));
375
404
  }
376
- return kt++, e(), document.addEventListener("fullscreenchange", e), () => {
377
- document.removeEventListener("fullscreenchange", e), kt--, kt <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t) => {
378
- t.parentNode && t.parentNode.removeChild(t);
379
- }), kt = 0);
405
+ return ke++, i(), document.addEventListener("fullscreenchange", i), () => {
406
+ document.removeEventListener("fullscreenchange", i), ke--, ke <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((e) => {
407
+ e.parentNode && e.parentNode.removeChild(e);
408
+ }), ke = 0);
380
409
  };
381
- }, []), { getPortalContainer: Mn };
410
+ }, []), { getPortalContainer: Tn };
382
411
  }
383
- const Dn = 100, Pn = 100, zn = 1e6, kn = 100, An = 50, Bn = St(Lt((e, t) => {
384
- const { offset: n = 0, viewportSize: o = 0, totalSize: i = 0, minSize: r = 0, endGap: s = Dn, endScrollIncrement: a = Pn, style: l = ze, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: p = zn, scaleFactor: w = kn, precisionFactor: b = An, ...S } = e;
412
+ const Mn = 100, Dn = 100, Pn = 1e6, zn = 100, kn = 50, An = Se(Le((i, e) => {
413
+ const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: s = Mn, endScrollIncrement: l = Dn, style: a = Pt, onMouseDown: c, onScrollOffset: h, onScroll: u, scaleLimit: d = Pn, scaleFactor: w = zn, precisionFactor: b = kn, ...x } = i;
385
414
  u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
386
- const v = T(c, [c]), $ = () => ({ offset: n, totalSize: p === 0 ? i : Math.min(i ?? 0, Math.max(r ?? 0, (n ?? 0) + (o ?? 0)) + (s ?? 0)) }), [_, y] = Q($), m = p !== 0 && _.totalSize > p ? w : 1, z = m / b, P = Math.ceil(_.totalSize / m), O = Math.ceil(_.offset / m), F = Math.ceil(o / m), g = R((D) => {
387
- }, []), [x, A] = Q(!1), d = k(null);
388
- Vt(() => {
389
- if (!x) {
390
- d.current = { propTotalSize: i, propViewportSize: o, propOffset: n };
391
- const D = $();
415
+ const S = T(c, [c]), P = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (s ?? 0)) }), [_, y] = Q(P), f = d !== 0 && _.totalSize > d ? w : 1, k = f / b, z = Math.ceil(_.totalSize / f), O = Math.ceil(_.offset / f), F = Math.ceil(n / f), g = R((D) => {
416
+ }, []), [v, B] = Q(!1), p = A(null);
417
+ Ve(() => {
418
+ if (!v) {
419
+ p.current = { propTotalSize: o, propViewportSize: n, propOffset: t };
420
+ const D = P();
392
421
  y(D);
393
422
  }
394
- }, [i, o, n, x, r, s, a]);
423
+ }, [o, n, t, v, r, s, l]);
395
424
  const C = T((D, G, W) => {
396
- const Y = d.current;
397
- d.current = null, Y && Y.propTotalSize === i && Y.propViewportSize === o && Y.propOffset === n || (Math.abs(D - O) < z && (D = O), h?.(D * m, O, F));
398
- }, [h, m, z, O, F]), f = R((D) => {
399
- document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", f), A(!1);
425
+ const Y = p.current;
426
+ p.current = null, Y && Y.propTotalSize === o && Y.propViewportSize === n && Y.propOffset === t || (Math.abs(D - O) < k && (D = O), h?.(D * f, O, F));
427
+ }, [h, f, k, O, F]), m = R((D) => {
428
+ document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", m), B(!1);
400
429
  }, []), E = R((D) => {
401
- v?.(D), A(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", f, { passive: !0 });
402
- }, [g, f]);
403
- return L(te, { ref: t, style: { ...l }, ...S, offset: O, totalSize: P, viewportSize: F, onMouseDown: E, onScrollOffset: C });
430
+ S?.(D), B(!0), document.addEventListener("mousemove", g, { passive: !0 }), document.addEventListener("mouseup", m, { passive: !0 });
431
+ }, [g, m]);
432
+ return L(et, { ref: e, style: { ...a }, ...x, offset: O, totalSize: z, viewportSize: F, onMouseDown: E, onScrollOffset: C });
404
433
  }));
405
- Bn.displayName = "VirtualScrollbar";
406
- const lo = { BottomEnd: "bottom-end", BottomStart: "bottom-start", Bottom: "bottom", LeftEnd: "left-end", LeftStart: "left-start", Left: "left", RightEnd: "right-end", RightStart: "right-start", Right: "right", TopEnd: "top-end", TopStart: "top-start", Top: "top" };
407
- function Wt(e, t) {
408
- if (typeof e == "function") return e(t);
409
- e && (e.current = t);
434
+ An.displayName = "VirtualScrollbar";
435
+ const so = { BottomEnd: "bottom-end", BottomStart: "bottom-start", Bottom: "bottom", LeftEnd: "left-end", LeftStart: "left-start", Left: "left", RightEnd: "right-end", RightStart: "right-start", Right: "right", TopEnd: "top-end", TopStart: "top-start", Top: "top" };
436
+ function We(i, e) {
437
+ if (typeof i == "function") return i(e);
438
+ i && (i.current = e);
410
439
  }
411
- var Ht = parseInt(nn.split(".")[0], 10) >= 19 ? function(e) {
412
- return (t) => {
413
- const n = [];
414
- for (const o of e) {
415
- const i = Wt(o, t), r = typeof i == "function";
416
- n.push(r ? i : () => Wt(o, null));
440
+ var He = parseInt(tn.split(".")[0], 10) >= 19 ? function(i) {
441
+ return (e) => {
442
+ const t = [];
443
+ for (const n of i) {
444
+ const o = We(n, e), r = typeof o == "function";
445
+ t.push(r ? o : () => We(n, null));
417
446
  }
418
447
  return () => {
419
- for (const o of n) o();
448
+ for (const n of t) n();
420
449
  };
421
450
  };
422
- } : function(e) {
423
- return (t) => {
424
- for (const n of e) Wt(n, t);
451
+ } : function(i) {
452
+ return (e) => {
453
+ for (const t of i) We(t, e);
425
454
  };
426
455
  };
427
- const ao = St(Lt((e, t) => {
428
- const { refFocusStart: n, ...o } = e, i = k(null), r = R(() => {
429
- if (n) return void n?.current?.focus();
430
- const s = i.current.parentElement.children;
431
- let a = [];
432
- for (let l = 0; l < s.length && s[l] !== i.current; l++) {
433
- const c = s[l].getAttribute("tabindex");
434
- if (c == null || c === "-1" || s[l].getAttribute("disabled") === "true") continue;
435
- const h = s[l];
436
- h.focus && a.push({ tabindex: parseInt(c), child: h });
456
+ const lo = Se(Le((i, e) => {
457
+ const { refFocusStart: t, ...n } = i, o = A(null), r = R(() => {
458
+ if (t) return void t?.current?.focus();
459
+ const s = o.current.parentElement.children;
460
+ let l = [];
461
+ for (let a = 0; a < s.length && s[a] !== o.current; a++) {
462
+ const c = s[a].getAttribute("tabindex");
463
+ if (c == null || c === "-1" || s[a].getAttribute("disabled") === "true") continue;
464
+ const h = s[a];
465
+ h.focus && l.push({ tabindex: parseInt(c), child: h });
437
466
  }
438
- a.length !== 0 && (a.sort(function(l, c) {
439
- return l.tabindex - c.tabindex;
440
- }), a[0].child.focus());
441
- }, [n]);
442
- return L("div", { tabIndex: 0, ref: Ht([i, t]), onFocus: r, ...o });
443
- })), co = St(Lt((e, t) => {
444
- const { className: n, style: o, children: i, radius: r = 4, strokeWidth: s = 1, strokeColor: a = "grey", ...l } = e, [c, { width: h, height: u }] = mt(), p = k(null), w = ($, _ = 0) => {
445
- const y = $ / 2, m = u - y + _;
446
- return function(z, P, O = !1) {
447
- if (P === 0) return z;
448
- function F(f, E, D) {
449
- let G = E.x - f.x, W = E.y - f.y, Y = Math.sqrt(G * G + W * W);
450
- return g(f, E, Math.min(1, D / Y));
467
+ l.length !== 0 && (l.sort(function(a, c) {
468
+ return a.tabindex - c.tabindex;
469
+ }), l[0].child.focus());
470
+ }, [t]);
471
+ return L("div", { tabIndex: 0, ref: He([o, e]), onFocus: r, ...n });
472
+ })), ao = Se(Le((i, e) => {
473
+ const { className: t, style: n, children: o, radius: r = 4, strokeWidth: s = 1, strokeColor: l = "grey", ...a } = i, [c, { width: h, height: u }] = fe(), d = A(null), w = (P, _ = 0) => {
474
+ const y = P / 2, f = u - y + _;
475
+ return function(k, z, O = !1) {
476
+ if (z === 0) return k;
477
+ function F(m, E, D) {
478
+ let G = E.x - m.x, W = E.y - m.y, Y = Math.sqrt(G * G + W * W);
479
+ return g(m, E, Math.min(1, D / Y));
451
480
  }
452
- function g(f, E, D) {
453
- return { x: f.x + (E.x - f.x) * D, y: f.y + (E.y - f.y) * D };
481
+ function g(m, E, D) {
482
+ return { x: m.x + (E.x - m.x) * D, y: m.y + (E.y - m.y) * D };
454
483
  }
455
- function x(f, E) {
456
- f.length > 2 && (f[f.length - 2] = E.x, f[f.length - 1] = E.y);
484
+ function v(m, E) {
485
+ m.length > 2 && (m[m.length - 2] = E.x, m[m.length - 1] = E.y);
457
486
  }
458
- function A(f) {
459
- return { x: parseFloat(f[f.length - 2]), y: parseFloat(f[f.length - 1]) };
487
+ function B(m) {
488
+ return { x: parseFloat(m[m.length - 2]), y: parseFloat(m[m.length - 1]) };
460
489
  }
461
- let d = z.split(/[,\s]/).reduce(function(f, E) {
490
+ let p = k.split(/[,\s]/).reduce(function(m, E) {
462
491
  let D = E.match("([a-zA-Z])(.+)");
463
- return D ? (f.push(D[1]), f.push(D[2])) : f.push(E), f;
464
- }, []).reduce(function(f, E) {
465
- return parseFloat(E) == E && f.length ? f[f.length - 1].push(E) : f.push([E]), f;
492
+ return D ? (m.push(D[1]), m.push(D[2])) : m.push(E), m;
493
+ }, []).reduce(function(m, E) {
494
+ return parseFloat(E) == E && m.length ? m[m.length - 1].push(E) : m.push([E]), m;
466
495
  }, []), C = [];
467
- if (d.length > 1) {
468
- let f = A(d[0]), E = null;
469
- d[d.length - 1][0] === "Z" && d[0].length > 2 && (E = ["L", f.x, f.y], d[d.length - 1] = E), C.push(d[0]);
470
- for (let D = 1; D < d.length; D++) {
471
- let G = C[C.length - 1], W = d[D], Y = W === E ? d[1] : d[D + 1];
496
+ if (p.length > 1) {
497
+ let m = B(p[0]), E = null;
498
+ p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L", m.x, m.y], p[p.length - 1] = E), C.push(p[0]);
499
+ for (let D = 1; D < p.length; D++) {
500
+ let G = C[C.length - 1], W = p[D], Y = W === E ? p[1] : p[D + 1];
472
501
  if (Y && G && G.length > 2 && W[0] === "L" && Y.length > 2 && Y[0] === "L") {
473
- let j, B, I = A(G), X = A(W), nt = A(Y);
474
- O ? (j = g(X, G.origPoint || I, P), B = g(X, Y.origPoint || nt, P)) : (j = F(X, I, P), B = F(X, nt, P)), x(W, j), W.origPoint = X, C.push(W);
475
- let gt = g(j, X, 0.5), yt = g(X, B, 0.5), K = ["C", gt.x, gt.y, yt.x, yt.y, B.x, B.y];
476
- K.origPoint = X, C.push(K);
502
+ let X, $, I = B(G), j = B(W), ne = B(Y);
503
+ O ? (X = g(j, G.origPoint || I, z), $ = g(j, Y.origPoint || ne, z)) : (X = F(j, I, z), $ = F(j, ne, z)), v(W, X), W.origPoint = j, C.push(W);
504
+ let ge = g(X, j, 0.5), ye = g(j, $, 0.5), K = ["C", ge.x, ge.y, ye.x, ye.y, $.x, $.y];
505
+ K.origPoint = j, C.push(K);
477
506
  } else C.push(W);
478
507
  }
479
508
  if (E) {
480
- let D = A(C[C.length - 1]);
481
- C.push(["Z"]), x(C[0], D);
509
+ let D = B(C[C.length - 1]);
510
+ C.push(["Z"]), v(C[0], D);
482
511
  }
483
- } else C = d;
484
- return C.reduce(function(f, E) {
485
- return f + E.join(" ") + " ";
512
+ } else C = p;
513
+ return C.reduce(function(m, E) {
514
+ return m + E.join(" ") + " ";
486
515
  }, "");
487
- }(`${`M 0 ${y} L ${r - 0.5} ${y} L ${r - 0.5} ${m} L ${2 * r} ${m}`} ${`L ${h - 2 * r} ${m}`} ${`M ${h - 2 * r} ${m} L ${h - r} ${m} L ${h - r} ${y} L ${h} ${y}`}`, r);
488
- }, b = N(() => w(s), [h, u, r, s]), S = N(() => {
516
+ }(`${`M 0 ${y} L ${r - 0.5} ${y} L ${r - 0.5} ${f} L ${2 * r} ${f}`} ${`L ${h - 2 * r} ${f}`} ${`M ${h - 2 * r} ${f} L ${h - r} ${f} L ${h - r} ${y} L ${h} ${y}`}`, r);
517
+ }, b = N(() => w(s), [h, u, r, s]), x = N(() => {
489
518
  if (r === 0) return;
490
- const $ = r / 2;
491
- return w(r) + `L ${h} 0 L 0 0 L 0 ${$}`;
492
- }, [b, r, s]), v = N(() => ({ style: { clipPath: `path('${S}')` } }), [S]);
493
- return bt("div", { className: n, style: { display: "flex", flexDirection: "row", ...o }, ...l, ref: Ht([p, c, t]), children: [ft.isValidElement(i) ? ft.cloneElement(i, v) : L(Mt, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: b, stroke: a, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] });
494
- })), $n = {}, On = (e) => {
495
- const { onPointerDown: t, style: n, splitDirection: o, paddingBefore: i = 0, paddingAfter: r = 0, disabled: s, key: a, hitAreaProps: l = $n, ...c } = e, h = o === "row", { style: u, className: p, ...w } = l;
496
- return L("div", { style: { ...n, position: "relative" }, ...c, children: L("div", { className: vt("hit-box", p), style: { left: (h ? -i : 0) + "px", width: `calc(100% + ${h ? i + r : 0}px)`, top: (h ? 0 : -i) + "px", height: `calc(100% + ${h ? 0 : i + r}px)`, position: "absolute", ...u }, onPointerDown: s ? void 0 : t, ...w }) }, a);
497
- }, At = {}, _t = (e, t, n = !0) => e === null ? null : e.pixels !== null ? n ? e.pixels : t - e.pixels : (n ? e.percent : 100 - e.percent) / 100 * t, Bt = (e, t = !0) => e?.percent ? `${t ? e.percent : 100 - e.percent}%` : e?.pixels ? `${e.pixels}px` : void 0, ut = (e, t) => {
498
- if (e == null) return null;
499
- const n = { percent: null, pixels: null };
500
- let o = t;
501
- return typeof e == "string" && ((e = e.trim().toLowerCase()).endsWith("px") ? (e = e.substring(0, e.length - 2), o = !1) : e.endsWith("%") && (e = e.substring(0, e.length - 1), o = !0), e = parseFloat(e)), o ? n.percent = e : n.pixels = e, Object.freeze(n);
502
- }, ho = St(Lt((e, t) => {
503
- const { elementBefore: n, elementAfter: o, splitDirection: i = "row", fixedPane: r = null, position: s, onPositionChange: a, minBefore: l, maxBefore: c, minAfter: h, maxAfter: u, children: p, className: w, style: b, disabled: S = !1, onDragStart: v, onDragResize: $, onDragFinish: _, resizerProps: y = At, paneProps: m = At, paneBeforeProps: z = At, paneAfterProps: P = At, createResizer: O = On } = e;
504
- if (p) throw new Error("Use elementBefore and elementAfter instead of children.");
505
- const F = N(() => ft.isValidElement(o) && ft.isValidElement(n), [o, n]), g = N(() => {
519
+ const P = r / 2;
520
+ return w(r) + `L ${h} 0 L 0 0 L 0 ${P}`;
521
+ }, [b, r, s]), S = N(() => ({ style: { clipPath: `path('${x}')` } }), [x]);
522
+ return be("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...a, ref: He([d, c, e]), children: [me.isValidElement(o) ? me.cloneElement(o, S) : L(Me, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: h, height: u, viewBox: `0 0 ${h} ${u}`, children: L("path", { d: b, stroke: l, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: s }) })] });
523
+ })), Bn = {}, $n = (i) => {
524
+ const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: s, key: l, hitAreaProps: a = Bn, ...c } = i, h = n === "row", { style: u, className: d, ...w } = a;
525
+ return L("div", { style: { ...t, position: "relative" }, ...c, children: L("div", { className: ve("hit-box", d), style: { left: (h ? -o : 0) + "px", width: `calc(100% + ${h ? o + r : 0}px)`, top: (h ? 0 : -o) + "px", height: `calc(100% + ${h ? 0 : o + r}px)`, position: "absolute", ...u }, onPointerDown: s ? void 0 : e, ...w }) }, l);
526
+ }, Ae = {}, _e = (i, e, t = !0) => i === null ? null : i.pixels !== null ? t ? i.pixels : e - i.pixels : (t ? i.percent : 100 - i.percent) / 100 * e, Be = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, ue = (i, e) => {
527
+ if (i == null) return null;
528
+ const t = { percent: null, pixels: null };
529
+ let n = e;
530
+ return typeof i == "string" && ((i = i.trim().toLowerCase()).endsWith("px") ? (i = i.substring(0, i.length - 2), n = !1) : i.endsWith("%") && (i = i.substring(0, i.length - 1), n = !0), i = parseFloat(i)), n ? t.percent = i : t.pixels = i, Object.freeze(t);
531
+ }, co = Se(Le((i, e) => {
532
+ const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: s, onPositionChange: l, minBefore: a, maxBefore: c, minAfter: h, maxAfter: u, children: d, className: w, style: b, disabled: x = !1, onDragStart: S, onDragResize: P, onDragFinish: _, resizerProps: y = Ae, paneProps: f = Ae, paneBeforeProps: k = Ae, paneAfterProps: z = Ae, createResizer: O = $n } = i;
533
+ if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
534
+ const F = N(() => me.isValidElement(n) && me.isValidElement(t), [n, t]), g = N(() => {
506
535
  let M = null;
507
536
  r && (r === "before" ? M = 0 : r === "after" && (M = 1));
508
537
  const H = M === null;
509
- return { fixedPaneOffset: M, isPercent: H, minBefore: ut(l, H), maxBefore: ut(c, H), minAfter: ut(h, H), maxAfter: ut(u, H) };
510
- }, [l, c, h, u]), x = T(a, [a]), [A, d] = Q(() => ut(s, r === null));
538
+ return { fixedPaneOffset: M, isPercent: H, minBefore: ue(a, H), maxBefore: ue(c, H), minAfter: ue(h, H), maxAfter: ue(u, H) };
539
+ }, [a, c, h, u]), v = T(l, [l]), [B, p] = Q(() => ue(s, r === null));
511
540
  V(() => {
512
- d(ut(s, r === null));
541
+ p(ue(s, r === null));
513
542
  }, [s, r]);
514
- const [C, { width: f, height: E }] = mt(), [D, { width: G, height: W }] = mt(), Y = i === "row" ? G : W, j = i === "row" ? f : E, B = N(() => ((M, H, q, U) => {
515
- const at = [null, null], ot = [null, null];
516
- if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (at[0] = M?.pixels, ot[1] = 100) : (at[1] = M?.pixels - q, ot[0] = 100) : M?.percent != null && (U.fixedPaneOffset !== 1 ? (ot[0] = M?.percent, ot[1] = 100 - M?.percent) : (ot[1] = M?.percent, ot[0] = 100 - M?.percent)), { percents: ot, pixels: at, minBefore: Bt(U.minBefore, !0), maxBefore: Bt(U.maxBefore, !0), minAfter: Bt(U.minAfter), maxAfter: Bt(U.maxAfter) };
517
- let ht = _t(M, H, U.fixedPaneOffset !== 1), tt = H - q, ae = _t(U.minBefore, tt, !0) ?? 0, Qe = _t(U.maxBefore, tt, !0) ?? tt, zt = 0, Ft = 0, ce = 0, he = tt;
518
- zt = (_t(U.maxAfter, H, !1) ?? q) - q, Ft = _t(U.minAfter, H, !1) ?? H, ce = Math.max(ae, zt), he = Math.min(Qe, Ft), ht = Math.max(ce, Math.min(ht, he)), Ft = Math.min(tt - ht, _t(U.maxAfter, tt - ht, !0) ?? tt), zt = Math.min(tt - ht, _t(U.minAfter, tt - ht, !0) ?? tt), at[0] = ht, at[1] = tt - at[0];
519
- const tn = Math.max(0, Math.min(100, ht / tt * 100));
520
- return ot[0] = tn, ot[1] = 100 - ot[0], { percents: ot, pixels: at, minBefore: `${ae}px`, minAfter: `${zt}px`, maxBefore: `${at[0]}px`, maxAfter: `${at[1]}px` };
521
- })(A, j, Y, g), [g, A, j, Y, i]), [I, X] = Q(!1), nt = T(v, [v]), gt = T($, [$]), yt = T(_, [_]), K = k(null), st = k(null), it = k(null), { style: pt, className: lt, ...ct } = m, Ct = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pt }, { className: Re, style: Ve, ...Fe } = z, { className: Ie, style: Ne, ...We } = P, Ye = { flex: "1 1 100%", width: "100%", ...b, flexDirection: i, display: "flex" }, { className: ne, style: oe, onPointerDown: ie, ...re } = y, je = T((M) => {
522
- const H = ut(M, r === null);
523
- d(H);
524
- }, [r]), Dt = T((M) => {
525
- if (S || !I) return;
526
- const H = le.current?.getBoundingClientRect();
543
+ const [C, { width: m, height: E }] = fe(), [D, { width: G, height: W }] = fe(), Y = o === "row" ? G : W, X = o === "row" ? m : E, $ = N(() => ((M, H, q, U) => {
544
+ const ae = [null, null], oe = [null, null];
545
+ if (M || (M = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), H === 0) return M?.pixels != null ? U.fixedPaneOffset !== 1 ? (ae[0] = M?.pixels, oe[1] = 100) : (ae[1] = M?.pixels - q, oe[0] = 100) : M?.percent != null && (U.fixedPaneOffset !== 1 ? (oe[0] = M?.percent, oe[1] = 100 - M?.percent) : (oe[1] = M?.percent, oe[0] = 100 - M?.percent)), { percents: oe, pixels: ae, minBefore: Be(U.minBefore, !0), maxBefore: Be(U.maxBefore, !0), minAfter: Be(U.minAfter), maxAfter: Be(U.maxAfter) };
546
+ let he = _e(M, H, U.fixedPaneOffset !== 1), ee = H - q, at = _e(U.minBefore, ee, !0) ?? 0, Jt = _e(U.maxBefore, ee, !0) ?? ee, ze = 0, Fe = 0, ct = 0, ht = ee;
547
+ ze = (_e(U.maxAfter, H, !1) ?? q) - q, Fe = _e(U.minAfter, H, !1) ?? H, ct = Math.max(at, ze), ht = Math.min(Jt, Fe), he = Math.max(ct, Math.min(he, ht)), Fe = Math.min(ee - he, _e(U.maxAfter, ee - he, !0) ?? ee), ze = Math.min(ee - he, _e(U.minAfter, ee - he, !0) ?? ee), ae[0] = he, ae[1] = ee - ae[0];
548
+ const Qt = Math.max(0, Math.min(100, he / ee * 100));
549
+ return oe[0] = Qt, oe[1] = 100 - oe[0], { percents: oe, pixels: ae, minBefore: `${at}px`, minAfter: `${ze}px`, maxBefore: `${ae[0]}px`, maxAfter: `${ae[1]}px` };
550
+ })(B, X, Y, g), [g, B, X, Y, o]), [I, j] = Q(!1), ne = T(S, [S]), ge = T(P, [P]), ye = T(_, [_]), K = A(null), se = A(null), ie = A(null), { style: pe, className: le, ...ce } = f, Ce = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: Ht, style: Rt, ...Vt } = k, { className: Ft, style: It, ...Nt } = z, Wt = { flex: "1 1 100%", width: "100%", ...b, flexDirection: o, display: "flex" }, { className: nt, style: ot, onPointerDown: it, ...rt } = y, Yt = T((M) => {
551
+ const H = ue(M, r === null);
552
+ p(H);
553
+ }, [r]), De = T((M) => {
554
+ if (x || !I) return;
555
+ const H = lt.current?.getBoundingClientRect();
527
556
  let q = 0;
528
- q = i === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, q = Math.max(0, Math.min(j, q)), g.fixedPaneOffset === 1 && (q = j - q), s && A.pixels === q || d({ pixels: q, percent: null }), gt?.(q), M.stopPropagation(), M.preventDefault();
529
- }, [g, i, S, I, A, j]), se = T((M) => {
530
- if (document.removeEventListener("pointermove", Dt), document.removeEventListener("touchmove", Dt), document.removeEventListener("pointerup", se), !!I && (X(!1), !!A)) {
531
- if (yt(A.pixels), !ut(s, r === null) || A.pixels !== s) {
532
- const H = { ...A };
533
- H.percent === null && (H.percent = H.pixels / j * 100), x(H);
557
+ q = o === "row" ? (M.clientX ?? M.touches?.[0]?.clientX) - H.x : (M.clientY ?? M.touches?.[0]?.clientY) - H.y, q = Math.max(0, Math.min(X, q)), g.fixedPaneOffset === 1 && (q = X - q), s && B.pixels === q || p({ pixels: q, percent: null }), ge?.(q), M.stopPropagation(), M.preventDefault();
558
+ }, [g, o, x, I, B, X]), st = T((M) => {
559
+ if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", st), !!I && (j(!1), !!B)) {
560
+ if (ye(B.pixels), !ue(s, r === null) || B.pixels !== s) {
561
+ const H = { ...B };
562
+ H.percent === null && (H.percent = H.pixels / X * 100), v(H);
534
563
  }
535
564
  M.stopPropagation(), M.preventDefault();
536
565
  }
537
- }, [A, I, s, r, j]), Xe = T((M) => {
538
- ie?.(M), M.defaultPrevented || S || I || (X(!0), nt(), document.addEventListener("pointermove", Dt, { passive: !1 }), document.addEventListener("touchmove", Dt, { passive: !1 }), document.addEventListener("pointerup", se, { passive: !1 }));
539
- }, [ie]), le = Ae(t, () => ({ setPosition: je, isSplitPane: () => !0 }), []), Ue = N(() => F ? O?.({ key: "resizer", ref: Ht([D, st]), className: vt("resizer", ne), onPointerDownCapture: Xe, style: { cursor: S ? void 0 : i === "row" ? "ew-resize" : "ns-resize", minWidth: i === "row" ? "2px" : void 0, minHeight: i !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...oe }, splitDirection: i, disabled: S, ...re }) : null, [F, ne, re, i, oe, S]), Pt = i === "row" ? "Width" : "Height", Ze = { ...Ct, ...Ve, flex: g.fixedPaneOffset === 0 && B?.pixels[0] !== null ? `0 0 ${Math.round(B?.pixels[0])}px` : `1 1 ${Math.round(B?.percents[0] ?? 100)}%`, [`min${Pt}`]: B?.minBefore, [`max${Pt}`]: o ? B?.maxBefore : "100%" }, Ge = { ...Ct, ...Ne, flex: g.fixedPaneOffset === 1 && B?.pixels[1] !== null ? `0 0 ${Math.round(B?.pixels[1])}px` : `1 1 ${Math.round(B?.percents[1] ?? 100)}%`, [`min${Pt}`]: B?.minAfter, [`max${Pt}`]: n ? B?.maxAfter : "100%" }, qe = N(() => n ? L("div", { ref: K, className: vt("before", lt, Re), style: Ze, ...ct, ...Fe, children: n }, "before") : null, [n, m, z, g, B]), Je = N(() => o ? L("div", { ref: it, className: vt("after", lt, Ie), style: Ge, ...ct, ...We, children: o }, "after") : null, [o, m, P, g, B]);
540
- return bt("div", { ref: Ht([C, le]), className: vt("splitPane", i === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Ye, children: [qe, Ue, Je] });
566
+ }, [B, I, s, r, X]), Xt = T((M) => {
567
+ it?.(M), M.defaultPrevented || x || I || (j(!0), ne(), document.addEventListener("pointermove", De, { passive: !1 }), document.addEventListener("touchmove", De, { passive: !1 }), document.addEventListener("pointerup", st, { passive: !1 }));
568
+ }, [it]), lt = kt(e, () => ({ setPosition: Yt, isSplitPane: () => !0 }), []), jt = N(() => F ? O?.({ key: "resizer", ref: He([D, se]), className: ve("resizer", nt), onPointerDownCapture: Xt, style: { cursor: x ? void 0 : o === "row" ? "ew-resize" : "ns-resize", minWidth: o === "row" ? "2px" : void 0, minHeight: o !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...ot }, splitDirection: o, disabled: x, ...rt }) : null, [F, nt, rt, o, ot, x]), Pe = o === "row" ? "Width" : "Height", Ut = { ...Ce, ...Rt, flex: g.fixedPaneOffset === 0 && $?.pixels[0] !== null ? `0 0 ${Math.round($?.pixels[0])}px` : `1 1 ${Math.round($?.percents[0] ?? 100)}%`, [`min${Pe}`]: $?.minBefore, [`max${Pe}`]: n ? $?.maxBefore : "100%" }, Zt = { ...Ce, ...It, flex: g.fixedPaneOffset === 1 && $?.pixels[1] !== null ? `0 0 ${Math.round($?.pixels[1])}px` : `1 1 ${Math.round($?.percents[1] ?? 100)}%`, [`min${Pe}`]: $?.minAfter, [`max${Pe}`]: t ? $?.maxAfter : "100%" }, Gt = N(() => t ? L("div", { ref: K, className: ve("before", le, Ht), style: Ut, ...ce, ...Vt, children: t }, "before") : null, [t, f, k, g, $]), qt = N(() => n ? L("div", { ref: ie, className: ve("after", le, Ft), style: Zt, ...ce, ...Nt, children: n }, "after") : null, [n, f, z, g, $]);
569
+ return be("div", { ref: He([C, lt]), className: ve("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: I }, w), style: Wt, children: [Gt, jt, qt] });
541
570
  }));
542
- function uo(e) {
543
- const [t, n] = Q(typeof window < "u" ? window.devicePixelRatio : 1), o = k(null);
571
+ function ho(i) {
572
+ const [e, t] = Q(typeof window < "u" ? window.devicePixelRatio : 1), n = A(null);
544
573
  return V(() => {
545
574
  if (!(typeof window < "u" && "matchMedia" in window)) return;
546
- const i = () => {
575
+ const o = () => {
547
576
  const r = window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);
548
- r.addEventListener("change", i, { once: !0, passive: !0 }), n(window.devicePixelRatio), o.current = { mediaMatcher: r, listener: i };
577
+ r.addEventListener("change", o, { once: !0, passive: !0 }), t(window.devicePixelRatio), n.current = { mediaMatcher: r, listener: o };
549
578
  };
550
- return i(), () => {
551
- o.current && o.current.mediaMatcher.removeEventListener("change", o.current.listener);
579
+ return o(), () => {
580
+ n.current && n.current.mediaMatcher.removeEventListener("change", n.current.listener);
552
581
  };
553
- }, [e]), t;
582
+ }, [i]), e;
554
583
  }
555
- function po(e) {
584
+ function uo(i) {
556
585
  if (typeof window > "u") return 1;
557
- const { defaultDpr: t = 1, maxDpr: n = 3, round: o = !0 } = e || {}, i = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : t;
558
- return Math.min(Math.max(1, o ? Math.floor(i) : i), n);
586
+ const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
587
+ return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
559
588
  }
560
- function _o(e, t, n) {
561
- const o = T(t, [t]);
589
+ function po(i, e, t) {
590
+ const n = T(e, [e]);
562
591
  V(() => {
563
- const i = (r) => {
564
- e.current && !e.current.contains(r.target) && o(r);
592
+ const o = (r) => {
593
+ i.current && !i.current.contains(r.target) && n(r);
565
594
  };
566
- return n && n.mouseEvents === !1 || (document.addEventListener("mousedown", i), document.addEventListener("touchstart", i)), n && n.focusEvents === !1 || document.addEventListener("focus", i), () => {
567
- document.removeEventListener("mousedown", i), document.removeEventListener("touchstart", i), document.removeEventListener("focus", i);
595
+ return t && t.mouseEvents === !1 || (document.addEventListener("mousedown", o), document.addEventListener("touchstart", o)), t && t.focusEvents === !1 || document.addEventListener("focus", o), () => {
596
+ document.removeEventListener("mousedown", o), document.removeEventListener("touchstart", o), document.removeEventListener("focus", o);
568
597
  };
569
- }, [e]);
598
+ }, [i]);
570
599
  }
571
- function Kn(e) {
572
- if (!e) throw new Error("must have a PointerHandlerOptions");
573
- const { onPointerDown: t, onPointerUp: n, onPointerMoveOrWait: o, processTouch: i = !1, consumeTouch: r = !0 } = e, s = T(t, [t]), a = T(n, [n]), l = T(o, [o]), c = k(!1), h = e?.timerInitial ?? 230, u = e?.timerContinuous ?? h / 2, p = k(null), w = k(null), b = k(null), S = k(null), v = R(() => {
574
- S.current && (clearTimeout(S.current), S.current = null);
575
- }, []), $ = R((x) => {
576
- S.current = setTimeout(() => {
600
+ function On(i) {
601
+ if (!i) throw new Error("must have a PointerHandlerOptions");
602
+ const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, s = T(e, [e]), l = T(t, [t]), a = T(n, [n]), c = A(!1), h = i?.timerInitial ?? 230, u = i?.timerContinuous ?? h / 2, d = A(null), w = A(null), b = A(null), x = A(null), S = R(() => {
603
+ x.current && (clearTimeout(x.current), x.current = null);
604
+ }, []), P = R((v) => {
605
+ x.current = setTimeout(() => {
577
606
  window.requestAnimationFrame(() => {
578
- c.current !== !1 && l?.(w.current, b.current, p.current);
579
- }), $(u);
580
- }, x ?? h);
607
+ c.current !== !1 && a?.(w.current, b.current, d.current);
608
+ }), P(u);
609
+ }, v ?? h);
581
610
  }, []);
582
- V(() => () => v(), []);
583
- const _ = i ? "pointer" : "mouse", y = R((x) => {
584
- x.stopPropagation(), x.stopImmediatePropagation(), x.preventDefault();
585
- }, []), m = T((x) => {
586
- document.removeEventListener(`${_}move`, O), document.removeEventListener(`${_}up`, m), document.removeEventListener("keydown", F), document.removeEventListener("keyup", g), document.removeEventListener("touchstart", y, { capture: !0 }), document.removeEventListener("touchmove", y, { capture: !0 }), window.removeEventListener("blur", z), v(), window.requestAnimationFrame(() => {
587
- c.current !== !1 && (c.current = !1, a?.(x, b.current, p.current), b.current = null);
611
+ V(() => () => S(), []);
612
+ const _ = o ? "pointer" : "mouse", y = R((v) => {
613
+ v.stopPropagation(), v.stopImmediatePropagation(), v.preventDefault();
614
+ }, []), f = T((v) => {
615
+ document.removeEventListener(`${_}move`, O), document.removeEventListener(`${_}up`, f), document.removeEventListener("keydown", F), document.removeEventListener("keyup", g), document.removeEventListener("touchstart", y, { capture: !0 }), document.removeEventListener("touchmove", y, { capture: !0 }), window.removeEventListener("blur", k), S(), window.requestAnimationFrame(() => {
616
+ c.current !== !1 && (c.current = !1, l?.(v, b.current, d.current), b.current = null);
588
617
  });
589
- }, []), z = R(() => {
590
- c.current !== !1 && (c.current = !1, m(w.current));
591
- }, []), P = T(() => {
592
- v(), $(u), window.requestAnimationFrame(() => {
593
- c.current !== !1 && l?.(w.current, b.current, p.current);
618
+ }, []), k = R(() => {
619
+ c.current !== !1 && (c.current = !1, f(w.current));
620
+ }, []), z = T(() => {
621
+ S(), P(u), window.requestAnimationFrame(() => {
622
+ c.current !== !1 && a?.(w.current, b.current, d.current);
594
623
  });
595
- }, [u]), O = T((x) => {
596
- w.current = x, P();
597
- }, []), F = T((x) => {
598
- b.current = { ctrlKey: x.ctrlKey, shiftKey: x.shiftKey, altKey: x.altKey, metaKey: x.metaKey }, P();
599
- }, []), g = T((x) => {
600
- b.current = { ctrlKey: x.ctrlKey, shiftKey: x.shiftKey, altKey: x.altKey, metaKey: x.metaKey }, P();
624
+ }, [u]), O = T((v) => {
625
+ w.current = v, z();
626
+ }, []), F = T((v) => {
627
+ b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
628
+ }, []), g = T((v) => {
629
+ b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, z();
601
630
  }, [u]);
602
- return T((x) => {
603
- x.isDefaultPrevented() || (b.current = { ctrlKey: x.ctrlKey, shiftKey: x.shiftKey, altKey: x.altKey, metaKey: x.metaKey }, s(x, b.current) !== !1 && (p.current = x, w.current = x.nativeEvent, document.addEventListener(`${_}up`, m, { passive: !1 }), document.addEventListener(`${_}move`, O, { passive: !1 }), document.addEventListener("keydown", F, { passive: !1 }), document.addEventListener("keyup", g, { passive: !1 }), window.addEventListener("blur", z, { passive: !0 }), i && r && (document.addEventListener("touchstart", y, { passive: !1, capture: !0 }), document.addEventListener("touchmove", y, { passive: !1, capture: !0 })), c.current = !0, $(h)));
604
- }, [h, i]);
631
+ return T((v) => {
632
+ v.isDefaultPrevented() || (b.current = { ctrlKey: v.ctrlKey, shiftKey: v.shiftKey, altKey: v.altKey, metaKey: v.metaKey }, s(v, b.current) !== !1 && (d.current = v, w.current = v.nativeEvent, document.addEventListener(`${_}up`, f, { passive: !1 }), document.addEventListener(`${_}move`, O, { passive: !1 }), document.addEventListener("keydown", F, { passive: !1 }), document.addEventListener("keyup", g, { passive: !1 }), window.addEventListener("blur", k, { passive: !0 }), o && r && (document.addEventListener("touchstart", y, { passive: !1, capture: !0 }), document.addEventListener("touchmove", y, { passive: !1, capture: !0 })), c.current = !0, P(h)));
633
+ }, [h, o]);
605
634
  }
606
- function fo(e, t) {
607
- return Kn({ onPointerDown: e, onPointerMoveOrWait: (n, o, i) => {
608
- e?.(i);
609
- }, ...t });
635
+ function _o(i, e) {
636
+ return On({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
637
+ i?.(o);
638
+ }, ...e });
610
639
  }
611
- const Hn = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
612
- const o = k(e);
613
- if (typeof t != "function") throw new Error("function expected as hook body parameter. got " + typeof t);
614
- const i = t();
615
- return Vt(() => {
616
- o.current !== i && (o.current = i, n(i));
617
- }, [n, i]), null;
618
- }, qt = (e) => {
619
- console && console.warn && console.warn(e);
620
- }, Yt = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
621
- let Rn = 1, Jt = !1, $e = !1;
622
- const Ot = [], xt = [], Rt = () => {
623
- xt.forEach((e) => e());
624
- }, Vn = ({ automaticContainerInternalUseOnly: e }) => {
625
- const [t, n] = Q([]), o = k([]);
626
- return o.current = t, e || Jt !== !1 || ($e = !0), V(() => {
627
- let i = !0;
640
+ const Kn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
641
+ const n = A(i);
642
+ if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
643
+ const o = e();
644
+ return Ve(() => {
645
+ n.current !== o && (n.current = o, t(o));
646
+ }, [t, o]), null;
647
+ }, qe = (i) => {
648
+ console && console.warn && console.warn(i);
649
+ }, Ye = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
650
+ let Hn = 1, Je = !1, Bt = !1;
651
+ const Oe = [], xe = [], Re = () => {
652
+ xe.forEach((i) => i());
653
+ }, Rn = ({ automaticContainerInternalUseOnly: i }) => {
654
+ const [e, t] = Q([]), n = A([]);
655
+ return n.current = e, i || Je !== !1 || (Bt = !0), V(() => {
656
+ let o = !0;
628
657
  function r() {
629
- if (i) return xt[0] !== r ? (e || Jt !== !0 || qt("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((s) => [])) : void n([...Ot]);
658
+ if (o) return xe[0] !== r ? (i || Je !== !0 || qe("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void t((s) => [])) : void t([...Oe]);
630
659
  }
631
- return xt.push(r), Rt(), () => {
632
- i = !1, o.current?.length > 0 && qt("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), xt.splice(xt.indexOf(r), 1), Rt();
660
+ return xe.push(r), Re(), () => {
661
+ o = !1, n.current?.length > 0 && qe("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), xe.splice(xe.indexOf(r), 1), Re();
633
662
  };
634
- }, [e]), L(Mt, { children: t.map(({ hook: i, key: r }) => on(Hn, { ...i, key: r })) });
635
- }, Fn = (e) => {
636
- const t = Rn++;
637
- return Ot.push({ hook: e, key: t }), xt.length === 0 && $e === !1 && (Jt = !0, ((n) => {
638
- if (Yt.document && Yt.document.createElement) {
639
- const o = Yt.document.createElement("div");
640
- sn(o).render(L(n, { automaticContainerInternalUseOnly: !0 }));
641
- } else qt("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
642
- })(Vn)), Rt(), () => {
643
- Ot.splice(Ot.findIndex((n) => n.key === t), 1), Rt();
663
+ }, [i]), L(Me, { children: e.map(({ hook: o, key: r }) => nn(Kn, { ...o, key: r })) });
664
+ }, Vn = (i) => {
665
+ const e = Hn++;
666
+ return Oe.push({ hook: i, key: e }), xe.length === 0 && Bt === !1 && (Je = !0, ((t) => {
667
+ if (Ye.document && Ye.document.createElement) {
668
+ const n = Ye.document.createElement("div");
669
+ rn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
670
+ } else qe("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
671
+ })(Rn)), Re(), () => {
672
+ Oe.splice(Oe.findIndex((t) => t.key === e), 1), Re();
644
673
  };
645
- }, Oe = (e, t, n = {}) => {
646
- let o, i, r = !1, s = !1, a = [], { unmountIfNoConsumers: l = !1 } = n;
674
+ }, $t = (i, e, t = {}) => {
675
+ let n, o, r = !1, s = !1, l = [], { unmountIfNoConsumers: a = !1 } = t;
647
676
  const c = (u) => {
648
- i = u, ln(() => a.forEach((p) => p(u)));
649
- }, h = () => (s || (i = typeof e == "function" ? e() : e, s = !0), i);
677
+ o = u, sn(() => l.forEach((d) => d(u)));
678
+ }, h = () => (s || (o = typeof i == "function" ? i() : i, s = !0), o);
650
679
  return () => {
651
- const [u, p] = Q(h);
652
- return V(() => (r || (r = !0, o = Fn({ initValue: e, useHookBody: t, applyStateChange: c })), a.push(p), i !== u && p(i), () => {
653
- a.splice(a.indexOf(p), 1), a.length === 0 && l && (o(), r = !1);
680
+ const [u, d] = Q(h);
681
+ return V(() => (r || (r = !0, n = Vn({ initValue: i, useHookBody: e, applyStateChange: c })), l.push(d), o !== u && d(o), () => {
682
+ l.splice(l.indexOf(d), 1), l.length === 0 && a && (n(), r = !1);
654
683
  }), []), u;
655
684
  };
656
685
  };
657
- let Ke = () => {
686
+ let Ot = () => {
658
687
  console.warn("You must call useEditMode before setting its state.");
659
688
  };
660
- const In = Oe(null, () => {
661
- const [e, t] = Q(null);
662
- return Ke = t, e;
689
+ const Fn = $t(null, () => {
690
+ const [i, e] = Q(null);
691
+ return Ot = e, i;
663
692
  }), mo = () => {
664
- const e = In();
665
- return N(() => ({ setMode: (t) => {
666
- Ke((n) => (typeof t == "function" && (t = t(n)), t?.onModeChange?.(t ?? null), t));
667
- }, getMode: () => e }), [e]);
693
+ const i = Fn();
694
+ return N(() => ({ setMode: (e) => {
695
+ Ot((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
696
+ }, getMode: () => i }), [i]);
668
697
  };
669
- class Qt {
670
- constructor(t, n, o, i) {
671
- this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = t, this._target = n, this._applyProps(o || {}), this._callback = i, i === void 0 && (this._callback = () => {
698
+ class Qe {
699
+ constructor(e, t, n, o) {
700
+ this._listenersProperties = /* @__PURE__ */ new Set(), this._listenersExecute = /* @__PURE__ */ new Set(), this._key = e, this._target = t, this._applyProps(n || {}), this._callback = o, o === void 0 && (this._callback = () => {
672
701
  console.log(`implement: ${this.label()} : ${this.description()}`);
673
702
  });
674
703
  }
675
704
  key() {
676
705
  return this._key;
677
706
  }
678
- _resolve(t, n) {
679
- if (typeof t == "function") {
680
- const o = n ?? this._context;
681
- return t(typeof o == "function" ? o() : o);
707
+ _resolve(e, t) {
708
+ if (typeof e == "function") {
709
+ const n = t ?? this._context;
710
+ return e(typeof n == "function" ? n() : n);
682
711
  }
683
- return t;
712
+ return e;
684
713
  }
685
714
  target() {
686
715
  return typeof this._target == "function" ? this._target() : this._target;
687
716
  }
688
- label(t, n) {
689
- const o = this._scopedLabels?.[t] || this._label;
690
- let i = null;
691
- if (typeof o == "function") {
692
- const r = n ?? this._context;
693
- i = o(typeof r == "function" ? r() : r);
694
- } else i = o;
695
- return i;
717
+ label(e, t) {
718
+ const n = this._scopedLabels?.[e] || this._label;
719
+ let o = null;
720
+ if (typeof n == "function") {
721
+ const r = t ?? this._context;
722
+ o = n(typeof r == "function" ? r() : r);
723
+ } else o = n;
724
+ return o;
696
725
  }
697
- description(t) {
698
- return this._resolve(this._description, t);
726
+ description(e) {
727
+ return this._resolve(this._description, e);
699
728
  }
700
- tags(t) {
701
- return this._resolve(this._tags, t);
729
+ tags(e) {
730
+ return this._resolve(this._tags, e);
702
731
  }
703
- icon(t) {
704
- return this._resolve(this._icon, t);
732
+ icon(e) {
733
+ return this._resolve(this._icon, e);
705
734
  }
706
735
  shortcut() {
707
736
  return this._resolve(this._shortcut);
@@ -715,176 +744,176 @@ class Qt {
715
744
  context() {
716
745
  return typeof this._context == "function" ? this._context() : this._context;
717
746
  }
718
- async execute(t, n) {
747
+ async execute(e, t) {
719
748
  if (!this.disabled() && this._callback) {
720
749
  try {
721
- let o = !0;
722
- if (n?.beforeExecute && (o = n?.beforeExecute(this, t)), await Promise.resolve(o) === !1) return !1;
723
- const i = this._callback.bind(this)(t, this);
724
- if (await Promise.resolve(i) === !1) return !1;
725
- n?.onExecute?.(this, t), this._notifyExecute(t);
726
- } catch (o) {
727
- return console.warn(o), n?.onError(this, o, t), this._notifyError(t, o), !1;
750
+ let n = !0;
751
+ if (t?.beforeExecute && (n = t?.beforeExecute(this, e)), await Promise.resolve(n) === !1) return !1;
752
+ const o = this._callback.bind(this)(e, this);
753
+ if (await Promise.resolve(o) === !1) return !1;
754
+ t?.onExecute?.(this, e), this._notifyExecute(e);
755
+ } catch (n) {
756
+ return console.warn(n), t?.onError(this, n, e), this._notifyError(e, n), !1;
728
757
  }
729
758
  return !0;
730
759
  }
731
760
  }
732
- addPropertyListener(t, n = !1) {
733
- if (!t) throw new Error("listener must be specified");
734
- const o = this._listenersProperties;
735
- return o.add(t), n && t({}, this), () => {
736
- o.delete(t);
761
+ addPropertyListener(e, t = !1) {
762
+ if (!e) throw new Error("listener must be specified");
763
+ const n = this._listenersProperties;
764
+ return n.add(e), t && e({}, this), () => {
765
+ n.delete(e);
737
766
  };
738
767
  }
739
- addExecuteListener(t) {
740
- if (!t) throw new Error("listener must be specified");
741
- const n = this._listenersExecute;
742
- return n.add(t), function() {
743
- n.delete(t);
768
+ addExecuteListener(e) {
769
+ if (!e) throw new Error("listener must be specified");
770
+ const t = this._listenersExecute;
771
+ return t.add(e), function() {
772
+ t.delete(e);
744
773
  };
745
774
  }
746
- _notifyExecute(t) {
747
- const n = this;
748
- this._listenersExecute.forEach((o) => {
749
- o.onExecute(n, t);
775
+ _notifyExecute(e) {
776
+ const t = this;
777
+ this._listenersExecute.forEach((n) => {
778
+ n.onExecute(t, e);
750
779
  });
751
780
  }
752
- _notifyError(t, n) {
753
- const o = this;
754
- this._listenersExecute.forEach((i) => {
755
- i.onError?.(o, t, n);
781
+ _notifyError(e, t) {
782
+ const n = this;
783
+ this._listenersExecute.forEach((o) => {
784
+ o.onError?.(n, e, t);
756
785
  });
757
786
  }
758
- updateCallback(t) {
759
- return this._callback = t || null, this;
787
+ updateCallback(e) {
788
+ return this._callback = e || null, this;
760
789
  }
761
- update(t) {
762
- if (!t) return;
763
- const n = this._applyProps(t);
764
- return Object.keys(n).length > 0 && this._notifyPropertyChange(n), this;
790
+ update(e) {
791
+ if (!e) return;
792
+ const t = this._applyProps(e);
793
+ return Object.keys(t).length > 0 && this._notifyPropertyChange(t), this;
765
794
  }
766
- _notifyPropertyChange(t) {
767
- const n = this;
768
- this._listenersProperties.forEach((o) => {
769
- o(t, n);
795
+ _notifyPropertyChange(e) {
796
+ const t = this;
797
+ this._listenersProperties.forEach((n) => {
798
+ n(e, t);
770
799
  });
771
800
  }
772
- _applyProps(t) {
773
- let n = {}, o = this;
774
- return Object.keys(t).forEach((i) => {
775
- let r = t[i];
776
- o["_" + i] !== r && (o["_" + i] = n[i] = r);
777
- }), n;
801
+ _applyProps(e) {
802
+ let t = {}, n = this;
803
+ return Object.keys(e).forEach((o) => {
804
+ let r = e[o];
805
+ n["_" + o] !== r && (n["_" + o] = t[o] = r);
806
+ }), t;
778
807
  }
779
808
  }
780
- class jt extends Qt {
809
+ class Xe extends Qe {
781
810
  }
782
- class He {
783
- constructor(t, n) {
784
- this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = et.uuidV4(), this._target = t, this._groupKey = n ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(n, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
785
- const o = this;
786
- this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (i, r) => {
787
- const s = o._root._listenersByKey, a = r.key(), l = s.get(a);
788
- l && o._notifyCommands(l, "onCommandChange", r);
811
+ class Kt {
812
+ constructor(e, t) {
813
+ this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = te.uuidV4(), this._target = e, this._groupKey = t ?? null, this._root = this, this._nodes = /* @__PURE__ */ new Map(), this._nodes.set(t, this), this._children = /* @__PURE__ */ new Map(), this._listeners = /* @__PURE__ */ new Set(), this._commandsByKey = /* @__PURE__ */ new Map(), this._commandsByShortcut = /* @__PURE__ */ new Map();
814
+ const n = this;
815
+ this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (o, r) => {
816
+ const s = n._root._listenersByKey, l = r.key(), a = s.get(l);
817
+ a && n._notifyCommands(a, "onCommandChange", r);
789
818
  };
790
819
  }
791
- _getCommand(t) {
792
- return this._commandsByKey.get(t) || (this._parent?._getCommand(t) ?? null);
820
+ _getCommand(e) {
821
+ return this._commandsByKey.get(e) || (this._parent?._getCommand(e) ?? null);
793
822
  }
794
- getCommand(t, n = !1) {
795
- const o = this._root._focused;
796
- let i = o, r = o === this;
797
- for (; !r && i; ) i === this && (r = !0), i = i._parent;
798
- return (r ? o : this)._getCommand(t);
823
+ getCommand(e, t = !1) {
824
+ const n = this._root._focused;
825
+ let o = n, r = n === this;
826
+ for (; !r && o; ) o === this && (r = !0), o = o._parent;
827
+ return (r ? n : this)._getCommand(e);
799
828
  }
800
- createChildGroup(t, n, o) {
801
- let i;
802
- if (!o) {
803
- let a = this;
804
- for (; a && !i; ) {
805
- let l = a._nodes.get(n);
806
- l && (i = l), a = a._parent;
829
+ createChildGroup(e, t, n) {
830
+ let o;
831
+ if (!n) {
832
+ let l = this;
833
+ for (; l && !o; ) {
834
+ let a = l._nodes.get(t);
835
+ a && (o = a), l = l._parent;
807
836
  }
808
837
  }
809
- i || (i = new He(t, n), i._parent = this, i._root = this._root, i._unListenersByCommand = null, i._listenersByKey = null, i._commandsPropertyListener = null);
810
- const r = (a, l) => {
811
- !a.has(n) || o ? a.set(n, l) : o === void 0 && console.warn("commandGroup already registered", n);
838
+ o || (o = new Kt(e, t), o._parent = this, o._root = this._root, o._unListenersByCommand = null, o._listenersByKey = null, o._commandsPropertyListener = null);
839
+ const r = (l, a) => {
840
+ !l.has(t) || n ? l.set(t, a) : n === void 0 && console.warn("commandGroup already registered", t);
812
841
  };
813
- r(this._root._nodes, i);
842
+ r(this._root._nodes, o);
814
843
  let s = this._parent;
815
- for (; s; ) r(this._nodes, i), s = s._parent;
816
- return this._children.set(n, i), this._notify("onGroupChange"), i;
844
+ for (; s; ) r(this._nodes, o), s = s._parent;
845
+ return this._children.set(t, o), this._notify("onGroupChange"), o;
817
846
  }
818
847
  getKey() {
819
848
  return this._groupKey;
820
849
  }
821
- getGroup(t) {
822
- return this._nodes.get(t);
850
+ getGroup(e) {
851
+ return this._nodes.get(e);
823
852
  }
824
- _addCommands(t, n = void 0) {
825
- const o = this._commandsByKey, i = this._commandsByShortcut, r = this._root._commandsPropertyListener, s = this._root._unListenersByCommand;
826
- for (let a = 0; a < t.length; a++) {
827
- const l = t[a], c = l.key();
828
- if (o.has(c) && !n) {
829
- n === void 0 && console.warn("command already registered", c);
853
+ _addCommands(e, t = void 0) {
854
+ const n = this._commandsByKey, o = this._commandsByShortcut, r = this._root._commandsPropertyListener, s = this._root._unListenersByCommand;
855
+ for (let l = 0; l < e.length; l++) {
856
+ const a = e[l], c = a.key();
857
+ if (n.has(c) && !t) {
858
+ t === void 0 && console.warn("command already registered", c);
830
859
  continue;
831
860
  }
832
- o.set(c, l);
833
- let h = s.get(l);
834
- h && (h(), s.delete(l));
835
- const u = l.addPropertyListener(r);
836
- s.set(l, u);
837
- const p = l.shortcut();
838
- if (!p) continue;
839
- const w = Array.isArray(p) ? p : [p];
861
+ n.set(c, a);
862
+ let h = s.get(a);
863
+ h && (h(), s.delete(a));
864
+ const u = a.addPropertyListener(r);
865
+ s.set(a, u);
866
+ const d = a.shortcut();
867
+ if (!d) continue;
868
+ const w = Array.isArray(d) ? d : [d];
840
869
  for (let b = 0; b < w.length; b++) {
841
- const S = Tt(w[b]), v = i.get(S);
842
- v && !n && n === void 0 && console.warn(`Shortcut already registered: ${S}, ${c}, ${v}.`), i.set(S, c);
870
+ const x = Te(w[b]), S = o.get(x);
871
+ S && !t && t === void 0 && console.warn(`Shortcut already registered: ${x}, ${c}, ${S}.`), o.set(x, c);
843
872
  }
844
873
  }
845
874
  }
846
875
  removeFromParent() {
847
876
  if (!this._parent) return;
848
- let t = this._parent, n = [];
849
- const o = this._groupKey;
850
- for (; t; ) n.push(t._nodes), t._nodes.delete(o), t = t._parent;
851
- t = this._parent;
852
- const i = (r) => {
877
+ let e = this._parent, t = [];
878
+ const n = this._groupKey;
879
+ for (; e; ) t.push(e._nodes), e._nodes.delete(n), e = e._parent;
880
+ e = this._parent;
881
+ const o = (r) => {
853
882
  r._children.forEach((s) => {
854
- for (let a = 0; a < n.length; a++) s._nodes.delete(n[a]);
855
- i(s);
883
+ for (let l = 0; l < t.length; l++) s._nodes.delete(t[l]);
884
+ o(s);
856
885
  });
857
886
  };
858
- i(this), this._parent = null, this._notify("onGroupChange");
887
+ o(this), this._parent = null, this._notify("onGroupChange");
859
888
  }
860
- addCommands(t, n) {
861
- this._addCommands(t, n), this._notify("onGroupChange");
889
+ addCommands(e, t) {
890
+ this._addCommands(e, t), this._notify("onGroupChange");
862
891
  }
863
892
  getActive() {
864
893
  return this._root._focused ?? this._root;
865
894
  }
866
- activate(t) {
867
- let n = this;
868
- if (t && (n = this._nodes.get(t), !n)) return void console.warn("group not found", t);
869
- let o = this._root._focused ?? this._root;
870
- for (; o; ) o = o._parent;
871
- this._root._focused !== n && (this._root._focused = n, this._notify("onGroupChange"), this._notify("onActiveChange"));
895
+ activate(e) {
896
+ let t = this;
897
+ if (e && (t = this._nodes.get(e), !t)) return void console.warn("group not found", e);
898
+ let n = this._root._focused ?? this._root;
899
+ for (; n; ) n = n._parent;
900
+ this._root._focused !== t && (this._root._focused = t, this._notify("onGroupChange"), this._notify("onActiveChange"));
872
901
  }
873
- findCommandByEvent(t) {
874
- const n = [];
875
- t.altKey && n.push(Z.Alt), t.shiftKey && n.push(Z.Shift), t.ctrlKey && n.push(Z.Ctrl), t.metaKey && n.push(Z.Meta);
876
- let o = Tt({ key: t.code, modifiers: n });
877
- const i = this._commandsByShortcut;
878
- let r = i.get(o);
879
- r || (o = Tt({ key: t.key, modifiers: n }), r = i.get(o)), !r && t.code.startsWith("Digit") && (o = Tt({ key: t.code.substring(5, t.code.length), modifiers: n }), r = this._commandsByShortcut.get(o)), !r && t.code.startsWith("Key") && (r = Tt({ key: t.code.substring(3, t.code.length), modifiers: n }), r = i.get(o));
902
+ findCommandByEvent(e) {
903
+ const t = [];
904
+ e.altKey && t.push(Z.Alt), e.shiftKey && t.push(Z.Shift), e.ctrlKey && t.push(Z.Ctrl), e.metaKey && t.push(Z.Meta);
905
+ let n = Te({ key: e.code, modifiers: t });
906
+ const o = this._commandsByShortcut;
907
+ let r = o.get(n);
908
+ r || (n = Te({ key: e.key, modifiers: t }), r = o.get(n)), !r && e.code.startsWith("Digit") && (n = Te({ key: e.code.substring(5, e.code.length), modifiers: t }), r = this._commandsByShortcut.get(n)), !r && e.code.startsWith("Key") && (r = Te({ key: e.code.substring(3, e.code.length), modifiers: t }), r = o.get(n));
880
909
  let s = null;
881
- return r && (s = this._commandsByKey.get(r), s && s.disabled() && (s = null), !s || s.target() && s.target().contains(t.target) || (s = null)), s || (this._parent?.findCommandByEvent(t) ?? null);
910
+ return r && (s = this._commandsByKey.get(r), s && s.disabled() && (s = null), !s || s.target() && s.target().contains(e.target) || (s = null)), s || (this._parent?.findCommandByEvent(e) ?? null);
882
911
  }
883
- dispatchToFocusedCommand(t) {
884
- const n = this.getActive();
885
- if (!n || t.isDefaultPrevented()) return !1;
886
- const o = n.findCommandByEvent?.(t);
887
- return !!o && (o.execute(), t.preventDefault(), !0);
912
+ dispatchToFocusedCommand(e) {
913
+ const t = this.getActive();
914
+ if (!t || e.isDefaultPrevented()) return !1;
915
+ const n = t.findCommandByEvent?.(e);
916
+ return !!n && (n.execute(), e.preventDefault(), !0);
888
917
  }
889
918
  getRoot() {
890
919
  return this._parent ? this._parent.getRoot() : this;
@@ -892,297 +921,297 @@ class He {
892
921
  getParent() {
893
922
  return this._parent;
894
923
  }
895
- addListener(t, n) {
896
- const o = this._listeners, i = n?.keys, r = this._root._listenersByKey;
897
- if (i && !t.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
924
+ addListener(e, t) {
925
+ const n = this._listeners, o = t?.keys, r = this._root._listenersByKey;
926
+ if (o && !e.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
898
927
  let s = null;
899
- if (i) for (let a = 0; a < i.length; a++) {
900
- const l = i[a];
901
- if (!l) continue;
902
- let c = r.get(l);
903
- c || (c = /* @__PURE__ */ new Set(), r.set(l, c)), s || (s = []), s.push(c), c.add(t);
928
+ if (o) for (let l = 0; l < o.length; l++) {
929
+ const a = o[l];
930
+ if (!a) continue;
931
+ let c = r.get(a);
932
+ c || (c = /* @__PURE__ */ new Set(), r.set(a, c)), s || (s = []), s.push(c), c.add(e);
904
933
  }
905
- return o.add(t), () => {
906
- if (s) for (let a = 0; a < s.length; a++)
907
- s[a].delete(t);
908
- o.delete(t);
934
+ return n.add(e), () => {
935
+ if (s) for (let l = 0; l < s.length; l++)
936
+ s[l].delete(e);
937
+ n.delete(e);
909
938
  };
910
939
  }
911
- _notifyCommands(t, n, o) {
912
- const i = this;
940
+ _notifyCommands(e, t, n) {
941
+ const o = this;
913
942
  setTimeout(() => {
914
- t.forEach((r) => {
915
- r[n]?.(i, o);
943
+ e.forEach((r) => {
944
+ r[t]?.(o, n);
916
945
  });
917
946
  }, 0);
918
947
  }
919
- _notify(t, n) {
920
- const o = this;
948
+ _notify(e, t) {
949
+ const n = this;
921
950
  setTimeout(() => {
922
- o._listeners.forEach((i) => {
923
- i[t]?.(o, n);
924
- }), o._parent && o._parent._notify(t, n);
951
+ n._listeners.forEach((o) => {
952
+ o[e]?.(n, t);
953
+ }), n._parent && n._parent._notify(e, t);
925
954
  }, 0);
926
955
  }
927
956
  getAllCommands() {
928
- const t = [], n = this._groupKey;
929
- return this._commandsByKey.forEach((o) => {
930
- t.push({ command: o, groupKey: n });
931
- }), this._children.forEach((o) => {
932
- t.push(...o.getAllCommands());
933
- }), t;
957
+ const e = [], t = this._groupKey;
958
+ return this._commandsByKey.forEach((n) => {
959
+ e.push({ command: n, groupKey: t });
960
+ }), this._children.forEach((n) => {
961
+ e.push(...n.getAllCommands());
962
+ }), e;
934
963
  }
935
964
  }
936
- const Nn = et.getOS() === et.OSType.MacOS || et.getOS() === et.OSType.IOS ? "Cmd" : "Ctrl", Wn = et.getOS() === et.OSType.MacOS || et.getOS() === et.OSType.IOS ? "⌘" : "^", Tt = (e, t = !1) => {
937
- const n = {};
938
- for (let i = 0; e.modifiers && i < e.modifiers.length; i++) n[e.modifiers[i]] = !0;
939
- let o = "";
940
- return (n?.[Z.Ctrl] || n?.[Z.Meta]) && (o += (o.length > 0 ? "+" : "") + (t ? Wn : Nn)), n?.[Z.Alt] && (o += t ? "⌥" : "Alt"), n?.[Z.Shift] && (o += (o.length > 0 ? "+" : "") + (t ? "⇧" : "Shift")), o += (o.length > 0 ? "+" : "") + ke(e.key), o;
965
+ const In = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "Cmd" : "Ctrl", Nn = te.getOS() === te.OSType.MacOS || te.getOS() === te.OSType.IOS ? "⌘" : "^", Te = (i, e = !1) => {
966
+ const t = {};
967
+ for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
968
+ let n = "";
969
+ return (t?.[Z.Ctrl] || t?.[Z.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? Nn : In)), t?.[Z.Alt] && (n += e ? "⌥" : "Alt"), t?.[Z.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + zt(i.key), n;
941
970
  };
942
- function go(e, t = null) {
943
- const n = k(t);
944
- n.current = t;
945
- const [o, i] = rn((s) => s + 1, 0), r = N(() => Array.isArray(e) ? e : [e], [e]);
971
+ function fo(i, e = null) {
972
+ const t = A(e);
973
+ t.current = e;
974
+ const [n, o] = on((s) => s + 1, 0), r = N(() => Array.isArray(i) ? i : [i], [i]);
946
975
  return V(() => {
947
976
  if (!r || r.length === 0) return;
948
977
  const s = (c, h) => {
949
- n.current?.onChange?.(h), i();
978
+ t.current?.onChange?.(h), o();
950
979
  };
951
- let a = null;
952
- t && (a = { onExecute(c, h) {
953
- n.current?.onExecute?.(c, h);
980
+ let l = null;
981
+ e && (l = { onExecute(c, h) {
982
+ t.current?.onExecute?.(c, h);
954
983
  }, onError(c, h, u) {
955
- n.current?.onError?.(c, h, u);
984
+ t.current?.onError?.(c, h, u);
956
985
  } });
957
- const l = /* @__PURE__ */ new Set();
958
- for (let c = 0; c < r.length; c++) l.add(r[c]?.addPropertyListener(et.debounce(s, 0), !0)), t && l.add(r[c]?.addExecuteListener(a));
986
+ const a = /* @__PURE__ */ new Set();
987
+ for (let c = 0; c < r.length; c++) a.add(r[c]?.addPropertyListener(te.debounce(s, 0), !0)), e && a.add(r[c]?.addExecuteListener(l));
959
988
  return () => {
960
- l.forEach((c) => {
989
+ a.forEach((c) => {
961
990
  c?.();
962
991
  });
963
992
  };
964
- }, [e]), o;
993
+ }, [i]), n;
965
994
  }
966
- const $t = (e, t) => {
967
- const n = [];
968
- if (t) for (let o = 0; o < t.length; o++) {
969
- const i = t[o], r = i ? e?.getCommand(i) : null;
970
- n.push(r);
995
+ const $e = (i, e) => {
996
+ const t = [];
997
+ if (e) for (let n = 0; n < e.length; n++) {
998
+ const o = e[n], r = o ? i?.getCommand(o) : null;
999
+ t.push(r);
971
1000
  }
972
- return n;
1001
+ return t;
973
1002
  };
974
- function yo(e, t = null, n = null, o) {
975
- const i = k(n);
976
- i.current = n, t && !Array.isArray(t) && (t = [t]);
977
- const [r, s] = Q($t(e, t)), a = o ? [...o, e] : [e];
1003
+ function go(i, e = null, t = null, n) {
1004
+ const o = A(t);
1005
+ o.current = t, e && !Array.isArray(e) && (e = [e]);
1006
+ const [r, s] = Q($e(i, e)), l = n ? [...n, i] : [i];
978
1007
  return V(() => {
979
- const l = { onGroupChange: () => {
980
- const p = $t(e, t);
981
- s(p), i.current?.onChange?.(this);
1008
+ const a = { onGroupChange: () => {
1009
+ const d = $e(i, e);
1010
+ s(d), o.current?.onChange?.(this);
982
1011
  } };
983
1012
  let c;
984
- t && t.length > 0 && (c = { keys: t }, l.onCommandChange = (p, w) => {
985
- i.current?.onChange?.(e), s($t(e, t));
1013
+ e && e.length > 0 && (c = { keys: e }, a.onCommandChange = (d, w) => {
1014
+ o.current?.onChange?.(i), s($e(i, e));
986
1015
  });
987
- const h = e?.addListener(l, c), u = $t(e, t);
988
- return s(u), i.current?.onChange && i.current?.onChange(e), () => {
1016
+ const h = i?.addListener(a, c), u = $e(i, e);
1017
+ return s(u), o.current?.onChange && o.current?.onChange(i), () => {
989
1018
  h?.();
990
1019
  };
991
- }, a), r;
1020
+ }, l), r;
992
1021
  }
993
- const vo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Yn = Oe({ setClipboard: (e) => {
1022
+ const yo = { Toolbar: "toolbar", Menuitem: "menuitem" }, Wn = $t({ setClipboard: (i) => {
994
1023
  throw new Error("This is only available via the useClipboard.");
995
- }, getClipboard: () => Kt.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
996
- const [e, t] = Q(Kt.Global);
997
- return { setClipboard: (n) => t(n), getClipboard: () => e, refNativeCopy: k(null), refNativeLastKey: k(null) };
998
- }), xo = (e) => {
999
- const { source: t, target: n, onPaste: o, onClipboardUpdate: i, notifier: r = Be, commands: s } = e, a = T(i, [i]), l = T(o, [o]), { getClipboard: c, refNativeCopy: h } = Yn(), u = c();
1024
+ }, getClipboard: () => Ke.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
1025
+ const [i, e] = Q(Ke.Global);
1026
+ return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: A(null), refNativeLastKey: A(null) };
1027
+ }), vo = (i) => {
1028
+ const { source: e, target: t, onPaste: n, onClipboardUpdate: o, notifier: r = At, commands: s } = i, l = T(o, [o]), a = T(n, [n]), { getClipboard: c, refNativeCopy: h } = Wn(), u = c();
1000
1029
  N(() => {
1001
- const _ = t?.element, y = n?.element ?? t?.element;
1030
+ const _ = e?.element, y = t?.element ?? e?.element;
1002
1031
  if (!s) return;
1003
- const m = [new jt("cut", _, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [Z.Ctrl] } }), new jt("copy", _, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [Z.Ctrl] } }), new jt("paste", y, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [Z.Ctrl] }, { key: "F8", modifiers: [Z.Ctrl] }] })];
1004
- s?.addCommands(m, !0);
1032
+ const f = [new Xe("cut", _, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", shortcut: { key: "X", modifiers: [Z.Ctrl] } }), new Xe("copy", _, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", shortcut: { key: "C", modifiers: [Z.Ctrl] } }), new Xe("paste", y, { label: "Paste", description: "Add content on the clipboard to your document.", shortcut: [{ key: "V", modifiers: [Z.Ctrl] }, { key: "F8", modifiers: [Z.Ctrl] }] })];
1033
+ s?.addCommands(f, !0);
1005
1034
  }, [s]);
1006
- const p = T(async (_) => {
1007
- if (!t?.element) return;
1035
+ const d = T(async (_) => {
1036
+ if (!e?.element) return;
1008
1037
  let y = null;
1009
1038
  try {
1010
- y = t.doCopy?.(_), typeof y == "string" ? await u.writeText(y) : await u.writeReference(y);
1011
- } catch (m) {
1012
- throw m;
1039
+ y = e.doCopy?.(_), typeof y == "string" ? await u.writeText(y) : await u.writeReference(y);
1040
+ } catch (f) {
1041
+ throw f;
1013
1042
  }
1014
- }, [t, r]), w = T(async (_) => {
1015
- const y = t?.element?.();
1043
+ }, [e, r]), w = T(async (_) => {
1044
+ const y = e?.element?.();
1016
1045
  if (y) {
1017
1046
  h.current = { sourceElement: y, args: _ };
1018
1047
  try {
1019
- await p(_);
1020
- } catch (m) {
1021
- r?.showError?.(m);
1048
+ await d(_);
1049
+ } catch (f) {
1050
+ r?.showError?.(f);
1022
1051
  }
1023
1052
  }
1024
- }, [t?.element, r]), b = R(() => {
1053
+ }, [e?.element, r]), b = R(() => {
1025
1054
  w({ isCut: !0 });
1026
- }, []), S = T(async (_, y, m) => {
1055
+ }, []), x = T(async (_, y, f) => {
1027
1056
  try {
1028
- if (await _.doPaste(y, m) === !1) return;
1029
- l?.(y, m);
1030
- } catch (z) {
1031
- r?.showError?.(z);
1057
+ if (await _.doPaste(y, f) === !1) return;
1058
+ a?.(y, f);
1059
+ } catch (k) {
1060
+ r?.showError?.(k);
1032
1061
  }
1033
- }, [l]), v = T(async (_, y, m) => {
1034
- const z = n?.element?.();
1035
- if (z && await et.whenFocus(z), !_ && !y) return;
1036
- const P = await r?.showBusy?.("Pasting...");
1062
+ }, [a]), S = T(async (_, y, f) => {
1063
+ const k = t?.element?.();
1064
+ if (k && await te.whenFocus(k), !_ && !y) return;
1065
+ const z = await r?.showBusy?.("Pasting...");
1037
1066
  if (y) try {
1038
- return await S(n, y, m), void P?.();
1067
+ return await x(t, y, f), void z?.();
1039
1068
  } catch (g) {
1040
- P?.(), r?.showError?.(g);
1069
+ z?.(), r?.showError?.(g);
1041
1070
  }
1042
- let O, F = n.importFromExternal;
1043
- F || (F = (g, x) => ({ getItemType: () => "text", toText: () => _.text, isClipboardItem: !0 }));
1071
+ let O, F = t.importFromExternal;
1072
+ F || (F = (g, v) => ({ getItemType: () => "text", toText: () => _.text, isClipboardItem: !0 }));
1044
1073
  try {
1045
1074
  O = await F(_, { isCut: !1 });
1046
1075
  } catch (g) {
1047
- P?.(), r?.showError?.(g);
1076
+ z?.(), r?.showError?.(g);
1048
1077
  }
1049
1078
  if (O) try {
1050
1079
  const g = await Promise.resolve(O);
1051
- await S(n, g, m), P?.();
1080
+ await x(t, g, f), z?.();
1052
1081
  } catch (g) {
1053
- P?.(), r?.showError?.(g);
1082
+ z?.(), r?.showError?.(g);
1054
1083
  }
1055
- else P?.();
1056
- }, [S, n, r]), $ = T(async (_) => {
1057
- if (n?.element) try {
1084
+ else z?.();
1085
+ }, [x, t, r]), P = T(async (_) => {
1086
+ if (t?.element) try {
1058
1087
  const y = await u.readReference();
1059
- if (y) return void await v(null, y, _);
1060
- const m = [];
1061
- m[0] = await It.readStringFromClipboard(u, Nt.plain), m[1] = await It.readHTMLFromClipboard(u, Nt.html), m[2] = await It.readBlobFromClipboard(u, Nt.png);
1062
- const z = { text: m[0] ?? null, html: m[1] ?? null, image: m[2] ?? null };
1063
- await v(z, null, _);
1088
+ if (y) return void await S(null, y, _);
1089
+ const f = [];
1090
+ f[0] = await Ie.readStringFromClipboard(u, Ne.plain), f[1] = await Ie.readHTMLFromClipboard(u, Ne.html), f[2] = await Ie.readBlobFromClipboard(u, Ne.png);
1091
+ const k = { text: f[0] ?? null, html: f[1] ?? null, image: f[2] ?? null };
1092
+ await S(k, null, _);
1064
1093
  } catch (y) {
1065
1094
  if (y?.message === "Document is not focused.") return;
1066
1095
  r?.showError?.(y);
1067
1096
  }
1068
- }, [v, n?.element, r]);
1097
+ }, [S, t?.element, r]);
1069
1098
  return T(async (_) => {
1070
- }, [t?.element]), T(async (_) => {
1071
- }, [n?.element, v, r]), V(() => {
1099
+ }, [e?.element]), T(async (_) => {
1100
+ }, [t?.element, S, r]), V(() => {
1072
1101
  if (!u) return;
1073
- const _ = async (z) => {
1074
- const P = await u.readReference();
1075
- a?.(P);
1076
- }, y = (z) => {
1077
- r?.showMessage?.(Kt.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
1078
- }, m = (z) => {
1079
- r?.showMessage?.(Kt.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
1102
+ const _ = async (k) => {
1103
+ const z = await u.readReference();
1104
+ l?.(z);
1105
+ }, y = (k) => {
1106
+ r?.showMessage?.(Ke.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
1107
+ }, f = (k) => {
1108
+ r?.showMessage?.(Ke.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
1080
1109
  };
1081
- return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread", y), u.addEventListener("clipboarderrorwrite", m), () => {
1082
- u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread", y), u.removeEventListener("clipboarderrorwrite", m);
1110
+ return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread", y), u.addEventListener("clipboarderrorwrite", f), () => {
1111
+ u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread", y), u.removeEventListener("clipboarderrorwrite", f);
1083
1112
  };
1084
1113
  }, [u, r]), V(() => {
1085
- }, [p, v, t, n]), V(() => {
1086
- s?.getCommand("cut")?.updateCallback(b).update({ disabled: !t || !n }), s?.getCommand("copy")?.updateCallback(w).update({ disabled: !t }), s?.getCommand("paste")?.updateCallback($).update({ disabled: !n });
1087
- }, [t, n, s]), { paste: $, copy: w, clipboard: u };
1114
+ }, [d, S, e, t]), V(() => {
1115
+ s?.getCommand("cut")?.updateCallback(b).update({ disabled: !e || !t }), s?.getCommand("copy")?.updateCallback(w).update({ disabled: !e }), s?.getCommand("paste")?.updateCallback(P).update({ disabled: !t });
1116
+ }, [e, t, s]), { paste: P, copy: w, clipboard: u };
1088
1117
  };
1089
- function bo(e, t = !0) {
1090
- const n = k(e);
1118
+ function xo(i, e = !0) {
1119
+ const t = A(i);
1091
1120
  V(() => {
1092
- if (t) {
1093
- const o = Object.entries(e).reduce((i, [r, s]) => (n.current[r] !== s && (i[r] = [n.current[r], s]), i), {});
1094
- Object.keys(o).length > 0 && console.log("Changed props:", o);
1121
+ if (e) {
1122
+ const n = Object.entries(i).reduce((o, [r, s]) => (t.current[r] !== s && (o[r] = [t.current[r], s]), o), {});
1123
+ Object.keys(n).length > 0 && console.log("Changed props:", n);
1095
1124
  }
1096
- n.current = e;
1125
+ t.current = i;
1097
1126
  });
1098
1127
  }
1099
- let Xt = !1, jn = 0;
1100
- var Xn = typeof document < "u" ? Vt : V;
1101
- const xe = () => "sheetxl-ui-" + jn++, be = ft.useId, wo = be ?? function() {
1102
- const [e, t] = ft.useState(() => Xt ? xe() : void 0);
1128
+ let je = !1, Yn = 0;
1129
+ var Xn = typeof document < "u" ? Ve : V;
1130
+ const xt = () => "sheetxl-ui-" + Yn++, bt = me.useId, bo = bt ?? function() {
1131
+ const [i, e] = me.useState(() => je ? xt() : void 0);
1103
1132
  return Xn(() => {
1104
- e == null && t(xe());
1105
- }, []), ft.useEffect(() => {
1106
- Xt || (Xt = !0);
1107
- }, []), e;
1108
- }, we = "Undo the last action.", Se = "Repeat the last action or undo the redo.", Un = (e) => `Redo ${e}`, So = ({ manager: e, commands: t, disabled: n, notifier: o = Be }) => {
1109
- const i = T((s) => {
1133
+ i == null && e(xt());
1134
+ }, []), me.useEffect(() => {
1135
+ je || (je = !0);
1136
+ }, []), i;
1137
+ }, wt = "Undo the last action.", St = "Repeat the last action or undo the redo.", jn = (i) => `Redo ${i}`, wo = ({ manager: i, commands: e, disabled: t, notifier: n = At }) => {
1138
+ const o = T((s) => {
1110
1139
  try {
1111
- e?.undo(s);
1112
- } catch (a) {
1113
- o.showError?.(a);
1140
+ i?.undo(s);
1141
+ } catch (l) {
1142
+ n.showError?.(l);
1114
1143
  }
1115
- }, [e]), r = T((s) => {
1144
+ }, [i]), r = T((s) => {
1116
1145
  try {
1117
- e?.redo(s);
1118
- } catch (a) {
1119
- o.showError?.(a);
1146
+ i?.redo(s);
1147
+ } catch (l) {
1148
+ n.showError?.(l);
1120
1149
  }
1121
- }, [e]);
1150
+ }, [i]);
1122
1151
  return N(() => {
1123
- if (!t) return;
1124
- const s = { contains: (l) => !0, focus() {
1125
- } }, a = [new Qt("undo", s, { label: "Undo", description: we, shortcut: { key: "z", modifiers: [Z.Ctrl] }, disabled: !0 }, i), new Qt("redo", s, { label: "Redo", description: Se, shortcut: [{ key: "y", modifiers: [Z.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [Z.Alt] }], disabled: !0 }, r)];
1126
- t?.addCommands(a, !0);
1127
- }, [t]), V(() => {
1128
- if (!t) return;
1152
+ if (!e) return;
1153
+ const s = { contains: (a) => !0, focus() {
1154
+ } }, l = [new Qe("undo", s, { label: "Undo", description: wt, shortcut: { key: "z", modifiers: [Z.Ctrl] }, disabled: !0 }, o), new Qe("redo", s, { label: "Redo", description: St, shortcut: [{ key: "y", modifiers: [Z.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [Z.Alt] }], disabled: !0 }, r)];
1155
+ e?.addCommands(l, !0);
1156
+ }, [e]), V(() => {
1157
+ if (!e) return;
1129
1158
  const s = () => {
1130
- const l = e?.getTopUndoDescription(), c = {};
1159
+ const a = i?.getTopUndoDescription(), c = {};
1131
1160
  var h;
1132
- t.getCommand("undo").update({ disabled: n || !e || !e.hasUndo(), description: l ? (h = l, `Undo ${h}`) : we, state: c, context: { undoManager: e } });
1133
- const u = e?.getTopRedoDescription();
1134
- t.getCommand("redo").update({ disabled: n || !e || !e.hasRedo(), description: u ? Un(u) : Se, state: c, context: { undoManager: e } });
1161
+ e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: a ? (h = a, `Undo ${h}`) : wt, state: c, context: { undoManager: i } });
1162
+ const u = i?.getTopRedoDescription();
1163
+ e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? jn(u) : St, state: c, context: { undoManager: i } });
1135
1164
  };
1136
- if (s(), !e) return;
1137
- const a = e.addListener({ onStackChange() {
1165
+ if (s(), !i) return;
1166
+ const l = i.addListener({ onStackChange() {
1138
1167
  s();
1139
1168
  } });
1140
- return () => a?.();
1141
- }, [e, t, n]), { undo: i, redo: r };
1169
+ return () => l?.();
1170
+ }, [i, e, t]), { undo: o, redo: r };
1142
1171
  };
1143
1172
  export {
1144
- Qt as Command,
1145
- vo as CommandButtonType,
1146
- He as CommandGroup,
1147
- Be as DefaultNotifier,
1148
- ao as FocusKeyNavigation,
1149
- to as HorizontalAlignment,
1173
+ Qe as Command,
1174
+ yo as CommandButtonType,
1175
+ Kt as CommandGroup,
1176
+ At as DefaultNotifier,
1177
+ lo as FocusKeyNavigation,
1178
+ Qn as HorizontalAlignment,
1150
1179
  eo as KeyCodes,
1151
1180
  Z as KeyModifiers,
1152
- no as MouseButtonCodes,
1153
- ye as NotificationType,
1154
- ro as ReactUtils,
1155
- co as RoundedTab,
1156
- Tn as ScrollPane,
1157
- io as ScrollUtils,
1158
- te as Scrollbar,
1159
- rt as ScrollbarOrientation,
1160
- jt as SimpleCommand,
1161
- ho as SplitPane,
1162
- On as SplitPaneResizer,
1163
- lo as ToolTipPlacement,
1164
- Bn as VirtualScrollbar,
1165
- En as defaultCreateScrollCorner,
1166
- oo as defaultCreateScrollEdgeButton,
1167
- un as defaultCreateScrollEndButton,
1168
- hn as defaultCreateScrollStartButton,
1169
- ge as defaultCreateScrollbar,
1170
- po as getDevicePixelRatio,
1171
- Mn as getPortalContainer,
1172
- Tt as toShortcutString,
1181
+ to as MouseButtonCodes,
1182
+ yt as NotificationType,
1183
+ io as ReactUtils,
1184
+ ao as RoundedTab,
1185
+ En as ScrollPane,
1186
+ oo as ScrollUtils,
1187
+ et as Scrollbar,
1188
+ re as ScrollbarOrientation,
1189
+ Xe as SimpleCommand,
1190
+ co as SplitPane,
1191
+ $n as SplitPaneResizer,
1192
+ so as ToolTipPlacement,
1193
+ An as VirtualScrollbar,
1194
+ Cn as defaultCreateScrollCorner,
1195
+ no as defaultCreateScrollEdgeButton,
1196
+ hn as defaultCreateScrollEndButton,
1197
+ cn as defaultCreateScrollStartButton,
1198
+ gt as defaultCreateScrollbar,
1199
+ uo as getDevicePixelRatio,
1200
+ Tn as getPortalContainer,
1201
+ Te as toShortcutString,
1173
1202
  T as useCallbackRef,
1174
- go as useCommand,
1175
- yo as useCommands,
1176
- xo as useCopyPaste,
1177
- uo as useDevicePixelRatio,
1203
+ fo as useCommand,
1204
+ go as useCommands,
1205
+ vo as useCopyPaste,
1206
+ ho as useDevicePixelRatio,
1178
1207
  mo as useEditMode,
1179
- so as useFullscreenPortal,
1180
- Yn as useGlobalClipboard,
1181
- wo as useId,
1182
- Ae as useImperativeElement,
1183
- fo as useMouseDownAndHoldListener,
1184
- _o as useOnClickOrFocusAway,
1185
- Kn as useSynchronizedPointerHandler,
1186
- bo as useTraceUpdate,
1187
- So as useUndoManager
1208
+ ro as useFullscreenPortal,
1209
+ Wn as useGlobalClipboard,
1210
+ bo as useId,
1211
+ kt as useImperativeElement,
1212
+ _o as useMouseDownAndHoldListener,
1213
+ po as useOnClickOrFocusAway,
1214
+ On as useSynchronizedPointerHandler,
1215
+ xo as useTraceUpdate,
1216
+ wo as useUndoManager
1188
1217
  };