@vonage/media-processor 2.0.0 → 2.0.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/docs/assets/search.js +1 -1
- package/dist/docs/enums/VonageSourceType.html +3 -5
- package/dist/docs/index.html +1 -1
- package/dist/docs/modules.html +4 -4
- package/dist/media-processor.es.js +684 -2004
- package/dist/media-processor.min.js +1 -0
- package/dist/media-processor.static.js +832 -0
- package/dist/media-processor.umd.js +2 -3
- package/dist/types/lib/main.d.ts +10 -0
- package/dist/types/{src → lib/src}/core/InsertableStreamHelper.d.ts +0 -0
- package/dist/types/{src → lib/src}/core/MediaProcessor.d.ts +3 -1
- package/dist/types/{src → lib/src}/core/MediaProcessorConnector.d.ts +0 -0
- package/dist/types/{src → lib/src}/core/MediaProcessorConnectorInterface.d.ts +0 -0
- package/dist/types/{src → lib/src}/core/MediaProcessorInterface.d.ts +0 -0
- package/dist/types/{src → lib/src}/core/pipeline.d.ts +4 -5
- package/dist/types/{src → lib/src}/telemetry/Key.d.ts +0 -0
- package/dist/types/lib/src/telemetry/QosReporter.d.ts +22 -0
- package/dist/types/{src → lib/src}/utils/Tools.d.ts +0 -0
- package/dist/types/{src → lib/src}/utils/package-json.d.ts +0 -0
- package/dist/types/{src → lib/src}/utils/utils.d.ts +0 -0
- package/package.json +72 -62
- package/dist/types/main.d.ts +0 -11
- package/dist/types/src/telemetry/Reporter.d.ts +0 -97
|
@@ -1,2110 +1,783 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
class Key {
|
|
11
|
-
}
|
|
12
|
-
Key.updates = {
|
|
13
|
-
"transformer_new": "New transformer",
|
|
14
|
-
"transformer_null": "Null transformer"
|
|
15
|
-
};
|
|
16
|
-
Key.errors = {
|
|
17
|
-
"transformer_none": "No transformers provided",
|
|
18
|
-
"transformer_start": "Cannot start transformer",
|
|
19
|
-
"transformer_transform": "Cannot transform frame",
|
|
20
|
-
"transformer_flush": "Cannot flush transformer",
|
|
21
|
-
"readable_null": "Readable is null",
|
|
22
|
-
"writable_null": "Writable is null"
|
|
23
|
-
};
|
|
24
|
-
var axios$2 = { exports: {} };
|
|
25
|
-
var bind$2 = function bind(fn, thisArg) {
|
|
26
|
-
return function wrap() {
|
|
27
|
-
var args = new Array(arguments.length);
|
|
28
|
-
for (var i = 0; i < args.length; i++) {
|
|
29
|
-
args[i] = arguments[i];
|
|
30
|
-
}
|
|
31
|
-
return fn.apply(thisArg, args);
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
var bind$1 = bind$2;
|
|
35
|
-
var toString = Object.prototype.toString;
|
|
36
|
-
function isArray(val) {
|
|
37
|
-
return Array.isArray(val);
|
|
38
|
-
}
|
|
39
|
-
function isUndefined(val) {
|
|
40
|
-
return typeof val === "undefined";
|
|
41
|
-
}
|
|
42
|
-
function isBuffer(val) {
|
|
43
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
|
|
44
|
-
}
|
|
45
|
-
function isArrayBuffer(val) {
|
|
46
|
-
return toString.call(val) === "[object ArrayBuffer]";
|
|
47
|
-
}
|
|
48
|
-
function isFormData(val) {
|
|
49
|
-
return toString.call(val) === "[object FormData]";
|
|
50
|
-
}
|
|
51
|
-
function isArrayBufferView(val) {
|
|
52
|
-
var result;
|
|
53
|
-
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
54
|
-
result = ArrayBuffer.isView(val);
|
|
55
|
-
} else {
|
|
56
|
-
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
59
|
-
}
|
|
60
|
-
function isString(val) {
|
|
61
|
-
return typeof val === "string";
|
|
62
|
-
}
|
|
63
|
-
function isNumber(val) {
|
|
64
|
-
return typeof val === "number";
|
|
65
|
-
}
|
|
66
|
-
function isObject(val) {
|
|
67
|
-
return val !== null && typeof val === "object";
|
|
68
|
-
}
|
|
69
|
-
function isPlainObject(val) {
|
|
70
|
-
if (toString.call(val) !== "[object Object]") {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
var prototype = Object.getPrototypeOf(val);
|
|
74
|
-
return prototype === null || prototype === Object.prototype;
|
|
75
|
-
}
|
|
76
|
-
function isDate(val) {
|
|
77
|
-
return toString.call(val) === "[object Date]";
|
|
78
|
-
}
|
|
79
|
-
function isFile(val) {
|
|
80
|
-
return toString.call(val) === "[object File]";
|
|
81
|
-
}
|
|
82
|
-
function isBlob(val) {
|
|
83
|
-
return toString.call(val) === "[object Blob]";
|
|
84
|
-
}
|
|
85
|
-
function isFunction(val) {
|
|
86
|
-
return toString.call(val) === "[object Function]";
|
|
87
|
-
}
|
|
88
|
-
function isStream(val) {
|
|
89
|
-
return isObject(val) && isFunction(val.pipe);
|
|
90
|
-
}
|
|
91
|
-
function isURLSearchParams(val) {
|
|
92
|
-
return toString.call(val) === "[object URLSearchParams]";
|
|
93
|
-
}
|
|
94
|
-
function trim(str) {
|
|
95
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
|
96
|
-
}
|
|
97
|
-
function isStandardBrowserEnv() {
|
|
98
|
-
if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
102
|
-
}
|
|
103
|
-
function forEach(obj, fn) {
|
|
104
|
-
if (obj === null || typeof obj === "undefined") {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
if (typeof obj !== "object") {
|
|
108
|
-
obj = [obj];
|
|
109
|
-
}
|
|
110
|
-
if (isArray(obj)) {
|
|
111
|
-
for (var i = 0, l = obj.length; i < l; i++) {
|
|
112
|
-
fn.call(null, obj[i], i, obj);
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
for (var key in obj) {
|
|
116
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
117
|
-
fn.call(null, obj[key], key, obj);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function merge() {
|
|
123
|
-
var result = {};
|
|
124
|
-
function assignValue(val, key) {
|
|
125
|
-
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
126
|
-
result[key] = merge(result[key], val);
|
|
127
|
-
} else if (isPlainObject(val)) {
|
|
128
|
-
result[key] = merge({}, val);
|
|
129
|
-
} else if (isArray(val)) {
|
|
130
|
-
result[key] = val.slice();
|
|
131
|
-
} else {
|
|
132
|
-
result[key] = val;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
136
|
-
forEach(arguments[i], assignValue);
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
}
|
|
140
|
-
function extend(a, b, thisArg) {
|
|
141
|
-
forEach(b, function assignValue(val, key) {
|
|
142
|
-
if (thisArg && typeof val === "function") {
|
|
143
|
-
a[key] = bind$1(val, thisArg);
|
|
144
|
-
} else {
|
|
145
|
-
a[key] = val;
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
return a;
|
|
149
|
-
}
|
|
150
|
-
function stripBOM(content) {
|
|
151
|
-
if (content.charCodeAt(0) === 65279) {
|
|
152
|
-
content = content.slice(1);
|
|
153
|
-
}
|
|
154
|
-
return content;
|
|
155
|
-
}
|
|
156
|
-
var utils$e = {
|
|
157
|
-
isArray,
|
|
158
|
-
isArrayBuffer,
|
|
159
|
-
isBuffer,
|
|
160
|
-
isFormData,
|
|
161
|
-
isArrayBufferView,
|
|
162
|
-
isString,
|
|
163
|
-
isNumber,
|
|
164
|
-
isObject,
|
|
165
|
-
isPlainObject,
|
|
166
|
-
isUndefined,
|
|
167
|
-
isDate,
|
|
168
|
-
isFile,
|
|
169
|
-
isBlob,
|
|
170
|
-
isFunction,
|
|
171
|
-
isStream,
|
|
172
|
-
isURLSearchParams,
|
|
173
|
-
isStandardBrowserEnv,
|
|
174
|
-
forEach,
|
|
175
|
-
merge,
|
|
176
|
-
extend,
|
|
177
|
-
trim,
|
|
178
|
-
stripBOM
|
|
179
|
-
};
|
|
180
|
-
var utils$d = utils$e;
|
|
181
|
-
function encode(val) {
|
|
182
|
-
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
183
|
-
}
|
|
184
|
-
var buildURL$2 = function buildURL(url, params, paramsSerializer) {
|
|
185
|
-
if (!params) {
|
|
186
|
-
return url;
|
|
187
|
-
}
|
|
188
|
-
var serializedParams;
|
|
189
|
-
if (paramsSerializer) {
|
|
190
|
-
serializedParams = paramsSerializer(params);
|
|
191
|
-
} else if (utils$d.isURLSearchParams(params)) {
|
|
192
|
-
serializedParams = params.toString();
|
|
193
|
-
} else {
|
|
194
|
-
var parts = [];
|
|
195
|
-
utils$d.forEach(params, function serialize(val, key) {
|
|
196
|
-
if (val === null || typeof val === "undefined") {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (utils$d.isArray(val)) {
|
|
200
|
-
key = key + "[]";
|
|
201
|
-
} else {
|
|
202
|
-
val = [val];
|
|
203
|
-
}
|
|
204
|
-
utils$d.forEach(val, function parseValue(v) {
|
|
205
|
-
if (utils$d.isDate(v)) {
|
|
206
|
-
v = v.toISOString();
|
|
207
|
-
} else if (utils$d.isObject(v)) {
|
|
208
|
-
v = JSON.stringify(v);
|
|
209
|
-
}
|
|
210
|
-
parts.push(encode(key) + "=" + encode(v));
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
serializedParams = parts.join("&");
|
|
214
|
-
}
|
|
215
|
-
if (serializedParams) {
|
|
216
|
-
var hashmarkIndex = url.indexOf("#");
|
|
217
|
-
if (hashmarkIndex !== -1) {
|
|
218
|
-
url = url.slice(0, hashmarkIndex);
|
|
219
|
-
}
|
|
220
|
-
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
221
|
-
}
|
|
222
|
-
return url;
|
|
223
|
-
};
|
|
224
|
-
var utils$c = utils$e;
|
|
225
|
-
function InterceptorManager$1() {
|
|
226
|
-
this.handlers = [];
|
|
227
|
-
}
|
|
228
|
-
InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
|
|
229
|
-
this.handlers.push({
|
|
230
|
-
fulfilled,
|
|
231
|
-
rejected,
|
|
232
|
-
synchronous: options ? options.synchronous : false,
|
|
233
|
-
runWhen: options ? options.runWhen : null
|
|
234
|
-
});
|
|
235
|
-
return this.handlers.length - 1;
|
|
236
|
-
};
|
|
237
|
-
InterceptorManager$1.prototype.eject = function eject(id) {
|
|
238
|
-
if (this.handlers[id]) {
|
|
239
|
-
this.handlers[id] = null;
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
InterceptorManager$1.prototype.forEach = function forEach2(fn) {
|
|
243
|
-
utils$c.forEach(this.handlers, function forEachHandler(h) {
|
|
244
|
-
if (h !== null) {
|
|
245
|
-
fn(h);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
};
|
|
249
|
-
var InterceptorManager_1 = InterceptorManager$1;
|
|
250
|
-
var utils$b = utils$e;
|
|
251
|
-
var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
|
|
252
|
-
utils$b.forEach(headers, function processHeader(value, name) {
|
|
253
|
-
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
254
|
-
headers[normalizedName] = value;
|
|
255
|
-
delete headers[name];
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
};
|
|
259
|
-
var enhanceError$2 = function enhanceError(error, config, code, request2, response) {
|
|
260
|
-
error.config = config;
|
|
261
|
-
if (code) {
|
|
262
|
-
error.code = code;
|
|
263
|
-
}
|
|
264
|
-
error.request = request2;
|
|
265
|
-
error.response = response;
|
|
266
|
-
error.isAxiosError = true;
|
|
267
|
-
error.toJSON = function toJSON() {
|
|
268
|
-
return {
|
|
269
|
-
message: this.message,
|
|
270
|
-
name: this.name,
|
|
271
|
-
description: this.description,
|
|
272
|
-
number: this.number,
|
|
273
|
-
fileName: this.fileName,
|
|
274
|
-
lineNumber: this.lineNumber,
|
|
275
|
-
columnNumber: this.columnNumber,
|
|
276
|
-
stack: this.stack,
|
|
277
|
-
config: this.config,
|
|
278
|
-
code: this.code,
|
|
279
|
-
status: this.response && this.response.status ? this.response.status : null
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
return error;
|
|
283
|
-
};
|
|
284
|
-
var enhanceError$1 = enhanceError$2;
|
|
285
|
-
var createError$2 = function createError(message, config, code, request2, response) {
|
|
286
|
-
var error = new Error(message);
|
|
287
|
-
return enhanceError$1(error, config, code, request2, response);
|
|
288
|
-
};
|
|
289
|
-
var createError$1 = createError$2;
|
|
290
|
-
var settle$1 = function settle(resolve, reject, response) {
|
|
291
|
-
var validateStatus2 = response.config.validateStatus;
|
|
292
|
-
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
293
|
-
resolve(response);
|
|
294
|
-
} else {
|
|
295
|
-
reject(createError$1(
|
|
296
|
-
"Request failed with status code " + response.status,
|
|
297
|
-
response.config,
|
|
298
|
-
null,
|
|
299
|
-
response.request,
|
|
300
|
-
response
|
|
301
|
-
));
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
var utils$a = utils$e;
|
|
305
|
-
var cookies$1 = utils$a.isStandardBrowserEnv() ? function standardBrowserEnv() {
|
|
306
|
-
return {
|
|
307
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
308
|
-
var cookie = [];
|
|
309
|
-
cookie.push(name + "=" + encodeURIComponent(value));
|
|
310
|
-
if (utils$a.isNumber(expires)) {
|
|
311
|
-
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
312
|
-
}
|
|
313
|
-
if (utils$a.isString(path)) {
|
|
314
|
-
cookie.push("path=" + path);
|
|
315
|
-
}
|
|
316
|
-
if (utils$a.isString(domain)) {
|
|
317
|
-
cookie.push("domain=" + domain);
|
|
318
|
-
}
|
|
319
|
-
if (secure === true) {
|
|
320
|
-
cookie.push("secure");
|
|
321
|
-
}
|
|
322
|
-
document.cookie = cookie.join("; ");
|
|
323
|
-
},
|
|
324
|
-
read: function read(name) {
|
|
325
|
-
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
326
|
-
return match ? decodeURIComponent(match[3]) : null;
|
|
327
|
-
},
|
|
328
|
-
remove: function remove(name) {
|
|
329
|
-
this.write(name, "", Date.now() - 864e5);
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
}() : function nonStandardBrowserEnv() {
|
|
333
|
-
return {
|
|
334
|
-
write: function write() {
|
|
335
|
-
},
|
|
336
|
-
read: function read() {
|
|
337
|
-
return null;
|
|
338
|
-
},
|
|
339
|
-
remove: function remove() {
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
}();
|
|
343
|
-
var isAbsoluteURL$1 = function isAbsoluteURL(url) {
|
|
344
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
345
|
-
};
|
|
346
|
-
var combineURLs$1 = function combineURLs(baseURL, relativeURL) {
|
|
347
|
-
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
348
|
-
};
|
|
349
|
-
var isAbsoluteURL2 = isAbsoluteURL$1;
|
|
350
|
-
var combineURLs2 = combineURLs$1;
|
|
351
|
-
var buildFullPath$1 = function buildFullPath(baseURL, requestedURL) {
|
|
352
|
-
if (baseURL && !isAbsoluteURL2(requestedURL)) {
|
|
353
|
-
return combineURLs2(baseURL, requestedURL);
|
|
354
|
-
}
|
|
355
|
-
return requestedURL;
|
|
356
|
-
};
|
|
357
|
-
var utils$9 = utils$e;
|
|
358
|
-
var ignoreDuplicateOf = [
|
|
359
|
-
"age",
|
|
360
|
-
"authorization",
|
|
361
|
-
"content-length",
|
|
362
|
-
"content-type",
|
|
363
|
-
"etag",
|
|
364
|
-
"expires",
|
|
365
|
-
"from",
|
|
366
|
-
"host",
|
|
367
|
-
"if-modified-since",
|
|
368
|
-
"if-unmodified-since",
|
|
369
|
-
"last-modified",
|
|
370
|
-
"location",
|
|
371
|
-
"max-forwards",
|
|
372
|
-
"proxy-authorization",
|
|
373
|
-
"referer",
|
|
374
|
-
"retry-after",
|
|
375
|
-
"user-agent"
|
|
376
|
-
];
|
|
377
|
-
var parseHeaders$1 = function parseHeaders(headers) {
|
|
378
|
-
var parsed = {};
|
|
379
|
-
var key;
|
|
380
|
-
var val;
|
|
381
|
-
var i;
|
|
382
|
-
if (!headers) {
|
|
383
|
-
return parsed;
|
|
384
|
-
}
|
|
385
|
-
utils$9.forEach(headers.split("\n"), function parser(line) {
|
|
386
|
-
i = line.indexOf(":");
|
|
387
|
-
key = utils$9.trim(line.substr(0, i)).toLowerCase();
|
|
388
|
-
val = utils$9.trim(line.substr(i + 1));
|
|
389
|
-
if (key) {
|
|
390
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
if (key === "set-cookie") {
|
|
394
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
395
|
-
} else {
|
|
396
|
-
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
return parsed;
|
|
401
|
-
};
|
|
402
|
-
var utils$8 = utils$e;
|
|
403
|
-
var isURLSameOrigin$1 = utils$8.isStandardBrowserEnv() ? function standardBrowserEnv2() {
|
|
404
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
405
|
-
var urlParsingNode = document.createElement("a");
|
|
406
|
-
var originURL;
|
|
407
|
-
function resolveURL(url) {
|
|
408
|
-
var href = url;
|
|
409
|
-
if (msie) {
|
|
410
|
-
urlParsingNode.setAttribute("href", href);
|
|
411
|
-
href = urlParsingNode.href;
|
|
412
|
-
}
|
|
413
|
-
urlParsingNode.setAttribute("href", href);
|
|
414
|
-
return {
|
|
415
|
-
href: urlParsingNode.href,
|
|
416
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
417
|
-
host: urlParsingNode.host,
|
|
418
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
419
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
420
|
-
hostname: urlParsingNode.hostname,
|
|
421
|
-
port: urlParsingNode.port,
|
|
422
|
-
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
originURL = resolveURL(window.location.href);
|
|
426
|
-
return function isURLSameOrigin2(requestURL) {
|
|
427
|
-
var parsed = utils$8.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
428
|
-
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
429
|
-
};
|
|
430
|
-
}() : function nonStandardBrowserEnv2() {
|
|
431
|
-
return function isURLSameOrigin2() {
|
|
432
|
-
return true;
|
|
433
|
-
};
|
|
434
|
-
}();
|
|
435
|
-
function Cancel$3(message) {
|
|
436
|
-
this.message = message;
|
|
437
|
-
}
|
|
438
|
-
Cancel$3.prototype.toString = function toString2() {
|
|
439
|
-
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
440
|
-
};
|
|
441
|
-
Cancel$3.prototype.__CANCEL__ = true;
|
|
442
|
-
var Cancel_1 = Cancel$3;
|
|
443
|
-
var utils$7 = utils$e;
|
|
444
|
-
var settle2 = settle$1;
|
|
445
|
-
var cookies = cookies$1;
|
|
446
|
-
var buildURL$1 = buildURL$2;
|
|
447
|
-
var buildFullPath2 = buildFullPath$1;
|
|
448
|
-
var parseHeaders2 = parseHeaders$1;
|
|
449
|
-
var isURLSameOrigin = isURLSameOrigin$1;
|
|
450
|
-
var createError2 = createError$2;
|
|
451
|
-
var defaults$4 = defaults_1;
|
|
452
|
-
var Cancel$2 = Cancel_1;
|
|
453
|
-
var xhr = function xhrAdapter(config) {
|
|
454
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
455
|
-
var requestData = config.data;
|
|
456
|
-
var requestHeaders = config.headers;
|
|
457
|
-
var responseType = config.responseType;
|
|
458
|
-
var onCanceled;
|
|
459
|
-
function done() {
|
|
460
|
-
if (config.cancelToken) {
|
|
461
|
-
config.cancelToken.unsubscribe(onCanceled);
|
|
462
|
-
}
|
|
463
|
-
if (config.signal) {
|
|
464
|
-
config.signal.removeEventListener("abort", onCanceled);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
if (utils$7.isFormData(requestData)) {
|
|
468
|
-
delete requestHeaders["Content-Type"];
|
|
469
|
-
}
|
|
470
|
-
var request2 = new XMLHttpRequest();
|
|
471
|
-
if (config.auth) {
|
|
472
|
-
var username = config.auth.username || "";
|
|
473
|
-
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
|
|
474
|
-
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
|
475
|
-
}
|
|
476
|
-
var fullPath = buildFullPath2(config.baseURL, config.url);
|
|
477
|
-
request2.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
|
|
478
|
-
request2.timeout = config.timeout;
|
|
479
|
-
function onloadend() {
|
|
480
|
-
if (!request2) {
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null;
|
|
484
|
-
var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
|
|
485
|
-
var response = {
|
|
486
|
-
data: responseData,
|
|
487
|
-
status: request2.status,
|
|
488
|
-
statusText: request2.statusText,
|
|
489
|
-
headers: responseHeaders,
|
|
490
|
-
config,
|
|
491
|
-
request: request2
|
|
492
|
-
};
|
|
493
|
-
settle2(function _resolve(value) {
|
|
494
|
-
resolve(value);
|
|
495
|
-
done();
|
|
496
|
-
}, function _reject(err) {
|
|
497
|
-
reject(err);
|
|
498
|
-
done();
|
|
499
|
-
}, response);
|
|
500
|
-
request2 = null;
|
|
501
|
-
}
|
|
502
|
-
if ("onloadend" in request2) {
|
|
503
|
-
request2.onloadend = onloadend;
|
|
504
|
-
} else {
|
|
505
|
-
request2.onreadystatechange = function handleLoad() {
|
|
506
|
-
if (!request2 || request2.readyState !== 4) {
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
setTimeout(onloadend);
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
request2.onabort = function handleAbort() {
|
|
516
|
-
if (!request2) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
reject(createError2("Request aborted", config, "ECONNABORTED", request2));
|
|
520
|
-
request2 = null;
|
|
521
|
-
};
|
|
522
|
-
request2.onerror = function handleError() {
|
|
523
|
-
reject(createError2("Network Error", config, null, request2));
|
|
524
|
-
request2 = null;
|
|
525
|
-
};
|
|
526
|
-
request2.ontimeout = function handleTimeout() {
|
|
527
|
-
var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
|
|
528
|
-
var transitional2 = config.transitional || defaults$4.transitional;
|
|
529
|
-
if (config.timeoutErrorMessage) {
|
|
530
|
-
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
531
|
-
}
|
|
532
|
-
reject(createError2(
|
|
533
|
-
timeoutErrorMessage,
|
|
534
|
-
config,
|
|
535
|
-
transitional2.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
|
|
536
|
-
request2
|
|
537
|
-
));
|
|
538
|
-
request2 = null;
|
|
539
|
-
};
|
|
540
|
-
if (utils$7.isStandardBrowserEnv()) {
|
|
541
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0;
|
|
542
|
-
if (xsrfValue) {
|
|
543
|
-
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
if ("setRequestHeader" in request2) {
|
|
547
|
-
utils$7.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
548
|
-
if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
|
|
549
|
-
delete requestHeaders[key];
|
|
550
|
-
} else {
|
|
551
|
-
request2.setRequestHeader(key, val);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
if (!utils$7.isUndefined(config.withCredentials)) {
|
|
556
|
-
request2.withCredentials = !!config.withCredentials;
|
|
557
|
-
}
|
|
558
|
-
if (responseType && responseType !== "json") {
|
|
559
|
-
request2.responseType = config.responseType;
|
|
560
|
-
}
|
|
561
|
-
if (typeof config.onDownloadProgress === "function") {
|
|
562
|
-
request2.addEventListener("progress", config.onDownloadProgress);
|
|
563
|
-
}
|
|
564
|
-
if (typeof config.onUploadProgress === "function" && request2.upload) {
|
|
565
|
-
request2.upload.addEventListener("progress", config.onUploadProgress);
|
|
566
|
-
}
|
|
567
|
-
if (config.cancelToken || config.signal) {
|
|
568
|
-
onCanceled = function(cancel) {
|
|
569
|
-
if (!request2) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
reject(!cancel || cancel && cancel.type ? new Cancel$2("canceled") : cancel);
|
|
573
|
-
request2.abort();
|
|
574
|
-
request2 = null;
|
|
575
|
-
};
|
|
576
|
-
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
577
|
-
if (config.signal) {
|
|
578
|
-
config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
if (!requestData) {
|
|
582
|
-
requestData = null;
|
|
583
|
-
}
|
|
584
|
-
request2.send(requestData);
|
|
585
|
-
});
|
|
586
|
-
};
|
|
587
|
-
var utils$6 = utils$e;
|
|
588
|
-
var normalizeHeaderName2 = normalizeHeaderName$1;
|
|
589
|
-
var enhanceError2 = enhanceError$2;
|
|
590
|
-
var DEFAULT_CONTENT_TYPE = {
|
|
591
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
592
|
-
};
|
|
593
|
-
function setContentTypeIfUnset(headers, value) {
|
|
594
|
-
if (!utils$6.isUndefined(headers) && utils$6.isUndefined(headers["Content-Type"])) {
|
|
595
|
-
headers["Content-Type"] = value;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
function getDefaultAdapter() {
|
|
599
|
-
var adapter;
|
|
600
|
-
if (typeof XMLHttpRequest !== "undefined") {
|
|
601
|
-
adapter = xhr;
|
|
602
|
-
} else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
|
|
603
|
-
adapter = xhr;
|
|
604
|
-
}
|
|
605
|
-
return adapter;
|
|
606
|
-
}
|
|
607
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
608
|
-
if (utils$6.isString(rawValue)) {
|
|
609
|
-
try {
|
|
610
|
-
(parser || JSON.parse)(rawValue);
|
|
611
|
-
return utils$6.trim(rawValue);
|
|
612
|
-
} catch (e) {
|
|
613
|
-
if (e.name !== "SyntaxError") {
|
|
614
|
-
throw e;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
619
|
-
}
|
|
620
|
-
var defaults$3 = {
|
|
621
|
-
transitional: {
|
|
622
|
-
silentJSONParsing: true,
|
|
623
|
-
forcedJSONParsing: true,
|
|
624
|
-
clarifyTimeoutError: false
|
|
625
|
-
},
|
|
626
|
-
adapter: getDefaultAdapter(),
|
|
627
|
-
transformRequest: [function transformRequest(data2, headers) {
|
|
628
|
-
normalizeHeaderName2(headers, "Accept");
|
|
629
|
-
normalizeHeaderName2(headers, "Content-Type");
|
|
630
|
-
if (utils$6.isFormData(data2) || utils$6.isArrayBuffer(data2) || utils$6.isBuffer(data2) || utils$6.isStream(data2) || utils$6.isFile(data2) || utils$6.isBlob(data2)) {
|
|
631
|
-
return data2;
|
|
632
|
-
}
|
|
633
|
-
if (utils$6.isArrayBufferView(data2)) {
|
|
634
|
-
return data2.buffer;
|
|
635
|
-
}
|
|
636
|
-
if (utils$6.isURLSearchParams(data2)) {
|
|
637
|
-
setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
|
|
638
|
-
return data2.toString();
|
|
639
|
-
}
|
|
640
|
-
if (utils$6.isObject(data2) || headers && headers["Content-Type"] === "application/json") {
|
|
641
|
-
setContentTypeIfUnset(headers, "application/json");
|
|
642
|
-
return stringifySafely(data2);
|
|
643
|
-
}
|
|
644
|
-
return data2;
|
|
645
|
-
}],
|
|
646
|
-
transformResponse: [function transformResponse(data2) {
|
|
647
|
-
var transitional2 = this.transitional || defaults$3.transitional;
|
|
648
|
-
var silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
649
|
-
var forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
650
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
|
|
651
|
-
if (strictJSONParsing || forcedJSONParsing && utils$6.isString(data2) && data2.length) {
|
|
652
|
-
try {
|
|
653
|
-
return JSON.parse(data2);
|
|
654
|
-
} catch (e) {
|
|
655
|
-
if (strictJSONParsing) {
|
|
656
|
-
if (e.name === "SyntaxError") {
|
|
657
|
-
throw enhanceError2(e, this, "E_JSON_PARSE");
|
|
658
|
-
}
|
|
659
|
-
throw e;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
return data2;
|
|
664
|
-
}],
|
|
665
|
-
timeout: 0,
|
|
666
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
667
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
668
|
-
maxContentLength: -1,
|
|
669
|
-
maxBodyLength: -1,
|
|
670
|
-
validateStatus: function validateStatus(status) {
|
|
671
|
-
return status >= 200 && status < 300;
|
|
672
|
-
},
|
|
673
|
-
headers: {
|
|
674
|
-
common: {
|
|
675
|
-
"Accept": "application/json, text/plain, */*"
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
utils$6.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
|
|
680
|
-
defaults$3.headers[method] = {};
|
|
681
|
-
});
|
|
682
|
-
utils$6.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
683
|
-
defaults$3.headers[method] = utils$6.merge(DEFAULT_CONTENT_TYPE);
|
|
684
|
-
});
|
|
685
|
-
var defaults_1 = defaults$3;
|
|
686
|
-
var utils$5 = utils$e;
|
|
687
|
-
var defaults$2 = defaults_1;
|
|
688
|
-
var transformData$1 = function transformData(data2, headers, fns) {
|
|
689
|
-
var context = this || defaults$2;
|
|
690
|
-
utils$5.forEach(fns, function transform(fn) {
|
|
691
|
-
data2 = fn.call(context, data2, headers);
|
|
692
|
-
});
|
|
693
|
-
return data2;
|
|
694
|
-
};
|
|
695
|
-
var isCancel$1 = function isCancel(value) {
|
|
696
|
-
return !!(value && value.__CANCEL__);
|
|
697
|
-
};
|
|
698
|
-
var utils$4 = utils$e;
|
|
699
|
-
var transformData2 = transformData$1;
|
|
700
|
-
var isCancel2 = isCancel$1;
|
|
701
|
-
var defaults$1 = defaults_1;
|
|
702
|
-
var Cancel$1 = Cancel_1;
|
|
703
|
-
function throwIfCancellationRequested(config) {
|
|
704
|
-
if (config.cancelToken) {
|
|
705
|
-
config.cancelToken.throwIfRequested();
|
|
706
|
-
}
|
|
707
|
-
if (config.signal && config.signal.aborted) {
|
|
708
|
-
throw new Cancel$1("canceled");
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
var dispatchRequest$1 = function dispatchRequest(config) {
|
|
712
|
-
throwIfCancellationRequested(config);
|
|
713
|
-
config.headers = config.headers || {};
|
|
714
|
-
config.data = transformData2.call(
|
|
715
|
-
config,
|
|
716
|
-
config.data,
|
|
717
|
-
config.headers,
|
|
718
|
-
config.transformRequest
|
|
719
|
-
);
|
|
720
|
-
config.headers = utils$4.merge(
|
|
721
|
-
config.headers.common || {},
|
|
722
|
-
config.headers[config.method] || {},
|
|
723
|
-
config.headers
|
|
724
|
-
);
|
|
725
|
-
utils$4.forEach(
|
|
726
|
-
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
727
|
-
function cleanHeaderConfig(method) {
|
|
728
|
-
delete config.headers[method];
|
|
729
|
-
}
|
|
730
|
-
);
|
|
731
|
-
var adapter = config.adapter || defaults$1.adapter;
|
|
732
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
733
|
-
throwIfCancellationRequested(config);
|
|
734
|
-
response.data = transformData2.call(
|
|
735
|
-
config,
|
|
736
|
-
response.data,
|
|
737
|
-
response.headers,
|
|
738
|
-
config.transformResponse
|
|
739
|
-
);
|
|
740
|
-
return response;
|
|
741
|
-
}, function onAdapterRejection(reason) {
|
|
742
|
-
if (!isCancel2(reason)) {
|
|
743
|
-
throwIfCancellationRequested(config);
|
|
744
|
-
if (reason && reason.response) {
|
|
745
|
-
reason.response.data = transformData2.call(
|
|
746
|
-
config,
|
|
747
|
-
reason.response.data,
|
|
748
|
-
reason.response.headers,
|
|
749
|
-
config.transformResponse
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
return Promise.reject(reason);
|
|
754
|
-
});
|
|
755
|
-
};
|
|
756
|
-
var utils$3 = utils$e;
|
|
757
|
-
var mergeConfig$2 = function mergeConfig(config1, config2) {
|
|
758
|
-
config2 = config2 || {};
|
|
759
|
-
var config = {};
|
|
760
|
-
function getMergedValue(target, source2) {
|
|
761
|
-
if (utils$3.isPlainObject(target) && utils$3.isPlainObject(source2)) {
|
|
762
|
-
return utils$3.merge(target, source2);
|
|
763
|
-
} else if (utils$3.isPlainObject(source2)) {
|
|
764
|
-
return utils$3.merge({}, source2);
|
|
765
|
-
} else if (utils$3.isArray(source2)) {
|
|
766
|
-
return source2.slice();
|
|
767
|
-
}
|
|
768
|
-
return source2;
|
|
769
|
-
}
|
|
770
|
-
function mergeDeepProperties(prop) {
|
|
771
|
-
if (!utils$3.isUndefined(config2[prop])) {
|
|
772
|
-
return getMergedValue(config1[prop], config2[prop]);
|
|
773
|
-
} else if (!utils$3.isUndefined(config1[prop])) {
|
|
774
|
-
return getMergedValue(void 0, config1[prop]);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
function valueFromConfig2(prop) {
|
|
778
|
-
if (!utils$3.isUndefined(config2[prop])) {
|
|
779
|
-
return getMergedValue(void 0, config2[prop]);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
function defaultToConfig2(prop) {
|
|
783
|
-
if (!utils$3.isUndefined(config2[prop])) {
|
|
784
|
-
return getMergedValue(void 0, config2[prop]);
|
|
785
|
-
} else if (!utils$3.isUndefined(config1[prop])) {
|
|
786
|
-
return getMergedValue(void 0, config1[prop]);
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
function mergeDirectKeys(prop) {
|
|
790
|
-
if (prop in config2) {
|
|
791
|
-
return getMergedValue(config1[prop], config2[prop]);
|
|
792
|
-
} else if (prop in config1) {
|
|
793
|
-
return getMergedValue(void 0, config1[prop]);
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
var mergeMap = {
|
|
797
|
-
"url": valueFromConfig2,
|
|
798
|
-
"method": valueFromConfig2,
|
|
799
|
-
"data": valueFromConfig2,
|
|
800
|
-
"baseURL": defaultToConfig2,
|
|
801
|
-
"transformRequest": defaultToConfig2,
|
|
802
|
-
"transformResponse": defaultToConfig2,
|
|
803
|
-
"paramsSerializer": defaultToConfig2,
|
|
804
|
-
"timeout": defaultToConfig2,
|
|
805
|
-
"timeoutMessage": defaultToConfig2,
|
|
806
|
-
"withCredentials": defaultToConfig2,
|
|
807
|
-
"adapter": defaultToConfig2,
|
|
808
|
-
"responseType": defaultToConfig2,
|
|
809
|
-
"xsrfCookieName": defaultToConfig2,
|
|
810
|
-
"xsrfHeaderName": defaultToConfig2,
|
|
811
|
-
"onUploadProgress": defaultToConfig2,
|
|
812
|
-
"onDownloadProgress": defaultToConfig2,
|
|
813
|
-
"decompress": defaultToConfig2,
|
|
814
|
-
"maxContentLength": defaultToConfig2,
|
|
815
|
-
"maxBodyLength": defaultToConfig2,
|
|
816
|
-
"transport": defaultToConfig2,
|
|
817
|
-
"httpAgent": defaultToConfig2,
|
|
818
|
-
"httpsAgent": defaultToConfig2,
|
|
819
|
-
"cancelToken": defaultToConfig2,
|
|
820
|
-
"socketPath": defaultToConfig2,
|
|
821
|
-
"responseEncoding": defaultToConfig2,
|
|
822
|
-
"validateStatus": mergeDirectKeys
|
|
823
|
-
};
|
|
824
|
-
utils$3.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
825
|
-
var merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
826
|
-
var configValue = merge2(prop);
|
|
827
|
-
utils$3.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var V = (t, e, r) => e in t ? B(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var a = (t, e, r) => (V(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
function Ie() {
|
|
5
|
+
return new Promise((t, e) => {
|
|
6
|
+
typeof MediaStreamTrackProcessor > "u" || typeof MediaStreamTrackGenerator > "u" ? e("Your browser does not support the MediaStreamTrack API for Insertable Streams of Media.") : t();
|
|
828
7
|
});
|
|
829
|
-
return config;
|
|
830
|
-
};
|
|
831
|
-
var data = {
|
|
832
|
-
"version": "0.25.0"
|
|
833
|
-
};
|
|
834
|
-
var VERSION = data.version;
|
|
835
|
-
var validators$1 = {};
|
|
836
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) {
|
|
837
|
-
validators$1[type] = function validator2(thing) {
|
|
838
|
-
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
839
|
-
};
|
|
840
|
-
});
|
|
841
|
-
var deprecatedWarnings = {};
|
|
842
|
-
validators$1.transitional = function transitional(validator2, version2, message) {
|
|
843
|
-
function formatMessage(opt, desc) {
|
|
844
|
-
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
845
|
-
}
|
|
846
|
-
return function(value, opt, opts) {
|
|
847
|
-
if (validator2 === false) {
|
|
848
|
-
throw new Error(formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")));
|
|
849
|
-
}
|
|
850
|
-
if (version2 && !deprecatedWarnings[opt]) {
|
|
851
|
-
deprecatedWarnings[opt] = true;
|
|
852
|
-
console.warn(
|
|
853
|
-
formatMessage(
|
|
854
|
-
opt,
|
|
855
|
-
" has been deprecated since v" + version2 + " and will be removed in the near future"
|
|
856
|
-
)
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
860
|
-
};
|
|
861
|
-
};
|
|
862
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
863
|
-
if (typeof options !== "object") {
|
|
864
|
-
throw new TypeError("options must be an object");
|
|
865
|
-
}
|
|
866
|
-
var keys = Object.keys(options);
|
|
867
|
-
var i = keys.length;
|
|
868
|
-
while (i-- > 0) {
|
|
869
|
-
var opt = keys[i];
|
|
870
|
-
var validator2 = schema[opt];
|
|
871
|
-
if (validator2) {
|
|
872
|
-
var value = options[opt];
|
|
873
|
-
var result = value === void 0 || validator2(value, opt, options);
|
|
874
|
-
if (result !== true) {
|
|
875
|
-
throw new TypeError("option " + opt + " must be " + result);
|
|
876
|
-
}
|
|
877
|
-
continue;
|
|
878
|
-
}
|
|
879
|
-
if (allowUnknown !== true) {
|
|
880
|
-
throw Error("Unknown option " + opt);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
var validator$1 = {
|
|
885
|
-
assertOptions,
|
|
886
|
-
validators: validators$1
|
|
887
|
-
};
|
|
888
|
-
var utils$2 = utils$e;
|
|
889
|
-
var buildURL2 = buildURL$2;
|
|
890
|
-
var InterceptorManager = InterceptorManager_1;
|
|
891
|
-
var dispatchRequest2 = dispatchRequest$1;
|
|
892
|
-
var mergeConfig$1 = mergeConfig$2;
|
|
893
|
-
var validator = validator$1;
|
|
894
|
-
var validators = validator.validators;
|
|
895
|
-
function Axios$1(instanceConfig) {
|
|
896
|
-
this.defaults = instanceConfig;
|
|
897
|
-
this.interceptors = {
|
|
898
|
-
request: new InterceptorManager(),
|
|
899
|
-
response: new InterceptorManager()
|
|
900
|
-
};
|
|
901
8
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
config.method = config.method.toLowerCase();
|
|
915
|
-
} else if (this.defaults.method) {
|
|
916
|
-
config.method = this.defaults.method.toLowerCase();
|
|
917
|
-
} else {
|
|
918
|
-
config.method = "get";
|
|
919
|
-
}
|
|
920
|
-
var transitional2 = config.transitional;
|
|
921
|
-
if (transitional2 !== void 0) {
|
|
922
|
-
validator.assertOptions(transitional2, {
|
|
923
|
-
silentJSONParsing: validators.transitional(validators.boolean),
|
|
924
|
-
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
925
|
-
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
926
|
-
}, false);
|
|
927
|
-
}
|
|
928
|
-
var requestInterceptorChain = [];
|
|
929
|
-
var synchronousRequestInterceptors = true;
|
|
930
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
931
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
934
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
935
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
936
|
-
});
|
|
937
|
-
var responseInterceptorChain = [];
|
|
938
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
939
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
940
|
-
});
|
|
941
|
-
var promise;
|
|
942
|
-
if (!synchronousRequestInterceptors) {
|
|
943
|
-
var chain = [dispatchRequest2, void 0];
|
|
944
|
-
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
945
|
-
chain = chain.concat(responseInterceptorChain);
|
|
946
|
-
promise = Promise.resolve(config);
|
|
947
|
-
while (chain.length) {
|
|
948
|
-
promise = promise.then(chain.shift(), chain.shift());
|
|
949
|
-
}
|
|
950
|
-
return promise;
|
|
951
|
-
}
|
|
952
|
-
var newConfig = config;
|
|
953
|
-
while (requestInterceptorChain.length) {
|
|
954
|
-
var onFulfilled = requestInterceptorChain.shift();
|
|
955
|
-
var onRejected = requestInterceptorChain.shift();
|
|
956
|
-
try {
|
|
957
|
-
newConfig = onFulfilled(newConfig);
|
|
958
|
-
} catch (error) {
|
|
959
|
-
onRejected(error);
|
|
960
|
-
break;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
try {
|
|
964
|
-
promise = dispatchRequest2(newConfig);
|
|
965
|
-
} catch (error) {
|
|
966
|
-
return Promise.reject(error);
|
|
967
|
-
}
|
|
968
|
-
while (responseInterceptorChain.length) {
|
|
969
|
-
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
970
|
-
}
|
|
971
|
-
return promise;
|
|
972
|
-
};
|
|
973
|
-
Axios$1.prototype.getUri = function getUri(config) {
|
|
974
|
-
if (!config.url) {
|
|
975
|
-
throw new Error("Provided config url is not valid");
|
|
976
|
-
}
|
|
977
|
-
config = mergeConfig$1(this.defaults, config);
|
|
978
|
-
return buildURL2(config.url, config.params, config.paramsSerializer).replace(/^\?/, "");
|
|
979
|
-
};
|
|
980
|
-
utils$2.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
981
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
982
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
983
|
-
method,
|
|
984
|
-
url,
|
|
985
|
-
data: (config || {}).data
|
|
986
|
-
}));
|
|
987
|
-
};
|
|
9
|
+
class l {
|
|
10
|
+
}
|
|
11
|
+
a(l, "updates", {
|
|
12
|
+
transformer_new: "New transformer",
|
|
13
|
+
transformer_null: "Null transformer"
|
|
14
|
+
}), a(l, "errors", {
|
|
15
|
+
transformer_none: "No transformers provided",
|
|
16
|
+
transformer_start: "Cannot start transformer",
|
|
17
|
+
transformer_transform: "Cannot transform frame",
|
|
18
|
+
transformer_flush: "Cannot flush transformer",
|
|
19
|
+
readable_null: "Readable is null",
|
|
20
|
+
writable_null: "Writable is null"
|
|
988
21
|
});
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
url,
|
|
994
|
-
data: data2
|
|
995
|
-
}));
|
|
996
|
-
};
|
|
997
|
-
});
|
|
998
|
-
var Axios_1 = Axios$1;
|
|
999
|
-
var Cancel = Cancel_1;
|
|
1000
|
-
function CancelToken(executor) {
|
|
1001
|
-
if (typeof executor !== "function") {
|
|
1002
|
-
throw new TypeError("executor must be a function.");
|
|
1003
|
-
}
|
|
1004
|
-
var resolvePromise;
|
|
1005
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
1006
|
-
resolvePromise = resolve;
|
|
1007
|
-
});
|
|
1008
|
-
var token = this;
|
|
1009
|
-
this.promise.then(function(cancel) {
|
|
1010
|
-
if (!token._listeners)
|
|
1011
|
-
return;
|
|
1012
|
-
var i;
|
|
1013
|
-
var l = token._listeners.length;
|
|
1014
|
-
for (i = 0; i < l; i++) {
|
|
1015
|
-
token._listeners[i](cancel);
|
|
1016
|
-
}
|
|
1017
|
-
token._listeners = null;
|
|
1018
|
-
});
|
|
1019
|
-
this.promise.then = function(onfulfilled) {
|
|
1020
|
-
var _resolve;
|
|
1021
|
-
var promise = new Promise(function(resolve) {
|
|
1022
|
-
token.subscribe(resolve);
|
|
1023
|
-
_resolve = resolve;
|
|
1024
|
-
}).then(onfulfilled);
|
|
1025
|
-
promise.cancel = function reject() {
|
|
1026
|
-
token.unsubscribe(_resolve);
|
|
1027
|
-
};
|
|
1028
|
-
return promise;
|
|
1029
|
-
};
|
|
1030
|
-
executor(function cancel(message) {
|
|
1031
|
-
if (token.reason) {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
token.reason = new Cancel(message);
|
|
1035
|
-
resolvePromise(token.reason);
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
1039
|
-
if (this.reason) {
|
|
1040
|
-
throw this.reason;
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|
1044
|
-
if (this.reason) {
|
|
1045
|
-
listener(this.reason);
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
if (this._listeners) {
|
|
1049
|
-
this._listeners.push(listener);
|
|
1050
|
-
} else {
|
|
1051
|
-
this._listeners = [listener];
|
|
1052
|
-
}
|
|
1053
|
-
};
|
|
1054
|
-
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|
1055
|
-
if (!this._listeners) {
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
var index = this._listeners.indexOf(listener);
|
|
1059
|
-
if (index !== -1) {
|
|
1060
|
-
this._listeners.splice(index, 1);
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
CancelToken.source = function source() {
|
|
1064
|
-
var cancel;
|
|
1065
|
-
var token = new CancelToken(function executor(c) {
|
|
1066
|
-
cancel = c;
|
|
1067
|
-
});
|
|
1068
|
-
return {
|
|
1069
|
-
token,
|
|
1070
|
-
cancel
|
|
1071
|
-
};
|
|
1072
|
-
};
|
|
1073
|
-
var CancelToken_1 = CancelToken;
|
|
1074
|
-
var spread = function spread2(callback) {
|
|
1075
|
-
return function wrap(arr) {
|
|
1076
|
-
return callback.apply(null, arr);
|
|
1077
|
-
};
|
|
1078
|
-
};
|
|
1079
|
-
var utils$1 = utils$e;
|
|
1080
|
-
var isAxiosError = function isAxiosError2(payload) {
|
|
1081
|
-
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
1082
|
-
};
|
|
1083
|
-
var utils = utils$e;
|
|
1084
|
-
var bind2 = bind$2;
|
|
1085
|
-
var Axios = Axios_1;
|
|
1086
|
-
var mergeConfig2 = mergeConfig$2;
|
|
1087
|
-
var defaults = defaults_1;
|
|
1088
|
-
function createInstance(defaultConfig) {
|
|
1089
|
-
var context = new Axios(defaultConfig);
|
|
1090
|
-
var instance = bind2(Axios.prototype.request, context);
|
|
1091
|
-
utils.extend(instance, Axios.prototype, context);
|
|
1092
|
-
utils.extend(instance, context);
|
|
1093
|
-
instance.create = function create(instanceConfig) {
|
|
1094
|
-
return createInstance(mergeConfig2(defaultConfig, instanceConfig));
|
|
1095
|
-
};
|
|
1096
|
-
return instance;
|
|
1097
|
-
}
|
|
1098
|
-
var axios$1 = createInstance(defaults);
|
|
1099
|
-
axios$1.Axios = Axios;
|
|
1100
|
-
axios$1.Cancel = Cancel_1;
|
|
1101
|
-
axios$1.CancelToken = CancelToken_1;
|
|
1102
|
-
axios$1.isCancel = isCancel$1;
|
|
1103
|
-
axios$1.VERSION = data.version;
|
|
1104
|
-
axios$1.all = function all(promises) {
|
|
1105
|
-
return Promise.all(promises);
|
|
1106
|
-
};
|
|
1107
|
-
axios$1.spread = spread;
|
|
1108
|
-
axios$1.isAxiosError = isAxiosError;
|
|
1109
|
-
axios$2.exports = axios$1;
|
|
1110
|
-
axios$2.exports.default = axios$1;
|
|
1111
|
-
var axios = axios$2.exports;
|
|
1112
|
-
class Optional {
|
|
1113
|
-
isEmpty() {
|
|
1114
|
-
return !this.isPresent();
|
|
1115
|
-
}
|
|
1116
|
-
static of(value) {
|
|
1117
|
-
if (value !== null && value !== void 0)
|
|
1118
|
-
return new PresentOptional(value);
|
|
1119
|
-
else
|
|
1120
|
-
throw new TypeError("The passed value was null or undefined.");
|
|
1121
|
-
}
|
|
1122
|
-
static ofNonNull(value) {
|
|
1123
|
-
return Optional.of(value);
|
|
1124
|
-
}
|
|
1125
|
-
static ofNullable(nullable) {
|
|
1126
|
-
if (nullable !== null && nullable !== void 0)
|
|
1127
|
-
return new PresentOptional(nullable);
|
|
1128
|
-
else
|
|
1129
|
-
return new EmptyOptional();
|
|
1130
|
-
}
|
|
1131
|
-
static empty() {
|
|
1132
|
-
return new EmptyOptional();
|
|
1133
|
-
}
|
|
1134
|
-
static from(option) {
|
|
1135
|
-
switch (option.kind) {
|
|
1136
|
-
case "present":
|
|
1137
|
-
return Optional.of(option.value);
|
|
1138
|
-
case "empty":
|
|
1139
|
-
return Optional.empty();
|
|
1140
|
-
default:
|
|
1141
|
-
throw new TypeError("The passed value was not an Option type.");
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
class PresentOptional extends Optional {
|
|
1146
|
-
constructor(value) {
|
|
1147
|
-
super();
|
|
1148
|
-
this.payload = value;
|
|
1149
|
-
}
|
|
1150
|
-
isPresent() {
|
|
1151
|
-
return true;
|
|
1152
|
-
}
|
|
1153
|
-
get() {
|
|
1154
|
-
return this.payload;
|
|
1155
|
-
}
|
|
1156
|
-
ifPresent(consumer) {
|
|
1157
|
-
consumer(this.payload);
|
|
1158
|
-
}
|
|
1159
|
-
ifPresentOrElse(consumer, emptyAction) {
|
|
1160
|
-
consumer(this.payload);
|
|
1161
|
-
}
|
|
1162
|
-
filter(predicate) {
|
|
1163
|
-
return predicate(this.payload) ? this : Optional.empty();
|
|
1164
|
-
}
|
|
1165
|
-
map(mapper) {
|
|
1166
|
-
const result = mapper(this.payload);
|
|
1167
|
-
return Optional.ofNullable(result);
|
|
1168
|
-
}
|
|
1169
|
-
flatMap(mapper) {
|
|
1170
|
-
return mapper(this.payload);
|
|
1171
|
-
}
|
|
1172
|
-
or(supplier) {
|
|
1173
|
-
return this;
|
|
1174
|
-
}
|
|
1175
|
-
orElse(another) {
|
|
1176
|
-
return this.payload;
|
|
1177
|
-
}
|
|
1178
|
-
orElseGet(another) {
|
|
1179
|
-
return this.payload;
|
|
1180
|
-
}
|
|
1181
|
-
orElseThrow(exception) {
|
|
1182
|
-
return this.payload;
|
|
1183
|
-
}
|
|
1184
|
-
orNull() {
|
|
1185
|
-
return this.payload;
|
|
1186
|
-
}
|
|
1187
|
-
orUndefined() {
|
|
1188
|
-
return this.payload;
|
|
1189
|
-
}
|
|
1190
|
-
toOption() {
|
|
1191
|
-
return { kind: "present", value: this.payload };
|
|
1192
|
-
}
|
|
1193
|
-
matches(cases) {
|
|
1194
|
-
return cases.present(this.payload);
|
|
1195
|
-
}
|
|
1196
|
-
toJSON(key) {
|
|
1197
|
-
return this.payload;
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
class EmptyOptional extends Optional {
|
|
1201
|
-
isPresent() {
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
constructor() {
|
|
1205
|
-
super();
|
|
1206
|
-
}
|
|
1207
|
-
get() {
|
|
1208
|
-
throw new TypeError("The optional is not present.");
|
|
1209
|
-
}
|
|
1210
|
-
ifPresent(consumer) {
|
|
1211
|
-
}
|
|
1212
|
-
ifPresentOrElse(consumer, emptyAction) {
|
|
1213
|
-
emptyAction();
|
|
1214
|
-
}
|
|
1215
|
-
filter(predicate) {
|
|
1216
|
-
return this;
|
|
1217
|
-
}
|
|
1218
|
-
map(mapper) {
|
|
1219
|
-
return Optional.empty();
|
|
1220
|
-
}
|
|
1221
|
-
flatMap(mapper) {
|
|
1222
|
-
return Optional.empty();
|
|
1223
|
-
}
|
|
1224
|
-
or(supplier) {
|
|
1225
|
-
return supplier();
|
|
1226
|
-
}
|
|
1227
|
-
orElse(another) {
|
|
1228
|
-
return another;
|
|
1229
|
-
}
|
|
1230
|
-
orElseGet(another) {
|
|
1231
|
-
return this.orElse(another());
|
|
1232
|
-
}
|
|
1233
|
-
orElseThrow(exception) {
|
|
1234
|
-
throw exception();
|
|
1235
|
-
}
|
|
1236
|
-
orNull() {
|
|
1237
|
-
return null;
|
|
1238
|
-
}
|
|
1239
|
-
orUndefined() {
|
|
1240
|
-
return void 0;
|
|
1241
|
-
}
|
|
1242
|
-
toOption() {
|
|
1243
|
-
return { kind: "empty" };
|
|
1244
|
-
}
|
|
1245
|
-
matches(cases) {
|
|
1246
|
-
return cases.empty();
|
|
1247
|
-
}
|
|
1248
|
-
toJSON(key) {
|
|
1249
|
-
return null;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
const version = "2.0.0";
|
|
1253
|
-
var VonageSourceType = /* @__PURE__ */ ((VonageSourceType2) => {
|
|
1254
|
-
VonageSourceType2["automation"] = "automation";
|
|
1255
|
-
VonageSourceType2["test"] = "test";
|
|
1256
|
-
VonageSourceType2["vbc"] = "vbc";
|
|
1257
|
-
VonageSourceType2["video"] = "video";
|
|
1258
|
-
VonageSourceType2["voice"] = "voice";
|
|
1259
|
-
return VonageSourceType2;
|
|
1260
|
-
})(VonageSourceType || {});
|
|
1261
|
-
function setVonageMetadata(metadata) {
|
|
1262
|
-
globalThis._vonageMediaProcessorMetadata = metadata;
|
|
1263
|
-
}
|
|
1264
|
-
function getVonageMetadata() {
|
|
1265
|
-
return globalThis._vonageMediaProcessorMetadata;
|
|
1266
|
-
}
|
|
1267
|
-
class ReportBuilder {
|
|
1268
|
-
constructor() {
|
|
1269
|
-
const metadata = getVonageMetadata();
|
|
1270
|
-
this._report = {
|
|
1271
|
-
action: Optional.empty(),
|
|
1272
|
-
applicationId: Optional.ofNullable(metadata !== void 0 && metadata != null ? metadata.appId : null),
|
|
1273
|
-
timestamp: Date.now(),
|
|
1274
|
-
fps: Optional.empty(),
|
|
1275
|
-
framesTransformed: Optional.empty(),
|
|
1276
|
-
guid: Optional.empty(),
|
|
1277
|
-
highestFrameTransformCpu: Optional.empty(),
|
|
1278
|
-
message: Optional.empty(),
|
|
1279
|
-
source: Optional.ofNullable(metadata !== void 0 && metadata != null ? metadata.sourceType : null),
|
|
1280
|
-
transformedFps: Optional.empty(),
|
|
1281
|
-
transformerType: Optional.empty(),
|
|
1282
|
-
variation: Optional.empty(),
|
|
1283
|
-
videoHeight: Optional.empty(),
|
|
1284
|
-
videoWidth: Optional.empty(),
|
|
1285
|
-
version,
|
|
1286
|
-
error: Optional.empty(),
|
|
1287
|
-
proxyUrl: Optional.ofNullable(metadata !== void 0 && metadata != null ? metadata.proxyUrl : null)
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
action(action) {
|
|
1291
|
-
this._report.action = Optional.ofNullable(action);
|
|
1292
|
-
return this;
|
|
1293
|
-
}
|
|
1294
|
-
framesTransformed(framesTransformed) {
|
|
1295
|
-
this._report.framesTransformed = Optional.ofNullable(framesTransformed);
|
|
1296
|
-
return this;
|
|
1297
|
-
}
|
|
1298
|
-
fps(fps) {
|
|
1299
|
-
this._report.fps = Optional.ofNullable(fps);
|
|
1300
|
-
return this;
|
|
1301
|
-
}
|
|
1302
|
-
guid(guid) {
|
|
1303
|
-
this._report.guid = Optional.ofNullable(guid);
|
|
1304
|
-
return this;
|
|
1305
|
-
}
|
|
1306
|
-
message(message) {
|
|
1307
|
-
this._report.message = Optional.ofNullable(message);
|
|
1308
|
-
return this;
|
|
1309
|
-
}
|
|
1310
|
-
transformedFps(transformedFps) {
|
|
1311
|
-
this._report.transformedFps = Optional.ofNullable(transformedFps);
|
|
1312
|
-
return this;
|
|
1313
|
-
}
|
|
1314
|
-
transformerType(transformerType) {
|
|
1315
|
-
this._report.transformerType = Optional.ofNullable(transformerType);
|
|
1316
|
-
return this;
|
|
1317
|
-
}
|
|
1318
|
-
variation(variation) {
|
|
1319
|
-
this._report.variation = Optional.ofNullable(variation);
|
|
1320
|
-
return this;
|
|
1321
|
-
}
|
|
1322
|
-
videoHeight(videoHeight) {
|
|
1323
|
-
this._report.videoHeight = Optional.ofNullable(videoHeight);
|
|
1324
|
-
return this;
|
|
1325
|
-
}
|
|
1326
|
-
videoWidth(videoWidth) {
|
|
1327
|
-
this._report.videoWidth = Optional.ofNullable(videoWidth);
|
|
1328
|
-
return this;
|
|
1329
|
-
}
|
|
1330
|
-
error(error) {
|
|
1331
|
-
this._report.error = Optional.ofNullable(error);
|
|
1332
|
-
return this;
|
|
1333
|
-
}
|
|
1334
|
-
build() {
|
|
1335
|
-
return this._report;
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
const serializeReport = (report) => {
|
|
1339
|
-
return JSON.stringify(report, (key, value) => {
|
|
1340
|
-
if (value !== null)
|
|
1341
|
-
return value;
|
|
1342
|
-
});
|
|
1343
|
-
};
|
|
1344
|
-
class Reporter {
|
|
1345
|
-
static report(report) {
|
|
1346
|
-
return new Promise((resolve, reject) => {
|
|
1347
|
-
if (report.applicationId.isEmpty() || report.source.isEmpty()) {
|
|
1348
|
-
resolve("success");
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
let axiosInstance = axios.create();
|
|
1352
|
-
let config = {
|
|
1353
|
-
timeout: 1e4,
|
|
1354
|
-
timeoutErrorMessage: "Request timeout",
|
|
1355
|
-
headers: {
|
|
1356
|
-
"Content-Type": "application/json"
|
|
1357
|
-
}
|
|
1358
|
-
};
|
|
1359
|
-
let telemetryServerUrl = "hlg.tokbox.com/prod/logging/vcp_webrtc";
|
|
1360
|
-
if (!report.proxyUrl.isEmpty()) {
|
|
1361
|
-
let proxy;
|
|
1362
|
-
if (report.proxyUrl.get().slice(report.proxyUrl.get().length - 1) !== "/") {
|
|
1363
|
-
proxy = report.proxyUrl.get() + "/";
|
|
1364
|
-
} else {
|
|
1365
|
-
proxy = report.proxyUrl.get();
|
|
1366
|
-
}
|
|
1367
|
-
telemetryServerUrl = proxy + telemetryServerUrl;
|
|
1368
|
-
} else {
|
|
1369
|
-
telemetryServerUrl = "https://" + telemetryServerUrl;
|
|
1370
|
-
}
|
|
1371
|
-
axiosInstance.post(telemetryServerUrl, serializeReport(report), config).then((res) => {
|
|
1372
|
-
console.log(res);
|
|
1373
|
-
resolve("success");
|
|
1374
|
-
}).catch((e) => {
|
|
1375
|
-
console.log(e);
|
|
1376
|
-
reject(e);
|
|
1377
|
-
});
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
var getRandomValues;
|
|
1382
|
-
var rnds8 = new Uint8Array(16);
|
|
1383
|
-
function rng() {
|
|
1384
|
-
if (!getRandomValues) {
|
|
1385
|
-
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
|
|
1386
|
-
if (!getRandomValues) {
|
|
1387
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
return getRandomValues(rnds8);
|
|
1391
|
-
}
|
|
1392
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
1393
|
-
function validate(uuid) {
|
|
1394
|
-
return typeof uuid === "string" && REGEX.test(uuid);
|
|
1395
|
-
}
|
|
1396
|
-
var byteToHex = [];
|
|
1397
|
-
for (var i = 0; i < 256; ++i) {
|
|
1398
|
-
byteToHex.push((i + 256).toString(16).substr(1));
|
|
1399
|
-
}
|
|
1400
|
-
function stringify(arr) {
|
|
1401
|
-
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
1402
|
-
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
1403
|
-
if (!validate(uuid)) {
|
|
1404
|
-
throw TypeError("Stringified UUID is invalid");
|
|
1405
|
-
}
|
|
1406
|
-
return uuid;
|
|
1407
|
-
}
|
|
1408
|
-
function v4(options, buf, offset) {
|
|
1409
|
-
options = options || {};
|
|
1410
|
-
var rnds = options.random || (options.rng || rng)();
|
|
1411
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
1412
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
1413
|
-
if (buf) {
|
|
1414
|
-
offset = offset || 0;
|
|
1415
|
-
for (var i = 0; i < 16; ++i) {
|
|
1416
|
-
buf[offset + i] = rnds[i];
|
|
1417
|
-
}
|
|
1418
|
-
return buf;
|
|
1419
|
-
}
|
|
1420
|
-
return stringify(rnds);
|
|
1421
|
-
}
|
|
1422
|
-
const anyMap = /* @__PURE__ */ new WeakMap();
|
|
1423
|
-
const eventsMap = /* @__PURE__ */ new WeakMap();
|
|
1424
|
-
const producersMap = /* @__PURE__ */ new WeakMap();
|
|
1425
|
-
const anyProducer = Symbol("anyProducer");
|
|
1426
|
-
const resolvedPromise = Promise.resolve();
|
|
1427
|
-
const listenerAdded = Symbol("listenerAdded");
|
|
1428
|
-
const listenerRemoved = Symbol("listenerRemoved");
|
|
1429
|
-
let isGlobalDebugEnabled = false;
|
|
1430
|
-
function assertEventName(eventName) {
|
|
1431
|
-
if (typeof eventName !== "string" && typeof eventName !== "symbol") {
|
|
22
|
+
const h = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), O = Symbol("anyProducer"), D = Promise.resolve(), k = Symbol("listenerAdded"), A = Symbol("listenerRemoved");
|
|
23
|
+
let x = !1;
|
|
24
|
+
function _(t) {
|
|
25
|
+
if (typeof t != "string" && typeof t != "symbol")
|
|
1432
26
|
throw new TypeError("eventName must be a string or a symbol");
|
|
1433
|
-
}
|
|
1434
27
|
}
|
|
1435
|
-
function
|
|
1436
|
-
if (typeof
|
|
28
|
+
function T(t) {
|
|
29
|
+
if (typeof t != "function")
|
|
1437
30
|
throw new TypeError("listener must be a function");
|
|
1438
|
-
}
|
|
1439
31
|
}
|
|
1440
|
-
function
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
function iterator(instance, eventNames) {
|
|
1470
|
-
eventNames = Array.isArray(eventNames) ? eventNames : [eventNames];
|
|
1471
|
-
let isFinished = false;
|
|
1472
|
-
let flush = () => {
|
|
1473
|
-
};
|
|
1474
|
-
let queue = [];
|
|
1475
|
-
const producer = {
|
|
1476
|
-
enqueue(item) {
|
|
1477
|
-
queue.push(item);
|
|
1478
|
-
flush();
|
|
32
|
+
function g(t, e) {
|
|
33
|
+
const r = E.get(t);
|
|
34
|
+
return r.has(e) || r.set(e, /* @__PURE__ */ new Set()), r.get(e);
|
|
35
|
+
}
|
|
36
|
+
function b(t, e) {
|
|
37
|
+
const r = typeof e == "string" || typeof e == "symbol" ? e : O, s = y.get(t);
|
|
38
|
+
return s.has(r) || s.set(r, /* @__PURE__ */ new Set()), s.get(r);
|
|
39
|
+
}
|
|
40
|
+
function Y(t, e, r) {
|
|
41
|
+
const s = y.get(t);
|
|
42
|
+
if (s.has(e))
|
|
43
|
+
for (const o of s.get(e))
|
|
44
|
+
o.enqueue(r);
|
|
45
|
+
if (s.has(O)) {
|
|
46
|
+
const o = Promise.all([e, r]);
|
|
47
|
+
for (const i of s.get(O))
|
|
48
|
+
i.enqueue(o);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function U(t, e) {
|
|
52
|
+
e = Array.isArray(e) ? e : [e];
|
|
53
|
+
let r = !1, s = () => {
|
|
54
|
+
}, o = [];
|
|
55
|
+
const i = {
|
|
56
|
+
enqueue(n) {
|
|
57
|
+
o.push(n), s();
|
|
1479
58
|
},
|
|
1480
59
|
finish() {
|
|
1481
|
-
|
|
1482
|
-
flush();
|
|
60
|
+
r = !0, s();
|
|
1483
61
|
}
|
|
1484
62
|
};
|
|
1485
|
-
for (const
|
|
1486
|
-
|
|
1487
|
-
}
|
|
63
|
+
for (const n of e)
|
|
64
|
+
b(t, n).add(i);
|
|
1488
65
|
return {
|
|
1489
66
|
async next() {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
return this.next();
|
|
1497
|
-
}
|
|
1498
|
-
await new Promise((resolve) => {
|
|
1499
|
-
flush = resolve;
|
|
1500
|
-
});
|
|
1501
|
-
return this.next();
|
|
1502
|
-
}
|
|
1503
|
-
return {
|
|
1504
|
-
done: false,
|
|
1505
|
-
value: await queue.shift()
|
|
1506
|
-
};
|
|
67
|
+
return o ? o.length === 0 ? r ? (o = void 0, this.next()) : (await new Promise((n) => {
|
|
68
|
+
s = n;
|
|
69
|
+
}), this.next()) : {
|
|
70
|
+
done: !1,
|
|
71
|
+
value: await o.shift()
|
|
72
|
+
} : { done: !0 };
|
|
1507
73
|
},
|
|
1508
|
-
async return(
|
|
1509
|
-
|
|
1510
|
-
for (const
|
|
1511
|
-
|
|
1512
|
-
}
|
|
1513
|
-
flush();
|
|
1514
|
-
return arguments.length > 0 ? { done: true, value: await value } : { done: true };
|
|
74
|
+
async return(n) {
|
|
75
|
+
o = void 0;
|
|
76
|
+
for (const c of e)
|
|
77
|
+
b(t, c).delete(i);
|
|
78
|
+
return s(), arguments.length > 0 ? { done: !0, value: await n } : { done: !0 };
|
|
1515
79
|
},
|
|
1516
80
|
[Symbol.asyncIterator]() {
|
|
1517
81
|
return this;
|
|
1518
82
|
}
|
|
1519
83
|
};
|
|
1520
84
|
}
|
|
1521
|
-
function
|
|
1522
|
-
if (
|
|
1523
|
-
return
|
|
1524
|
-
|
|
1525
|
-
if (!Array.isArray(methodNames)) {
|
|
85
|
+
function H(t) {
|
|
86
|
+
if (t === void 0)
|
|
87
|
+
return $;
|
|
88
|
+
if (!Array.isArray(t))
|
|
1526
89
|
throw new TypeError("`methodNames` must be an array of strings");
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
const isListenerSymbol = (symbol) => symbol === listenerAdded || symbol === listenerRemoved;
|
|
1539
|
-
class Emittery {
|
|
1540
|
-
static mixin(emitteryPropertyName, methodNames) {
|
|
1541
|
-
methodNames = defaultMethodNamesOrAssert(methodNames);
|
|
1542
|
-
return (target) => {
|
|
1543
|
-
if (typeof target !== "function") {
|
|
90
|
+
for (const e of t)
|
|
91
|
+
if (!$.includes(e))
|
|
92
|
+
throw typeof e != "string" ? new TypeError("`methodNames` element must be a string") : new Error(`${e} is not Emittery method`);
|
|
93
|
+
return t;
|
|
94
|
+
}
|
|
95
|
+
const I = (t) => t === k || t === A;
|
|
96
|
+
class m {
|
|
97
|
+
static mixin(e, r) {
|
|
98
|
+
return r = H(r), (s) => {
|
|
99
|
+
if (typeof s != "function")
|
|
1544
100
|
throw new TypeError("`target` must be function");
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
}
|
|
1558
|
-
Object.defineProperty(target.prototype, emitteryPropertyName, {
|
|
1559
|
-
enumerable: false,
|
|
1560
|
-
get: getEmitteryProperty
|
|
101
|
+
for (const n of r)
|
|
102
|
+
if (s.prototype[n] !== void 0)
|
|
103
|
+
throw new Error(`The property \`${n}\` already exists on \`target\``);
|
|
104
|
+
function o() {
|
|
105
|
+
return Object.defineProperty(this, e, {
|
|
106
|
+
enumerable: !1,
|
|
107
|
+
value: new m()
|
|
108
|
+
}), this[e];
|
|
109
|
+
}
|
|
110
|
+
Object.defineProperty(s.prototype, e, {
|
|
111
|
+
enumerable: !1,
|
|
112
|
+
get: o
|
|
1561
113
|
});
|
|
1562
|
-
const
|
|
1563
|
-
return this[
|
|
114
|
+
const i = (n) => function(...c) {
|
|
115
|
+
return this[e][n](...c);
|
|
1564
116
|
};
|
|
1565
|
-
for (const
|
|
1566
|
-
Object.defineProperty(
|
|
1567
|
-
enumerable:
|
|
1568
|
-
value:
|
|
117
|
+
for (const n of r)
|
|
118
|
+
Object.defineProperty(s.prototype, n, {
|
|
119
|
+
enumerable: !1,
|
|
120
|
+
value: i(n)
|
|
1569
121
|
});
|
|
1570
|
-
|
|
1571
|
-
return target;
|
|
122
|
+
return s;
|
|
1572
123
|
};
|
|
1573
124
|
}
|
|
1574
125
|
static get isDebugEnabled() {
|
|
1575
|
-
if (typeof process
|
|
1576
|
-
return
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
return env.DEBUG === "emittery" || env.DEBUG === "*" || isGlobalDebugEnabled;
|
|
126
|
+
if (typeof process != "object")
|
|
127
|
+
return x;
|
|
128
|
+
const { env: e } = process || { env: {} };
|
|
129
|
+
return e.DEBUG === "emittery" || e.DEBUG === "*" || x;
|
|
1580
130
|
}
|
|
1581
|
-
static set isDebugEnabled(
|
|
1582
|
-
|
|
131
|
+
static set isDebugEnabled(e) {
|
|
132
|
+
x = e;
|
|
1583
133
|
}
|
|
1584
|
-
constructor(
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
eventName = eventName.toString();
|
|
1597
|
-
}
|
|
1598
|
-
const currentTime = new Date();
|
|
1599
|
-
const logTime = `${currentTime.getHours()}:${currentTime.getMinutes()}:${currentTime.getSeconds()}.${currentTime.getMilliseconds()}`;
|
|
1600
|
-
console.log(`[${logTime}][emittery:${type}][${debugName}] Event Name: ${eventName}
|
|
1601
|
-
data: ${eventData}`);
|
|
1602
|
-
};
|
|
1603
|
-
}
|
|
134
|
+
constructor(e = {}) {
|
|
135
|
+
h.set(this, /* @__PURE__ */ new Set()), E.set(this, /* @__PURE__ */ new Map()), y.set(this, /* @__PURE__ */ new Map()), this.debug = e.debug || {}, this.debug.enabled === void 0 && (this.debug.enabled = !1), this.debug.logger || (this.debug.logger = (r, s, o, i) => {
|
|
136
|
+
try {
|
|
137
|
+
i = JSON.stringify(i);
|
|
138
|
+
} catch {
|
|
139
|
+
i = `Object with the following keys failed to stringify: ${Object.keys(i).join(",")}`;
|
|
140
|
+
}
|
|
141
|
+
typeof o == "symbol" && (o = o.toString());
|
|
142
|
+
const n = new Date(), c = `${n.getHours()}:${n.getMinutes()}:${n.getSeconds()}.${n.getMilliseconds()}`;
|
|
143
|
+
console.log(`[${c}][emittery:${r}][${s}] Event Name: ${o}
|
|
144
|
+
data: ${i}`);
|
|
145
|
+
});
|
|
1604
146
|
}
|
|
1605
|
-
logIfDebugEnabled(
|
|
1606
|
-
|
|
1607
|
-
this.debug.logger(type, this.debug.name, eventName, eventData);
|
|
1608
|
-
}
|
|
147
|
+
logIfDebugEnabled(e, r, s) {
|
|
148
|
+
(m.isDebugEnabled || this.debug.enabled) && this.debug.logger(e, this.debug.name, r, s);
|
|
1609
149
|
}
|
|
1610
|
-
on(
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
getListeners(this, eventName).add(listener);
|
|
1616
|
-
this.logIfDebugEnabled("subscribe", eventName, void 0);
|
|
1617
|
-
if (!isListenerSymbol(eventName)) {
|
|
1618
|
-
this.emit(listenerAdded, { eventName, listener });
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
return this.off.bind(this, eventNames, listener);
|
|
150
|
+
on(e, r) {
|
|
151
|
+
T(r), e = Array.isArray(e) ? e : [e];
|
|
152
|
+
for (const s of e)
|
|
153
|
+
_(s), g(this, s).add(r), this.logIfDebugEnabled("subscribe", s, void 0), I(s) || this.emit(k, { eventName: s, listener: r });
|
|
154
|
+
return this.off.bind(this, e, r);
|
|
1622
155
|
}
|
|
1623
|
-
off(
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
assertEventName(eventName);
|
|
1628
|
-
getListeners(this, eventName).delete(listener);
|
|
1629
|
-
this.logIfDebugEnabled("unsubscribe", eventName, void 0);
|
|
1630
|
-
if (!isListenerSymbol(eventName)) {
|
|
1631
|
-
this.emit(listenerRemoved, { eventName, listener });
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
156
|
+
off(e, r) {
|
|
157
|
+
T(r), e = Array.isArray(e) ? e : [e];
|
|
158
|
+
for (const s of e)
|
|
159
|
+
_(s), g(this, s).delete(r), this.logIfDebugEnabled("unsubscribe", s, void 0), I(s) || this.emit(A, { eventName: s, listener: r });
|
|
1634
160
|
}
|
|
1635
|
-
once(
|
|
1636
|
-
return new Promise((
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1639
|
-
resolve(data2);
|
|
161
|
+
once(e) {
|
|
162
|
+
return new Promise((r) => {
|
|
163
|
+
const s = this.on(e, (o) => {
|
|
164
|
+
s(), r(o);
|
|
1640
165
|
});
|
|
1641
166
|
});
|
|
1642
167
|
}
|
|
1643
|
-
events(
|
|
1644
|
-
|
|
1645
|
-
for (const
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
const staticListeners = [...listeners];
|
|
1657
|
-
const staticAnyListeners = isListenerSymbol(eventName) ? [] : [...anyListeners];
|
|
1658
|
-
await resolvedPromise;
|
|
1659
|
-
await Promise.all([
|
|
1660
|
-
...staticListeners.map(async (listener) => {
|
|
1661
|
-
if (listeners.has(listener)) {
|
|
1662
|
-
return listener(eventData);
|
|
1663
|
-
}
|
|
168
|
+
events(e) {
|
|
169
|
+
e = Array.isArray(e) ? e : [e];
|
|
170
|
+
for (const r of e)
|
|
171
|
+
_(r);
|
|
172
|
+
return U(this, e);
|
|
173
|
+
}
|
|
174
|
+
async emit(e, r) {
|
|
175
|
+
_(e), this.logIfDebugEnabled("emit", e, r), Y(this, e, r);
|
|
176
|
+
const s = g(this, e), o = h.get(this), i = [...s], n = I(e) ? [] : [...o];
|
|
177
|
+
await D, await Promise.all([
|
|
178
|
+
...i.map(async (c) => {
|
|
179
|
+
if (s.has(c))
|
|
180
|
+
return c(r);
|
|
1664
181
|
}),
|
|
1665
|
-
...
|
|
1666
|
-
if (
|
|
1667
|
-
return
|
|
1668
|
-
}
|
|
182
|
+
...n.map(async (c) => {
|
|
183
|
+
if (o.has(c))
|
|
184
|
+
return c(e, r);
|
|
1669
185
|
})
|
|
1670
186
|
]);
|
|
1671
187
|
}
|
|
1672
|
-
async emitSerial(
|
|
1673
|
-
|
|
1674
|
-
this.
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
for (const listener of staticListeners) {
|
|
1681
|
-
if (listeners.has(listener)) {
|
|
1682
|
-
await listener(eventData);
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
for (const listener of staticAnyListeners) {
|
|
1686
|
-
if (anyListeners.has(listener)) {
|
|
1687
|
-
await listener(eventName, eventData);
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
188
|
+
async emitSerial(e, r) {
|
|
189
|
+
_(e), this.logIfDebugEnabled("emitSerial", e, r);
|
|
190
|
+
const s = g(this, e), o = h.get(this), i = [...s], n = [...o];
|
|
191
|
+
await D;
|
|
192
|
+
for (const c of i)
|
|
193
|
+
s.has(c) && await c(r);
|
|
194
|
+
for (const c of n)
|
|
195
|
+
o.has(c) && await c(e, r);
|
|
1690
196
|
}
|
|
1691
|
-
onAny(
|
|
1692
|
-
|
|
1693
|
-
this.logIfDebugEnabled("subscribeAny", void 0, void 0);
|
|
1694
|
-
anyMap.get(this).add(listener);
|
|
1695
|
-
this.emit(listenerAdded, { listener });
|
|
1696
|
-
return this.offAny.bind(this, listener);
|
|
197
|
+
onAny(e) {
|
|
198
|
+
return T(e), this.logIfDebugEnabled("subscribeAny", void 0, void 0), h.get(this).add(e), this.emit(k, { listener: e }), this.offAny.bind(this, e);
|
|
1697
199
|
}
|
|
1698
200
|
anyEvent() {
|
|
1699
|
-
return
|
|
1700
|
-
}
|
|
1701
|
-
offAny(
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
const producers = getEventProducers(this, eventName);
|
|
1714
|
-
for (const producer of producers) {
|
|
1715
|
-
producer.finish();
|
|
1716
|
-
}
|
|
1717
|
-
producers.clear();
|
|
201
|
+
return U(this);
|
|
202
|
+
}
|
|
203
|
+
offAny(e) {
|
|
204
|
+
T(e), this.logIfDebugEnabled("unsubscribeAny", void 0, void 0), this.emit(A, { listener: e }), h.get(this).delete(e);
|
|
205
|
+
}
|
|
206
|
+
clearListeners(e) {
|
|
207
|
+
e = Array.isArray(e) ? e : [e];
|
|
208
|
+
for (const r of e)
|
|
209
|
+
if (this.logIfDebugEnabled("clear", r, void 0), typeof r == "string" || typeof r == "symbol") {
|
|
210
|
+
g(this, r).clear();
|
|
211
|
+
const s = b(this, r);
|
|
212
|
+
for (const o of s)
|
|
213
|
+
o.finish();
|
|
214
|
+
s.clear();
|
|
1718
215
|
} else {
|
|
1719
|
-
|
|
1720
|
-
for (const
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
}
|
|
1727
|
-
producers.clear();
|
|
216
|
+
h.get(this).clear();
|
|
217
|
+
for (const s of E.get(this).values())
|
|
218
|
+
s.clear();
|
|
219
|
+
for (const s of y.get(this).values()) {
|
|
220
|
+
for (const o of s)
|
|
221
|
+
o.finish();
|
|
222
|
+
s.clear();
|
|
1728
223
|
}
|
|
1729
224
|
}
|
|
1730
|
-
}
|
|
1731
225
|
}
|
|
1732
|
-
listenerCount(
|
|
1733
|
-
|
|
1734
|
-
let
|
|
1735
|
-
for (const
|
|
1736
|
-
if (typeof
|
|
1737
|
-
|
|
226
|
+
listenerCount(e) {
|
|
227
|
+
e = Array.isArray(e) ? e : [e];
|
|
228
|
+
let r = 0;
|
|
229
|
+
for (const s of e) {
|
|
230
|
+
if (typeof s == "string") {
|
|
231
|
+
r += h.get(this).size + g(this, s).size + b(this, s).size + b(this).size;
|
|
1738
232
|
continue;
|
|
1739
233
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
count += value.size;
|
|
1746
|
-
}
|
|
1747
|
-
for (const value of producersMap.get(this).values()) {
|
|
1748
|
-
count += value.size;
|
|
1749
|
-
}
|
|
234
|
+
typeof s < "u" && _(s), r += h.get(this).size;
|
|
235
|
+
for (const o of E.get(this).values())
|
|
236
|
+
r += o.size;
|
|
237
|
+
for (const o of y.get(this).values())
|
|
238
|
+
r += o.size;
|
|
1750
239
|
}
|
|
1751
|
-
return
|
|
240
|
+
return r;
|
|
1752
241
|
}
|
|
1753
|
-
bindMethods(
|
|
1754
|
-
if (typeof
|
|
242
|
+
bindMethods(e, r) {
|
|
243
|
+
if (typeof e != "object" || e === null)
|
|
1755
244
|
throw new TypeError("`target` must be an object");
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
enumerable: false,
|
|
1764
|
-
value: this[methodName].bind(this)
|
|
245
|
+
r = H(r);
|
|
246
|
+
for (const s of r) {
|
|
247
|
+
if (e[s] !== void 0)
|
|
248
|
+
throw new Error(`The property \`${s}\` already exists on \`target\``);
|
|
249
|
+
Object.defineProperty(e, s, {
|
|
250
|
+
enumerable: !1,
|
|
251
|
+
value: this[s].bind(this)
|
|
1765
252
|
});
|
|
1766
253
|
}
|
|
1767
254
|
}
|
|
1768
255
|
}
|
|
1769
|
-
const
|
|
1770
|
-
Object.defineProperty(
|
|
1771
|
-
value:
|
|
1772
|
-
writable:
|
|
1773
|
-
enumerable:
|
|
1774
|
-
configurable:
|
|
256
|
+
const $ = Object.getOwnPropertyNames(m.prototype).filter((t) => t !== "constructor");
|
|
257
|
+
Object.defineProperty(m, "listenerAdded", {
|
|
258
|
+
value: k,
|
|
259
|
+
writable: !1,
|
|
260
|
+
enumerable: !0,
|
|
261
|
+
configurable: !1
|
|
1775
262
|
});
|
|
1776
|
-
Object.defineProperty(
|
|
1777
|
-
value:
|
|
1778
|
-
writable:
|
|
1779
|
-
enumerable:
|
|
1780
|
-
configurable:
|
|
263
|
+
Object.defineProperty(m, "listenerRemoved", {
|
|
264
|
+
value: A,
|
|
265
|
+
writable: !1,
|
|
266
|
+
enumerable: !0,
|
|
267
|
+
configurable: !1
|
|
1781
268
|
});
|
|
1782
|
-
var
|
|
1783
|
-
function
|
|
1784
|
-
return typeof
|
|
269
|
+
var L = m;
|
|
270
|
+
function q(t) {
|
|
271
|
+
return typeof t == "object" && t !== null && "message" in t && typeof t.message == "string";
|
|
1785
272
|
}
|
|
1786
|
-
function
|
|
1787
|
-
if (
|
|
1788
|
-
return
|
|
273
|
+
function J(t) {
|
|
274
|
+
if (q(t))
|
|
275
|
+
return t;
|
|
1789
276
|
try {
|
|
1790
|
-
return new Error(JSON.stringify(
|
|
277
|
+
return new Error(JSON.stringify(t));
|
|
1791
278
|
} catch {
|
|
1792
|
-
return new Error(String(
|
|
1793
|
-
}
|
|
279
|
+
return new Error(String(t));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function v(t) {
|
|
283
|
+
return J(t).message;
|
|
284
|
+
}
|
|
285
|
+
var X = Object.defineProperty, Z = (t, e, r) => e in t ? X(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, K = (t, e, r) => (Z(t, typeof e != "symbol" ? e + "" : e, r), r), N = /* @__PURE__ */ ((t) => (t.automation = "automation", t.test = "test", t.vbc = "vbc", t.video = "video", t.voice = "voice", t))(N || {});
|
|
286
|
+
const ee = "hlg.tokbox.com/prod/logging/vcp_webrtc", re = "https://", te = 1e4;
|
|
287
|
+
let S;
|
|
288
|
+
const se = new Uint8Array(16);
|
|
289
|
+
function oe() {
|
|
290
|
+
if (!S && (S = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !S))
|
|
291
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
292
|
+
return S(se);
|
|
293
|
+
}
|
|
294
|
+
const f = [];
|
|
295
|
+
for (let t = 0; t < 256; ++t)
|
|
296
|
+
f.push((t + 256).toString(16).slice(1));
|
|
297
|
+
function ie(t, e = 0) {
|
|
298
|
+
return (f[t[e + 0]] + f[t[e + 1]] + f[t[e + 2]] + f[t[e + 3]] + "-" + f[t[e + 4]] + f[t[e + 5]] + "-" + f[t[e + 6]] + f[t[e + 7]] + "-" + f[t[e + 8]] + f[t[e + 9]] + "-" + f[t[e + 10]] + f[t[e + 11]] + f[t[e + 12]] + f[t[e + 13]] + f[t[e + 14]] + f[t[e + 15]]).toLowerCase();
|
|
299
|
+
}
|
|
300
|
+
const ne = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Q = {
|
|
301
|
+
randomUUID: ne
|
|
302
|
+
};
|
|
303
|
+
function ae(t, e, r) {
|
|
304
|
+
if (Q.randomUUID && !e && !t)
|
|
305
|
+
return Q.randomUUID();
|
|
306
|
+
t = t || {};
|
|
307
|
+
const s = t.random || (t.rng || oe)();
|
|
308
|
+
if (s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, e) {
|
|
309
|
+
r = r || 0;
|
|
310
|
+
for (let o = 0; o < 16; ++o)
|
|
311
|
+
e[r + o] = s[o];
|
|
312
|
+
return e;
|
|
313
|
+
}
|
|
314
|
+
return ie(s);
|
|
315
|
+
}
|
|
316
|
+
const p = {};
|
|
317
|
+
var d = /* @__PURE__ */ ((t) => (t.INIT = "INIT", t.FORWARD = "FORWARD", t.TERMINATE = "TERMINATE", t.GLOBALS_SYNC = "GLOBALS_SYNC", t))(d || {});
|
|
318
|
+
function j(t) {
|
|
319
|
+
return [ImageBitmap, ReadableStream, WritableStream].some((e) => t instanceof e);
|
|
320
|
+
}
|
|
321
|
+
let ce = 0;
|
|
322
|
+
function fe(t, e, r, s, o) {
|
|
323
|
+
const i = ce++;
|
|
324
|
+
return t.postMessage(
|
|
325
|
+
{
|
|
326
|
+
id: i,
|
|
327
|
+
type: e,
|
|
328
|
+
functionName: r,
|
|
329
|
+
args: s
|
|
330
|
+
},
|
|
331
|
+
s.filter((n) => j(n))
|
|
332
|
+
), new Promise((n) => {
|
|
333
|
+
o == null || o.set(i, n);
|
|
334
|
+
});
|
|
1794
335
|
}
|
|
1795
|
-
function
|
|
1796
|
-
|
|
336
|
+
function w(t, e) {
|
|
337
|
+
const { id: r, type: s } = t, o = Array.isArray(e) ? e : [e];
|
|
338
|
+
postMessage(
|
|
339
|
+
{
|
|
340
|
+
id: r,
|
|
341
|
+
type: s,
|
|
342
|
+
result: e
|
|
343
|
+
},
|
|
344
|
+
o.filter((i) => j(i))
|
|
345
|
+
);
|
|
1797
346
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
return
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
const RATE_DROP_TO_PRECENT = 0.8;
|
|
1819
|
-
class InternalTransformer extends emittery {
|
|
1820
|
-
constructor(transformer, index) {
|
|
1821
|
-
super();
|
|
1822
|
-
this.index_ = index;
|
|
1823
|
-
this.uuid_ = v4();
|
|
1824
|
-
this.framesTransformed_ = 0;
|
|
1825
|
-
this.transformer_ = transformer;
|
|
1826
|
-
this.shouldStop_ = false;
|
|
1827
|
-
this.isFlashed_ = false;
|
|
1828
|
-
this.framesFromSource_ = 0;
|
|
1829
|
-
this.fps_ = 0;
|
|
1830
|
-
this.mediaTransformerQosReportStartTimestamp_ = 0;
|
|
1831
|
-
this.videoHeight_ = 0;
|
|
1832
|
-
this.videoWidth_ = 0;
|
|
1833
|
-
this.trackExpectedRate_ = -1;
|
|
1834
|
-
this.transformerType_ = "Custom";
|
|
1835
|
-
if ("getTransformerType" in transformer) {
|
|
1836
|
-
this.transformerType_ = transformer.getTransformerType();
|
|
347
|
+
const G = {};
|
|
348
|
+
function z() {
|
|
349
|
+
return typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope;
|
|
350
|
+
}
|
|
351
|
+
async function le() {
|
|
352
|
+
if (z())
|
|
353
|
+
w({ type: d.GLOBALS_SYNC }, p);
|
|
354
|
+
else {
|
|
355
|
+
const t = [];
|
|
356
|
+
for (const e in G) {
|
|
357
|
+
const { worker: r, resolvers: s } = G[e].workerContext;
|
|
358
|
+
r && t.push(
|
|
359
|
+
fe(
|
|
360
|
+
r,
|
|
361
|
+
d.GLOBALS_SYNC,
|
|
362
|
+
"",
|
|
363
|
+
[p],
|
|
364
|
+
s
|
|
365
|
+
)
|
|
366
|
+
);
|
|
1837
367
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
368
|
+
await Promise.all(t);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function P(t, e) {
|
|
372
|
+
if (Array.isArray(e))
|
|
373
|
+
e.splice(0, e.length);
|
|
374
|
+
else if (typeof e == "object")
|
|
375
|
+
for (const r in e)
|
|
376
|
+
delete e[r];
|
|
377
|
+
for (const r in t)
|
|
378
|
+
Array.isArray(t[r]) ? (e[r] = [], P(t[r], e[r])) : typeof t[r] == "object" ? (e[r] = {}, P(t[r], e[r])) : e[r] = t[r];
|
|
379
|
+
}
|
|
380
|
+
async function ue(t, e) {
|
|
381
|
+
const { functionName: r, args: s } = t;
|
|
382
|
+
if (!e.instance)
|
|
383
|
+
throw "instance not initialized";
|
|
384
|
+
if (!r)
|
|
385
|
+
throw "missing function name to call";
|
|
386
|
+
if (!e.instance[r])
|
|
387
|
+
throw `undefined function [${r}] in class ${e.instance.constructor.workerId}`;
|
|
388
|
+
w(t, await e.instance[r](...s != null ? s : []));
|
|
389
|
+
}
|
|
390
|
+
const he = {};
|
|
391
|
+
function pe(t, e) {
|
|
392
|
+
if (!t.args)
|
|
393
|
+
throw "Missing className while initializing worker";
|
|
394
|
+
const [r, s] = t.args, o = he[r];
|
|
395
|
+
if (o)
|
|
396
|
+
e.instance = new o(t.args.slice(1));
|
|
397
|
+
else
|
|
398
|
+
throw `unknown worker class ${r}`;
|
|
399
|
+
P(s, p), w(t, typeof e.instance !== void 0);
|
|
400
|
+
}
|
|
401
|
+
async function de(t, e) {
|
|
402
|
+
const { args: r } = t;
|
|
403
|
+
if (!e.instance)
|
|
404
|
+
throw "instance not initialized";
|
|
405
|
+
let s;
|
|
406
|
+
e.instance.terminate && (s = await e.instance.terminate(...r != null ? r : [])), w(t, s);
|
|
407
|
+
}
|
|
408
|
+
function me(t) {
|
|
409
|
+
if (!t.args)
|
|
410
|
+
throw "Missing globals while syncing";
|
|
411
|
+
P(t.args[0], p), w(t, {});
|
|
412
|
+
}
|
|
413
|
+
function _e() {
|
|
414
|
+
const t = {};
|
|
415
|
+
onmessage = async (e) => {
|
|
416
|
+
const r = e.data;
|
|
417
|
+
switch (r.type) {
|
|
418
|
+
case d.INIT:
|
|
419
|
+
pe(r, t);
|
|
420
|
+
break;
|
|
421
|
+
case d.FORWARD:
|
|
422
|
+
ue(r, t);
|
|
423
|
+
break;
|
|
424
|
+
case d.TERMINATE:
|
|
425
|
+
de(r, t);
|
|
426
|
+
break;
|
|
427
|
+
case d.GLOBALS_SYNC:
|
|
428
|
+
me(r);
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
z() && _e();
|
|
434
|
+
function ge(t, e) {
|
|
435
|
+
return p[t] || (p[t] = e), [
|
|
436
|
+
() => p[t],
|
|
437
|
+
async (r) => {
|
|
438
|
+
p[t] = r, await le();
|
|
439
|
+
}
|
|
440
|
+
];
|
|
441
|
+
}
|
|
442
|
+
function ye(t, e) {
|
|
443
|
+
return ge(t, e);
|
|
444
|
+
}
|
|
445
|
+
const [be, we] = ye("metadata");
|
|
446
|
+
function ve(t) {
|
|
447
|
+
we(t);
|
|
448
|
+
}
|
|
449
|
+
function C() {
|
|
450
|
+
return be();
|
|
451
|
+
}
|
|
452
|
+
class W {
|
|
453
|
+
constructor(e) {
|
|
454
|
+
K(this, "uuid", ae()), this.config = e;
|
|
455
|
+
}
|
|
456
|
+
async send(e) {
|
|
457
|
+
var r, s, o;
|
|
458
|
+
const { appId: i, sourceType: n } = (r = C()) != null ? r : {};
|
|
459
|
+
if (!i || !n)
|
|
460
|
+
return "metadata missing";
|
|
461
|
+
const c = new AbortController(), u = setTimeout(() => c.abort(), te);
|
|
462
|
+
return await ((o = (s = this.config) == null ? void 0 : s.fetch) != null ? o : fetch)(this.getUrl(), {
|
|
463
|
+
method: "POST",
|
|
464
|
+
headers: this.getHeaders(),
|
|
465
|
+
body: JSON.stringify(this.buildReport(e)),
|
|
466
|
+
signal: c.signal
|
|
467
|
+
}), clearTimeout(u), "success";
|
|
468
|
+
}
|
|
469
|
+
getUrl() {
|
|
470
|
+
var e;
|
|
471
|
+
let r = (e = C().proxyUrl) != null ? e : re;
|
|
472
|
+
return r += (r.at(-1) === "/" ? "" : "/") + ee, r;
|
|
473
|
+
}
|
|
474
|
+
getHeaders() {
|
|
475
|
+
return {
|
|
476
|
+
"Content-Type": "application/json"
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
buildReport(e) {
|
|
480
|
+
const r = C();
|
|
481
|
+
return {
|
|
482
|
+
guid: this.uuid,
|
|
483
|
+
...e,
|
|
484
|
+
applicationId: r.appId,
|
|
485
|
+
timestamp: Date.now(),
|
|
486
|
+
proxyUrl: r.proxyUrl,
|
|
487
|
+
source: r.sourceType
|
|
488
|
+
};
|
|
1840
489
|
}
|
|
1841
|
-
|
|
1842
|
-
|
|
490
|
+
}
|
|
491
|
+
const R = "2.0.1";
|
|
492
|
+
class Te {
|
|
493
|
+
constructor(e) {
|
|
494
|
+
a(this, "frameTransformedCount", 0);
|
|
495
|
+
a(this, "frameFromSourceCount", 0);
|
|
496
|
+
a(this, "startAt", 0);
|
|
497
|
+
a(this, "reporter");
|
|
498
|
+
this.config = e, this.reporter = new W(e);
|
|
499
|
+
}
|
|
500
|
+
async onFrameFromSource() {
|
|
501
|
+
this.frameFromSourceCount++;
|
|
502
|
+
}
|
|
503
|
+
get fps() {
|
|
504
|
+
const { startAt: e, frameFromSourceCount: r } = this, o = (Date.now() - e) / 1e3;
|
|
505
|
+
return r / o;
|
|
506
|
+
}
|
|
507
|
+
async onFrameTransformed(e = {}, r = !1) {
|
|
508
|
+
this.startAt === 0 && (this.startAt = Date.now()), this.frameTransformedCount++;
|
|
509
|
+
const { startAt: s, frameTransformedCount: o, frameFromSourceCount: i } = this, n = Date.now(), c = (n - s) / 1e3, u = o / c, M = i / c;
|
|
510
|
+
return r || this.frameTransformedCount >= this.config.loggingIntervalFrameCount ? (this.frameFromSourceCount = 0, this.frameTransformedCount = 0, this.startAt = n, this.reporter.config = this.config, this.reporter.send({
|
|
511
|
+
...this.config.report,
|
|
512
|
+
variation: "QoS",
|
|
513
|
+
fps: M,
|
|
514
|
+
transformedFps: u,
|
|
515
|
+
framesTransformed: o,
|
|
516
|
+
...e
|
|
517
|
+
})) : "success";
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
var Se = /* @__PURE__ */ ((t) => (t.FPS_DROP = "fps_drop", t))(Se || {}), Ee = /* @__PURE__ */ ((t) => (t.start = "start", t.transform = "transform", t.flush = "flush", t))(Ee || {}), F = /* @__PURE__ */ ((t) => (t.pipeline_ended = "pipeline_ended", t.pipeline_ended_with_error = "pipeline_ended_with_error", t.pipeline_started = "pipeline_started", t.pipeline_started_with_error = "pipeline_started_with_error", t.pipeline_restarted = "pipeline_restarted", t.pipeline_restarted_with_error = "pipeline_restarted_with_error", t))(F || {});
|
|
521
|
+
const Re = 500, ke = 0.8;
|
|
522
|
+
class Ae extends L {
|
|
523
|
+
constructor(r, s) {
|
|
524
|
+
super();
|
|
525
|
+
a(this, "reporter_", new W());
|
|
526
|
+
a(this, "reporterQos_", new Te({
|
|
527
|
+
loggingIntervalFrameCount: Re,
|
|
528
|
+
report: {
|
|
529
|
+
version: R
|
|
530
|
+
}
|
|
531
|
+
}));
|
|
532
|
+
a(this, "transformerType_");
|
|
533
|
+
a(this, "transformer_");
|
|
534
|
+
a(this, "shouldStop_");
|
|
535
|
+
a(this, "isFlashed_");
|
|
536
|
+
a(this, "mediaTransformerQosReportStartTimestamp_");
|
|
537
|
+
a(this, "videoHeight_");
|
|
538
|
+
a(this, "videoWidth_");
|
|
539
|
+
a(this, "trackExpectedRate_");
|
|
540
|
+
a(this, "index_");
|
|
541
|
+
a(this, "controller_");
|
|
542
|
+
this.index_ = s, this.transformer_ = r, this.shouldStop_ = !1, this.isFlashed_ = !1, this.mediaTransformerQosReportStartTimestamp_ = 0, this.videoHeight_ = 0, this.videoWidth_ = 0, this.trackExpectedRate_ = -1, this.transformerType_ = "Custom", "getTransformerType" in r && (this.transformerType_ = r.getTransformerType()), this.report({
|
|
543
|
+
variation: "Create"
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
setTrackExpectedRate(r) {
|
|
547
|
+
this.trackExpectedRate_ = r;
|
|
1843
548
|
}
|
|
1844
|
-
async start(
|
|
1845
|
-
this.controller_ =
|
|
1846
|
-
if (this.transformer_ && typeof this.transformer_.start === "function") {
|
|
549
|
+
async start(r) {
|
|
550
|
+
if (this.controller_ = r, this.transformer_ && typeof this.transformer_.start == "function")
|
|
1847
551
|
try {
|
|
1848
|
-
await this.transformer_.start(
|
|
1849
|
-
} catch (
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
552
|
+
await this.transformer_.start(r);
|
|
553
|
+
} catch (s) {
|
|
554
|
+
this.report({
|
|
555
|
+
message: l.errors.transformer_start,
|
|
556
|
+
variation: "Error",
|
|
557
|
+
error: v(s)
|
|
558
|
+
});
|
|
559
|
+
const o = { eventMetaData: { transformerIndex: this.index_ }, error: s, function: "start" };
|
|
560
|
+
this.emit("error", o);
|
|
1854
561
|
}
|
|
1855
|
-
}
|
|
1856
562
|
}
|
|
1857
|
-
async transform(
|
|
1858
|
-
var
|
|
1859
|
-
if (this.mediaTransformerQosReportStartTimestamp_ === 0)
|
|
1860
|
-
this.
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
this.videoHeight_ = (_a = data2 == null ? void 0 : data2.displayHeight) != null ? _a : 0;
|
|
1864
|
-
this.videoWidth_ = (_b = data2 == null ? void 0 : data2.displayWidth) != null ? _b : 0;
|
|
1865
|
-
}
|
|
1866
|
-
++this.framesFromSource_;
|
|
1867
|
-
if (this.transformer_) {
|
|
1868
|
-
if (!this.shouldStop_) {
|
|
563
|
+
async transform(r, s) {
|
|
564
|
+
var o, i, n, c;
|
|
565
|
+
if (this.mediaTransformerQosReportStartTimestamp_ === 0 && (this.mediaTransformerQosReportStartTimestamp_ = Date.now()), r instanceof VideoFrame && (this.videoHeight_ = (o = r == null ? void 0 : r.displayHeight) != null ? o : 0, this.videoWidth_ = (i = r == null ? void 0 : r.displayWidth) != null ? i : 0), this.reporterQos_.onFrameFromSource(), this.transformer_)
|
|
566
|
+
if (this.shouldStop_)
|
|
567
|
+
console.warn("[Pipeline] flush from transform"), r.close(), this.flush(s), s.terminate();
|
|
568
|
+
else {
|
|
1869
569
|
try {
|
|
1870
|
-
await ((
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
570
|
+
await ((c = (n = this.transformer_).transform) == null ? void 0 : c.call(n, r, s)), this.reportQos();
|
|
571
|
+
} catch (u) {
|
|
572
|
+
this.report({
|
|
573
|
+
message: l.errors.transformer_transform,
|
|
574
|
+
variation: "Error",
|
|
575
|
+
error: v(u)
|
|
576
|
+
});
|
|
577
|
+
const M = { eventMetaData: { transformerIndex: this.index_ }, error: u, function: "transform" };
|
|
578
|
+
this.emit("error", M);
|
|
579
|
+
}
|
|
580
|
+
if (this.trackExpectedRate_ != -1 && this.trackExpectedRate_ * ke > this.reporterQos_.fps) {
|
|
581
|
+
const u = {
|
|
582
|
+
eventMetaData: {
|
|
583
|
+
transformerIndex: this.index_
|
|
584
|
+
},
|
|
585
|
+
warningType: "fps_drop",
|
|
586
|
+
dropInfo: {
|
|
587
|
+
requested: this.trackExpectedRate_,
|
|
588
|
+
current: this.reporterQos_.fps
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
this.emit("warn", u);
|
|
1880
592
|
}
|
|
1881
|
-
} else {
|
|
1882
|
-
console.warn("[Pipeline] flush from transform");
|
|
1883
|
-
data2.close();
|
|
1884
|
-
this.flush(controller);
|
|
1885
|
-
controller.terminate();
|
|
1886
593
|
}
|
|
1887
|
-
}
|
|
1888
594
|
}
|
|
1889
|
-
async flush(
|
|
1890
|
-
if (this.transformer_ && typeof this.transformer_.flush
|
|
1891
|
-
this.isFlashed_ =
|
|
595
|
+
async flush(r) {
|
|
596
|
+
if (this.transformer_ && typeof this.transformer_.flush == "function" && !this.isFlashed_) {
|
|
597
|
+
this.isFlashed_ = !0;
|
|
1892
598
|
try {
|
|
1893
|
-
await this.transformer_.flush(
|
|
1894
|
-
} catch (
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
599
|
+
await this.transformer_.flush(r);
|
|
600
|
+
} catch (s) {
|
|
601
|
+
this.report({
|
|
602
|
+
message: l.errors.transformer_flush,
|
|
603
|
+
variation: "Error",
|
|
604
|
+
error: v(s)
|
|
605
|
+
});
|
|
606
|
+
const o = { eventMetaData: { transformerIndex: this.index_ }, error: s, function: "flush" };
|
|
607
|
+
this.emit("error", o);
|
|
1899
608
|
}
|
|
1900
609
|
}
|
|
1901
|
-
this.
|
|
1902
|
-
|
|
1903
|
-
|
|
610
|
+
this.reportQos(!0), this.report({
|
|
611
|
+
variation: "Delete"
|
|
612
|
+
});
|
|
1904
613
|
}
|
|
1905
614
|
stop() {
|
|
1906
|
-
console.log("[Pipeline] Stop stream.");
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
615
|
+
console.log("[Pipeline] Stop stream."), this.controller_ && (this.flush(this.controller_), this.controller_.terminate()), this.shouldStop_ = !0;
|
|
616
|
+
}
|
|
617
|
+
report(r) {
|
|
618
|
+
this.reporter_.send({
|
|
619
|
+
version: R,
|
|
620
|
+
action: "MediaTransformer",
|
|
621
|
+
transformerType: this.transformerType_,
|
|
622
|
+
...r
|
|
623
|
+
});
|
|
1912
624
|
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
this.
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
this.mediaTransformerQosReportStartTimestamp_ = 0;
|
|
1924
|
-
this.framesFromSource_ = 0;
|
|
1925
|
-
this.framesTransformed_ = 0;
|
|
625
|
+
reportQos(r = !1) {
|
|
626
|
+
this.reporterQos_.config = {
|
|
627
|
+
...this.reporterQos_.config
|
|
628
|
+
}, this.reporterQos_.onFrameTransformed({
|
|
629
|
+
version: R,
|
|
630
|
+
action: "MediaTransformer",
|
|
631
|
+
transformerType: this.transformerType_,
|
|
632
|
+
videoWidth: this.videoWidth_,
|
|
633
|
+
videoHeight: this.videoHeight_
|
|
634
|
+
}, r);
|
|
1926
635
|
}
|
|
1927
636
|
}
|
|
1928
|
-
class
|
|
1929
|
-
constructor(
|
|
637
|
+
class Pe extends L {
|
|
638
|
+
constructor(r) {
|
|
1930
639
|
super();
|
|
1931
|
-
this
|
|
1932
|
-
this
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
this.emit("warn",
|
|
1940
|
-
});
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
this.
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
}
|
|
1950
|
-
async start(readable, writeable) {
|
|
640
|
+
a(this, "transformers_");
|
|
641
|
+
a(this, "trackExpectedRate_");
|
|
642
|
+
this.transformers_ = [], this.trackExpectedRate_ = -1;
|
|
643
|
+
for (let s = 0; s < r.length; s++) {
|
|
644
|
+
let o = new Ae(r[s], s);
|
|
645
|
+
o.on("error", (i) => {
|
|
646
|
+
this.emit("error", i);
|
|
647
|
+
}), o.on("warn", (i) => {
|
|
648
|
+
this.emit("warn", i);
|
|
649
|
+
}), this.transformers_.push(o);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
setTrackExpectedRate(r) {
|
|
653
|
+
this.trackExpectedRate_ = r;
|
|
654
|
+
for (let s of this.transformers_)
|
|
655
|
+
s.setTrackExpectedRate(this.trackExpectedRate_);
|
|
656
|
+
}
|
|
657
|
+
async start(r, s) {
|
|
1951
658
|
if (!this.transformers_ || this.transformers_.length === 0) {
|
|
1952
659
|
console.log("[Pipeline] No transformers.");
|
|
1953
660
|
return;
|
|
1954
661
|
}
|
|
1955
662
|
try {
|
|
1956
|
-
let
|
|
1957
|
-
for (let
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
await orgReader.cancel();
|
|
1964
|
-
this.emit("pipelineInfo", "pipeline_ended");
|
|
1965
|
-
}).catch(async (e) => {
|
|
1966
|
-
readable.cancel().then(() => {
|
|
663
|
+
let o = r;
|
|
664
|
+
for (let i of this.transformers_)
|
|
665
|
+
r = r.pipeThrough(new TransformStream(i));
|
|
666
|
+
r.pipeTo(s).then(async () => {
|
|
667
|
+
console.log("[Pipeline] Setup."), await s.abort(), await o.cancel(), this.emit("pipelineInfo", "pipeline_ended");
|
|
668
|
+
}).catch(async (i) => {
|
|
669
|
+
r.cancel().then(() => {
|
|
1967
670
|
console.log("[Pipeline] Shutting down streams after abort.");
|
|
1968
|
-
}).catch((
|
|
1969
|
-
console.error("[Pipeline] Error from stream transform:",
|
|
1970
|
-
});
|
|
1971
|
-
await writeable.abort(e);
|
|
1972
|
-
await orgReader.cancel(e);
|
|
1973
|
-
this.emit("pipelineInfo", "pipeline_ended_with_error");
|
|
671
|
+
}).catch((n) => {
|
|
672
|
+
console.error("[Pipeline] Error from stream transform:", n);
|
|
673
|
+
}), await s.abort(i), await o.cancel(i), this.emit("pipelineInfo", "pipeline_ended_with_error");
|
|
1974
674
|
});
|
|
1975
|
-
} catch
|
|
1976
|
-
this.emit("pipelineInfo", "pipeline_started_with_error");
|
|
1977
|
-
this.destroy();
|
|
675
|
+
} catch {
|
|
676
|
+
this.emit("pipelineInfo", "pipeline_started_with_error"), this.destroy();
|
|
1978
677
|
return;
|
|
1979
678
|
}
|
|
1980
|
-
this.emit("pipelineInfo", "pipeline_started");
|
|
1981
|
-
console.log("[Pipeline] Pipeline started.");
|
|
679
|
+
this.emit("pipelineInfo", "pipeline_started"), console.log("[Pipeline] Pipeline started.");
|
|
1982
680
|
}
|
|
1983
681
|
async destroy() {
|
|
1984
682
|
console.log("[Pipeline] Destroying Pipeline.");
|
|
1985
|
-
for (let
|
|
1986
|
-
|
|
1987
|
-
}
|
|
683
|
+
for (let r of this.transformers_)
|
|
684
|
+
r.stop();
|
|
1988
685
|
}
|
|
1989
686
|
}
|
|
1990
|
-
class
|
|
687
|
+
class Ce extends L {
|
|
1991
688
|
constructor() {
|
|
1992
689
|
super();
|
|
1993
|
-
this
|
|
1994
|
-
this
|
|
1995
|
-
|
|
1996
|
-
|
|
690
|
+
a(this, "reporter_");
|
|
691
|
+
a(this, "pipeline_");
|
|
692
|
+
a(this, "transformers_");
|
|
693
|
+
a(this, "readable_");
|
|
694
|
+
a(this, "writable_");
|
|
695
|
+
a(this, "trackExpectedRate_");
|
|
696
|
+
this.reporter_ = new W(), this.trackExpectedRate_ = -1, this.report({
|
|
697
|
+
variation: "Create"
|
|
698
|
+
});
|
|
1997
699
|
}
|
|
1998
|
-
setTrackExpectedRate(
|
|
1999
|
-
this.trackExpectedRate_ =
|
|
2000
|
-
if (this.pipeline_) {
|
|
2001
|
-
this.pipeline_.setTrackExpectedRate(this.trackExpectedRate_);
|
|
2002
|
-
}
|
|
700
|
+
setTrackExpectedRate(r) {
|
|
701
|
+
this.trackExpectedRate_ = r, this.pipeline_ && this.pipeline_.setTrackExpectedRate(this.trackExpectedRate_);
|
|
2003
702
|
}
|
|
2004
|
-
transform(
|
|
2005
|
-
this.readable_ =
|
|
2006
|
-
this.writable_ = writable;
|
|
2007
|
-
return this.transformInternal();
|
|
703
|
+
transform(r, s) {
|
|
704
|
+
return this.readable_ = r, this.writable_ = s, this.transformInternal();
|
|
2008
705
|
}
|
|
2009
706
|
transformInternal() {
|
|
2010
|
-
return new Promise((
|
|
707
|
+
return new Promise(async (r, s) => {
|
|
2011
708
|
if (!this.transformers_ || this.transformers_.length === 0) {
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
709
|
+
this.report({
|
|
710
|
+
message: l.errors.transformer_none,
|
|
711
|
+
variation: "Error"
|
|
712
|
+
}), s("[MediaProcessor] Need to set transformers.");
|
|
2015
713
|
return;
|
|
2016
714
|
}
|
|
2017
715
|
if (!this.readable_) {
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
716
|
+
this.report({
|
|
717
|
+
variation: "Error",
|
|
718
|
+
message: l.errors.readable_null
|
|
719
|
+
}), s("[MediaProcessor] Readable is null.");
|
|
2021
720
|
return;
|
|
2022
721
|
}
|
|
2023
722
|
if (!this.writable_) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
723
|
+
this.report({
|
|
724
|
+
variation: "Error",
|
|
725
|
+
message: l.errors.writable_null
|
|
726
|
+
}), s("[MediaProcessor] Writable is null.");
|
|
2027
727
|
return;
|
|
2028
728
|
}
|
|
2029
|
-
let
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
this.
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
this.pipeline_.
|
|
2037
|
-
|
|
2038
|
-
})
|
|
2039
|
-
|
|
2040
|
-
this.emit("error", eventData);
|
|
2041
|
-
});
|
|
2042
|
-
this.pipeline_.on("pipelineInfo", (eventData) => {
|
|
2043
|
-
if (isPipelineReset) {
|
|
2044
|
-
if (eventData === "pipeline_started") {
|
|
2045
|
-
eventData = PipelineInfoData.pipeline_restarted;
|
|
2046
|
-
} else if (eventData === "pipeline_started_with_error") {
|
|
2047
|
-
eventData = PipelineInfoData.pipeline_restarted_with_error;
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
this.emit("pipelineInfo", eventData);
|
|
2051
|
-
});
|
|
2052
|
-
if (this.trackExpectedRate_ != -1) {
|
|
2053
|
-
this.pipeline_.setTrackExpectedRate(this.trackExpectedRate_);
|
|
2054
|
-
}
|
|
2055
|
-
this.pipeline_.start(this.readable_, this.writable_).then(() => {
|
|
2056
|
-
resolve();
|
|
2057
|
-
}).catch((e) => {
|
|
2058
|
-
reject(e);
|
|
729
|
+
let o = !1;
|
|
730
|
+
this.pipeline_ && (o = !0, this.pipeline_.clearListeners(), this.pipeline_.destroy()), this.pipeline_ = new Pe(this.transformers_), this.pipeline_.on("warn", (i) => {
|
|
731
|
+
this.emit("warn", i);
|
|
732
|
+
}), this.pipeline_.on("error", (i) => {
|
|
733
|
+
this.emit("error", i);
|
|
734
|
+
}), this.pipeline_.on("pipelineInfo", (i) => {
|
|
735
|
+
o && (i === "pipeline_started" ? i = F.pipeline_restarted : i === "pipeline_started_with_error" && (i = F.pipeline_restarted_with_error)), this.emit("pipelineInfo", i);
|
|
736
|
+
}), this.trackExpectedRate_ != -1 && this.pipeline_.setTrackExpectedRate(this.trackExpectedRate_), this.pipeline_.start(this.readable_, this.writable_).then(() => {
|
|
737
|
+
r();
|
|
738
|
+
}).catch((i) => {
|
|
739
|
+
s(i);
|
|
2059
740
|
});
|
|
2060
741
|
});
|
|
2061
742
|
}
|
|
2062
|
-
setTransformers(
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
return this.transformInternal();
|
|
2068
|
-
}
|
|
2069
|
-
return Promise.resolve();
|
|
743
|
+
setTransformers(r) {
|
|
744
|
+
return this.report({
|
|
745
|
+
variation: "Update",
|
|
746
|
+
message: l.updates.transformer_new
|
|
747
|
+
}), this.transformers_ = r, this.readable_ && this.writable_ ? this.transformInternal() : Promise.resolve();
|
|
2070
748
|
}
|
|
2071
749
|
destroy() {
|
|
2072
|
-
return new Promise((
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
750
|
+
return new Promise(async (r) => {
|
|
751
|
+
this.pipeline_ && this.pipeline_.destroy(), this.report({ variation: "Delete" }), r();
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
report(r) {
|
|
755
|
+
this.reporter_.send({
|
|
756
|
+
version: R,
|
|
757
|
+
action: "MediaProcessor",
|
|
758
|
+
...r
|
|
2079
759
|
});
|
|
2080
760
|
}
|
|
2081
761
|
}
|
|
2082
|
-
class
|
|
762
|
+
class Me {
|
|
2083
763
|
constructor() {
|
|
2084
|
-
this
|
|
2085
|
-
this
|
|
764
|
+
a(this, "processor_");
|
|
765
|
+
a(this, "generator_");
|
|
766
|
+
this.processor_ = null, this.generator_ = null;
|
|
2086
767
|
}
|
|
2087
|
-
init(
|
|
2088
|
-
return new Promise((
|
|
768
|
+
init(e) {
|
|
769
|
+
return new Promise((r, s) => {
|
|
2089
770
|
try {
|
|
2090
|
-
this.processor_ = new MediaStreamTrackProcessor(
|
|
2091
|
-
} catch (
|
|
2092
|
-
console.log(`[InsertableStreamHelper] MediaStreamTrackProcessor failed: ${
|
|
2093
|
-
reject(e);
|
|
771
|
+
this.processor_ = new MediaStreamTrackProcessor(e);
|
|
772
|
+
} catch (o) {
|
|
773
|
+
console.log(`[InsertableStreamHelper] MediaStreamTrackProcessor failed: ${o}`), s(o);
|
|
2094
774
|
}
|
|
2095
775
|
try {
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
this.generator_ = new MediaStreamTrackGenerator({ kind: "video" });
|
|
2100
|
-
} else {
|
|
2101
|
-
reject("kind not supported");
|
|
2102
|
-
}
|
|
2103
|
-
} catch (e) {
|
|
2104
|
-
console.log(`[InsertableStreamHelper] MediaStreamTrackGenerator failed: ${e}`);
|
|
2105
|
-
reject(e);
|
|
776
|
+
e.kind === "audio" ? this.generator_ = new MediaStreamTrackGenerator({ kind: "audio" }) : e.kind === "video" ? this.generator_ = new MediaStreamTrackGenerator({ kind: "video" }) : s("kind not supported");
|
|
777
|
+
} catch (o) {
|
|
778
|
+
console.log(`[InsertableStreamHelper] MediaStreamTrackGenerator failed: ${o}`), s(o);
|
|
2106
779
|
}
|
|
2107
|
-
|
|
780
|
+
r();
|
|
2108
781
|
});
|
|
2109
782
|
}
|
|
2110
783
|
getReadable() {
|
|
@@ -2117,36 +790,43 @@ class InsertableStreamHelper {
|
|
|
2117
790
|
return this.generator_;
|
|
2118
791
|
}
|
|
2119
792
|
}
|
|
2120
|
-
class
|
|
2121
|
-
constructor(
|
|
2122
|
-
this
|
|
2123
|
-
this
|
|
793
|
+
class Oe {
|
|
794
|
+
constructor(e) {
|
|
795
|
+
a(this, "insertableStreamHelper_");
|
|
796
|
+
a(this, "mediaProcessor_");
|
|
797
|
+
this.insertableStreamHelper_ = new Me(), this.mediaProcessor_ = e;
|
|
2124
798
|
}
|
|
2125
|
-
setTrack(
|
|
2126
|
-
return new Promise((
|
|
2127
|
-
this.insertableStreamHelper_.init(
|
|
799
|
+
setTrack(e) {
|
|
800
|
+
return new Promise((r, s) => {
|
|
801
|
+
this.insertableStreamHelper_.init(e).then(() => {
|
|
2128
802
|
this.mediaProcessor_.transform(this.insertableStreamHelper_.getReadable(), this.insertableStreamHelper_.getWriteable()).then(() => {
|
|
2129
|
-
|
|
2130
|
-
}).catch((
|
|
2131
|
-
|
|
803
|
+
r(this.insertableStreamHelper_.getProccesorTrack());
|
|
804
|
+
}).catch((o) => {
|
|
805
|
+
s(o);
|
|
2132
806
|
});
|
|
2133
|
-
}).catch((
|
|
2134
|
-
|
|
807
|
+
}).catch((o) => {
|
|
808
|
+
s(o);
|
|
2135
809
|
});
|
|
2136
810
|
});
|
|
2137
811
|
}
|
|
2138
812
|
destroy() {
|
|
2139
|
-
return new Promise((
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
});
|
|
2146
|
-
} else {
|
|
2147
|
-
reject("no processor");
|
|
2148
|
-
}
|
|
813
|
+
return new Promise((e, r) => {
|
|
814
|
+
this.mediaProcessor_ ? this.mediaProcessor_.destroy().then(() => {
|
|
815
|
+
e();
|
|
816
|
+
}).catch((s) => {
|
|
817
|
+
r(s);
|
|
818
|
+
}) : r("no processor");
|
|
2149
819
|
});
|
|
2150
820
|
}
|
|
2151
821
|
}
|
|
2152
|
-
export {
|
|
822
|
+
export {
|
|
823
|
+
Ee as ErrorFunction,
|
|
824
|
+
Ce as MediaProcessor,
|
|
825
|
+
Oe as MediaProcessorConnector,
|
|
826
|
+
F as PipelineInfoData,
|
|
827
|
+
N as VonageSourceType,
|
|
828
|
+
Se as WarningType,
|
|
829
|
+
C as getVonageMetadata,
|
|
830
|
+
Ie as isSupported,
|
|
831
|
+
ve as setVonageMetadata
|
|
832
|
+
};
|