@vidispine/vdt-js 23.3.0-pre.4 → 23.3.0-pre.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -0
- package/dist/index.js +513 -440
- package/dist/index.umd.cjs +3 -3
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { filesize as
|
|
2
|
-
const
|
|
1
|
+
import { filesize as y } from "filesize";
|
|
2
|
+
const ue = (e, t) => t ? ue(t, e % t) : e, H = (e) => {
|
|
3
3
|
const { width: t, height: r } = e || {};
|
|
4
4
|
if (t === void 0 || r === void 0)
|
|
5
5
|
return;
|
|
6
|
-
const n =
|
|
6
|
+
const n = ue(t, r);
|
|
7
7
|
let o = t / n, s = r / n;
|
|
8
8
|
return o > 21 && (s = 1, o = (t / r).toFixed(2)), [o, s].join(":");
|
|
9
|
-
}, b = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: r }) => [t, r])) || []),
|
|
9
|
+
}, b = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: r }) => [t, r])) || []), Ct = {
|
|
10
10
|
ACCESSCONTROL_READ: "_accesscontrol_read",
|
|
11
11
|
ACCESSCONTROL_WRITE: "_accesscontrol_write",
|
|
12
12
|
ADMINISTRATOR: "_administrator",
|
|
@@ -116,7 +116,7 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
116
116
|
USER: "_user",
|
|
117
117
|
VXA: "_vxa",
|
|
118
118
|
VXA_READ: "_vxa_read"
|
|
119
|
-
},
|
|
119
|
+
}, Lt = [
|
|
120
120
|
"stl_subtitle",
|
|
121
121
|
"stl_tti",
|
|
122
122
|
"stl_gsi",
|
|
@@ -128,7 +128,7 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
128
128
|
"facedetect_face",
|
|
129
129
|
"originalTrackFilename",
|
|
130
130
|
"stl_gsiHeader"
|
|
131
|
-
],
|
|
131
|
+
], Bt = [
|
|
132
132
|
"title",
|
|
133
133
|
"user",
|
|
134
134
|
"shapeTag",
|
|
@@ -267,62 +267,62 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
267
267
|
"jc",
|
|
268
268
|
"vp",
|
|
269
269
|
"sn"
|
|
270
|
-
],
|
|
270
|
+
], Y = [
|
|
271
271
|
"uuid",
|
|
272
272
|
"user",
|
|
273
273
|
"timestamp",
|
|
274
274
|
"change",
|
|
275
275
|
"conflict",
|
|
276
276
|
"mode"
|
|
277
|
-
],
|
|
277
|
+
], le = [
|
|
278
278
|
"name",
|
|
279
279
|
"id",
|
|
280
280
|
"referenced",
|
|
281
281
|
"data",
|
|
282
282
|
"inheritance"
|
|
283
|
-
],
|
|
284
|
-
...
|
|
283
|
+
], we = [
|
|
284
|
+
...Y,
|
|
285
285
|
"value",
|
|
286
286
|
"lang"
|
|
287
|
-
],
|
|
288
|
-
...
|
|
289
|
-
...
|
|
287
|
+
], Ce = [
|
|
288
|
+
...Y,
|
|
289
|
+
...le,
|
|
290
290
|
"value",
|
|
291
291
|
"reference",
|
|
292
292
|
"type",
|
|
293
293
|
"track"
|
|
294
|
-
],
|
|
295
|
-
...
|
|
296
|
-
...
|
|
294
|
+
], Le = [
|
|
295
|
+
...Y,
|
|
296
|
+
...le,
|
|
297
297
|
"cycle",
|
|
298
298
|
"field",
|
|
299
299
|
"group"
|
|
300
|
-
],
|
|
301
|
-
const t = (r) =>
|
|
302
|
-
return Array.isArray(e) ? e.every(
|
|
303
|
-
},
|
|
300
|
+
], k = (e) => Object.prototype.toString.call(e) === "[object Object]" && e.value !== void 0, _e = (e) => ["string", "boolean", "number"].includes(typeof e), me = (e) => k(e) && ((e == null ? void 0 : e.value) === null || k(e.value) || _e(e.value)), Be = (e) => Object.prototype.toString.call(e) === "[object Object]", pe = (e) => Object.prototype.toString.call(e) === "[object Date]", fe = (e) => e === null ? !0 : Array.isArray(e) ? e.some(fe) : _e(e) || me(e) || pe(e), Te = (e) => {
|
|
301
|
+
const t = (r) => Be(r) && r.value === void 0 && !!Object.entries(e);
|
|
302
|
+
return Array.isArray(e) ? e.every(Te) : t(e);
|
|
303
|
+
}, We = (e, t) => e + (t.length > 1 ? "s" : ""), Ee = (e, t) => {
|
|
304
304
|
const r = e.filter((n) => !t.includes(n));
|
|
305
305
|
if (r.length)
|
|
306
306
|
throw Error(
|
|
307
|
-
`Unsupported ${
|
|
307
|
+
`Unsupported ${We("key", r)} (${r.join(", ")})`
|
|
308
308
|
);
|
|
309
|
-
},
|
|
309
|
+
}, he = (e) => {
|
|
310
310
|
if (Array.isArray(e))
|
|
311
311
|
throw Error("Invalid value inside value object, cannot be array");
|
|
312
|
-
return [void 0, null].includes(e) ? {} :
|
|
312
|
+
return [void 0, null].includes(e) ? {} : pe(e) ? { value: e.toISOString() } : { value: e.toString() };
|
|
313
313
|
}, je = (e) => {
|
|
314
|
-
if (
|
|
314
|
+
if (Ee(Object.keys(e), we), Object.keys(e).length === 0)
|
|
315
315
|
throw Error("Invalid value object, cannot be empty object");
|
|
316
316
|
if (typeof (e == null ? void 0 : e.value) == "string")
|
|
317
317
|
return e;
|
|
318
|
-
const t =
|
|
318
|
+
const t = he(e == null ? void 0 : e.value);
|
|
319
319
|
return { ...e, ...t !== void 0 ? t : {} };
|
|
320
|
-
},
|
|
320
|
+
}, K = (e) => {
|
|
321
321
|
if (![void 0, null].includes(e))
|
|
322
|
-
return Array.isArray(e) ? e.flatMap(
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
const t =
|
|
322
|
+
return Array.isArray(e) ? e.flatMap(K) : k(e) ? je(e) : he(e);
|
|
323
|
+
}, xe = (e) => {
|
|
324
|
+
Ee(Object.keys(e), Ce);
|
|
325
|
+
const t = K(e == null ? void 0 : e.value);
|
|
326
326
|
if (t === void 0) {
|
|
327
327
|
const { value: r, ...n } = e;
|
|
328
328
|
return n;
|
|
@@ -331,27 +331,27 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
331
331
|
...e,
|
|
332
332
|
value: [...Array.isArray(t) ? t : [t]]
|
|
333
333
|
};
|
|
334
|
-
},
|
|
335
|
-
if (
|
|
336
|
-
return
|
|
337
|
-
const t =
|
|
334
|
+
}, Pe = (e) => {
|
|
335
|
+
if (me(e))
|
|
336
|
+
return xe(e);
|
|
337
|
+
const t = K(e);
|
|
338
338
|
if (t !== void 0)
|
|
339
339
|
return { value: [...Array.isArray(t) ? t : [t]] };
|
|
340
|
-
},
|
|
340
|
+
}, Ae = (e) => {
|
|
341
341
|
const t = [], r = [];
|
|
342
342
|
let n = {};
|
|
343
343
|
return Object.entries(e || {}).forEach(([o, s]) => {
|
|
344
|
-
if (
|
|
344
|
+
if (Le.includes(o))
|
|
345
345
|
n = { ...n, [o]: s };
|
|
346
|
-
else if (
|
|
346
|
+
else if (fe(s))
|
|
347
347
|
try {
|
|
348
|
-
r.push({ name: o, ...
|
|
348
|
+
r.push({ name: o, ...Pe(s) });
|
|
349
349
|
} catch (a) {
|
|
350
350
|
throw Error(a.message + (o ? ` for field "${o}"` : ""));
|
|
351
351
|
}
|
|
352
|
-
else if (
|
|
352
|
+
else if (Te(s))
|
|
353
353
|
(Array.isArray(s) ? s : [s]).forEach((a) => {
|
|
354
|
-
t.push({ name: o, ...
|
|
354
|
+
t.push({ name: o, ...Ae(a) });
|
|
355
355
|
});
|
|
356
356
|
else
|
|
357
357
|
throw Error(`Unhandled value for "${o}"`);
|
|
@@ -360,8 +360,8 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
360
360
|
...t.length > 0 ? { group: t } : {},
|
|
361
361
|
...r.length > 0 ? { field: r } : {}
|
|
362
362
|
};
|
|
363
|
-
},
|
|
364
|
-
const { start: t = "-INF", end: r = "+INF", base: n = void 0, ...o } = e, { group: s, field: a } =
|
|
363
|
+
}, Ue = (e) => {
|
|
364
|
+
const { start: t = "-INF", end: r = "+INF", base: n = void 0, ...o } = e, { group: s, field: a } = Ae(o);
|
|
365
365
|
return {
|
|
366
366
|
...s ? { group: s } : {},
|
|
367
367
|
...a ? { field: a } : {},
|
|
@@ -369,18 +369,18 @@ const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
|
369
369
|
end: r.toString(),
|
|
370
370
|
...n ? { base: n } : {}
|
|
371
371
|
};
|
|
372
|
-
},
|
|
373
|
-
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) =>
|
|
374
|
-
}),
|
|
372
|
+
}, Wt = (e) => ({
|
|
373
|
+
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) => Ue(t))
|
|
374
|
+
}), Ge = (e, t) => {
|
|
375
375
|
var o, s;
|
|
376
376
|
const [r] = ((o = e == null ? void 0 : e.start) == null ? void 0 : o.split("@")) || [], [n] = ((s = t == null ? void 0 : t.start) == null ? void 0 : s.split("@")) || [];
|
|
377
377
|
return Number(r) < Number(n) ? -1 : Number(r) > Number(n) ? 1 : 0;
|
|
378
|
-
}, g = (e) => Array.isArray(e) ? e : e && [e] || [],
|
|
378
|
+
}, g = (e) => Array.isArray(e) ? e : e && [e] || [], re = (e) => Array.isArray(e) ? e.pop() : e, $e = (e) => (e == null ? void 0 : e.every((t) => typeof t == "string")) || !1, Oe = {
|
|
379
379
|
includeValueAttributes: !1
|
|
380
380
|
};
|
|
381
|
-
function
|
|
381
|
+
function Ve(e, t) {
|
|
382
382
|
const { includeValueAttributes: r } = {
|
|
383
|
-
...
|
|
383
|
+
...Oe,
|
|
384
384
|
...t || {}
|
|
385
385
|
};
|
|
386
386
|
if (r === !1)
|
|
@@ -392,60 +392,60 @@ function Ge(e, t) {
|
|
|
392
392
|
)
|
|
393
393
|
) || {}, value: n };
|
|
394
394
|
}
|
|
395
|
-
const
|
|
396
|
-
...
|
|
395
|
+
const Ie = {
|
|
396
|
+
...Oe,
|
|
397
397
|
joinValue: void 0,
|
|
398
398
|
arrayOnSingleValue: !0
|
|
399
399
|
};
|
|
400
|
-
function
|
|
400
|
+
function ke(e, t) {
|
|
401
401
|
const { joinValue: r, arrayOnSingleValue: n, ...o } = {
|
|
402
|
-
...
|
|
402
|
+
...Ie,
|
|
403
403
|
...t || {}
|
|
404
|
-
}, s = e == null ? void 0 : e.map((a) =>
|
|
404
|
+
}, s = e == null ? void 0 : e.map((a) => Ve(a, o));
|
|
405
405
|
return $e(s) && r ? s == null ? void 0 : s.join(r) : n !== !0 && (s == null ? void 0 : s.length) <= 1 ? s == null ? void 0 : s[0] : s;
|
|
406
406
|
}
|
|
407
|
-
const
|
|
407
|
+
const Re = {
|
|
408
408
|
includeFieldAttributes: !1,
|
|
409
|
-
...
|
|
410
|
-
},
|
|
409
|
+
...Ie
|
|
410
|
+
}, He = (e, t) => {
|
|
411
411
|
const { includeFieldAttributes: r, ...n } = {
|
|
412
|
-
...
|
|
412
|
+
...Re,
|
|
413
413
|
...t || {}
|
|
414
|
-
}, { value: o, ...s } = e, a =
|
|
414
|
+
}, { value: o, ...s } = e, a = ke(o, n), i = r === !0 && s || Array.isArray(r) && Object.fromEntries(
|
|
415
415
|
Object.entries(s).filter(
|
|
416
416
|
([c]) => r.includes(c)
|
|
417
417
|
)
|
|
418
418
|
) || {};
|
|
419
419
|
return r ? { ...i, value: a } : a;
|
|
420
|
-
},
|
|
421
|
-
...
|
|
420
|
+
}, j = {
|
|
421
|
+
...Re,
|
|
422
422
|
fieldAsList: !1,
|
|
423
423
|
arrayOnSingleField: !1,
|
|
424
424
|
overrideField: void 0
|
|
425
|
-
},
|
|
425
|
+
}, Se = (e, t) => {
|
|
426
426
|
const r = {
|
|
427
|
-
...
|
|
427
|
+
...j,
|
|
428
428
|
...t || {}
|
|
429
429
|
}, { fieldAsList: n, arrayOnSingleField: o, overrideField: s } = r, a = s === !0 && n === !1, i = {};
|
|
430
430
|
return e == null || e.forEach((c) => {
|
|
431
|
-
const { name: l } = c,
|
|
432
|
-
|
|
431
|
+
const { name: l } = c, d = He(c, r), _ = o === !0 ? g(d) : d, p = i[l];
|
|
432
|
+
p ? a ? i[l] = d : i[l] = [g(p), g(d)].flat() : i[l] = _;
|
|
433
433
|
}), n === !0 ? Object.values(i).flat() : i;
|
|
434
|
-
},
|
|
435
|
-
...
|
|
434
|
+
}, ge = {
|
|
435
|
+
...j,
|
|
436
436
|
includeGroupAttributes: !1,
|
|
437
437
|
groupAsList: !1,
|
|
438
438
|
arrayOnSingleGroup: !1,
|
|
439
439
|
overrideGroup: void 0
|
|
440
|
-
},
|
|
440
|
+
}, Ye = (e, t) => {
|
|
441
441
|
const r = {
|
|
442
|
-
...
|
|
442
|
+
...ge,
|
|
443
443
|
...t || {}
|
|
444
444
|
}, { includeGroupAttributes: n } = r, o = Object.fromEntries(
|
|
445
445
|
Object.entries(r).filter(
|
|
446
|
-
([_]) => Object.keys(
|
|
446
|
+
([_]) => Object.keys(j).includes(_)
|
|
447
447
|
)
|
|
448
|
-
), { field: s, group: a, ...i } = e, c = s &&
|
|
448
|
+
), { field: s, group: a, ...i } = e, c = s && Se(s, o), l = a && be(a, r);
|
|
449
449
|
return {
|
|
450
450
|
...n === !0 && i || Array.isArray(n) && Object.fromEntries(
|
|
451
451
|
Object.entries(i).filter(
|
|
@@ -455,80 +455,80 @@ const Ae = {
|
|
|
455
455
|
...o != null && o.fieldAsList ? c && { field: c } || {} : c,
|
|
456
456
|
...r != null && r.groupAsList ? l && { group: l } || {} : l
|
|
457
457
|
};
|
|
458
|
-
},
|
|
459
|
-
const r = { ...
|
|
458
|
+
}, z = ge, be = (e, t) => {
|
|
459
|
+
const r = { ...z, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: o, overrideGroup: s } = r, a = s === !0 && n === !1, i = {};
|
|
460
460
|
return e == null || e.forEach((c) => {
|
|
461
|
-
const { name: l } = c,
|
|
462
|
-
|
|
463
|
-
g(
|
|
464
|
-
g(
|
|
461
|
+
const { name: l } = c, d = Ye(c, r), _ = o === !0 ? g(d) : d, p = i[l];
|
|
462
|
+
p ? a ? i[l] = d : i[l] = [
|
|
463
|
+
g(p),
|
|
464
|
+
g(d)
|
|
465
465
|
].flat() : i[l] = _;
|
|
466
466
|
}), n ? Object.values(i).flat() : i;
|
|
467
|
-
},
|
|
468
|
-
...
|
|
467
|
+
}, Ne = {
|
|
468
|
+
...z,
|
|
469
469
|
includeTimespanAttributes: !1,
|
|
470
470
|
flat: !1,
|
|
471
471
|
arrayOnSingle: !1,
|
|
472
472
|
arrayOnSingleValue: !0,
|
|
473
473
|
arrayOnSingleGroup: void 0,
|
|
474
474
|
arrayOnSingleField: void 0
|
|
475
|
-
},
|
|
475
|
+
}, Ke = (e, t) => {
|
|
476
476
|
const r = {
|
|
477
|
-
...
|
|
477
|
+
...Ne,
|
|
478
478
|
...t || {}
|
|
479
479
|
}, { includeTimespanAttributes: n, arrayOnSingle: o, flat: s } = r, a = Object.fromEntries(
|
|
480
|
-
Object.entries(t).map(([
|
|
481
|
-
if (Object.keys(
|
|
482
|
-
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(
|
|
483
|
-
}).filter((
|
|
480
|
+
Object.entries(t).map(([u, m]) => {
|
|
481
|
+
if (Object.keys(z).includes(u))
|
|
482
|
+
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideGroup", "overrideField"].includes(u) && (m !== void 0 ? m : s === !0) ? [u, !0] : [u, m];
|
|
483
|
+
}).filter((u) => !!u)
|
|
484
484
|
), i = Object.fromEntries(
|
|
485
|
-
Object.entries(t).map(([
|
|
486
|
-
if (Object.keys(
|
|
487
|
-
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(
|
|
488
|
-
}).filter((
|
|
489
|
-
), { field: c, group: l, ...
|
|
485
|
+
Object.entries(t).map(([u, m]) => {
|
|
486
|
+
if (Object.keys(j).includes(u))
|
|
487
|
+
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(u) && (m !== void 0 ? m : o === !0) ? [u, !0] : ["overrideField"].includes(u) && (m !== void 0 ? m : s === !0) ? [u, !0] : [u, m];
|
|
488
|
+
}).filter((u) => !!u)
|
|
489
|
+
), { field: c, group: l, ...d } = e || {}, _ = c && Se(c, i), p = l && be(l, a);
|
|
490
490
|
return {
|
|
491
|
-
...n === !0 &&
|
|
492
|
-
Object.entries(
|
|
493
|
-
([
|
|
491
|
+
...n === !0 && d || Array.isArray(n) && Object.fromEntries(
|
|
492
|
+
Object.entries(d).filter(
|
|
493
|
+
([u]) => n.includes(u)
|
|
494
494
|
)
|
|
495
495
|
) || {},
|
|
496
496
|
...i != null && i.fieldAsList ? { field: _ } : _,
|
|
497
|
-
...a != null && a.groupAsList ? { group:
|
|
497
|
+
...a != null && a.groupAsList ? { group: p } : p
|
|
498
498
|
};
|
|
499
|
-
},
|
|
500
|
-
...
|
|
499
|
+
}, J = {
|
|
500
|
+
...Ne,
|
|
501
501
|
timespanAsList: !1,
|
|
502
502
|
joinTimespan: "_",
|
|
503
503
|
sortTimespan: !1,
|
|
504
504
|
flat: !1,
|
|
505
505
|
flatTimespan: void 0
|
|
506
|
-
},
|
|
506
|
+
}, ye = (e, t) => {
|
|
507
507
|
const r = {
|
|
508
|
-
...
|
|
508
|
+
...J,
|
|
509
509
|
...t || {}
|
|
510
510
|
}, { timespanAsList: n, joinTimespan: o, sortTimespan: s, flat: a, flatTimespan: i, ...c } = r, l = { flat: a, ...c };
|
|
511
|
-
s && e.sort(
|
|
512
|
-
const
|
|
513
|
-
return e == null || e.forEach((
|
|
514
|
-
const { start:
|
|
515
|
-
E ?
|
|
516
|
-
}), n === !0 ? Object.values(_) :
|
|
517
|
-
},
|
|
518
|
-
...
|
|
511
|
+
s && e.sort(Ge);
|
|
512
|
+
const d = (i !== void 0 ? i === !0 : a === !0) && n === !1, _ = {};
|
|
513
|
+
return e == null || e.forEach((p) => {
|
|
514
|
+
const { start: f, end: u } = p, m = d ? "flat" : [f, u].join(o), T = Ke(p, l), E = _[m];
|
|
515
|
+
E ? d ? f === "-INF" && u === "+INF" ? _[m] = { ...re(E), ...T } : _[m] = { ...T, ...re(E) } : _[m] = [...g(E), T] : _[m] = T;
|
|
516
|
+
}), n === !0 ? Object.values(_) : d ? Object.values(_).pop() : _;
|
|
517
|
+
}, ze = {
|
|
518
|
+
...J,
|
|
519
519
|
includeMetadataAttributes: !1,
|
|
520
520
|
flat: !1
|
|
521
521
|
};
|
|
522
|
-
function
|
|
522
|
+
function jt(e, t) {
|
|
523
523
|
const r = {
|
|
524
|
-
...
|
|
524
|
+
...ze,
|
|
525
525
|
...t || {}
|
|
526
526
|
}, { includeMetadataAttributes: n, flat: o } = r, { timespan: s = [], ...a } = e || {}, i = Object.fromEntries(
|
|
527
|
-
Object.entries(t).map(([
|
|
528
|
-
if (Object.keys(
|
|
529
|
-
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(
|
|
530
|
-
}).filter((
|
|
531
|
-
), c =
|
|
527
|
+
Object.entries(t).map(([d, _]) => {
|
|
528
|
+
if (Object.keys(J).includes(d))
|
|
529
|
+
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(d) && (_ !== void 0 ? _ : o === !0) ? [d, !0] : [d, _];
|
|
530
|
+
}).filter((d) => !!d)
|
|
531
|
+
), c = ye(
|
|
532
532
|
s,
|
|
533
533
|
i
|
|
534
534
|
);
|
|
@@ -537,21 +537,21 @@ function Lt(e, t) {
|
|
|
537
537
|
...a,
|
|
538
538
|
...a.revision ? { revision: a.revision.split(",") } : {}
|
|
539
539
|
} || Array.isArray(n) && Object.fromEntries(
|
|
540
|
-
Object.entries(a).map(([
|
|
541
|
-
if (n.includes(
|
|
540
|
+
Object.entries(a).map(([d, _]) => {
|
|
541
|
+
if (n.includes(d))
|
|
542
542
|
return [
|
|
543
|
-
|
|
544
|
-
|
|
543
|
+
d,
|
|
544
|
+
d === "revision" && typeof _ == "string" ? _.split(",") : _
|
|
545
545
|
];
|
|
546
|
-
}).filter((
|
|
546
|
+
}).filter((d) => !!d)
|
|
547
547
|
) || {},
|
|
548
548
|
...i != null && i.timespanAsList ? { timespan: c } : c
|
|
549
549
|
};
|
|
550
550
|
}
|
|
551
|
-
const
|
|
551
|
+
const xt = (e) => {
|
|
552
552
|
const { field: t = [] } = e || {};
|
|
553
553
|
return b(t);
|
|
554
|
-
},
|
|
554
|
+
}, X = {
|
|
555
555
|
PAL: { denominator: 25, numerator: 1 },
|
|
556
556
|
NTSC: { denominator: 3e4, numerator: 1001 },
|
|
557
557
|
NTSC30: { denominator: 30, numerator: 1 },
|
|
@@ -559,7 +559,7 @@ const Bt = (e) => {
|
|
|
559
559
|
59.94: { denominator: 6e4, numerator: 1001 },
|
|
560
560
|
23.976: { denominator: 48e3, numerator: 2002 },
|
|
561
561
|
23.98: { denominator: 48e3, numerator: 2002 }
|
|
562
|
-
},
|
|
562
|
+
}, oe = Object.keys(X), ne = {
|
|
563
563
|
toText: {
|
|
564
564
|
constant: !1,
|
|
565
565
|
fraction: !1
|
|
@@ -569,7 +569,7 @@ const Bt = (e) => {
|
|
|
569
569
|
rounded: !1
|
|
570
570
|
}
|
|
571
571
|
};
|
|
572
|
-
class
|
|
572
|
+
class I {
|
|
573
573
|
/**
|
|
574
574
|
* Constructor for TimeBase
|
|
575
575
|
*
|
|
@@ -586,7 +586,7 @@ class h {
|
|
|
586
586
|
*/
|
|
587
587
|
toConstant() {
|
|
588
588
|
let t;
|
|
589
|
-
return Object.entries(
|
|
589
|
+
return Object.entries(X).find((r) => {
|
|
590
590
|
const [n, o] = r, { numerator: s, denominator: a } = o;
|
|
591
591
|
return s === this.numerator && a === this.denominator ? (t = n, !0) : !1;
|
|
592
592
|
}), t;
|
|
@@ -603,7 +603,7 @@ class h {
|
|
|
603
603
|
* @returns Text representation of the TimeBase
|
|
604
604
|
*/
|
|
605
605
|
toText(t) {
|
|
606
|
-
const { constant: r, fraction: n } = { ...
|
|
606
|
+
const { constant: r, fraction: n } = { ...ne.toText, ...t };
|
|
607
607
|
if (r) {
|
|
608
608
|
const s = this.toConstant();
|
|
609
609
|
if (s)
|
|
@@ -627,7 +627,7 @@ class h {
|
|
|
627
627
|
const r = this.denominator / this.numerator;
|
|
628
628
|
if (Number.isInteger(r))
|
|
629
629
|
return r;
|
|
630
|
-
const { rounded: n, fixed: o } = { ...
|
|
630
|
+
const { rounded: n, fixed: o } = { ...ne.toRate, ...t || {} };
|
|
631
631
|
return n ? Math.round(r) : o === !0 || typeof o == "number" ? Number(r.toFixed(typeof o == "boolean" ? 2 : o)) : r;
|
|
632
632
|
}
|
|
633
633
|
/**
|
|
@@ -650,39 +650,39 @@ class h {
|
|
|
650
650
|
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
const
|
|
653
|
+
const q = (e) => {
|
|
654
654
|
if (e === void 0)
|
|
655
|
-
return new
|
|
655
|
+
return new I();
|
|
656
656
|
if (typeof e == "number")
|
|
657
|
-
return new
|
|
657
|
+
return new I({ denominator: e });
|
|
658
658
|
if (typeof e == "string" && e.includes(":")) {
|
|
659
659
|
const [t, r] = e.split(":");
|
|
660
|
-
return new
|
|
660
|
+
return new I({ denominator: t, numerator: r });
|
|
661
661
|
}
|
|
662
|
-
if (
|
|
663
|
-
return new
|
|
662
|
+
if (oe.includes(e))
|
|
663
|
+
return new I(X[e]);
|
|
664
664
|
if (!["string", "number"].includes(typeof e) || Number.isNaN(Number(e)))
|
|
665
665
|
throw new Error(
|
|
666
|
-
`timeBaseText must be a number or ${
|
|
666
|
+
`timeBaseText must be a number or ${oe.join(",")} - is ${JSON.stringify(
|
|
667
667
|
e
|
|
668
668
|
)}`
|
|
669
669
|
);
|
|
670
|
-
return new
|
|
671
|
-
},
|
|
670
|
+
return new I({ denominator: Number(e) });
|
|
671
|
+
}, M = (e) => new I(e), v = (e) => e instanceof I ? e : typeof e == "string" || typeof e == "number" ? q(e) : M(e), Q = (e) => {
|
|
672
672
|
const t = e.toConstant();
|
|
673
673
|
return t === "59.94" && 4 || ["NTSC", "29.97"].includes(t) && 2 || void 0;
|
|
674
|
-
},
|
|
675
|
-
const { samples: t, timeBase: r } = e, n =
|
|
674
|
+
}, Fe = (e) => Q(e) > 0, se = (e) => {
|
|
675
|
+
const { samples: t, timeBase: r } = e, n = Q(r);
|
|
676
676
|
if (!n)
|
|
677
677
|
return 0;
|
|
678
678
|
const o = r.toRate({ rounded: !0 }), s = 60 * o, a = 60 * o - n, i = 10 * (s - n) + n, c = Math.floor((t + 1) / i), l = Math.max(
|
|
679
679
|
0,
|
|
680
680
|
(t + 1) % i - s
|
|
681
|
-
),
|
|
681
|
+
), d = Math.floor(
|
|
682
682
|
l / a
|
|
683
|
-
),
|
|
684
|
-
return c * 9 * n +
|
|
685
|
-
},
|
|
683
|
+
), p = l % a > 0 ? n : 0;
|
|
684
|
+
return c * 9 * n + d * n + p;
|
|
685
|
+
}, G = {
|
|
686
686
|
conformTimeBase: {
|
|
687
687
|
dropFrame: void 0,
|
|
688
688
|
frameSeparator: void 0
|
|
@@ -696,7 +696,7 @@ const H = (e) => {
|
|
|
696
696
|
format: void 0
|
|
697
697
|
}
|
|
698
698
|
};
|
|
699
|
-
class
|
|
699
|
+
class S {
|
|
700
700
|
/**
|
|
701
701
|
* Constructor for TimeCode
|
|
702
702
|
*
|
|
@@ -704,7 +704,7 @@ class R {
|
|
|
704
704
|
* @param options Options for the timeCode
|
|
705
705
|
*/
|
|
706
706
|
constructor(t, r) {
|
|
707
|
-
this.samples = 0, this.timeBase = new
|
|
707
|
+
this.samples = 0, this.timeBase = new I();
|
|
708
708
|
const { samples: n, timeBase: o } = t || {};
|
|
709
709
|
if (n !== void 0)
|
|
710
710
|
if (typeof n == "number")
|
|
@@ -713,7 +713,7 @@ class R {
|
|
|
713
713
|
n === "-INF" ? this.samples = -1 / 0 : n === "+INF" ? this.samples = 1 / 0 : this.samples = Number(n);
|
|
714
714
|
else
|
|
715
715
|
throw new Error(`samples is not number/string/-Inf/+Inf is: ${n}`);
|
|
716
|
-
o !== void 0 && (o instanceof
|
|
716
|
+
o !== void 0 && (o instanceof I ? this.timeBase = o : this.timeBase = v(o)), this.dropFrame = (r == null ? void 0 : r.dropFrame) ?? Fe(this.timeBase), this.frameSeparator = (r == null ? void 0 : r.frameSeparator) ?? (this.dropFrame ? ";" : ":");
|
|
717
717
|
}
|
|
718
718
|
/**
|
|
719
719
|
* Return this TimeCode added with the supplied timeCodeType
|
|
@@ -737,7 +737,7 @@ class R {
|
|
|
737
737
|
let o = t;
|
|
738
738
|
(r !== this.timeBase.numerator || n !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
739
739
|
const { samples: s } = o;
|
|
740
|
-
return new
|
|
740
|
+
return new S({ samples: this.samples + s, timeBase: this.timeBase });
|
|
741
741
|
}
|
|
742
742
|
/**
|
|
743
743
|
* Return this TimeCode subtracted with the supplied timeCodeType
|
|
@@ -761,7 +761,7 @@ class R {
|
|
|
761
761
|
let o = t;
|
|
762
762
|
(r !== this.timeBase.numerator || n !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
763
763
|
const { samples: s } = o;
|
|
764
|
-
return new
|
|
764
|
+
return new S({ samples: this.samples - s, timeBase: this.timeBase });
|
|
765
765
|
}
|
|
766
766
|
/**
|
|
767
767
|
* Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
|
|
@@ -775,10 +775,10 @@ class R {
|
|
|
775
775
|
* @returns A new TimeCode instance with the conformTo timeBase applied
|
|
776
776
|
*/
|
|
777
777
|
conformTimeBase(t, r) {
|
|
778
|
-
const n = t instanceof
|
|
778
|
+
const n = t instanceof I ? t : v(t), o = Math.floor(
|
|
779
779
|
this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
|
|
780
|
-
), s = { ...
|
|
781
|
-
return new
|
|
780
|
+
), s = { ...G.conformTimeBase, ...r || {} };
|
|
781
|
+
return new S(
|
|
782
782
|
{
|
|
783
783
|
samples: o,
|
|
784
784
|
timeBase: n
|
|
@@ -799,7 +799,7 @@ class R {
|
|
|
799
799
|
*/
|
|
800
800
|
toText(t) {
|
|
801
801
|
let r = `${this.samples}`;
|
|
802
|
-
const n = { ...
|
|
802
|
+
const n = { ...G.toText, ...t || {} }, o = this.timeBase.toText(n);
|
|
803
803
|
return (t != null && t.includeTimeBaseForSeconds || !["1", "1:1"].includes(o)) && (r = [this.samples, o].join("@")), r;
|
|
804
804
|
}
|
|
805
805
|
/**
|
|
@@ -818,7 +818,7 @@ class R {
|
|
|
818
818
|
seconds: 1 / 0,
|
|
819
819
|
frames: 1 / 0
|
|
820
820
|
};
|
|
821
|
-
const t = this.samples + (this.dropFrame ?
|
|
821
|
+
const t = this.samples + (this.dropFrame ? se(this) : 0);
|
|
822
822
|
let r = this.timeBase.toRate({ rounded: !0 });
|
|
823
823
|
["23.976", "23.98"].includes(this.timeBase.toConstant()) && (r = this.timeBase.toRate({ fixed: !0 }));
|
|
824
824
|
const n = Math.floor(t / (3600 * r)), o = Math.floor(t / (60 * r)) % 60, s = Math.floor(t / r) % 60, a = Math.floor(t % r);
|
|
@@ -837,7 +837,7 @@ class R {
|
|
|
837
837
|
* @returns Time for the time code
|
|
838
838
|
*/
|
|
839
839
|
toTime() {
|
|
840
|
-
const t = this.samples +
|
|
840
|
+
const t = this.samples + se(this), { hours: r, minutes: n, seconds: o } = this.toUnits(), s = this.timeBase.toRate({ rounded: !0 }), a = t % s, i = Math.floor(1e3 * a / s), c = a / s;
|
|
841
841
|
return {
|
|
842
842
|
hours: r,
|
|
843
843
|
minutes: n,
|
|
@@ -875,53 +875,53 @@ class R {
|
|
|
875
875
|
* @returns Duration representation of the TimeCode
|
|
876
876
|
*/
|
|
877
877
|
toDuration(t) {
|
|
878
|
-
const { format: r } = { ...
|
|
878
|
+
const { format: r } = { ...G.toDuration, ...t || {} }, { hours: n, ...o } = this.toTime();
|
|
879
879
|
let { minutes: s, seconds: a, milliseconds: i } = o;
|
|
880
880
|
if (r && typeof r != "string")
|
|
881
881
|
throw Error("format has to be a string");
|
|
882
|
-
const c = (
|
|
882
|
+
const c = (p, f) => !r.includes(p) || !f.some((u) => r.includes(u) && r.lastIndexOf(p) > r.indexOf(u));
|
|
883
883
|
if (r && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
|
|
884
884
|
throw Error("format order is unsupported (has to be h, m, s then S)");
|
|
885
885
|
if (!r)
|
|
886
886
|
return `${n > 0 ? `${n}:${`${s}`.padStart(2, "0")}` : s}:${`${a}`.padStart(2, "0")}`;
|
|
887
|
-
const l = (
|
|
888
|
-
let
|
|
889
|
-
for (;
|
|
890
|
-
|
|
891
|
-
return
|
|
892
|
-
},
|
|
893
|
-
return [...r].forEach((
|
|
894
|
-
switch (
|
|
887
|
+
const l = (p, f) => {
|
|
888
|
+
let u = p;
|
|
889
|
+
for (; f[u] === f[u + 1]; )
|
|
890
|
+
u += 1;
|
|
891
|
+
return u - p + 1;
|
|
892
|
+
}, d = ["h", "m", "s", "S"], _ = [];
|
|
893
|
+
return [...r].forEach((p, f, u) => {
|
|
894
|
+
switch (p) {
|
|
895
895
|
case "h": {
|
|
896
|
-
if (
|
|
896
|
+
if (u[f - 1] === "h")
|
|
897
897
|
break;
|
|
898
|
-
const m = l(
|
|
899
|
-
_.push(`${n}`.padStart(m, "0")),
|
|
898
|
+
const m = l(f, u);
|
|
899
|
+
_.push(`${n}`.padStart(m, "0")), d.includes(u[f + m]) && _.push(":");
|
|
900
900
|
break;
|
|
901
901
|
}
|
|
902
902
|
case "m": {
|
|
903
|
-
if (
|
|
903
|
+
if (u[f - 1] === "m")
|
|
904
904
|
break;
|
|
905
|
-
const m = l(
|
|
906
|
-
r.includes("h") || (s += n * 60), _.push(`${s}`.padStart(m, "0")),
|
|
905
|
+
const m = l(f, u);
|
|
906
|
+
r.includes("h") || (s += n * 60), _.push(`${s}`.padStart(m, "0")), d.includes(u[f + m]) && _.push(":");
|
|
907
907
|
break;
|
|
908
908
|
}
|
|
909
909
|
case "s": {
|
|
910
|
-
if (
|
|
910
|
+
if (u[f - 1] === "s")
|
|
911
911
|
break;
|
|
912
|
-
const m = l(
|
|
913
|
-
r.includes("m") || (a += s * 60), _.push(`${a}`.padStart(m, "0")),
|
|
912
|
+
const m = l(f, u);
|
|
913
|
+
r.includes("m") || (a += s * 60), _.push(`${a}`.padStart(m, "0")), d.includes(u[f + m]) && _.push(".");
|
|
914
914
|
break;
|
|
915
915
|
}
|
|
916
916
|
case "S": {
|
|
917
|
-
if (
|
|
917
|
+
if (u[f - 1] === "S")
|
|
918
918
|
break;
|
|
919
|
-
const m = l(
|
|
919
|
+
const m = l(f, u);
|
|
920
920
|
r.includes("s") || (i += a * 1e3), _.push(`${Math.round(i / 10 ** (3 - m))}`.padStart(m, "0"));
|
|
921
921
|
break;
|
|
922
922
|
}
|
|
923
923
|
default:
|
|
924
|
-
_.push(
|
|
924
|
+
_.push(p);
|
|
925
925
|
}
|
|
926
926
|
}), _.join("");
|
|
927
927
|
}
|
|
@@ -960,12 +960,12 @@ class R {
|
|
|
960
960
|
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
-
const
|
|
963
|
+
const Je = (e, t) => {
|
|
964
964
|
let r = Math.abs(e), n = Math.abs(t);
|
|
965
965
|
for (; r && n && r !== n; )
|
|
966
966
|
r > n ? [r, n] = [r - n, n] : [r, n] = [r, n - r];
|
|
967
967
|
return r || n;
|
|
968
|
-
},
|
|
968
|
+
}, Xe = (e, t) => {
|
|
969
969
|
const { timeBase: r, useGCD: n = !1, ...o } = t || {}, s = `${e}`.replace(/,/g, ".");
|
|
970
970
|
if (Number.isNaN(+s))
|
|
971
971
|
throw new Error(`seconds must be digits, is ${e}`);
|
|
@@ -973,33 +973,33 @@ const ze = (e, t) => {
|
|
|
973
973
|
if (Number.isInteger(+s))
|
|
974
974
|
i = +s * a;
|
|
975
975
|
else {
|
|
976
|
-
const [, l] = s.split("."),
|
|
977
|
-
a *= 10 **
|
|
976
|
+
const [, l] = s.split("."), d = Math.min((l == null ? void 0 : l.length) ?? 0, 16);
|
|
977
|
+
a *= 10 ** d, i = Math.round(Number(s) * a);
|
|
978
978
|
}
|
|
979
979
|
if (r === void 0 && n) {
|
|
980
|
-
const l =
|
|
980
|
+
const l = Je(a, i);
|
|
981
981
|
i /= l, a /= l;
|
|
982
982
|
}
|
|
983
|
-
const c = new
|
|
983
|
+
const c = new S(
|
|
984
984
|
{ samples: i, timeBase: { denominator: a, numerator: 1 } },
|
|
985
985
|
o
|
|
986
986
|
);
|
|
987
|
-
return r !== void 0 ? c.conformTimeBase(
|
|
988
|
-
},
|
|
989
|
-
const a = s.toRate({ rounded: !0 }), i =
|
|
987
|
+
return r !== void 0 ? c.conformTimeBase(v(r), o) : c;
|
|
988
|
+
}, qe = ([e, t, r, n], o, s) => {
|
|
989
|
+
const a = s.toRate({ rounded: !0 }), i = Q(s);
|
|
990
990
|
if (o === 0 || !i)
|
|
991
991
|
return 0;
|
|
992
|
-
const c = t % 10 !== 0, l = c && r === 0,
|
|
992
|
+
const c = t % 10 !== 0, l = c && r === 0, d = e * (3600 * a - 54 * i), _ = t * 60 * a - (t - Math.ceil(t / 10)) * i, p = r * a - (c && r > 1 ? i : 0);
|
|
993
993
|
if (l && n < i)
|
|
994
994
|
throw new Error(
|
|
995
995
|
`Frame does not exist for ${s.toConstant() || s.toRate()} drop-frame`
|
|
996
996
|
);
|
|
997
|
-
const
|
|
998
|
-
return o -
|
|
999
|
-
},
|
|
997
|
+
const f = l ? n - i : n, u = d + _ + p + f;
|
|
998
|
+
return o - u;
|
|
999
|
+
}, $ = (e, t, r) => {
|
|
1000
1000
|
const [n, o, s, a] = e, i = t.toRate({ rounded: !0 }), c = n * 3600 * i + o * 60 * i + s * i + a;
|
|
1001
|
-
return c - (r ?
|
|
1002
|
-
},
|
|
1001
|
+
return c - (r ? qe(e, c, t) : 0);
|
|
1002
|
+
}, Qe = (e) => {
|
|
1003
1003
|
const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
|
|
1004
1004
|
let r = [];
|
|
1005
1005
|
if (t) {
|
|
@@ -1016,47 +1016,47 @@ const ze = (e, t) => {
|
|
|
1016
1016
|
smpteValues: r.map(Number),
|
|
1017
1017
|
smpteFrameSeparator: n
|
|
1018
1018
|
};
|
|
1019
|
-
},
|
|
1019
|
+
}, Ze = ["error", "add", "ignore"], et = {
|
|
1020
1020
|
exceedingMode: "error",
|
|
1021
1021
|
timeBase: void 0,
|
|
1022
1022
|
dropFrame: void 0,
|
|
1023
1023
|
frameSeparator: void 0
|
|
1024
|
-
},
|
|
1025
|
-
const { exceedingMode: r, timeBase: n, ...o } = { ...
|
|
1024
|
+
}, tt = (e, t) => {
|
|
1025
|
+
const { exceedingMode: r, timeBase: n, ...o } = { ...et, ...t };
|
|
1026
1026
|
if ([null, void 0].includes(e))
|
|
1027
1027
|
throw new Error("smpte cannot be undefined or null");
|
|
1028
1028
|
if (typeof e != "string")
|
|
1029
1029
|
throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
|
|
1030
|
-
const { smpteValues: s, smpteFrameSeparator: a } =
|
|
1030
|
+
const { smpteValues: s, smpteFrameSeparator: a } = Qe(e), i = v(n), c = {
|
|
1031
1031
|
...o,
|
|
1032
1032
|
frameSeparator: (o == null ? void 0 : o.frameSeparator) || a,
|
|
1033
1033
|
...(o == null ? void 0 : o.dropFrame) === void 0 ? {
|
|
1034
|
-
dropFrame: n !== void 0 ?
|
|
1034
|
+
dropFrame: n !== void 0 ? Fe(i) : [";", ","].includes(a)
|
|
1035
1035
|
} : {}
|
|
1036
|
-
}, l = i.toRate({ rounded: !0 }),
|
|
1037
|
-
if (s.some((
|
|
1036
|
+
}, l = i.toRate({ rounded: !0 }), d = Math.max(0, l - 1);
|
|
1037
|
+
if (s.some((p) => p < 0))
|
|
1038
1038
|
throw new Error("Negative values are not supported");
|
|
1039
1039
|
let _;
|
|
1040
1040
|
switch (r) {
|
|
1041
1041
|
case "error": {
|
|
1042
|
-
const [
|
|
1043
|
-
if (
|
|
1042
|
+
const [p, f, u, m] = s;
|
|
1043
|
+
if (p >= 100 || f >= 60)
|
|
1044
1044
|
throw Error("Minutes has to be less than 60");
|
|
1045
|
-
if (
|
|
1045
|
+
if (u >= 60)
|
|
1046
1046
|
throw Error("Seconds has to be less than 60");
|
|
1047
|
-
if (m >
|
|
1048
|
-
throw Error(`Frames has to be less or equal to ${
|
|
1049
|
-
_ =
|
|
1047
|
+
if (m > d)
|
|
1048
|
+
throw Error(`Frames has to be less or equal to ${d}`);
|
|
1049
|
+
_ = $(s, i, c == null ? void 0 : c.dropFrame);
|
|
1050
1050
|
break;
|
|
1051
1051
|
}
|
|
1052
1052
|
case "ignore": {
|
|
1053
|
-
const [
|
|
1054
|
-
Math.min(100,
|
|
1055
|
-
Math.min(59,
|
|
1056
|
-
Math.min(59,
|
|
1057
|
-
Math.min(
|
|
1053
|
+
const [p, f, u, m] = s, T = [
|
|
1054
|
+
Math.min(100, p),
|
|
1055
|
+
Math.min(59, f),
|
|
1056
|
+
Math.min(59, u),
|
|
1057
|
+
Math.min(d, m)
|
|
1058
1058
|
];
|
|
1059
|
-
_ =
|
|
1059
|
+
_ = $(
|
|
1060
1060
|
T,
|
|
1061
1061
|
i,
|
|
1062
1062
|
c == null ? void 0 : c.dropFrame
|
|
@@ -1064,19 +1064,19 @@ const ze = (e, t) => {
|
|
|
1064
1064
|
break;
|
|
1065
1065
|
}
|
|
1066
1066
|
case "add": {
|
|
1067
|
-
_ =
|
|
1067
|
+
_ = $(s, i, c == null ? void 0 : c.dropFrame);
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
1070
|
default:
|
|
1071
|
-
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(
|
|
1071
|
+
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(Ze)}`);
|
|
1072
1072
|
}
|
|
1073
|
-
return new
|
|
1074
|
-
},
|
|
1073
|
+
return new S({ samples: _, timeBase: i }, c);
|
|
1074
|
+
}, rt = {
|
|
1075
1075
|
timeBase: void 0,
|
|
1076
1076
|
dropFrame: void 0,
|
|
1077
1077
|
frameSeparator: void 0
|
|
1078
|
-
},
|
|
1079
|
-
const { timeBase: r, ...n } = { ...
|
|
1078
|
+
}, B = (e, t) => {
|
|
1079
|
+
const { timeBase: r, ...n } = { ...rt, ...t };
|
|
1080
1080
|
let o;
|
|
1081
1081
|
if (e === void 0)
|
|
1082
1082
|
o = { samples: 0 };
|
|
@@ -1084,41 +1084,41 @@ const ze = (e, t) => {
|
|
|
1084
1084
|
o = { samples: e };
|
|
1085
1085
|
else if (e.includes("@")) {
|
|
1086
1086
|
const [a, i] = e.split("@");
|
|
1087
|
-
o = { samples: Number(a), timeBase:
|
|
1087
|
+
o = { samples: Number(a), timeBase: q(i) };
|
|
1088
1088
|
} else
|
|
1089
1089
|
e === "-INF" ? o = { samples: -1 / 0 } : e === "+INF" ? o = { samples: 1 / 0 } : o = { samples: Number(e) };
|
|
1090
|
-
if (Number.isNaN(o == null ? void 0 : o.samples) || o.timeBase && !(o.timeBase instanceof
|
|
1090
|
+
if (Number.isNaN(o == null ? void 0 : o.samples) || o.timeBase && !(o.timeBase instanceof I))
|
|
1091
1091
|
throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
|
|
1092
|
-
const s = new
|
|
1093
|
-
return r ? s.conformTimeBase(
|
|
1094
|
-
},
|
|
1092
|
+
const s = new S(o, n);
|
|
1093
|
+
return r ? s.conformTimeBase(v(r), n) : s;
|
|
1094
|
+
}, ot = {
|
|
1095
1095
|
dropFrame: void 0,
|
|
1096
1096
|
frameSeparator: void 0
|
|
1097
|
-
},
|
|
1098
|
-
if (e instanceof
|
|
1097
|
+
}, D = (e, t) => new S(e, { ...ot, ...t }), nt = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), st = (e) => !Number.isNaN(Number(e)), W = (e, t) => {
|
|
1098
|
+
if (e instanceof S)
|
|
1099
1099
|
return e;
|
|
1100
1100
|
if (typeof e != "string" && typeof e != "number")
|
|
1101
|
-
return
|
|
1102
|
-
if (typeof e == "string" &&
|
|
1103
|
-
return
|
|
1104
|
-
if (["string", "number"].includes(typeof e) &&
|
|
1105
|
-
return
|
|
1101
|
+
return D(e, t);
|
|
1102
|
+
if (typeof e == "string" && nt(e))
|
|
1103
|
+
return tt(e, t);
|
|
1104
|
+
if (["string", "number"].includes(typeof e) && st(e))
|
|
1105
|
+
return Xe(e, t);
|
|
1106
1106
|
if (typeof e == "string")
|
|
1107
|
-
return
|
|
1107
|
+
return B(e, t);
|
|
1108
1108
|
};
|
|
1109
|
-
function
|
|
1109
|
+
function ie({ hours: e = 0, minutes: t = 0, seconds: r = 0, partialSeconds: n = 0 }) {
|
|
1110
1110
|
const o = e.toFixed().padStart(2, "0"), s = t.toFixed().padStart(2, "0"), a = r.toFixed().padStart(2, "0"), i = (n * 10).toFixed().padStart(3, "0");
|
|
1111
1111
|
return `${o}:${s}:${a}.${i}`;
|
|
1112
1112
|
}
|
|
1113
1113
|
const it = {
|
|
1114
1114
|
subtitleGroup: "stl_subtitle",
|
|
1115
1115
|
subtitleField: "stl_text"
|
|
1116
|
-
},
|
|
1116
|
+
}, Pt = (e, t) => {
|
|
1117
1117
|
const { subtitleGroup: r, subtitleField: n } = { ...it, ...t || {} }, { timespan: o = [] } = e || {};
|
|
1118
1118
|
return o.length === 0 ? "" : `WEBVTT
|
|
1119
1119
|
|
|
1120
1120
|
|
|
1121
|
-
${
|
|
1121
|
+
${ye(o, {
|
|
1122
1122
|
includeTimespanAttributes: !0,
|
|
1123
1123
|
sortTimespan: !0,
|
|
1124
1124
|
timespanAsList: !0,
|
|
@@ -1128,15 +1128,15 @@ ${ge(o, {
|
|
|
1128
1128
|
const {
|
|
1129
1129
|
start: c,
|
|
1130
1130
|
end: l,
|
|
1131
|
-
[r]: { [n]:
|
|
1131
|
+
[r]: { [n]: d } = {}
|
|
1132
1132
|
} = (Array.isArray(i) ? i[0] : i) || {};
|
|
1133
|
-
if (!
|
|
1133
|
+
if (!d)
|
|
1134
1134
|
return "";
|
|
1135
|
-
const _ =
|
|
1136
|
-
return `${_} --> ${
|
|
1135
|
+
const _ = ie(B(c).toTime()), p = ie(B(l).toTime());
|
|
1136
|
+
return `${_} --> ${p} line:0%\r${d}\r`;
|
|
1137
1137
|
}).join(`
|
|
1138
1138
|
`)}`;
|
|
1139
|
-
}, at = { count: !0, exclude: !0 },
|
|
1139
|
+
}, at = { count: !0, exclude: !0 }, Ut = (e = [], t = {}) => {
|
|
1140
1140
|
const r = { ...at, ...t }, { count: n, exclude: o } = r;
|
|
1141
1141
|
return e.map((s) => typeof s == "string" ? {
|
|
1142
1142
|
field: s,
|
|
@@ -1144,7 +1144,7 @@ ${ge(o, {
|
|
|
1144
1144
|
count: n,
|
|
1145
1145
|
...o === !0 ? { exclude: [s] } : {}
|
|
1146
1146
|
} : s);
|
|
1147
|
-
},
|
|
1147
|
+
}, Gt = (e = []) => e == null ? void 0 : e.map(({ name: t, field: r, count: n, range: o }) => ({
|
|
1148
1148
|
facetName: t,
|
|
1149
1149
|
fieldName: r,
|
|
1150
1150
|
count: n == null ? void 0 : n.reduce((s, { fieldValue: a, value: i }) => ({ ...s, [a]: i }), {}),
|
|
@@ -1155,7 +1155,7 @@ ${ge(o, {
|
|
|
1155
1155
|
count: Number(s) || 0
|
|
1156
1156
|
}))
|
|
1157
1157
|
} : {}
|
|
1158
|
-
})),
|
|
1158
|
+
})), $t = (e = []) => {
|
|
1159
1159
|
const t = {};
|
|
1160
1160
|
return e.forEach(({ name: r, field: n, count: o }) => {
|
|
1161
1161
|
t[r || n] = o.reduce(
|
|
@@ -1163,30 +1163,30 @@ ${ge(o, {
|
|
|
1163
1163
|
{}
|
|
1164
1164
|
);
|
|
1165
1165
|
}), t;
|
|
1166
|
-
},
|
|
1166
|
+
}, De = {
|
|
1167
1167
|
arrayOnSingle: !0,
|
|
1168
1168
|
joinValue: void 0,
|
|
1169
1169
|
timespanAsList: !1
|
|
1170
|
-
},
|
|
1170
|
+
}, V = (e, t) => {
|
|
1171
1171
|
const {
|
|
1172
1172
|
arrayOnSingle: r = !0,
|
|
1173
1173
|
joinValue: n = void 0,
|
|
1174
1174
|
timespanAsList: o = !1
|
|
1175
|
-
} = { ...
|
|
1176
|
-
return s.reduce((
|
|
1177
|
-
const { name:
|
|
1178
|
-
if (
|
|
1179
|
-
return
|
|
1180
|
-
let
|
|
1181
|
-
return r === !1 &&
|
|
1175
|
+
} = { ...De, ...t || {} }, { field: s = [], start: a, end: i } = e || {}, c = o ? { start: a, end: i } : {};
|
|
1176
|
+
return s.reduce((d, _) => {
|
|
1177
|
+
const { name: p, value: f = [] } = _;
|
|
1178
|
+
if (f.length === 0)
|
|
1179
|
+
return d;
|
|
1180
|
+
let u;
|
|
1181
|
+
return r === !1 && f.length === 1 ? [u] = f : n ? u = f.join(n) : u = f, { ...d, [p]: u };
|
|
1182
1182
|
}, c);
|
|
1183
1183
|
}, ct = {
|
|
1184
|
-
...
|
|
1184
|
+
...De,
|
|
1185
1185
|
timespanAsList: !1,
|
|
1186
1186
|
joinTimespan: "_",
|
|
1187
1187
|
flat: !1,
|
|
1188
1188
|
flatTimespan: !1
|
|
1189
|
-
},
|
|
1189
|
+
}, Vt = (e = [], t) => {
|
|
1190
1190
|
const {
|
|
1191
1191
|
timespanAsList: r,
|
|
1192
1192
|
joinTimespan: n = "_",
|
|
@@ -1195,21 +1195,101 @@ ${ge(o, {
|
|
|
1195
1195
|
...a
|
|
1196
1196
|
} = { ...ct, ...t || {} };
|
|
1197
1197
|
return r === !0 ? e.map(
|
|
1198
|
-
(i) =>
|
|
1198
|
+
(i) => V(i, { ...a, timespanAsList: r })
|
|
1199
1199
|
) : o === !0 || s === !0 ? e.reduce(
|
|
1200
|
-
(i, c) => ({ ...i, ...
|
|
1200
|
+
(i, c) => ({ ...i, ...V(c, t) }),
|
|
1201
1201
|
{}
|
|
1202
1202
|
) : e.reduce(
|
|
1203
1203
|
(i, c) => ({
|
|
1204
1204
|
...i,
|
|
1205
|
-
[[c.start, c.end].join(n)]:
|
|
1205
|
+
[[c.start, c.end].join(n)]: V(
|
|
1206
1206
|
c,
|
|
1207
1207
|
t
|
|
1208
1208
|
)
|
|
1209
1209
|
}),
|
|
1210
1210
|
{}
|
|
1211
1211
|
);
|
|
1212
|
-
},
|
|
1212
|
+
}, dt = (e, t) => {
|
|
1213
|
+
const r = W(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: o = [] } = n, s = o.map((i) => {
|
|
1214
|
+
const c = i.split("/").pop().split("?").shift();
|
|
1215
|
+
return B(c).toSeconds();
|
|
1216
|
+
}), a = s.reduce(
|
|
1217
|
+
(i, c, l) => Math.abs(c - r) < Math.abs(s[i] - r) ? l : i,
|
|
1218
|
+
0
|
|
1219
|
+
);
|
|
1220
|
+
return o[a];
|
|
1221
|
+
}, ut = {
|
|
1222
|
+
includeGroupMetadata: !1,
|
|
1223
|
+
flatEvents: !1,
|
|
1224
|
+
includeEntityType: !1,
|
|
1225
|
+
includeNearestThumbnail: !1
|
|
1226
|
+
}, lt = ({
|
|
1227
|
+
start: e,
|
|
1228
|
+
end: t,
|
|
1229
|
+
group: r = [{ id: "unknown", name: "unknown" }]
|
|
1230
|
+
}) => {
|
|
1231
|
+
const [{ id: n, name: o }] = r, s = W(e).toSeconds(), a = W(t).toSeconds();
|
|
1232
|
+
return { start: e, end: t, startSeconds: s, endSeconds: a, group: { uuid: n, name: o } };
|
|
1233
|
+
}, kt = (e = {}, t) => {
|
|
1234
|
+
const { entry: r = [] } = e, n = {
|
|
1235
|
+
...ut,
|
|
1236
|
+
...t || {}
|
|
1237
|
+
}, { includeGroupMetadata: o, flatEvents: s, includeEntityType: a, includeNearestThumbnail: i } = n, c = r.map((l) => {
|
|
1238
|
+
const { type: d, item: { metadata: _ = {}, id: p, thumbnails: f = {} } = {}, timespan: u, item: m } = l;
|
|
1239
|
+
let T = u.map(
|
|
1240
|
+
(E) => lt(E)
|
|
1241
|
+
);
|
|
1242
|
+
if (i && d === "Item" && f.uri && (T = T.map((E) => {
|
|
1243
|
+
const { start: h } = E, A = dt(m, W(h));
|
|
1244
|
+
return { ...E, thumbnail: A };
|
|
1245
|
+
})), o && d === "Item") {
|
|
1246
|
+
const { timespan: E = [] } = _, h = E.flatMap(
|
|
1247
|
+
(A) => A.group
|
|
1248
|
+
);
|
|
1249
|
+
if (h.length > 0) {
|
|
1250
|
+
const A = T.map((O) => {
|
|
1251
|
+
const {
|
|
1252
|
+
group: { uuid: N }
|
|
1253
|
+
} = O, [w] = N.split("/"), { field: P = [], group: U = [] } = h.find(
|
|
1254
|
+
({ uuid: C }) => C === w
|
|
1255
|
+
);
|
|
1256
|
+
return {
|
|
1257
|
+
...O,
|
|
1258
|
+
group: {
|
|
1259
|
+
...O.group,
|
|
1260
|
+
field: P,
|
|
1261
|
+
group: U
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
});
|
|
1265
|
+
return {
|
|
1266
|
+
entityType: "Item",
|
|
1267
|
+
entityId: p,
|
|
1268
|
+
events: A.sort((O, N) => O.startSeconds - N.startSeconds),
|
|
1269
|
+
...a ? { itemType: m } : {}
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return {
|
|
1274
|
+
entityType: d === "Item" ? "Item" : "Collection",
|
|
1275
|
+
entityId: p,
|
|
1276
|
+
events: T.sort((E, h) => E.startSeconds - h.startSeconds),
|
|
1277
|
+
...a && d === "Item" ? { itemType: m } : {},
|
|
1278
|
+
...a && d === "Collection" ? { collectionType: m } : {}
|
|
1279
|
+
};
|
|
1280
|
+
});
|
|
1281
|
+
return s ? c.flatMap(
|
|
1282
|
+
({ events: l, entityType: d, entityId: _, itemType: p, collectionType: f }) => l.map(
|
|
1283
|
+
(u) => ({
|
|
1284
|
+
...u,
|
|
1285
|
+
entityType: d,
|
|
1286
|
+
entityId: _,
|
|
1287
|
+
...p && { itemType: p },
|
|
1288
|
+
...f && { collectionType: f }
|
|
1289
|
+
})
|
|
1290
|
+
)
|
|
1291
|
+
).sort((l, d) => l.startSeconds - d.startSeconds) : c;
|
|
1292
|
+
}, Ht = (e = "NOW") => {
|
|
1213
1293
|
if (e.startsWith("NOW")) {
|
|
1214
1294
|
if (e === "NOW")
|
|
1215
1295
|
return /* @__PURE__ */ new Date();
|
|
@@ -1235,10 +1315,10 @@ ${ge(o, {
|
|
|
1235
1315
|
return o;
|
|
1236
1316
|
}
|
|
1237
1317
|
return new Date(e);
|
|
1238
|
-
},
|
|
1318
|
+
}, x = (e) => {
|
|
1239
1319
|
const { property: t = [], ...r } = e || {};
|
|
1240
1320
|
return { ...b(t), ...r };
|
|
1241
|
-
},
|
|
1321
|
+
}, _t = (e) => x(e), mt = (e) => x(e), pt = { kB: "kHz", B: "Hz", mB: "mHz" }, ae = { kB: "kbps", B: "bps", MB: "mbps" }, ft = (e) => {
|
|
1242
1322
|
var T;
|
|
1243
1323
|
const {
|
|
1244
1324
|
timeBase: t,
|
|
@@ -1247,32 +1327,32 @@ ${ge(o, {
|
|
|
1247
1327
|
mediaInfo: o,
|
|
1248
1328
|
bitrate: s,
|
|
1249
1329
|
metadata: a
|
|
1250
|
-
} = e, i =
|
|
1330
|
+
} = e, i = _t(o), {
|
|
1251
1331
|
Format: c,
|
|
1252
1332
|
Resolution: l,
|
|
1253
|
-
Bit_rate_mode:
|
|
1254
|
-
} = i, _ = b(a || []),
|
|
1333
|
+
Bit_rate_mode: d
|
|
1334
|
+
} = i, _ = b(a || []), p = t != null && t.denominator ? ((t == null ? void 0 : t.denominator) || 1) / ((t == null ? void 0 : t.numerator) || 1) : void 0, f = p !== void 0 ? y(p, {
|
|
1255
1335
|
base: 10,
|
|
1256
1336
|
round: 1,
|
|
1257
|
-
symbols:
|
|
1337
|
+
symbols: pt
|
|
1258
1338
|
}) : void 0;
|
|
1259
|
-
let
|
|
1260
|
-
return s !== void 0 && (
|
|
1261
|
-
(T =
|
|
1339
|
+
let u, m;
|
|
1340
|
+
return s !== void 0 && (u = y(s, { round: 2, symbols: ae }), m = Number(
|
|
1341
|
+
(T = y(s, { exponent: 1, symbols: ae }).split(" kbps")) == null ? void 0 : T[0]
|
|
1262
1342
|
)), {
|
|
1263
1343
|
audioFormat: c,
|
|
1264
1344
|
audioCodec: n,
|
|
1265
|
-
audioSamplerate:
|
|
1266
|
-
audioSamplerateSamples:
|
|
1345
|
+
audioSamplerate: f,
|
|
1346
|
+
audioSamplerateSamples: p,
|
|
1267
1347
|
audioBitDepth: l,
|
|
1268
|
-
audioBitrate:
|
|
1348
|
+
audioBitrate: u,
|
|
1269
1349
|
audioBitrateKbps: m,
|
|
1270
|
-
audioBitRateMode:
|
|
1350
|
+
audioBitRateMode: d,
|
|
1271
1351
|
audioChannels: r,
|
|
1272
1352
|
audioMediaInfo: i,
|
|
1273
1353
|
audioMetadata: _
|
|
1274
1354
|
};
|
|
1275
|
-
},
|
|
1355
|
+
}, Yt = {
|
|
1276
1356
|
/** Just created, not used. */
|
|
1277
1357
|
NONE: "NONE",
|
|
1278
1358
|
/** Discovered or created, not yet marked as finished. */
|
|
@@ -1295,7 +1375,7 @@ ${ge(o, {
|
|
|
1295
1375
|
ARCHIVED: "ARCHIVED",
|
|
1296
1376
|
/** File will be synchronized by multi-site agent. */
|
|
1297
1377
|
AWAITING_SYNC: "AWAITING_SYNC"
|
|
1298
|
-
},
|
|
1378
|
+
}, Me = (e) => {
|
|
1299
1379
|
const {
|
|
1300
1380
|
uri: t = [],
|
|
1301
1381
|
size: r,
|
|
@@ -1303,30 +1383,30 @@ ${ge(o, {
|
|
|
1303
1383
|
path: o,
|
|
1304
1384
|
id: s,
|
|
1305
1385
|
storage: a
|
|
1306
|
-
} = e, [i] = t, c = r !== void 0 ?
|
|
1386
|
+
} = e, [i] = t, c = r !== void 0 ? y(r, { base: 2, standard: "jedec" }) : "", l = (o == null ? void 0 : o.split("/")) || [], d = l.pop() || "", _ = l.map((p) => `${p}/`).join("") || void 0;
|
|
1307
1387
|
return {
|
|
1308
1388
|
uri: i,
|
|
1309
1389
|
hash: n,
|
|
1310
1390
|
fileSize: c,
|
|
1311
1391
|
fileSizeBytes: r,
|
|
1312
1392
|
path: o,
|
|
1313
|
-
fileName:
|
|
1393
|
+
fileName: d,
|
|
1314
1394
|
fileId: s,
|
|
1315
1395
|
storageId: a,
|
|
1316
1396
|
folderPath: _
|
|
1317
1397
|
};
|
|
1318
|
-
},
|
|
1319
|
-
const { file: t, mediaInfo: r, metadata: n = [] } = e, o = b(n), s =
|
|
1398
|
+
}, Tt = (e = {}) => {
|
|
1399
|
+
const { file: t, mediaInfo: r, metadata: n = [] } = e, o = b(n), s = x(r);
|
|
1320
1400
|
let a = { binaryMetadata: o, binaryMediaInfo: s };
|
|
1321
1401
|
if (t) {
|
|
1322
|
-
const [i] = t, c =
|
|
1402
|
+
const [i] = t, c = Me(i);
|
|
1323
1403
|
a = {
|
|
1324
1404
|
...a,
|
|
1325
1405
|
...c
|
|
1326
1406
|
};
|
|
1327
1407
|
}
|
|
1328
1408
|
return a;
|
|
1329
|
-
},
|
|
1409
|
+
}, Et = (e = {}) => {
|
|
1330
1410
|
const {
|
|
1331
1411
|
mediaInfo: t,
|
|
1332
1412
|
metadata: r,
|
|
@@ -1335,42 +1415,42 @@ ${ge(o, {
|
|
|
1335
1415
|
startTimestamp: s,
|
|
1336
1416
|
startTimecode: a,
|
|
1337
1417
|
timeCodeTimeBase: i
|
|
1338
|
-
} = e, c = b(r || []), l =
|
|
1339
|
-
let { Format:
|
|
1418
|
+
} = e, c = b(r || []), l = x(t);
|
|
1419
|
+
let { Format: d } = l;
|
|
1340
1420
|
const {
|
|
1341
1421
|
Video_Format_List: _,
|
|
1342
|
-
Audio_Format_List:
|
|
1343
|
-
Text_Format_List:
|
|
1422
|
+
Audio_Format_List: p,
|
|
1423
|
+
Text_Format_List: f
|
|
1344
1424
|
} = l;
|
|
1345
|
-
if (
|
|
1425
|
+
if (d === void 0) {
|
|
1346
1426
|
const { format: m } = e;
|
|
1347
|
-
|
|
1427
|
+
d = m, m && m.includes(",") && ([d] = m.split(","));
|
|
1348
1428
|
}
|
|
1349
|
-
let
|
|
1350
|
-
containerFormat:
|
|
1429
|
+
let u = {
|
|
1430
|
+
containerFormat: d,
|
|
1351
1431
|
videoFormat: _,
|
|
1352
|
-
audioFormat:
|
|
1353
|
-
textFormat:
|
|
1432
|
+
audioFormat: p,
|
|
1433
|
+
textFormat: f,
|
|
1354
1434
|
containerMetadata: c,
|
|
1355
1435
|
containerMediaInfo: l
|
|
1356
1436
|
};
|
|
1357
|
-
if (c.componentOriginalFilename && (
|
|
1358
|
-
const m =
|
|
1359
|
-
|
|
1437
|
+
if (c.componentOriginalFilename && (u.originalFilename = c.componentOriginalFilename), o !== void 0 && o.samples !== 0) {
|
|
1438
|
+
const m = D(o);
|
|
1439
|
+
u.durationTimeCode = m.toObject(), u.duration = m.toDuration();
|
|
1360
1440
|
}
|
|
1361
|
-
if (s && (
|
|
1441
|
+
if (s && (u.startTimestamp = D(s).toObject()), a !== void 0 && i && (u.startTimecode = D({
|
|
1362
1442
|
samples: a,
|
|
1363
1443
|
timeBase: i
|
|
1364
1444
|
})), n) {
|
|
1365
|
-
const [m] = n, T =
|
|
1366
|
-
|
|
1367
|
-
...
|
|
1445
|
+
const [m] = n, T = Me(m);
|
|
1446
|
+
u = {
|
|
1447
|
+
...u,
|
|
1368
1448
|
...T
|
|
1369
1449
|
};
|
|
1370
1450
|
}
|
|
1371
|
-
return
|
|
1372
|
-
},
|
|
1373
|
-
var
|
|
1451
|
+
return u;
|
|
1452
|
+
}, ce = { kB: "kbps", B: "bps", MB: "mbps" }, ht = (e = {}) => {
|
|
1453
|
+
var ee;
|
|
1374
1454
|
const {
|
|
1375
1455
|
codec: t,
|
|
1376
1456
|
bitrate: r,
|
|
@@ -1378,54 +1458,54 @@ ${ge(o, {
|
|
|
1378
1458
|
resolution: o,
|
|
1379
1459
|
mediaInfo: s,
|
|
1380
1460
|
metadata: a = []
|
|
1381
|
-
} = e, i =
|
|
1461
|
+
} = e, i = mt(s), c = b(a), {
|
|
1382
1462
|
Format: l,
|
|
1383
|
-
"Frame rate":
|
|
1463
|
+
"Frame rate": d,
|
|
1384
1464
|
"Color space": _,
|
|
1385
|
-
"Color primaries":
|
|
1386
|
-
Colorimetry:
|
|
1465
|
+
"Color primaries": p,
|
|
1466
|
+
Colorimetry: f
|
|
1387
1467
|
} = i;
|
|
1388
|
-
let
|
|
1468
|
+
let u;
|
|
1389
1469
|
const { averageFrameRate: m, realBaseFrameRate: T } = e;
|
|
1390
|
-
T !== void 0 ?
|
|
1470
|
+
T !== void 0 ? u = M({
|
|
1391
1471
|
numerator: T.denominator,
|
|
1392
1472
|
denominator: T.numerator
|
|
1393
|
-
}) :
|
|
1473
|
+
}) : d !== void 0 ? u = q(d) : m !== void 0 && (u = M({
|
|
1394
1474
|
numerator: m.denominator,
|
|
1395
1475
|
denominator: m.numerator
|
|
1396
1476
|
}));
|
|
1397
1477
|
let { "Frame count": E } = i;
|
|
1398
1478
|
if (E === void 0) {
|
|
1399
|
-
const { numberOfPackets:
|
|
1400
|
-
|
|
1479
|
+
const { numberOfPackets: te } = e;
|
|
1480
|
+
te !== void 0 && (E = te.toString());
|
|
1401
1481
|
}
|
|
1402
|
-
let
|
|
1403
|
-
E &&
|
|
1404
|
-
const { height:
|
|
1405
|
-
let
|
|
1406
|
-
return r !== void 0 && (
|
|
1407
|
-
(
|
|
1482
|
+
let h, A, O;
|
|
1483
|
+
E && u && (h = D({ samples: E, timeBase: u }), A = h.timeBase.toConstant() || h.timeBase.toRate(), O = h.toSmpte());
|
|
1484
|
+
const { height: N, width: w } = o || {}, P = H(o), U = `${w}x${N}`;
|
|
1485
|
+
let C, Z;
|
|
1486
|
+
return r !== void 0 && (C = y(r, { round: 2, symbols: ce }), Z = Number(
|
|
1487
|
+
(ee = y(r, { exponent: 2, symbols: ce }).split(" mbps")) == null ? void 0 : ee[0]
|
|
1408
1488
|
)), {
|
|
1409
1489
|
videoFormat: l,
|
|
1410
|
-
dimension:
|
|
1411
|
-
frameRate:
|
|
1412
|
-
height:
|
|
1413
|
-
width:
|
|
1414
|
-
timeBase:
|
|
1415
|
-
timeCode:
|
|
1490
|
+
dimension: U,
|
|
1491
|
+
frameRate: A,
|
|
1492
|
+
height: N,
|
|
1493
|
+
width: w,
|
|
1494
|
+
timeBase: u,
|
|
1495
|
+
timeCode: h,
|
|
1416
1496
|
videoCodec: t,
|
|
1417
|
-
smpte:
|
|
1418
|
-
videoBitrate:
|
|
1419
|
-
videoBitrateMbps:
|
|
1497
|
+
smpte: O,
|
|
1498
|
+
videoBitrate: C,
|
|
1499
|
+
videoBitrateMbps: Z,
|
|
1420
1500
|
fieldOrder: n,
|
|
1421
1501
|
colorSpace: _,
|
|
1422
|
-
chromaSubsampling:
|
|
1423
|
-
aspectRatio:
|
|
1424
|
-
colorPrimaries:
|
|
1502
|
+
chromaSubsampling: f,
|
|
1503
|
+
aspectRatio: P,
|
|
1504
|
+
colorPrimaries: p,
|
|
1425
1505
|
videoMetadata: c,
|
|
1426
1506
|
videoMediaInfo: i
|
|
1427
1507
|
};
|
|
1428
|
-
},
|
|
1508
|
+
}, ve = (e = {}) => {
|
|
1429
1509
|
let t = {};
|
|
1430
1510
|
const {
|
|
1431
1511
|
containerComponent: r,
|
|
@@ -1436,61 +1516,61 @@ ${ge(o, {
|
|
|
1436
1516
|
tag: i = []
|
|
1437
1517
|
} = e;
|
|
1438
1518
|
if ([t.tag] = i, [t.mimeType] = a, r) {
|
|
1439
|
-
const c =
|
|
1519
|
+
const c = Et(r);
|
|
1440
1520
|
t = {
|
|
1441
1521
|
...t,
|
|
1442
1522
|
...c
|
|
1443
1523
|
};
|
|
1444
1524
|
}
|
|
1445
1525
|
if (n) {
|
|
1446
|
-
const [c] = n, l =
|
|
1526
|
+
const [c] = n, l = ht(c);
|
|
1447
1527
|
t = {
|
|
1448
1528
|
...t,
|
|
1449
1529
|
...l
|
|
1450
1530
|
};
|
|
1451
1531
|
}
|
|
1452
1532
|
if (o) {
|
|
1453
|
-
const [c] = o, l =
|
|
1533
|
+
const [c] = o, l = ft(c);
|
|
1454
1534
|
t = {
|
|
1455
1535
|
...t,
|
|
1456
1536
|
...l
|
|
1457
1537
|
};
|
|
1458
1538
|
}
|
|
1459
1539
|
if (s) {
|
|
1460
|
-
const [c] = s, l =
|
|
1540
|
+
const [c] = s, l = Tt(c);
|
|
1461
1541
|
t = {
|
|
1462
1542
|
...t,
|
|
1463
1543
|
...l
|
|
1464
1544
|
};
|
|
1465
1545
|
}
|
|
1466
1546
|
return t;
|
|
1467
|
-
},
|
|
1547
|
+
}, F = {
|
|
1468
1548
|
PDF: "PDF",
|
|
1469
1549
|
TEXT: "TEXT",
|
|
1470
1550
|
MSWORD: "MSWORD",
|
|
1471
1551
|
JSON: "JSON",
|
|
1472
1552
|
XML: "XML"
|
|
1473
|
-
},
|
|
1553
|
+
}, R = {
|
|
1474
1554
|
IMAGE: "IMAGE",
|
|
1475
1555
|
AUDIO: "AUDIO",
|
|
1476
1556
|
VIDEO: "VIDEO",
|
|
1477
1557
|
DOCUMENT: "DOCUMENT",
|
|
1478
1558
|
BINARY: "BINARY"
|
|
1479
|
-
},
|
|
1559
|
+
}, Kt = (e = {}) => {
|
|
1480
1560
|
const { mimeType: t } = e, r = Array.isArray(t) ? t[0] : t;
|
|
1481
1561
|
if (r) {
|
|
1482
1562
|
if (r.endsWith("/pdf"))
|
|
1483
|
-
return
|
|
1563
|
+
return F.PDF;
|
|
1484
1564
|
if (r.startsWith("text/"))
|
|
1485
|
-
return
|
|
1565
|
+
return F.TEXT;
|
|
1486
1566
|
if (r.endsWith("/msword"))
|
|
1487
|
-
return
|
|
1567
|
+
return F.MSWORD;
|
|
1488
1568
|
if (r.endsWith("/json"))
|
|
1489
|
-
return
|
|
1569
|
+
return F.JSON;
|
|
1490
1570
|
if (r.endsWith("/xml"))
|
|
1491
|
-
return
|
|
1571
|
+
return F.XML;
|
|
1492
1572
|
}
|
|
1493
|
-
},
|
|
1573
|
+
}, At = [
|
|
1494
1574
|
"image/apng",
|
|
1495
1575
|
"image/bmp",
|
|
1496
1576
|
"image/gif",
|
|
@@ -1498,7 +1578,7 @@ ${ge(o, {
|
|
|
1498
1578
|
"image/x-icon",
|
|
1499
1579
|
"image/png",
|
|
1500
1580
|
"image/svg+xml"
|
|
1501
|
-
],
|
|
1581
|
+
], Ot = ["video/mp4"], It = [
|
|
1502
1582
|
"audio/mp4",
|
|
1503
1583
|
"audio/mpeg",
|
|
1504
1584
|
"audio/x-aac",
|
|
@@ -1509,67 +1589,58 @@ ${ge(o, {
|
|
|
1509
1589
|
"audio/ogg",
|
|
1510
1590
|
"audio/webm",
|
|
1511
1591
|
"audio/x-flac"
|
|
1512
|
-
],
|
|
1592
|
+
], Rt = [...Ot, ...At, ...It], St = ["http", "https"], gt = "video/mp4", bt = "video/quicktime", Nt = "video/x-m4v", yt = "MPEG-4", Ft = "mov", Dt = "h264", L = [
|
|
1513
1593
|
"__mp4",
|
|
1514
1594
|
"__mp3_160k",
|
|
1515
1595
|
"__png",
|
|
1516
1596
|
"__jpeg",
|
|
1517
1597
|
"__gif",
|
|
1518
1598
|
"original"
|
|
1519
|
-
].reverse(),
|
|
1599
|
+
].reverse(), de = ({ parsedShape: { tag: e } }, { parsedShape: { tag: t } }) => L.includes(e) || L.includes(t) ? L.indexOf(t) - L.indexOf(e) : e.toLowerCase().localeCompare(t.toLowerCase()), zt = (e, t) => {
|
|
1520
1600
|
const {
|
|
1521
|
-
allowedMimeTypes: r =
|
|
1522
|
-
allowedMethods: n =
|
|
1523
|
-
sortPriority: o =
|
|
1601
|
+
allowedMimeTypes: r = Rt,
|
|
1602
|
+
allowedMethods: n = St,
|
|
1603
|
+
sortPriority: o = de,
|
|
1524
1604
|
sourceKey: s = "src",
|
|
1525
1605
|
mimeTypeKey: a = "type",
|
|
1526
1606
|
shapeKey: i = "shape",
|
|
1527
1607
|
parsedShapeKey: c = "parsedShape"
|
|
1528
|
-
} = t || {}, { shape: l = [] } = e || {},
|
|
1529
|
-
let
|
|
1530
|
-
const m =
|
|
1531
|
-
if (E && (
|
|
1608
|
+
} = t || {}, { shape: l = [] } = e || {}, d = l.reduce((_, p) => {
|
|
1609
|
+
let f, u;
|
|
1610
|
+
const m = ve(p), { uri: T, mimeType: E, containerFormat: h, videoCodec: A } = m;
|
|
1611
|
+
if (E && (f = E, (E === bt || E === Nt) && (h === yt || h === Ft) && A === Dt && (f = gt)), T)
|
|
1532
1612
|
if (n) {
|
|
1533
|
-
const [
|
|
1534
|
-
n.includes(
|
|
1613
|
+
const [O] = T.split("://");
|
|
1614
|
+
n.includes(O) && (u = T);
|
|
1535
1615
|
} else
|
|
1536
|
-
|
|
1537
|
-
return
|
|
1538
|
-
[s]:
|
|
1539
|
-
[a]:
|
|
1540
|
-
[i]:
|
|
1616
|
+
u = T;
|
|
1617
|
+
return u && r.includes(f) && _.push({
|
|
1618
|
+
[s]: u,
|
|
1619
|
+
[a]: f,
|
|
1620
|
+
[i]: p,
|
|
1541
1621
|
[c]: m
|
|
1542
1622
|
}), _;
|
|
1543
1623
|
}, []);
|
|
1544
|
-
return typeof o == "function" &&
|
|
1545
|
-
},
|
|
1546
|
-
const t =
|
|
1624
|
+
return typeof o == "function" && d.sort(de), d;
|
|
1625
|
+
}, Jt = (e) => {
|
|
1626
|
+
const t = ve(e), { mimeType: r, videoCodec: n, audioCodec: o } = t;
|
|
1547
1627
|
if (r) {
|
|
1548
1628
|
if (r.startsWith("audio/") && o !== void 0)
|
|
1549
|
-
return
|
|
1629
|
+
return R.AUDIO;
|
|
1550
1630
|
if (r.startsWith("video/")) {
|
|
1551
1631
|
if (n !== void 0)
|
|
1552
|
-
return
|
|
1632
|
+
return R.VIDEO;
|
|
1553
1633
|
if (o !== void 0)
|
|
1554
|
-
return
|
|
1634
|
+
return R.AUDIO;
|
|
1555
1635
|
}
|
|
1556
1636
|
if (r.startsWith("image/"))
|
|
1557
|
-
return
|
|
1637
|
+
return R.IMAGE;
|
|
1558
1638
|
if (r.endsWith("/pdf") || r.startsWith("text/") || r.endsWith("/msword") || r.endsWith("/json") || r.endsWith("/xml"))
|
|
1559
|
-
return
|
|
1639
|
+
return R.DOCUMENT;
|
|
1560
1640
|
if (r.endsWith("/octet-stream"))
|
|
1561
|
-
return
|
|
1641
|
+
return R.BINARY;
|
|
1562
1642
|
}
|
|
1563
|
-
},
|
|
1564
|
-
const r = st(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: o = [] } = n, s = o.map((i) => {
|
|
1565
|
-
const c = new URL(i).pathname.split("/").pop();
|
|
1566
|
-
return w(c).toSeconds();
|
|
1567
|
-
}), a = s.reduce(
|
|
1568
|
-
(i, c, l) => Math.abs(c - r) < Math.abs(s[i] - r) ? l : i,
|
|
1569
|
-
0
|
|
1570
|
-
);
|
|
1571
|
-
return o[a];
|
|
1572
|
-
}, Dt = (e) => {
|
|
1643
|
+
}, Mt = (e) => {
|
|
1573
1644
|
const t = {}, { outputSetting: r = [] } = e || {};
|
|
1574
1645
|
if (r.length === 0)
|
|
1575
1646
|
return t;
|
|
@@ -1577,34 +1648,34 @@ ${ge(o, {
|
|
|
1577
1648
|
if (o && (t.containerFormat = o.Container), s) {
|
|
1578
1649
|
const { CodecSettings: i = {} } = s, { Codec: c, ...l } = i;
|
|
1579
1650
|
t.videoFormat = c;
|
|
1580
|
-
const { Height:
|
|
1581
|
-
t.height =
|
|
1582
|
-
const [
|
|
1583
|
-
if (
|
|
1584
|
-
t.fieldOrder =
|
|
1585
|
-
const
|
|
1651
|
+
const { Height: d, Width: _ } = s;
|
|
1652
|
+
t.height = d, t.width = _, d && _ && (t.dimension = `${_}x${d}`, t.aspectRatio = H({ height: d, width: _ }));
|
|
1653
|
+
const [p] = Object.values(l);
|
|
1654
|
+
if (p) {
|
|
1655
|
+
t.fieldOrder = p.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = p.Bitrate;
|
|
1656
|
+
const f = p.FramerateDenominator, u = p.FramerateNumerator, m = M({ denominator: u, numerator: f });
|
|
1586
1657
|
t.timeBase = m, t.frameRate = m.toConstant() || m.toRate();
|
|
1587
1658
|
}
|
|
1588
1659
|
}
|
|
1589
1660
|
if (a && a.length > 0) {
|
|
1590
1661
|
const { CodecSettings: i = {} } = a[0], { Codec: c, ...l } = i;
|
|
1591
1662
|
t.audioFormat = c;
|
|
1592
|
-
const [
|
|
1593
|
-
|
|
1663
|
+
const [d] = Object.values(l);
|
|
1664
|
+
d && (t.audioSamplerate = d.SampleRate, t.audioBitrate = d.Bitrate, t.audioBitRateMode = d.RateControlMode);
|
|
1594
1665
|
}
|
|
1595
1666
|
return t;
|
|
1596
|
-
},
|
|
1667
|
+
}, Xt = (e) => {
|
|
1597
1668
|
const t = {}, { description: r, format: n, audio: o, video: s, mediaconvert: a } = e || {};
|
|
1598
1669
|
if (a)
|
|
1599
|
-
return { description: r, ...
|
|
1670
|
+
return { description: r, ...Mt(a) };
|
|
1600
1671
|
if (t.description = r, t.containerFormat = n, s) {
|
|
1601
1672
|
if (t.videoFormat = s.codec, t.videoBitrate = s.bitrate, s.framerate) {
|
|
1602
|
-
const i =
|
|
1673
|
+
const i = M(s.framerate);
|
|
1603
1674
|
t.timeBase = i, t.frameRate = i.toConstant() || i.toRate();
|
|
1604
1675
|
}
|
|
1605
1676
|
if (s.scaling) {
|
|
1606
1677
|
const { height: i, width: c } = s.scaling;
|
|
1607
|
-
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio =
|
|
1678
|
+
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio = H({ height: i, width: c }));
|
|
1608
1679
|
}
|
|
1609
1680
|
}
|
|
1610
1681
|
if (o) {
|
|
@@ -1612,7 +1683,7 @@ ${ge(o, {
|
|
|
1612
1683
|
t.audioFormat = i, c && (t.audioChannels = c.length);
|
|
1613
1684
|
}
|
|
1614
1685
|
return t;
|
|
1615
|
-
},
|
|
1686
|
+
}, vt = (e) => {
|
|
1616
1687
|
if (!e)
|
|
1617
1688
|
return;
|
|
1618
1689
|
const {
|
|
@@ -1625,26 +1696,26 @@ ${ge(o, {
|
|
|
1625
1696
|
longRestriction: i,
|
|
1626
1697
|
data: c,
|
|
1627
1698
|
values: l
|
|
1628
|
-
} = e, { minLength:
|
|
1629
|
-
label:
|
|
1630
|
-
value:
|
|
1631
|
-
})), E = ((
|
|
1632
|
-
min:
|
|
1633
|
-
max:
|
|
1634
|
-
minLength:
|
|
1699
|
+
} = e, { minLength: d, maxLength: _, pattern: p } = o || {}, { minInclusive: f, maxInclusive: u } = s || a || i || {}, m = ((l == null ? void 0 : l.field) || []).map(({ key: A, value: O }) => ({
|
|
1700
|
+
label: O ?? A,
|
|
1701
|
+
value: A
|
|
1702
|
+
})), E = ((A) => Object.fromEntries(Object.entries(A).filter(([, O]) => O !== void 0)))({
|
|
1703
|
+
min: f,
|
|
1704
|
+
max: u,
|
|
1705
|
+
minLength: d,
|
|
1635
1706
|
maxLength: _,
|
|
1636
|
-
pattern:
|
|
1637
|
-
}),
|
|
1707
|
+
pattern: p ? new RegExp(p) : void 0
|
|
1708
|
+
}), h = b(c);
|
|
1638
1709
|
return {
|
|
1639
1710
|
name: t,
|
|
1640
1711
|
type: r,
|
|
1641
1712
|
defaultValue: n,
|
|
1642
|
-
required:
|
|
1713
|
+
required: f !== void 0 || d !== void 0 && d > 0,
|
|
1643
1714
|
restrictions: E,
|
|
1644
|
-
data:
|
|
1715
|
+
data: h,
|
|
1645
1716
|
options: m
|
|
1646
1717
|
};
|
|
1647
|
-
},
|
|
1718
|
+
}, qt = (e) => e == null ? void 0 : e.map(vt).filter((t) => !!t), Qt = [
|
|
1648
1719
|
"date",
|
|
1649
1720
|
"float",
|
|
1650
1721
|
"integer",
|
|
@@ -1655,52 +1726,54 @@ ${ge(o, {
|
|
|
1655
1726
|
"timeCode"
|
|
1656
1727
|
];
|
|
1657
1728
|
export {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1729
|
+
F as DOCUMENT_TYPES,
|
|
1730
|
+
Ce as FIELD_ATTRIBUTE_KEYS,
|
|
1731
|
+
Qt as FIELD_DEFINITION_TYPES,
|
|
1732
|
+
we as FIELD_VALUE_ATTRIBUTE_KEYS,
|
|
1733
|
+
Yt as FILE_STATES,
|
|
1734
|
+
Le as GROUP_ATTRIBUTE_KEYS,
|
|
1735
|
+
Ct as ROLE_NAMES,
|
|
1736
|
+
R as SHAPE_MEDIA_TYPES,
|
|
1737
|
+
Lt as SYSTEM_FIELDGROUPS,
|
|
1738
|
+
Bt as SYSTEM_FIELDS,
|
|
1739
|
+
I as TimeBase,
|
|
1740
|
+
S as TimeCode,
|
|
1741
|
+
Wt as createMetadataType,
|
|
1742
|
+
Ut as createSearchFacetList,
|
|
1743
|
+
v as createTimeBase,
|
|
1744
|
+
W as createTimeCode,
|
|
1745
|
+
ut as defaultOptions,
|
|
1746
|
+
zt as filterShapeSource,
|
|
1747
|
+
dt as findNearestThumbnail,
|
|
1748
|
+
q as formatTimeBaseText,
|
|
1749
|
+
M as formatTimeBaseType,
|
|
1750
|
+
Xe as formatTimeCodeSeconds,
|
|
1751
|
+
tt as formatTimeCodeSmpte,
|
|
1752
|
+
B as formatTimeCodeText,
|
|
1753
|
+
D as formatTimeCodeType,
|
|
1754
|
+
Kt as getShapeDocumentType,
|
|
1755
|
+
Jt as getShapeMediaType,
|
|
1756
|
+
Pt as metadataTypeToWebVtt,
|
|
1757
|
+
ft as parseAudioComponent,
|
|
1758
|
+
Tt as parseBinaryComponent,
|
|
1759
|
+
Et as parseContainerComponent,
|
|
1760
|
+
Gt as parseFacetList,
|
|
1761
|
+
$t as parseFacetType,
|
|
1762
|
+
qt as parseFieldDefinitionList,
|
|
1763
|
+
Se as parseFieldList,
|
|
1764
|
+
Me as parseFileType,
|
|
1765
|
+
be as parseGroupList,
|
|
1766
|
+
V as parseHighlightTimespan,
|
|
1767
|
+
Vt as parseHighlightTimespanList,
|
|
1696
1768
|
b as parseKeyValuePairType,
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1769
|
+
Mt as parseMediaConvertPreset,
|
|
1770
|
+
jt as parseMetadataType,
|
|
1771
|
+
Ht as parseNowDate,
|
|
1772
|
+
kt as parseSearchResultEvents,
|
|
1773
|
+
ve as parseShapeType,
|
|
1774
|
+
xt as parseSimpleMetadataType,
|
|
1775
|
+
Ke as parseTimespan,
|
|
1776
|
+
ye as parseTimespanList,
|
|
1777
|
+
Xt as parseTranscodePreset,
|
|
1778
|
+
ht as parseVideoComponent
|
|
1706
1779
|
};
|