@vidispine/vdt-js 21.3.0 → 21.4.0-pre.1

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.es.js CHANGED
@@ -1,3 +1,41 @@
1
+ function ownKeys(object, enumerableOnly) {
2
+ var keys = Object.keys(object);
3
+
4
+ if (Object.getOwnPropertySymbols) {
5
+ var symbols = Object.getOwnPropertySymbols(object);
6
+
7
+ if (enumerableOnly) {
8
+ symbols = symbols.filter(function (sym) {
9
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
10
+ });
11
+ }
12
+
13
+ keys.push.apply(keys, symbols);
14
+ }
15
+
16
+ return keys;
17
+ }
18
+
19
+ function _objectSpread2(target) {
20
+ for (var i = 1; i < arguments.length; i++) {
21
+ var source = arguments[i] != null ? arguments[i] : {};
22
+
23
+ if (i % 2) {
24
+ ownKeys(Object(source), true).forEach(function (key) {
25
+ _defineProperty(target, key, source[key]);
26
+ });
27
+ } else if (Object.getOwnPropertyDescriptors) {
28
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
29
+ } else {
30
+ ownKeys(Object(source)).forEach(function (key) {
31
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
32
+ });
33
+ }
34
+ }
35
+
36
+ return target;
37
+ }
38
+
1
39
  function _typeof(obj) {
2
40
  "@babel/helpers - typeof";
3
41
 
@@ -51,40 +89,6 @@ function _defineProperty(obj, key, value) {
51
89
  return obj;
52
90
  }
53
91
 
54
- function ownKeys(object, enumerableOnly) {
55
- var keys = Object.keys(object);
56
-
57
- if (Object.getOwnPropertySymbols) {
58
- var symbols = Object.getOwnPropertySymbols(object);
59
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
60
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
61
- });
62
- keys.push.apply(keys, symbols);
63
- }
64
-
65
- return keys;
66
- }
67
-
68
- function _objectSpread2(target) {
69
- for (var i = 1; i < arguments.length; i++) {
70
- var source = arguments[i] != null ? arguments[i] : {};
71
-
72
- if (i % 2) {
73
- ownKeys(Object(source), true).forEach(function (key) {
74
- _defineProperty(target, key, source[key]);
75
- });
76
- } else if (Object.getOwnPropertyDescriptors) {
77
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
78
- } else {
79
- ownKeys(Object(source)).forEach(function (key) {
80
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
81
- });
82
- }
83
- }
84
-
85
- return target;
86
- }
87
-
88
92
  function _objectWithoutPropertiesLoose(source, excluded) {
89
93
  if (source == null) return {};
90
94
  var target = {};
@@ -138,18 +142,21 @@ function _arrayWithHoles(arr) {
138
142
  }
139
143
 
140
144
  function _iterableToArray(iter) {
141
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
145
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
142
146
  }
143
147
 
144
148
  function _iterableToArrayLimit(arr, i) {
145
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
149
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
150
+
151
+ if (_i == null) return;
146
152
  var _arr = [];
147
153
  var _n = true;
148
154
  var _d = false;
149
- var _e = undefined;
155
+
156
+ var _s, _e;
150
157
 
151
158
  try {
152
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
159
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
153
160
  _arr.push(_s.value);
154
161
 
155
162
  if (i && _arr.length === i) break;
@@ -193,6 +200,11 @@ function _nonIterableRest() {
193
200
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
194
201
  }
195
202
 
203
+ var _excluded = ["value"],
204
+ _excluded2 = ["field", "group"],
205
+ _excluded3 = ["field", "group"],
206
+ _excluded4 = ["timespan"];
207
+
196
208
  var sortTimespanList = function sortTimespanList(_ref, _ref2) {
197
209
  var firstStart = _ref.start;
198
210
  var secondStart = _ref2.start;
@@ -259,7 +271,7 @@ var parseField = function parseField() {
259
271
 
260
272
  var _field$value = field.value,
261
273
  value = _field$value === void 0 ? [] : _field$value,
262
- attributes = _objectWithoutProperties(field, ["value"]);
274
+ attributes = _objectWithoutProperties(field, _excluded);
263
275
 
264
276
  var parsedValueList = parseValueList(value, options);
265
277
  if (includeAttributes || includeFieldAttributes) return _objectSpread2(_objectSpread2({}, attributes), {}, {
@@ -329,7 +341,7 @@ var parseGroup = function parseGroup() {
329
341
  fieldList = _group$field === void 0 ? [] : _group$field,
330
342
  _group$group = group.group,
331
343
  groupList = _group$group === void 0 ? [] : _group$group,
332
- attributes = _objectWithoutProperties(group, ["field", "group"]);
344
+ attributes = _objectWithoutProperties(group, _excluded2);
333
345
 
334
346
  var parsedFieldList = parseFieldList(fieldList, options);
335
347
  var parsedGroupList = parseGroupList(groupList, options); // eslint-disable-line no-use-before-define,max-len
@@ -413,7 +425,7 @@ var parseTimespan = function parseTimespan() {
413
425
  fieldList = _timespan$field === void 0 ? [] : _timespan$field,
414
426
  _timespan$group = timespan.group,
415
427
  groupList = _timespan$group === void 0 ? [] : _timespan$group,
416
- attributes = _objectWithoutProperties(timespan, ["field", "group"]);
428
+ attributes = _objectWithoutProperties(timespan, _excluded3);
417
429
 
418
430
  var field = parseFieldList(fieldList, options);
419
431
  var group = parseGroupList(groupList, options);
@@ -518,7 +530,7 @@ var parseMetadataType = function parseMetadataType() {
518
530
 
519
531
  var _metadataType$timespa2 = metadataType.timespan,
520
532
  timespanList = _metadataType$timespa2 === void 0 ? [] : _metadataType$timespa2,
521
- attributes = _objectWithoutProperties(metadataType, ["timespan"]);
533
+ attributes = _objectWithoutProperties(metadataType, _excluded4);
522
534
 
523
535
  if (sortTimespan) timespanList.sort(sortTimespanList);
524
536
  var timespan = parseTimespanList(timespanList, options);
@@ -530,20 +542,24 @@ var parseMetadataType = function parseMetadataType() {
530
542
  return timespan;
531
543
  };
532
544
 
545
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
546
+
533
547
  function createCommonjsModule(fn, module) {
534
548
  return module = { exports: {} }, fn(module, module.exports), module.exports;
535
549
  }
536
550
 
537
551
  var filesize = createCommonjsModule(function (module, exports) {
538
- /**
539
- * filesize
540
- *
541
- * @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
542
- * @license BSD-3-Clause
543
- * @version 6.1.0
552
+ /**
553
+ * filesize
554
+ *
555
+ * @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
556
+ * @license BSD-3-Clause
557
+ * @version 6.4.0
544
558
  */
559
+ (function (global, factory) {
560
+ module.exports = factory() ;
561
+ })(commonjsGlobal, function () {
545
562
 
546
- (function (global) {
547
563
  var b = /^(b|B)$/,
548
564
  symbol = {
549
565
  iec: {
@@ -558,37 +574,45 @@ var filesize = createCommonjsModule(function (module, exports) {
558
574
  fullform = {
559
575
  iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
560
576
  jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
577
+ },
578
+ roundingFuncs = {
579
+ floor: Math.floor,
580
+ ceil: Math.ceil
561
581
  };
562
- /**
563
- * filesize
564
- *
565
- * @method filesize
566
- * @param {Mixed} arg String, Int or Float to transform
567
- * @param {Object} descriptor [Optional] Flags
568
- * @return {String} Readable file size String
582
+ /**
583
+ * filesize
584
+ *
585
+ * @method filesize
586
+ * @param {Mixed} arg String, Int or Float to transform
587
+ * @param {Object} descriptor [Optional] Flags
588
+ * @return {String} Readable file size String
569
589
  */
570
590
 
571
591
  function filesize(arg) {
572
592
  var descriptor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
573
593
  var result = [],
574
594
  val = 0,
575
- e = void 0,
576
- base = void 0,
577
- bits = void 0,
578
- ceil = void 0,
579
- full = void 0,
580
- fullforms = void 0,
581
- locale = void 0,
582
- localeOptions = void 0,
583
- neg = void 0,
584
- num = void 0,
585
- output = void 0,
586
- round = void 0,
587
- unix = void 0,
588
- separator = void 0,
589
- spacer = void 0,
590
- standard = void 0,
591
- symbols = void 0;
595
+ e,
596
+ base,
597
+ bits,
598
+ ceil,
599
+ full,
600
+ fullforms,
601
+ locale,
602
+ localeOptions,
603
+ neg,
604
+ num,
605
+ output,
606
+ pad,
607
+ round,
608
+ u,
609
+ unix,
610
+ separator,
611
+ spacer,
612
+ standard,
613
+ symbols,
614
+ roundingFunc,
615
+ precision;
592
616
 
593
617
  if (isNaN(arg)) {
594
618
  throw new TypeError("Invalid number");
@@ -596,6 +620,7 @@ var filesize = createCommonjsModule(function (module, exports) {
596
620
 
597
621
  bits = descriptor.bits === true;
598
622
  unix = descriptor.unix === true;
623
+ pad = descriptor.pad === true;
599
624
  base = descriptor.base || 2;
600
625
  round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
601
626
  locale = descriptor.locale !== void 0 ? descriptor.locale : "";
@@ -608,9 +633,11 @@ var filesize = createCommonjsModule(function (module, exports) {
608
633
  full = descriptor.fullform === true;
609
634
  fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
610
635
  e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
636
+ roundingFunc = roundingFuncs[descriptor.roundingMethod] || Math.round;
611
637
  num = Number(arg);
612
638
  neg = num < 0;
613
- ceil = base > 2 ? 1000 : 1024; // Flipping a negative number to determine the size
639
+ ceil = base > 2 ? 1000 : 1024;
640
+ precision = isNaN(descriptor.precision) === false ? parseInt(descriptor.precision, 10) : 0; // Flipping a negative number to determine the size
614
641
 
615
642
  if (neg) {
616
643
  num = -num;
@@ -627,6 +654,10 @@ var filesize = createCommonjsModule(function (module, exports) {
627
654
 
628
655
 
629
656
  if (e > 8) {
657
+ if (precision > 0) {
658
+ precision += 8 - e;
659
+ }
660
+
630
661
  e = 8;
631
662
  }
632
663
 
@@ -637,7 +668,7 @@ var filesize = createCommonjsModule(function (module, exports) {
637
668
 
638
669
  if (num === 0) {
639
670
  result[0] = 0;
640
- result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
671
+ u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
641
672
  } else {
642
673
  val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
643
674
 
@@ -650,14 +681,15 @@ var filesize = createCommonjsModule(function (module, exports) {
650
681
  }
651
682
  }
652
683
 
653
- result[0] = Number(val.toFixed(e > 0 ? round : 0));
684
+ var p = Math.pow(10, e > 0 ? round : 0);
685
+ result[0] = roundingFunc(val * p) / p;
654
686
 
655
687
  if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
656
688
  result[0] = 1;
657
689
  e++;
658
690
  }
659
691
 
660
- result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
692
+ u = result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
661
693
 
662
694
  if (unix) {
663
695
  result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
@@ -672,6 +704,11 @@ var filesize = createCommonjsModule(function (module, exports) {
672
704
 
673
705
  if (neg) {
674
706
  result[0] = -result[0];
707
+ } // Setting optional precision
708
+
709
+
710
+ if (precision > 0) {
711
+ result[0] = result[0].toPrecision(precision);
675
712
  } // Applying custom symbol
676
713
 
677
714
 
@@ -683,26 +720,28 @@ var filesize = createCommonjsModule(function (module, exports) {
683
720
  result[0] = result[0].toLocaleString(locale, localeOptions);
684
721
  } else if (separator.length > 0) {
685
722
  result[0] = result[0].toString().replace(".", separator);
686
- } // Returning Array, Object, or String (default)
687
-
723
+ }
688
724
 
689
- if (output === "array") {
690
- return result;
725
+ if (pad && Number.isInteger(result[0]) === false && round > 0) {
726
+ var x = separator || ".",
727
+ tmp = result[0].toString().split(x),
728
+ s = tmp[1] || "",
729
+ l = s.length,
730
+ n = round - l;
731
+ result[0] = "".concat(tmp[0]).concat(x).concat(s.padEnd(l + n, "0"));
691
732
  }
692
733
 
693
734
  if (full) {
694
735
  result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
695
- }
736
+ } // Returning Array, Object, or String (default)
696
737
 
697
- if (output === "object") {
698
- return {
699
- value: result[0],
700
- symbol: result[1],
701
- exponent: e
702
- };
703
- }
704
738
 
705
- return result.join(spacer);
739
+ return output === "array" ? result : output === "object" ? {
740
+ value: result[0],
741
+ symbol: result[1],
742
+ exponent: e,
743
+ unit: u
744
+ } : result.join(spacer);
706
745
  } // Partial application for functional programming
707
746
 
708
747
 
@@ -710,13 +749,10 @@ var filesize = createCommonjsModule(function (module, exports) {
710
749
  return function (arg) {
711
750
  return filesize(arg, opt);
712
751
  };
713
- }; // CommonJS, AMD, script tag
714
-
752
+ };
715
753
 
716
- {
717
- module.exports = filesize;
718
- }
719
- })();
754
+ return filesize;
755
+ });
720
756
  });
721
757
 
722
758
  var _CONSTANT_TIMEBASES;
@@ -1355,6 +1391,7 @@ var parseKeyValuePairType = function parseKeyValuePairType() {
1355
1391
  return keyValuePairType.reduce(keyValuePairTypeReducer, {});
1356
1392
  };
1357
1393
 
1394
+ var _excluded$1 = ["property"];
1358
1395
  var sampleRateSymbols = {
1359
1396
  kB: 'kHz',
1360
1397
  B: 'Hz',
@@ -1389,7 +1426,7 @@ var parseBaseMediaInfoType = function parseBaseMediaInfoType() {
1389
1426
  var baseMediaInfoType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1390
1427
 
1391
1428
  var keyValuePairType = baseMediaInfoType.property,
1392
- props = _objectWithoutProperties(baseMediaInfoType, ["property"]);
1429
+ props = _objectWithoutProperties(baseMediaInfoType, _excluded$1);
1393
1430
 
1394
1431
  var parsedKeyValuePairType = parseKeyValuePairType(keyValuePairType);
1395
1432
  return _objectSpread2(_objectSpread2({}, parsedKeyValuePairType), props);
@@ -1688,6 +1725,9 @@ var parseShapeType = function parseShapeType() {
1688
1725
  return parsedShape;
1689
1726
  };
1690
1727
 
1728
+ var _excluded$2 = ["Codec"],
1729
+ _excluded2$1 = ["Codec"];
1730
+
1691
1731
  var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetType) {
1692
1732
  var output = {};
1693
1733
  var description = transcodePresetType.description,
@@ -1714,7 +1754,7 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetTy
1714
1754
  CodecSettings = _VideoDescription$Cod === void 0 ? {} : _VideoDescription$Cod;
1715
1755
 
1716
1756
  var Codec = CodecSettings.Codec,
1717
- otherSettings = _objectWithoutProperties(CodecSettings, ["Codec"]);
1757
+ otherSettings = _objectWithoutProperties(CodecSettings, _excluded$2);
1718
1758
 
1719
1759
  output.videoFormat = Codec;
1720
1760
  var height = VideoDescription.Height,
@@ -1755,7 +1795,7 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetTy
1755
1795
  _CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
1756
1796
 
1757
1797
  var _Codec = _CodecSettings.Codec,
1758
- _otherSettings = _objectWithoutProperties(_CodecSettings, ["Codec"]);
1798
+ _otherSettings = _objectWithoutProperties(_CodecSettings, _excluded2$1);
1759
1799
 
1760
1800
  output.audioFormat = _Codec;
1761
1801
 
@@ -1896,6 +1936,9 @@ var createFacetType = function createFacetType() {
1896
1936
  });
1897
1937
  }; // eslint-disable-next-line import/prefer-default-export
1898
1938
 
1939
+ var _excluded$3 = ["groupName"],
1940
+ _excluded2$2 = ["start", "end"];
1941
+
1899
1942
  /* eslint-disable import/prefer-default-export */
1900
1943
  var parseValueList$1 = function parseValueList(value) {
1901
1944
  if (value === undefined) return [];
@@ -1993,7 +2036,7 @@ var parseGroupsOrFields = function parseGroupsOrFields(groupsOrFields) {
1993
2036
  } else if (Array.isArray(value)) {
1994
2037
  value.forEach(function (_ref4) {
1995
2038
  var groupName = _ref4.groupName,
1996
- groupValue = _objectWithoutProperties(_ref4, ["groupName"]);
2039
+ groupValue = _objectWithoutProperties(_ref4, _excluded$3);
1997
2040
 
1998
2041
  // eslint-disable-next-line no-use-before-define
1999
2042
  group.push(parseGroup$1({
@@ -2020,7 +2063,7 @@ var parseTimeSpan = function parseTimeSpan(timeSpan) {
2020
2063
  start = _timeSpan$start === void 0 ? '-INF' : _timeSpan$start,
2021
2064
  _timeSpan$end = timeSpan.end,
2022
2065
  end = _timeSpan$end === void 0 ? '+INF' : _timeSpan$end,
2023
- groupsOrFields = _objectWithoutProperties(timeSpan, ["start", "end"]);
2066
+ groupsOrFields = _objectWithoutProperties(timeSpan, _excluded2$2);
2024
2067
 
2025
2068
  var _parseGroupsOrFields2 = parseGroupsOrFields(groupsOrFields),
2026
2069
  group = _parseGroupsOrFields2.group,