@sheetxl/utils-react 0.7.4 → 0.7.6
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.
- package/README.md +9 -5
- package/browser/cjs/B9stfyU9EqTwUsA3.cjs +6 -0
- package/browser/cjs/index.cjs +3 -3
- package/browser/esm/CxY-6HIFmPob67ga.mjs +12 -0
- package/browser/esm/index.mjs +885 -605
- package/node/assets/style.css +1 -1
- package/node/esm/index.mjs +1036 -754
- package/node/esm/iqYVEUkNtlVZ_Hro.mjs +12 -0
- package/package.json +15 -2
- package/types/index.d.ts +236 -13
package/browser/esm/index.mjs
CHANGED
|
@@ -1,152 +1,152 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
import { jsx as L, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { CommonUtils as
|
|
5
|
-
import { createRoot as
|
|
6
|
-
import { unstable_batchedUpdates as
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.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}:root{--icon-size-sm: .875rem;--icon-size-md: 1rem;--icon-size-lg: 1.25rem;--icon-size-xl: 1.5rem}._Icon_1ipwo_10{font-size:var(--icon-size, var(--icon-size-md));min-width:var(--icon-size, var(--icon-size-md));min-height:var(--icon-size, var(--icon-size-md));--icon-stroke-em: .085em;--icon-color: currentColor;--icon-secondary-color: color-mix(in oklab, currentColor 65%, transparent);--icon-tertiary-color: color-mix(in oklab, currentColor 40%, transparent);--icon-line-color: currentColor;--icon-main-opacity: 1;--icon-secondary-opacity: .45;--icon-tertiary-opacity: .25;--icon-line-opacity: 1;--icon-filter: none;filter:var(--icon-filter);display:inline-flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle;flex:0 0 auto}._Icon_1ipwo_10 .sm{--font-size: var(--icon-size-sm)}._Icon_1ipwo_10 .md{--font-size: var(--icon-size-md)}._Icon_1ipwo_10 .lg{--font-size: var(--icon-size-lg)}._Icon_1ipwo_10 .xl{--font-size: var(--icon-size-xl)}._Icon_1ipwo_10>svg{width:var(--icon-size);height:var(--icon-size)}._Icon_1ipwo_10>img{aspect-ratio:1 / 1;display:block;line-height:1}._Icon_1ipwo_10 .fill,._Icon_1ipwo_10 .line{--layer-color: var(--icon-color);--layer-opacity: var(--icon-main-opacity)}._Icon_1ipwo_10 .secondary{--layer-color: var(--icon-secondary-color)}._Icon_1ipwo_10 .tertiary{--layer-color: var(--icon-tertiary-color)}._Icon_1ipwo_10 .primary{--layer-color: var(--sxl-app-color-primary, var(--icon-primary, #595b5e))}._Icon_1ipwo_10 .secondary{--layer-color: var(--sxl-app-color-secondary, #9c27b0)}._Icon_1ipwo_10 .secondary.light{--layer-color: var(--sxl-app-color-secondary-light, #a060ac)}._Icon_1ipwo_10 .success{--layer-color: var(--sxl-app-color-success, #22c55e)}._Icon_1ipwo_10 .success.light{--layer-color: var(--sxl-app-color-success-light, #22c55e)}._Icon_1ipwo_10 .info{--layer-color: var(--sxl-app-color-info, #3b82f6)}._Icon_1ipwo_10 .warn{--layer-color: var(--sxl-app-color-warn, #f59e0b)}._Icon_1ipwo_10 .error{--layer-color: var(--sxl-app-color-error, #ef4444)}._Icon_1ipwo_10 .error.light{--layer-color: var(--sxl-app-color-error-light, #f87171)}._Icon_1ipwo_10 .grey{--layer-color: var(--sxl-app-color-grey, #cccccc)}._Icon_1ipwo_10 .shadow{--layer-color: var(--sxl-app-color-shadow, #cccccc)}._Icon_1ipwo_10 .fill:not(.fixed){fill:var(--layer-color);opacity:var(--layer-opacity);stroke:none}._Icon_1ipwo_10 .line:not(.fixed){fill:none;stroke:var(--layer-color, var(--icon-line-color));stroke-width:var(--icon-stroke-em);opacity:var(--layer-opacity, var(--icon-line-opacity));vector-effect:non-scaling-stroke;pointer-events:none;stroke-linecap:var(--icon-linecap, round);stroke-linejoin:var(--icon-linejoin, round);stroke-miterlimit:var(--icon-miter, 4)}@media (prefers-color-scheme: dark){._Icon_1ipwo_10 .invert-dark{filter:invert(1) hue-rotate(180deg)}}._Icon_1ipwo_10 .muted{opacity:calc(var(--layer-opacity, 1) * .6)}@keyframes _sxl-walk_1ipwo_1{to{stroke-dashoffset:0}}.icon.walking .walkable.line{stroke-dasharray:var(--walk-dash-length, 5px) var(--walk-dash-gap, 2px);stroke-dashoffset:calc(var(--walk-dash-length, 5px) + var(--walk-dash-gap, 2px));animation:_sxl-walk_1ipwo_1 var(--walk-duration, .96s) linear infinite;will-change:stroke-dashoffset}")),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
+
import { jsx as L, jsxs as Se, Fragment as ke } from "react/jsx-runtime";
|
|
3
|
+
import ie, { useLayoutEffect as Ve, useEffect as V, useState as q, useMemo as N, useCallback as H, useRef as O, memo as ye, forwardRef as Ce, useImperativeHandle as cn, version as hn, createContext as un, useContext as dn, createElement as pn, useReducer as fn } from "react";
|
|
4
|
+
import { CommonUtils as Z, DefaultNotifier as _n, Notifier as me, InternalClipboard as Ie, ClipboardUtils as Fe, MimeType as je } from "@sheetxl/utils";
|
|
5
|
+
import { createRoot as mn } from "react-dom/client";
|
|
6
|
+
import { unstable_batchedUpdates as gn } from "react-dom";
|
|
7
7
|
/**
|
|
8
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.
|
|
8
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.7.6
|
|
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
|
|
14
|
-
function
|
|
13
|
+
const _o = { General: "general", Left: "left", Right: "right", Center: "center", Justify: "justify", Fill: "fill", Distributed: "distributed", CenterContinuous: "centerContinuous" }, G = { Shift: "shift", Alt: "alt", Ctrl: "ctrl", Meta: "meta" }, mo = { 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 }, go = { Left: 1, Middle: 2, Right: 3 }, se = { Horizontal: "horizontal", Vertical: "vertical" };
|
|
14
|
+
function Pt(i) {
|
|
15
15
|
var e, t, n = "";
|
|
16
16
|
if (typeof i == "string" || typeof i == "number") n += i;
|
|
17
17
|
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
18
18
|
var o = i.length;
|
|
19
|
-
for (e = 0; e < o; e++) i[e] && (t =
|
|
19
|
+
for (e = 0; e < o; e++) i[e] && (t = Pt(i[e])) && (n && (n += " "), n += t);
|
|
20
20
|
} else for (t in i) i[t] && (n && (n += " "), n += t);
|
|
21
21
|
return n;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e =
|
|
23
|
+
function we() {
|
|
24
|
+
for (var i, e, t = 0, n = "", o = arguments.length; t < o; t++) (i = arguments[t]) && (e = Pt(i)) && (n && (n += " "), n += e);
|
|
25
25
|
return n;
|
|
26
26
|
}
|
|
27
|
-
var
|
|
28
|
-
},
|
|
29
|
-
const ge =
|
|
30
|
-
var i =
|
|
31
|
-
return new window.ResizeObserver(function(
|
|
32
|
-
if (
|
|
33
|
-
var
|
|
34
|
-
r({ x:
|
|
27
|
+
var yn = function() {
|
|
28
|
+
}, At = typeof window < "u", vn = At ? Ve : V, ft = { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, bottom: 0, right: 0 };
|
|
29
|
+
const ge = At && window.ResizeObserver !== void 0 ? function() {
|
|
30
|
+
var i = q(null), e = i[0], t = i[1], n = q(ft), o = n[0], r = n[1], a = N(function() {
|
|
31
|
+
return new window.ResizeObserver(function(h) {
|
|
32
|
+
if (h[0]) {
|
|
33
|
+
var s = h[0].contentRect, l = s.x, c = s.y, u = s.width, d = s.height, f = s.top, v = s.left, m = s.bottom, b = s.right;
|
|
34
|
+
r({ x: l, y: c, width: u, height: d, top: f, left: v, bottom: m, right: b });
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
}, []);
|
|
38
|
-
return
|
|
39
|
-
if (e) return
|
|
40
|
-
|
|
38
|
+
return vn(function() {
|
|
39
|
+
if (e) return a.observe(e), function() {
|
|
40
|
+
a.disconnect();
|
|
41
41
|
};
|
|
42
42
|
}, [e]), [t, o];
|
|
43
43
|
} : function() {
|
|
44
|
-
return [
|
|
45
|
-
},
|
|
46
|
-
const t = H((...r) => i?.(...r), e), n =
|
|
44
|
+
return [yn, ft];
|
|
45
|
+
}, M = (i, e) => {
|
|
46
|
+
const t = H((...r) => i?.(...r), e), n = O(null);
|
|
47
47
|
n.current = t;
|
|
48
48
|
const o = H((...r) => n.current?.(...r), []);
|
|
49
49
|
if (n.current) return o;
|
|
50
|
-
},
|
|
51
|
-
const { style: e, orientation: t =
|
|
50
|
+
}, xn = (i) => {
|
|
51
|
+
const { style: e, orientation: t = se.Vertical, ...n } = i, o = t === se.Vertical;
|
|
52
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
|
-
},
|
|
54
|
-
const { style: e, orientation: t =
|
|
53
|
+
}, wn = (i) => {
|
|
54
|
+
const { style: e, orientation: t = se.Vertical, ...n } = i, o = t === se.Vertical;
|
|
55
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
|
-
},
|
|
57
|
-
const { style: e, orientation: t =
|
|
56
|
+
}, yo = (i) => {
|
|
57
|
+
const { style: e, orientation: t = se.Vertical, ...n } = i, o = t === se.Vertical;
|
|
58
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
59
|
}, Ze = (i, e, t, n, o = 0) => {
|
|
60
60
|
for (let r = 0; r < t.length; r++) {
|
|
61
|
-
const
|
|
62
|
-
let
|
|
61
|
+
const a = t[r].getBoundingClientRect();
|
|
62
|
+
let h = a.left - e, s = h + a.width;
|
|
63
63
|
if (n) {
|
|
64
|
-
if (
|
|
65
|
-
} else if (Math.ceil(
|
|
64
|
+
if (h < i && s >= i) return h;
|
|
65
|
+
} else if (Math.ceil(s) > Math.ceil(i) + 2) return s;
|
|
66
66
|
}
|
|
67
67
|
return o;
|
|
68
|
-
},
|
|
69
|
-
const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className:
|
|
68
|
+
}, vo = Object.freeze(Object.defineProperty({ __proto__: null, getScrollTo: Ze }, Symbol.toStringTag, { value: "Module" })), bn = "_sheetxl-scrollbar_eblx4_6", ot = ye(Ce((i, e) => {
|
|
69
|
+
const { offset: t = 0, totalSize: n = 0, viewportSize: o = 0, style: r, className: a, orientation: h = se.Vertical, onScrollOffset: s, onScroll: l, showCustomScrollButtons: c = !1, scrollButtonIncrement: u = 200, scrollButtonInitialRepeatDelay: d = 260, scrollButtonAdditionalRepeatDelay: f = 120, createScrollStartButton: v = xn, createScrollEndButton: m = wn, ...b } = i, T = M(l, [l]), _ = O(null), [w, { width: x, height: A }] = ge(), [P, { width: B, height: K }] = ge(), y = h === se.Vertical, S = y ? "top" : "left", z = y ? "scrollTop" : "scrollLeft", p = y ? A : x, C = y ? K : B, [g, E] = q(null);
|
|
70
70
|
V(() => {
|
|
71
|
-
|
|
72
|
-
}, [
|
|
73
|
-
const
|
|
71
|
+
g !== null && _.current && _.current.scrollTo({ behavior: "smooth", [S]: g });
|
|
72
|
+
}, [g, y]);
|
|
73
|
+
const k = H((R, le = !1) => {
|
|
74
74
|
if (!_.current) return 0;
|
|
75
|
-
const
|
|
75
|
+
const re = _.current.querySelector(".scrollbar-viewport"), fe = re.getBoundingClientRect(), ae = re.children, he = le ? 0 : Ze(R, fe[S], ae, !0, Math.max(0, R - u));
|
|
76
76
|
return E(he), Math.max(0, he);
|
|
77
|
-
}, []),
|
|
77
|
+
}, []), J = H((R, le = !1) => {
|
|
78
78
|
if (!_.current) return 0;
|
|
79
|
-
const
|
|
79
|
+
const re = _.current.querySelector(".scrollbar-viewport"), fe = re.getBoundingClientRect(), ae = re.children, he = Math.ceil(C - p), Ee = le ? he : Ze(R, fe[S], ae, !1, Math.max(0, R + u));
|
|
80
80
|
return E(Ee), Math.min(he, Ee);
|
|
81
|
-
}, [C, p]), F =
|
|
81
|
+
}, [C, p]), F = O(null), j = H((R) => {
|
|
82
82
|
F.current = t;
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
}, [
|
|
83
|
+
const le = R.target[z];
|
|
84
|
+
s(le, o, n), T?.(R);
|
|
85
|
+
}, [s, o, n, t]);
|
|
86
86
|
V(() => {
|
|
87
|
-
const
|
|
88
|
-
F.current = null, t !==
|
|
89
|
-
}, [t,
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
}, []),
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
}, [
|
|
98
|
-
V(() => () =>
|
|
99
|
-
const ne = t,
|
|
100
|
-
if (!
|
|
101
|
-
const
|
|
102
|
-
return
|
|
103
|
-
}, [
|
|
104
|
-
if (!
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
}, [
|
|
108
|
-
return
|
|
87
|
+
const R = F.current;
|
|
88
|
+
F.current = null, t !== R && (_.current[z] = t);
|
|
89
|
+
}, [t, z]);
|
|
90
|
+
const Y = O(null), $ = O(null), W = H(() => {
|
|
91
|
+
Y.current && (clearTimeout(Y.current), Y.current = null, $.current = null);
|
|
92
|
+
}, []), X = H((R, le, re, fe = d) => {
|
|
93
|
+
$.current = R, Y.current = setTimeout(() => {
|
|
94
|
+
const ae = re ? k($.current || R) : J($.current || R);
|
|
95
|
+
ae !== $.current ? X(ae, !1, re, f) : W();
|
|
96
|
+
}, le ? 0 : fe);
|
|
97
|
+
}, [k, J, W]);
|
|
98
|
+
V(() => () => W(), [W]);
|
|
99
|
+
const ne = t, ve = N(() => {
|
|
100
|
+
if (!c) return null;
|
|
101
|
+
const R = { orientation: h, disabled: Math.floor(ne) <= 0 || Math.floor(C - p) === 0, onMouseUp: W, onMouseLeave: W, onMouseDown: () => X(ne, !0, !0) };
|
|
102
|
+
return v?.(R);
|
|
103
|
+
}, [c, h, ne, g, C, p]), xe = N(() => {
|
|
104
|
+
if (!c) return null;
|
|
105
|
+
const R = { orientation: h, disabled: Math.floor(C - p) <= Math.ceil(ne), onMouseUp: W, onMouseLeave: W, onMouseDown: () => X(ne, !0, !1) };
|
|
106
|
+
return m?.(R);
|
|
107
|
+
}, [c, h, ne, g, C, p]);
|
|
108
|
+
return Se("div", { ref: e, style: { display: "flex", flex: "1", flexDirection: y ? "column" : "row", padding: "0", ...r }, className: we(bn, a), ...b, children: [ve, L("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: y ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: w, children: L("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: y ? "scroll" : "hidden", overflowX: y ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: j, ref: _, children: L("div", { ref: P, style: { position: "absolute", height: y ? n - o + (A ?? 0) : 1, width: y ? 1 : n - o + (x ?? 0) }, className: "scrollbar-viewport" }) }) }), xe] });
|
|
109
109
|
}));
|
|
110
|
-
|
|
111
|
-
let _t = Date.now, mt = 1e3, pe = {},
|
|
110
|
+
ot.displayName = "Scrollbar";
|
|
111
|
+
let _t = Date.now, mt = 1e3, pe = {}, Sn = 1;
|
|
112
112
|
const Te = (i) => {
|
|
113
113
|
let e = pe[i] !== null;
|
|
114
114
|
return e && (pe[i] = null), e;
|
|
115
|
-
},
|
|
116
|
-
let r = _t(),
|
|
117
|
-
if (
|
|
115
|
+
}, gt = (i, e, t, n = 0, o) => {
|
|
116
|
+
let r = _t(), a = r, h = 0, s = 0, l = 0, c = Sn++;
|
|
117
|
+
if (c % 20 == 0) {
|
|
118
118
|
const d = {};
|
|
119
|
-
for (let
|
|
119
|
+
for (let f in pe) d[f] = !0;
|
|
120
120
|
pe = d;
|
|
121
121
|
}
|
|
122
122
|
const u = function(d) {
|
|
123
|
-
let
|
|
123
|
+
let f = d !== !0, v = _t(), m = !0;
|
|
124
124
|
try {
|
|
125
|
-
|
|
125
|
+
m = (!e || e(c)) ?? !0;
|
|
126
126
|
} catch {
|
|
127
|
-
|
|
127
|
+
m = !1;
|
|
128
128
|
}
|
|
129
|
-
if (!pe[
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
for (let _ = 0; _ < Math.min(
|
|
129
|
+
if (!pe[c] || !m) return pe[c] = null, void t?.(60 - s / ((v - r) / mt), c, !1);
|
|
130
|
+
if (f) {
|
|
131
|
+
l = Math.round((v - a) / 16.666666666666668) - 1;
|
|
132
|
+
for (let _ = 0; _ < Math.min(l, 4); _++) u(!0), s++;
|
|
133
133
|
}
|
|
134
|
-
n && (
|
|
135
|
-
let
|
|
134
|
+
n && (h = (v - r) / n, h > 1 && (h = 1));
|
|
135
|
+
let b = o ? o(h) : h, T = !1;
|
|
136
136
|
try {
|
|
137
|
-
|
|
137
|
+
T = i(b, v, f);
|
|
138
138
|
} catch {
|
|
139
|
-
|
|
139
|
+
T = !1;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
T !== !1 && h !== 1 || !f ? f && (a = v, requestAnimationFrame(u)) : (pe[c] = null, t?.(60 - s / ((v - r) / mt), c, h === 1 || n == null));
|
|
142
142
|
};
|
|
143
|
-
return pe[
|
|
144
|
-
},
|
|
143
|
+
return pe[c] = !0, requestAnimationFrame(u), c;
|
|
144
|
+
}, Ln = function(i) {
|
|
145
145
|
return Math.pow(i - 1, 3) + 1;
|
|
146
|
-
},
|
|
146
|
+
}, Cn = function(i) {
|
|
147
147
|
return (i /= 0.5) < 1 ? 0.5 * Math.pow(i, 3) : 0.5 * (Math.pow(i - 2, 3) + 2);
|
|
148
148
|
};
|
|
149
|
-
class
|
|
149
|
+
class En {
|
|
150
150
|
constructor(e, t) {
|
|
151
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
152
|
}
|
|
@@ -172,11 +172,11 @@ class xn {
|
|
|
172
172
|
zoomTo(e, t = !1, n, o, r) {
|
|
173
173
|
if (!this.options.zooming) throw new Error("Zooming is not enabled!");
|
|
174
174
|
r && (this.__zoomComplete = r), this.__isDecelerating && (Te(this.__isDecelerating), this.__isDecelerating = 0);
|
|
175
|
-
const
|
|
175
|
+
const a = this.__zoomLevel;
|
|
176
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
|
|
178
|
-
let
|
|
179
|
-
|
|
177
|
+
const h = e / a;
|
|
178
|
+
let s = h * (this.__scrollLeft + n) - n, l = h * (this.__scrollTop + o) - o;
|
|
179
|
+
s > this.__maxScrollLeft ? s = this.__maxScrollLeft : s < 0 && (s = 0), l > this.__maxScrollTop ? l = this.__maxScrollTop : l < 0 && (l = 0), this.__publish(s, l, e, t);
|
|
180
180
|
}
|
|
181
181
|
zoomBy(e, t = !1, n = 0, o = 0, r) {
|
|
182
182
|
this.zoomTo(this.__zoomLevel * e, t, n, o, r);
|
|
@@ -210,30 +210,30 @@ class xn {
|
|
|
210
210
|
if (!this.__isTracking) return;
|
|
211
211
|
let o, r;
|
|
212
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
|
|
213
|
+
let a = this.__positions;
|
|
214
214
|
if (this.__isDragging) {
|
|
215
|
-
let
|
|
215
|
+
let h = o - this.__lastTouchLeft, s = r - this.__lastTouchTop, l = this.__scrollLeft, c = this.__scrollTop, u = this.__zoomLevel;
|
|
216
216
|
if (n !== void 0 && this.options.zooming) {
|
|
217
217
|
let d = u;
|
|
218
218
|
if (u = u / this.__lastScale * n, u = Math.max(Math.min(u, this.options.maxZoom), this.options.minZoom), d !== u) {
|
|
219
|
-
let
|
|
220
|
-
|
|
219
|
+
let f = o - this.__clientLeft, v = r - this.__clientTop;
|
|
220
|
+
l = (f + l) * u / d - f, c = (v + c) * u / d - v, this.__computeScrollMax(u);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
if (this.__enableScrollX) {
|
|
224
|
-
|
|
224
|
+
l -= h * this.options.speedMultiplier;
|
|
225
225
|
let d = this.__maxScrollLeft;
|
|
226
|
-
(
|
|
226
|
+
(l > d || l < 0) && (this.options.bouncing ? l += h / 2 * this.options.speedMultiplier : l = l > d ? d : 0);
|
|
227
227
|
}
|
|
228
228
|
if (this.__enableScrollY) {
|
|
229
|
-
|
|
229
|
+
c -= s * this.options.speedMultiplier;
|
|
230
230
|
const d = this.__maxScrollTop;
|
|
231
|
-
(
|
|
231
|
+
(c > d || c < 0) && (this.options.bouncing ? c += s / 2 * this.options.speedMultiplier : c = c > d ? d : 0);
|
|
232
232
|
}
|
|
233
|
-
|
|
233
|
+
a.length > 60 && a.splice(0, 30), a.push(l, c, t), this.__publish(l, c, u);
|
|
234
234
|
} else {
|
|
235
|
-
let
|
|
236
|
-
this.__enableScrollX = this.options.scrollingX &&
|
|
235
|
+
let h = this.options.locking ? 3 : 0, s = 5, l = Math.abs(o - this.__initialTouchLeft), c = Math.abs(r - this.__initialTouchTop);
|
|
236
|
+
this.__enableScrollX = this.options.scrollingX && l >= h, this.__enableScrollY = this.options.scrollingY && c >= h, a.push(this.__scrollLeft, this.__scrollTop, t), this.__isDragging = (this.__enableScrollX || this.__enableScrollY) && (l >= s || c >= s), this.__isDragging && (this.__interruptedAnimation = !1);
|
|
237
237
|
}
|
|
238
238
|
this.__lastTouchLeft = o, this.__lastTouchTop = r, this.__lastTouchMove = t, this.__lastScale = n;
|
|
239
239
|
}
|
|
@@ -244,10 +244,10 @@ class xn {
|
|
|
244
244
|
let t = this.__positions, n = t.length - 1, o = n;
|
|
245
245
|
for (let r = n; r > 0 && t[r] > this.__lastTouchMove - 100; r -= 3) o = r;
|
|
246
246
|
if (o !== n) {
|
|
247
|
-
const r = t[n] - t[o],
|
|
248
|
-
this.__decelerationVelocityX =
|
|
249
|
-
const
|
|
250
|
-
(Math.abs(this.__decelerationVelocityX) >
|
|
247
|
+
const r = t[n] - t[o], a = this.__scrollLeft - t[o - 2], h = this.__scrollTop - t[o - 1];
|
|
248
|
+
this.__decelerationVelocityX = a / r * (1e3 / 60), this.__decelerationVelocityY = h / r * (1e3 / 60);
|
|
249
|
+
const s = this.options.paging || this.options.snapping ? 4 : 1;
|
|
250
|
+
(Math.abs(this.__decelerationVelocityX) > s || Math.abs(this.__decelerationVelocityY) > s) && this.__startDeceleration(e);
|
|
251
251
|
} else this.options.scrollingComplete?.();
|
|
252
252
|
} else e - this.__lastTouchMove > 100 && this.options.scrollingComplete?.();
|
|
253
253
|
this.__isDecelerating || ((this.__interruptedAnimation || this.__isDragging) && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, !0, this.__zoomLevel)), this.__positions.length = 0;
|
|
@@ -257,14 +257,14 @@ class xn {
|
|
|
257
257
|
const r = this.__isAnimating;
|
|
258
258
|
if (r && (Te(r), this.__isAnimating = 0), o && this.options.animating) {
|
|
259
259
|
this.__scheduledLeft = e, this.__scheduledTop = t, this.__scheduledZoom = n;
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
}.bind(this),
|
|
263
|
-
return this.__isAnimating ===
|
|
264
|
-
}.bind(this),
|
|
265
|
-
|
|
260
|
+
const a = this.__scrollLeft, h = this.__scrollTop, s = this.__zoomLevel, l = e - a, c = t - h, u = n - s, d = function(m, b, T) {
|
|
261
|
+
T && (this.__scrollLeft = a + l * m, this.__scrollTop = h + c * m, this.__zoomLevel = s + u * m, this.__callback && this.__callback(this.__scrollLeft, this.__scrollTop, this.__zoomLevel));
|
|
262
|
+
}.bind(this), f = function(m) {
|
|
263
|
+
return this.__isAnimating === m;
|
|
264
|
+
}.bind(this), v = function(m, b, T) {
|
|
265
|
+
b === this.__isAnimating && (this.__isAnimating = !1), (this.__didDecelerationComplete || T) && this.options.scrollingComplete?.(), this.options.zooming && (this.__computeScrollMax(), this.__zoomComplete && (this.__zoomComplete(), this.__zoomComplete = null));
|
|
266
266
|
}.bind(this);
|
|
267
|
-
this.__isAnimating =
|
|
267
|
+
this.__isAnimating = gt(d, f, v, this.options.animationDuration, r ? Ln : Cn);
|
|
268
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));
|
|
269
269
|
}
|
|
270
270
|
__computeScrollMax(e = this.__zoomLevel) {
|
|
@@ -272,18 +272,18 @@ class xn {
|
|
|
272
272
|
}
|
|
273
273
|
__startDeceleration(e) {
|
|
274
274
|
if (this.options.paging) {
|
|
275
|
-
const
|
|
276
|
-
this.__minDecelerationScrollLeft = Math.floor(
|
|
275
|
+
const a = Math.max(Math.min(this.__scrollLeft, this.__maxScrollLeft), 0), h = Math.max(Math.min(this.__scrollTop, this.__maxScrollTop), 0), s = this.__clientWidth, l = this.__clientHeight;
|
|
276
|
+
this.__minDecelerationScrollLeft = Math.floor(a / s) * s, this.__minDecelerationScrollTop = Math.floor(h / l) * l, this.__maxDecelerationScrollLeft = Math.ceil(a / s) * s, this.__maxDecelerationScrollTop = Math.ceil(h / l) * l;
|
|
277
277
|
} else this.__minDecelerationScrollLeft = 0, this.__minDecelerationScrollTop = 0, this.__maxDecelerationScrollLeft = this.__maxScrollLeft, this.__maxDecelerationScrollTop = this.__maxScrollTop;
|
|
278
|
-
const t = function(
|
|
279
|
-
this.__stepThroughDeceleration(
|
|
278
|
+
const t = function(a, h, s) {
|
|
279
|
+
this.__stepThroughDeceleration(s);
|
|
280
280
|
}.bind(this), n = this.options.snapping ? 4 : 0.1, o = function() {
|
|
281
|
-
const
|
|
282
|
-
return
|
|
283
|
-
}.bind(this), r = function(
|
|
281
|
+
const a = Math.abs(this.__decelerationVelocityX) >= n || Math.abs(this.__decelerationVelocityY) >= n;
|
|
282
|
+
return a || (this.__didDecelerationComplete = !0), a;
|
|
283
|
+
}.bind(this), r = function(a, h, s) {
|
|
284
284
|
this.__isDecelerating = 0, this.__didDecelerationComplete && this.options.scrollingComplete?.(), this.scrollTo(this.__scrollLeft, this.__scrollTop, this.options.snapping);
|
|
285
285
|
}.bind(this);
|
|
286
|
-
this.__isDecelerating =
|
|
286
|
+
this.__isDecelerating = gt(t, o, r);
|
|
287
287
|
}
|
|
288
288
|
__stepThroughDeceleration(e) {
|
|
289
289
|
let t = this.__scrollLeft + this.__decelerationVelocityX, n = this.__scrollTop + this.__decelerationVelocityY;
|
|
@@ -294,24 +294,24 @@ class xn {
|
|
|
294
294
|
r !== n && (n = r, this.__decelerationVelocityY = 0);
|
|
295
295
|
}
|
|
296
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,
|
|
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 *
|
|
297
|
+
let o = 0, r = 0, a = this.options.penetrationDeceleration, h = 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 * a : this.__decelerationVelocityX = o * h), r !== 0 && (r * this.__decelerationVelocityY <= 0 ? this.__decelerationVelocityY += r * a : this.__decelerationVelocityY = r * h);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
var
|
|
302
|
+
var ee = typeof window < "u" ? window : { screen: {}, navigator: {} }, Le = (ee.matchMedia || function() {
|
|
303
303
|
return { matches: !1 };
|
|
304
|
-
}).bind(
|
|
305
|
-
return
|
|
306
|
-
} },
|
|
304
|
+
}).bind(ee), zt = !1, Tn = { get passive() {
|
|
305
|
+
return zt = !0;
|
|
306
|
+
} }, yt = function() {
|
|
307
307
|
};
|
|
308
|
-
|
|
309
|
-
var
|
|
310
|
-
const
|
|
311
|
-
function
|
|
312
|
-
return
|
|
308
|
+
ee.addEventListener && ee.addEventListener("p", yt, Tn), ee.removeEventListener && ee.removeEventListener("p", yt, !1);
|
|
309
|
+
var Mn = zt, kn = "PointerEvent" in ee, it = "ontouchstart" in ee, Bt = it || "TouchEvent" in ee && Le("(any-pointer: coarse)").matches, vt = (ee.navigator.maxTouchPoints || 0) > 0 || Bt, Ot = ee.navigator.userAgent || "", Dn = Le("(pointer: coarse)").matches && /iPad|Macintosh/.test(Ot) && Math.min(ee.screen.width || 0, ee.screen.height || 0) >= 768, $t = (Le("(pointer: coarse)").matches || !Le("(pointer: fine)").matches && it) && !/Windows.*Firefox/.test(Ot), Pn = Le("(any-pointer: fine)").matches || Le("(any-hover: hover)").matches || Dn || !it, qe = !vt || !Pn && $t ? vt ? "touchOnly" : "mouseOnly" : "hybrid", An = qe === "mouseOnly" ? "mouse" : qe === "touchOnly" || $t ? "touch" : "mouse";
|
|
310
|
+
const zn = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: qe, primaryInput: An, supportsPassiveEvents: Mn, supportsPointerEvents: kn, supportsTouchEvents: Bt }, Symbol.toStringTag, { value: "Module" })), Bn = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), Kt = {};
|
|
311
|
+
function Je() {
|
|
312
|
+
return zn;
|
|
313
313
|
}
|
|
314
|
-
const
|
|
314
|
+
const Rt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : Z.camelToPrettyCase(i), xo = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: Kt, boundPixel: function(i, e = !1, t = 0) {
|
|
315
315
|
return i;
|
|
316
316
|
}, createSyntheticEvent: (i) => {
|
|
317
317
|
let e = !1, t = !1;
|
|
@@ -321,65 +321,65 @@ const kt = (i) => i === "BracketLeft" ? "[" : i === "BracketRight" ? "]" : te.ca
|
|
|
321
321
|
t = !0, i.stopPropagation();
|
|
322
322
|
}, isPropagationStopped: () => t, persist: () => {
|
|
323
323
|
}, timeStamp: i.timeStamp, type: i.type };
|
|
324
|
-
}, detectIt:
|
|
325
|
-
function
|
|
326
|
-
const n =
|
|
327
|
-
return
|
|
324
|
+
}, detectIt: Je, focusableNodeNames: Bn, toPrettyKeyCode: Rt }, Symbol.toStringTag, { value: "Module" })), On = [];
|
|
325
|
+
function It(i, e, t = On) {
|
|
326
|
+
const n = O(null);
|
|
327
|
+
return cn(i, () => {
|
|
328
328
|
if (!n.current) return;
|
|
329
329
|
const o = n.current, r = e?.();
|
|
330
330
|
if (!r || typeof r != "object") throw new Error("attributes must return a plain object of values");
|
|
331
|
-
const
|
|
332
|
-
for (let
|
|
333
|
-
const
|
|
334
|
-
Object.defineProperty(o,
|
|
331
|
+
const a = Object.keys(r), h = a.length;
|
|
332
|
+
for (let s = 0; s < h; s++) {
|
|
333
|
+
const l = a[s], c = r[l];
|
|
334
|
+
Object.defineProperty(o, l, { value: c, writable: !0, configurable: !0, enumerable: !0 });
|
|
335
335
|
}
|
|
336
336
|
return o;
|
|
337
337
|
}, t), n;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar:
|
|
339
|
+
const xt = (i) => L(ot, { ...i }), $n = ({ width: i, height: e }) => L("div", { className: "corner", style: { minWidth: `${i}px`, width: `${i}px`, minHeight: `${e}px`, height: `${e}px` } }), Kn = ye(Ce((i, e) => {
|
|
340
|
+
const { children: t, viewport: n, onScrollViewport: o, showHorizontalScrollbar: r = !0, showVerticalScrollbar: a = !0, createScrollCorner: h = $n, createHorizontalScrollbar: s = xt, createVerticalScrollbar: l = xt, style: c, touchElement: u, disableTouch: d, ...f } = i, v = M(o, [o]), m = It(e, () => ({ isScrollPane: () => !0 }), []), b = O(null);
|
|
341
341
|
V(() => {
|
|
342
|
-
|
|
342
|
+
b.current && (b.current.__scrollTop === n?.top && b.current.__scrollLeft === n?.left || b.current.__isDecelerating || b.current?.scrollTo(n?.left, n?.top, !1));
|
|
343
343
|
}, [n?.left, n?.top, u]);
|
|
344
|
-
const
|
|
345
|
-
|
|
344
|
+
const T = H((p, C) => {
|
|
345
|
+
v?.({ left: p, top: C });
|
|
346
346
|
}, []), _ = H((p) => {
|
|
347
|
-
|
|
348
|
-
}, []),
|
|
349
|
-
p.preventDefault(),
|
|
350
|
-
}, []),
|
|
351
|
-
|
|
352
|
-
}, []),
|
|
353
|
-
|
|
347
|
+
b.current?.doTouchStart(p.touches, p.timeStamp);
|
|
348
|
+
}, []), w = H((p) => {
|
|
349
|
+
p.preventDefault(), b.current?.doTouchMove(p.touches, p.timeStamp);
|
|
350
|
+
}, []), x = H((p) => {
|
|
351
|
+
b.current?.doTouchEnd(p.timeStamp);
|
|
352
|
+
}, []), A = H(({ containerWidth: p, containerHeight: C, totalWidth: g, totalHeight: E }) => {
|
|
353
|
+
b.current.setDimensions(p, C, g, E);
|
|
354
354
|
}, []);
|
|
355
355
|
V(() => {
|
|
356
|
-
const p = u ??
|
|
357
|
-
if (!d &&
|
|
358
|
-
if (!
|
|
356
|
+
const p = u ?? m.current;
|
|
357
|
+
if (!d && Je().supportsTouchEvents && p && n) {
|
|
358
|
+
if (!b.current) {
|
|
359
359
|
const C = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
|
|
360
|
-
|
|
360
|
+
b.current = new En(T, C);
|
|
361
361
|
}
|
|
362
|
-
|
|
362
|
+
Je().supportsTouchEvents && (p.addEventListener("touchstart", _), p.addEventListener("touchend", x), p.addEventListener("touchmove", w)), A({ containerWidth: n?.width, containerHeight: n?.height, totalWidth: n?.totalWidth, totalHeight: n?.totalHeight });
|
|
363
363
|
}
|
|
364
364
|
return () => {
|
|
365
|
-
p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend",
|
|
365
|
+
p?.removeEventListener("touchstart", _), p?.removeEventListener("touchend", x), p?.removeEventListener("touchmove", w);
|
|
366
366
|
};
|
|
367
367
|
}, [n?.width, n?.height, n?.totalWidth, n?.totalHeight, d, u]);
|
|
368
|
-
const [
|
|
369
|
-
const p =
|
|
370
|
-
|
|
368
|
+
const [P, { width: B }] = ge(), [K, { height: y }] = ge(), S = N(() => {
|
|
369
|
+
const p = l({ orientation: se.Vertical, offset: n?.top, viewportSize: n?.height, totalSize: n?.totalHeight, onScrollOffset: (C) => {
|
|
370
|
+
v?.({ top: C });
|
|
371
371
|
} });
|
|
372
|
-
return L("div", { style: { display: "flex", flex: "0" }, ref:
|
|
373
|
-
}, [
|
|
374
|
-
const p =
|
|
375
|
-
return
|
|
376
|
-
}, [
|
|
377
|
-
return L("div", { style: { position: "relative", display: "flex", minWidth:
|
|
372
|
+
return L("div", { style: { display: "flex", flex: "0" }, ref: P, children: p });
|
|
373
|
+
}, [l, n?.top, n?.height, n?.totalHeight]), z = N(() => {
|
|
374
|
+
const p = s({ orientation: se.Horizontal, offset: n?.left, viewportSize: n?.width, totalSize: n?.totalWidth, onScrollOffset: (C) => v?.({ left: C }) });
|
|
375
|
+
return Se("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% - ${B}px)` }, children: L("div", { ref: K, className: "sizer", children: p }) }), a ? h({ width: B, height: y }) : L(ke, {})] });
|
|
376
|
+
}, [s, n?.left, n?.width, n?.totalWidth, a, h, B, y]);
|
|
377
|
+
return L("div", { style: { position: "relative", display: "flex", minWidth: a ? `${B}px` : void 0, minHeight: r ? `${y}px` : void 0, ...c }, ...f, ref: m, children: Se("div", { style: { position: "relative", width: "100%", flex: "1 1 100%", display: "flex", flexDirection: "column", boxSizing: "border-box" }, children: [Se("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: [L("div", { style: { display: "flex", flex: "1 1 100%", overflow: "hidden" }, children: t }), a ? S : L(ke, {})] }), r ? z : L(ke, {})] }) });
|
|
378
378
|
}));
|
|
379
|
-
|
|
380
|
-
let
|
|
381
|
-
function
|
|
382
|
-
const [i, e] =
|
|
379
|
+
Kn.displayName = "ScrollPane";
|
|
380
|
+
let ze = 0;
|
|
381
|
+
function wo() {
|
|
382
|
+
const [i, e] = q(!!document.fullscreenElement), t = H(() => {
|
|
383
383
|
const n = document.fullscreenElement;
|
|
384
384
|
return n ? n.querySelector(".fullscreen-portal-root") || n : document.body;
|
|
385
385
|
}, []);
|
|
@@ -390,42 +390,42 @@ function ho() {
|
|
|
390
390
|
let r = o.querySelector(".fullscreen-portal-root");
|
|
391
391
|
r || (r = document.createElement("div"), r.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", o.appendChild(r));
|
|
392
392
|
}
|
|
393
|
-
return
|
|
394
|
-
document.removeEventListener("fullscreenchange", n),
|
|
393
|
+
return ze++, n(), document.addEventListener("fullscreenchange", n), () => {
|
|
394
|
+
document.removeEventListener("fullscreenchange", n), ze--, ze <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((o) => {
|
|
395
395
|
o.parentNode && o.parentNode.removeChild(o);
|
|
396
|
-
}),
|
|
396
|
+
}), ze = 0);
|
|
397
397
|
};
|
|
398
398
|
}, []), { getPortalContainer: t, isFullscreen: i };
|
|
399
399
|
}
|
|
400
|
-
const
|
|
401
|
-
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap:
|
|
400
|
+
const Rn = 100, In = 100, Nn = 1e6, Hn = 100, Vn = 50, Wn = ye(Ce((i, e) => {
|
|
401
|
+
const { offset: t = 0, viewportSize: n = 0, totalSize: o = 0, minSize: r = 0, endGap: a = Rn, endScrollIncrement: h = In, style: s = Kt, onMouseDown: l, onScrollOffset: c, onScroll: u, scaleLimit: d = Nn, scaleFactor: f = Hn, precisionFactor: v = Vn, ...m } = i;
|
|
402
402
|
u && console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");
|
|
403
|
-
const
|
|
404
|
-
}, []), [
|
|
405
|
-
|
|
406
|
-
if (!
|
|
403
|
+
const b = M(l, [l]), T = () => ({ offset: t, totalSize: d === 0 ? o : Math.min(o ?? 0, Math.max(r ?? 0, (t ?? 0) + (n ?? 0)) + (a ?? 0)) }), [_, w] = q(T), x = d !== 0 && _.totalSize > d ? f : 1, A = x / v, P = Math.ceil(_.totalSize / x), B = Math.ceil(_.offset / x), K = Math.ceil(n / x), y = H((k) => {
|
|
404
|
+
}, []), [S, z] = q(!1), p = O(null);
|
|
405
|
+
Ve(() => {
|
|
406
|
+
if (!S) {
|
|
407
407
|
p.current = { propTotalSize: o, propViewportSize: n, propOffset: t };
|
|
408
|
-
const
|
|
409
|
-
|
|
408
|
+
const k = T();
|
|
409
|
+
w(k);
|
|
410
410
|
}
|
|
411
|
-
}, [o, n, t,
|
|
412
|
-
const C =
|
|
413
|
-
const
|
|
414
|
-
p.current = null,
|
|
415
|
-
}, [
|
|
416
|
-
document.removeEventListener("mousemove",
|
|
417
|
-
}, []), E = H((
|
|
418
|
-
|
|
419
|
-
}, [
|
|
420
|
-
return L(
|
|
411
|
+
}, [o, n, t, S, r, a, h]);
|
|
412
|
+
const C = M((k, J, F) => {
|
|
413
|
+
const j = p.current;
|
|
414
|
+
p.current = null, j && j.propTotalSize === o && j.propViewportSize === n && j.propOffset === t || (Math.abs(k - B) < A && (k = B), c?.(k * x, B, K));
|
|
415
|
+
}, [c, x, A, B, K]), g = H((k) => {
|
|
416
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", g), z(!1);
|
|
417
|
+
}, []), E = H((k) => {
|
|
418
|
+
b?.(k), z(!0), document.addEventListener("mousemove", y, { passive: !0 }), document.addEventListener("mouseup", g, { passive: !0 });
|
|
419
|
+
}, [y, g]);
|
|
420
|
+
return L(ot, { ref: e, style: { ...s }, ...m, offset: B, totalSize: P, viewportSize: K, onMouseDown: E, onScrollOffset: C });
|
|
421
421
|
}));
|
|
422
|
-
|
|
423
|
-
const
|
|
422
|
+
Wn.displayName = "VirtualScrollbar";
|
|
423
|
+
const bo = { 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" };
|
|
424
424
|
function Ye(i, e) {
|
|
425
425
|
if (typeof i == "function") return i(e);
|
|
426
426
|
i && (i.current = e);
|
|
427
427
|
}
|
|
428
|
-
var
|
|
428
|
+
var Ne = parseInt(hn.split(".")[0], 10) >= 19 ? function(i) {
|
|
429
429
|
return (e) => {
|
|
430
430
|
const t = [];
|
|
431
431
|
for (const n of i) {
|
|
@@ -441,132 +441,407 @@ var He = parseInt(on.split(".")[0], 10) >= 19 ? function(i) {
|
|
|
441
441
|
for (const t of i) Ye(t, e);
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
|
-
const
|
|
445
|
-
const { refFocusStart: t, ...n } = i, o =
|
|
444
|
+
const So = ye(Ce((i, e) => {
|
|
445
|
+
const { refFocusStart: t, ...n } = i, o = O(null), r = H(() => {
|
|
446
446
|
if (t) return void t?.current?.focus();
|
|
447
|
-
const
|
|
448
|
-
let
|
|
449
|
-
for (let
|
|
450
|
-
const
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
453
|
-
|
|
447
|
+
const a = o.current.parentElement.children;
|
|
448
|
+
let h = [];
|
|
449
|
+
for (let s = 0; s < a.length && a[s] !== o.current; s++) {
|
|
450
|
+
const l = a[s].getAttribute("tabindex");
|
|
451
|
+
if (l == null || l === "-1" || a[s].getAttribute("disabled") === "true") continue;
|
|
452
|
+
const c = a[s];
|
|
453
|
+
c.focus && h.push({ tabindex: parseInt(l), child: c });
|
|
454
454
|
}
|
|
455
|
-
|
|
456
|
-
return
|
|
457
|
-
}),
|
|
455
|
+
h.length !== 0 && (h.sort(function(s, l) {
|
|
456
|
+
return s.tabindex - l.tabindex;
|
|
457
|
+
}), h[0].child.focus());
|
|
458
458
|
}, [t]);
|
|
459
|
-
return L("div", { tabIndex: 0, ref:
|
|
460
|
-
})),
|
|
461
|
-
const { className: t, style: n, children: o, radius: r = 4, strokeWidth:
|
|
462
|
-
const
|
|
463
|
-
return (function(
|
|
464
|
-
if (
|
|
465
|
-
function
|
|
466
|
-
let
|
|
467
|
-
return g
|
|
459
|
+
return L("div", { tabIndex: 0, ref: Ne([o, e]), onFocus: r, ...n });
|
|
460
|
+
})), Lo = ye(Ce((i, e) => {
|
|
461
|
+
const { className: t, style: n, children: o, radius: r = 4, strokeWidth: a = 1, strokeColor: h = "grey", ...s } = i, [l, { width: c, height: u }] = ge(), d = O(null), f = (T, _ = 0) => {
|
|
462
|
+
const w = T / 2, x = u - w + _;
|
|
463
|
+
return (function(A, P, B = !1) {
|
|
464
|
+
if (P === 0) return A;
|
|
465
|
+
function K(g, E, k) {
|
|
466
|
+
let J = E.x - g.x, F = E.y - g.y, j = Math.sqrt(J * J + F * F);
|
|
467
|
+
return y(g, E, Math.min(1, k / j));
|
|
468
468
|
}
|
|
469
|
-
function g
|
|
470
|
-
return { x:
|
|
469
|
+
function y(g, E, k) {
|
|
470
|
+
return { x: g.x + (E.x - g.x) * k, y: g.y + (E.y - g.y) * k };
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
|
|
472
|
+
function S(g, E) {
|
|
473
|
+
g.length > 2 && (g[g.length - 2] = E.x, g[g.length - 1] = E.y);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
return { x: parseFloat(
|
|
475
|
+
function z(g) {
|
|
476
|
+
return { x: parseFloat(g[g.length - 2]), y: parseFloat(g[g.length - 1]) };
|
|
477
477
|
}
|
|
478
|
-
let p =
|
|
479
|
-
let
|
|
480
|
-
return
|
|
481
|
-
}, []).reduce(function(
|
|
482
|
-
return parseFloat(E) == E &&
|
|
478
|
+
let p = A.split(/[,\s]/).reduce(function(g, E) {
|
|
479
|
+
let k = E.match("([a-zA-Z])(.+)");
|
|
480
|
+
return k ? (g.push(k[1]), g.push(k[2])) : g.push(E), g;
|
|
481
|
+
}, []).reduce(function(g, E) {
|
|
482
|
+
return parseFloat(E) == E && g.length ? g[g.length - 1].push(E) : g.push([E]), g;
|
|
483
483
|
}, []), C = [];
|
|
484
484
|
if (p.length > 1) {
|
|
485
|
-
let
|
|
486
|
-
p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L",
|
|
487
|
-
for (let
|
|
488
|
-
let
|
|
489
|
-
if (
|
|
490
|
-
let
|
|
491
|
-
|
|
492
|
-
let
|
|
493
|
-
|
|
485
|
+
let g = z(p[0]), E = null;
|
|
486
|
+
p[p.length - 1][0] === "Z" && p[0].length > 2 && (E = ["L", g.x, g.y], p[p.length - 1] = E), C.push(p[0]);
|
|
487
|
+
for (let k = 1; k < p.length; k++) {
|
|
488
|
+
let J = C[C.length - 1], F = p[k], j = F === E ? p[1] : p[k + 1];
|
|
489
|
+
if (j && J && J.length > 2 && F[0] === "L" && j.length > 2 && j[0] === "L") {
|
|
490
|
+
let Y, $, W = z(J), X = z(F), ne = z(j);
|
|
491
|
+
B ? (Y = y(X, J.origPoint || W, P), $ = y(X, j.origPoint || ne, P)) : (Y = K(X, W, P), $ = K(X, ne, P)), S(F, Y), F.origPoint = X, C.push(F);
|
|
492
|
+
let ve = y(Y, X, 0.5), xe = y(X, $, 0.5), R = ["C", ve.x, ve.y, xe.x, xe.y, $.x, $.y];
|
|
493
|
+
R.origPoint = X, C.push(R);
|
|
494
494
|
} else C.push(F);
|
|
495
495
|
}
|
|
496
496
|
if (E) {
|
|
497
|
-
let
|
|
498
|
-
C.push(["Z"]),
|
|
497
|
+
let k = z(C[C.length - 1]);
|
|
498
|
+
C.push(["Z"]), S(C[0], k);
|
|
499
499
|
}
|
|
500
500
|
} else C = p;
|
|
501
|
-
return C.reduce(function(
|
|
502
|
-
return
|
|
501
|
+
return C.reduce(function(g, E) {
|
|
502
|
+
return g + E.join(" ") + " ";
|
|
503
503
|
}, "");
|
|
504
|
-
})(`${`M 0 ${
|
|
505
|
-
},
|
|
504
|
+
})(`${`M 0 ${w} L ${r - 0.5} ${w} L ${r - 0.5} ${x} L ${2 * r} ${x}`} ${`L ${c - 2 * r} ${x}`} ${`M ${c - 2 * r} ${x} L ${c - r} ${x} L ${c - r} ${w} L ${c} ${w}`}`, r);
|
|
505
|
+
}, v = N(() => f(a), [c, u, r, a]), m = N(() => {
|
|
506
506
|
if (r === 0) return;
|
|
507
|
-
const
|
|
508
|
-
return
|
|
509
|
-
}, [
|
|
510
|
-
return
|
|
511
|
-
})),
|
|
512
|
-
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled:
|
|
513
|
-
return L("div", { style: { ...t, position: "relative" }, ...
|
|
514
|
-
}, Be = {},
|
|
507
|
+
const T = r / 2;
|
|
508
|
+
return f(r) + `L ${c} 0 L 0 0 L 0 ${T}`;
|
|
509
|
+
}, [v, r, a]), b = N(() => ({ style: { clipPath: `path('${m}')` } }), [m]);
|
|
510
|
+
return Se("div", { className: t, style: { display: "flex", flexDirection: "row", ...n }, ...s, ref: Ne([d, l, e]), children: [ie.isValidElement(o) ? ie.cloneElement(o, b) : L(ke, {}), L("svg", { style: { position: "absolute", top: 0, left: 0, pointerEvents: "none" }, width: c, height: u, viewBox: `0 0 ${c} ${u}`, children: L("path", { d: v, stroke: h, fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: a }) })] });
|
|
511
|
+
})), Fn = {}, jn = (i) => {
|
|
512
|
+
const { onPointerDown: e, style: t, splitDirection: n, paddingBefore: o = 0, paddingAfter: r = 0, disabled: a, key: h, hitAreaProps: s = Fn, ...l } = i, c = n === "row", { style: u, className: d, ...f } = s;
|
|
513
|
+
return L("div", { style: { ...t, position: "relative" }, ...l, children: L("div", { className: we("hit-box", d), style: { left: (c ? -o : 0) + "px", width: `calc(100% + ${c ? o + r : 0}px)`, top: (c ? 0 : -o) + "px", height: `calc(100% + ${c ? 0 : o + r}px)`, position: "absolute", ...u }, onPointerDown: a ? void 0 : e, ...f }) }, h);
|
|
514
|
+
}, Be = {}, _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, Oe = (i, e = !0) => i?.percent ? `${e ? i.percent : 100 - i.percent}%` : i?.pixels ? `${i.pixels}px` : void 0, de = (i, e) => {
|
|
515
515
|
if (i == null) return null;
|
|
516
516
|
const t = { percent: null, pixels: null };
|
|
517
517
|
let n = e;
|
|
518
518
|
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);
|
|
519
|
-
},
|
|
520
|
-
const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position:
|
|
519
|
+
}, Co = ye(Ce((i, e) => {
|
|
520
|
+
const { elementBefore: t, elementAfter: n, splitDirection: o = "row", fixedPane: r = null, position: a, onPositionChange: h, minBefore: s, maxBefore: l, minAfter: c, maxAfter: u, children: d, className: f, style: v, disabled: m = !1, onDragStart: b, onDragResize: T, onDragFinish: _, resizerProps: w = Be, paneProps: x = Be, paneBeforeProps: A = Be, paneAfterProps: P = Be, createResizer: B = jn } = i;
|
|
521
521
|
if (d) throw new Error("Use elementBefore and elementAfter instead of children.");
|
|
522
|
-
const
|
|
523
|
-
let
|
|
524
|
-
r && (r === "before" ?
|
|
525
|
-
const
|
|
526
|
-
return { fixedPaneOffset:
|
|
527
|
-
}, [
|
|
522
|
+
const K = N(() => ie.isValidElement(n) && ie.isValidElement(t), [n, t]), y = N(() => {
|
|
523
|
+
let D = null;
|
|
524
|
+
r && (r === "before" ? D = 0 : r === "after" && (D = 1));
|
|
525
|
+
const I = D === null;
|
|
526
|
+
return { fixedPaneOffset: D, isPercent: I, minBefore: de(s, I), maxBefore: de(l, I), minAfter: de(c, I), maxAfter: de(u, I) };
|
|
527
|
+
}, [s, l, c, u]), S = M(h, [h]), [z, p] = q(() => de(a, r === null));
|
|
528
528
|
V(() => {
|
|
529
|
-
p(de(
|
|
530
|
-
}, [
|
|
531
|
-
const [C, { width:
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
let ue =
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
return oe[0] =
|
|
538
|
-
})(
|
|
539
|
-
const
|
|
540
|
-
p(
|
|
541
|
-
}, [r]),
|
|
542
|
-
if (
|
|
543
|
-
const
|
|
544
|
-
let
|
|
545
|
-
|
|
546
|
-
}, [
|
|
547
|
-
if (document.removeEventListener("pointermove",
|
|
548
|
-
if (
|
|
549
|
-
const
|
|
550
|
-
|
|
529
|
+
p(de(a, r === null));
|
|
530
|
+
}, [a, r]);
|
|
531
|
+
const [C, { width: g, height: E }] = ge(), [k, { width: J, height: F }] = ge(), j = o === "row" ? J : F, Y = o === "row" ? g : E, $ = N(() => ((D, I, Q, U) => {
|
|
532
|
+
const ce = [null, null], oe = [null, null];
|
|
533
|
+
if (D || (D = { percent: U.fixedPaneOffset === null ? 50 : null, pixels: U.fixedPaneOffset === null ? null : 0 }), I === 0) return D?.pixels != null ? U.fixedPaneOffset !== 1 ? (ce[0] = D?.pixels, oe[1] = 100) : (ce[1] = D?.pixels - Q, oe[0] = 100) : D?.percent != null && (U.fixedPaneOffset !== 1 ? (oe[0] = D?.percent, oe[1] = 100 - D?.percent) : (oe[1] = D?.percent, oe[0] = 100 - D?.percent)), { percents: oe, pixels: ce, minBefore: Oe(U.minBefore, !0), maxBefore: Oe(U.maxBefore, !0), minAfter: Oe(U.minAfter), maxAfter: Oe(U.maxAfter) };
|
|
534
|
+
let ue = _e(D, I, U.fixedPaneOffset !== 1), te = I - Q, ut = _e(U.minBefore, te, !0) ?? 0, ln = _e(U.maxBefore, te, !0) ?? te, Ae = 0, We = 0, dt = 0, pt = te;
|
|
535
|
+
Ae = (_e(U.maxAfter, I, !1) ?? Q) - Q, We = _e(U.minAfter, I, !1) ?? I, dt = Math.max(ut, Ae), pt = Math.min(ln, We), ue = Math.max(dt, Math.min(ue, pt)), We = Math.min(te - ue, _e(U.maxAfter, te - ue, !0) ?? te), Ae = Math.min(te - ue, _e(U.minAfter, te - ue, !0) ?? te), ce[0] = ue, ce[1] = te - ce[0];
|
|
536
|
+
const an = Math.max(0, Math.min(100, ue / te * 100));
|
|
537
|
+
return oe[0] = an, oe[1] = 100 - oe[0], { percents: oe, pixels: ce, minBefore: `${ut}px`, minAfter: `${Ae}px`, maxBefore: `${ce[0]}px`, maxAfter: `${ce[1]}px` };
|
|
538
|
+
})(z, Y, j, y), [y, z, Y, j, o]), [W, X] = q(!1), ne = M(b, [b]), ve = M(T, [T]), xe = M(_, [_]), R = O(null), le = O(null), re = O(null), { style: fe, className: ae, ...he } = x, Ee = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...fe }, { className: Yt, style: Xt, ...Ut } = A, { className: Gt, style: Zt, ...qt } = P, Jt = { flex: "1 1 100%", width: "100%", ...v, flexDirection: o, display: "flex" }, { className: rt, style: st, onPointerDown: lt, ...at } = w, Qt = M((D) => {
|
|
539
|
+
const I = de(D, r === null);
|
|
540
|
+
p(I);
|
|
541
|
+
}, [r]), De = M((D) => {
|
|
542
|
+
if (m || !W) return;
|
|
543
|
+
const I = ht.current?.getBoundingClientRect();
|
|
544
|
+
let Q = 0;
|
|
545
|
+
Q = o === "row" ? (D.clientX ?? D.touches?.[0]?.clientX) - I.x : (D.clientY ?? D.touches?.[0]?.clientY) - I.y, Q = Math.max(0, Math.min(Y, Q)), y.fixedPaneOffset === 1 && (Q = Y - Q), a && z.pixels === Q || p({ pixels: Q, percent: null }), ve?.(Q), D.stopPropagation(), D.preventDefault();
|
|
546
|
+
}, [y, o, m, W, z, Y]), ct = M((D) => {
|
|
547
|
+
if (document.removeEventListener("pointermove", De), document.removeEventListener("touchmove", De), document.removeEventListener("pointerup", ct), !!W && (X(!1), !!z)) {
|
|
548
|
+
if (xe(z.pixels), !de(a, r === null) || z.pixels !== a) {
|
|
549
|
+
const I = { ...z };
|
|
550
|
+
I.percent === null && (I.percent = I.pixels / Y * 100), S(I);
|
|
551
551
|
}
|
|
552
|
-
|
|
552
|
+
D.stopPropagation(), D.preventDefault();
|
|
553
|
+
}
|
|
554
|
+
}, [z, W, a, r, Y]), en = M((D) => {
|
|
555
|
+
lt?.(D), D.defaultPrevented || m || W || (X(!0), ne(), document.addEventListener("pointermove", De, { passive: !1 }), document.addEventListener("touchmove", De, { passive: !1 }), document.addEventListener("pointerup", ct, { passive: !1 }));
|
|
556
|
+
}, [lt]), ht = It(e, () => ({ setPosition: Qt, isSplitPane: () => !0 }), []), tn = N(() => K ? B?.({ key: "resizer", ref: Ne([k, le]), className: we("resizer", rt), onPointerDownCapture: en, style: { cursor: m ? 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, ...st }, splitDirection: o, disabled: m, ...at }) : null, [K, rt, at, o, st, m]), Pe = o === "row" ? "Width" : "Height", nn = { ...Ee, ...Xt, flex: y.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%" }, on = { ...Ee, ...Zt, flex: y.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%" }, rn = N(() => t ? L("div", { ref: R, className: we("before", ae, Yt), style: nn, ...he, ...Ut, children: t }, "before") : null, [t, x, A, y, $]), sn = N(() => n ? L("div", { ref: re, className: we("after", ae, Gt), style: on, ...he, ...qt, children: n }, "after") : null, [n, x, P, y, $]);
|
|
557
|
+
return Se("div", { ref: Ne([C, ht]), className: we("splitPane", o === "row" ? "vertical" : "horizontal", { dragging: W }, f), style: Jt, children: [rn, tn, sn] });
|
|
558
|
+
}));
|
|
559
|
+
function Yn(i) {
|
|
560
|
+
if (typeof i == "function") return i;
|
|
561
|
+
if (typeof i == "string") {
|
|
562
|
+
const e = i.trim();
|
|
563
|
+
if (e.startsWith("data:image/svg+xml")) {
|
|
564
|
+
const t = (function(n) {
|
|
565
|
+
const o = /^data:image\/svg\+xml(;[^,]*)?,(.*)$/i.exec(n.trim());
|
|
566
|
+
if (!o) return null;
|
|
567
|
+
const r = o[1] || "", a = o[2] || "";
|
|
568
|
+
try {
|
|
569
|
+
if (/;base64/i.test(r)) {
|
|
570
|
+
if (typeof atob < "u") {
|
|
571
|
+
const h = atob(a);
|
|
572
|
+
if (typeof TextDecoder < "u") {
|
|
573
|
+
const l = new Uint8Array(h.length);
|
|
574
|
+
for (let c = 0; c < h.length; c++) l[c] = h.charCodeAt(c);
|
|
575
|
+
return new TextDecoder("utf-8").decode(l);
|
|
576
|
+
}
|
|
577
|
+
let s = "";
|
|
578
|
+
for (let l = 0; l < h.length; l++)
|
|
579
|
+
s += `%${h.charCodeAt(l).toString(16).padStart(2, "0")}`;
|
|
580
|
+
return decodeURIComponent(s);
|
|
581
|
+
}
|
|
582
|
+
return (globalThis.Buffer ? globalThis.Buffer.from(a, "base64") : require("buffer").Buffer.from(a, "base64")).toString("utf-8");
|
|
583
|
+
}
|
|
584
|
+
try {
|
|
585
|
+
return decodeURIComponent(a);
|
|
586
|
+
} catch {
|
|
587
|
+
return a;
|
|
588
|
+
}
|
|
589
|
+
} catch {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
})(e);
|
|
593
|
+
if (t) return St(t);
|
|
594
|
+
}
|
|
595
|
+
if (e.startsWith("<")) {
|
|
596
|
+
if (/^<\s*svg\b/i.test(e)) return St(e);
|
|
597
|
+
if (/^<\s*path\b/i.test(e)) {
|
|
598
|
+
const t = wt(e);
|
|
599
|
+
if (t) return { paths: [{ d: t }] };
|
|
600
|
+
}
|
|
601
|
+
return { paths: [{ d: e }] };
|
|
602
|
+
}
|
|
603
|
+
return { paths: [{ d: e }] };
|
|
604
|
+
}
|
|
605
|
+
if (Array.isArray(i)) {
|
|
606
|
+
const e = [];
|
|
607
|
+
for (const t of i) if (typeof t == "string") {
|
|
608
|
+
const n = String(t).trim();
|
|
609
|
+
if (n.startsWith("<path")) {
|
|
610
|
+
const o = wt(n);
|
|
611
|
+
o && e.push({ d: o });
|
|
612
|
+
} else e.push({ d: n });
|
|
613
|
+
} else t && typeof t == "object" && "d" in t && typeof t.d == "string" && e.push({ ...t });
|
|
614
|
+
return { paths: e };
|
|
615
|
+
}
|
|
616
|
+
return i;
|
|
617
|
+
}
|
|
618
|
+
function wt(i) {
|
|
619
|
+
const e = /\bd\s*=\s*(?:"([^"]+)"|'([^']+)')/i.exec(i);
|
|
620
|
+
return e ? e[1] ?? e[2] ?? null : null;
|
|
621
|
+
}
|
|
622
|
+
function bt(i) {
|
|
623
|
+
if ("svg" in i) return { ...i, svg: Yn(i.svg) };
|
|
624
|
+
if ("url" in i) {
|
|
625
|
+
const e = typeof i.url == "string" ? { src: i.url } : i.url;
|
|
626
|
+
return { ...i, url: e };
|
|
627
|
+
}
|
|
628
|
+
if ("emoji" in i) {
|
|
629
|
+
const e = typeof i.emoji == "string" ? i.emoji : i.emoji.text;
|
|
630
|
+
return { ...i, emoji: e };
|
|
631
|
+
}
|
|
632
|
+
return i;
|
|
633
|
+
}
|
|
634
|
+
function St(i) {
|
|
635
|
+
try {
|
|
636
|
+
if (typeof DOMParser < "u") {
|
|
637
|
+
const a = new DOMParser().parseFromString(i, "image/svg+xml"), h = a.querySelector("svg"), s = h?.getAttribute("viewBox") ?? void 0, l = [];
|
|
638
|
+
return a.querySelectorAll("path").forEach((c) => {
|
|
639
|
+
const u = c.getAttribute("d");
|
|
640
|
+
if (!u) return;
|
|
641
|
+
const d = { d: u }, f = c.getAttribute("class");
|
|
642
|
+
f && (d.className = f);
|
|
643
|
+
const v = c.getAttribute("fill");
|
|
644
|
+
v && v !== "none" && (d.fill = v);
|
|
645
|
+
const m = c.getAttribute("stroke");
|
|
646
|
+
m && (d.stroke = m);
|
|
647
|
+
const b = c.getAttribute("opacity");
|
|
648
|
+
b && (d.opacity = Number(b));
|
|
649
|
+
const T = c.getAttribute("fill-rule");
|
|
650
|
+
T && (d.fillRule = T);
|
|
651
|
+
const _ = c.getAttribute("clip-rule");
|
|
652
|
+
_ && (d.clipRule = _), l.push(d);
|
|
653
|
+
}), { viewBox: s, paths: l };
|
|
654
|
+
}
|
|
655
|
+
} catch {
|
|
656
|
+
}
|
|
657
|
+
const e = i.match(/viewBox="([^"]+)"/i), t = e ? e[1] : void 0, n = [], o = /<path\b[^>]*\sd="([^"]+)"[^>]*>/gi;
|
|
658
|
+
let r;
|
|
659
|
+
for (; r = o.exec(i); ) n.push({ d: r[1] });
|
|
660
|
+
return { viewBox: t, paths: n };
|
|
661
|
+
}
|
|
662
|
+
function Lt(i) {
|
|
663
|
+
const e = {};
|
|
664
|
+
for (const [r, a] of Object.entries(i.icons)) e[r] = bt(a);
|
|
665
|
+
const t = { label: i.meta?.label ?? "Unnamed", version: i.meta?.version ?? "1.0.0", license: i.meta?.license ?? "MIT", defaultViewBox: "0 0 24 24", extends: i.meta?.extends ?? [] };
|
|
666
|
+
t.extends.includes("base") || t.extends.push("base");
|
|
667
|
+
const n = { meta: t, icons: e }, o = i.overrides;
|
|
668
|
+
if (o) {
|
|
669
|
+
const r = {};
|
|
670
|
+
for (const [a, h] of Object.entries(o)) {
|
|
671
|
+
const s = {};
|
|
672
|
+
for (const [l, c] of Object.entries(h)) s[l] = bt(c);
|
|
673
|
+
r[a] = s;
|
|
674
|
+
}
|
|
675
|
+
n.__overrides = r;
|
|
676
|
+
}
|
|
677
|
+
return n;
|
|
678
|
+
}
|
|
679
|
+
function Xn() {
|
|
680
|
+
const i = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
|
|
681
|
+
let t = "base", n = /* @__PURE__ */ new Map();
|
|
682
|
+
async function o(s) {
|
|
683
|
+
const l = i.get(s ?? t);
|
|
684
|
+
if (!l) throw new Error(`Icon pack not registered: ${s}`);
|
|
685
|
+
if (!l.pack) {
|
|
686
|
+
if (!l.loading) {
|
|
687
|
+
if (!l.loader) throw new Error(`No loader for icon pack: ${s}`);
|
|
688
|
+
l.loading = l.loader().then((c) => {
|
|
689
|
+
const u = c && typeof c == "object" && "default" in c ? c.default : c;
|
|
690
|
+
l.pack = Lt(u);
|
|
691
|
+
}).catch((c) => {
|
|
692
|
+
throw l.loading = void 0, c;
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
await l.loading;
|
|
553
696
|
}
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
697
|
+
}
|
|
698
|
+
function r(s) {
|
|
699
|
+
const l = s.indexOf(":");
|
|
700
|
+
return l > 0 ? { ns: s.slice(0, l), key: s.slice(l + 1) } : { key: s };
|
|
701
|
+
}
|
|
702
|
+
function a(s, l) {
|
|
703
|
+
const c = [s, ...i.get(s)?.pack?.meta.extends ?? []];
|
|
704
|
+
for (const u of c) {
|
|
705
|
+
const d = i.get(u);
|
|
706
|
+
if (!d?.pack) continue;
|
|
707
|
+
const { icons: f } = d.pack, v = f[e.get(u)?.get(l) ?? l] ?? f[l];
|
|
708
|
+
if (v) return { glyph: v, pack: d.pack, packKey: u };
|
|
709
|
+
}
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
function h(s, l) {
|
|
713
|
+
const c = l?.packKey ?? t;
|
|
714
|
+
if (l?.packKey) return a(l.packKey, s);
|
|
715
|
+
if (!s) return null;
|
|
716
|
+
const { ns: u, key: d } = r(s);
|
|
717
|
+
if (u) {
|
|
718
|
+
const f = i.get(u)?.pack;
|
|
719
|
+
if (f) {
|
|
720
|
+
if (i.get(t)?.pack) {
|
|
721
|
+
const m = f.__overrides, b = m?.[t]?.[d];
|
|
722
|
+
if (b) return { glyph: b, pack: f, packKey: u };
|
|
723
|
+
}
|
|
724
|
+
const v = a(u, d);
|
|
725
|
+
if (v) return v;
|
|
726
|
+
}
|
|
727
|
+
return null;
|
|
728
|
+
}
|
|
729
|
+
return a(c, s);
|
|
730
|
+
}
|
|
731
|
+
return { register: function(s, l) {
|
|
732
|
+
const c = i.get(s) ?? {};
|
|
733
|
+
typeof l == "function" ? c.loader = l : c.pack = Lt(l), i.set(s, c), t || (t = s);
|
|
734
|
+
}, prefetch: async function(s = t) {
|
|
735
|
+
const l = Array.isArray(s) ? s : [s];
|
|
736
|
+
await Promise.all(l.map(o));
|
|
737
|
+
}, setActive: function(s) {
|
|
738
|
+
t = s;
|
|
739
|
+
for (const l of n.keys()) try {
|
|
740
|
+
l(s);
|
|
741
|
+
} catch {
|
|
742
|
+
}
|
|
743
|
+
}, getActive: function() {
|
|
744
|
+
return t;
|
|
745
|
+
}, resolve: async function(s, l) {
|
|
746
|
+
let c = h(s, l);
|
|
747
|
+
if (c) return c;
|
|
748
|
+
const u = l?.packKey ?? t, { ns: d } = r(s);
|
|
749
|
+
if (l?.packKey) {
|
|
750
|
+
if (await o(u), c = h(s, l), c) return c;
|
|
751
|
+
const f = i.get(u)?.pack?.meta?.extends ?? [];
|
|
752
|
+
if (f.length && (await Promise.all(f.map(o)), c = h(s, l), c)) return c;
|
|
753
|
+
} else if (d) {
|
|
754
|
+
if (await o(d), c = h(s, l), c) return c;
|
|
755
|
+
const f = i.get(d)?.pack?.meta?.extends ?? [];
|
|
756
|
+
if (f.length && (await Promise.all(f.map(o)), c = h(s, l), c)) return c;
|
|
757
|
+
} else {
|
|
758
|
+
if (await o(u), c = h(s, l), c) return c;
|
|
759
|
+
const f = i.get(u)?.pack?.meta?.extends ?? [];
|
|
760
|
+
if (f.length && (await Promise.all(f.map(o)), c = h(s, l), c)) return c;
|
|
761
|
+
}
|
|
762
|
+
return null;
|
|
763
|
+
}, registerAlias: function(s, l, c) {
|
|
764
|
+
e.has(s) || e.set(s, /* @__PURE__ */ new Map()), e.get(s).set(l, c);
|
|
765
|
+
}, has: function(s, l) {
|
|
766
|
+
return !!h(s, l);
|
|
767
|
+
}, getPack: function(s) {
|
|
768
|
+
return i.get(s ?? t)?.pack;
|
|
769
|
+
}, hasPack: function(s) {
|
|
770
|
+
return !!i.get(s)?.pack;
|
|
771
|
+
}, listPacks: function() {
|
|
772
|
+
return Array.from(i.keys());
|
|
773
|
+
}, listIcons: function(s) {
|
|
774
|
+
const l = i.get(s)?.pack;
|
|
775
|
+
return l ? Object.keys(l.icons) : [];
|
|
776
|
+
}, addActiveListener: function(s) {
|
|
777
|
+
const l = n.get(s);
|
|
778
|
+
if (l) return l;
|
|
779
|
+
const c = () => {
|
|
780
|
+
n.delete(s);
|
|
781
|
+
};
|
|
782
|
+
return n.set(s, c), c;
|
|
783
|
+
} };
|
|
784
|
+
}
|
|
785
|
+
const Ke = Xn();
|
|
786
|
+
Ke.register("base", () => import("./CxY-6HIFmPob67ga.mjs"));
|
|
787
|
+
const Ct = (i) => L("svg", { ...i, children: L("path", {}) }), Un = { Icon: "_Icon_1ipwo_10" }, Gn = ye((i) => {
|
|
788
|
+
const { iconKey: e, packKey: t, className: n, style: o, role: r, title: a, size: h, ariaHidden: s, sourceProps: l, children: c, ...u } = i, [d, f] = ie.useState(null);
|
|
789
|
+
ie.useEffect(() => {
|
|
790
|
+
let p = !0, C = t, g = e;
|
|
791
|
+
if (!g) {
|
|
792
|
+
const E = Ke.getPack(C);
|
|
793
|
+
return void f({ glyph: E ? { svg: Z.EmptyArray } : void 0, pack: E ?? void 0, packKey: C ?? Ke.getActive() });
|
|
794
|
+
}
|
|
795
|
+
if (g.includes(":")) {
|
|
796
|
+
const [E, k] = g.split(":");
|
|
797
|
+
C = E, g = k;
|
|
798
|
+
}
|
|
799
|
+
return Ke.resolve(g, { packKey: C }).then((E) => {
|
|
800
|
+
p && f(E);
|
|
801
|
+
}), () => {
|
|
802
|
+
p = !1;
|
|
803
|
+
};
|
|
804
|
+
}, [e, t]);
|
|
805
|
+
const v = d?.pack, m = d?.glyph, b = d?.packKey;
|
|
806
|
+
let T = m ? m.svg : void 0;
|
|
807
|
+
const _ = m && !T ? m.url : void 0, w = !m || T || _ ? void 0 : m.emoji, x = h != null ? typeof h == "number" ? `${h}px` : h : void 0, A = N(() => [Un.Icon, "icon", n].filter(Boolean).join(" "), [n]), P = N(() => {
|
|
808
|
+
const p = { ...o };
|
|
809
|
+
return p["--icon-size"] = x, p;
|
|
810
|
+
}, [o, x]), B = r ?? (a ? "img" : "presentation"), K = s ?? (!a || void 0), y = (p) => L("span", { className: A, style: P, role: B, "aria-hidden": K, title: a, "data-icon-glyph": e, "data-icon-pack": b, ...u, children: p });
|
|
811
|
+
if (c) return y(c);
|
|
812
|
+
if (w) return y(L("span", { children: typeof w == "string" ? w : w.text }));
|
|
813
|
+
if (_) return y(L("img", { src: _.src, alt: a ?? "" }));
|
|
814
|
+
if (m && "react" in m) {
|
|
815
|
+
const p = m.react, C = { className: A, style: P, role: B, "aria-hidden": K, title: a, ...u, ...l };
|
|
816
|
+
return y(L(p, { ...C }));
|
|
817
|
+
}
|
|
818
|
+
const S = { viewBox: T?.viewBox ?? v?.meta.defaultViewBox ?? "0 0 24 24" };
|
|
819
|
+
if (typeof T == "function")
|
|
820
|
+
return y(T(S) ?? L(Ct, { ...S }));
|
|
821
|
+
if (!T) return y(L(Ct, { ...S }));
|
|
822
|
+
const z = T.paths;
|
|
823
|
+
return y(L("svg", { ...S, children: z ? z.map((p, C) => L("path", { d: p.d, className: p.className, fill: p.fill, stroke: p.stroke, opacity: p.opacity, fillRule: p.fillRule, clipRule: p.clipRule }, C)) : null }));
|
|
824
|
+
});
|
|
825
|
+
function Eo(i) {
|
|
826
|
+
const { isWalking: e = !1, themedType: t = "info", speed: n = 120, dashGap: o = 3, dashLength: r = 5, iconKey: a, packKey: h, style: s, className: l, ...c } = i, u = N(() => {
|
|
827
|
+
if (!e) return;
|
|
828
|
+
const f = { "--walk-duration": `${n * (o + r)}ms`, "--walk-dash-length": `${r}px`, "--walk-dash-gap": `${o}px` };
|
|
829
|
+
return t && t !== "accent" && (f["--icon-accent"] = `var(--icon-${t})`), f;
|
|
830
|
+
}, [e, n, o, r, t]), d = N(() => e ? l + " walking" : l, [e, l]);
|
|
831
|
+
return L(Gn, { iconKey: a, packKey: h, className: d, style: { ...s, ...u }, ...c });
|
|
832
|
+
}
|
|
833
|
+
const Et = { Default: "default", Error: "error", Success: "success", Warning: "warning", Info: "info" };
|
|
834
|
+
class Zn extends _n {
|
|
835
|
+
setOverrides(e) {
|
|
836
|
+
super.setOverrides(e);
|
|
562
837
|
}
|
|
563
838
|
getDelegate() {
|
|
564
|
-
return this.
|
|
839
|
+
return this._overrides;
|
|
565
840
|
}
|
|
566
841
|
showMessage(e, t) {
|
|
567
842
|
const n = this.getDelegate();
|
|
568
843
|
if (n?.showMessage) return n.showMessage(e, t);
|
|
569
|
-
t?.type !==
|
|
844
|
+
t?.type !== Et.Warning ? t?.type !== Et.Error ? me.log(e) : me.error(e) : me.warn(e);
|
|
570
845
|
}
|
|
571
846
|
showBusy(e, t) {
|
|
572
847
|
const n = this.getDelegate();
|
|
@@ -581,7 +856,7 @@ class Vn extends cn {
|
|
|
581
856
|
}
|
|
582
857
|
showError(e) {
|
|
583
858
|
const t = this.getDelegate();
|
|
584
|
-
t?.showError ? t.showError(e) :
|
|
859
|
+
t?.showError ? t.showError(e) : me.error(e);
|
|
585
860
|
}
|
|
586
861
|
showOptions(e) {
|
|
587
862
|
const t = this.getDelegate();
|
|
@@ -592,14 +867,14 @@ class Vn extends cn {
|
|
|
592
867
|
return t?.showInputOptions ? t.showInputOptions(e) : Promise.resolve({ input: "", option: "" });
|
|
593
868
|
}
|
|
594
869
|
}
|
|
595
|
-
const
|
|
596
|
-
const t =
|
|
597
|
-
return
|
|
598
|
-
|
|
870
|
+
const Nt = un(new Zn()), To = ({ children: i, notifier: e }) => (ie.useEffect(() => {
|
|
871
|
+
const t = me.getOverrides();
|
|
872
|
+
return me.setOverrides(e), () => {
|
|
873
|
+
me.setOverrides(t);
|
|
599
874
|
};
|
|
600
|
-
}, [e]),
|
|
601
|
-
function
|
|
602
|
-
const [e, t] =
|
|
875
|
+
}, [e]), ie.createElement(Nt.Provider, { value: e }, i)), Ht = () => dn(Nt);
|
|
876
|
+
function Mo(i) {
|
|
877
|
+
const [e, t] = q(typeof window < "u" ? window.devicePixelRatio : 1), n = O(null);
|
|
603
878
|
return V(() => {
|
|
604
879
|
if (!(typeof window < "u" && "matchMedia" in window)) return;
|
|
605
880
|
const o = () => {
|
|
@@ -611,13 +886,13 @@ function go(i) {
|
|
|
611
886
|
};
|
|
612
887
|
}, [i]), e;
|
|
613
888
|
}
|
|
614
|
-
function
|
|
889
|
+
function ko(i) {
|
|
615
890
|
if (typeof window > "u") return 1;
|
|
616
891
|
const { defaultDpr: e = 1, maxDpr: t = 3, round: n = !0 } = i || {}, o = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : e;
|
|
617
892
|
return Math.min(Math.max(1, n ? Math.floor(o) : o), t);
|
|
618
893
|
}
|
|
619
|
-
function
|
|
620
|
-
const n =
|
|
894
|
+
function Do(i, e, t) {
|
|
895
|
+
const n = M(e, [e]);
|
|
621
896
|
V(() => {
|
|
622
897
|
const o = (r) => {
|
|
623
898
|
i.current && !i.current.contains(r.target) && n(r);
|
|
@@ -627,108 +902,108 @@ function vo(i, e, t) {
|
|
|
627
902
|
};
|
|
628
903
|
}, [i]);
|
|
629
904
|
}
|
|
630
|
-
function
|
|
905
|
+
function qn(i) {
|
|
631
906
|
if (!i) throw new Error("must have a PointerHandlerOptions");
|
|
632
|
-
const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i,
|
|
633
|
-
|
|
634
|
-
}, []),
|
|
635
|
-
|
|
907
|
+
const { onPointerDown: e, onPointerUp: t, onPointerMoveOrWait: n, processTouch: o = !1, consumeTouch: r = !0 } = i, a = M(e, [e]), h = M(t, [t]), s = M(n, [n]), l = O(!1), c = i?.timerInitial ?? 230, u = i?.timerContinuous ?? c / 2, d = O(null), f = O(null), v = O(null), m = O(null), b = H(() => {
|
|
908
|
+
m.current && (clearTimeout(m.current), m.current = null);
|
|
909
|
+
}, []), T = H((S) => {
|
|
910
|
+
m.current = setTimeout(() => {
|
|
636
911
|
window.requestAnimationFrame(() => {
|
|
637
|
-
|
|
638
|
-
}),
|
|
639
|
-
},
|
|
912
|
+
l.current !== !1 && s?.(f.current, v.current, d.current);
|
|
913
|
+
}), T(u);
|
|
914
|
+
}, S ?? c);
|
|
640
915
|
}, []);
|
|
641
|
-
V(() => () =>
|
|
642
|
-
const _ = o ? "pointer" : "mouse",
|
|
643
|
-
|
|
644
|
-
}, []),
|
|
645
|
-
document.removeEventListener(`${_}move`,
|
|
646
|
-
|
|
916
|
+
V(() => () => b(), []);
|
|
917
|
+
const _ = o ? "pointer" : "mouse", w = H((S) => {
|
|
918
|
+
S.stopPropagation(), S.stopImmediatePropagation(), S.preventDefault();
|
|
919
|
+
}, []), x = M((S) => {
|
|
920
|
+
document.removeEventListener(`${_}move`, B), document.removeEventListener(`${_}up`, x), document.removeEventListener("keydown", K), document.removeEventListener("keyup", y), document.removeEventListener("touchstart", w, { capture: !0 }), document.removeEventListener("touchmove", w, { capture: !0 }), window.removeEventListener("blur", A), b(), window.requestAnimationFrame(() => {
|
|
921
|
+
l.current !== !1 && (l.current = !1, h?.(S, v.current, d.current), v.current = null);
|
|
647
922
|
});
|
|
648
|
-
}, []),
|
|
649
|
-
|
|
650
|
-
}, []),
|
|
651
|
-
|
|
652
|
-
|
|
923
|
+
}, []), A = H(() => {
|
|
924
|
+
l.current !== !1 && (l.current = !1, x(f.current));
|
|
925
|
+
}, []), P = M(() => {
|
|
926
|
+
b(), T(u), window.requestAnimationFrame(() => {
|
|
927
|
+
l.current !== !1 && s?.(f.current, v.current, d.current);
|
|
653
928
|
});
|
|
654
|
-
}, [u]),
|
|
655
|
-
|
|
656
|
-
}, []),
|
|
657
|
-
|
|
658
|
-
}, []),
|
|
659
|
-
|
|
929
|
+
}, [u]), B = M((S) => {
|
|
930
|
+
f.current = S, P();
|
|
931
|
+
}, []), K = M((S) => {
|
|
932
|
+
v.current = { ctrlKey: S.ctrlKey, shiftKey: S.shiftKey, altKey: S.altKey, metaKey: S.metaKey }, P();
|
|
933
|
+
}, []), y = M((S) => {
|
|
934
|
+
v.current = { ctrlKey: S.ctrlKey, shiftKey: S.shiftKey, altKey: S.altKey, metaKey: S.metaKey }, P();
|
|
660
935
|
}, [u]);
|
|
661
|
-
return
|
|
662
|
-
|
|
663
|
-
}, [
|
|
936
|
+
return M((S) => {
|
|
937
|
+
S.isDefaultPrevented() || (v.current = { ctrlKey: S.ctrlKey, shiftKey: S.shiftKey, altKey: S.altKey, metaKey: S.metaKey }, a(S, v.current) !== !1 && (d.current = S, f.current = S.nativeEvent, document.addEventListener(`${_}up`, x, { passive: !1 }), document.addEventListener(`${_}move`, B, { passive: !1 }), document.addEventListener("keydown", K, { passive: !1 }), document.addEventListener("keyup", y, { passive: !1 }), window.addEventListener("blur", A, { passive: !0 }), o && r && (document.addEventListener("touchstart", w, { passive: !1, capture: !0 }), document.addEventListener("touchmove", w, { passive: !1, capture: !0 })), l.current = !0, T(c)));
|
|
938
|
+
}, [c, o]);
|
|
664
939
|
}
|
|
665
|
-
function
|
|
666
|
-
return
|
|
940
|
+
function Po(i, e) {
|
|
941
|
+
return qn({ onPointerDown: i, onPointerMoveOrWait: (t, n, o) => {
|
|
667
942
|
i?.(o);
|
|
668
943
|
}, ...e });
|
|
669
944
|
}
|
|
670
|
-
const
|
|
671
|
-
const n =
|
|
945
|
+
const Jn = ({ initValue: i, useHookBody: e, applyStateChange: t }) => {
|
|
946
|
+
const n = O(i);
|
|
672
947
|
if (typeof e != "function") throw new Error("function expected as hook body parameter. got " + typeof e);
|
|
673
948
|
const o = e();
|
|
674
|
-
return
|
|
949
|
+
return Ve(() => {
|
|
675
950
|
n.current !== o && (n.current = o, t(o));
|
|
676
951
|
}, [t, o]), null;
|
|
677
|
-
},
|
|
952
|
+
}, Qe = (i) => {
|
|
678
953
|
console && console.warn && console.warn(i);
|
|
679
954
|
}, Xe = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
|
|
680
|
-
let
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
},
|
|
684
|
-
const [e, t] =
|
|
685
|
-
return n.current = e, i ||
|
|
955
|
+
let Qn = 1, et = !1, Vt = !1;
|
|
956
|
+
const Re = [], be = [], He = () => {
|
|
957
|
+
be.forEach((i) => i());
|
|
958
|
+
}, eo = ({ automaticContainerInternalUseOnly: i }) => {
|
|
959
|
+
const [e, t] = q([]), n = O([]);
|
|
960
|
+
return n.current = e, i || et !== !1 || (Vt = !0), V(() => {
|
|
686
961
|
let o = !0;
|
|
687
962
|
function r() {
|
|
688
|
-
if (o) return
|
|
963
|
+
if (o) return be[0] !== r ? (i || et !== !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((a) => [])) : void t([...Re]);
|
|
689
964
|
}
|
|
690
|
-
return
|
|
691
|
-
o = !1, n.current?.length > 0 &&
|
|
965
|
+
return be.push(r), He(), () => {
|
|
966
|
+
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"), be.splice(be.indexOf(r), 1), He();
|
|
692
967
|
};
|
|
693
|
-
}, [i]), L(
|
|
694
|
-
},
|
|
695
|
-
const e =
|
|
696
|
-
return
|
|
968
|
+
}, [i]), L(ke, { children: e.map(({ hook: o, key: r }) => pn(Jn, { ...o, key: r })) });
|
|
969
|
+
}, to = (i) => {
|
|
970
|
+
const e = Qn++;
|
|
971
|
+
return Re.push({ hook: i, key: e }), be.length === 0 && Vt === !1 && (et = !0, ((t) => {
|
|
697
972
|
if (Xe.document && Xe.document.createElement) {
|
|
698
973
|
const n = Xe.document.createElement("div");
|
|
699
|
-
|
|
700
|
-
} else
|
|
701
|
-
})(
|
|
702
|
-
|
|
974
|
+
mn(n).render(L(t, { automaticContainerInternalUseOnly: !0 }));
|
|
975
|
+
} 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.");
|
|
976
|
+
})(eo)), He(), () => {
|
|
977
|
+
Re.splice(Re.findIndex((t) => t.key === e), 1), He();
|
|
703
978
|
};
|
|
704
979
|
};
|
|
705
|
-
let
|
|
706
|
-
|
|
707
|
-
let n, o, r = !1,
|
|
708
|
-
const
|
|
709
|
-
o = u,
|
|
710
|
-
},
|
|
980
|
+
let tt = null;
|
|
981
|
+
tt || (tt = (i, e, t = {}) => {
|
|
982
|
+
let n, o, r = !1, a = !1, h = [], { unmountIfNoConsumers: s = !1 } = t;
|
|
983
|
+
const l = (u) => {
|
|
984
|
+
o = u, gn(() => h.forEach((d) => d(u)));
|
|
985
|
+
}, c = () => (a || (o = typeof i == "function" ? i() : i, a = !0), o);
|
|
711
986
|
return () => {
|
|
712
|
-
const [u, d] =
|
|
713
|
-
return V(() => (r || (r = !0, n =
|
|
714
|
-
|
|
987
|
+
const [u, d] = q(c);
|
|
988
|
+
return V(() => (r || (r = !0, n = to({ initValue: i, useHookBody: e, applyStateChange: l })), h.push(d), o !== u && d(o), () => {
|
|
989
|
+
h.splice(h.indexOf(d), 1), h.length === 0 && s && (n(), r = !1);
|
|
715
990
|
}), []), u;
|
|
716
991
|
};
|
|
717
992
|
});
|
|
718
|
-
const
|
|
719
|
-
let
|
|
993
|
+
const Wt = tt;
|
|
994
|
+
let Ft = () => {
|
|
720
995
|
console.warn("You must call useEditMode before setting its state.");
|
|
721
996
|
};
|
|
722
|
-
const
|
|
723
|
-
const [i, e] =
|
|
724
|
-
return
|
|
725
|
-
}),
|
|
726
|
-
const i =
|
|
727
|
-
return
|
|
728
|
-
|
|
997
|
+
const no = Wt(null, () => {
|
|
998
|
+
const [i, e] = q(null);
|
|
999
|
+
return Ft = e, i;
|
|
1000
|
+
}), Ao = () => {
|
|
1001
|
+
const i = no();
|
|
1002
|
+
return N(() => ({ setMode: (e) => {
|
|
1003
|
+
Ft((t) => (typeof e == "function" && (e = e(t)), e?.onModeChange?.(e ?? null), e));
|
|
729
1004
|
}, getMode: () => i }), [i]);
|
|
730
1005
|
};
|
|
731
|
-
class
|
|
1006
|
+
class nt {
|
|
732
1007
|
constructor(e, t, n, o) {
|
|
733
1008
|
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 = () => {
|
|
734
1009
|
console.log(`implement: ${this.label()} : ${this.description()}`);
|
|
@@ -839,15 +1114,15 @@ class tt {
|
|
|
839
1114
|
}), t;
|
|
840
1115
|
}
|
|
841
1116
|
}
|
|
842
|
-
class
|
|
1117
|
+
class Ue extends nt {
|
|
843
1118
|
}
|
|
844
|
-
class
|
|
1119
|
+
class jt {
|
|
845
1120
|
constructor(e, t) {
|
|
846
|
-
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid =
|
|
1121
|
+
this._target = null, this._groupKey = null, this._root = null, this._parent = null, this._uuid = Z.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();
|
|
847
1122
|
const n = this;
|
|
848
1123
|
this._unListenersByCommand = /* @__PURE__ */ new Map(), this._listenersByKey = /* @__PURE__ */ new Map(), this._commandsPropertyListener = (o, r) => {
|
|
849
|
-
const
|
|
850
|
-
|
|
1124
|
+
const a = n._root._listenersByKey, h = r.key(), s = a.get(h);
|
|
1125
|
+
s && n._notifyCommands(s, "onCommandChange", r);
|
|
851
1126
|
};
|
|
852
1127
|
}
|
|
853
1128
|
_getCommand(e) {
|
|
@@ -862,19 +1137,19 @@ class Ht {
|
|
|
862
1137
|
createChildGroup(e, t, n) {
|
|
863
1138
|
let o;
|
|
864
1139
|
if (!n) {
|
|
865
|
-
let
|
|
866
|
-
for (;
|
|
867
|
-
let
|
|
868
|
-
|
|
1140
|
+
let h = this;
|
|
1141
|
+
for (; h && !o; ) {
|
|
1142
|
+
let s = h._nodes.get(t);
|
|
1143
|
+
s && (o = s), h = h._parent;
|
|
869
1144
|
}
|
|
870
1145
|
}
|
|
871
|
-
o || (o = new
|
|
872
|
-
const r = (
|
|
873
|
-
!
|
|
1146
|
+
o || (o = new jt(e, t), o._parent = this, o._root = this._root, o._unListenersByCommand = null, o._listenersByKey = null, o._commandsPropertyListener = null);
|
|
1147
|
+
const r = (h, s) => {
|
|
1148
|
+
!h.has(t) || n ? h.set(t, s) : n === void 0 && console.warn("commandGroup already registered", t);
|
|
874
1149
|
};
|
|
875
1150
|
r(this._root._nodes, o);
|
|
876
|
-
let
|
|
877
|
-
for (;
|
|
1151
|
+
let a = this._parent;
|
|
1152
|
+
for (; a; ) r(this._nodes, o), a = a._parent;
|
|
878
1153
|
return this._children.set(t, o), this._notify("onGroupChange"), o;
|
|
879
1154
|
}
|
|
880
1155
|
getKey() {
|
|
@@ -884,24 +1159,24 @@ class Ht {
|
|
|
884
1159
|
return this._nodes.get(e);
|
|
885
1160
|
}
|
|
886
1161
|
_addCommands(e, t = void 0) {
|
|
887
|
-
const n = this._commandsByKey, o = this._commandsByShortcut, r = this._root._commandsPropertyListener,
|
|
888
|
-
for (let
|
|
889
|
-
const
|
|
890
|
-
if (n.has(
|
|
891
|
-
t === void 0 && console.warn("command already registered",
|
|
1162
|
+
const n = this._commandsByKey, o = this._commandsByShortcut, r = this._root._commandsPropertyListener, a = this._root._unListenersByCommand;
|
|
1163
|
+
for (let h = 0; h < e.length; h++) {
|
|
1164
|
+
const s = e[h], l = s.key();
|
|
1165
|
+
if (n.has(l) && !t) {
|
|
1166
|
+
t === void 0 && console.warn("command already registered", l);
|
|
892
1167
|
continue;
|
|
893
1168
|
}
|
|
894
|
-
n.set(
|
|
895
|
-
let
|
|
896
|
-
|
|
897
|
-
const u =
|
|
898
|
-
|
|
899
|
-
const d =
|
|
1169
|
+
n.set(l, s);
|
|
1170
|
+
let c = a.get(s);
|
|
1171
|
+
c && (c(), a.delete(s));
|
|
1172
|
+
const u = s.addPropertyListener(r);
|
|
1173
|
+
a.set(s, u);
|
|
1174
|
+
const d = s.shortcut();
|
|
900
1175
|
if (!d) continue;
|
|
901
|
-
const
|
|
902
|
-
for (let
|
|
903
|
-
const
|
|
904
|
-
|
|
1176
|
+
const f = Array.isArray(d) ? d : [d];
|
|
1177
|
+
for (let v = 0; v < f.length; v++) {
|
|
1178
|
+
const m = Me(f[v]), b = o.get(m);
|
|
1179
|
+
b && !t && t === void 0 && console.warn(`Shortcut already registered: ${m}, ${l}, ${b}.`), o.set(m, l);
|
|
905
1180
|
}
|
|
906
1181
|
}
|
|
907
1182
|
}
|
|
@@ -912,9 +1187,9 @@ class Ht {
|
|
|
912
1187
|
for (; e; ) t.push(e._nodes), e._nodes.delete(n), e = e._parent;
|
|
913
1188
|
e = this._parent;
|
|
914
1189
|
const o = (r) => {
|
|
915
|
-
r._children.forEach((
|
|
916
|
-
for (let
|
|
917
|
-
o(
|
|
1190
|
+
r._children.forEach((a) => {
|
|
1191
|
+
for (let h = 0; h < t.length; h++) a._nodes.delete(t[h]);
|
|
1192
|
+
o(a);
|
|
918
1193
|
});
|
|
919
1194
|
};
|
|
920
1195
|
o(this), this._parent = null, this._notify("onGroupChange");
|
|
@@ -934,13 +1209,13 @@ class Ht {
|
|
|
934
1209
|
}
|
|
935
1210
|
findCommandByEvent(e) {
|
|
936
1211
|
const t = [];
|
|
937
|
-
e.altKey && t.push(
|
|
1212
|
+
e.altKey && t.push(G.Alt), e.shiftKey && t.push(G.Shift), e.ctrlKey && t.push(G.Ctrl), e.metaKey && t.push(G.Meta);
|
|
938
1213
|
let n = Me({ key: e.code, modifiers: t });
|
|
939
1214
|
const o = this._commandsByShortcut;
|
|
940
1215
|
let r = o.get(n);
|
|
941
1216
|
r || (n = Me({ key: e.key, modifiers: t }), r = o.get(n)), !r && e.code.startsWith("Digit") && (n = Me({ key: e.code.substring(5, e.code.length), modifiers: t }), r = this._commandsByShortcut.get(n)), !r && e.code.startsWith("Key") && (r = Me({ key: e.code.substring(3, e.code.length), modifiers: t }), r = o.get(n));
|
|
942
|
-
let
|
|
943
|
-
return r && (
|
|
1217
|
+
let a = null;
|
|
1218
|
+
return r && (a = this._commandsByKey.get(r), a && a.disabled() && (a = null), !a || a.target() && a.target().contains(e.target) || (a = null)), a || (this._parent?.findCommandByEvent(e) ?? null);
|
|
944
1219
|
}
|
|
945
1220
|
dispatchToFocusedCommand(e) {
|
|
946
1221
|
const t = this.getActive();
|
|
@@ -957,16 +1232,16 @@ class Ht {
|
|
|
957
1232
|
addListener(e, t) {
|
|
958
1233
|
const n = this._listeners, o = t?.keys, r = this._root._listenersByKey;
|
|
959
1234
|
if (o && !e.onCommandChange) throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");
|
|
960
|
-
let
|
|
961
|
-
if (o) for (let
|
|
962
|
-
const
|
|
963
|
-
if (!
|
|
964
|
-
let
|
|
965
|
-
|
|
1235
|
+
let a = null;
|
|
1236
|
+
if (o) for (let h = 0; h < o.length; h++) {
|
|
1237
|
+
const s = o[h];
|
|
1238
|
+
if (!s) continue;
|
|
1239
|
+
let l = r.get(s);
|
|
1240
|
+
l || (l = /* @__PURE__ */ new Set(), r.set(s, l)), a || (a = []), a.push(l), l.add(e);
|
|
966
1241
|
}
|
|
967
1242
|
return n.add(e), () => {
|
|
968
|
-
if (
|
|
969
|
-
|
|
1243
|
+
if (a) for (let h = 0; h < a.length; h++)
|
|
1244
|
+
a[h].delete(e);
|
|
970
1245
|
n.delete(e);
|
|
971
1246
|
};
|
|
972
1247
|
}
|
|
@@ -995,257 +1270,262 @@ class Ht {
|
|
|
995
1270
|
}), e;
|
|
996
1271
|
}
|
|
997
1272
|
}
|
|
998
|
-
const
|
|
1273
|
+
const oo = Z.getOS() === Z.OSType.MacOS || Z.getOS() === Z.OSType.IOS ? "Cmd" : "Ctrl", io = Z.getOS() === Z.OSType.MacOS || Z.getOS() === Z.OSType.IOS ? "⌘" : "^", Me = (i, e = !1) => {
|
|
999
1274
|
const t = {};
|
|
1000
1275
|
for (let o = 0; i.modifiers && o < i.modifiers.length; o++) t[i.modifiers[o]] = !0;
|
|
1001
1276
|
let n = "";
|
|
1002
|
-
return (t?.[
|
|
1277
|
+
return (t?.[G.Ctrl] || t?.[G.Meta]) && (n += (n.length > 0 ? "+" : "") + (e ? io : oo)), t?.[G.Alt] && (n += e ? "⌥" : "Alt"), t?.[G.Shift] && (n += (n.length > 0 ? "+" : "") + (e ? "⇧" : "Shift")), n += (n.length > 0 ? "+" : "") + Rt(i.key), n;
|
|
1003
1278
|
};
|
|
1004
|
-
function
|
|
1005
|
-
const t =
|
|
1279
|
+
function zo(i, e = null) {
|
|
1280
|
+
const t = O(e);
|
|
1006
1281
|
t.current = e;
|
|
1007
|
-
const [n, o] =
|
|
1282
|
+
const [n, o] = fn((a) => a + 1, 0), r = N(() => Array.isArray(i) ? i : [i], [i]);
|
|
1008
1283
|
return V(() => {
|
|
1009
1284
|
if (!r || r.length === 0) return;
|
|
1010
|
-
const
|
|
1011
|
-
t.current?.onChange?.(
|
|
1285
|
+
const a = (l, c) => {
|
|
1286
|
+
t.current?.onChange?.(c), o();
|
|
1012
1287
|
};
|
|
1013
|
-
let
|
|
1014
|
-
e && (
|
|
1015
|
-
t.current?.onExecute?.(
|
|
1016
|
-
}, onError(
|
|
1017
|
-
t.current?.onError?.(
|
|
1288
|
+
let h = null;
|
|
1289
|
+
e && (h = { onExecute(l, c) {
|
|
1290
|
+
t.current?.onExecute?.(l, c);
|
|
1291
|
+
}, onError(l, c, u) {
|
|
1292
|
+
t.current?.onError?.(l, c, u);
|
|
1018
1293
|
} });
|
|
1019
|
-
const
|
|
1020
|
-
for (let
|
|
1294
|
+
const s = /* @__PURE__ */ new Set();
|
|
1295
|
+
for (let l = 0; l < r.length; l++) s.add(r[l]?.addPropertyListener(Z.debounce(a, 0), !0)), e && s.add(r[l]?.addExecuteListener(h));
|
|
1021
1296
|
return () => {
|
|
1022
|
-
|
|
1023
|
-
|
|
1297
|
+
s.forEach((l) => {
|
|
1298
|
+
l?.();
|
|
1024
1299
|
});
|
|
1025
1300
|
};
|
|
1026
1301
|
}, [i]), n;
|
|
1027
1302
|
}
|
|
1028
1303
|
const $e = (i, e) => {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1304
|
+
if (!e || !i || e.length === 0) return Z.EmptyArray;
|
|
1305
|
+
const t = e.length, n = new Array(t);
|
|
1306
|
+
for (let o = 0; o < t; o++) {
|
|
1307
|
+
const r = e[o], a = r ? i.getCommand(r) : null;
|
|
1308
|
+
n[o] = a;
|
|
1033
1309
|
}
|
|
1034
|
-
return
|
|
1310
|
+
return n;
|
|
1035
1311
|
};
|
|
1036
|
-
function
|
|
1037
|
-
const o =
|
|
1312
|
+
function Bo(i, e = null, t = null, n) {
|
|
1313
|
+
const o = O(t);
|
|
1038
1314
|
o.current = t, e && !Array.isArray(e) && (e = [e]);
|
|
1039
|
-
const [r,
|
|
1315
|
+
const [r, a] = q($e(i, e)), h = n ? [...n, i] : [i];
|
|
1040
1316
|
return V(() => {
|
|
1041
|
-
const
|
|
1317
|
+
const s = { onGroupChange: () => {
|
|
1042
1318
|
const d = $e(i, e);
|
|
1043
|
-
|
|
1319
|
+
a(d), o.current?.onChange?.(this);
|
|
1044
1320
|
} };
|
|
1045
|
-
let
|
|
1046
|
-
e && e.length > 0 && (
|
|
1047
|
-
o.current?.onChange?.(i),
|
|
1321
|
+
let l;
|
|
1322
|
+
e && e.length > 0 && (l = { keys: e }, s.onCommandChange = (d, f) => {
|
|
1323
|
+
o.current?.onChange?.(i), a($e(i, e));
|
|
1048
1324
|
});
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1051
|
-
|
|
1325
|
+
const c = i?.addListener(s, l), u = $e(i, e);
|
|
1326
|
+
return a(u), o.current?.onChange && o.current?.onChange(i), () => {
|
|
1327
|
+
c?.();
|
|
1052
1328
|
};
|
|
1053
|
-
},
|
|
1329
|
+
}, h), r;
|
|
1054
1330
|
}
|
|
1055
|
-
const
|
|
1331
|
+
const Oo = { Toolbar: "toolbar", Menuitem: "menuitem" }, ro = Wt({ setClipboard: (i) => {
|
|
1056
1332
|
throw new Error("This is only available via the useClipboard.");
|
|
1057
|
-
}, getClipboard: () =>
|
|
1058
|
-
const [i, e] =
|
|
1059
|
-
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy:
|
|
1060
|
-
}),
|
|
1061
|
-
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, commands: r } = i,
|
|
1062
|
-
|
|
1063
|
-
const _ = e?.element,
|
|
1333
|
+
}, getClipboard: () => Ie.Global, refNativeCopy: { current: null }, refNativeLastKey: { current: null } }, () => {
|
|
1334
|
+
const [i, e] = q(Ie.Global);
|
|
1335
|
+
return { setClipboard: (t) => e(t), getClipboard: () => i, refNativeCopy: O(null), refNativeLastKey: O(null) };
|
|
1336
|
+
}), $o = (i) => {
|
|
1337
|
+
const { source: e, target: t, onPaste: n, onClipboardUpdate: o, commands: r } = i, a = Ht(), h = M(o, [o]), s = M(n, [n]), { getClipboard: l, refNativeCopy: c } = ro(), u = l();
|
|
1338
|
+
N(() => {
|
|
1339
|
+
const _ = e?.element, w = t?.element ?? e?.element;
|
|
1064
1340
|
if (!r) return;
|
|
1065
|
-
const
|
|
1066
|
-
r?.addCommands(
|
|
1341
|
+
const x = [new Ue("cut", _, { label: "Cut", description: "Remove the selection and put it on the clipboard so you can paste it somewhere else.", icon: "cut", shortcut: { key: "X", modifiers: [G.Ctrl] } }), new Ue("copy", _, { label: "Copy", description: "Put a copy of the selection on the clipboard so you can paste it somewhere else.", icon: "copy", shortcut: { key: "C", modifiers: [G.Ctrl] } }), new Ue("paste", w, { label: "Paste", description: "Add content on the clipboard to your document.", icon: "paste", shortcut: [{ key: "V", modifiers: [G.Ctrl] }, { key: "F8", modifiers: [G.Ctrl] }] })];
|
|
1342
|
+
r?.addCommands(x, !0);
|
|
1067
1343
|
}, [r]);
|
|
1068
|
-
const d =
|
|
1344
|
+
const d = M(async (_) => {
|
|
1069
1345
|
if (!e?.element) return;
|
|
1070
|
-
let
|
|
1346
|
+
let w = null;
|
|
1071
1347
|
try {
|
|
1072
|
-
|
|
1073
|
-
} catch (
|
|
1074
|
-
throw
|
|
1348
|
+
w = e.doCopy?.(_), typeof w == "string" ? await u.writeText(w) : await u.writeReference(w);
|
|
1349
|
+
} catch (x) {
|
|
1350
|
+
throw x;
|
|
1075
1351
|
}
|
|
1076
|
-
}, [e,
|
|
1077
|
-
const
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1352
|
+
}, [e, a]), f = M(async (_) => {
|
|
1353
|
+
const w = e?.element?.();
|
|
1354
|
+
if (w) {
|
|
1355
|
+
c.current = { sourceElement: w, args: _ };
|
|
1080
1356
|
try {
|
|
1081
1357
|
await d(_);
|
|
1082
|
-
} catch (
|
|
1083
|
-
|
|
1358
|
+
} catch (x) {
|
|
1359
|
+
a.showError?.(x);
|
|
1084
1360
|
}
|
|
1085
1361
|
}
|
|
1086
|
-
}, [e?.element,
|
|
1087
|
-
|
|
1088
|
-
}, []),
|
|
1362
|
+
}, [e?.element, a]), v = H(() => {
|
|
1363
|
+
f({ isCut: !0 });
|
|
1364
|
+
}, []), m = M(async (_, w, x) => {
|
|
1089
1365
|
try {
|
|
1090
|
-
if (await _.doPaste(
|
|
1091
|
-
|
|
1092
|
-
} catch (
|
|
1093
|
-
|
|
1366
|
+
if (await _.doPaste(w, x) === !1) return;
|
|
1367
|
+
s?.(w, x);
|
|
1368
|
+
} catch (A) {
|
|
1369
|
+
a.showError?.(A);
|
|
1094
1370
|
}
|
|
1095
|
-
}, [
|
|
1096
|
-
const
|
|
1097
|
-
if (
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
return await
|
|
1101
|
-
} catch (
|
|
1102
|
-
|
|
1371
|
+
}, [s]), b = M(async (_, w, x) => {
|
|
1372
|
+
const A = t?.element?.();
|
|
1373
|
+
if (A && await Z.whenFocus(A), !_ && !w) return;
|
|
1374
|
+
const P = await a.showBusy?.("Pasting...");
|
|
1375
|
+
if (w) try {
|
|
1376
|
+
return await m(t, w, x), void P?.();
|
|
1377
|
+
} catch (y) {
|
|
1378
|
+
P?.(), a.showError?.(y);
|
|
1103
1379
|
}
|
|
1104
|
-
let
|
|
1105
|
-
|
|
1380
|
+
let B, K = t.importFromExternal;
|
|
1381
|
+
K || (K = (y, S) => ({ getItemType: () => "text", toText: () => _.text, isClipboardItem: !0 }));
|
|
1106
1382
|
try {
|
|
1107
|
-
|
|
1108
|
-
} catch (
|
|
1109
|
-
|
|
1383
|
+
B = await K(_, { isCut: !1 });
|
|
1384
|
+
} catch (y) {
|
|
1385
|
+
P?.(), a.showError?.(y);
|
|
1110
1386
|
}
|
|
1111
|
-
if (
|
|
1112
|
-
const
|
|
1113
|
-
await
|
|
1114
|
-
} catch (
|
|
1115
|
-
|
|
1387
|
+
if (B) try {
|
|
1388
|
+
const y = await Promise.resolve(B);
|
|
1389
|
+
await m(t, y, x), P?.();
|
|
1390
|
+
} catch (y) {
|
|
1391
|
+
P?.(), a.showError?.(y);
|
|
1116
1392
|
}
|
|
1117
|
-
else
|
|
1118
|
-
}, [
|
|
1393
|
+
else P?.();
|
|
1394
|
+
}, [m, t, a]), T = M(async (_) => {
|
|
1119
1395
|
if (t?.element) try {
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1122
|
-
const
|
|
1123
|
-
|
|
1124
|
-
const
|
|
1125
|
-
await
|
|
1126
|
-
} catch (
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1396
|
+
const w = await u.readReference();
|
|
1397
|
+
if (w) return void await b(null, w, _);
|
|
1398
|
+
const x = [];
|
|
1399
|
+
x[0] = await Fe.readStringFromClipboard(u, je.plain), x[1] = await Fe.readHTMLFromClipboard(u, je.html), x[2] = await Fe.readBlobFromClipboard(u, je.png);
|
|
1400
|
+
const A = { text: x[0] ?? null, html: x[1] ?? null, image: x[2] ?? null };
|
|
1401
|
+
await b(A, null, _);
|
|
1402
|
+
} catch (w) {
|
|
1403
|
+
if (w?.message === "Document is not focused.") return;
|
|
1404
|
+
a.showError?.(w);
|
|
1129
1405
|
}
|
|
1130
|
-
}, [
|
|
1131
|
-
return
|
|
1132
|
-
}, [e?.element]),
|
|
1133
|
-
}, [t?.element,
|
|
1406
|
+
}, [b, t?.element, a]);
|
|
1407
|
+
return M(async (_) => {
|
|
1408
|
+
}, [e?.element]), M(async (_) => {
|
|
1409
|
+
}, [t?.element, b, a]), V(() => {
|
|
1134
1410
|
if (!u) return;
|
|
1135
|
-
const _ = async (
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
},
|
|
1139
|
-
|
|
1140
|
-
},
|
|
1141
|
-
|
|
1411
|
+
const _ = async (A) => {
|
|
1412
|
+
const P = await u.readReference();
|
|
1413
|
+
h?.(P);
|
|
1414
|
+
}, w = (A) => {
|
|
1415
|
+
a.showMessage?.(Ie.ErrorMessages.PermsRead, { onceKey: "clipboard.features" });
|
|
1416
|
+
}, x = (A) => {
|
|
1417
|
+
a.showMessage?.(Ie.ErrorMessages.PermsWrite, { onceKey: "clipboard.features" });
|
|
1142
1418
|
};
|
|
1143
|
-
return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread",
|
|
1144
|
-
u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread",
|
|
1419
|
+
return u.addEventListener("clipboardchange", _), u.addEventListener("clipboarderrorread", w), u.addEventListener("clipboarderrorwrite", x), () => {
|
|
1420
|
+
u.removeEventListener("clipboardchange", _), u.removeEventListener("clipboarderrorread", w), u.removeEventListener("clipboarderrorwrite", x);
|
|
1145
1421
|
};
|
|
1146
|
-
}, [u,
|
|
1147
|
-
}, [d,
|
|
1148
|
-
r?.getCommand("cut")?.updateCallback(
|
|
1149
|
-
}, [e, t, r]), { paste:
|
|
1422
|
+
}, [u, a]), V(() => {
|
|
1423
|
+
}, [d, b, e, t]), V(() => {
|
|
1424
|
+
r?.getCommand("cut")?.updateCallback(v).update({ disabled: !e || !t }), r?.getCommand("copy")?.updateCallback(f).update({ disabled: !e }), r?.getCommand("paste")?.updateCallback(T).update({ disabled: !t });
|
|
1425
|
+
}, [e, t, r]), { paste: T, copy: f, clipboard: u };
|
|
1150
1426
|
};
|
|
1151
|
-
function
|
|
1152
|
-
const t =
|
|
1427
|
+
function Ko(i, e = !0) {
|
|
1428
|
+
const t = O(i);
|
|
1153
1429
|
V(() => {
|
|
1154
1430
|
if (e) {
|
|
1155
|
-
const n = Object.entries(i).reduce((o, [r,
|
|
1431
|
+
const n = Object.entries(i).reduce((o, [r, a]) => (t.current[r] !== a && (o[r] = [t.current[r], a]), o), {});
|
|
1156
1432
|
Object.keys(n).length > 0 && console.log("Changed props:", n);
|
|
1157
1433
|
}
|
|
1158
1434
|
t.current = i;
|
|
1159
1435
|
});
|
|
1160
1436
|
}
|
|
1161
|
-
let
|
|
1162
|
-
var
|
|
1163
|
-
const
|
|
1164
|
-
const [i, e] =
|
|
1165
|
-
return
|
|
1166
|
-
i == null && e(
|
|
1167
|
-
}, []),
|
|
1168
|
-
|
|
1437
|
+
let Ge = !1, so = 0;
|
|
1438
|
+
var lo = typeof document < "u" ? Ve : V;
|
|
1439
|
+
const Tt = () => "sheetxl-ui-" + so++, Mt = ie.useId, Ro = Mt ?? function() {
|
|
1440
|
+
const [i, e] = ie.useState(() => Ge ? Tt() : void 0);
|
|
1441
|
+
return lo(() => {
|
|
1442
|
+
i == null && e(Tt());
|
|
1443
|
+
}, []), ie.useEffect(() => {
|
|
1444
|
+
Ge || (Ge = !0);
|
|
1169
1445
|
}, []), i;
|
|
1170
|
-
},
|
|
1171
|
-
const n =
|
|
1446
|
+
}, kt = "Undo the last action.", Dt = "Repeat the last action or undo the redo.", ao = (i) => `Redo ${i}`, Io = ({ manager: i, commands: e, disabled: t }) => {
|
|
1447
|
+
const n = Ht(), o = M((a) => {
|
|
1172
1448
|
try {
|
|
1173
|
-
i?.undo(
|
|
1174
|
-
} catch (
|
|
1175
|
-
n.error(
|
|
1449
|
+
i?.undo(a);
|
|
1450
|
+
} catch (h) {
|
|
1451
|
+
n.error(h);
|
|
1176
1452
|
}
|
|
1177
|
-
}, [i]), r =
|
|
1453
|
+
}, [i]), r = M((a) => {
|
|
1178
1454
|
try {
|
|
1179
|
-
i?.redo(
|
|
1180
|
-
} catch (
|
|
1181
|
-
n.error(
|
|
1455
|
+
i?.redo(a);
|
|
1456
|
+
} catch (h) {
|
|
1457
|
+
n.error(h);
|
|
1182
1458
|
}
|
|
1183
1459
|
}, [i]);
|
|
1184
|
-
return
|
|
1460
|
+
return N(() => {
|
|
1185
1461
|
if (!e) return;
|
|
1186
|
-
const
|
|
1187
|
-
} },
|
|
1188
|
-
e?.addCommands(
|
|
1462
|
+
const a = { contains: (s) => !0, focus() {
|
|
1463
|
+
} }, h = [new nt("undo", a, { label: "Undo", description: kt, shortcut: { key: "z", modifiers: [G.Ctrl] }, disabled: !0 }, o), new nt("redo", a, { label: "Redo", description: Dt, shortcut: [{ key: "y", modifiers: [G.Ctrl] }, { key: "F4" }, { key: "Enter", modifiers: [G.Alt] }], disabled: !0 }, r)];
|
|
1464
|
+
e?.addCommands(h, !0);
|
|
1189
1465
|
}, [e]), V(() => {
|
|
1190
1466
|
if (!e) return;
|
|
1191
|
-
const
|
|
1192
|
-
const
|
|
1193
|
-
var
|
|
1194
|
-
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description:
|
|
1467
|
+
const a = () => {
|
|
1468
|
+
const s = i?.getTopUndoDescription(), l = {};
|
|
1469
|
+
var c;
|
|
1470
|
+
e.getCommand("undo").update({ disabled: t || !i || !i.hasUndo(), description: s ? (c = s, `Undo ${c}`) : kt, state: l, context: { undoManager: i } });
|
|
1195
1471
|
const u = i?.getTopRedoDescription();
|
|
1196
|
-
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ?
|
|
1472
|
+
e.getCommand("redo").update({ disabled: t || !i || !i.hasRedo(), description: u ? ao(u) : Dt, state: l, context: { undoManager: i } });
|
|
1197
1473
|
};
|
|
1198
|
-
if (
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1474
|
+
if (a(), !i) return;
|
|
1475
|
+
const h = i.addListener({ onStackChange() {
|
|
1476
|
+
a();
|
|
1201
1477
|
} });
|
|
1202
|
-
return () =>
|
|
1478
|
+
return () => h?.();
|
|
1203
1479
|
}, [i, e, t]), { undo: o, redo: r };
|
|
1204
1480
|
};
|
|
1205
1481
|
export {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
yo as
|
|
1482
|
+
nt as Command,
|
|
1483
|
+
Oo as CommandButtonType,
|
|
1484
|
+
jt as CommandGroup,
|
|
1485
|
+
Ke as DefaultDynamicIconService,
|
|
1486
|
+
Zn as DefaultReactNotifier,
|
|
1487
|
+
Gn as DynamicIcon,
|
|
1488
|
+
So as FocusKeyNavigation,
|
|
1489
|
+
_o as HorizontalAlignment,
|
|
1490
|
+
mo as KeyCodes,
|
|
1491
|
+
G as KeyModifiers,
|
|
1492
|
+
go as MouseButtonCodes,
|
|
1493
|
+
To as NotifierProvider,
|
|
1494
|
+
Et as NotifierType,
|
|
1495
|
+
xo as ReactUtils,
|
|
1496
|
+
Lo as RoundedTab,
|
|
1497
|
+
Kn as ScrollPane,
|
|
1498
|
+
vo as ScrollUtils,
|
|
1499
|
+
ot as Scrollbar,
|
|
1500
|
+
se as ScrollbarOrientation,
|
|
1501
|
+
Ue as SimpleCommand,
|
|
1502
|
+
Co as SplitPane,
|
|
1503
|
+
jn as SplitPaneResizer,
|
|
1504
|
+
bo as ToolTipPlacement,
|
|
1505
|
+
Wn as VirtualScrollbar,
|
|
1506
|
+
Eo as WalkingIcon,
|
|
1507
|
+
Xn as createDynamicIconService,
|
|
1508
|
+
$n as defaultCreateScrollCorner,
|
|
1509
|
+
yo as defaultCreateScrollEdgeButton,
|
|
1510
|
+
wn as defaultCreateScrollEndButton,
|
|
1511
|
+
xn as defaultCreateScrollStartButton,
|
|
1512
|
+
xt as defaultCreateScrollbar,
|
|
1513
|
+
ko as getDevicePixelRatio,
|
|
1234
1514
|
Me as toShortcutString,
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1515
|
+
M as useCallbackRef,
|
|
1516
|
+
zo as useCommand,
|
|
1517
|
+
Bo as useCommands,
|
|
1518
|
+
$o as useCopyPaste,
|
|
1519
|
+
Mo as useDevicePixelRatio,
|
|
1520
|
+
Ao as useEditMode,
|
|
1521
|
+
wo as useFullscreenPortal,
|
|
1522
|
+
ro as useGlobalClipboard,
|
|
1523
|
+
Ro as useId,
|
|
1524
|
+
It as useImperativeElement,
|
|
1525
|
+
Po as useMouseDownAndHoldListener,
|
|
1526
|
+
Ht as useNotifier,
|
|
1527
|
+
Do as useOnClickOrFocusAway,
|
|
1528
|
+
qn as useSynchronizedPointerHandler,
|
|
1529
|
+
Ko as useTraceUpdate,
|
|
1530
|
+
Io as useUndoManager
|
|
1251
1531
|
};
|