@vidispine/vdt-js 25.4.6 → 26.1.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.d.ts +2 -0
- package/dist/index.js +334 -330
- 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, a = s / n;
|
|
10
|
+
return r > 21 && (a = 1, r = (t / s).toFixed(2)), [r, a].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
|
+
}, i = s && !n;
|
|
17
|
+
clearTimeout(n), n = setTimeout(o, t), i && 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, a]) => {
|
|
364
364
|
if (Yt.includes(r))
|
|
365
|
-
n = { ...n, [r]:
|
|
366
|
-
else if (At(
|
|
365
|
+
n = { ...n, [r]: a };
|
|
366
|
+
else if (At(a))
|
|
367
367
|
try {
|
|
368
|
-
s.push({ name: r, ...Qt(
|
|
368
|
+
s.push({ name: r, ...Qt(a) });
|
|
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(a))
|
|
373
|
+
(Array.isArray(a) ? a : [a]).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: a, field: o } = Rt(r);
|
|
385
385
|
return {
|
|
386
|
-
...
|
|
386
|
+
...a ? { group: a } : {},
|
|
387
387
|
...o ? { field: o } : {},
|
|
388
388
|
start: t.toString(),
|
|
389
389
|
end: s.toString(),
|
|
@@ -392,8 +392,8 @@ 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, a;
|
|
396
|
+
const [s] = ((r = e == null ? void 0 : e.start) == null ? void 0 : r.split("@")) || [], [n] = ((a = t == null ? void 0 : t.start) == null ? void 0 : a.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
|
|
@@ -415,13 +415,17 @@ function se(e, t) {
|
|
|
415
415
|
const St = {
|
|
416
416
|
...yt,
|
|
417
417
|
joinValue: void 0,
|
|
418
|
-
arrayOnSingleValue: !0
|
|
418
|
+
arrayOnSingleValue: !0,
|
|
419
|
+
selectedLang: void 0
|
|
419
420
|
};
|
|
420
421
|
function re(e, t) {
|
|
421
|
-
const { joinValue: s, arrayOnSingleValue: n,
|
|
422
|
+
const { joinValue: s, arrayOnSingleValue: n, selectedLang: r, ...a } = {
|
|
422
423
|
...St,
|
|
423
424
|
...t || {}
|
|
424
|
-
}
|
|
425
|
+
};
|
|
426
|
+
let o = e;
|
|
427
|
+
e && r && e.every((d) => d.lang !== void 0) && (o = e.filter((d) => d.lang === r));
|
|
428
|
+
const i = o == null ? void 0 : o.map((c) => se(c, a));
|
|
425
429
|
return ee(i) && s ? i == null ? void 0 : i.join(s) : n !== !0 && (i == null ? void 0 : i.length) <= 1 ? i == null ? void 0 : i[0] : i;
|
|
426
430
|
}
|
|
427
431
|
const vt = {
|
|
@@ -431,12 +435,12 @@ const vt = {
|
|
|
431
435
|
const { includeFieldAttributes: s, ...n } = {
|
|
432
436
|
...vt,
|
|
433
437
|
...t || {}
|
|
434
|
-
}, { value: r, ...
|
|
435
|
-
Object.entries(
|
|
438
|
+
}, { value: r, ...a } = e, o = re(r, n), i = s === !0 && a || Array.isArray(s) && Object.fromEntries(
|
|
439
|
+
Object.entries(a).filter(
|
|
436
440
|
([c]) => s.includes(c)
|
|
437
441
|
)
|
|
438
442
|
) || {};
|
|
439
|
-
return s ? { ...
|
|
443
|
+
return s ? { ...i, value: o } : o;
|
|
440
444
|
}, G = {
|
|
441
445
|
...vt,
|
|
442
446
|
fieldAsList: !1,
|
|
@@ -446,11 +450,11 @@ const vt = {
|
|
|
446
450
|
const s = {
|
|
447
451
|
...G,
|
|
448
452
|
...t || {}
|
|
449
|
-
}, { fieldAsList: n, arrayOnSingleField: r, overrideField:
|
|
453
|
+
}, { fieldAsList: n, arrayOnSingleField: r, overrideField: a } = s, o = a === !0 && n === !1, i = {};
|
|
450
454
|
return e == null || e.forEach((c) => {
|
|
451
|
-
const { name:
|
|
452
|
-
m ? o ?
|
|
453
|
-
}), n === !0 ? Object.values(
|
|
455
|
+
const { name: d } = c, u = ne(c, s), f = r === !0 ? F(u) : u, m = i[d];
|
|
456
|
+
m ? o ? i[d] = u : i[d] = [F(m), F(u)].flat() : i[d] = f;
|
|
457
|
+
}), n === !0 ? Object.values(i).flat() : i;
|
|
454
458
|
}, Ft = {
|
|
455
459
|
...G,
|
|
456
460
|
includeGroupAttributes: !1,
|
|
@@ -465,25 +469,25 @@ const vt = {
|
|
|
465
469
|
Object.entries(s).filter(
|
|
466
470
|
([f]) => Object.keys(G).includes(f)
|
|
467
471
|
)
|
|
468
|
-
), { field:
|
|
472
|
+
), { field: a, group: o, ...i } = e, c = a && Dt(a, r), d = o && Mt(o, s);
|
|
469
473
|
return {
|
|
470
|
-
...n === !0 &&
|
|
471
|
-
Object.entries(
|
|
474
|
+
...n === !0 && i || Array.isArray(n) && Object.fromEntries(
|
|
475
|
+
Object.entries(i).filter(
|
|
472
476
|
([f]) => n.includes(f)
|
|
473
477
|
)
|
|
474
478
|
) || {},
|
|
475
479
|
...r != null && r.fieldAsList ? c && { field: c } || {} : c,
|
|
476
|
-
...s != null && s.groupAsList ?
|
|
480
|
+
...s != null && s.groupAsList ? d && { group: d } || {} : d
|
|
477
481
|
};
|
|
478
482
|
}, Q = Ft, Mt = (e, t) => {
|
|
479
|
-
const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup:
|
|
483
|
+
const s = { ...Q, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: r, overrideGroup: a } = s, o = a === !0 && n === !1, i = {};
|
|
480
484
|
return e == null || e.forEach((c) => {
|
|
481
|
-
const { name:
|
|
482
|
-
m ? o ?
|
|
485
|
+
const { name: d } = c, u = ie(c, s), f = r === !0 ? F(u) : u, m = i[d];
|
|
486
|
+
m ? o ? i[d] = u : i[d] = [
|
|
483
487
|
F(m),
|
|
484
488
|
F(u)
|
|
485
|
-
].flat() :
|
|
486
|
-
}), n ? Object.values(
|
|
489
|
+
].flat() : i[d] = f;
|
|
490
|
+
}), n ? Object.values(i).flat() : i;
|
|
487
491
|
}, Nt = {
|
|
488
492
|
...Q,
|
|
489
493
|
includeTimespanAttributes: !1,
|
|
@@ -496,24 +500,24 @@ const vt = {
|
|
|
496
500
|
const s = {
|
|
497
501
|
...Nt,
|
|
498
502
|
...t || {}
|
|
499
|
-
}, { includeTimespanAttributes: n, arrayOnSingle: r, flat:
|
|
500
|
-
Object.entries(t).map(([
|
|
501
|
-
if (Object.keys(Q).includes(
|
|
502
|
-
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(
|
|
503
|
-
}).filter((
|
|
504
|
-
),
|
|
505
|
-
Object.entries(t).map(([
|
|
506
|
-
if (Object.keys(G).includes(
|
|
507
|
-
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(
|
|
508
|
-
}).filter((
|
|
509
|
-
), { field: c, group:
|
|
503
|
+
}, { includeTimespanAttributes: n, arrayOnSingle: r, flat: a } = s, o = Object.fromEntries(
|
|
504
|
+
Object.entries(t).map(([l, h]) => {
|
|
505
|
+
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 : a === !0) ? [l, !0] : [l, h];
|
|
507
|
+
}).filter((l) => !!l)
|
|
508
|
+
), i = Object.fromEntries(
|
|
509
|
+
Object.entries(t).map(([l, h]) => {
|
|
510
|
+
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 : a === !0) ? [l, !0] : [l, h];
|
|
512
|
+
}).filter((l) => !!l)
|
|
513
|
+
), { field: c, group: d, ...u } = e || {}, f = c && Dt(c, i), m = d && Mt(d, o);
|
|
510
514
|
return {
|
|
511
515
|
...n === !0 && u || Array.isArray(n) && Object.fromEntries(
|
|
512
516
|
Object.entries(u).filter(
|
|
513
|
-
([
|
|
517
|
+
([l]) => n.includes(l)
|
|
514
518
|
)
|
|
515
519
|
) || {},
|
|
516
|
-
...
|
|
520
|
+
...i != null && i.fieldAsList ? { field: f } : f,
|
|
517
521
|
...o != null && o.groupAsList ? { group: m } : m
|
|
518
522
|
};
|
|
519
523
|
}, Z = {
|
|
@@ -527,12 +531,12 @@ const vt = {
|
|
|
527
531
|
const s = {
|
|
528
532
|
...Z,
|
|
529
533
|
...t || {}
|
|
530
|
-
}, { timespanAsList: n, joinTimespan: r, sortTimespan:
|
|
531
|
-
|
|
532
|
-
const u = (
|
|
534
|
+
}, { timespanAsList: n, joinTimespan: r, sortTimespan: a, flat: o, flatTimespan: i, ...c } = s, d = { flat: o, ...c };
|
|
535
|
+
a && e.sort(te);
|
|
536
|
+
const u = (i !== void 0 ? i === !0 : o === !0) && n === !1, f = {};
|
|
533
537
|
return e == null || e.forEach((m) => {
|
|
534
|
-
const { start: p, end:
|
|
535
|
-
E ? u ? p === "-INF" &&
|
|
538
|
+
const { start: p, end: l } = m, h = u ? "flat" : [p, l].join(r), g = ae(m, d), E = f[h];
|
|
539
|
+
E ? u ? p === "-INF" && l === "+INF" ? f[h] = { ...at(E), ...g } : f[h] = { ...g, ...at(E) } : f[h] = [...F(E), g] : f[h] = g;
|
|
536
540
|
}), n === !0 ? Object.values(f) : u ? Object.values(f).pop() : f;
|
|
537
541
|
}, oe = {
|
|
538
542
|
...Z,
|
|
@@ -543,14 +547,14 @@ function ce(e, t) {
|
|
|
543
547
|
const s = {
|
|
544
548
|
...oe,
|
|
545
549
|
...t || {}
|
|
546
|
-
}, { includeMetadataAttributes: n, flat: r } = s, { timespan:
|
|
550
|
+
}, { includeMetadataAttributes: n, flat: r } = s, { timespan: a = [], ...o } = e || {}, i = Object.fromEntries(
|
|
547
551
|
Object.entries(s).map(([u, f]) => {
|
|
548
552
|
if (Object.keys(Z).includes(u))
|
|
549
553
|
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(u) && (f !== void 0 ? f : r === !0) ? [u, !0] : [u, f];
|
|
550
554
|
}).filter((u) => !!u)
|
|
551
555
|
), c = Ct(
|
|
552
|
-
|
|
553
|
-
|
|
556
|
+
a,
|
|
557
|
+
i
|
|
554
558
|
);
|
|
555
559
|
return {
|
|
556
560
|
...n === !0 && {
|
|
@@ -565,7 +569,7 @@ function ce(e, t) {
|
|
|
565
569
|
];
|
|
566
570
|
}).filter((u) => !!u)
|
|
567
571
|
) || {},
|
|
568
|
-
...
|
|
572
|
+
...i != null && i.timespanAsList ? { timespan: c } : c
|
|
569
573
|
};
|
|
570
574
|
}
|
|
571
575
|
const ls = (e) => {
|
|
@@ -607,8 +611,8 @@ class R {
|
|
|
607
611
|
toConstant() {
|
|
608
612
|
let t;
|
|
609
613
|
return Object.entries(tt).find((s) => {
|
|
610
|
-
const [n, r] = s, { numerator:
|
|
611
|
-
return
|
|
614
|
+
const [n, r] = s, { numerator: a, denominator: o } = r;
|
|
615
|
+
return a === this.numerator && o === this.denominator ? (t = n, !0) : !1;
|
|
612
616
|
}), t;
|
|
613
617
|
}
|
|
614
618
|
/**
|
|
@@ -625,9 +629,9 @@ class R {
|
|
|
625
629
|
toText(t) {
|
|
626
630
|
const { constant: s, fraction: n } = { ...ct.toText, ...t };
|
|
627
631
|
if (s) {
|
|
628
|
-
const
|
|
629
|
-
if (
|
|
630
|
-
return
|
|
632
|
+
const a = this.toConstant();
|
|
633
|
+
if (a)
|
|
634
|
+
return a;
|
|
631
635
|
}
|
|
632
636
|
return n || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
|
|
633
637
|
}
|
|
@@ -696,12 +700,12 @@ const et = (e) => {
|
|
|
696
700
|
const { samples: t, timeBase: s } = e, n = st(s);
|
|
697
701
|
if (!n)
|
|
698
702
|
return 0;
|
|
699
|
-
const r = s.toRate({ rounded: !0 }),
|
|
703
|
+
const r = s.toRate({ rounded: !0 }), a = 60 * r, o = 60 * r - n, i = 10 * (a - n) + n, c = Math.floor((t + 1) / i), d = Math.max(
|
|
700
704
|
0,
|
|
701
|
-
(t + 1) %
|
|
705
|
+
(t + 1) % i - a
|
|
702
706
|
), u = Math.floor(
|
|
703
|
-
|
|
704
|
-
), m =
|
|
707
|
+
d / o
|
|
708
|
+
), m = d % o > 0 ? n : 0;
|
|
705
709
|
return c * 9 * n + u * n + m;
|
|
706
710
|
}, V = {
|
|
707
711
|
conformTimeBase: {
|
|
@@ -757,8 +761,8 @@ class S {
|
|
|
757
761
|
const { numerator: s, denominator: n } = (t == null ? void 0 : t.timeBase) || {};
|
|
758
762
|
let r = t;
|
|
759
763
|
(s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
|
|
760
|
-
const { samples:
|
|
761
|
-
return new S({ samples: this.samples +
|
|
764
|
+
const { samples: a } = r;
|
|
765
|
+
return new S({ samples: this.samples + a, timeBase: this.timeBase });
|
|
762
766
|
}
|
|
763
767
|
/**
|
|
764
768
|
* Return this TimeCode subtracted with the supplied timeCodeType
|
|
@@ -781,8 +785,8 @@ class S {
|
|
|
781
785
|
const { timeBase: { numerator: s, denominator: n } = {} } = t;
|
|
782
786
|
let r = t;
|
|
783
787
|
(s !== this.timeBase.numerator || n !== this.timeBase.denominator) && (r = t.conformTimeBase(this.timeBase));
|
|
784
|
-
const { samples:
|
|
785
|
-
return new S({ samples: this.samples -
|
|
788
|
+
const { samples: a } = r;
|
|
789
|
+
return new S({ samples: this.samples - a, timeBase: this.timeBase });
|
|
786
790
|
}
|
|
787
791
|
/**
|
|
788
792
|
* Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
|
|
@@ -806,12 +810,12 @@ class S {
|
|
|
806
810
|
"round"
|
|
807
811
|
].join(", ")}"`
|
|
808
812
|
);
|
|
809
|
-
const
|
|
813
|
+
const a = Math[r](
|
|
810
814
|
this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
|
|
811
815
|
), o = { ...V.conformTimeBase, ...s || {} };
|
|
812
816
|
return new S(
|
|
813
817
|
{
|
|
814
|
-
samples:
|
|
818
|
+
samples: a,
|
|
815
819
|
timeBase: n
|
|
816
820
|
},
|
|
817
821
|
o
|
|
@@ -852,11 +856,11 @@ class S {
|
|
|
852
856
|
const t = this.samples + (this.dropFrame ? ut(this) : 0);
|
|
853
857
|
let s = this.timeBase.toRate({ rounded: !0 });
|
|
854
858
|
["23.976", "23.98"].includes(this.timeBase.toConstant()) && (s = this.timeBase.toRate({ fixed: !0 }));
|
|
855
|
-
const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60,
|
|
859
|
+
const n = Math.floor(t / (3600 * s)), r = Math.floor(t / (60 * s)) % 60, a = Math.floor(t / s) % 60, o = Math.floor(t % s);
|
|
856
860
|
return {
|
|
857
861
|
hours: n,
|
|
858
862
|
minutes: r,
|
|
859
|
-
seconds:
|
|
863
|
+
seconds: a,
|
|
860
864
|
frames: o
|
|
861
865
|
};
|
|
862
866
|
}
|
|
@@ -868,12 +872,12 @@ class S {
|
|
|
868
872
|
* @returns Time for the time code
|
|
869
873
|
*/
|
|
870
874
|
toTime() {
|
|
871
|
-
const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(),
|
|
875
|
+
const t = this.samples + ut(this), { hours: s, minutes: n, seconds: r } = this.toUnits(), a = this.timeBase.toRate({ rounded: !0 }), o = t % a, i = Math.floor(1e3 * o / a), c = o / a;
|
|
872
876
|
return {
|
|
873
877
|
hours: s,
|
|
874
878
|
minutes: n,
|
|
875
879
|
seconds: r,
|
|
876
|
-
milliseconds:
|
|
880
|
+
milliseconds: i,
|
|
877
881
|
partialSeconds: c
|
|
878
882
|
};
|
|
879
883
|
}
|
|
@@ -907,48 +911,48 @@ class S {
|
|
|
907
911
|
*/
|
|
908
912
|
toDuration(t) {
|
|
909
913
|
const { format: s } = { ...V.toDuration, ...t || {} }, { hours: n, ...r } = this.toTime();
|
|
910
|
-
let { minutes:
|
|
914
|
+
let { minutes: a, seconds: o, milliseconds: i } = r;
|
|
911
915
|
if (s && typeof s != "string")
|
|
912
916
|
throw Error("format has to be a string");
|
|
913
|
-
const c = (m, p) => !s.includes(m) || !p.some((
|
|
917
|
+
const c = (m, p) => !s.includes(m) || !p.some((l) => s.includes(l) && s.lastIndexOf(m) > s.indexOf(l));
|
|
914
918
|
if (s && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
|
|
915
919
|
throw Error("format order is unsupported (has to be h, m, s then S)");
|
|
916
920
|
if (!s)
|
|
917
|
-
return `${n > 0 ? `${n}:${`${
|
|
918
|
-
const
|
|
919
|
-
let
|
|
920
|
-
for (; p[
|
|
921
|
-
|
|
922
|
-
return
|
|
921
|
+
return `${n > 0 ? `${n}:${`${a}`.padStart(2, "0")}` : a}:${`${o}`.padStart(2, "0")}`;
|
|
922
|
+
const d = (m, p) => {
|
|
923
|
+
let l = m;
|
|
924
|
+
for (; p[l] === p[l + 1]; )
|
|
925
|
+
l += 1;
|
|
926
|
+
return l - m + 1;
|
|
923
927
|
}, u = ["h", "m", "s", "S"], f = [];
|
|
924
|
-
return [...s].forEach((m, p,
|
|
928
|
+
return [...s].forEach((m, p, l) => {
|
|
925
929
|
switch (m) {
|
|
926
930
|
case "h": {
|
|
927
|
-
if (
|
|
931
|
+
if (l[p - 1] === "h")
|
|
928
932
|
break;
|
|
929
|
-
const h =
|
|
930
|
-
f.push(`${n}`.padStart(h, "0")), u.includes(
|
|
933
|
+
const h = d(p, l);
|
|
934
|
+
f.push(`${n}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
|
|
931
935
|
break;
|
|
932
936
|
}
|
|
933
937
|
case "m": {
|
|
934
|
-
if (
|
|
938
|
+
if (l[p - 1] === "m")
|
|
935
939
|
break;
|
|
936
|
-
const h =
|
|
937
|
-
s.includes("h") || (
|
|
940
|
+
const h = d(p, l);
|
|
941
|
+
s.includes("h") || (a += n * 60), f.push(`${a}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(":");
|
|
938
942
|
break;
|
|
939
943
|
}
|
|
940
944
|
case "s": {
|
|
941
|
-
if (
|
|
945
|
+
if (l[p - 1] === "s")
|
|
942
946
|
break;
|
|
943
|
-
const h =
|
|
944
|
-
s.includes("m") || (o +=
|
|
947
|
+
const h = d(p, l);
|
|
948
|
+
s.includes("m") || (o += a * 60), f.push(`${o}`.padStart(h, "0")), u.includes(l[p + h]) && f.push(".");
|
|
945
949
|
break;
|
|
946
950
|
}
|
|
947
951
|
case "S": {
|
|
948
|
-
if (
|
|
952
|
+
if (l[p - 1] === "S")
|
|
949
953
|
break;
|
|
950
|
-
const h =
|
|
951
|
-
s.includes("s") || (
|
|
954
|
+
const h = d(p, l);
|
|
955
|
+
s.includes("s") || (i += o * 1e3), f.push(`${Math.round(i / 10 ** (3 - h))}`.padStart(h, "0"));
|
|
952
956
|
break;
|
|
953
957
|
}
|
|
954
958
|
default:
|
|
@@ -970,12 +974,12 @@ class S {
|
|
|
970
974
|
};
|
|
971
975
|
if (this.samples === -1 / 0)
|
|
972
976
|
return "00:00:00:00";
|
|
973
|
-
const { hours: n, minutes: r, seconds:
|
|
977
|
+
const { hours: n, minutes: r, seconds: a, frames: o } = this.toUnits(), i = s ? this.frameSeparator : ":", c = [
|
|
974
978
|
n.toFixed().padStart(2, "0"),
|
|
975
979
|
r.toFixed().padStart(2, "0"),
|
|
976
|
-
|
|
977
|
-
].join(
|
|
978
|
-
return [c, `${o}`.padStart(
|
|
980
|
+
a.toFixed().padStart(2, "0")
|
|
981
|
+
].join(i), d = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
|
|
982
|
+
return [c, `${o}`.padStart(d, "0")].join(this.frameSeparator);
|
|
979
983
|
}
|
|
980
984
|
/**
|
|
981
985
|
* Get TimeCode as a VidiCore TimeCodeType object
|
|
@@ -1003,45 +1007,45 @@ const ue = (e, t) => {
|
|
|
1003
1007
|
s > n ? [s, n] = [s - n, n] : [s, n] = [s, n - s];
|
|
1004
1008
|
return s || n;
|
|
1005
1009
|
}, de = (e, t) => {
|
|
1006
|
-
const { timeBase: s, useGCD: n = !1, roundingMode: r, ...
|
|
1010
|
+
const { timeBase: s, useGCD: n = !1, roundingMode: r, ...a } = t || {}, o = `${e}`.replace(/,/g, ".");
|
|
1007
1011
|
if (Number.isNaN(+o))
|
|
1008
1012
|
throw new Error(`seconds must be digits, is ${e}`);
|
|
1009
|
-
let
|
|
1013
|
+
let i = 1, c;
|
|
1010
1014
|
if (Number.isInteger(+o))
|
|
1011
|
-
c = +o *
|
|
1015
|
+
c = +o * i;
|
|
1012
1016
|
else {
|
|
1013
1017
|
const [, u] = o.split("."), f = Math.min((u == null ? void 0 : u.length) ?? 0, 16);
|
|
1014
|
-
|
|
1018
|
+
i *= 10 ** f, c = Math.round(Number(o) * i);
|
|
1015
1019
|
}
|
|
1016
1020
|
if (s === void 0 && n) {
|
|
1017
|
-
const u = ue(
|
|
1018
|
-
c /= u,
|
|
1021
|
+
const u = ue(i, c);
|
|
1022
|
+
c /= u, i /= u;
|
|
1019
1023
|
}
|
|
1020
|
-
const
|
|
1021
|
-
{ samples: c, timeBase: { denominator:
|
|
1022
|
-
|
|
1024
|
+
const d = new S(
|
|
1025
|
+
{ samples: c, timeBase: { denominator: i, numerator: 1 } },
|
|
1026
|
+
a
|
|
1023
1027
|
);
|
|
1024
|
-
return s !== void 0 ?
|
|
1025
|
-
}, le = ([e, t, s, n], r,
|
|
1026
|
-
const o =
|
|
1027
|
-
if (r === 0 || !
|
|
1028
|
+
return s !== void 0 ? d.conformTimeBase(s, { ...a, roundingMode: r }) : d;
|
|
1029
|
+
}, le = ([e, t, s, n], r, a) => {
|
|
1030
|
+
const o = a.toRate({ rounded: !0 }), i = st(a);
|
|
1031
|
+
if (r === 0 || !i)
|
|
1028
1032
|
return 0;
|
|
1029
|
-
const c = t % 10 !== 0,
|
|
1030
|
-
if (
|
|
1033
|
+
const c = t % 10 !== 0, d = c && s === 0, u = e * (3600 * o - 54 * i), f = t * 60 * o - (t - Math.ceil(t / 10)) * i, m = s * o - (c && s > 1 ? i : 0);
|
|
1034
|
+
if (d && n < i)
|
|
1031
1035
|
throw new Error(
|
|
1032
|
-
`Frame does not exist for ${
|
|
1036
|
+
`Frame does not exist for ${a.toConstant() || a.toRate()} drop-frame`
|
|
1033
1037
|
);
|
|
1034
|
-
const p =
|
|
1035
|
-
return r -
|
|
1038
|
+
const p = d ? n - i : n, l = u + f + m + p;
|
|
1039
|
+
return r - l;
|
|
1036
1040
|
}, H = (e, t, s) => {
|
|
1037
|
-
const [n, r,
|
|
1041
|
+
const [n, r, a, o] = e, i = t.toRate({ rounded: !0 }), c = n * 3600 * i + r * 60 * i + a * i + o;
|
|
1038
1042
|
return c - (s ? le(e, c, t) : 0);
|
|
1039
1043
|
}, fe = (e) => {
|
|
1040
1044
|
const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
|
|
1041
1045
|
let s = [];
|
|
1042
1046
|
if (t) {
|
|
1043
|
-
const [r,
|
|
1044
|
-
s = [...r.split(":"),
|
|
1047
|
+
const [r, a] = e.split(t);
|
|
1048
|
+
s = [...r.split(":"), a];
|
|
1045
1049
|
} else
|
|
1046
1050
|
s = e.split(":");
|
|
1047
1051
|
if (s.length !== 4)
|
|
@@ -1064,50 +1068,50 @@ const ue = (e, t) => {
|
|
|
1064
1068
|
throw new Error("smpte cannot be undefined or null");
|
|
1065
1069
|
if (typeof e != "string")
|
|
1066
1070
|
throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
|
|
1067
|
-
const { smpteValues:
|
|
1071
|
+
const { smpteValues: a, smpteFrameSeparator: o } = fe(e), i = $(n), c = {
|
|
1068
1072
|
...r,
|
|
1069
1073
|
frameSeparator: (r == null ? void 0 : r.frameSeparator) || o,
|
|
1070
1074
|
...(r == null ? void 0 : r.dropFrame) === void 0 ? {
|
|
1071
|
-
dropFrame: n !== void 0 ? wt(
|
|
1075
|
+
dropFrame: n !== void 0 ? wt(i) : [";", ","].includes(o)
|
|
1072
1076
|
} : {}
|
|
1073
|
-
},
|
|
1074
|
-
if (
|
|
1077
|
+
}, d = i.toRate({ rounded: !0 }), u = Math.max(0, d - 1);
|
|
1078
|
+
if (a.some((m) => m < 0))
|
|
1075
1079
|
throw new Error("Negative values are not supported");
|
|
1076
1080
|
let f;
|
|
1077
1081
|
switch (s) {
|
|
1078
1082
|
case "error": {
|
|
1079
|
-
const [m, p,
|
|
1083
|
+
const [m, p, l, h] = a;
|
|
1080
1084
|
if (m >= 100 || p >= 60)
|
|
1081
1085
|
throw Error("Minutes has to be less than 60");
|
|
1082
|
-
if (
|
|
1086
|
+
if (l >= 60)
|
|
1083
1087
|
throw Error("Seconds has to be less than 60");
|
|
1084
1088
|
if (h > u)
|
|
1085
1089
|
throw Error(`Frames has to be less or equal to ${u}`);
|
|
1086
|
-
f = H(
|
|
1090
|
+
f = H(a, i, c == null ? void 0 : c.dropFrame);
|
|
1087
1091
|
break;
|
|
1088
1092
|
}
|
|
1089
1093
|
case "ignore": {
|
|
1090
|
-
const [m, p,
|
|
1094
|
+
const [m, p, l, h] = a, g = [
|
|
1091
1095
|
Math.min(100, m),
|
|
1092
1096
|
Math.min(59, p),
|
|
1093
|
-
Math.min(59,
|
|
1097
|
+
Math.min(59, l),
|
|
1094
1098
|
Math.min(u, h)
|
|
1095
1099
|
];
|
|
1096
1100
|
f = H(
|
|
1097
1101
|
g,
|
|
1098
|
-
|
|
1102
|
+
i,
|
|
1099
1103
|
c == null ? void 0 : c.dropFrame
|
|
1100
1104
|
);
|
|
1101
1105
|
break;
|
|
1102
1106
|
}
|
|
1103
1107
|
case "add": {
|
|
1104
|
-
f = H(
|
|
1108
|
+
f = H(a, i, c == null ? void 0 : c.dropFrame);
|
|
1105
1109
|
break;
|
|
1106
1110
|
}
|
|
1107
1111
|
default:
|
|
1108
1112
|
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(me)}`);
|
|
1109
1113
|
}
|
|
1110
|
-
return new S({ samples: f, timeBase:
|
|
1114
|
+
return new S({ samples: f, timeBase: i }, c);
|
|
1111
1115
|
}, _e = {
|
|
1112
1116
|
timeBase: void 0,
|
|
1113
1117
|
dropFrame: void 0,
|
|
@@ -1120,22 +1124,22 @@ const ue = (e, t) => {
|
|
|
1120
1124
|
else if (typeof e == "number")
|
|
1121
1125
|
r = { samples: e };
|
|
1122
1126
|
else if (e.includes("@")) {
|
|
1123
|
-
const [o,
|
|
1124
|
-
r = { samples: Number(o), timeBase: et(
|
|
1127
|
+
const [o, i] = e.split("@");
|
|
1128
|
+
r = { samples: Number(o), timeBase: et(i) };
|
|
1125
1129
|
} else
|
|
1126
1130
|
e === "-INF" ? r = { samples: -1 / 0 } : e === "+INF" ? r = { samples: 1 / 0 } : r = { samples: Number(e) };
|
|
1127
1131
|
if (Number.isNaN(r == null ? void 0 : r.samples) || r.timeBase && !(r.timeBase instanceof R))
|
|
1128
1132
|
throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
|
|
1129
|
-
const
|
|
1130
|
-
return s ?
|
|
1133
|
+
const a = new S(r, n);
|
|
1134
|
+
return s ? a.conformTimeBase($(s), n) : a;
|
|
1131
1135
|
}, Te = {
|
|
1132
1136
|
dropFrame: void 0,
|
|
1133
1137
|
frameSeparator: void 0
|
|
1134
|
-
},
|
|
1138
|
+
}, P = (e, t) => new S(e, { ...Te, ...t }), ge = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), Ee = (e) => !Number.isNaN(Number(e)), j = (e, t) => {
|
|
1135
1139
|
if (e instanceof S)
|
|
1136
1140
|
return e;
|
|
1137
1141
|
if (typeof e != "string" && typeof e != "number")
|
|
1138
|
-
return
|
|
1142
|
+
return P(e, t);
|
|
1139
1143
|
if (typeof e == "string" && ge(e))
|
|
1140
1144
|
return pe(e, t);
|
|
1141
1145
|
if (["string", "number"].includes(typeof e) && Ee(e))
|
|
@@ -1144,8 +1148,8 @@ const ue = (e, t) => {
|
|
|
1144
1148
|
return U(e, t);
|
|
1145
1149
|
};
|
|
1146
1150
|
function dt({ hours: e = 0, minutes: t = 0, seconds: s = 0, partialSeconds: n = 0 }) {
|
|
1147
|
-
const r = e.toFixed().padStart(2, "0"),
|
|
1148
|
-
return `${r}:${
|
|
1151
|
+
const r = e.toFixed().padStart(2, "0"), a = t.toFixed().padStart(2, "0"), o = s.toFixed().padStart(2, "0"), i = (n * 10).toFixed().padStart(3, "0");
|
|
1152
|
+
return `${r}:${a}:${o}.${i}`;
|
|
1149
1153
|
}
|
|
1150
1154
|
const Ae = {
|
|
1151
1155
|
subtitleGroup: "stl_subtitle",
|
|
@@ -1160,18 +1164,18 @@ const Ae = {
|
|
|
1160
1164
|
timespanAsList: !0,
|
|
1161
1165
|
overrideGroup: !0,
|
|
1162
1166
|
joinValue: ","
|
|
1163
|
-
}).map((
|
|
1167
|
+
}).map((i) => {
|
|
1164
1168
|
const {
|
|
1165
1169
|
start: c,
|
|
1166
|
-
end:
|
|
1170
|
+
end: d,
|
|
1167
1171
|
[s]: { [n]: u } = {}
|
|
1168
|
-
} = (Array.isArray(
|
|
1172
|
+
} = (Array.isArray(i) ? i[0] : i) || {};
|
|
1169
1173
|
if (!u)
|
|
1170
1174
|
return "";
|
|
1171
|
-
const f = dt(U(c).toTime()), m = dt(U(
|
|
1175
|
+
const f = dt(U(c).toTime()), m = dt(U(d).toTime());
|
|
1172
1176
|
return `${f} --> ${m} line:0%\r${u}\r`;
|
|
1173
1177
|
});
|
|
1174
|
-
if (o.some((
|
|
1178
|
+
if (o.some((i) => !!i))
|
|
1175
1179
|
return `WEBVTT
|
|
1176
1180
|
|
|
1177
1181
|
|
|
@@ -1179,32 +1183,32 @@ ${o.join(`
|
|
|
1179
1183
|
`)}`;
|
|
1180
1184
|
}, Ie = { count: !0, exclude: !0 }, ms = (e = [], t = {}) => {
|
|
1181
1185
|
const s = { ...Ie, ...t }, { count: n, exclude: r } = s;
|
|
1182
|
-
return e.map((
|
|
1183
|
-
field:
|
|
1184
|
-
name:
|
|
1186
|
+
return e.map((a) => typeof a == "string" ? {
|
|
1187
|
+
field: a,
|
|
1188
|
+
name: a,
|
|
1185
1189
|
count: n,
|
|
1186
|
-
...r === !0 ? { exclude: [
|
|
1187
|
-
} :
|
|
1190
|
+
...r === !0 ? { exclude: [a] } : {}
|
|
1191
|
+
} : a);
|
|
1188
1192
|
}, hs = (e = []) => e == null ? void 0 : e.map(({ name: t, field: s, count: n, range: r }) => ({
|
|
1189
1193
|
facetName: t,
|
|
1190
1194
|
fieldName: s,
|
|
1191
|
-
count: n == null ? void 0 : n.reduce((
|
|
1195
|
+
count: n == null ? void 0 : n.reduce((a, { fieldValue: o, value: i }) => ({ ...a, [o]: i }), {}),
|
|
1192
1196
|
...r ? {
|
|
1193
|
-
range: r.map(({ value:
|
|
1197
|
+
range: r.map(({ value: a, start: o, end: i }) => ({
|
|
1194
1198
|
start: Number.isNaN(+o) ? o : Number(o),
|
|
1195
|
-
end: Number.isNaN(+
|
|
1196
|
-
count: Number(
|
|
1199
|
+
end: Number.isNaN(+i) ? i : Number(i),
|
|
1200
|
+
count: Number(a) || 0
|
|
1197
1201
|
}))
|
|
1198
1202
|
} : {}
|
|
1199
1203
|
})), ps = (e = []) => {
|
|
1200
1204
|
const t = {};
|
|
1201
1205
|
return e.forEach(({ name: s, field: n, count: r }) => {
|
|
1202
1206
|
t[s || n] = r.reduce(
|
|
1203
|
-
(
|
|
1207
|
+
(a, { fieldValue: o, value: i }) => ({ ...a, [o]: i }),
|
|
1204
1208
|
{}
|
|
1205
1209
|
);
|
|
1206
1210
|
}), t;
|
|
1207
|
-
},
|
|
1211
|
+
}, Lt = {
|
|
1208
1212
|
arrayOnSingle: !0,
|
|
1209
1213
|
joinValue: void 0,
|
|
1210
1214
|
timespanAsList: !1
|
|
@@ -1213,16 +1217,16 @@ ${o.join(`
|
|
|
1213
1217
|
arrayOnSingle: s = !0,
|
|
1214
1218
|
joinValue: n = void 0,
|
|
1215
1219
|
timespanAsList: r = !1
|
|
1216
|
-
} = { ...
|
|
1217
|
-
return
|
|
1220
|
+
} = { ...Lt, ...t || {} }, { field: a = [], start: o, end: i } = e || {}, c = r ? { start: o, end: i } : {};
|
|
1221
|
+
return a.reduce((u, f) => {
|
|
1218
1222
|
const { name: m, value: p = [] } = f;
|
|
1219
1223
|
if (p.length === 0)
|
|
1220
1224
|
return u;
|
|
1221
|
-
let
|
|
1222
|
-
return s === !1 && p.length === 1 ? [
|
|
1225
|
+
let l;
|
|
1226
|
+
return s === !1 && p.length === 1 ? [l] = p : n ? l = p.join(n) : l = p, { ...u, [m]: l };
|
|
1223
1227
|
}, c);
|
|
1224
1228
|
}, Oe = {
|
|
1225
|
-
...
|
|
1229
|
+
...Lt,
|
|
1226
1230
|
timespanAsList: !1,
|
|
1227
1231
|
joinTimespan: "_",
|
|
1228
1232
|
flat: !1,
|
|
@@ -1232,17 +1236,17 @@ ${o.join(`
|
|
|
1232
1236
|
timespanAsList: s,
|
|
1233
1237
|
joinTimespan: n = "_",
|
|
1234
1238
|
flat: r,
|
|
1235
|
-
flatTimespan:
|
|
1239
|
+
flatTimespan: a,
|
|
1236
1240
|
...o
|
|
1237
1241
|
} = { ...Oe, ...t || {} };
|
|
1238
1242
|
return s === !0 ? e.map(
|
|
1239
|
-
(
|
|
1240
|
-
) : r === !0 ||
|
|
1241
|
-
(
|
|
1243
|
+
(i) => Y(i, { ...o, timespanAsList: s })
|
|
1244
|
+
) : r === !0 || a === !0 ? e.reduce(
|
|
1245
|
+
(i, c) => ({ ...i, ...Y(c, t) }),
|
|
1242
1246
|
{}
|
|
1243
1247
|
) : e.reduce(
|
|
1244
|
-
(
|
|
1245
|
-
...
|
|
1248
|
+
(i, c) => ({
|
|
1249
|
+
...i,
|
|
1246
1250
|
[[c.start, c.end].join(n)]: Y(
|
|
1247
1251
|
c,
|
|
1248
1252
|
t
|
|
@@ -1251,11 +1255,11 @@ ${o.join(`
|
|
|
1251
1255
|
{}
|
|
1252
1256
|
);
|
|
1253
1257
|
}, be = (e, t) => {
|
|
1254
|
-
const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n,
|
|
1255
|
-
const c =
|
|
1258
|
+
const s = j(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: r = [] } = n, a = r.map((i) => {
|
|
1259
|
+
const c = i.split("/").pop().split("?").shift();
|
|
1256
1260
|
return U(c).toSeconds();
|
|
1257
|
-
}), o =
|
|
1258
|
-
(
|
|
1261
|
+
}), o = a.reduce(
|
|
1262
|
+
(i, c, d) => Math.abs(c - s) < Math.abs(a[i] - s) ? d : i,
|
|
1259
1263
|
0
|
|
1260
1264
|
);
|
|
1261
1265
|
return r[o];
|
|
@@ -1269,18 +1273,18 @@ ${o.join(`
|
|
|
1269
1273
|
end: t,
|
|
1270
1274
|
group: s = [{ id: "unknown", name: "unknown" }]
|
|
1271
1275
|
}) => {
|
|
1272
|
-
const [{ id: n, name: r }] = s,
|
|
1273
|
-
return { start: e, end: t, startSeconds:
|
|
1276
|
+
const [{ id: n, name: r }] = s, a = j(e).toSeconds(), o = j(t).toSeconds();
|
|
1277
|
+
return { start: e, end: t, startSeconds: a, endSeconds: o, group: { uuid: n, name: r } };
|
|
1274
1278
|
}, Ts = (e = {}, t) => {
|
|
1275
1279
|
const { entry: s = [] } = e, n = {
|
|
1276
1280
|
...Re,
|
|
1277
1281
|
...t || {}
|
|
1278
|
-
}, { includeGroupMetadata: r, flatEvents:
|
|
1279
|
-
const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan:
|
|
1280
|
-
let g =
|
|
1282
|
+
}, { includeGroupMetadata: r, flatEvents: a, includeEntityType: o, includeNearestThumbnail: i } = n, c = s.map((d) => {
|
|
1283
|
+
const { type: u, item: { metadata: f = {}, id: m, thumbnails: p = {} } = {}, timespan: l, item: h } = d;
|
|
1284
|
+
let g = l.map(
|
|
1281
1285
|
(E) => ye(E)
|
|
1282
1286
|
);
|
|
1283
|
-
if (
|
|
1287
|
+
if (i && u === "Item" && p.uri && (g = g.map((E) => {
|
|
1284
1288
|
const { start: A } = E, O = be(h, j(A));
|
|
1285
1289
|
return { ...E, thumbnail: O };
|
|
1286
1290
|
})), r && u === "Item") {
|
|
@@ -1319,17 +1323,17 @@ ${o.join(`
|
|
|
1319
1323
|
...o && u === "Collection" ? { collectionType: h } : {}
|
|
1320
1324
|
};
|
|
1321
1325
|
});
|
|
1322
|
-
return
|
|
1323
|
-
({ events:
|
|
1324
|
-
(
|
|
1325
|
-
...
|
|
1326
|
+
return a ? c.flatMap(
|
|
1327
|
+
({ events: d, entityType: u, entityId: f, itemType: m, collectionType: p }) => d.map(
|
|
1328
|
+
(l) => ({
|
|
1329
|
+
...l,
|
|
1326
1330
|
entityType: u,
|
|
1327
1331
|
entityId: f,
|
|
1328
1332
|
...m && { itemType: m },
|
|
1329
1333
|
...p && { collectionType: p }
|
|
1330
1334
|
})
|
|
1331
1335
|
)
|
|
1332
|
-
).sort((
|
|
1336
|
+
).sort((d, u) => d.startSeconds - u.startSeconds) : c;
|
|
1333
1337
|
}, gs = (e = "NOW") => {
|
|
1334
1338
|
if (e.startsWith("NOW")) {
|
|
1335
1339
|
if (e === "NOW")
|
|
@@ -1366,31 +1370,31 @@ ${o.join(`
|
|
|
1366
1370
|
channelCount: s,
|
|
1367
1371
|
codec: n,
|
|
1368
1372
|
mediaInfo: r,
|
|
1369
|
-
bitrate:
|
|
1373
|
+
bitrate: a,
|
|
1370
1374
|
metadata: o
|
|
1371
|
-
} = e,
|
|
1375
|
+
} = e, i = Se(r), {
|
|
1372
1376
|
Format: c,
|
|
1373
|
-
Resolution:
|
|
1377
|
+
Resolution: d,
|
|
1374
1378
|
Bit_rate_mode: u
|
|
1375
|
-
} =
|
|
1379
|
+
} = i, 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, {
|
|
1376
1380
|
base: 10,
|
|
1377
1381
|
round: 1,
|
|
1378
1382
|
symbols: De
|
|
1379
1383
|
}) : void 0;
|
|
1380
|
-
let
|
|
1381
|
-
return
|
|
1382
|
-
(g = w(
|
|
1384
|
+
let l, h;
|
|
1385
|
+
return a !== void 0 && (l = w(a, { round: 2, symbols: lt }), h = Number(
|
|
1386
|
+
(g = w(a, { exponent: 1, symbols: lt }).split(" kbps")) == null ? void 0 : g[0]
|
|
1383
1387
|
)), {
|
|
1384
1388
|
audioFormat: c,
|
|
1385
1389
|
audioCodec: n,
|
|
1386
1390
|
audioSamplerate: p,
|
|
1387
1391
|
audioSamplerateSamples: m,
|
|
1388
|
-
audioBitDepth:
|
|
1389
|
-
audioBitrate:
|
|
1392
|
+
audioBitDepth: d,
|
|
1393
|
+
audioBitrate: l,
|
|
1390
1394
|
audioBitrateKbps: h,
|
|
1391
1395
|
audioBitRateMode: u,
|
|
1392
1396
|
audioChannels: s,
|
|
1393
|
-
audioMediaInfo:
|
|
1397
|
+
audioMediaInfo: i,
|
|
1394
1398
|
audioMetadata: f
|
|
1395
1399
|
};
|
|
1396
1400
|
}, Es = {
|
|
@@ -1416,31 +1420,31 @@ ${o.join(`
|
|
|
1416
1420
|
ARCHIVED: "ARCHIVED",
|
|
1417
1421
|
/** File will be synchronized by multi-site agent. */
|
|
1418
1422
|
AWAITING_SYNC: "AWAITING_SYNC"
|
|
1419
|
-
},
|
|
1423
|
+
}, Bt = (e) => {
|
|
1420
1424
|
const {
|
|
1421
1425
|
uri: t = [],
|
|
1422
1426
|
size: s,
|
|
1423
1427
|
hash: n,
|
|
1424
1428
|
path: r,
|
|
1425
|
-
id:
|
|
1429
|
+
id: a,
|
|
1426
1430
|
storage: o
|
|
1427
|
-
} = e, [
|
|
1431
|
+
} = e, [i] = 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;
|
|
1428
1432
|
return {
|
|
1429
|
-
uri:
|
|
1433
|
+
uri: i,
|
|
1430
1434
|
hash: n,
|
|
1431
1435
|
fileSize: c,
|
|
1432
1436
|
fileSizeBytes: s,
|
|
1433
1437
|
path: r,
|
|
1434
1438
|
fileName: u,
|
|
1435
|
-
fileId:
|
|
1439
|
+
fileId: a,
|
|
1436
1440
|
storageId: o,
|
|
1437
1441
|
folderPath: f
|
|
1438
1442
|
};
|
|
1439
1443
|
}, Me = (e = {}) => {
|
|
1440
|
-
const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n),
|
|
1441
|
-
let o = { binaryMetadata: r, binaryMediaInfo:
|
|
1444
|
+
const { file: t, mediaInfo: s, metadata: n = [] } = e, r = M(n), a = z(s);
|
|
1445
|
+
let o = { binaryMetadata: r, binaryMediaInfo: a };
|
|
1442
1446
|
if (t) {
|
|
1443
|
-
const [
|
|
1447
|
+
const [i] = t, c = Bt(i);
|
|
1444
1448
|
o = {
|
|
1445
1449
|
...o,
|
|
1446
1450
|
...c
|
|
@@ -1453,43 +1457,43 @@ ${o.join(`
|
|
|
1453
1457
|
metadata: s,
|
|
1454
1458
|
file: n,
|
|
1455
1459
|
duration: r,
|
|
1456
|
-
startTimestamp:
|
|
1460
|
+
startTimestamp: a,
|
|
1457
1461
|
startTimecode: o,
|
|
1458
|
-
timeCodeTimeBase:
|
|
1459
|
-
} = e, c = M(s || []),
|
|
1460
|
-
let { Format: u } =
|
|
1462
|
+
timeCodeTimeBase: i
|
|
1463
|
+
} = e, c = M(s || []), d = z(t);
|
|
1464
|
+
let { Format: u } = d;
|
|
1461
1465
|
const {
|
|
1462
1466
|
Video_Format_List: f,
|
|
1463
1467
|
Audio_Format_List: m,
|
|
1464
1468
|
Text_Format_List: p
|
|
1465
|
-
} =
|
|
1469
|
+
} = d;
|
|
1466
1470
|
if (u === void 0) {
|
|
1467
1471
|
const { format: h } = e;
|
|
1468
1472
|
u = h, h && h.includes(",") && ([u] = h.split(","));
|
|
1469
1473
|
}
|
|
1470
|
-
let
|
|
1474
|
+
let l = {
|
|
1471
1475
|
containerFormat: u,
|
|
1472
1476
|
videoFormat: f,
|
|
1473
1477
|
audioFormat: m,
|
|
1474
1478
|
textFormat: p,
|
|
1475
1479
|
containerMetadata: c,
|
|
1476
|
-
containerMediaInfo:
|
|
1480
|
+
containerMediaInfo: d
|
|
1477
1481
|
};
|
|
1478
|
-
if (c.componentOriginalFilename && (
|
|
1479
|
-
const h =
|
|
1480
|
-
|
|
1482
|
+
if (c.componentOriginalFilename && (l.originalFilename = c.componentOriginalFilename), r !== void 0 && r.samples !== 0) {
|
|
1483
|
+
const h = P(r);
|
|
1484
|
+
l.durationTimeCode = h.toObject(), l.duration = h.toDuration();
|
|
1481
1485
|
}
|
|
1482
|
-
if (
|
|
1486
|
+
if (a && (l.startTimestamp = P(a).toObject()), o !== void 0 && i && (l.startTimecode = P({
|
|
1483
1487
|
samples: o,
|
|
1484
|
-
timeBase:
|
|
1488
|
+
timeBase: i
|
|
1485
1489
|
})), n) {
|
|
1486
|
-
const [h] = n, g =
|
|
1487
|
-
|
|
1488
|
-
...
|
|
1490
|
+
const [h] = n, g = Bt(h);
|
|
1491
|
+
l = {
|
|
1492
|
+
...l,
|
|
1489
1493
|
...g
|
|
1490
1494
|
};
|
|
1491
1495
|
}
|
|
1492
|
-
return
|
|
1496
|
+
return l;
|
|
1493
1497
|
}, ft = { kB: "kbps", B: "bps", MB: "mbps" }, Ce = (e = {}) => {
|
|
1494
1498
|
var k;
|
|
1495
1499
|
const {
|
|
@@ -1497,66 +1501,66 @@ ${o.join(`
|
|
|
1497
1501
|
bitrate: s,
|
|
1498
1502
|
fieldOrder: n,
|
|
1499
1503
|
resolution: r,
|
|
1500
|
-
mediaInfo:
|
|
1504
|
+
mediaInfo: a,
|
|
1501
1505
|
metadata: o = []
|
|
1502
|
-
} = e,
|
|
1503
|
-
Format:
|
|
1506
|
+
} = e, i = ve(a), c = M(o), {
|
|
1507
|
+
Format: d,
|
|
1504
1508
|
"Frame rate": u,
|
|
1505
1509
|
"Color space": f,
|
|
1506
1510
|
"Color primaries": m,
|
|
1507
1511
|
Colorimetry: p
|
|
1508
|
-
} =
|
|
1509
|
-
let
|
|
1512
|
+
} = i;
|
|
1513
|
+
let l;
|
|
1510
1514
|
const { averageFrameRate: h, realBaseFrameRate: g } = e;
|
|
1511
|
-
g !== void 0 ?
|
|
1515
|
+
g !== void 0 ? l = x({
|
|
1512
1516
|
numerator: g.denominator,
|
|
1513
1517
|
denominator: g.numerator
|
|
1514
|
-
}) : u !== void 0 ?
|
|
1518
|
+
}) : u !== void 0 ? l = et(u) : h !== void 0 && (l = x({
|
|
1515
1519
|
numerator: h.denominator,
|
|
1516
1520
|
denominator: h.numerator
|
|
1517
1521
|
}));
|
|
1518
|
-
let { "Frame count": E } =
|
|
1522
|
+
let { "Frame count": E } = i;
|
|
1519
1523
|
if (E === void 0) {
|
|
1520
1524
|
const { numberOfPackets: it } = e;
|
|
1521
1525
|
it !== void 0 && (E = it.toString());
|
|
1522
1526
|
}
|
|
1523
1527
|
let A, O, I;
|
|
1524
|
-
E &&
|
|
1528
|
+
E && l && (A = P({ samples: E, timeBase: l }), O = A.timeBase.toConstant() || A.timeBase.toRate(), I = A.toSmpte());
|
|
1525
1529
|
const { height: b, width: D } = r || {}, N = J(r), C = `${D}x${b}`;
|
|
1526
|
-
let v,
|
|
1527
|
-
return s !== void 0 && (v = w(s, { round: 2, symbols: ft }),
|
|
1530
|
+
let v, L;
|
|
1531
|
+
return s !== void 0 && (v = w(s, { round: 2, symbols: ft }), L = Number(
|
|
1528
1532
|
(k = w(s, { exponent: 2, symbols: ft }).split(" mbps")) == null ? void 0 : k[0]
|
|
1529
1533
|
)), {
|
|
1530
|
-
videoFormat:
|
|
1534
|
+
videoFormat: d,
|
|
1531
1535
|
dimension: C,
|
|
1532
1536
|
frameRate: O,
|
|
1533
1537
|
height: b,
|
|
1534
1538
|
width: D,
|
|
1535
|
-
timeBase:
|
|
1539
|
+
timeBase: l,
|
|
1536
1540
|
timeCode: A,
|
|
1537
1541
|
videoCodec: t,
|
|
1538
1542
|
smpte: I,
|
|
1539
1543
|
videoBitrate: v,
|
|
1540
|
-
videoBitrateMbps:
|
|
1544
|
+
videoBitrateMbps: L,
|
|
1541
1545
|
fieldOrder: n,
|
|
1542
1546
|
colorSpace: f,
|
|
1543
1547
|
chromaSubsampling: p,
|
|
1544
1548
|
aspectRatio: N,
|
|
1545
1549
|
colorPrimaries: m,
|
|
1546
1550
|
videoMetadata: c,
|
|
1547
|
-
videoMediaInfo:
|
|
1551
|
+
videoMediaInfo: i
|
|
1548
1552
|
};
|
|
1549
1553
|
}, rt = (e = {}, t = {}) => {
|
|
1550
1554
|
let s = {};
|
|
1551
1555
|
const { priority: n = ["container", "video", "audio", "binary"] } = t, {
|
|
1552
1556
|
containerComponent: r,
|
|
1553
|
-
videoComponent:
|
|
1557
|
+
videoComponent: a,
|
|
1554
1558
|
audioComponent: o,
|
|
1555
|
-
binaryComponent:
|
|
1559
|
+
binaryComponent: i,
|
|
1556
1560
|
mimeType: c = [],
|
|
1557
|
-
tag:
|
|
1561
|
+
tag: d = []
|
|
1558
1562
|
} = e;
|
|
1559
|
-
[s.tag] =
|
|
1563
|
+
[s.tag] = d, [s.mimeType] = c;
|
|
1560
1564
|
const u = (f, m) => Object.fromEntries(
|
|
1561
1565
|
[.../* @__PURE__ */ new Set([...Object.keys(m), ...Object.keys(f)])].map((p) => [
|
|
1562
1566
|
p,
|
|
@@ -1572,8 +1576,8 @@ ${o.join(`
|
|
|
1572
1576
|
));
|
|
1573
1577
|
break;
|
|
1574
1578
|
case "video":
|
|
1575
|
-
if (
|
|
1576
|
-
const [m] =
|
|
1579
|
+
if (a) {
|
|
1580
|
+
const [m] = a;
|
|
1577
1581
|
s = u(
|
|
1578
1582
|
s,
|
|
1579
1583
|
Ce(m)
|
|
@@ -1590,8 +1594,8 @@ ${o.join(`
|
|
|
1590
1594
|
}
|
|
1591
1595
|
break;
|
|
1592
1596
|
case "binary":
|
|
1593
|
-
if (
|
|
1594
|
-
const [m] =
|
|
1597
|
+
if (i) {
|
|
1598
|
+
const [m] = i;
|
|
1595
1599
|
s = u(
|
|
1596
1600
|
s,
|
|
1597
1601
|
Me(m)
|
|
@@ -1600,7 +1604,7 @@ ${o.join(`
|
|
|
1600
1604
|
break;
|
|
1601
1605
|
}
|
|
1602
1606
|
}), s;
|
|
1603
|
-
},
|
|
1607
|
+
}, B = {
|
|
1604
1608
|
PDF: "PDF",
|
|
1605
1609
|
TEXT: "TEXT",
|
|
1606
1610
|
MSWORD: "MSWORD",
|
|
@@ -1616,15 +1620,15 @@ ${o.join(`
|
|
|
1616
1620
|
const { mimeType: t } = e, s = Array.isArray(t) ? t[0] : t;
|
|
1617
1621
|
if (s) {
|
|
1618
1622
|
if (s.endsWith("/pdf"))
|
|
1619
|
-
return
|
|
1623
|
+
return B.PDF;
|
|
1620
1624
|
if (s.startsWith("text/"))
|
|
1621
|
-
return
|
|
1625
|
+
return B.TEXT;
|
|
1622
1626
|
if (s.endsWith("/msword"))
|
|
1623
|
-
return
|
|
1627
|
+
return B.MSWORD;
|
|
1624
1628
|
if (s.endsWith("/json"))
|
|
1625
|
-
return
|
|
1629
|
+
return B.JSON;
|
|
1626
1630
|
if (s.endsWith("/xml"))
|
|
1627
|
-
return
|
|
1631
|
+
return B.XML;
|
|
1628
1632
|
}
|
|
1629
1633
|
}, we = [
|
|
1630
1634
|
"image/apng",
|
|
@@ -1634,7 +1638,7 @@ ${o.join(`
|
|
|
1634
1638
|
"image/x-icon",
|
|
1635
1639
|
"image/png",
|
|
1636
1640
|
"image/svg+xml"
|
|
1637
|
-
],
|
|
1641
|
+
], Le = ["video/mp4"], Be = [
|
|
1638
1642
|
"audio/mp4",
|
|
1639
1643
|
"audio/mpeg",
|
|
1640
1644
|
"audio/x-aac",
|
|
@@ -1645,7 +1649,7 @@ ${o.join(`
|
|
|
1645
1649
|
"audio/ogg",
|
|
1646
1650
|
"audio/webm",
|
|
1647
1651
|
"audio/x-flac"
|
|
1648
|
-
],
|
|
1652
|
+
], Pe = [...Le, ...we, ...Be], xe = ["http", "https"], je = "video/mp4", ke = "video/quicktime", We = "video/x-m4v", $e = "MPEG-4", Ue = "mov", Ge = "h264", W = [
|
|
1649
1653
|
"__mp4",
|
|
1650
1654
|
"__mp3_160k",
|
|
1651
1655
|
"__png",
|
|
@@ -1654,26 +1658,26 @@ ${o.join(`
|
|
|
1654
1658
|
"original"
|
|
1655
1659
|
].reverse(), mt = ({ parsedShape: { tag: e } }, { parsedShape: { tag: t } }) => W.includes(e) || W.includes(t) ? W.indexOf(t) - W.indexOf(e) : e.toLowerCase().localeCompare(t.toLowerCase()), Is = (e, t) => {
|
|
1656
1660
|
const {
|
|
1657
|
-
allowedMimeTypes: s =
|
|
1661
|
+
allowedMimeTypes: s = Pe,
|
|
1658
1662
|
allowedMethods: n = xe,
|
|
1659
1663
|
sortPriority: r = mt,
|
|
1660
|
-
sourceKey:
|
|
1664
|
+
sourceKey: a = "src",
|
|
1661
1665
|
mimeTypeKey: o = "type",
|
|
1662
|
-
shapeKey:
|
|
1666
|
+
shapeKey: i = "shape",
|
|
1663
1667
|
parsedShapeKey: c = "parsedShape"
|
|
1664
|
-
} = t || {}, { shape:
|
|
1665
|
-
let p,
|
|
1668
|
+
} = t || {}, { shape: d = [] } = e || {}, u = d.reduce((f, m) => {
|
|
1669
|
+
let p, l;
|
|
1666
1670
|
const h = rt(m), { uri: g, mimeType: E, containerFormat: A, videoCodec: O } = h;
|
|
1667
1671
|
if (E && (p = E, (E === ke || E === We) && (A === $e || A === Ue) && O === Ge && (p = je)), g)
|
|
1668
1672
|
if (n) {
|
|
1669
1673
|
const [I] = g.split("://");
|
|
1670
|
-
n.includes(I) && (
|
|
1674
|
+
n.includes(I) && (l = g);
|
|
1671
1675
|
} else
|
|
1672
|
-
|
|
1673
|
-
return
|
|
1674
|
-
[
|
|
1676
|
+
l = g;
|
|
1677
|
+
return l && s.includes(p) && f.push({
|
|
1678
|
+
[a]: l,
|
|
1675
1679
|
[o]: p,
|
|
1676
|
-
[
|
|
1680
|
+
[i]: m,
|
|
1677
1681
|
[c]: h
|
|
1678
1682
|
}), f;
|
|
1679
1683
|
}, []);
|
|
@@ -1696,7 +1700,7 @@ ${o.join(`
|
|
|
1696
1700
|
if (s.endsWith("/octet-stream"))
|
|
1697
1701
|
return y.BINARY;
|
|
1698
1702
|
}
|
|
1699
|
-
},
|
|
1703
|
+
}, Pt = "video/mp4", xt = "video/quicktime", jt = "video/x-m4v", ze = "MPEG-4", Ve = "mov", He = "h264", Ye = [Pt, xt, jt], kt = [
|
|
1700
1704
|
"video/x-mxf-h264",
|
|
1701
1705
|
"video/x-mxf-h264-aac",
|
|
1702
1706
|
"video/x-mxf-h264-pcm_s24le",
|
|
@@ -1724,23 +1728,23 @@ ${o.join(`
|
|
|
1724
1728
|
allowedMimeTypes: s = qe,
|
|
1725
1729
|
allowedMethods: n = Xe,
|
|
1726
1730
|
streamingServers: r = []
|
|
1727
|
-
} = t || {}, { shape:
|
|
1731
|
+
} = t || {}, { shape: a = [] } = e || {}, { startTimeCode: o } = ce(e == null ? void 0 : e.metadata, {
|
|
1728
1732
|
flat: !0,
|
|
1729
1733
|
arrayOnSingleValue: !1
|
|
1730
1734
|
});
|
|
1731
|
-
return
|
|
1735
|
+
return a.reduce((c, d) => {
|
|
1732
1736
|
var D, N, C;
|
|
1733
1737
|
let u, f, m;
|
|
1734
|
-
const p = rt(
|
|
1735
|
-
if (!(s != null && s.includes(h)) || !(n != null && n.includes((D =
|
|
1738
|
+
const p = rt(d), { uri: l, mimeType: h, containerFormat: g, videoCodec: E } = p;
|
|
1739
|
+
if (!(s != null && s.includes(h)) || !(n != null && n.includes((D = l == null ? void 0 : l.split("://")) == null ? void 0 : D[0])))
|
|
1736
1740
|
return c;
|
|
1737
1741
|
if (m = p.tag, !m) {
|
|
1738
|
-
const v = (C = (N = h == null ? void 0 : h.split) == null ? void 0 : N.call(h, "/")) == null ? void 0 : C.pop(),
|
|
1739
|
-
|
|
1742
|
+
const v = (C = (N = h == null ? void 0 : h.split) == null ? void 0 : N.call(h, "/")) == null ? void 0 : C.pop(), L = c.filter((k) => k.label === v).length;
|
|
1743
|
+
L === 0 ? m = v : m = v + (L + 1);
|
|
1740
1744
|
}
|
|
1741
1745
|
const { timeBase: A, startTimecode: O } = p, I = o ?? O, b = I && j(I);
|
|
1742
|
-
return f =
|
|
1743
|
-
url:
|
|
1746
|
+
return f = l, u = h, (h === xt || h === jt) && (g === ze || g === Ve) && E === He && (u = Pt), r != null && r.length && kt.includes(h) && (f = Qe({
|
|
1747
|
+
url: l,
|
|
1744
1748
|
streamingServers: r,
|
|
1745
1749
|
ending: "mpd"
|
|
1746
1750
|
}), u = "application/dash+xml"), f && c.push({
|
|
@@ -1755,43 +1759,43 @@ ${o.join(`
|
|
|
1755
1759
|
const t = {}, { outputSetting: s = [] } = e || {};
|
|
1756
1760
|
if (s.length === 0)
|
|
1757
1761
|
return t;
|
|
1758
|
-
const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription:
|
|
1759
|
-
if (r && (t.containerFormat = r.Container),
|
|
1760
|
-
const { CodecSettings:
|
|
1762
|
+
const n = JSON.parse(s[0]), { Settings: { ContainerSettings: r, VideoDescription: a, AudioDescriptions: o } = {} } = n;
|
|
1763
|
+
if (r && (t.containerFormat = r.Container), a) {
|
|
1764
|
+
const { CodecSettings: i = {} } = a, { Codec: c, ...d } = i;
|
|
1761
1765
|
t.videoFormat = c;
|
|
1762
|
-
const { Height: u, Width: f } =
|
|
1766
|
+
const { Height: u, Width: f } = a;
|
|
1763
1767
|
t.height = u, t.width = f, u && f && (t.dimension = `${f}x${u}`, t.aspectRatio = J({ height: u, width: f }));
|
|
1764
|
-
const [m] = Object.values(
|
|
1768
|
+
const [m] = Object.values(d);
|
|
1765
1769
|
if (m) {
|
|
1766
1770
|
t.fieldOrder = m.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = m.Bitrate;
|
|
1767
|
-
const p = m.FramerateDenominator,
|
|
1771
|
+
const p = m.FramerateDenominator, l = m.FramerateNumerator, h = x({ denominator: l, numerator: p });
|
|
1768
1772
|
t.timeBase = h, t.frameRate = h.toConstant() || h.toRate();
|
|
1769
1773
|
}
|
|
1770
1774
|
}
|
|
1771
1775
|
if (o && o.length > 0) {
|
|
1772
|
-
const { CodecSettings:
|
|
1776
|
+
const { CodecSettings: i = {} } = o[0], { Codec: c, ...d } = i;
|
|
1773
1777
|
t.audioFormat = c;
|
|
1774
|
-
const [u] = Object.values(
|
|
1778
|
+
const [u] = Object.values(d);
|
|
1775
1779
|
u && (t.audioSamplerate = u.SampleRate, t.audioBitrate = u.Bitrate, t.audioBitRateMode = u.RateControlMode);
|
|
1776
1780
|
}
|
|
1777
1781
|
return t;
|
|
1778
1782
|
}, Rs = (e) => {
|
|
1779
|
-
const t = {}, { description: s, format: n, audio: r, video:
|
|
1783
|
+
const t = {}, { description: s, format: n, audio: r, video: a, mediaconvert: o } = e || {};
|
|
1780
1784
|
if (o)
|
|
1781
1785
|
return { description: s, ...Ze(o) };
|
|
1782
|
-
if (t.description = s, t.containerFormat = n,
|
|
1783
|
-
if (t.videoFormat =
|
|
1784
|
-
const
|
|
1785
|
-
t.timeBase =
|
|
1786
|
+
if (t.description = s, t.containerFormat = n, a) {
|
|
1787
|
+
if (t.videoFormat = a.codec, t.videoBitrate = a.bitrate, a.framerate) {
|
|
1788
|
+
const i = x(a.framerate);
|
|
1789
|
+
t.timeBase = i, t.frameRate = i.toConstant() || i.toRate();
|
|
1786
1790
|
}
|
|
1787
|
-
if (
|
|
1788
|
-
const { height:
|
|
1789
|
-
t.height =
|
|
1791
|
+
if (a.scaling) {
|
|
1792
|
+
const { height: i, width: c } = a.scaling;
|
|
1793
|
+
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio = J({ height: i, width: c }));
|
|
1790
1794
|
}
|
|
1791
1795
|
}
|
|
1792
1796
|
if (r) {
|
|
1793
|
-
const { codec:
|
|
1794
|
-
t.audioFormat =
|
|
1797
|
+
const { codec: i, channel: c } = r;
|
|
1798
|
+
t.audioFormat = i, c && (t.audioChannels = c.length);
|
|
1795
1799
|
}
|
|
1796
1800
|
return t;
|
|
1797
1801
|
}, ts = (e) => {
|
|
@@ -1802,17 +1806,17 @@ ${o.join(`
|
|
|
1802
1806
|
type: s,
|
|
1803
1807
|
defaultValue: n,
|
|
1804
1808
|
stringRestriction: r,
|
|
1805
|
-
floatRestriction:
|
|
1809
|
+
floatRestriction: a,
|
|
1806
1810
|
integerRestriction: o,
|
|
1807
|
-
longRestriction:
|
|
1811
|
+
longRestriction: i,
|
|
1808
1812
|
data: c,
|
|
1809
|
-
values:
|
|
1813
|
+
values: d,
|
|
1810
1814
|
system: u
|
|
1811
|
-
} = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive:
|
|
1815
|
+
} = e, { minLength: f, maxLength: m, pattern: p } = r || {}, { minInclusive: l, maxInclusive: h } = a || o || i || {}, g = ((d == null ? void 0 : d.field) || []).map(({ key: I, value: b }) => ({
|
|
1812
1816
|
label: b ?? I,
|
|
1813
1817
|
value: I
|
|
1814
1818
|
})), A = ((I) => Object.fromEntries(Object.entries(I).filter(([, b]) => b !== void 0)))({
|
|
1815
|
-
min:
|
|
1819
|
+
min: l,
|
|
1816
1820
|
max: h,
|
|
1817
1821
|
minLength: f,
|
|
1818
1822
|
maxLength: m,
|
|
@@ -1822,7 +1826,7 @@ ${o.join(`
|
|
|
1822
1826
|
name: t,
|
|
1823
1827
|
type: s,
|
|
1824
1828
|
defaultValue: n,
|
|
1825
|
-
required:
|
|
1829
|
+
required: l !== void 0 || f !== void 0 && f > 0,
|
|
1826
1830
|
restrictions: A,
|
|
1827
1831
|
data: O,
|
|
1828
1832
|
options: g,
|
|
@@ -1870,8 +1874,8 @@ class nt {
|
|
|
1870
1874
|
*/
|
|
1871
1875
|
trigger(t, s, n) {
|
|
1872
1876
|
const r = this.events[t];
|
|
1873
|
-
!r || r.length < 1 || r.forEach((
|
|
1874
|
-
|
|
1877
|
+
!r || r.length < 1 || r.forEach((a) => {
|
|
1878
|
+
a(s, n);
|
|
1875
1879
|
});
|
|
1876
1880
|
}
|
|
1877
1881
|
}
|
|
@@ -1956,7 +1960,7 @@ class es {
|
|
|
1956
1960
|
}
|
|
1957
1961
|
class ht {
|
|
1958
1962
|
constructor(t, s) {
|
|
1959
|
-
var n, r,
|
|
1963
|
+
var n, r, a, o, i, c;
|
|
1960
1964
|
if (this.DEFAULT_OPTIONS = Object.freeze({
|
|
1961
1965
|
targetRate: 4e6,
|
|
1962
1966
|
// 4mb sec,
|
|
@@ -1983,7 +1987,7 @@ class ht {
|
|
|
1983
1987
|
...((n = s.api) == null ? void 0 : n.props) ?? {},
|
|
1984
1988
|
queryParams: {
|
|
1985
1989
|
transferId: zt(),
|
|
1986
|
-
...((
|
|
1990
|
+
...((a = (r = s.api) == null ? void 0 : r.props) == null ? void 0 : a.queryParams) ?? {}
|
|
1987
1991
|
}
|
|
1988
1992
|
}
|
|
1989
1993
|
}
|
|
@@ -1999,7 +2003,7 @@ class ht {
|
|
|
1999
2003
|
maxConcurrentTransfers: this.options.maxConcurrentTransfers,
|
|
2000
2004
|
mime: "",
|
|
2001
2005
|
status: _.idle,
|
|
2002
|
-
transferId: (c = (
|
|
2006
|
+
transferId: (c = (i = (o = s.api) == null ? void 0 : o.props) == null ? void 0 : i.queryParams) == null ? void 0 : c.transferId,
|
|
2003
2007
|
lastStats: {}
|
|
2004
2008
|
}, 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}`));
|
|
2005
2009
|
}
|
|
@@ -2011,19 +2015,19 @@ class ht {
|
|
|
2011
2015
|
let n = 0;
|
|
2012
2016
|
const r = () => {
|
|
2013
2017
|
for (; this.state.transferPromises.length < this.state.maxConcurrentTransfers && n < s; ) {
|
|
2014
|
-
const
|
|
2015
|
-
if (n += 1,
|
|
2018
|
+
const a = this.state.chunks[n];
|
|
2019
|
+
if (n += 1, a.state.status !== _.complete && a.state.status !== _.transferring) {
|
|
2016
2020
|
this.state.status = _.transferring;
|
|
2017
|
-
const o =
|
|
2021
|
+
const o = a.tryTransfer();
|
|
2018
2022
|
this.state.transferPromises.push(o), o.then(() => {
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2021
|
-
}).catch((
|
|
2023
|
+
const i = this.state.transferPromises.indexOf(o);
|
|
2024
|
+
i !== -1 && this.state.transferPromises.splice(i, 1), this.state.status !== _.canceled && r();
|
|
2025
|
+
}).catch((i) => {
|
|
2022
2026
|
const c = this.state.transferPromises.indexOf(o);
|
|
2023
2027
|
c !== -1 && this.state.transferPromises.splice(c, 1), console.error(
|
|
2024
2028
|
"Failed on this upload(), check connectivity and try to resume",
|
|
2025
|
-
|
|
2026
|
-
), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state,
|
|
2029
|
+
i
|
|
2030
|
+
), this.state.status !== _.offline ? (this.state.status = _.failed, this.eventBus.trigger(T.failed, this.state, i), this.options.onFail && this.options.onFail(i)) : setTimeout(() => this.retry(), 5e3);
|
|
2027
2031
|
});
|
|
2028
2032
|
}
|
|
2029
2033
|
}
|
|
@@ -2035,16 +2039,16 @@ class ht {
|
|
|
2035
2039
|
// get all byte ranges for splitting in chunks
|
|
2036
2040
|
getByteRangesForChunks(t, s = this.options.chunkSize) {
|
|
2037
2041
|
const n = [], { minChunkSize: r } = this.options;
|
|
2038
|
-
let o = s >= r ? s : r,
|
|
2039
|
-
if (t.size - (t.size - t.size /
|
|
2042
|
+
let o = s >= r ? s : r, i = Math.floor(t.size / o);
|
|
2043
|
+
if (t.size - (t.size - t.size / i) >= r || (i -= 1, o = Math.floor(t.size / i)), i < 2 || t.size < this.options.minFileSize)
|
|
2040
2044
|
n.push({ start: 0, end: t.size });
|
|
2041
2045
|
else
|
|
2042
|
-
for (let c = 0; c <=
|
|
2043
|
-
const
|
|
2046
|
+
for (let c = 0; c <= i; c += 1) {
|
|
2047
|
+
const d = o * c;
|
|
2044
2048
|
let u = o * c + o;
|
|
2045
2049
|
t.size - o * c <= r && (u = t.size);
|
|
2046
2050
|
const m = {
|
|
2047
|
-
start:
|
|
2051
|
+
start: d,
|
|
2048
2052
|
end: u
|
|
2049
2053
|
};
|
|
2050
2054
|
if (n.push(m), u === t.size)
|
|
@@ -2131,22 +2135,22 @@ class ht {
|
|
|
2131
2135
|
}
|
|
2132
2136
|
getStats() {
|
|
2133
2137
|
const t = this.state.chunks.length, s = this.state.chunks.filter(
|
|
2134
|
-
(
|
|
2138
|
+
(d) => d.state.status === _.complete
|
|
2135
2139
|
), n = this.state.chunks.filter(
|
|
2136
|
-
(
|
|
2140
|
+
(d) => d.state.status === _.transferring
|
|
2137
2141
|
), r = s.length;
|
|
2138
|
-
let
|
|
2139
|
-
s.forEach((
|
|
2140
|
-
|
|
2141
|
-
}), n.forEach((
|
|
2142
|
-
o +=
|
|
2142
|
+
let a = 0, o = 0;
|
|
2143
|
+
s.forEach((d) => {
|
|
2144
|
+
a += d.transferRate, o += d.blobSlice.size;
|
|
2145
|
+
}), n.forEach((d) => {
|
|
2146
|
+
o += d.state.bytesTransferred;
|
|
2143
2147
|
});
|
|
2144
|
-
const
|
|
2148
|
+
const i = a / r, c = {
|
|
2145
2149
|
totalChunks: t,
|
|
2146
2150
|
completedChunks: r,
|
|
2147
2151
|
totalBytes: this.state.blob.size,
|
|
2148
2152
|
transferredBytes: o,
|
|
2149
|
-
avgTransferRate:
|
|
2153
|
+
avgTransferRate: i,
|
|
2150
2154
|
concurrentTransfers: this.state.maxConcurrentTransfers
|
|
2151
2155
|
};
|
|
2152
2156
|
return this.state.rate = c.avgTransferRate, c;
|
|
@@ -2254,8 +2258,8 @@ class vs {
|
|
|
2254
2258
|
removeChunkedUpload(t, s = !1) {
|
|
2255
2259
|
const n = (r) => r ? r.state.status === _.complete && !s ? (console.error(
|
|
2256
2260
|
"Can't cancel complete transfers, pass true as a second argument in .removeChunkedUpload() to force removal."
|
|
2257
|
-
), !1) : (Object.keys(this.state.transfers).forEach((
|
|
2258
|
-
r === this.state.transfers[
|
|
2261
|
+
), !1) : (Object.keys(this.state.transfers).forEach((a) => {
|
|
2262
|
+
r === this.state.transfers[a] && delete this.state.transfers[a];
|
|
2259
2263
|
}), this.events.trigger(T.removed, this.state), r.cancel(), !0) : (console.error("Could not find a matching transfer to cancel."), !1);
|
|
2260
2264
|
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(
|
|
2261
2265
|
"Invalid object to remove - has to be either ChunkedUpload, File or transferId"
|
|
@@ -2334,12 +2338,12 @@ class vs {
|
|
|
2334
2338
|
get fileList() {
|
|
2335
2339
|
const t = [];
|
|
2336
2340
|
return this.transfers.forEach((s) => {
|
|
2337
|
-
const n = s.getStats(), { totalChunks: r, completedChunks:
|
|
2341
|
+
const n = s.getStats(), { totalChunks: r, completedChunks: a } = n, o = {
|
|
2338
2342
|
name: s.state.blob.name,
|
|
2339
2343
|
bytesDone: n.transferredBytes,
|
|
2340
2344
|
bytesTotal: s.state.blob.size,
|
|
2341
2345
|
totalChunks: r,
|
|
2342
|
-
completedChunks:
|
|
2346
|
+
completedChunks: a,
|
|
2343
2347
|
transfer: s
|
|
2344
2348
|
};
|
|
2345
2349
|
t.push(o);
|
|
@@ -2347,16 +2351,16 @@ class vs {
|
|
|
2347
2351
|
}
|
|
2348
2352
|
}
|
|
2349
2353
|
const Wt = (e, t, s = "") => {
|
|
2350
|
-
const n = (
|
|
2351
|
-
const c =
|
|
2352
|
-
return
|
|
2353
|
-
}, [r,
|
|
2354
|
-
return
|
|
2354
|
+
const n = (i) => {
|
|
2355
|
+
const c = i.startsWith("/") ? i.slice(1) : i, d = (c == null ? void 0 : c.search("/")) ?? -1;
|
|
2356
|
+
return d === -1 ? [c] : [c.slice(0, d), c.slice(d + 1)];
|
|
2357
|
+
}, [r, a] = n(t), o = [s, r].filter(Boolean).join("/");
|
|
2358
|
+
return a ? {
|
|
2355
2359
|
[r]: {
|
|
2356
2360
|
file: new File([e], r, { ...e, type: "folder" }),
|
|
2357
2361
|
path: o,
|
|
2358
2362
|
progress: { totalBytes: e.size ?? 0, transferredBytes: 0 },
|
|
2359
|
-
files: Wt(e,
|
|
2363
|
+
files: Wt(e, a, o)
|
|
2360
2364
|
}
|
|
2361
2365
|
} : {
|
|
2362
2366
|
[r]: {
|
|
@@ -2371,7 +2375,7 @@ export {
|
|
|
2371
2375
|
vs as ChunkedTransferManager,
|
|
2372
2376
|
ht as ChunkedUpload,
|
|
2373
2377
|
nt as ChunkedUploadEventBus,
|
|
2374
|
-
|
|
2378
|
+
B as DOCUMENT_TYPES,
|
|
2375
2379
|
T as EVENTS,
|
|
2376
2380
|
Ht as FIELD_ATTRIBUTE_KEYS,
|
|
2377
2381
|
Ss as FIELD_DEFINITION_TYPES,
|
|
@@ -2397,7 +2401,7 @@ export {
|
|
|
2397
2401
|
de as formatTimeCodeSeconds,
|
|
2398
2402
|
pe as formatTimeCodeSmpte,
|
|
2399
2403
|
U as formatTimeCodeText,
|
|
2400
|
-
|
|
2404
|
+
P as formatTimeCodeType,
|
|
2401
2405
|
bs as getPlayerSources,
|
|
2402
2406
|
As as getShapeDocumentType,
|
|
2403
2407
|
Os as getShapeMediaType,
|
|
@@ -2409,7 +2413,7 @@ export {
|
|
|
2409
2413
|
ps as parseFacetType,
|
|
2410
2414
|
ys as parseFieldDefinitionList,
|
|
2411
2415
|
Dt as parseFieldList,
|
|
2412
|
-
|
|
2416
|
+
Bt as parseFileType,
|
|
2413
2417
|
Mt as parseGroupList,
|
|
2414
2418
|
Y as parseHighlightTimespan,
|
|
2415
2419
|
_s as parseHighlightTimespanList,
|