@vidispine/vdt-js 26.1.0-pre.2 → 26.1.0-pre.4
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.d.ts +4 -0
- package/dist/index.js +249 -233
- package/dist/index.umd.cjs +2 -2
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -6,15 +6,15 @@ const pt = (e, t) => t ? pt(t, e % t) : e, J = (e) => {
|
|
|
6
6
|
if (t === void 0 || s === void 0)
|
|
7
7
|
return;
|
|
8
8
|
const n = pt(t, s);
|
|
9
|
-
let r = t / n,
|
|
10
|
-
return r > 21 && (
|
|
9
|
+
let r = t / n, i = s / n;
|
|
10
|
+
return r > 21 && (i = 1, r = (t / s).toFixed(2)), [r, i].join(":");
|
|
11
11
|
}, M = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: s }) => [t, s])) || []), Gt = (e, t, s) => {
|
|
12
12
|
let n;
|
|
13
13
|
return (r) => {
|
|
14
14
|
const o = () => {
|
|
15
15
|
n = null, s || e.apply(void 0, r);
|
|
16
|
-
},
|
|
17
|
-
clearTimeout(n), n = setTimeout(o, t),
|
|
16
|
+
}, a = s && !n;
|
|
17
|
+
clearTimeout(n), n = setTimeout(o, t), a && e.apply(void 0, r);
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
function zt() {
|
|
@@ -360,17 +360,17 @@ const os = {
|
|
|
360
360
|
}, Rt = (e) => {
|
|
361
361
|
const t = [], s = [];
|
|
362
362
|
let n = {};
|
|
363
|
-
return Object.entries(e || {}).forEach(([r,
|
|
363
|
+
return Object.entries(e || {}).forEach(([r, i]) => {
|
|
364
364
|
if (Yt.includes(r))
|
|
365
|
-
n = { ...n, [r]:
|
|
366
|
-
else if (At(
|
|
365
|
+
n = { ...n, [r]: i };
|
|
366
|
+
else if (At(i))
|
|
367
367
|
try {
|
|
368
|
-
s.push({ name: r, ...Qt(
|
|
368
|
+
s.push({ name: r, ...Qt(i) });
|
|
369
369
|
} catch (o) {
|
|
370
370
|
throw Error(o.message + (r ? ` for field "${r}"` : ""));
|
|
371
371
|
}
|
|
372
|
-
else if (It(
|
|
373
|
-
(Array.isArray(
|
|
372
|
+
else if (It(i))
|
|
373
|
+
(Array.isArray(i) ? i : [i]).forEach((o) => {
|
|
374
374
|
t.push({ name: r, ...Rt(o) });
|
|
375
375
|
});
|
|
376
376
|
else
|
|
@@ -381,9 +381,9 @@ const os = {
|
|
|
381
381
|
...s.length > 0 ? { field: s } : {}
|
|
382
382
|
};
|
|
383
383
|
}, Zt = (e) => {
|
|
384
|
-
const { start: t = "-INF", end: s = "+INF", base: n = void 0, ...r } = e, { group:
|
|
384
|
+
const { start: t = "-INF", end: s = "+INF", base: n = void 0, ...r } = e, { group: i, field: o } = Rt(r);
|
|
385
385
|
return {
|
|
386
|
-
...
|
|
386
|
+
...i ? { group: i } : {},
|
|
387
387
|
...o ? { field: o } : {},
|
|
388
388
|
start: t.toString(),
|
|
389
389
|
end: s.toString(),
|
|
@@ -392,69 +392,85 @@ const os = {
|
|
|
392
392
|
}, ds = (e) => ({
|
|
393
393
|
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) => Zt(t))
|
|
394
394
|
}), te = (e, t) => {
|
|
395
|
-
var r,
|
|
396
|
-
const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [n] = ((
|
|
395
|
+
var r, i;
|
|
396
|
+
const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [n] = ((i = t == null ? void 0 : t.start) == null ? void 0 : i.split("@")) || [];
|
|
397
397
|
return Number(s) < Number(n) ? -1 : Number(s) > Number(n) ? 1 : 0;
|
|
398
398
|
}, F = (e) => Array.isArray(e) ? e : e && [e] || [], at = (e) => Array.isArray(e) ? e.pop() : e, ee = (e) => (e == null ? void 0 : e.every((t) => typeof t == "string")) || !1, yt = {
|
|
399
399
|
includeValueAttributes: !1
|
|
400
400
|
};
|
|
401
|
-
function se(e, t) {
|
|
402
|
-
const { includeValueAttributes:
|
|
401
|
+
function se(e, t, s = !1) {
|
|
402
|
+
const { includeValueAttributes: n } = {
|
|
403
403
|
...yt,
|
|
404
404
|
...t || {}
|
|
405
405
|
};
|
|
406
|
-
|
|
406
|
+
let r = n;
|
|
407
|
+
if (r === !1 && !s)
|
|
407
408
|
return e == null ? void 0 : e.value;
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
r === !1 && s && (r = ["lang"]);
|
|
410
|
+
const { value: i, ...o } = e;
|
|
411
|
+
return { ...r === !0 && o || Array.isArray(r) && Object.fromEntries(
|
|
412
|
+
Object.entries(o).filter(
|
|
413
|
+
([c]) => Array.isArray(r) && r.includes(c)
|
|
412
414
|
)
|
|
413
|
-
) || {}, value:
|
|
415
|
+
) || {}, value: i };
|
|
414
416
|
}
|
|
415
417
|
const St = {
|
|
416
418
|
...yt,
|
|
417
419
|
joinValue: void 0,
|
|
418
420
|
arrayOnSingleValue: !0,
|
|
419
|
-
selectedLang: void 0
|
|
421
|
+
selectedLang: void 0,
|
|
422
|
+
includeLangAttrForLangDependentOnly: !1
|
|
420
423
|
};
|
|
421
|
-
function re(e, t) {
|
|
422
|
-
const {
|
|
424
|
+
function re(e, t, s) {
|
|
425
|
+
const {
|
|
426
|
+
joinValue: n,
|
|
427
|
+
arrayOnSingleValue: r,
|
|
428
|
+
selectedLang: i,
|
|
429
|
+
includeLangAttrForLangDependentOnly: o,
|
|
430
|
+
...a
|
|
431
|
+
} = {
|
|
423
432
|
...St,
|
|
424
433
|
...t || {}
|
|
425
434
|
};
|
|
426
|
-
let
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
|
|
435
|
+
let c = e;
|
|
436
|
+
s && e && i && (c = e.filter((u) => u.lang === i));
|
|
437
|
+
const d = c == null ? void 0 : c.map(
|
|
438
|
+
(u) => se(u, a, s && o)
|
|
439
|
+
);
|
|
440
|
+
return ee(d) && n ? d == null ? void 0 : d.join(n) : r !== !0 && (d == null ? void 0 : d.length) <= 1 ? d == null ? void 0 : d[0] : d;
|
|
430
441
|
}
|
|
431
442
|
const vt = {
|
|
432
443
|
includeFieldAttributes: !1,
|
|
433
444
|
...St
|
|
434
|
-
}, ne = (e, t) => {
|
|
435
|
-
const { includeFieldAttributes:
|
|
445
|
+
}, ne = (e, t, s) => {
|
|
446
|
+
const { includeFieldAttributes: n, ...r } = {
|
|
436
447
|
...vt,
|
|
437
448
|
...t || {}
|
|
438
|
-
}, { value:
|
|
439
|
-
Object.entries(
|
|
440
|
-
([
|
|
449
|
+
}, { value: i, ...o } = e, a = re(i, r, s), c = n === !0 && o || Array.isArray(n) && Object.fromEntries(
|
|
450
|
+
Object.entries(o).filter(
|
|
451
|
+
([d]) => n.includes(d)
|
|
441
452
|
)
|
|
442
453
|
) || {};
|
|
443
|
-
return
|
|
454
|
+
return n ? { ...c, value: a } : a;
|
|
444
455
|
}, G = {
|
|
445
456
|
...vt,
|
|
446
457
|
fieldAsList: !1,
|
|
447
458
|
arrayOnSingleField: !1,
|
|
448
|
-
overrideField: void 0
|
|
459
|
+
overrideField: void 0,
|
|
460
|
+
languageDependentFields: void 0
|
|
449
461
|
}, Dt = (e, t) => {
|
|
450
462
|
const s = {
|
|
451
463
|
...G,
|
|
452
464
|
...t || {}
|
|
453
|
-
}, { fieldAsList: n, arrayOnSingleField: r, overrideField:
|
|
454
|
-
return e == null || e.forEach((
|
|
455
|
-
const { name:
|
|
456
|
-
|
|
457
|
-
|
|
465
|
+
}, { fieldAsList: n, arrayOnSingleField: r, overrideField: i, languageDependentFields: o } = s, a = i === !0 && n === !1, c = {};
|
|
466
|
+
return e == null || e.forEach((d) => {
|
|
467
|
+
const { name: u } = d, f = (o == null ? void 0 : o.includes(u)) === !0, m = ne(
|
|
468
|
+
d,
|
|
469
|
+
s,
|
|
470
|
+
f
|
|
471
|
+
), p = r === !0 ? F(m) : m, l = c[u];
|
|
472
|
+
l ? a ? c[u] = m : c[u] = [F(l), F(m)].flat() : c[u] = p;
|
|
473
|
+
}), n === !0 ? Object.values(c).flat() : c;
|
|
458
474
|
}, Ft = {
|
|
459
475
|
...G,
|
|
460
476
|
includeGroupAttributes: !1,
|
|
@@ -469,10 +485,10 @@ const vt = {
|
|
|
469
485
|
Object.entries(s).filter(
|
|
470
486
|
([f]) => Object.keys(G).includes(f)
|
|
471
487
|
)
|
|
472
|
-
), { field:
|
|
488
|
+
), { field: i, group: o, ...a } = e, c = i && Dt(i, r), d = o && Mt(o, s);
|
|
473
489
|
return {
|
|
474
|
-
...n === !0 &&
|
|
475
|
-
Object.entries(
|
|
490
|
+
...n === !0 && a || Array.isArray(n) && Object.fromEntries(
|
|
491
|
+
Object.entries(a).filter(
|
|
476
492
|
([f]) => n.includes(f)
|
|
477
493
|
)
|
|
478
494
|
) || {},
|
|
@@ -480,14 +496,14 @@ const vt = {
|
|
|
480
496
|
...s != null && s.groupAsList ? d && { group: d } || {} : d
|
|
481
497
|
};
|
|
482
498
|
}, Q = Ft, Mt = (e, t) => {
|
|
483
|
-
const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup:
|
|
499
|
+
const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup: i } = s, o = i === !0 && n === !1, a = {};
|
|
484
500
|
return e == null || e.forEach((c) => {
|
|
485
|
-
const { name: d } = c, u = ie(c, s), f = r === !0 ? F(u) : u, m =
|
|
486
|
-
m ? o ?
|
|
501
|
+
const { name: d } = c, u = ie(c, s), f = r === !0 ? F(u) : u, m = a[d];
|
|
502
|
+
m ? o ? a[d] = u : a[d] = [
|
|
487
503
|
F(m),
|
|
488
504
|
F(u)
|
|
489
|
-
].flat() :
|
|
490
|
-
}), n ? Object.values(
|
|
505
|
+
].flat() : a[d] = f;
|
|
506
|
+
}), n ? Object.values(a).flat() : a;
|
|
491
507
|
}, Nt = {
|
|
492
508
|
...Q,
|
|
493
509
|
includeTimespanAttributes: !1,
|
|
@@ -500,24 +516,24 @@ const vt = {
|
|
|
500
516
|
const s = {
|
|
501
517
|
...Nt,
|
|
502
518
|
...t || {}
|
|
503
|
-
}, { includeTimespanAttributes: n, arrayOnSingle: r, flat:
|
|
519
|
+
}, { includeTimespanAttributes: n, arrayOnSingle: r, flat: i } = s, o = Object.fromEntries(
|
|
504
520
|
Object.entries(t).map(([l, h]) => {
|
|
505
521
|
if (Object.keys(Q).includes(l))
|
|
506
|
-
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideGroup", "overrideField"].includes(l) && (h !== void 0 ? h :
|
|
522
|
+
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideGroup", "overrideField"].includes(l) && (h !== void 0 ? h : i === !0) ? [l, !0] : [l, h];
|
|
507
523
|
}).filter((l) => !!l)
|
|
508
|
-
),
|
|
524
|
+
), a = Object.fromEntries(
|
|
509
525
|
Object.entries(t).map(([l, h]) => {
|
|
510
526
|
if (Object.keys(G).includes(l))
|
|
511
|
-
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideField"].includes(l) && (h !== void 0 ? h :
|
|
527
|
+
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(l) && (h !== void 0 ? h : r === !0) ? [l, !0] : ["overrideField"].includes(l) && (h !== void 0 ? h : i === !0) ? [l, !0] : [l, h];
|
|
512
528
|
}).filter((l) => !!l)
|
|
513
|
-
), { field: c, group: d, ...u } = e || {}, f = c && Dt(c,
|
|
529
|
+
), { field: c, group: d, ...u } = e || {}, f = c && Dt(c, a), m = d && Mt(d, o);
|
|
514
530
|
return {
|
|
515
531
|
...n === !0 && u || Array.isArray(n) && Object.fromEntries(
|
|
516
532
|
Object.entries(u).filter(
|
|
517
533
|
([l]) => n.includes(l)
|
|
518
534
|
)
|
|
519
535
|
) || {},
|
|
520
|
-
...
|
|
536
|
+
...a != null && a.fieldAsList ? { field: f } : f,
|
|
521
537
|
...o != null && o.groupAsList ? { group: m } : m
|
|
522
538
|
};
|
|
523
539
|
}, Z = {
|
|
@@ -531,9 +547,9 @@ const vt = {
|
|
|
531
547
|
const s = {
|
|
532
548
|
...Z,
|
|
533
549
|
...t || {}
|
|
534
|
-
}, { timespanAsList: n, joinTimespan: r, sortTimespan:
|
|
535
|
-
|
|
536
|
-
const u = (
|
|
550
|
+
}, { timespanAsList: n, joinTimespan: r, sortTimespan: i, flat: o, flatTimespan: a, ...c } = s, d = { flat: o, ...c };
|
|
551
|
+
i && e.sort(te);
|
|
552
|
+
const u = (a !== void 0 ? a === !0 : o === !0) && n === !1, f = {};
|
|
537
553
|
return e == null || e.forEach((m) => {
|
|
538
554
|
const { start: p, end: l } = m, h = u ? "flat" : [p, l].join(r), g = ae(m, d), E = f[h];
|
|
539
555
|
E ? u ? p === "-INF" && l === "+INF" ? f[h] = { ...at(E), ...g } : f[h] = { ...g, ...at(E) } : f[h] = [...F(E), g] : f[h] = g;
|
|
@@ -547,14 +563,14 @@ function ce(e, t) {
|
|
|
547
563
|
const s = {
|
|
548
564
|
...oe,
|
|
549
565
|
...t || {}
|
|
550
|
-
}, { includeMetadataAttributes: n, flat: r } = s, { timespan:
|
|
566
|
+
}, { includeMetadataAttributes: n, flat: r } = s, { timespan: i = [], ...o } = e || {}, a = Object.fromEntries(
|
|
551
567
|
Object.entries(s).map(([u, f]) => {
|
|
552
568
|
if (Object.keys(Z).includes(u))
|
|
553
569
|
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(u) && (f !== void 0 ? f : r === !0) ? [u, !0] : [u, f];
|
|
554
570
|
}).filter((u) => !!u)
|
|
555
571
|
), c = Ct(
|
|
556
|
-
|
|
557
|
-
|
|
572
|
+
i,
|
|
573
|
+
a
|
|
558
574
|
);
|
|
559
575
|
return {
|
|
560
576
|
...n === !0 && {
|
|
@@ -569,7 +585,7 @@ function ce(e, t) {
|
|
|
569
585
|
];
|
|
570
586
|
}).filter((u) => !!u)
|
|
571
587
|
) || {},
|
|
572
|
-
...
|
|
588
|
+
...a != null && a.timespanAsList ? { timespan: c } : c
|
|
573
589
|
};
|
|
574
590
|
}
|
|
575
591
|
const ls = (e) => {
|
|
@@ -611,8 +627,8 @@ class R {
|
|
|
611
627
|
toConstant() {
|
|
612
628
|
let t;
|
|
613
629
|
return Object.entries(tt).find((s) => {
|
|
614
|
-
const [n, r] = s, { numerator:
|
|
615
|
-
return
|
|
630
|
+
const [n, r] = s, { numerator: i, denominator: o } = r;
|
|
631
|
+
return i === this.numerator && o === this.denominator ? (t = n, !0) : !1;
|
|
616
632
|
}), t;
|
|
617
633
|
}
|
|
618
634
|
/**
|
|
@@ -629,9 +645,9 @@ class R {
|
|
|
629
645
|
toText(t) {
|
|
630
646
|
const { constant: s, fraction: n } = { ...ct.toText, ...t };
|
|
631
647
|
if (s) {
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
return
|
|
648
|
+
const i = this.toConstant();
|
|
649
|
+
if (i)
|
|
650
|
+
return i;
|
|
635
651
|
}
|
|
636
652
|
return n || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
|
|
637
653
|
}
|
|
@@ -700,9 +716,9 @@ const et = (e) => {
|
|
|
700
716
|
const { samples: t, timeBase: s } = e, n = st(s);
|
|
701
717
|
if (!n)
|
|
702
718
|
return 0;
|
|
703
|
-
const r = s.toRate({ rounded: !0 }),
|
|
719
|
+
const r = s.toRate({ rounded: !0 }), i = 60 * r, o = 60 * r - n, a = 10 * (i - n) + n, c = Math.floor((t + 1) / a), d = Math.max(
|
|
704
720
|
0,
|
|
705
|
-
(t + 1) %
|
|
721
|
+
(t + 1) % a - i
|
|
706
722
|
), u = Math.floor(
|
|
707
723
|
d / o
|
|
708
724
|
), m = d % o > 0 ? n : 0;
|
|
@@ -761,8 +777,8 @@ class S {
|
|
|
761
777
|
const { numerator: s, denominator: n } = (t == null ? void 0 : t.timeBase) || {};
|
|
762
778
|
let r = t;
|
|
763
779
|
(s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
|
|
764
|
-
const { samples:
|
|
765
|
-
return new S({ samples: this.samples +
|
|
780
|
+
const { samples: i } = r;
|
|
781
|
+
return new S({ samples: this.samples + i, timeBase: this.timeBase });
|
|
766
782
|
}
|
|
767
783
|
/**
|
|
768
784
|
* Return this TimeCode subtracted with the supplied timeCodeType
|
|
@@ -785,8 +801,8 @@ class S {
|
|
|
785
801
|
const { timeBase: { numerator: s, denominator: n } = {} } = t;
|
|
786
802
|
let r = t;
|
|
787
803
|
(s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
|
|
788
|
-
const { samples:
|
|
789
|
-
return new S({ samples: this.samples -
|
|
804
|
+
const { samples: i } = r;
|
|
805
|
+
return new S({ samples: this.samples - i, timeBase: this.timeBase });
|
|
790
806
|
}
|
|
791
807
|
/**
|
|
792
808
|
* Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
|
|
@@ -810,12 +826,12 @@ class S {
|
|
|
810
826
|
"round"
|
|
811
827
|
].join(", ")}"`
|
|
812
828
|
);
|
|
813
|
-
const
|
|
829
|
+
const i = Math[r](
|
|
814
830
|
this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
|
|
815
831
|
), o = { ...V.conformTimeBase, ...s || {} };
|
|
816
832
|
return new S(
|
|
817
833
|
{
|
|
818
|
-
samples:
|
|
834
|
+
samples: i,
|
|
819
835
|
timeBase: n
|
|
820
836
|
},
|
|
821
837
|
o
|
|
@@ -856,11 +872,11 @@ class S {
|
|
|
856
872
|
const t = this.samples + (this.dropFrame ? ut(this) : 0);
|
|
857
873
|
let s = this.timeBase.toRate({ rounded: !0 });
|
|
858
874
|
["23.976", "23.98"].includes(this.timeBase.toConstant()) && (s = this.timeBase.toRate({ fixed: !0 }));
|
|
859
|
-
const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60,
|
|
875
|
+
const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60, i = Math.floor(t / s) % 60, o = Math.floor(t % s);
|
|
860
876
|
return {
|
|
861
877
|
hours: n,
|
|
862
878
|
minutes: r,
|
|
863
|
-
seconds:
|
|
879
|
+
seconds: i,
|
|
864
880
|
frames: o
|
|
865
881
|
};
|
|
866
882
|
}
|
|
@@ -872,12 +888,12 @@ class S {
|
|
|
872
888
|
* @returns Time for the time code
|
|
873
889
|
*/
|
|
874
890
|
toTime() {
|
|
875
|
-
const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(),
|
|
891
|
+
const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(), i = this.timeBase.toRate({ rounded: !0 }), o = t % i, a = Math.floor(1e3 * o / i), c = o / i;
|
|
876
892
|
return {
|
|
877
893
|
hours: s,
|
|
878
894
|
minutes: n,
|
|
879
895
|
seconds: r,
|
|
880
|
-
milliseconds:
|
|
896
|
+
milliseconds: a,
|
|
881
897
|
partialSeconds: c
|
|
882
898
|
};
|
|
883
899
|
}
|
|
@@ -911,14 +927,14 @@ class S {
|
|
|
911
927
|
*/
|
|
912
928
|
toDuration(t) {
|
|
913
929
|
const { format: s } = { ...V.toDuration, ...t || {} }, { hours: n, ...r } = this.toTime();
|
|
914
|
-
let { minutes:
|
|
930
|
+
let { minutes: i, seconds: o, milliseconds: a } = r;
|
|
915
931
|
if (s && typeof s != "string")
|
|
916
932
|
throw Error("format has to be a string");
|
|
917
933
|
const c = (m, p) => !s.includes(m) || !p.some((l) => s.includes(l) && s.lastIndexOf(m) > s.indexOf(l));
|
|
918
934
|
if (s && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
|
|
919
935
|
throw Error("format order is unsupported (has to be h, m, s then S)");
|
|
920
936
|
if (!s)
|
|
921
|
-
return `${n > 0 ? `${n}:${`${
|
|
937
|
+
return `${n > 0 ? `${n}:${`${i}`.padStart(2, "0")}` : i}:${`${o}`.padStart(2, "0")}`;
|
|
922
938
|
const d = (m, p) => {
|
|
923
939
|
let l = m;
|
|
924
940
|
for (; p[l] === p[l + 1]; )
|
|
@@ -938,21 +954,21 @@ class S {
|
|
|
938
954
|
if (l[p - 1] === "m")
|
|
939
955
|
break;
|
|
940
956
|
const h = d(p, l);
|
|
941
|
-
s.includes("h") || (
|
|
957
|
+
s.includes("h") || (i += n * 60), f.push(`${i}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
|
|
942
958
|
break;
|
|
943
959
|
}
|
|
944
960
|
case "s": {
|
|
945
961
|
if (l[p - 1] === "s")
|
|
946
962
|
break;
|
|
947
963
|
const h = d(p, l);
|
|
948
|
-
s.includes("m") || (o +=
|
|
964
|
+
s.includes("m") || (o += i * 60), f.push(`${o}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(".");
|
|
949
965
|
break;
|
|
950
966
|
}
|
|
951
967
|
case "S": {
|
|
952
968
|
if (l[p - 1] === "S")
|
|
953
969
|
break;
|
|
954
970
|
const h = d(p, l);
|
|
955
|
-
s.includes("s") || (
|
|
971
|
+
s.includes("s") || (a += o * 1e3), f.push(`${Math.round(a / 10 ** (3 - h))}`.padStart(h, "0"));
|
|
956
972
|
break;
|
|
957
973
|
}
|
|
958
974
|
default:
|
|
@@ -974,11 +990,11 @@ class S {
|
|
|
974
990
|
};
|
|
975
991
|
if (this.samples === -1 / 0)
|
|
976
992
|
return "00:00:00:00";
|
|
977
|
-
const { hours: n, minutes: r, seconds:
|
|
993
|
+
const { hours: n, minutes: r, seconds: i, frames: o } = this.toUnits(), a = s ? this.frameSeparator : ":", c = [
|
|
978
994
|
n.toFixed().padStart(2, "0"),
|
|
979
995
|
r.toFixed().padStart(2, "0"),
|
|
980
|
-
|
|
981
|
-
].join(
|
|
996
|
+
i.toFixed().padStart(2, "0")
|
|
997
|
+
].join(a), d = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
|
|
982
998
|
return [c, `${o}`.padStart(d, "0")].join(this.frameSeparator);
|
|
983
999
|
}
|
|
984
1000
|
/**
|
|
@@ -1007,45 +1023,45 @@ const ue = (e, t) => {
|
|
|
1007
1023
|
s > n ? [s, n] = [s - n, n] : [s, n] = [s, n - s];
|
|
1008
1024
|
return s || n;
|
|
1009
1025
|
}, de = (e, t) => {
|
|
1010
|
-
const { timeBase: s, useGCD: n = !1, roundingMode: r, ...
|
|
1026
|
+
const { timeBase: s, useGCD: n = !1, roundingMode: r, ...i } = t || {}, o = `${e}`.replace(/,/g, ".");
|
|
1011
1027
|
if (Number.isNaN(+o))
|
|
1012
1028
|
throw new Error(`seconds must be digits, is ${e}`);
|
|
1013
|
-
let
|
|
1029
|
+
let a = 1, c;
|
|
1014
1030
|
if (Number.isInteger(+o))
|
|
1015
|
-
c = +o *
|
|
1031
|
+
c = +o * a;
|
|
1016
1032
|
else {
|
|
1017
1033
|
const [, u] = o.split("."), f = Math.min((u == null ? void 0 : u.length) ?? 0, 16);
|
|
1018
|
-
|
|
1034
|
+
a *= 10 ** f, c = Math.round(Number(o) * a);
|
|
1019
1035
|
}
|
|
1020
1036
|
if (s === void 0 && n) {
|
|
1021
|
-
const u = ue(
|
|
1022
|
-
c /= u,
|
|
1037
|
+
const u = ue(a, c);
|
|
1038
|
+
c /= u, a /= u;
|
|
1023
1039
|
}
|
|
1024
1040
|
const d = new S(
|
|
1025
|
-
{ samples: c, timeBase: { denominator:
|
|
1026
|
-
|
|
1041
|
+
{ samples: c, timeBase: { denominator: a, numerator: 1 } },
|
|
1042
|
+
i
|
|
1027
1043
|
);
|
|
1028
|
-
return s !== void 0 ? d.conformTimeBase(s, { ...
|
|
1029
|
-
}, le = ([e, t, s, n], r,
|
|
1030
|
-
const o =
|
|
1031
|
-
if (r === 0 || !
|
|
1044
|
+
return s !== void 0 ? d.conformTimeBase(s, { ...i, roundingMode: r }) : d;
|
|
1045
|
+
}, le = ([e, t, s, n], r, i) => {
|
|
1046
|
+
const o = i.toRate({ rounded: !0 }), a = st(i);
|
|
1047
|
+
if (r === 0 || !a)
|
|
1032
1048
|
return 0;
|
|
1033
|
-
const c = t % 10 !== 0, d = c && s === 0, u = e * (3600 * o - 54 *
|
|
1034
|
-
if (d && n <
|
|
1049
|
+
const c = t % 10 !== 0, d = c && s === 0, u = e * (3600 * o - 54 * a), f = t * 60 * o - (t - Math.ceil(t / 10)) * a, m = s * o - (c && s > 1 ? a : 0);
|
|
1050
|
+
if (d && n < a)
|
|
1035
1051
|
throw new Error(
|
|
1036
|
-
`Frame does not exist for ${
|
|
1052
|
+
`Frame does not exist for ${i.toConstant() || i.toRate()} drop-frame`
|
|
1037
1053
|
);
|
|
1038
|
-
const p = d ? n -
|
|
1054
|
+
const p = d ? n - a : n, l = u + f + m + p;
|
|
1039
1055
|
return r - l;
|
|
1040
1056
|
}, H = (e, t, s) => {
|
|
1041
|
-
const [n, r,
|
|
1057
|
+
const [n, r, i, o] = e, a = t.toRate({ rounded: !0 }), c = n * 3600 * a + r * 60 * a + i * a + o;
|
|
1042
1058
|
return c - (s ? le(e, c, t) : 0);
|
|
1043
1059
|
}, fe = (e) => {
|
|
1044
1060
|
const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
|
|
1045
1061
|
let s = [];
|
|
1046
1062
|
if (t) {
|
|
1047
|
-
const [r,
|
|
1048
|
-
s = [...r.split(":"),
|
|
1063
|
+
const [r, i] = e.split(t);
|
|
1064
|
+
s = [...r.split(":"), i];
|
|
1049
1065
|
} else
|
|
1050
1066
|
s = e.split(":");
|
|
1051
1067
|
if (s.length !== 4)
|
|
@@ -1068,30 +1084,30 @@ const ue = (e, t) => {
|
|
|
1068
1084
|
throw new Error("smpte cannot be undefined or null");
|
|
1069
1085
|
if (typeof e != "string")
|
|
1070
1086
|
throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
|
|
1071
|
-
const { smpteValues:
|
|
1087
|
+
const { smpteValues: i, smpteFrameSeparator: o } = fe(e), a = $(n), c = {
|
|
1072
1088
|
...r,
|
|
1073
1089
|
frameSeparator: (r == null ? void 0 : r.frameSeparator) || o,
|
|
1074
1090
|
...(r == null ? void 0 : r.dropFrame) === void 0 ? {
|
|
1075
|
-
dropFrame: n !== void 0 ? wt(
|
|
1091
|
+
dropFrame: n !== void 0 ? wt(a) : [";", ","].includes(o)
|
|
1076
1092
|
} : {}
|
|
1077
|
-
}, d =
|
|
1078
|
-
if (
|
|
1093
|
+
}, d = a.toRate({ rounded: !0 }), u = Math.max(0, d - 1);
|
|
1094
|
+
if (i.some((m) => m < 0))
|
|
1079
1095
|
throw new Error("Negative values are not supported");
|
|
1080
1096
|
let f;
|
|
1081
1097
|
switch (s) {
|
|
1082
1098
|
case "error": {
|
|
1083
|
-
const [m, p, l, h] =
|
|
1099
|
+
const [m, p, l, h] = i;
|
|
1084
1100
|
if (m >= 100 || p >= 60)
|
|
1085
1101
|
throw Error("Minutes has to be less than 60");
|
|
1086
1102
|
if (l >= 60)
|
|
1087
1103
|
throw Error("Seconds has to be less than 60");
|
|
1088
1104
|
if (h > u)
|
|
1089
1105
|
throw Error(`Frames has to be less or equal to ${u}`);
|
|
1090
|
-
f = H(
|
|
1106
|
+
f = H(i, a, c == null ? void 0 : c.dropFrame);
|
|
1091
1107
|
break;
|
|
1092
1108
|
}
|
|
1093
1109
|
case "ignore": {
|
|
1094
|
-
const [m, p, l, h] =
|
|
1110
|
+
const [m, p, l, h] = i, g = [
|
|
1095
1111
|
Math.min(100, m),
|
|
1096
1112
|
Math.min(59, p),
|
|
1097
1113
|
Math.min(59, l),
|
|
@@ -1099,19 +1115,19 @@ const ue = (e, t) => {
|
|
|
1099
1115
|
];
|
|
1100
1116
|
f = H(
|
|
1101
1117
|
g,
|
|
1102
|
-
|
|
1118
|
+
a,
|
|
1103
1119
|
c == null ? void 0 : c.dropFrame
|
|
1104
1120
|
);
|
|
1105
1121
|
break;
|
|
1106
1122
|
}
|
|
1107
1123
|
case "add": {
|
|
1108
|
-
f = H(
|
|
1124
|
+
f = H(i, a, c == null ? void 0 : c.dropFrame);
|
|
1109
1125
|
break;
|
|
1110
1126
|
}
|
|
1111
1127
|
default:
|
|
1112
1128
|
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(me)}`);
|
|
1113
1129
|
}
|
|
1114
|
-
return new S({ samples: f, timeBase:
|
|
1130
|
+
return new S({ samples: f, timeBase: a }, c);
|
|
1115
1131
|
}, _e = {
|
|
1116
1132
|
timeBase: void 0,
|
|
1117
1133
|
dropFrame: void 0,
|
|
@@ -1124,14 +1140,14 @@ const ue = (e, t) => {
|
|
|
1124
1140
|
else if (typeof e == "number")
|
|
1125
1141
|
r = { samples: e };
|
|
1126
1142
|
else if (e.includes("@")) {
|
|
1127
|
-
const [o,
|
|
1128
|
-
r = { samples: Number(o), timeBase: et(
|
|
1143
|
+
const [o, a] = e.split("@");
|
|
1144
|
+
r = { samples: Number(o), timeBase: et(a) };
|
|
1129
1145
|
} else
|
|
1130
1146
|
e === "-INF" ? r = { samples: -1 / 0 } : e === "+INF" ? r = { samples: 1 / 0 } : r = { samples: Number(e) };
|
|
1131
1147
|
if (Number.isNaN(r == null ? void 0 : r.samples) || r.timeBase && !(r.timeBase instanceof R))
|
|
1132
1148
|
throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
|
|
1133
|
-
const
|
|
1134
|
-
return s ?
|
|
1149
|
+
const i = new S(r, n);
|
|
1150
|
+
return s ? i.conformTimeBase($(s), n) : i;
|
|
1135
1151
|
}, Te = {
|
|
1136
1152
|
dropFrame: void 0,
|
|
1137
1153
|
frameSeparator: void 0
|
|
@@ -1148,8 +1164,8 @@ const ue = (e, t) => {
|
|
|
1148
1164
|
return U(e, t);
|
|
1149
1165
|
};
|
|
1150
1166
|
function dt({ hours: e = 0, minutes: t = 0, seconds: s = 0, partialSeconds: n = 0 }) {
|
|
1151
|
-
const r = e.toFixed().padStart(2, "0"),
|
|
1152
|
-
return `${r}:${
|
|
1167
|
+
const r = e.toFixed().padStart(2, "0"), i = t.toFixed().padStart(2, "0"), o = s.toFixed().padStart(2, "0"), a = (n * 10).toFixed().padStart(3, "0");
|
|
1168
|
+
return `${r}:${i}:${o}.${a}`;
|
|
1153
1169
|
}
|
|
1154
1170
|
const Ae = {
|
|
1155
1171
|
subtitleGroup: "stl_subtitle",
|
|
@@ -1164,18 +1180,18 @@ const Ae = {
|
|
|
1164
1180
|
timespanAsList: !0,
|
|
1165
1181
|
overrideGroup: !0,
|
|
1166
1182
|
joinValue: ","
|
|
1167
|
-
}).map((
|
|
1183
|
+
}).map((a) => {
|
|
1168
1184
|
const {
|
|
1169
1185
|
start: c,
|
|
1170
1186
|
end: d,
|
|
1171
1187
|
[s]: { [n]: u } = {}
|
|
1172
|
-
} = (Array.isArray(
|
|
1188
|
+
} = (Array.isArray(a) ? a[0] : a) || {};
|
|
1173
1189
|
if (!u)
|
|
1174
1190
|
return "";
|
|
1175
1191
|
const f = dt(U(c).toTime()), m = dt(U(d).toTime());
|
|
1176
1192
|
return `${f} --> ${m} line:0%\r${u}\r`;
|
|
1177
1193
|
});
|
|
1178
|
-
if (o.some((
|
|
1194
|
+
if (o.some((a) => !!a))
|
|
1179
1195
|
return `WEBVTT
|
|
1180
1196
|
|
|
1181
1197
|
|
|
@@ -1183,28 +1199,28 @@ ${o.join(`
|
|
|
1183
1199
|
`)}`;
|
|
1184
1200
|
}, Ie = { count: !0, exclude: !0 }, ms = (e = [], t = {}) => {
|
|
1185
1201
|
const s = { ...Ie, ...t }, { count: n, exclude: r } = s;
|
|
1186
|
-
return e.map((
|
|
1187
|
-
field:
|
|
1188
|
-
name:
|
|
1202
|
+
return e.map((i) => typeof i == "string" ? {
|
|
1203
|
+
field: i,
|
|
1204
|
+
name: i,
|
|
1189
1205
|
count: n,
|
|
1190
|
-
...r === !0 ? { exclude: [
|
|
1191
|
-
} :
|
|
1206
|
+
...r === !0 ? { exclude: [i] } : {}
|
|
1207
|
+
} : i);
|
|
1192
1208
|
}, hs = (e = []) => e == null ? void 0 : e.map(({ name: t, field: s, count: n, range: r }) => ({
|
|
1193
1209
|
facetName: t,
|
|
1194
1210
|
fieldName: s,
|
|
1195
|
-
count: n == null ? void 0 : n.reduce((
|
|
1211
|
+
count: n == null ? void 0 : n.reduce((i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }), {}),
|
|
1196
1212
|
...r ? {
|
|
1197
|
-
range: r.map(({ value:
|
|
1213
|
+
range: r.map(({ value: i, start: o, end: a }) => ({
|
|
1198
1214
|
start: Number.isNaN(+o) ? o : Number(o),
|
|
1199
|
-
end: Number.isNaN(+
|
|
1200
|
-
count: Number(
|
|
1215
|
+
end: Number.isNaN(+a) ? a : Number(a),
|
|
1216
|
+
count: Number(i) || 0
|
|
1201
1217
|
}))
|
|
1202
1218
|
} : {}
|
|
1203
1219
|
})), ps = (e = []) => {
|
|
1204
1220
|
const t = {};
|
|
1205
1221
|
return e.forEach(({ name: s, field: n, count: r }) => {
|
|
1206
1222
|
t[s || n] = r.reduce(
|
|
1207
|
-
(
|
|
1223
|
+
(i, { fieldValue: o, value: a }) => ({ ...i, [o]: a }),
|
|
1208
1224
|
{}
|
|
1209
1225
|
);
|
|
1210
1226
|
}), t;
|
|
@@ -1217,8 +1233,8 @@ ${o.join(`
|
|
|
1217
1233
|
arrayOnSingle: s = !0,
|
|
1218
1234
|
joinValue: n = void 0,
|
|
1219
1235
|
timespanAsList: r = !1
|
|
1220
|
-
} = { ...Lt, ...t || {} }, { field:
|
|
1221
|
-
return
|
|
1236
|
+
} = { ...Lt, ...t || {} }, { field: i = [], start: o, end: a } = e || {}, c = r ? { start: o, end: a } : {};
|
|
1237
|
+
return i.reduce((u, f) => {
|
|
1222
1238
|
const { name: m, value: p = [] } = f;
|
|
1223
1239
|
if (p.length === 0)
|
|
1224
1240
|
return u;
|
|
@@ -1236,17 +1252,17 @@ ${o.join(`
|
|
|
1236
1252
|
timespanAsList: s,
|
|
1237
1253
|
joinTimespan: n = "_",
|
|
1238
1254
|
flat: r,
|
|
1239
|
-
flatTimespan:
|
|
1255
|
+
flatTimespan: i,
|
|
1240
1256
|
...o
|
|
1241
1257
|
} = { ...Oe, ...t || {} };
|
|
1242
1258
|
return s === !0 ? e.map(
|
|
1243
|
-
(
|
|
1244
|
-
) : r === !0 ||
|
|
1245
|
-
(
|
|
1259
|
+
(a) => Y(a, { ...o, timespanAsList: s })
|
|
1260
|
+
) : r === !0 || i === !0 ? e.reduce(
|
|
1261
|
+
(a, c) => ({ ...a, ...Y(c, t) }),
|
|
1246
1262
|
{}
|
|
1247
1263
|
) : e.reduce(
|
|
1248
|
-
(
|
|
1249
|
-
...
|
|
1264
|
+
(a, c) => ({
|
|
1265
|
+
...a,
|
|
1250
1266
|
[[c.start, c.end].join(n)]: Y(
|
|
1251
1267
|
c,
|
|
1252
1268
|
t
|
|
@@ -1255,11 +1271,11 @@ ${o.join(`
|
|
|
1255
1271
|
{}
|
|
1256
1272
|
);
|
|
1257
1273
|
}, be = (e, t) => {
|
|
1258
|
-
const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n,
|
|
1259
|
-
const c =
|
|
1274
|
+
const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n, i = r.map((a) => {
|
|
1275
|
+
const c = a.split("/").pop().split("?").shift();
|
|
1260
1276
|
return U(c).toSeconds();
|
|
1261
|
-
}), o =
|
|
1262
|
-
(
|
|
1277
|
+
}), o = i.reduce(
|
|
1278
|
+
(a, c, d) => Math.abs(c - s) < Math.abs(i[a] - s) ? d : a,
|
|
1263
1279
|
0
|
|
1264
1280
|
);
|
|
1265
1281
|
return r[o];
|
|
@@ -1273,18 +1289,18 @@ ${o.join(`
|
|
|
1273
1289
|
end: t,
|
|
1274
1290
|
group: s = [{ id: "unknown", name: "unknown" }]
|
|
1275
1291
|
}) => {
|
|
1276
|
-
const [{ id: n, name: r }] = s,
|
|
1277
|
-
return { start: e, end: t, startSeconds:
|
|
1292
|
+
const [{ id: n, name: r }] = s, i = j(e).toSeconds(), o = j(t).toSeconds();
|
|
1293
|
+
return { start: e, end: t, startSeconds: i, endSeconds: o, group: { uuid: n, name: r } };
|
|
1278
1294
|
}, Ts = (e = {}, t) => {
|
|
1279
1295
|
const { entry: s = [] } = e, n = {
|
|
1280
1296
|
...Re,
|
|
1281
1297
|
...t || {}
|
|
1282
|
-
}, { includeGroupMetadata: r, flatEvents:
|
|
1298
|
+
}, { includeGroupMetadata: r, flatEvents: i, includeEntityType: o, includeNearestThumbnail: a } = n, c = s.map((d) => {
|
|
1283
1299
|
const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan: l, item: h } = d;
|
|
1284
1300
|
let g = l.map(
|
|
1285
1301
|
(E) => ye(E)
|
|
1286
1302
|
);
|
|
1287
|
-
if (
|
|
1303
|
+
if (a && u === "Item" && p.uri && (g = g.map((E) => {
|
|
1288
1304
|
const { start: A } = E, O = be(h, j(A));
|
|
1289
1305
|
return { ...E, thumbnail: O };
|
|
1290
1306
|
})), r && u === "Item") {
|
|
@@ -1323,7 +1339,7 @@ ${o.join(`
|
|
|
1323
1339
|
...o && u === "Collection" ? { collectionType: h } : {}
|
|
1324
1340
|
};
|
|
1325
1341
|
});
|
|
1326
|
-
return
|
|
1342
|
+
return i ? c.flatMap(
|
|
1327
1343
|
({ events: d, entityType: u, entityId: f, itemType: m, collectionType: p }) => d.map(
|
|
1328
1344
|
(l) => ({
|
|
1329
1345
|
...l,
|
|
@@ -1370,20 +1386,20 @@ ${o.join(`
|
|
|
1370
1386
|
channelCount: s,
|
|
1371
1387
|
codec: n,
|
|
1372
1388
|
mediaInfo: r,
|
|
1373
|
-
bitrate:
|
|
1389
|
+
bitrate: i,
|
|
1374
1390
|
metadata: o
|
|
1375
|
-
} = e,
|
|
1391
|
+
} = e, a = Se(r), {
|
|
1376
1392
|
Format: c,
|
|
1377
1393
|
Resolution: d,
|
|
1378
1394
|
Bit_rate_mode: u
|
|
1379
|
-
} =
|
|
1395
|
+
} = a, f = M(o || []), m = t != null && t.denominator ? ((t == null ? void 0 : t.denominator) || 1) / ((t == null ? void 0 : t.numerator) || 1) : void 0, p = m !== void 0 ? w(m, {
|
|
1380
1396
|
base: 10,
|
|
1381
1397
|
round: 1,
|
|
1382
1398
|
symbols: De
|
|
1383
1399
|
}) : void 0;
|
|
1384
1400
|
let l, h;
|
|
1385
|
-
return
|
|
1386
|
-
(g = w(
|
|
1401
|
+
return i !== void 0 && (l = w(i, { round: 2, symbols: lt }), h = Number(
|
|
1402
|
+
(g = w(i, { exponent: 1, symbols: lt }).split(" kbps")) == null ? void 0 : g[0]
|
|
1387
1403
|
)), {
|
|
1388
1404
|
audioFormat: c,
|
|
1389
1405
|
audioCodec: n,
|
|
@@ -1394,7 +1410,7 @@ ${o.join(`
|
|
|
1394
1410
|
audioBitrateKbps: h,
|
|
1395
1411
|
audioBitRateMode: u,
|
|
1396
1412
|
audioChannels: s,
|
|
1397
|
-
audioMediaInfo:
|
|
1413
|
+
audioMediaInfo: a,
|
|
1398
1414
|
audioMetadata: f
|
|
1399
1415
|
};
|
|
1400
1416
|
}, Es = {
|
|
@@ -1426,25 +1442,25 @@ ${o.join(`
|
|
|
1426
1442
|
size: s,
|
|
1427
1443
|
hash: n,
|
|
1428
1444
|
path: r,
|
|
1429
|
-
id:
|
|
1445
|
+
id: i,
|
|
1430
1446
|
storage: o
|
|
1431
|
-
} = e, [
|
|
1447
|
+
} = e, [a] = t, c = s !== void 0 ? w(s, { base: 2, standard: "jedec" }) : "", d = (r == null ? void 0 : r.split("/")) || [], u = d.pop() || "", f = d.map((m) => `${m}/`).join("") || void 0;
|
|
1432
1448
|
return {
|
|
1433
|
-
uri:
|
|
1449
|
+
uri: a,
|
|
1434
1450
|
hash: n,
|
|
1435
1451
|
fileSize: c,
|
|
1436
1452
|
fileSizeBytes: s,
|
|
1437
1453
|
path: r,
|
|
1438
1454
|
fileName: u,
|
|
1439
|
-
fileId:
|
|
1455
|
+
fileId: i,
|
|
1440
1456
|
storageId: o,
|
|
1441
1457
|
folderPath: f
|
|
1442
1458
|
};
|
|
1443
1459
|
}, Me = (e = {}) => {
|
|
1444
|
-
const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n),
|
|
1445
|
-
let o = { binaryMetadata: r, binaryMediaInfo:
|
|
1460
|
+
const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n), i = z(s);
|
|
1461
|
+
let o = { binaryMetadata: r, binaryMediaInfo: i };
|
|
1446
1462
|
if (t) {
|
|
1447
|
-
const [
|
|
1463
|
+
const [a] = t, c = Bt(a);
|
|
1448
1464
|
o = {
|
|
1449
1465
|
...o,
|
|
1450
1466
|
...c
|
|
@@ -1457,9 +1473,9 @@ ${o.join(`
|
|
|
1457
1473
|
metadata: s,
|
|
1458
1474
|
file: n,
|
|
1459
1475
|
duration: r,
|
|
1460
|
-
startTimestamp:
|
|
1476
|
+
startTimestamp: i,
|
|
1461
1477
|
startTimecode: o,
|
|
1462
|
-
timeCodeTimeBase:
|
|
1478
|
+
timeCodeTimeBase: a
|
|
1463
1479
|
} = e, c = M(s || []), d = z(t);
|
|
1464
1480
|
let { Format: u } = d;
|
|
1465
1481
|
const {
|
|
@@ -1483,9 +1499,9 @@ ${o.join(`
|
|
|
1483
1499
|
const h = P(r);
|
|
1484
1500
|
l.durationTimeCode = h.toObject(), l.duration = h.toDuration();
|
|
1485
1501
|
}
|
|
1486
|
-
if (
|
|
1502
|
+
if (i && (l.startTimestamp = P(i).toObject()), o !== void 0 && a && (l.startTimecode = P({
|
|
1487
1503
|
samples: o,
|
|
1488
|
-
timeBase:
|
|
1504
|
+
timeBase: a
|
|
1489
1505
|
})), n) {
|
|
1490
1506
|
const [h] = n, g = Bt(h);
|
|
1491
1507
|
l = {
|
|
@@ -1501,15 +1517,15 @@ ${o.join(`
|
|
|
1501
1517
|
bitrate: s,
|
|
1502
1518
|
fieldOrder: n,
|
|
1503
1519
|
resolution: r,
|
|
1504
|
-
mediaInfo:
|
|
1520
|
+
mediaInfo: i,
|
|
1505
1521
|
metadata: o = []
|
|
1506
|
-
} = e,
|
|
1522
|
+
} = e, a = ve(i), c = M(o), {
|
|
1507
1523
|
Format: d,
|
|
1508
1524
|
"Frame rate": u,
|
|
1509
1525
|
"Color space": f,
|
|
1510
1526
|
"Color primaries": m,
|
|
1511
1527
|
Colorimetry: p
|
|
1512
|
-
} =
|
|
1528
|
+
} = a;
|
|
1513
1529
|
let l;
|
|
1514
1530
|
const { averageFrameRate: h, realBaseFrameRate: g } = e;
|
|
1515
1531
|
g !== void 0 ? l = x({
|
|
@@ -1519,7 +1535,7 @@ ${o.join(`
|
|
|
1519
1535
|
numerator: h.denominator,
|
|
1520
1536
|
denominator: h.numerator
|
|
1521
1537
|
}));
|
|
1522
|
-
let { "Frame count": E } =
|
|
1538
|
+
let { "Frame count": E } = a;
|
|
1523
1539
|
if (E === void 0) {
|
|
1524
1540
|
const { numberOfPackets: it } = e;
|
|
1525
1541
|
it !== void 0 && (E = it.toString());
|
|
@@ -1548,15 +1564,15 @@ ${o.join(`
|
|
|
1548
1564
|
aspectRatio: N,
|
|
1549
1565
|
colorPrimaries: m,
|
|
1550
1566
|
videoMetadata: c,
|
|
1551
|
-
videoMediaInfo:
|
|
1567
|
+
videoMediaInfo: a
|
|
1552
1568
|
};
|
|
1553
1569
|
}, rt = (e = {}, t = {}) => {
|
|
1554
1570
|
let s = {};
|
|
1555
1571
|
const { priority: n = ["container", "video", "audio", "binary"] } = t, {
|
|
1556
1572
|
containerComponent: r,
|
|
1557
|
-
videoComponent:
|
|
1573
|
+
videoComponent: i,
|
|
1558
1574
|
audioComponent: o,
|
|
1559
|
-
binaryComponent:
|
|
1575
|
+
binaryComponent: a,
|
|
1560
1576
|
mimeType: c = [],
|
|
1561
1577
|
tag: d = []
|
|
1562
1578
|
} = e;
|
|
@@ -1576,8 +1592,8 @@ ${o.join(`
|
|
|
1576
1592
|
));
|
|
1577
1593
|
break;
|
|
1578
1594
|
case "video":
|
|
1579
|
-
if (
|
|
1580
|
-
const [m] =
|
|
1595
|
+
if (i) {
|
|
1596
|
+
const [m] = i;
|
|
1581
1597
|
s = u(
|
|
1582
1598
|
s,
|
|
1583
1599
|
Ce(m)
|
|
@@ -1594,8 +1610,8 @@ ${o.join(`
|
|
|
1594
1610
|
}
|
|
1595
1611
|
break;
|
|
1596
1612
|
case "binary":
|
|
1597
|
-
if (
|
|
1598
|
-
const [m] =
|
|
1613
|
+
if (a) {
|
|
1614
|
+
const [m] = a;
|
|
1599
1615
|
s = u(
|
|
1600
1616
|
s,
|
|
1601
1617
|
Me(m)
|
|
@@ -1661,9 +1677,9 @@ ${o.join(`
|
|
|
1661
1677
|
allowedMimeTypes: s = Pe,
|
|
1662
1678
|
allowedMethods: n = xe,
|
|
1663
1679
|
sortPriority: r = mt,
|
|
1664
|
-
sourceKey:
|
|
1680
|
+
sourceKey: i = "src",
|
|
1665
1681
|
mimeTypeKey: o = "type",
|
|
1666
|
-
shapeKey:
|
|
1682
|
+
shapeKey: a = "shape",
|
|
1667
1683
|
parsedShapeKey: c = "parsedShape"
|
|
1668
1684
|
} = t || {}, { shape: d = [] } = e || {}, u = d.reduce((f, m) => {
|
|
1669
1685
|
let p, l;
|
|
@@ -1675,9 +1691,9 @@ ${o.join(`
|
|
|
1675
1691
|
} else
|
|
1676
1692
|
l = g;
|
|
1677
1693
|
return l && s.includes(p) && f.push({
|
|
1678
|
-
[
|
|
1694
|
+
[i]: l,
|
|
1679
1695
|
[o]: p,
|
|
1680
|
-
[
|
|
1696
|
+
[a]: m,
|
|
1681
1697
|
[c]: h
|
|
1682
1698
|
}), f;
|
|
1683
1699
|
}, []);
|
|
@@ -1728,11 +1744,11 @@ ${o.join(`
|
|
|
1728
1744
|
allowedMimeTypes: s = qe,
|
|
1729
1745
|
allowedMethods: n = Xe,
|
|
1730
1746
|
streamingServers: r = []
|
|
1731
|
-
} = t || {}, { shape:
|
|
1747
|
+
} = t || {}, { shape: i = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
|
|
1732
1748
|
flat: !0,
|
|
1733
1749
|
arrayOnSingleValue: !1
|
|
1734
1750
|
});
|
|
1735
|
-
return
|
|
1751
|
+
return i.reduce((c, d) => {
|
|
1736
1752
|
var D, N, C;
|
|
1737
1753
|
let u, f, m;
|
|
1738
1754
|
const p = rt(d), { uri: l, mimeType: h, containerFormat: g, videoCodec: E } = p;
|
|
@@ -1759,11 +1775,11 @@ ${o.join(`
|
|
|
1759
1775
|
const t = {}, { outputSetting: s = [] } = e || {};
|
|
1760
1776
|
if (s.length === 0)
|
|
1761
1777
|
return t;
|
|
1762
|
-
const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription:
|
|
1763
|
-
if (r && (t.containerFormat = r.Container),
|
|
1764
|
-
const { CodecSettings:
|
|
1778
|
+
const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription: i, AudioDescriptions: o } = {} } = n;
|
|
1779
|
+
if (r && (t.containerFormat = r.Container), i) {
|
|
1780
|
+
const { CodecSettings: a = {} } = i, { Codec: c, ...d } = a;
|
|
1765
1781
|
t.videoFormat = c;
|
|
1766
|
-
const { Height: u, Width: f } =
|
|
1782
|
+
const { Height: u, Width: f } = i;
|
|
1767
1783
|
t.height = u, t.width = f, u && f && (t.dimension = `${f}x${u}`, t.aspectRatio = J({ height: u, width: f }));
|
|
1768
1784
|
const [m] = Object.values(d);
|
|
1769
1785
|
if (m) {
|
|
@@ -1773,29 +1789,29 @@ ${o.join(`
|
|
|
1773
1789
|
}
|
|
1774
1790
|
}
|
|
1775
1791
|
if (o && o.length > 0) {
|
|
1776
|
-
const { CodecSettings:
|
|
1792
|
+
const { CodecSettings: a = {} } = o[0], { Codec: c, ...d } = a;
|
|
1777
1793
|
t.audioFormat = c;
|
|
1778
1794
|
const [u] = Object.values(d);
|
|
1779
1795
|
u && (t.audioSamplerate = u.SampleRate, t.audioBitrate = u.Bitrate, t.audioBitRateMode = u.RateControlMode);
|
|
1780
1796
|
}
|
|
1781
1797
|
return t;
|
|
1782
1798
|
}, Rs = (e) => {
|
|
1783
|
-
const t = {}, { description: s, format: n, audio: r, video:
|
|
1799
|
+
const t = {}, { description: s, format: n, audio: r, video: i, mediaconvert: o } = e || {};
|
|
1784
1800
|
if (o)
|
|
1785
1801
|
return { description: s, ...Ze(o) };
|
|
1786
|
-
if (t.description = s, t.containerFormat = n,
|
|
1787
|
-
if (t.videoFormat =
|
|
1788
|
-
const
|
|
1789
|
-
t.timeBase =
|
|
1802
|
+
if (t.description = s, t.containerFormat = n, i) {
|
|
1803
|
+
if (t.videoFormat = i.codec, t.videoBitrate = i.bitrate, i.framerate) {
|
|
1804
|
+
const a = x(i.framerate);
|
|
1805
|
+
t.timeBase = a, t.frameRate = a.toConstant() || a.toRate();
|
|
1790
1806
|
}
|
|
1791
|
-
if (
|
|
1792
|
-
const { height:
|
|
1793
|
-
t.height =
|
|
1807
|
+
if (i.scaling) {
|
|
1808
|
+
const { height: a, width: c } = i.scaling;
|
|
1809
|
+
t.height = a, t.width = c, a && c && (t.dimension = `${c}x${a}`, t.aspectRatio = J({ height: a, width: c }));
|
|
1794
1810
|
}
|
|
1795
1811
|
}
|
|
1796
1812
|
if (r) {
|
|
1797
|
-
const { codec:
|
|
1798
|
-
t.audioFormat =
|
|
1813
|
+
const { codec: a, channel: c } = r;
|
|
1814
|
+
t.audioFormat = a, c && (t.audioChannels = c.length);
|
|
1799
1815
|
}
|
|
1800
1816
|
return t;
|
|
1801
1817
|
}, ts = (e) => {
|
|
@@ -1806,13 +1822,13 @@ ${o.join(`
|
|
|
1806
1822
|
type: s,
|
|
1807
1823
|
defaultValue: n,
|
|
1808
1824
|
stringRestriction: r,
|
|
1809
|
-
floatRestriction:
|
|
1825
|
+
floatRestriction: i,
|
|
1810
1826
|
integerRestriction: o,
|
|
1811
|
-
longRestriction:
|
|
1827
|
+
longRestriction: a,
|
|
1812
1828
|
data: c,
|
|
1813
1829
|
values: d,
|
|
1814
1830
|
system: u
|
|
1815
|
-
} = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: l, maxInclusive: h } =
|
|
1831
|
+
} = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: l, maxInclusive: h } = i || o || a || {}, g = ((d == null ? void 0 : d.field) || []).map(({ key: I, value: b }) => ({
|
|
1816
1832
|
label: b ?? I,
|
|
1817
1833
|
value: I
|
|
1818
1834
|
})), A = ((I) => Object.fromEntries(Object.entries(I).filter(([, b]) => b !== void 0)))({
|
|
@@ -1874,8 +1890,8 @@ class nt {
|
|
|
1874
1890
|
*/
|
|
1875
1891
|
trigger(t, s, n) {
|
|
1876
1892
|
const r = this.events[t];
|
|
1877
|
-
!r || r.length < 1 || r.forEach((
|
|
1878
|
-
|
|
1893
|
+
!r || r.length < 1 || r.forEach((i) => {
|
|
1894
|
+
i(s, n);
|
|
1879
1895
|
});
|
|
1880
1896
|
}
|
|
1881
1897
|
}
|
|
@@ -1960,7 +1976,7 @@ class es {
|
|
|
1960
1976
|
}
|
|
1961
1977
|
class ht {
|
|
1962
1978
|
constructor(t, s) {
|
|
1963
|
-
var n, r,
|
|
1979
|
+
var n, r, i, o, a, c;
|
|
1964
1980
|
if (this.DEFAULT_OPTIONS = Object.freeze({
|
|
1965
1981
|
targetRate: 4e6,
|
|
1966
1982
|
// 4mb sec,
|
|
@@ -1987,7 +2003,7 @@ class ht {
|
|
|
1987
2003
|
...((n = s.api) == null ? void 0 : n.props) ?? {},
|
|
1988
2004
|
queryParams: {
|
|
1989
2005
|
transferId: zt(),
|
|
1990
|
-
...((
|
|
2006
|
+
...((i = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : i.queryParams) ?? {}
|
|
1991
2007
|
}
|
|
1992
2008
|
}
|
|
1993
2009
|
}
|
|
@@ -2003,7 +2019,7 @@ class ht {
|
|
|
2003
2019
|
maxConcurrentTransfers: this.options.maxConcurrentTransfers,
|
|
2004
2020
|
mime: "",
|
|
2005
2021
|
status: _.idle,
|
|
2006
|
-
transferId: (c = (
|
|
2022
|
+
transferId: (c = (a = (o = s.api) == null ? void 0 : o.props) == null ? void 0 : a.queryParams) == null ? void 0 : c.transferId,
|
|
2007
2023
|
lastStats: {}
|
|
2008
2024
|
}, typeof t == "object" ? (this.state.blob = t, this.state.mime = t.type, this.addChunksFromBlob(t)) : console.error(new Error(`Expected a File or a Blob object, but got ${typeof t}`));
|
|
2009
2025
|
}
|
|
@@ -2015,19 +2031,19 @@ class ht {
|
|
|
2015
2031
|
let n = 0;
|
|
2016
2032
|
const r = () => {
|
|
2017
2033
|
for (; this.state.transferPromises.length < this.state.maxConcurrentTransfers && n < s; ) {
|
|
2018
|
-
const
|
|
2019
|
-
if (n += 1,
|
|
2034
|
+
const i = this.state.chunks[n];
|
|
2035
|
+
if (n += 1, i.state.status !== _.complete && i.state.status !== _.transferring) {
|
|
2020
2036
|
this.state.status = _.transferring;
|
|
2021
|
-
const o =
|
|
2037
|
+
const o = i.tryTransfer();
|
|
2022
2038
|
this.state.transferPromises.push(o), o.then(() => {
|
|
2023
|
-
const
|
|
2024
|
-
|
|
2025
|
-
}).catch((
|
|
2039
|
+
const a = this.state.transferPromises.indexOf(o);
|
|
2040
|
+
a !== -1 && this.state.transferPromises.splice(a, 1), this.state.status !== _.canceled && r();
|
|
2041
|
+
}).catch((a) => {
|
|
2026
2042
|
const c = this.state.transferPromises.indexOf(o);
|
|
2027
2043
|
c !== -1 && this.state.transferPromises.splice(c, 1), console.error(
|
|
2028
2044
|
"Failed on this upload(), check connectivity and try to resume",
|
|
2029
|
-
|
|
2030
|
-
), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state,
|
|
2045
|
+
a
|
|
2046
|
+
), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state, a), this.options.onFail && this.options.onFail(a)) : setTimeout(() => this.retry(), 5e3);
|
|
2031
2047
|
});
|
|
2032
2048
|
}
|
|
2033
2049
|
}
|
|
@@ -2039,11 +2055,11 @@ class ht {
|
|
|
2039
2055
|
// get all byte ranges for splitting in chunks
|
|
2040
2056
|
getByteRangesForChunks(t, s = this.options.chunkSize) {
|
|
2041
2057
|
const n = [], { minChunkSize: r } = this.options;
|
|
2042
|
-
let o = s >= r ? s : r,
|
|
2043
|
-
if (t.size - (t.size - t.size /
|
|
2058
|
+
let o = s >= r ? s : r, a = Math.floor(t.size / o);
|
|
2059
|
+
if (t.size - (t.size - t.size / a) >= r || (a -= 1, o = Math.floor(t.size / a)), a < 2 || t.size < this.options.minFileSize)
|
|
2044
2060
|
n.push({ start: 0, end: t.size });
|
|
2045
2061
|
else
|
|
2046
|
-
for (let c = 0; c <=
|
|
2062
|
+
for (let c = 0; c <= a; c += 1) {
|
|
2047
2063
|
const d = o * c;
|
|
2048
2064
|
let u = o * c + o;
|
|
2049
2065
|
t.size - o * c <= r && (u = t.size);
|
|
@@ -2139,18 +2155,18 @@ class ht {
|
|
|
2139
2155
|
), n = this.state.chunks.filter(
|
|
2140
2156
|
(d) => d.state.status === _.transferring
|
|
2141
2157
|
), r = s.length;
|
|
2142
|
-
let
|
|
2158
|
+
let i = 0, o = 0;
|
|
2143
2159
|
s.forEach((d) => {
|
|
2144
|
-
|
|
2160
|
+
i += d.transferRate, o += d.blobSlice.size;
|
|
2145
2161
|
}), n.forEach((d) => {
|
|
2146
2162
|
o += d.state.bytesTransferred;
|
|
2147
2163
|
});
|
|
2148
|
-
const
|
|
2164
|
+
const a = i / r, c = {
|
|
2149
2165
|
totalChunks: t,
|
|
2150
2166
|
completedChunks: r,
|
|
2151
2167
|
totalBytes: this.state.blob.size,
|
|
2152
2168
|
transferredBytes: o,
|
|
2153
|
-
avgTransferRate:
|
|
2169
|
+
avgTransferRate: a,
|
|
2154
2170
|
concurrentTransfers: this.state.maxConcurrentTransfers
|
|
2155
2171
|
};
|
|
2156
2172
|
return this.state.rate = c.avgTransferRate, c;
|
|
@@ -2258,8 +2274,8 @@ class vs {
|
|
|
2258
2274
|
removeChunkedUpload(t, s = !1) {
|
|
2259
2275
|
const n = (r) => r ? r.state.status === _.complete && !s ? (console.error(
|
|
2260
2276
|
"Can't cancel complete transfers, pass true as a second argument in .removeChunkedUpload() to force removal."
|
|
2261
|
-
), !1) : (Object.keys(this.state.transfers).forEach((
|
|
2262
|
-
r === this.state.transfers[
|
|
2277
|
+
), !1) : (Object.keys(this.state.transfers).forEach((i) => {
|
|
2278
|
+
r === this.state.transfers[i] && delete this.state.transfers[i];
|
|
2263
2279
|
}), this.events.trigger(T.removed, this.state), r.cancel(), !0) : (console.error("Could not find a matching transfer to cancel."), !1);
|
|
2264
2280
|
t instanceof ht ? n(t) : t instanceof File ? n(this.exists(t)) : typeof t == "string" ? n(this.transfers.find((r) => r.transferId === t)) : console.error(
|
|
2265
2281
|
"Invalid object to remove - has to be either ChunkedUpload, File or transferId"
|
|
@@ -2338,12 +2354,12 @@ class vs {
|
|
|
2338
2354
|
get fileList() {
|
|
2339
2355
|
const t = [];
|
|
2340
2356
|
return this.transfers.forEach((s) => {
|
|
2341
|
-
const n = s.getStats(), { totalChunks: r, completedChunks:
|
|
2357
|
+
const n = s.getStats(), { totalChunks: r, completedChunks: i } = n, o = {
|
|
2342
2358
|
name: s.state.blob.name,
|
|
2343
2359
|
bytesDone: n.transferredBytes,
|
|
2344
2360
|
bytesTotal: s.state.blob.size,
|
|
2345
2361
|
totalChunks: r,
|
|
2346
|
-
completedChunks:
|
|
2362
|
+
completedChunks: i,
|
|
2347
2363
|
transfer: s
|
|
2348
2364
|
};
|
|
2349
2365
|
t.push(o);
|
|
@@ -2351,16 +2367,16 @@ class vs {
|
|
|
2351
2367
|
}
|
|
2352
2368
|
}
|
|
2353
2369
|
const Wt = (e, t, s = "") => {
|
|
2354
|
-
const n = (
|
|
2355
|
-
const c =
|
|
2370
|
+
const n = (a) => {
|
|
2371
|
+
const c = a.startsWith("/") ? a.slice(1) : a, d = (c == null ? void 0 : c.search("/")) ?? -1;
|
|
2356
2372
|
return d === -1 ? [c] : [c.slice(0, d), c.slice(d + 1)];
|
|
2357
|
-
}, [r,
|
|
2358
|
-
return
|
|
2373
|
+
}, [r, i] = n(t), o = [s, r].filter(Boolean).join("/");
|
|
2374
|
+
return i ? {
|
|
2359
2375
|
[r]: {
|
|
2360
2376
|
file: new File([e], r, { ...e, type: "folder" }),
|
|
2361
2377
|
path: o,
|
|
2362
2378
|
progress: { totalBytes: e.size ?? 0, transferredBytes: 0 },
|
|
2363
|
-
files: Wt(e,
|
|
2379
|
+
files: Wt(e, i, o)
|
|
2364
2380
|
}
|
|
2365
2381
|
} : {
|
|
2366
2382
|
[r]: {
|