@vidispine/vdt-js 22.4.0-pre.9 → 23.1.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.js CHANGED
@@ -9,7 +9,7 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
9
9
  var _typeof = require('@babel/runtime/helpers/typeof');
10
10
  var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
11
11
  var _createClass = require('@babel/runtime/helpers/createClass');
12
- var parseFileSize = require('filesize');
12
+ var filesize = require('filesize');
13
13
 
14
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
15
 
@@ -20,30 +20,24 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
20
20
  var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
21
21
  var _classCallCheck__default = /*#__PURE__*/_interopDefaultLegacy(_classCallCheck);
22
22
  var _createClass__default = /*#__PURE__*/_interopDefaultLegacy(_createClass);
23
- var parseFileSize__default = /*#__PURE__*/_interopDefaultLegacy(parseFileSize);
24
23
 
25
24
  var gcd = function gcd(a, b) {
26
25
  return b ? gcd(b, a % b) : a;
27
26
  };
28
-
29
27
  var parseAspectRatio = function parseAspectRatio(aspectRatio) {
30
28
  var _ref = aspectRatio || {},
31
- width = _ref.width,
32
- height = _ref.height;
33
-
29
+ width = _ref.width,
30
+ height = _ref.height;
34
31
  if (width === undefined || height === undefined) {
35
32
  return undefined;
36
33
  }
37
-
38
34
  var denominator = gcd(width, height);
39
35
  var widthRatio = width / denominator;
40
36
  var heightRatio = height / denominator;
41
-
42
37
  if (widthRatio > 21) {
43
38
  heightRatio = 1;
44
39
  widthRatio = (width / height).toFixed(2);
45
40
  }
46
-
47
41
  return [widthRatio, heightRatio].join(':');
48
42
  };
49
43
 
