@dereekb/util 10.0.6 → 10.0.8

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/test/index.esm.js DELETED
@@ -1,2796 +0,0 @@
1
- import { isPromise, build, promiseReference, forwardFunction, mapObjectMap } from '@dereekb/util';
2
-
3
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
-
5
- var check = function (it) {
6
- return it && it.Math === Math && it;
7
- };
8
-
9
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
10
- var global$i =
11
- // eslint-disable-next-line es/no-global-this -- safe
12
- check(typeof globalThis == 'object' && globalThis) ||
13
- check(typeof window == 'object' && window) ||
14
- // eslint-disable-next-line no-restricted-globals -- safe
15
- check(typeof self == 'object' && self) ||
16
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
17
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
18
- // eslint-disable-next-line no-new-func -- fallback
19
- (function () { return this; })() || Function('return this')();
20
-
21
- var objectGetOwnPropertyDescriptor = {};
22
-
23
- var fails$a = function (exec) {
24
- try {
25
- return !!exec();
26
- } catch (error) {
27
- return true;
28
- }
29
- };
30
-
31
- var fails$9 = fails$a;
32
-
33
- // Detect IE8's incomplete defineProperty implementation
34
- var descriptors = !fails$9(function () {
35
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
36
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
37
- });
38
-
39
- var fails$8 = fails$a;
40
-
41
- var functionBindNative = !fails$8(function () {
42
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
43
- var test = (function () { /* empty */ }).bind();
44
- // eslint-disable-next-line no-prototype-builtins -- safe
45
- return typeof test != 'function' || test.hasOwnProperty('prototype');
46
- });
47
-
48
- var NATIVE_BIND$3 = functionBindNative;
49
-
50
- var call$b = Function.prototype.call;
51
-
52
- var functionCall = NATIVE_BIND$3 ? call$b.bind(call$b) : function () {
53
- return call$b.apply(call$b, arguments);
54
- };
55
-
56
- var objectPropertyIsEnumerable = {};
57
-
58
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
59
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
60
- var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
61
-
62
- // Nashorn ~ JDK8 bug
63
- var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
64
-
65
- // `Object.prototype.propertyIsEnumerable` method implementation
66
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
67
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
68
- var descriptor = getOwnPropertyDescriptor$2(this, V);
69
- return !!descriptor && descriptor.enumerable;
70
- } : $propertyIsEnumerable;
71
-
72
- var createPropertyDescriptor$2 = function (bitmap, value) {
73
- return {
74
- enumerable: !(bitmap & 1),
75
- configurable: !(bitmap & 2),
76
- writable: !(bitmap & 4),
77
- value: value
78
- };
79
- };
80
-
81
- var NATIVE_BIND$2 = functionBindNative;
82
-
83
- var FunctionPrototype$2 = Function.prototype;
84
- var call$a = FunctionPrototype$2.call;
85
- var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$a, call$a);
86
-
87
- var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
88
- return function () {
89
- return call$a.apply(fn, arguments);
90
- };
91
- };
92
-
93
- var uncurryThis$d = functionUncurryThis;
94
-
95
- var toString$1 = uncurryThis$d({}.toString);
96
- var stringSlice$1 = uncurryThis$d(''.slice);
97
-
98
- var classofRaw$2 = function (it) {
99
- return stringSlice$1(toString$1(it), 8, -1);
100
- };
101
-
102
- var uncurryThis$c = functionUncurryThis;
103
- var fails$7 = fails$a;
104
- var classof$4 = classofRaw$2;
105
-
106
- var $Object$3 = Object;
107
- var split = uncurryThis$c(''.split);
108
-
109
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
110
- var indexedObject = fails$7(function () {
111
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
112
- // eslint-disable-next-line no-prototype-builtins -- safe
113
- return !$Object$3('z').propertyIsEnumerable(0);
114
- }) ? function (it) {
115
- return classof$4(it) === 'String' ? split(it, '') : $Object$3(it);
116
- } : $Object$3;
117
-
118
- // we can't use just `it == null` since of `document.all` special case
119
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
120
- var isNullOrUndefined$4 = function (it) {
121
- return it === null || it === undefined;
122
- };
123
-
124
- var isNullOrUndefined$3 = isNullOrUndefined$4;
125
-
126
- var $TypeError$c = TypeError;
127
-
128
- // `RequireObjectCoercible` abstract operation
129
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
130
- var requireObjectCoercible$2 = function (it) {
131
- if (isNullOrUndefined$3(it)) throw new $TypeError$c("Can't call method on " + it);
132
- return it;
133
- };
134
-
135
- // toObject with fallback for non-array-like ES3 strings
136
- var IndexedObject = indexedObject;
137
- var requireObjectCoercible$1 = requireObjectCoercible$2;
138
-
139
- var toIndexedObject$3 = function (it) {
140
- return IndexedObject(requireObjectCoercible$1(it));
141
- };
142
-
143
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
144
- var documentAll = typeof document == 'object' && document.all;
145
-
146
- // `IsCallable` abstract operation
147
- // https://tc39.es/ecma262/#sec-iscallable
148
- // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
149
- var isCallable$g = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
150
- return typeof argument == 'function' || argument === documentAll;
151
- } : function (argument) {
152
- return typeof argument == 'function';
153
- };
154
-
155
- var isCallable$f = isCallable$g;
156
-
157
- var isObject$8 = function (it) {
158
- return typeof it == 'object' ? it !== null : isCallable$f(it);
159
- };
160
-
161
- var global$h = global$i;
162
- var isCallable$e = isCallable$g;
163
-
164
- var aFunction = function (argument) {
165
- return isCallable$e(argument) ? argument : undefined;
166
- };
167
-
168
- var getBuiltIn$7 = function (namespace, method) {
169
- return arguments.length < 2 ? aFunction(global$h[namespace]) : global$h[namespace] && global$h[namespace][method];
170
- };
171
-
172
- var uncurryThis$b = functionUncurryThis;
173
-
174
- var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
175
-
176
- var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
177
-
178
- var global$g = global$i;
179
- var userAgent$3 = engineUserAgent;
180
-
181
- var process$3 = global$g.process;
182
- var Deno$1 = global$g.Deno;
183
- var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
184
- var v8 = versions && versions.v8;
185
- var match, version;
186
-
187
- if (v8) {
188
- match = v8.split('.');
189
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
190
- // but their correct versions are not interesting for us
191
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
192
- }
193
-
194
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
195
- // so check `userAgent` even if `.v8` exists, but 0
196
- if (!version && userAgent$3) {
197
- match = userAgent$3.match(/Edge\/(\d+)/);
198
- if (!match || match[1] >= 74) {
199
- match = userAgent$3.match(/Chrome\/(\d+)/);
200
- if (match) version = +match[1];
201
- }
202
- }
203
-
204
- var engineV8Version = version;
205
-
206
- /* eslint-disable es/no-symbol -- required for testing */
207
- var V8_VERSION$1 = engineV8Version;
208
- var fails$6 = fails$a;
209
- var global$f = global$i;
210
-
211
- var $String$4 = global$f.String;
212
-
213
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
214
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$6(function () {
215
- var symbol = Symbol('symbol detection');
216
- // Chrome 38 Symbol has incorrect toString conversion
217
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
218
- // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
219
- // of course, fail.
220
- return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
221
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
222
- !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
223
- });
224
-
225
- /* eslint-disable es/no-symbol -- required for testing */
226
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
227
-
228
- var useSymbolAsUid = NATIVE_SYMBOL$1
229
- && !Symbol.sham
230
- && typeof Symbol.iterator == 'symbol';
231
-
232
- var getBuiltIn$6 = getBuiltIn$7;
233
- var isCallable$d = isCallable$g;
234
- var isPrototypeOf$2 = objectIsPrototypeOf;
235
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
236
-
237
- var $Object$2 = Object;
238
-
239
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
240
- return typeof it == 'symbol';
241
- } : function (it) {
242
- var $Symbol = getBuiltIn$6('Symbol');
243
- return isCallable$d($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
244
- };
245
-
246
- var $String$3 = String;
247
-
248
- var tryToString$4 = function (argument) {
249
- try {
250
- return $String$3(argument);
251
- } catch (error) {
252
- return 'Object';
253
- }
254
- };
255
-
256
- var isCallable$c = isCallable$g;
257
- var tryToString$3 = tryToString$4;
258
-
259
- var $TypeError$b = TypeError;
260
-
261
- // `Assert: IsCallable(argument) is true`
262
- var aCallable$8 = function (argument) {
263
- if (isCallable$c(argument)) return argument;
264
- throw new $TypeError$b(tryToString$3(argument) + ' is not a function');
265
- };
266
-
267
- var aCallable$7 = aCallable$8;
268
- var isNullOrUndefined$2 = isNullOrUndefined$4;
269
-
270
- // `GetMethod` abstract operation
271
- // https://tc39.es/ecma262/#sec-getmethod
272
- var getMethod$3 = function (V, P) {
273
- var func = V[P];
274
- return isNullOrUndefined$2(func) ? undefined : aCallable$7(func);
275
- };
276
-
277
- var call$9 = functionCall;
278
- var isCallable$b = isCallable$g;
279
- var isObject$7 = isObject$8;
280
-
281
- var $TypeError$a = TypeError;
282
-
283
- // `OrdinaryToPrimitive` abstract operation
284
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
285
- var ordinaryToPrimitive$1 = function (input, pref) {
286
- var fn, val;
287
- if (pref === 'string' && isCallable$b(fn = input.toString) && !isObject$7(val = call$9(fn, input))) return val;
288
- if (isCallable$b(fn = input.valueOf) && !isObject$7(val = call$9(fn, input))) return val;
289
- if (pref !== 'string' && isCallable$b(fn = input.toString) && !isObject$7(val = call$9(fn, input))) return val;
290
- throw new $TypeError$a("Can't convert object to primitive value");
291
- };
292
-
293
- var shared$3 = {exports: {}};
294
-
295
- var global$e = global$i;
296
-
297
- // eslint-disable-next-line es/no-object-defineproperty -- safe
298
- var defineProperty$3 = Object.defineProperty;
299
-
300
- var defineGlobalProperty$3 = function (key, value) {
301
- try {
302
- defineProperty$3(global$e, key, { value: value, configurable: true, writable: true });
303
- } catch (error) {
304
- global$e[key] = value;
305
- } return value;
306
- };
307
-
308
- var global$d = global$i;
309
- var defineGlobalProperty$2 = defineGlobalProperty$3;
310
-
311
- var SHARED = '__core-js_shared__';
312
- var store$3 = global$d[SHARED] || defineGlobalProperty$2(SHARED, {});
313
-
314
- var sharedStore = store$3;
315
-
316
- var store$2 = sharedStore;
317
-
318
- (shared$3.exports = function (key, value) {
319
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
320
- })('versions', []).push({
321
- version: '3.35.0',
322
- mode: 'global',
323
- copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
324
- license: 'https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE',
325
- source: 'https://github.com/zloirock/core-js'
326
- });
327
-
328
- var requireObjectCoercible = requireObjectCoercible$2;
329
-
330
- var $Object$1 = Object;
331
-
332
- // `ToObject` abstract operation
333
- // https://tc39.es/ecma262/#sec-toobject
334
- var toObject$1 = function (argument) {
335
- return $Object$1(requireObjectCoercible(argument));
336
- };
337
-
338
- var uncurryThis$a = functionUncurryThis;
339
- var toObject = toObject$1;
340
-
341
- var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
342
-
343
- // `HasOwnProperty` abstract operation
344
- // https://tc39.es/ecma262/#sec-hasownproperty
345
- // eslint-disable-next-line es/no-object-hasown -- safe
346
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
347
- return hasOwnProperty(toObject(it), key);
348
- };
349
-
350
- var uncurryThis$9 = functionUncurryThis;
351
-
352
- var id = 0;
353
- var postfix = Math.random();
354
- var toString = uncurryThis$9(1.0.toString);
355
-
356
- var uid$2 = function (key) {
357
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
358
- };
359
-
360
- var global$c = global$i;
361
- var shared$2 = shared$3.exports;
362
- var hasOwn$8 = hasOwnProperty_1;
363
- var uid$1 = uid$2;
364
- var NATIVE_SYMBOL = symbolConstructorDetection;
365
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
366
-
367
- var Symbol$1 = global$c.Symbol;
368
- var WellKnownSymbolsStore = shared$2('wks');
369
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
370
-
371
- var wellKnownSymbol$a = function (name) {
372
- if (!hasOwn$8(WellKnownSymbolsStore, name)) {
373
- WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)
374
- ? Symbol$1[name]
375
- : createWellKnownSymbol('Symbol.' + name);
376
- } return WellKnownSymbolsStore[name];
377
- };
378
-
379
- var call$8 = functionCall;
380
- var isObject$6 = isObject$8;
381
- var isSymbol$1 = isSymbol$2;
382
- var getMethod$2 = getMethod$3;
383
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
384
- var wellKnownSymbol$9 = wellKnownSymbol$a;
385
-
386
- var $TypeError$9 = TypeError;
387
- var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
388
-
389
- // `ToPrimitive` abstract operation
390
- // https://tc39.es/ecma262/#sec-toprimitive
391
- var toPrimitive$1 = function (input, pref) {
392
- if (!isObject$6(input) || isSymbol$1(input)) return input;
393
- var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
394
- var result;
395
- if (exoticToPrim) {
396
- if (pref === undefined) pref = 'default';
397
- result = call$8(exoticToPrim, input, pref);
398
- if (!isObject$6(result) || isSymbol$1(result)) return result;
399
- throw new $TypeError$9("Can't convert object to primitive value");
400
- }
401
- if (pref === undefined) pref = 'number';
402
- return ordinaryToPrimitive(input, pref);
403
- };
404
-
405
- var toPrimitive = toPrimitive$1;
406
- var isSymbol = isSymbol$2;
407
-
408
- // `ToPropertyKey` abstract operation
409
- // https://tc39.es/ecma262/#sec-topropertykey
410
- var toPropertyKey$2 = function (argument) {
411
- var key = toPrimitive(argument, 'string');
412
- return isSymbol(key) ? key : key + '';
413
- };
414
-
415
- var global$b = global$i;
416
- var isObject$5 = isObject$8;
417
-
418
- var document$3 = global$b.document;
419
- // typeof document.createElement is 'object' in old IE
420
- var EXISTS$1 = isObject$5(document$3) && isObject$5(document$3.createElement);
421
-
422
- var documentCreateElement = function (it) {
423
- return EXISTS$1 ? document$3.createElement(it) : {};
424
- };
425
-
426
- var DESCRIPTORS$8 = descriptors;
427
- var fails$5 = fails$a;
428
- var createElement$1 = documentCreateElement;
429
-
430
- // Thanks to IE8 for its funny defineProperty
431
- var ie8DomDefine = !DESCRIPTORS$8 && !fails$5(function () {
432
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
433
- return Object.defineProperty(createElement$1('div'), 'a', {
434
- get: function () { return 7; }
435
- }).a !== 7;
436
- });
437
-
438
- var DESCRIPTORS$7 = descriptors;
439
- var call$7 = functionCall;
440
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
441
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
442
- var toIndexedObject$2 = toIndexedObject$3;
443
- var toPropertyKey$1 = toPropertyKey$2;
444
- var hasOwn$7 = hasOwnProperty_1;
445
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
446
-
447
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
448
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
449
-
450
- // `Object.getOwnPropertyDescriptor` method
451
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
452
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
453
- O = toIndexedObject$2(O);
454
- P = toPropertyKey$1(P);
455
- if (IE8_DOM_DEFINE$1) try {
456
- return $getOwnPropertyDescriptor$1(O, P);
457
- } catch (error) { /* empty */ }
458
- if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!call$7(propertyIsEnumerableModule.f, O, P), O[P]);
459
- };
460
-
461
- var objectDefineProperty = {};
462
-
463
- var DESCRIPTORS$6 = descriptors;
464
- var fails$4 = fails$a;
465
-
466
- // V8 ~ Chrome 36-
467
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
468
- var v8PrototypeDefineBug = DESCRIPTORS$6 && fails$4(function () {
469
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
470
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
471
- value: 42,
472
- writable: false
473
- }).prototype !== 42;
474
- });
475
-
476
- var isObject$4 = isObject$8;
477
-
478
- var $String$2 = String;
479
- var $TypeError$8 = TypeError;
480
-
481
- // `Assert: Type(argument) is Object`
482
- var anObject$8 = function (argument) {
483
- if (isObject$4(argument)) return argument;
484
- throw new $TypeError$8($String$2(argument) + ' is not an object');
485
- };
486
-
487
- var DESCRIPTORS$5 = descriptors;
488
- var IE8_DOM_DEFINE = ie8DomDefine;
489
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
490
- var anObject$7 = anObject$8;
491
- var toPropertyKey = toPropertyKey$2;
492
-
493
- var $TypeError$7 = TypeError;
494
- // eslint-disable-next-line es/no-object-defineproperty -- safe
495
- var $defineProperty = Object.defineProperty;
496
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
497
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
498
- var ENUMERABLE = 'enumerable';
499
- var CONFIGURABLE$1 = 'configurable';
500
- var WRITABLE = 'writable';
501
-
502
- // `Object.defineProperty` method
503
- // https://tc39.es/ecma262/#sec-object.defineproperty
504
- objectDefineProperty.f = DESCRIPTORS$5 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
505
- anObject$7(O);
506
- P = toPropertyKey(P);
507
- anObject$7(Attributes);
508
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
509
- var current = $getOwnPropertyDescriptor(O, P);
510
- if (current && current[WRITABLE]) {
511
- O[P] = Attributes.value;
512
- Attributes = {
513
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
514
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
515
- writable: false
516
- };
517
- }
518
- } return $defineProperty(O, P, Attributes);
519
- } : $defineProperty : function defineProperty(O, P, Attributes) {
520
- anObject$7(O);
521
- P = toPropertyKey(P);
522
- anObject$7(Attributes);
523
- if (IE8_DOM_DEFINE) try {
524
- return $defineProperty(O, P, Attributes);
525
- } catch (error) { /* empty */ }
526
- if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$7('Accessors not supported');
527
- if ('value' in Attributes) O[P] = Attributes.value;
528
- return O;
529
- };
530
-
531
- var DESCRIPTORS$4 = descriptors;
532
- var definePropertyModule$2 = objectDefineProperty;
533
- var createPropertyDescriptor = createPropertyDescriptor$2;
534
-
535
- var createNonEnumerableProperty$2 = DESCRIPTORS$4 ? function (object, key, value) {
536
- return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
537
- } : function (object, key, value) {
538
- object[key] = value;
539
- return object;
540
- };
541
-
542
- var makeBuiltIn$3 = {exports: {}};
543
-
544
- var DESCRIPTORS$3 = descriptors;
545
- var hasOwn$6 = hasOwnProperty_1;
546
-
547
- var FunctionPrototype$1 = Function.prototype;
548
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
549
- var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
550
-
551
- var EXISTS = hasOwn$6(FunctionPrototype$1, 'name');
552
- // additional protection from minified / mangled / dropped function names
553
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
554
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype$1, 'name').configurable));
555
-
556
- var functionName = {
557
- EXISTS: EXISTS,
558
- PROPER: PROPER,
559
- CONFIGURABLE: CONFIGURABLE
560
- };
561
-
562
- var uncurryThis$8 = functionUncurryThis;
563
- var isCallable$a = isCallable$g;
564
- var store$1 = sharedStore;
565
-
566
- var functionToString = uncurryThis$8(Function.toString);
567
-
568
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
569
- if (!isCallable$a(store$1.inspectSource)) {
570
- store$1.inspectSource = function (it) {
571
- return functionToString(it);
572
- };
573
- }
574
-
575
- var inspectSource$3 = store$1.inspectSource;
576
-
577
- var global$a = global$i;
578
- var isCallable$9 = isCallable$g;
579
-
580
- var WeakMap$1 = global$a.WeakMap;
581
-
582
- var weakMapBasicDetection = isCallable$9(WeakMap$1) && /native code/.test(String(WeakMap$1));
583
-
584
- var shared$1 = shared$3.exports;
585
- var uid = uid$2;
586
-
587
- var keys = shared$1('keys');
588
-
589
- var sharedKey$1 = function (key) {
590
- return keys[key] || (keys[key] = uid(key));
591
- };
592
-
593
- var hiddenKeys$3 = {};
594
-
595
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
596
- var global$9 = global$i;
597
- var isObject$3 = isObject$8;
598
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
599
- var hasOwn$5 = hasOwnProperty_1;
600
- var shared = sharedStore;
601
- var sharedKey = sharedKey$1;
602
- var hiddenKeys$2 = hiddenKeys$3;
603
-
604
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
605
- var TypeError$2 = global$9.TypeError;
606
- var WeakMap = global$9.WeakMap;
607
- var set$1, get, has;
608
-
609
- var enforce = function (it) {
610
- return has(it) ? get(it) : set$1(it, {});
611
- };
612
-
613
- var getterFor = function (TYPE) {
614
- return function (it) {
615
- var state;
616
- if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
617
- throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
618
- } return state;
619
- };
620
- };
621
-
622
- if (NATIVE_WEAK_MAP || shared.state) {
623
- var store = shared.state || (shared.state = new WeakMap());
624
- /* eslint-disable no-self-assign -- prototype methods protection */
625
- store.get = store.get;
626
- store.has = store.has;
627
- store.set = store.set;
628
- /* eslint-enable no-self-assign -- prototype methods protection */
629
- set$1 = function (it, metadata) {
630
- if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
631
- metadata.facade = it;
632
- store.set(it, metadata);
633
- return metadata;
634
- };
635
- get = function (it) {
636
- return store.get(it) || {};
637
- };
638
- has = function (it) {
639
- return store.has(it);
640
- };
641
- } else {
642
- var STATE = sharedKey('state');
643
- hiddenKeys$2[STATE] = true;
644
- set$1 = function (it, metadata) {
645
- if (hasOwn$5(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
646
- metadata.facade = it;
647
- createNonEnumerableProperty$1(it, STATE, metadata);
648
- return metadata;
649
- };
650
- get = function (it) {
651
- return hasOwn$5(it, STATE) ? it[STATE] : {};
652
- };
653
- has = function (it) {
654
- return hasOwn$5(it, STATE);
655
- };
656
- }
657
-
658
- var internalState = {
659
- set: set$1,
660
- get: get,
661
- has: has,
662
- enforce: enforce,
663
- getterFor: getterFor
664
- };
665
-
666
- var uncurryThis$7 = functionUncurryThis;
667
- var fails$3 = fails$a;
668
- var isCallable$8 = isCallable$g;
669
- var hasOwn$4 = hasOwnProperty_1;
670
- var DESCRIPTORS$2 = descriptors;
671
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
672
- var inspectSource$2 = inspectSource$3;
673
- var InternalStateModule$1 = internalState;
674
-
675
- var enforceInternalState = InternalStateModule$1.enforce;
676
- var getInternalState = InternalStateModule$1.get;
677
- var $String$1 = String;
678
- // eslint-disable-next-line es/no-object-defineproperty -- safe
679
- var defineProperty$2 = Object.defineProperty;
680
- var stringSlice = uncurryThis$7(''.slice);
681
- var replace = uncurryThis$7(''.replace);
682
- var join = uncurryThis$7([].join);
683
-
684
- var CONFIGURABLE_LENGTH = DESCRIPTORS$2 && !fails$3(function () {
685
- return defineProperty$2(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
686
- });
687
-
688
- var TEMPLATE = String(String).split('String');
689
-
690
- var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
691
- if (stringSlice($String$1(name), 0, 7) === 'Symbol(') {
692
- name = '[' + replace($String$1(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
693
- }
694
- if (options && options.getter) name = 'get ' + name;
695
- if (options && options.setter) name = 'set ' + name;
696
- if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
697
- if (DESCRIPTORS$2) defineProperty$2(value, 'name', { value: name, configurable: true });
698
- else value.name = name;
699
- }
700
- if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
701
- defineProperty$2(value, 'length', { value: options.arity });
702
- }
703
- try {
704
- if (options && hasOwn$4(options, 'constructor') && options.constructor) {
705
- if (DESCRIPTORS$2) defineProperty$2(value, 'prototype', { writable: false });
706
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
707
- } else if (value.prototype) value.prototype = undefined;
708
- } catch (error) { /* empty */ }
709
- var state = enforceInternalState(value);
710
- if (!hasOwn$4(state, 'source')) {
711
- state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
712
- } return value;
713
- };
714
-
715
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
716
- // eslint-disable-next-line no-extend-native -- required
717
- Function.prototype.toString = makeBuiltIn$2(function toString() {
718
- return isCallable$8(this) && getInternalState(this).source || inspectSource$2(this);
719
- }, 'toString');
720
-
721
- var isCallable$7 = isCallable$g;
722
- var definePropertyModule$1 = objectDefineProperty;
723
- var makeBuiltIn$1 = makeBuiltIn$3.exports;
724
- var defineGlobalProperty$1 = defineGlobalProperty$3;
725
-
726
- var defineBuiltIn$3 = function (O, key, value, options) {
727
- if (!options) options = {};
728
- var simple = options.enumerable;
729
- var name = options.name !== undefined ? options.name : key;
730
- if (isCallable$7(value)) makeBuiltIn$1(value, name, options);
731
- if (options.global) {
732
- if (simple) O[key] = value;
733
- else defineGlobalProperty$1(key, value);
734
- } else {
735
- try {
736
- if (!options.unsafe) delete O[key];
737
- else if (O[key]) simple = true;
738
- } catch (error) { /* empty */ }
739
- if (simple) O[key] = value;
740
- else definePropertyModule$1.f(O, key, {
741
- value: value,
742
- enumerable: false,
743
- configurable: !options.nonConfigurable,
744
- writable: !options.nonWritable
745
- });
746
- } return O;
747
- };
748
-
749
- var objectGetOwnPropertyNames = {};
750
-
751
- var ceil = Math.ceil;
752
- var floor = Math.floor;
753
-
754
- // `Math.trunc` method
755
- // https://tc39.es/ecma262/#sec-math.trunc
756
- // eslint-disable-next-line es/no-math-trunc -- safe
757
- var mathTrunc = Math.trunc || function trunc(x) {
758
- var n = +x;
759
- return (n > 0 ? floor : ceil)(n);
760
- };
761
-
762
- var trunc = mathTrunc;
763
-
764
- // `ToIntegerOrInfinity` abstract operation
765
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
766
- var toIntegerOrInfinity$2 = function (argument) {
767
- var number = +argument;
768
- // eslint-disable-next-line no-self-compare -- NaN check
769
- return number !== number || number === 0 ? 0 : trunc(number);
770
- };
771
-
772
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
773
-
774
- var max = Math.max;
775
- var min$1 = Math.min;
776
-
777
- // Helper for a popular repeating case of the spec:
778
- // Let integer be ? ToInteger(index).
779
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
780
- var toAbsoluteIndex$1 = function (index, length) {
781
- var integer = toIntegerOrInfinity$1(index);
782
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
783
- };
784
-
785
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
786
-
787
- var min = Math.min;
788
-
789
- // `ToLength` abstract operation
790
- // https://tc39.es/ecma262/#sec-tolength
791
- var toLength$1 = function (argument) {
792
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
793
- };
794
-
795
- var toLength = toLength$1;
796
-
797
- // `LengthOfArrayLike` abstract operation
798
- // https://tc39.es/ecma262/#sec-lengthofarraylike
799
- var lengthOfArrayLike$2 = function (obj) {
800
- return toLength(obj.length);
801
- };
802
-
803
- var toIndexedObject$1 = toIndexedObject$3;
804
- var toAbsoluteIndex = toAbsoluteIndex$1;
805
- var lengthOfArrayLike$1 = lengthOfArrayLike$2;
806
-
807
- // `Array.prototype.{ indexOf, includes }` methods implementation
808
- var createMethod = function (IS_INCLUDES) {
809
- return function ($this, el, fromIndex) {
810
- var O = toIndexedObject$1($this);
811
- var length = lengthOfArrayLike$1(O);
812
- var index = toAbsoluteIndex(fromIndex, length);
813
- var value;
814
- // Array#includes uses SameValueZero equality algorithm
815
- // eslint-disable-next-line no-self-compare -- NaN check
816
- if (IS_INCLUDES && el !== el) while (length > index) {
817
- value = O[index++];
818
- // eslint-disable-next-line no-self-compare -- NaN check
819
- if (value !== value) return true;
820
- // Array#indexOf ignores holes, Array#includes - not
821
- } else for (;length > index; index++) {
822
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
823
- } return !IS_INCLUDES && -1;
824
- };
825
- };
826
-
827
- var arrayIncludes = {
828
- // `Array.prototype.includes` method
829
- // https://tc39.es/ecma262/#sec-array.prototype.includes
830
- includes: createMethod(true),
831
- // `Array.prototype.indexOf` method
832
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
833
- indexOf: createMethod(false)
834
- };
835
-
836
- var uncurryThis$6 = functionUncurryThis;
837
- var hasOwn$3 = hasOwnProperty_1;
838
- var toIndexedObject = toIndexedObject$3;
839
- var indexOf = arrayIncludes.indexOf;
840
- var hiddenKeys$1 = hiddenKeys$3;
841
-
842
- var push = uncurryThis$6([].push);
843
-
844
- var objectKeysInternal = function (object, names) {
845
- var O = toIndexedObject(object);
846
- var i = 0;
847
- var result = [];
848
- var key;
849
- for (key in O) !hasOwn$3(hiddenKeys$1, key) && hasOwn$3(O, key) && push(result, key);
850
- // Don't enum bug & hidden keys
851
- while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
852
- ~indexOf(result, key) || push(result, key);
853
- }
854
- return result;
855
- };
856
-
857
- // IE8- don't enum bug keys
858
- var enumBugKeys$1 = [
859
- 'constructor',
860
- 'hasOwnProperty',
861
- 'isPrototypeOf',
862
- 'propertyIsEnumerable',
863
- 'toLocaleString',
864
- 'toString',
865
- 'valueOf'
866
- ];
867
-
868
- var internalObjectKeys = objectKeysInternal;
869
- var enumBugKeys = enumBugKeys$1;
870
-
871
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
872
-
873
- // `Object.getOwnPropertyNames` method
874
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
875
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
876
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
877
- return internalObjectKeys(O, hiddenKeys);
878
- };
879
-
880
- var objectGetOwnPropertySymbols = {};
881
-
882
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
883
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
884
-
885
- var getBuiltIn$5 = getBuiltIn$7;
886
- var uncurryThis$5 = functionUncurryThis;
887
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
888
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
889
- var anObject$6 = anObject$8;
890
-
891
- var concat = uncurryThis$5([].concat);
892
-
893
- // all object keys, includes non-enumerable and symbols
894
- var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
895
- var keys = getOwnPropertyNamesModule.f(anObject$6(it));
896
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
897
- return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
898
- };
899
-
900
- var hasOwn$2 = hasOwnProperty_1;
901
- var ownKeys = ownKeys$1;
902
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
903
- var definePropertyModule = objectDefineProperty;
904
-
905
- var copyConstructorProperties$1 = function (target, source, exceptions) {
906
- var keys = ownKeys(source);
907
- var defineProperty = definePropertyModule.f;
908
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
909
- for (var i = 0; i < keys.length; i++) {
910
- var key = keys[i];
911
- if (!hasOwn$2(target, key) && !(exceptions && hasOwn$2(exceptions, key))) {
912
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
913
- }
914
- }
915
- };
916
-
917
- var fails$2 = fails$a;
918
- var isCallable$6 = isCallable$g;
919
-
920
- var replacement = /#|\.prototype\./;
921
-
922
- var isForced$2 = function (feature, detection) {
923
- var value = data[normalize(feature)];
924
- return value === POLYFILL ? true
925
- : value === NATIVE ? false
926
- : isCallable$6(detection) ? fails$2(detection)
927
- : !!detection;
928
- };
929
-
930
- var normalize = isForced$2.normalize = function (string) {
931
- return String(string).replace(replacement, '.').toLowerCase();
932
- };
933
-
934
- var data = isForced$2.data = {};
935
- var NATIVE = isForced$2.NATIVE = 'N';
936
- var POLYFILL = isForced$2.POLYFILL = 'P';
937
-
938
- var isForced_1 = isForced$2;
939
-
940
- var global$8 = global$i;
941
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
942
- var createNonEnumerableProperty = createNonEnumerableProperty$2;
943
- var defineBuiltIn$2 = defineBuiltIn$3;
944
- var defineGlobalProperty = defineGlobalProperty$3;
945
- var copyConstructorProperties = copyConstructorProperties$1;
946
- var isForced$1 = isForced_1;
947
-
948
- /*
949
- options.target - name of the target object
950
- options.global - target is the global object
951
- options.stat - export as static methods of target
952
- options.proto - export as prototype methods of target
953
- options.real - real prototype method for the `pure` version
954
- options.forced - export even if the native feature is available
955
- options.bind - bind methods to the target, required for the `pure` version
956
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
957
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
958
- options.sham - add a flag to not completely full polyfills
959
- options.enumerable - export as enumerable property
960
- options.dontCallGetSet - prevent calling a getter on target
961
- options.name - the .name of the function if it does not match the key
962
- */
963
- var _export = function (options, source) {
964
- var TARGET = options.target;
965
- var GLOBAL = options.global;
966
- var STATIC = options.stat;
967
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
968
- if (GLOBAL) {
969
- target = global$8;
970
- } else if (STATIC) {
971
- target = global$8[TARGET] || defineGlobalProperty(TARGET, {});
972
- } else {
973
- target = (global$8[TARGET] || {}).prototype;
974
- }
975
- if (target) for (key in source) {
976
- sourceProperty = source[key];
977
- if (options.dontCallGetSet) {
978
- descriptor = getOwnPropertyDescriptor$1(target, key);
979
- targetProperty = descriptor && descriptor.value;
980
- } else targetProperty = target[key];
981
- FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
982
- // contained in target
983
- if (!FORCED && targetProperty !== undefined) {
984
- if (typeof sourceProperty == typeof targetProperty) continue;
985
- copyConstructorProperties(sourceProperty, targetProperty);
986
- }
987
- // add a flag to not completely full polyfills
988
- if (options.sham || (targetProperty && targetProperty.sham)) {
989
- createNonEnumerableProperty(sourceProperty, 'sham', true);
990
- }
991
- defineBuiltIn$2(target, key, sourceProperty, options);
992
- }
993
- };
994
-
995
- var global$7 = global$i;
996
- var classof$3 = classofRaw$2;
997
-
998
- var engineIsNode = classof$3(global$7.process) === 'process';
999
-
1000
- var uncurryThis$4 = functionUncurryThis;
1001
- var aCallable$6 = aCallable$8;
1002
-
1003
- var functionUncurryThisAccessor = function (object, key, method) {
1004
- try {
1005
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1006
- return uncurryThis$4(aCallable$6(Object.getOwnPropertyDescriptor(object, key)[method]));
1007
- } catch (error) { /* empty */ }
1008
- };
1009
-
1010
- var isObject$2 = isObject$8;
1011
-
1012
- var isPossiblePrototype$1 = function (argument) {
1013
- return isObject$2(argument) || argument === null;
1014
- };
1015
-
1016
- var isPossiblePrototype = isPossiblePrototype$1;
1017
-
1018
- var $String = String;
1019
- var $TypeError$6 = TypeError;
1020
-
1021
- var aPossiblePrototype$1 = function (argument) {
1022
- if (isPossiblePrototype(argument)) return argument;
1023
- throw new $TypeError$6("Can't set " + $String(argument) + ' as a prototype');
1024
- };
1025
-
1026
- /* eslint-disable no-proto -- safe */
1027
- var uncurryThisAccessor = functionUncurryThisAccessor;
1028
- var anObject$5 = anObject$8;
1029
- var aPossiblePrototype = aPossiblePrototype$1;
1030
-
1031
- // `Object.setPrototypeOf` method
1032
- // https://tc39.es/ecma262/#sec-object.setprototypeof
1033
- // Works with __proto__ only. Old v8 can't work with null proto objects.
1034
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
1035
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1036
- var CORRECT_SETTER = false;
1037
- var test = {};
1038
- var setter;
1039
- try {
1040
- setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1041
- setter(test, []);
1042
- CORRECT_SETTER = test instanceof Array;
1043
- } catch (error) { /* empty */ }
1044
- return function setPrototypeOf(O, proto) {
1045
- anObject$5(O);
1046
- aPossiblePrototype(proto);
1047
- if (CORRECT_SETTER) setter(O, proto);
1048
- else O.__proto__ = proto;
1049
- return O;
1050
- };
1051
- }() : undefined);
1052
-
1053
- var defineProperty$1 = objectDefineProperty.f;
1054
- var hasOwn$1 = hasOwnProperty_1;
1055
- var wellKnownSymbol$8 = wellKnownSymbol$a;
1056
-
1057
- var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
1058
-
1059
- var setToStringTag$1 = function (target, TAG, STATIC) {
1060
- if (target && !STATIC) target = target.prototype;
1061
- if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1062
- defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1063
- }
1064
- };
1065
-
1066
- var makeBuiltIn = makeBuiltIn$3.exports;
1067
- var defineProperty = objectDefineProperty;
1068
-
1069
- var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1070
- if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1071
- if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1072
- return defineProperty.f(target, name, descriptor);
1073
- };
1074
-
1075
- var getBuiltIn$4 = getBuiltIn$7;
1076
- var defineBuiltInAccessor = defineBuiltInAccessor$1;
1077
- var wellKnownSymbol$7 = wellKnownSymbol$a;
1078
- var DESCRIPTORS$1 = descriptors;
1079
-
1080
- var SPECIES$2 = wellKnownSymbol$7('species');
1081
-
1082
- var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1083
- var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME);
1084
-
1085
- if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$2]) {
1086
- defineBuiltInAccessor(Constructor, SPECIES$2, {
1087
- configurable: true,
1088
- get: function () { return this; }
1089
- });
1090
- }
1091
- };
1092
-
1093
- var isPrototypeOf$1 = objectIsPrototypeOf;
1094
-
1095
- var $TypeError$5 = TypeError;
1096
-
1097
- var anInstance$1 = function (it, Prototype) {
1098
- if (isPrototypeOf$1(Prototype, it)) return it;
1099
- throw new $TypeError$5('Incorrect invocation');
1100
- };
1101
-
1102
- var wellKnownSymbol$6 = wellKnownSymbol$a;
1103
-
1104
- var TO_STRING_TAG$1 = wellKnownSymbol$6('toStringTag');
1105
- var test = {};
1106
-
1107
- test[TO_STRING_TAG$1] = 'z';
1108
-
1109
- var toStringTagSupport = String(test) === '[object z]';
1110
-
1111
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1112
- var isCallable$5 = isCallable$g;
1113
- var classofRaw$1 = classofRaw$2;
1114
- var wellKnownSymbol$5 = wellKnownSymbol$a;
1115
-
1116
- var TO_STRING_TAG = wellKnownSymbol$5('toStringTag');
1117
- var $Object = Object;
1118
-
1119
- // ES3 wrong here
1120
- var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
1121
-
1122
- // fallback for IE11 Script Access Denied error
1123
- var tryGet = function (it, key) {
1124
- try {
1125
- return it[key];
1126
- } catch (error) { /* empty */ }
1127
- };
1128
-
1129
- // getting tag from ES6+ `Object.prototype.toString`
1130
- var classof$2 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
1131
- var O, tag, result;
1132
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1133
- // @@toStringTag case
1134
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1135
- // builtinTag case
1136
- : CORRECT_ARGUMENTS ? classofRaw$1(O)
1137
- // ES3 arguments fallback
1138
- : (result = classofRaw$1(O)) === 'Object' && isCallable$5(O.callee) ? 'Arguments' : result;
1139
- };
1140
-
1141
- var uncurryThis$3 = functionUncurryThis;
1142
- var fails$1 = fails$a;
1143
- var isCallable$4 = isCallable$g;
1144
- var classof$1 = classof$2;
1145
- var getBuiltIn$3 = getBuiltIn$7;
1146
- var inspectSource$1 = inspectSource$3;
1147
-
1148
- var noop = function () { /* empty */ };
1149
- var empty = [];
1150
- var construct = getBuiltIn$3('Reflect', 'construct');
1151
- var constructorRegExp = /^\s*(?:class|function)\b/;
1152
- var exec = uncurryThis$3(constructorRegExp.exec);
1153
- var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
1154
-
1155
- var isConstructorModern = function isConstructor(argument) {
1156
- if (!isCallable$4(argument)) return false;
1157
- try {
1158
- construct(noop, empty, argument);
1159
- return true;
1160
- } catch (error) {
1161
- return false;
1162
- }
1163
- };
1164
-
1165
- var isConstructorLegacy = function isConstructor(argument) {
1166
- if (!isCallable$4(argument)) return false;
1167
- switch (classof$1(argument)) {
1168
- case 'AsyncFunction':
1169
- case 'GeneratorFunction':
1170
- case 'AsyncGeneratorFunction': return false;
1171
- }
1172
- try {
1173
- // we can't check .prototype since constructors produced by .bind haven't it
1174
- // `Function#toString` throws on some built-it function in some legacy engines
1175
- // (for example, `DOMQuad` and similar in FF41-)
1176
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
1177
- } catch (error) {
1178
- return true;
1179
- }
1180
- };
1181
-
1182
- isConstructorLegacy.sham = true;
1183
-
1184
- // `IsConstructor` abstract operation
1185
- // https://tc39.es/ecma262/#sec-isconstructor
1186
- var isConstructor$1 = !construct || fails$1(function () {
1187
- var called;
1188
- return isConstructorModern(isConstructorModern.call)
1189
- || !isConstructorModern(Object)
1190
- || !isConstructorModern(function () { called = true; })
1191
- || called;
1192
- }) ? isConstructorLegacy : isConstructorModern;
1193
-
1194
- var isConstructor = isConstructor$1;
1195
- var tryToString$2 = tryToString$4;
1196
-
1197
- var $TypeError$4 = TypeError;
1198
-
1199
- // `Assert: IsConstructor(argument) is true`
1200
- var aConstructor$1 = function (argument) {
1201
- if (isConstructor(argument)) return argument;
1202
- throw new $TypeError$4(tryToString$2(argument) + ' is not a constructor');
1203
- };
1204
-
1205
- var anObject$4 = anObject$8;
1206
- var aConstructor = aConstructor$1;
1207
- var isNullOrUndefined$1 = isNullOrUndefined$4;
1208
- var wellKnownSymbol$4 = wellKnownSymbol$a;
1209
-
1210
- var SPECIES$1 = wellKnownSymbol$4('species');
1211
-
1212
- // `SpeciesConstructor` abstract operation
1213
- // https://tc39.es/ecma262/#sec-speciesconstructor
1214
- var speciesConstructor$1 = function (O, defaultConstructor) {
1215
- var C = anObject$4(O).constructor;
1216
- var S;
1217
- return C === undefined || isNullOrUndefined$1(S = anObject$4(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
1218
- };
1219
-
1220
- var NATIVE_BIND$1 = functionBindNative;
1221
-
1222
- var FunctionPrototype = Function.prototype;
1223
- var apply$1 = FunctionPrototype.apply;
1224
- var call$6 = FunctionPrototype.call;
1225
-
1226
- // eslint-disable-next-line es/no-reflect -- safe
1227
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$6.bind(apply$1) : function () {
1228
- return call$6.apply(apply$1, arguments);
1229
- });
1230
-
1231
- var classofRaw = classofRaw$2;
1232
- var uncurryThis$2 = functionUncurryThis;
1233
-
1234
- var functionUncurryThisClause = function (fn) {
1235
- // Nashorn bug:
1236
- // https://github.com/zloirock/core-js/issues/1128
1237
- // https://github.com/zloirock/core-js/issues/1130
1238
- if (classofRaw(fn) === 'Function') return uncurryThis$2(fn);
1239
- };
1240
-
1241
- var uncurryThis$1 = functionUncurryThisClause;
1242
- var aCallable$5 = aCallable$8;
1243
- var NATIVE_BIND = functionBindNative;
1244
-
1245
- var bind$4 = uncurryThis$1(uncurryThis$1.bind);
1246
-
1247
- // optional / simple context binding
1248
- var functionBindContext = function (fn, that) {
1249
- aCallable$5(fn);
1250
- return that === undefined ? fn : NATIVE_BIND ? bind$4(fn, that) : function (/* ...args */) {
1251
- return fn.apply(that, arguments);
1252
- };
1253
- };
1254
-
1255
- var getBuiltIn$2 = getBuiltIn$7;
1256
-
1257
- var html$1 = getBuiltIn$2('document', 'documentElement');
1258
-
1259
- var uncurryThis = functionUncurryThis;
1260
-
1261
- var arraySlice$1 = uncurryThis([].slice);
1262
-
1263
- var $TypeError$3 = TypeError;
1264
-
1265
- var validateArgumentsLength$1 = function (passed, required) {
1266
- if (passed < required) throw new $TypeError$3('Not enough arguments');
1267
- return passed;
1268
- };
1269
-
1270
- var userAgent$2 = engineUserAgent;
1271
-
1272
- // eslint-disable-next-line redos/no-vulnerable -- safe
1273
- var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
1274
-
1275
- var global$6 = global$i;
1276
- var apply = functionApply;
1277
- var bind$3 = functionBindContext;
1278
- var isCallable$3 = isCallable$g;
1279
- var hasOwn = hasOwnProperty_1;
1280
- var fails = fails$a;
1281
- var html = html$1;
1282
- var arraySlice = arraySlice$1;
1283
- var createElement = documentCreateElement;
1284
- var validateArgumentsLength = validateArgumentsLength$1;
1285
- var IS_IOS$1 = engineIsIos;
1286
- var IS_NODE$3 = engineIsNode;
1287
-
1288
- var set = global$6.setImmediate;
1289
- var clear = global$6.clearImmediate;
1290
- var process$2 = global$6.process;
1291
- var Dispatch = global$6.Dispatch;
1292
- var Function$1 = global$6.Function;
1293
- var MessageChannel = global$6.MessageChannel;
1294
- var String$1 = global$6.String;
1295
- var counter = 0;
1296
- var queue$2 = {};
1297
- var ONREADYSTATECHANGE = 'onreadystatechange';
1298
- var $location, defer, channel, port;
1299
-
1300
- fails(function () {
1301
- // Deno throws a ReferenceError on `location` access without `--location` flag
1302
- $location = global$6.location;
1303
- });
1304
-
1305
- var run = function (id) {
1306
- if (hasOwn(queue$2, id)) {
1307
- var fn = queue$2[id];
1308
- delete queue$2[id];
1309
- fn();
1310
- }
1311
- };
1312
-
1313
- var runner = function (id) {
1314
- return function () {
1315
- run(id);
1316
- };
1317
- };
1318
-
1319
- var eventListener = function (event) {
1320
- run(event.data);
1321
- };
1322
-
1323
- var globalPostMessageDefer = function (id) {
1324
- // old engines have not location.origin
1325
- global$6.postMessage(String$1(id), $location.protocol + '//' + $location.host);
1326
- };
1327
-
1328
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1329
- if (!set || !clear) {
1330
- set = function setImmediate(handler) {
1331
- validateArgumentsLength(arguments.length, 1);
1332
- var fn = isCallable$3(handler) ? handler : Function$1(handler);
1333
- var args = arraySlice(arguments, 1);
1334
- queue$2[++counter] = function () {
1335
- apply(fn, undefined, args);
1336
- };
1337
- defer(counter);
1338
- return counter;
1339
- };
1340
- clear = function clearImmediate(id) {
1341
- delete queue$2[id];
1342
- };
1343
- // Node.js 0.8-
1344
- if (IS_NODE$3) {
1345
- defer = function (id) {
1346
- process$2.nextTick(runner(id));
1347
- };
1348
- // Sphere (JS game engine) Dispatch API
1349
- } else if (Dispatch && Dispatch.now) {
1350
- defer = function (id) {
1351
- Dispatch.now(runner(id));
1352
- };
1353
- // Browsers with MessageChannel, includes WebWorkers
1354
- // except iOS - https://github.com/zloirock/core-js/issues/624
1355
- } else if (MessageChannel && !IS_IOS$1) {
1356
- channel = new MessageChannel();
1357
- port = channel.port2;
1358
- channel.port1.onmessage = eventListener;
1359
- defer = bind$3(port.postMessage, port);
1360
- // Browsers with postMessage, skip WebWorkers
1361
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1362
- } else if (
1363
- global$6.addEventListener &&
1364
- isCallable$3(global$6.postMessage) &&
1365
- !global$6.importScripts &&
1366
- $location && $location.protocol !== 'file:' &&
1367
- !fails(globalPostMessageDefer)
1368
- ) {
1369
- defer = globalPostMessageDefer;
1370
- global$6.addEventListener('message', eventListener, false);
1371
- // IE8-
1372
- } else if (ONREADYSTATECHANGE in createElement('script')) {
1373
- defer = function (id) {
1374
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
1375
- html.removeChild(this);
1376
- run(id);
1377
- };
1378
- };
1379
- // Rest old browsers
1380
- } else {
1381
- defer = function (id) {
1382
- setTimeout(runner(id), 0);
1383
- };
1384
- }
1385
- }
1386
-
1387
- var task$1 = {
1388
- set: set,
1389
- clear: clear
1390
- };
1391
-
1392
- var global$5 = global$i;
1393
- var DESCRIPTORS = descriptors;
1394
-
1395
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1396
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1397
-
1398
- // Avoid NodeJS experimental warning
1399
- var safeGetBuiltIn$1 = function (name) {
1400
- if (!DESCRIPTORS) return global$5[name];
1401
- var descriptor = getOwnPropertyDescriptor(global$5, name);
1402
- return descriptor && descriptor.value;
1403
- };
1404
-
1405
- var Queue$2 = function () {
1406
- this.head = null;
1407
- this.tail = null;
1408
- };
1409
-
1410
- Queue$2.prototype = {
1411
- add: function (item) {
1412
- var entry = { item: item, next: null };
1413
- var tail = this.tail;
1414
- if (tail) tail.next = entry;
1415
- else this.head = entry;
1416
- this.tail = entry;
1417
- },
1418
- get: function () {
1419
- var entry = this.head;
1420
- if (entry) {
1421
- var next = this.head = entry.next;
1422
- if (next === null) this.tail = null;
1423
- return entry.item;
1424
- }
1425
- }
1426
- };
1427
-
1428
- var queue$1 = Queue$2;
1429
-
1430
- var userAgent$1 = engineUserAgent;
1431
-
1432
- var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
1433
-
1434
- var userAgent = engineUserAgent;
1435
-
1436
- var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
1437
-
1438
- var global$4 = global$i;
1439
- var safeGetBuiltIn = safeGetBuiltIn$1;
1440
- var bind$2 = functionBindContext;
1441
- var macrotask = task$1.set;
1442
- var Queue$1 = queue$1;
1443
- var IS_IOS = engineIsIos;
1444
- var IS_IOS_PEBBLE = engineIsIosPebble;
1445
- var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
1446
- var IS_NODE$2 = engineIsNode;
1447
-
1448
- var MutationObserver = global$4.MutationObserver || global$4.WebKitMutationObserver;
1449
- var document$2 = global$4.document;
1450
- var process$1 = global$4.process;
1451
- var Promise$1 = global$4.Promise;
1452
- var microtask$1 = safeGetBuiltIn('queueMicrotask');
1453
- var notify$1, toggle, node, promise, then;
1454
-
1455
- // modern engines have queueMicrotask method
1456
- if (!microtask$1) {
1457
- var queue = new Queue$1();
1458
-
1459
- var flush = function () {
1460
- var parent, fn;
1461
- if (IS_NODE$2 && (parent = process$1.domain)) parent.exit();
1462
- while (fn = queue.get()) try {
1463
- fn();
1464
- } catch (error) {
1465
- if (queue.head) notify$1();
1466
- throw error;
1467
- }
1468
- if (parent) parent.enter();
1469
- };
1470
-
1471
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
1472
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1473
- if (!IS_IOS && !IS_NODE$2 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
1474
- toggle = true;
1475
- node = document$2.createTextNode('');
1476
- new MutationObserver(flush).observe(node, { characterData: true });
1477
- notify$1 = function () {
1478
- node.data = toggle = !toggle;
1479
- };
1480
- // environments with maybe non-completely correct, but existent Promise
1481
- } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
1482
- // Promise.resolve without an argument throws an error in LG WebOS 2
1483
- promise = Promise$1.resolve(undefined);
1484
- // workaround of WebKit ~ iOS Safari 10.1 bug
1485
- promise.constructor = Promise$1;
1486
- then = bind$2(promise.then, promise);
1487
- notify$1 = function () {
1488
- then(flush);
1489
- };
1490
- // Node.js without promises
1491
- } else if (IS_NODE$2) {
1492
- notify$1 = function () {
1493
- process$1.nextTick(flush);
1494
- };
1495
- // for other environments - macrotask based on:
1496
- // - setImmediate
1497
- // - MessageChannel
1498
- // - window.postMessage
1499
- // - onreadystatechange
1500
- // - setTimeout
1501
- } else {
1502
- // `webpack` dev server bug on IE global methods - use bind(fn, global)
1503
- macrotask = bind$2(macrotask, global$4);
1504
- notify$1 = function () {
1505
- macrotask(flush);
1506
- };
1507
- }
1508
-
1509
- microtask$1 = function (fn) {
1510
- if (!queue.head) notify$1();
1511
- queue.add(fn);
1512
- };
1513
- }
1514
-
1515
- var microtask_1 = microtask$1;
1516
-
1517
- var hostReportErrors$1 = function (a, b) {
1518
- try {
1519
- // eslint-disable-next-line no-console -- safe
1520
- arguments.length === 1 ? console.error(a) : console.error(a, b);
1521
- } catch (error) { /* empty */ }
1522
- };
1523
-
1524
- var perform$3 = function (exec) {
1525
- try {
1526
- return { error: false, value: exec() };
1527
- } catch (error) {
1528
- return { error: true, value: error };
1529
- }
1530
- };
1531
-
1532
- var global$3 = global$i;
1533
-
1534
- var promiseNativeConstructor = global$3.Promise;
1535
-
1536
- /* global Deno -- Deno case */
1537
- var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
1538
-
1539
- var IS_DENO$1 = engineIsDeno;
1540
- var IS_NODE$1 = engineIsNode;
1541
-
1542
- var engineIsBrowser = !IS_DENO$1 && !IS_NODE$1
1543
- && typeof window == 'object'
1544
- && typeof document == 'object';
1545
-
1546
- var global$2 = global$i;
1547
- var NativePromiseConstructor$3 = promiseNativeConstructor;
1548
- var isCallable$2 = isCallable$g;
1549
- var isForced = isForced_1;
1550
- var inspectSource = inspectSource$3;
1551
- var wellKnownSymbol$3 = wellKnownSymbol$a;
1552
- var IS_BROWSER = engineIsBrowser;
1553
- var IS_DENO = engineIsDeno;
1554
- var V8_VERSION = engineV8Version;
1555
-
1556
- NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
1557
- var SPECIES = wellKnownSymbol$3('species');
1558
- var SUBCLASSING = false;
1559
- var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$2(global$2.PromiseRejectionEvent);
1560
-
1561
- var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
1562
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
1563
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
1564
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1565
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1566
- // We can't detect it synchronously, so just check versions
1567
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
1568
- // We can't use @@species feature detection in V8 since it causes
1569
- // deoptimization and performance degradation
1570
- // https://github.com/zloirock/core-js/issues/679
1571
- if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
1572
- // Detect correctness of subclassing with @@species support
1573
- var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
1574
- var FakePromise = function (exec) {
1575
- exec(function () { /* empty */ }, function () { /* empty */ });
1576
- };
1577
- var constructor = promise.constructor = {};
1578
- constructor[SPECIES] = FakePromise;
1579
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
1580
- if (!SUBCLASSING) return true;
1581
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1582
- } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT$1;
1583
- });
1584
-
1585
- var promiseConstructorDetection = {
1586
- CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
1587
- REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
1588
- SUBCLASSING: SUBCLASSING
1589
- };
1590
-
1591
- var newPromiseCapability$2 = {};
1592
-
1593
- var aCallable$4 = aCallable$8;
1594
-
1595
- var $TypeError$2 = TypeError;
1596
-
1597
- var PromiseCapability = function (C) {
1598
- var resolve, reject;
1599
- this.promise = new C(function ($$resolve, $$reject) {
1600
- if (resolve !== undefined || reject !== undefined) throw new $TypeError$2('Bad Promise constructor');
1601
- resolve = $$resolve;
1602
- reject = $$reject;
1603
- });
1604
- this.resolve = aCallable$4(resolve);
1605
- this.reject = aCallable$4(reject);
1606
- };
1607
-
1608
- // `NewPromiseCapability` abstract operation
1609
- // https://tc39.es/ecma262/#sec-newpromisecapability
1610
- newPromiseCapability$2.f = function (C) {
1611
- return new PromiseCapability(C);
1612
- };
1613
-
1614
- var $$5 = _export;
1615
- var IS_NODE = engineIsNode;
1616
- var global$1 = global$i;
1617
- var call$5 = functionCall;
1618
- var defineBuiltIn$1 = defineBuiltIn$3;
1619
- var setPrototypeOf = objectSetPrototypeOf;
1620
- var setToStringTag = setToStringTag$1;
1621
- var setSpecies = setSpecies$1;
1622
- var aCallable$3 = aCallable$8;
1623
- var isCallable$1 = isCallable$g;
1624
- var isObject$1 = isObject$8;
1625
- var anInstance = anInstance$1;
1626
- var speciesConstructor = speciesConstructor$1;
1627
- var task = task$1.set;
1628
- var microtask = microtask_1;
1629
- var hostReportErrors = hostReportErrors$1;
1630
- var perform$2 = perform$3;
1631
- var Queue = queue$1;
1632
- var InternalStateModule = internalState;
1633
- var NativePromiseConstructor$2 = promiseNativeConstructor;
1634
- var PromiseConstructorDetection = promiseConstructorDetection;
1635
- var newPromiseCapabilityModule$3 = newPromiseCapability$2;
1636
-
1637
- var PROMISE = 'Promise';
1638
- var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
1639
- var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
1640
- var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
1641
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
1642
- var setInternalState = InternalStateModule.set;
1643
- var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
1644
- var PromiseConstructor = NativePromiseConstructor$2;
1645
- var PromisePrototype = NativePromisePrototype$1;
1646
- var TypeError$1 = global$1.TypeError;
1647
- var document$1 = global$1.document;
1648
- var process = global$1.process;
1649
- var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
1650
- var newGenericPromiseCapability = newPromiseCapability$1;
1651
-
1652
- var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$1.dispatchEvent);
1653
- var UNHANDLED_REJECTION = 'unhandledrejection';
1654
- var REJECTION_HANDLED = 'rejectionhandled';
1655
- var PENDING = 0;
1656
- var FULFILLED = 1;
1657
- var REJECTED = 2;
1658
- var HANDLED = 1;
1659
- var UNHANDLED = 2;
1660
-
1661
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1662
-
1663
- // helpers
1664
- var isThenable = function (it) {
1665
- var then;
1666
- return isObject$1(it) && isCallable$1(then = it.then) ? then : false;
1667
- };
1668
-
1669
- var callReaction = function (reaction, state) {
1670
- var value = state.value;
1671
- var ok = state.state === FULFILLED;
1672
- var handler = ok ? reaction.ok : reaction.fail;
1673
- var resolve = reaction.resolve;
1674
- var reject = reaction.reject;
1675
- var domain = reaction.domain;
1676
- var result, then, exited;
1677
- try {
1678
- if (handler) {
1679
- if (!ok) {
1680
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1681
- state.rejection = HANDLED;
1682
- }
1683
- if (handler === true) result = value;
1684
- else {
1685
- if (domain) domain.enter();
1686
- result = handler(value); // can throw
1687
- if (domain) {
1688
- domain.exit();
1689
- exited = true;
1690
- }
1691
- }
1692
- if (result === reaction.promise) {
1693
- reject(new TypeError$1('Promise-chain cycle'));
1694
- } else if (then = isThenable(result)) {
1695
- call$5(then, result, resolve, reject);
1696
- } else resolve(result);
1697
- } else reject(value);
1698
- } catch (error) {
1699
- if (domain && !exited) domain.exit();
1700
- reject(error);
1701
- }
1702
- };
1703
-
1704
- var notify = function (state, isReject) {
1705
- if (state.notified) return;
1706
- state.notified = true;
1707
- microtask(function () {
1708
- var reactions = state.reactions;
1709
- var reaction;
1710
- while (reaction = reactions.get()) {
1711
- callReaction(reaction, state);
1712
- }
1713
- state.notified = false;
1714
- if (isReject && !state.rejection) onUnhandled(state);
1715
- });
1716
- };
1717
-
1718
- var dispatchEvent = function (name, promise, reason) {
1719
- var event, handler;
1720
- if (DISPATCH_EVENT) {
1721
- event = document$1.createEvent('Event');
1722
- event.promise = promise;
1723
- event.reason = reason;
1724
- event.initEvent(name, false, true);
1725
- global$1.dispatchEvent(event);
1726
- } else event = { promise: promise, reason: reason };
1727
- if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global$1['on' + name])) handler(event);
1728
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1729
- };
1730
-
1731
- var onUnhandled = function (state) {
1732
- call$5(task, global$1, function () {
1733
- var promise = state.facade;
1734
- var value = state.value;
1735
- var IS_UNHANDLED = isUnhandled(state);
1736
- var result;
1737
- if (IS_UNHANDLED) {
1738
- result = perform$2(function () {
1739
- if (IS_NODE) {
1740
- process.emit('unhandledRejection', value, promise);
1741
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1742
- });
1743
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1744
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
1745
- if (result.error) throw result.value;
1746
- }
1747
- });
1748
- };
1749
-
1750
- var isUnhandled = function (state) {
1751
- return state.rejection !== HANDLED && !state.parent;
1752
- };
1753
-
1754
- var onHandleUnhandled = function (state) {
1755
- call$5(task, global$1, function () {
1756
- var promise = state.facade;
1757
- if (IS_NODE) {
1758
- process.emit('rejectionHandled', promise);
1759
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1760
- });
1761
- };
1762
-
1763
- var bind$1 = function (fn, state, unwrap) {
1764
- return function (value) {
1765
- fn(state, value, unwrap);
1766
- };
1767
- };
1768
-
1769
- var internalReject = function (state, value, unwrap) {
1770
- if (state.done) return;
1771
- state.done = true;
1772
- if (unwrap) state = unwrap;
1773
- state.value = value;
1774
- state.state = REJECTED;
1775
- notify(state, true);
1776
- };
1777
-
1778
- var internalResolve = function (state, value, unwrap) {
1779
- if (state.done) return;
1780
- state.done = true;
1781
- if (unwrap) state = unwrap;
1782
- try {
1783
- if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
1784
- var then = isThenable(value);
1785
- if (then) {
1786
- microtask(function () {
1787
- var wrapper = { done: false };
1788
- try {
1789
- call$5(then, value,
1790
- bind$1(internalResolve, wrapper, state),
1791
- bind$1(internalReject, wrapper, state)
1792
- );
1793
- } catch (error) {
1794
- internalReject(wrapper, error, state);
1795
- }
1796
- });
1797
- } else {
1798
- state.value = value;
1799
- state.state = FULFILLED;
1800
- notify(state, false);
1801
- }
1802
- } catch (error) {
1803
- internalReject({ done: false }, error, state);
1804
- }
1805
- };
1806
-
1807
- // constructor polyfill
1808
- if (FORCED_PROMISE_CONSTRUCTOR$4) {
1809
- // 25.4.3.1 Promise(executor)
1810
- PromiseConstructor = function Promise(executor) {
1811
- anInstance(this, PromisePrototype);
1812
- aCallable$3(executor);
1813
- call$5(Internal, this);
1814
- var state = getInternalPromiseState(this);
1815
- try {
1816
- executor(bind$1(internalResolve, state), bind$1(internalReject, state));
1817
- } catch (error) {
1818
- internalReject(state, error);
1819
- }
1820
- };
1821
-
1822
- PromisePrototype = PromiseConstructor.prototype;
1823
-
1824
- // eslint-disable-next-line no-unused-vars -- required for `.length`
1825
- Internal = function Promise(executor) {
1826
- setInternalState(this, {
1827
- type: PROMISE,
1828
- done: false,
1829
- notified: false,
1830
- parent: false,
1831
- reactions: new Queue(),
1832
- rejection: false,
1833
- state: PENDING,
1834
- value: undefined
1835
- });
1836
- };
1837
-
1838
- // `Promise.prototype.then` method
1839
- // https://tc39.es/ecma262/#sec-promise.prototype.then
1840
- Internal.prototype = defineBuiltIn$1(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
1841
- var state = getInternalPromiseState(this);
1842
- var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
1843
- state.parent = true;
1844
- reaction.ok = isCallable$1(onFulfilled) ? onFulfilled : true;
1845
- reaction.fail = isCallable$1(onRejected) && onRejected;
1846
- reaction.domain = IS_NODE ? process.domain : undefined;
1847
- if (state.state === PENDING) state.reactions.add(reaction);
1848
- else microtask(function () {
1849
- callReaction(reaction, state);
1850
- });
1851
- return reaction.promise;
1852
- });
1853
-
1854
- OwnPromiseCapability = function () {
1855
- var promise = new Internal();
1856
- var state = getInternalPromiseState(promise);
1857
- this.promise = promise;
1858
- this.resolve = bind$1(internalResolve, state);
1859
- this.reject = bind$1(internalReject, state);
1860
- };
1861
-
1862
- newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
1863
- return C === PromiseConstructor || C === PromiseWrapper
1864
- ? new OwnPromiseCapability(C)
1865
- : newGenericPromiseCapability(C);
1866
- };
1867
-
1868
- if (isCallable$1(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
1869
- nativeThen = NativePromisePrototype$1.then;
1870
-
1871
- if (!NATIVE_PROMISE_SUBCLASSING) {
1872
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
1873
- defineBuiltIn$1(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
1874
- var that = this;
1875
- return new PromiseConstructor(function (resolve, reject) {
1876
- call$5(nativeThen, that, resolve, reject);
1877
- }).then(onFulfilled, onRejected);
1878
- // https://github.com/zloirock/core-js/issues/640
1879
- }, { unsafe: true });
1880
- }
1881
-
1882
- // make `.constructor === Promise` work for native promise-based APIs
1883
- try {
1884
- delete NativePromisePrototype$1.constructor;
1885
- } catch (error) { /* empty */ }
1886
-
1887
- // make `instanceof Promise` work for native promise-based APIs
1888
- if (setPrototypeOf) {
1889
- setPrototypeOf(NativePromisePrototype$1, PromisePrototype);
1890
- }
1891
- }
1892
- }
1893
-
1894
- $$5({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
1895
- Promise: PromiseConstructor
1896
- });
1897
-
1898
- setToStringTag(PromiseConstructor, PROMISE, false);
1899
- setSpecies(PROMISE);
1900
-
1901
- var iterators = {};
1902
-
1903
- var wellKnownSymbol$2 = wellKnownSymbol$a;
1904
- var Iterators$1 = iterators;
1905
-
1906
- var ITERATOR$2 = wellKnownSymbol$2('iterator');
1907
- var ArrayPrototype = Array.prototype;
1908
-
1909
- // check on default Array iterator
1910
- var isArrayIteratorMethod$1 = function (it) {
1911
- return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
1912
- };
1913
-
1914
- var classof = classof$2;
1915
- var getMethod$1 = getMethod$3;
1916
- var isNullOrUndefined = isNullOrUndefined$4;
1917
- var Iterators = iterators;
1918
- var wellKnownSymbol$1 = wellKnownSymbol$a;
1919
-
1920
- var ITERATOR$1 = wellKnownSymbol$1('iterator');
1921
-
1922
- var getIteratorMethod$2 = function (it) {
1923
- if (!isNullOrUndefined(it)) return getMethod$1(it, ITERATOR$1)
1924
- || getMethod$1(it, '@@iterator')
1925
- || Iterators[classof(it)];
1926
- };
1927
-
1928
- var call$4 = functionCall;
1929
- var aCallable$2 = aCallable$8;
1930
- var anObject$3 = anObject$8;
1931
- var tryToString$1 = tryToString$4;
1932
- var getIteratorMethod$1 = getIteratorMethod$2;
1933
-
1934
- var $TypeError$1 = TypeError;
1935
-
1936
- var getIterator$1 = function (argument, usingIterator) {
1937
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1938
- if (aCallable$2(iteratorMethod)) return anObject$3(call$4(iteratorMethod, argument));
1939
- throw new $TypeError$1(tryToString$1(argument) + ' is not iterable');
1940
- };
1941
-
1942
- var call$3 = functionCall;
1943
- var anObject$2 = anObject$8;
1944
- var getMethod = getMethod$3;
1945
-
1946
- var iteratorClose$1 = function (iterator, kind, value) {
1947
- var innerResult, innerError;
1948
- anObject$2(iterator);
1949
- try {
1950
- innerResult = getMethod(iterator, 'return');
1951
- if (!innerResult) {
1952
- if (kind === 'throw') throw value;
1953
- return value;
1954
- }
1955
- innerResult = call$3(innerResult, iterator);
1956
- } catch (error) {
1957
- innerError = true;
1958
- innerResult = error;
1959
- }
1960
- if (kind === 'throw') throw value;
1961
- if (innerError) throw innerResult;
1962
- anObject$2(innerResult);
1963
- return value;
1964
- };
1965
-
1966
- var bind = functionBindContext;
1967
- var call$2 = functionCall;
1968
- var anObject$1 = anObject$8;
1969
- var tryToString = tryToString$4;
1970
- var isArrayIteratorMethod = isArrayIteratorMethod$1;
1971
- var lengthOfArrayLike = lengthOfArrayLike$2;
1972
- var isPrototypeOf = objectIsPrototypeOf;
1973
- var getIterator = getIterator$1;
1974
- var getIteratorMethod = getIteratorMethod$2;
1975
- var iteratorClose = iteratorClose$1;
1976
-
1977
- var $TypeError = TypeError;
1978
-
1979
- var Result = function (stopped, result) {
1980
- this.stopped = stopped;
1981
- this.result = result;
1982
- };
1983
-
1984
- var ResultPrototype = Result.prototype;
1985
-
1986
- var iterate$2 = function (iterable, unboundFunction, options) {
1987
- var that = options && options.that;
1988
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1989
- var IS_RECORD = !!(options && options.IS_RECORD);
1990
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1991
- var INTERRUPTED = !!(options && options.INTERRUPTED);
1992
- var fn = bind(unboundFunction, that);
1993
- var iterator, iterFn, index, length, result, next, step;
1994
-
1995
- var stop = function (condition) {
1996
- if (iterator) iteratorClose(iterator, 'normal', condition);
1997
- return new Result(true, condition);
1998
- };
1999
-
2000
- var callFn = function (value) {
2001
- if (AS_ENTRIES) {
2002
- anObject$1(value);
2003
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2004
- } return INTERRUPTED ? fn(value, stop) : fn(value);
2005
- };
2006
-
2007
- if (IS_RECORD) {
2008
- iterator = iterable.iterator;
2009
- } else if (IS_ITERATOR) {
2010
- iterator = iterable;
2011
- } else {
2012
- iterFn = getIteratorMethod(iterable);
2013
- if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
2014
- // optimisation for array iterators
2015
- if (isArrayIteratorMethod(iterFn)) {
2016
- for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
2017
- result = callFn(iterable[index]);
2018
- if (result && isPrototypeOf(ResultPrototype, result)) return result;
2019
- } return new Result(false);
2020
- }
2021
- iterator = getIterator(iterable, iterFn);
2022
- }
2023
-
2024
- next = IS_RECORD ? iterable.next : iterator.next;
2025
- while (!(step = call$2(next, iterator)).done) {
2026
- try {
2027
- result = callFn(step.value);
2028
- } catch (error) {
2029
- iteratorClose(iterator, 'throw', error);
2030
- }
2031
- if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
2032
- } return new Result(false);
2033
- };
2034
-
2035
- var wellKnownSymbol = wellKnownSymbol$a;
2036
-
2037
- var ITERATOR = wellKnownSymbol('iterator');
2038
- var SAFE_CLOSING = false;
2039
-
2040
- try {
2041
- var called = 0;
2042
- var iteratorWithReturn = {
2043
- next: function () {
2044
- return { done: !!called++ };
2045
- },
2046
- 'return': function () {
2047
- SAFE_CLOSING = true;
2048
- }
2049
- };
2050
- iteratorWithReturn[ITERATOR] = function () {
2051
- return this;
2052
- };
2053
- // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
2054
- Array.from(iteratorWithReturn, function () { throw 2; });
2055
- } catch (error) { /* empty */ }
2056
-
2057
- var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
2058
- try {
2059
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2060
- } catch (error) { return false; } // workaround of old WebKit + `eval` bug
2061
- var ITERATION_SUPPORT = false;
2062
- try {
2063
- var object = {};
2064
- object[ITERATOR] = function () {
2065
- return {
2066
- next: function () {
2067
- return { done: ITERATION_SUPPORT = true };
2068
- }
2069
- };
2070
- };
2071
- exec(object);
2072
- } catch (error) { /* empty */ }
2073
- return ITERATION_SUPPORT;
2074
- };
2075
-
2076
- var NativePromiseConstructor$1 = promiseNativeConstructor;
2077
- var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
2078
- var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
2079
-
2080
- var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
2081
- NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2082
- });
2083
-
2084
- var $$4 = _export;
2085
- var call$1 = functionCall;
2086
- var aCallable$1 = aCallable$8;
2087
- var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2088
- var perform$1 = perform$3;
2089
- var iterate$1 = iterate$2;
2090
- var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2091
-
2092
- // `Promise.all` method
2093
- // https://tc39.es/ecma262/#sec-promise.all
2094
- $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2095
- all: function all(iterable) {
2096
- var C = this;
2097
- var capability = newPromiseCapabilityModule$2.f(C);
2098
- var resolve = capability.resolve;
2099
- var reject = capability.reject;
2100
- var result = perform$1(function () {
2101
- var $promiseResolve = aCallable$1(C.resolve);
2102
- var values = [];
2103
- var counter = 0;
2104
- var remaining = 1;
2105
- iterate$1(iterable, function (promise) {
2106
- var index = counter++;
2107
- var alreadyCalled = false;
2108
- remaining++;
2109
- call$1($promiseResolve, C, promise).then(function (value) {
2110
- if (alreadyCalled) return;
2111
- alreadyCalled = true;
2112
- values[index] = value;
2113
- --remaining || resolve(values);
2114
- }, reject);
2115
- });
2116
- --remaining || resolve(values);
2117
- });
2118
- if (result.error) reject(result.value);
2119
- return capability.promise;
2120
- }
2121
- });
2122
-
2123
- var $$3 = _export;
2124
- var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2125
- var NativePromiseConstructor = promiseNativeConstructor;
2126
- var getBuiltIn$1 = getBuiltIn$7;
2127
- var isCallable = isCallable$g;
2128
- var defineBuiltIn = defineBuiltIn$3;
2129
-
2130
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
2131
-
2132
- // `Promise.prototype.catch` method
2133
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
2134
- $$3({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2135
- 'catch': function (onRejected) {
2136
- return this.then(undefined, onRejected);
2137
- }
2138
- });
2139
-
2140
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2141
- if (isCallable(NativePromiseConstructor)) {
2142
- var method = getBuiltIn$1('Promise').prototype['catch'];
2143
- if (NativePromisePrototype['catch'] !== method) {
2144
- defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
2145
- }
2146
- }
2147
-
2148
- var $$2 = _export;
2149
- var call = functionCall;
2150
- var aCallable = aCallable$8;
2151
- var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2152
- var perform = perform$3;
2153
- var iterate = iterate$2;
2154
- var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2155
-
2156
- // `Promise.race` method
2157
- // https://tc39.es/ecma262/#sec-promise.race
2158
- $$2({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2159
- race: function race(iterable) {
2160
- var C = this;
2161
- var capability = newPromiseCapabilityModule$1.f(C);
2162
- var reject = capability.reject;
2163
- var result = perform(function () {
2164
- var $promiseResolve = aCallable(C.resolve);
2165
- iterate(iterable, function (promise) {
2166
- call($promiseResolve, C, promise).then(capability.resolve, reject);
2167
- });
2168
- });
2169
- if (result.error) reject(result.value);
2170
- return capability.promise;
2171
- }
2172
- });
2173
-
2174
- var $$1 = _export;
2175
- var newPromiseCapabilityModule = newPromiseCapability$2;
2176
- var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2177
-
2178
- // `Promise.reject` method
2179
- // https://tc39.es/ecma262/#sec-promise.reject
2180
- $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2181
- reject: function reject(r) {
2182
- var capability = newPromiseCapabilityModule.f(this);
2183
- var capabilityReject = capability.reject;
2184
- capabilityReject(r);
2185
- return capability.promise;
2186
- }
2187
- });
2188
-
2189
- var anObject = anObject$8;
2190
- var isObject = isObject$8;
2191
- var newPromiseCapability = newPromiseCapability$2;
2192
-
2193
- var promiseResolve$1 = function (C, x) {
2194
- anObject(C);
2195
- if (isObject(x) && x.constructor === C) return x;
2196
- var promiseCapability = newPromiseCapability.f(C);
2197
- var resolve = promiseCapability.resolve;
2198
- resolve(x);
2199
- return promiseCapability.promise;
2200
- };
2201
-
2202
- var $ = _export;
2203
- var getBuiltIn = getBuiltIn$7;
2204
- var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2205
- var promiseResolve = promiseResolve$1;
2206
-
2207
- getBuiltIn('Promise');
2208
-
2209
- // `Promise.resolve` method
2210
- // https://tc39.es/ecma262/#sec-promise.resolve
2211
- $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2212
- resolve: function resolve(x) {
2213
- return promiseResolve(this, x);
2214
- }
2215
- });
2216
-
2217
- /**
2218
- * A fixture instance that is generated new for each test run.
2219
- */
2220
-
2221
- /**
2222
- * The test fixture is used as a singleton across tests used in a single context.
2223
- *
2224
- * This allows us to define tests while referencing the instance.
2225
- */
2226
-
2227
- /**
2228
- * JestTestFixture with additional functions that the JestTestContextFactory sees for managing the instance.
2229
- *
2230
- * The fixture is used as a refernce point for the Instance that is changed between each test.
2231
- */
2232
-
2233
- /**
2234
- * Abstract JestTestContextFixture instance.
2235
- */
2236
- class AbstractJestTestContextFixture {
2237
- constructor() {
2238
- this._instance = void 0;
2239
- }
2240
- get instance() {
2241
- return this._instance;
2242
- }
2243
- setInstance(instance) {
2244
- if (this._instance != null) {
2245
- throw new Error(`The testing fixture is locked. Don't call setInstance() directly.`);
2246
- }
2247
- this._instance = instance;
2248
- return () => {
2249
- delete this._instance;
2250
- };
2251
- }
2252
- }
2253
-
2254
- /**
2255
- * Abstract JestTestContextFixture instance with a parent.
2256
- */
2257
- class AbstractChildJestTestContextFixture extends AbstractJestTestContextFixture {
2258
- constructor(parent) {
2259
- super();
2260
- this.parent = parent;
2261
- }
2262
- }
2263
-
2264
- /**
2265
- * Used for Jest tests to execute a number of tests using the fixture.
2266
- *
2267
- * The fixture is automatically setup and torn down each test per the configuration with a clean fixture instance.
2268
- */
2269
-
2270
- /**
2271
- * Used to configure a JestTestContextFactory for building tests.
2272
- */
2273
-
2274
- /**
2275
- * Creates a JestTestContextBuilderFunction given the input builder.
2276
- *
2277
- * @param builder
2278
- * @returns
2279
- */
2280
- function jestTestContextBuilder(builder) {
2281
- return inputConfig => {
2282
- const config = builder.buildConfig(inputConfig);
2283
- return buildTests => {
2284
- const fixture = builder.buildFixture(config);
2285
-
2286
- // add before each
2287
- if (builder.beforeEach != null) {
2288
- beforeEach(builder.beforeEach);
2289
- }
2290
-
2291
- // add tests
2292
- useJestContextFixture({
2293
- fixture,
2294
- /**
2295
- * Build tests by passing the fixture to the testing functions.
2296
- *
2297
- * This will inject all tests and sub Jest lifecycle items.
2298
- */
2299
- buildTests,
2300
- initInstance: () => builder.setupInstance(config),
2301
- destroyInstance: instance => builder.teardownInstance(instance, config)
2302
- });
2303
-
2304
- // add after each
2305
- if (builder.afterEach != null) {
2306
- afterEach(builder.afterEach);
2307
- }
2308
- };
2309
- };
2310
- }
2311
- /**
2312
- * Creates a test context and jest configurations that will initialize an instance
2313
- */
2314
- function useJestContextFixture(config) {
2315
- const {
2316
- buildTests,
2317
- fixture,
2318
- initInstance,
2319
- destroyInstance
2320
- } = config;
2321
- let clearInstance;
2322
- let instance;
2323
-
2324
- // Create an instance
2325
- beforeEach(async () => {
2326
- try {
2327
- instance = await initInstance();
2328
- clearInstance = fixture.setInstance(instance);
2329
- } catch (e) {
2330
- console.error('Failed building a test instance due to an error in buildInstance(). Error: ', e);
2331
- if (clearInstance) {
2332
- clearInstance();
2333
- }
2334
- throw e;
2335
- }
2336
- });
2337
-
2338
- // Declare tests
2339
- buildTests(fixture);
2340
-
2341
- // Cleanup
2342
- afterEach(async () => {
2343
- if (clearInstance) {
2344
- clearInstance();
2345
- }
2346
- if (fixture.instance != null) {
2347
- console.warn('Expected instance to be set on fixture for cleanup but was set to something else.');
2348
- }
2349
- if (destroyInstance) {
2350
- try {
2351
- await destroyInstance(instance);
2352
- instance = undefined;
2353
- } catch (e) {
2354
- console.error('Failed due to error in destroyInstance()');
2355
- throw e;
2356
- }
2357
- }
2358
- });
2359
- }
2360
-
2361
- var makeError = {exports: {}};
2362
-
2363
- (function (module, exports) {
2364
-
2365
- // ===================================================================
2366
-
2367
- var construct = typeof Reflect !== "undefined" ? Reflect.construct : undefined;
2368
- var defineProperty = Object.defineProperty;
2369
-
2370
- // -------------------------------------------------------------------
2371
-
2372
- var captureStackTrace = Error.captureStackTrace;
2373
- if (captureStackTrace === undefined) {
2374
- captureStackTrace = function captureStackTrace(error) {
2375
- var container = new Error();
2376
-
2377
- defineProperty(error, "stack", {
2378
- configurable: true,
2379
- get: function getStack() {
2380
- var stack = container.stack;
2381
-
2382
- // Replace property with value for faster future accesses.
2383
- defineProperty(this, "stack", {
2384
- configurable: true,
2385
- value: stack,
2386
- writable: true,
2387
- });
2388
-
2389
- return stack;
2390
- },
2391
- set: function setStack(stack) {
2392
- defineProperty(error, "stack", {
2393
- configurable: true,
2394
- value: stack,
2395
- writable: true,
2396
- });
2397
- },
2398
- });
2399
- };
2400
- }
2401
-
2402
- // -------------------------------------------------------------------
2403
-
2404
- function BaseError(message) {
2405
- if (message !== undefined) {
2406
- defineProperty(this, "message", {
2407
- configurable: true,
2408
- value: message,
2409
- writable: true,
2410
- });
2411
- }
2412
-
2413
- var cname = this.constructor.name;
2414
- if (cname !== undefined && cname !== this.name) {
2415
- defineProperty(this, "name", {
2416
- configurable: true,
2417
- value: cname,
2418
- writable: true,
2419
- });
2420
- }
2421
-
2422
- captureStackTrace(this, this.constructor);
2423
- }
2424
-
2425
- BaseError.prototype = Object.create(Error.prototype, {
2426
- // See: https://github.com/JsCommunity/make-error/issues/4
2427
- constructor: {
2428
- configurable: true,
2429
- value: BaseError,
2430
- writable: true,
2431
- },
2432
- });
2433
-
2434
- // -------------------------------------------------------------------
2435
-
2436
- // Sets the name of a function if possible (depends of the JS engine).
2437
- var setFunctionName = (function() {
2438
- function setFunctionName(fn, name) {
2439
- return defineProperty(fn, "name", {
2440
- configurable: true,
2441
- value: name,
2442
- });
2443
- }
2444
- try {
2445
- var f = function() {};
2446
- setFunctionName(f, "foo");
2447
- if (f.name === "foo") {
2448
- return setFunctionName;
2449
- }
2450
- } catch (_) {}
2451
- })();
2452
-
2453
- // -------------------------------------------------------------------
2454
-
2455
- function makeError(constructor, super_) {
2456
- if (super_ == null || super_ === Error) {
2457
- super_ = BaseError;
2458
- } else if (typeof super_ !== "function") {
2459
- throw new TypeError("super_ should be a function");
2460
- }
2461
-
2462
- var name;
2463
- if (typeof constructor === "string") {
2464
- name = constructor;
2465
- constructor =
2466
- construct !== undefined
2467
- ? function() {
2468
- return construct(super_, arguments, this.constructor);
2469
- }
2470
- : function() {
2471
- super_.apply(this, arguments);
2472
- };
2473
-
2474
- // If the name can be set, do it once and for all.
2475
- if (setFunctionName !== undefined) {
2476
- setFunctionName(constructor, name);
2477
- name = undefined;
2478
- }
2479
- } else if (typeof constructor !== "function") {
2480
- throw new TypeError("constructor should be either a string or a function");
2481
- }
2482
-
2483
- // Also register the super constructor also as `constructor.super_` just
2484
- // like Node's `util.inherits()`.
2485
- //
2486
- // eslint-disable-next-line dot-notation
2487
- constructor.super_ = constructor["super"] = super_;
2488
-
2489
- var properties = {
2490
- constructor: {
2491
- configurable: true,
2492
- value: constructor,
2493
- writable: true,
2494
- },
2495
- };
2496
-
2497
- // If the name could not be set on the constructor, set it on the
2498
- // prototype.
2499
- if (name !== undefined) {
2500
- properties.name = {
2501
- configurable: true,
2502
- value: name,
2503
- writable: true,
2504
- };
2505
- }
2506
- constructor.prototype = Object.create(super_.prototype, properties);
2507
-
2508
- return constructor;
2509
- }
2510
- exports = module.exports = makeError;
2511
- exports.BaseError = BaseError;
2512
- }(makeError, makeError.exports));
2513
-
2514
- /**
2515
- * https://github.com/facebook/jest/issues/11698
2516
- *
2517
- * Since fail() was silently removed, we redefine it.
2518
- */
2519
-
2520
- // MARK: Types
2521
-
2522
- /**
2523
- * Passes the error to the JestDoneCallback.
2524
- * @param done
2525
- * @param e
2526
- */
2527
- function failWithJestDoneCallback(done, e = new Error('failed test')) {
2528
- if (done.fail != null) {
2529
- done.fail(e);
2530
- } else {
2531
- done(e);
2532
- }
2533
- }
2534
- // MARK: Errors
2535
- /**
2536
- * Error thrown by fail() and used by expectError()
2537
- */
2538
- class JestExpectedFailError extends makeError.exports.BaseError {}
2539
- function failSuccessfullyError(message) {
2540
- return new JestExpectedFailError(message);
2541
- }
2542
- function failSuccessfully(message) {
2543
- throw failSuccessfullyError(message);
2544
- }
2545
-
2546
- /**
2547
- * Error thrown when success occurs when it should not have.
2548
- */
2549
- class JestUnexpectedSuccessFailureError extends makeError.exports.BaseError {}
2550
- function failDueToSuccessError(message) {
2551
- return new JestUnexpectedSuccessFailureError(message != null ? message : 'expected an error to occur but was successful instead');
2552
- }
2553
- function failTest(message) {
2554
- throw failDueToSuccessError(message);
2555
- }
2556
- function failDueToSuccess() {
2557
- throw failDueToSuccessError();
2558
- }
2559
- function failWithDoneDueToSuccess(done) {
2560
- failWithJestDoneCallback(done, failDueToSuccessError());
2561
- }
2562
- function EXPECT_ERROR_DEFAULT_HANDLER(e) {
2563
- if (e instanceof JestExpectedFailError) ; else {
2564
- throw e;
2565
- }
2566
- }
2567
-
2568
- // MARK: Expect Fail
2569
- /**
2570
- * Function that expects any failure to be thrown, then throws a JestExpectedFailError.
2571
- *
2572
- * @param errorFn
2573
- * @param handleError
2574
- */
2575
-
2576
- function expectFail(errorFn) {
2577
- function handleError(e) {
2578
- if (e instanceof JestUnexpectedSuccessFailureError) {
2579
- throw e;
2580
- } else {
2581
- failSuccessfully();
2582
- }
2583
- }
2584
- try {
2585
- const result = errorFn();
2586
- if (isPromise(result)) {
2587
- return result.then(failDueToSuccess).catch(handleError);
2588
- } else {
2589
- failDueToSuccess();
2590
- }
2591
- } catch (e) {
2592
- handleError(e);
2593
- }
2594
- }
2595
-
2596
- /**
2597
- * Function that expects a JestExpectedFailError to be thrown.
2598
- *
2599
- * @param errorFn
2600
- * @param handleError
2601
- */
2602
-
2603
- function expectSuccessfulFail(errorFn, handleError = EXPECT_ERROR_DEFAULT_HANDLER) {
2604
- try {
2605
- const result = errorFn();
2606
- if (isPromise(result)) {
2607
- return result.then(failDueToSuccess).catch(handleError);
2608
- } else {
2609
- failDueToSuccess();
2610
- }
2611
- } catch (e) {
2612
- handleError(e);
2613
- }
2614
- }
2615
-
2616
- // MARK: ShouldFail
2617
-
2618
- /**
2619
- * Used to wrap a Jest testing function and watch for JestExpectedFailError errors in order to pass the test. Other exceptions are treated normally as failures.
2620
- *
2621
- * This is typically used in conjunction with failSuccessfully(), expectSuccessfulFail(), or expectFail().
2622
- *
2623
- * @param fn
2624
- * @param strict
2625
- * @returns
2626
- */
2627
- function shouldFail(fn) {
2628
- const usesDoneCallback = fn.length > 0;
2629
- return done => {
2630
- function handleError(e) {
2631
- if (!(e instanceof JestExpectedFailError)) {
2632
- failWithJestDoneCallback(done, e);
2633
- } else {
2634
- done();
2635
- }
2636
- }
2637
- expectSuccessfulFail(() => {
2638
- let result;
2639
- if (usesDoneCallback) {
2640
- const fakeDone = build({
2641
- base: fakeDoneHandler(),
2642
- build: x => {
2643
- x.failSuccessfully = () => {
2644
- fakeDone(failSuccessfullyError());
2645
- };
2646
- }
2647
- });
2648
- const callbackWithDoneResult = fn(fakeDone);
2649
- if (isPromise(callbackWithDoneResult)) {
2650
- fakeDone.reject(new Error('Configured to use "done" value while returning a promise. Configure your test to use one or the other.'));
2651
- }
2652
-
2653
- // return the fake done promise. Done/fail will resolve as a promise.
2654
- result = fakeDone._ref.promise;
2655
- } else {
2656
- result = fn();
2657
- }
2658
- return result;
2659
- }, handleError);
2660
- };
2661
- }
2662
-
2663
- // MARK: It
2664
-
2665
- function itShouldFail(describeOrFn, fn) {
2666
- let description;
2667
- if (typeof describeOrFn === 'string') {
2668
- description = `should fail ${describeOrFn}`;
2669
- } else {
2670
- fn = describeOrFn;
2671
- description = 'should fail';
2672
- }
2673
- it(description, shouldFail(fn));
2674
- }
2675
-
2676
- // MARK: Fake Done
2677
-
2678
- function fakeDoneHandler() {
2679
- const promiseRef = promiseReference();
2680
- const doneHandler = promiseRef.resolve;
2681
- const failHandler = e => {
2682
- promiseRef.reject(e);
2683
- };
2684
- const fakeDone = error => {
2685
- if (error) {
2686
- failHandler(error);
2687
- } else {
2688
- doneHandler(0);
2689
- }
2690
- };
2691
- fakeDone.fail = error => {
2692
- failHandler(error);
2693
- };
2694
- fakeDone._ref = promiseRef;
2695
- fakeDone.promise = promiseRef.promise;
2696
- fakeDone.resolve = promiseRef.resolve;
2697
- fakeDone.reject = promiseRef.reject;
2698
- return fakeDone;
2699
- }
2700
-
2701
- class AbstractWrappedFixture {
2702
- constructor(fixture) {
2703
- this.fixture = fixture;
2704
- }
2705
- }
2706
- class AbstractWrappedFixtureWithInstance extends AbstractJestTestContextFixture {
2707
- constructor(parent) {
2708
- super();
2709
- this.parent = parent;
2710
- }
2711
- }
2712
-
2713
- /**
2714
- * Used to wrap a JestTestContextFactory of one fixture type to another.
2715
- *
2716
- * This is useful for cases where the base fixture may be used in a lot of places and contexts, but the wrapped version can configure
2717
- * tests more specifically.
2718
- */
2719
-
2720
- /**
2721
- * Wraps the input JestTestContextFactory to emit another type of Fixture for tests.
2722
- *
2723
- * @returns
2724
- */
2725
- function wrapJestTestContextFactory(config) {
2726
- return factory => {
2727
- return buildTests => {
2728
- factory(inputFixture => {
2729
- const wrap = config.wrapFixture(inputFixture);
2730
- let effect;
2731
-
2732
- // add before each
2733
- if (config.setupWrap != null) {
2734
- beforeEach(async () => {
2735
- effect = await config.setupWrap(wrap);
2736
- });
2737
- }
2738
-
2739
- // add tests
2740
- buildTests(wrap);
2741
-
2742
- // add after each
2743
- if (config.teardownWrap != null) {
2744
- afterEach(async () => {
2745
- await config.teardownWrap(wrap, effect);
2746
- });
2747
- }
2748
- });
2749
- };
2750
- };
2751
- }
2752
-
2753
- // MARK EasyWrap
2754
-
2755
- function instanceWrapJestTestContextFactory(config) {
2756
- return wrapJestTestContextFactory({
2757
- wrapFixture: config.wrapFixture,
2758
- setupWrap: async wrap => {
2759
- const instance = await config.makeInstance(wrap);
2760
- const effect = wrap.setInstance(instance);
2761
- if (config.setupInstance) {
2762
- await config.setupInstance(instance, wrap);
2763
- }
2764
- return effect;
2765
- },
2766
- teardownWrap: async (wrap, deleteInstanceEffect) => {
2767
- deleteInstanceEffect == null || deleteInstanceEffect();
2768
- if (config.teardownInstance) {
2769
- await config.teardownInstance(wrap.instance);
2770
- }
2771
- }
2772
- });
2773
- }
2774
-
2775
- /**
2776
- * Creates a test context and jest configurations that provides a function to build tests based on the configuration.
2777
- */
2778
- function useJestFunctionFixture(config, buildTests) {
2779
- const {
2780
- fn
2781
- } = config;
2782
- const forward = forwardFunction(fn);
2783
- buildTests(forward);
2784
- }
2785
-
2786
- // MARK: Array Fixture
2787
-
2788
- /**
2789
- * Creates a test context and jest configurations that provides a function to build tests based on the configuration.
2790
- */
2791
- function useJestFunctionMapFixture(config, buildTests) {
2792
- const forwardedFunctions = mapObjectMap(config.fns, fn => forwardFunction(fn));
2793
- buildTests(forwardedFunctions);
2794
- }
2795
-
2796
- export { AbstractChildJestTestContextFixture, AbstractJestTestContextFixture, AbstractWrappedFixture, AbstractWrappedFixtureWithInstance, EXPECT_ERROR_DEFAULT_HANDLER, JestExpectedFailError, JestUnexpectedSuccessFailureError, expectFail, expectSuccessfulFail, failDueToSuccess, failDueToSuccessError, failSuccessfully, failSuccessfullyError, failTest, failWithDoneDueToSuccess, failWithJestDoneCallback, fakeDoneHandler, instanceWrapJestTestContextFactory, itShouldFail, jestTestContextBuilder, shouldFail, useJestContextFixture, useJestFunctionFixture, useJestFunctionMapFixture, wrapJestTestContextFactory };