@vidispine/vdt-react-timeline 23.1.0 → 23.2.0-pre.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/dist/index.js CHANGED
@@ -1,10 +1,1846 @@
1
- export { TimelineContext, TimelineProvider, useTimeline } from './TimelineContext.js';
2
- export { default as Timeline } from './Timeline/Timeline.js';
3
- export { default as TimelinePlayhead } from './TimelinePlayhead/TimelinePlayhead.js';
4
- export { default as TimelineWaveform } from './TimelineWaveform/TimelineWaveform.js';
5
- export { default as TimelineEvent } from './TimelineEvent/TimelineEvent.js';
6
- export { default as TimelineTrack } from './TimelineTrack/TimelineTrack.js';
7
- export { default as TimelineRow } from './TimelineRow/TimelineRow.js';
8
- export { default as TimelinePlayheadTrack } from './TimelinePlayheadTrack/TimelinePlayheadTrack.js';
9
- export { default as TimelineScroll } from './TimelineScroll/TimelineScroll.js';
10
- export { default as TimelineScrollContainer } from './TimelineScrollContainer/TimelineScrollContainer.js';
1
+ import { jsx as D, jsxs as te, Fragment as Fe } from "react/jsx-runtime";
2
+ import { useState as re, useRef as U, createContext as Je, useMemo as We, useContext as Ke, useEffect as le, memo as Qe, Children as oe, cloneElement as Le } from "react";
3
+ import ne from "lodash.clamp";
4
+ import F from "clsx";
5
+ import _e from "react-is";
6
+ import { Rect as ee, Stage as ue, Layer as de, Group as Pe, Text as et, Line as tt } from "react-konva";
7
+ import rt from "lodash.sortby";
8
+ import nt from "lodash.uniq";
9
+ const M = (r, i, s, n, l) => r + (l - s) * (i - r) / (n - s), we = (r, i, s) => {
10
+ process.env.NODE_ENV === "development" && console[s](`${r ? `${r}: ` : ""}${i}`);
11
+ }, J = {
12
+ error: (...r) => we(...r, "error"),
13
+ warn: (...r) => we(...r, "warn")
14
+ };
15
+ function it(r, i) {
16
+ const s = [];
17
+ for (let n = 0; n < r.length - 1; n += 1)
18
+ s.push(i(r[n], r[n + 1]));
19
+ return s;
20
+ }
21
+ function ae(...r) {
22
+ const i = getComputedStyle(document.body);
23
+ return r.map((s) => i.getPropertyValue(s));
24
+ }
25
+ function ot({
26
+ uncontrolledDefaultState: r = void 0,
27
+ uncontrolledOnChange: i = void 0,
28
+ controlledState: s = void 0,
29
+ controlledOnChange: n = void 0,
30
+ componentName: l,
31
+ stateName: o
32
+ }) {
33
+ const [f, d] = re(r), y = U(null), h = (a) => {
34
+ y.current !== null && y.current !== a && (a ? J.warn(l, `${o} changed from uncontrolled to controlled`) : J.warn(l, `${o} changed from controlled to uncontrolled`)), y.current = a;
35
+ };
36
+ return s !== void 0 ? (h(!0), [s, n]) : (h(!1), [
37
+ f,
38
+ n ? (...a) => {
39
+ i ? i(d, ...a) : d(...a), n(...a);
40
+ } : i || d
41
+ ]);
42
+ }
43
+ function st(r, i, s) {
44
+ const n = s.end - s.start < 100 && r === "in" ? 1 : 2;
45
+ return r === "in" ? 1 / n : n;
46
+ }
47
+ function at({
48
+ start: r,
49
+ end: i,
50
+ defaultPerspective: s,
51
+ perspective: n,
52
+ onChangePerspective: l,
53
+ zoomMultiplier: o = st
54
+ }) {
55
+ const [f, d] = ot({
56
+ uncontrolledDefaultState: s || {
57
+ start: r,
58
+ end: i
59
+ },
60
+ controlledState: n,
61
+ controlledOnChange: l,
62
+ componentName: "VdtTimeline",
63
+ stateName: "perspective"
64
+ }), y = typeof o == "function" ? o : (c) => c === "in" ? 1 / o : o, h = (c, p) => {
65
+ d({
66
+ start: ne(Number(c), r, i),
67
+ end: ne(Number(p), r, i)
68
+ });
69
+ };
70
+ return {
71
+ perspective: f,
72
+ setPerspective: h,
73
+ zoom: (c, p) => {
74
+ const b = f.end - f.start, E = (p - f.start) / b, g = y(c, p, f);
75
+ if (g === 1)
76
+ return;
77
+ const w = (f.end - f.start) * g, W = p - E * w, V = p + (1 - E) * w, N = (() => r > W ? r - W : V > i ? i - V : 0)();
78
+ h(
79
+ W + N,
80
+ V + N
81
+ );
82
+ }
83
+ };
84
+ }
85
+ const Ve = Je();
86
+ function ct({
87
+ start: r,
88
+ end: i,
89
+ time: s,
90
+ onChangeTime: n,
91
+ timelineRef: l,
92
+ children: o,
93
+ perspective: f,
94
+ onChangePerspective: d,
95
+ defaultPerspective: y
96
+ }) {
97
+ const h = at({
98
+ start: r,
99
+ end: i,
100
+ perspective: f,
101
+ onChangePerspective: d,
102
+ defaultPerspective: y
103
+ }), a = We(
104
+ () => ({
105
+ ...h,
106
+ start: r,
107
+ end: i,
108
+ time: s,
109
+ onChangeTime: n,
110
+ timelineRef: l
111
+ }),
112
+ [i, n, r, s, h, l]
113
+ );
114
+ return /* @__PURE__ */ D(Ve.Provider, { value: a, children: o });
115
+ }
116
+ function ie() {
117
+ return Ke(Ve);
118
+ }
119
+ var e = {}, xe = {
120
+ get exports() {
121
+ return e;
122
+ },
123
+ set exports(r) {
124
+ e = r;
125
+ }
126
+ };
127
+ /*
128
+ object-assign
129
+ (c) Sindre Sorhus
130
+ @license MIT
131
+ */
132
+ var ve, Re;
133
+ function lt() {
134
+ if (Re)
135
+ return ve;
136
+ Re = 1;
137
+ var r = Object.getOwnPropertySymbols, i = Object.prototype.hasOwnProperty, s = Object.prototype.propertyIsEnumerable;
138
+ function n(o) {
139
+ if (o == null)
140
+ throw new TypeError("Object.assign cannot be called with null or undefined");
141
+ return Object(o);
142
+ }
143
+ function l() {
144
+ try {
145
+ if (!Object.assign)
146
+ return !1;
147
+ var o = new String("abc");
148
+ if (o[5] = "de", Object.getOwnPropertyNames(o)[0] === "5")
149
+ return !1;
150
+ for (var f = {}, d = 0; d < 10; d++)
151
+ f["_" + String.fromCharCode(d)] = d;
152
+ var y = Object.getOwnPropertyNames(f).map(function(a) {
153
+ return f[a];
154
+ });
155
+ if (y.join("") !== "0123456789")
156
+ return !1;
157
+ var h = {};
158
+ return "abcdefghijklmnopqrst".split("").forEach(function(a) {
159
+ h[a] = a;
160
+ }), Object.keys(Object.assign({}, h)).join("") === "abcdefghijklmnopqrst";
161
+ } catch {
162
+ return !1;
163
+ }
164
+ }
165
+ return ve = l() ? Object.assign : function(o, f) {
166
+ for (var d, y = n(o), h, a = 1; a < arguments.length; a++) {
167
+ d = Object(arguments[a]);
168
+ for (var c in d)
169
+ i.call(d, c) && (y[c] = d[c]);
170
+ if (r) {
171
+ h = r(d);
172
+ for (var p = 0; p < h.length; p++)
173
+ s.call(d, h[p]) && (y[h[p]] = d[h[p]]);
174
+ }
175
+ }
176
+ return y;
177
+ }, ve;
178
+ }
179
+ var he, ke;
180
+ function Oe() {
181
+ if (ke)
182
+ return he;
183
+ ke = 1;
184
+ var r = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
185
+ return he = r, he;
186
+ }
187
+ var me, je;
188
+ function Ne() {
189
+ return je || (je = 1, me = Function.call.bind(Object.prototype.hasOwnProperty)), me;
190
+ }
191
+ var ye, Ae;
192
+ function ut() {
193
+ if (Ae)
194
+ return ye;
195
+ Ae = 1;
196
+ var r = function() {
197
+ };
198
+ if (process.env.NODE_ENV !== "production") {
199
+ var i = Oe(), s = {}, n = Ne();
200
+ r = function(o) {
201
+ var f = "Warning: " + o;
202
+ typeof console < "u" && console.error(f);
203
+ try {
204
+ throw new Error(f);
205
+ } catch {
206
+ }
207
+ };
208
+ }
209
+ function l(o, f, d, y, h) {
210
+ if (process.env.NODE_ENV !== "production") {
211
+ for (var a in o)
212
+ if (n(o, a)) {
213
+ var c;
214
+ try {
215
+ if (typeof o[a] != "function") {
216
+ var p = Error(
217
+ (y || "React class") + ": " + d + " type `" + a + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[a] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
218
+ );
219
+ throw p.name = "Invariant Violation", p;
220
+ }
221
+ c = o[a](f, a, y, d, null, i);
222
+ } catch (E) {
223
+ c = E;
224
+ }
225
+ if (c && !(c instanceof Error) && r(
226
+ (y || "React class") + ": type specification of " + d + " `" + a + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof c + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
227
+ ), c instanceof Error && !(c.message in s)) {
228
+ s[c.message] = !0;
229
+ var b = h ? h() : "";
230
+ r(
231
+ "Failed " + d + " type: " + c.message + (b ?? "")
232
+ );
233
+ }
234
+ }
235
+ }
236
+ }
237
+ return l.resetWarningCache = function() {
238
+ process.env.NODE_ENV !== "production" && (s = {});
239
+ }, ye = l, ye;
240
+ }
241
+ var ge, Ce;
242
+ function dt() {
243
+ if (Ce)
244
+ return ge;
245
+ Ce = 1;
246
+ var r = _e, i = lt(), s = Oe(), n = Ne(), l = ut(), o = function() {
247
+ };
248
+ process.env.NODE_ENV !== "production" && (o = function(d) {
249
+ var y = "Warning: " + d;
250
+ typeof console < "u" && console.error(y);
251
+ try {
252
+ throw new Error(y);
253
+ } catch {
254
+ }
255
+ });
256
+ function f() {
257
+ return null;
258
+ }
259
+ return ge = function(d, y) {
260
+ var h = typeof Symbol == "function" && Symbol.iterator, a = "@@iterator";
261
+ function c(t) {
262
+ var u = t && (h && t[h] || t[a]);
263
+ if (typeof u == "function")
264
+ return u;
265
+ }
266
+ var p = "<<anonymous>>", b = {
267
+ array: W("array"),
268
+ bigint: W("bigint"),
269
+ bool: W("boolean"),
270
+ func: W("function"),
271
+ number: W("number"),
272
+ object: W("object"),
273
+ string: W("string"),
274
+ symbol: W("symbol"),
275
+ any: V(),
276
+ arrayOf: N,
277
+ element: I(),
278
+ elementType: x(),
279
+ instanceOf: $,
280
+ node: _(),
281
+ objectOf: L,
282
+ oneOf: H,
283
+ oneOfType: C,
284
+ shape: Z,
285
+ exact: j
286
+ };
287
+ function E(t, u) {
288
+ return t === u ? t !== 0 || 1 / t === 1 / u : t !== t && u !== u;
289
+ }
290
+ function g(t, u) {
291
+ this.message = t, this.data = u && typeof u == "object" ? u : {}, this.stack = "";
292
+ }
293
+ g.prototype = Error.prototype;
294
+ function w(t) {
295
+ if (process.env.NODE_ENV !== "production")
296
+ var u = {}, R = 0;
297
+ function T(A, O, S, v, m, k, G) {
298
+ if (v = v || p, k = k || S, G !== s) {
299
+ if (y) {
300
+ var z = new Error(
301
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
302
+ );
303
+ throw z.name = "Invariant Violation", z;
304
+ } else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
305
+ var Q = v + ":" + S;
306
+ !u[Q] && // Avoid spamming the console because they are often not actionable except for lib authors
307
+ R < 3 && (o(
308
+ "You are manually calling a React.PropTypes validation function for the `" + k + "` prop on `" + v + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
309
+ ), u[Q] = !0, R++);
310
+ }
311
+ }
312
+ return O[S] == null ? A ? O[S] === null ? new g("The " + m + " `" + k + "` is marked as required " + ("in `" + v + "`, but its value is `null`.")) : new g("The " + m + " `" + k + "` is marked as required in " + ("`" + v + "`, but its value is `undefined`.")) : null : t(O, S, v, m, k);
313
+ }
314
+ var P = T.bind(null, !1);
315
+ return P.isRequired = T.bind(null, !0), P;
316
+ }
317
+ function W(t) {
318
+ function u(R, T, P, A, O, S) {
319
+ var v = R[T], m = X(v);
320
+ if (m !== t) {
321
+ var k = K(v);
322
+ return new g(
323
+ "Invalid " + A + " `" + O + "` of type " + ("`" + k + "` supplied to `" + P + "`, expected ") + ("`" + t + "`."),
324
+ { expectedType: t }
325
+ );
326
+ }
327
+ return null;
328
+ }
329
+ return w(u);
330
+ }
331
+ function V() {
332
+ return w(f);
333
+ }
334
+ function N(t) {
335
+ function u(R, T, P, A, O) {
336
+ if (typeof t != "function")
337
+ return new g("Property `" + O + "` of component `" + P + "` has invalid PropType notation inside arrayOf.");
338
+ var S = R[T];
339
+ if (!Array.isArray(S)) {
340
+ var v = X(S);
341
+ return new g("Invalid " + A + " `" + O + "` of type " + ("`" + v + "` supplied to `" + P + "`, expected an array."));
342
+ }
343
+ for (var m = 0; m < S.length; m++) {
344
+ var k = t(S, m, P, A, O + "[" + m + "]", s);
345
+ if (k instanceof Error)
346
+ return k;
347
+ }
348
+ return null;
349
+ }
350
+ return w(u);
351
+ }
352
+ function I() {
353
+ function t(u, R, T, P, A) {
354
+ var O = u[R];
355
+ if (!d(O)) {
356
+ var S = X(O);
357
+ return new g("Invalid " + P + " `" + A + "` of type " + ("`" + S + "` supplied to `" + T + "`, expected a single ReactElement."));
358
+ }
359
+ return null;
360
+ }
361
+ return w(t);
362
+ }
363
+ function x() {
364
+ function t(u, R, T, P, A) {
365
+ var O = u[R];
366
+ if (!r.isValidElementType(O)) {
367
+ var S = X(O);
368
+ return new g("Invalid " + P + " `" + A + "` of type " + ("`" + S + "` supplied to `" + T + "`, expected a single ReactElement type."));
369
+ }
370
+ return null;
371
+ }
372
+ return w(t);
373
+ }
374
+ function $(t) {
375
+ function u(R, T, P, A, O) {
376
+ if (!(R[T] instanceof t)) {
377
+ var S = t.name || p, v = pe(R[T]);
378
+ return new g("Invalid " + A + " `" + O + "` of type " + ("`" + v + "` supplied to `" + P + "`, expected ") + ("instance of `" + S + "`."));
379
+ }
380
+ return null;
381
+ }
382
+ return w(u);
383
+ }
384
+ function H(t) {
385
+ if (!Array.isArray(t))
386
+ return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? o(
387
+ "Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
388
+ ) : o("Invalid argument supplied to oneOf, expected an array.")), f;
389
+ function u(R, T, P, A, O) {
390
+ for (var S = R[T], v = 0; v < t.length; v++)
391
+ if (E(S, t[v]))
392
+ return null;
393
+ var m = JSON.stringify(t, function(G, z) {
394
+ var Q = K(z);
395
+ return Q === "symbol" ? String(z) : z;
396
+ });
397
+ return new g("Invalid " + A + " `" + O + "` of value `" + String(S) + "` " + ("supplied to `" + P + "`, expected one of " + m + "."));
398
+ }
399
+ return w(u);
400
+ }
401
+ function L(t) {
402
+ function u(R, T, P, A, O) {
403
+ if (typeof t != "function")
404
+ return new g("Property `" + O + "` of component `" + P + "` has invalid PropType notation inside objectOf.");
405
+ var S = R[T], v = X(S);
406
+ if (v !== "object")
407
+ return new g("Invalid " + A + " `" + O + "` of type " + ("`" + v + "` supplied to `" + P + "`, expected an object."));
408
+ for (var m in S)
409
+ if (n(S, m)) {
410
+ var k = t(S, m, P, A, O + "." + m, s);
411
+ if (k instanceof Error)
412
+ return k;
413
+ }
414
+ return null;
415
+ }
416
+ return w(u);
417
+ }
418
+ function C(t) {
419
+ if (!Array.isArray(t))
420
+ return process.env.NODE_ENV !== "production" && o("Invalid argument supplied to oneOfType, expected an instance of array."), f;
421
+ for (var u = 0; u < t.length; u++) {
422
+ var R = t[u];
423
+ if (typeof R != "function")
424
+ return o(
425
+ "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + fe(R) + " at index " + u + "."
426
+ ), f;
427
+ }
428
+ function T(P, A, O, S, v) {
429
+ for (var m = [], k = 0; k < t.length; k++) {
430
+ var G = t[k], z = G(P, A, O, S, v, s);
431
+ if (z == null)
432
+ return null;
433
+ z.data && n(z.data, "expectedType") && m.push(z.data.expectedType);
434
+ }
435
+ var Q = m.length > 0 ? ", expected one of type [" + m.join(", ") + "]" : "";
436
+ return new g("Invalid " + S + " `" + v + "` supplied to " + ("`" + O + "`" + Q + "."));
437
+ }
438
+ return w(T);
439
+ }
440
+ function _() {
441
+ function t(u, R, T, P, A) {
442
+ return q(u[R]) ? null : new g("Invalid " + P + " `" + A + "` supplied to " + ("`" + T + "`, expected a ReactNode."));
443
+ }
444
+ return w(t);
445
+ }
446
+ function Y(t, u, R, T, P) {
447
+ return new g(
448
+ (t || "React class") + ": " + u + " type `" + R + "." + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + P + "`."
449
+ );
450
+ }
451
+ function Z(t) {
452
+ function u(R, T, P, A, O) {
453
+ var S = R[T], v = X(S);
454
+ if (v !== "object")
455
+ return new g("Invalid " + A + " `" + O + "` of type `" + v + "` " + ("supplied to `" + P + "`, expected `object`."));
456
+ for (var m in t) {
457
+ var k = t[m];
458
+ if (typeof k != "function")
459
+ return Y(P, A, O, m, K(k));
460
+ var G = k(S, m, P, A, O + "." + m, s);
461
+ if (G)
462
+ return G;
463
+ }
464
+ return null;
465
+ }
466
+ return w(u);
467
+ }
468
+ function j(t) {
469
+ function u(R, T, P, A, O) {
470
+ var S = R[T], v = X(S);
471
+ if (v !== "object")
472
+ return new g("Invalid " + A + " `" + O + "` of type `" + v + "` " + ("supplied to `" + P + "`, expected `object`."));
473
+ var m = i({}, R[T], t);
474
+ for (var k in m) {
475
+ var G = t[k];
476
+ if (n(t, k) && typeof G != "function")
477
+ return Y(P, A, O, k, K(G));
478
+ if (!G)
479
+ return new g(
480
+ "Invalid " + A + " `" + O + "` key `" + k + "` supplied to `" + P + "`.\nBad object: " + JSON.stringify(R[T], null, " ") + `
481
+ Valid keys: ` + JSON.stringify(Object.keys(t), null, " ")
482
+ );
483
+ var z = G(S, k, P, A, O + "." + k, s);
484
+ if (z)
485
+ return z;
486
+ }
487
+ return null;
488
+ }
489
+ return w(u);
490
+ }
491
+ function q(t) {
492
+ switch (typeof t) {
493
+ case "number":
494
+ case "string":
495
+ case "undefined":
496
+ return !0;
497
+ case "boolean":
498
+ return !t;
499
+ case "object":
500
+ if (Array.isArray(t))
501
+ return t.every(q);
502
+ if (t === null || d(t))
503
+ return !0;
504
+ var u = c(t);
505
+ if (u) {
506
+ var R = u.call(t), T;
507
+ if (u !== t.entries) {
508
+ for (; !(T = R.next()).done; )
509
+ if (!q(T.value))
510
+ return !1;
511
+ } else
512
+ for (; !(T = R.next()).done; ) {
513
+ var P = T.value;
514
+ if (P && !q(P[1]))
515
+ return !1;
516
+ }
517
+ } else
518
+ return !1;
519
+ return !0;
520
+ default:
521
+ return !1;
522
+ }
523
+ }
524
+ function B(t, u) {
525
+ return t === "symbol" ? !0 : u ? u["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && u instanceof Symbol : !1;
526
+ }
527
+ function X(t) {
528
+ var u = typeof t;
529
+ return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : B(u, t) ? "symbol" : u;
530
+ }
531
+ function K(t) {
532
+ if (typeof t > "u" || t === null)
533
+ return "" + t;
534
+ var u = X(t);
535
+ if (u === "object") {
536
+ if (t instanceof Date)
537
+ return "date";
538
+ if (t instanceof RegExp)
539
+ return "regexp";
540
+ }
541
+ return u;
542
+ }
543
+ function fe(t) {
544
+ var u = K(t);
545
+ switch (u) {
546
+ case "array":
547
+ case "object":
548
+ return "an " + u;
549
+ case "boolean":
550
+ case "date":
551
+ case "regexp":
552
+ return "a " + u;
553
+ default:
554
+ return u;
555
+ }
556
+ }
557
+ function pe(t) {
558
+ return !t.constructor || !t.constructor.name ? p : t.constructor.name;
559
+ }
560
+ return b.checkPropTypes = l, b.resetWarningCache = l.resetWarningCache, b.PropTypes = b, b;
561
+ }, ge;
562
+ }
563
+ var Te, De;
564
+ function ft() {
565
+ if (De)
566
+ return Te;
567
+ De = 1;
568
+ var r = Oe();
569
+ function i() {
570
+ }
571
+ function s() {
572
+ }
573
+ return s.resetWarningCache = i, Te = function() {
574
+ function n(f, d, y, h, a, c) {
575
+ if (c !== r) {
576
+ var p = new Error(
577
+ "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
578
+ );
579
+ throw p.name = "Invariant Violation", p;
580
+ }
581
+ }
582
+ n.isRequired = n;
583
+ function l() {
584
+ return n;
585
+ }
586
+ var o = {
587
+ array: n,
588
+ bigint: n,
589
+ bool: n,
590
+ func: n,
591
+ number: n,
592
+ object: n,
593
+ string: n,
594
+ symbol: n,
595
+ any: n,
596
+ arrayOf: l,
597
+ element: n,
598
+ elementType: n,
599
+ instanceOf: l,
600
+ node: n,
601
+ objectOf: l,
602
+ oneOf: l,
603
+ oneOfType: l,
604
+ shape: l,
605
+ exact: l,
606
+ checkPropTypes: s,
607
+ resetWarningCache: i
608
+ };
609
+ return o.PropTypes = o, o;
610
+ }, Te;
611
+ }
612
+ if (process.env.NODE_ENV !== "production") {
613
+ var pt = _e, vt = !0;
614
+ xe.exports = dt()(pt.isElement, vt);
615
+ } else
616
+ xe.exports = ft()();
617
+ function Me({
618
+ start: r,
619
+ end: i,
620
+ time: s,
621
+ onChangeTime: n,
622
+ children: l,
623
+ className: o,
624
+ perspective: f,
625
+ onChangePerspective: d,
626
+ defaultPerspective: y,
627
+ zoomMultiplier: h,
628
+ ...a
629
+ }) {
630
+ const c = U();
631
+ return /* @__PURE__ */ D(
632
+ ct,
633
+ {
634
+ start: r,
635
+ end: i,
636
+ time: s,
637
+ onChangeTime: n,
638
+ timelineRef: c,
639
+ perspective: f,
640
+ onChangePerspective: d,
641
+ defaultPerspective: y,
642
+ zoomMultiplier: h,
643
+ children: /* @__PURE__ */ D("div", { ref: c, className: F("VdtTimeline-root", o), ...a, children: l })
644
+ }
645
+ );
646
+ }
647
+ Me.propTypes = {
648
+ /**
649
+ * Start of timeline.
650
+ */
651
+ start: e.number.isRequired,
652
+ /**
653
+ * End of timeline.
654
+ */
655
+ end: e.number.isRequired,
656
+ /**
657
+ * Place of timeline marker.
658
+ */
659
+ time: e.number,
660
+ /**
661
+ * Children components to render inside timeline.
662
+ */
663
+ children: e.oneOfType([e.arrayOf(e.node), e.node]),
664
+ /**
665
+ * Callback to trigger when changing the value of time prop.
666
+ */
667
+ onChangeTime: e.func,
668
+ /**
669
+ * Zoom level of timeline: shows ticks between start and end values (if start and end of timeline are within this range).
670
+ */
671
+ perspective: e.shape({ start: e.number, end: e.number }),
672
+ /**
673
+ * Callback to trigger when changing the value of perspective prop.
674
+ */
675
+ onChangePerspective: e.func,
676
+ /**
677
+ * Set default value for perspective when rendering component.
678
+ */
679
+ defaultPerspective: e.shape({ start: e.number, end: e.number }),
680
+ /**
681
+ * Multiply by value when zooming in.
682
+ */
683
+ zoomMultiplier: e.oneOfType([e.number, e.func]),
684
+ /**
685
+ * Override styles with className.
686
+ */
687
+ className: e.string
688
+ };
689
+ Me.defaultProps = {
690
+ time: void 0,
691
+ children: void 0,
692
+ onChangeTime: void 0,
693
+ perspective: void 0,
694
+ onChangePerspective: void 0,
695
+ defaultPerspective: void 0,
696
+ zoomMultiplier: void 0,
697
+ className: void 0
698
+ };
699
+ const He = 15, qe = 100;
700
+ const [ht] = ae("--vdt-timeline-palette-secondary"), ze = document.createElement("img");
701
+ ze.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
702
+ function $e({
703
+ className: r,
704
+ perspective: i,
705
+ time: s,
706
+ lineWidth: n,
707
+ headWidth: l,
708
+ headHeight: o,
709
+ style: f,
710
+ onDrag: d,
711
+ HeadProps: y,
712
+ ...h
713
+ }) {
714
+ var L;
715
+ const { perspective: a, time: c, onChangeTime: p } = ie() || {
716
+ perspective: i,
717
+ time: s
718
+ };
719
+ a === void 0 && J.error(
720
+ "VdtTimelinePlayhead",
721
+ "missing 'perspective' prop. If the component is used outside a VdtTimelineContext, 'perspective' must be passed explicitly"
722
+ );
723
+ const b = U(), E = (L = b.current) == null ? void 0 : L.parentElement, g = (E == null ? void 0 : E.clientWidth) || 0, [w, W] = re(!1), [V, N] = re(c), I = M(0, g, a.start, a.end, V), x = (C) => C <= a.end && C >= a.start, $ = !x(V);
724
+ le(() => {
725
+ c !== void 0 && !w && N(c);
726
+ }, [c, w]);
727
+ const H = d || p && ((C, ..._) => p(..._));
728
+ return /* @__PURE__ */ D(
729
+ "div",
730
+ {
731
+ ref: b,
732
+ className: F("VdtTimelinePlayhead-root", r),
733
+ style: {
734
+ width: n,
735
+ left: I,
736
+ display: $ && "none",
737
+ zIndex: qe,
738
+ ...f
739
+ },
740
+ draggable: !0,
741
+ onDragStart: (C) => (W(!0), C.dataTransfer.setDragImage(ze, 0, 0), !1),
742
+ onDragEnd: () => {
743
+ W(!1), H != null && H.flush && H.flush();
744
+ },
745
+ onDrag: (C) => {
746
+ if (H) {
747
+ const { x: _ } = b.current.parentElement.getBoundingClientRect(), Y = M(
748
+ a.start,
749
+ a.end,
750
+ 0,
751
+ g,
752
+ C.clientX - _
753
+ );
754
+ if (x(Y)) {
755
+ const Z = ne(Y, a.start, a.end);
756
+ H(C, Z), N(Z);
757
+ }
758
+ }
759
+ },
760
+ ...h,
761
+ children: /* @__PURE__ */ D(
762
+ "div",
763
+ {
764
+ className: "VdtTimelinePlayhead-head",
765
+ style: {
766
+ position: "absolute",
767
+ height: o,
768
+ width: l,
769
+ backgroundColor: ht,
770
+ left: -(l / 2 - n / 2),
771
+ top: -o + 1,
772
+ clipPath: "polygon(0% 0%, 0% 70%, 50% 100%, 100% 70%, 100% 0%)"
773
+ },
774
+ ...y
775
+ }
776
+ )
777
+ }
778
+ );
779
+ }
780
+ $e.propTypes = {
781
+ /**
782
+ * Apply inline CSS styling
783
+ */
784
+ style: e.instanceOf(Object),
785
+ /**
786
+ * Height of marker head in px
787
+ */
788
+ headHeight: e.number,
789
+ /**
790
+ * Width of marker head in px
791
+ */
792
+ headWidth: e.number,
793
+ /**
794
+ * Width/thickness of marker line in px
795
+ */
796
+ lineWidth: e.number,
797
+ /**
798
+ * Zoom level when looking at playhead.
799
+ */
800
+ perspective: e.shape({ start: e.number, end: e.number }),
801
+ /**
802
+ * Timeline placement of marker
803
+ */
804
+ time: e.number,
805
+ onDrag: e.func,
806
+ /**
807
+ * Additional props for marker head
808
+ */
809
+ HeadProps: e.instanceOf(Object),
810
+ /**
811
+ * Override styles with className
812
+ */
813
+ className: e.string
814
+ };
815
+ $e.defaultProps = {
816
+ style: {},
817
+ headHeight: 16,
818
+ headWidth: 12,
819
+ lineWidth: 2,
820
+ perspective: void 0,
821
+ time: 0,
822
+ onDrag: void 0,
823
+ HeadProps: {},
824
+ className: void 0
825
+ };
826
+ function se(r) {
827
+ const [i, s] = re({}), n = U(
828
+ new ResizeObserver((l) => {
829
+ var f;
830
+ const o = (f = l[0]) == null ? void 0 : f.contentRect;
831
+ o && s(o);
832
+ })
833
+ );
834
+ return le(() => {
835
+ const l = n == null ? void 0 : n.current, o = r == null ? void 0 : r.current;
836
+ return o && l.observe(o), () => {
837
+ o && l.unobserve(o);
838
+ };
839
+ }, [r]), i;
840
+ }
841
+ const [mt] = ae("--vdt-timeline-palette-primary"), yt = Qe(
842
+ ({ amplitudeSegments: r, pxPerTimeUnit: i, start: s, height: n, ...l }) => r.map(({ amplitude: o, start: f, end: d }, y) => {
843
+ const h = i * (d - f), a = (f - s) * i, c = n * o, p = (n - c) / 2;
844
+ return /* @__PURE__ */ D(
845
+ ee,
846
+ {
847
+ x: a,
848
+ y: p,
849
+ height: c,
850
+ width: h,
851
+ fill: mt,
852
+ ...l
853
+ },
854
+ y
855
+ );
856
+ })
857
+ );
858
+ function Be({
859
+ className: r,
860
+ waveform: i,
861
+ start: s,
862
+ end: n,
863
+ perspective: l,
864
+ StageProps: o,
865
+ LayerProps: f,
866
+ RectProps: d,
867
+ WaveRectProps: y,
868
+ ...h
869
+ }) {
870
+ const { start: a, end: c, perspective: p } = ie() || {
871
+ start: s,
872
+ end: n,
873
+ perspective: l
874
+ };
875
+ (a === void 0 || c === void 0 || p === void 0) && J.error(
876
+ "VdtTimelineWaveform",
877
+ "missing 'start', 'end' or 'perspective' props. If the component is used outside a VdtTimelineContext, 'start', 'end' or 'perspective' must be passed explicitly"
878
+ );
879
+ const b = U(), { width: E = 0, height: g = 0 } = se(b), w = We(
880
+ () => i.map((I, x) => ({
881
+ amplitude: I,
882
+ start: M(a, c, 0, i.length - 1, x),
883
+ end: M(a, c, 0, i.length - 1, x + 1)
884
+ })),
885
+ [i, a, c]
886
+ ), W = E / (c - a), V = (c - a) / (p.end - p.start), N = M(0, V * E, a, c, p.start);
887
+ return /* @__PURE__ */ D("div", { ref: b, className: F("VdtTimelineWaveform-root", r), ...h, children: /* @__PURE__ */ D(ue, { height: g, width: E, x: -N, scaleX: V, ...o, children: /* @__PURE__ */ te(de, { listening: !1, ...f, children: [
888
+ /* @__PURE__ */ D(ee, { x: 0, y: 0, width: E, height: g, ...d }),
889
+ /* @__PURE__ */ D(
890
+ yt,
891
+ {
892
+ amplitudeSegments: w,
893
+ pxPerTimeUnit: W,
894
+ start: a,
895
+ height: g,
896
+ ...y
897
+ }
898
+ )
899
+ ] }) }) });
900
+ }
901
+ Be.propTypes = {
902
+ /**
903
+ * Array of integers to form the wave.
904
+ */
905
+ waveform: e.arrayOf(e.number),
906
+ /**
907
+ * Set starting point of the waveform. The value provided is the value of the respective data point in passed data.
908
+ */
909
+ start: e.number,
910
+ /**
911
+ * Set ending point of the waveform. The value provided is the value of the respective data point in passed data.
912
+ */
913
+ end: e.number,
914
+ /**
915
+ * Zoom level when looking at waveform.
916
+ */
917
+ perspective: e.shape({ start: e.number, end: e.number }),
918
+ /**
919
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Stage.html
920
+ */
921
+ StageProps: e.instanceOf(Object),
922
+ /**
923
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Layer.html
924
+ */
925
+ LayerProps: e.instanceOf(Object),
926
+ /**
927
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Rect.html
928
+ */
929
+ RectProps: e.instanceOf(Object),
930
+ /**
931
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Rect.html
932
+ */
933
+ WaveRectProps: e.instanceOf(Object),
934
+ /**
935
+ * Override styles with className
936
+ */
937
+ className: e.string
938
+ };
939
+ Be.defaultProps = {
940
+ waveform: [],
941
+ start: void 0,
942
+ end: void 0,
943
+ perspective: void 0,
944
+ StageProps: {},
945
+ LayerProps: {},
946
+ RectProps: {},
947
+ WaveRectProps: {},
948
+ className: void 0
949
+ };
950
+ function ce({ hoverEffect: r = () => {
951
+ } } = {}) {
952
+ const [i, s] = re(!1), n = U(null);
953
+ return {
954
+ isHovering: i,
955
+ onMouseEnter: (l) => {
956
+ s(!0), n.current = r(l);
957
+ },
958
+ onMouseLeave: () => {
959
+ s(!1), n.current && n.current(), n.current = null;
960
+ }
961
+ };
962
+ }
963
+ const [gt, Tt] = ae(
964
+ "--vdt-timeline-palette-primary",
965
+ "--vdt-timeline-palette-primary-dark"
966
+ ), be = 5;
967
+ function Ge({
968
+ onClick: r,
969
+ x: i,
970
+ width: s,
971
+ y: n,
972
+ height: l,
973
+ padding: o,
974
+ start: f,
975
+ end: d,
976
+ onHover: y,
977
+ onMove: h,
978
+ onMoveStart: a,
979
+ onMoveEnd: c,
980
+ onResize: p,
981
+ onResizeStart: b,
982
+ onResizeEnd: E,
983
+ ...g
984
+ }) {
985
+ [i, s, n, l].some((j) => j === void 0) && J.error(
986
+ "VdtTimelineEvent",
987
+ "missing 'x', 'width', 'y', or 'height' props. If the component is not used as a direct child of VdtTimelineTrack, 'x', 'width', 'y', or 'height' must be passed explicitly"
988
+ );
989
+ const w = U(), { isHovering: W, ...V } = ce({
990
+ hoverEffect: (j) => (y && y(j, !0), () => {
991
+ y && y(j, !1);
992
+ })
993
+ }), { isHovering: N, ...I } = ce({
994
+ hoverEffect: (j) => (p && (j.target.getStage().container().style.cursor = "col-resize"), () => {
995
+ p && (j.target.getStage().container().style.cursor = "default");
996
+ })
997
+ }), [x, $] = re(!1), H = !!r;
998
+ le(() => {
999
+ if (w.current) {
1000
+ const j = (() => x ? "grabbing" : W && H ? "pointer" : "default")();
1001
+ w.current.getStage().container().style.cursor = j;
1002
+ }
1003
+ }, [x, W, H]);
1004
+ const L = n + o, C = l - 2 * o, _ = {
1005
+ y: L,
1006
+ height: C,
1007
+ x: i,
1008
+ width: s
1009
+ }, Y = W || N ? {
1010
+ fill: Tt
1011
+ } : {}, Z = (j) => {
1012
+ const q = j === "start" ? i : i + s - be;
1013
+ return {
1014
+ onDragStart: () => {
1015
+ b && b(j);
1016
+ },
1017
+ draggable: !!p,
1018
+ dragBoundFunc: (B) => ({ x: B.x, y: L }),
1019
+ onDragEnd: () => {
1020
+ E && E(j);
1021
+ },
1022
+ width: be,
1023
+ x: q,
1024
+ onDragMove: (B) => {
1025
+ if (!p)
1026
+ return;
1027
+ const { x: X } = B.target.position();
1028
+ B.target.x(q);
1029
+ const K = Math.floor(
1030
+ M(
1031
+ f,
1032
+ d,
1033
+ i,
1034
+ i + s,
1035
+ X + (j === "start" ? 0 : be)
1036
+ )
1037
+ );
1038
+ p(B, j, K);
1039
+ }
1040
+ };
1041
+ };
1042
+ return /* @__PURE__ */ te(Fe, { children: [
1043
+ /* @__PURE__ */ D(
1044
+ ee,
1045
+ {
1046
+ ref: w,
1047
+ draggable: !!h,
1048
+ dragBoundFunc: (j) => ({ x: j.x, y: L }),
1049
+ onDragStart: (j) => {
1050
+ h && ($(!0), a && a(j));
1051
+ },
1052
+ onDragEnd: (j) => {
1053
+ h && ($(!1), c && c(j));
1054
+ },
1055
+ onDragMove: (j) => {
1056
+ if (!h)
1057
+ return;
1058
+ const { x: q } = j.target.position();
1059
+ j.target.x(i);
1060
+ const B = Math.floor(M(f, d, i, i + s, q));
1061
+ h(j, B);
1062
+ },
1063
+ fill: gt,
1064
+ onClick: r,
1065
+ ..._,
1066
+ ...Y,
1067
+ ...V,
1068
+ ...g
1069
+ }
1070
+ ),
1071
+ /* @__PURE__ */ D(ee, { ..._, ...I, ...Z("start") }),
1072
+ /* @__PURE__ */ D(ee, { ..._, ...I, ...Z("end") })
1073
+ ] });
1074
+ }
1075
+ Ge.propTypes = {
1076
+ /**
1077
+ * Callback to trigger on clicking on timeline event component.
1078
+ */
1079
+ onClick: e.func,
1080
+ /**
1081
+ * Callback to trigger on hovering over timeline event component.
1082
+ */
1083
+ onHover: e.func,
1084
+ /**
1085
+ * Callback to trigger on moving a timeline event component (when mousedown and dragging).
1086
+ */
1087
+ onMove: e.func,
1088
+ /**
1089
+ * Callback to trigger on moving a timeline event component only when mousedown and dragging.
1090
+ */
1091
+ onMoveStart: e.func,
1092
+ /**
1093
+ * Callback to trigger on moving a timeline event component only when mouseup and not dragging.
1094
+ */
1095
+ onMoveEnd: e.func,
1096
+ /**
1097
+ * Callback to trigger on resizing a timeline event component.
1098
+ */
1099
+ onResize: e.func,
1100
+ /**
1101
+ * Callback to trigger on resizing a timeline event component only when mousedown and dragging.
1102
+ */
1103
+ onResizeStart: e.func,
1104
+ /**
1105
+ * Callback to trigger on resizing a timeline event component only when mouseup and not dragging.
1106
+ */
1107
+ onResizeEnd: e.func,
1108
+ /**
1109
+ * Position of event bar in x-axis (px)
1110
+ */
1111
+ x: e.number,
1112
+ /**
1113
+ * Width of event bar in px
1114
+ */
1115
+ width: e.number,
1116
+ /**
1117
+ * Position of event bar in y-axis (px)
1118
+ */
1119
+ y: e.number,
1120
+ /**
1121
+ * Height of event bar in px
1122
+ */
1123
+ height: e.number,
1124
+ /**
1125
+ * Padding of event bar in px
1126
+ */
1127
+ padding: e.number,
1128
+ /**
1129
+ * Start of timeline event
1130
+ */
1131
+ start: e.number.isRequired,
1132
+ /**
1133
+ * End of timeline event
1134
+ */
1135
+ end: e.number.isRequired,
1136
+ /**
1137
+ * Override styles with className
1138
+ */
1139
+ className: e.string
1140
+ };
1141
+ Ge.defaultProps = {
1142
+ onClick: void 0,
1143
+ onHover: void 0,
1144
+ onMove: void 0,
1145
+ onMoveStart: void 0,
1146
+ onMoveEnd: void 0,
1147
+ onResize: void 0,
1148
+ onResizeStart: void 0,
1149
+ onResizeEnd: void 0,
1150
+ x: void 0,
1151
+ width: void 0,
1152
+ y: 0,
1153
+ height: He,
1154
+ padding: 1,
1155
+ className: void 0
1156
+ };
1157
+ function Xe({
1158
+ className: r,
1159
+ children: i,
1160
+ perspective: s,
1161
+ onClick: n,
1162
+ style: l,
1163
+ onHover: o,
1164
+ StageProps: f,
1165
+ LayerProps: d,
1166
+ GroupProps: y,
1167
+ RectProps: h,
1168
+ ...a
1169
+ }) {
1170
+ const { perspective: c } = ie() || {
1171
+ perspective: s
1172
+ };
1173
+ c === void 0 && J.error(
1174
+ "VdtTimelineTrack",
1175
+ "missing 'perspective' prop. If the component is used outside a VdtTimelineContext, 'perspective' must be passed explicitly"
1176
+ );
1177
+ const p = oe.toArray(i).filter(({ props: I = {} }) => !(I.start > c.end || I.end < c.start)), b = U(), { width: E = 0, height: g = 0 } = se(b), w = Math.max(...oe.map(i, ({ props: { y: I = 0, height: x = 0 } = {} }) => I + x)) || He, W = (I) => {
1178
+ const { start: x, end: $ } = I.props || {}, H = (() => {
1179
+ if (x !== void 0 && $ !== void 0) {
1180
+ const L = M(
1181
+ 0,
1182
+ E,
1183
+ c.start,
1184
+ c.end,
1185
+ x
1186
+ ), C = M(0, E, c.start, c.end, $) - L;
1187
+ return {
1188
+ x: L,
1189
+ width: C
1190
+ };
1191
+ }
1192
+ return {};
1193
+ })();
1194
+ return Le(I, {
1195
+ ...I.props,
1196
+ ...H
1197
+ });
1198
+ }, { isHovering: V, ...N } = ce({
1199
+ hoverEffect: (I) => {
1200
+ o && o(I, !0);
1201
+ const x = I.target.getStage().container();
1202
+ return n && (x.style.cursor = "pointer"), () => {
1203
+ o && o(I, !1), n && (x.style.cursor = "default");
1204
+ };
1205
+ }
1206
+ });
1207
+ return /* @__PURE__ */ D(
1208
+ "div",
1209
+ {
1210
+ ref: b,
1211
+ className: F("VdtTimelineTrack-root", r),
1212
+ style: { height: w, ...l },
1213
+ ...a,
1214
+ children: /* @__PURE__ */ D(ue, { height: g, width: E, ...f, children: /* @__PURE__ */ D(de, { ...d, children: /* @__PURE__ */ te(Pe, { ...y, children: [
1215
+ /* @__PURE__ */ D(
1216
+ ee,
1217
+ {
1218
+ x: 0,
1219
+ y: 0,
1220
+ width: E,
1221
+ height: g,
1222
+ onClick: n,
1223
+ ...N,
1224
+ ...h
1225
+ }
1226
+ ),
1227
+ oe.map(p, W)
1228
+ ] }) }) })
1229
+ }
1230
+ );
1231
+ }
1232
+ Xe.propTypes = {
1233
+ /**
1234
+ * children are positioned within the track according to 'start' and 'end' props passed to them
1235
+ */
1236
+ // children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
1237
+ children(r, i, s) {
1238
+ const n = r[i];
1239
+ let l;
1240
+ return oe.forEach(n, (o) => {
1241
+ const { props: { start: f, end: d } = {} } = o;
1242
+ (f === void 0 || d === void 0) && (l = new Error(
1243
+ `children of ${s} must be passed a 'start' and 'end' prop. These props are used to position the child within the track.`
1244
+ ));
1245
+ }), l;
1246
+ },
1247
+ /**
1248
+ * Start and end of timeline scroll, unzoomed
1249
+ */
1250
+ perspective: e.shape({ start: e.number, end: e.number }),
1251
+ /**
1252
+ * Callback to trigger on timeline track component click.
1253
+ */
1254
+ onClick: e.func,
1255
+ /**
1256
+ * Callback to trigger on mouse hover over timeline track component.
1257
+ */
1258
+ onHover: e.func,
1259
+ /**
1260
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Stage.html
1261
+ */
1262
+ StageProps: e.instanceOf(Object),
1263
+ /**
1264
+ * Props for Layer component. For more information: https://konvajs.org/api/Konva.Layer.html
1265
+ */
1266
+ LayerProps: e.instanceOf(Object),
1267
+ /**
1268
+ * Props for Group component. For more information: https://konvajs.org/api/Konva.Group.html
1269
+ */
1270
+ GroupProps: e.instanceOf(Object),
1271
+ /**
1272
+ * Props for Rect component. For more information: https://konvajs.org/api/Konva.Rect.html
1273
+ */
1274
+ RectProps: e.instanceOf(Object),
1275
+ /**
1276
+ * Override styles with className
1277
+ */
1278
+ className: e.string,
1279
+ /**
1280
+ * Apply inline CSS styling
1281
+ */
1282
+ style: e.instanceOf(Object)
1283
+ };
1284
+ Xe.defaultProps = {
1285
+ style: {},
1286
+ children: void 0,
1287
+ perspective: void 0,
1288
+ onClick: void 0,
1289
+ onHover: void 0,
1290
+ StageProps: {},
1291
+ LayerProps: {},
1292
+ GroupProps: {},
1293
+ RectProps: {},
1294
+ className: void 0
1295
+ };
1296
+ function Ee({
1297
+ className: r,
1298
+ children: i,
1299
+ label: s,
1300
+ LabelProps: n,
1301
+ LabelTextProps: l,
1302
+ ...o
1303
+ }) {
1304
+ return /* @__PURE__ */ te(
1305
+ "div",
1306
+ {
1307
+ className: F("VdtTimelineRow-root", r, {
1308
+ "VdtTimelineRow-hasLabel": !!s
1309
+ }),
1310
+ ...o,
1311
+ children: [
1312
+ s && /* @__PURE__ */ D("div", { className: "VdtTimelineRow-label", ...n, children: /* @__PURE__ */ D("span", { className: "VdtTimelineRow-labelText", ...l, children: s }) }),
1313
+ i
1314
+ ]
1315
+ }
1316
+ );
1317
+ }
1318
+ Ee.propTypes = {
1319
+ /**
1320
+ * Children components to render inside row content container.
1321
+ */
1322
+ children: e.oneOfType([e.arrayOf(e.node), e.node]),
1323
+ /**
1324
+ * Custom row label
1325
+ */
1326
+ label: e.node,
1327
+ /**
1328
+ * Props for Layer component. For more information: https://konvajs.org/api/Konva.Label.html
1329
+ */
1330
+ LabelProps: e.instanceOf(Object),
1331
+ /**
1332
+ * Props for Layer component. For more information: https://konvajs.org/api/Konva.Label.html
1333
+ */
1334
+ LabelTextProps: e.instanceOf(Object),
1335
+ /**
1336
+ * Override styles with className
1337
+ */
1338
+ className: e.string,
1339
+ /**
1340
+ * Apply inline CSS styling
1341
+ */
1342
+ style: e.instanceOf(Object)
1343
+ };
1344
+ Ee.defaultProps = {
1345
+ children: void 0,
1346
+ label: void 0,
1347
+ LabelProps: {},
1348
+ LabelTextProps: {},
1349
+ className: void 0,
1350
+ style: {}
1351
+ };
1352
+ const Ie = 2, [bt, Pt] = ae(
1353
+ "--vdt-timeline-palette-text-primary",
1354
+ "--vdt-timeline-palette-text-secondary"
1355
+ );
1356
+ function Ot({ x: r, y: i, minX: s, maxX: n, label: l, TickGroupProps: o, TickTextProps: f, TickLineProps: d }) {
1357
+ const y = l !== void 0, { color: h, tickWidth: a, tickSize: c } = y ? {
1358
+ color: bt,
1359
+ tickWidth: 2,
1360
+ tickSize: 8
1361
+ } : {
1362
+ color: Pt,
1363
+ tickWidth: 1,
1364
+ tickSize: 4
1365
+ }, [p, b] = re(), E = U();
1366
+ le(() => {
1367
+ E.current && b(E.current.getTextWidth());
1368
+ }, []);
1369
+ const g = ne(r - p / 2, s + Ie, n - p - Ie) || void 0;
1370
+ return r < s || r > n ? null : /* @__PURE__ */ te(Pe, { ...o, children: [
1371
+ /* @__PURE__ */ D(
1372
+ et,
1373
+ {
1374
+ ref: E,
1375
+ x: g,
1376
+ y: i - c - 20,
1377
+ fontFamily: "Helvetica",
1378
+ text: l,
1379
+ fontStyle: "bold",
1380
+ fontSize: 10,
1381
+ fill: h,
1382
+ ...f
1383
+ }
1384
+ ),
1385
+ /* @__PURE__ */ D(
1386
+ tt,
1387
+ {
1388
+ points: [r, i - c, r, i],
1389
+ stroke: h,
1390
+ strokeWidth: a,
1391
+ ...d
1392
+ }
1393
+ )
1394
+ ] });
1395
+ }
1396
+ function Ye({ width: r, perspective: i }) {
1397
+ const s = Math.max(Math.floor(r / 90), 2), n = nt(
1398
+ [...Array(s).keys()].map(
1399
+ (o) => M(i.start, i.end, 0, s - 1, o)
1400
+ )
1401
+ ).map((o) => ({
1402
+ time: o,
1403
+ label: String(Math.round(o))
1404
+ })), l = it(n, (o, f) => {
1405
+ const d = (f.time - o.time) / 10;
1406
+ return [...Array(9).keys()].map((y) => ({ time: o.time + (y + 1) * d }));
1407
+ }).flat();
1408
+ return rt([...n, ...l], ["time"]);
1409
+ }
1410
+ function Ue({
1411
+ className: r,
1412
+ children: i,
1413
+ ticks: s,
1414
+ onClick: n,
1415
+ onHover: l,
1416
+ onWheel: o,
1417
+ onDrag: f,
1418
+ start: d,
1419
+ end: y,
1420
+ perspective: h,
1421
+ timelineRef: a,
1422
+ StageProps: c,
1423
+ LayerProps: p,
1424
+ GroupProps: b,
1425
+ RectProps: E,
1426
+ TickGroupProps: g,
1427
+ TickTextProps: w,
1428
+ TickLineProps: W,
1429
+ ...V
1430
+ }) {
1431
+ var O, S;
1432
+ const { start: N, end: I, perspective: x, setPerspective: $, zoom: H, onChangeTime: L, timelineRef: C } = ie() || {
1433
+ start: d,
1434
+ end: y,
1435
+ perspective: h,
1436
+ timelineRef: a
1437
+ };
1438
+ (N === void 0 || I === void 0 || x === void 0) && J.error(
1439
+ "VdtTimelinePlayheadTrack",
1440
+ "missing 'start', 'end' or 'perspective' props. If the component is used outside a VdtTimelineContext, 'start', 'end' and 'perspective' must be passed explicitly"
1441
+ ), C === void 0 && (i == null ? void 0 : i.length) > 0 && J.warn(
1442
+ "VdtTimelinePlayheadTrack",
1443
+ "missing 'timelineRef' prop. This ref is used to set the height of the playhead within the timeline."
1444
+ );
1445
+ const _ = o || H && ((v, ...m) => H(...m)), Y = n || L && ((v, ...m) => L(...m)), Z = f || $ && ((v, ...m) => $(...m)), j = U(), { width: q = 0, height: B = 0 } = se(j), X = s || Ye, fe = (typeof X == "function" ? X({ start: N, end: I, width: q, perspective: x }) : X).map(({ label: v, time: m }) => ({
1446
+ x: M(0, q, x.start, x.end, m),
1447
+ label: v,
1448
+ time: m
1449
+ })), { height: pe } = se(C), t = (((O = j == null ? void 0 : j.current) == null ? void 0 : O.offsetTop) || 0) - (((S = C == null ? void 0 : C.current) == null ? void 0 : S.offsetTop) || 0), u = B, R = pe - B - t || void 0, T = U(), { isHovering: P, ...A } = ce({
1450
+ hoverEffect: (v) => {
1451
+ l && l(v, !0);
1452
+ const m = v.target.getStage().container();
1453
+ return Y && (m.style.cursor = "pointer"), () => {
1454
+ l && l(v, !1), Y && (m.style.cursor = "default");
1455
+ };
1456
+ }
1457
+ });
1458
+ return /* @__PURE__ */ te(
1459
+ "div",
1460
+ {
1461
+ ref: j,
1462
+ className: F("VdtTimelinePlayheadTrack-root", r),
1463
+ ...V,
1464
+ children: [
1465
+ oe.map(
1466
+ i,
1467
+ (v) => Le(v, {
1468
+ style: {
1469
+ top: u,
1470
+ height: R
1471
+ }
1472
+ })
1473
+ ),
1474
+ /* @__PURE__ */ D(ue, { height: B, width: q, ...c, children: /* @__PURE__ */ D(de, { ...p, children: /* @__PURE__ */ te(
1475
+ Pe,
1476
+ {
1477
+ onClick: (v) => {
1478
+ if (T.current && Y) {
1479
+ const { x: m } = T.current.getRelativePointerPosition();
1480
+ Y(v, M(x.start, x.end, 0, q, m));
1481
+ }
1482
+ },
1483
+ onWheel: (v) => {
1484
+ if (T.current && _) {
1485
+ const { x: m } = T.current.getRelativePointerPosition();
1486
+ _(
1487
+ v,
1488
+ v.evt.deltaY < 0 ? "in" : "out",
1489
+ M(x.start, x.end, 0, q, m)
1490
+ );
1491
+ }
1492
+ },
1493
+ draggable: !0,
1494
+ dragBoundFunc: () => ({ x: 0, y: 0 }),
1495
+ onDragStart: (v) => {
1496
+ const m = v.target.getStage().container();
1497
+ m.style.cursor = "grabbing";
1498
+ },
1499
+ onDragEnd: (v) => {
1500
+ const m = v.target.getStage().container();
1501
+ m.style.cursor = "pointer";
1502
+ },
1503
+ onDragMove: (v) => {
1504
+ if (Z) {
1505
+ const { movementX: m } = v.evt;
1506
+ if (m === 0)
1507
+ return;
1508
+ const k = M(
1509
+ x.start,
1510
+ x.end,
1511
+ 0,
1512
+ q,
1513
+ -m
1514
+ ), G = x.end - x.start, z = ne(k, N, I - G), Q = z + G;
1515
+ Z(v, z, Q);
1516
+ }
1517
+ },
1518
+ ...A,
1519
+ ...b,
1520
+ children: [
1521
+ /* @__PURE__ */ D(ee, { ref: T, x: 0, y: 0, width: q, height: B, ...E }),
1522
+ fe.map(({ x: v, label: m, time: k }) => /* @__PURE__ */ D(
1523
+ Ot,
1524
+ {
1525
+ minX: 0,
1526
+ maxX: q,
1527
+ x: v,
1528
+ label: m,
1529
+ y: B,
1530
+ TickGroupProps: g,
1531
+ TickLineProps: W,
1532
+ TickTextProps: w
1533
+ },
1534
+ k
1535
+ ))
1536
+ ]
1537
+ }
1538
+ ) }) })
1539
+ ]
1540
+ }
1541
+ );
1542
+ }
1543
+ Ue.propTypes = {
1544
+ /**
1545
+ * Callback to trigger on clicking on playhead track component.
1546
+ */
1547
+ onClick: e.func,
1548
+ /**
1549
+ * Callback to trigger on mouse hover over playhead track component.
1550
+ */
1551
+ onHover: e.func,
1552
+ /**
1553
+ * Array of (large) timeline tick objects. Set time and label.
1554
+ */
1555
+ ticks: e.oneOfType([
1556
+ e.arrayOf(
1557
+ e.shape({
1558
+ time: e.number,
1559
+ label: e.string
1560
+ })
1561
+ ),
1562
+ e.func
1563
+ ]),
1564
+ /**
1565
+ * Callback to trigger on using the mouse wheel.
1566
+ */
1567
+ onWheel: e.func,
1568
+ /**
1569
+ * Callback to trigger on dragging playhead track component
1570
+ */
1571
+ onDrag: e.func,
1572
+ /**
1573
+ * Children components to render before/above the playhead track, according to top and height props passed to playhead track.
1574
+ */
1575
+ children: e.oneOfType([e.arrayOf(e.node), e.node]),
1576
+ /**
1577
+ * Start of playhead track.
1578
+ */
1579
+ start: e.number,
1580
+ /**
1581
+ * End of playhead track.
1582
+ */
1583
+ end: e.number,
1584
+ /**
1585
+ * Zoom level when looking at track.
1586
+ */
1587
+ perspective: e.shape({ start: e.number, end: e.number }),
1588
+ /**
1589
+ * Ref object to track timeline events.
1590
+ */
1591
+ timelineRef: e.shape({ current: e.instanceOf(Element) }),
1592
+ /**
1593
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Stage.html
1594
+ */
1595
+ StageProps: e.instanceOf(Object),
1596
+ /**
1597
+ * Props for Layer component. For more information: https://konvajs.org/api/Konva.Layer.html
1598
+ */
1599
+ LayerProps: e.instanceOf(Object),
1600
+ /**
1601
+ * Props for Group component. For more information: https://konvajs.org/api/Konva.Group.html
1602
+ */
1603
+ GroupProps: e.instanceOf(Object),
1604
+ /**
1605
+ * Props for React component. For more information: https://konvajs.org/api/Konva.Rect.html
1606
+ */
1607
+ RectProps: e.instanceOf(Object),
1608
+ /**
1609
+ * Props for Group component. For more information: https://konvajs.org/api/Konva.Group.html
1610
+ */
1611
+ TickGroupProps: e.instanceOf(Object),
1612
+ /**
1613
+ * Props for Group component. For more information: https://konvajs.org/api/Konva.Text.html
1614
+ */
1615
+ TickTextProps: e.instanceOf(Object),
1616
+ /**
1617
+ * Props for Group component. For more information: https://konvajs.org/api/Konva.Line.html
1618
+ */
1619
+ TickLineProps: e.instanceOf(Object),
1620
+ /**
1621
+ * Override styles with className
1622
+ */
1623
+ className: e.string,
1624
+ /**
1625
+ * Apply inline CSS styling
1626
+ */
1627
+ style: e.instanceOf(Object)
1628
+ };
1629
+ Ue.defaultProps = {
1630
+ onClick: void 0,
1631
+ onHover: void 0,
1632
+ ticks: Ye,
1633
+ children: void 0,
1634
+ start: void 0,
1635
+ end: void 0,
1636
+ perspective: void 0,
1637
+ onWheel: void 0,
1638
+ onDrag: void 0,
1639
+ timelineRef: void 0,
1640
+ StageProps: {},
1641
+ LayerProps: {},
1642
+ GroupProps: {},
1643
+ RectProps: {},
1644
+ TickGroupProps: {},
1645
+ TickTextProps: {},
1646
+ TickLineProps: {},
1647
+ className: void 0,
1648
+ style: {}
1649
+ };
1650
+ const [Et] = ae("--vdt-timeline-palette-secondary");
1651
+ function Se({
1652
+ className: r,
1653
+ onScroll: i,
1654
+ onClick: s,
1655
+ start: n,
1656
+ end: l,
1657
+ perspective: o,
1658
+ style: f,
1659
+ StageProps: d,
1660
+ LayerProps: y,
1661
+ RectProps: h,
1662
+ ...a
1663
+ }) {
1664
+ const { start: c, end: p, perspective: b, setPerspective: E } = ie() || {
1665
+ start: n,
1666
+ end: l,
1667
+ perspective: o
1668
+ };
1669
+ (c === void 0 || p === void 0 || b === void 0) && J.error(
1670
+ "VdtTimelineScroll",
1671
+ "missing 'start', 'end' or 'perspective' props. If the component is used outside a VdtTimelineContext, 'start', 'end' and 'perspective' must be passed explicitly"
1672
+ );
1673
+ const g = U(), { width: w = 0, height: W = 0 } = se(g), V = M(0, w, c, p, b.start), N = b.end - b.start, I = M(0, w, 0, p - c, N), x = i || E && ((L, ...C) => E(...C)), $ = s || E && ((L, ...C) => E(...C)), H = c !== b.start || p !== b.end;
1674
+ return /* @__PURE__ */ D(
1675
+ "div",
1676
+ {
1677
+ className: F("VdtTimelineScroll-root", r),
1678
+ style: { display: !H && "none", zIndex: qe + 1, ...f },
1679
+ ref: g,
1680
+ ...a,
1681
+ children: /* @__PURE__ */ D(
1682
+ ue,
1683
+ {
1684
+ height: W,
1685
+ width: w,
1686
+ onClick: (L) => {
1687
+ if (!$)
1688
+ return;
1689
+ const { x: C } = L.currentTarget.getRelativePointerPosition();
1690
+ let _;
1691
+ C > V + I ? _ = Math.floor(M(c, p, 0, w, C - I)) : C < V && (_ = Math.floor(M(c, p, 0, w, C))), _ !== void 0 && _ !== b.start && $(L, _, _ + N);
1692
+ },
1693
+ ...d,
1694
+ children: /* @__PURE__ */ D(de, { ...y, children: /* @__PURE__ */ D(
1695
+ ee,
1696
+ {
1697
+ x: V,
1698
+ y: 0,
1699
+ width: I,
1700
+ height: W,
1701
+ fill: Et,
1702
+ draggable: !0,
1703
+ dragBoundFunc: (L) => ({ x: ne(L.x, 0, w - I), y: 0 }),
1704
+ onDragMove: (L) => {
1705
+ if (!x)
1706
+ return;
1707
+ const { x: C } = L.target.position();
1708
+ L.target.x(V);
1709
+ const _ = Math.floor(M(c, p, 0, w, C));
1710
+ x(L, _, _ + N);
1711
+ },
1712
+ ...h
1713
+ }
1714
+ ) })
1715
+ }
1716
+ )
1717
+ }
1718
+ );
1719
+ }
1720
+ Se.propTypes = {
1721
+ /**
1722
+ * Callback to trigger on timeline component scroll.
1723
+ */
1724
+ onScroll: e.func,
1725
+ /**
1726
+ * Callback to trigger on timeline component click.
1727
+ */
1728
+ onClick: e.func,
1729
+ /**
1730
+ * Start time of timeline scroll.
1731
+ */
1732
+ start: e.number,
1733
+ /**
1734
+ * End time of timeline scroll
1735
+ */
1736
+ end: e.number,
1737
+ /**
1738
+ * Zoom level of timeline scroll.
1739
+ */
1740
+ perspective: e.shape({ start: e.number, end: e.number }),
1741
+ /**
1742
+ * Apply inline CSS styling
1743
+ */
1744
+ style: e.instanceOf(Object),
1745
+ /**
1746
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Stage.html
1747
+ */
1748
+ StageProps: e.instanceOf(Object),
1749
+ /**
1750
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Layer.html
1751
+ */
1752
+ LayerProps: e.instanceOf(Object),
1753
+ /**
1754
+ * Props for Stage component. For more information: https://konvajs.org/api/Konva.Rect.html
1755
+ */
1756
+ RectProps: e.instanceOf(Object),
1757
+ /**
1758
+ * Override styles with className
1759
+ */
1760
+ className: e.string
1761
+ };
1762
+ Se.defaultProps = {
1763
+ onScroll: void 0,
1764
+ onClick: void 0,
1765
+ start: void 0,
1766
+ end: void 0,
1767
+ perspective: void 0,
1768
+ style: {},
1769
+ StageProps: {},
1770
+ LayerProps: {},
1771
+ RectProps: {},
1772
+ className: void 0
1773
+ };
1774
+ function St(r, { start: i, end: s }) {
1775
+ return Math.floor(0.02 * (i - s));
1776
+ }
1777
+ function Ze({
1778
+ className: r,
1779
+ children: i,
1780
+ getScrollDistance: s,
1781
+ RowProps: n,
1782
+ ScrollProps: l,
1783
+ ...o
1784
+ }) {
1785
+ const { start: f, end: d, perspective: y, setPerspective: h } = ie();
1786
+ return /* @__PURE__ */ te(
1787
+ "div",
1788
+ {
1789
+ className: F("VdtTimelineScrollContainer-root", r),
1790
+ onWheel: (a) => {
1791
+ if (a.shiftKey) {
1792
+ const c = s(a, { start: f, end: d, perspective: y }), p = y.start + (a.deltaY > 0 ? -c : c), b = y.end - y.start, E = p + b;
1793
+ E > d ? h(d - b, d) : p < f ? h(f, b) : h(p, E);
1794
+ }
1795
+ },
1796
+ ...o,
1797
+ children: [
1798
+ i,
1799
+ /* @__PURE__ */ D(Ee, { className: F("VdtTimelineScrollContainer-timelineRow"), ...n, children: /* @__PURE__ */ D(Se, { ...l }) })
1800
+ ]
1801
+ }
1802
+ );
1803
+ }
1804
+ Ze.propTypes = {
1805
+ /**
1806
+ * Override styles with className
1807
+ */
1808
+ className: e.string,
1809
+ /**
1810
+ * Children components to render
1811
+ */
1812
+ children: e.oneOfType([e.arrayOf(e.node), e.node]),
1813
+ /**
1814
+ * Get distance of scrolling
1815
+ */
1816
+ getScrollDistance: e.func,
1817
+ /**
1818
+ * Additional props for row component
1819
+ */
1820
+ RowProps: e.instanceOf(Object),
1821
+ /**
1822
+ * Additional props for scroll component
1823
+ */
1824
+ ScrollProps: e.instanceOf(Object)
1825
+ };
1826
+ Ze.defaultProps = {
1827
+ children: void 0,
1828
+ getScrollDistance: St,
1829
+ RowProps: {},
1830
+ ScrollProps: {},
1831
+ className: void 0
1832
+ };
1833
+ export {
1834
+ Me as Timeline,
1835
+ Ve as TimelineContext,
1836
+ Ge as TimelineEvent,
1837
+ $e as TimelinePlayhead,
1838
+ Ue as TimelinePlayheadTrack,
1839
+ ct as TimelineProvider,
1840
+ Ee as TimelineRow,
1841
+ Se as TimelineScroll,
1842
+ Ze as TimelineScrollContainer,
1843
+ Xe as TimelineTrack,
1844
+ Be as TimelineWaveform,
1845
+ ie as useTimeline
1846
+ };