@@ -57,13 +51,13 @@ var parseAspectRatio = function parseAspectRatio(aspectRatio) {
57
51
  var parseKeyValuePairTypes = function parseKeyValuePairTypes(keyValuePairTypes) {
58
52
  return Object.fromEntries(keyValuePairTypes.map(function (_ref) {
59
53
  var key = _ref.key,
60
- value = _ref.value;
54
+ value = _ref.value;
61
55
  return [key, value];
62
56
  }));
63
57
  };
64
58
 
65
59
  /**
66
- * Object with all name of roles in VidiCore
60
+ * Const object with VidiCore role names
67
61
  *
68
62
  * @category Auth
69
63
  */
@@ -179,114 +173,96 @@ var ROLE_NAMES = {
179
173
  VXA_READ: '_vxa_read'
180
174
  };
181
175
 
182
- var SHARED_ATTRIBUTE_KEYS = ['uuid', 'user', 'timestamp', 'change', 'conflict', 'mode'];
183
- var SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS = ['name', 'id', 'referenced', 'data', 'inheritance'];
184
176
  /**
185
- * Array with all available metadata group attributes
177
+ * Array with all available VidiCore system/default field group names
186
178
  *
187
179
  * @category Metadata
188
180
  */
181
+ var SYSTEM_FIELDGROUPS = ['stl_subtitle', 'stl_tti', 'stl_gsi', 'mrk_marker', 'pho_validation', 'pho_resource', 'pho_error', 'facedetect_rect', 'facedetect_face', 'originalTrackFilename', 'stl_gsiHeader'];
189
182
 
190
- var GROUP_ATTRIBUTE_KEYS = [].concat(SHARED_ATTRIBUTE_KEYS, SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS, ['cycle', 'field', 'group']);
191
183
  /**
192
- * Array with all available metadata group attributes
184
+ * Array with all available VidiCore system/default field names (including transient)
193
185
  *
194
186
  * @category Metadata
195
187
  */
188
+ var SYSTEM_FIELDS = ['title', 'user', 'shapeTag', 'representativeThumbnail', 'representativeThumbnailNoAuth', 'representativeItems', 'itemId', 'collectionId', 'mediaType', 'mimeType', 'created', 'startTimeCode', 'startSeconds', 'fieldValidationError', 'schemaValidationError', 'originalFilename', 'originalUri', 'originalAudioCodec', 'originalVideoCodec', 'originalHeight', 'originalWidth', 'originalFormat', 'durationSeconds', 'durationTimeCode', 'solr-index', '__user', '__collection', '__collection_size', '__ancestor_collection', '__ancestor_collection_size', '__shape', '__shape_size', '__shape_last_added', '__placeholder_shape_size', '__version', '__version_count', '__storage', '__storage_size', '__shapetag_{tag}_hash_{hash}', '__storage_{tag}', '__storage_{tag}_size', '__storagegroup', '__storagegroup_size', '__sequence', '__sequence_size', '__metadata_last_modified', '__external_id', '__deletion_lock_id', '__deletion_lock_expiry', '__child_collection', '__child_collection_size', '__parent_collection', '__parent_collection_size', '__items_size', 'stl_text', 'stl_justification', 'stl_xrelative', 'stl_yrelative', 'stl_vertical', 'stl_verticalbase', 'stl_horizontalbase', 'stl_sizerelative', 'stl_color', 'stl_outline', 'stl_outlinecolor', 'stl_outlinesize', 'stl_font', 'stl_service', 'stl_tti', 'stl_gsi', 'cct', 'tcd', 'tcf', 'oet', 'cd', 'mnc', 'cpn', 'dfc', 'tcp', 'tcs', 'tet', 'tnb', 'tnd', 'en', 'co', 'tng', 'rd', 'mnr', 'dsc', 'opt', 'lc', 'tpt', 'tn', 'slr', 'tns', 'rn', 'pub', 'dsn', 'ecd', 'mrk_zerolength', 'mrk_text', 'mrk_color', 'pho_resource_name', 'pho_error_level', 'pho_error_code', 'pho_error_description', 'facedetect_rect_width', 'facedetect_rect_height', 'facedetect_rect_y', 'facedetect_rect_x', 'facedetect_pid', 'facedetect_rect', 'trackId', 'eidr_actor', 'eidr_alternateId', 'eidr_countryOfOrigin', 'eidr_director', 'eidr_id', 'eidr_referentType', 'eidr_releaseDate', 'eidr_resourceName', 'eidr_status', 'eidr_sync', 'ttml_div', 'ttml_root', 'vxa_collection_id', 'vxaId', 'vxaLocalPath', 'tco', 'cs', 'ebn', 'tf', 'cf', 'sgn', 'tci', 'jc', 'vp', 'sn'];
189
+
190
+ var SHARED_ATTRIBUTE_KEYS = ['uuid', 'user', 'timestamp', 'change', 'conflict', 'mode'];
191
+ var SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS = ['name', 'id', 'referenced', 'data', 'inheritance'];
196
192
 
197
- var FIELD_ATTRIBUTE_KEYS = [].concat(SHARED_ATTRIBUTE_KEYS, SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS, ['value', 'reference', 'type', 'track']);
198
193
  /**
199
194
  * Array with all available metadata field value attributes
200
195
  *
201
196
  * @category Metadata
202
197
  */
203
-
204
- var FIELD_VALUE_ATTRIBUTE_KEYS = [].concat(SHARED_ATTRIBUTE_KEYS, ['value', 'lang']);
198
+ var FIELD_VALUE_ATTRIBUTE_KEYS = [].concat(_toConsumableArray__default["default"](SHARED_ATTRIBUTE_KEYS), ['value', 'lang']);
205
199
 
206
200
  /**
207
- * Array with all available VidiCore system/default field group names
201
+ * Array with all available metadata field attributes
208
202
  *
209
203
  * @category Metadata
210
204
  */
211
- var SYSTEM_FIELDGROUPS = ['stl_subtitle', 'stl_tti', 'stl_gsi', 'mrk_marker', 'pho_validation', 'pho_resource', 'pho_error', 'facedetect_rect', 'facedetect_face', 'originalTrackFilename', 'stl_gsiHeader'];
205
+ var FIELD_ATTRIBUTE_KEYS = [].concat(_toConsumableArray__default["default"](SHARED_ATTRIBUTE_KEYS), _toConsumableArray__default["default"](SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS), ['value', 'reference', 'type', 'track']);
206
+
212
207
  /**
213
- * Array with all available VidiCore system/default field group names
208
+ * Array with all available metadata group attributes
214
209
  *
215
210
  * @category Metadata
216
211
  */
217
-
218
- var SYSTEM_FIELDS = ['title', 'user', 'shapeTag', 'representativeThumbnail', 'representativeThumbnailNoAuth', 'representativeItems', 'itemId', 'collectionId', 'mediaType', 'mimeType', 'created', 'startTimeCode', 'startSeconds', 'fieldValidationError', 'schemaValidationError', 'originalFilename', 'originalUri', 'originalAudioCodec', 'originalVideoCodec', 'originalHeight', 'originalWidth', 'originalFormat', 'durationSeconds', 'durationTimeCode', 'solr-index', '__user', '__collection', '__collection_size', '__ancestor_collection', '__ancestor_collection_size', '__shape', '__shape_size', '__shape_last_added', '__placeholder_shape_size', '__version', '__version_count', '__storage', '__storage_size', '__shapetag_{tag}_hash_{hash}', '__storage_{tag}', '__storage_{tag}_size', '__storagegroup', '__storagegroup_size', '__sequence', '__sequence_size', '__metadata_last_modified', '__external_id', '__deletion_lock_id', '__deletion_lock_expiry', '__child_collection', '__child_collection_size', '__parent_collection', '__parent_collection_size', '__items_size', 'stl_text', 'stl_justification', 'stl_xrelative', 'stl_yrelative', 'stl_vertical', 'stl_verticalbase', 'stl_horizontalbase', 'stl_sizerelative', 'stl_color', 'stl_outline', 'stl_outlinecolor', 'stl_outlinesize', 'stl_font', 'stl_service', 'stl_tti', 'stl_gsi', 'cct', 'tcd', 'tcf', 'oet', 'cd', 'mnc', 'cpn', 'dfc', 'tcp', 'tcs', 'tet', 'tnb', 'tnd', 'en', 'co', 'tng', 'rd', 'mnr', 'dsc', 'opt', 'lc', 'tpt', 'tn', 'slr', 'tns', 'rn', 'pub', 'dsn', 'ecd', 'mrk_zerolength', 'mrk_text', 'mrk_color', 'pho_resource_name', 'pho_error_level', 'pho_error_code', 'pho_error_description', 'facedetect_rect_width', 'facedetect_rect_height', 'facedetect_rect_y', 'facedetect_rect_x', 'facedetect_pid', 'facedetect_rect', 'trackId', 'eidr_actor', 'eidr_alternateId', 'eidr_countryOfOrigin', 'eidr_director', 'eidr_id', 'eidr_referentType', 'eidr_releaseDate', 'eidr_resourceName', 'eidr_status', 'eidr_sync', 'ttml_div', 'ttml_root', 'vxa_collection_id', 'vxaId', 'vxaLocalPath', 'tco', 'cs', 'ebn', 'tf', 'cf', 'sgn', 'tci', 'jc', 'vp', 'sn'];
212
+ var GROUP_ATTRIBUTE_KEYS = [].concat(_toConsumableArray__default["default"](SHARED_ATTRIBUTE_KEYS), _toConsumableArray__default["default"](SHARED_FIELD_AND_GROUP_ATTRIBUTE_KEYS), ['cycle', 'field', 'group']);
219
213
 
220
214
  var _excluded$e = ["value"],
221
- _excluded2$2 = ["start", "end", "base"];
222
-
215
+ _excluded2$2 = ["start", "end", "base"];
223
216
  function ownKeys$i(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
224
-
225
217
  function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$i(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
226
-
227
218
  var isValueObject = function isValueObject(o) {
228
219
  return Object.prototype.toString.call(o) === '[object Object]' && o.value !== undefined;
229
220
  };
230
-
231
221
  var isFieldType = function isFieldType(v) {
232
222
  return ['string', 'boolean', 'number'].includes(_typeof__default["default"](v));
233
223
  };
234
-
235
224
  var isFieldObject = function isFieldObject(o) {
236
225
  return isValueObject(o) && ((o === null || o === void 0 ? void 0 : o.value) === null || isValueObject(o.value) || isFieldType(o.value));
237
226
  };
238
-
239
227
  var isObject = function isObject(o) {
240
228
  return Object.prototype.toString.call(o) === '[object Object]';
241
229
  };
242
-
243
230
  var isDate = function isDate(o) {
244
231
  return Object.prototype.toString.call(o) === '[object Date]';
245
232
  };
246
-
247
233
  var isField = function isField(value) {
248
234
  if (value === null) {
249
235
  return true;
250
236
  }
251
-
252
237
  if (Array.isArray(value)) {
253
238
  return value.some(isField);
254
239
  }
255
-
256
240
  return isFieldType(value) || isFieldObject(value) || isDate(value);
257
241
  };
258
-
259
242
  var isGroup = function isGroup(value) {
260
243
  var isGroupObject = function isGroupObject(v) {
261
244
  return isObject(v) && v.value === undefined && !!Object.entries(value);
262
245
  };
263
-
264
246
  if (Array.isArray(value)) {
265
247
  return value.every(isGroup);
266
248
  }
267
-
268
249
  return isGroupObject(value);
269
250
  };
270
-
271
251
  var tryPluralize = function tryPluralize(str, arr) {
272
252
  return str + (arr.length > 1 ? 's' : '');
273
253
  };
274
-
275
254
  var ensureKeysAreValid = function ensureKeysAreValid(keysToCheck, keysToMatch) {
276
255
  var unsupportedKeys = keysToCheck.filter(function (k) {
277
256
  return !keysToMatch.includes(k);
278
257
  });
279
-
280
258
  if (unsupportedKeys.length) {
281
259
  throw Error("Unsupported ".concat(tryPluralize('key', unsupportedKeys), " (").concat(unsupportedKeys.join(', '), ")"));
282
260
  }
283
261
  };
284
-
285
262
  var parseValue$1 = function parseValue(value) {
286
263
  if (Array.isArray(value)) {
287
264
  throw Error('Invalid value inside value object, cannot be array');
288
265
  }
289
-
290
266
  if ([undefined, null].includes(value)) return {};
291
267
  if (isDate(value)) return {
292
268
  value: value.toISOString()
@@ -295,70 +271,55 @@ var parseValue$1 = function parseValue(value) {
295
271
  value: value.toString()
296
272
  };
297
273
  };
298
-
299
274
  var parseValueObject = function parseValueObject(valueObject) {
300
275
  ensureKeysAreValid(Object.keys(valueObject), FIELD_VALUE_ATTRIBUTE_KEYS);
301
-
302
276
  if (Object.keys(valueObject).length === 0) {
303
277
  throw Error('Invalid value object, cannot be empty object');
304
278
  }
305
-
306
279
  if (typeof (valueObject === null || valueObject === void 0 ? void 0 : valueObject.value) === 'string') {
307
280
  return valueObject;
308
281
  }
309
-
310
282
  var parsedValue = parseValue$1(valueObject === null || valueObject === void 0 ? void 0 : valueObject.value);
311
283
  return _objectSpread$i(_objectSpread$i({}, valueObject), parsedValue !== undefined ? parsedValue : {});
312
284
  };
313
-
314
285
  var parseFieldValue = function parseFieldValue(value) {
315
286
  if ([undefined, null].includes(value)) return undefined;
316
287
  if (Array.isArray(value)) return value.flatMap(parseFieldValue);
317
288
  if (isValueObject(value)) return parseValueObject(value);
318
289
  return parseValue$1(value);
319
290
  };
320
-
321
291
  var parseFieldObject = function parseFieldObject(fieldObject) {
322
292
  ensureKeysAreValid(Object.keys(fieldObject), FIELD_ATTRIBUTE_KEYS);
323
293
  var parsedFieldValue = parseFieldValue(fieldObject === null || fieldObject === void 0 ? void 0 : fieldObject.value);
324
-
325
294
  if (parsedFieldValue === undefined) {
326
295
  fieldObject.value;
327
- var fieldObjectWithoutValue = _objectWithoutProperties__default["default"](fieldObject, _excluded$e);
328
-
296
+ var fieldObjectWithoutValue = _objectWithoutProperties__default["default"](fieldObject, _excluded$e);
329
297
  return fieldObjectWithoutValue;
330
298
  }
331
-
332
299
  return _objectSpread$i(_objectSpread$i({}, fieldObject), {}, {
333
300
  value: _toConsumableArray__default["default"](Array.isArray(parsedFieldValue) ? parsedFieldValue : [parsedFieldValue])
334
301
  });
335
302
  };
336
-
337
303
  var parseField$1 = function parseField(field) {
338
304
  if (isFieldObject(field)) {
339
305
  return parseFieldObject(field);
340
306
  }
341
-
342
307
  var parsedFieldValue = parseFieldValue(field);
343
-
344
308
  if (parsedFieldValue === undefined) {
345
309
  return undefined;
346
310
  }
347
-
348
311
  return {
349
312
  value: _toConsumableArray__default["default"](Array.isArray(parsedFieldValue) ? parsedFieldValue : [parsedFieldValue])
350
313
  };
351
314
  };
352
-
353
315
  var parseGroupsAndFields = function parseGroupsAndFields(groupOrField) {
354
316
  var group = [];
355
317
  var field = [];
356
318
  var groupAttributes = {};
357
319
  Object.entries(groupOrField || {}).forEach(function (_ref) {
358
320
  var _ref2 = _slicedToArray__default["default"](_ref, 2),
359
- name = _ref2[0],
360
- value = _ref2[1];
361
-
321
+ name = _ref2[0],
322
+ value = _ref2[1];
362
323
  if (GROUP_ATTRIBUTE_KEYS.includes(name)) {
363
324
  groupAttributes = _objectSpread$i(_objectSpread$i({}, groupAttributes), {}, _defineProperty__default["default"]({}, name, value));
364
325
  } else if (isField(value)) {
@@ -385,20 +346,17 @@ var parseGroupsAndFields = function parseGroupsAndFields(groupOrField) {
385
346
  field: field
386
347
  } : {});
387
348
  };
388
-
389
349
  var parseTimespan$1 = function parseTimespan(timespan) {
390
350
  var _timespan$start = timespan.start,
391
- start = _timespan$start === void 0 ? '-INF' : _timespan$start,
392
- _timespan$end = timespan.end,
393
- end = _timespan$end === void 0 ? '+INF' : _timespan$end,
394
- _timespan$base = timespan.base,
395
- base = _timespan$base === void 0 ? undefined : _timespan$base,
396
- groupsAndFields = _objectWithoutProperties__default["default"](timespan, _excluded2$2);
397
-
351
+ start = _timespan$start === void 0 ? '-INF' : _timespan$start,
352
+ _timespan$end = timespan.end,
353
+ end = _timespan$end === void 0 ? '+INF' : _timespan$end,
354
+ _timespan$base = timespan.base,
355
+ base = _timespan$base === void 0 ? undefined : _timespan$base,
356
+ groupsAndFields = _objectWithoutProperties__default["default"](timespan, _excluded2$2);
398
357
  var _parseGroupsAndFields = parseGroupsAndFields(groupsAndFields),
399
- group = _parseGroupsAndFields.group,
400
- field = _parseGroupsAndFields.field;
401
-
358
+ group = _parseGroupsAndFields.group,
359
+ field = _parseGroupsAndFields.field;
402
360
  return _objectSpread$i(_objectSpread$i(_objectSpread$i({}, group ? {
403
361
  group: group
404
362
  } : {}), field ? {
@@ -410,7 +368,6 @@ var parseTimespan$1 = function parseTimespan(timespan) {
410
368
  base: base
411
369
  } : {});
412
370
  };
413
-
414
371
  /**
415
372
  * Create a VidiCore metadata object from a more dense/simplified structure
416
373
  *
@@ -442,23 +399,18 @@ var createMetadataType = function createMetadataType(input) {
442
399
  */
443
400
  var sortTimespanList = function sortTimespanList(timespan1, timespan2) {
444
401
  var _timespan1$start, _timespan2$start;
445
-
446
402
  var _ref = (timespan1 === null || timespan1 === void 0 ? void 0 : (_timespan1$start = timespan1.start) === null || _timespan1$start === void 0 ? void 0 : _timespan1$start.split('@')) || [],
447
- _ref2 = _slicedToArray__default["default"](_ref, 1),
448
- firstStart = _ref2[0];
449
-
403
+ _ref2 = _slicedToArray__default["default"](_ref, 1),
404
+ firstStart = _ref2[0];
450
405
  var _ref3 = (timespan2 === null || timespan2 === void 0 ? void 0 : (_timespan2$start = timespan2.start) === null || _timespan2$start === void 0 ? void 0 : _timespan2$start.split('@')) || [],
451
- _ref4 = _slicedToArray__default["default"](_ref3, 1),
452
- secondStart = _ref4[0];
453
-
406
+ _ref4 = _slicedToArray__default["default"](_ref3, 1),
407
+ secondStart = _ref4[0];
454
408
  if (Number(firstStart) < Number(secondStart)) {
455
409
  return -1;
456
410
  }
457
-
458
411
  if (Number(firstStart) > Number(secondStart)) {
459
412
  return 1;
460
413
  }
461
-
462
414
  return 0;
463
415
  };
464
416
 
@@ -470,10 +422,10 @@ var sortTimespanList = function sortTimespanList(timespan1, timespan2) {
470
422
  * @param v value to return as array
471
423
  * @returns input value wrapped as array
472
424
  */
473
-
474
425
  var asArray = function asArray(v) {
475
426
  return Array.isArray(v) ? v : v && [v] || [];
476
427
  };
428
+
477
429
  /**
478
430
  * @private
479
431
  *
@@ -482,10 +434,10 @@ var asArray = function asArray(v) {
482
434
  * @param v value to return as array
483
435
  * @returns input value wrapped as array
484
436
  */
485
-
486
437
  var asSingle = function asSingle(v) {
487
438
  return Array.isArray(v) ? v.pop() : v;
488
439
  };
440
+
489
441
  /**
490
442
  * @private
491
443
  * Check if array is string array (+ type guard)
@@ -493,7 +445,6 @@ var asSingle = function asSingle(v) {
493
445
  * @param arr Array to check if string array
494
446
  * @returns true if string array
495
447
  */
496
-
497
448
  var isStringArray = function isStringArray(arr) {
498
449
  return (arr === null || arr === void 0 ? void 0 : arr.every(function (v) {
499
450
  return typeof v === 'string';
@@ -501,14 +452,12 @@ var isStringArray = function isStringArray(arr) {
501
452
  };
502
453
 
503
454
  var _excluded$d = ["value"];
504
-
505
455
  function ownKeys$h(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
506
-
507
456
  function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
508
-
509
457
  var defaultOptions$a = {
510
458
  includeValueAttributes: false
511
459
  };
460
+
512
461
  /**
513
462
  * @internal
514
463
  * Parse the value object inside a field value list
@@ -517,22 +466,17 @@ var defaultOptions$a = {
517
466
  * @param options For how to parse the value object
518
467
  * @returns The parsed value
519
468
  */
520
-
521
469
  function parseValue(value, options) {
522
470
  var _defaultOptions = _objectSpread$h(_objectSpread$h({}, defaultOptions$a), options || {}),
523
- includeValueAttributes = _defaultOptions.includeValueAttributes;
524
-
471
+ includeValueAttributes = _defaultOptions.includeValueAttributes;
525
472
  if (includeValueAttributes === false) {
526
473
  return value === null || value === void 0 ? void 0 : value.value;
527
474
  }
528
-
529
475
  var stringValue = value.value,
530
- attributes = _objectWithoutProperties__default["default"](value, _excluded$d);
531
-
476
+ attributes = _objectWithoutProperties__default["default"](value, _excluded$d);
532
477
  var valueAttributes = includeValueAttributes === true && attributes || Array.isArray(includeValueAttributes) && Object.fromEntries(Object.entries(attributes).filter(function (_ref) {
533
478
  var _ref2 = _slicedToArray__default["default"](_ref, 1),
534
- key = _ref2[0];
535
-
479
+ key = _ref2[0];
536
480
  return includeValueAttributes.includes(key);
537
481
  })) || {};
538
482
  return _objectSpread$h(_objectSpread$h({}, valueAttributes), {}, {
@@ -541,14 +485,13 @@ function parseValue(value, options) {
541
485
  }
542
486
 
543
487
  var _excluded$c = ["joinValue", "arrayOnSingleValue"];
544
-
545
488
  function ownKeys$g(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
546
-
547
489
  function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
548
490
  var defaultOptions$9 = _objectSpread$g(_objectSpread$g({}, defaultOptions$a), {}, {
549
491
  joinValue: undefined,
550
492
  arrayOnSingleValue: true
551
493
  });
494
+
552
495
  /**
553
496
  * @internal
554
497
  *
@@ -556,13 +499,11 @@ var defaultOptions$9 = _objectSpread$g(_objectSpread$g({}, defaultOptions$a), {}
556
499
  * @param options
557
500
  * @returns
558
501
  */
559
-
560
502
  function parseValueList(valueList, options) {
561
503
  var _defaultOptions = _objectSpread$g(_objectSpread$g({}, defaultOptions$9), options || {}),
562
- joinValue = _defaultOptions.joinValue,
563
- arrayOnSingleValue = _defaultOptions.arrayOnSingleValue,
564
- parseValueOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$c);
565
-
504
+ joinValue = _defaultOptions.joinValue,
505
+ arrayOnSingleValue = _defaultOptions.arrayOnSingleValue,
506
+ parseValueOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$c);
566
507
  var parsedValueList = valueList === null || valueList === void 0 ? void 0 : valueList.map(function (v) {
567
508
  return parseValue(v, parseValueOptions);
568
509
  });
@@ -572,14 +513,13 @@ function parseValueList(valueList, options) {
572
513
  }
573
514
 
574
515
  var _excluded$b = ["includeFieldAttributes"],
575
- _excluded2$1 = ["value"];
576
-
516
+ _excluded2$1 = ["value"];
577
517
  function ownKeys$f(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
578
-
579
518
  function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
580
519
  var defaultOptions$8 = _objectSpread$f({
581
520
  includeFieldAttributes: false
582
521
  }, defaultOptions$9);
522
+
583
523
  /**
584
524
  * @internal
585
525
  *
@@ -587,20 +527,16 @@ var defaultOptions$8 = _objectSpread$f({
587
527
  * @param options
588
528
  * @returns
589
529
  */
590
-
591
530
  var parseField = function parseField(field, options) {
592
531
  var _defaultOptions = _objectSpread$f(_objectSpread$f({}, defaultOptions$8), options || {}),
593
- includeFieldAttributes = _defaultOptions.includeFieldAttributes,
594
- parseValueListOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$b);
595
-
532
+ includeFieldAttributes = _defaultOptions.includeFieldAttributes,
533
+ parseValueListOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$b);
596
534
  var value = field.value,
597
- attributes = _objectWithoutProperties__default["default"](field, _excluded2$1);
598
-
535
+ attributes = _objectWithoutProperties__default["default"](field, _excluded2$1);
599
536
  var parsedValueList = parseValueList(value, parseValueListOptions);
600
537
  var fieldAttributes = includeFieldAttributes === true && attributes || Array.isArray(includeFieldAttributes) && Object.fromEntries(Object.entries(attributes).filter(function (_ref) {
601
538
  var _ref2 = _slicedToArray__default["default"](_ref, 1),
602
- key = _ref2[0];
603
-
539
+ key = _ref2[0];
604
540
  return includeFieldAttributes.includes(key);
605
541
  })) || {};
606
542
  return includeFieldAttributes ? _objectSpread$f(_objectSpread$f({}, fieldAttributes), {}, {
@@ -609,25 +545,22 @@ var parseField = function parseField(field, options) {
609
545
  };
610
546
 
611
547
  function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
612
-
613
548
  function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
614
549
  var defaultOptions$7 = _objectSpread$e(_objectSpread$e({}, defaultOptions$8), {}, {
615
550
  fieldAsList: false,
616
551
  arrayOnSingleField: false,
617
552
  overrideField: undefined
618
553
  });
619
-
620
554
  /**
621
555
  * Parse a metadata field list according to selected options
622
556
  *
623
557
  * @remarks
624
- * Duplicate fields (same field name in the same field list) are usually not the data model we'd advise using.
625
- * Since VidiCore supports multiple values in one fields, it's typically advised to store them as such.
626
- * But, given duplicated fields when parsing it will:
627
- * - with default options, merge duplicated field values to one field value array
628
- * - with `fieldAsList` enabled, separate fields in the list/array (as usual, even if not duplicate)
629
- * - with `includeFieldAttributes` enabled, return an array of field objects
630
- * - with `overrideField` enabled - Override so it returns the latest "duplicated" field it parses
558
+ * When parsing duplicate fields (same field name in the same field list) it will:
559
+ * - with default options: combine field values to one array within the same field name key
560
+ * - with `joinValue` enabled: join values within each field (returns array with string for each field value)
561
+ * - with `fieldAsList` enabled: separate fields in the list/array (as usual, even if not duplicate)
562
+ * - with `includeFieldAttributes` enabled: return an array of field objects
563
+ * - with `overrideField` enabled: return the latest duplicated field it parses
631
564
  *
632
565
  * @param fieldList Field list to parse
633
566
  * @param [options=defaultOptions] Options for how to parse the field list
@@ -637,10 +570,9 @@ var defaultOptions$7 = _objectSpread$e(_objectSpread$e({}, defaultOptions$8), {}
637
570
  */
638
571
  var parseFieldList = function parseFieldList(fieldList, options) {
639
572
  var parseFieldListOptions = _objectSpread$e(_objectSpread$e({}, defaultOptions$7), options || {});
640
-
641
573
  var fieldAsList = parseFieldListOptions.fieldAsList,
642
- arrayOnSingleField = parseFieldListOptions.arrayOnSingleField,
643
- overrideField = parseFieldListOptions.overrideField;
574
+ arrayOnSingleField = parseFieldListOptions.arrayOnSingleField,
575
+ overrideField = parseFieldListOptions.overrideField;
644
576
  var shouldOverride = overrideField === true && fieldAsList === false;
645
577
  var output = {};
646
578
  fieldList === null || fieldList === void 0 ? void 0 : fieldList.forEach(function (field) {
@@ -654,18 +586,14 @@ var parseFieldList = function parseFieldList(fieldList, options) {
654
586
  };
655
587
 
656
588
  var _excluded$a = ["field", "group"];
657
-
658
589
  function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
659
-
660
590
  function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
661
-
662
591
  var defaultParseGroupOptions = _objectSpread$d(_objectSpread$d({}, defaultOptions$7), {}, {
663
592
  includeGroupAttributes: false,
664
593
  groupAsList: false,
665
594
  arrayOnSingleGroup: false,
666
595
  overrideGroup: undefined
667
596
  });
668
-
669
597
  /**
670
598
  * @internal
671
599
  *
@@ -677,26 +605,21 @@ var defaultParseGroupOptions = _objectSpread$d(_objectSpread$d({}, defaultOption
677
605
  */
678
606
  var parseGroup = function parseGroup(group, options) {
679
607
  var parseGroupOptions = _objectSpread$d(_objectSpread$d({}, defaultParseGroupOptions), options || {});
680
-
681
608
  var includeGroupAttributes = parseGroupOptions.includeGroupAttributes;
682
609
  var parseFieldListOptions = Object.fromEntries(Object.entries(parseGroupOptions).filter(function (_ref) {
683
610
  var _ref2 = _slicedToArray__default["default"](_ref, 1),
684
- key = _ref2[0];
685
-
611
+ key = _ref2[0];
686
612
  return Object.keys(defaultOptions$7).includes(key);
687
613
  }));
688
-
689
614
  var fieldList = group.field,
690
- groupList = group.group,
691
- attributes = _objectWithoutProperties__default["default"](group, _excluded$a);
692
-
693
- var parsedFieldList = fieldList && parseFieldList(fieldList, parseFieldListOptions); // eslint-disable-next-line @typescript-eslint/no-use-before-define
694
-
615
+ groupList = group.group,
616
+ attributes = _objectWithoutProperties__default["default"](group, _excluded$a);
617
+ var parsedFieldList = fieldList && parseFieldList(fieldList, parseFieldListOptions);
618
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
695
619
  var parsedGroupList = groupList && parseGroupList(groupList, parseGroupOptions);
696
620
  var groupAttributes = includeGroupAttributes === true && attributes || Array.isArray(includeGroupAttributes) && Object.fromEntries(Object.entries(attributes).filter(function (_ref3) {
697
621
  var _ref4 = _slicedToArray__default["default"](_ref3, 1),
698
- key = _ref4[0];
699
-
622
+ key = _ref4[0];
700
623
  return includeGroupAttributes.includes(key);
701
624
  })) || {};
702
625
  return _objectSpread$d(_objectSpread$d(_objectSpread$d({}, groupAttributes), parseFieldListOptions !== null && parseFieldListOptions !== void 0 && parseFieldListOptions.fieldAsList ? parsedFieldList && {
@@ -705,16 +628,16 @@ var parseGroup = function parseGroup(group, options) {
705
628
  group: parsedGroupList
706
629
  } || {} : parsedGroupList);
707
630
  };
708
-
709
631
  var defaultOptions$6 = defaultParseGroupOptions;
632
+
710
633
  /**
711
634
  * Parse a metadata group list according to selected options
712
635
  *
713
636
  * @remarks
714
- * Parsing duplicate groups (with identical name) in the same group list will return:
715
- * - with default options, an array of group objects
716
- * - with `groupAsList` enabled, separate group objects in the list/array (as usual, even if not duplicate)
717
- * - with `overrideGroup` enabled, return the latest duplicated group it parses
637
+ * Parsing duplicate groups (same group name in the same group list) it will:
638
+ * - with default options: combine group objects to one array within the same group name key
639
+ * - with `groupAsList` enabled: return separate group objects in a list/array (as usual, even if not duplicate)
640
+ * - with `overrideGroup` enabled: return the latest duplicated group it parses
718
641
  *
719
642
  * @param groupList Group list to parse
720
643
  * @param options options for how to parse list
@@ -722,13 +645,11 @@ var defaultOptions$6 = defaultParseGroupOptions;
722
645
  *
723
646
  * @category Metadata
724
647
  */
725
-
726
648
  var parseGroupList = function parseGroupList(groupList, options) {
727
649
  var parseGroupOptions = _objectSpread$d(_objectSpread$d({}, defaultOptions$6), options || {});
728
-
729
650
  var groupAsList = parseGroupOptions.groupAsList,
730
- arrayOnSingleGroup = parseGroupOptions.arrayOnSingleGroup,
731
- overrideGroup = parseGroupOptions.overrideGroup;
651
+ arrayOnSingleGroup = parseGroupOptions.arrayOnSingleGroup,
652
+ overrideGroup = parseGroupOptions.overrideGroup;
732
653
  var shouldOverride = overrideGroup === true && groupAsList === false;
733
654
  var output = {};
734
655
  groupList === null || groupList === void 0 ? void 0 : groupList.forEach(function (group) {
@@ -738,18 +659,14 @@ var parseGroupList = function parseGroupList(groupList, options) {
738
659
  var existingParsedGroups = output[name];
739
660
  if (!existingParsedGroups) output[name] = parsedGroupOutput;else if (shouldOverride) output[name] = parsedGroup;else output[name] = [asArray(existingParsedGroups), asArray(parsedGroup)].flat();
740
661
  });
741
-
742
662
  if (groupAsList) {
743
663
  return Object.values(output).flat();
744
664
  }
745
-
746
665
  return output;
747
666
  };
748
667
 
749
668
  var _excluded$9 = ["field", "group"];
750
-
751
669
  function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
752
-
753
670
  function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$c(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
754
671
  var defaultOptions$5 = _objectSpread$c(_objectSpread$c({}, defaultOptions$6), {}, {
755
672
  includeTimespanAttributes: false,
@@ -759,6 +676,7 @@ var defaultOptions$5 = _objectSpread$c(_objectSpread$c({}, defaultOptions$6), {}
759
676
  arrayOnSingleGroup: undefined,
760
677
  arrayOnSingleField: undefined
761
678
  });
679
+
762
680
  /**
763
681
  *
764
682
  * Parses timespan according to specified options
@@ -774,68 +692,55 @@ var defaultOptions$5 = _objectSpread$c(_objectSpread$c({}, defaultOptions$6), {}
774
692
  *
775
693
  * @category Metadata
776
694
  */
777
-
778
695
  var parseTimespan = function parseTimespan(timespan, options) {
779
696
  var parseTimespanOptions = _objectSpread$c(_objectSpread$c({}, defaultOptions$5), options || {});
780
-
781
697
  var includeTimespanAttributes = parseTimespanOptions.includeTimespanAttributes,
782
- arrayOnSingle = parseTimespanOptions.arrayOnSingle,
783
- flat = parseTimespanOptions.flat;
698
+ arrayOnSingle = parseTimespanOptions.arrayOnSingle,
699
+ flat = parseTimespanOptions.flat;
784
700
  var parseGroupListOptions = Object.fromEntries(Object.entries(options).map(function (_ref) {
785
701
  var _ref2 = _slicedToArray__default["default"](_ref, 2),
786
- key = _ref2[0],
787
- value = _ref2[1];
788
-
702
+ key = _ref2[0],
703
+ value = _ref2[1];
789
704
  if (Object.keys(defaultOptions$6).includes(key)) {
790
705
  if (['arrayOnSingleGroup', 'arrayOnSingleField', 'arrayOnSingleValue'].includes(key) && (value !== undefined ? value : arrayOnSingle === true)) {
791
706
  return [key, true];
792
707
  }
793
-
794
708
  if (['overrideGroup', 'overrideField'].includes(key) && (value !== undefined ? value : flat === true)) {
795
709
  return [key, true];
796
710
  }
797
-
798
711
  return [key, value];
799
712
  }
800
-
801
713
  return undefined;
802
714
  }).filter(function (e) {
803
715
  return !!e;
804
716
  }));
805
717
  var parseFieldListOptions = Object.fromEntries(Object.entries(options).map(function (_ref3) {
806
718
  var _ref4 = _slicedToArray__default["default"](_ref3, 2),
807
- key = _ref4[0],
808
- value = _ref4[1];
809
-
719
+ key = _ref4[0],
720
+ value = _ref4[1];
810
721
  if (Object.keys(defaultOptions$7).includes(key)) {
811
722
  if (['arrayOnSingleField', 'arrayOnSingleValue'].includes(key) && (value !== undefined ? value : arrayOnSingle === true)) {
812
723
  return [key, true];
813
724
  }
814
-
815
725
  if (['overrideField'].includes(key) && (value !== undefined ? value : flat === true)) {
816
726
  return [key, true];
817
727
  }
818
-
819
728
  return [key, value];
820
729
  }
821
-
822
730
  return undefined;
823
731
  }).filter(function (e) {
824
732
  return !!e;
825
733
  }));
826
-
827
734
  var _ref5 = timespan || {},
828
- fieldList = _ref5.field,
829
- groupList = _ref5.group,
830
- attributes = _objectWithoutProperties__default["default"](_ref5, _excluded$9);
831
-
832
- var parsedFieldList = fieldList && parseFieldList(fieldList, parseFieldListOptions); // eslint-disable-next-line @typescript-eslint/no-use-before-define
833
-
735
+ fieldList = _ref5.field,
736
+ groupList = _ref5.group,
737
+ attributes = _objectWithoutProperties__default["default"](_ref5, _excluded$9);
738
+ var parsedFieldList = fieldList && parseFieldList(fieldList, parseFieldListOptions);
739
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
834
740
  var parsedGroupList = groupList && parseGroupList(groupList, parseGroupListOptions);
835
741
  var timespanAttributes = includeTimespanAttributes === true && attributes || Array.isArray(includeTimespanAttributes) && Object.fromEntries(Object.entries(attributes).filter(function (_ref6) {
836
742
  var _ref7 = _slicedToArray__default["default"](_ref6, 1),
837
- key = _ref7[0];
838
-
743
+ key = _ref7[0];
839
744
  return includeTimespanAttributes.includes(key);
840
745
  })) || {};
841
746
  return _objectSpread$c(_objectSpread$c(_objectSpread$c({}, timespanAttributes), parseFieldListOptions !== null && parseFieldListOptions !== void 0 && parseFieldListOptions.fieldAsList ? {
@@ -846,9 +751,7 @@ var parseTimespan = function parseTimespan(timespan, options) {
846
751
  };
847
752
 
848
753
  var _excluded$8 = ["timespanAsList", "joinTimespan", "sortTimespan", "flat", "flatTimespan"];
849
-
850
754
  function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
851
-
852
755
  function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$b(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
853
756
  var defaultOptions$4 = _objectSpread$b(_objectSpread$b({}, defaultOptions$5), {}, {
854
757
  timespanAsList: false,
@@ -869,27 +772,23 @@ var defaultOptions$4 = _objectSpread$b(_objectSpread$b({}, defaultOptions$5), {}
869
772
  *
870
773
  * @category Metadata
871
774
  */
872
-
873
775
  var parseTimespanList = function parseTimespanList(timespanList, options) {
874
776
  var parseTimespanListOptions = _objectSpread$b(_objectSpread$b({}, defaultOptions$4), options || {});
875
-
876
777
  var timespanAsList = parseTimespanListOptions.timespanAsList,
877
- joinTimespan = parseTimespanListOptions.joinTimespan,
878
- sortTimespan = parseTimespanListOptions.sortTimespan,
879
- flat = parseTimespanListOptions.flat,
880
- flatTimespan = parseTimespanListOptions.flatTimespan,
881
- otherOptions = _objectWithoutProperties__default["default"](parseTimespanListOptions, _excluded$8);
882
-
778
+ joinTimespan = parseTimespanListOptions.joinTimespan,
779
+ sortTimespan = parseTimespanListOptions.sortTimespan,
780
+ flat = parseTimespanListOptions.flat,
781
+ flatTimespan = parseTimespanListOptions.flatTimespan,
782
+ otherOptions = _objectWithoutProperties__default["default"](parseTimespanListOptions, _excluded$8);
883
783
  var parseTimespanOptions = _objectSpread$b({
884
784
  flat: flat
885
785
  }, otherOptions);
886
-
887
786
  if (sortTimespan) timespanList.sort(sortTimespanList);
888
787
  var shouldFlatten = (flatTimespan !== undefined ? flatTimespan === true : flat === true) && timespanAsList === false;
889
788
  var output = {};
890
789
  timespanList === null || timespanList === void 0 ? void 0 : timespanList.forEach(function (timespan) {
891
790
  var start = timespan.start,
892
- end = timespan.end;
791
+ end = timespan.end;
893
792
  var key = shouldFlatten ? 'flat' : [start, end].join(joinTimespan);
894
793
  var parsedTimespan = parseTimespan(timespan, parseTimespanOptions);
895
794
  var existingParsedTimespans = output[key];
@@ -901,27 +800,23 @@ var parseTimespanList = function parseTimespanList(timespanList, options) {
901
800
  }
902
801
  } else output[key] = [].concat(_toConsumableArray__default["default"](asArray(existingParsedTimespans)), [parsedTimespan]);
903
802
  });
904
-
905
803
  if (timespanAsList === true) {
906
804
  return Object.values(output);
907
805
  }
908
-
909
806
  if (shouldFlatten) {
910
807
  return Object.values(output).pop();
911
808
  }
912
-
913
809
  return output;
914
810
  };
915
811
 
916
812
  var _excluded$7 = ["timespan"];
917
-
918
813
  function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
919
-
920
814
  function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$a(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
921
815
  var defaultOptions$3 = _objectSpread$a(_objectSpread$a({}, defaultOptions$4), {}, {
922
816
  includeMetadataAttributes: false,
923
817
  flat: false
924
818
  });
819
+
925
820
  /**
926
821
  * Parses MetadataType according to specified options
927
822
  *
@@ -938,31 +833,24 @@ var defaultOptions$3 = _objectSpread$a(_objectSpread$a({}, defaultOptions$4), {}
938
833
  *
939
834
  * @category Metadata
940
835
  */
941
-
942
836
  function parseMetadataType(metadataType, options) {
943
837
  var parseMetadataTypeOptions = _objectSpread$a(_objectSpread$a({}, defaultOptions$3), options || {});
944
-
945
838
  var includeMetadataAttributes = parseMetadataTypeOptions.includeMetadataAttributes,
946
- flat = parseMetadataTypeOptions.flat;
947
-
839
+ flat = parseMetadataTypeOptions.flat;
948
840
  var _ref = metadataType || {},
949
- _ref$timespan = _ref.timespan,
950
- timespanList = _ref$timespan === void 0 ? [] : _ref$timespan,
951
- attributes = _objectWithoutProperties__default["default"](_ref, _excluded$7);
952
-
841
+ _ref$timespan = _ref.timespan,
842
+ timespanList = _ref$timespan === void 0 ? [] : _ref$timespan,
843
+ attributes = _objectWithoutProperties__default["default"](_ref, _excluded$7);
953
844
  var parseTimespanListOptions = Object.fromEntries(Object.entries(options).map(function (_ref2) {
954
845
  var _ref3 = _slicedToArray__default["default"](_ref2, 2),
955
- key = _ref3[0],
956
- value = _ref3[1];
957
-
846
+ key = _ref3[0],
847
+ value = _ref3[1];
958
848
  if (Object.keys(defaultOptions$4).includes(key)) {
959
849
  if (['onlyGeneric', 'overrideGroup', 'overrideField'].includes(key) && (value !== undefined ? value : flat === true)) {
960
850
  return [key, true];
961
851
  }
962
-
963
852
  return [key, value];
964
853
  }
965
-
966
854
  return undefined;
967
855
  }).filter(function (e) {
968
856
  return !!e;
@@ -972,13 +860,11 @@ function parseMetadataType(metadataType, options) {
972
860
  revision: attributes.revision.split(',')
973
861
  } : {}) || Array.isArray(includeMetadataAttributes) && Object.fromEntries(Object.entries(attributes).map(function (_ref4) {
974
862
  var _ref5 = _slicedToArray__default["default"](_ref4, 2),
975
- key = _ref5[0],
976
- value = _ref5[1];
977
-
863
+ key = _ref5[0],
864
+ value = _ref5[1];
978
865
  if (includeMetadataAttributes.includes(key)) {
979
866
  return [key, key === 'revision' && typeof value === 'string' ? value.split(',') : value];
980
867
  }
981
-
982
868
  return undefined;
983
869
  }).filter(function (o) {
984
870
  return !!o;
@@ -998,12 +884,10 @@ function parseMetadataType(metadataType, options) {
998
884
  *
999
885
  * @category Metadata
1000
886
  */
1001
-
1002
887
  var parseSimpleMetadataType = function parseSimpleMetadataType(simpleMetadataType) {
1003
888
  var _ref = simpleMetadataType || {},
1004
- _ref$field = _ref.field,
1005
- field = _ref$field === void 0 ? [] : _ref$field;
1006
-
889
+ _ref$field = _ref.field,
890
+ field = _ref$field === void 0 ? [] : _ref$field;
1007
891
  return parseKeyValuePairTypes(field);
1008
892
  };
1009
893
 
@@ -1048,6 +932,7 @@ var TIME_BASE_CONSTANTS = Object.keys(MAP_CONSTANT_TO_DEN_NUM);
1048
932
  */
1049
933
  var TimeBase = /*#__PURE__*/function () {
1050
934
  // The numerator for the TimeBase
935
+
1051
936
  // The denominator for the TimeBase
1052
937
 
1053
938
  /**
@@ -1057,79 +942,68 @@ var TimeBase = /*#__PURE__*/function () {
1057
942
  */
1058
943
  function TimeBase(timeBaseType) {
1059
944
  _classCallCheck__default["default"](this, TimeBase);
1060
-
1061
945
  _defineProperty__default["default"](this, "numerator", 1);
1062
-
1063
946
  _defineProperty__default["default"](this, "denominator", 1);
1064
-
1065
947
  var _ref = timeBaseType || {},
1066
- _ref$numerator = _ref.numerator,
1067
- numerator = _ref$numerator === void 0 ? 1 : _ref$numerator,
1068
- _ref$denominator = _ref.denominator,
1069
- denominator = _ref$denominator === void 0 ? 1 : _ref$denominator;
1070
-
948
+ _ref$numerator = _ref.numerator,
949
+ numerator = _ref$numerator === void 0 ? 1 : _ref$numerator,
950
+ _ref$denominator = _ref.denominator,
951
+ denominator = _ref$denominator === void 0 ? 1 : _ref$denominator;
1071
952
  this.numerator = Number(numerator);
1072
953
  this.denominator = Number(denominator);
1073
954
  }
955
+
1074
956
  /**
1075
957
  * Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
1076
958
  * @returns Constant representation of the TimeBase
1077
959
  */
1078
-
1079
-
1080
960
  _createClass__default["default"](TimeBase, [{
1081
961
  key: "toConstant",
1082
962
  value: function toConstant() {
1083
963
  var _this = this;
1084
-
1085
- var constant; // If multiple equal den/num, it selects first in MAP_CONSTANT_TO_DEN_NUM
1086
-
964
+ var constant;
965
+ // If multiple equal den/num, it selects first in MAP_CONSTANT_TO_DEN_NUM
1087
966
  Object.entries(MAP_CONSTANT_TO_DEN_NUM).find(function (timeBaseConstant) {
1088
967
  var _timeBaseConstant = _slicedToArray__default["default"](timeBaseConstant, 2),
1089
- thisTimeBaseText = _timeBaseConstant[0],
1090
- thisTimeBaseType = _timeBaseConstant[1];
1091
-
968
+ thisTimeBaseText = _timeBaseConstant[0],
969
+ thisTimeBaseType = _timeBaseConstant[1];
1092
970
  var numerator = thisTimeBaseType.numerator,
1093
- denominator = thisTimeBaseType.denominator;
1094
-
971
+ denominator = thisTimeBaseType.denominator;
1095
972
  if (numerator === _this.numerator && denominator === _this.denominator) {
1096
973
  constant = thisTimeBaseText;
1097
974
  return true;
1098
975
  }
1099
-
1100
976
  return false;
1101
977
  });
1102
978
  return constant;
1103
979
  }
980
+
1104
981
  /**
1105
982
  * Get TimeBase as a VidiCore TimeBaseType string
1106
983
  *
1107
984
  * @remarks
1108
985
  * Default format: denominator(:numerator if > 1)
986
+ *
1109
987
  * `constant` has precedence over `fraction` if both are true (e.g. NTSC > 30000:1001)
1110
988
  *
1111
989
  * @param options For how to display it as text
1112
990
  * @returns Text representation of the TimeBase
1113
991
  */
1114
-
1115
992
  }, {
1116
993
  key: "toText",
1117
994
  value: function toText(options) {
1118
995
  if (options !== null && options !== void 0 && options.constant) {
1119
996
  var _timeBaseText = this.toConstant();
1120
-
1121
997
  if (_timeBaseText) return _timeBaseText;
1122
998
  }
1123
-
1124
999
  if (options !== null && options !== void 0 && options.fraction || this.numerator > 1) {
1125
1000
  var _timeBaseText2 = [this.denominator, this.numerator].join(':');
1126
-
1127
1001
  return _timeBaseText2;
1128
1002
  }
1129
-
1130
1003
  var timeBaseText = String(this.denominator);
1131
1004
  return timeBaseText;
1132
1005
  }
1006
+
1133
1007
  /**
1134
1008
  * Output TimeBase as frame rate (by default max 16 decimal places)
1135
1009
  *
@@ -1140,6 +1014,7 @@ var TimeBase = /*#__PURE__*/function () {
1140
1014
  * - `number` gives that amount of decimal places
1141
1015
  *
1142
1016
  * Default format: rate with two decimals if needed (i.e. decimals are > 0)
1017
+ *
1143
1018
  * Option precedence (when all true): `constant` > `rounded` > `fixed`
1144
1019
  *
1145
1020
  * @param options For how to display it as rate
@@ -1148,36 +1023,30 @@ var TimeBase = /*#__PURE__*/function () {
1148
1023
  *
1149
1024
  * @category Time
1150
1025
  */
1151
-
1152
1026
  }, {
1153
1027
  key: "toRate",
1154
1028
  value: function toRate(options) {
1155
1029
  var rate = this.denominator / this.numerator;
1156
-
1157
1030
  if (Number.isInteger(rate)) {
1158
1031
  return rate;
1159
1032
  }
1160
-
1161
1033
  if (options !== null && options !== void 0 && options.rounded) {
1162
1034
  return Math.round(rate);
1163
1035
  }
1164
-
1165
1036
  var _ref2 = options || {},
1166
- _ref2$fixed = _ref2.fixed,
1167
- fixed = _ref2$fixed === void 0 ? true : _ref2$fixed;
1168
-
1037
+ _ref2$fixed = _ref2.fixed,
1038
+ fixed = _ref2$fixed === void 0 ? true : _ref2$fixed;
1169
1039
  if (fixed === true || typeof fixed === 'number') {
1170
1040
  return Number(rate.toFixed(typeof fixed === 'boolean' ? 2 : fixed));
1171
1041
  }
1172
-
1173
1042
  return rate;
1174
1043
  }
1044
+
1175
1045
  /**
1176
1046
  * Get TimeBase in a object representation
1177
1047
  *
1178
1048
  * @returns TimeBase as `{denominator, numerator}` object
1179
1049
  */
1180
-
1181
1050
  }, {
1182
1051
  key: "toObject",
1183
1052
  value: function toObject() {
@@ -1186,12 +1055,12 @@ var TimeBase = /*#__PURE__*/function () {
1186
1055
  numerator: this.numerator
1187
1056
  };
1188
1057
  }
1058
+
1189
1059
  /**
1190
1060
  * @deprecated Use {@link TimeBase#toObject | toObject} instead
1191
1061
  *
1192
1062
  * @returns TimeBase as `{denominator, numerator}` object
1193
1063
  */
1194
-
1195
1064
  }, {
1196
1065
  key: "toJson",
1197
1066
  value: function toJson() {
@@ -1200,7 +1069,6 @@ var TimeBase = /*#__PURE__*/function () {
1200
1069
  return this.toObject();
1201
1070
  }
1202
1071
  }]);
1203
-
1204
1072
  return TimeBase;
1205
1073
  }();
1206
1074
 
@@ -1212,38 +1080,31 @@ var TimeBase = /*#__PURE__*/function () {
1212
1080
  *
1213
1081
  * @category Time
1214
1082
  */
1215
-
1216
1083
  var formatTimeBaseText = function formatTimeBaseText(timeBaseText) {
1217
1084
  if (timeBaseText === undefined) {
1218
1085
  return new TimeBase();
1219
1086
  }
1220
-
1221
1087
  if (typeof timeBaseText === 'number') {
1222
1088
  return new TimeBase({
1223
1089
  denominator: timeBaseText
1224
1090
  });
1225
1091
  }
1226
-
1227
1092
  if (typeof timeBaseText === 'string' && timeBaseText.includes(':')) {
1228
1093
  var _timeBaseText$split = timeBaseText.split(':'),
1229
- _timeBaseText$split2 = _slicedToArray__default["default"](_timeBaseText$split, 2),
1230
- denominator = _timeBaseText$split2[0],
1231
- numerator = _timeBaseText$split2[1];
1232
-
1094
+ _timeBaseText$split2 = _slicedToArray__default["default"](_timeBaseText$split, 2),
1095
+ denominator = _timeBaseText$split2[0],
1096
+ numerator = _timeBaseText$split2[1];
1233
1097
  return new TimeBase({
1234
1098
  denominator: denominator,
1235
1099
  numerator: numerator
1236
1100
  });
1237
1101
  }
1238
-
1239
1102
  if (TIME_BASE_CONSTANTS.includes(timeBaseText)) {
1240
1103
  return new TimeBase(MAP_CONSTANT_TO_DEN_NUM[timeBaseText]);
1241
1104
  }
1242
-
1243
1105
  if (!['string', 'number'].includes(_typeof__default["default"](timeBaseText)) || Number.isNaN(Number(timeBaseText))) {
1244
1106
  throw new Error("timeBaseText must be a number or ".concat(TIME_BASE_CONSTANTS.join(','), " - is ").concat(JSON.stringify(timeBaseText)));
1245
1107
  }
1246
-
1247
1108
  return new TimeBase({
1248
1109
  denominator: Number(timeBaseText)
1249
1110
  });
@@ -1273,7 +1134,6 @@ var createTimeBase = function createTimeBase(timeBase) {
1273
1134
  if (typeof timeBase === 'string' || typeof timeBase === 'number') {
1274
1135
  return formatTimeBaseText(timeBase);
1275
1136
  }
1276
-
1277
1137
  return formatTimeBaseType(timeBase);
1278
1138
  };
1279
1139
 
@@ -1298,16 +1158,14 @@ var getAmountOfFrameDrops = function getAmountOfFrameDrops(timeBase) {
1298
1158
  * @param timeBase TimeBase Instance to check
1299
1159
  * @returns true if time base drops frames, false otherwise
1300
1160
  */
1301
-
1302
1161
  var isDropFrameTimeBase = function isDropFrameTimeBase(timeBase) {
1303
1162
  return getAmountOfFrameDrops(timeBase) > 0;
1304
1163
  };
1305
1164
 
1306
1165
  var _excluded$6 = ["hours"];
1307
-
1308
1166
  var getDroppedFramesFromSamples = function getDroppedFramesFromSamples(timeCode) {
1309
1167
  var samples = timeCode.samples,
1310
- timeBase = timeCode.timeBase;
1168
+ timeBase = timeCode.timeBase;
1311
1169
  var amountOfFrameDrops = getAmountOfFrameDrops(timeBase);
1312
1170
  if (!amountOfFrameDrops) return 0;
1313
1171
  var roundedFrameRate = timeBase.toRate({
@@ -1323,7 +1181,6 @@ var getDroppedFramesFromSamples = function getDroppedFramesFromSamples(timeCode)
1323
1181
  var amountOfFrameRemainderChunks = frameRemainder > 0 ? amountOfFrameDrops : 0;
1324
1182
  return amountOfTenMinuteChunks * 9 * amountOfFrameDrops + amountOfOneMinuteReminderChunks * amountOfFrameDrops + amountOfFrameRemainderChunks;
1325
1183
  };
1326
-
1327
1184
  /**
1328
1185
  * TimeCode class representing the TimeCodeType in VidiCore
1329
1186
  *
@@ -1333,8 +1190,11 @@ var getDroppedFramesFromSamples = function getDroppedFramesFromSamples(timeCode)
1333
1190
  */
1334
1191
  var TimeCode = /*#__PURE__*/function () {
1335
1192
  // Amount of samples for the time code
1193
+
1336
1194
  // The time base for the time code
1195
+
1337
1196
  // If time code is dropFrame or not (by default checks timeBase)
1197
+
1338
1198
  // Separator for frame in smpte output (default ":" for non-drop-frame and ";" for dropFrame)
1339
1199
 
1340
1200
  /**
@@ -1345,21 +1205,14 @@ var TimeCode = /*#__PURE__*/function () {
1345
1205
  */
1346
1206
  function TimeCode(timeCodeType, options) {
1347
1207
  var _options$dropFrame, _options$frameSeparat;
1348
-
1349
1208
  _classCallCheck__default["default"](this, TimeCode);
1350
-
1351
1209
  _defineProperty__default["default"](this, "samples", 0);
1352
-
1353
1210
  _defineProperty__default["default"](this, "timeBase", new TimeBase());
1354
-
1355
1211
  _defineProperty__default["default"](this, "dropFrame", void 0);
1356
-
1357
1212
  _defineProperty__default["default"](this, "frameSeparator", void 0);
1358
-
1359
1213
  var _ref = timeCodeType || {},
1360
- samples = _ref.samples,
1361
- timeBase = _ref.timeBase;
1362
-
1214
+ samples = _ref.samples,
1215
+ timeBase = _ref.timeBase;
1363
1216
  if (samples !== undefined) {
1364
1217
  if (typeof samples === 'number') {
1365
1218
  this.samples = samples;
@@ -1375,7 +1228,6 @@ var TimeCode = /*#__PURE__*/function () {
1375
1228
  throw new Error("samples is not number/string/-Inf/+Inf is: ".concat(samples));
1376
1229
  }
1377
1230
  }
1378
-
1379
1231
  if (timeBase !== undefined) {
1380
1232
  if (timeBase instanceof TimeBase) {
1381
1233
  this.timeBase = timeBase;
@@ -1383,10 +1235,10 @@ var TimeCode = /*#__PURE__*/function () {
1383
1235
  this.timeBase = createTimeBase(timeBase);
1384
1236
  }
1385
1237
  }
1386
-
1387
1238
  this.dropFrame = (_options$dropFrame = options === null || options === void 0 ? void 0 : options.dropFrame) !== null && _options$dropFrame !== void 0 ? _options$dropFrame : isDropFrameTimeBase(this.timeBase);
1388
1239
  this.frameSeparator = (_options$frameSeparat = options === null || options === void 0 ? void 0 : options.frameSeparator) !== null && _options$frameSeparat !== void 0 ? _options$frameSeparat : this.dropFrame ? ';' : ':';
1389
1240
  }
1241
+
1390
1242
  /**
1391
1243
  * Return this TimeCode added with the supplied timeCodeType
1392
1244
  * If time bases differ, it will retain the time base of this TimeCode instance
@@ -1399,32 +1251,27 @@ var TimeCode = /*#__PURE__*/function () {
1399
1251
  * @param timeCode A TimeCode instance you want to add with
1400
1252
  * @returns A new TimeCode instance with the addition applied
1401
1253
  */
1402
-
1403
-
1404
1254
  _createClass__default["default"](TimeCode, [{
1405
1255
  key: "add",
1406
1256
  value: function add(timeCode) {
1407
1257
  if (!(timeCode !== null && timeCode !== void 0 && timeCode.timeBase) || (timeCode === null || timeCode === void 0 ? void 0 : timeCode.samples) === undefined) {
1408
1258
  throw Error('Invalid timeCodeType, cannot be added');
1409
1259
  }
1410
-
1411
1260
  var _ref2 = (timeCode === null || timeCode === void 0 ? void 0 : timeCode.timeBase) || {},
1412
- numerator = _ref2.numerator,
1413
- denominator = _ref2.denominator;
1414
-
1261
+ numerator = _ref2.numerator,
1262
+ denominator = _ref2.denominator;
1415
1263
  var conformedTimeCode = timeCode;
1416
-
1417
1264
  if (numerator !== this.timeBase.numerator || denominator !== this.timeBase.denominator) {
1418
1265
  conformedTimeCode = timeCode.conformTimeBase(this.timeBase);
1419
1266
  }
1420
-
1421
1267
  var _conformedTimeCode = conformedTimeCode,
1422
- samples = _conformedTimeCode.samples;
1268
+ samples = _conformedTimeCode.samples;
1423
1269
  return new TimeCode({
1424
1270
  samples: this.samples + samples,
1425
1271
  timeBase: this.timeBase
1426
1272
  });
1427
1273
  }
1274
+
1428
1275
  /**
1429
1276
  * Return this TimeCode subtracted with the supplied timeCodeType
1430
1277
  * If time bases differ, it will retain the time base of the instance time code
@@ -1437,31 +1284,28 @@ var TimeCode = /*#__PURE__*/function () {
1437
1284
  * @param timeCode A TimeCode instance you want to subtract with
1438
1285
  * @returns A new TimeCode instance with the subtraction applied
1439
1286
  */
1440
-
1441
1287
  }, {
1442
1288
  key: "subtract",
1443
1289
  value: function subtract(timeCode) {
1444
1290
  if (!(timeCode !== null && timeCode !== void 0 && timeCode.timeBase) || (timeCode === null || timeCode === void 0 ? void 0 : timeCode.samples) === undefined) {
1445
1291
  throw Error('Invalid timeCodeType, cannot be subtracted');
1446
1292
  }
1447
-
1448
1293
  var _timeCode$timeBase = timeCode.timeBase;
1449
1294
  _timeCode$timeBase = _timeCode$timeBase === void 0 ? {} : _timeCode$timeBase;
1450
1295
  var numerator = _timeCode$timeBase.numerator,
1451
- denominator = _timeCode$timeBase.denominator;
1296
+ denominator = _timeCode$timeBase.denominator;
1452
1297
  var conformedTimeCode = timeCode;
1453
-
1454
1298
  if (numerator !== this.timeBase.numerator || denominator !== this.timeBase.denominator) {
1455
1299
  conformedTimeCode = timeCode.conformTimeBase(this.timeBase);
1456
1300
  }
1457
-
1458
1301
  var _conformedTimeCode2 = conformedTimeCode,
1459
- samples = _conformedTimeCode2.samples;
1302
+ samples = _conformedTimeCode2.samples;
1460
1303
  return new TimeCode({
1461
1304
  samples: this.samples - samples,
1462
1305
  timeBase: this.timeBase
1463
1306
  });
1464
1307
  }
1308
+
1465
1309
  /**
1466
1310
  * Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
1467
1311
  *
@@ -1471,7 +1315,6 @@ var TimeCode = /*#__PURE__*/function () {
1471
1315
  * @param timeBase The TimeBase it should conform the TimeCode to
1472
1316
  * @returns A new TimeCode instance with the conformTo timeBase applied
1473
1317
  */
1474
-
1475
1318
  }, {
1476
1319
  key: "conformTimeBase",
1477
1320
  value: function conformTimeBase(timeBase) {
@@ -1487,11 +1330,13 @@ var TimeCode = /*#__PURE__*/function () {
1487
1330
  };
1488
1331
  return new TimeCode(timeCode);
1489
1332
  }
1333
+
1490
1334
  /**
1491
1335
  * Get TimeCode as a text representation
1492
1336
  *
1493
1337
  * @remarks
1494
1338
  * Default format: samples@denominator(:numerator if > 1)
1339
+ *
1495
1340
  * `constant` has precedence over `fraction` if both are true
1496
1341
  *
1497
1342
  * @param options Options for how to format text
@@ -1499,39 +1344,36 @@ var TimeCode = /*#__PURE__*/function () {
1499
1344
  *
1500
1345
  * @category Time
1501
1346
  */
1502
-
1503
1347
  }, {
1504
1348
  key: "toText",
1505
1349
  value: function toText(options) {
1506
1350
  var timeCodeText = "".concat(this.samples);
1507
1351
  var timeBaseText = this.timeBase.toText(options);
1508
-
1509
1352
  if (options !== null && options !== void 0 && options.includeTimeBaseForSeconds || !['1', '1:1'].includes(timeBaseText)) {
1510
1353
  timeCodeText = [this.samples, timeBaseText].join('@');
1511
1354
  }
1512
-
1513
1355
  return timeCodeText;
1514
1356
  }
1357
+
1515
1358
  /**
1516
1359
  * Get TimeCode in a units object representation
1517
1360
  *
1518
1361
  * @returns Units (time and frames) for the time code
1519
1362
  */
1520
-
1521
1363
  }, {
1522
1364
  key: "toUnits",
1523
1365
  value: function toUnits() {
1524
1366
  var totalSamples = this.samples + (this.dropFrame ? getDroppedFramesFromSamples(this) : 0);
1525
1367
  var roundedFrameRate = this.timeBase.toRate({
1526
1368
  rounded: true
1527
- }); // Calculated without drop-frame but with 2 decimal places
1369
+ });
1528
1370
 
1371
+ // Calculated without drop-frame but with 2 decimal places
1529
1372
  if (['23.976', '23.98'].includes(this.timeBase.toConstant())) {
1530
1373
  roundedFrameRate = this.timeBase.toRate({
1531
1374
  fixed: true
1532
1375
  });
1533
1376
  }
1534
-
1535
1377
  var hours = Math.floor(totalSamples / (3600 * roundedFrameRate));
1536
1378
  var minutes = Math.floor(totalSamples / (60 * roundedFrameRate)) % 60;
1537
1379
  var seconds = Math.floor(totalSamples / roundedFrameRate) % 60;
@@ -1543,23 +1385,21 @@ var TimeCode = /*#__PURE__*/function () {
1543
1385
  frames: frames
1544
1386
  };
1545
1387
  }
1388
+
1546
1389
  /**
1547
1390
  * Get TimeCode in a time object representation
1548
1391
  * "milliseconds" is rounded down, if you want another representation use "partialSeconds"
1549
1392
  *
1550
1393
  * @returns Time for the time code
1551
1394
  */
1552
-
1553
1395
  }, {
1554
1396
  key: "toTime",
1555
1397
  value: function toTime() {
1556
1398
  var totalSamples = this.samples + getDroppedFramesFromSamples(this);
1557
-
1558
1399
  var _this$toUnits = this.toUnits(),
1559
- hours = _this$toUnits.hours,
1560
- minutes = _this$toUnits.minutes,
1561
- seconds = _this$toUnits.seconds;
1562
-
1400
+ hours = _this$toUnits.hours,
1401
+ minutes = _this$toUnits.minutes,
1402
+ seconds = _this$toUnits.seconds;
1563
1403
  var roundedFrameRate = this.timeBase.toRate({
1564
1404
  rounded: true
1565
1405
  });
@@ -1574,20 +1414,21 @@ var TimeCode = /*#__PURE__*/function () {
1574
1414
  partialSeconds: partialSeconds
1575
1415
  };
1576
1416
  }
1417
+
1577
1418
  /**
1578
1419
  * Get TimeCode in a seconds representation
1579
1420
  *
1580
1421
  * @returns Total seconds for the time code
1581
1422
  */
1582
-
1583
1423
  }, {
1584
1424
  key: "toSeconds",
1585
1425
  value: function toSeconds() {
1586
1426
  var _this$timeBase = this.timeBase,
1587
- numerator = _this$timeBase.numerator,
1588
- denominator = _this$timeBase.denominator;
1427
+ numerator = _this$timeBase.numerator,
1428
+ denominator = _this$timeBase.denominator;
1589
1429
  return Math.round(1000 * +(this.samples * numerator / denominator)) / 1000;
1590
1430
  }
1431
+
1591
1432
  /**
1592
1433
  * Get TimeCode in a duration representation
1593
1434
  * The time unit char keys for the format string are:
@@ -1606,52 +1447,40 @@ var TimeCode = /*#__PURE__*/function () {
1606
1447
  * @param options Options for how to display duration
1607
1448
  * @returns Duration representation of the TimeCode
1608
1449
  */
1609
-
1610
1450
  }, {
1611
1451
  key: "toDuration",
1612
1452
  value: function toDuration(options) {
1613
1453
  var _ref3 = options || {},
1614
- format = _ref3.format;
1615
-
1454
+ format = _ref3.format;
1616
1455
  var _this$toTime = this.toTime(),
1617
- hours = _this$toTime.hours,
1618
- rest = _objectWithoutProperties__default["default"](_this$toTime, _excluded$6);
1619
-
1456
+ hours = _this$toTime.hours,
1457
+ rest = _objectWithoutProperties__default["default"](_this$toTime, _excluded$6);
1620
1458
  var minutes = rest.minutes,
1621
- seconds = rest.seconds,
1622
- milliseconds = rest.milliseconds;
1623
-
1459
+ seconds = rest.seconds,
1460
+ milliseconds = rest.milliseconds;
1624
1461
  if (!!format && typeof format !== 'string') {
1625
1462
  throw Error('format has to be a string');
1626
1463
  }
1627
-
1628
1464
  var isBefore = function isBefore(unit, units) {
1629
1465
  return !format.includes(unit) || !units.some(function (u) {
1630
1466
  return format.includes(u) && format.lastIndexOf(unit) > format.indexOf(u);
1631
1467
  });
1632
1468
  };
1633
-
1634
1469
  if (!!format && !(isBefore('h', ['m', 's', 'S']) && isBefore('m', ['s', 'S']) && isBefore('s', ['S']))) {
1635
1470
  throw Error('format order is unsupported (has to be h, m, s then S)');
1636
1471
  }
1637
-
1638
1472
  if (!format) {
1639
1473
  return "".concat(hours > 0 ? "".concat(hours, ":").concat("".concat(minutes).padStart(2, '0')) : minutes, ":").concat("".concat(seconds).padStart(2, '0'));
1640
1474
  }
1641
-
1642
1475
  var countConsecutiveChars = function countConsecutiveChars(i, arr) {
1643
1476
  var j = i;
1644
-
1645
1477
  while (arr[j] === arr[j + 1]) {
1646
1478
  j += 1;
1647
1479
  }
1648
-
1649
1480
  return j - i + 1;
1650
1481
  };
1651
-
1652
1482
  var timeUnitKeys = ['h', 'm', 's', 'S'];
1653
1483
  var output = [];
1654
-
1655
1484
  _toConsumableArray__default["default"](format).forEach(function (c, i, arr) {
1656
1485
  switch (c) {
1657
1486
  case 'h':
@@ -1659,108 +1488,85 @@ var TimeCode = /*#__PURE__*/function () {
1659
1488
  if (arr[i - 1] === 'h') {
1660
1489
  break;
1661
1490
  }
1662
-
1663
1491
  var amount = countConsecutiveChars(i, arr);
1664
1492
  output.push("".concat(hours).padStart(amount, '0'));
1665
-
1666
1493
  if (timeUnitKeys.includes(arr[i + amount])) {
1667
1494
  output.push(':');
1668
1495
  }
1669
-
1670
1496
  break;
1671
1497
  }
1672
-
1673
1498
  case 'm':
1674
1499
  {
1675
1500
  if (arr[i - 1] === 'm') {
1676
1501
  break;
1677
1502
  }
1678
-
1679
1503
  var _amount = countConsecutiveChars(i, arr);
1680
-
1681
1504
  if (!format.includes('h')) {
1682
1505
  minutes += hours * 60;
1683
1506
  }
1684
-
1685
1507
  output.push("".concat(minutes).padStart(_amount, '0'));
1686
-
1687
1508
  if (timeUnitKeys.includes(arr[i + _amount])) {
1688
1509
  output.push(':');
1689
1510
  }
1690
-
1691
1511
  break;
1692
1512
  }
1693
-
1694
1513
  case 's':
1695
1514
  {
1696
1515
  if (arr[i - 1] === 's') {
1697
1516
  break;
1698
1517
  }
1699
-
1700
1518
  var _amount2 = countConsecutiveChars(i, arr);
1701
-
1702
1519
  if (!format.includes('m')) {
1703
1520
  seconds += minutes * 60;
1704
1521
  }
1705
-
1706
1522
  output.push("".concat(seconds).padStart(_amount2, '0'));
1707
-
1708
1523
  if (timeUnitKeys.includes(arr[i + _amount2])) {
1709
1524
  output.push('.');
1710
1525
  }
1711
-
1712
1526
  break;
1713
1527
  }
1714
-
1715
1528
  case 'S':
1716
1529
  {
1717
1530
  if (arr[i - 1] === 'S') {
1718
1531
  break;
1719
1532
  }
1720
-
1721
1533
  var _amount3 = countConsecutiveChars(i, arr);
1722
-
1723
1534
  if (!format.includes('s')) {
1724
1535
  milliseconds += seconds * 1000;
1725
1536
  }
1726
-
1727
1537
  output.push("".concat(Math.round(milliseconds / Math.pow(10, 3 - _amount3))).padStart(_amount3, '0'));
1728
1538
  break;
1729
1539
  }
1730
-
1731
1540
  default:
1732
1541
  output.push(c);
1733
1542
  }
1734
1543
  });
1735
-
1736
1544
  return output.join('');
1737
1545
  }
1546
+
1738
1547
  /**
1739
1548
  * Get TimeCode in a smpte representation
1740
1549
  *
1741
1550
  * @returns Smpte representation of the TimeCode
1742
1551
  */
1743
-
1744
1552
  }, {
1745
1553
  key: "toSmpte",
1746
1554
  value: function toSmpte() {
1747
1555
  if (this.samples === -Infinity) return '00:00:00:00';
1748
-
1749
1556
  var _this$toUnits2 = this.toUnits(),
1750
- hours = _this$toUnits2.hours,
1751
- minutes = _this$toUnits2.minutes,
1752
- seconds = _this$toUnits2.seconds,
1753
- frames = _this$toUnits2.frames;
1754
-
1557
+ hours = _this$toUnits2.hours,
1558
+ minutes = _this$toUnits2.minutes,
1559
+ seconds = _this$toUnits2.seconds,
1560
+ frames = _this$toUnits2.frames;
1755
1561
  var hhmmss = [hours.toFixed().padStart(2, '0'), minutes.toFixed().padStart(2, '0'), seconds.toFixed().padStart(2, '0')].join(':');
1756
1562
  return [hhmmss, "".concat(frames).padStart(2, '0')].join(this.frameSeparator);
1757
1563
  }
1564
+
1758
1565
  /**
1759
1566
  * Get TimeCode as a VidiCore TimeCodeType object
1760
1567
  *
1761
1568
  * @returns TimeCode as `{ samples, timeBase }`
1762
1569
  */
1763
-
1764
1570
  }, {
1765
1571
  key: "toObject",
1766
1572
  value: function toObject() {
@@ -1769,12 +1575,12 @@ var TimeCode = /*#__PURE__*/function () {
1769
1575
  timeBase: this.timeBase.toObject()
1770
1576
  };
1771
1577
  }
1578
+
1772
1579
  /**
1773
1580
  * @deprecated Use {@link TimeCode#toObject | toObject} instead
1774
1581
  *
1775
1582
  * @returns TimeCode as `{ samples, timeBase }`
1776
1583
  */
1777
-
1778
1584
  }, {
1779
1585
  key: "toJson",
1780
1586
  value: function toJson() {
@@ -1783,7 +1589,6 @@ var TimeCode = /*#__PURE__*/function () {
1783
1589
  return this.toObject();
1784
1590
  }
1785
1591
  }]);
1786
-
1787
1592
  return TimeCode;
1788
1593
  }();
1789
1594
 
@@ -1801,7 +1606,6 @@ var TimeCode = /*#__PURE__*/function () {
1801
1606
  var getGreatestCommonDivisor = function getGreatestCommonDivisor(num1, num2) {
1802
1607
  var a = Math.abs(num1);
1803
1608
  var b = Math.abs(num2);
1804
-
1805
1609
  while (a && b && a !== b) {
1806
1610
  if (a > b) {
1807
1611
  var _ref = [a - b, b];
@@ -1813,15 +1617,15 @@ var getGreatestCommonDivisor = function getGreatestCommonDivisor(num1, num2) {
1813
1617
  b = _ref2[1];
1814
1618
  }
1815
1619
  }
1816
-
1817
1620
  return a || b;
1818
1621
  };
1819
1622
 
1820
1623
  var _excluded$5 = ["timeBase", "useGCD"];
1821
-
1822
1624
  /**
1823
1625
  * Format seconds to TimeCode object
1824
- * Input time base is always 1:1 since it expects seconds as input
1626
+ *
1627
+ * @remarks
1628
+ * Input time base is always considered as 1:1 since it expects seconds as input
1825
1629
  *
1826
1630
  * Note: Max 15 digits accuracy (double precision float64), e.g.
1827
1631
  * - 10^6 seconds can have 10^9 decimals (nanosecond) precision
@@ -1836,40 +1640,32 @@ var _excluded$5 = ["timeBase", "useGCD"];
1836
1640
  */
1837
1641
  var formatTimeCodeSeconds = function formatTimeCodeSeconds(seconds, options) {
1838
1642
  var _ref = options || {},
1839
- timeBase = _ref.timeBase,
1840
- _ref$useGCD = _ref.useGCD,
1841
- useGCD = _ref$useGCD === void 0 ? false : _ref$useGCD,
1842
- timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$5);
1843
-
1643
+ timeBase = _ref.timeBase,
1644
+ _ref$useGCD = _ref.useGCD,
1645
+ useGCD = _ref$useGCD === void 0 ? false : _ref$useGCD,
1646
+ timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$5);
1844
1647
  var secondsWithDot = "".concat(seconds).replace(/,/g, '.');
1845
-
1846
1648
  if (Number.isNaN(+secondsWithDot)) {
1847
1649
  throw new Error("seconds must be digits, is ".concat(seconds));
1848
1650
  }
1849
-
1850
1651
  var denominator = 1;
1851
1652
  var samples;
1852
-
1853
1653
  if (Number.isInteger(+secondsWithDot)) {
1854
1654
  samples = +secondsWithDot * denominator;
1855
1655
  } else {
1856
1656
  var _ms$length;
1857
-
1858
1657
  var _secondsWithDot$split = secondsWithDot.split('.'),
1859
- _secondsWithDot$split2 = _slicedToArray__default["default"](_secondsWithDot$split, 2),
1860
- ms = _secondsWithDot$split2[1];
1861
-
1658
+ _secondsWithDot$split2 = _slicedToArray__default["default"](_secondsWithDot$split, 2),
1659
+ ms = _secondsWithDot$split2[1];
1862
1660
  var decimalPlaces = Math.min((_ms$length = ms === null || ms === void 0 ? void 0 : ms.length) !== null && _ms$length !== void 0 ? _ms$length : 0, 16);
1863
1661
  denominator *= Math.pow(10, decimalPlaces);
1864
1662
  samples = Math.round(Number(secondsWithDot) * denominator);
1865
1663
  }
1866
-
1867
1664
  if (timeBase === undefined && useGCD) {
1868
1665
  var gcd = getGreatestCommonDivisor(denominator, samples);
1869
1666
  samples /= gcd;
1870
1667
  denominator /= gcd;
1871
1668
  }
1872
-
1873
1669
  var timeCode = new TimeCode({
1874
1670
  samples: samples,
1875
1671
  timeBase: {
@@ -1877,47 +1673,40 @@ var formatTimeCodeSeconds = function formatTimeCodeSeconds(seconds, options) {
1877
1673
  numerator: 1
1878
1674
  }
1879
1675
  }, timeCodeOptions);
1880
- return timeBase !== undefined ? timeCode.conformTimeBase(createTimeBase(timeBase === true ? 1 : timeBase)) : timeCode;
1676
+ return timeBase !== undefined ? timeCode.conformTimeBase(createTimeBase(timeBase)) : timeCode;
1881
1677
  };
1882
1678
 
1883
1679
  var getDroppedFramesFromSmpte = function getDroppedFramesFromSmpte(_ref, samples, timeBase) {
1884
1680
  var _ref2 = _slicedToArray__default["default"](_ref, 4),
1885
- hh = _ref2[0],
1886
- mm = _ref2[1],
1887
- ss = _ref2[2],
1888
- ff = _ref2[3];
1889
-
1681
+ hh = _ref2[0],
1682
+ mm = _ref2[1],
1683
+ ss = _ref2[2],
1684
+ ff = _ref2[3];
1890
1685
  var roundedFrameRate = timeBase.toRate({
1891
1686
  rounded: true
1892
1687
  });
1893
1688
  var dropFrames = getAmountOfFrameDrops(timeBase);
1894
-
1895
1689
  if (samples === 0 || !dropFrames) {
1896
1690
  return 0;
1897
1691
  }
1898
-
1899
1692
  var shouldDropMinute = mm % 10 !== 0;
1900
1693
  var shouldDropSecond = shouldDropMinute && ss === 0;
1901
1694
  var hourFrames = hh * (3600 * roundedFrameRate - 54 * dropFrames);
1902
1695
  var minuteFrames = mm * 60 * roundedFrameRate - (mm - Math.ceil(mm / 10)) * dropFrames;
1903
1696
  var secondFrames = ss * roundedFrameRate - (shouldDropMinute && ss > 1 ? dropFrames : 0);
1904
-
1905
1697
  if (shouldDropSecond && ff < dropFrames) {
1906
1698
  throw new Error("Frame does not exist for ".concat(timeBase.toConstant() || timeBase.toRate(), " drop-frame"));
1907
1699
  }
1908
-
1909
1700
  var frameFrames = shouldDropSecond ? ff - dropFrames : ff;
1910
1701
  var samplesWithoutDroppedFrames = hourFrames + minuteFrames + secondFrames + frameFrames;
1911
1702
  return samples - samplesWithoutDroppedFrames;
1912
1703
  };
1913
-
1914
1704
  var getSamplesFromSmpte = function getSamplesFromSmpte(smpteValues, timeBase, dropFrame) {
1915
1705
  var _smpteValues = _slicedToArray__default["default"](smpteValues, 4),
1916
- hh = _smpteValues[0],
1917
- mm = _smpteValues[1],
1918
- ss = _smpteValues[2],
1919
- ff = _smpteValues[3];
1920
-
1706
+ hh = _smpteValues[0],
1707
+ mm = _smpteValues[1],
1708
+ ss = _smpteValues[2],
1709
+ ff = _smpteValues[3];
1921
1710
  var roundedFrameRate = timeBase.toRate({
1922
1711
  rounded: true
1923
1712
  });
@@ -1927,32 +1716,26 @@ var getSamplesFromSmpte = function getSamplesFromSmpte(smpteValues, timeBase, dr
1927
1716
 
1928
1717
  var splitSmpte = function splitSmpte(smpte) {
1929
1718
  var _ref = (smpte === null || smpte === void 0 ? void 0 : smpte.match(/[^0-9:\-_]/)) || [],
1930
- _ref2 = _slicedToArray__default["default"](_ref, 1),
1931
- nonColonFrameSeparator = _ref2[0];
1932
-
1719
+ _ref2 = _slicedToArray__default["default"](_ref, 1),
1720
+ nonColonFrameSeparator = _ref2[0];
1933
1721
  var smpteValues = [];
1934
-
1935
1722
  if (nonColonFrameSeparator) {
1936
1723
  var _smpte$split = smpte.split(nonColonFrameSeparator),
1937
- _smpte$split2 = _slicedToArray__default["default"](_smpte$split, 2),
1938
- hhmmss = _smpte$split2[0],
1939
- ff = _smpte$split2[1];
1940
-
1724
+ _smpte$split2 = _slicedToArray__default["default"](_smpte$split, 2),
1725
+ hhmmss = _smpte$split2[0],
1726
+ ff = _smpte$split2[1];
1941
1727
  smpteValues = [].concat(_toConsumableArray__default["default"](hhmmss.split(':')), [ff]);
1942
1728
  } else {
1943
1729
  smpteValues = smpte.split(':');
1944
1730
  }
1945
-
1946
1731
  if (smpteValues.length !== 4) {
1947
1732
  throw new Error('Invalid format, must be "##:##:##:##');
1948
1733
  }
1949
-
1950
1734
  if (smpteValues.some(function (n) {
1951
1735
  return Number.isNaN(n);
1952
1736
  })) {
1953
1737
  throw new Error('Invalid format, values must be numbers');
1954
1738
  }
1955
-
1956
1739
  var smpteFrameSeparator = nonColonFrameSeparator || ':';
1957
1740
  return {
1958
1741
  smpteValues: smpteValues.map(Number),
@@ -1961,12 +1744,9 @@ var splitSmpte = function splitSmpte(smpte) {
1961
1744
  };
1962
1745
 
1963
1746
  var _excluded$4 = ["exceedingMode", "timeBase"];
1964
-
1965
1747
  function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1966
-
1967
1748
  function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1968
1749
  var EXCEEDING_OPTIONS = ['error', 'add', 'ignore'];
1969
-
1970
1750
  /**
1971
1751
  * Format smpte text to a TimeCode Instance
1972
1752
  *
@@ -1983,98 +1763,79 @@ var EXCEEDING_OPTIONS = ['error', 'add', 'ignore'];
1983
1763
  */
1984
1764
  var formatTimeCodeSmpte = function formatTimeCodeSmpte(smpte, options) {
1985
1765
  var _ref = options || {},
1986
- _ref$exceedingMode = _ref.exceedingMode,
1987
- exceedingMode = _ref$exceedingMode === void 0 ? 'error' : _ref$exceedingMode,
1988
- timeBase = _ref.timeBase,
1989
- timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$4);
1990
-
1766
+ _ref$exceedingMode = _ref.exceedingMode,
1767
+ exceedingMode = _ref$exceedingMode === void 0 ? 'error' : _ref$exceedingMode,
1768
+ timeBase = _ref.timeBase,
1769
+ timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$4);
1991
1770
  if ([null, undefined].includes(smpte)) {
1992
1771
  throw new Error("smpte cannot be undefined or null");
1993
1772
  }
1994
-
1995
1773
  if (typeof smpte !== 'string') {
1996
1774
  throw new Error("smpte must be a string, is ".concat(JSON.stringify(smpte)));
1997
1775
  }
1998
-
1999
1776
  var _splitSmpte = splitSmpte(smpte),
2000
- smpteValues = _splitSmpte.smpteValues,
2001
- smpteFrameSeparator = _splitSmpte.smpteFrameSeparator;
2002
-
1777
+ smpteValues = _splitSmpte.smpteValues,
1778
+ smpteFrameSeparator = _splitSmpte.smpteFrameSeparator;
2003
1779
  var timeBaseInstance = createTimeBase(timeBase);
2004
-
2005
1780
  var mergedOptions = _objectSpread$9(_objectSpread$9({}, timeCodeOptions), {}, {
2006
1781
  frameSeparator: (timeCodeOptions === null || timeCodeOptions === void 0 ? void 0 : timeCodeOptions.frameSeparator) || smpteFrameSeparator
2007
1782
  }, (timeCodeOptions === null || timeCodeOptions === void 0 ? void 0 : timeCodeOptions.dropFrame) === undefined ? {
2008
1783
  dropFrame: timeBase !== undefined ? isDropFrameTimeBase(timeBaseInstance) : [';', ','].includes(smpteFrameSeparator)
2009
1784
  } : {});
2010
-
2011
1785
  var roundedFrameRate = timeBaseInstance.toRate({
2012
1786
  rounded: true
2013
1787
  });
2014
1788
  var maxFrame = Math.max(0, roundedFrameRate - 1);
2015
-
2016
1789
  if (smpteValues.some(function (v) {
2017
1790
  return v < 0;
2018
1791
  })) {
2019
1792
  throw new Error('Negative values are not supported');
2020
1793
  }
2021
-
2022
1794
  var samples;
2023
-
2024
1795
  switch (exceedingMode) {
2025
1796
  case 'error':
2026
1797
  {
2027
1798
  var _smpteValues = _slicedToArray__default["default"](smpteValues, 4),
2028
- hours = _smpteValues[0],
2029
- minutes = _smpteValues[1],
2030
- seconds = _smpteValues[2],
2031
- frames = _smpteValues[3];
2032
-
1799
+ hours = _smpteValues[0],
1800
+ minutes = _smpteValues[1],
1801
+ seconds = _smpteValues[2],
1802
+ frames = _smpteValues[3];
2033
1803
  if (hours >= 100) {
2034
1804
  throw Error('Minutes has to be less than 60');
2035
1805
  }
2036
-
2037
1806
  if (minutes >= 60) {
2038
1807
  throw Error('Minutes has to be less than 60');
2039
1808
  }
2040
-
2041
1809
  if (seconds >= 60) {
2042
1810
  throw Error('Seconds has to be less than 60');
2043
1811
  }
2044
-
2045
1812
  if (frames > maxFrame) {
2046
1813
  throw Error("Frames has to be less or equal to ".concat(maxFrame));
2047
1814
  }
2048
-
2049
1815
  samples = getSamplesFromSmpte(smpteValues, timeBaseInstance, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.dropFrame);
2050
1816
  break;
2051
1817
  }
2052
-
2053
1818
  case 'ignore':
2054
1819
  {
2055
1820
  var _smpteValues2 = _slicedToArray__default["default"](smpteValues, 4),
2056
- _hours = _smpteValues2[0],
2057
- _minutes = _smpteValues2[1],
2058
- _seconds = _smpteValues2[2],
2059
- _frames = _smpteValues2[3];
2060
-
1821
+ _hours = _smpteValues2[0],
1822
+ _minutes = _smpteValues2[1],
1823
+ _seconds = _smpteValues2[2],
1824
+ _frames = _smpteValues2[3];
2061
1825
  var truncatedSmpteValues = [Math.min(100, _hours), Math.min(59, _minutes), Math.min(59, _seconds), Math.min(maxFrame, _frames)];
2062
1826
  samples = getSamplesFromSmpte(truncatedSmpteValues, timeBaseInstance, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.dropFrame);
2063
1827
  break;
2064
1828
  }
2065
-
2066
1829
  case 'add':
2067
1830
  {
2068
1831
  samples = getSamplesFromSmpte(smpteValues, timeBaseInstance, mergedOptions === null || mergedOptions === void 0 ? void 0 : mergedOptions.dropFrame);
2069
1832
  break;
2070
1833
  }
2071
-
2072
1834
  default:
2073
1835
  {
2074
1836
  throw new Error("Invalid exceedingMode, options are ".concat(JSON.stringify(EXCEEDING_OPTIONS)));
2075
1837
  }
2076
1838
  }
2077
-
2078
1839
  return new TimeCode({
2079
1840
  samples: samples,
2080
1841
  timeBase: timeBaseInstance
@@ -2082,7 +1843,6 @@ var formatTimeCodeSmpte = function formatTimeCodeSmpte(smpte, options) {
2082
1843
  };
2083
1844
 
2084
1845
  var _excluded$3 = ["timeBase"];
2085
-
2086
1846
  /**
2087
1847
  * Format text to a TimeCode instance
2088
1848
  *
@@ -2092,13 +1852,10 @@ var _excluded$3 = ["timeBase"];
2092
1852
  */
2093
1853
  var formatTimeCodeText = function formatTimeCodeText(timeCodeText, options) {
2094
1854
  var _timeCodeObject;
2095
-
2096
1855
  var _ref = options || {},
2097
- timeBase = _ref.timeBase,
2098
- timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$3);
2099
-
1856
+ timeBase = _ref.timeBase,
1857
+ timeCodeOptions = _objectWithoutProperties__default["default"](_ref, _excluded$3);
2100
1858
  var timeCodeObject;
2101
-
2102
1859
  if (timeCodeText === undefined) {
2103
1860
  timeCodeObject = {
2104
1861
  samples: 0
@@ -2109,10 +1866,9 @@ var formatTimeCodeText = function formatTimeCodeText(timeCodeText, options) {
2109
1866
  };
2110
1867
  } else if (timeCodeText.includes('@')) {
2111
1868
  var _timeCodeText$split = timeCodeText.split('@'),
2112
- _timeCodeText$split2 = _slicedToArray__default["default"](_timeCodeText$split, 2),
2113
- samplesString = _timeCodeText$split2[0],
2114
- timeBaseText = _timeCodeText$split2[1];
2115
-
1869
+ _timeCodeText$split2 = _slicedToArray__default["default"](_timeCodeText$split, 2),
1870
+ samplesString = _timeCodeText$split2[0],
1871
+ timeBaseText = _timeCodeText$split2[1];
2116
1872
  var samples = Number(samplesString);
2117
1873
  timeCodeObject = {
2118
1874
  samples: samples,
@@ -2131,11 +1887,9 @@ var formatTimeCodeText = function formatTimeCodeText(timeCodeText, options) {
2131
1887
  samples: Number(timeCodeText)
2132
1888
  };
2133
1889
  }
2134
-
2135
1890
  if (Number.isNaN((_timeCodeObject = timeCodeObject) === null || _timeCodeObject === void 0 ? void 0 : _timeCodeObject.samples) || timeCodeObject.timeBase && !(timeCodeObject.timeBase instanceof TimeBase)) {
2136
1891
  throw new Error("timeCodeText must be a number or sample@timeBase - is ".concat(timeCodeText));
2137
1892
  }
2138
-
2139
1893
  var timeCode = new TimeCode(timeCodeObject, timeCodeOptions);
2140
1894
  return timeBase ? timeCode.conformTimeBase(createTimeBase(timeBase)) : timeCode;
2141
1895
  };
@@ -2156,11 +1910,9 @@ var formatTimeCodeType = function formatTimeCodeType(timeCode, options) {
2156
1910
  var hasSmpteFormat = function hasSmpteFormat(s) {
2157
1911
  return !!s.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/);
2158
1912
  };
2159
-
2160
1913
  var isNumber = function isNumber(s) {
2161
1914
  return !Number.isNaN(Number(s));
2162
1915
  };
2163
-
2164
1916
  /**
2165
1917
  * Create a TimeCode instance from smpte, seconds/samples, timeCode object or string
2166
1918
  *
@@ -2172,42 +1924,38 @@ var isNumber = function isNumber(s) {
2172
1924
  */
2173
1925
  var createTimeCode = function createTimeCode(timeCode, options) {
2174
1926
  // TimeCode
2175
- if (typeof timeCode !== 'string' && typeof timeCode !== 'number') return formatTimeCodeType(timeCode, options); // SMPTE
2176
-
1927
+ if (typeof timeCode !== 'string' && typeof timeCode !== 'number') return formatTimeCodeType(timeCode, options);
1928
+ // SMPTE
2177
1929
  if (typeof timeCode === 'string' && hasSmpteFormat(timeCode)) return formatTimeCodeSmpte(timeCode, options);
2178
1930
  if (['string', 'number'].includes(_typeof__default["default"](timeCode)) && isNumber(timeCode)) return formatTimeCodeSeconds(timeCode, options);
2179
-
2180
1931
  if (typeof timeCode === 'string') {
2181
1932
  return formatTimeCodeText(timeCode, options);
2182
1933
  }
2183
-
2184
1934
  return undefined;
2185
1935
  };
2186
1936
 
2187
1937
  function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2188
-
2189
1938
  function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2190
-
2191
1939
  function timeToCueTime(_ref) {
2192
1940
  var _ref$hours = _ref.hours,
2193
- hours = _ref$hours === void 0 ? 0 : _ref$hours,
2194
- _ref$minutes = _ref.minutes,
2195
- minutes = _ref$minutes === void 0 ? 0 : _ref$minutes,
2196
- _ref$seconds = _ref.seconds,
2197
- seconds = _ref$seconds === void 0 ? 0 : _ref$seconds,
2198
- _ref$partialSeconds = _ref.partialSeconds,
2199
- partialSeconds = _ref$partialSeconds === void 0 ? 0 : _ref$partialSeconds;
1941
+ hours = _ref$hours === void 0 ? 0 : _ref$hours,
1942
+ _ref$minutes = _ref.minutes,
1943
+ minutes = _ref$minutes === void 0 ? 0 : _ref$minutes,
1944
+ _ref$seconds = _ref.seconds,
1945
+ seconds = _ref$seconds === void 0 ? 0 : _ref$seconds,
1946
+ _ref$partialSeconds = _ref.partialSeconds,
1947
+ partialSeconds = _ref$partialSeconds === void 0 ? 0 : _ref$partialSeconds;
2200
1948
  var hourStr = hours.toFixed().padStart(2, '0');
2201
1949
  var minStr = minutes.toFixed().padStart(2, '0');
2202
1950
  var secondsStr = seconds.toFixed().padStart(2, '0');
2203
1951
  var partialStr = (partialSeconds * 10).toFixed().padStart(3, '0');
2204
1952
  return "".concat(hourStr, ":").concat(minStr, ":").concat(secondsStr, ".").concat(partialStr);
2205
1953
  }
2206
-
2207
1954
  var defaultOptions$2 = {
2208
1955
  subtitleGroup: 'stl_subtitle',
2209
1956
  subtitleField: 'stl_text'
2210
1957
  };
1958
+
2211
1959
  /**
2212
1960
  * Convert metadata subtitle groups to WebVtt subtitles
2213
1961
  *
@@ -2217,16 +1965,13 @@ var defaultOptions$2 = {
2217
1965
  *
2218
1966
  * @category Metadata
2219
1967
  */
2220
-
2221
1968
  var metadataTypeToWebVtt = function metadataTypeToWebVtt(metadataType, options) {
2222
1969
  var _defaultOptions = _objectSpread$8(_objectSpread$8({}, defaultOptions$2), options || {}),
2223
- subtitleGroup = _defaultOptions.subtitleGroup,
2224
- subtitleField = _defaultOptions.subtitleField;
2225
-
1970
+ subtitleGroup = _defaultOptions.subtitleGroup,
1971
+ subtitleField = _defaultOptions.subtitleField;
2226
1972
  var _ref2 = metadataType || {},
2227
- _ref2$timespan = _ref2.timespan,
2228
- timespanList = _ref2$timespan === void 0 ? [] : _ref2$timespan;
2229
-
1973
+ _ref2$timespan = _ref2.timespan,
1974
+ timespanList = _ref2$timespan === void 0 ? [] : _ref2$timespan;
2230
1975
  if (timespanList.length === 0) return '';
2231
1976
  var parsedTimespans = parseTimespanList(timespanList, {
2232
1977
  includeTimespanAttributes: true,
@@ -2237,10 +1982,9 @@ var metadataTypeToWebVtt = function metadataTypeToWebVtt(metadataType, options)
2237
1982
  });
2238
1983
  var vttCues = parsedTimespans.map(function (timespan) {
2239
1984
  var _ref3 = (Array.isArray(timespan) ? timespan[0] : timespan) || {},
2240
- startText = _ref3.start,
2241
- endText = _ref3.end,
2242
- _ref3$subtitleGroup = _ref3[subtitleGroup];
2243
-
1985
+ startText = _ref3.start,
1986
+ endText = _ref3.end,
1987
+ _ref3$subtitleGroup = _ref3[subtitleGroup];
2244
1988
  _ref3$subtitleGroup = _ref3$subtitleGroup === void 0 ? {} : _ref3$subtitleGroup;
2245
1989
  var text = _ref3$subtitleGroup[subtitleField];
2246
1990
  if (!text) return '';
@@ -2276,9 +2020,7 @@ var createFacetType = function createFacetType() {
2276
2020
  };
2277
2021
 
2278
2022
  function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2279
-
2280
2023
  function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2281
-
2282
2024
  /** Parsed facet type */
2283
2025
 
2284
2026
  /**
@@ -2294,11 +2036,11 @@ var parseFacetType = function parseFacetType() {
2294
2036
  var output = {};
2295
2037
  facetType.forEach(function (_ref) {
2296
2038
  var name = _ref.name,
2297
- field = _ref.field,
2298
- count = _ref.count;
2039
+ field = _ref.field,
2040
+ count = _ref.count;
2299
2041
  output[name || field] = count.reduce(function (acc, _ref2) {
2300
2042
  var fieldValue = _ref2.fieldValue,
2301
- value = _ref2.value;
2043
+ value = _ref2.value;
2302
2044
  return _objectSpread$7(_objectSpread$7({}, acc), {}, _defineProperty__default["default"]({}, fieldValue, value));
2303
2045
  }, {});
2304
2046
  });
@@ -2306,14 +2048,13 @@ var parseFacetType = function parseFacetType() {
2306
2048
  };
2307
2049
 
2308
2050
  function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2309
-
2310
2051
  function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2311
-
2312
2052
  var defaultOptions$1 = {
2313
2053
  arrayOnSingle: true,
2314
2054
  joinValue: undefined,
2315
2055
  timespanAsList: false
2316
2056
  };
2057
+
2317
2058
  /**
2318
2059
  * Parses highlight timespan in VidiCore into key/value object.
2319
2060
  * The attributes can be targeted for each sub-type.
@@ -2322,48 +2063,40 @@ var defaultOptions$1 = {
2322
2063
  *
2323
2064
  * @category Search
2324
2065
  */
2325
-
2326
2066
  var parseHighlightTimespan = function parseHighlightTimespan(timespan, options) {
2327
2067
  var _defaultOptions = _objectSpread$6(_objectSpread$6({}, defaultOptions$1), options || {}),
2328
- _defaultOptions$array = _defaultOptions.arrayOnSingle,
2329
- arrayOnSingle = _defaultOptions$array === void 0 ? true : _defaultOptions$array,
2330
- _defaultOptions$joinV = _defaultOptions.joinValue,
2331
- joinValue = _defaultOptions$joinV === void 0 ? undefined : _defaultOptions$joinV,
2332
- _defaultOptions$times = _defaultOptions.timespanAsList,
2333
- timespanAsList = _defaultOptions$times === void 0 ? false : _defaultOptions$times;
2334
-
2068
+ _defaultOptions$array = _defaultOptions.arrayOnSingle,
2069
+ arrayOnSingle = _defaultOptions$array === void 0 ? true : _defaultOptions$array,
2070
+ _defaultOptions$joinV = _defaultOptions.joinValue,
2071
+ joinValue = _defaultOptions$joinV === void 0 ? undefined : _defaultOptions$joinV,
2072
+ _defaultOptions$times = _defaultOptions.timespanAsList,
2073
+ timespanAsList = _defaultOptions$times === void 0 ? false : _defaultOptions$times;
2335
2074
  var _ref = timespan || {},
2336
- _ref$field = _ref.field,
2337
- field = _ref$field === void 0 ? [] : _ref$field,
2338
- start = _ref.start,
2339
- end = _ref.end;
2340
-
2075
+ _ref$field = _ref.field,
2076
+ field = _ref$field === void 0 ? [] : _ref$field,
2077
+ start = _ref.start,
2078
+ end = _ref.end;
2341
2079
  var initialValue = timespanAsList ? {
2342
2080
  start: start,
2343
2081
  end: end
2344
2082
  } : {};
2345
2083
  var fieldList = field.reduce(function (acc, curr) {
2346
2084
  var name = curr.name,
2347
- _curr$value = curr.value,
2348
- valueList = _curr$value === void 0 ? [] : _curr$value;
2085
+ _curr$value = curr.value,
2086
+ valueList = _curr$value === void 0 ? [] : _curr$value;
2349
2087
  if (valueList.length === 0) return acc;
2350
2088
  var fieldValue;
2351
-
2352
2089
  if (arrayOnSingle === false && valueList.length === 1) {
2353
2090
  var _valueList = _slicedToArray__default["default"](valueList, 1);
2354
-
2355
2091
  fieldValue = _valueList[0];
2356
2092
  } else if (joinValue) fieldValue = valueList.join(joinValue);else fieldValue = valueList;
2357
-
2358
2093
  return _objectSpread$6(_objectSpread$6({}, acc), {}, _defineProperty__default["default"]({}, name, fieldValue));
2359
2094
  }, initialValue);
2360
2095
  return fieldList;
2361
2096
  };
2362
2097
 
2363
2098
  var _excluded$2 = ["timespanAsList", "joinTimespan", "flat", "flatTimespan"];
2364
-
2365
2099
  function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2366
-
2367
2100
  function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2368
2101
  var defaultOptions = _objectSpread$5(_objectSpread$5({}, defaultOptions$1), {}, {
2369
2102
  timespanAsList: false,
@@ -2371,6 +2104,7 @@ var defaultOptions = _objectSpread$5(_objectSpread$5({}, defaultOptions$1), {},
2371
2104
  flat: false,
2372
2105
  flatTimespan: false
2373
2106
  });
2107
+
2374
2108
  /**
2375
2109
  * Parses highlight timespans from VidiCore into key/value object.
2376
2110
  * The attributes can be targeted for each sub-type.
@@ -2380,19 +2114,16 @@ var defaultOptions = _objectSpread$5(_objectSpread$5({}, defaultOptions$1), {},
2380
2114
  *
2381
2115
  * @category Search
2382
2116
  */
2383
-
2384
2117
  var parseHighlightTimespanList = function parseHighlightTimespanList() {
2385
2118
  var highlightTimespanList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2386
2119
  var options = arguments.length > 1 ? arguments[1] : undefined;
2387
-
2388
2120
  var _defaultOptions = _objectSpread$5(_objectSpread$5({}, defaultOptions), options || {}),
2389
- timespanAsList = _defaultOptions.timespanAsList,
2390
- _defaultOptions$joinT = _defaultOptions.joinTimespan,
2391
- joinTimespan = _defaultOptions$joinT === void 0 ? '_' : _defaultOptions$joinT,
2392
- flat = _defaultOptions.flat,
2393
- flatTimespan = _defaultOptions.flatTimespan,
2394
- parseHighlightTimespanOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$2);
2395
-
2121
+ timespanAsList = _defaultOptions.timespanAsList,
2122
+ _defaultOptions$joinT = _defaultOptions.joinTimespan,
2123
+ joinTimespan = _defaultOptions$joinT === void 0 ? '_' : _defaultOptions$joinT,
2124
+ flat = _defaultOptions.flat,
2125
+ flatTimespan = _defaultOptions.flatTimespan,
2126
+ parseHighlightTimespanOptions = _objectWithoutProperties__default["default"](_defaultOptions, _excluded$2);
2396
2127
  if (timespanAsList === true) return highlightTimespanList.map(function (timespan) {
2397
2128
  return parseHighlightTimespan(timespan, _objectSpread$5(_objectSpread$5({}, parseHighlightTimespanOptions), {}, {
2398
2129
  timespanAsList: timespanAsList
@@ -2406,59 +2137,62 @@ var parseHighlightTimespanList = function parseHighlightTimespanList() {
2406
2137
  }, {});
2407
2138
  };
2408
2139
 
2140
+ /**
2141
+ * Parse Vidicore "NOW" constants to a date object
2142
+ *
2143
+ * Format: `NOW[+/-][number][HOUR/DAY/MONTH/YEAR(s)]` (e.g. "NOW-2HOURS")
2144
+ *
2145
+ * @remarks
2146
+ * Returns an approximate date since it's created client side
2147
+ *
2148
+ * @param value A "NOW" constant
2149
+ * @returns A date from the NOW constant
2150
+ *
2151
+ * @category Search
2152
+ */
2409
2153
  var parseNowDate = function parseNowDate() {
2410
2154
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'NOW';
2411
-
2412
2155
  if (value.startsWith('NOW')) {
2413
2156
  if (value === 'NOW') return new Date();
2414
2157
  var sign = value[3];
2415
2158
  var number = Number(value.match(/(\d+)/)[0]);
2416
2159
  var unit = value.match(/(\d.*)/)[0].replace(/\d/g, '');
2417
2160
  var nowDiff = new Date();
2418
-
2419
2161
  switch (unit) {
2420
2162
  case 'HOUR':
2421
2163
  case 'HOURS':
2422
2164
  if (sign === '+') nowDiff.setHours(nowDiff.getHours() + number);
2423
2165
  if (sign === '-') nowDiff.setHours(nowDiff.getHours() - number);
2424
2166
  break;
2425
-
2426
2167
  case 'DAY':
2427
2168
  case 'DAYS':
2428
2169
  if (sign === '+') nowDiff.setDate(nowDiff.getDate() + number);
2429
2170
  if (sign === '-') nowDiff.setDate(nowDiff.getDate() - number);
2430
2171
  break;
2431
-
2432
2172
  case 'MONTH':
2433
2173
  case 'MONTHS':
2434
2174
  if (sign === '+') nowDiff.setMonth(nowDiff.getMonth() + number);
2435
2175
  if (sign === '-') nowDiff.setMonth(nowDiff.getMonth() - number);
2436
2176
  break;
2437
-
2438
2177
  case 'YEAR':
2439
2178
  case 'YEARS':
2440
2179
  if (sign === '+') nowDiff.setFullYear(nowDiff.getFullYear() + number);
2441
2180
  if (sign === '-') nowDiff.setFullYear(nowDiff.getFullYear() - number);
2442
2181
  break;
2443
2182
  }
2444
-
2445
2183
  return nowDiff;
2446
2184
  }
2447
-
2448
2185
  return new Date(value);
2449
2186
  };
2450
2187
 
2451
2188
  var _excluded$1 = ["property"];
2452
-
2453
2189
  function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2454
-
2455
2190
  function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2456
2191
  var parseBaseMediaInfoType = function parseBaseMediaInfoType(baseMediaInfoType) {
2457
2192
  var _ref = baseMediaInfoType || {},
2458
- _ref$property = _ref.property,
2459
- keyValuePairTypes = _ref$property === void 0 ? [] : _ref$property,
2460
- props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
2461
-
2193
+ _ref$property = _ref.property,
2194
+ keyValuePairTypes = _ref$property === void 0 ? [] : _ref$property,
2195
+ props = _objectWithoutProperties__default["default"](_ref, _excluded$1);
2462
2196
  var parsedKeyValuePairType = parseKeyValuePairTypes(keyValuePairTypes);
2463
2197
  return _objectSpread$4(_objectSpread$4({}, parsedKeyValuePairType), props);
2464
2198
  };
@@ -2474,12 +2208,11 @@ var sampleRateSymbols = {
2474
2208
  B: 'Hz',
2475
2209
  mB: 'mHz'
2476
2210
  };
2477
- var bitRateSymbols = {
2211
+ var bitRateSymbols$1 = {
2478
2212
  kB: 'kbps',
2479
2213
  B: 'bps',
2480
2214
  MB: 'mbps'
2481
2215
  };
2482
-
2483
2216
  /**
2484
2217
  * Parses the technical information of a AudioComponentType.
2485
2218
  * @param audioComponentType - A AudioComponentType from VidiCore.
@@ -2489,27 +2222,35 @@ var bitRateSymbols = {
2489
2222
  */
2490
2223
  var parseAudioComponent = function parseAudioComponent(audioComponentType) {
2491
2224
  var timeBase = audioComponentType.timeBase,
2492
- audioChannels = audioComponentType.channelCount,
2493
- audioCodec = audioComponentType.codec,
2494
- mediaInfo = audioComponentType.mediaInfo,
2495
- bitrate = audioComponentType.bitrate,
2496
- metadata = audioComponentType.metadata;
2225
+ audioChannels = audioComponentType.channelCount,
2226
+ audioCodec = audioComponentType.codec,
2227
+ mediaInfo = audioComponentType.mediaInfo,
2228
+ bitrate = audioComponentType.bitrate,
2229
+ metadata = audioComponentType.metadata;
2497
2230
  var audioMediaInfo = parseAudioMediaInfoType(mediaInfo);
2498
2231
  var audioFormat = audioMediaInfo.Format,
2499
- audioBitDepth = audioMediaInfo.Resolution,
2500
- audioBitRateMode = audioMediaInfo.Bit_rate_mode;
2232
+ audioBitDepth = audioMediaInfo.Resolution,
2233
+ audioBitRateMode = audioMediaInfo.Bit_rate_mode;
2501
2234
  var audioMetadata = parseKeyValuePairTypes(metadata || []);
2502
2235
  var audioSamplerateSamples = timeBase !== null && timeBase !== void 0 && timeBase.denominator ? ((timeBase === null || timeBase === void 0 ? void 0 : timeBase.denominator) || 1) / ((timeBase === null || timeBase === void 0 ? void 0 : timeBase.numerator) || 1) : undefined;
2503
- var audioSamplerate = audioSamplerateSamples !== undefined ? parseFileSize__default["default"](audioSamplerateSamples, {
2236
+ var audioSamplerate = audioSamplerateSamples !== undefined ? filesize.filesize(audioSamplerateSamples, {
2504
2237
  base: 10,
2505
2238
  round: 1,
2506
2239
  symbols: sampleRateSymbols
2507
2240
  }) : undefined;
2508
- var audioBitrate = bitrate !== undefined ? parseFileSize__default["default"](bitrate, {
2509
- base: 10,
2510
- round: 2,
2511
- symbols: bitRateSymbols
2512
- }) : undefined;
2241
+ var audioBitrate;
2242
+ var audioBitrateKbps;
2243
+ if (bitrate !== undefined) {
2244
+ var _split;
2245
+ audioBitrate = filesize.filesize(bitrate, {
2246
+ round: 2,
2247
+ symbols: bitRateSymbols$1
2248
+ });
2249
+ audioBitrateKbps = Number((_split = filesize.filesize(bitrate, {
2250
+ exponent: 1,
2251
+ symbols: bitRateSymbols$1
2252
+ }).split(' kbps')) === null || _split === void 0 ? void 0 : _split[0]);
2253
+ }
2513
2254
  return {
2514
2255
  audioFormat: audioFormat,
2515
2256
  audioCodec: audioCodec,
@@ -2517,6 +2258,7 @@ var parseAudioComponent = function parseAudioComponent(audioComponentType) {
2517
2258
  audioSamplerateSamples: audioSamplerateSamples,
2518
2259
  audioBitDepth: audioBitDepth,
2519
2260
  audioBitrate: audioBitrate,
2261
+ audioBitrateKbps: audioBitrateKbps,
2520
2262
  audioBitRateMode: audioBitRateMode,
2521
2263
  audioChannels: audioChannels,
2522
2264
  audioMediaInfo: audioMediaInfo,
@@ -2524,9 +2266,43 @@ var parseAudioComponent = function parseAudioComponent(audioComponentType) {
2524
2266
  };
2525
2267
  };
2526
2268
 
2269
+ /**
2270
+ * Const object with all file states in VidiCore
2271
+ * (see https://apidoc.vidispine.com/latest/storage/storage.html#file-states for more info)
2272
+ *
2273
+ * @category File
2274
+ */
2275
+ var FILE_STATES = {
2276
+ /** Just created, not used. */
2277
+ NONE: 'NONE',
2278
+ /** Discovered or created, not yet marked as finished. */
2279
+ OPEN: 'OPEN',
2280
+ /** File does no longer grow. */
2281
+ CLOSED: 'CLOSED',
2282
+ /** The current state is not known. */
2283
+ UNKNOWN: 'UNKNOWN',
2284
+ /** File is missing from the file system/storage. */
2285
+ MISSING: 'MISSING',
2286
+ /** File has been missing for a longer period. Candidate for restoration from archive. */
2287
+ LOST: 'LOST',
2288
+ /** File will appear on file system/storage, transfer subsystem or transcoder will create it. */
2289
+ TO_APPEAR: 'TO_APPEAR',
2290
+ /** The file is no longer in use, and will be deleted at the next clean-up sweep. */
2291
+ TO_BE_DELETED: 'TO_BE_DELETED',
2292
+ /** File is in use by transfer subsystem or transcoder. */
2293
+ BEING_READ: 'BEING_READ',
2294
+ /** File is archived. */
2295
+ ARCHIVED: 'ARCHIVED',
2296
+ /** File will be synchronized by multi-site agent. */
2297
+ AWAITING_SYNC: 'AWAITING_SYNC'
2298
+ };
2299
+
2527
2300
  /**
2528
2301
  * Parses a VidiCore file object
2529
2302
  *
2303
+ * @remarks
2304
+ * File sizes are parsed with JEDEC standard (base 2)
2305
+ *
2530
2306
  * @param fileType VidiCore file object
2531
2307
  * @returns A parsed file object
2532
2308
  *
@@ -2534,16 +2310,17 @@ var parseAudioComponent = function parseAudioComponent(audioComponentType) {
2534
2310
  */
2535
2311
  var parseFileType = function parseFileType(fileType) {
2536
2312
  var _fileType$uri = fileType.uri,
2537
- uriList = _fileType$uri === void 0 ? [] : _fileType$uri,
2538
- fileSizeBytes = fileType.size,
2539
- hash = fileType.hash,
2540
- path = fileType.path,
2541
- fileId = fileType.id;
2542
-
2313
+ uriList = _fileType$uri === void 0 ? [] : _fileType$uri,
2314
+ fileSizeBytes = fileType.size,
2315
+ hash = fileType.hash,
2316
+ path = fileType.path,
2317
+ fileId = fileType.id;
2543
2318
  var _uriList = _slicedToArray__default["default"](uriList, 1),
2544
- uri = _uriList[0];
2545
-
2546
- var fileSize = fileSizeBytes !== undefined ? parseFileSize__default["default"](fileSizeBytes) : '';
2319
+ uri = _uriList[0];
2320
+ var fileSize = fileSizeBytes !== undefined ? filesize.filesize(fileSizeBytes, {
2321
+ base: 2,
2322
+ standard: 'jedec'
2323
+ }) : '';
2547
2324
  var fileName = path ? path.split('/').pop() : undefined;
2548
2325
  return {
2549
2326
  uri: uri,
@@ -2557,9 +2334,7 @@ var parseFileType = function parseFileType(fileType) {
2557
2334
  };
2558
2335
 
2559
2336
  function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2560
-
2561
2337
  function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2562
-
2563
2338
  /**
2564
2339
  * Parses the technical information of a BinaryComponentType.
2565
2340
  * @param binaryComponentType - A BinaryComponentType from VidiCore.
@@ -2570,30 +2345,27 @@ function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) {
2570
2345
  var parseBinaryComponent = function parseBinaryComponent() {
2571
2346
  var binaryComponentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2572
2347
  var fileList = binaryComponentType.file,
2573
- mediaInfo = binaryComponentType.mediaInfo,
2574
- _binaryComponentType$ = binaryComponentType.metadata,
2575
- metadata = _binaryComponentType$ === void 0 ? [] : _binaryComponentType$;
2348
+ mediaInfo = binaryComponentType.mediaInfo,
2349
+ _binaryComponentType$ = binaryComponentType.metadata,
2350
+ metadata = _binaryComponentType$ === void 0 ? [] : _binaryComponentType$;
2576
2351
  var binaryMetadata = parseKeyValuePairTypes(metadata);
2577
2352
  var binaryMediaInfo = parseBaseMediaInfoType(mediaInfo);
2578
2353
  var parsedBinaryComponent = {
2579
2354
  binaryMetadata: binaryMetadata,
2580
2355
  binaryMediaInfo: binaryMediaInfo
2581
2356
  };
2582
-
2583
2357
  if (fileList) {
2584
2358
  var _fileList = _slicedToArray__default["default"](fileList, 1),
2585
- fileType = _fileList[0];
2586
-
2359
+ fileType = _fileList[0];
2587
2360
  var parsedFileType = parseFileType(fileType);
2588
2361
  parsedBinaryComponent = _objectSpread$3(_objectSpread$3({}, parsedBinaryComponent), parsedFileType);
2589
2362
  }
2590
-
2591
2363
  return parsedBinaryComponent;
2592
2364
  };
2593
2365
 
2594
2366
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2595
-
2596
2367
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2368
+
2597
2369
  /**
2598
2370
  * Parsed container component
2599
2371
  */
@@ -2608,32 +2380,27 @@ function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) {
2608
2380
  var parseContainerComponent = function parseContainerComponent() {
2609
2381
  var containerComponentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2610
2382
  var mediaInfo = containerComponentType.mediaInfo,
2611
- metadata = containerComponentType.metadata,
2612
- fileList = containerComponentType.file,
2613
- durationTimeCode = containerComponentType.duration,
2614
- startTimestamp = containerComponentType.startTimestamp,
2615
- startTimecode = containerComponentType.startTimecode,
2616
- timeCodeTimeBase = containerComponentType.timeCodeTimeBase;
2383
+ metadata = containerComponentType.metadata,
2384
+ fileList = containerComponentType.file,
2385
+ durationTimeCode = containerComponentType.duration,
2386
+ startTimestamp = containerComponentType.startTimestamp,
2387
+ startTimecode = containerComponentType.startTimecode,
2388
+ timeCodeTimeBase = containerComponentType.timeCodeTimeBase;
2617
2389
  var containerMetadata = parseKeyValuePairTypes(metadata || []);
2618
2390
  var containerMediaInfo = parseBaseMediaInfoType(mediaInfo);
2619
2391
  var containerFormat = containerMediaInfo.Format;
2620
2392
  var videoFormat = containerMediaInfo.Video_Format_List,
2621
- audioFormat = containerMediaInfo.Audio_Format_List,
2622
- textFormat = containerMediaInfo.Text_Format_List;
2623
-
2393
+ audioFormat = containerMediaInfo.Audio_Format_List,
2394
+ textFormat = containerMediaInfo.Text_Format_List;
2624
2395
  if (containerFormat === undefined) {
2625
2396
  var format = containerComponentType.format;
2626
2397
  containerFormat = format;
2627
-
2628
2398
  if (format && format.includes(',')) {
2629
2399
  var formatList = format.split(',');
2630
-
2631
2400
  var _formatList = _slicedToArray__default["default"](formatList, 1);
2632
-
2633
2401
  containerFormat = _formatList[0];
2634
2402
  }
2635
2403
  }
2636
-
2637
2404
  var parsedContainerComponentType = {
2638
2405
  containerFormat: containerFormat,
2639
2406
  videoFormat: videoFormat,
@@ -2642,39 +2409,37 @@ var parseContainerComponent = function parseContainerComponent() {
2642
2409
  containerMetadata: containerMetadata,
2643
2410
  containerMediaInfo: containerMediaInfo
2644
2411
  };
2645
-
2646
2412
  if (containerMetadata.componentOriginalFilename) {
2647
2413
  parsedContainerComponentType.originalFilename = containerMetadata.componentOriginalFilename;
2648
2414
  }
2649
-
2650
2415
  if (durationTimeCode !== undefined && durationTimeCode.samples !== 0) {
2651
2416
  var timeCode = formatTimeCodeType(durationTimeCode);
2652
2417
  parsedContainerComponentType.durationTimeCode = timeCode.toObject();
2653
2418
  parsedContainerComponentType.duration = timeCode.toDuration();
2654
2419
  }
2655
-
2656
2420
  if (startTimestamp) {
2657
2421
  parsedContainerComponentType.startTimestamp = formatTimeCodeType(startTimestamp).toObject();
2658
2422
  }
2659
-
2660
2423
  if (startTimecode !== undefined && timeCodeTimeBase) {
2661
2424
  parsedContainerComponentType.startTimecode = formatTimeCodeType({
2662
2425
  samples: startTimecode,
2663
2426
  timeBase: timeCodeTimeBase
2664
2427
  });
2665
2428
  }
2666
-
2667
2429
  if (fileList) {
2668
2430
  var _fileList = _slicedToArray__default["default"](fileList, 1),
2669
- fileType = _fileList[0];
2670
-
2431
+ fileType = _fileList[0];
2671
2432
  var parsedFileType = parseFileType(fileType);
2672
2433
  parsedContainerComponentType = _objectSpread$2(_objectSpread$2({}, parsedContainerComponentType), parsedFileType);
2673
2434
  }
2674
-
2675
2435
  return parsedContainerComponentType;
2676
2436
  };
2677
2437
 
2438
+ var bitRateSymbols = {
2439
+ kB: 'kbps',
2440
+ B: 'bps',
2441
+ MB: 'mbps'
2442
+ };
2678
2443
  /**
2679
2444
  * Parses the technical information of a VideoComponentType.
2680
2445
  * @param {Object} videoComponentType - A VideoComponentType from VidiCore.
@@ -2685,23 +2450,22 @@ var parseContainerComponent = function parseContainerComponent() {
2685
2450
  var parseVideoComponent = function parseVideoComponent() {
2686
2451
  var videoComponentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2687
2452
  var videoCodec = videoComponentType.codec,
2688
- bitrate = videoComponentType.bitrate,
2689
- fieldOrder = videoComponentType.fieldOrder,
2690
- resolution = videoComponentType.resolution,
2691
- mediaInfo = videoComponentType.mediaInfo,
2692
- _videoComponentType$m = videoComponentType.metadata,
2693
- metadata = _videoComponentType$m === void 0 ? [] : _videoComponentType$m;
2453
+ bitrate = videoComponentType.bitrate,
2454
+ fieldOrder = videoComponentType.fieldOrder,
2455
+ resolution = videoComponentType.resolution,
2456
+ mediaInfo = videoComponentType.mediaInfo,
2457
+ _videoComponentType$m = videoComponentType.metadata,
2458
+ metadata = _videoComponentType$m === void 0 ? [] : _videoComponentType$m;
2694
2459
  var videoMediaInfo = parseVideoMediaInfoType(mediaInfo);
2695
2460
  var videoMetadata = parseKeyValuePairTypes(metadata);
2696
2461
  var videoFormat = videoMediaInfo.Format,
2697
- timeBaseText = videoMediaInfo['Frame rate'],
2698
- colorSpace = videoMediaInfo['Color space'],
2699
- colorPrimaries = videoMediaInfo['Color primaries'],
2700
- chromaSubsampling = videoMediaInfo.Colorimetry;
2462
+ timeBaseText = videoMediaInfo['Frame rate'],
2463
+ colorSpace = videoMediaInfo['Color space'],
2464
+ colorPrimaries = videoMediaInfo['Color primaries'],
2465
+ chromaSubsampling = videoMediaInfo.Colorimetry;
2701
2466
  var timeBase;
2702
2467
  var averageFrameRate = videoComponentType.averageFrameRate,
2703
- realBaseFrameRate = videoComponentType.realBaseFrameRate;
2704
-
2468
+ realBaseFrameRate = videoComponentType.realBaseFrameRate;
2705
2469
  if (realBaseFrameRate !== undefined) {
2706
2470
  timeBase = formatTimeBaseType({
2707
2471
  numerator: realBaseFrameRate.denominator,
@@ -2715,18 +2479,14 @@ var parseVideoComponent = function parseVideoComponent() {
2715
2479
  denominator: averageFrameRate.numerator
2716
2480
  });
2717
2481
  }
2718
-
2719
2482
  var samples = videoMediaInfo['Frame count'];
2720
-
2721
2483
  if (samples === undefined) {
2722
2484
  var numberOfPackets = videoComponentType.numberOfPackets;
2723
2485
  if (numberOfPackets !== undefined) samples = numberOfPackets.toString();
2724
2486
  }
2725
-
2726
2487
  var timeCode;
2727
2488
  var frameRate;
2728
2489
  var smpte;
2729
-
2730
2490
  if (samples && timeBase) {
2731
2491
  timeCode = formatTimeCodeType({
2732
2492
  samples: samples,
@@ -2735,16 +2495,24 @@ var parseVideoComponent = function parseVideoComponent() {
2735
2495
  frameRate = timeCode.timeBase.toConstant() || timeCode.timeBase.toRate();
2736
2496
  smpte = timeCode.toSmpte();
2737
2497
  }
2738
-
2739
2498
  var _ref = resolution || {},
2740
- height = _ref.height,
2741
- width = _ref.width;
2742
-
2499
+ height = _ref.height,
2500
+ width = _ref.width;
2743
2501
  var aspectRatio = parseAspectRatio(resolution);
2744
2502
  var dimension = "".concat(width, "x").concat(height);
2745
- var videoBitrate = bitrate ? parseFileSize__default["default"](bitrate, {
2746
- bits: true
2747
- }) : undefined;
2503
+ var videoBitrate;
2504
+ var videoBitrateMbps;
2505
+ if (bitrate !== undefined) {
2506
+ var _split;
2507
+ videoBitrate = filesize.filesize(bitrate, {
2508
+ round: 2,
2509
+ symbols: bitRateSymbols
2510
+ });
2511
+ videoBitrateMbps = Number((_split = filesize.filesize(bitrate, {
2512
+ exponent: 2,
2513
+ symbols: bitRateSymbols
2514
+ }).split(' mbps')) === null || _split === void 0 ? void 0 : _split[0]);
2515
+ }
2748
2516
  return {
2749
2517
  videoFormat: videoFormat,
2750
2518
  dimension: dimension,
@@ -2756,6 +2524,7 @@ var parseVideoComponent = function parseVideoComponent() {
2756
2524
  videoCodec: videoCodec,
2757
2525
  smpte: smpte,
2758
2526
  videoBitrate: videoBitrate,
2527
+ videoBitrateMbps: videoBitrateMbps,
2759
2528
  fieldOrder: fieldOrder,
2760
2529
  colorSpace: colorSpace,
2761
2530
  chromaSubsampling: chromaSubsampling,
@@ -2767,9 +2536,7 @@ var parseVideoComponent = function parseVideoComponent() {
2767
2536
  };
2768
2537
 
2769
2538
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2770
-
2771
2539
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2772
-
2773
2540
  /**
2774
2541
  * Parses the technical information of a ShapeType and its various components.
2775
2542
  *
@@ -2788,55 +2555,47 @@ var parseShapeType = function parseShapeType() {
2788
2555
  var shapeType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2789
2556
  var parsedShape = {};
2790
2557
  var containerComponent = shapeType.containerComponent,
2791
- videoComponentList = shapeType.videoComponent,
2792
- audioComponentList = shapeType.audioComponent,
2793
- binaryComponentList = shapeType.binaryComponent,
2794
- _shapeType$mimeType = shapeType.mimeType,
2795
- mimeTypeList = _shapeType$mimeType === void 0 ? [] : _shapeType$mimeType,
2796
- _shapeType$tag = shapeType.tag,
2797
- tagList = _shapeType$tag === void 0 ? [] : _shapeType$tag;
2798
-
2558
+ videoComponentList = shapeType.videoComponent,
2559
+ audioComponentList = shapeType.audioComponent,
2560
+ binaryComponentList = shapeType.binaryComponent,
2561
+ _shapeType$mimeType = shapeType.mimeType,
2562
+ mimeTypeList = _shapeType$mimeType === void 0 ? [] : _shapeType$mimeType,
2563
+ _shapeType$tag = shapeType.tag,
2564
+ tagList = _shapeType$tag === void 0 ? [] : _shapeType$tag;
2799
2565
  var _tagList = _slicedToArray__default["default"](tagList, 1);
2800
-
2801
2566
  parsedShape.tag = _tagList[0];
2802
-
2803
2567
  var _mimeTypeList = _slicedToArray__default["default"](mimeTypeList, 1);
2804
-
2805
2568
  parsedShape.mimeType = _mimeTypeList[0];
2806
-
2807
2569
  if (containerComponent) {
2808
2570
  var parsedContainerComponent = parseContainerComponent(containerComponent);
2809
2571
  parsedShape = _objectSpread$1(_objectSpread$1({}, parsedShape), parsedContainerComponent);
2810
2572
  }
2811
-
2812
2573
  if (videoComponentList) {
2813
2574
  var _videoComponentList = _slicedToArray__default["default"](videoComponentList, 1),
2814
- videoComponent = _videoComponentList[0];
2815
-
2575
+ videoComponent = _videoComponentList[0];
2816
2576
  var parsedVideoComponent = parseVideoComponent(videoComponent);
2817
2577
  parsedShape = _objectSpread$1(_objectSpread$1({}, parsedShape), parsedVideoComponent);
2818
2578
  }
2819
-
2820
2579
  if (audioComponentList) {
2821
2580
  var _audioComponentList = _slicedToArray__default["default"](audioComponentList, 1),
2822
- audioComponent = _audioComponentList[0];
2823
-
2581
+ audioComponent = _audioComponentList[0];
2824
2582
  var parsedAudioComponent = parseAudioComponent(audioComponent);
2825
2583
  parsedShape = _objectSpread$1(_objectSpread$1({}, parsedShape), parsedAudioComponent);
2826
2584
  }
2827
-
2828
2585
  if (binaryComponentList) {
2829
2586
  var _binaryComponentList = _slicedToArray__default["default"](binaryComponentList, 1),
2830
- binaryComponent = _binaryComponentList[0];
2831
-
2587
+ binaryComponent = _binaryComponentList[0];
2832
2588
  var parsedBinaryComponent = parseBinaryComponent(binaryComponent);
2833
2589
  parsedShape = _objectSpread$1(_objectSpread$1({}, parsedShape), parsedBinaryComponent);
2834
2590
  }
2835
-
2836
2591
  return parsedShape;
2837
2592
  };
2838
2593
 
2839
- // eslint-disable-next-line import/no-cycle
2594
+ /**
2595
+ * Const object with document types
2596
+ *
2597
+ * @category Shape
2598
+ */
2840
2599
  var DOCUMENT_TYPES = {
2841
2600
  PDF: 'PDF',
2842
2601
  TEXT: 'TEXT',
@@ -2845,6 +2604,20 @@ var DOCUMENT_TYPES = {
2845
2604
  XML: 'XML'
2846
2605
  };
2847
2606
 
2607
+ /**
2608
+ * Const object with media types
2609
+ *
2610
+ * @category Shape
2611
+ */
2612
+ var SHAPE_MEDIA_TYPES = {
2613
+ IMAGE: 'IMAGE',
2614
+ AUDIO: 'AUDIO',
2615
+ VIDEO: 'VIDEO',
2616
+ DOCUMENT: 'DOCUMENT',
2617
+ BINARY: 'BINARY'
2618
+ };
2619
+
2620
+ // eslint-disable-next-line import/no-cycle
2848
2621
  /**
2849
2622
  * Return a const for the document type of a shape (looks at mimeType)
2850
2623
  *
@@ -2878,21 +2651,20 @@ var QUICKTIME_MIMETYPE = 'video/quicktime';
2878
2651
  var M4V_MIMETYPE = 'video/x-m4v';
2879
2652
  var MP4_CONTAINER = 'MPEG-4';
2880
2653
  var MOV_CONTAINER = 'mov';
2881
- var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, secondary alphabetical.
2882
- // using reverse() so the first has highest index
2654
+ var H264_CODEC = 'h264';
2883
2655
 
2656
+ // Sort by tags in the order of previewShapeOrder, secondary alphabetical.
2657
+ // using reverse() so the first has highest index
2884
2658
  var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
2885
-
2886
2659
  var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
2887
2660
  var firstEl = _ref.parsedShape.tag;
2888
2661
  var secondEl = _ref2.parsedShape.tag;
2889
-
2890
2662
  if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
2891
2663
  return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
2892
2664
  }
2893
-
2894
2665
  return firstEl.toLowerCase().localeCompare(secondEl.toLowerCase());
2895
2666
  };
2667
+
2896
2668
  /**
2897
2669
  * Filter a shape type list to get shapes that are playable in a browser
2898
2670
  *
@@ -2902,75 +2674,57 @@ var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
2902
2674
  *
2903
2675
  * @category Shape
2904
2676
  */
2905
-
2906
-
2907
2677
  var filterShapeSource = function filterShapeSource(itemType, options) {
2908
2678
  var _ref3 = options || {},
2909
- _ref3$allowedMimeType = _ref3.allowedMimeTypes,
2910
- allowedMimeTypes = _ref3$allowedMimeType === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _ref3$allowedMimeType,
2911
- _ref3$allowedMethods = _ref3.allowedMethods,
2912
- allowedMethods = _ref3$allowedMethods === void 0 ? DEFAULT_ALLOWED_METHODS : _ref3$allowedMethods,
2913
- _ref3$sortPriority = _ref3.sortPriority,
2914
- sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
2915
- _ref3$sourceKey = _ref3.sourceKey,
2916
- sourceKey = _ref3$sourceKey === void 0 ? 'src' : _ref3$sourceKey,
2917
- _ref3$mimeTypeKey = _ref3.mimeTypeKey,
2918
- mimeTypeKey = _ref3$mimeTypeKey === void 0 ? 'type' : _ref3$mimeTypeKey,
2919
- _ref3$shapeKey = _ref3.shapeKey,
2920
- shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey,
2921
- _ref3$parsedShapeKey = _ref3.parsedShapeKey,
2922
- parsedShapeKey = _ref3$parsedShapeKey === void 0 ? 'parsedShape' : _ref3$parsedShapeKey;
2923
-
2679
+ _ref3$allowedMimeType = _ref3.allowedMimeTypes,
2680
+ allowedMimeTypes = _ref3$allowedMimeType === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _ref3$allowedMimeType,
2681
+ _ref3$allowedMethods = _ref3.allowedMethods,
2682
+ allowedMethods = _ref3$allowedMethods === void 0 ? DEFAULT_ALLOWED_METHODS : _ref3$allowedMethods,
2683
+ _ref3$sortPriority = _ref3.sortPriority,
2684
+ sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
2685
+ _ref3$sourceKey = _ref3.sourceKey,
2686
+ sourceKey = _ref3$sourceKey === void 0 ? 'src' : _ref3$sourceKey,
2687
+ _ref3$mimeTypeKey = _ref3.mimeTypeKey,
2688
+ mimeTypeKey = _ref3$mimeTypeKey === void 0 ? 'type' : _ref3$mimeTypeKey,
2689
+ _ref3$shapeKey = _ref3.shapeKey,
2690
+ shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey,
2691
+ _ref3$parsedShapeKey = _ref3.parsedShapeKey,
2692
+ parsedShapeKey = _ref3$parsedShapeKey === void 0 ? 'parsedShape' : _ref3$parsedShapeKey;
2924
2693
  var _ref4 = itemType || {},
2925
- _ref4$shape = _ref4.shape,
2926
- shapeList = _ref4$shape === void 0 ? [] : _ref4$shape;
2927
-
2694
+ _ref4$shape = _ref4.shape,
2695
+ shapeList = _ref4$shape === void 0 ? [] : _ref4$shape;
2928
2696
  var filteredShapeList = shapeList.reduce(function (acc, shapeType) {
2929
2697
  var type;
2930
2698
  var src;
2931
2699
  var parsedShape = parseShapeType(shapeType);
2932
2700
  var uri = parsedShape.uri,
2933
- mimeType = parsedShape.mimeType,
2934
- containerFormat = parsedShape.containerFormat,
2935
- videoCodec = parsedShape.videoCodec;
2936
-
2701
+ mimeType = parsedShape.mimeType,
2702
+ containerFormat = parsedShape.containerFormat,
2703
+ videoCodec = parsedShape.videoCodec;
2937
2704
  if (mimeType) {
2938
2705
  type = mimeType;
2939
2706
  if ((mimeType === QUICKTIME_MIMETYPE || mimeType === M4V_MIMETYPE) && (containerFormat === MP4_CONTAINER || containerFormat === MOV_CONTAINER) && videoCodec === H264_CODEC) type = MP4_MIMETYPE;
2940
2707
  }
2941
-
2942
2708
  if (uri) {
2943
2709
  if (allowedMethods) {
2944
2710
  var _uri$split = uri.split('://'),
2945
- _uri$split2 = _slicedToArray__default["default"](_uri$split, 1),
2946
- thisMethod = _uri$split2[0];
2947
-
2711
+ _uri$split2 = _slicedToArray__default["default"](_uri$split, 1),
2712
+ thisMethod = _uri$split2[0];
2948
2713
  if (allowedMethods.includes(thisMethod)) src = uri;
2949
2714
  } else {
2950
2715
  src = uri;
2951
2716
  }
2952
2717
  }
2953
-
2954
2718
  if (src && allowedMimeTypes.includes(type)) {
2955
2719
  var _acc$push;
2956
-
2957
2720
  acc.push((_acc$push = {}, _defineProperty__default["default"](_acc$push, sourceKey, src), _defineProperty__default["default"](_acc$push, mimeTypeKey, type), _defineProperty__default["default"](_acc$push, shapeKey, shapeType), _defineProperty__default["default"](_acc$push, parsedShapeKey, parsedShape), _acc$push));
2958
2721
  }
2959
-
2960
2722
  return acc;
2961
2723
  }, []);
2962
2724
  if (typeof sortPriority === 'function') filteredShapeList.sort(defaultSortPriority);
2963
2725
  return filteredShapeList;
2964
2726
  };
2965
2727
 
2966
- var SHAPE_MEDIA_TYPES = {
2967
- IMAGE: 'IMAGE',
2968
- AUDIO: 'AUDIO',
2969
- VIDEO: 'VIDEO',
2970
- DOCUMENT: 'DOCUMENT',
2971
- BINARY: 'BINARY'
2972
- };
2973
-
2974
2728
  /**
2975
2729
  * Returns a const for which media type a shape has
2976
2730
  *
@@ -2982,19 +2736,16 @@ var SHAPE_MEDIA_TYPES = {
2982
2736
  var getShapeMediaType = function getShapeMediaType(shape) {
2983
2737
  var parsedShape = parseShapeType(shape);
2984
2738
  var mimeType = parsedShape.mimeType,
2985
- videoCodec = parsedShape.videoCodec,
2986
- audioCodec = parsedShape.audioCodec;
2739
+ videoCodec = parsedShape.videoCodec,
2740
+ audioCodec = parsedShape.audioCodec;
2987
2741
  if (!mimeType) return undefined;
2988
-
2989
2742
  if (mimeType.startsWith('audio/')) {
2990
2743
  if (audioCodec !== undefined) return SHAPE_MEDIA_TYPES.AUDIO;
2991
2744
  }
2992
-
2993
2745
  if (mimeType.startsWith('video/')) {
2994
2746
  if (videoCodec !== undefined) return SHAPE_MEDIA_TYPES.VIDEO;
2995
2747
  if (audioCodec !== undefined) return SHAPE_MEDIA_TYPES.AUDIO;
2996
2748
  }
2997
-
2998
2749
  if (mimeType.startsWith('image/')) return SHAPE_MEDIA_TYPES.IMAGE;
2999
2750
  if (mimeType.endsWith('/pdf')) return SHAPE_MEDIA_TYPES.DOCUMENT;
3000
2751
  if (mimeType.startsWith('text/')) return SHAPE_MEDIA_TYPES.DOCUMENT;
@@ -3019,13 +2770,11 @@ var getShapeMediaType = function getShapeMediaType(shape) {
3019
2770
  */
3020
2771
  var findNearestThumbnail = function findNearestThumbnail(itemType, timeCode) {
3021
2772
  var tcSeconds = createTimeCode(timeCode).toSeconds();
3022
-
3023
2773
  var _ref = itemType || {},
3024
- _ref$thumbnails = _ref.thumbnails,
3025
- thumbnails = _ref$thumbnails === void 0 ? {} : _ref$thumbnails;
3026
-
2774
+ _ref$thumbnails = _ref.thumbnails,
2775
+ thumbnails = _ref$thumbnails === void 0 ? {} : _ref$thumbnails;
3027
2776
  var _thumbnails$uri = thumbnails.uri,
3028
- srcList = _thumbnails$uri === void 0 ? [] : _thumbnails$uri;
2777
+ srcList = _thumbnails$uri === void 0 ? [] : _thumbnails$uri;
3029
2778
  var srcTcSeconds = srcList.map(function (url) {
3030
2779
  var tc = new URL(url).pathname.split('/').pop();
3031
2780
  return formatTimeCodeText(tc).toSeconds();
@@ -3037,7 +2786,8 @@ var findNearestThumbnail = function findNearestThumbnail(itemType, timeCode) {
3037
2786
  };
3038
2787
 
3039
2788
  var _excluded = ["Codec"],
3040
- _excluded2 = ["Codec"];
2789
+ _excluded2 = ["Codec"];
2790
+
3041
2791
  /**
3042
2792
  * TODO
3043
2793
  */
@@ -3052,36 +2802,29 @@ var _excluded = ["Codec"],
3052
2802
  */
3053
2803
  var parseMediaConvertPreset = function parseMediaConvertPreset(mediaconvert) {
3054
2804
  var output = {};
3055
-
3056
2805
  var _ref = mediaconvert || {},
3057
- _ref$outputSetting = _ref.outputSetting,
3058
- outputSetting = _ref$outputSetting === void 0 ? [] : _ref$outputSetting;
3059
-
2806
+ _ref$outputSetting = _ref.outputSetting,
2807
+ outputSetting = _ref$outputSetting === void 0 ? [] : _ref$outputSetting;
3060
2808
  if (outputSetting.length === 0) return output;
3061
2809
  var mc = JSON.parse(outputSetting[0]);
3062
2810
  var _mc$Settings = mc.Settings;
3063
2811
  _mc$Settings = _mc$Settings === void 0 ? {} : _mc$Settings;
3064
2812
  var ContainerSettings = _mc$Settings.ContainerSettings,
3065
- VideoDescription = _mc$Settings.VideoDescription,
3066
- AudioDescriptions = _mc$Settings.AudioDescriptions;
3067
-
2813
+ VideoDescription = _mc$Settings.VideoDescription,
2814
+ AudioDescriptions = _mc$Settings.AudioDescriptions;
3068
2815
  if (ContainerSettings) {
3069
2816
  output.containerFormat = ContainerSettings.Container;
3070
2817
  }
3071
-
3072
2818
  if (VideoDescription) {
3073
2819
  var _VideoDescription$Cod = VideoDescription.CodecSettings,
3074
- CodecSettings = _VideoDescription$Cod === void 0 ? {} : _VideoDescription$Cod;
3075
-
2820
+ CodecSettings = _VideoDescription$Cod === void 0 ? {} : _VideoDescription$Cod;
3076
2821
  var Codec = CodecSettings.Codec,
3077
- otherSettings = _objectWithoutProperties__default["default"](CodecSettings, _excluded);
3078
-
2822
+ otherSettings = _objectWithoutProperties__default["default"](CodecSettings, _excluded);
3079
2823
  output.videoFormat = Codec;
3080
2824
  var height = VideoDescription.Height,
3081
- width = VideoDescription.Width;
2825
+ width = VideoDescription.Width;
3082
2826
  output.height = height;
3083
2827
  output.width = width;
3084
-
3085
2828
  if (height && width) {
3086
2829
  output.dimension = "".concat(width, "x").concat(height);
3087
2830
  output.aspectRatio = parseAspectRatio({
@@ -3089,17 +2832,14 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(mediaconvert) {
3089
2832
  width: width
3090
2833
  });
3091
2834
  }
3092
-
3093
2835
  var _Object$values = Object.values(otherSettings),
3094
- _Object$values2 = _slicedToArray__default["default"](_Object$values, 1),
3095
- codecSpecs = _Object$values2[0];
3096
-
2836
+ _Object$values2 = _slicedToArray__default["default"](_Object$values, 1),
2837
+ codecSpecs = _Object$values2[0];
3097
2838
  if (codecSpecs) {
3098
2839
  output.fieldOrder = codecSpecs.InterlaceMode;
3099
2840
  if (output.fieldOrder && output.fieldOrder.includes('TOP')) output.fieldOrder = 'interlaced';
3100
2841
  output.videoBitrate = codecSpecs.Bitrate;
3101
2842
  var numerator = codecSpecs.FramerateDenominator; // other way round to vs ¯\_(ツ)_/¯
3102
-
3103
2843
  var denominator = codecSpecs.FramerateNumerator;
3104
2844
  var timeBase = formatTimeBaseType({
3105
2845
  denominator: denominator,
@@ -3109,78 +2849,61 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(mediaconvert) {
3109
2849
  output.frameRate = timeBase.toConstant() || timeBase.toRate();
3110
2850
  }
3111
2851
  }
3112
-
3113
2852
  if (AudioDescriptions && AudioDescriptions.length > 0) {
3114
2853
  var _AudioDescriptions$0$ = AudioDescriptions[0].CodecSettings,
3115
- _CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
3116
-
2854
+ _CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
3117
2855
  var _Codec = _CodecSettings.Codec,
3118
- _otherSettings = _objectWithoutProperties__default["default"](_CodecSettings, _excluded2);
3119
-
2856
+ _otherSettings = _objectWithoutProperties__default["default"](_CodecSettings, _excluded2);
3120
2857
  output.audioFormat = _Codec;
3121
-
3122
2858
  var _Object$values3 = Object.values(_otherSettings),
3123
- _Object$values4 = _slicedToArray__default["default"](_Object$values3, 1),
3124
- _codecSpecs = _Object$values4[0];
3125
-
2859
+ _Object$values4 = _slicedToArray__default["default"](_Object$values3, 1),
2860
+ _codecSpecs = _Object$values4[0];
3126
2861
  if (_codecSpecs) {
3127
2862
  output.audioSamplerate = _codecSpecs.SampleRate;
3128
2863
  output.audioBitrate = _codecSpecs.Bitrate;
3129
2864
  output.audioBitRateMode = _codecSpecs.RateControlMode;
3130
2865
  }
3131
2866
  }
3132
-
3133
2867
  return output;
3134
2868
  };
3135
2869
 
3136
2870
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3137
-
3138
2871
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3139
2872
  /**
3140
- * TODO
3141
- */
3142
-
3143
- /**
3144
- * TODO
2873
+ * Parse a VidiCore transcode preset
3145
2874
  *
3146
- * @param transcodePresetType
3147
- * @returns
2875
+ * @param transcodePresetType a VidiCore transcode preset
2876
+ * @returns A parsed transcode preset
3148
2877
  *
3149
2878
  * @category Transcode
3150
2879
  */
3151
2880
  var parseTranscodePreset = function parseTranscodePreset(transcodePresetType) {
3152
2881
  var output = {};
3153
-
3154
2882
  var _ref = transcodePresetType || {},
3155
- description = _ref.description,
3156
- format = _ref.format,
3157
- audio = _ref.audio,
3158
- video = _ref.video,
3159
- mediaconvert = _ref.mediaconvert;
3160
-
2883
+ description = _ref.description,
2884
+ format = _ref.format,
2885
+ audio = _ref.audio,
2886
+ video = _ref.video,
2887
+ mediaconvert = _ref.mediaconvert;
3161
2888
  if (mediaconvert) return _objectSpread({
3162
2889
  description: description
3163
2890
  }, parseMediaConvertPreset(mediaconvert));
3164
2891
  output.description = description;
3165
2892
  output.containerFormat = format;
3166
-
3167
2893
  if (video) {
3168
2894
  output.videoFormat = video.codec;
3169
2895
  output.videoBitrate = video.bitrate;
3170
-
3171
2896
  if (video.framerate) {
3172
2897
  var timeBase = formatTimeBaseType(video.framerate);
3173
2898
  output.timeBase = timeBase;
3174
2899
  output.frameRate = timeBase.toConstant() || timeBase.toRate();
3175
2900
  }
3176
-
3177
2901
  if (video.scaling) {
3178
2902
  var _video$scaling = video.scaling,
3179
- height = _video$scaling.height,
3180
- width = _video$scaling.width;
2903
+ height = _video$scaling.height,
2904
+ width = _video$scaling.width;
3181
2905
  output.height = height;
3182
2906
  output.width = width;
3183
-
3184
2907
  if (height && width) {
3185
2908
  output.dimension = "".concat(width, "x").concat(height);
3186
2909
  output.aspectRatio = parseAspectRatio({
@@ -3190,21 +2913,22 @@ var parseTranscodePreset = function parseTranscodePreset(transcodePresetType) {
3190
2913
  }
3191
2914
  }
3192
2915
  }
3193
-
3194
2916
  if (audio) {
3195
2917
  var audioFormat = audio.codec,
3196
- channel = audio.channel;
2918
+ channel = audio.channel;
3197
2919
  output.audioFormat = audioFormat;
3198
2920
  if (channel) output.audioChannels = channel.length;
3199
2921
  }
3200
-
3201
2922
  return output;
3202
2923
  };
3203
2924
 
2925
+ exports.DOCUMENT_TYPES = DOCUMENT_TYPES;
3204
2926
  exports.FIELD_ATTRIBUTE_KEYS = FIELD_ATTRIBUTE_KEYS;
3205
2927
  exports.FIELD_VALUE_ATTRIBUTE_KEYS = FIELD_VALUE_ATTRIBUTE_KEYS;
2928
+ exports.FILE_STATES = FILE_STATES;
3206
2929
  exports.GROUP_ATTRIBUTE_KEYS = GROUP_ATTRIBUTE_KEYS;
3207
2930
  exports.ROLE_NAMES = ROLE_NAMES;
2931
+ exports.SHAPE_MEDIA_TYPES = SHAPE_MEDIA_TYPES;
3208
2932
  exports.SYSTEM_FIELDGROUPS = SYSTEM_FIELDGROUPS;
3209
2933
  exports.SYSTEM_FIELDS = SYSTEM_FIELDS;
3210
2934
  exports.TimeBase = TimeBase;