@vention/machine-logic-ui-sdk 0.0.2

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/index.esm.js ADDED
@@ -0,0 +1,3686 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import 'react-simple-keyboard/build/css/index.css';
3
+ import { useState, useRef, useEffect } from 'react';
4
+ import Keyboard from 'react-simple-keyboard';
5
+ import * as mqtt from 'mqtt';
6
+
7
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
+
9
+ var check = function (it) {
10
+ return it && it.Math == Math && it;
11
+ };
12
+
13
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
14
+ var global$G =
15
+ // eslint-disable-next-line es/no-global-this -- safe
16
+ check(typeof globalThis == 'object' && globalThis) ||
17
+ check(typeof window == 'object' && window) ||
18
+ // eslint-disable-next-line no-restricted-globals -- safe
19
+ check(typeof self == 'object' && self) ||
20
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
21
+ // eslint-disable-next-line no-new-func -- fallback
22
+ (function () { return this; })() || Function('return this')();
23
+
24
+ var fails$i = function (exec) {
25
+ try {
26
+ return !!exec();
27
+ } catch (error) {
28
+ return true;
29
+ }
30
+ };
31
+
32
+ var fails$h = fails$i;
33
+
34
+ var functionBindNative = !fails$h(function () {
35
+ var test = (function () { /* empty */ }).bind();
36
+ // eslint-disable-next-line no-prototype-builtins -- safe
37
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
38
+ });
39
+
40
+ var NATIVE_BIND$3 = functionBindNative;
41
+
42
+ var FunctionPrototype$2 = Function.prototype;
43
+ var bind$5 = FunctionPrototype$2.bind;
44
+ var call$e = FunctionPrototype$2.call;
45
+ var uncurryThis$m = NATIVE_BIND$3 && bind$5.bind(call$e, call$e);
46
+
47
+ var functionUncurryThis = NATIVE_BIND$3 ? function (fn) {
48
+ return fn && uncurryThis$m(fn);
49
+ } : function (fn) {
50
+ return fn && function () {
51
+ return call$e.apply(fn, arguments);
52
+ };
53
+ };
54
+
55
+ var uncurryThis$l = functionUncurryThis;
56
+
57
+ var toString$7 = uncurryThis$l({}.toString);
58
+ var stringSlice$5 = uncurryThis$l(''.slice);
59
+
60
+ var classofRaw$1 = function (it) {
61
+ return stringSlice$5(toString$7(it), 8, -1);
62
+ };
63
+
64
+ var global$F = global$G;
65
+ var uncurryThis$k = functionUncurryThis;
66
+ var fails$g = fails$i;
67
+ var classof$7 = classofRaw$1;
68
+
69
+ var Object$5 = global$F.Object;
70
+ var split = uncurryThis$k(''.split);
71
+
72
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
73
+ var indexedObject = fails$g(function () {
74
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
75
+ // eslint-disable-next-line no-prototype-builtins -- safe
76
+ return !Object$5('z').propertyIsEnumerable(0);
77
+ }) ? function (it) {
78
+ return classof$7(it) == 'String' ? split(it, '') : Object$5(it);
79
+ } : Object$5;
80
+
81
+ var global$E = global$G;
82
+
83
+ var TypeError$f = global$E.TypeError;
84
+
85
+ // `RequireObjectCoercible` abstract operation
86
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
87
+ var requireObjectCoercible$6 = function (it) {
88
+ if (it == undefined) throw TypeError$f("Can't call method on " + it);
89
+ return it;
90
+ };
91
+
92
+ // toObject with fallback for non-array-like ES3 strings
93
+ var IndexedObject$1 = indexedObject;
94
+ var requireObjectCoercible$5 = requireObjectCoercible$6;
95
+
96
+ var toIndexedObject$5 = function (it) {
97
+ return IndexedObject$1(requireObjectCoercible$5(it));
98
+ };
99
+
100
+ var shared$4 = {exports: {}};
101
+
102
+ var global$D = global$G;
103
+
104
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
105
+ var defineProperty$3 = Object.defineProperty;
106
+
107
+ var setGlobal$3 = function (key, value) {
108
+ try {
109
+ defineProperty$3(global$D, key, { value: value, configurable: true, writable: true });
110
+ } catch (error) {
111
+ global$D[key] = value;
112
+ } return value;
113
+ };
114
+
115
+ var global$C = global$G;
116
+ var setGlobal$2 = setGlobal$3;
117
+
118
+ var SHARED = '__core-js_shared__';
119
+ var store$3 = global$C[SHARED] || setGlobal$2(SHARED, {});
120
+
121
+ var sharedStore = store$3;
122
+
123
+ var store$2 = sharedStore;
124
+
125
+ (shared$4.exports = function (key, value) {
126
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
127
+ })('versions', []).push({
128
+ version: '3.20.3',
129
+ mode: 'global',
130
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
131
+ license: 'https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE',
132
+ source: 'https://github.com/zloirock/core-js'
133
+ });
134
+
135
+ var global$B = global$G;
136
+ var requireObjectCoercible$4 = requireObjectCoercible$6;
137
+
138
+ var Object$4 = global$B.Object;
139
+
140
+ // `ToObject` abstract operation
141
+ // https://tc39.es/ecma262/#sec-toobject
142
+ var toObject$4 = function (argument) {
143
+ return Object$4(requireObjectCoercible$4(argument));
144
+ };
145
+
146
+ var uncurryThis$j = functionUncurryThis;
147
+ var toObject$3 = toObject$4;
148
+
149
+ var hasOwnProperty = uncurryThis$j({}.hasOwnProperty);
150
+
151
+ // `HasOwnProperty` abstract operation
152
+ // https://tc39.es/ecma262/#sec-hasownproperty
153
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
154
+ return hasOwnProperty(toObject$3(it), key);
155
+ };
156
+
157
+ var uncurryThis$i = functionUncurryThis;
158
+
159
+ var id = 0;
160
+ var postfix = Math.random();
161
+ var toString$6 = uncurryThis$i(1.0.toString);
162
+
163
+ var uid$2 = function (key) {
164
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36);
165
+ };
166
+
167
+ // `IsCallable` abstract operation
168
+ // https://tc39.es/ecma262/#sec-iscallable
169
+ var isCallable$j = function (argument) {
170
+ return typeof argument == 'function';
171
+ };
172
+
173
+ var global$A = global$G;
174
+ var isCallable$i = isCallable$j;
175
+
176
+ var aFunction = function (argument) {
177
+ return isCallable$i(argument) ? argument : undefined;
178
+ };
179
+
180
+ var getBuiltIn$7 = function (namespace, method) {
181
+ return arguments.length < 2 ? aFunction(global$A[namespace]) : global$A[namespace] && global$A[namespace][method];
182
+ };
183
+
184
+ var getBuiltIn$6 = getBuiltIn$7;
185
+
186
+ var engineUserAgent = getBuiltIn$6('navigator', 'userAgent') || '';
187
+
188
+ var global$z = global$G;
189
+ var userAgent$3 = engineUserAgent;
190
+
191
+ var process$3 = global$z.process;
192
+ var Deno = global$z.Deno;
193
+ var versions = process$3 && process$3.versions || Deno && Deno.version;
194
+ var v8 = versions && versions.v8;
195
+ var match, version;
196
+
197
+ if (v8) {
198
+ match = v8.split('.');
199
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
200
+ // but their correct versions are not interesting for us
201
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
202
+ }
203
+
204
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
205
+ // so check `userAgent` even if `.v8` exists, but 0
206
+ if (!version && userAgent$3) {
207
+ match = userAgent$3.match(/Edge\/(\d+)/);
208
+ if (!match || match[1] >= 74) {
209
+ match = userAgent$3.match(/Chrome\/(\d+)/);
210
+ if (match) version = +match[1];
211
+ }
212
+ }
213
+
214
+ var engineV8Version = version;
215
+
216
+ /* eslint-disable es/no-symbol -- required for testing */
217
+
218
+ var V8_VERSION$1 = engineV8Version;
219
+ var fails$f = fails$i;
220
+
221
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
222
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$f(function () {
223
+ var symbol = Symbol();
224
+ // Chrome 38 Symbol has incorrect toString conversion
225
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
226
+ return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
227
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
228
+ !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
229
+ });
230
+
231
+ /* eslint-disable es/no-symbol -- required for testing */
232
+
233
+ var NATIVE_SYMBOL$1 = nativeSymbol;
234
+
235
+ var useSymbolAsUid = NATIVE_SYMBOL$1
236
+ && !Symbol.sham
237
+ && typeof Symbol.iterator == 'symbol';
238
+
239
+ var global$y = global$G;
240
+ var shared$3 = shared$4.exports;
241
+ var hasOwn$9 = hasOwnProperty_1;
242
+ var uid$1 = uid$2;
243
+ var NATIVE_SYMBOL = nativeSymbol;
244
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
245
+
246
+ var WellKnownSymbolsStore = shared$3('wks');
247
+ var Symbol$1 = global$y.Symbol;
248
+ var symbolFor = Symbol$1 && Symbol$1['for'];
249
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
250
+
251
+ var wellKnownSymbol$i = function (name) {
252
+ if (!hasOwn$9(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
253
+ var description = 'Symbol.' + name;
254
+ if (NATIVE_SYMBOL && hasOwn$9(Symbol$1, name)) {
255
+ WellKnownSymbolsStore[name] = Symbol$1[name];
256
+ } else if (USE_SYMBOL_AS_UID$1 && symbolFor) {
257
+ WellKnownSymbolsStore[name] = symbolFor(description);
258
+ } else {
259
+ WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
260
+ }
261
+ } return WellKnownSymbolsStore[name];
262
+ };
263
+
264
+ var isCallable$h = isCallable$j;
265
+
266
+ var isObject$8 = function (it) {
267
+ return typeof it == 'object' ? it !== null : isCallable$h(it);
268
+ };
269
+
270
+ var global$x = global$G;
271
+ var isObject$7 = isObject$8;
272
+
273
+ var String$5 = global$x.String;
274
+ var TypeError$e = global$x.TypeError;
275
+
276
+ // `Assert: Type(argument) is Object`
277
+ var anObject$e = function (argument) {
278
+ if (isObject$7(argument)) return argument;
279
+ throw TypeError$e(String$5(argument) + ' is not an object');
280
+ };
281
+
282
+ var objectDefineProperties = {};
283
+
284
+ var fails$e = fails$i;
285
+
286
+ // Detect IE8's incomplete defineProperty implementation
287
+ var descriptors = !fails$e(function () {
288
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
289
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
290
+ });
291
+
292
+ var DESCRIPTORS$9 = descriptors;
293
+ var fails$d = fails$i;
294
+
295
+ // V8 ~ Chrome 36-
296
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
297
+ var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$d(function () {
298
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
299
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
300
+ value: 42,
301
+ writable: false
302
+ }).prototype != 42;
303
+ });
304
+
305
+ var objectDefineProperty = {};
306
+
307
+ var global$w = global$G;
308
+ var isObject$6 = isObject$8;
309
+
310
+ var document$3 = global$w.document;
311
+ // typeof document.createElement is 'object' in old IE
312
+ var EXISTS$1 = isObject$6(document$3) && isObject$6(document$3.createElement);
313
+
314
+ var documentCreateElement$2 = function (it) {
315
+ return EXISTS$1 ? document$3.createElement(it) : {};
316
+ };
317
+
318
+ var DESCRIPTORS$8 = descriptors;
319
+ var fails$c = fails$i;
320
+ var createElement$1 = documentCreateElement$2;
321
+
322
+ // Thanks to IE8 for its funny defineProperty
323
+ var ie8DomDefine = !DESCRIPTORS$8 && !fails$c(function () {
324
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
325
+ return Object.defineProperty(createElement$1('div'), 'a', {
326
+ get: function () { return 7; }
327
+ }).a != 7;
328
+ });
329
+
330
+ var NATIVE_BIND$2 = functionBindNative;
331
+
332
+ var call$d = Function.prototype.call;
333
+
334
+ var functionCall = NATIVE_BIND$2 ? call$d.bind(call$d) : function () {
335
+ return call$d.apply(call$d, arguments);
336
+ };
337
+
338
+ var uncurryThis$h = functionUncurryThis;
339
+
340
+ var objectIsPrototypeOf = uncurryThis$h({}.isPrototypeOf);
341
+
342
+ var global$v = global$G;
343
+ var getBuiltIn$5 = getBuiltIn$7;
344
+ var isCallable$g = isCallable$j;
345
+ var isPrototypeOf$3 = objectIsPrototypeOf;
346
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
347
+
348
+ var Object$3 = global$v.Object;
349
+
350
+ var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
351
+ return typeof it == 'symbol';
352
+ } : function (it) {
353
+ var $Symbol = getBuiltIn$5('Symbol');
354
+ return isCallable$g($Symbol) && isPrototypeOf$3($Symbol.prototype, Object$3(it));
355
+ };
356
+
357
+ var global$u = global$G;
358
+
359
+ var String$4 = global$u.String;
360
+
361
+ var tryToString$4 = function (argument) {
362
+ try {
363
+ return String$4(argument);
364
+ } catch (error) {
365
+ return 'Object';
366
+ }
367
+ };
368
+
369
+ var global$t = global$G;
370
+ var isCallable$f = isCallable$j;
371
+ var tryToString$3 = tryToString$4;
372
+
373
+ var TypeError$d = global$t.TypeError;
374
+
375
+ // `Assert: IsCallable(argument) is true`
376
+ var aCallable$5 = function (argument) {
377
+ if (isCallable$f(argument)) return argument;
378
+ throw TypeError$d(tryToString$3(argument) + ' is not a function');
379
+ };
380
+
381
+ var aCallable$4 = aCallable$5;
382
+
383
+ // `GetMethod` abstract operation
384
+ // https://tc39.es/ecma262/#sec-getmethod
385
+ var getMethod$4 = function (V, P) {
386
+ var func = V[P];
387
+ return func == null ? undefined : aCallable$4(func);
388
+ };
389
+
390
+ var global$s = global$G;
391
+ var call$c = functionCall;
392
+ var isCallable$e = isCallable$j;
393
+ var isObject$5 = isObject$8;
394
+
395
+ var TypeError$c = global$s.TypeError;
396
+
397
+ // `OrdinaryToPrimitive` abstract operation
398
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
399
+ var ordinaryToPrimitive$1 = function (input, pref) {
400
+ var fn, val;
401
+ if (pref === 'string' && isCallable$e(fn = input.toString) && !isObject$5(val = call$c(fn, input))) return val;
402
+ if (isCallable$e(fn = input.valueOf) && !isObject$5(val = call$c(fn, input))) return val;
403
+ if (pref !== 'string' && isCallable$e(fn = input.toString) && !isObject$5(val = call$c(fn, input))) return val;
404
+ throw TypeError$c("Can't convert object to primitive value");
405
+ };
406
+
407
+ var global$r = global$G;
408
+ var call$b = functionCall;
409
+ var isObject$4 = isObject$8;
410
+ var isSymbol$1 = isSymbol$2;
411
+ var getMethod$3 = getMethod$4;
412
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
413
+ var wellKnownSymbol$h = wellKnownSymbol$i;
414
+
415
+ var TypeError$b = global$r.TypeError;
416
+ var TO_PRIMITIVE = wellKnownSymbol$h('toPrimitive');
417
+
418
+ // `ToPrimitive` abstract operation
419
+ // https://tc39.es/ecma262/#sec-toprimitive
420
+ var toPrimitive$1 = function (input, pref) {
421
+ if (!isObject$4(input) || isSymbol$1(input)) return input;
422
+ var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
423
+ var result;
424
+ if (exoticToPrim) {
425
+ if (pref === undefined) pref = 'default';
426
+ result = call$b(exoticToPrim, input, pref);
427
+ if (!isObject$4(result) || isSymbol$1(result)) return result;
428
+ throw TypeError$b("Can't convert object to primitive value");
429
+ }
430
+ if (pref === undefined) pref = 'number';
431
+ return ordinaryToPrimitive(input, pref);
432
+ };
433
+
434
+ var toPrimitive = toPrimitive$1;
435
+ var isSymbol = isSymbol$2;
436
+
437
+ // `ToPropertyKey` abstract operation
438
+ // https://tc39.es/ecma262/#sec-topropertykey
439
+ var toPropertyKey$2 = function (argument) {
440
+ var key = toPrimitive(argument, 'string');
441
+ return isSymbol(key) ? key : key + '';
442
+ };
443
+
444
+ var global$q = global$G;
445
+ var DESCRIPTORS$7 = descriptors;
446
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
447
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
448
+ var anObject$d = anObject$e;
449
+ var toPropertyKey$1 = toPropertyKey$2;
450
+
451
+ var TypeError$a = global$q.TypeError;
452
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
453
+ var $defineProperty = Object.defineProperty;
454
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
455
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
456
+ var ENUMERABLE = 'enumerable';
457
+ var CONFIGURABLE$1 = 'configurable';
458
+ var WRITABLE = 'writable';
459
+
460
+ // `Object.defineProperty` method
461
+ // https://tc39.es/ecma262/#sec-object.defineproperty
462
+ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
463
+ anObject$d(O);
464
+ P = toPropertyKey$1(P);
465
+ anObject$d(Attributes);
466
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
467
+ var current = $getOwnPropertyDescriptor$1(O, P);
468
+ if (current && current[WRITABLE]) {
469
+ O[P] = Attributes.value;
470
+ Attributes = {
471
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
472
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
473
+ writable: false
474
+ };
475
+ }
476
+ } return $defineProperty(O, P, Attributes);
477
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
478
+ anObject$d(O);
479
+ P = toPropertyKey$1(P);
480
+ anObject$d(Attributes);
481
+ if (IE8_DOM_DEFINE$1) try {
482
+ return $defineProperty(O, P, Attributes);
483
+ } catch (error) { /* empty */ }
484
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError$a('Accessors not supported');
485
+ if ('value' in Attributes) O[P] = Attributes.value;
486
+ return O;
487
+ };
488
+
489
+ var ceil = Math.ceil;
490
+ var floor$1 = Math.floor;
491
+
492
+ // `ToIntegerOrInfinity` abstract operation
493
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
494
+ var toIntegerOrInfinity$4 = function (argument) {
495
+ var number = +argument;
496
+ // eslint-disable-next-line no-self-compare -- safe
497
+ return number !== number || number === 0 ? 0 : (number > 0 ? floor$1 : ceil)(number);
498
+ };
499
+
500
+ var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
501
+
502
+ var max$1 = Math.max;
503
+ var min$3 = Math.min;
504
+
505
+ // Helper for a popular repeating case of the spec:
506
+ // Let integer be ? ToInteger(index).
507
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
508
+ var toAbsoluteIndex$1 = function (index, length) {
509
+ var integer = toIntegerOrInfinity$3(index);
510
+ return integer < 0 ? max$1(integer + length, 0) : min$3(integer, length);
511
+ };
512
+
513
+ var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
514
+
515
+ var min$2 = Math.min;
516
+
517
+ // `ToLength` abstract operation
518
+ // https://tc39.es/ecma262/#sec-tolength
519
+ var toLength$3 = function (argument) {
520
+ return argument > 0 ? min$2(toIntegerOrInfinity$2(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
521
+ };
522
+
523
+ var toLength$2 = toLength$3;
524
+
525
+ // `LengthOfArrayLike` abstract operation
526
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
527
+ var lengthOfArrayLike$2 = function (obj) {
528
+ return toLength$2(obj.length);
529
+ };
530
+
531
+ var toIndexedObject$4 = toIndexedObject$5;
532
+ var toAbsoluteIndex = toAbsoluteIndex$1;
533
+ var lengthOfArrayLike$1 = lengthOfArrayLike$2;
534
+
535
+ // `Array.prototype.{ indexOf, includes }` methods implementation
536
+ var createMethod$1 = function (IS_INCLUDES) {
537
+ return function ($this, el, fromIndex) {
538
+ var O = toIndexedObject$4($this);
539
+ var length = lengthOfArrayLike$1(O);
540
+ var index = toAbsoluteIndex(fromIndex, length);
541
+ var value;
542
+ // Array#includes uses SameValueZero equality algorithm
543
+ // eslint-disable-next-line no-self-compare -- NaN check
544
+ if (IS_INCLUDES && el != el) while (length > index) {
545
+ value = O[index++];
546
+ // eslint-disable-next-line no-self-compare -- NaN check
547
+ if (value != value) return true;
548
+ // Array#indexOf ignores holes, Array#includes - not
549
+ } else for (;length > index; index++) {
550
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
551
+ } return !IS_INCLUDES && -1;
552
+ };
553
+ };
554
+
555
+ var arrayIncludes = {
556
+ // `Array.prototype.includes` method
557
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
558
+ includes: createMethod$1(true),
559
+ // `Array.prototype.indexOf` method
560
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
561
+ indexOf: createMethod$1(false)
562
+ };
563
+
564
+ var hiddenKeys$4 = {};
565
+
566
+ var uncurryThis$g = functionUncurryThis;
567
+ var hasOwn$8 = hasOwnProperty_1;
568
+ var toIndexedObject$3 = toIndexedObject$5;
569
+ var indexOf$1 = arrayIncludes.indexOf;
570
+ var hiddenKeys$3 = hiddenKeys$4;
571
+
572
+ var push$1 = uncurryThis$g([].push);
573
+
574
+ var objectKeysInternal = function (object, names) {
575
+ var O = toIndexedObject$3(object);
576
+ var i = 0;
577
+ var result = [];
578
+ var key;
579
+ for (key in O) !hasOwn$8(hiddenKeys$3, key) && hasOwn$8(O, key) && push$1(result, key);
580
+ // Don't enum bug & hidden keys
581
+ while (names.length > i) if (hasOwn$8(O, key = names[i++])) {
582
+ ~indexOf$1(result, key) || push$1(result, key);
583
+ }
584
+ return result;
585
+ };
586
+
587
+ // IE8- don't enum bug keys
588
+ var enumBugKeys$3 = [
589
+ 'constructor',
590
+ 'hasOwnProperty',
591
+ 'isPrototypeOf',
592
+ 'propertyIsEnumerable',
593
+ 'toLocaleString',
594
+ 'toString',
595
+ 'valueOf'
596
+ ];
597
+
598
+ var internalObjectKeys$1 = objectKeysInternal;
599
+ var enumBugKeys$2 = enumBugKeys$3;
600
+
601
+ // `Object.keys` method
602
+ // https://tc39.es/ecma262/#sec-object.keys
603
+ // eslint-disable-next-line es/no-object-keys -- safe
604
+ var objectKeys$2 = Object.keys || function keys(O) {
605
+ return internalObjectKeys$1(O, enumBugKeys$2);
606
+ };
607
+
608
+ var DESCRIPTORS$6 = descriptors;
609
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
610
+ var definePropertyModule$4 = objectDefineProperty;
611
+ var anObject$c = anObject$e;
612
+ var toIndexedObject$2 = toIndexedObject$5;
613
+ var objectKeys$1 = objectKeys$2;
614
+
615
+ // `Object.defineProperties` method
616
+ // https://tc39.es/ecma262/#sec-object.defineproperties
617
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
618
+ objectDefineProperties.f = DESCRIPTORS$6 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
619
+ anObject$c(O);
620
+ var props = toIndexedObject$2(Properties);
621
+ var keys = objectKeys$1(Properties);
622
+ var length = keys.length;
623
+ var index = 0;
624
+ var key;
625
+ while (length > index) definePropertyModule$4.f(O, key = keys[index++], props[key]);
626
+ return O;
627
+ };
628
+
629
+ var getBuiltIn$4 = getBuiltIn$7;
630
+
631
+ var html$2 = getBuiltIn$4('document', 'documentElement');
632
+
633
+ var shared$2 = shared$4.exports;
634
+ var uid = uid$2;
635
+
636
+ var keys = shared$2('keys');
637
+
638
+ var sharedKey$3 = function (key) {
639
+ return keys[key] || (keys[key] = uid(key));
640
+ };
641
+
642
+ /* global ActiveXObject -- old IE, WSH */
643
+
644
+ var anObject$b = anObject$e;
645
+ var definePropertiesModule = objectDefineProperties;
646
+ var enumBugKeys$1 = enumBugKeys$3;
647
+ var hiddenKeys$2 = hiddenKeys$4;
648
+ var html$1 = html$2;
649
+ var documentCreateElement$1 = documentCreateElement$2;
650
+ var sharedKey$2 = sharedKey$3;
651
+
652
+ var GT = '>';
653
+ var LT = '<';
654
+ var PROTOTYPE = 'prototype';
655
+ var SCRIPT = 'script';
656
+ var IE_PROTO$1 = sharedKey$2('IE_PROTO');
657
+
658
+ var EmptyConstructor = function () { /* empty */ };
659
+
660
+ var scriptTag = function (content) {
661
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
662
+ };
663
+
664
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
665
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
666
+ activeXDocument.write(scriptTag(''));
667
+ activeXDocument.close();
668
+ var temp = activeXDocument.parentWindow.Object;
669
+ activeXDocument = null; // avoid memory leak
670
+ return temp;
671
+ };
672
+
673
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
674
+ var NullProtoObjectViaIFrame = function () {
675
+ // Thrash, waste and sodomy: IE GC bug
676
+ var iframe = documentCreateElement$1('iframe');
677
+ var JS = 'java' + SCRIPT + ':';
678
+ var iframeDocument;
679
+ iframe.style.display = 'none';
680
+ html$1.appendChild(iframe);
681
+ // https://github.com/zloirock/core-js/issues/475
682
+ iframe.src = String(JS);
683
+ iframeDocument = iframe.contentWindow.document;
684
+ iframeDocument.open();
685
+ iframeDocument.write(scriptTag('document.F=Object'));
686
+ iframeDocument.close();
687
+ return iframeDocument.F;
688
+ };
689
+
690
+ // Check for document.domain and active x support
691
+ // No need to use active x approach when document.domain is not set
692
+ // see https://github.com/es-shims/es5-shim/issues/150
693
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
694
+ // avoid IE GC bug
695
+ var activeXDocument;
696
+ var NullProtoObject = function () {
697
+ try {
698
+ activeXDocument = new ActiveXObject('htmlfile');
699
+ } catch (error) { /* ignore */ }
700
+ NullProtoObject = typeof document != 'undefined'
701
+ ? document.domain && activeXDocument
702
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
703
+ : NullProtoObjectViaIFrame()
704
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
705
+ var length = enumBugKeys$1.length;
706
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys$1[length]];
707
+ return NullProtoObject();
708
+ };
709
+
710
+ hiddenKeys$2[IE_PROTO$1] = true;
711
+
712
+ // `Object.create` method
713
+ // https://tc39.es/ecma262/#sec-object.create
714
+ var objectCreate = Object.create || function create(O, Properties) {
715
+ var result;
716
+ if (O !== null) {
717
+ EmptyConstructor[PROTOTYPE] = anObject$b(O);
718
+ result = new EmptyConstructor();
719
+ EmptyConstructor[PROTOTYPE] = null;
720
+ // add "__proto__" for Object.getPrototypeOf polyfill
721
+ result[IE_PROTO$1] = O;
722
+ } else result = NullProtoObject();
723
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
724
+ };
725
+
726
+ var wellKnownSymbol$g = wellKnownSymbol$i;
727
+ var create$2 = objectCreate;
728
+ var definePropertyModule$3 = objectDefineProperty;
729
+
730
+ var UNSCOPABLES = wellKnownSymbol$g('unscopables');
731
+ var ArrayPrototype$1 = Array.prototype;
732
+
733
+ // Array.prototype[@@unscopables]
734
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
735
+ if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
736
+ definePropertyModule$3.f(ArrayPrototype$1, UNSCOPABLES, {
737
+ configurable: true,
738
+ value: create$2(null)
739
+ });
740
+ }
741
+
742
+ // add a key to Array.prototype[@@unscopables]
743
+ var addToUnscopables$2 = function (key) {
744
+ ArrayPrototype$1[UNSCOPABLES][key] = true;
745
+ };
746
+
747
+ var iterators = {};
748
+
749
+ var uncurryThis$f = functionUncurryThis;
750
+ var isCallable$d = isCallable$j;
751
+ var store$1 = sharedStore;
752
+
753
+ var functionToString = uncurryThis$f(Function.toString);
754
+
755
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
756
+ if (!isCallable$d(store$1.inspectSource)) {
757
+ store$1.inspectSource = function (it) {
758
+ return functionToString(it);
759
+ };
760
+ }
761
+
762
+ var inspectSource$4 = store$1.inspectSource;
763
+
764
+ var global$p = global$G;
765
+ var isCallable$c = isCallable$j;
766
+ var inspectSource$3 = inspectSource$4;
767
+
768
+ var WeakMap$1 = global$p.WeakMap;
769
+
770
+ var nativeWeakMap = isCallable$c(WeakMap$1) && /native code/.test(inspectSource$3(WeakMap$1));
771
+
772
+ var createPropertyDescriptor$3 = function (bitmap, value) {
773
+ return {
774
+ enumerable: !(bitmap & 1),
775
+ configurable: !(bitmap & 2),
776
+ writable: !(bitmap & 4),
777
+ value: value
778
+ };
779
+ };
780
+
781
+ var DESCRIPTORS$5 = descriptors;
782
+ var definePropertyModule$2 = objectDefineProperty;
783
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
784
+
785
+ var createNonEnumerableProperty$6 = DESCRIPTORS$5 ? function (object, key, value) {
786
+ return definePropertyModule$2.f(object, key, createPropertyDescriptor$2(1, value));
787
+ } : function (object, key, value) {
788
+ object[key] = value;
789
+ return object;
790
+ };
791
+
792
+ var NATIVE_WEAK_MAP = nativeWeakMap;
793
+ var global$o = global$G;
794
+ var uncurryThis$e = functionUncurryThis;
795
+ var isObject$3 = isObject$8;
796
+ var createNonEnumerableProperty$5 = createNonEnumerableProperty$6;
797
+ var hasOwn$7 = hasOwnProperty_1;
798
+ var shared$1 = sharedStore;
799
+ var sharedKey$1 = sharedKey$3;
800
+ var hiddenKeys$1 = hiddenKeys$4;
801
+
802
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
803
+ var TypeError$9 = global$o.TypeError;
804
+ var WeakMap = global$o.WeakMap;
805
+ var set$1, get, has;
806
+
807
+ var enforce = function (it) {
808
+ return has(it) ? get(it) : set$1(it, {});
809
+ };
810
+
811
+ var getterFor = function (TYPE) {
812
+ return function (it) {
813
+ var state;
814
+ if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
815
+ throw TypeError$9('Incompatible receiver, ' + TYPE + ' required');
816
+ } return state;
817
+ };
818
+ };
819
+
820
+ if (NATIVE_WEAK_MAP || shared$1.state) {
821
+ var store = shared$1.state || (shared$1.state = new WeakMap());
822
+ var wmget = uncurryThis$e(store.get);
823
+ var wmhas = uncurryThis$e(store.has);
824
+ var wmset = uncurryThis$e(store.set);
825
+ set$1 = function (it, metadata) {
826
+ if (wmhas(store, it)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
827
+ metadata.facade = it;
828
+ wmset(store, it, metadata);
829
+ return metadata;
830
+ };
831
+ get = function (it) {
832
+ return wmget(store, it) || {};
833
+ };
834
+ has = function (it) {
835
+ return wmhas(store, it);
836
+ };
837
+ } else {
838
+ var STATE = sharedKey$1('state');
839
+ hiddenKeys$1[STATE] = true;
840
+ set$1 = function (it, metadata) {
841
+ if (hasOwn$7(it, STATE)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
842
+ metadata.facade = it;
843
+ createNonEnumerableProperty$5(it, STATE, metadata);
844
+ return metadata;
845
+ };
846
+ get = function (it) {
847
+ return hasOwn$7(it, STATE) ? it[STATE] : {};
848
+ };
849
+ has = function (it) {
850
+ return hasOwn$7(it, STATE);
851
+ };
852
+ }
853
+
854
+ var internalState = {
855
+ set: set$1,
856
+ get: get,
857
+ has: has,
858
+ enforce: enforce,
859
+ getterFor: getterFor
860
+ };
861
+
862
+ var objectGetOwnPropertyDescriptor = {};
863
+
864
+ var objectPropertyIsEnumerable = {};
865
+
866
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
867
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
868
+ var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor;
869
+
870
+ // Nashorn ~ JDK8 bug
871
+ var NASHORN_BUG = getOwnPropertyDescriptor$3 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
872
+
873
+ // `Object.prototype.propertyIsEnumerable` method implementation
874
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
875
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
876
+ var descriptor = getOwnPropertyDescriptor$3(this, V);
877
+ return !!descriptor && descriptor.enumerable;
878
+ } : $propertyIsEnumerable;
879
+
880
+ var DESCRIPTORS$4 = descriptors;
881
+ var call$a = functionCall;
882
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
883
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
884
+ var toIndexedObject$1 = toIndexedObject$5;
885
+ var toPropertyKey = toPropertyKey$2;
886
+ var hasOwn$6 = hasOwnProperty_1;
887
+ var IE8_DOM_DEFINE = ie8DomDefine;
888
+
889
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
890
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
891
+
892
+ // `Object.getOwnPropertyDescriptor` method
893
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
894
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
895
+ O = toIndexedObject$1(O);
896
+ P = toPropertyKey(P);
897
+ if (IE8_DOM_DEFINE) try {
898
+ return $getOwnPropertyDescriptor(O, P);
899
+ } catch (error) { /* empty */ }
900
+ if (hasOwn$6(O, P)) return createPropertyDescriptor$1(!call$a(propertyIsEnumerableModule$1.f, O, P), O[P]);
901
+ };
902
+
903
+ var redefine$7 = {exports: {}};
904
+
905
+ var DESCRIPTORS$3 = descriptors;
906
+ var hasOwn$5 = hasOwnProperty_1;
907
+
908
+ var FunctionPrototype$1 = Function.prototype;
909
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
910
+ var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
911
+
912
+ var EXISTS = hasOwn$5(FunctionPrototype$1, 'name');
913
+ // additional protection from minified / mangled / dropped function names
914
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
915
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype$1, 'name').configurable));
916
+
917
+ var functionName = {
918
+ EXISTS: EXISTS,
919
+ PROPER: PROPER,
920
+ CONFIGURABLE: CONFIGURABLE
921
+ };
922
+
923
+ var global$n = global$G;
924
+ var isCallable$b = isCallable$j;
925
+ var hasOwn$4 = hasOwnProperty_1;
926
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$6;
927
+ var setGlobal$1 = setGlobal$3;
928
+ var inspectSource$2 = inspectSource$4;
929
+ var InternalStateModule$2 = internalState;
930
+ var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
931
+
932
+ var getInternalState$3 = InternalStateModule$2.get;
933
+ var enforceInternalState = InternalStateModule$2.enforce;
934
+ var TEMPLATE = String(String).split('String');
935
+
936
+ (redefine$7.exports = function (O, key, value, options) {
937
+ var unsafe = options ? !!options.unsafe : false;
938
+ var simple = options ? !!options.enumerable : false;
939
+ var noTargetGet = options ? !!options.noTargetGet : false;
940
+ var name = options && options.name !== undefined ? options.name : key;
941
+ var state;
942
+ if (isCallable$b(value)) {
943
+ if (String(name).slice(0, 7) === 'Symbol(') {
944
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
945
+ }
946
+ if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
947
+ createNonEnumerableProperty$4(value, 'name', name);
948
+ }
949
+ state = enforceInternalState(value);
950
+ if (!state.source) {
951
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
952
+ }
953
+ }
954
+ if (O === global$n) {
955
+ if (simple) O[key] = value;
956
+ else setGlobal$1(key, value);
957
+ return;
958
+ } else if (!unsafe) {
959
+ delete O[key];
960
+ } else if (!noTargetGet && O[key]) {
961
+ simple = true;
962
+ }
963
+ if (simple) O[key] = value;
964
+ else createNonEnumerableProperty$4(O, key, value);
965
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
966
+ })(Function.prototype, 'toString', function toString() {
967
+ return isCallable$b(this) && getInternalState$3(this).source || inspectSource$2(this);
968
+ });
969
+
970
+ var objectGetOwnPropertyNames = {};
971
+
972
+ var internalObjectKeys = objectKeysInternal;
973
+ var enumBugKeys = enumBugKeys$3;
974
+
975
+ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
976
+
977
+ // `Object.getOwnPropertyNames` method
978
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
979
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
980
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
981
+ return internalObjectKeys(O, hiddenKeys);
982
+ };
983
+
984
+ var objectGetOwnPropertySymbols = {};
985
+
986
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
987
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
988
+
989
+ var getBuiltIn$3 = getBuiltIn$7;
990
+ var uncurryThis$d = functionUncurryThis;
991
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
992
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
993
+ var anObject$a = anObject$e;
994
+
995
+ var concat$2 = uncurryThis$d([].concat);
996
+
997
+ // all object keys, includes non-enumerable and symbols
998
+ var ownKeys$1 = getBuiltIn$3('Reflect', 'ownKeys') || function ownKeys(it) {
999
+ var keys = getOwnPropertyNamesModule.f(anObject$a(it));
1000
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1001
+ return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
1002
+ };
1003
+
1004
+ var hasOwn$3 = hasOwnProperty_1;
1005
+ var ownKeys = ownKeys$1;
1006
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1007
+ var definePropertyModule$1 = objectDefineProperty;
1008
+
1009
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
1010
+ var keys = ownKeys(source);
1011
+ var defineProperty = definePropertyModule$1.f;
1012
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1013
+ for (var i = 0; i < keys.length; i++) {
1014
+ var key = keys[i];
1015
+ if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
1016
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1017
+ }
1018
+ }
1019
+ };
1020
+
1021
+ var fails$b = fails$i;
1022
+ var isCallable$a = isCallable$j;
1023
+
1024
+ var replacement = /#|\.prototype\./;
1025
+
1026
+ var isForced$2 = function (feature, detection) {
1027
+ var value = data[normalize(feature)];
1028
+ return value == POLYFILL ? true
1029
+ : value == NATIVE ? false
1030
+ : isCallable$a(detection) ? fails$b(detection)
1031
+ : !!detection;
1032
+ };
1033
+
1034
+ var normalize = isForced$2.normalize = function (string) {
1035
+ return String(string).replace(replacement, '.').toLowerCase();
1036
+ };
1037
+
1038
+ var data = isForced$2.data = {};
1039
+ var NATIVE = isForced$2.NATIVE = 'N';
1040
+ var POLYFILL = isForced$2.POLYFILL = 'P';
1041
+
1042
+ var isForced_1 = isForced$2;
1043
+
1044
+ var global$m = global$G;
1045
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1046
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$6;
1047
+ var redefine$6 = redefine$7.exports;
1048
+ var setGlobal = setGlobal$3;
1049
+ var copyConstructorProperties = copyConstructorProperties$1;
1050
+ var isForced$1 = isForced_1;
1051
+
1052
+ /*
1053
+ options.target - name of the target object
1054
+ options.global - target is the global object
1055
+ options.stat - export as static methods of target
1056
+ options.proto - export as prototype methods of target
1057
+ options.real - real prototype method for the `pure` version
1058
+ options.forced - export even if the native feature is available
1059
+ options.bind - bind methods to the target, required for the `pure` version
1060
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1061
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
1062
+ options.sham - add a flag to not completely full polyfills
1063
+ options.enumerable - export as enumerable property
1064
+ options.noTargetGet - prevent calling a getter on target
1065
+ options.name - the .name of the function if it does not match the key
1066
+ */
1067
+ var _export = function (options, source) {
1068
+ var TARGET = options.target;
1069
+ var GLOBAL = options.global;
1070
+ var STATIC = options.stat;
1071
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1072
+ if (GLOBAL) {
1073
+ target = global$m;
1074
+ } else if (STATIC) {
1075
+ target = global$m[TARGET] || setGlobal(TARGET, {});
1076
+ } else {
1077
+ target = (global$m[TARGET] || {}).prototype;
1078
+ }
1079
+ if (target) for (key in source) {
1080
+ sourceProperty = source[key];
1081
+ if (options.noTargetGet) {
1082
+ descriptor = getOwnPropertyDescriptor$2(target, key);
1083
+ targetProperty = descriptor && descriptor.value;
1084
+ } else targetProperty = target[key];
1085
+ FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1086
+ // contained in target
1087
+ if (!FORCED && targetProperty !== undefined) {
1088
+ if (typeof sourceProperty == typeof targetProperty) continue;
1089
+ copyConstructorProperties(sourceProperty, targetProperty);
1090
+ }
1091
+ // add a flag to not completely full polyfills
1092
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1093
+ createNonEnumerableProperty$3(sourceProperty, 'sham', true);
1094
+ }
1095
+ // extend global
1096
+ redefine$6(target, key, sourceProperty, options);
1097
+ }
1098
+ };
1099
+
1100
+ var fails$a = fails$i;
1101
+
1102
+ var correctPrototypeGetter = !fails$a(function () {
1103
+ function F() { /* empty */ }
1104
+ F.prototype.constructor = null;
1105
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1106
+ return Object.getPrototypeOf(new F()) !== F.prototype;
1107
+ });
1108
+
1109
+ var global$l = global$G;
1110
+ var hasOwn$2 = hasOwnProperty_1;
1111
+ var isCallable$9 = isCallable$j;
1112
+ var toObject$2 = toObject$4;
1113
+ var sharedKey = sharedKey$3;
1114
+ var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1115
+
1116
+ var IE_PROTO = sharedKey('IE_PROTO');
1117
+ var Object$2 = global$l.Object;
1118
+ var ObjectPrototype = Object$2.prototype;
1119
+
1120
+ // `Object.getPrototypeOf` method
1121
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
1122
+ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object$2.getPrototypeOf : function (O) {
1123
+ var object = toObject$2(O);
1124
+ if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1125
+ var constructor = object.constructor;
1126
+ if (isCallable$9(constructor) && object instanceof constructor) {
1127
+ return constructor.prototype;
1128
+ } return object instanceof Object$2 ? ObjectPrototype : null;
1129
+ };
1130
+
1131
+ var fails$9 = fails$i;
1132
+ var isCallable$8 = isCallable$j;
1133
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1134
+ var redefine$5 = redefine$7.exports;
1135
+ var wellKnownSymbol$f = wellKnownSymbol$i;
1136
+
1137
+ var ITERATOR$5 = wellKnownSymbol$f('iterator');
1138
+ var BUGGY_SAFARI_ITERATORS$1 = false;
1139
+
1140
+ // `%IteratorPrototype%` object
1141
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1142
+ var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1143
+
1144
+ /* eslint-disable es/no-array-prototype-keys -- safe */
1145
+ if ([].keys) {
1146
+ arrayIterator = [].keys();
1147
+ // Safari 8 has buggy iterators w/o `next`
1148
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1149
+ else {
1150
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1151
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1152
+ }
1153
+ }
1154
+
1155
+ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$9(function () {
1156
+ var test = {};
1157
+ // FF44- legacy iterators case
1158
+ return IteratorPrototype$2[ITERATOR$5].call(test) !== test;
1159
+ });
1160
+
1161
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1162
+
1163
+ // `%IteratorPrototype%[@@iterator]()` method
1164
+ // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1165
+ if (!isCallable$8(IteratorPrototype$2[ITERATOR$5])) {
1166
+ redefine$5(IteratorPrototype$2, ITERATOR$5, function () {
1167
+ return this;
1168
+ });
1169
+ }
1170
+
1171
+ var iteratorsCore = {
1172
+ IteratorPrototype: IteratorPrototype$2,
1173
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1174
+ };
1175
+
1176
+ var defineProperty$2 = objectDefineProperty.f;
1177
+ var hasOwn$1 = hasOwnProperty_1;
1178
+ var wellKnownSymbol$e = wellKnownSymbol$i;
1179
+
1180
+ var TO_STRING_TAG$3 = wellKnownSymbol$e('toStringTag');
1181
+
1182
+ var setToStringTag$3 = function (target, TAG, STATIC) {
1183
+ if (target && !STATIC) target = target.prototype;
1184
+ if (target && !hasOwn$1(target, TO_STRING_TAG$3)) {
1185
+ defineProperty$2(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1186
+ }
1187
+ };
1188
+
1189
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1190
+ var create$1 = objectCreate;
1191
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1192
+ var setToStringTag$2 = setToStringTag$3;
1193
+ var Iterators$4 = iterators;
1194
+
1195
+ var returnThis$1 = function () { return this; };
1196
+
1197
+ var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1198
+ var TO_STRING_TAG = NAME + ' Iterator';
1199
+ IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1200
+ setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
1201
+ Iterators$4[TO_STRING_TAG] = returnThis$1;
1202
+ return IteratorConstructor;
1203
+ };
1204
+
1205
+ var global$k = global$G;
1206
+ var isCallable$7 = isCallable$j;
1207
+
1208
+ var String$3 = global$k.String;
1209
+ var TypeError$8 = global$k.TypeError;
1210
+
1211
+ var aPossiblePrototype$1 = function (argument) {
1212
+ if (typeof argument == 'object' || isCallable$7(argument)) return argument;
1213
+ throw TypeError$8("Can't set " + String$3(argument) + ' as a prototype');
1214
+ };
1215
+
1216
+ /* eslint-disable no-proto -- safe */
1217
+
1218
+ var uncurryThis$c = functionUncurryThis;
1219
+ var anObject$9 = anObject$e;
1220
+ var aPossiblePrototype = aPossiblePrototype$1;
1221
+
1222
+ // `Object.setPrototypeOf` method
1223
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1224
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1225
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1226
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1227
+ var CORRECT_SETTER = false;
1228
+ var test = {};
1229
+ var setter;
1230
+ try {
1231
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1232
+ setter = uncurryThis$c(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1233
+ setter(test, []);
1234
+ CORRECT_SETTER = test instanceof Array;
1235
+ } catch (error) { /* empty */ }
1236
+ return function setPrototypeOf(O, proto) {
1237
+ anObject$9(O);
1238
+ aPossiblePrototype(proto);
1239
+ if (CORRECT_SETTER) setter(O, proto);
1240
+ else O.__proto__ = proto;
1241
+ return O;
1242
+ };
1243
+ }() : undefined);
1244
+
1245
+ var $$6 = _export;
1246
+ var call$9 = functionCall;
1247
+ var FunctionName = functionName;
1248
+ var isCallable$6 = isCallable$j;
1249
+ var createIteratorConstructor = createIteratorConstructor$1;
1250
+ var getPrototypeOf = objectGetPrototypeOf;
1251
+ var setPrototypeOf$1 = objectSetPrototypeOf;
1252
+ var setToStringTag$1 = setToStringTag$3;
1253
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$6;
1254
+ var redefine$4 = redefine$7.exports;
1255
+ var wellKnownSymbol$d = wellKnownSymbol$i;
1256
+ var Iterators$3 = iterators;
1257
+ var IteratorsCore = iteratorsCore;
1258
+
1259
+ var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
1260
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1261
+ var IteratorPrototype = IteratorsCore.IteratorPrototype;
1262
+ var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1263
+ var ITERATOR$4 = wellKnownSymbol$d('iterator');
1264
+ var KEYS = 'keys';
1265
+ var VALUES = 'values';
1266
+ var ENTRIES = 'entries';
1267
+
1268
+ var returnThis = function () { return this; };
1269
+
1270
+ var defineIterator$1 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1271
+ createIteratorConstructor(IteratorConstructor, NAME, next);
1272
+
1273
+ var getIterationMethod = function (KIND) {
1274
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1275
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
1276
+ switch (KIND) {
1277
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1278
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1279
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1280
+ } return function () { return new IteratorConstructor(this); };
1281
+ };
1282
+
1283
+ var TO_STRING_TAG = NAME + ' Iterator';
1284
+ var INCORRECT_VALUES_NAME = false;
1285
+ var IterablePrototype = Iterable.prototype;
1286
+ var nativeIterator = IterablePrototype[ITERATOR$4]
1287
+ || IterablePrototype['@@iterator']
1288
+ || DEFAULT && IterablePrototype[DEFAULT];
1289
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1290
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1291
+ var CurrentIteratorPrototype, methods, KEY;
1292
+
1293
+ // fix native
1294
+ if (anyNativeIterator) {
1295
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1296
+ if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1297
+ if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1298
+ if (setPrototypeOf$1) {
1299
+ setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
1300
+ } else if (!isCallable$6(CurrentIteratorPrototype[ITERATOR$4])) {
1301
+ redefine$4(CurrentIteratorPrototype, ITERATOR$4, returnThis);
1302
+ }
1303
+ }
1304
+ // Set @@toStringTag to native iterators
1305
+ setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
1306
+ }
1307
+ }
1308
+
1309
+ // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1310
+ if (PROPER_FUNCTION_NAME$1 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1311
+ if (CONFIGURABLE_FUNCTION_NAME) {
1312
+ createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
1313
+ } else {
1314
+ INCORRECT_VALUES_NAME = true;
1315
+ defaultIterator = function values() { return call$9(nativeIterator, this); };
1316
+ }
1317
+ }
1318
+
1319
+ // export additional methods
1320
+ if (DEFAULT) {
1321
+ methods = {
1322
+ values: getIterationMethod(VALUES),
1323
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1324
+ entries: getIterationMethod(ENTRIES)
1325
+ };
1326
+ if (FORCED) for (KEY in methods) {
1327
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1328
+ redefine$4(IterablePrototype, KEY, methods[KEY]);
1329
+ }
1330
+ } else $$6({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1331
+ }
1332
+
1333
+ // define iterator
1334
+ if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
1335
+ redefine$4(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
1336
+ }
1337
+ Iterators$3[NAME] = defaultIterator;
1338
+
1339
+ return methods;
1340
+ };
1341
+
1342
+ var toIndexedObject = toIndexedObject$5;
1343
+ var addToUnscopables$1 = addToUnscopables$2;
1344
+ var Iterators$2 = iterators;
1345
+ var InternalStateModule$1 = internalState;
1346
+ var defineProperty$1 = objectDefineProperty.f;
1347
+ var defineIterator = defineIterator$1;
1348
+ var DESCRIPTORS$2 = descriptors;
1349
+
1350
+ var ARRAY_ITERATOR = 'Array Iterator';
1351
+ var setInternalState$1 = InternalStateModule$1.set;
1352
+ var getInternalState$2 = InternalStateModule$1.getterFor(ARRAY_ITERATOR);
1353
+
1354
+ // `Array.prototype.entries` method
1355
+ // https://tc39.es/ecma262/#sec-array.prototype.entries
1356
+ // `Array.prototype.keys` method
1357
+ // https://tc39.es/ecma262/#sec-array.prototype.keys
1358
+ // `Array.prototype.values` method
1359
+ // https://tc39.es/ecma262/#sec-array.prototype.values
1360
+ // `Array.prototype[@@iterator]` method
1361
+ // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1362
+ // `CreateArrayIterator` internal method
1363
+ // https://tc39.es/ecma262/#sec-createarrayiterator
1364
+ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1365
+ setInternalState$1(this, {
1366
+ type: ARRAY_ITERATOR,
1367
+ target: toIndexedObject(iterated), // target
1368
+ index: 0, // next index
1369
+ kind: kind // kind
1370
+ });
1371
+ // `%ArrayIteratorPrototype%.next` method
1372
+ // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1373
+ }, function () {
1374
+ var state = getInternalState$2(this);
1375
+ var target = state.target;
1376
+ var kind = state.kind;
1377
+ var index = state.index++;
1378
+ if (!target || index >= target.length) {
1379
+ state.target = undefined;
1380
+ return { value: undefined, done: true };
1381
+ }
1382
+ if (kind == 'keys') return { value: index, done: false };
1383
+ if (kind == 'values') return { value: target[index], done: false };
1384
+ return { value: [index, target[index]], done: false };
1385
+ }, 'values');
1386
+
1387
+ // argumentsList[@@iterator] is %ArrayProto_values%
1388
+ // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1389
+ // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1390
+ var values = Iterators$2.Arguments = Iterators$2.Array;
1391
+
1392
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1393
+ addToUnscopables$1('keys');
1394
+ addToUnscopables$1('values');
1395
+ addToUnscopables$1('entries');
1396
+
1397
+ // V8 ~ Chrome 45- bug
1398
+ if (DESCRIPTORS$2 && values.name !== 'values') try {
1399
+ defineProperty$1(values, 'name', { value: 'values' });
1400
+ } catch (error) { /* empty */ }
1401
+
1402
+ // iterable DOM collections
1403
+ // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1404
+ var domIterables = {
1405
+ CSSRuleList: 0,
1406
+ CSSStyleDeclaration: 0,
1407
+ CSSValueList: 0,
1408
+ ClientRectList: 0,
1409
+ DOMRectList: 0,
1410
+ DOMStringList: 0,
1411
+ DOMTokenList: 1,
1412
+ DataTransferItemList: 0,
1413
+ FileList: 0,
1414
+ HTMLAllCollection: 0,
1415
+ HTMLCollection: 0,
1416
+ HTMLFormElement: 0,
1417
+ HTMLSelectElement: 0,
1418
+ MediaList: 0,
1419
+ MimeTypeArray: 0,
1420
+ NamedNodeMap: 0,
1421
+ NodeList: 1,
1422
+ PaintRequestList: 0,
1423
+ Plugin: 0,
1424
+ PluginArray: 0,
1425
+ SVGLengthList: 0,
1426
+ SVGNumberList: 0,
1427
+ SVGPathSegList: 0,
1428
+ SVGPointList: 0,
1429
+ SVGStringList: 0,
1430
+ SVGTransformList: 0,
1431
+ SourceBufferList: 0,
1432
+ StyleSheetList: 0,
1433
+ TextTrackCueList: 0,
1434
+ TextTrackList: 0,
1435
+ TouchList: 0
1436
+ };
1437
+
1438
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1439
+ var documentCreateElement = documentCreateElement$2;
1440
+
1441
+ var classList = documentCreateElement('span').classList;
1442
+ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1443
+
1444
+ var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1445
+
1446
+ var global$j = global$G;
1447
+ var DOMIterables = domIterables;
1448
+ var DOMTokenListPrototype = domTokenListPrototype;
1449
+ var ArrayIteratorMethods = es_array_iterator;
1450
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$6;
1451
+ var wellKnownSymbol$c = wellKnownSymbol$i;
1452
+
1453
+ var ITERATOR$3 = wellKnownSymbol$c('iterator');
1454
+ var TO_STRING_TAG$2 = wellKnownSymbol$c('toStringTag');
1455
+ var ArrayValues = ArrayIteratorMethods.values;
1456
+
1457
+ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1458
+ if (CollectionPrototype) {
1459
+ // some Chrome versions have non-configurable methods on DOMTokenList
1460
+ if (CollectionPrototype[ITERATOR$3] !== ArrayValues) try {
1461
+ createNonEnumerableProperty$1(CollectionPrototype, ITERATOR$3, ArrayValues);
1462
+ } catch (error) {
1463
+ CollectionPrototype[ITERATOR$3] = ArrayValues;
1464
+ }
1465
+ if (!CollectionPrototype[TO_STRING_TAG$2]) {
1466
+ createNonEnumerableProperty$1(CollectionPrototype, TO_STRING_TAG$2, COLLECTION_NAME);
1467
+ }
1468
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1469
+ // some Chrome versions have non-configurable methods on DOMTokenList
1470
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1471
+ createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1472
+ } catch (error) {
1473
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1474
+ }
1475
+ }
1476
+ }
1477
+ };
1478
+
1479
+ for (var COLLECTION_NAME in DOMIterables) {
1480
+ handlePrototype(global$j[COLLECTION_NAME] && global$j[COLLECTION_NAME].prototype, COLLECTION_NAME);
1481
+ }
1482
+
1483
+ handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1484
+
1485
+ var $$5 = _export;
1486
+ var $includes = arrayIncludes.includes;
1487
+ var addToUnscopables = addToUnscopables$2;
1488
+
1489
+ // `Array.prototype.includes` method
1490
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
1491
+ $$5({ target: 'Array', proto: true }, {
1492
+ includes: function includes(el /* , fromIndex = 0 */) {
1493
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1494
+ }
1495
+ });
1496
+
1497
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1498
+ addToUnscopables('includes');
1499
+
1500
+ var isObject$2 = isObject$8;
1501
+ var classof$6 = classofRaw$1;
1502
+ var wellKnownSymbol$b = wellKnownSymbol$i;
1503
+
1504
+ var MATCH$1 = wellKnownSymbol$b('match');
1505
+
1506
+ // `IsRegExp` abstract operation
1507
+ // https://tc39.es/ecma262/#sec-isregexp
1508
+ var isRegexp = function (it) {
1509
+ var isRegExp;
1510
+ return isObject$2(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$6(it) == 'RegExp');
1511
+ };
1512
+
1513
+ var global$i = global$G;
1514
+ var isRegExp = isRegexp;
1515
+
1516
+ var TypeError$7 = global$i.TypeError;
1517
+
1518
+ var notARegexp = function (it) {
1519
+ if (isRegExp(it)) {
1520
+ throw TypeError$7("The method doesn't accept regular expressions");
1521
+ } return it;
1522
+ };
1523
+
1524
+ var wellKnownSymbol$a = wellKnownSymbol$i;
1525
+
1526
+ var TO_STRING_TAG$1 = wellKnownSymbol$a('toStringTag');
1527
+ var test = {};
1528
+
1529
+ test[TO_STRING_TAG$1] = 'z';
1530
+
1531
+ var toStringTagSupport = String(test) === '[object z]';
1532
+
1533
+ var global$h = global$G;
1534
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1535
+ var isCallable$5 = isCallable$j;
1536
+ var classofRaw = classofRaw$1;
1537
+ var wellKnownSymbol$9 = wellKnownSymbol$i;
1538
+
1539
+ var TO_STRING_TAG = wellKnownSymbol$9('toStringTag');
1540
+ var Object$1 = global$h.Object;
1541
+
1542
+ // ES3 wrong here
1543
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1544
+
1545
+ // fallback for IE11 Script Access Denied error
1546
+ var tryGet = function (it, key) {
1547
+ try {
1548
+ return it[key];
1549
+ } catch (error) { /* empty */ }
1550
+ };
1551
+
1552
+ // getting tag from ES6+ `Object.prototype.toString`
1553
+ var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1554
+ var O, tag, result;
1555
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1556
+ // @@toStringTag case
1557
+ : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
1558
+ // builtinTag case
1559
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1560
+ // ES3 arguments fallback
1561
+ : (result = classofRaw(O)) == 'Object' && isCallable$5(O.callee) ? 'Arguments' : result;
1562
+ };
1563
+
1564
+ var global$g = global$G;
1565
+ var classof$4 = classof$5;
1566
+
1567
+ var String$2 = global$g.String;
1568
+
1569
+ var toString$5 = function (argument) {
1570
+ if (classof$4(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1571
+ return String$2(argument);
1572
+ };
1573
+
1574
+ var wellKnownSymbol$8 = wellKnownSymbol$i;
1575
+
1576
+ var MATCH = wellKnownSymbol$8('match');
1577
+
1578
+ var correctIsRegexpLogic = function (METHOD_NAME) {
1579
+ var regexp = /./;
1580
+ try {
1581
+ '/./'[METHOD_NAME](regexp);
1582
+ } catch (error1) {
1583
+ try {
1584
+ regexp[MATCH] = false;
1585
+ return '/./'[METHOD_NAME](regexp);
1586
+ } catch (error2) { /* empty */ }
1587
+ } return false;
1588
+ };
1589
+
1590
+ var $$4 = _export;
1591
+ var uncurryThis$b = functionUncurryThis;
1592
+ var notARegExp$1 = notARegexp;
1593
+ var requireObjectCoercible$3 = requireObjectCoercible$6;
1594
+ var toString$4 = toString$5;
1595
+ var correctIsRegExpLogic$1 = correctIsRegexpLogic;
1596
+
1597
+ var stringIndexOf$1 = uncurryThis$b(''.indexOf);
1598
+
1599
+ // `String.prototype.includes` method
1600
+ // https://tc39.es/ecma262/#sec-string.prototype.includes
1601
+ $$4({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
1602
+ includes: function includes(searchString /* , position = 0 */) {
1603
+ return !!~stringIndexOf$1(
1604
+ toString$4(requireObjectCoercible$3(this)),
1605
+ toString$4(notARegExp$1(searchString)),
1606
+ arguments.length > 1 ? arguments[1] : undefined
1607
+ );
1608
+ }
1609
+ });
1610
+
1611
+ var DESCRIPTORS$1 = descriptors;
1612
+ var uncurryThis$a = functionUncurryThis;
1613
+ var call$8 = functionCall;
1614
+ var fails$8 = fails$i;
1615
+ var objectKeys = objectKeys$2;
1616
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1617
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1618
+ var toObject$1 = toObject$4;
1619
+ var IndexedObject = indexedObject;
1620
+
1621
+ // eslint-disable-next-line es/no-object-assign -- safe
1622
+ var $assign = Object.assign;
1623
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1624
+ var defineProperty = Object.defineProperty;
1625
+ var concat$1 = uncurryThis$a([].concat);
1626
+
1627
+ // `Object.assign` method
1628
+ // https://tc39.es/ecma262/#sec-object.assign
1629
+ var objectAssign = !$assign || fails$8(function () {
1630
+ // should have correct order of operations (Edge bug)
1631
+ if (DESCRIPTORS$1 && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
1632
+ enumerable: true,
1633
+ get: function () {
1634
+ defineProperty(this, 'b', {
1635
+ value: 3,
1636
+ enumerable: false
1637
+ });
1638
+ }
1639
+ }), { b: 2 })).b !== 1) return true;
1640
+ // should work with symbols and should have deterministic property order (V8 bug)
1641
+ var A = {};
1642
+ var B = {};
1643
+ // eslint-disable-next-line es/no-symbol -- safe
1644
+ var symbol = Symbol();
1645
+ var alphabet = 'abcdefghijklmnopqrst';
1646
+ A[symbol] = 7;
1647
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1648
+ return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
1649
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1650
+ var T = toObject$1(target);
1651
+ var argumentsLength = arguments.length;
1652
+ var index = 1;
1653
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1654
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
1655
+ while (argumentsLength > index) {
1656
+ var S = IndexedObject(arguments[index++]);
1657
+ var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1658
+ var length = keys.length;
1659
+ var j = 0;
1660
+ var key;
1661
+ while (length > j) {
1662
+ key = keys[j++];
1663
+ if (!DESCRIPTORS$1 || call$8(propertyIsEnumerable, S, key)) T[key] = S[key];
1664
+ }
1665
+ } return T;
1666
+ } : $assign;
1667
+
1668
+ var $$3 = _export;
1669
+ var assign = objectAssign;
1670
+
1671
+ // `Object.assign` method
1672
+ // https://tc39.es/ecma262/#sec-object.assign
1673
+ // eslint-disable-next-line es/no-object-assign -- required for testing
1674
+ $$3({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
1675
+ assign: assign
1676
+ });
1677
+
1678
+ var anObject$8 = anObject$e;
1679
+
1680
+ // `RegExp.prototype.flags` getter implementation
1681
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1682
+ var regexpFlags$1 = function () {
1683
+ var that = anObject$8(this);
1684
+ var result = '';
1685
+ if (that.global) result += 'g';
1686
+ if (that.ignoreCase) result += 'i';
1687
+ if (that.multiline) result += 'm';
1688
+ if (that.dotAll) result += 's';
1689
+ if (that.unicode) result += 'u';
1690
+ if (that.sticky) result += 'y';
1691
+ return result;
1692
+ };
1693
+
1694
+ var uncurryThis$9 = functionUncurryThis;
1695
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
1696
+ var redefine$3 = redefine$7.exports;
1697
+ var anObject$7 = anObject$e;
1698
+ var isPrototypeOf$2 = objectIsPrototypeOf;
1699
+ var $toString = toString$5;
1700
+ var fails$7 = fails$i;
1701
+ var regExpFlags = regexpFlags$1;
1702
+
1703
+ var TO_STRING = 'toString';
1704
+ var RegExpPrototype$1 = RegExp.prototype;
1705
+ var n$ToString = RegExpPrototype$1[TO_STRING];
1706
+ var getFlags = uncurryThis$9(regExpFlags);
1707
+
1708
+ var NOT_GENERIC = fails$7(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1709
+ // FF44- RegExp#toString has a wrong name
1710
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING;
1711
+
1712
+ // `RegExp.prototype.toString` method
1713
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
1714
+ if (NOT_GENERIC || INCORRECT_NAME) {
1715
+ redefine$3(RegExp.prototype, TO_STRING, function toString() {
1716
+ var R = anObject$7(this);
1717
+ var p = $toString(R.source);
1718
+ var rf = R.flags;
1719
+ var f = $toString(rf === undefined && isPrototypeOf$2(RegExpPrototype$1, R) && !('flags' in RegExpPrototype$1) ? getFlags(R) : rf);
1720
+ return '/' + p + '/' + f;
1721
+ }, { unsafe: true });
1722
+ }
1723
+
1724
+ var KeyboardLayoutName;
1725
+ (function (KeyboardLayoutName) {
1726
+ KeyboardLayoutName["DEFAULT"] = "default";
1727
+ KeyboardLayoutName["SHIFT"] = "shift";
1728
+ })(KeyboardLayoutName || (KeyboardLayoutName = {}));
1729
+ var KeyboardKey;
1730
+ (function (KeyboardKey) {
1731
+ KeyboardKey["SHIFT"] = "{shift}";
1732
+ KeyboardKey["CAPS_LOCK"] = "{lock}";
1733
+ KeyboardKey["BACKSPACE"] = "{bksp}";
1734
+ KeyboardKey["ENTER"] = "{enter}";
1735
+ KeyboardKey["SUBMIT"] = "{submit}";
1736
+ KeyboardKey["TAB"] = "{tab}";
1737
+ KeyboardKey["SPACE"] = "{space}";
1738
+ // All the other keys should be a literal of what they represent
1739
+ })(KeyboardKey || (KeyboardKey = {}));
1740
+ const TEXT = {
1741
+ default: [`\` 1 2 3 4 5 6 7 8 9 0 - = ${KeyboardKey.BACKSPACE}`, `${KeyboardKey.TAB} q w e r t y u i o p [ ] \\`, `${KeyboardKey.CAPS_LOCK} a s d f g h j k l ; ' ${KeyboardKey.SUBMIT}`, `${KeyboardKey.SHIFT} z x c v b n m , . / ${KeyboardKey.ENTER}`, `${KeyboardKey.SPACE}`],
1742
+ shift: [`~ ! @ # $ % ^ & * ( ) _ + ${KeyboardKey.BACKSPACE}`, `${KeyboardKey.TAB} Q W E R T Y U I O P { } |`, `${KeyboardKey.CAPS_LOCK} A S D F G H J K L : " ${KeyboardKey.SUBMIT}`, `${KeyboardKey.SHIFT} Z X C V B N M < > ? ${KeyboardKey.ENTER}`, `${KeyboardKey.SPACE}`]
1743
+ };
1744
+ const NUMERIC = {
1745
+ default: ["1 2 3", "4 5 6", "7 8 9", ". 0 -", `${KeyboardKey.BACKSPACE} ${KeyboardKey.SUBMIT}`]
1746
+ };
1747
+ const KeyboardLayout = {
1748
+ TEXT,
1749
+ NUMERIC
1750
+ };
1751
+ const KeyboardDisplay = {
1752
+ [KeyboardKey.SHIFT]: "shift ⇧",
1753
+ [KeyboardKey.CAPS_LOCK]: "caps lock ⇪",
1754
+ [KeyboardKey.BACKSPACE]: "backspace ⌫",
1755
+ [KeyboardKey.ENTER]: "enter ↵",
1756
+ [KeyboardKey.SUBMIT]: "submit ✓",
1757
+ [KeyboardKey.TAB]: "tab ⇥",
1758
+ [KeyboardKey.SPACE]: "space"
1759
+ };
1760
+ const KeyboardLayoutsByInputType = {
1761
+ // Input type number cannot be supported because we cannot set the cursor position on number inputs
1762
+ // Use type "tel" instead
1763
+ // number: KeyboardLayout.NUMERIC,
1764
+ tel: KeyboardLayout.NUMERIC,
1765
+ date: KeyboardLayout.NUMERIC,
1766
+ week: KeyboardLayout.NUMERIC,
1767
+ text: KeyboardLayout.TEXT,
1768
+ password: KeyboardLayout.TEXT,
1769
+ "datetime-local": KeyboardLayout.TEXT,
1770
+ month: KeyboardLayout.TEXT,
1771
+ time: KeyboardLayout.TEXT,
1772
+ email: KeyboardLayout.TEXT,
1773
+ search: KeyboardLayout.TEXT,
1774
+ url: KeyboardLayout.TEXT,
1775
+ textarea: KeyboardLayout.TEXT
1776
+ };
1777
+
1778
+ const VirtualKeyboard = () => {
1779
+ const [initialInputValue, setInitialInputValue] = useState();
1780
+ const [toggleLayoutOnInput, setToggleLayoutOnInput] = useState(false);
1781
+ const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
1782
+ const [keyboardLayout, setKeyboardLayout] = useState(KeyboardLayout.TEXT);
1783
+ const [keyboardLayoutName, setKeyboardLayoutName] = useState(KeyboardLayoutName.DEFAULT);
1784
+ const [focusedTextInput, setFocusedTextInput] = useState();
1785
+ const virtualKeyboardRef = useRef(null);
1786
+ useEffect(function showOrHideKeyboard() {
1787
+ // The keyboard will appear/disappear on mouse down
1788
+ // However, if the user is clicking something, like a submit button or the input itself, the mouse up will happen a few milliseconds after the keyboard is shown/hidden
1789
+ // The layout might shift, the page might scroll and the user might misclick because of that.
1790
+ // To prevent this, we introduce a small delay to allow the user to finish the click they started.
1791
+ // The layout will shift after the click.
1792
+ const effectDelayMs = 150;
1793
+ if (focusedTextInput !== undefined) {
1794
+ const showTimeout = setTimeout(() => {
1795
+ setIsKeyboardVisible(true);
1796
+ }, effectDelayMs);
1797
+ return () => {
1798
+ clearTimeout(showTimeout);
1799
+ };
1800
+ }
1801
+ const hideTimeout = setTimeout(() => {
1802
+ var _a;
1803
+ (_a = virtualKeyboardRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
1804
+ setIsKeyboardVisible(false);
1805
+ }, effectDelayMs);
1806
+ return () => {
1807
+ clearTimeout(hideTimeout);
1808
+ };
1809
+ }, [focusedTextInput]);
1810
+ useEffect(function scrollInputIntoViewAfterKeyboardAppears() {
1811
+ if (isKeyboardVisible && focusedTextInput !== undefined) {
1812
+ focusedTextInput.scrollIntoView({
1813
+ behavior: "smooth",
1814
+ block: "center"
1815
+ });
1816
+ }
1817
+ }, [isKeyboardVisible, focusedTextInput]);
1818
+ useEffect(function attachToFocusedTextInput() {
1819
+ const setFocusedInputIfFocusedElementIsInput = event => {
1820
+ const eventTarget = event.target;
1821
+ if (eventTarget.type === "number") {
1822
+ console.warn("The VirtualKeyboard cannot support an input of type number. Use type 'tel' instead.", eventTarget);
1823
+ eventTarget.type = "tel";
1824
+ }
1825
+ const targetKeyboardLayout = KeyboardLayoutsByInputType[eventTarget.type];
1826
+ if (targetKeyboardLayout !== undefined) {
1827
+ setKeyboardLayout(targetKeyboardLayout);
1828
+ setKeyboardLayoutName(KeyboardLayoutName.DEFAULT);
1829
+ setFocusedTextInput(eventTarget);
1830
+ setInitialInputValue(eventTarget.value);
1831
+ }
1832
+ };
1833
+ document.addEventListener("focus", setFocusedInputIfFocusedElementIsInput, {
1834
+ capture: true
1835
+ });
1836
+ return () => {
1837
+ document.removeEventListener("focus", setFocusedInputIfFocusedElementIsInput, {
1838
+ capture: true
1839
+ });
1840
+ };
1841
+ }, []);
1842
+ useEffect(function detachWhenTextInputLosesFocus() {
1843
+ if (focusedTextInput === undefined || initialInputValue === undefined) {
1844
+ return;
1845
+ }
1846
+ const unsetFocusedTextInput = () => {
1847
+ if (initialInputValue !== focusedTextInput.value) {
1848
+ focusedTextInput.dispatchEvent(new Event("change")); // Some jQuery handlers use on("change", handler)
1849
+ }
1850
+ setFocusedTextInput(undefined);
1851
+ setInitialInputValue(undefined);
1852
+ };
1853
+ focusedTextInput.addEventListener("blur", unsetFocusedTextInput, {
1854
+ capture: true
1855
+ });
1856
+ return () => {
1857
+ focusedTextInput.removeEventListener("blur", unsetFocusedTextInput, {
1858
+ capture: true
1859
+ });
1860
+ };
1861
+ }, [focusedTextInput, initialInputValue]);
1862
+ // Stay in sync with external changes originating from code or physical keyboard
1863
+ useEffect(function syncExternalChangesFromCodeOrKeyboard() {
1864
+ if (focusedTextInput === undefined) {
1865
+ return;
1866
+ }
1867
+ const updateKeyboardInput = () => {
1868
+ var _a, _b;
1869
+ (_a = virtualKeyboardRef.current) === null || _a === void 0 ? void 0 : _a.setInput(focusedTextInput.value);
1870
+ (_b = virtualKeyboardRef.current) === null || _b === void 0 ? void 0 : _b.setCaretPosition(focusedTextInput.selectionStart, focusedTextInput.selectionEnd);
1871
+ };
1872
+ /** Without adding a click event listener, moving the caret by tapping somewhere on your input does not work correctly with inputs in a shadow dom.
1873
+ * the caret position needs to be explicitly set on click */
1874
+ focusedTextInput.addEventListener("input", updateKeyboardInput, {
1875
+ capture: true
1876
+ });
1877
+ focusedTextInput.addEventListener("click", updateKeyboardInput, {
1878
+ capture: true
1879
+ });
1880
+ focusedTextInput.addEventListener("touchend", updateKeyboardInput, {
1881
+ capture: true
1882
+ });
1883
+ return () => {
1884
+ focusedTextInput.removeEventListener("input", updateKeyboardInput, {
1885
+ capture: true
1886
+ });
1887
+ focusedTextInput.removeEventListener("click", updateKeyboardInput, {
1888
+ capture: true
1889
+ });
1890
+ focusedTextInput.removeEventListener("touchend", updateKeyboardInput, {
1891
+ capture: true
1892
+ });
1893
+ };
1894
+ }, [focusedTextInput]);
1895
+ const handleInput = (newValue, event) => {
1896
+ if (focusedTextInput === undefined) {
1897
+ return;
1898
+ }
1899
+ if (String(focusedTextInput.className).includes("monaco")) {
1900
+ /* skip: MonacoEditor textarea input actions via VirtualKeyboard are
1901
+ * handled below using the monacoEventEmitter + editor.trigger(...) calls. */
1902
+ return;
1903
+ }
1904
+ if (toggleLayoutOnInput) {
1905
+ setKeyboardLayoutName(toggleLayout(keyboardLayoutName));
1906
+ setToggleLayoutOnInput(false);
1907
+ }
1908
+ setInputValue(focusedTextInput, newValue, virtualKeyboardRef.current.caretPosition);
1909
+ };
1910
+ const handleKeyPress = keyboardKey => {
1911
+ if (focusedTextInput === undefined || virtualKeyboardRef.current === null) {
1912
+ return;
1913
+ }
1914
+ switch (keyboardKey) {
1915
+ case KeyboardKey.SHIFT:
1916
+ setToggleLayoutOnInput(!toggleLayoutOnInput);
1917
+ setKeyboardLayoutName(toggleLayout(keyboardLayoutName));
1918
+ break;
1919
+ case KeyboardKey.CAPS_LOCK:
1920
+ setKeyboardLayoutName(toggleLayout(keyboardLayoutName));
1921
+ break;
1922
+ case KeyboardKey.SUBMIT:
1923
+ focusedTextInput.blur();
1924
+ break;
1925
+ }
1926
+ };
1927
+ if (!isKeyboardVisible) {
1928
+ return null;
1929
+ }
1930
+ return jsx("div", Object.assign({
1931
+ id: "virtual_keyboard"
1932
+ }, {
1933
+ children: jsx(Keyboard, {
1934
+ keyboardRef: ref => {
1935
+ virtualKeyboardRef.current = ref;
1936
+ },
1937
+ onInit: keyboard => {
1938
+ if (keyboard === undefined) {
1939
+ console.error("The virtual keyboard is open, but not available. This is not supposed to happen.");
1940
+ return;
1941
+ }
1942
+ if (focusedTextInput === undefined) {
1943
+ console.error("The virtual keyboard is open, but there's no focusedTextInput. This is not supposed to happen.");
1944
+ return;
1945
+ }
1946
+ const textWasSelectedBeforeInit = isTextSelected(focusedTextInput);
1947
+ keyboard.setCaretPosition(focusedTextInput.selectionStart);
1948
+ keyboard.setInput(focusedTextInput.value);
1949
+ if (textWasSelectedBeforeInit !== undefined && textWasSelectedBeforeInit) {
1950
+ focusedTextInput.select();
1951
+ }
1952
+ keyboard.setCaretPosition(focusedTextInput.selectionStart);
1953
+ keyboard.setInput(focusedTextInput.value);
1954
+ },
1955
+ onChange: handleInput,
1956
+ onKeyPress: handleKeyPress,
1957
+ layout: keyboardLayout,
1958
+ layoutName: keyboardLayoutName,
1959
+ preventMouseDownDefault: true,
1960
+ stopMouseDownPropagation: true,
1961
+ autoUseTouchEvents: true,
1962
+ display: KeyboardDisplay,
1963
+ newLineOnEnter: true
1964
+ })
1965
+ }));
1966
+ };
1967
+ /**
1968
+ * Sets the input value in a way that can be picked up by React if the element is managed by React.
1969
+ *
1970
+ * I don't understand any of this, but other people do
1971
+ * - https://stackoverflow.com/questions/42550341/react-trigger-onchange-if-input-value-is-changing-by-state/59939017#59939017
1972
+ */
1973
+ function setInputValue(inputElement, inputValue, caretPosition) {
1974
+ var _a, _b;
1975
+ const valueSetter = (_a = Object.getOwnPropertyDescriptor(inputElement, "value")) === null || _a === void 0 ? void 0 : _a.set;
1976
+ const inputPrototype = Object.getPrototypeOf(inputElement);
1977
+ const prototypeValueSetter = (_b = Object.getOwnPropertyDescriptor(inputPrototype, "value")) === null || _b === void 0 ? void 0 : _b.set;
1978
+ if (valueSetter !== undefined && prototypeValueSetter !== undefined && valueSetter !== prototypeValueSetter) {
1979
+ prototypeValueSetter.call(inputElement, inputValue);
1980
+ } else if (valueSetter !== undefined) {
1981
+ valueSetter.call(inputElement, inputValue);
1982
+ } else {
1983
+ // Not managed by React, set it the normal way
1984
+ inputElement.value = inputValue;
1985
+ }
1986
+ // The input caret position doesn't stay in sync after setting the value programmatically, so we set it
1987
+ inputElement.setSelectionRange(caretPosition, caretPosition);
1988
+ inputElement.dispatchEvent(new Event("input")); // Some jQuery handlers use on("input", handler)
1989
+ inputElement.dispatchEvent(new Event("input", {
1990
+ bubbles: true
1991
+ })); // Used by React onChange handlers
1992
+ }
1993
+ function toggleLayout(keyboardLayoutName) {
1994
+ return keyboardLayoutName === KeyboardLayoutName.DEFAULT ? KeyboardLayoutName.SHIFT : KeyboardLayoutName.DEFAULT;
1995
+ }
1996
+ function isTextSelected(inputElement) {
1997
+ if (typeof inputElement.selectionStart == "number") {
1998
+ return inputElement.selectionStart === 0 && inputElement.selectionEnd === inputElement.value.length;
1999
+ } else if (typeof window.getSelection != "undefined") {
2000
+ const selection = window.getSelection();
2001
+ return (selection === null || selection === void 0 ? void 0 : selection.toString()) === inputElement.value;
2002
+ }
2003
+ }
2004
+
2005
+ var $$2 = _export;
2006
+ var uncurryThis$8 = functionUncurryThis;
2007
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
2008
+ var toLength$1 = toLength$3;
2009
+ var toString$3 = toString$5;
2010
+ var notARegExp = notARegexp;
2011
+ var requireObjectCoercible$2 = requireObjectCoercible$6;
2012
+ var correctIsRegExpLogic = correctIsRegexpLogic;
2013
+
2014
+ // eslint-disable-next-line es/no-string-prototype-startswith -- safe
2015
+ var un$StartsWith = uncurryThis$8(''.startsWith);
2016
+ var stringSlice$4 = uncurryThis$8(''.slice);
2017
+ var min$1 = Math.min;
2018
+
2019
+ var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
2020
+ // https://github.com/zloirock/core-js/pull/702
2021
+ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
2022
+ var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
2023
+ return descriptor && !descriptor.writable;
2024
+ }();
2025
+
2026
+ // `String.prototype.startsWith` method
2027
+ // https://tc39.es/ecma262/#sec-string.prototype.startswith
2028
+ $$2({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
2029
+ startsWith: function startsWith(searchString /* , position = 0 */) {
2030
+ var that = toString$3(requireObjectCoercible$2(this));
2031
+ notARegExp(searchString);
2032
+ var index = toLength$1(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
2033
+ var search = toString$3(searchString);
2034
+ return un$StartsWith
2035
+ ? un$StartsWith(that, search, index)
2036
+ : stringSlice$4(that, index, index + search.length) === search;
2037
+ }
2038
+ });
2039
+
2040
+ var global$f = global$G;
2041
+
2042
+ var nativePromiseConstructor = global$f.Promise;
2043
+
2044
+ var redefine$2 = redefine$7.exports;
2045
+
2046
+ var redefineAll$1 = function (target, src, options) {
2047
+ for (var key in src) redefine$2(target, key, src[key], options);
2048
+ return target;
2049
+ };
2050
+
2051
+ var getBuiltIn$2 = getBuiltIn$7;
2052
+ var definePropertyModule = objectDefineProperty;
2053
+ var wellKnownSymbol$7 = wellKnownSymbol$i;
2054
+ var DESCRIPTORS = descriptors;
2055
+
2056
+ var SPECIES$3 = wellKnownSymbol$7('species');
2057
+
2058
+ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
2059
+ var Constructor = getBuiltIn$2(CONSTRUCTOR_NAME);
2060
+ var defineProperty = definePropertyModule.f;
2061
+
2062
+ if (DESCRIPTORS && Constructor && !Constructor[SPECIES$3]) {
2063
+ defineProperty(Constructor, SPECIES$3, {
2064
+ configurable: true,
2065
+ get: function () { return this; }
2066
+ });
2067
+ }
2068
+ };
2069
+
2070
+ var global$e = global$G;
2071
+ var isPrototypeOf$1 = objectIsPrototypeOf;
2072
+
2073
+ var TypeError$6 = global$e.TypeError;
2074
+
2075
+ var anInstance$1 = function (it, Prototype) {
2076
+ if (isPrototypeOf$1(Prototype, it)) return it;
2077
+ throw TypeError$6('Incorrect invocation');
2078
+ };
2079
+
2080
+ var uncurryThis$7 = functionUncurryThis;
2081
+ var aCallable$3 = aCallable$5;
2082
+ var NATIVE_BIND$1 = functionBindNative;
2083
+
2084
+ var bind$4 = uncurryThis$7(uncurryThis$7.bind);
2085
+
2086
+ // optional / simple context binding
2087
+ var functionBindContext = function (fn, that) {
2088
+ aCallable$3(fn);
2089
+ return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
2090
+ return fn.apply(that, arguments);
2091
+ };
2092
+ };
2093
+
2094
+ var wellKnownSymbol$6 = wellKnownSymbol$i;
2095
+ var Iterators$1 = iterators;
2096
+
2097
+ var ITERATOR$2 = wellKnownSymbol$6('iterator');
2098
+ var ArrayPrototype = Array.prototype;
2099
+
2100
+ // check on default Array iterator
2101
+ var isArrayIteratorMethod$1 = function (it) {
2102
+ return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
2103
+ };
2104
+
2105
+ var classof$3 = classof$5;
2106
+ var getMethod$2 = getMethod$4;
2107
+ var Iterators = iterators;
2108
+ var wellKnownSymbol$5 = wellKnownSymbol$i;
2109
+
2110
+ var ITERATOR$1 = wellKnownSymbol$5('iterator');
2111
+
2112
+ var getIteratorMethod$2 = function (it) {
2113
+ if (it != undefined) return getMethod$2(it, ITERATOR$1)
2114
+ || getMethod$2(it, '@@iterator')
2115
+ || Iterators[classof$3(it)];
2116
+ };
2117
+
2118
+ var global$d = global$G;
2119
+ var call$7 = functionCall;
2120
+ var aCallable$2 = aCallable$5;
2121
+ var anObject$6 = anObject$e;
2122
+ var tryToString$2 = tryToString$4;
2123
+ var getIteratorMethod$1 = getIteratorMethod$2;
2124
+
2125
+ var TypeError$5 = global$d.TypeError;
2126
+
2127
+ var getIterator$1 = function (argument, usingIterator) {
2128
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
2129
+ if (aCallable$2(iteratorMethod)) return anObject$6(call$7(iteratorMethod, argument));
2130
+ throw TypeError$5(tryToString$2(argument) + ' is not iterable');
2131
+ };
2132
+
2133
+ var call$6 = functionCall;
2134
+ var anObject$5 = anObject$e;
2135
+ var getMethod$1 = getMethod$4;
2136
+
2137
+ var iteratorClose$1 = function (iterator, kind, value) {
2138
+ var innerResult, innerError;
2139
+ anObject$5(iterator);
2140
+ try {
2141
+ innerResult = getMethod$1(iterator, 'return');
2142
+ if (!innerResult) {
2143
+ if (kind === 'throw') throw value;
2144
+ return value;
2145
+ }
2146
+ innerResult = call$6(innerResult, iterator);
2147
+ } catch (error) {
2148
+ innerError = true;
2149
+ innerResult = error;
2150
+ }
2151
+ if (kind === 'throw') throw value;
2152
+ if (innerError) throw innerResult;
2153
+ anObject$5(innerResult);
2154
+ return value;
2155
+ };
2156
+
2157
+ var global$c = global$G;
2158
+ var bind$3 = functionBindContext;
2159
+ var call$5 = functionCall;
2160
+ var anObject$4 = anObject$e;
2161
+ var tryToString$1 = tryToString$4;
2162
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
2163
+ var lengthOfArrayLike = lengthOfArrayLike$2;
2164
+ var isPrototypeOf = objectIsPrototypeOf;
2165
+ var getIterator = getIterator$1;
2166
+ var getIteratorMethod = getIteratorMethod$2;
2167
+ var iteratorClose = iteratorClose$1;
2168
+
2169
+ var TypeError$4 = global$c.TypeError;
2170
+
2171
+ var Result = function (stopped, result) {
2172
+ this.stopped = stopped;
2173
+ this.result = result;
2174
+ };
2175
+
2176
+ var ResultPrototype = Result.prototype;
2177
+
2178
+ var iterate$1 = function (iterable, unboundFunction, options) {
2179
+ var that = options && options.that;
2180
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2181
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
2182
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
2183
+ var fn = bind$3(unboundFunction, that);
2184
+ var iterator, iterFn, index, length, result, next, step;
2185
+
2186
+ var stop = function (condition) {
2187
+ if (iterator) iteratorClose(iterator, 'normal', condition);
2188
+ return new Result(true, condition);
2189
+ };
2190
+
2191
+ var callFn = function (value) {
2192
+ if (AS_ENTRIES) {
2193
+ anObject$4(value);
2194
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2195
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
2196
+ };
2197
+
2198
+ if (IS_ITERATOR) {
2199
+ iterator = iterable;
2200
+ } else {
2201
+ iterFn = getIteratorMethod(iterable);
2202
+ if (!iterFn) throw TypeError$4(tryToString$1(iterable) + ' is not iterable');
2203
+ // optimisation for array iterators
2204
+ if (isArrayIteratorMethod(iterFn)) {
2205
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
2206
+ result = callFn(iterable[index]);
2207
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
2208
+ } return new Result(false);
2209
+ }
2210
+ iterator = getIterator(iterable, iterFn);
2211
+ }
2212
+
2213
+ next = iterator.next;
2214
+ while (!(step = call$5(next, iterator)).done) {
2215
+ try {
2216
+ result = callFn(step.value);
2217
+ } catch (error) {
2218
+ iteratorClose(iterator, 'throw', error);
2219
+ }
2220
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
2221
+ } return new Result(false);
2222
+ };
2223
+
2224
+ var wellKnownSymbol$4 = wellKnownSymbol$i;
2225
+
2226
+ var ITERATOR = wellKnownSymbol$4('iterator');
2227
+ var SAFE_CLOSING = false;
2228
+
2229
+ try {
2230
+ var called = 0;
2231
+ var iteratorWithReturn = {
2232
+ next: function () {
2233
+ return { done: !!called++ };
2234
+ },
2235
+ 'return': function () {
2236
+ SAFE_CLOSING = true;
2237
+ }
2238
+ };
2239
+ iteratorWithReturn[ITERATOR] = function () {
2240
+ return this;
2241
+ };
2242
+ // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
2243
+ Array.from(iteratorWithReturn, function () { throw 2; });
2244
+ } catch (error) { /* empty */ }
2245
+
2246
+ var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
2247
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2248
+ var ITERATION_SUPPORT = false;
2249
+ try {
2250
+ var object = {};
2251
+ object[ITERATOR] = function () {
2252
+ return {
2253
+ next: function () {
2254
+ return { done: ITERATION_SUPPORT = true };
2255
+ }
2256
+ };
2257
+ };
2258
+ exec(object);
2259
+ } catch (error) { /* empty */ }
2260
+ return ITERATION_SUPPORT;
2261
+ };
2262
+
2263
+ var uncurryThis$6 = functionUncurryThis;
2264
+ var fails$6 = fails$i;
2265
+ var isCallable$4 = isCallable$j;
2266
+ var classof$2 = classof$5;
2267
+ var getBuiltIn$1 = getBuiltIn$7;
2268
+ var inspectSource$1 = inspectSource$4;
2269
+
2270
+ var noop = function () { /* empty */ };
2271
+ var empty = [];
2272
+ var construct = getBuiltIn$1('Reflect', 'construct');
2273
+ var constructorRegExp = /^\s*(?:class|function)\b/;
2274
+ var exec$1 = uncurryThis$6(constructorRegExp.exec);
2275
+ var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
2276
+
2277
+ var isConstructorModern = function isConstructor(argument) {
2278
+ if (!isCallable$4(argument)) return false;
2279
+ try {
2280
+ construct(noop, empty, argument);
2281
+ return true;
2282
+ } catch (error) {
2283
+ return false;
2284
+ }
2285
+ };
2286
+
2287
+ var isConstructorLegacy = function isConstructor(argument) {
2288
+ if (!isCallable$4(argument)) return false;
2289
+ switch (classof$2(argument)) {
2290
+ case 'AsyncFunction':
2291
+ case 'GeneratorFunction':
2292
+ case 'AsyncGeneratorFunction': return false;
2293
+ }
2294
+ try {
2295
+ // we can't check .prototype since constructors produced by .bind haven't it
2296
+ // `Function#toString` throws on some built-it function in some legacy engines
2297
+ // (for example, `DOMQuad` and similar in FF41-)
2298
+ return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource$1(argument));
2299
+ } catch (error) {
2300
+ return true;
2301
+ }
2302
+ };
2303
+
2304
+ isConstructorLegacy.sham = true;
2305
+
2306
+ // `IsConstructor` abstract operation
2307
+ // https://tc39.es/ecma262/#sec-isconstructor
2308
+ var isConstructor$1 = !construct || fails$6(function () {
2309
+ var called;
2310
+ return isConstructorModern(isConstructorModern.call)
2311
+ || !isConstructorModern(Object)
2312
+ || !isConstructorModern(function () { called = true; })
2313
+ || called;
2314
+ }) ? isConstructorLegacy : isConstructorModern;
2315
+
2316
+ var global$b = global$G;
2317
+ var isConstructor = isConstructor$1;
2318
+ var tryToString = tryToString$4;
2319
+
2320
+ var TypeError$3 = global$b.TypeError;
2321
+
2322
+ // `Assert: IsConstructor(argument) is true`
2323
+ var aConstructor$1 = function (argument) {
2324
+ if (isConstructor(argument)) return argument;
2325
+ throw TypeError$3(tryToString(argument) + ' is not a constructor');
2326
+ };
2327
+
2328
+ var anObject$3 = anObject$e;
2329
+ var aConstructor = aConstructor$1;
2330
+ var wellKnownSymbol$3 = wellKnownSymbol$i;
2331
+
2332
+ var SPECIES$2 = wellKnownSymbol$3('species');
2333
+
2334
+ // `SpeciesConstructor` abstract operation
2335
+ // https://tc39.es/ecma262/#sec-speciesconstructor
2336
+ var speciesConstructor$1 = function (O, defaultConstructor) {
2337
+ var C = anObject$3(O).constructor;
2338
+ var S;
2339
+ return C === undefined || (S = anObject$3(C)[SPECIES$2]) == undefined ? defaultConstructor : aConstructor(S);
2340
+ };
2341
+
2342
+ var NATIVE_BIND = functionBindNative;
2343
+
2344
+ var FunctionPrototype = Function.prototype;
2345
+ var apply$2 = FunctionPrototype.apply;
2346
+ var call$4 = FunctionPrototype.call;
2347
+
2348
+ // eslint-disable-next-line es/no-reflect -- safe
2349
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$4.bind(apply$2) : function () {
2350
+ return call$4.apply(apply$2, arguments);
2351
+ });
2352
+
2353
+ var uncurryThis$5 = functionUncurryThis;
2354
+
2355
+ var arraySlice$1 = uncurryThis$5([].slice);
2356
+
2357
+ var userAgent$2 = engineUserAgent;
2358
+
2359
+ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
2360
+
2361
+ var classof$1 = classofRaw$1;
2362
+ var global$a = global$G;
2363
+
2364
+ var engineIsNode = classof$1(global$a.process) == 'process';
2365
+
2366
+ var global$9 = global$G;
2367
+ var apply$1 = functionApply;
2368
+ var bind$2 = functionBindContext;
2369
+ var isCallable$3 = isCallable$j;
2370
+ var hasOwn = hasOwnProperty_1;
2371
+ var fails$5 = fails$i;
2372
+ var html = html$2;
2373
+ var arraySlice = arraySlice$1;
2374
+ var createElement = documentCreateElement$2;
2375
+ var IS_IOS$1 = engineIsIos;
2376
+ var IS_NODE$2 = engineIsNode;
2377
+
2378
+ var set = global$9.setImmediate;
2379
+ var clear = global$9.clearImmediate;
2380
+ var process$2 = global$9.process;
2381
+ var Dispatch = global$9.Dispatch;
2382
+ var Function$1 = global$9.Function;
2383
+ var MessageChannel = global$9.MessageChannel;
2384
+ var String$1 = global$9.String;
2385
+ var counter = 0;
2386
+ var queue$1 = {};
2387
+ var ONREADYSTATECHANGE = 'onreadystatechange';
2388
+ var location, defer, channel, port;
2389
+
2390
+ try {
2391
+ // Deno throws a ReferenceError on `location` access without `--location` flag
2392
+ location = global$9.location;
2393
+ } catch (error) { /* empty */ }
2394
+
2395
+ var run = function (id) {
2396
+ if (hasOwn(queue$1, id)) {
2397
+ var fn = queue$1[id];
2398
+ delete queue$1[id];
2399
+ fn();
2400
+ }
2401
+ };
2402
+
2403
+ var runner = function (id) {
2404
+ return function () {
2405
+ run(id);
2406
+ };
2407
+ };
2408
+
2409
+ var listener = function (event) {
2410
+ run(event.data);
2411
+ };
2412
+
2413
+ var post = function (id) {
2414
+ // old engines have not location.origin
2415
+ global$9.postMessage(String$1(id), location.protocol + '//' + location.host);
2416
+ };
2417
+
2418
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
2419
+ if (!set || !clear) {
2420
+ set = function setImmediate(fn) {
2421
+ var args = arraySlice(arguments, 1);
2422
+ queue$1[++counter] = function () {
2423
+ apply$1(isCallable$3(fn) ? fn : Function$1(fn), undefined, args);
2424
+ };
2425
+ defer(counter);
2426
+ return counter;
2427
+ };
2428
+ clear = function clearImmediate(id) {
2429
+ delete queue$1[id];
2430
+ };
2431
+ // Node.js 0.8-
2432
+ if (IS_NODE$2) {
2433
+ defer = function (id) {
2434
+ process$2.nextTick(runner(id));
2435
+ };
2436
+ // Sphere (JS game engine) Dispatch API
2437
+ } else if (Dispatch && Dispatch.now) {
2438
+ defer = function (id) {
2439
+ Dispatch.now(runner(id));
2440
+ };
2441
+ // Browsers with MessageChannel, includes WebWorkers
2442
+ // except iOS - https://github.com/zloirock/core-js/issues/624
2443
+ } else if (MessageChannel && !IS_IOS$1) {
2444
+ channel = new MessageChannel();
2445
+ port = channel.port2;
2446
+ channel.port1.onmessage = listener;
2447
+ defer = bind$2(port.postMessage, port);
2448
+ // Browsers with postMessage, skip WebWorkers
2449
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
2450
+ } else if (
2451
+ global$9.addEventListener &&
2452
+ isCallable$3(global$9.postMessage) &&
2453
+ !global$9.importScripts &&
2454
+ location && location.protocol !== 'file:' &&
2455
+ !fails$5(post)
2456
+ ) {
2457
+ defer = post;
2458
+ global$9.addEventListener('message', listener, false);
2459
+ // IE8-
2460
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
2461
+ defer = function (id) {
2462
+ html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
2463
+ html.removeChild(this);
2464
+ run(id);
2465
+ };
2466
+ };
2467
+ // Rest old browsers
2468
+ } else {
2469
+ defer = function (id) {
2470
+ setTimeout(runner(id), 0);
2471
+ };
2472
+ }
2473
+ }
2474
+
2475
+ var task$1 = {
2476
+ set: set,
2477
+ clear: clear
2478
+ };
2479
+
2480
+ var userAgent$1 = engineUserAgent;
2481
+ var global$8 = global$G;
2482
+
2483
+ var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && global$8.Pebble !== undefined;
2484
+
2485
+ var userAgent = engineUserAgent;
2486
+
2487
+ var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
2488
+
2489
+ var global$7 = global$G;
2490
+ var bind$1 = functionBindContext;
2491
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
2492
+ var macrotask = task$1.set;
2493
+ var IS_IOS = engineIsIos;
2494
+ var IS_IOS_PEBBLE = engineIsIosPebble;
2495
+ var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
2496
+ var IS_NODE$1 = engineIsNode;
2497
+
2498
+ var MutationObserver = global$7.MutationObserver || global$7.WebKitMutationObserver;
2499
+ var document$2 = global$7.document;
2500
+ var process$1 = global$7.process;
2501
+ var Promise$1 = global$7.Promise;
2502
+ // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
2503
+ var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$7, 'queueMicrotask');
2504
+ var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
2505
+
2506
+ var flush, head, last, notify$1, toggle, node, promise, then;
2507
+
2508
+ // modern engines have queueMicrotask method
2509
+ if (!queueMicrotask) {
2510
+ flush = function () {
2511
+ var parent, fn;
2512
+ if (IS_NODE$1 && (parent = process$1.domain)) parent.exit();
2513
+ while (head) {
2514
+ fn = head.fn;
2515
+ head = head.next;
2516
+ try {
2517
+ fn();
2518
+ } catch (error) {
2519
+ if (head) notify$1();
2520
+ else last = undefined;
2521
+ throw error;
2522
+ }
2523
+ } last = undefined;
2524
+ if (parent) parent.enter();
2525
+ };
2526
+
2527
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
2528
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
2529
+ if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
2530
+ toggle = true;
2531
+ node = document$2.createTextNode('');
2532
+ new MutationObserver(flush).observe(node, { characterData: true });
2533
+ notify$1 = function () {
2534
+ node.data = toggle = !toggle;
2535
+ };
2536
+ // environments with maybe non-completely correct, but existent Promise
2537
+ } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
2538
+ // Promise.resolve without an argument throws an error in LG WebOS 2
2539
+ promise = Promise$1.resolve(undefined);
2540
+ // workaround of WebKit ~ iOS Safari 10.1 bug
2541
+ promise.constructor = Promise$1;
2542
+ then = bind$1(promise.then, promise);
2543
+ notify$1 = function () {
2544
+ then(flush);
2545
+ };
2546
+ // Node.js without promises
2547
+ } else if (IS_NODE$1) {
2548
+ notify$1 = function () {
2549
+ process$1.nextTick(flush);
2550
+ };
2551
+ // for other environments - macrotask based on:
2552
+ // - setImmediate
2553
+ // - MessageChannel
2554
+ // - window.postMessag
2555
+ // - onreadystatechange
2556
+ // - setTimeout
2557
+ } else {
2558
+ // strange IE + webpack dev server bug - use .bind(global)
2559
+ macrotask = bind$1(macrotask, global$7);
2560
+ notify$1 = function () {
2561
+ macrotask(flush);
2562
+ };
2563
+ }
2564
+ }
2565
+
2566
+ var microtask$1 = queueMicrotask || function (fn) {
2567
+ var task = { fn: fn, next: undefined };
2568
+ if (last) last.next = task;
2569
+ if (!head) {
2570
+ head = task;
2571
+ notify$1();
2572
+ } last = task;
2573
+ };
2574
+
2575
+ var newPromiseCapability$2 = {};
2576
+
2577
+ var aCallable$1 = aCallable$5;
2578
+
2579
+ var PromiseCapability = function (C) {
2580
+ var resolve, reject;
2581
+ this.promise = new C(function ($$resolve, $$reject) {
2582
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
2583
+ resolve = $$resolve;
2584
+ reject = $$reject;
2585
+ });
2586
+ this.resolve = aCallable$1(resolve);
2587
+ this.reject = aCallable$1(reject);
2588
+ };
2589
+
2590
+ // `NewPromiseCapability` abstract operation
2591
+ // https://tc39.es/ecma262/#sec-newpromisecapability
2592
+ newPromiseCapability$2.f = function (C) {
2593
+ return new PromiseCapability(C);
2594
+ };
2595
+
2596
+ var anObject$2 = anObject$e;
2597
+ var isObject$1 = isObject$8;
2598
+ var newPromiseCapability$1 = newPromiseCapability$2;
2599
+
2600
+ var promiseResolve$1 = function (C, x) {
2601
+ anObject$2(C);
2602
+ if (isObject$1(x) && x.constructor === C) return x;
2603
+ var promiseCapability = newPromiseCapability$1.f(C);
2604
+ var resolve = promiseCapability.resolve;
2605
+ resolve(x);
2606
+ return promiseCapability.promise;
2607
+ };
2608
+
2609
+ var global$6 = global$G;
2610
+
2611
+ var hostReportErrors$1 = function (a, b) {
2612
+ var console = global$6.console;
2613
+ if (console && console.error) {
2614
+ arguments.length == 1 ? console.error(a) : console.error(a, b);
2615
+ }
2616
+ };
2617
+
2618
+ var perform$1 = function (exec) {
2619
+ try {
2620
+ return { error: false, value: exec() };
2621
+ } catch (error) {
2622
+ return { error: true, value: error };
2623
+ }
2624
+ };
2625
+
2626
+ var Queue$1 = function () {
2627
+ this.head = null;
2628
+ this.tail = null;
2629
+ };
2630
+
2631
+ Queue$1.prototype = {
2632
+ add: function (item) {
2633
+ var entry = { item: item, next: null };
2634
+ if (this.head) this.tail.next = entry;
2635
+ else this.head = entry;
2636
+ this.tail = entry;
2637
+ },
2638
+ get: function () {
2639
+ var entry = this.head;
2640
+ if (entry) {
2641
+ this.head = entry.next;
2642
+ if (this.tail === entry) this.tail = null;
2643
+ return entry.item;
2644
+ }
2645
+ }
2646
+ };
2647
+
2648
+ var queue = Queue$1;
2649
+
2650
+ var engineIsBrowser = typeof window == 'object';
2651
+
2652
+ var $$1 = _export;
2653
+ var global$5 = global$G;
2654
+ var getBuiltIn = getBuiltIn$7;
2655
+ var call$3 = functionCall;
2656
+ var NativePromise = nativePromiseConstructor;
2657
+ var redefine$1 = redefine$7.exports;
2658
+ var redefineAll = redefineAll$1;
2659
+ var setPrototypeOf = objectSetPrototypeOf;
2660
+ var setToStringTag = setToStringTag$3;
2661
+ var setSpecies = setSpecies$1;
2662
+ var aCallable = aCallable$5;
2663
+ var isCallable$2 = isCallable$j;
2664
+ var isObject = isObject$8;
2665
+ var anInstance = anInstance$1;
2666
+ var inspectSource = inspectSource$4;
2667
+ var iterate = iterate$1;
2668
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
2669
+ var speciesConstructor = speciesConstructor$1;
2670
+ var task = task$1.set;
2671
+ var microtask = microtask$1;
2672
+ var promiseResolve = promiseResolve$1;
2673
+ var hostReportErrors = hostReportErrors$1;
2674
+ var newPromiseCapabilityModule = newPromiseCapability$2;
2675
+ var perform = perform$1;
2676
+ var Queue = queue;
2677
+ var InternalStateModule = internalState;
2678
+ var isForced = isForced_1;
2679
+ var wellKnownSymbol$2 = wellKnownSymbol$i;
2680
+ var IS_BROWSER = engineIsBrowser;
2681
+ var IS_NODE = engineIsNode;
2682
+ var V8_VERSION = engineV8Version;
2683
+
2684
+ var SPECIES$1 = wellKnownSymbol$2('species');
2685
+ var PROMISE = 'Promise';
2686
+
2687
+ var getInternalState$1 = InternalStateModule.getterFor(PROMISE);
2688
+ var setInternalState = InternalStateModule.set;
2689
+ var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
2690
+ var NativePromisePrototype = NativePromise && NativePromise.prototype;
2691
+ var PromiseConstructor = NativePromise;
2692
+ var PromisePrototype = NativePromisePrototype;
2693
+ var TypeError$2 = global$5.TypeError;
2694
+ var document$1 = global$5.document;
2695
+ var process = global$5.process;
2696
+ var newPromiseCapability = newPromiseCapabilityModule.f;
2697
+ var newGenericPromiseCapability = newPromiseCapability;
2698
+
2699
+ var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$5.dispatchEvent);
2700
+ var NATIVE_REJECTION_EVENT = isCallable$2(global$5.PromiseRejectionEvent);
2701
+ var UNHANDLED_REJECTION = 'unhandledrejection';
2702
+ var REJECTION_HANDLED = 'rejectionhandled';
2703
+ var PENDING = 0;
2704
+ var FULFILLED = 1;
2705
+ var REJECTED = 2;
2706
+ var HANDLED = 1;
2707
+ var UNHANDLED = 2;
2708
+ var SUBCLASSING = false;
2709
+
2710
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
2711
+
2712
+ var FORCED = isForced(PROMISE, function () {
2713
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
2714
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
2715
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
2716
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
2717
+ // We can't detect it synchronously, so just check versions
2718
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
2719
+ // We can't use @@species feature detection in V8 since it causes
2720
+ // deoptimization and performance degradation
2721
+ // https://github.com/zloirock/core-js/issues/679
2722
+ if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
2723
+ // Detect correctness of subclassing with @@species support
2724
+ var promise = new PromiseConstructor(function (resolve) { resolve(1); });
2725
+ var FakePromise = function (exec) {
2726
+ exec(function () { /* empty */ }, function () { /* empty */ });
2727
+ };
2728
+ var constructor = promise.constructor = {};
2729
+ constructor[SPECIES$1] = FakePromise;
2730
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
2731
+ if (!SUBCLASSING) return true;
2732
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
2733
+ return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
2734
+ });
2735
+
2736
+ var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
2737
+ PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
2738
+ });
2739
+
2740
+ // helpers
2741
+ var isThenable = function (it) {
2742
+ var then;
2743
+ return isObject(it) && isCallable$2(then = it.then) ? then : false;
2744
+ };
2745
+
2746
+ var callReaction = function (reaction, state) {
2747
+ var value = state.value;
2748
+ var ok = state.state == FULFILLED;
2749
+ var handler = ok ? reaction.ok : reaction.fail;
2750
+ var resolve = reaction.resolve;
2751
+ var reject = reaction.reject;
2752
+ var domain = reaction.domain;
2753
+ var result, then, exited;
2754
+ try {
2755
+ if (handler) {
2756
+ if (!ok) {
2757
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
2758
+ state.rejection = HANDLED;
2759
+ }
2760
+ if (handler === true) result = value;
2761
+ else {
2762
+ if (domain) domain.enter();
2763
+ result = handler(value); // can throw
2764
+ if (domain) {
2765
+ domain.exit();
2766
+ exited = true;
2767
+ }
2768
+ }
2769
+ if (result === reaction.promise) {
2770
+ reject(TypeError$2('Promise-chain cycle'));
2771
+ } else if (then = isThenable(result)) {
2772
+ call$3(then, result, resolve, reject);
2773
+ } else resolve(result);
2774
+ } else reject(value);
2775
+ } catch (error) {
2776
+ if (domain && !exited) domain.exit();
2777
+ reject(error);
2778
+ }
2779
+ };
2780
+
2781
+ var notify = function (state, isReject) {
2782
+ if (state.notified) return;
2783
+ state.notified = true;
2784
+ microtask(function () {
2785
+ var reactions = state.reactions;
2786
+ var reaction;
2787
+ while (reaction = reactions.get()) {
2788
+ callReaction(reaction, state);
2789
+ }
2790
+ state.notified = false;
2791
+ if (isReject && !state.rejection) onUnhandled(state);
2792
+ });
2793
+ };
2794
+
2795
+ var dispatchEvent = function (name, promise, reason) {
2796
+ var event, handler;
2797
+ if (DISPATCH_EVENT) {
2798
+ event = document$1.createEvent('Event');
2799
+ event.promise = promise;
2800
+ event.reason = reason;
2801
+ event.initEvent(name, false, true);
2802
+ global$5.dispatchEvent(event);
2803
+ } else event = { promise: promise, reason: reason };
2804
+ if (!NATIVE_REJECTION_EVENT && (handler = global$5['on' + name])) handler(event);
2805
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
2806
+ };
2807
+
2808
+ var onUnhandled = function (state) {
2809
+ call$3(task, global$5, function () {
2810
+ var promise = state.facade;
2811
+ var value = state.value;
2812
+ var IS_UNHANDLED = isUnhandled(state);
2813
+ var result;
2814
+ if (IS_UNHANDLED) {
2815
+ result = perform(function () {
2816
+ if (IS_NODE) {
2817
+ process.emit('unhandledRejection', value, promise);
2818
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
2819
+ });
2820
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
2821
+ state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
2822
+ if (result.error) throw result.value;
2823
+ }
2824
+ });
2825
+ };
2826
+
2827
+ var isUnhandled = function (state) {
2828
+ return state.rejection !== HANDLED && !state.parent;
2829
+ };
2830
+
2831
+ var onHandleUnhandled = function (state) {
2832
+ call$3(task, global$5, function () {
2833
+ var promise = state.facade;
2834
+ if (IS_NODE) {
2835
+ process.emit('rejectionHandled', promise);
2836
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
2837
+ });
2838
+ };
2839
+
2840
+ var bind = function (fn, state, unwrap) {
2841
+ return function (value) {
2842
+ fn(state, value, unwrap);
2843
+ };
2844
+ };
2845
+
2846
+ var internalReject = function (state, value, unwrap) {
2847
+ if (state.done) return;
2848
+ state.done = true;
2849
+ if (unwrap) state = unwrap;
2850
+ state.value = value;
2851
+ state.state = REJECTED;
2852
+ notify(state, true);
2853
+ };
2854
+
2855
+ var internalResolve = function (state, value, unwrap) {
2856
+ if (state.done) return;
2857
+ state.done = true;
2858
+ if (unwrap) state = unwrap;
2859
+ try {
2860
+ if (state.facade === value) throw TypeError$2("Promise can't be resolved itself");
2861
+ var then = isThenable(value);
2862
+ if (then) {
2863
+ microtask(function () {
2864
+ var wrapper = { done: false };
2865
+ try {
2866
+ call$3(then, value,
2867
+ bind(internalResolve, wrapper, state),
2868
+ bind(internalReject, wrapper, state)
2869
+ );
2870
+ } catch (error) {
2871
+ internalReject(wrapper, error, state);
2872
+ }
2873
+ });
2874
+ } else {
2875
+ state.value = value;
2876
+ state.state = FULFILLED;
2877
+ notify(state, false);
2878
+ }
2879
+ } catch (error) {
2880
+ internalReject({ done: false }, error, state);
2881
+ }
2882
+ };
2883
+
2884
+ // constructor polyfill
2885
+ if (FORCED) {
2886
+ // 25.4.3.1 Promise(executor)
2887
+ PromiseConstructor = function Promise(executor) {
2888
+ anInstance(this, PromisePrototype);
2889
+ aCallable(executor);
2890
+ call$3(Internal, this);
2891
+ var state = getInternalState$1(this);
2892
+ try {
2893
+ executor(bind(internalResolve, state), bind(internalReject, state));
2894
+ } catch (error) {
2895
+ internalReject(state, error);
2896
+ }
2897
+ };
2898
+ PromisePrototype = PromiseConstructor.prototype;
2899
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
2900
+ Internal = function Promise(executor) {
2901
+ setInternalState(this, {
2902
+ type: PROMISE,
2903
+ done: false,
2904
+ notified: false,
2905
+ parent: false,
2906
+ reactions: new Queue(),
2907
+ rejection: false,
2908
+ state: PENDING,
2909
+ value: undefined
2910
+ });
2911
+ };
2912
+ Internal.prototype = redefineAll(PromisePrototype, {
2913
+ // `Promise.prototype.then` method
2914
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
2915
+ // eslint-disable-next-line unicorn/no-thenable -- safe
2916
+ then: function then(onFulfilled, onRejected) {
2917
+ var state = getInternalPromiseState(this);
2918
+ var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
2919
+ state.parent = true;
2920
+ reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
2921
+ reaction.fail = isCallable$2(onRejected) && onRejected;
2922
+ reaction.domain = IS_NODE ? process.domain : undefined;
2923
+ if (state.state == PENDING) state.reactions.add(reaction);
2924
+ else microtask(function () {
2925
+ callReaction(reaction, state);
2926
+ });
2927
+ return reaction.promise;
2928
+ },
2929
+ // `Promise.prototype.catch` method
2930
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
2931
+ 'catch': function (onRejected) {
2932
+ return this.then(undefined, onRejected);
2933
+ }
2934
+ });
2935
+ OwnPromiseCapability = function () {
2936
+ var promise = new Internal();
2937
+ var state = getInternalState$1(promise);
2938
+ this.promise = promise;
2939
+ this.resolve = bind(internalResolve, state);
2940
+ this.reject = bind(internalReject, state);
2941
+ };
2942
+ newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
2943
+ return C === PromiseConstructor || C === PromiseWrapper
2944
+ ? new OwnPromiseCapability(C)
2945
+ : newGenericPromiseCapability(C);
2946
+ };
2947
+
2948
+ if (isCallable$2(NativePromise) && NativePromisePrototype !== Object.prototype) {
2949
+ nativeThen = NativePromisePrototype.then;
2950
+
2951
+ if (!SUBCLASSING) {
2952
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
2953
+ redefine$1(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
2954
+ var that = this;
2955
+ return new PromiseConstructor(function (resolve, reject) {
2956
+ call$3(nativeThen, that, resolve, reject);
2957
+ }).then(onFulfilled, onRejected);
2958
+ // https://github.com/zloirock/core-js/issues/640
2959
+ }, { unsafe: true });
2960
+
2961
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2962
+ redefine$1(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
2963
+ }
2964
+
2965
+ // make `.constructor === Promise` work for native promise-based APIs
2966
+ try {
2967
+ delete NativePromisePrototype.constructor;
2968
+ } catch (error) { /* empty */ }
2969
+
2970
+ // make `instanceof Promise` work for native promise-based APIs
2971
+ if (setPrototypeOf) {
2972
+ setPrototypeOf(NativePromisePrototype, PromisePrototype);
2973
+ }
2974
+ }
2975
+ }
2976
+
2977
+ $$1({ global: true, wrap: true, forced: FORCED }, {
2978
+ Promise: PromiseConstructor
2979
+ });
2980
+
2981
+ setToStringTag(PromiseConstructor, PROMISE, false);
2982
+ setSpecies(PROMISE);
2983
+
2984
+ PromiseWrapper = getBuiltIn(PROMISE);
2985
+
2986
+ // statics
2987
+ $$1({ target: PROMISE, stat: true, forced: FORCED }, {
2988
+ // `Promise.reject` method
2989
+ // https://tc39.es/ecma262/#sec-promise.reject
2990
+ reject: function reject(r) {
2991
+ var capability = newPromiseCapability(this);
2992
+ call$3(capability.reject, undefined, r);
2993
+ return capability.promise;
2994
+ }
2995
+ });
2996
+
2997
+ $$1({ target: PROMISE, stat: true, forced: FORCED }, {
2998
+ // `Promise.resolve` method
2999
+ // https://tc39.es/ecma262/#sec-promise.resolve
3000
+ resolve: function resolve(x) {
3001
+ return promiseResolve(this, x);
3002
+ }
3003
+ });
3004
+
3005
+ $$1({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
3006
+ // `Promise.all` method
3007
+ // https://tc39.es/ecma262/#sec-promise.all
3008
+ all: function all(iterable) {
3009
+ var C = this;
3010
+ var capability = newPromiseCapability(C);
3011
+ var resolve = capability.resolve;
3012
+ var reject = capability.reject;
3013
+ var result = perform(function () {
3014
+ var $promiseResolve = aCallable(C.resolve);
3015
+ var values = [];
3016
+ var counter = 0;
3017
+ var remaining = 1;
3018
+ iterate(iterable, function (promise) {
3019
+ var index = counter++;
3020
+ var alreadyCalled = false;
3021
+ remaining++;
3022
+ call$3($promiseResolve, C, promise).then(function (value) {
3023
+ if (alreadyCalled) return;
3024
+ alreadyCalled = true;
3025
+ values[index] = value;
3026
+ --remaining || resolve(values);
3027
+ }, reject);
3028
+ });
3029
+ --remaining || resolve(values);
3030
+ });
3031
+ if (result.error) reject(result.value);
3032
+ return capability.promise;
3033
+ },
3034
+ // `Promise.race` method
3035
+ // https://tc39.es/ecma262/#sec-promise.race
3036
+ race: function race(iterable) {
3037
+ var C = this;
3038
+ var capability = newPromiseCapability(C);
3039
+ var reject = capability.reject;
3040
+ var result = perform(function () {
3041
+ var $promiseResolve = aCallable(C.resolve);
3042
+ iterate(iterable, function (promise) {
3043
+ call$3($promiseResolve, C, promise).then(capability.resolve, reject);
3044
+ });
3045
+ });
3046
+ if (result.error) reject(result.value);
3047
+ return capability.promise;
3048
+ }
3049
+ });
3050
+
3051
+ var fails$4 = fails$i;
3052
+ var global$4 = global$G;
3053
+
3054
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
3055
+ var $RegExp$2 = global$4.RegExp;
3056
+
3057
+ var UNSUPPORTED_Y$1 = fails$4(function () {
3058
+ var re = $RegExp$2('a', 'y');
3059
+ re.lastIndex = 2;
3060
+ return re.exec('abcd') != null;
3061
+ });
3062
+
3063
+ // UC Browser bug
3064
+ // https://github.com/zloirock/core-js/issues/1008
3065
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$4(function () {
3066
+ return !$RegExp$2('a', 'y').sticky;
3067
+ });
3068
+
3069
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$4(function () {
3070
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
3071
+ var re = $RegExp$2('^r', 'gy');
3072
+ re.lastIndex = 2;
3073
+ return re.exec('str') != null;
3074
+ });
3075
+
3076
+ var regexpStickyHelpers = {
3077
+ BROKEN_CARET: BROKEN_CARET,
3078
+ MISSED_STICKY: MISSED_STICKY,
3079
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
3080
+ };
3081
+
3082
+ var fails$3 = fails$i;
3083
+ var global$3 = global$G;
3084
+
3085
+ // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
3086
+ var $RegExp$1 = global$3.RegExp;
3087
+
3088
+ var regexpUnsupportedDotAll = fails$3(function () {
3089
+ var re = $RegExp$1('.', 's');
3090
+ return !(re.dotAll && re.exec('\n') && re.flags === 's');
3091
+ });
3092
+
3093
+ var fails$2 = fails$i;
3094
+ var global$2 = global$G;
3095
+
3096
+ // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
3097
+ var $RegExp = global$2.RegExp;
3098
+
3099
+ var regexpUnsupportedNcg = fails$2(function () {
3100
+ var re = $RegExp('(?<a>b)', 'g');
3101
+ return re.exec('b').groups.a !== 'b' ||
3102
+ 'b'.replace(re, '$<a>c') !== 'bc';
3103
+ });
3104
+
3105
+ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
3106
+ /* eslint-disable regexp/no-useless-quantifier -- testing */
3107
+ var call$2 = functionCall;
3108
+ var uncurryThis$4 = functionUncurryThis;
3109
+ var toString$2 = toString$5;
3110
+ var regexpFlags = regexpFlags$1;
3111
+ var stickyHelpers = regexpStickyHelpers;
3112
+ var shared = shared$4.exports;
3113
+ var create = objectCreate;
3114
+ var getInternalState = internalState.get;
3115
+ var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
3116
+ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
3117
+
3118
+ var nativeReplace = shared('native-string-replace', String.prototype.replace);
3119
+ var nativeExec = RegExp.prototype.exec;
3120
+ var patchedExec = nativeExec;
3121
+ var charAt$3 = uncurryThis$4(''.charAt);
3122
+ var indexOf = uncurryThis$4(''.indexOf);
3123
+ var replace$1 = uncurryThis$4(''.replace);
3124
+ var stringSlice$3 = uncurryThis$4(''.slice);
3125
+
3126
+ var UPDATES_LAST_INDEX_WRONG = (function () {
3127
+ var re1 = /a/;
3128
+ var re2 = /b*/g;
3129
+ call$2(nativeExec, re1, 'a');
3130
+ call$2(nativeExec, re2, 'a');
3131
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
3132
+ })();
3133
+
3134
+ var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
3135
+
3136
+ // nonparticipating capturing group, copied from es5-shim's String#split patch.
3137
+ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
3138
+
3139
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
3140
+
3141
+ if (PATCH) {
3142
+ patchedExec = function exec(string) {
3143
+ var re = this;
3144
+ var state = getInternalState(re);
3145
+ var str = toString$2(string);
3146
+ var raw = state.raw;
3147
+ var result, reCopy, lastIndex, match, i, object, group;
3148
+
3149
+ if (raw) {
3150
+ raw.lastIndex = re.lastIndex;
3151
+ result = call$2(patchedExec, raw, str);
3152
+ re.lastIndex = raw.lastIndex;
3153
+ return result;
3154
+ }
3155
+
3156
+ var groups = state.groups;
3157
+ var sticky = UNSUPPORTED_Y && re.sticky;
3158
+ var flags = call$2(regexpFlags, re);
3159
+ var source = re.source;
3160
+ var charsAdded = 0;
3161
+ var strCopy = str;
3162
+
3163
+ if (sticky) {
3164
+ flags = replace$1(flags, 'y', '');
3165
+ if (indexOf(flags, 'g') === -1) {
3166
+ flags += 'g';
3167
+ }
3168
+
3169
+ strCopy = stringSlice$3(str, re.lastIndex);
3170
+ // Support anchored sticky behavior.
3171
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
3172
+ source = '(?: ' + source + ')';
3173
+ strCopy = ' ' + strCopy;
3174
+ charsAdded++;
3175
+ }
3176
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
3177
+ // simulate the 'y' flag.
3178
+ reCopy = new RegExp('^(?:' + source + ')', flags);
3179
+ }
3180
+
3181
+ if (NPCG_INCLUDED) {
3182
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
3183
+ }
3184
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
3185
+
3186
+ match = call$2(nativeExec, sticky ? reCopy : re, strCopy);
3187
+
3188
+ if (sticky) {
3189
+ if (match) {
3190
+ match.input = stringSlice$3(match.input, charsAdded);
3191
+ match[0] = stringSlice$3(match[0], charsAdded);
3192
+ match.index = re.lastIndex;
3193
+ re.lastIndex += match[0].length;
3194
+ } else re.lastIndex = 0;
3195
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
3196
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
3197
+ }
3198
+ if (NPCG_INCLUDED && match && match.length > 1) {
3199
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
3200
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
3201
+ call$2(nativeReplace, match[0], reCopy, function () {
3202
+ for (i = 1; i < arguments.length - 2; i++) {
3203
+ if (arguments[i] === undefined) match[i] = undefined;
3204
+ }
3205
+ });
3206
+ }
3207
+
3208
+ if (match && groups) {
3209
+ match.groups = object = create(null);
3210
+ for (i = 0; i < groups.length; i++) {
3211
+ group = groups[i];
3212
+ object[group[0]] = match[group[1]];
3213
+ }
3214
+ }
3215
+
3216
+ return match;
3217
+ };
3218
+ }
3219
+
3220
+ var regexpExec$2 = patchedExec;
3221
+
3222
+ var $ = _export;
3223
+ var exec = regexpExec$2;
3224
+
3225
+ // `RegExp.prototype.exec` method
3226
+ // https://tc39.es/ecma262/#sec-regexp.prototype.exec
3227
+ $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
3228
+ exec: exec
3229
+ });
3230
+
3231
+ // TODO: Remove from `core-js@4` since it's moved to entry points
3232
+
3233
+ var uncurryThis$3 = functionUncurryThis;
3234
+ var redefine = redefine$7.exports;
3235
+ var regexpExec$1 = regexpExec$2;
3236
+ var fails$1 = fails$i;
3237
+ var wellKnownSymbol$1 = wellKnownSymbol$i;
3238
+ var createNonEnumerableProperty = createNonEnumerableProperty$6;
3239
+
3240
+ var SPECIES = wellKnownSymbol$1('species');
3241
+ var RegExpPrototype = RegExp.prototype;
3242
+
3243
+ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
3244
+ var SYMBOL = wellKnownSymbol$1(KEY);
3245
+
3246
+ var DELEGATES_TO_SYMBOL = !fails$1(function () {
3247
+ // String methods call symbol-named RegEp methods
3248
+ var O = {};
3249
+ O[SYMBOL] = function () { return 7; };
3250
+ return ''[KEY](O) != 7;
3251
+ });
3252
+
3253
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$1(function () {
3254
+ // Symbol-named RegExp methods call .exec
3255
+ var execCalled = false;
3256
+ var re = /a/;
3257
+
3258
+ if (KEY === 'split') {
3259
+ // We can't use real regex here since it causes deoptimization
3260
+ // and serious performance degradation in V8
3261
+ // https://github.com/zloirock/core-js/issues/306
3262
+ re = {};
3263
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
3264
+ // a new one. We need to return the patched regex when creating the new one.
3265
+ re.constructor = {};
3266
+ re.constructor[SPECIES] = function () { return re; };
3267
+ re.flags = '';
3268
+ re[SYMBOL] = /./[SYMBOL];
3269
+ }
3270
+
3271
+ re.exec = function () { execCalled = true; return null; };
3272
+
3273
+ re[SYMBOL]('');
3274
+ return !execCalled;
3275
+ });
3276
+
3277
+ if (
3278
+ !DELEGATES_TO_SYMBOL ||
3279
+ !DELEGATES_TO_EXEC ||
3280
+ FORCED
3281
+ ) {
3282
+ var uncurriedNativeRegExpMethod = uncurryThis$3(/./[SYMBOL]);
3283
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
3284
+ var uncurriedNativeMethod = uncurryThis$3(nativeMethod);
3285
+ var $exec = regexp.exec;
3286
+ if ($exec === regexpExec$1 || $exec === RegExpPrototype.exec) {
3287
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
3288
+ // The native String method already delegates to @@method (this
3289
+ // polyfilled function), leasing to infinite recursion.
3290
+ // We avoid it by directly calling the native @@method method.
3291
+ return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
3292
+ }
3293
+ return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
3294
+ }
3295
+ return { done: false };
3296
+ });
3297
+
3298
+ redefine(String.prototype, KEY, methods[0]);
3299
+ redefine(RegExpPrototype, SYMBOL, methods[1]);
3300
+ }
3301
+
3302
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
3303
+ };
3304
+
3305
+ var uncurryThis$2 = functionUncurryThis;
3306
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
3307
+ var toString$1 = toString$5;
3308
+ var requireObjectCoercible$1 = requireObjectCoercible$6;
3309
+
3310
+ var charAt$2 = uncurryThis$2(''.charAt);
3311
+ var charCodeAt = uncurryThis$2(''.charCodeAt);
3312
+ var stringSlice$2 = uncurryThis$2(''.slice);
3313
+
3314
+ var createMethod = function (CONVERT_TO_STRING) {
3315
+ return function ($this, pos) {
3316
+ var S = toString$1(requireObjectCoercible$1($this));
3317
+ var position = toIntegerOrInfinity$1(pos);
3318
+ var size = S.length;
3319
+ var first, second;
3320
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
3321
+ first = charCodeAt(S, position);
3322
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
3323
+ || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
3324
+ ? CONVERT_TO_STRING
3325
+ ? charAt$2(S, position)
3326
+ : first
3327
+ : CONVERT_TO_STRING
3328
+ ? stringSlice$2(S, position, position + 2)
3329
+ : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
3330
+ };
3331
+ };
3332
+
3333
+ var stringMultibyte = {
3334
+ // `String.prototype.codePointAt` method
3335
+ // https://tc39.es/ecma262/#sec-string.prototype.codepointat
3336
+ codeAt: createMethod(false),
3337
+ // `String.prototype.at` method
3338
+ // https://github.com/mathiasbynens/String.prototype.at
3339
+ charAt: createMethod(true)
3340
+ };
3341
+
3342
+ var charAt$1 = stringMultibyte.charAt;
3343
+
3344
+ // `AdvanceStringIndex` abstract operation
3345
+ // https://tc39.es/ecma262/#sec-advancestringindex
3346
+ var advanceStringIndex$1 = function (S, index, unicode) {
3347
+ return index + (unicode ? charAt$1(S, index).length : 1);
3348
+ };
3349
+
3350
+ var uncurryThis$1 = functionUncurryThis;
3351
+ var toObject = toObject$4;
3352
+
3353
+ var floor = Math.floor;
3354
+ var charAt = uncurryThis$1(''.charAt);
3355
+ var replace = uncurryThis$1(''.replace);
3356
+ var stringSlice$1 = uncurryThis$1(''.slice);
3357
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
3358
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
3359
+
3360
+ // `GetSubstitution` abstract operation
3361
+ // https://tc39.es/ecma262/#sec-getsubstitution
3362
+ var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
3363
+ var tailPos = position + matched.length;
3364
+ var m = captures.length;
3365
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
3366
+ if (namedCaptures !== undefined) {
3367
+ namedCaptures = toObject(namedCaptures);
3368
+ symbols = SUBSTITUTION_SYMBOLS;
3369
+ }
3370
+ return replace(replacement, symbols, function (match, ch) {
3371
+ var capture;
3372
+ switch (charAt(ch, 0)) {
3373
+ case '$': return '$';
3374
+ case '&': return matched;
3375
+ case '`': return stringSlice$1(str, 0, position);
3376
+ case "'": return stringSlice$1(str, tailPos);
3377
+ case '<':
3378
+ capture = namedCaptures[stringSlice$1(ch, 1, -1)];
3379
+ break;
3380
+ default: // \d\d?
3381
+ var n = +ch;
3382
+ if (n === 0) return match;
3383
+ if (n > m) {
3384
+ var f = floor(n / 10);
3385
+ if (f === 0) return match;
3386
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
3387
+ return match;
3388
+ }
3389
+ capture = captures[n - 1];
3390
+ }
3391
+ return capture === undefined ? '' : capture;
3392
+ });
3393
+ };
3394
+
3395
+ var global$1 = global$G;
3396
+ var call$1 = functionCall;
3397
+ var anObject$1 = anObject$e;
3398
+ var isCallable$1 = isCallable$j;
3399
+ var classof = classofRaw$1;
3400
+ var regexpExec = regexpExec$2;
3401
+
3402
+ var TypeError$1 = global$1.TypeError;
3403
+
3404
+ // `RegExpExec` abstract operation
3405
+ // https://tc39.es/ecma262/#sec-regexpexec
3406
+ var regexpExecAbstract = function (R, S) {
3407
+ var exec = R.exec;
3408
+ if (isCallable$1(exec)) {
3409
+ var result = call$1(exec, R, S);
3410
+ if (result !== null) anObject$1(result);
3411
+ return result;
3412
+ }
3413
+ if (classof(R) === 'RegExp') return call$1(regexpExec, R, S);
3414
+ throw TypeError$1('RegExp#exec called on incompatible receiver');
3415
+ };
3416
+
3417
+ var apply = functionApply;
3418
+ var call = functionCall;
3419
+ var uncurryThis = functionUncurryThis;
3420
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
3421
+ var fails = fails$i;
3422
+ var anObject = anObject$e;
3423
+ var isCallable = isCallable$j;
3424
+ var toIntegerOrInfinity = toIntegerOrInfinity$4;
3425
+ var toLength = toLength$3;
3426
+ var toString = toString$5;
3427
+ var requireObjectCoercible = requireObjectCoercible$6;
3428
+ var advanceStringIndex = advanceStringIndex$1;
3429
+ var getMethod = getMethod$4;
3430
+ var getSubstitution = getSubstitution$1;
3431
+ var regExpExec = regexpExecAbstract;
3432
+ var wellKnownSymbol = wellKnownSymbol$i;
3433
+
3434
+ var REPLACE = wellKnownSymbol('replace');
3435
+ var max = Math.max;
3436
+ var min = Math.min;
3437
+ var concat = uncurryThis([].concat);
3438
+ var push = uncurryThis([].push);
3439
+ var stringIndexOf = uncurryThis(''.indexOf);
3440
+ var stringSlice = uncurryThis(''.slice);
3441
+
3442
+ var maybeToString = function (it) {
3443
+ return it === undefined ? it : String(it);
3444
+ };
3445
+
3446
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
3447
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
3448
+ var REPLACE_KEEPS_$0 = (function () {
3449
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
3450
+ return 'a'.replace(/./, '$0') === '$0';
3451
+ })();
3452
+
3453
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
3454
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
3455
+ if (/./[REPLACE]) {
3456
+ return /./[REPLACE]('a', '$0') === '';
3457
+ }
3458
+ return false;
3459
+ })();
3460
+
3461
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
3462
+ var re = /./;
3463
+ re.exec = function () {
3464
+ var result = [];
3465
+ result.groups = { a: '7' };
3466
+ return result;
3467
+ };
3468
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
3469
+ return ''.replace(re, '$<a>') !== '7';
3470
+ });
3471
+
3472
+ // @@replace logic
3473
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
3474
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
3475
+
3476
+ return [
3477
+ // `String.prototype.replace` method
3478
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
3479
+ function replace(searchValue, replaceValue) {
3480
+ var O = requireObjectCoercible(this);
3481
+ var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
3482
+ return replacer
3483
+ ? call(replacer, searchValue, O, replaceValue)
3484
+ : call(nativeReplace, toString(O), searchValue, replaceValue);
3485
+ },
3486
+ // `RegExp.prototype[@@replace]` method
3487
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
3488
+ function (string, replaceValue) {
3489
+ var rx = anObject(this);
3490
+ var S = toString(string);
3491
+
3492
+ if (
3493
+ typeof replaceValue == 'string' &&
3494
+ stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
3495
+ stringIndexOf(replaceValue, '$<') === -1
3496
+ ) {
3497
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
3498
+ if (res.done) return res.value;
3499
+ }
3500
+
3501
+ var functionalReplace = isCallable(replaceValue);
3502
+ if (!functionalReplace) replaceValue = toString(replaceValue);
3503
+
3504
+ var global = rx.global;
3505
+ if (global) {
3506
+ var fullUnicode = rx.unicode;
3507
+ rx.lastIndex = 0;
3508
+ }
3509
+ var results = [];
3510
+ while (true) {
3511
+ var result = regExpExec(rx, S);
3512
+ if (result === null) break;
3513
+
3514
+ push(results, result);
3515
+ if (!global) break;
3516
+
3517
+ var matchStr = toString(result[0]);
3518
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
3519
+ }
3520
+
3521
+ var accumulatedResult = '';
3522
+ var nextSourcePosition = 0;
3523
+ for (var i = 0; i < results.length; i++) {
3524
+ result = results[i];
3525
+
3526
+ var matched = toString(result[0]);
3527
+ var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
3528
+ var captures = [];
3529
+ // NOTE: This is equivalent to
3530
+ // captures = result.slice(1).map(maybeToString)
3531
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
3532
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
3533
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
3534
+ for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
3535
+ var namedCaptures = result.groups;
3536
+ if (functionalReplace) {
3537
+ var replacerArgs = concat([matched], captures, position, S);
3538
+ if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
3539
+ var replacement = toString(apply(replaceValue, undefined, replacerArgs));
3540
+ } else {
3541
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
3542
+ }
3543
+ if (position >= nextSourcePosition) {
3544
+ accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
3545
+ nextSourcePosition = position + matched.length;
3546
+ }
3547
+ }
3548
+ return accumulatedResult + stringSlice(S, nextSourcePosition);
3549
+ }
3550
+ ];
3551
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
3552
+
3553
+ /******************************************************************************
3554
+ Copyright (c) Microsoft Corporation.
3555
+
3556
+ Permission to use, copy, modify, and/or distribute this software for any
3557
+ purpose with or without fee is hereby granted.
3558
+
3559
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3560
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3561
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3562
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3563
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3564
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3565
+ PERFORMANCE OF THIS SOFTWARE.
3566
+ ***************************************************************************** */
3567
+
3568
+ function __awaiter(thisArg, _arguments, P, generator) {
3569
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3570
+ return new (P || (P = Promise))(function (resolve, reject) {
3571
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3572
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3573
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3574
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3575
+ });
3576
+ }
3577
+
3578
+ const MQTT_TIMEOUT_SECONDS = 3;
3579
+ const MQTT_TIMEOUT_MS = MQTT_TIMEOUT_SECONDS * 1000;
3580
+ const KEEP_ALIVE_SECONDS = 5;
3581
+ const RECONNECT_INTERVAL_MS = 1 * 1000; // 1 second
3582
+ function getClientId() {
3583
+ return "pendant_" + Math.random().toString(16).substr(2, 8);
3584
+ }
3585
+ class MqttClient {
3586
+ constructor(url, connectCallback) {
3587
+ this.subscriptions = [];
3588
+ this.connect(url, connectCallback);
3589
+ }
3590
+ connect(url, connectCallback) {
3591
+ const options = {
3592
+ connectTimeout: MQTT_TIMEOUT_MS,
3593
+ clientId: getClientId(),
3594
+ reconnectPeriod: 0,
3595
+ keepalive: KEEP_ALIVE_SECONDS
3596
+ };
3597
+ this.mqttClient = mqtt.connect(url, options);
3598
+ this.mqttClient.on("connect", () => {
3599
+ connectCallback === null || connectCallback === void 0 ? void 0 : connectCallback();
3600
+ });
3601
+ this.mqttClient.on("close", () => {
3602
+ var _a;
3603
+ console.warn("MQTT connection closed");
3604
+ (_a = this.mqttClient) === null || _a === void 0 ? void 0 : _a.end(true, {}, () => {
3605
+ console.log("MQTT connection ended");
3606
+ this.mqttClient = undefined;
3607
+ setTimeout(() => this.connect(url, connectCallback), RECONNECT_INTERVAL_MS);
3608
+ });
3609
+ });
3610
+ this.mqttClient.on("error", error => {
3611
+ console.error("Error encountered in mqtt client: ", error);
3612
+ });
3613
+ this.mqttClient.on("message", (topic, message) => {
3614
+ this.subscriptions.forEach(sub => {
3615
+ if (sub.pattern.test(topic)) {
3616
+ sub.callback(topic, message.toString());
3617
+ }
3618
+ });
3619
+ });
3620
+ }
3621
+ subscribe(topic, regex, cb) {
3622
+ var _a;
3623
+ this.subscriptions.push({
3624
+ pattern: regex,
3625
+ callback: cb
3626
+ });
3627
+ (_a = this.mqttClient) === null || _a === void 0 ? void 0 : _a.subscribe(topic, err => {
3628
+ if (err) {
3629
+ this.subscriptions = this.subscriptions.filter(sub => sub.pattern !== regex || sub.callback !== cb);
3630
+ console.error("Unable to subscribe to MQTT broker with error: ", err);
3631
+ }
3632
+ });
3633
+ }
3634
+ unsubscribe(topic, regex, cb) {
3635
+ var _a;
3636
+ this.subscriptions = this.subscriptions.filter(sub => sub.pattern !== regex || sub.callback !== cb);
3637
+ const sameTopicSubscriptions = this.subscriptions.filter(sub => String(sub.pattern) === String(regex));
3638
+ if (sameTopicSubscriptions.length <= 0) {
3639
+ (_a = this.mqttClient) === null || _a === void 0 ? void 0 : _a.unsubscribe(topic);
3640
+ }
3641
+ }
3642
+ publish(topic, message, retain = false) {
3643
+ var _a;
3644
+ const options = {
3645
+ retain
3646
+ };
3647
+ (_a = this.mqttClient) === null || _a === void 0 ? void 0 : _a.publish(topic, message, options);
3648
+ }
3649
+ }
3650
+
3651
+ const isTouchScreenDevice = () => "ontouchstart" in window || navigator.maxTouchPoints > 0;
3652
+ const isOnEdge = () => {
3653
+ return window.location.hostname.startsWith("192.168") || window.location.hostname.startsWith("localhost");
3654
+ };
3655
+ const getExecutionEngineHttpUrl = () => {
3656
+ const url = window.location.hostname;
3657
+ const executionEngineUrl = isOnEdge() ? `http://${url}:3100` : `${window.location.origin}/digital-twin/execution-engine`;
3658
+ return executionEngineUrl;
3659
+ };
3660
+ const getMqttWsUrl = () => __awaiter(void 0, void 0, void 0, function* () {
3661
+ if (isOnEdge()) {
3662
+ return `ws://${window.location.hostname}:9001`;
3663
+ }
3664
+ /**
3665
+ * We are not trying to allocate a new Machine Motion here. By the time a custom UI can be opened in the CAD (assembler),
3666
+ * we would have already been allocated a Virtual Machine Motion, and a repeated request to the
3667
+ * alloc endpoint will just re-return the connection details of the Virtual Machine Motion that
3668
+ * has already been allocated.
3669
+ */
3670
+ const response = yield fetch(`${window.location.origin}/orchestrator/allocator/vmm_connection_details`);
3671
+ const data = yield response.json();
3672
+ const url = `${data.message.host}/${data.message.token}/mqtt`;
3673
+ const websocketUrl = url.replace("https", "wss");
3674
+ return websocketUrl;
3675
+ });
3676
+ const connectToMqttAndGetClient = () => __awaiter(void 0, void 0, void 0, function* () {
3677
+ const websocketUrl = yield getMqttWsUrl();
3678
+ const mqttClient = new MqttClient(websocketUrl, () => console.log("Connected to MQTT Broker"));
3679
+ return mqttClient;
3680
+ });
3681
+ const getMachineCodeProcessHttpUrl = processName => {
3682
+ const executionEngineHttpUrl = getExecutionEngineHttpUrl();
3683
+ return `${executionEngineHttpUrl}/v1/machineCode/services/${processName}`;
3684
+ };
3685
+
3686
+ export { MqttClient, VirtualKeyboard, connectToMqttAndGetClient, getExecutionEngineHttpUrl, getMachineCodeProcessHttpUrl, getMqttWsUrl, isOnEdge, isTouchScreenDevice };