@vidispine/vdt-js 23.2.0-pre.1 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1469 -1376
- package/dist/index.js +1585 -214
- package/dist/index.umd.cjs +5 -0
- package/package.json +43 -34
- package/dist/index.es.js +0 -271
- package/dist/index.es.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,78 +1,597 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1
|
+
import { filesize as N } from "filesize";
|
|
2
|
+
const ae = (e, t) => t ? ae(t, e % t) : e, P = (e) => {
|
|
3
|
+
const { width: t, height: r } = e || {};
|
|
4
|
+
if (t === void 0 || r === void 0)
|
|
5
|
+
return;
|
|
6
|
+
const n = ae(t, r);
|
|
7
|
+
let o = t / n, s = r / n;
|
|
8
|
+
return o > 21 && (s = 1, o = (t / r).toFixed(2)), [o, s].join(":");
|
|
9
|
+
}, b = (e) => Object.fromEntries((e == null ? void 0 : e.map(({ key: t, value: r }) => [t, r])) || []), Mt = {
|
|
10
|
+
ACCESSCONTROL_READ: "_accesscontrol_read",
|
|
11
|
+
ACCESSCONTROL_WRITE: "_accesscontrol_write",
|
|
12
|
+
ADMINISTRATOR: "_administrator",
|
|
13
|
+
AUTO_PROJECTION_READ: "_auto_projection_read",
|
|
14
|
+
AUTO_PROJECTION_WRITE: "_auto_projection_write",
|
|
15
|
+
COLLECTION_NOTIFICATION_READ: "_collection_notification_read",
|
|
16
|
+
COLLECTION_NOTIFICATION_WRITE: "_collection_notification_write",
|
|
17
|
+
COLLECTION_READ: "_collection_read",
|
|
18
|
+
COLLECTION_WRITE: "_collection_write",
|
|
19
|
+
CONFIGURATION_READ: "_configuration_read",
|
|
20
|
+
DELETION_LOCK_NOTIFICATION_READ: "_deletion_lock_notification_read",
|
|
21
|
+
DELETION_LOCK_NOTIFICATION_WRITE: "_deletion_lock_notification_write",
|
|
22
|
+
DELETION_LOCK_READ: "_deletion_lock_read",
|
|
23
|
+
DELETION_LOCK_WRITE: "_deletion_lock_write",
|
|
24
|
+
DOCUMENT_NOTIFICATION_READ: "_document_notification_read",
|
|
25
|
+
DOCUMENT_NOTIFICATION_WRITE: "_document_notification_write",
|
|
26
|
+
DOCUMENT_READ: "_document_read",
|
|
27
|
+
DOCUMENT_WRITE: "_document_write",
|
|
28
|
+
ERROR_READ: "_error_read",
|
|
29
|
+
ERROR_WRITE: "_error_write",
|
|
30
|
+
EXPORT: "_export",
|
|
31
|
+
EXPORT_TEMPLATE_READ: "_export_template_read",
|
|
32
|
+
EXPORT_TEMPLATE_WRITE: "_export_template_write",
|
|
33
|
+
EXTERNAL_ID_READ: "_external_id_read",
|
|
34
|
+
EXTERNAL_ID_WRITE: "_external_id_write",
|
|
35
|
+
FILE_NOTIFICATION_READ: "_file_notification_read",
|
|
36
|
+
FILE_NOTIFICATION_WRITE: "_file_notification_write",
|
|
37
|
+
FILE_READ: "_file_read",
|
|
38
|
+
FILE_WRITE: "_file_write",
|
|
39
|
+
GROUP_READ: "_group_read",
|
|
40
|
+
GROUP_WRITE: "_group_write",
|
|
41
|
+
IMPORT_WRITE: "_import",
|
|
42
|
+
ITEM_ID_READ: "_item_id_read",
|
|
43
|
+
ITEM_ID_WRITE: "_item_id_write",
|
|
44
|
+
ITEM_NOTIFICATION_READ: "_item_notification_read",
|
|
45
|
+
ITEM_NOTIFICATION_WRITE: "_item_notification_write",
|
|
46
|
+
ITEM_WRITE: "_item_write",
|
|
47
|
+
ITEM_SEARCH: "_item_search",
|
|
48
|
+
ITEM_SHAPE_READ: "_item_shape_read",
|
|
49
|
+
ITEM_SHAPE_WRITE: "_item_shape_write",
|
|
50
|
+
ITEM_TIMELINE_READ: "_item_timeline_read",
|
|
51
|
+
ITEM_TIMELINE_WRITE: "_item_timeline_write",
|
|
52
|
+
ITEM_URI: "_item_uri",
|
|
53
|
+
JOB_NOTIFICATION_READ: "_job_notification_read",
|
|
54
|
+
JOB_NOTIFICATION_WRITE: "_job_notification_write",
|
|
55
|
+
JOB_READ: "_job_read",
|
|
56
|
+
JOB_WRITE: "_job_write",
|
|
57
|
+
LIBRARY_READ: "_library_read",
|
|
58
|
+
LIBRARY_WRITE: "_library_write",
|
|
59
|
+
LOCK_READ: "_lock_read",
|
|
60
|
+
LOCK_WRITE: "_lock_write",
|
|
61
|
+
LOG_READ: "_log_read",
|
|
62
|
+
METADATA_DATASET_READ: "_metadata_dataset_read",
|
|
63
|
+
METADATA_DATASET_WRITE: "_metadata_dataset_write",
|
|
64
|
+
METADATA_FIELD_GROUP_READ: "_metadata_field_group_read",
|
|
65
|
+
METADATA_FIELD_GROUP_WRITE: "_metadata_field_group_write",
|
|
66
|
+
METADATA_FIELD_READ: "_metadata_field_read",
|
|
67
|
+
METADATA_FIELD_WRITE: "_metadata_field_write",
|
|
68
|
+
METADATA_GLOBAL_READ: "_metadata_global_read",
|
|
69
|
+
METADATA_GLOBAL_WRITE: "_metadata_global_write",
|
|
70
|
+
METADATA_LOCK_READ: "_metadata_lock_read",
|
|
71
|
+
METADATA_LOCK_WRITE: "_metadata_lock_write",
|
|
72
|
+
METADATA_READ: "_metadata_read",
|
|
73
|
+
METADATA_SCHEMA_READ: "_metadata_schema_read",
|
|
74
|
+
METADATA_SCHEMA_WRITE: "_metadata_schema_write",
|
|
75
|
+
METADATA_WRITE: "_metadata_write",
|
|
76
|
+
OTIF_ANALYZE: "_otif_analyze",
|
|
77
|
+
OTIF_READ: "_otif_read",
|
|
78
|
+
OTIF_WRITE: "_otif_write",
|
|
79
|
+
PLACEHOLDER_NOTIFICATION_READ: "_placeholder_notification_read",
|
|
80
|
+
PLACEHOLDER_NOTIFICATION_WRITE: "_placeholder_notification_write",
|
|
81
|
+
PROJECTION_READ: "_projection_read",
|
|
82
|
+
PROJECTION_WRITE: "_projection_write",
|
|
83
|
+
QUOTA_NOTIFICATION_READ: "_quota_notification_read",
|
|
84
|
+
QUOTA_NOTIFICATION_WRITE: "_quota_notification_write",
|
|
85
|
+
QUOTA_READ: "_quota_read",
|
|
86
|
+
QUOTA_WRITE: "_quota_write",
|
|
87
|
+
RELATION_READ: "_relation_read",
|
|
88
|
+
RELATION_WRITE: "_relation_write",
|
|
89
|
+
RESOURCE_READ: "_resource_read",
|
|
90
|
+
RESOURCE_WRITE: "_resource_write",
|
|
91
|
+
RUN_AS: "_run_as",
|
|
92
|
+
SEARCH: "_search",
|
|
93
|
+
SEQUENCE_READ: "_sequence_read",
|
|
94
|
+
SEQUENCE_WRITE: "_sequence_write",
|
|
95
|
+
SHAPE_TAG_READ: "_shape_tag_read",
|
|
96
|
+
SHAPE_TAG_WRITE: "_shape_tag_write",
|
|
97
|
+
SITE_MANAGER: "_site_manager",
|
|
98
|
+
SITE_RULE_READ: "_site_rule_read",
|
|
99
|
+
SITE_RULE_WRITE: "_site_rule_write",
|
|
100
|
+
STORAGE_GROUP_READ: "_storage_group_read",
|
|
101
|
+
STORAGE_GROUP_WRITE: "_storage_group_write",
|
|
102
|
+
STORAGE_NOTIFICATION_READ: "_storage_notification_read",
|
|
103
|
+
STORAGE_NOTIFICATION_WRITE: "_storage_notification_write",
|
|
104
|
+
STORAGE_READ: "_storage_read",
|
|
105
|
+
STORAGE_RULE_READ: "_storage_rule_read",
|
|
106
|
+
STORAGE_RULE_WRITE: "_storage_rule_write",
|
|
107
|
+
STORAGE_WRITE: "_storage_write",
|
|
108
|
+
SUPER_ACCESS_USER: "_super_access_user",
|
|
109
|
+
TASKDEFINITION_READ: "_taskdefinition_read",
|
|
110
|
+
TASKDEFINITION_WRITE: "_taskdefinition_write",
|
|
111
|
+
THUMBNAIL_READ: "_thumbnail_read",
|
|
112
|
+
THUMBNAIL_WRITE: "_thumbnail_write",
|
|
113
|
+
TRANSCODER: "_transcoder",
|
|
114
|
+
TRANSFER_READ: "_transfer_read",
|
|
115
|
+
TRANSFER_WRITE: "_transfer_write",
|
|
116
|
+
USER: "_user",
|
|
117
|
+
VXA: "_vxa",
|
|
118
|
+
VXA_READ: "_vxa_read"
|
|
119
|
+
}, vt = [
|
|
120
|
+
"stl_subtitle",
|
|
121
|
+
"stl_tti",
|
|
122
|
+
"stl_gsi",
|
|
123
|
+
"mrk_marker",
|
|
124
|
+
"pho_validation",
|
|
125
|
+
"pho_resource",
|
|
126
|
+
"pho_error",
|
|
127
|
+
"facedetect_rect",
|
|
128
|
+
"facedetect_face",
|
|
129
|
+
"originalTrackFilename",
|
|
130
|
+
"stl_gsiHeader"
|
|
131
|
+
], wt = [
|
|
132
|
+
"title",
|
|
133
|
+
"user",
|
|
134
|
+
"shapeTag",
|
|
135
|
+
"representativeThumbnail",
|
|
136
|
+
"representativeThumbnailNoAuth",
|
|
137
|
+
"representativeItems",
|
|
138
|
+
"itemId",
|
|
139
|
+
"collectionId",
|
|
140
|
+
"mediaType",
|
|
141
|
+
"mimeType",
|
|
142
|
+
"created",
|
|
143
|
+
"startTimeCode",
|
|
144
|
+
"startSeconds",
|
|
145
|
+
"fieldValidationError",
|
|
146
|
+
"schemaValidationError",
|
|
147
|
+
"originalFilename",
|
|
148
|
+
"originalUri",
|
|
149
|
+
"originalAudioCodec",
|
|
150
|
+
"originalVideoCodec",
|
|
151
|
+
"originalHeight",
|
|
152
|
+
"originalWidth",
|
|
153
|
+
"originalFormat",
|
|
154
|
+
"durationSeconds",
|
|
155
|
+
"durationTimeCode",
|
|
156
|
+
"solr-index",
|
|
157
|
+
"__user",
|
|
158
|
+
"__collection",
|
|
159
|
+
"__collection_size",
|
|
160
|
+
"__ancestor_collection",
|
|
161
|
+
"__ancestor_collection_size",
|
|
162
|
+
"__shape",
|
|
163
|
+
"__shape_size",
|
|
164
|
+
"__shape_last_added",
|
|
165
|
+
"__placeholder_shape_size",
|
|
166
|
+
"__version",
|
|
167
|
+
"__version_count",
|
|
168
|
+
"__storage",
|
|
169
|
+
"__storage_size",
|
|
170
|
+
"__shapetag_{tag}_hash_{hash}",
|
|
171
|
+
"__storage_{tag}",
|
|
172
|
+
"__storage_{tag}_size",
|
|
173
|
+
"__storagegroup",
|
|
174
|
+
"__storagegroup_size",
|
|
175
|
+
"__sequence",
|
|
176
|
+
"__sequence_size",
|
|
177
|
+
"__metadata_last_modified",
|
|
178
|
+
"__external_id",
|
|
179
|
+
"__deletion_lock_id",
|
|
180
|
+
"__deletion_lock_expiry",
|
|
181
|
+
"__child_collection",
|
|
182
|
+
"__child_collection_size",
|
|
183
|
+
"__parent_collection",
|
|
184
|
+
"__parent_collection_size",
|
|
185
|
+
"__items_size",
|
|
186
|
+
"stl_text",
|
|
187
|
+
"stl_justification",
|
|
188
|
+
"stl_xrelative",
|
|
189
|
+
"stl_yrelative",
|
|
190
|
+
"stl_vertical",
|
|
191
|
+
"stl_verticalbase",
|
|
192
|
+
"stl_horizontalbase",
|
|
193
|
+
"stl_sizerelative",
|
|
194
|
+
"stl_color",
|
|
195
|
+
"stl_outline",
|
|
196
|
+
"stl_outlinecolor",
|
|
197
|
+
"stl_outlinesize",
|
|
198
|
+
"stl_font",
|
|
199
|
+
"stl_service",
|
|
200
|
+
"stl_tti",
|
|
201
|
+
"stl_gsi",
|
|
202
|
+
"cct",
|
|
203
|
+
"tcd",
|
|
204
|
+
"tcf",
|
|
205
|
+
"oet",
|
|
206
|
+
"cd",
|
|
207
|
+
"mnc",
|
|
208
|
+
"cpn",
|
|
209
|
+
"dfc",
|
|
210
|
+
"tcp",
|
|
211
|
+
"tcs",
|
|
212
|
+
"tet",
|
|
213
|
+
"tnb",
|
|
214
|
+
"tnd",
|
|
215
|
+
"en",
|
|
216
|
+
"co",
|
|
217
|
+
"tng",
|
|
218
|
+
"rd",
|
|
219
|
+
"mnr",
|
|
220
|
+
"dsc",
|
|
221
|
+
"opt",
|
|
222
|
+
"lc",
|
|
223
|
+
"tpt",
|
|
224
|
+
"tn",
|
|
225
|
+
"slr",
|
|
226
|
+
"tns",
|
|
227
|
+
"rn",
|
|
228
|
+
"pub",
|
|
229
|
+
"dsn",
|
|
230
|
+
"ecd",
|
|
231
|
+
"mrk_zerolength",
|
|
232
|
+
"mrk_text",
|
|
233
|
+
"mrk_color",
|
|
234
|
+
"pho_resource_name",
|
|
235
|
+
"pho_error_level",
|
|
236
|
+
"pho_error_code",
|
|
237
|
+
"pho_error_description",
|
|
238
|
+
"facedetect_rect_width",
|
|
239
|
+
"facedetect_rect_height",
|
|
240
|
+
"facedetect_rect_y",
|
|
241
|
+
"facedetect_rect_x",
|
|
242
|
+
"facedetect_pid",
|
|
243
|
+
"facedetect_rect",
|
|
244
|
+
"trackId",
|
|
245
|
+
"eidr_actor",
|
|
246
|
+
"eidr_alternateId",
|
|
247
|
+
"eidr_countryOfOrigin",
|
|
248
|
+
"eidr_director",
|
|
249
|
+
"eidr_id",
|
|
250
|
+
"eidr_referentType",
|
|
251
|
+
"eidr_releaseDate",
|
|
252
|
+
"eidr_resourceName",
|
|
253
|
+
"eidr_status",
|
|
254
|
+
"eidr_sync",
|
|
255
|
+
"ttml_div",
|
|
256
|
+
"ttml_root",
|
|
257
|
+
"vxa_collection_id",
|
|
258
|
+
"vxaId",
|
|
259
|
+
"vxaLocalPath",
|
|
260
|
+
"tco",
|
|
261
|
+
"cs",
|
|
262
|
+
"ebn",
|
|
263
|
+
"tf",
|
|
264
|
+
"cf",
|
|
265
|
+
"sgn",
|
|
266
|
+
"tci",
|
|
267
|
+
"jc",
|
|
268
|
+
"vp",
|
|
269
|
+
"sn"
|
|
270
|
+
], U = [
|
|
271
|
+
"uuid",
|
|
272
|
+
"user",
|
|
273
|
+
"timestamp",
|
|
274
|
+
"change",
|
|
275
|
+
"conflict",
|
|
276
|
+
"mode"
|
|
277
|
+
], ce = [
|
|
278
|
+
"name",
|
|
279
|
+
"id",
|
|
280
|
+
"referenced",
|
|
281
|
+
"data",
|
|
282
|
+
"inheritance"
|
|
283
|
+
], ve = [
|
|
284
|
+
...U,
|
|
285
|
+
"value",
|
|
286
|
+
"lang"
|
|
287
|
+
], we = [
|
|
288
|
+
...U,
|
|
289
|
+
...ce,
|
|
290
|
+
"value",
|
|
291
|
+
"reference",
|
|
292
|
+
"type",
|
|
293
|
+
"track"
|
|
294
|
+
], Ce = [
|
|
295
|
+
...U,
|
|
296
|
+
...ce,
|
|
297
|
+
"cycle",
|
|
298
|
+
"field",
|
|
299
|
+
"group"
|
|
300
|
+
], x = (e) => Object.prototype.toString.call(e) === "[object Object]" && e.value !== void 0, de = (e) => ["string", "boolean", "number"].includes(typeof e), ue = (e) => x(e) && ((e == null ? void 0 : e.value) === null || x(e.value) || de(e.value)), Le = (e) => Object.prototype.toString.call(e) === "[object Object]", le = (e) => Object.prototype.toString.call(e) === "[object Date]", _e = (e) => e === null ? !0 : Array.isArray(e) ? e.some(_e) : de(e) || ue(e) || le(e), me = (e) => {
|
|
301
|
+
const t = (r) => Le(r) && r.value === void 0 && !!Object.entries(e);
|
|
302
|
+
return Array.isArray(e) ? e.every(me) : t(e);
|
|
303
|
+
}, Be = (e, t) => e + (t.length > 1 ? "s" : ""), fe = (e, t) => {
|
|
304
|
+
const r = e.filter((n) => !t.includes(n));
|
|
305
|
+
if (r.length)
|
|
306
|
+
throw Error(
|
|
307
|
+
`Unsupported ${Be("key", r)} (${r.join(", ")})`
|
|
308
|
+
);
|
|
309
|
+
}, pe = (e) => {
|
|
310
|
+
if (Array.isArray(e))
|
|
311
|
+
throw Error("Invalid value inside value object, cannot be array");
|
|
312
|
+
return [void 0, null].includes(e) ? {} : le(e) ? { value: e.toISOString() } : { value: e.toString() };
|
|
313
|
+
}, je = (e) => {
|
|
314
|
+
if (fe(Object.keys(e), ve), Object.keys(e).length === 0)
|
|
315
|
+
throw Error("Invalid value object, cannot be empty object");
|
|
316
|
+
if (typeof (e == null ? void 0 : e.value) == "string")
|
|
317
|
+
return e;
|
|
318
|
+
const t = pe(e == null ? void 0 : e.value);
|
|
319
|
+
return { ...e, ...t !== void 0 ? t : {} };
|
|
320
|
+
}, $ = (e) => {
|
|
321
|
+
if (![void 0, null].includes(e))
|
|
322
|
+
return Array.isArray(e) ? e.flatMap($) : x(e) ? je(e) : pe(e);
|
|
323
|
+
}, We = (e) => {
|
|
324
|
+
fe(Object.keys(e), we);
|
|
325
|
+
const t = $(e == null ? void 0 : e.value);
|
|
326
|
+
if (t === void 0) {
|
|
327
|
+
const { value: r, ...n } = e;
|
|
328
|
+
return n;
|
|
329
|
+
}
|
|
330
|
+
return {
|
|
331
|
+
...e,
|
|
332
|
+
value: [...Array.isArray(t) ? t : [t]]
|
|
333
|
+
};
|
|
334
|
+
}, xe = (e) => {
|
|
335
|
+
if (ue(e))
|
|
336
|
+
return We(e);
|
|
337
|
+
const t = $(e);
|
|
338
|
+
if (t !== void 0)
|
|
339
|
+
return { value: [...Array.isArray(t) ? t : [t]] };
|
|
340
|
+
}, Te = (e) => {
|
|
341
|
+
const t = [], r = [];
|
|
342
|
+
let n = {};
|
|
343
|
+
return Object.entries(e || {}).forEach(([o, s]) => {
|
|
344
|
+
if (Ce.includes(o))
|
|
345
|
+
n = { ...n, [o]: s };
|
|
346
|
+
else if (_e(s))
|
|
347
|
+
try {
|
|
348
|
+
r.push({ name: o, ...xe(s) });
|
|
349
|
+
} catch (a) {
|
|
350
|
+
throw Error(a.message + (o ? ` for field "${o}"` : ""));
|
|
351
|
+
}
|
|
352
|
+
else if (me(s))
|
|
353
|
+
(Array.isArray(s) ? s : [s]).forEach((a) => {
|
|
354
|
+
t.push({ name: o, ...Te(a) });
|
|
355
|
+
});
|
|
356
|
+
else
|
|
357
|
+
throw Error(`Unhandled value for "${o}"`);
|
|
358
|
+
}), {
|
|
359
|
+
...n,
|
|
360
|
+
...t.length > 0 ? { group: t } : {},
|
|
361
|
+
...r.length > 0 ? { field: r } : {}
|
|
362
|
+
};
|
|
363
|
+
}, Pe = (e) => {
|
|
364
|
+
const { start: t = "-INF", end: r = "+INF", base: n = void 0, ...o } = e, { group: s, field: a } = Te(o);
|
|
365
|
+
return {
|
|
366
|
+
...s ? { group: s } : {},
|
|
367
|
+
...a ? { field: a } : {},
|
|
368
|
+
start: t.toString(),
|
|
369
|
+
end: r.toString(),
|
|
370
|
+
...n ? { base: n } : {}
|
|
371
|
+
};
|
|
372
|
+
}, Ct = (e) => ({
|
|
373
|
+
timespan: (Array.isArray(e) ? e : [e || {}]).map((t) => Pe(t))
|
|
374
|
+
}), Ue = (e, t) => {
|
|
375
|
+
var o, s;
|
|
376
|
+
const [r] = ((o = e == null ? void 0 : e.start) == null ? void 0 : o.split("@")) || [], [n] = ((s = t == null ? void 0 : t.start) == null ? void 0 : s.split("@")) || [];
|
|
377
|
+
return Number(r) < Number(n) ? -1 : Number(r) > Number(n) ? 1 : 0;
|
|
378
|
+
}, g = (e) => Array.isArray(e) ? e : e && [e] || [], Z = (e) => Array.isArray(e) ? e.pop() : e, $e = (e) => (e == null ? void 0 : e.every((t) => typeof t == "string")) || !1, Ee = {
|
|
379
|
+
includeValueAttributes: !1
|
|
380
|
+
};
|
|
381
|
+
function Ge(e, t) {
|
|
382
|
+
const { includeValueAttributes: r } = {
|
|
383
|
+
...Ee,
|
|
384
|
+
...t || {}
|
|
385
|
+
};
|
|
386
|
+
if (r === !1)
|
|
387
|
+
return e == null ? void 0 : e.value;
|
|
388
|
+
const { value: n, ...o } = e;
|
|
389
|
+
return { ...r === !0 && o || Array.isArray(r) && Object.fromEntries(
|
|
390
|
+
Object.entries(o).filter(
|
|
391
|
+
([a]) => r.includes(a)
|
|
392
|
+
)
|
|
393
|
+
) || {}, value: n };
|
|
394
|
+
}
|
|
395
|
+
const he = {
|
|
396
|
+
...Ee,
|
|
397
|
+
joinValue: void 0,
|
|
398
|
+
arrayOnSingleValue: !0
|
|
399
|
+
};
|
|
400
|
+
function Ve(e, t) {
|
|
401
|
+
const { joinValue: r, arrayOnSingleValue: n, ...o } = {
|
|
402
|
+
...he,
|
|
403
|
+
...t || {}
|
|
404
|
+
}, s = e == null ? void 0 : e.map((a) => Ge(a, o));
|
|
405
|
+
return $e(s) && r ? s == null ? void 0 : s.join(r) : n !== !0 && (s == null ? void 0 : s.length) <= 1 ? s == null ? void 0 : s[0] : s;
|
|
406
|
+
}
|
|
407
|
+
const Ae = {
|
|
408
|
+
includeFieldAttributes: !1,
|
|
409
|
+
...he
|
|
410
|
+
}, ke = (e, t) => {
|
|
411
|
+
const { includeFieldAttributes: r, ...n } = {
|
|
412
|
+
...Ae,
|
|
413
|
+
...t || {}
|
|
414
|
+
}, { value: o, ...s } = e, a = Ve(o, n), i = r === !0 && s || Array.isArray(r) && Object.fromEntries(
|
|
415
|
+
Object.entries(s).filter(
|
|
416
|
+
([c]) => r.includes(c)
|
|
417
|
+
)
|
|
418
|
+
) || {};
|
|
419
|
+
return r ? { ...i, value: a } : a;
|
|
420
|
+
}, C = {
|
|
421
|
+
...Ae,
|
|
422
|
+
fieldAsList: !1,
|
|
423
|
+
arrayOnSingleField: !1,
|
|
424
|
+
overrideField: void 0
|
|
425
|
+
}, Oe = (e, t) => {
|
|
426
|
+
const r = {
|
|
427
|
+
...C,
|
|
428
|
+
...t || {}
|
|
429
|
+
}, { fieldAsList: n, arrayOnSingleField: o, overrideField: s } = r, a = s === !0 && n === !1, i = {};
|
|
430
|
+
return e == null || e.forEach((c) => {
|
|
431
|
+
const { name: l } = c, u = ke(c, r), _ = o === !0 ? g(u) : u, f = i[l];
|
|
432
|
+
f ? a ? i[l] = u : i[l] = [g(f), g(u)].flat() : i[l] = _;
|
|
433
|
+
}), n === !0 ? Object.values(i).flat() : i;
|
|
434
|
+
}, Ie = {
|
|
435
|
+
...C,
|
|
436
|
+
includeGroupAttributes: !1,
|
|
437
|
+
groupAsList: !1,
|
|
438
|
+
arrayOnSingleGroup: !1,
|
|
439
|
+
overrideGroup: void 0
|
|
440
|
+
}, He = (e, t) => {
|
|
441
|
+
const r = {
|
|
442
|
+
...Ie,
|
|
443
|
+
...t || {}
|
|
444
|
+
}, { includeGroupAttributes: n } = r, o = Object.fromEntries(
|
|
445
|
+
Object.entries(r).filter(
|
|
446
|
+
([_]) => Object.keys(C).includes(_)
|
|
447
|
+
)
|
|
448
|
+
), { field: s, group: a, ...i } = e, c = s && Oe(s, o), l = a && Re(a, r);
|
|
449
|
+
return {
|
|
450
|
+
...n === !0 && i || Array.isArray(n) && Object.fromEntries(
|
|
451
|
+
Object.entries(i).filter(
|
|
452
|
+
([_]) => n.includes(_)
|
|
453
|
+
)
|
|
454
|
+
) || {},
|
|
455
|
+
...o != null && o.fieldAsList ? c && { field: c } || {} : c,
|
|
456
|
+
...r != null && r.groupAsList ? l && { group: l } || {} : l
|
|
457
|
+
};
|
|
458
|
+
}, G = Ie, Re = (e, t) => {
|
|
459
|
+
const r = { ...G, ...t || {} }, { groupAsList: n, arrayOnSingleGroup: o, overrideGroup: s } = r, a = s === !0 && n === !1, i = {};
|
|
460
|
+
return e == null || e.forEach((c) => {
|
|
461
|
+
const { name: l } = c, u = He(c, r), _ = o === !0 ? g(u) : u, f = i[l];
|
|
462
|
+
f ? a ? i[l] = u : i[l] = [
|
|
463
|
+
g(f),
|
|
464
|
+
g(u)
|
|
465
|
+
].flat() : i[l] = _;
|
|
466
|
+
}), n ? Object.values(i).flat() : i;
|
|
467
|
+
}, Se = {
|
|
468
|
+
...G,
|
|
469
|
+
includeTimespanAttributes: !1,
|
|
470
|
+
flat: !1,
|
|
471
|
+
arrayOnSingle: !1,
|
|
472
|
+
arrayOnSingleValue: !0,
|
|
473
|
+
arrayOnSingleGroup: void 0,
|
|
474
|
+
arrayOnSingleField: void 0
|
|
475
|
+
}, Ye = (e, t) => {
|
|
476
|
+
const r = {
|
|
477
|
+
...Se,
|
|
478
|
+
...t || {}
|
|
479
|
+
}, { includeTimespanAttributes: n, arrayOnSingle: o, flat: s } = r, a = Object.fromEntries(
|
|
480
|
+
Object.entries(t).map(([d, m]) => {
|
|
481
|
+
if (Object.keys(G).includes(d))
|
|
482
|
+
return ["arrayOnSingleGroup", "arrayOnSingleField", "arrayOnSingleValue"].includes(d) && (m !== void 0 ? m : o === !0) ? [d, !0] : ["overrideGroup", "overrideField"].includes(d) && (m !== void 0 ? m : s === !0) ? [d, !0] : [d, m];
|
|
483
|
+
}).filter((d) => !!d)
|
|
484
|
+
), i = Object.fromEntries(
|
|
485
|
+
Object.entries(t).map(([d, m]) => {
|
|
486
|
+
if (Object.keys(C).includes(d))
|
|
487
|
+
return ["arrayOnSingleField", "arrayOnSingleValue"].includes(d) && (m !== void 0 ? m : o === !0) ? [d, !0] : ["overrideField"].includes(d) && (m !== void 0 ? m : s === !0) ? [d, !0] : [d, m];
|
|
488
|
+
}).filter((d) => !!d)
|
|
489
|
+
), { field: c, group: l, ...u } = e || {}, _ = c && Oe(c, i), f = l && Re(l, a);
|
|
490
|
+
return {
|
|
491
|
+
...n === !0 && u || Array.isArray(n) && Object.fromEntries(
|
|
492
|
+
Object.entries(u).filter(
|
|
493
|
+
([d]) => n.includes(d)
|
|
494
|
+
)
|
|
495
|
+
) || {},
|
|
496
|
+
...i != null && i.fieldAsList ? { field: _ } : _,
|
|
497
|
+
...a != null && a.groupAsList ? { group: f } : f
|
|
498
|
+
};
|
|
499
|
+
}, V = {
|
|
500
|
+
...Se,
|
|
501
|
+
timespanAsList: !1,
|
|
502
|
+
joinTimespan: "_",
|
|
503
|
+
sortTimespan: !1,
|
|
504
|
+
flat: !1,
|
|
505
|
+
flatTimespan: void 0
|
|
506
|
+
}, ge = (e, t) => {
|
|
507
|
+
const r = {
|
|
508
|
+
...V,
|
|
509
|
+
...t || {}
|
|
510
|
+
}, { timespanAsList: n, joinTimespan: o, sortTimespan: s, flat: a, flatTimespan: i, ...c } = r, l = { flat: a, ...c };
|
|
511
|
+
s && e.sort(Ue);
|
|
512
|
+
const u = (i !== void 0 ? i === !0 : a === !0) && n === !1, _ = {};
|
|
513
|
+
return e == null || e.forEach((f) => {
|
|
514
|
+
const { start: p, end: d } = f, m = u ? "flat" : [p, d].join(o), T = Ye(f, l), E = _[m];
|
|
515
|
+
E ? u ? p === "-INF" && d === "+INF" ? _[m] = { ...Z(E), ...T } : _[m] = { ...T, ...Z(E) } : _[m] = [...g(E), T] : _[m] = T;
|
|
516
|
+
}), n === !0 ? Object.values(_) : u ? Object.values(_).pop() : _;
|
|
517
|
+
}, Ke = {
|
|
518
|
+
...V,
|
|
519
|
+
includeMetadataAttributes: !1,
|
|
520
|
+
flat: !1
|
|
521
|
+
};
|
|
522
|
+
function Lt(e, t) {
|
|
523
|
+
const r = {
|
|
524
|
+
...Ke,
|
|
525
|
+
...t || {}
|
|
526
|
+
}, { includeMetadataAttributes: n, flat: o } = r, { timespan: s = [], ...a } = e || {}, i = Object.fromEntries(
|
|
527
|
+
Object.entries(t).map(([u, _]) => {
|
|
528
|
+
if (Object.keys(V).includes(u))
|
|
529
|
+
return ["onlyGeneric", "overrideGroup", "overrideField"].includes(u) && (_ !== void 0 ? _ : o === !0) ? [u, !0] : [u, _];
|
|
530
|
+
}).filter((u) => !!u)
|
|
531
|
+
), c = ge(
|
|
532
|
+
s,
|
|
533
|
+
i
|
|
534
|
+
);
|
|
535
|
+
return {
|
|
536
|
+
...n === !0 && {
|
|
537
|
+
...a,
|
|
538
|
+
...a.revision ? { revision: a.revision.split(",") } : {}
|
|
539
|
+
} || Array.isArray(n) && Object.fromEntries(
|
|
540
|
+
Object.entries(a).map(([u, _]) => {
|
|
541
|
+
if (n.includes(u))
|
|
542
|
+
return [
|
|
543
|
+
u,
|
|
544
|
+
u === "revision" && typeof _ == "string" ? _.split(",") : _
|
|
545
|
+
];
|
|
546
|
+
}).filter((u) => !!u)
|
|
547
|
+
) || {},
|
|
548
|
+
...i != null && i.timespanAsList ? { timespan: c } : c
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
const Bt = (e) => {
|
|
552
|
+
const { field: t = [] } = e || {};
|
|
553
|
+
return b(t);
|
|
554
|
+
}, k = {
|
|
555
|
+
PAL: { denominator: 25, numerator: 1 },
|
|
556
|
+
NTSC: { denominator: 3e4, numerator: 1001 },
|
|
557
|
+
NTSC30: { denominator: 30, numerator: 1 },
|
|
558
|
+
29.97: { denominator: 3e4, numerator: 1001 },
|
|
559
|
+
59.94: { denominator: 6e4, numerator: 1001 },
|
|
560
|
+
23.976: { denominator: 48e3, numerator: 2002 },
|
|
561
|
+
23.98: { denominator: 48e3, numerator: 2002 }
|
|
562
|
+
}, ee = Object.keys(k), te = {
|
|
563
|
+
toText: {
|
|
564
|
+
constant: !1,
|
|
565
|
+
fraction: !1
|
|
566
|
+
},
|
|
567
|
+
toRate: {
|
|
568
|
+
fixed: !0,
|
|
569
|
+
rounded: !1
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
class h {
|
|
573
|
+
/**
|
|
69
574
|
* Constructor for TimeBase
|
|
70
575
|
*
|
|
71
576
|
* @param timeBaseType A TimeBaseType object
|
|
72
|
-
*/
|
|
577
|
+
*/
|
|
578
|
+
constructor(t) {
|
|
579
|
+
this.numerator = 1, this.denominator = 1;
|
|
580
|
+
const { numerator: r = 1, denominator: n = 1 } = t || {};
|
|
581
|
+
this.numerator = Number(r), this.denominator = Number(n);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
73
584
|
* Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
|
|
74
585
|
* @returns Constant representation of the TimeBase
|
|
75
|
-
*/
|
|
586
|
+
*/
|
|
587
|
+
toConstant() {
|
|
588
|
+
let t;
|
|
589
|
+
return Object.entries(k).find((r) => {
|
|
590
|
+
const [n, o] = r, { numerator: s, denominator: a } = o;
|
|
591
|
+
return s === this.numerator && a === this.denominator ? (t = n, !0) : !1;
|
|
592
|
+
}), t;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
76
595
|
* Get TimeBase as a VidiCore TimeBaseType string
|
|
77
596
|
*
|
|
78
597
|
* @remarks
|
|
@@ -82,7 +601,17 @@ function ownKeys$f(object,enumerableOnly){var keys=Object.keys(object);if(Object
|
|
|
82
601
|
*
|
|
83
602
|
* @param options For how to display it as text
|
|
84
603
|
* @returns Text representation of the TimeBase
|
|
85
|
-
*/
|
|
604
|
+
*/
|
|
605
|
+
toText(t) {
|
|
606
|
+
const { constant: r, fraction: n } = { ...te.toText, ...t };
|
|
607
|
+
if (r) {
|
|
608
|
+
const s = this.toConstant();
|
|
609
|
+
if (s)
|
|
610
|
+
return s;
|
|
611
|
+
}
|
|
612
|
+
return n || this.numerator > 1 ? [this.denominator, this.numerator].join(":") : String(this.denominator);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
86
615
|
* Output TimeBase as frame rate (by default max 16 decimal places)
|
|
87
616
|
*
|
|
88
617
|
* @remarks
|
|
@@ -93,32 +622,100 @@ function ownKeys$f(object,enumerableOnly){var keys=Object.keys(object);if(Object
|
|
|
93
622
|
* @param options On how to return the rate
|
|
94
623
|
*
|
|
95
624
|
* @return Rate of the TimeBase
|
|
96
|
-
*/
|
|
625
|
+
*/
|
|
626
|
+
toRate(t) {
|
|
627
|
+
const r = this.denominator / this.numerator;
|
|
628
|
+
if (Number.isInteger(r))
|
|
629
|
+
return r;
|
|
630
|
+
const { rounded: n, fixed: o } = { ...te.toRate, ...t || {} };
|
|
631
|
+
return n ? Math.round(r) : o === !0 || typeof o == "number" ? Number(r.toFixed(typeof o == "boolean" ? 2 : o)) : r;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
97
634
|
* Get TimeBase in a object representation
|
|
98
635
|
*
|
|
99
636
|
* @returns TimeBase as `{denominator, numerator}` object
|
|
100
|
-
*/
|
|
637
|
+
*/
|
|
638
|
+
toObject() {
|
|
639
|
+
return {
|
|
640
|
+
denominator: this.denominator,
|
|
641
|
+
numerator: this.numerator
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
101
645
|
* @deprecated Use {@link TimeBase#toObject | toObject} instead
|
|
102
646
|
*
|
|
103
647
|
* @returns TimeBase as `{denominator, numerator}` object
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
648
|
+
*/
|
|
649
|
+
toJson() {
|
|
650
|
+
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
const H = (e) => {
|
|
654
|
+
if (e === void 0)
|
|
655
|
+
return new h();
|
|
656
|
+
if (typeof e == "number")
|
|
657
|
+
return new h({ denominator: e });
|
|
658
|
+
if (typeof e == "string" && e.includes(":")) {
|
|
659
|
+
const [t, r] = e.split(":");
|
|
660
|
+
return new h({ denominator: t, numerator: r });
|
|
661
|
+
}
|
|
662
|
+
if (ee.includes(e))
|
|
663
|
+
return new h(k[e]);
|
|
664
|
+
if (!["string", "number"].includes(typeof e) || Number.isNaN(Number(e)))
|
|
665
|
+
throw new Error(
|
|
666
|
+
`timeBaseText must be a number or ${ee.join(",")} - is ${JSON.stringify(
|
|
667
|
+
e
|
|
668
|
+
)}`
|
|
669
|
+
);
|
|
670
|
+
return new h({ denominator: Number(e) });
|
|
671
|
+
}, y = (e) => new h(e), M = (e) => e instanceof h ? e : typeof e == "string" || typeof e == "number" ? H(e) : y(e), Y = (e) => {
|
|
672
|
+
const t = e.toConstant();
|
|
673
|
+
return t === "59.94" && 4 || ["NTSC", "29.97"].includes(t) && 2 || void 0;
|
|
674
|
+
}, be = (e) => Y(e) > 0, re = (e) => {
|
|
675
|
+
const { samples: t, timeBase: r } = e, n = Y(r);
|
|
676
|
+
if (!n)
|
|
677
|
+
return 0;
|
|
678
|
+
const o = r.toRate({ rounded: !0 }), s = 60 * o, a = 60 * o - n, i = 10 * (s - n) + n, c = Math.floor((t + 1) / i), l = Math.max(
|
|
679
|
+
0,
|
|
680
|
+
(t + 1) % i - s
|
|
681
|
+
), u = Math.floor(
|
|
682
|
+
l / a
|
|
683
|
+
), f = l % a > 0 ? n : 0;
|
|
684
|
+
return c * 9 * n + u * n + f;
|
|
685
|
+
}, B = {
|
|
686
|
+
conformTimeBase: {
|
|
687
|
+
dropFrame: void 0,
|
|
688
|
+
frameSeparator: void 0
|
|
689
|
+
},
|
|
690
|
+
toText: {
|
|
691
|
+
constant: !1,
|
|
692
|
+
fraction: !1,
|
|
693
|
+
includeTimeBaseForSeconds: !1
|
|
694
|
+
},
|
|
695
|
+
toDuration: {
|
|
696
|
+
format: void 0
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
class I {
|
|
700
|
+
/**
|
|
117
701
|
* Constructor for TimeCode
|
|
118
702
|
*
|
|
119
703
|
* @param timeCodeType Object to create TimeCode of
|
|
120
704
|
* @param options Options for the timeCode
|
|
121
|
-
*/
|
|
705
|
+
*/
|
|
706
|
+
constructor(t, r) {
|
|
707
|
+
this.samples = 0, this.timeBase = new h();
|
|
708
|
+
const { samples: n, timeBase: o } = t || {};
|
|
709
|
+
if (n !== void 0)
|
|
710
|
+
if (typeof n == "number")
|
|
711
|
+
this.samples = n;
|
|
712
|
+
else if (typeof n == "string")
|
|
713
|
+
n === "-INF" ? this.samples = -1 / 0 : n === "+INF" ? this.samples = 1 / 0 : this.samples = Number(n);
|
|
714
|
+
else
|
|
715
|
+
throw new Error(`samples is not number/string/-Inf/+Inf is: ${n}`);
|
|
716
|
+
o !== void 0 && (o instanceof h ? this.timeBase = o : this.timeBase = M(o)), this.dropFrame = (r == null ? void 0 : r.dropFrame) ?? be(this.timeBase), this.frameSeparator = (r == null ? void 0 : r.frameSeparator) ?? (this.dropFrame ? ";" : ":");
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
122
719
|
* Return this TimeCode added with the supplied timeCodeType
|
|
123
720
|
* - If time bases differ, it will retain the time base of this TimeCode instance
|
|
124
721
|
* - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
|
|
@@ -132,7 +729,17 @@ var _excluded$6=["hours"];function ownKeys$e(object,enumerableOnly){var keys=Obj
|
|
|
132
729
|
*
|
|
133
730
|
* @param timeCode A TimeCode instance you want to add with
|
|
134
731
|
* @returns A new TimeCode instance with the addition applied
|
|
135
|
-
*/
|
|
732
|
+
*/
|
|
733
|
+
add(t) {
|
|
734
|
+
if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
|
|
735
|
+
throw Error("Invalid timeCodeType, cannot be added");
|
|
736
|
+
const { numerator: r, denominator: n } = (t == null ? void 0 : t.timeBase) || {};
|
|
737
|
+
let o = t;
|
|
738
|
+
(r !== this.timeBase.numerator || n !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
739
|
+
const { samples: s } = o;
|
|
740
|
+
return new I({ samples: this.samples + s, timeBase: this.timeBase });
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
136
743
|
* Return this TimeCode subtracted with the supplied timeCodeType
|
|
137
744
|
* - If time bases differ, it will retain the time base of the instance time code
|
|
138
745
|
* - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
|
|
@@ -146,7 +753,17 @@ var _excluded$6=["hours"];function ownKeys$e(object,enumerableOnly){var keys=Obj
|
|
|
146
753
|
*
|
|
147
754
|
* @param timeCode A TimeCode instance you want to subtract with
|
|
148
755
|
* @returns A new TimeCode instance with the subtraction applied
|
|
149
|
-
*/
|
|
756
|
+
*/
|
|
757
|
+
subtract(t) {
|
|
758
|
+
if (!(t != null && t.timeBase) || (t == null ? void 0 : t.samples) === void 0)
|
|
759
|
+
throw Error("Invalid timeCodeType, cannot be subtracted");
|
|
760
|
+
const { timeBase: { numerator: r, denominator: n } = {} } = t;
|
|
761
|
+
let o = t;
|
|
762
|
+
(r !== this.timeBase.numerator || n !== this.timeBase.denominator) && (o = t.conformTimeBase(this.timeBase));
|
|
763
|
+
const { samples: s } = o;
|
|
764
|
+
return new I({ samples: this.samples - s, timeBase: this.timeBase });
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
150
767
|
* Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
|
|
151
768
|
*
|
|
152
769
|
* @remarks
|
|
@@ -156,7 +773,20 @@ var _excluded$6=["hours"];function ownKeys$e(object,enumerableOnly){var keys=Obj
|
|
|
156
773
|
* @param timeBase The TimeBase it should conform the TimeCode to
|
|
157
774
|
* @param options Explicitly set TimeCode options, by default these are derived from `timeBase`
|
|
158
775
|
* @returns A new TimeCode instance with the conformTo timeBase applied
|
|
159
|
-
*/
|
|
776
|
+
*/
|
|
777
|
+
conformTimeBase(t, r) {
|
|
778
|
+
const n = t instanceof h ? t : M(t), o = Math.floor(
|
|
779
|
+
this.samples / (this.timeBase.toRate({ fixed: !1 }) / n.toRate({ fixed: !1 }))
|
|
780
|
+
), s = { ...B.conformTimeBase, ...r || {} };
|
|
781
|
+
return new I(
|
|
782
|
+
{
|
|
783
|
+
samples: o,
|
|
784
|
+
timeBase: n
|
|
785
|
+
},
|
|
786
|
+
s
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
160
790
|
* Get TimeCode as a text representation
|
|
161
791
|
*
|
|
162
792
|
* @remarks
|
|
@@ -166,24 +796,66 @@ var _excluded$6=["hours"];function ownKeys$e(object,enumerableOnly){var keys=Obj
|
|
|
166
796
|
*
|
|
167
797
|
* @param options Options for how to format text
|
|
168
798
|
* @returns Text representation of TimeCode
|
|
169
|
-
*/
|
|
799
|
+
*/
|
|
800
|
+
toText(t) {
|
|
801
|
+
let r = `${this.samples}`;
|
|
802
|
+
const n = { ...B.toText, ...t || {} }, o = this.timeBase.toText(n);
|
|
803
|
+
return (t != null && t.includeTimeBaseForSeconds || !["1", "1:1"].includes(o)) && (r = [this.samples, o].join("@")), r;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
170
806
|
* Get TimeCode in a units object representation
|
|
171
807
|
*
|
|
172
808
|
* @remarks
|
|
173
809
|
* If samples is `Infinity` it also returns `Infinity` for all units
|
|
174
810
|
*
|
|
175
811
|
* @returns Units (time and frames) for the time code
|
|
176
|
-
*/
|
|
812
|
+
*/
|
|
813
|
+
toUnits() {
|
|
814
|
+
if (this.samples === 1 / 0)
|
|
815
|
+
return {
|
|
816
|
+
hours: 1 / 0,
|
|
817
|
+
minutes: 1 / 0,
|
|
818
|
+
seconds: 1 / 0,
|
|
819
|
+
frames: 1 / 0
|
|
820
|
+
};
|
|
821
|
+
const t = this.samples + (this.dropFrame ? re(this) : 0);
|
|
822
|
+
let r = this.timeBase.toRate({ rounded: !0 });
|
|
823
|
+
["23.976", "23.98"].includes(this.timeBase.toConstant()) && (r = this.timeBase.toRate({ fixed: !0 }));
|
|
824
|
+
const n = Math.floor(t / (3600 * r)), o = Math.floor(t / (60 * r)) % 60, s = Math.floor(t / r) % 60, a = Math.floor(t % r);
|
|
825
|
+
return {
|
|
826
|
+
hours: n,
|
|
827
|
+
minutes: o,
|
|
828
|
+
seconds: s,
|
|
829
|
+
frames: a
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
177
833
|
* Get TimeCode in a time object representation
|
|
178
834
|
*
|
|
179
835
|
* Note: "milliseconds" is rounded down - use "partialSeconds" for another representation
|
|
180
836
|
*
|
|
181
837
|
* @returns Time for the time code
|
|
182
|
-
*/
|
|
838
|
+
*/
|
|
839
|
+
toTime() {
|
|
840
|
+
const t = this.samples + re(this), { hours: r, minutes: n, seconds: o } = this.toUnits(), s = this.timeBase.toRate({ rounded: !0 }), a = t % s, i = Math.floor(1e3 * a / s), c = a / s;
|
|
841
|
+
return {
|
|
842
|
+
hours: r,
|
|
843
|
+
minutes: n,
|
|
844
|
+
seconds: o,
|
|
845
|
+
milliseconds: i,
|
|
846
|
+
partialSeconds: c
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
183
850
|
* Get TimeCode in a seconds representation
|
|
184
851
|
*
|
|
185
852
|
* @returns Total seconds for the time code
|
|
186
|
-
*/
|
|
853
|
+
*/
|
|
854
|
+
toSeconds() {
|
|
855
|
+
const { numerator: t, denominator: r } = this.timeBase;
|
|
856
|
+
return Math.round(1e3 * +(this.samples * t / r)) / 1e3;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
187
859
|
* Get TimeCode in a duration representation
|
|
188
860
|
*
|
|
189
861
|
* The time unit keys for the format string are:
|
|
@@ -201,132 +873,831 @@ var _excluded$6=["hours"];function ownKeys$e(object,enumerableOnly){var keys=Obj
|
|
|
201
873
|
*
|
|
202
874
|
* @param options Options for how to display duration
|
|
203
875
|
* @returns Duration representation of the TimeCode
|
|
204
|
-
*/
|
|
876
|
+
*/
|
|
877
|
+
toDuration(t) {
|
|
878
|
+
const { format: r } = { ...B.toDuration, ...t || {} }, { hours: n, ...o } = this.toTime();
|
|
879
|
+
let { minutes: s, seconds: a, milliseconds: i } = o;
|
|
880
|
+
if (r && typeof r != "string")
|
|
881
|
+
throw Error("format has to be a string");
|
|
882
|
+
const c = (f, p) => !r.includes(f) || !p.some((d) => r.includes(d) && r.lastIndexOf(f) > r.indexOf(d));
|
|
883
|
+
if (r && !(c("h", ["m", "s", "S"]) && c("m", ["s", "S"]) && c("s", ["S"])))
|
|
884
|
+
throw Error("format order is unsupported (has to be h, m, s then S)");
|
|
885
|
+
if (!r)
|
|
886
|
+
return `${n > 0 ? `${n}:${`${s}`.padStart(2, "0")}` : s}:${`${a}`.padStart(2, "0")}`;
|
|
887
|
+
const l = (f, p) => {
|
|
888
|
+
let d = f;
|
|
889
|
+
for (; p[d] === p[d + 1]; )
|
|
890
|
+
d += 1;
|
|
891
|
+
return d - f + 1;
|
|
892
|
+
}, u = ["h", "m", "s", "S"], _ = [];
|
|
893
|
+
return [...r].forEach((f, p, d) => {
|
|
894
|
+
switch (f) {
|
|
895
|
+
case "h": {
|
|
896
|
+
if (d[p - 1] === "h")
|
|
897
|
+
break;
|
|
898
|
+
const m = l(p, d);
|
|
899
|
+
_.push(`${n}`.padStart(m, "0")), u.includes(d[p + m]) && _.push(":");
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
case "m": {
|
|
903
|
+
if (d[p - 1] === "m")
|
|
904
|
+
break;
|
|
905
|
+
const m = l(p, d);
|
|
906
|
+
r.includes("h") || (s += n * 60), _.push(`${s}`.padStart(m, "0")), u.includes(d[p + m]) && _.push(":");
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
case "s": {
|
|
910
|
+
if (d[p - 1] === "s")
|
|
911
|
+
break;
|
|
912
|
+
const m = l(p, d);
|
|
913
|
+
r.includes("m") || (a += s * 60), _.push(`${a}`.padStart(m, "0")), u.includes(d[p + m]) && _.push(".");
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
case "S": {
|
|
917
|
+
if (d[p - 1] === "S")
|
|
918
|
+
break;
|
|
919
|
+
const m = l(p, d);
|
|
920
|
+
r.includes("s") || (i += a * 1e3), _.push(`${Math.round(i / 10 ** (3 - m))}`.padStart(m, "0"));
|
|
921
|
+
break;
|
|
922
|
+
}
|
|
923
|
+
default:
|
|
924
|
+
_.push(f);
|
|
925
|
+
}
|
|
926
|
+
}), _.join("");
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
205
929
|
* Get TimeCode in a smpte representation
|
|
206
930
|
*
|
|
207
931
|
* @returns Smpte representation of the TimeCode
|
|
208
|
-
*/
|
|
932
|
+
*/
|
|
933
|
+
toSmpte() {
|
|
934
|
+
if (this.samples === -1 / 0)
|
|
935
|
+
return "00:00:00:00";
|
|
936
|
+
const { hours: t, minutes: r, seconds: n, frames: o } = this.toUnits(), s = [
|
|
937
|
+
t.toFixed().padStart(2, "0"),
|
|
938
|
+
r.toFixed().padStart(2, "0"),
|
|
939
|
+
n.toFixed().padStart(2, "0")
|
|
940
|
+
].join(":"), a = Math.max(2, `${this.timeBase.toRate({ rounded: !0 }) - 1}`.length);
|
|
941
|
+
return [s, `${o}`.padStart(a, "0")].join(this.frameSeparator);
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
209
944
|
* Get TimeCode as a VidiCore TimeCodeType object
|
|
210
945
|
*
|
|
211
946
|
* @returns TimeCode as `{ samples, timeBase }`
|
|
212
|
-
*/
|
|
947
|
+
*/
|
|
948
|
+
toObject() {
|
|
949
|
+
return {
|
|
950
|
+
samples: this.samples,
|
|
951
|
+
timeBase: this.timeBase.toObject()
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
213
955
|
* @deprecated Use {@link TimeCode#toObject | toObject} instead
|
|
214
956
|
*
|
|
215
957
|
* @returns TimeCode as `{ samples, timeBase }`
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
958
|
+
*/
|
|
959
|
+
toJson() {
|
|
960
|
+
return console.warn("Deprecated - use toObject instead"), this.toObject();
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
const ze = (e, t) => {
|
|
964
|
+
let r = Math.abs(e), n = Math.abs(t);
|
|
965
|
+
for (; r && n && r !== n; )
|
|
966
|
+
r > n ? [r, n] = [r - n, n] : [r, n] = [r, n - r];
|
|
967
|
+
return r || n;
|
|
968
|
+
}, Je = (e, t) => {
|
|
969
|
+
const { timeBase: r, useGCD: n = !1, ...o } = t || {}, s = `${e}`.replace(/,/g, ".");
|
|
970
|
+
if (Number.isNaN(+s))
|
|
971
|
+
throw new Error(`seconds must be digits, is ${e}`);
|
|
972
|
+
let a = 1, i;
|
|
973
|
+
if (Number.isInteger(+s))
|
|
974
|
+
i = +s * a;
|
|
975
|
+
else {
|
|
976
|
+
const [, l] = s.split("."), u = Math.min((l == null ? void 0 : l.length) ?? 0, 16);
|
|
977
|
+
a *= 10 ** u, i = Math.round(Number(s) * a);
|
|
978
|
+
}
|
|
979
|
+
if (r === void 0 && n) {
|
|
980
|
+
const l = ze(a, i);
|
|
981
|
+
i /= l, a /= l;
|
|
982
|
+
}
|
|
983
|
+
const c = new I(
|
|
984
|
+
{ samples: i, timeBase: { denominator: a, numerator: 1 } },
|
|
985
|
+
o
|
|
986
|
+
);
|
|
987
|
+
return r !== void 0 ? c.conformTimeBase(M(r), o) : c;
|
|
988
|
+
}, Xe = ([e, t, r, n], o, s) => {
|
|
989
|
+
const a = s.toRate({ rounded: !0 }), i = Y(s);
|
|
990
|
+
if (o === 0 || !i)
|
|
991
|
+
return 0;
|
|
992
|
+
const c = t % 10 !== 0, l = c && r === 0, u = e * (3600 * a - 54 * i), _ = t * 60 * a - (t - Math.ceil(t / 10)) * i, f = r * a - (c && r > 1 ? i : 0);
|
|
993
|
+
if (l && n < i)
|
|
994
|
+
throw new Error(
|
|
995
|
+
`Frame does not exist for ${s.toConstant() || s.toRate()} drop-frame`
|
|
996
|
+
);
|
|
997
|
+
const p = l ? n - i : n, d = u + _ + f + p;
|
|
998
|
+
return o - d;
|
|
999
|
+
}, j = (e, t, r) => {
|
|
1000
|
+
const [n, o, s, a] = e, i = t.toRate({ rounded: !0 }), c = n * 3600 * i + o * 60 * i + s * i + a;
|
|
1001
|
+
return c - (r ? Xe(e, c, t) : 0);
|
|
1002
|
+
}, qe = (e) => {
|
|
1003
|
+
const [t] = (e == null ? void 0 : e.match(/[^0-9:\-_]/)) || [];
|
|
1004
|
+
let r = [];
|
|
1005
|
+
if (t) {
|
|
1006
|
+
const [o, s] = e.split(t);
|
|
1007
|
+
r = [...o.split(":"), s];
|
|
1008
|
+
} else
|
|
1009
|
+
r = e.split(":");
|
|
1010
|
+
if (r.length !== 4)
|
|
1011
|
+
throw new Error('Invalid format, must be "##:##:##:##');
|
|
1012
|
+
if (r.some((o) => Number.isNaN(o)))
|
|
1013
|
+
throw new Error("Invalid format, values must be numbers");
|
|
1014
|
+
const n = t || ":";
|
|
1015
|
+
return {
|
|
1016
|
+
smpteValues: r.map(Number),
|
|
1017
|
+
smpteFrameSeparator: n
|
|
1018
|
+
};
|
|
1019
|
+
}, Qe = ["error", "add", "ignore"], Ze = {
|
|
1020
|
+
exceedingMode: "error",
|
|
1021
|
+
timeBase: void 0,
|
|
1022
|
+
dropFrame: void 0,
|
|
1023
|
+
frameSeparator: void 0
|
|
1024
|
+
}, et = (e, t) => {
|
|
1025
|
+
const { exceedingMode: r, timeBase: n, ...o } = { ...Ze, ...t };
|
|
1026
|
+
if ([null, void 0].includes(e))
|
|
1027
|
+
throw new Error("smpte cannot be undefined or null");
|
|
1028
|
+
if (typeof e != "string")
|
|
1029
|
+
throw new Error(`smpte must be a string, is ${JSON.stringify(e)}`);
|
|
1030
|
+
const { smpteValues: s, smpteFrameSeparator: a } = qe(e), i = M(n), c = {
|
|
1031
|
+
...o,
|
|
1032
|
+
frameSeparator: (o == null ? void 0 : o.frameSeparator) || a,
|
|
1033
|
+
...(o == null ? void 0 : o.dropFrame) === void 0 ? {
|
|
1034
|
+
dropFrame: n !== void 0 ? be(i) : [";", ","].includes(a)
|
|
1035
|
+
} : {}
|
|
1036
|
+
}, l = i.toRate({ rounded: !0 }), u = Math.max(0, l - 1);
|
|
1037
|
+
if (s.some((f) => f < 0))
|
|
1038
|
+
throw new Error("Negative values are not supported");
|
|
1039
|
+
let _;
|
|
1040
|
+
switch (r) {
|
|
1041
|
+
case "error": {
|
|
1042
|
+
const [f, p, d, m] = s;
|
|
1043
|
+
if (f >= 100 || p >= 60)
|
|
1044
|
+
throw Error("Minutes has to be less than 60");
|
|
1045
|
+
if (d >= 60)
|
|
1046
|
+
throw Error("Seconds has to be less than 60");
|
|
1047
|
+
if (m > u)
|
|
1048
|
+
throw Error(`Frames has to be less or equal to ${u}`);
|
|
1049
|
+
_ = j(s, i, c == null ? void 0 : c.dropFrame);
|
|
1050
|
+
break;
|
|
1051
|
+
}
|
|
1052
|
+
case "ignore": {
|
|
1053
|
+
const [f, p, d, m] = s, T = [
|
|
1054
|
+
Math.min(100, f),
|
|
1055
|
+
Math.min(59, p),
|
|
1056
|
+
Math.min(59, d),
|
|
1057
|
+
Math.min(u, m)
|
|
1058
|
+
];
|
|
1059
|
+
_ = j(
|
|
1060
|
+
T,
|
|
1061
|
+
i,
|
|
1062
|
+
c == null ? void 0 : c.dropFrame
|
|
1063
|
+
);
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
case "add": {
|
|
1067
|
+
_ = j(s, i, c == null ? void 0 : c.dropFrame);
|
|
1068
|
+
break;
|
|
1069
|
+
}
|
|
1070
|
+
default:
|
|
1071
|
+
throw new Error(`Invalid exceedingMode, options are ${JSON.stringify(Qe)}`);
|
|
1072
|
+
}
|
|
1073
|
+
return new I({ samples: _, timeBase: i }, c);
|
|
1074
|
+
}, tt = {
|
|
1075
|
+
timeBase: void 0,
|
|
1076
|
+
dropFrame: void 0,
|
|
1077
|
+
frameSeparator: void 0
|
|
1078
|
+
}, w = (e, t) => {
|
|
1079
|
+
const { timeBase: r, ...n } = { ...tt, ...t };
|
|
1080
|
+
let o;
|
|
1081
|
+
if (e === void 0)
|
|
1082
|
+
o = { samples: 0 };
|
|
1083
|
+
else if (typeof e == "number")
|
|
1084
|
+
o = { samples: e };
|
|
1085
|
+
else if (e.includes("@")) {
|
|
1086
|
+
const [a, i] = e.split("@");
|
|
1087
|
+
o = { samples: Number(a), timeBase: H(i) };
|
|
1088
|
+
} else
|
|
1089
|
+
e === "-INF" ? o = { samples: -1 / 0 } : e === "+INF" ? o = { samples: 1 / 0 } : o = { samples: Number(e) };
|
|
1090
|
+
if (Number.isNaN(o == null ? void 0 : o.samples) || o.timeBase && !(o.timeBase instanceof h))
|
|
1091
|
+
throw new Error(`timeCodeText must be a number or sample@timeBase - is ${e}`);
|
|
1092
|
+
const s = new I(o, n);
|
|
1093
|
+
return r ? s.conformTimeBase(M(r), n) : s;
|
|
1094
|
+
}, rt = {
|
|
1095
|
+
dropFrame: void 0,
|
|
1096
|
+
frameSeparator: void 0
|
|
1097
|
+
}, F = (e, t) => new I(e, { ...rt, ...t }), ot = (e) => !!e.match(/^(\d\d+):(\d\d+):(\d\d+)(:|;|\.|,)(\d\d+)$/), nt = (e) => !Number.isNaN(Number(e)), st = (e, t) => {
|
|
1098
|
+
if (e instanceof I)
|
|
1099
|
+
return e;
|
|
1100
|
+
if (typeof e != "string" && typeof e != "number")
|
|
1101
|
+
return F(e, t);
|
|
1102
|
+
if (typeof e == "string" && ot(e))
|
|
1103
|
+
return et(e, t);
|
|
1104
|
+
if (["string", "number"].includes(typeof e) && nt(e))
|
|
1105
|
+
return Je(e, t);
|
|
1106
|
+
if (typeof e == "string")
|
|
1107
|
+
return w(e, t);
|
|
1108
|
+
};
|
|
1109
|
+
function oe({ hours: e = 0, minutes: t = 0, seconds: r = 0, partialSeconds: n = 0 }) {
|
|
1110
|
+
const o = e.toFixed().padStart(2, "0"), s = t.toFixed().padStart(2, "0"), a = r.toFixed().padStart(2, "0"), i = (n * 10).toFixed().padStart(3, "0");
|
|
1111
|
+
return `${o}:${s}:${a}.${i}`;
|
|
1112
|
+
}
|
|
1113
|
+
const it = {
|
|
1114
|
+
subtitleGroup: "stl_subtitle",
|
|
1115
|
+
subtitleField: "stl_text"
|
|
1116
|
+
}, jt = (e, t) => {
|
|
1117
|
+
const { subtitleGroup: r, subtitleField: n } = { ...it, ...t || {} }, { timespan: o = [] } = e || {};
|
|
1118
|
+
return o.length === 0 ? "" : `WEBVTT
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
${ge(o, {
|
|
1122
|
+
includeTimespanAttributes: !0,
|
|
1123
|
+
sortTimespan: !0,
|
|
1124
|
+
timespanAsList: !0,
|
|
1125
|
+
overrideGroup: !0,
|
|
1126
|
+
joinValue: ","
|
|
1127
|
+
}).map((i) => {
|
|
1128
|
+
const {
|
|
1129
|
+
start: c,
|
|
1130
|
+
end: l,
|
|
1131
|
+
[r]: { [n]: u } = {}
|
|
1132
|
+
} = (Array.isArray(i) ? i[0] : i) || {};
|
|
1133
|
+
if (!u)
|
|
1134
|
+
return "";
|
|
1135
|
+
const _ = oe(w(c).toTime()), f = oe(w(l).toTime());
|
|
1136
|
+
return `${_} --> ${f} line:0%\r${u}\r`;
|
|
1137
|
+
}).join(`
|
|
1138
|
+
`)}`;
|
|
1139
|
+
}, at = { count: !0, exclude: !0 }, Wt = (e = [], t = {}) => {
|
|
1140
|
+
const r = { ...at, ...t }, { count: n, exclude: o } = r;
|
|
1141
|
+
return e.map((s) => typeof s == "string" ? {
|
|
1142
|
+
field: s,
|
|
1143
|
+
name: s,
|
|
1144
|
+
count: n,
|
|
1145
|
+
...o === !0 ? { exclude: [s] } : {}
|
|
1146
|
+
} : s);
|
|
1147
|
+
}, xt = (e = []) => e == null ? void 0 : e.map(({ name: t, field: r, count: n, range: o }) => ({
|
|
1148
|
+
facetName: t,
|
|
1149
|
+
fieldName: r,
|
|
1150
|
+
count: n == null ? void 0 : n.reduce((s, { fieldValue: a, value: i }) => ({ ...s, [a]: i }), {}),
|
|
1151
|
+
...o ? {
|
|
1152
|
+
range: o.map(({ value: s, start: a, end: i }) => ({
|
|
1153
|
+
start: Number.isNaN(+a) ? a : Number(a),
|
|
1154
|
+
end: Number.isNaN(+i) ? i : Number(i),
|
|
1155
|
+
count: Number(s) || 0
|
|
1156
|
+
}))
|
|
1157
|
+
} : {}
|
|
1158
|
+
})), Pt = (e = []) => {
|
|
1159
|
+
const t = {};
|
|
1160
|
+
return e.forEach(({ name: r, field: n, count: o }) => {
|
|
1161
|
+
t[r || n] = o.reduce(
|
|
1162
|
+
(s, { fieldValue: a, value: i }) => ({ ...s, [a]: i }),
|
|
1163
|
+
{}
|
|
1164
|
+
);
|
|
1165
|
+
}), t;
|
|
1166
|
+
}, Ne = {
|
|
1167
|
+
arrayOnSingle: !0,
|
|
1168
|
+
joinValue: void 0,
|
|
1169
|
+
timespanAsList: !1
|
|
1170
|
+
}, W = (e, t) => {
|
|
1171
|
+
const {
|
|
1172
|
+
arrayOnSingle: r = !0,
|
|
1173
|
+
joinValue: n = void 0,
|
|
1174
|
+
timespanAsList: o = !1
|
|
1175
|
+
} = { ...Ne, ...t || {} }, { field: s = [], start: a, end: i } = e || {}, c = o ? { start: a, end: i } : {};
|
|
1176
|
+
return s.reduce((u, _) => {
|
|
1177
|
+
const { name: f, value: p = [] } = _;
|
|
1178
|
+
if (p.length === 0)
|
|
1179
|
+
return u;
|
|
1180
|
+
let d;
|
|
1181
|
+
return r === !1 && p.length === 1 ? [d] = p : n ? d = p.join(n) : d = p, { ...u, [f]: d };
|
|
1182
|
+
}, c);
|
|
1183
|
+
}, ct = {
|
|
1184
|
+
...Ne,
|
|
1185
|
+
timespanAsList: !1,
|
|
1186
|
+
joinTimespan: "_",
|
|
1187
|
+
flat: !1,
|
|
1188
|
+
flatTimespan: !1
|
|
1189
|
+
}, Ut = (e = [], t) => {
|
|
1190
|
+
const {
|
|
1191
|
+
timespanAsList: r,
|
|
1192
|
+
joinTimespan: n = "_",
|
|
1193
|
+
flat: o,
|
|
1194
|
+
flatTimespan: s,
|
|
1195
|
+
...a
|
|
1196
|
+
} = { ...ct, ...t || {} };
|
|
1197
|
+
return r === !0 ? e.map(
|
|
1198
|
+
(i) => W(i, { ...a, timespanAsList: r })
|
|
1199
|
+
) : o === !0 || s === !0 ? e.reduce(
|
|
1200
|
+
(i, c) => ({ ...i, ...W(c, t) }),
|
|
1201
|
+
{}
|
|
1202
|
+
) : e.reduce(
|
|
1203
|
+
(i, c) => ({
|
|
1204
|
+
...i,
|
|
1205
|
+
[[c.start, c.end].join(n)]: W(
|
|
1206
|
+
c,
|
|
1207
|
+
t
|
|
1208
|
+
)
|
|
1209
|
+
}),
|
|
1210
|
+
{}
|
|
1211
|
+
);
|
|
1212
|
+
}, $t = (e = "NOW") => {
|
|
1213
|
+
if (e.startsWith("NOW")) {
|
|
1214
|
+
if (e === "NOW")
|
|
1215
|
+
return /* @__PURE__ */ new Date();
|
|
1216
|
+
const t = e[3], r = Number(e.match(/(\d+)/)[0]), n = e.match(/(\d.*)/)[0].replace(/\d/g, ""), o = /* @__PURE__ */ new Date();
|
|
1217
|
+
switch (n) {
|
|
1218
|
+
case "HOUR":
|
|
1219
|
+
case "HOURS":
|
|
1220
|
+
t === "+" && o.setHours(o.getHours() + r), t === "-" && o.setHours(o.getHours() - r);
|
|
1221
|
+
break;
|
|
1222
|
+
case "DAY":
|
|
1223
|
+
case "DAYS":
|
|
1224
|
+
t === "+" && o.setDate(o.getDate() + r), t === "-" && o.setDate(o.getDate() - r);
|
|
1225
|
+
break;
|
|
1226
|
+
case "MONTH":
|
|
1227
|
+
case "MONTHS":
|
|
1228
|
+
t === "+" && o.setMonth(o.getMonth() + r), t === "-" && o.setMonth(o.getMonth() - r);
|
|
1229
|
+
break;
|
|
1230
|
+
case "YEAR":
|
|
1231
|
+
case "YEARS":
|
|
1232
|
+
t === "+" && o.setFullYear(o.getFullYear() + r), t === "-" && o.setFullYear(o.getFullYear() - r);
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
return o;
|
|
1236
|
+
}
|
|
1237
|
+
return new Date(e);
|
|
1238
|
+
}, L = (e) => {
|
|
1239
|
+
const { property: t = [], ...r } = e || {};
|
|
1240
|
+
return { ...b(t), ...r };
|
|
1241
|
+
}, dt = (e) => L(e), ut = (e) => L(e), lt = { kB: "kHz", B: "Hz", mB: "mHz" }, ne = { kB: "kbps", B: "bps", MB: "mbps" }, _t = (e) => {
|
|
1242
|
+
var T;
|
|
1243
|
+
const {
|
|
1244
|
+
timeBase: t,
|
|
1245
|
+
channelCount: r,
|
|
1246
|
+
codec: n,
|
|
1247
|
+
mediaInfo: o,
|
|
1248
|
+
bitrate: s,
|
|
1249
|
+
metadata: a
|
|
1250
|
+
} = e, i = dt(o), {
|
|
1251
|
+
Format: c,
|
|
1252
|
+
Resolution: l,
|
|
1253
|
+
Bit_rate_mode: u
|
|
1254
|
+
} = i, _ = b(a || []), f = t != null && t.denominator ? ((t == null ? void 0 : t.denominator) || 1) / ((t == null ? void 0 : t.numerator) || 1) : void 0, p = f !== void 0 ? N(f, {
|
|
1255
|
+
base: 10,
|
|
1256
|
+
round: 1,
|
|
1257
|
+
symbols: lt
|
|
1258
|
+
}) : void 0;
|
|
1259
|
+
let d, m;
|
|
1260
|
+
return s !== void 0 && (d = N(s, { round: 2, symbols: ne }), m = Number(
|
|
1261
|
+
(T = N(s, { exponent: 1, symbols: ne }).split(" kbps")) == null ? void 0 : T[0]
|
|
1262
|
+
)), {
|
|
1263
|
+
audioFormat: c,
|
|
1264
|
+
audioCodec: n,
|
|
1265
|
+
audioSamplerate: p,
|
|
1266
|
+
audioSamplerateSamples: f,
|
|
1267
|
+
audioBitDepth: l,
|
|
1268
|
+
audioBitrate: d,
|
|
1269
|
+
audioBitrateKbps: m,
|
|
1270
|
+
audioBitRateMode: u,
|
|
1271
|
+
audioChannels: r,
|
|
1272
|
+
audioMediaInfo: i,
|
|
1273
|
+
audioMetadata: _
|
|
1274
|
+
};
|
|
1275
|
+
}, Gt = {
|
|
1276
|
+
/** Just created, not used. */
|
|
1277
|
+
NONE: "NONE",
|
|
1278
|
+
/** Discovered or created, not yet marked as finished. */
|
|
1279
|
+
OPEN: "OPEN",
|
|
1280
|
+
/** File does no longer grow. */
|
|
1281
|
+
CLOSED: "CLOSED",
|
|
1282
|
+
/** The current state is not known. */
|
|
1283
|
+
UNKNOWN: "UNKNOWN",
|
|
1284
|
+
/** File is missing from the file system/storage. */
|
|
1285
|
+
MISSING: "MISSING",
|
|
1286
|
+
/** File has been missing for a longer period. Candidate for restoration from archive. */
|
|
1287
|
+
LOST: "LOST",
|
|
1288
|
+
/** File will appear on file system/storage, transfer subsystem or transcoder will create it. */
|
|
1289
|
+
TO_APPEAR: "TO_APPEAR",
|
|
1290
|
+
/** The file is no longer in use, and will be deleted at the next clean-up sweep. */
|
|
1291
|
+
TO_BE_DELETED: "TO_BE_DELETED",
|
|
1292
|
+
/** File is in use by transfer subsystem or transcoder. */
|
|
1293
|
+
BEING_READ: "BEING_READ",
|
|
1294
|
+
/** File is archived. */
|
|
1295
|
+
ARCHIVED: "ARCHIVED",
|
|
1296
|
+
/** File will be synchronized by multi-site agent. */
|
|
1297
|
+
AWAITING_SYNC: "AWAITING_SYNC"
|
|
1298
|
+
}, De = (e) => {
|
|
1299
|
+
const {
|
|
1300
|
+
uri: t = [],
|
|
1301
|
+
size: r,
|
|
1302
|
+
hash: n,
|
|
1303
|
+
path: o,
|
|
1304
|
+
id: s,
|
|
1305
|
+
storage: a
|
|
1306
|
+
} = e, [i] = t, c = r !== void 0 ? N(r, { base: 2, standard: "jedec" }) : "", l = (o == null ? void 0 : o.split("/")) || [], u = l.pop() || "", _ = l.map((f) => `${f}/`).join("") || void 0;
|
|
1307
|
+
return {
|
|
1308
|
+
uri: i,
|
|
1309
|
+
hash: n,
|
|
1310
|
+
fileSize: c,
|
|
1311
|
+
fileSizeBytes: r,
|
|
1312
|
+
path: o,
|
|
1313
|
+
fileName: u,
|
|
1314
|
+
fileId: s,
|
|
1315
|
+
storageId: a,
|
|
1316
|
+
folderPath: _
|
|
1317
|
+
};
|
|
1318
|
+
}, mt = (e = {}) => {
|
|
1319
|
+
const { file: t, mediaInfo: r, metadata: n = [] } = e, o = b(n), s = L(r);
|
|
1320
|
+
let a = { binaryMetadata: o, binaryMediaInfo: s };
|
|
1321
|
+
if (t) {
|
|
1322
|
+
const [i] = t, c = De(i);
|
|
1323
|
+
a = {
|
|
1324
|
+
...a,
|
|
1325
|
+
...c
|
|
1326
|
+
};
|
|
1327
|
+
}
|
|
1328
|
+
return a;
|
|
1329
|
+
}, ft = (e = {}) => {
|
|
1330
|
+
const {
|
|
1331
|
+
mediaInfo: t,
|
|
1332
|
+
metadata: r,
|
|
1333
|
+
file: n,
|
|
1334
|
+
duration: o,
|
|
1335
|
+
startTimestamp: s,
|
|
1336
|
+
startTimecode: a,
|
|
1337
|
+
timeCodeTimeBase: i
|
|
1338
|
+
} = e, c = b(r || []), l = L(t);
|
|
1339
|
+
let { Format: u } = l;
|
|
1340
|
+
const {
|
|
1341
|
+
Video_Format_List: _,
|
|
1342
|
+
Audio_Format_List: f,
|
|
1343
|
+
Text_Format_List: p
|
|
1344
|
+
} = l;
|
|
1345
|
+
if (u === void 0) {
|
|
1346
|
+
const { format: m } = e;
|
|
1347
|
+
u = m, m && m.includes(",") && ([u] = m.split(","));
|
|
1348
|
+
}
|
|
1349
|
+
let d = {
|
|
1350
|
+
containerFormat: u,
|
|
1351
|
+
videoFormat: _,
|
|
1352
|
+
audioFormat: f,
|
|
1353
|
+
textFormat: p,
|
|
1354
|
+
containerMetadata: c,
|
|
1355
|
+
containerMediaInfo: l
|
|
1356
|
+
};
|
|
1357
|
+
if (c.componentOriginalFilename && (d.originalFilename = c.componentOriginalFilename), o !== void 0 && o.samples !== 0) {
|
|
1358
|
+
const m = F(o);
|
|
1359
|
+
d.durationTimeCode = m.toObject(), d.duration = m.toDuration();
|
|
1360
|
+
}
|
|
1361
|
+
if (s && (d.startTimestamp = F(s).toObject()), a !== void 0 && i && (d.startTimecode = F({
|
|
1362
|
+
samples: a,
|
|
1363
|
+
timeBase: i
|
|
1364
|
+
})), n) {
|
|
1365
|
+
const [m] = n, T = De(m);
|
|
1366
|
+
d = {
|
|
1367
|
+
...d,
|
|
1368
|
+
...T
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
return d;
|
|
1372
|
+
}, se = { kB: "kbps", B: "bps", MB: "mbps" }, pt = (e = {}) => {
|
|
1373
|
+
var q;
|
|
1374
|
+
const {
|
|
1375
|
+
codec: t,
|
|
1376
|
+
bitrate: r,
|
|
1377
|
+
fieldOrder: n,
|
|
1378
|
+
resolution: o,
|
|
1379
|
+
mediaInfo: s,
|
|
1380
|
+
metadata: a = []
|
|
1381
|
+
} = e, i = ut(s), c = b(a), {
|
|
1382
|
+
Format: l,
|
|
1383
|
+
"Frame rate": u,
|
|
1384
|
+
"Color space": _,
|
|
1385
|
+
"Color primaries": f,
|
|
1386
|
+
Colorimetry: p
|
|
1387
|
+
} = i;
|
|
1388
|
+
let d;
|
|
1389
|
+
const { averageFrameRate: m, realBaseFrameRate: T } = e;
|
|
1390
|
+
T !== void 0 ? d = y({
|
|
1391
|
+
numerator: T.denominator,
|
|
1392
|
+
denominator: T.numerator
|
|
1393
|
+
}) : u !== void 0 ? d = H(u) : m !== void 0 && (d = y({
|
|
1394
|
+
numerator: m.denominator,
|
|
1395
|
+
denominator: m.numerator
|
|
1396
|
+
}));
|
|
1397
|
+
let { "Frame count": E } = i;
|
|
1398
|
+
if (E === void 0) {
|
|
1399
|
+
const { numberOfPackets: Q } = e;
|
|
1400
|
+
Q !== void 0 && (E = Q.toString());
|
|
1401
|
+
}
|
|
1402
|
+
let A, R, S;
|
|
1403
|
+
E && d && (A = F({ samples: E, timeBase: d }), R = A.timeBase.toConstant() || A.timeBase.toRate(), S = A.toSmpte());
|
|
1404
|
+
const { height: K, width: z } = o || {}, ye = P(o), Me = `${z}x${K}`;
|
|
1405
|
+
let J, X;
|
|
1406
|
+
return r !== void 0 && (J = N(r, { round: 2, symbols: se }), X = Number(
|
|
1407
|
+
(q = N(r, { exponent: 2, symbols: se }).split(" mbps")) == null ? void 0 : q[0]
|
|
1408
|
+
)), {
|
|
1409
|
+
videoFormat: l,
|
|
1410
|
+
dimension: Me,
|
|
1411
|
+
frameRate: R,
|
|
1412
|
+
height: K,
|
|
1413
|
+
width: z,
|
|
1414
|
+
timeBase: d,
|
|
1415
|
+
timeCode: A,
|
|
1416
|
+
videoCodec: t,
|
|
1417
|
+
smpte: S,
|
|
1418
|
+
videoBitrate: J,
|
|
1419
|
+
videoBitrateMbps: X,
|
|
1420
|
+
fieldOrder: n,
|
|
1421
|
+
colorSpace: _,
|
|
1422
|
+
chromaSubsampling: p,
|
|
1423
|
+
aspectRatio: ye,
|
|
1424
|
+
colorPrimaries: f,
|
|
1425
|
+
videoMetadata: c,
|
|
1426
|
+
videoMediaInfo: i
|
|
1427
|
+
};
|
|
1428
|
+
}, Fe = (e = {}) => {
|
|
1429
|
+
let t = {};
|
|
1430
|
+
const {
|
|
1431
|
+
containerComponent: r,
|
|
1432
|
+
videoComponent: n,
|
|
1433
|
+
audioComponent: o,
|
|
1434
|
+
binaryComponent: s,
|
|
1435
|
+
mimeType: a = [],
|
|
1436
|
+
tag: i = []
|
|
1437
|
+
} = e;
|
|
1438
|
+
if ([t.tag] = i, [t.mimeType] = a, r) {
|
|
1439
|
+
const c = ft(r);
|
|
1440
|
+
t = {
|
|
1441
|
+
...t,
|
|
1442
|
+
...c
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
if (n) {
|
|
1446
|
+
const [c] = n, l = pt(c);
|
|
1447
|
+
t = {
|
|
1448
|
+
...t,
|
|
1449
|
+
...l
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
if (o) {
|
|
1453
|
+
const [c] = o, l = _t(c);
|
|
1454
|
+
t = {
|
|
1455
|
+
...t,
|
|
1456
|
+
...l
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
if (s) {
|
|
1460
|
+
const [c] = s, l = mt(c);
|
|
1461
|
+
t = {
|
|
1462
|
+
...t,
|
|
1463
|
+
...l
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
return t;
|
|
1467
|
+
}, D = {
|
|
1468
|
+
PDF: "PDF",
|
|
1469
|
+
TEXT: "TEXT",
|
|
1470
|
+
MSWORD: "MSWORD",
|
|
1471
|
+
JSON: "JSON",
|
|
1472
|
+
XML: "XML"
|
|
1473
|
+
}, O = {
|
|
1474
|
+
IMAGE: "IMAGE",
|
|
1475
|
+
AUDIO: "AUDIO",
|
|
1476
|
+
VIDEO: "VIDEO",
|
|
1477
|
+
DOCUMENT: "DOCUMENT",
|
|
1478
|
+
BINARY: "BINARY"
|
|
1479
|
+
}, Vt = (e = {}) => {
|
|
1480
|
+
const { mimeType: t } = e, r = Array.isArray(t) ? t[0] : t;
|
|
1481
|
+
if (r) {
|
|
1482
|
+
if (r.endsWith("/pdf"))
|
|
1483
|
+
return D.PDF;
|
|
1484
|
+
if (r.startsWith("text/"))
|
|
1485
|
+
return D.TEXT;
|
|
1486
|
+
if (r.endsWith("/msword"))
|
|
1487
|
+
return D.MSWORD;
|
|
1488
|
+
if (r.endsWith("/json"))
|
|
1489
|
+
return D.JSON;
|
|
1490
|
+
if (r.endsWith("/xml"))
|
|
1491
|
+
return D.XML;
|
|
1492
|
+
}
|
|
1493
|
+
}, Tt = [
|
|
1494
|
+
"image/apng",
|
|
1495
|
+
"image/bmp",
|
|
1496
|
+
"image/gif",
|
|
1497
|
+
"image/jpeg",
|
|
1498
|
+
"image/x-icon",
|
|
1499
|
+
"image/png",
|
|
1500
|
+
"image/svg+xml"
|
|
1501
|
+
], Et = ["video/mp4"], ht = [
|
|
1502
|
+
"audio/mp4",
|
|
1503
|
+
"audio/mpeg",
|
|
1504
|
+
"audio/x-aac",
|
|
1505
|
+
"audio/aac",
|
|
1506
|
+
"audio/x-wav",
|
|
1507
|
+
"audio/wav",
|
|
1508
|
+
"audio/accp",
|
|
1509
|
+
"audio/ogg",
|
|
1510
|
+
"audio/webm",
|
|
1511
|
+
"audio/x-flac"
|
|
1512
|
+
], At = [...Et, ...Tt, ...ht], Ot = ["http", "https"], It = "video/mp4", Rt = "video/quicktime", St = "video/x-m4v", gt = "MPEG-4", bt = "mov", Nt = "h264", v = [
|
|
1513
|
+
"__mp4",
|
|
1514
|
+
"__mp3_160k",
|
|
1515
|
+
"__png",
|
|
1516
|
+
"__jpeg",
|
|
1517
|
+
"__gif",
|
|
1518
|
+
"original"
|
|
1519
|
+
].reverse(), ie = ({ parsedShape: { tag: e } }, { parsedShape: { tag: t } }) => v.includes(e) || v.includes(t) ? v.indexOf(t) - v.indexOf(e) : e.toLowerCase().localeCompare(t.toLowerCase()), kt = (e, t) => {
|
|
1520
|
+
const {
|
|
1521
|
+
allowedMimeTypes: r = At,
|
|
1522
|
+
allowedMethods: n = Ot,
|
|
1523
|
+
sortPriority: o = ie,
|
|
1524
|
+
sourceKey: s = "src",
|
|
1525
|
+
mimeTypeKey: a = "type",
|
|
1526
|
+
shapeKey: i = "shape",
|
|
1527
|
+
parsedShapeKey: c = "parsedShape"
|
|
1528
|
+
} = t || {}, { shape: l = [] } = e || {}, u = l.reduce((_, f) => {
|
|
1529
|
+
let p, d;
|
|
1530
|
+
const m = Fe(f), { uri: T, mimeType: E, containerFormat: A, videoCodec: R } = m;
|
|
1531
|
+
if (E && (p = E, (E === Rt || E === St) && (A === gt || A === bt) && R === Nt && (p = It)), T)
|
|
1532
|
+
if (n) {
|
|
1533
|
+
const [S] = T.split("://");
|
|
1534
|
+
n.includes(S) && (d = T);
|
|
1535
|
+
} else
|
|
1536
|
+
d = T;
|
|
1537
|
+
return d && r.includes(p) && _.push({
|
|
1538
|
+
[s]: d,
|
|
1539
|
+
[a]: p,
|
|
1540
|
+
[i]: f,
|
|
1541
|
+
[c]: m
|
|
1542
|
+
}), _;
|
|
1543
|
+
}, []);
|
|
1544
|
+
return typeof o == "function" && u.sort(ie), u;
|
|
1545
|
+
}, Ht = (e) => {
|
|
1546
|
+
const t = Fe(e), { mimeType: r, videoCodec: n, audioCodec: o } = t;
|
|
1547
|
+
if (r) {
|
|
1548
|
+
if (r.startsWith("audio/") && o !== void 0)
|
|
1549
|
+
return O.AUDIO;
|
|
1550
|
+
if (r.startsWith("video/")) {
|
|
1551
|
+
if (n !== void 0)
|
|
1552
|
+
return O.VIDEO;
|
|
1553
|
+
if (o !== void 0)
|
|
1554
|
+
return O.AUDIO;
|
|
1555
|
+
}
|
|
1556
|
+
if (r.startsWith("image/"))
|
|
1557
|
+
return O.IMAGE;
|
|
1558
|
+
if (r.endsWith("/pdf") || r.startsWith("text/") || r.endsWith("/msword") || r.endsWith("/json") || r.endsWith("/xml"))
|
|
1559
|
+
return O.DOCUMENT;
|
|
1560
|
+
if (r.endsWith("/octet-stream"))
|
|
1561
|
+
return O.BINARY;
|
|
1562
|
+
}
|
|
1563
|
+
}, Yt = (e, t) => {
|
|
1564
|
+
const r = st(t).toSeconds(), { thumbnails: n = {} } = e || {}, { uri: o = [] } = n, s = o.map((i) => {
|
|
1565
|
+
const c = new URL(i).pathname.split("/").pop();
|
|
1566
|
+
return w(c).toSeconds();
|
|
1567
|
+
}), a = s.reduce(
|
|
1568
|
+
(i, c, l) => Math.abs(c - r) < Math.abs(s[i] - r) ? l : i,
|
|
1569
|
+
0
|
|
1570
|
+
);
|
|
1571
|
+
return o[a];
|
|
1572
|
+
}, Dt = (e) => {
|
|
1573
|
+
const t = {}, { outputSetting: r = [] } = e || {};
|
|
1574
|
+
if (r.length === 0)
|
|
1575
|
+
return t;
|
|
1576
|
+
const n = JSON.parse(r[0]), { Settings: { ContainerSettings: o, VideoDescription: s, AudioDescriptions: a } = {} } = n;
|
|
1577
|
+
if (o && (t.containerFormat = o.Container), s) {
|
|
1578
|
+
const { CodecSettings: i = {} } = s, { Codec: c, ...l } = i;
|
|
1579
|
+
t.videoFormat = c;
|
|
1580
|
+
const { Height: u, Width: _ } = s;
|
|
1581
|
+
t.height = u, t.width = _, u && _ && (t.dimension = `${_}x${u}`, t.aspectRatio = P({ height: u, width: _ }));
|
|
1582
|
+
const [f] = Object.values(l);
|
|
1583
|
+
if (f) {
|
|
1584
|
+
t.fieldOrder = f.InterlaceMode, t.fieldOrder && t.fieldOrder.includes("TOP") && (t.fieldOrder = "interlaced"), t.videoBitrate = f.Bitrate;
|
|
1585
|
+
const p = f.FramerateDenominator, d = f.FramerateNumerator, m = y({ denominator: d, numerator: p });
|
|
1586
|
+
t.timeBase = m, t.frameRate = m.toConstant() || m.toRate();
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
if (a && a.length > 0) {
|
|
1590
|
+
const { CodecSettings: i = {} } = a[0], { Codec: c, ...l } = i;
|
|
1591
|
+
t.audioFormat = c;
|
|
1592
|
+
const [u] = Object.values(l);
|
|
1593
|
+
u && (t.audioSamplerate = u.SampleRate, t.audioBitrate = u.Bitrate, t.audioBitRateMode = u.RateControlMode);
|
|
1594
|
+
}
|
|
1595
|
+
return t;
|
|
1596
|
+
}, Kt = (e) => {
|
|
1597
|
+
const t = {}, { description: r, format: n, audio: o, video: s, mediaconvert: a } = e || {};
|
|
1598
|
+
if (a)
|
|
1599
|
+
return { description: r, ...Dt(a) };
|
|
1600
|
+
if (t.description = r, t.containerFormat = n, s) {
|
|
1601
|
+
if (t.videoFormat = s.codec, t.videoBitrate = s.bitrate, s.framerate) {
|
|
1602
|
+
const i = y(s.framerate);
|
|
1603
|
+
t.timeBase = i, t.frameRate = i.toConstant() || i.toRate();
|
|
1604
|
+
}
|
|
1605
|
+
if (s.scaling) {
|
|
1606
|
+
const { height: i, width: c } = s.scaling;
|
|
1607
|
+
t.height = i, t.width = c, i && c && (t.dimension = `${c}x${i}`, t.aspectRatio = P({ height: i, width: c }));
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (o) {
|
|
1611
|
+
const { codec: i, channel: c } = o;
|
|
1612
|
+
t.audioFormat = i, c && (t.audioChannels = c.length);
|
|
1613
|
+
}
|
|
1614
|
+
return t;
|
|
1615
|
+
}, Ft = (e) => {
|
|
1616
|
+
if (!e)
|
|
1617
|
+
return;
|
|
1618
|
+
const {
|
|
1619
|
+
name: t,
|
|
1620
|
+
type: r,
|
|
1621
|
+
defaultValue: n,
|
|
1622
|
+
stringRestriction: o,
|
|
1623
|
+
floatRestriction: s,
|
|
1624
|
+
integerRestriction: a,
|
|
1625
|
+
longRestriction: i,
|
|
1626
|
+
data: c,
|
|
1627
|
+
values: l
|
|
1628
|
+
} = e, { minLength: u, maxLength: _, pattern: f } = o || {}, { minInclusive: p, maxInclusive: d } = s || a || i || {}, m = ((l == null ? void 0 : l.field) || []).map(({ key: R, value: S }) => ({ label: S, value: R })), E = ((R) => Object.fromEntries(Object.entries(R).filter(([, S]) => S !== void 0)))({
|
|
1629
|
+
min: p,
|
|
1630
|
+
max: d,
|
|
1631
|
+
minLength: u,
|
|
1632
|
+
maxLength: _,
|
|
1633
|
+
pattern: f ? new RegExp(f) : void 0
|
|
1634
|
+
}), A = b(c);
|
|
1635
|
+
return {
|
|
1636
|
+
name: t,
|
|
1637
|
+
type: r,
|
|
1638
|
+
defaultValue: n,
|
|
1639
|
+
required: p !== void 0 || u !== void 0 && u > 0,
|
|
1640
|
+
restrictions: E,
|
|
1641
|
+
data: A,
|
|
1642
|
+
options: m
|
|
1643
|
+
};
|
|
1644
|
+
}, zt = (e) => e == null ? void 0 : e.map(Ft).filter((t) => !!t), Jt = [
|
|
1645
|
+
"date",
|
|
1646
|
+
"float",
|
|
1647
|
+
"integer",
|
|
1648
|
+
"long",
|
|
1649
|
+
"string",
|
|
1650
|
+
"string-exact",
|
|
1651
|
+
"boolean",
|
|
1652
|
+
"timeCode"
|
|
1653
|
+
];
|
|
1654
|
+
export {
|
|
1655
|
+
D as DOCUMENT_TYPES,
|
|
1656
|
+
we as FIELD_ATTRIBUTE_KEYS,
|
|
1657
|
+
Jt as FIELD_DEFINITION_TYPES,
|
|
1658
|
+
ve as FIELD_VALUE_ATTRIBUTE_KEYS,
|
|
1659
|
+
Gt as FILE_STATES,
|
|
1660
|
+
Ce as GROUP_ATTRIBUTE_KEYS,
|
|
1661
|
+
Mt as ROLE_NAMES,
|
|
1662
|
+
O as SHAPE_MEDIA_TYPES,
|
|
1663
|
+
vt as SYSTEM_FIELDGROUPS,
|
|
1664
|
+
wt as SYSTEM_FIELDS,
|
|
1665
|
+
h as TimeBase,
|
|
1666
|
+
I as TimeCode,
|
|
1667
|
+
Ct as createMetadataType,
|
|
1668
|
+
Wt as createSearchFacetList,
|
|
1669
|
+
M as createTimeBase,
|
|
1670
|
+
st as createTimeCode,
|
|
1671
|
+
kt as filterShapeSource,
|
|
1672
|
+
Yt as findNearestThumbnail,
|
|
1673
|
+
H as formatTimeBaseText,
|
|
1674
|
+
y as formatTimeBaseType,
|
|
1675
|
+
Je as formatTimeCodeSeconds,
|
|
1676
|
+
et as formatTimeCodeSmpte,
|
|
1677
|
+
w as formatTimeCodeText,
|
|
1678
|
+
F as formatTimeCodeType,
|
|
1679
|
+
Vt as getShapeDocumentType,
|
|
1680
|
+
Ht as getShapeMediaType,
|
|
1681
|
+
jt as metadataTypeToWebVtt,
|
|
1682
|
+
_t as parseAudioComponent,
|
|
1683
|
+
mt as parseBinaryComponent,
|
|
1684
|
+
ft as parseContainerComponent,
|
|
1685
|
+
xt as parseFacetList,
|
|
1686
|
+
Pt as parseFacetType,
|
|
1687
|
+
zt as parseFieldDefinitionList,
|
|
1688
|
+
Oe as parseFieldList,
|
|
1689
|
+
De as parseFileType,
|
|
1690
|
+
Re as parseGroupList,
|
|
1691
|
+
W as parseHighlightTimespan,
|
|
1692
|
+
Ut as parseHighlightTimespanList,
|
|
1693
|
+
b as parseKeyValuePairType,
|
|
1694
|
+
Dt as parseMediaConvertPreset,
|
|
1695
|
+
Lt as parseMetadataType,
|
|
1696
|
+
$t as parseNowDate,
|
|
1697
|
+
Fe as parseShapeType,
|
|
1698
|
+
Bt as parseSimpleMetadataType,
|
|
1699
|
+
Ye as parseTimespan,
|
|
1700
|
+
ge as parseTimespanList,
|
|
1701
|
+
Kt as parseTranscodePreset,
|
|
1702
|
+
pt as parseVideoComponent
|
|
1703
|
+
};
|