@commentkit/comment-kit 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +3 -3
- package/SECURITY.md +1 -1
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +3 -3
- package/dist/demo.es.js +24 -15
- package/dist/headless.es.js +2 -2
- package/dist/preact.es.js +2 -2
- package/dist/qwik.qwik.mjs +2 -2
- package/dist/react.es.js +2 -2
- package/dist/shared/ShadowRootContext-DD6a0QaI.js +11 -0
- package/dist/shared/annotation-toolbar-RSrb0Nku.js +1086 -0
- package/dist/shared/{attachment-refresh-DmVkfPtl.js → attachment-refresh-CSTYwRW-.js} +3 -3
- package/dist/shared/{button-By0hGrJK.js → button-D4GHW6oZ.js} +133 -164
- package/dist/shared/{button-group-C285iSkZ.js → button-group-BVR7iT-S.js} +13 -13
- package/dist/shared/{comment-drawing-canvas-zIPS1dnW.js → comment-drawing-canvas-DbuXP54N.js} +2 -2
- package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
- package/dist/shared/{comment-image-lightbox-CdMNf0_y.js → comment-image-lightbox-zlIGEVA-.js} +7 -7
- package/dist/shared/{comment-images-content-DqeqmQnb.js → comment-images-content-aYbJb79_.js} +38 -38
- package/dist/shared/{comment-kit-core-C-0JJS2i.js → comment-kit-core-B0k7XsMz.js} +742 -746
- package/dist/shared/{comment-kit-ui-CBaz7L3u.js → comment-kit-ui-BXLJcZYQ.js} +5310 -5718
- package/dist/shared/{comment-screenshot-annotator-CuYmKafz.js → comment-screenshot-annotator-ChWwYJzO.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-Dw81osel.js → comment-screenshot-overlay-Bufg3rHz.js} +6 -6
- package/dist/shared/{dev-export-panel-D08M2LKD.js → dev-export-panel-DAZenvgD.js} +6 -6
- package/dist/shared/{dev-grab-BJLZZ2xU.js → dev-grab-O8q25zar.js} +48 -47
- package/dist/shared/dist-D9A5k-N4.js +617 -0
- package/dist/shared/{element-selector-Biyn2cpR.js → element-selector-CYkwzfEr.js} +349 -347
- package/dist/shared/input-UPtAj0M6.js +111 -0
- package/dist/shared/{mount-ui-DXdL3p9b.js → mount-ui-BKaWBhKq.js} +4 -4
- package/dist/shared/{pusher-D4M5K6Dk.js → pusher-BUaiCkDJ.js} +1 -1
- package/dist/shared/{realtime-BTqYEy8s.js → realtime-C0Z8dXXH.js} +41 -28
- package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
- package/dist/shared/screenshot-B-ZfFItT.js +199 -0
- package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
- package/dist/shared/{shadow-root-C58Ap5Nu.js → shadow-root-Cd3SLHyj.js} +3 -5
- package/dist/shared/{token-session-D0Y_HZw0.js → token-session-DplW5QDx.js} +2 -2
- package/dist/shared/useLabelableId-8n0QmH8N.js +154 -0
- package/dist/shared/{useRender-D1z_X_BY.js → useRender-Uxk1OPK-.js} +1 -1
- package/dist/shared/{useValueChanged-CrzfD8l-.js → useValueChanged-DKq5cMot.js} +13 -13
- package/dist/shared/{websocket-manager-BFKa95TO.js → websocket-manager-798cRDyL.js} +2 -2
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +19 -9
- package/dist/types/core/comment-kit-core.d.ts +8 -4
- package/dist/types/core/types.d.ts +49 -9
- package/dist/types/core/write-access.d.ts +2 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +30 -18
- package/package.json +1 -1
- package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
- package/dist/shared/annotation-toolbar-CpPKy0oq.js +0 -1094
- package/dist/shared/dist-De294MVF.js +0 -623
|
@@ -0,0 +1,1086 @@
|
|
|
1
|
+
import { u as e } from "./comment-kit-core-B0k7XsMz.js";
|
|
2
|
+
import { C as t, F as n, P as r, T as i, d as a, f as o, l as s, m as c, o as l, s as u, t as d, u as f } from "./button-D4GHW6oZ.js";
|
|
3
|
+
import { $t as p, Ct as m, Et as ee, Nt as h, Ot as g, Tt as _, Zt as v, en as te, i as y, o as b, r as x, t as S, x as C, xt as ne } from "./separator-UhJb0Row.js";
|
|
4
|
+
import { E as w, M as re, S as ie, h as ae, j as oe, n as se, t as ce, u as le, y as ue } from "./useValueChanged-DKq5cMot.js";
|
|
5
|
+
import { a as de } from "./ShadowRootContext-DD6a0QaI.js";
|
|
6
|
+
import { a as fe, i as pe, l as me, n as he, o as T, r as ge, s as E, t as D, u as _e } from "./button-group-BVR7iT-S.js";
|
|
7
|
+
import { a as ve, c as ye, i as O, n as be, r as k, t as xe, u as Se } from "./useLabelableId-8n0QmH8N.js";
|
|
8
|
+
import { A as Ce, D as A, E as j, M, O as N, b as we, d as P, f as Te, j as F, k as I, o as L, s as R, w as Ee, x as De, y as z } from "./comment-kit-ui-BXLJcZYQ.js";
|
|
9
|
+
import { a as Oe, c as ke, d as B, l as V, n as Ae, o as H, r as je, s as U, t as Me, u as W } from "./annotation-icons-Dh-bmNYK.js";
|
|
10
|
+
import * as G from "react";
|
|
11
|
+
import { jsx as K, jsxs as q } from "react/jsx-runtime";
|
|
12
|
+
var J = () => () => {}, Ne = () => !0, Pe = () => !1;
|
|
13
|
+
function Fe() {
|
|
14
|
+
return C(J, Ne, Pe);
|
|
15
|
+
}
|
|
16
|
+
function Ie() {
|
|
17
|
+
let [e, t] = G.useState(!1);
|
|
18
|
+
return G.useEffect(() => {
|
|
19
|
+
t(!0);
|
|
20
|
+
}, []), e;
|
|
21
|
+
}
|
|
22
|
+
var Le = a(18) ? Fe : Ie;
|
|
23
|
+
function Re() {
|
|
24
|
+
return !Le();
|
|
25
|
+
}
|
|
26
|
+
function ze(e) {
|
|
27
|
+
let { script: t } = e, { nonce: n } = Te();
|
|
28
|
+
return Re() ? /*#__PURE__*/ K("script", {
|
|
29
|
+
nonce: n,
|
|
30
|
+
dangerouslySetInnerHTML: { __html: t },
|
|
31
|
+
suppressHydrationWarning: !0
|
|
32
|
+
}) : null;
|
|
33
|
+
}
|
|
34
|
+
function Y() {
|
|
35
|
+
let e = G.useRef(0), [t, n] = G.useState({
|
|
36
|
+
paths: [],
|
|
37
|
+
undone: [],
|
|
38
|
+
activePath: null,
|
|
39
|
+
tool: "pen",
|
|
40
|
+
color: Ee,
|
|
41
|
+
strokeWidth: 3
|
|
42
|
+
}), r = G.useCallback((e) => {
|
|
43
|
+
n((t) => ({
|
|
44
|
+
...t,
|
|
45
|
+
tool: e
|
|
46
|
+
}));
|
|
47
|
+
}, []), i = G.useCallback((e) => {
|
|
48
|
+
n((t) => ({
|
|
49
|
+
...t,
|
|
50
|
+
color: e
|
|
51
|
+
}));
|
|
52
|
+
}, []), a = G.useCallback((e) => {
|
|
53
|
+
n((t) => ({
|
|
54
|
+
...t,
|
|
55
|
+
strokeWidth: e
|
|
56
|
+
}));
|
|
57
|
+
}, []), o = G.useCallback((t, r, i = 1) => {
|
|
58
|
+
let a = `path-${String(++e.current)}`;
|
|
59
|
+
n((e) => ({
|
|
60
|
+
...e,
|
|
61
|
+
activePath: {
|
|
62
|
+
id: a,
|
|
63
|
+
tool: e.tool,
|
|
64
|
+
points: [{
|
|
65
|
+
x: t,
|
|
66
|
+
y: r
|
|
67
|
+
}],
|
|
68
|
+
color: e.color,
|
|
69
|
+
strokeWidth: e.strokeWidth * i
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
}, []), s = G.useCallback((e, t) => {
|
|
73
|
+
n((n) => {
|
|
74
|
+
if (!n.activePath) return n;
|
|
75
|
+
if (n.activePath.tool === "pen") return {
|
|
76
|
+
...n,
|
|
77
|
+
activePath: {
|
|
78
|
+
...n.activePath,
|
|
79
|
+
points: [...n.activePath.points, {
|
|
80
|
+
x: e,
|
|
81
|
+
y: t
|
|
82
|
+
}]
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
let r = n.activePath.points[0] ?? {
|
|
86
|
+
x: 0,
|
|
87
|
+
y: 0
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
...n,
|
|
91
|
+
activePath: {
|
|
92
|
+
...n.activePath,
|
|
93
|
+
points: [r, {
|
|
94
|
+
x: e,
|
|
95
|
+
y: t
|
|
96
|
+
}]
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
}, []), c = G.useCallback(() => {
|
|
101
|
+
n((e) => !e.activePath || e.activePath.points.length < 2 ? {
|
|
102
|
+
...e,
|
|
103
|
+
activePath: null
|
|
104
|
+
} : {
|
|
105
|
+
...e,
|
|
106
|
+
paths: [...e.paths, e.activePath],
|
|
107
|
+
undone: [],
|
|
108
|
+
activePath: null
|
|
109
|
+
});
|
|
110
|
+
}, []), l = G.useCallback(() => {
|
|
111
|
+
n((e) => ({
|
|
112
|
+
...e,
|
|
113
|
+
activePath: null
|
|
114
|
+
}));
|
|
115
|
+
}, []), u = G.useCallback(() => {
|
|
116
|
+
n((e) => e.paths.length === 0 ? e : {
|
|
117
|
+
...e,
|
|
118
|
+
paths: e.paths.slice(0, -1),
|
|
119
|
+
undone: [...e.undone, ...e.paths.slice(-1)]
|
|
120
|
+
});
|
|
121
|
+
}, []), d = G.useCallback(() => {
|
|
122
|
+
n((e) => e.undone.length === 0 ? e : {
|
|
123
|
+
...e,
|
|
124
|
+
paths: [...e.paths, ...e.undone.slice(-1)],
|
|
125
|
+
undone: e.undone.slice(0, -1)
|
|
126
|
+
});
|
|
127
|
+
}, []), f = G.useCallback(() => {
|
|
128
|
+
n((e) => ({
|
|
129
|
+
...e,
|
|
130
|
+
paths: [],
|
|
131
|
+
undone: [],
|
|
132
|
+
activePath: null
|
|
133
|
+
}));
|
|
134
|
+
}, []);
|
|
135
|
+
return {
|
|
136
|
+
...t,
|
|
137
|
+
setTool: r,
|
|
138
|
+
setColor: i,
|
|
139
|
+
setStrokeWidth: a,
|
|
140
|
+
startPath: o,
|
|
141
|
+
addPoint: s,
|
|
142
|
+
endPath: c,
|
|
143
|
+
cancelPath: l,
|
|
144
|
+
undo: u,
|
|
145
|
+
redo: d,
|
|
146
|
+
clear: f,
|
|
147
|
+
canUndo: t.paths.length > 0,
|
|
148
|
+
canRedo: t.undone.length > 0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function X(e) {
|
|
152
|
+
let t = e.composedPath?.()[0] ?? e.target;
|
|
153
|
+
return t instanceof Element ? [
|
|
154
|
+
"INPUT",
|
|
155
|
+
"TEXTAREA",
|
|
156
|
+
"SELECT"
|
|
157
|
+
].includes(t.tagName) || t instanceof HTMLElement && t.isContentEditable : !1;
|
|
158
|
+
}
|
|
159
|
+
function Be(t, n, r) {
|
|
160
|
+
G.useEffect(() => {
|
|
161
|
+
let i = (i) => {
|
|
162
|
+
if (e() || i.defaultPrevented || i.isComposing || X(i)) return;
|
|
163
|
+
let a = i.key.toLowerCase();
|
|
164
|
+
(i.metaKey || i.ctrlKey) && !i.altKey && (a === "z" || a === "y") ? (i.preventDefault(), a === "y" || i.shiftKey ? n() : t()) : i.key === "Escape" && (i.preventDefault(), r());
|
|
165
|
+
};
|
|
166
|
+
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
167
|
+
}, [
|
|
168
|
+
t,
|
|
169
|
+
n,
|
|
170
|
+
r
|
|
171
|
+
]);
|
|
172
|
+
}
|
|
173
|
+
function Ve(e, t) {
|
|
174
|
+
return e - t;
|
|
175
|
+
}
|
|
176
|
+
function He(e, t, n, r, i, a) {
|
|
177
|
+
let o = P(e, n, r);
|
|
178
|
+
if (!i) return o;
|
|
179
|
+
let s = a.slice();
|
|
180
|
+
return s[t] = P(o, a[t - 1] ?? -Infinity, a[t + 1] ?? Infinity), s.sort(Ve);
|
|
181
|
+
}
|
|
182
|
+
function Ue(e, t, n) {
|
|
183
|
+
if (!Array.isArray(e)) return !0;
|
|
184
|
+
let r = t * n;
|
|
185
|
+
for (let t = 0; t < e.length - 1; t += 1) if (!(Math.abs(e[t] - e[t + 1]) >= r)) return !1;
|
|
186
|
+
return !0;
|
|
187
|
+
}
|
|
188
|
+
var Z = () => null, We = {
|
|
189
|
+
activeThumbIndex: Z,
|
|
190
|
+
max: Z,
|
|
191
|
+
min: Z,
|
|
192
|
+
minStepsBetweenValues: Z,
|
|
193
|
+
step: Z,
|
|
194
|
+
values: Z,
|
|
195
|
+
...Se
|
|
196
|
+
}, Ge = /*#__PURE__*/ G.createContext(void 0);
|
|
197
|
+
function Ke() {
|
|
198
|
+
let e = G.useContext(Ge);
|
|
199
|
+
if (e === void 0) throw Error(r(62));
|
|
200
|
+
return e;
|
|
201
|
+
}
|
|
202
|
+
function qe(e, t) {
|
|
203
|
+
return e === t || Array.isArray(e) && Array.isArray(t) && De(e, t);
|
|
204
|
+
}
|
|
205
|
+
var Je = /*#__PURE__*/ G.forwardRef(function(e, t) {
|
|
206
|
+
let { "aria-labelledby": r, className: i, defaultValue: a, disabled: c = !1, id: l, format: u, largeStep: d = 10, locale: f, render: ee, max: h = 100, min: g = 0, minStepsBetweenValues: _ = 0, form: te, name: y, onValueChange: b, onValueCommitted: x, orientation: S = "horizontal", step: C = 1, thumbCollisionBehavior: ne = "push", thumbAlignment: w = "center", value: le, style: de, ...fe } = e, pe = se(l), me = z(pe), he = o(b), T = o(x), { clearErrors: ge } = k(), { state: E, disabled: D, name: _e, setTouched: ve, setDirty: xe, validityData: Se, validation: A } = ye(), { labelId: j } = be(), [M, Te] = G.useState(), F = r ?? we(j, M), I = D || c, L = _e ?? y, [R, Ee] = Ce({
|
|
207
|
+
controlled: le,
|
|
208
|
+
default: a ?? g,
|
|
209
|
+
name: "Slider"
|
|
210
|
+
}), Oe = G.useRef(null), ke = G.useRef(null), B = G.useRef([]), V = G.useRef(null), Ae = G.useRef(-1), H = G.useRef(null), je = G.useRef(ie), [U, Me] = G.useState(-1), [W, q] = G.useState(-1), [J, Ne] = G.useState(!1), [Pe, Fe] = G.useState(() => /* @__PURE__ */ new Map()), [Ie, Le] = G.useState([void 0, void 0]), Re = o((e) => {
|
|
211
|
+
Me(e), e !== -1 && q(e);
|
|
212
|
+
}), ze = o((e) => {
|
|
213
|
+
e && (ke.current = e);
|
|
214
|
+
}), Y = Array.isArray(R), X = G.useMemo(() => Y ? R.map((e) => P(e, g, h)).sort(Ve) : [P(R, g, h)], [
|
|
215
|
+
h,
|
|
216
|
+
g,
|
|
217
|
+
Y,
|
|
218
|
+
R
|
|
219
|
+
]), Be = Y ? X : X[0];
|
|
220
|
+
O(A.inputRef, pe, Be, void 0, !I, y), ce(Be, () => {
|
|
221
|
+
ge(L), A.change(Be);
|
|
222
|
+
let e = Se.initialValue, t;
|
|
223
|
+
t = Array.isArray(Be) && Array.isArray(e) ? !De(Be, e) : Be !== e, xe(t);
|
|
224
|
+
});
|
|
225
|
+
let Z = o((e, t) => {
|
|
226
|
+
if (Number.isNaN(e) || qe(e, R)) return !1;
|
|
227
|
+
let n = t.event, r = n.constructor, i = new r(n.type, n);
|
|
228
|
+
return Object.defineProperty(i, "target", {
|
|
229
|
+
writable: !0,
|
|
230
|
+
value: {
|
|
231
|
+
value: e,
|
|
232
|
+
name: L
|
|
233
|
+
}
|
|
234
|
+
}), t.event = i, he(e, t), !t.isCanceled && (je.current = t.reason, Ee(e), !0);
|
|
235
|
+
}), Ke = o((e, t, n) => {
|
|
236
|
+
let r = He(e, t, g, h, Y, X);
|
|
237
|
+
if (Ue(r, C, _)) {
|
|
238
|
+
let e = "key" in n ? ue : ae, i = Z(r, oe(e, n.nativeEvent, void 0, { activeThumbIndex: t }));
|
|
239
|
+
ve(!0), i && T(r, re(e, n.nativeEvent));
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
n(() => {
|
|
243
|
+
if (!I) return;
|
|
244
|
+
let e = v(m(Oe.current));
|
|
245
|
+
p(Oe.current, e) && e.blur(), U !== -1 && Re(-1);
|
|
246
|
+
}, [
|
|
247
|
+
U,
|
|
248
|
+
I,
|
|
249
|
+
Re
|
|
250
|
+
]);
|
|
251
|
+
let Je = G.useMemo(() => ({
|
|
252
|
+
...E,
|
|
253
|
+
activeThumbIndex: U,
|
|
254
|
+
disabled: I,
|
|
255
|
+
dragging: J,
|
|
256
|
+
orientation: S,
|
|
257
|
+
max: h,
|
|
258
|
+
min: g,
|
|
259
|
+
minStepsBetweenValues: _,
|
|
260
|
+
step: C,
|
|
261
|
+
values: X
|
|
262
|
+
}), [
|
|
263
|
+
E,
|
|
264
|
+
U,
|
|
265
|
+
I,
|
|
266
|
+
J,
|
|
267
|
+
h,
|
|
268
|
+
g,
|
|
269
|
+
_,
|
|
270
|
+
S,
|
|
271
|
+
C,
|
|
272
|
+
X
|
|
273
|
+
]), Q = G.useMemo(() => ({
|
|
274
|
+
active: U,
|
|
275
|
+
controlRef: ke,
|
|
276
|
+
disabled: I,
|
|
277
|
+
dragging: J,
|
|
278
|
+
validation: A,
|
|
279
|
+
format: u,
|
|
280
|
+
handleInputChange: Ke,
|
|
281
|
+
indicatorPosition: Ie,
|
|
282
|
+
inset: w !== "center",
|
|
283
|
+
isArrayValue: Y,
|
|
284
|
+
labelId: F,
|
|
285
|
+
rootLabelId: me,
|
|
286
|
+
largeStep: d,
|
|
287
|
+
lastUsedThumbIndex: W,
|
|
288
|
+
lastChangeReasonRef: je,
|
|
289
|
+
form: te,
|
|
290
|
+
locale: f,
|
|
291
|
+
max: h,
|
|
292
|
+
min: g,
|
|
293
|
+
minStepsBetweenValues: _,
|
|
294
|
+
name: L,
|
|
295
|
+
onValueCommitted: T,
|
|
296
|
+
orientation: S,
|
|
297
|
+
pressedThumbCenterOffsetRef: V,
|
|
298
|
+
pressedThumbIndexRef: Ae,
|
|
299
|
+
pressedValuesRef: H,
|
|
300
|
+
registerFieldControlRef: ze,
|
|
301
|
+
renderBeforeHydration: w === "edge",
|
|
302
|
+
setActive: Re,
|
|
303
|
+
setDragging: Ne,
|
|
304
|
+
setIndicatorPosition: Le,
|
|
305
|
+
setLabelId: Te,
|
|
306
|
+
setValue: Z,
|
|
307
|
+
state: Je,
|
|
308
|
+
step: C,
|
|
309
|
+
thumbCollisionBehavior: ne,
|
|
310
|
+
thumbMap: Pe,
|
|
311
|
+
thumbRefs: B,
|
|
312
|
+
values: X
|
|
313
|
+
}), [
|
|
314
|
+
U,
|
|
315
|
+
F,
|
|
316
|
+
me,
|
|
317
|
+
I,
|
|
318
|
+
J,
|
|
319
|
+
A,
|
|
320
|
+
u,
|
|
321
|
+
Ke,
|
|
322
|
+
Ie,
|
|
323
|
+
d,
|
|
324
|
+
W,
|
|
325
|
+
te,
|
|
326
|
+
f,
|
|
327
|
+
h,
|
|
328
|
+
g,
|
|
329
|
+
_,
|
|
330
|
+
L,
|
|
331
|
+
T,
|
|
332
|
+
S,
|
|
333
|
+
Y,
|
|
334
|
+
ze,
|
|
335
|
+
Re,
|
|
336
|
+
Z,
|
|
337
|
+
Je,
|
|
338
|
+
C,
|
|
339
|
+
ne,
|
|
340
|
+
w,
|
|
341
|
+
Pe,
|
|
342
|
+
X
|
|
343
|
+
]), Ye = s("div", e, {
|
|
344
|
+
state: Je,
|
|
345
|
+
ref: [t, Oe],
|
|
346
|
+
props: [
|
|
347
|
+
{
|
|
348
|
+
"aria-labelledby": F,
|
|
349
|
+
id: pe,
|
|
350
|
+
role: "group"
|
|
351
|
+
},
|
|
352
|
+
fe,
|
|
353
|
+
(e) => A.getValidationProps(I, e)
|
|
354
|
+
],
|
|
355
|
+
stateAttributesMapping: We
|
|
356
|
+
});
|
|
357
|
+
return /*#__PURE__*/ K(Ge.Provider, {
|
|
358
|
+
value: Q,
|
|
359
|
+
children: /*#__PURE__*/ K(N, {
|
|
360
|
+
elementsRef: B,
|
|
361
|
+
onMapChange: Fe,
|
|
362
|
+
children: Ye
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
function Q(e) {
|
|
367
|
+
return e === "touch" || e === "pen";
|
|
368
|
+
}
|
|
369
|
+
function Ye(e, t) {
|
|
370
|
+
let n = e.getBoundingClientRect();
|
|
371
|
+
return t ? (n.top + n.bottom) / 2 : (n.left + n.right) / 2;
|
|
372
|
+
}
|
|
373
|
+
function Xe(e) {
|
|
374
|
+
if (e === 0) return 0;
|
|
375
|
+
if (Math.abs(e) < 1) {
|
|
376
|
+
let t = e.toExponential().split("e-"), n = t[0].split(".")[1];
|
|
377
|
+
return (n ? n.length : 0) + parseInt(t[1], 10);
|
|
378
|
+
}
|
|
379
|
+
let t = e.toString().split(".")[1];
|
|
380
|
+
return t ? t.length : 0;
|
|
381
|
+
}
|
|
382
|
+
function Ze(e, t, n) {
|
|
383
|
+
let r = Math.round((e - n) / t) * t + n;
|
|
384
|
+
return Number(r.toFixed(Math.max(Xe(t), Xe(n))));
|
|
385
|
+
}
|
|
386
|
+
function $(e, t, n, r, i, a, o, s) {
|
|
387
|
+
let c = e.slice(), l = a * o, u = c.length - 1, d = s ?? e, f = r + t * l, p = i - (u - t) * l;
|
|
388
|
+
c[t] = P(n, f, p);
|
|
389
|
+
for (let e = t + 1; e <= u; e += 1) {
|
|
390
|
+
let t = c[e - 1] + l, n = i - (u - e) * l, r = d[e], a = Math.max(c[e], t);
|
|
391
|
+
r < a && (a = Math.max(r, t)), c[e] = P(a, t, n);
|
|
392
|
+
}
|
|
393
|
+
for (let e = t - 1; e >= 0; --e) {
|
|
394
|
+
let t = c[e + 1] - l, n = r + e * l, i = d[e], a = Math.min(c[e], t);
|
|
395
|
+
i > a && (a = Math.min(i, t)), c[e] = P(a, n, t);
|
|
396
|
+
}
|
|
397
|
+
for (let e = 0; e <= u; e += 1) c[e] = Number(c[e].toFixed(12));
|
|
398
|
+
return c;
|
|
399
|
+
}
|
|
400
|
+
function Qe(e, t, n, r, i, a, o, s, c, l) {
|
|
401
|
+
let u = n ?? t, d = r ?? t;
|
|
402
|
+
if (!(u.length > 1)) return {
|
|
403
|
+
value: a,
|
|
404
|
+
thumbIndex: 0,
|
|
405
|
+
didSwap: !1
|
|
406
|
+
};
|
|
407
|
+
let f = c * l;
|
|
408
|
+
if (e === "push") return {
|
|
409
|
+
value: $(u, i, a, o, s, c, l),
|
|
410
|
+
thumbIndex: i,
|
|
411
|
+
didSwap: !1
|
|
412
|
+
};
|
|
413
|
+
let p = u.slice(), m = p[i - 1], ee = p[i + 1], h = m == null ? o : m + f, g = ee == null ? s : ee - f, _ = Number(P(a, h, g).toFixed(12));
|
|
414
|
+
switch (p[i] = _, e) {
|
|
415
|
+
case "swap": {
|
|
416
|
+
let e = u[i], t = 1e-7, n = a > e, r = a < e, h = n && ee != null && a >= ee - t, g = r && m != null && a <= m + t;
|
|
417
|
+
if (!h && !g) return {
|
|
418
|
+
value: p,
|
|
419
|
+
thumbIndex: i,
|
|
420
|
+
didSwap: !1
|
|
421
|
+
};
|
|
422
|
+
let v = h ? i + 1 : i - 1, te = p.map((e, t) => t === i ? _ : d[t] ?? u[t]), y = a;
|
|
423
|
+
y = h ? Math.max(a, p[v]) : Math.min(a, p[v]);
|
|
424
|
+
let b = $(p, v, y, o, s, c, l, te), x = h ? v - 1 : v + 1, S = b[x - 1], C = b[x + 1], ne = S == null ? o : S + f;
|
|
425
|
+
ne = Math.max(ne, o + x * f);
|
|
426
|
+
let w = C == null ? s : C - f;
|
|
427
|
+
w = Math.min(w, s - (b.length - 1 - x) * f);
|
|
428
|
+
let re = P(_, ne, w);
|
|
429
|
+
return b[x] = Number(re.toFixed(12)), {
|
|
430
|
+
value: b,
|
|
431
|
+
thumbIndex: v,
|
|
432
|
+
didSwap: !0
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
default: return {
|
|
436
|
+
value: p,
|
|
437
|
+
thumbIndex: i,
|
|
438
|
+
didSwap: !1
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
var $e = 2;
|
|
443
|
+
function et(e, t) {
|
|
444
|
+
if (!e) return {
|
|
445
|
+
start: 0,
|
|
446
|
+
end: 0
|
|
447
|
+
};
|
|
448
|
+
function n(e) {
|
|
449
|
+
let t = e == null ? 0 : parseFloat(e);
|
|
450
|
+
return Number.isNaN(t) ? 0 : t;
|
|
451
|
+
}
|
|
452
|
+
let r = t ? "Top" : "InlineStart", i = t ? "Bottom" : "InlineEnd";
|
|
453
|
+
return {
|
|
454
|
+
start: n(e[`border${r}Width`]) + n(e[`padding${r}`]),
|
|
455
|
+
end: n(e[`border${i}Width`]) + n(e[`padding${i}`])
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function tt(e, t) {
|
|
459
|
+
if (t.current != null && e.changedTouches) {
|
|
460
|
+
let n = e;
|
|
461
|
+
for (let e = 0; e < n.changedTouches.length; e += 1) {
|
|
462
|
+
let r = n.changedTouches[e];
|
|
463
|
+
if (r.identifier === t.current) return {
|
|
464
|
+
x: r.clientX,
|
|
465
|
+
y: r.clientY
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
x: e.clientX,
|
|
472
|
+
y: e.clientY
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
var nt = /*#__PURE__*/ G.forwardRef(function(e, n) {
|
|
476
|
+
let { render: r, className: a, style: c, ...l } = e, { disabled: u, dragging: d, inset: f, isArrayValue: h, lastChangeReasonRef: y, max: b, min: x, minStepsBetweenValues: S, onValueCommitted: C, orientation: ne, pressedThumbCenterOffsetRef: ie, pressedThumbIndexRef: ae, pressedValuesRef: se, registerFieldControlRef: ce, renderBeforeHydration: ue, setActive: fe, setDragging: pe, setValue: me, state: he, step: T, thumbCollisionBehavior: ge, thumbRefs: E, values: D } = Ke(), _e = de(), ve = D.length > 1, ye = ne === "vertical", O = G.useRef(null), be = G.useRef(null), k = o((e) => {
|
|
477
|
+
e && be.current == null && (be.current = t(e).getComputedStyle(e));
|
|
478
|
+
}), xe = G.useRef(null), Se = G.useRef(0), Ce = G.useRef(0), A = G.useRef(null), j = G.useRef(!1), M = ee(D);
|
|
479
|
+
function N(e) {
|
|
480
|
+
return e?.querySelector("input[type=\"range\"]");
|
|
481
|
+
}
|
|
482
|
+
function we(e) {
|
|
483
|
+
ae.current = e, E.current[e] || (ie.current = null);
|
|
484
|
+
}
|
|
485
|
+
function Te() {
|
|
486
|
+
ae.current = -1, ie.current = null;
|
|
487
|
+
}
|
|
488
|
+
function F(e) {
|
|
489
|
+
return i(e) ? E.current.some((t) => !i(t) || !p(t, e) ? !1 : N(t)?.disabled === !0) : !1;
|
|
490
|
+
}
|
|
491
|
+
function I(e) {
|
|
492
|
+
let t = O.current, n = ae.current;
|
|
493
|
+
if (!t || n < 0 || n >= D.length) return n >= D.length && (A.current = null), null;
|
|
494
|
+
let { width: r, height: i, bottom: a, left: o, right: s } = t.getBoundingClientRect(), c = et(be.current, ye), l = Ce.current, u = (ye ? i : r) - c.start - c.end - l * 2, d = ie.current ?? 0, f = e.x - d, p = e.y - d, m = ye ? a - p - c.end : (_e === "rtl" ? s - f : f - o) - c.start, ee = P((m - l) / u, 0, 1), g = (b - x) * ee + x;
|
|
495
|
+
return g = Ze(g, T, x), g = P(g, x, b), ve ? Qe(ge, D, M.current, se.current, n, g, x, b, T, S) : {
|
|
496
|
+
value: h ? [g] : g,
|
|
497
|
+
thumbIndex: n,
|
|
498
|
+
didSwap: !1
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function L(e) {
|
|
502
|
+
se.current = ve ? D.slice() : null, A.current = null, M.current = D;
|
|
503
|
+
let t = ae.current, n = t;
|
|
504
|
+
if (t > -1 && t < D.length) {
|
|
505
|
+
if (D[t] === b) {
|
|
506
|
+
let e = t;
|
|
507
|
+
for (; e > 0 && D[e - 1] === b;) --e;
|
|
508
|
+
n = e;
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
let t = ye ? "y" : "x", r;
|
|
512
|
+
n = -1;
|
|
513
|
+
for (let a = 0; a < E.current.length; a += 1) {
|
|
514
|
+
let o = E.current[a];
|
|
515
|
+
if (i(o) && !N(o)?.disabled) {
|
|
516
|
+
let i = Ye(o, ye), s = Math.abs(e[t] - i);
|
|
517
|
+
(r === void 0 || s <= r) && (n = a, r = s);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (n > -1 && n !== t && we(n), f) {
|
|
522
|
+
let e = E.current[n];
|
|
523
|
+
if (i(e)) {
|
|
524
|
+
let t = e.getBoundingClientRect();
|
|
525
|
+
Ce.current = t[ye ? "height" : "width"] / 2;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function R(e) {
|
|
530
|
+
let t = N(E.current?.[e]);
|
|
531
|
+
t && t.focus({
|
|
532
|
+
preventScroll: !0,
|
|
533
|
+
focusVisible: !1
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function Ee(e, t, n) {
|
|
537
|
+
let r = me(e.value, oe(t, n, void 0, { activeThumbIndex: e.thumbIndex }));
|
|
538
|
+
return r && (A.current = e.value, M.current = Array.isArray(e.value) ? e.value : [e.value], e.didSwap && (we(e.thumbIndex), R(e.thumbIndex))), r;
|
|
539
|
+
}
|
|
540
|
+
let De = o((e) => {
|
|
541
|
+
let t = tt(e, xe);
|
|
542
|
+
if (t == null) return;
|
|
543
|
+
if (Se.current += 1, e.type === "pointermove" && e.buttons === 0) {
|
|
544
|
+
z(e);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
let n = I(t);
|
|
548
|
+
n != null && Ue(n.value, T, S) && (!d && Se.current > $e && pe(!0), Ee(n, le, e));
|
|
549
|
+
}), z = o((e) => {
|
|
550
|
+
if (tt(e, xe) == null) return;
|
|
551
|
+
fe(-1), pe(!1), ie.current = null;
|
|
552
|
+
let t = A.current;
|
|
553
|
+
if (Array.isArray(t) && t.length !== D.length && (A.current = null), A.current != null) {
|
|
554
|
+
let t = y.current;
|
|
555
|
+
C(A.current, re(t, e));
|
|
556
|
+
}
|
|
557
|
+
"pointerType" in e && O.current?.hasPointerCapture(e.pointerId) && O.current?.releasePointerCapture(e.pointerId), ae.current = -1, B();
|
|
558
|
+
}), Oe = o((e) => {
|
|
559
|
+
xe.current ?? z(e);
|
|
560
|
+
}), ke = o((e) => {
|
|
561
|
+
let t = j.current;
|
|
562
|
+
if (j.current = !1, u) return;
|
|
563
|
+
if (F(te(e))) {
|
|
564
|
+
Te();
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
let n = e.changedTouches[0];
|
|
568
|
+
if (n == null) return;
|
|
569
|
+
if (xe.current = n.identifier, !t) {
|
|
570
|
+
let t = {
|
|
571
|
+
x: n.clientX,
|
|
572
|
+
y: n.clientY
|
|
573
|
+
};
|
|
574
|
+
L(t);
|
|
575
|
+
let r = I(t);
|
|
576
|
+
if (r == null) return;
|
|
577
|
+
R(r.thumbIndex), Ee(r, w, e), Se.current = 0;
|
|
578
|
+
}
|
|
579
|
+
let r = m(O.current);
|
|
580
|
+
r.addEventListener("touchmove", De, { passive: !0 }), r.addEventListener("touchend", z, { passive: !0 }), r.addEventListener("touchcancel", z, { passive: !0 });
|
|
581
|
+
}), B = o(() => {
|
|
582
|
+
let e = m(O.current);
|
|
583
|
+
e.removeEventListener("pointermove", De), e.removeEventListener("pointerup", z), e.removeEventListener("pointercancel", Oe), e.removeEventListener("touchmove", De), e.removeEventListener("touchend", z), e.removeEventListener("touchcancel", z), xe.current = null, se.current = null, A.current = null, j.current = !1;
|
|
584
|
+
}), V = _();
|
|
585
|
+
return G.useEffect(() => {
|
|
586
|
+
let e = O.current;
|
|
587
|
+
if (!e) return () => B();
|
|
588
|
+
let t = g(e, "touchstart", ke, { passive: !0 });
|
|
589
|
+
return () => {
|
|
590
|
+
t(), V.cancel(), B();
|
|
591
|
+
};
|
|
592
|
+
}, [
|
|
593
|
+
B,
|
|
594
|
+
ke,
|
|
595
|
+
O,
|
|
596
|
+
V
|
|
597
|
+
]), G.useEffect(() => {
|
|
598
|
+
u && B();
|
|
599
|
+
}, [u, B]), s("div", e, {
|
|
600
|
+
state: he,
|
|
601
|
+
ref: [
|
|
602
|
+
n,
|
|
603
|
+
ce,
|
|
604
|
+
O,
|
|
605
|
+
k
|
|
606
|
+
],
|
|
607
|
+
props: [{
|
|
608
|
+
"data-base-ui-slider-control": ue ? "" : void 0,
|
|
609
|
+
onPointerDown(e) {
|
|
610
|
+
j.current = !1;
|
|
611
|
+
let t = O.current, n = te(e.nativeEvent);
|
|
612
|
+
if (!t || u || e.defaultPrevented || !i(n) || e.button !== 0) return;
|
|
613
|
+
if (F(n)) {
|
|
614
|
+
Te();
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
let r = {
|
|
618
|
+
x: e.clientX,
|
|
619
|
+
y: e.clientY
|
|
620
|
+
};
|
|
621
|
+
L(r);
|
|
622
|
+
let a = I(r);
|
|
623
|
+
if (a == null) return;
|
|
624
|
+
p(E.current[a.thumbIndex], v(m(t))) ? e.preventDefault() : V.request(() => {
|
|
625
|
+
R(a.thumbIndex);
|
|
626
|
+
}), pe(!0), ie.current ?? Ee(a, w, e.nativeEvent), e.nativeEvent.pointerId && t.setPointerCapture(e.nativeEvent.pointerId), Se.current = 0, j.current = Q(e.pointerType);
|
|
627
|
+
let o = m(t);
|
|
628
|
+
o.addEventListener("pointermove", De, { passive: !0 }), o.addEventListener("pointerup", z, { once: !0 }), o.addEventListener("pointercancel", Oe, { once: !0 });
|
|
629
|
+
}
|
|
630
|
+
}, l],
|
|
631
|
+
stateAttributesMapping: We
|
|
632
|
+
});
|
|
633
|
+
}), rt = /*#__PURE__*/ G.forwardRef(function(e, t) {
|
|
634
|
+
let { render: n, className: r, style: i, ...a } = e, { state: o } = Ke();
|
|
635
|
+
return s("div", e, {
|
|
636
|
+
state: o,
|
|
637
|
+
ref: t,
|
|
638
|
+
props: [{ style: { position: "relative" } }, a],
|
|
639
|
+
stateAttributesMapping: We
|
|
640
|
+
});
|
|
641
|
+
}), it = "data-index", at, ot = /* @__PURE__ */ new Set([
|
|
642
|
+
...T,
|
|
643
|
+
_e,
|
|
644
|
+
me
|
|
645
|
+
]);
|
|
646
|
+
function st(e, t, n, r) {
|
|
647
|
+
if (!(t < 0)) return e.length === 2 ? `${R(e[t], r, n)} ${t === 0 ? "start" : "end"} range` : n ? R(e[t], r, n) : void 0;
|
|
648
|
+
}
|
|
649
|
+
function ct(e, t, n, r, i) {
|
|
650
|
+
let a = e + t * n, o = Number(a.toFixed(Math.max(Xe(e), Xe(t), Xe(r))));
|
|
651
|
+
return P(o, r, i);
|
|
652
|
+
}
|
|
653
|
+
var lt = /*#__PURE__*/ G.forwardRef(function(e, r) {
|
|
654
|
+
let { render: i, children: a, className: l, "aria-describedby": u, "aria-label": d, "aria-labelledby": m, "aria-valuetext": ee, disabled: g = !1, getAriaLabel: _, getAriaValueText: v, id: te, index: y, inputRef: b, onBlur: x, onFocus: S, onKeyDown: C, tabIndex: w, style: re, ...ie } = e, ae = se(te), { active: oe, lastUsedThumbIndex: ce, controlRef: le, disabled: ue, validation: D, format: O, handleInputChange: be, inset: k, isArrayValue: Se, labelId: Ce, largeStep: A, locale: j, max: M, min: N, minStepsBetweenValues: we, form: P, name: Te, orientation: F, pressedThumbCenterOffsetRef: Ee, pressedThumbIndexRef: De, renderBeforeHydration: z, setActive: Oe, setIndicatorPosition: ke, state: B, step: V, thumbRefs: Ae, values: H } = Ke(), je = de(), U = g || ue, Me = H.length > 1, W = F === "vertical", J = je === "rtl", { setTouched: Ne, validationMode: Pe } = ye(), Fe = G.useRef(null), Ie = G.useRef(null), Le = ve(U, Ie), Y = G.useRef(!1), X = o((e) => {
|
|
655
|
+
Y.current || S?.(e);
|
|
656
|
+
}), Be = o((e) => {
|
|
657
|
+
Y.current || x?.(e);
|
|
658
|
+
}), Ve = se(), Ue = xe(), Z = Me ? Ve : Ue, Ge = G.useMemo(() => ({ inputId: Z }), [Z]), { ref: qe, index: Je } = I({ metadata: Ge }), Q = Me ? y ?? Je : 0, Xe = Q === H.length - 1, $ = H[Q], Qe = L($, N, M), [$e, et] = G.useState(), tt = Re(), nt = ce >= 0 && ce < H.length ? ce : -1, rt = o(() => {
|
|
659
|
+
let e = le.current, t = Fe.current;
|
|
660
|
+
if (!e || !t) return;
|
|
661
|
+
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = W ? "height" : "width", a = r[i] - n[i], o = (n[i] / 2 + a * Qe / 100) / r[i] * 100, s = Number.isFinite(o) ? o : void 0;
|
|
662
|
+
et(s), Q === 0 ? ke((e) => [s, e[1]]) : Xe && ke((e) => [e[0], s]);
|
|
663
|
+
});
|
|
664
|
+
n(() => {
|
|
665
|
+
k && queueMicrotask(rt);
|
|
666
|
+
}, [rt, k]), n(() => {
|
|
667
|
+
k && rt();
|
|
668
|
+
}, [
|
|
669
|
+
rt,
|
|
670
|
+
k,
|
|
671
|
+
Qe
|
|
672
|
+
]), n(() => {
|
|
673
|
+
if (!k) return;
|
|
674
|
+
let e = le.current, n = Fe.current;
|
|
675
|
+
if (!e || !n) return;
|
|
676
|
+
let r = t(e).ResizeObserver;
|
|
677
|
+
if (typeof r != "function") return;
|
|
678
|
+
let i = new r(rt);
|
|
679
|
+
return i.observe(e), i.observe(n), () => {
|
|
680
|
+
i.disconnect();
|
|
681
|
+
};
|
|
682
|
+
}, [
|
|
683
|
+
le,
|
|
684
|
+
rt,
|
|
685
|
+
k
|
|
686
|
+
]);
|
|
687
|
+
let lt = W ? "bottom" : "insetInlineStart", ut = W ? "left" : "top", dt;
|
|
688
|
+
Me ? oe === Q ? dt = 2 : nt === Q && (dt = 1) : oe === Q && (dt = 1);
|
|
689
|
+
let ft;
|
|
690
|
+
ft = !k && !Number.isFinite(Qe) ? ne : {
|
|
691
|
+
position: "absolute",
|
|
692
|
+
[lt]: k ? "var(--position)" : `${Qe}%`,
|
|
693
|
+
[ut]: "50%",
|
|
694
|
+
translate: `${(W || !J ? -1 : 1) * 50}% ${(W ? 1 : -1) * 50}%`,
|
|
695
|
+
zIndex: dt,
|
|
696
|
+
...k && {
|
|
697
|
+
"--position": `${$e ?? 0}%`,
|
|
698
|
+
visibility: z && tt || $e === void 0 ? "hidden" : void 0
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
let pt;
|
|
702
|
+
W && (pt = J ? "vertical-rl" : "vertical-lr");
|
|
703
|
+
let mt = typeof _ == "function" ? _(Q) : d, ht = f({
|
|
704
|
+
"aria-label": mt,
|
|
705
|
+
"aria-labelledby": m ?? (mt == null ? Ce : void 0),
|
|
706
|
+
"aria-describedby": u,
|
|
707
|
+
"aria-orientation": F,
|
|
708
|
+
"aria-valuenow": $,
|
|
709
|
+
"aria-valuetext": typeof v == "function" ? v(R($, j, O), $, Q) : ee ?? st(H, Q, O, j),
|
|
710
|
+
disabled: U,
|
|
711
|
+
form: P,
|
|
712
|
+
id: Z,
|
|
713
|
+
max: M,
|
|
714
|
+
min: N,
|
|
715
|
+
name: Te,
|
|
716
|
+
onChange(e) {
|
|
717
|
+
be(e.currentTarget.valueAsNumber, Q, e);
|
|
718
|
+
},
|
|
719
|
+
onFocus(e) {
|
|
720
|
+
let t = Y.current;
|
|
721
|
+
Y.current = !1, Oe(Q), Le(!0), t && e.stopPropagation();
|
|
722
|
+
},
|
|
723
|
+
onBlur(e) {
|
|
724
|
+
Y.current ? e.stopPropagation() : (Oe(-1), !Ae.current.some((t) => p(t, e.relatedTarget)) && (Ne(!0), Le(!1), Pe === "onBlur" && D.commit(He($, Q, N, M, Se, H))));
|
|
725
|
+
},
|
|
726
|
+
onKeyDown(e) {
|
|
727
|
+
if (e.defaultPrevented || !ot.has(e.key)) return;
|
|
728
|
+
T.has(e.key) && e.stopPropagation();
|
|
729
|
+
let t = null, n = 0, r = e.shiftKey ? A : V, i = Ze($, V, N);
|
|
730
|
+
switch (e.key) {
|
|
731
|
+
case fe:
|
|
732
|
+
n = 1;
|
|
733
|
+
break;
|
|
734
|
+
case pe:
|
|
735
|
+
n = J ? -1 : 1;
|
|
736
|
+
break;
|
|
737
|
+
case he:
|
|
738
|
+
n = -1;
|
|
739
|
+
break;
|
|
740
|
+
case ge:
|
|
741
|
+
n = J ? 1 : -1;
|
|
742
|
+
break;
|
|
743
|
+
case _e:
|
|
744
|
+
r = A, n = 1;
|
|
745
|
+
break;
|
|
746
|
+
case me:
|
|
747
|
+
r = A, n = -1;
|
|
748
|
+
break;
|
|
749
|
+
case "End":
|
|
750
|
+
t = Me && Number.isFinite(H[Q + 1]) ? H[Q + 1] - V * we : M;
|
|
751
|
+
break;
|
|
752
|
+
case E: t = Me && Number.isFinite(H[Q - 1]) ? H[Q - 1] + V * we : N;
|
|
753
|
+
}
|
|
754
|
+
if (n !== 0 && (t = ct(i, r, n, N, M)), t !== null) {
|
|
755
|
+
let n = e.currentTarget;
|
|
756
|
+
h(n) || (Y.current = !0, n.blur(), n.focus({
|
|
757
|
+
preventScroll: !0,
|
|
758
|
+
focusVisible: !0
|
|
759
|
+
})), be(t, Q, e), e.preventDefault();
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
step: V,
|
|
763
|
+
style: {
|
|
764
|
+
...ne,
|
|
765
|
+
width: "100%",
|
|
766
|
+
height: "100%",
|
|
767
|
+
writingMode: pt
|
|
768
|
+
},
|
|
769
|
+
tabIndex: w,
|
|
770
|
+
type: "range",
|
|
771
|
+
value: $ ?? ""
|
|
772
|
+
}, (e) => D.getValidationProps(U, e), {
|
|
773
|
+
onFocus: X,
|
|
774
|
+
onBlur: Be,
|
|
775
|
+
onKeyDown: C
|
|
776
|
+
}), gt = c(Ie, D.inputRef, b);
|
|
777
|
+
return s("div", e, {
|
|
778
|
+
state: B,
|
|
779
|
+
ref: [
|
|
780
|
+
r,
|
|
781
|
+
qe,
|
|
782
|
+
Fe
|
|
783
|
+
],
|
|
784
|
+
props: [{
|
|
785
|
+
[it]: Q,
|
|
786
|
+
children: /*#__PURE__*/ q(G.Fragment, { children: [
|
|
787
|
+
a,
|
|
788
|
+
/*#__PURE__*/ K("input", {
|
|
789
|
+
ref: gt,
|
|
790
|
+
...ht,
|
|
791
|
+
suppressHydrationWarning: !0
|
|
792
|
+
}),
|
|
793
|
+
k && Xe && z && (at ||= /*#__PURE__*/ K(ze, { script: "" }))
|
|
794
|
+
] }),
|
|
795
|
+
id: ae,
|
|
796
|
+
onPointerDown(e) {
|
|
797
|
+
if (U) return;
|
|
798
|
+
De.current = Q;
|
|
799
|
+
let t = Ye(e.currentTarget, W);
|
|
800
|
+
Ee.current = (W ? e.clientY : e.clientX) - t;
|
|
801
|
+
},
|
|
802
|
+
style: ft,
|
|
803
|
+
suppressHydrationWarning: z || void 0
|
|
804
|
+
}, ie],
|
|
805
|
+
stateAttributesMapping: We
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
function ut(e, t, n, r, i, a) {
|
|
809
|
+
let o = {
|
|
810
|
+
visibility: a || n && (r === void 0 || t && i === void 0) ? "hidden" : void 0,
|
|
811
|
+
position: e ? "absolute" : "relative",
|
|
812
|
+
[e ? "width" : "height"]: "inherit"
|
|
813
|
+
}, s = `${r ?? 0}%`, c = `${(i ?? 0) - (r ?? 0)}%`;
|
|
814
|
+
return n && (o["--start-position"] = s, s = "var(--start-position)", t && (o["--relative-size"] = c, c = "var(--relative-size)")), o[e ? "bottom" : "insetInlineStart"] = t ? s : 0, o[e ? "height" : "width"] = t ? c : s, o;
|
|
815
|
+
}
|
|
816
|
+
var dt = /*#__PURE__*/ G.forwardRef(function(e, t) {
|
|
817
|
+
let { render: n, className: r, style: i, ...a } = e, { indicatorPosition: o, inset: c, max: l, min: u, orientation: d, renderBeforeHydration: f, state: p, values: m } = Ke(), ee = Re(), h = ut(d === "vertical", m.length > 1, c, c ? o[0] : L(m[0], u, l), c ? o[1] : L(m[m.length - 1], u, l), c && f && ee);
|
|
818
|
+
return s("div", e, {
|
|
819
|
+
state: p,
|
|
820
|
+
ref: t,
|
|
821
|
+
props: [{
|
|
822
|
+
"data-base-ui-slider-indicator": f ? "" : void 0,
|
|
823
|
+
style: h,
|
|
824
|
+
suppressHydrationWarning: f || void 0
|
|
825
|
+
}, a],
|
|
826
|
+
stateAttributesMapping: We
|
|
827
|
+
});
|
|
828
|
+
}), ft = G.forwardRef(function({ className: e, defaultValue: t, value: n, min: r = 0, max: i = 100, thumbAriaLabels: a, ...o }, s) {
|
|
829
|
+
let c = G.useMemo(() => Array.isArray(n) ? n : Array.isArray(t) ? t : [r], [
|
|
830
|
+
n,
|
|
831
|
+
t,
|
|
832
|
+
r
|
|
833
|
+
]);
|
|
834
|
+
return /* @__PURE__ */ K(Je, {
|
|
835
|
+
ref: s,
|
|
836
|
+
className: u("ck-slider", e),
|
|
837
|
+
"data-slot": "slider",
|
|
838
|
+
defaultValue: t,
|
|
839
|
+
value: n,
|
|
840
|
+
min: r,
|
|
841
|
+
max: i,
|
|
842
|
+
thumbAlignment: "edge",
|
|
843
|
+
...o,
|
|
844
|
+
children: /* @__PURE__ */ q(nt, {
|
|
845
|
+
className: "ck-slider-control",
|
|
846
|
+
children: [/* @__PURE__ */ K(rt, {
|
|
847
|
+
"data-slot": "slider-track",
|
|
848
|
+
className: "ck-slider-track",
|
|
849
|
+
children: /* @__PURE__ */ K(dt, {
|
|
850
|
+
"data-slot": "slider-range",
|
|
851
|
+
className: "ck-slider-range"
|
|
852
|
+
})
|
|
853
|
+
}), Array.from({ length: c.length }, (e, t) => /* @__PURE__ */ K(lt, {
|
|
854
|
+
"data-slot": "slider-thumb",
|
|
855
|
+
className: "ck-slider-thumb",
|
|
856
|
+
"aria-label": a?.[t] ?? (c.length > 1 ? `Value ${t + 1} of ${c.length}` : "Value")
|
|
857
|
+
}, t))]
|
|
858
|
+
})
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
ft.displayName = "Slider";
|
|
862
|
+
var pt = [
|
|
863
|
+
"pen",
|
|
864
|
+
"line",
|
|
865
|
+
"rect",
|
|
866
|
+
"circle",
|
|
867
|
+
"arrow"
|
|
868
|
+
];
|
|
869
|
+
function mt(e) {
|
|
870
|
+
return e != null && pt.includes(e);
|
|
871
|
+
}
|
|
872
|
+
var ht = [
|
|
873
|
+
{
|
|
874
|
+
value: "pen",
|
|
875
|
+
label: "Pen",
|
|
876
|
+
icon: ke
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
value: "line",
|
|
880
|
+
label: "Line",
|
|
881
|
+
icon: U
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
value: "rect",
|
|
885
|
+
label: "Rectangle",
|
|
886
|
+
icon: V
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
value: "circle",
|
|
890
|
+
label: "Circle",
|
|
891
|
+
icon: H
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
value: "arrow",
|
|
895
|
+
label: "Arrow",
|
|
896
|
+
icon: je
|
|
897
|
+
}
|
|
898
|
+
], gt = G.memo(function({ tools: e, colors: t, drawing: n, onSave: r, saveDisabled: i, onCancel: a }) {
|
|
899
|
+
let o = e ? ht.filter((t) => e.includes(t.value)) : ht;
|
|
900
|
+
function s(e) {
|
|
901
|
+
let t = e[0];
|
|
902
|
+
mt(t) && n.setTool(t);
|
|
903
|
+
}
|
|
904
|
+
function c(e) {
|
|
905
|
+
let t = e[0];
|
|
906
|
+
t && n.setColor(t);
|
|
907
|
+
}
|
|
908
|
+
return /* @__PURE__ */ q("div", {
|
|
909
|
+
className: "ck-annotation-toolbar",
|
|
910
|
+
role: "toolbar",
|
|
911
|
+
"aria-label": "Annotation tools",
|
|
912
|
+
children: [
|
|
913
|
+
/* @__PURE__ */ K(j, {
|
|
914
|
+
value: [n.tool],
|
|
915
|
+
onValueChange: s,
|
|
916
|
+
size: "sm",
|
|
917
|
+
spacing: 1,
|
|
918
|
+
"aria-label": "Drawing tool",
|
|
919
|
+
children: o.map(({ value: e, label: t, icon: n }) => /* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
920
|
+
render: /* @__PURE__ */ K(A, {
|
|
921
|
+
value: e,
|
|
922
|
+
"aria-label": t
|
|
923
|
+
}),
|
|
924
|
+
children: /* @__PURE__ */ K(n, {
|
|
925
|
+
size: 16,
|
|
926
|
+
stroke: 2
|
|
927
|
+
})
|
|
928
|
+
}), /* @__PURE__ */ K(y, { children: t })] }, e))
|
|
929
|
+
}),
|
|
930
|
+
/* @__PURE__ */ K(S, {
|
|
931
|
+
orientation: "vertical",
|
|
932
|
+
className: "ck-annotation-separator"
|
|
933
|
+
}),
|
|
934
|
+
/* @__PURE__ */ K(j, {
|
|
935
|
+
value: [n.color],
|
|
936
|
+
onValueChange: c,
|
|
937
|
+
size: "sm",
|
|
938
|
+
spacing: 1,
|
|
939
|
+
"aria-label": "Stroke color",
|
|
940
|
+
children: t.map((e) => /* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
941
|
+
render: /* @__PURE__ */ K(A, {
|
|
942
|
+
value: e.value,
|
|
943
|
+
"aria-label": e.label
|
|
944
|
+
}),
|
|
945
|
+
children: /* @__PURE__ */ K("span", {
|
|
946
|
+
className: "ck-annotation-swatch",
|
|
947
|
+
style: { "--ck-bg": e.value }
|
|
948
|
+
})
|
|
949
|
+
}), /* @__PURE__ */ K(y, { children: e.label })] }, e.value))
|
|
950
|
+
}),
|
|
951
|
+
/* @__PURE__ */ K(S, {
|
|
952
|
+
orientation: "vertical",
|
|
953
|
+
className: "ck-annotation-separator"
|
|
954
|
+
}),
|
|
955
|
+
/* @__PURE__ */ q("div", {
|
|
956
|
+
className: "ck-annotation-stroke",
|
|
957
|
+
children: [/* @__PURE__ */ K(ft, {
|
|
958
|
+
className: "ck-annotation-slider",
|
|
959
|
+
value: [n.strokeWidth],
|
|
960
|
+
onValueChange: (e) => {
|
|
961
|
+
let t = Array.isArray(e) ? e[0] : e;
|
|
962
|
+
t != null && Number.isFinite(t) && n.setStrokeWidth(t);
|
|
963
|
+
},
|
|
964
|
+
min: 1,
|
|
965
|
+
max: 12,
|
|
966
|
+
step: 1,
|
|
967
|
+
"aria-label": "Stroke width"
|
|
968
|
+
}), /* @__PURE__ */ q("span", {
|
|
969
|
+
className: "ck-annotation-stroke-label",
|
|
970
|
+
children: [n.strokeWidth, "px"]
|
|
971
|
+
})]
|
|
972
|
+
}),
|
|
973
|
+
/* @__PURE__ */ K(S, {
|
|
974
|
+
orientation: "vertical",
|
|
975
|
+
className: "ck-annotation-separator"
|
|
976
|
+
}),
|
|
977
|
+
/* @__PURE__ */ q(D, { children: [
|
|
978
|
+
/* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
979
|
+
render: /* @__PURE__ */ K(d, {
|
|
980
|
+
variant: "outline",
|
|
981
|
+
size: "icon-sm",
|
|
982
|
+
"aria-label": "Undo",
|
|
983
|
+
onClick: () => n.undo(),
|
|
984
|
+
disabled: !n.canUndo
|
|
985
|
+
}),
|
|
986
|
+
children: /* @__PURE__ */ K(Me, {
|
|
987
|
+
size: 16,
|
|
988
|
+
stroke: 2
|
|
989
|
+
})
|
|
990
|
+
}), /* @__PURE__ */ K(y, { children: /* @__PURE__ */ q("span", {
|
|
991
|
+
className: "ck-annotation-tooltip",
|
|
992
|
+
children: [
|
|
993
|
+
"Undo",
|
|
994
|
+
" ",
|
|
995
|
+
/* @__PURE__ */ q(M, { children: [/* @__PURE__ */ K(F, { children: "⌘" }), /* @__PURE__ */ K(F, { children: "Z" })] })
|
|
996
|
+
]
|
|
997
|
+
}) })] }),
|
|
998
|
+
/* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
999
|
+
render: /* @__PURE__ */ K(d, {
|
|
1000
|
+
variant: "outline",
|
|
1001
|
+
size: "icon-sm",
|
|
1002
|
+
"aria-label": "Redo",
|
|
1003
|
+
onClick: () => n.redo(),
|
|
1004
|
+
disabled: !n.canRedo
|
|
1005
|
+
}),
|
|
1006
|
+
children: /* @__PURE__ */ K(Ae, {
|
|
1007
|
+
size: 16,
|
|
1008
|
+
stroke: 2
|
|
1009
|
+
})
|
|
1010
|
+
}), /* @__PURE__ */ K(y, { children: /* @__PURE__ */ q("span", {
|
|
1011
|
+
className: "ck-annotation-tooltip",
|
|
1012
|
+
children: [
|
|
1013
|
+
"Redo",
|
|
1014
|
+
" ",
|
|
1015
|
+
/* @__PURE__ */ q(M, { children: [
|
|
1016
|
+
/* @__PURE__ */ K(F, { children: "⌘" }),
|
|
1017
|
+
/* @__PURE__ */ K(F, { children: "⇧" }),
|
|
1018
|
+
/* @__PURE__ */ K(F, { children: "Z" })
|
|
1019
|
+
] })
|
|
1020
|
+
]
|
|
1021
|
+
}) })] }),
|
|
1022
|
+
/* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
1023
|
+
render: /* @__PURE__ */ K(d, {
|
|
1024
|
+
variant: "outline",
|
|
1025
|
+
size: "icon-sm",
|
|
1026
|
+
"aria-label": "Clear all",
|
|
1027
|
+
onClick: () => n.clear(),
|
|
1028
|
+
disabled: n.paths.length === 0
|
|
1029
|
+
}),
|
|
1030
|
+
children: /* @__PURE__ */ K(W, {
|
|
1031
|
+
size: 16,
|
|
1032
|
+
stroke: 2
|
|
1033
|
+
})
|
|
1034
|
+
}), /* @__PURE__ */ K(y, { children: "Clear all" })] })
|
|
1035
|
+
] }),
|
|
1036
|
+
/* @__PURE__ */ K(S, {
|
|
1037
|
+
orientation: "vertical",
|
|
1038
|
+
className: "ck-annotation-separator"
|
|
1039
|
+
}),
|
|
1040
|
+
r ? /* @__PURE__ */ q(D, { children: [/* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
1041
|
+
render: /* @__PURE__ */ K(d, {
|
|
1042
|
+
variant: "outline",
|
|
1043
|
+
size: "icon-sm",
|
|
1044
|
+
"aria-label": "Cancel",
|
|
1045
|
+
onClick: a
|
|
1046
|
+
}),
|
|
1047
|
+
children: /* @__PURE__ */ K(B, {
|
|
1048
|
+
size: 16,
|
|
1049
|
+
stroke: 2
|
|
1050
|
+
})
|
|
1051
|
+
}), /* @__PURE__ */ K(y, { children: /* @__PURE__ */ q("span", {
|
|
1052
|
+
className: "ck-annotation-tooltip",
|
|
1053
|
+
children: ["Cancel ", /* @__PURE__ */ K(F, { children: "Esc" })]
|
|
1054
|
+
}) })] }), /* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
1055
|
+
render: /* @__PURE__ */ K(d, {
|
|
1056
|
+
size: "icon-sm",
|
|
1057
|
+
"aria-label": "Save drawing",
|
|
1058
|
+
"aria-disabled": i || void 0,
|
|
1059
|
+
className: l(i && "ck-annotation-save--disabled"),
|
|
1060
|
+
onClick: () => {
|
|
1061
|
+
i || r();
|
|
1062
|
+
}
|
|
1063
|
+
}),
|
|
1064
|
+
children: /* @__PURE__ */ K(Oe, {
|
|
1065
|
+
size: 16,
|
|
1066
|
+
stroke: 2
|
|
1067
|
+
})
|
|
1068
|
+
}), /* @__PURE__ */ K(y, { children: i ? "Draw something first" : "Save drawing" })] })] }) : /* @__PURE__ */ q(x, { children: [/* @__PURE__ */ K(b, {
|
|
1069
|
+
render: /* @__PURE__ */ K(d, {
|
|
1070
|
+
variant: "outline",
|
|
1071
|
+
size: "icon-sm",
|
|
1072
|
+
"aria-label": "Cancel",
|
|
1073
|
+
onClick: a
|
|
1074
|
+
}),
|
|
1075
|
+
children: /* @__PURE__ */ K(B, {
|
|
1076
|
+
size: 16,
|
|
1077
|
+
stroke: 2
|
|
1078
|
+
})
|
|
1079
|
+
}), /* @__PURE__ */ K(y, { children: /* @__PURE__ */ q("span", {
|
|
1080
|
+
className: "ck-annotation-tooltip",
|
|
1081
|
+
children: ["Cancel ", /* @__PURE__ */ K(F, { children: "Esc" })]
|
|
1082
|
+
}) })] })
|
|
1083
|
+
]
|
|
1084
|
+
});
|
|
1085
|
+
});
|
|
1086
|
+
export { Be as n, Y as r, gt as t };
|