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