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