@intrig/react 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js DELETED
@@ -1,3412 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { createContext, useReducer, useMemo, useContext, useState, useCallback } from 'react';
3
- import axios, { isAxiosError } from 'axios';
4
-
5
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
-
7
- var check = function (it) {
8
- return it && it.Math === Math && it;
9
- };
10
-
11
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
12
- var globalThis_1 =
13
- // eslint-disable-next-line es/no-global-this -- safe
14
- check(typeof globalThis == 'object' && globalThis) ||
15
- check(typeof window == 'object' && window) ||
16
- // eslint-disable-next-line no-restricted-globals -- safe
17
- check(typeof self == 'object' && self) ||
18
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
19
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
20
- // eslint-disable-next-line no-new-func -- fallback
21
- (function () { return this; })() || Function('return this')();
22
-
23
- var objectGetOwnPropertyDescriptor = {};
24
-
25
- var fails$f = function (exec) {
26
- try {
27
- return !!exec();
28
- } catch (error) {
29
- return true;
30
- }
31
- };
32
-
33
- var fails$e = fails$f;
34
-
35
- // Detect IE8's incomplete defineProperty implementation
36
- var descriptors = !fails$e(function () {
37
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
38
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
39
- });
40
-
41
- var fails$d = fails$f;
42
-
43
- var functionBindNative = !fails$d(function () {
44
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
45
- var test = (function () { /* empty */ }).bind();
46
- // eslint-disable-next-line no-prototype-builtins -- safe
47
- return typeof test != 'function' || test.hasOwnProperty('prototype');
48
- });
49
-
50
- var NATIVE_BIND$3 = functionBindNative;
51
-
52
- var call$d = Function.prototype.call;
53
-
54
- var functionCall = NATIVE_BIND$3 ? call$d.bind(call$d) : function () {
55
- return call$d.apply(call$d, arguments);
56
- };
57
-
58
- var objectPropertyIsEnumerable = {};
59
-
60
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
61
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
62
- var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
63
-
64
- // Nashorn ~ JDK8 bug
65
- var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
66
-
67
- // `Object.prototype.propertyIsEnumerable` method implementation
68
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
69
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
70
- var descriptor = getOwnPropertyDescriptor$2(this, V);
71
- return !!descriptor && descriptor.enumerable;
72
- } : $propertyIsEnumerable;
73
-
74
- var createPropertyDescriptor$4 = function (bitmap, value) {
75
- return {
76
- enumerable: !(bitmap & 1),
77
- configurable: !(bitmap & 2),
78
- writable: !(bitmap & 4),
79
- value: value
80
- };
81
- };
82
-
83
- var NATIVE_BIND$2 = functionBindNative;
84
-
85
- var FunctionPrototype$2 = Function.prototype;
86
- var call$c = FunctionPrototype$2.call;
87
- var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$c, call$c);
88
-
89
- var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
90
- return function () {
91
- return call$c.apply(fn, arguments);
92
- };
93
- };
94
-
95
- var uncurryThis$f = functionUncurryThis;
96
-
97
- var toString$3 = uncurryThis$f({}.toString);
98
- var stringSlice$1 = uncurryThis$f(''.slice);
99
-
100
- var classofRaw$2 = function (it) {
101
- return stringSlice$1(toString$3(it), 8, -1);
102
- };
103
-
104
- var uncurryThis$e = functionUncurryThis;
105
- var fails$c = fails$f;
106
- var classof$6 = classofRaw$2;
107
-
108
- var $Object$4 = Object;
109
- var split = uncurryThis$e(''.split);
110
-
111
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
112
- var indexedObject = fails$c(function () {
113
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
114
- // eslint-disable-next-line no-prototype-builtins -- safe
115
- return !$Object$4('z').propertyIsEnumerable(0);
116
- }) ? function (it) {
117
- return classof$6(it) === 'String' ? split(it, '') : $Object$4(it);
118
- } : $Object$4;
119
-
120
- // we can't use just `it == null` since of `document.all` special case
121
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
122
- var isNullOrUndefined$4 = function (it) {
123
- return it === null || it === undefined;
124
- };
125
-
126
- var isNullOrUndefined$3 = isNullOrUndefined$4;
127
-
128
- var $TypeError$e = TypeError;
129
-
130
- // `RequireObjectCoercible` abstract operation
131
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
132
- var requireObjectCoercible$4 = function (it) {
133
- if (isNullOrUndefined$3(it)) throw new $TypeError$e("Can't call method on " + it);
134
- return it;
135
- };
136
-
137
- // toObject with fallback for non-array-like ES3 strings
138
- var IndexedObject$2 = indexedObject;
139
- var requireObjectCoercible$3 = requireObjectCoercible$4;
140
-
141
- var toIndexedObject$5 = function (it) {
142
- return IndexedObject$2(requireObjectCoercible$3(it));
143
- };
144
-
145
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
146
- var documentAll = typeof document == 'object' && document.all;
147
-
148
- // `IsCallable` abstract operation
149
- // https://tc39.es/ecma262/#sec-iscallable
150
- // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
151
- var isCallable$j = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
152
- return typeof argument == 'function' || argument === documentAll;
153
- } : function (argument) {
154
- return typeof argument == 'function';
155
- };
156
-
157
- var isCallable$i = isCallable$j;
158
-
159
- var isObject$b = function (it) {
160
- return typeof it == 'object' ? it !== null : isCallable$i(it);
161
- };
162
-
163
- var globalThis$j = globalThis_1;
164
- var isCallable$h = isCallable$j;
165
-
166
- var aFunction = function (argument) {
167
- return isCallable$h(argument) ? argument : undefined;
168
- };
169
-
170
- var getBuiltIn$7 = function (namespace, method) {
171
- return arguments.length < 2 ? aFunction(globalThis$j[namespace]) : globalThis$j[namespace] && globalThis$j[namespace][method];
172
- };
173
-
174
- var uncurryThis$d = functionUncurryThis;
175
-
176
- var objectIsPrototypeOf = uncurryThis$d({}.isPrototypeOf);
177
-
178
- var globalThis$i = globalThis_1;
179
-
180
- var navigator = globalThis$i.navigator;
181
- var userAgent$5 = navigator && navigator.userAgent;
182
-
183
- var environmentUserAgent = userAgent$5 ? String(userAgent$5) : '';
184
-
185
- var globalThis$h = globalThis_1;
186
- var userAgent$4 = environmentUserAgent;
187
-
188
- var process$3 = globalThis$h.process;
189
- var Deno$1 = globalThis$h.Deno;
190
- var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
191
- var v8 = versions && versions.v8;
192
- var match, version;
193
-
194
- if (v8) {
195
- match = v8.split('.');
196
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
197
- // but their correct versions are not interesting for us
198
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
199
- }
200
-
201
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
202
- // so check `userAgent` even if `.v8` exists, but 0
203
- if (!version && userAgent$4) {
204
- match = userAgent$4.match(/Edge\/(\d+)/);
205
- if (!match || match[1] >= 74) {
206
- match = userAgent$4.match(/Chrome\/(\d+)/);
207
- if (match) version = +match[1];
208
- }
209
- }
210
-
211
- var environmentV8Version = version;
212
-
213
- /* eslint-disable es/no-symbol -- required for testing */
214
- var V8_VERSION$1 = environmentV8Version;
215
- var fails$b = fails$f;
216
- var globalThis$g = globalThis_1;
217
-
218
- var $String$5 = globalThis$g.String;
219
-
220
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
221
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$b(function () {
222
- var symbol = Symbol('symbol detection');
223
- // Chrome 38 Symbol has incorrect toString conversion
224
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
225
- // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
226
- // of course, fail.
227
- return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
228
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
229
- !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
230
- });
231
-
232
- /* eslint-disable es/no-symbol -- required for testing */
233
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
234
-
235
- var useSymbolAsUid = NATIVE_SYMBOL$1
236
- && !Symbol.sham
237
- && typeof Symbol.iterator == 'symbol';
238
-
239
- var getBuiltIn$6 = getBuiltIn$7;
240
- var isCallable$g = isCallable$j;
241
- var isPrototypeOf$2 = objectIsPrototypeOf;
242
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
243
-
244
- var $Object$3 = Object;
245
-
246
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
247
- return typeof it == 'symbol';
248
- } : function (it) {
249
- var $Symbol = getBuiltIn$6('Symbol');
250
- return isCallable$g($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$3(it));
251
- };
252
-
253
- var $String$4 = String;
254
-
255
- var tryToString$4 = function (argument) {
256
- try {
257
- return $String$4(argument);
258
- } catch (error) {
259
- return 'Object';
260
- }
261
- };
262
-
263
- var isCallable$f = isCallable$j;
264
- var tryToString$3 = tryToString$4;
265
-
266
- var $TypeError$d = TypeError;
267
-
268
- // `Assert: IsCallable(argument) is true`
269
- var aCallable$9 = function (argument) {
270
- if (isCallable$f(argument)) return argument;
271
- throw new $TypeError$d(tryToString$3(argument) + ' is not a function');
272
- };
273
-
274
- var aCallable$8 = aCallable$9;
275
- var isNullOrUndefined$2 = isNullOrUndefined$4;
276
-
277
- // `GetMethod` abstract operation
278
- // https://tc39.es/ecma262/#sec-getmethod
279
- var getMethod$3 = function (V, P) {
280
- var func = V[P];
281
- return isNullOrUndefined$2(func) ? undefined : aCallable$8(func);
282
- };
283
-
284
- var call$b = functionCall;
285
- var isCallable$e = isCallable$j;
286
- var isObject$a = isObject$b;
287
-
288
- var $TypeError$c = TypeError;
289
-
290
- // `OrdinaryToPrimitive` abstract operation
291
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
292
- var ordinaryToPrimitive$1 = function (input, pref) {
293
- var fn, val;
294
- if (pref === 'string' && isCallable$e(fn = input.toString) && !isObject$a(val = call$b(fn, input))) return val;
295
- if (isCallable$e(fn = input.valueOf) && !isObject$a(val = call$b(fn, input))) return val;
296
- if (pref !== 'string' && isCallable$e(fn = input.toString) && !isObject$a(val = call$b(fn, input))) return val;
297
- throw new $TypeError$c("Can't convert object to primitive value");
298
- };
299
-
300
- var sharedStore = {exports: {}};
301
-
302
- var globalThis$f = globalThis_1;
303
-
304
- // eslint-disable-next-line es/no-object-defineproperty -- safe
305
- var defineProperty$6 = Object.defineProperty;
306
-
307
- var defineGlobalProperty$3 = function (key, value) {
308
- try {
309
- defineProperty$6(globalThis$f, key, { value: value, configurable: true, writable: true });
310
- } catch (error) {
311
- globalThis$f[key] = value;
312
- } return value;
313
- };
314
-
315
- var globalThis$e = globalThis_1;
316
- var defineGlobalProperty$2 = defineGlobalProperty$3;
317
-
318
- var SHARED = '__core-js_shared__';
319
- var store$3 = sharedStore.exports = globalThis$e[SHARED] || defineGlobalProperty$2(SHARED, {});
320
-
321
- (store$3.versions || (store$3.versions = [])).push({
322
- version: '3.38.1',
323
- mode: 'global',
324
- copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
325
- license: 'https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE',
326
- source: 'https://github.com/zloirock/core-js'
327
- });
328
-
329
- var sharedStoreExports = sharedStore.exports;
330
-
331
- var store$2 = sharedStoreExports;
332
-
333
- var shared$3 = function (key, value) {
334
- return store$2[key] || (store$2[key] = value || {});
335
- };
336
-
337
- var requireObjectCoercible$2 = requireObjectCoercible$4;
338
-
339
- var $Object$2 = Object;
340
-
341
- // `ToObject` abstract operation
342
- // https://tc39.es/ecma262/#sec-toobject
343
- var toObject$4 = function (argument) {
344
- return $Object$2(requireObjectCoercible$2(argument));
345
- };
346
-
347
- var uncurryThis$c = functionUncurryThis;
348
- var toObject$3 = toObject$4;
349
-
350
- var hasOwnProperty = uncurryThis$c({}.hasOwnProperty);
351
-
352
- // `HasOwnProperty` abstract operation
353
- // https://tc39.es/ecma262/#sec-hasownproperty
354
- // eslint-disable-next-line es/no-object-hasown -- safe
355
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
356
- return hasOwnProperty(toObject$3(it), key);
357
- };
358
-
359
- var uncurryThis$b = functionUncurryThis;
360
-
361
- var id = 0;
362
- var postfix = Math.random();
363
- var toString$2 = uncurryThis$b(1.0.toString);
364
-
365
- var uid$2 = function (key) {
366
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
367
- };
368
-
369
- var globalThis$d = globalThis_1;
370
- var shared$2 = shared$3;
371
- var hasOwn$9 = hasOwnProperty_1;
372
- var uid$1 = uid$2;
373
- var NATIVE_SYMBOL = symbolConstructorDetection;
374
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
375
-
376
- var Symbol$1 = globalThis$d.Symbol;
377
- var WellKnownSymbolsStore = shared$2('wks');
378
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
379
-
380
- var wellKnownSymbol$g = function (name) {
381
- if (!hasOwn$9(WellKnownSymbolsStore, name)) {
382
- WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name)
383
- ? Symbol$1[name]
384
- : createWellKnownSymbol('Symbol.' + name);
385
- } return WellKnownSymbolsStore[name];
386
- };
387
-
388
- var call$a = functionCall;
389
- var isObject$9 = isObject$b;
390
- var isSymbol$1 = isSymbol$2;
391
- var getMethod$2 = getMethod$3;
392
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
393
- var wellKnownSymbol$f = wellKnownSymbol$g;
394
-
395
- var $TypeError$b = TypeError;
396
- var TO_PRIMITIVE = wellKnownSymbol$f('toPrimitive');
397
-
398
- // `ToPrimitive` abstract operation
399
- // https://tc39.es/ecma262/#sec-toprimitive
400
- var toPrimitive$1 = function (input, pref) {
401
- if (!isObject$9(input) || isSymbol$1(input)) return input;
402
- var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
403
- var result;
404
- if (exoticToPrim) {
405
- if (pref === undefined) pref = 'default';
406
- result = call$a(exoticToPrim, input, pref);
407
- if (!isObject$9(result) || isSymbol$1(result)) return result;
408
- throw new $TypeError$b("Can't convert object to primitive value");
409
- }
410
- if (pref === undefined) pref = 'number';
411
- return ordinaryToPrimitive(input, pref);
412
- };
413
-
414
- var toPrimitive = toPrimitive$1;
415
- var isSymbol = isSymbol$2;
416
-
417
- // `ToPropertyKey` abstract operation
418
- // https://tc39.es/ecma262/#sec-topropertykey
419
- var toPropertyKey$2 = function (argument) {
420
- var key = toPrimitive(argument, 'string');
421
- return isSymbol(key) ? key : key + '';
422
- };
423
-
424
- var globalThis$c = globalThis_1;
425
- var isObject$8 = isObject$b;
426
-
427
- var document$3 = globalThis$c.document;
428
- // typeof document.createElement is 'object' in old IE
429
- var EXISTS$1 = isObject$8(document$3) && isObject$8(document$3.createElement);
430
-
431
- var documentCreateElement$2 = function (it) {
432
- return EXISTS$1 ? document$3.createElement(it) : {};
433
- };
434
-
435
- var DESCRIPTORS$c = descriptors;
436
- var fails$a = fails$f;
437
- var createElement$1 = documentCreateElement$2;
438
-
439
- // Thanks to IE8 for its funny defineProperty
440
- var ie8DomDefine = !DESCRIPTORS$c && !fails$a(function () {
441
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
442
- return Object.defineProperty(createElement$1('div'), 'a', {
443
- get: function () { return 7; }
444
- }).a !== 7;
445
- });
446
-
447
- var DESCRIPTORS$b = descriptors;
448
- var call$9 = functionCall;
449
- var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
450
- var createPropertyDescriptor$3 = createPropertyDescriptor$4;
451
- var toIndexedObject$4 = toIndexedObject$5;
452
- var toPropertyKey$1 = toPropertyKey$2;
453
- var hasOwn$8 = hasOwnProperty_1;
454
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
455
-
456
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
457
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
458
-
459
- // `Object.getOwnPropertyDescriptor` method
460
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
461
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$b ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
462
- O = toIndexedObject$4(O);
463
- P = toPropertyKey$1(P);
464
- if (IE8_DOM_DEFINE$1) try {
465
- return $getOwnPropertyDescriptor$1(O, P);
466
- } catch (error) { /* empty */ }
467
- if (hasOwn$8(O, P)) return createPropertyDescriptor$3(!call$9(propertyIsEnumerableModule$1.f, O, P), O[P]);
468
- };
469
-
470
- var objectDefineProperty = {};
471
-
472
- var DESCRIPTORS$a = descriptors;
473
- var fails$9 = fails$f;
474
-
475
- // V8 ~ Chrome 36-
476
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
477
- var v8PrototypeDefineBug = DESCRIPTORS$a && fails$9(function () {
478
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
479
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
480
- value: 42,
481
- writable: false
482
- }).prototype !== 42;
483
- });
484
-
485
- var isObject$7 = isObject$b;
486
-
487
- var $String$3 = String;
488
- var $TypeError$a = TypeError;
489
-
490
- // `Assert: Type(argument) is Object`
491
- var anObject$9 = function (argument) {
492
- if (isObject$7(argument)) return argument;
493
- throw new $TypeError$a($String$3(argument) + ' is not an object');
494
- };
495
-
496
- var DESCRIPTORS$9 = descriptors;
497
- var IE8_DOM_DEFINE = ie8DomDefine;
498
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
499
- var anObject$8 = anObject$9;
500
- var toPropertyKey = toPropertyKey$2;
501
-
502
- var $TypeError$9 = TypeError;
503
- // eslint-disable-next-line es/no-object-defineproperty -- safe
504
- var $defineProperty = Object.defineProperty;
505
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
506
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
507
- var ENUMERABLE = 'enumerable';
508
- var CONFIGURABLE$1 = 'configurable';
509
- var WRITABLE = 'writable';
510
-
511
- // `Object.defineProperty` method
512
- // https://tc39.es/ecma262/#sec-object.defineproperty
513
- objectDefineProperty.f = DESCRIPTORS$9 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
514
- anObject$8(O);
515
- P = toPropertyKey(P);
516
- anObject$8(Attributes);
517
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
518
- var current = $getOwnPropertyDescriptor(O, P);
519
- if (current && current[WRITABLE]) {
520
- O[P] = Attributes.value;
521
- Attributes = {
522
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
523
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
524
- writable: false
525
- };
526
- }
527
- } return $defineProperty(O, P, Attributes);
528
- } : $defineProperty : function defineProperty(O, P, Attributes) {
529
- anObject$8(O);
530
- P = toPropertyKey(P);
531
- anObject$8(Attributes);
532
- if (IE8_DOM_DEFINE) try {
533
- return $defineProperty(O, P, Attributes);
534
- } catch (error) { /* empty */ }
535
- if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$9('Accessors not supported');
536
- if ('value' in Attributes) O[P] = Attributes.value;
537
- return O;
538
- };
539
-
540
- var DESCRIPTORS$8 = descriptors;
541
- var definePropertyModule$4 = objectDefineProperty;
542
- var createPropertyDescriptor$2 = createPropertyDescriptor$4;
543
-
544
- var createNonEnumerableProperty$4 = DESCRIPTORS$8 ? function (object, key, value) {
545
- return definePropertyModule$4.f(object, key, createPropertyDescriptor$2(1, value));
546
- } : function (object, key, value) {
547
- object[key] = value;
548
- return object;
549
- };
550
-
551
- var makeBuiltIn$3 = {exports: {}};
552
-
553
- var DESCRIPTORS$7 = descriptors;
554
- var hasOwn$7 = hasOwnProperty_1;
555
-
556
- var FunctionPrototype$1 = Function.prototype;
557
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
558
- var getDescriptor = DESCRIPTORS$7 && Object.getOwnPropertyDescriptor;
559
-
560
- var EXISTS = hasOwn$7(FunctionPrototype$1, 'name');
561
- // additional protection from minified / mangled / dropped function names
562
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
563
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$7 || (DESCRIPTORS$7 && getDescriptor(FunctionPrototype$1, 'name').configurable));
564
-
565
- var functionName = {
566
- EXISTS: EXISTS,
567
- PROPER: PROPER,
568
- CONFIGURABLE: CONFIGURABLE
569
- };
570
-
571
- var uncurryThis$a = functionUncurryThis;
572
- var isCallable$d = isCallable$j;
573
- var store$1 = sharedStoreExports;
574
-
575
- var functionToString = uncurryThis$a(Function.toString);
576
-
577
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
578
- if (!isCallable$d(store$1.inspectSource)) {
579
- store$1.inspectSource = function (it) {
580
- return functionToString(it);
581
- };
582
- }
583
-
584
- var inspectSource$3 = store$1.inspectSource;
585
-
586
- var globalThis$b = globalThis_1;
587
- var isCallable$c = isCallable$j;
588
-
589
- var WeakMap$1 = globalThis$b.WeakMap;
590
-
591
- var weakMapBasicDetection = isCallable$c(WeakMap$1) && /native code/.test(String(WeakMap$1));
592
-
593
- var shared$1 = shared$3;
594
- var uid = uid$2;
595
-
596
- var keys = shared$1('keys');
597
-
598
- var sharedKey$3 = function (key) {
599
- return keys[key] || (keys[key] = uid(key));
600
- };
601
-
602
- var hiddenKeys$4 = {};
603
-
604
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
605
- var globalThis$a = globalThis_1;
606
- var isObject$6 = isObject$b;
607
- var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
608
- var hasOwn$6 = hasOwnProperty_1;
609
- var shared = sharedStoreExports;
610
- var sharedKey$2 = sharedKey$3;
611
- var hiddenKeys$3 = hiddenKeys$4;
612
-
613
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
614
- var TypeError$2 = globalThis$a.TypeError;
615
- var WeakMap = globalThis$a.WeakMap;
616
- var set$1, get, has;
617
-
618
- var enforce = function (it) {
619
- return has(it) ? get(it) : set$1(it, {});
620
- };
621
-
622
- var getterFor = function (TYPE) {
623
- return function (it) {
624
- var state;
625
- if (!isObject$6(it) || (state = get(it)).type !== TYPE) {
626
- throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
627
- } return state;
628
- };
629
- };
630
-
631
- if (NATIVE_WEAK_MAP || shared.state) {
632
- var store = shared.state || (shared.state = new WeakMap());
633
- /* eslint-disable no-self-assign -- prototype methods protection */
634
- store.get = store.get;
635
- store.has = store.has;
636
- store.set = store.set;
637
- /* eslint-enable no-self-assign -- prototype methods protection */
638
- set$1 = function (it, metadata) {
639
- if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
640
- metadata.facade = it;
641
- store.set(it, metadata);
642
- return metadata;
643
- };
644
- get = function (it) {
645
- return store.get(it) || {};
646
- };
647
- has = function (it) {
648
- return store.has(it);
649
- };
650
- } else {
651
- var STATE = sharedKey$2('state');
652
- hiddenKeys$3[STATE] = true;
653
- set$1 = function (it, metadata) {
654
- if (hasOwn$6(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
655
- metadata.facade = it;
656
- createNonEnumerableProperty$3(it, STATE, metadata);
657
- return metadata;
658
- };
659
- get = function (it) {
660
- return hasOwn$6(it, STATE) ? it[STATE] : {};
661
- };
662
- has = function (it) {
663
- return hasOwn$6(it, STATE);
664
- };
665
- }
666
-
667
- var internalState = {
668
- set: set$1,
669
- get: get,
670
- has: has,
671
- enforce: enforce,
672
- getterFor: getterFor
673
- };
674
-
675
- var uncurryThis$9 = functionUncurryThis;
676
- var fails$8 = fails$f;
677
- var isCallable$b = isCallable$j;
678
- var hasOwn$5 = hasOwnProperty_1;
679
- var DESCRIPTORS$6 = descriptors;
680
- var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
681
- var inspectSource$2 = inspectSource$3;
682
- var InternalStateModule$2 = internalState;
683
-
684
- var enforceInternalState = InternalStateModule$2.enforce;
685
- var getInternalState$1 = InternalStateModule$2.get;
686
- var $String$2 = String;
687
- // eslint-disable-next-line es/no-object-defineproperty -- safe
688
- var defineProperty$5 = Object.defineProperty;
689
- var stringSlice = uncurryThis$9(''.slice);
690
- var replace = uncurryThis$9(''.replace);
691
- var join = uncurryThis$9([].join);
692
-
693
- var CONFIGURABLE_LENGTH = DESCRIPTORS$6 && !fails$8(function () {
694
- return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
695
- });
696
-
697
- var TEMPLATE = String(String).split('String');
698
-
699
- var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
700
- if (stringSlice($String$2(name), 0, 7) === 'Symbol(') {
701
- name = '[' + replace($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
702
- }
703
- if (options && options.getter) name = 'get ' + name;
704
- if (options && options.setter) name = 'set ' + name;
705
- if (!hasOwn$5(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
706
- if (DESCRIPTORS$6) defineProperty$5(value, 'name', { value: name, configurable: true });
707
- else value.name = name;
708
- }
709
- if (CONFIGURABLE_LENGTH && options && hasOwn$5(options, 'arity') && value.length !== options.arity) {
710
- defineProperty$5(value, 'length', { value: options.arity });
711
- }
712
- try {
713
- if (options && hasOwn$5(options, 'constructor') && options.constructor) {
714
- if (DESCRIPTORS$6) defineProperty$5(value, 'prototype', { writable: false });
715
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
716
- } else if (value.prototype) value.prototype = undefined;
717
- } catch (error) { /* empty */ }
718
- var state = enforceInternalState(value);
719
- if (!hasOwn$5(state, 'source')) {
720
- state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
721
- } return value;
722
- };
723
-
724
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
725
- // eslint-disable-next-line no-extend-native -- required
726
- Function.prototype.toString = makeBuiltIn$2(function toString() {
727
- return isCallable$b(this) && getInternalState$1(this).source || inspectSource$2(this);
728
- }, 'toString');
729
-
730
- var makeBuiltInExports = makeBuiltIn$3.exports;
731
-
732
- var isCallable$a = isCallable$j;
733
- var definePropertyModule$3 = objectDefineProperty;
734
- var makeBuiltIn$1 = makeBuiltInExports;
735
- var defineGlobalProperty$1 = defineGlobalProperty$3;
736
-
737
- var defineBuiltIn$5 = function (O, key, value, options) {
738
- if (!options) options = {};
739
- var simple = options.enumerable;
740
- var name = options.name !== undefined ? options.name : key;
741
- if (isCallable$a(value)) makeBuiltIn$1(value, name, options);
742
- if (options.global) {
743
- if (simple) O[key] = value;
744
- else defineGlobalProperty$1(key, value);
745
- } else {
746
- try {
747
- if (!options.unsafe) delete O[key];
748
- else if (O[key]) simple = true;
749
- } catch (error) { /* empty */ }
750
- if (simple) O[key] = value;
751
- else definePropertyModule$3.f(O, key, {
752
- value: value,
753
- enumerable: false,
754
- configurable: !options.nonConfigurable,
755
- writable: !options.nonWritable
756
- });
757
- } return O;
758
- };
759
-
760
- var objectGetOwnPropertyNames = {};
761
-
762
- var ceil = Math.ceil;
763
- var floor = Math.floor;
764
-
765
- // `Math.trunc` method
766
- // https://tc39.es/ecma262/#sec-math.trunc
767
- // eslint-disable-next-line es/no-math-trunc -- safe
768
- var mathTrunc = Math.trunc || function trunc(x) {
769
- var n = +x;
770
- return (n > 0 ? floor : ceil)(n);
771
- };
772
-
773
- var trunc = mathTrunc;
774
-
775
- // `ToIntegerOrInfinity` abstract operation
776
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
777
- var toIntegerOrInfinity$2 = function (argument) {
778
- var number = +argument;
779
- // eslint-disable-next-line no-self-compare -- NaN check
780
- return number !== number || number === 0 ? 0 : trunc(number);
781
- };
782
-
783
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
784
-
785
- var max = Math.max;
786
- var min$1 = Math.min;
787
-
788
- // Helper for a popular repeating case of the spec:
789
- // Let integer be ? ToInteger(index).
790
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
791
- var toAbsoluteIndex$1 = function (index, length) {
792
- var integer = toIntegerOrInfinity$1(index);
793
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
794
- };
795
-
796
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
797
-
798
- var min = Math.min;
799
-
800
- // `ToLength` abstract operation
801
- // https://tc39.es/ecma262/#sec-tolength
802
- var toLength$1 = function (argument) {
803
- var len = toIntegerOrInfinity(argument);
804
- return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
805
- };
806
-
807
- var toLength = toLength$1;
808
-
809
- // `LengthOfArrayLike` abstract operation
810
- // https://tc39.es/ecma262/#sec-lengthofarraylike
811
- var lengthOfArrayLike$3 = function (obj) {
812
- return toLength(obj.length);
813
- };
814
-
815
- var toIndexedObject$3 = toIndexedObject$5;
816
- var toAbsoluteIndex = toAbsoluteIndex$1;
817
- var lengthOfArrayLike$2 = lengthOfArrayLike$3;
818
-
819
- // `Array.prototype.{ indexOf, includes }` methods implementation
820
- var createMethod$1 = function (IS_INCLUDES) {
821
- return function ($this, el, fromIndex) {
822
- var O = toIndexedObject$3($this);
823
- var length = lengthOfArrayLike$2(O);
824
- if (length === 0) return !IS_INCLUDES && -1;
825
- var index = toAbsoluteIndex(fromIndex, length);
826
- var value;
827
- // Array#includes uses SameValueZero equality algorithm
828
- // eslint-disable-next-line no-self-compare -- NaN check
829
- if (IS_INCLUDES && el !== el) while (length > index) {
830
- value = O[index++];
831
- // eslint-disable-next-line no-self-compare -- NaN check
832
- if (value !== value) return true;
833
- // Array#indexOf ignores holes, Array#includes - not
834
- } else for (;length > index; index++) {
835
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
836
- } return !IS_INCLUDES && -1;
837
- };
838
- };
839
-
840
- var arrayIncludes = {
841
- // `Array.prototype.includes` method
842
- // https://tc39.es/ecma262/#sec-array.prototype.includes
843
- includes: createMethod$1(true),
844
- // `Array.prototype.indexOf` method
845
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
846
- indexOf: createMethod$1(false)
847
- };
848
-
849
- var uncurryThis$8 = functionUncurryThis;
850
- var hasOwn$4 = hasOwnProperty_1;
851
- var toIndexedObject$2 = toIndexedObject$5;
852
- var indexOf = arrayIncludes.indexOf;
853
- var hiddenKeys$2 = hiddenKeys$4;
854
-
855
- var push = uncurryThis$8([].push);
856
-
857
- var objectKeysInternal = function (object, names) {
858
- var O = toIndexedObject$2(object);
859
- var i = 0;
860
- var result = [];
861
- var key;
862
- for (key in O) !hasOwn$4(hiddenKeys$2, key) && hasOwn$4(O, key) && push(result, key);
863
- // Don't enum bug & hidden keys
864
- while (names.length > i) if (hasOwn$4(O, key = names[i++])) {
865
- ~indexOf(result, key) || push(result, key);
866
- }
867
- return result;
868
- };
869
-
870
- // IE8- don't enum bug keys
871
- var enumBugKeys$3 = [
872
- 'constructor',
873
- 'hasOwnProperty',
874
- 'isPrototypeOf',
875
- 'propertyIsEnumerable',
876
- 'toLocaleString',
877
- 'toString',
878
- 'valueOf'
879
- ];
880
-
881
- var internalObjectKeys$1 = objectKeysInternal;
882
- var enumBugKeys$2 = enumBugKeys$3;
883
-
884
- var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
885
-
886
- // `Object.getOwnPropertyNames` method
887
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
888
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
889
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
890
- return internalObjectKeys$1(O, hiddenKeys$1);
891
- };
892
-
893
- var objectGetOwnPropertySymbols = {};
894
-
895
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
896
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
897
-
898
- var getBuiltIn$5 = getBuiltIn$7;
899
- var uncurryThis$7 = functionUncurryThis;
900
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
901
- var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
902
- var anObject$7 = anObject$9;
903
-
904
- var concat$1 = uncurryThis$7([].concat);
905
-
906
- // all object keys, includes non-enumerable and symbols
907
- var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
908
- var keys = getOwnPropertyNamesModule.f(anObject$7(it));
909
- var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
910
- return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
911
- };
912
-
913
- var hasOwn$3 = hasOwnProperty_1;
914
- var ownKeys = ownKeys$1;
915
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
916
- var definePropertyModule$2 = objectDefineProperty;
917
-
918
- var copyConstructorProperties$1 = function (target, source, exceptions) {
919
- var keys = ownKeys(source);
920
- var defineProperty = definePropertyModule$2.f;
921
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
922
- for (var i = 0; i < keys.length; i++) {
923
- var key = keys[i];
924
- if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
925
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
926
- }
927
- }
928
- };
929
-
930
- var fails$7 = fails$f;
931
- var isCallable$9 = isCallable$j;
932
-
933
- var replacement = /#|\.prototype\./;
934
-
935
- var isForced$2 = function (feature, detection) {
936
- var value = data[normalize(feature)];
937
- return value === POLYFILL ? true
938
- : value === NATIVE ? false
939
- : isCallable$9(detection) ? fails$7(detection)
940
- : !!detection;
941
- };
942
-
943
- var normalize = isForced$2.normalize = function (string) {
944
- return String(string).replace(replacement, '.').toLowerCase();
945
- };
946
-
947
- var data = isForced$2.data = {};
948
- var NATIVE = isForced$2.NATIVE = 'N';
949
- var POLYFILL = isForced$2.POLYFILL = 'P';
950
-
951
- var isForced_1 = isForced$2;
952
-
953
- var globalThis$9 = globalThis_1;
954
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
955
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
956
- var defineBuiltIn$4 = defineBuiltIn$5;
957
- var defineGlobalProperty = defineGlobalProperty$3;
958
- var copyConstructorProperties = copyConstructorProperties$1;
959
- var isForced$1 = isForced_1;
960
-
961
- /*
962
- options.target - name of the target object
963
- options.global - target is the global object
964
- options.stat - export as static methods of target
965
- options.proto - export as prototype methods of target
966
- options.real - real prototype method for the `pure` version
967
- options.forced - export even if the native feature is available
968
- options.bind - bind methods to the target, required for the `pure` version
969
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
970
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
971
- options.sham - add a flag to not completely full polyfills
972
- options.enumerable - export as enumerable property
973
- options.dontCallGetSet - prevent calling a getter on target
974
- options.name - the .name of the function if it does not match the key
975
- */
976
- var _export = function (options, source) {
977
- var TARGET = options.target;
978
- var GLOBAL = options.global;
979
- var STATIC = options.stat;
980
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
981
- if (GLOBAL) {
982
- target = globalThis$9;
983
- } else if (STATIC) {
984
- target = globalThis$9[TARGET] || defineGlobalProperty(TARGET, {});
985
- } else {
986
- target = globalThis$9[TARGET] && globalThis$9[TARGET].prototype;
987
- }
988
- if (target) for (key in source) {
989
- sourceProperty = source[key];
990
- if (options.dontCallGetSet) {
991
- descriptor = getOwnPropertyDescriptor$1(target, key);
992
- targetProperty = descriptor && descriptor.value;
993
- } else targetProperty = target[key];
994
- FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
995
- // contained in target
996
- if (!FORCED && targetProperty !== undefined) {
997
- if (typeof sourceProperty == typeof targetProperty) continue;
998
- copyConstructorProperties(sourceProperty, targetProperty);
999
- }
1000
- // add a flag to not completely full polyfills
1001
- if (options.sham || (targetProperty && targetProperty.sham)) {
1002
- createNonEnumerableProperty$2(sourceProperty, 'sham', true);
1003
- }
1004
- defineBuiltIn$4(target, key, sourceProperty, options);
1005
- }
1006
- };
1007
-
1008
- var objectDefineProperties = {};
1009
-
1010
- var internalObjectKeys = objectKeysInternal;
1011
- var enumBugKeys$1 = enumBugKeys$3;
1012
-
1013
- // `Object.keys` method
1014
- // https://tc39.es/ecma262/#sec-object.keys
1015
- // eslint-disable-next-line es/no-object-keys -- safe
1016
- var objectKeys$2 = Object.keys || function keys(O) {
1017
- return internalObjectKeys(O, enumBugKeys$1);
1018
- };
1019
-
1020
- var DESCRIPTORS$5 = descriptors;
1021
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1022
- var definePropertyModule$1 = objectDefineProperty;
1023
- var anObject$6 = anObject$9;
1024
- var toIndexedObject$1 = toIndexedObject$5;
1025
- var objectKeys$1 = objectKeys$2;
1026
-
1027
- // `Object.defineProperties` method
1028
- // https://tc39.es/ecma262/#sec-object.defineproperties
1029
- // eslint-disable-next-line es/no-object-defineproperties -- safe
1030
- objectDefineProperties.f = DESCRIPTORS$5 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1031
- anObject$6(O);
1032
- var props = toIndexedObject$1(Properties);
1033
- var keys = objectKeys$1(Properties);
1034
- var length = keys.length;
1035
- var index = 0;
1036
- var key;
1037
- while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
1038
- return O;
1039
- };
1040
-
1041
- var getBuiltIn$4 = getBuiltIn$7;
1042
-
1043
- var html$2 = getBuiltIn$4('document', 'documentElement');
1044
-
1045
- /* global ActiveXObject -- old IE, WSH */
1046
- var anObject$5 = anObject$9;
1047
- var definePropertiesModule = objectDefineProperties;
1048
- var enumBugKeys = enumBugKeys$3;
1049
- var hiddenKeys = hiddenKeys$4;
1050
- var html$1 = html$2;
1051
- var documentCreateElement$1 = documentCreateElement$2;
1052
- var sharedKey$1 = sharedKey$3;
1053
-
1054
- var GT = '>';
1055
- var LT = '<';
1056
- var PROTOTYPE = 'prototype';
1057
- var SCRIPT = 'script';
1058
- var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1059
-
1060
- var EmptyConstructor = function () { /* empty */ };
1061
-
1062
- var scriptTag = function (content) {
1063
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1064
- };
1065
-
1066
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1067
- var NullProtoObjectViaActiveX = function (activeXDocument) {
1068
- activeXDocument.write(scriptTag(''));
1069
- activeXDocument.close();
1070
- var temp = activeXDocument.parentWindow.Object;
1071
- // eslint-disable-next-line no-useless-assignment -- avoid memory leak
1072
- activeXDocument = null;
1073
- return temp;
1074
- };
1075
-
1076
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
1077
- var NullProtoObjectViaIFrame = function () {
1078
- // Thrash, waste and sodomy: IE GC bug
1079
- var iframe = documentCreateElement$1('iframe');
1080
- var JS = 'java' + SCRIPT + ':';
1081
- var iframeDocument;
1082
- iframe.style.display = 'none';
1083
- html$1.appendChild(iframe);
1084
- // https://github.com/zloirock/core-js/issues/475
1085
- iframe.src = String(JS);
1086
- iframeDocument = iframe.contentWindow.document;
1087
- iframeDocument.open();
1088
- iframeDocument.write(scriptTag('document.F=Object'));
1089
- iframeDocument.close();
1090
- return iframeDocument.F;
1091
- };
1092
-
1093
- // Check for document.domain and active x support
1094
- // No need to use active x approach when document.domain is not set
1095
- // see https://github.com/es-shims/es5-shim/issues/150
1096
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1097
- // avoid IE GC bug
1098
- var activeXDocument;
1099
- var NullProtoObject = function () {
1100
- try {
1101
- activeXDocument = new ActiveXObject('htmlfile');
1102
- } catch (error) { /* ignore */ }
1103
- NullProtoObject = typeof document != 'undefined'
1104
- ? document.domain && activeXDocument
1105
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1106
- : NullProtoObjectViaIFrame()
1107
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
1108
- var length = enumBugKeys.length;
1109
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1110
- return NullProtoObject();
1111
- };
1112
-
1113
- hiddenKeys[IE_PROTO$1] = true;
1114
-
1115
- // `Object.create` method
1116
- // https://tc39.es/ecma262/#sec-object.create
1117
- // eslint-disable-next-line es/no-object-create -- safe
1118
- var objectCreate = Object.create || function create(O, Properties) {
1119
- var result;
1120
- if (O !== null) {
1121
- EmptyConstructor[PROTOTYPE] = anObject$5(O);
1122
- result = new EmptyConstructor();
1123
- EmptyConstructor[PROTOTYPE] = null;
1124
- // add "__proto__" for Object.getPrototypeOf polyfill
1125
- result[IE_PROTO$1] = O;
1126
- } else result = NullProtoObject();
1127
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1128
- };
1129
-
1130
- var wellKnownSymbol$e = wellKnownSymbol$g;
1131
- var create$1 = objectCreate;
1132
- var defineProperty$4 = objectDefineProperty.f;
1133
-
1134
- var UNSCOPABLES = wellKnownSymbol$e('unscopables');
1135
- var ArrayPrototype$1 = Array.prototype;
1136
-
1137
- // Array.prototype[@@unscopables]
1138
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1139
- if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
1140
- defineProperty$4(ArrayPrototype$1, UNSCOPABLES, {
1141
- configurable: true,
1142
- value: create$1(null)
1143
- });
1144
- }
1145
-
1146
- // add a key to Array.prototype[@@unscopables]
1147
- var addToUnscopables$2 = function (key) {
1148
- ArrayPrototype$1[UNSCOPABLES][key] = true;
1149
- };
1150
-
1151
- var $$b = _export;
1152
- var $includes = arrayIncludes.includes;
1153
- var fails$6 = fails$f;
1154
- var addToUnscopables$1 = addToUnscopables$2;
1155
-
1156
- // FF99+ bug
1157
- var BROKEN_ON_SPARSE = fails$6(function () {
1158
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
1159
- return !Array(1).includes();
1160
- });
1161
-
1162
- // `Array.prototype.includes` method
1163
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1164
- $$b({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1165
- includes: function includes(el /* , fromIndex = 0 */) {
1166
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1167
- }
1168
- });
1169
-
1170
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1171
- addToUnscopables$1('includes');
1172
-
1173
- var iterators = {};
1174
-
1175
- var fails$5 = fails$f;
1176
-
1177
- var correctPrototypeGetter = !fails$5(function () {
1178
- function F() { /* empty */ }
1179
- F.prototype.constructor = null;
1180
- // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1181
- return Object.getPrototypeOf(new F()) !== F.prototype;
1182
- });
1183
-
1184
- var hasOwn$2 = hasOwnProperty_1;
1185
- var isCallable$8 = isCallable$j;
1186
- var toObject$2 = toObject$4;
1187
- var sharedKey = sharedKey$3;
1188
- var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1189
-
1190
- var IE_PROTO = sharedKey('IE_PROTO');
1191
- var $Object$1 = Object;
1192
- var ObjectPrototype = $Object$1.prototype;
1193
-
1194
- // `Object.getPrototypeOf` method
1195
- // https://tc39.es/ecma262/#sec-object.getprototypeof
1196
- // eslint-disable-next-line es/no-object-getprototypeof -- safe
1197
- var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1198
- var object = toObject$2(O);
1199
- if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1200
- var constructor = object.constructor;
1201
- if (isCallable$8(constructor) && object instanceof constructor) {
1202
- return constructor.prototype;
1203
- } return object instanceof $Object$1 ? ObjectPrototype : null;
1204
- };
1205
-
1206
- var fails$4 = fails$f;
1207
- var isCallable$7 = isCallable$j;
1208
- var isObject$5 = isObject$b;
1209
- var getPrototypeOf$1 = objectGetPrototypeOf;
1210
- var defineBuiltIn$3 = defineBuiltIn$5;
1211
- var wellKnownSymbol$d = wellKnownSymbol$g;
1212
-
1213
- var ITERATOR$5 = wellKnownSymbol$d('iterator');
1214
- var BUGGY_SAFARI_ITERATORS$1 = false;
1215
-
1216
- // `%IteratorPrototype%` object
1217
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1218
- var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1219
-
1220
- /* eslint-disable es/no-array-prototype-keys -- safe */
1221
- if ([].keys) {
1222
- arrayIterator = [].keys();
1223
- // Safari 8 has buggy iterators w/o `next`
1224
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1225
- else {
1226
- PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1227
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1228
- }
1229
- }
1230
-
1231
- var NEW_ITERATOR_PROTOTYPE = !isObject$5(IteratorPrototype$2) || fails$4(function () {
1232
- var test = {};
1233
- // FF44- legacy iterators case
1234
- return IteratorPrototype$2[ITERATOR$5].call(test) !== test;
1235
- });
1236
-
1237
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1238
-
1239
- // `%IteratorPrototype%[@@iterator]()` method
1240
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1241
- if (!isCallable$7(IteratorPrototype$2[ITERATOR$5])) {
1242
- defineBuiltIn$3(IteratorPrototype$2, ITERATOR$5, function () {
1243
- return this;
1244
- });
1245
- }
1246
-
1247
- var iteratorsCore = {
1248
- IteratorPrototype: IteratorPrototype$2,
1249
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1250
- };
1251
-
1252
- var defineProperty$3 = objectDefineProperty.f;
1253
- var hasOwn$1 = hasOwnProperty_1;
1254
- var wellKnownSymbol$c = wellKnownSymbol$g;
1255
-
1256
- var TO_STRING_TAG$2 = wellKnownSymbol$c('toStringTag');
1257
-
1258
- var setToStringTag$4 = function (target, TAG, STATIC) {
1259
- if (target && !STATIC) target = target.prototype;
1260
- if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1261
- defineProperty$3(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1262
- }
1263
- };
1264
-
1265
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1266
- var create = objectCreate;
1267
- var createPropertyDescriptor$1 = createPropertyDescriptor$4;
1268
- var setToStringTag$3 = setToStringTag$4;
1269
- var Iterators$4 = iterators;
1270
-
1271
- var returnThis$1 = function () { return this; };
1272
-
1273
- var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1274
- var TO_STRING_TAG = NAME + ' Iterator';
1275
- IteratorConstructor.prototype = create(IteratorPrototype$1, { next: createPropertyDescriptor$1(+!ENUMERABLE_NEXT, next) });
1276
- setToStringTag$3(IteratorConstructor, TO_STRING_TAG, false);
1277
- Iterators$4[TO_STRING_TAG] = returnThis$1;
1278
- return IteratorConstructor;
1279
- };
1280
-
1281
- var uncurryThis$6 = functionUncurryThis;
1282
- var aCallable$7 = aCallable$9;
1283
-
1284
- var functionUncurryThisAccessor = function (object, key, method) {
1285
- try {
1286
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1287
- return uncurryThis$6(aCallable$7(Object.getOwnPropertyDescriptor(object, key)[method]));
1288
- } catch (error) { /* empty */ }
1289
- };
1290
-
1291
- var isObject$4 = isObject$b;
1292
-
1293
- var isPossiblePrototype$1 = function (argument) {
1294
- return isObject$4(argument) || argument === null;
1295
- };
1296
-
1297
- var isPossiblePrototype = isPossiblePrototype$1;
1298
-
1299
- var $String$1 = String;
1300
- var $TypeError$8 = TypeError;
1301
-
1302
- var aPossiblePrototype$1 = function (argument) {
1303
- if (isPossiblePrototype(argument)) return argument;
1304
- throw new $TypeError$8("Can't set " + $String$1(argument) + ' as a prototype');
1305
- };
1306
-
1307
- /* eslint-disable no-proto -- safe */
1308
- var uncurryThisAccessor = functionUncurryThisAccessor;
1309
- var isObject$3 = isObject$b;
1310
- var requireObjectCoercible$1 = requireObjectCoercible$4;
1311
- var aPossiblePrototype = aPossiblePrototype$1;
1312
-
1313
- // `Object.setPrototypeOf` method
1314
- // https://tc39.es/ecma262/#sec-object.setprototypeof
1315
- // Works with __proto__ only. Old v8 can't work with null proto objects.
1316
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
1317
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1318
- var CORRECT_SETTER = false;
1319
- var test = {};
1320
- var setter;
1321
- try {
1322
- setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1323
- setter(test, []);
1324
- CORRECT_SETTER = test instanceof Array;
1325
- } catch (error) { /* empty */ }
1326
- return function setPrototypeOf(O, proto) {
1327
- requireObjectCoercible$1(O);
1328
- aPossiblePrototype(proto);
1329
- if (!isObject$3(O)) return O;
1330
- if (CORRECT_SETTER) setter(O, proto);
1331
- else O.__proto__ = proto;
1332
- return O;
1333
- };
1334
- }() : undefined);
1335
-
1336
- var $$a = _export;
1337
- var call$8 = functionCall;
1338
- var FunctionName = functionName;
1339
- var isCallable$6 = isCallable$j;
1340
- var createIteratorConstructor = iteratorCreateConstructor;
1341
- var getPrototypeOf = objectGetPrototypeOf;
1342
- var setPrototypeOf$1 = objectSetPrototypeOf;
1343
- var setToStringTag$2 = setToStringTag$4;
1344
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1345
- var defineBuiltIn$2 = defineBuiltIn$5;
1346
- var wellKnownSymbol$b = wellKnownSymbol$g;
1347
- var Iterators$3 = iterators;
1348
- var IteratorsCore = iteratorsCore;
1349
-
1350
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1351
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1352
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
1353
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1354
- var ITERATOR$4 = wellKnownSymbol$b('iterator');
1355
- var KEYS = 'keys';
1356
- var VALUES = 'values';
1357
- var ENTRIES = 'entries';
1358
-
1359
- var returnThis = function () { return this; };
1360
-
1361
- var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1362
- createIteratorConstructor(IteratorConstructor, NAME, next);
1363
-
1364
- var getIterationMethod = function (KIND) {
1365
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1366
- if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1367
-
1368
- switch (KIND) {
1369
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1370
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1371
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1372
- }
1373
-
1374
- return function () { return new IteratorConstructor(this); };
1375
- };
1376
-
1377
- var TO_STRING_TAG = NAME + ' Iterator';
1378
- var INCORRECT_VALUES_NAME = false;
1379
- var IterablePrototype = Iterable.prototype;
1380
- var nativeIterator = IterablePrototype[ITERATOR$4]
1381
- || IterablePrototype['@@iterator']
1382
- || DEFAULT && IterablePrototype[DEFAULT];
1383
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1384
- var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1385
- var CurrentIteratorPrototype, methods, KEY;
1386
-
1387
- // fix native
1388
- if (anyNativeIterator) {
1389
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1390
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1391
- if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1392
- if (setPrototypeOf$1) {
1393
- setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
1394
- } else if (!isCallable$6(CurrentIteratorPrototype[ITERATOR$4])) {
1395
- defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$4, returnThis);
1396
- }
1397
- }
1398
- // Set @@toStringTag to native iterators
1399
- setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true);
1400
- }
1401
- }
1402
-
1403
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1404
- if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1405
- if (CONFIGURABLE_FUNCTION_NAME) {
1406
- createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1407
- } else {
1408
- INCORRECT_VALUES_NAME = true;
1409
- defaultIterator = function values() { return call$8(nativeIterator, this); };
1410
- }
1411
- }
1412
-
1413
- // export additional methods
1414
- if (DEFAULT) {
1415
- methods = {
1416
- values: getIterationMethod(VALUES),
1417
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1418
- entries: getIterationMethod(ENTRIES)
1419
- };
1420
- if (FORCED) for (KEY in methods) {
1421
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1422
- defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
1423
- }
1424
- } else $$a({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1425
- }
1426
-
1427
- // define iterator
1428
- if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
1429
- defineBuiltIn$2(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
1430
- }
1431
- Iterators$3[NAME] = defaultIterator;
1432
-
1433
- return methods;
1434
- };
1435
-
1436
- // `CreateIterResultObject` abstract operation
1437
- // https://tc39.es/ecma262/#sec-createiterresultobject
1438
- var createIterResultObject$1 = function (value, done) {
1439
- return { value: value, done: done };
1440
- };
1441
-
1442
- var toIndexedObject = toIndexedObject$5;
1443
- var addToUnscopables = addToUnscopables$2;
1444
- var Iterators$2 = iterators;
1445
- var InternalStateModule$1 = internalState;
1446
- var defineProperty$2 = objectDefineProperty.f;
1447
- var defineIterator = iteratorDefine;
1448
- var createIterResultObject = createIterResultObject$1;
1449
- var DESCRIPTORS$4 = descriptors;
1450
-
1451
- var ARRAY_ITERATOR = 'Array Iterator';
1452
- var setInternalState$1 = InternalStateModule$1.set;
1453
- var getInternalState = InternalStateModule$1.getterFor(ARRAY_ITERATOR);
1454
-
1455
- // `Array.prototype.entries` method
1456
- // https://tc39.es/ecma262/#sec-array.prototype.entries
1457
- // `Array.prototype.keys` method
1458
- // https://tc39.es/ecma262/#sec-array.prototype.keys
1459
- // `Array.prototype.values` method
1460
- // https://tc39.es/ecma262/#sec-array.prototype.values
1461
- // `Array.prototype[@@iterator]` method
1462
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1463
- // `CreateArrayIterator` internal method
1464
- // https://tc39.es/ecma262/#sec-createarrayiterator
1465
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1466
- setInternalState$1(this, {
1467
- type: ARRAY_ITERATOR,
1468
- target: toIndexedObject(iterated), // target
1469
- index: 0, // next index
1470
- kind: kind // kind
1471
- });
1472
- // `%ArrayIteratorPrototype%.next` method
1473
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1474
- }, function () {
1475
- var state = getInternalState(this);
1476
- var target = state.target;
1477
- var index = state.index++;
1478
- if (!target || index >= target.length) {
1479
- state.target = null;
1480
- return createIterResultObject(undefined, true);
1481
- }
1482
- switch (state.kind) {
1483
- case 'keys': return createIterResultObject(index, false);
1484
- case 'values': return createIterResultObject(target[index], false);
1485
- } return createIterResultObject([index, target[index]], false);
1486
- }, 'values');
1487
-
1488
- // argumentsList[@@iterator] is %ArrayProto_values%
1489
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1490
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1491
- var values = Iterators$2.Arguments = Iterators$2.Array;
1492
-
1493
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1494
- addToUnscopables('keys');
1495
- addToUnscopables('values');
1496
- addToUnscopables('entries');
1497
-
1498
- // V8 ~ Chrome 45- bug
1499
- if (DESCRIPTORS$4 && values.name !== 'values') try {
1500
- defineProperty$2(values, 'name', { value: 'values' });
1501
- } catch (error) { /* empty */ }
1502
-
1503
- var aCallable$6 = aCallable$9;
1504
- var toObject$1 = toObject$4;
1505
- var IndexedObject$1 = indexedObject;
1506
- var lengthOfArrayLike$1 = lengthOfArrayLike$3;
1507
-
1508
- var $TypeError$7 = TypeError;
1509
-
1510
- var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
1511
-
1512
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
1513
- var createMethod = function (IS_RIGHT) {
1514
- return function (that, callbackfn, argumentsLength, memo) {
1515
- var O = toObject$1(that);
1516
- var self = IndexedObject$1(O);
1517
- var length = lengthOfArrayLike$1(O);
1518
- aCallable$6(callbackfn);
1519
- if (length === 0 && argumentsLength < 2) throw new $TypeError$7(REDUCE_EMPTY);
1520
- var index = IS_RIGHT ? length - 1 : 0;
1521
- var i = IS_RIGHT ? -1 : 1;
1522
- if (argumentsLength < 2) while (true) {
1523
- if (index in self) {
1524
- memo = self[index];
1525
- index += i;
1526
- break;
1527
- }
1528
- index += i;
1529
- if (IS_RIGHT ? index < 0 : length <= index) {
1530
- throw new $TypeError$7(REDUCE_EMPTY);
1531
- }
1532
- }
1533
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1534
- memo = callbackfn(memo, self[index], index, O);
1535
- }
1536
- return memo;
1537
- };
1538
- };
1539
-
1540
- var arrayReduce = {
1541
- // `Array.prototype.reduce` method
1542
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1543
- left: createMethod(false),
1544
- // `Array.prototype.reduceRight` method
1545
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1546
- right: createMethod(true)
1547
- };
1548
-
1549
- var fails$3 = fails$f;
1550
-
1551
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1552
- var method = [][METHOD_NAME];
1553
- return !!method && fails$3(function () {
1554
- // eslint-disable-next-line no-useless-call -- required for testing
1555
- method.call(null, argument || function () { return 1; }, 1);
1556
- });
1557
- };
1558
-
1559
- /* global Bun, Deno -- detection */
1560
- var globalThis$8 = globalThis_1;
1561
- var userAgent$3 = environmentUserAgent;
1562
- var classof$5 = classofRaw$2;
1563
-
1564
- var userAgentStartsWith = function (string) {
1565
- return userAgent$3.slice(0, string.length) === string;
1566
- };
1567
-
1568
- var environment = (function () {
1569
- if (userAgentStartsWith('Bun/')) return 'BUN';
1570
- if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
1571
- if (userAgentStartsWith('Deno/')) return 'DENO';
1572
- if (userAgentStartsWith('Node.js/')) return 'NODE';
1573
- if (globalThis$8.Bun && typeof Bun.version == 'string') return 'BUN';
1574
- if (globalThis$8.Deno && typeof Deno.version == 'object') return 'DENO';
1575
- if (classof$5(globalThis$8.process) === 'process') return 'NODE';
1576
- if (globalThis$8.window && globalThis$8.document) return 'BROWSER';
1577
- return 'REST';
1578
- })();
1579
-
1580
- var ENVIRONMENT$1 = environment;
1581
-
1582
- var environmentIsNode = ENVIRONMENT$1 === 'NODE';
1583
-
1584
- var $$9 = _export;
1585
- var $reduce = arrayReduce.left;
1586
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
1587
- var CHROME_VERSION = environmentV8Version;
1588
- var IS_NODE$3 = environmentIsNode;
1589
-
1590
- // Chrome 80-82 has a critical bug
1591
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
1592
- var CHROME_BUG = !IS_NODE$3 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
1593
- var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');
1594
-
1595
- // `Array.prototype.reduce` method
1596
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1597
- $$9({ target: 'Array', proto: true, forced: FORCED }, {
1598
- reduce: function reduce(callbackfn /* , initialValue */) {
1599
- var length = arguments.length;
1600
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
1601
- }
1602
- });
1603
-
1604
- var DESCRIPTORS$3 = descriptors;
1605
- var uncurryThis$5 = functionUncurryThis;
1606
- var call$7 = functionCall;
1607
- var fails$2 = fails$f;
1608
- var objectKeys = objectKeys$2;
1609
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1610
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1611
- var toObject = toObject$4;
1612
- var IndexedObject = indexedObject;
1613
-
1614
- // eslint-disable-next-line es/no-object-assign -- safe
1615
- var $assign = Object.assign;
1616
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1617
- var defineProperty$1 = Object.defineProperty;
1618
- var concat = uncurryThis$5([].concat);
1619
-
1620
- // `Object.assign` method
1621
- // https://tc39.es/ecma262/#sec-object.assign
1622
- var objectAssign = !$assign || fails$2(function () {
1623
- // should have correct order of operations (Edge bug)
1624
- if (DESCRIPTORS$3 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
1625
- enumerable: true,
1626
- get: function () {
1627
- defineProperty$1(this, 'b', {
1628
- value: 3,
1629
- enumerable: false
1630
- });
1631
- }
1632
- }), { b: 2 })).b !== 1) return true;
1633
- // should work with symbols and should have deterministic property order (V8 bug)
1634
- var A = {};
1635
- var B = {};
1636
- // eslint-disable-next-line es/no-symbol -- safe
1637
- var symbol = Symbol('assign detection');
1638
- var alphabet = 'abcdefghijklmnopqrst';
1639
- A[symbol] = 7;
1640
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1641
- return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
1642
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1643
- var T = toObject(target);
1644
- var argumentsLength = arguments.length;
1645
- var index = 1;
1646
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1647
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
1648
- while (argumentsLength > index) {
1649
- var S = IndexedObject(arguments[index++]);
1650
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1651
- var length = keys.length;
1652
- var j = 0;
1653
- var key;
1654
- while (length > j) {
1655
- key = keys[j++];
1656
- if (!DESCRIPTORS$3 || call$7(propertyIsEnumerable, S, key)) T[key] = S[key];
1657
- }
1658
- } return T;
1659
- } : $assign;
1660
-
1661
- var $$8 = _export;
1662
- var assign = objectAssign;
1663
-
1664
- // `Object.assign` method
1665
- // https://tc39.es/ecma262/#sec-object.assign
1666
- // eslint-disable-next-line es/no-object-assign -- required for testing
1667
- $$8({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1668
- assign: assign
1669
- });
1670
-
1671
- var classofRaw$1 = classofRaw$2;
1672
- var uncurryThis$4 = functionUncurryThis;
1673
-
1674
- var functionUncurryThisClause = function (fn) {
1675
- // Nashorn bug:
1676
- // https://github.com/zloirock/core-js/issues/1128
1677
- // https://github.com/zloirock/core-js/issues/1130
1678
- if (classofRaw$1(fn) === 'Function') return uncurryThis$4(fn);
1679
- };
1680
-
1681
- var uncurryThis$3 = functionUncurryThisClause;
1682
- var aCallable$5 = aCallable$9;
1683
- var NATIVE_BIND$1 = functionBindNative;
1684
-
1685
- var bind$4 = uncurryThis$3(uncurryThis$3.bind);
1686
-
1687
- // optional / simple context binding
1688
- var functionBindContext = function (fn, that) {
1689
- aCallable$5(fn);
1690
- return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
1691
- return fn.apply(that, arguments);
1692
- };
1693
- };
1694
-
1695
- var wellKnownSymbol$a = wellKnownSymbol$g;
1696
- var Iterators$1 = iterators;
1697
-
1698
- var ITERATOR$3 = wellKnownSymbol$a('iterator');
1699
- var ArrayPrototype = Array.prototype;
1700
-
1701
- // check on default Array iterator
1702
- var isArrayIteratorMethod$1 = function (it) {
1703
- return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$3] === it);
1704
- };
1705
-
1706
- var wellKnownSymbol$9 = wellKnownSymbol$g;
1707
-
1708
- var TO_STRING_TAG$1 = wellKnownSymbol$9('toStringTag');
1709
- var test = {};
1710
-
1711
- test[TO_STRING_TAG$1] = 'z';
1712
-
1713
- var toStringTagSupport = String(test) === '[object z]';
1714
-
1715
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1716
- var isCallable$5 = isCallable$j;
1717
- var classofRaw = classofRaw$2;
1718
- var wellKnownSymbol$8 = wellKnownSymbol$g;
1719
-
1720
- var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
1721
- var $Object = Object;
1722
-
1723
- // ES3 wrong here
1724
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1725
-
1726
- // fallback for IE11 Script Access Denied error
1727
- var tryGet = function (it, key) {
1728
- try {
1729
- return it[key];
1730
- } catch (error) { /* empty */ }
1731
- };
1732
-
1733
- // getting tag from ES6+ `Object.prototype.toString`
1734
- var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1735
- var O, tag, result;
1736
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1737
- // @@toStringTag case
1738
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1739
- // builtinTag case
1740
- : CORRECT_ARGUMENTS ? classofRaw(O)
1741
- // ES3 arguments fallback
1742
- : (result = classofRaw(O)) === 'Object' && isCallable$5(O.callee) ? 'Arguments' : result;
1743
- };
1744
-
1745
- var classof$3 = classof$4;
1746
- var getMethod$1 = getMethod$3;
1747
- var isNullOrUndefined$1 = isNullOrUndefined$4;
1748
- var Iterators = iterators;
1749
- var wellKnownSymbol$7 = wellKnownSymbol$g;
1750
-
1751
- var ITERATOR$2 = wellKnownSymbol$7('iterator');
1752
-
1753
- var getIteratorMethod$2 = function (it) {
1754
- if (!isNullOrUndefined$1(it)) return getMethod$1(it, ITERATOR$2)
1755
- || getMethod$1(it, '@@iterator')
1756
- || Iterators[classof$3(it)];
1757
- };
1758
-
1759
- var call$6 = functionCall;
1760
- var aCallable$4 = aCallable$9;
1761
- var anObject$4 = anObject$9;
1762
- var tryToString$2 = tryToString$4;
1763
- var getIteratorMethod$1 = getIteratorMethod$2;
1764
-
1765
- var $TypeError$6 = TypeError;
1766
-
1767
- var getIterator$1 = function (argument, usingIterator) {
1768
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1769
- if (aCallable$4(iteratorMethod)) return anObject$4(call$6(iteratorMethod, argument));
1770
- throw new $TypeError$6(tryToString$2(argument) + ' is not iterable');
1771
- };
1772
-
1773
- var call$5 = functionCall;
1774
- var anObject$3 = anObject$9;
1775
- var getMethod = getMethod$3;
1776
-
1777
- var iteratorClose$1 = function (iterator, kind, value) {
1778
- var innerResult, innerError;
1779
- anObject$3(iterator);
1780
- try {
1781
- innerResult = getMethod(iterator, 'return');
1782
- if (!innerResult) {
1783
- if (kind === 'throw') throw value;
1784
- return value;
1785
- }
1786
- innerResult = call$5(innerResult, iterator);
1787
- } catch (error) {
1788
- innerError = true;
1789
- innerResult = error;
1790
- }
1791
- if (kind === 'throw') throw value;
1792
- if (innerError) throw innerResult;
1793
- anObject$3(innerResult);
1794
- return value;
1795
- };
1796
-
1797
- var bind$3 = functionBindContext;
1798
- var call$4 = functionCall;
1799
- var anObject$2 = anObject$9;
1800
- var tryToString$1 = tryToString$4;
1801
- var isArrayIteratorMethod = isArrayIteratorMethod$1;
1802
- var lengthOfArrayLike = lengthOfArrayLike$3;
1803
- var isPrototypeOf$1 = objectIsPrototypeOf;
1804
- var getIterator = getIterator$1;
1805
- var getIteratorMethod = getIteratorMethod$2;
1806
- var iteratorClose = iteratorClose$1;
1807
-
1808
- var $TypeError$5 = TypeError;
1809
-
1810
- var Result = function (stopped, result) {
1811
- this.stopped = stopped;
1812
- this.result = result;
1813
- };
1814
-
1815
- var ResultPrototype = Result.prototype;
1816
-
1817
- var iterate$3 = function (iterable, unboundFunction, options) {
1818
- var that = options && options.that;
1819
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1820
- var IS_RECORD = !!(options && options.IS_RECORD);
1821
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1822
- var INTERRUPTED = !!(options && options.INTERRUPTED);
1823
- var fn = bind$3(unboundFunction, that);
1824
- var iterator, iterFn, index, length, result, next, step;
1825
-
1826
- var stop = function (condition) {
1827
- if (iterator) iteratorClose(iterator, 'normal', condition);
1828
- return new Result(true, condition);
1829
- };
1830
-
1831
- var callFn = function (value) {
1832
- if (AS_ENTRIES) {
1833
- anObject$2(value);
1834
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1835
- } return INTERRUPTED ? fn(value, stop) : fn(value);
1836
- };
1837
-
1838
- if (IS_RECORD) {
1839
- iterator = iterable.iterator;
1840
- } else if (IS_ITERATOR) {
1841
- iterator = iterable;
1842
- } else {
1843
- iterFn = getIteratorMethod(iterable);
1844
- if (!iterFn) throw new $TypeError$5(tryToString$1(iterable) + ' is not iterable');
1845
- // optimisation for array iterators
1846
- if (isArrayIteratorMethod(iterFn)) {
1847
- for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1848
- result = callFn(iterable[index]);
1849
- if (result && isPrototypeOf$1(ResultPrototype, result)) return result;
1850
- } return new Result(false);
1851
- }
1852
- iterator = getIterator(iterable, iterFn);
1853
- }
1854
-
1855
- next = IS_RECORD ? iterable.next : iterator.next;
1856
- while (!(step = call$4(next, iterator)).done) {
1857
- try {
1858
- result = callFn(step.value);
1859
- } catch (error) {
1860
- iteratorClose(iterator, 'throw', error);
1861
- }
1862
- if (typeof result == 'object' && result && isPrototypeOf$1(ResultPrototype, result)) return result;
1863
- } return new Result(false);
1864
- };
1865
-
1866
- var DESCRIPTORS$2 = descriptors;
1867
- var definePropertyModule = objectDefineProperty;
1868
- var createPropertyDescriptor = createPropertyDescriptor$4;
1869
-
1870
- var createProperty$1 = function (object, key, value) {
1871
- if (DESCRIPTORS$2) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
1872
- else object[key] = value;
1873
- };
1874
-
1875
- var $$7 = _export;
1876
- var iterate$2 = iterate$3;
1877
- var createProperty = createProperty$1;
1878
-
1879
- // `Object.fromEntries` method
1880
- // https://github.com/tc39/proposal-object-from-entries
1881
- $$7({ target: 'Object', stat: true }, {
1882
- fromEntries: function fromEntries(iterable) {
1883
- var obj = {};
1884
- iterate$2(iterable, function (k, v) {
1885
- createProperty(obj, k, v);
1886
- }, { AS_ENTRIES: true });
1887
- return obj;
1888
- }
1889
- });
1890
-
1891
- var makeBuiltIn = makeBuiltInExports;
1892
- var defineProperty = objectDefineProperty;
1893
-
1894
- var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1895
- if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1896
- if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1897
- return defineProperty.f(target, name, descriptor);
1898
- };
1899
-
1900
- var getBuiltIn$3 = getBuiltIn$7;
1901
- var defineBuiltInAccessor = defineBuiltInAccessor$1;
1902
- var wellKnownSymbol$6 = wellKnownSymbol$g;
1903
- var DESCRIPTORS$1 = descriptors;
1904
-
1905
- var SPECIES$2 = wellKnownSymbol$6('species');
1906
-
1907
- var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1908
- var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
1909
-
1910
- if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$2]) {
1911
- defineBuiltInAccessor(Constructor, SPECIES$2, {
1912
- configurable: true,
1913
- get: function () { return this; }
1914
- });
1915
- }
1916
- };
1917
-
1918
- var isPrototypeOf = objectIsPrototypeOf;
1919
-
1920
- var $TypeError$4 = TypeError;
1921
-
1922
- var anInstance$1 = function (it, Prototype) {
1923
- if (isPrototypeOf(Prototype, it)) return it;
1924
- throw new $TypeError$4('Incorrect invocation');
1925
- };
1926
-
1927
- var uncurryThis$2 = functionUncurryThis;
1928
- var fails$1 = fails$f;
1929
- var isCallable$4 = isCallable$j;
1930
- var classof$2 = classof$4;
1931
- var getBuiltIn$2 = getBuiltIn$7;
1932
- var inspectSource$1 = inspectSource$3;
1933
-
1934
- var noop = function () { /* empty */ };
1935
- var construct = getBuiltIn$2('Reflect', 'construct');
1936
- var constructorRegExp = /^\s*(?:class|function)\b/;
1937
- var exec = uncurryThis$2(constructorRegExp.exec);
1938
- var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
1939
-
1940
- var isConstructorModern = function isConstructor(argument) {
1941
- if (!isCallable$4(argument)) return false;
1942
- try {
1943
- construct(noop, [], argument);
1944
- return true;
1945
- } catch (error) {
1946
- return false;
1947
- }
1948
- };
1949
-
1950
- var isConstructorLegacy = function isConstructor(argument) {
1951
- if (!isCallable$4(argument)) return false;
1952
- switch (classof$2(argument)) {
1953
- case 'AsyncFunction':
1954
- case 'GeneratorFunction':
1955
- case 'AsyncGeneratorFunction': return false;
1956
- }
1957
- try {
1958
- // we can't check .prototype since constructors produced by .bind haven't it
1959
- // `Function#toString` throws on some built-it function in some legacy engines
1960
- // (for example, `DOMQuad` and similar in FF41-)
1961
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
1962
- } catch (error) {
1963
- return true;
1964
- }
1965
- };
1966
-
1967
- isConstructorLegacy.sham = true;
1968
-
1969
- // `IsConstructor` abstract operation
1970
- // https://tc39.es/ecma262/#sec-isconstructor
1971
- var isConstructor$1 = !construct || fails$1(function () {
1972
- var called;
1973
- return isConstructorModern(isConstructorModern.call)
1974
- || !isConstructorModern(Object)
1975
- || !isConstructorModern(function () { called = true; })
1976
- || called;
1977
- }) ? isConstructorLegacy : isConstructorModern;
1978
-
1979
- var isConstructor = isConstructor$1;
1980
- var tryToString = tryToString$4;
1981
-
1982
- var $TypeError$3 = TypeError;
1983
-
1984
- // `Assert: IsConstructor(argument) is true`
1985
- var aConstructor$1 = function (argument) {
1986
- if (isConstructor(argument)) return argument;
1987
- throw new $TypeError$3(tryToString(argument) + ' is not a constructor');
1988
- };
1989
-
1990
- var anObject$1 = anObject$9;
1991
- var aConstructor = aConstructor$1;
1992
- var isNullOrUndefined = isNullOrUndefined$4;
1993
- var wellKnownSymbol$5 = wellKnownSymbol$g;
1994
-
1995
- var SPECIES$1 = wellKnownSymbol$5('species');
1996
-
1997
- // `SpeciesConstructor` abstract operation
1998
- // https://tc39.es/ecma262/#sec-speciesconstructor
1999
- var speciesConstructor$1 = function (O, defaultConstructor) {
2000
- var C = anObject$1(O).constructor;
2001
- var S;
2002
- return C === undefined || isNullOrUndefined(S = anObject$1(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
2003
- };
2004
-
2005
- var NATIVE_BIND = functionBindNative;
2006
-
2007
- var FunctionPrototype = Function.prototype;
2008
- var apply$1 = FunctionPrototype.apply;
2009
- var call$3 = FunctionPrototype.call;
2010
-
2011
- // eslint-disable-next-line es/no-reflect -- safe
2012
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$3.bind(apply$1) : function () {
2013
- return call$3.apply(apply$1, arguments);
2014
- });
2015
-
2016
- var uncurryThis$1 = functionUncurryThis;
2017
-
2018
- var arraySlice$1 = uncurryThis$1([].slice);
2019
-
2020
- var $TypeError$2 = TypeError;
2021
-
2022
- var validateArgumentsLength$1 = function (passed, required) {
2023
- if (passed < required) throw new $TypeError$2('Not enough arguments');
2024
- return passed;
2025
- };
2026
-
2027
- var userAgent$2 = environmentUserAgent;
2028
-
2029
- // eslint-disable-next-line redos/no-vulnerable -- safe
2030
- var environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
2031
-
2032
- var globalThis$7 = globalThis_1;
2033
- var apply = functionApply;
2034
- var bind$2 = functionBindContext;
2035
- var isCallable$3 = isCallable$j;
2036
- var hasOwn = hasOwnProperty_1;
2037
- var fails = fails$f;
2038
- var html = html$2;
2039
- var arraySlice = arraySlice$1;
2040
- var createElement = documentCreateElement$2;
2041
- var validateArgumentsLength = validateArgumentsLength$1;
2042
- var IS_IOS$1 = environmentIsIos;
2043
- var IS_NODE$2 = environmentIsNode;
2044
-
2045
- var set = globalThis$7.setImmediate;
2046
- var clear = globalThis$7.clearImmediate;
2047
- var process$2 = globalThis$7.process;
2048
- var Dispatch = globalThis$7.Dispatch;
2049
- var Function$1 = globalThis$7.Function;
2050
- var MessageChannel = globalThis$7.MessageChannel;
2051
- var String$1 = globalThis$7.String;
2052
- var counter = 0;
2053
- var queue$2 = {};
2054
- var ONREADYSTATECHANGE = 'onreadystatechange';
2055
- var $location, defer, channel, port;
2056
-
2057
- fails(function () {
2058
- // Deno throws a ReferenceError on `location` access without `--location` flag
2059
- $location = globalThis$7.location;
2060
- });
2061
-
2062
- var run = function (id) {
2063
- if (hasOwn(queue$2, id)) {
2064
- var fn = queue$2[id];
2065
- delete queue$2[id];
2066
- fn();
2067
- }
2068
- };
2069
-
2070
- var runner = function (id) {
2071
- return function () {
2072
- run(id);
2073
- };
2074
- };
2075
-
2076
- var eventListener = function (event) {
2077
- run(event.data);
2078
- };
2079
-
2080
- var globalPostMessageDefer = function (id) {
2081
- // old engines have not location.origin
2082
- globalThis$7.postMessage(String$1(id), $location.protocol + '//' + $location.host);
2083
- };
2084
-
2085
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
2086
- if (!set || !clear) {
2087
- set = function setImmediate(handler) {
2088
- validateArgumentsLength(arguments.length, 1);
2089
- var fn = isCallable$3(handler) ? handler : Function$1(handler);
2090
- var args = arraySlice(arguments, 1);
2091
- queue$2[++counter] = function () {
2092
- apply(fn, undefined, args);
2093
- };
2094
- defer(counter);
2095
- return counter;
2096
- };
2097
- clear = function clearImmediate(id) {
2098
- delete queue$2[id];
2099
- };
2100
- // Node.js 0.8-
2101
- if (IS_NODE$2) {
2102
- defer = function (id) {
2103
- process$2.nextTick(runner(id));
2104
- };
2105
- // Sphere (JS game engine) Dispatch API
2106
- } else if (Dispatch && Dispatch.now) {
2107
- defer = function (id) {
2108
- Dispatch.now(runner(id));
2109
- };
2110
- // Browsers with MessageChannel, includes WebWorkers
2111
- // except iOS - https://github.com/zloirock/core-js/issues/624
2112
- } else if (MessageChannel && !IS_IOS$1) {
2113
- channel = new MessageChannel();
2114
- port = channel.port2;
2115
- channel.port1.onmessage = eventListener;
2116
- defer = bind$2(port.postMessage, port);
2117
- // Browsers with postMessage, skip WebWorkers
2118
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
2119
- } else if (
2120
- globalThis$7.addEventListener &&
2121
- isCallable$3(globalThis$7.postMessage) &&
2122
- !globalThis$7.importScripts &&
2123
- $location && $location.protocol !== 'file:' &&
2124
- !fails(globalPostMessageDefer)
2125
- ) {
2126
- defer = globalPostMessageDefer;
2127
- globalThis$7.addEventListener('message', eventListener, false);
2128
- // IE8-
2129
- } else if (ONREADYSTATECHANGE in createElement('script')) {
2130
- defer = function (id) {
2131
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
2132
- html.removeChild(this);
2133
- run(id);
2134
- };
2135
- };
2136
- // Rest old browsers
2137
- } else {
2138
- defer = function (id) {
2139
- setTimeout(runner(id), 0);
2140
- };
2141
- }
2142
- }
2143
-
2144
- var task$1 = {
2145
- set: set,
2146
- clear: clear
2147
- };
2148
-
2149
- var globalThis$6 = globalThis_1;
2150
- var DESCRIPTORS = descriptors;
2151
-
2152
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2153
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
2154
-
2155
- // Avoid NodeJS experimental warning
2156
- var safeGetBuiltIn$1 = function (name) {
2157
- if (!DESCRIPTORS) return globalThis$6[name];
2158
- var descriptor = getOwnPropertyDescriptor(globalThis$6, name);
2159
- return descriptor && descriptor.value;
2160
- };
2161
-
2162
- var Queue$2 = function () {
2163
- this.head = null;
2164
- this.tail = null;
2165
- };
2166
-
2167
- Queue$2.prototype = {
2168
- add: function (item) {
2169
- var entry = { item: item, next: null };
2170
- var tail = this.tail;
2171
- if (tail) tail.next = entry;
2172
- else this.head = entry;
2173
- this.tail = entry;
2174
- },
2175
- get: function () {
2176
- var entry = this.head;
2177
- if (entry) {
2178
- var next = this.head = entry.next;
2179
- if (next === null) this.tail = null;
2180
- return entry.item;
2181
- }
2182
- }
2183
- };
2184
-
2185
- var queue$1 = Queue$2;
2186
-
2187
- var userAgent$1 = environmentUserAgent;
2188
-
2189
- var environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
2190
-
2191
- var userAgent = environmentUserAgent;
2192
-
2193
- var environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
2194
-
2195
- var globalThis$5 = globalThis_1;
2196
- var safeGetBuiltIn = safeGetBuiltIn$1;
2197
- var bind$1 = functionBindContext;
2198
- var macrotask = task$1.set;
2199
- var Queue$1 = queue$1;
2200
- var IS_IOS = environmentIsIos;
2201
- var IS_IOS_PEBBLE = environmentIsIosPebble;
2202
- var IS_WEBOS_WEBKIT = environmentIsWebosWebkit;
2203
- var IS_NODE$1 = environmentIsNode;
2204
-
2205
- var MutationObserver = globalThis$5.MutationObserver || globalThis$5.WebKitMutationObserver;
2206
- var document$2 = globalThis$5.document;
2207
- var process$1 = globalThis$5.process;
2208
- var Promise$1 = globalThis$5.Promise;
2209
- var microtask$1 = safeGetBuiltIn('queueMicrotask');
2210
- var notify$1, toggle, node, promise, then;
2211
-
2212
- // modern engines have queueMicrotask method
2213
- if (!microtask$1) {
2214
- var queue = new Queue$1();
2215
-
2216
- var flush = function () {
2217
- var parent, fn;
2218
- if (IS_NODE$1 && (parent = process$1.domain)) parent.exit();
2219
- while (fn = queue.get()) try {
2220
- fn();
2221
- } catch (error) {
2222
- if (queue.head) notify$1();
2223
- throw error;
2224
- }
2225
- if (parent) parent.enter();
2226
- };
2227
-
2228
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
2229
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
2230
- if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
2231
- toggle = true;
2232
- node = document$2.createTextNode('');
2233
- new MutationObserver(flush).observe(node, { characterData: true });
2234
- notify$1 = function () {
2235
- node.data = toggle = !toggle;
2236
- };
2237
- // environments with maybe non-completely correct, but existent Promise
2238
- } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
2239
- // Promise.resolve without an argument throws an error in LG WebOS 2
2240
- promise = Promise$1.resolve(undefined);
2241
- // workaround of WebKit ~ iOS Safari 10.1 bug
2242
- promise.constructor = Promise$1;
2243
- then = bind$1(promise.then, promise);
2244
- notify$1 = function () {
2245
- then(flush);
2246
- };
2247
- // Node.js without promises
2248
- } else if (IS_NODE$1) {
2249
- notify$1 = function () {
2250
- process$1.nextTick(flush);
2251
- };
2252
- // for other environments - macrotask based on:
2253
- // - setImmediate
2254
- // - MessageChannel
2255
- // - window.postMessage
2256
- // - onreadystatechange
2257
- // - setTimeout
2258
- } else {
2259
- // `webpack` dev server bug on IE global methods - use bind(fn, global)
2260
- macrotask = bind$1(macrotask, globalThis$5);
2261
- notify$1 = function () {
2262
- macrotask(flush);
2263
- };
2264
- }
2265
-
2266
- microtask$1 = function (fn) {
2267
- if (!queue.head) notify$1();
2268
- queue.add(fn);
2269
- };
2270
- }
2271
-
2272
- var microtask_1 = microtask$1;
2273
-
2274
- var hostReportErrors$1 = function (a, b) {
2275
- try {
2276
- // eslint-disable-next-line no-console -- safe
2277
- arguments.length === 1 ? console.error(a) : console.error(a, b);
2278
- } catch (error) { /* empty */ }
2279
- };
2280
-
2281
- var perform$3 = function (exec) {
2282
- try {
2283
- return { error: false, value: exec() };
2284
- } catch (error) {
2285
- return { error: true, value: error };
2286
- }
2287
- };
2288
-
2289
- var globalThis$4 = globalThis_1;
2290
-
2291
- var promiseNativeConstructor = globalThis$4.Promise;
2292
-
2293
- var globalThis$3 = globalThis_1;
2294
- var NativePromiseConstructor$3 = promiseNativeConstructor;
2295
- var isCallable$2 = isCallable$j;
2296
- var isForced = isForced_1;
2297
- var inspectSource = inspectSource$3;
2298
- var wellKnownSymbol$4 = wellKnownSymbol$g;
2299
- var ENVIRONMENT = environment;
2300
- var V8_VERSION = environmentV8Version;
2301
-
2302
- NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
2303
- var SPECIES = wellKnownSymbol$4('species');
2304
- var SUBCLASSING = false;
2305
- var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$2(globalThis$3.PromiseRejectionEvent);
2306
-
2307
- var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
2308
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
2309
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
2310
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
2311
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
2312
- // We can't detect it synchronously, so just check versions
2313
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
2314
- // We can't use @@species feature detection in V8 since it causes
2315
- // deoptimization and performance degradation
2316
- // https://github.com/zloirock/core-js/issues/679
2317
- if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
2318
- // Detect correctness of subclassing with @@species support
2319
- var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
2320
- var FakePromise = function (exec) {
2321
- exec(function () { /* empty */ }, function () { /* empty */ });
2322
- };
2323
- var constructor = promise.constructor = {};
2324
- constructor[SPECIES] = FakePromise;
2325
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
2326
- if (!SUBCLASSING) return true;
2327
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
2328
- } return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT$1;
2329
- });
2330
-
2331
- var promiseConstructorDetection = {
2332
- CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
2333
- REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
2334
- SUBCLASSING: SUBCLASSING
2335
- };
2336
-
2337
- var newPromiseCapability$2 = {};
2338
-
2339
- var aCallable$3 = aCallable$9;
2340
-
2341
- var $TypeError$1 = TypeError;
2342
-
2343
- var PromiseCapability = function (C) {
2344
- var resolve, reject;
2345
- this.promise = new C(function ($$resolve, $$reject) {
2346
- if (resolve !== undefined || reject !== undefined) throw new $TypeError$1('Bad Promise constructor');
2347
- resolve = $$resolve;
2348
- reject = $$reject;
2349
- });
2350
- this.resolve = aCallable$3(resolve);
2351
- this.reject = aCallable$3(reject);
2352
- };
2353
-
2354
- // `NewPromiseCapability` abstract operation
2355
- // https://tc39.es/ecma262/#sec-newpromisecapability
2356
- newPromiseCapability$2.f = function (C) {
2357
- return new PromiseCapability(C);
2358
- };
2359
-
2360
- var $$6 = _export;
2361
- var IS_NODE = environmentIsNode;
2362
- var globalThis$2 = globalThis_1;
2363
- var call$2 = functionCall;
2364
- var defineBuiltIn$1 = defineBuiltIn$5;
2365
- var setPrototypeOf = objectSetPrototypeOf;
2366
- var setToStringTag$1 = setToStringTag$4;
2367
- var setSpecies = setSpecies$1;
2368
- var aCallable$2 = aCallable$9;
2369
- var isCallable$1 = isCallable$j;
2370
- var isObject$2 = isObject$b;
2371
- var anInstance = anInstance$1;
2372
- var speciesConstructor = speciesConstructor$1;
2373
- var task = task$1.set;
2374
- var microtask = microtask_1;
2375
- var hostReportErrors = hostReportErrors$1;
2376
- var perform$2 = perform$3;
2377
- var Queue = queue$1;
2378
- var InternalStateModule = internalState;
2379
- var NativePromiseConstructor$2 = promiseNativeConstructor;
2380
- var PromiseConstructorDetection = promiseConstructorDetection;
2381
- var newPromiseCapabilityModule$3 = newPromiseCapability$2;
2382
-
2383
- var PROMISE = 'Promise';
2384
- var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
2385
- var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
2386
- var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
2387
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
2388
- var setInternalState = InternalStateModule.set;
2389
- var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
2390
- var PromiseConstructor = NativePromiseConstructor$2;
2391
- var PromisePrototype = NativePromisePrototype$1;
2392
- var TypeError$1 = globalThis$2.TypeError;
2393
- var document$1 = globalThis$2.document;
2394
- var process = globalThis$2.process;
2395
- var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
2396
- var newGenericPromiseCapability = newPromiseCapability$1;
2397
-
2398
- var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && globalThis$2.dispatchEvent);
2399
- var UNHANDLED_REJECTION = 'unhandledrejection';
2400
- var REJECTION_HANDLED = 'rejectionhandled';
2401
- var PENDING = 0;
2402
- var FULFILLED = 1;
2403
- var REJECTED = 2;
2404
- var HANDLED = 1;
2405
- var UNHANDLED = 2;
2406
-
2407
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
2408
-
2409
- // helpers
2410
- var isThenable = function (it) {
2411
- var then;
2412
- return isObject$2(it) && isCallable$1(then = it.then) ? then : false;
2413
- };
2414
-
2415
- var callReaction = function (reaction, state) {
2416
- var value = state.value;
2417
- var ok = state.state === FULFILLED;
2418
- var handler = ok ? reaction.ok : reaction.fail;
2419
- var resolve = reaction.resolve;
2420
- var reject = reaction.reject;
2421
- var domain = reaction.domain;
2422
- var result, then, exited;
2423
- try {
2424
- if (handler) {
2425
- if (!ok) {
2426
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
2427
- state.rejection = HANDLED;
2428
- }
2429
- if (handler === true) result = value;
2430
- else {
2431
- if (domain) domain.enter();
2432
- result = handler(value); // can throw
2433
- if (domain) {
2434
- domain.exit();
2435
- exited = true;
2436
- }
2437
- }
2438
- if (result === reaction.promise) {
2439
- reject(new TypeError$1('Promise-chain cycle'));
2440
- } else if (then = isThenable(result)) {
2441
- call$2(then, result, resolve, reject);
2442
- } else resolve(result);
2443
- } else reject(value);
2444
- } catch (error) {
2445
- if (domain && !exited) domain.exit();
2446
- reject(error);
2447
- }
2448
- };
2449
-
2450
- var notify = function (state, isReject) {
2451
- if (state.notified) return;
2452
- state.notified = true;
2453
- microtask(function () {
2454
- var reactions = state.reactions;
2455
- var reaction;
2456
- while (reaction = reactions.get()) {
2457
- callReaction(reaction, state);
2458
- }
2459
- state.notified = false;
2460
- if (isReject && !state.rejection) onUnhandled(state);
2461
- });
2462
- };
2463
-
2464
- var dispatchEvent = function (name, promise, reason) {
2465
- var event, handler;
2466
- if (DISPATCH_EVENT) {
2467
- event = document$1.createEvent('Event');
2468
- event.promise = promise;
2469
- event.reason = reason;
2470
- event.initEvent(name, false, true);
2471
- globalThis$2.dispatchEvent(event);
2472
- } else event = { promise: promise, reason: reason };
2473
- if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis$2['on' + name])) handler(event);
2474
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
2475
- };
2476
-
2477
- var onUnhandled = function (state) {
2478
- call$2(task, globalThis$2, function () {
2479
- var promise = state.facade;
2480
- var value = state.value;
2481
- var IS_UNHANDLED = isUnhandled(state);
2482
- var result;
2483
- if (IS_UNHANDLED) {
2484
- result = perform$2(function () {
2485
- if (IS_NODE) {
2486
- process.emit('unhandledRejection', value, promise);
2487
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
2488
- });
2489
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
2490
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
2491
- if (result.error) throw result.value;
2492
- }
2493
- });
2494
- };
2495
-
2496
- var isUnhandled = function (state) {
2497
- return state.rejection !== HANDLED && !state.parent;
2498
- };
2499
-
2500
- var onHandleUnhandled = function (state) {
2501
- call$2(task, globalThis$2, function () {
2502
- var promise = state.facade;
2503
- if (IS_NODE) {
2504
- process.emit('rejectionHandled', promise);
2505
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
2506
- });
2507
- };
2508
-
2509
- var bind = function (fn, state, unwrap) {
2510
- return function (value) {
2511
- fn(state, value, unwrap);
2512
- };
2513
- };
2514
-
2515
- var internalReject = function (state, value, unwrap) {
2516
- if (state.done) return;
2517
- state.done = true;
2518
- if (unwrap) state = unwrap;
2519
- state.value = value;
2520
- state.state = REJECTED;
2521
- notify(state, true);
2522
- };
2523
-
2524
- var internalResolve = function (state, value, unwrap) {
2525
- if (state.done) return;
2526
- state.done = true;
2527
- if (unwrap) state = unwrap;
2528
- try {
2529
- if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
2530
- var then = isThenable(value);
2531
- if (then) {
2532
- microtask(function () {
2533
- var wrapper = { done: false };
2534
- try {
2535
- call$2(then, value,
2536
- bind(internalResolve, wrapper, state),
2537
- bind(internalReject, wrapper, state)
2538
- );
2539
- } catch (error) {
2540
- internalReject(wrapper, error, state);
2541
- }
2542
- });
2543
- } else {
2544
- state.value = value;
2545
- state.state = FULFILLED;
2546
- notify(state, false);
2547
- }
2548
- } catch (error) {
2549
- internalReject({ done: false }, error, state);
2550
- }
2551
- };
2552
-
2553
- // constructor polyfill
2554
- if (FORCED_PROMISE_CONSTRUCTOR$4) {
2555
- // 25.4.3.1 Promise(executor)
2556
- PromiseConstructor = function Promise(executor) {
2557
- anInstance(this, PromisePrototype);
2558
- aCallable$2(executor);
2559
- call$2(Internal, this);
2560
- var state = getInternalPromiseState(this);
2561
- try {
2562
- executor(bind(internalResolve, state), bind(internalReject, state));
2563
- } catch (error) {
2564
- internalReject(state, error);
2565
- }
2566
- };
2567
-
2568
- PromisePrototype = PromiseConstructor.prototype;
2569
-
2570
- // eslint-disable-next-line no-unused-vars -- required for `.length`
2571
- Internal = function Promise(executor) {
2572
- setInternalState(this, {
2573
- type: PROMISE,
2574
- done: false,
2575
- notified: false,
2576
- parent: false,
2577
- reactions: new Queue(),
2578
- rejection: false,
2579
- state: PENDING,
2580
- value: null
2581
- });
2582
- };
2583
-
2584
- // `Promise.prototype.then` method
2585
- // https://tc39.es/ecma262/#sec-promise.prototype.then
2586
- Internal.prototype = defineBuiltIn$1(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
2587
- var state = getInternalPromiseState(this);
2588
- var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
2589
- state.parent = true;
2590
- reaction.ok = isCallable$1(onFulfilled) ? onFulfilled : true;
2591
- reaction.fail = isCallable$1(onRejected) && onRejected;
2592
- reaction.domain = IS_NODE ? process.domain : undefined;
2593
- if (state.state === PENDING) state.reactions.add(reaction);
2594
- else microtask(function () {
2595
- callReaction(reaction, state);
2596
- });
2597
- return reaction.promise;
2598
- });
2599
-
2600
- OwnPromiseCapability = function () {
2601
- var promise = new Internal();
2602
- var state = getInternalPromiseState(promise);
2603
- this.promise = promise;
2604
- this.resolve = bind(internalResolve, state);
2605
- this.reject = bind(internalReject, state);
2606
- };
2607
-
2608
- newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
2609
- return C === PromiseConstructor || C === PromiseWrapper
2610
- ? new OwnPromiseCapability(C)
2611
- : newGenericPromiseCapability(C);
2612
- };
2613
-
2614
- if (isCallable$1(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
2615
- nativeThen = NativePromisePrototype$1.then;
2616
-
2617
- if (!NATIVE_PROMISE_SUBCLASSING) {
2618
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
2619
- defineBuiltIn$1(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2620
- var that = this;
2621
- return new PromiseConstructor(function (resolve, reject) {
2622
- call$2(nativeThen, that, resolve, reject);
2623
- }).then(onFulfilled, onRejected);
2624
- // https://github.com/zloirock/core-js/issues/640
2625
- }, { unsafe: true });
2626
- }
2627
-
2628
- // make `.constructor === Promise` work for native promise-based APIs
2629
- try {
2630
- delete NativePromisePrototype$1.constructor;
2631
- } catch (error) { /* empty */ }
2632
-
2633
- // make `instanceof Promise` work for native promise-based APIs
2634
- if (setPrototypeOf) {
2635
- setPrototypeOf(NativePromisePrototype$1, PromisePrototype);
2636
- }
2637
- }
2638
- }
2639
-
2640
- $$6({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2641
- Promise: PromiseConstructor
2642
- });
2643
-
2644
- setToStringTag$1(PromiseConstructor, PROMISE, false);
2645
- setSpecies(PROMISE);
2646
-
2647
- var wellKnownSymbol$3 = wellKnownSymbol$g;
2648
-
2649
- var ITERATOR$1 = wellKnownSymbol$3('iterator');
2650
- var SAFE_CLOSING = false;
2651
-
2652
- try {
2653
- var called = 0;
2654
- var iteratorWithReturn = {
2655
- next: function () {
2656
- return { done: !!called++ };
2657
- },
2658
- 'return': function () {
2659
- SAFE_CLOSING = true;
2660
- }
2661
- };
2662
- iteratorWithReturn[ITERATOR$1] = function () {
2663
- return this;
2664
- };
2665
- // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
2666
- Array.from(iteratorWithReturn, function () { throw 2; });
2667
- } catch (error) { /* empty */ }
2668
-
2669
- var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
2670
- try {
2671
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2672
- } catch (error) { return false; } // workaround of old WebKit + `eval` bug
2673
- var ITERATION_SUPPORT = false;
2674
- try {
2675
- var object = {};
2676
- object[ITERATOR$1] = function () {
2677
- return {
2678
- next: function () {
2679
- return { done: ITERATION_SUPPORT = true };
2680
- }
2681
- };
2682
- };
2683
- exec(object);
2684
- } catch (error) { /* empty */ }
2685
- return ITERATION_SUPPORT;
2686
- };
2687
-
2688
- var NativePromiseConstructor$1 = promiseNativeConstructor;
2689
- var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
2690
- var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
2691
-
2692
- var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
2693
- NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2694
- });
2695
-
2696
- var $$5 = _export;
2697
- var call$1 = functionCall;
2698
- var aCallable$1 = aCallable$9;
2699
- var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2700
- var perform$1 = perform$3;
2701
- var iterate$1 = iterate$3;
2702
- var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2703
-
2704
- // `Promise.all` method
2705
- // https://tc39.es/ecma262/#sec-promise.all
2706
- $$5({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2707
- all: function all(iterable) {
2708
- var C = this;
2709
- var capability = newPromiseCapabilityModule$2.f(C);
2710
- var resolve = capability.resolve;
2711
- var reject = capability.reject;
2712
- var result = perform$1(function () {
2713
- var $promiseResolve = aCallable$1(C.resolve);
2714
- var values = [];
2715
- var counter = 0;
2716
- var remaining = 1;
2717
- iterate$1(iterable, function (promise) {
2718
- var index = counter++;
2719
- var alreadyCalled = false;
2720
- remaining++;
2721
- call$1($promiseResolve, C, promise).then(function (value) {
2722
- if (alreadyCalled) return;
2723
- alreadyCalled = true;
2724
- values[index] = value;
2725
- --remaining || resolve(values);
2726
- }, reject);
2727
- });
2728
- --remaining || resolve(values);
2729
- });
2730
- if (result.error) reject(result.value);
2731
- return capability.promise;
2732
- }
2733
- });
2734
-
2735
- var $$4 = _export;
2736
- var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2737
- var NativePromiseConstructor = promiseNativeConstructor;
2738
- var getBuiltIn$1 = getBuiltIn$7;
2739
- var isCallable = isCallable$j;
2740
- var defineBuiltIn = defineBuiltIn$5;
2741
-
2742
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
2743
-
2744
- // `Promise.prototype.catch` method
2745
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
2746
- $$4({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2747
- 'catch': function (onRejected) {
2748
- return this.then(undefined, onRejected);
2749
- }
2750
- });
2751
-
2752
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2753
- if (isCallable(NativePromiseConstructor)) {
2754
- var method = getBuiltIn$1('Promise').prototype['catch'];
2755
- if (NativePromisePrototype['catch'] !== method) {
2756
- defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
2757
- }
2758
- }
2759
-
2760
- var $$3 = _export;
2761
- var call = functionCall;
2762
- var aCallable = aCallable$9;
2763
- var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2764
- var perform = perform$3;
2765
- var iterate = iterate$3;
2766
- var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2767
-
2768
- // `Promise.race` method
2769
- // https://tc39.es/ecma262/#sec-promise.race
2770
- $$3({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2771
- race: function race(iterable) {
2772
- var C = this;
2773
- var capability = newPromiseCapabilityModule$1.f(C);
2774
- var reject = capability.reject;
2775
- var result = perform(function () {
2776
- var $promiseResolve = aCallable(C.resolve);
2777
- iterate(iterable, function (promise) {
2778
- call($promiseResolve, C, promise).then(capability.resolve, reject);
2779
- });
2780
- });
2781
- if (result.error) reject(result.value);
2782
- return capability.promise;
2783
- }
2784
- });
2785
-
2786
- var $$2 = _export;
2787
- var newPromiseCapabilityModule = newPromiseCapability$2;
2788
- var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2789
-
2790
- // `Promise.reject` method
2791
- // https://tc39.es/ecma262/#sec-promise.reject
2792
- $$2({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2793
- reject: function reject(r) {
2794
- var capability = newPromiseCapabilityModule.f(this);
2795
- var capabilityReject = capability.reject;
2796
- capabilityReject(r);
2797
- return capability.promise;
2798
- }
2799
- });
2800
-
2801
- var anObject = anObject$9;
2802
- var isObject$1 = isObject$b;
2803
- var newPromiseCapability = newPromiseCapability$2;
2804
-
2805
- var promiseResolve$1 = function (C, x) {
2806
- anObject(C);
2807
- if (isObject$1(x) && x.constructor === C) return x;
2808
- var promiseCapability = newPromiseCapability.f(C);
2809
- var resolve = promiseCapability.resolve;
2810
- resolve(x);
2811
- return promiseCapability.promise;
2812
- };
2813
-
2814
- var $$1 = _export;
2815
- var getBuiltIn = getBuiltIn$7;
2816
- var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2817
- var promiseResolve = promiseResolve$1;
2818
-
2819
- getBuiltIn('Promise');
2820
-
2821
- // `Promise.resolve` method
2822
- // https://tc39.es/ecma262/#sec-promise.resolve
2823
- $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2824
- resolve: function resolve(x) {
2825
- return promiseResolve(this, x);
2826
- }
2827
- });
2828
-
2829
- var isObject = isObject$b;
2830
- var classof$1 = classofRaw$2;
2831
- var wellKnownSymbol$2 = wellKnownSymbol$g;
2832
-
2833
- var MATCH$1 = wellKnownSymbol$2('match');
2834
-
2835
- // `IsRegExp` abstract operation
2836
- // https://tc39.es/ecma262/#sec-isregexp
2837
- var isRegexp = function (it) {
2838
- var isRegExp;
2839
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) === 'RegExp');
2840
- };
2841
-
2842
- var isRegExp = isRegexp;
2843
-
2844
- var $TypeError = TypeError;
2845
-
2846
- var notARegexp = function (it) {
2847
- if (isRegExp(it)) {
2848
- throw new $TypeError("The method doesn't accept regular expressions");
2849
- } return it;
2850
- };
2851
-
2852
- var classof = classof$4;
2853
-
2854
- var $String = String;
2855
-
2856
- var toString$1 = function (argument) {
2857
- if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
2858
- return $String(argument);
2859
- };
2860
-
2861
- var wellKnownSymbol$1 = wellKnownSymbol$g;
2862
-
2863
- var MATCH = wellKnownSymbol$1('match');
2864
-
2865
- var correctIsRegexpLogic = function (METHOD_NAME) {
2866
- var regexp = /./;
2867
- try {
2868
- '/./'[METHOD_NAME](regexp);
2869
- } catch (error1) {
2870
- try {
2871
- regexp[MATCH] = false;
2872
- return '/./'[METHOD_NAME](regexp);
2873
- } catch (error2) { /* empty */ }
2874
- } return false;
2875
- };
2876
-
2877
- var $ = _export;
2878
- var uncurryThis = functionUncurryThis;
2879
- var notARegExp = notARegexp;
2880
- var requireObjectCoercible = requireObjectCoercible$4;
2881
- var toString = toString$1;
2882
- var correctIsRegExpLogic = correctIsRegexpLogic;
2883
-
2884
- var stringIndexOf = uncurryThis(''.indexOf);
2885
-
2886
- // `String.prototype.includes` method
2887
- // https://tc39.es/ecma262/#sec-string.prototype.includes
2888
- $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
2889
- includes: function includes(searchString /* , position = 0 */) {
2890
- return !!~stringIndexOf(
2891
- toString(requireObjectCoercible(this)),
2892
- toString(notARegExp(searchString)),
2893
- arguments.length > 1 ? arguments[1] : undefined
2894
- );
2895
- }
2896
- });
2897
-
2898
- // iterable DOM collections
2899
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
2900
- var domIterables = {
2901
- CSSRuleList: 0,
2902
- CSSStyleDeclaration: 0,
2903
- CSSValueList: 0,
2904
- ClientRectList: 0,
2905
- DOMRectList: 0,
2906
- DOMStringList: 0,
2907
- DOMTokenList: 1,
2908
- DataTransferItemList: 0,
2909
- FileList: 0,
2910
- HTMLAllCollection: 0,
2911
- HTMLCollection: 0,
2912
- HTMLFormElement: 0,
2913
- HTMLSelectElement: 0,
2914
- MediaList: 0,
2915
- MimeTypeArray: 0,
2916
- NamedNodeMap: 0,
2917
- NodeList: 1,
2918
- PaintRequestList: 0,
2919
- Plugin: 0,
2920
- PluginArray: 0,
2921
- SVGLengthList: 0,
2922
- SVGNumberList: 0,
2923
- SVGPathSegList: 0,
2924
- SVGPointList: 0,
2925
- SVGStringList: 0,
2926
- SVGTransformList: 0,
2927
- SourceBufferList: 0,
2928
- StyleSheetList: 0,
2929
- TextTrackCueList: 0,
2930
- TextTrackList: 0,
2931
- TouchList: 0
2932
- };
2933
-
2934
- // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
2935
- var documentCreateElement = documentCreateElement$2;
2936
-
2937
- var classList = documentCreateElement('span').classList;
2938
- var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
2939
-
2940
- var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
2941
-
2942
- var globalThis$1 = globalThis_1;
2943
- var DOMIterables = domIterables;
2944
- var DOMTokenListPrototype = domTokenListPrototype;
2945
- var ArrayIteratorMethods = es_array_iterator;
2946
- var createNonEnumerableProperty = createNonEnumerableProperty$4;
2947
- var setToStringTag = setToStringTag$4;
2948
- var wellKnownSymbol = wellKnownSymbol$g;
2949
-
2950
- var ITERATOR = wellKnownSymbol('iterator');
2951
- var ArrayValues = ArrayIteratorMethods.values;
2952
-
2953
- var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
2954
- if (CollectionPrototype) {
2955
- // some Chrome versions have non-configurable methods on DOMTokenList
2956
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
2957
- createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
2958
- } catch (error) {
2959
- CollectionPrototype[ITERATOR] = ArrayValues;
2960
- }
2961
- setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
2962
- if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
2963
- // some Chrome versions have non-configurable methods on DOMTokenList
2964
- if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
2965
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
2966
- } catch (error) {
2967
- CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
2968
- }
2969
- }
2970
- }
2971
- };
2972
-
2973
- for (var COLLECTION_NAME in DOMIterables) {
2974
- handlePrototype(globalThis$1[COLLECTION_NAME] && globalThis$1[COLLECTION_NAME].prototype, COLLECTION_NAME);
2975
- }
2976
-
2977
- handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
2978
-
2979
- /**
2980
- * Checks whether the state is init state
2981
- * @param state
2982
- */
2983
- function isInit(state) {
2984
- return state.state === 'init';
2985
- }
2986
- /**
2987
- * Initializes a new state.
2988
- *
2989
- * @template T The type of the state.
2990
- * @return {InitState<T>} An object representing the initial state.
2991
- */
2992
- function init() {
2993
- return {
2994
- state: 'init'
2995
- };
2996
- }
2997
- /**
2998
- * Checks whether the state is pending state
2999
- * @param state
3000
- */
3001
- function isPending(state) {
3002
- return state.state === 'pending';
3003
- }
3004
- /**
3005
- * Generates a PendingState object with a state of "pending".
3006
- *
3007
- * @return {PendingState<T>} An object representing the pending state.
3008
- */
3009
- function pending(progress = undefined) {
3010
- return {
3011
- state: 'pending',
3012
- progress
3013
- };
3014
- }
3015
- /**
3016
- * Checks whether the state is success response
3017
- * @param state
3018
- */
3019
- function isSuccess(state) {
3020
- return state.state === 'success';
3021
- }
3022
- /**
3023
- * Creates a success state object with the provided data.
3024
- *
3025
- * @param {T} data - The data to be included in the success state.
3026
- * @return {SuccessState<T>} An object representing a success state containing the provided data.
3027
- */
3028
- function success(data) {
3029
- return {
3030
- state: 'success',
3031
- data
3032
- };
3033
- }
3034
- /**
3035
- * Checks whether the state is error state
3036
- * @param state
3037
- */
3038
- function isError(state) {
3039
- return state.state === 'error';
3040
- }
3041
- /**
3042
- * Constructs an ErrorState object representing an error.
3043
- *
3044
- * @param {any} error - The error object or message.
3045
- * @param {string} [statusCode] - An optional status code associated with the error.
3046
- * @return {ErrorState<T>} An object representing the error state.
3047
- */
3048
- function error(error, statusCode, request) {
3049
- return {
3050
- state: 'error',
3051
- error,
3052
- statusCode,
3053
- request
3054
- };
3055
- }
3056
- /**
3057
- * Indicates a successful dispatch state.
3058
- *
3059
- * @return {DispatchState<T>} An object representing a successful state.
3060
- */
3061
- function successfulDispatch() {
3062
- return {
3063
- state: 'success'
3064
- };
3065
- }
3066
- /**
3067
- * Determines if the provided dispatch state represents a successful dispatch.
3068
- *
3069
- * @param {DispatchState<T>} value - The dispatch state to check.
3070
- * @return {value is SuccessfulDispatch<T>} - True if the dispatch state indicates success, false otherwise.
3071
- */
3072
- function isSuccessfulDispatch(value) {
3073
- return value.state === 'success';
3074
- }
3075
- /**
3076
- * Generates a ValidationError object.
3077
- *
3078
- * @param error The error details that caused the validation to fail.
3079
- * @return The ValidationError object containing the error state and details.
3080
- */
3081
- function validationError(error) {
3082
- return {
3083
- state: 'validation-error',
3084
- error
3085
- };
3086
- }
3087
- /**
3088
- * Determines if a provided DispatchState object is a ValidationError.
3089
- *
3090
- * @param {DispatchState<T>} value - The DispatchState object to evaluate.
3091
- * @return {boolean} - Returns true if the provided DispatchState object is a ValidationError, otherwise returns false.
3092
- */
3093
- function isValidationError(value) {
3094
- return value.state === 'validation-error';
3095
- }
3096
-
3097
- /**
3098
- * Context object created using `createContext` function. Provides a way to share state, dispatch functions,
3099
- * and axios instance across components without having to pass props down manually at every level.
3100
- *
3101
- * @type {ContextType}
3102
- */
3103
- let Context = /*#__PURE__*/createContext({
3104
- state: {},
3105
- filteredState: {},
3106
- dispatch() {},
3107
- configs: {},
3108
- async execute() {}
3109
- });
3110
-
3111
- /**
3112
- * Handles state updates for network requests based on the provided action.
3113
- *
3114
- * @param {GlobalState} state - The current state of the application.
3115
- * @param {NetworkAction<unknown>} action - The action containing source, operation, key, and state.
3116
- * @return {GlobalState} - The updated state after applying the action.
3117
- */
3118
- function requestReducer(state, action) {
3119
- return Object.assign({}, state, {
3120
- [`${action.source}:${action.operation}:${action.key}`]: action.state
3121
- });
3122
- }
3123
- /**
3124
- * IntrigProvider is a context provider component that sets up global state management
3125
- * and provides Axios instances for API requests.
3126
- *
3127
- * @param {Object} props - The properties object.
3128
- * @param {React.ReactNode} props.children - The child components to be wrapped by the provider.
3129
- * @param {Object} [props.configs={}] - Configuration object for Axios instances.
3130
- * @param {Object} [props.configs.defaults={}] - Default configuration for Axios.
3131
- * @param {Object} [props.configs.petstore={}] - Configuration specific to the petstore API.
3132
- * @return {JSX.Element} A context provider component that wraps the provided children.
3133
- */
3134
- function IntrigProvider({
3135
- children,
3136
- configs = {}
3137
- }) {
3138
- const [state, dispatch] = useReducer(requestReducer, {});
3139
- const axiosInstances = useMemo(() => {
3140
- return {};
3141
- }, [configs]);
3142
- const contextValue = useMemo(() => {
3143
- async function execute(request, dispatch, schema) {
3144
- try {
3145
- dispatch(pending());
3146
- let response = await axiosInstances[request.source].request(request);
3147
- if (response.status >= 200 && response.status < 300) {
3148
- if (schema) {
3149
- let data = schema.safeParse(response.data);
3150
- if (!data.success) {
3151
- dispatch(error(data.error.issues, response.status, request));
3152
- return;
3153
- }
3154
- dispatch(success(data.data));
3155
- } else {
3156
- dispatch(success(response.data));
3157
- }
3158
- } else {
3159
- var _response$data;
3160
- dispatch(error((_response$data = response.data) != null ? _response$data : response.statusText, response.status));
3161
- }
3162
- } catch (e) {
3163
- if (isAxiosError(e)) {
3164
- var _e$response, _e$response2;
3165
- dispatch(error((_e$response = e.response) == null ? void 0 : _e$response.data, (_e$response2 = e.response) == null ? void 0 : _e$response2.status, request));
3166
- } else {
3167
- dispatch(error(e));
3168
- }
3169
- }
3170
- }
3171
- return {
3172
- state,
3173
- dispatch,
3174
- filteredState: state,
3175
- configs,
3176
- execute
3177
- };
3178
- }, [state, axiosInstances]);
3179
- return jsx(Context.Provider, {
3180
- value: contextValue,
3181
- children: children
3182
- });
3183
- }
3184
- function IntrigProviderStub({
3185
- children,
3186
- configs = {},
3187
- stubs = () => {}
3188
- }) {
3189
- const [state, dispatch] = useReducer(requestReducer, {});
3190
- const collectedStubs = useMemo(() => {
3191
- let fns = {};
3192
- function stub(hook, fn) {
3193
- fns[hook.key] = fn;
3194
- }
3195
- stubs(stub);
3196
- return fns;
3197
- }, [stubs]);
3198
- const contextValue = useMemo(() => {
3199
- async function execute(request, dispatch, schema) {
3200
- let stub = collectedStubs[request.key];
3201
- if (!!stub) {
3202
- try {
3203
- await stub(request.params, request.data, dispatch);
3204
- } catch (e) {
3205
- dispatch(error(e));
3206
- }
3207
- } else {
3208
- dispatch(init());
3209
- }
3210
- }
3211
- return {
3212
- state,
3213
- dispatch,
3214
- filteredState: state,
3215
- configs,
3216
- execute
3217
- };
3218
- }, [state, dispatch, configs, collectedStubs]);
3219
- return jsx(Context.Provider, {
3220
- value: contextValue,
3221
- children: children
3222
- });
3223
- }
3224
- /**
3225
- * StatusTrap component is used to track and manage network request states.
3226
- *
3227
- * @param {Object} props - The properties object.
3228
- * @param {React.ReactNode} props.children - The child elements to be rendered.
3229
- * @param {string} props.type - The type of network state to handle ("error", "pending", "pending + error").
3230
- * @param {boolean} [props.propagate=true] - Whether to propagate the event to the parent context.
3231
- * @return {React.ReactElement} The context provider component with filtered state and custom dispatch.
3232
- */
3233
- function StatusTrap({
3234
- children,
3235
- type,
3236
- propagate = true
3237
- }) {
3238
- const ctx = useContext(Context);
3239
- const [requests, setRequests] = useState([]);
3240
- const shouldHandleEvent = useCallback(state => {
3241
- switch (type) {
3242
- case 'error':
3243
- return isError(state);
3244
- case 'pending':
3245
- return isPending(state);
3246
- case 'pending + error':
3247
- return isPending(state) || isError(state);
3248
- default:
3249
- return false;
3250
- }
3251
- }, [type]);
3252
- const dispatch = useCallback(event => {
3253
- if (!event.handled) {
3254
- if (shouldHandleEvent(event.state)) {
3255
- setRequests(prev => [...prev, event.key]);
3256
- if (!propagate) {
3257
- ctx.dispatch(Object.assign({}, event, {
3258
- handled: true
3259
- }));
3260
- return;
3261
- }
3262
- } else {
3263
- setRequests(prev => prev.filter(k => k !== event.key));
3264
- }
3265
- }
3266
- ctx.dispatch(event);
3267
- }, [ctx, propagate, shouldHandleEvent]);
3268
- const filteredState = useMemo(() => {
3269
- return Object.fromEntries(Object.entries(ctx.state).filter(([key]) => requests.includes(key)));
3270
- }, [ctx.state, requests]);
3271
- return jsx(Context.Provider, {
3272
- value: Object.assign({}, ctx, {
3273
- dispatch,
3274
- filteredState
3275
- }),
3276
- children: children
3277
- });
3278
- }
3279
- /**
3280
- * useNetworkState is a custom hook that manages the network state within the specified context.
3281
- * It handles making network requests, dispatching appropriate states based on the request lifecycle,
3282
- * and allows aborting ongoing requests.
3283
- *
3284
- * @param {Object} params - The parameters required to configure and use the network state.
3285
- * @param {string} params.key - A unique identifier for the network request.
3286
- * @param {string} params.operation - The operation type related to the request.
3287
- * @param {string} params.source - The source or endpoint for the network request.
3288
- * @param {Object} params.schema - The schema used for validating the response data.
3289
- * @param {number} [params.debounceDelay] - The debounce delay for executing the network request.
3290
- *
3291
- * @return {[NetworkState<T>, (request: AxiosRequestConfig) => void, () => void]}
3292
- * Returns a state object representing the current network state,
3293
- * a function to execute the network request, and a function to clear the request.
3294
- */
3295
- function useNetworkState({
3296
- key,
3297
- operation,
3298
- source,
3299
- schema,
3300
- debounceDelay: requestDebounceDelay
3301
- }) {
3302
- var _context$state3;
3303
- const context = useContext(Context);
3304
- const [abortController, setAbortController] = useState();
3305
- const networkState = useMemo(() => {
3306
- var _context$state, _context$state2;
3307
- return (_context$state = (_context$state2 = context.state) == null ? void 0 : _context$state2[`${source}:${operation}:${key}`]) != null ? _context$state : init();
3308
- }, [(_context$state3 = context.state) == null ? void 0 : _context$state3[`${source}:${operation}:${key}`]]);
3309
- const dispatch = useCallback(state => {
3310
- context.dispatch({
3311
- key,
3312
- operation,
3313
- source,
3314
- state
3315
- });
3316
- }, [key, operation, source, context.dispatch]);
3317
- const debounceDelay = useMemo(() => {
3318
- var _ref, _context$configs;
3319
- return (_ref = requestDebounceDelay != null ? requestDebounceDelay : (_context$configs = context.configs) == null ? void 0 : _context$configs.debounceDelay) != null ? _ref : 0;
3320
- }, [context.configs, requestDebounceDelay]);
3321
- const execute = useCallback(async request => {
3322
- let abortController = new AbortController();
3323
- setAbortController(abortController);
3324
- let requestConfig = Object.assign({}, request, {
3325
- onUploadProgress(event) {
3326
- dispatch(pending({
3327
- type: 'upload',
3328
- loaded: event.loaded,
3329
- total: event.total
3330
- }));
3331
- request.onUploadProgress == null || request.onUploadProgress(event);
3332
- },
3333
- onDownloadProgress(event) {
3334
- dispatch(pending({
3335
- type: 'download',
3336
- loaded: event.loaded,
3337
- total: event.total
3338
- }));
3339
- request.onDownloadProgress == null || request.onDownloadProgress(event);
3340
- },
3341
- signal: abortController.signal
3342
- });
3343
- await context.execute(requestConfig, dispatch, schema);
3344
- }, [networkState, context.dispatch, axios]);
3345
- const deboundedExecute = useMemo(() => debounce(execute, debounceDelay != null ? debounceDelay : 0), [execute]);
3346
- const clear = useCallback(() => {
3347
- dispatch(init());
3348
- setAbortController(abortController => {
3349
- abortController == null || abortController.abort();
3350
- return undefined;
3351
- });
3352
- }, [dispatch, abortController]);
3353
- return [networkState, deboundedExecute, clear, dispatch];
3354
- }
3355
- function debounce(func, delay) {
3356
- let timeoutId;
3357
- return (...args) => {
3358
- if (timeoutId) {
3359
- clearTimeout(timeoutId);
3360
- }
3361
- timeoutId = setTimeout(() => {
3362
- func(...args);
3363
- }, delay);
3364
- };
3365
- }
3366
- /**
3367
- * Handles central error extraction from the provided context.
3368
- * It filters the state to retain error states and maps them to a structured error object with additional context information.
3369
- * @return {Object[]} An array of objects representing the error states with context information such as source, operation, and key.
3370
- */
3371
- function useCentralErrorHandling() {
3372
- const ctx = useContext(Context);
3373
- return useMemo(() => {
3374
- return Object.entries(ctx.filteredState).filter(([, state]) => isError(state)).map(([k, state]) => {
3375
- let [source, operation, key] = k.split(':');
3376
- return Object.assign({}, state, {
3377
- source,
3378
- operation,
3379
- key
3380
- });
3381
- });
3382
- }, [ctx.filteredState]);
3383
- }
3384
- /**
3385
- * Uses central pending state handling by aggregating pending states from context.
3386
- * It calculates the overall progress of pending states if any, or returns an initial state otherwise.
3387
- *
3388
- * @return {NetworkState} The aggregated network state based on the pending states and their progress.
3389
- */
3390
- function useCentralPendingStateHandling() {
3391
- const ctx = useContext(Context);
3392
- const result = useMemo(() => {
3393
- let pendingStates = Object.values(ctx.filteredState).filter(isPending);
3394
- if (!pendingStates.length) {
3395
- return init();
3396
- }
3397
- let progress = pendingStates.filter(a => a.progress).reduce((progress, current) => {
3398
- var _current$progress$tot, _current$progress, _current$progress$loa, _current$progress2;
3399
- return {
3400
- total: progress.total + ((_current$progress$tot = (_current$progress = current.progress) == null ? void 0 : _current$progress.total) != null ? _current$progress$tot : 0),
3401
- loaded: progress.loaded + ((_current$progress$loa = (_current$progress2 = current.progress) == null ? void 0 : _current$progress2.loaded) != null ? _current$progress$loa : 0)
3402
- };
3403
- }, {
3404
- total: 0,
3405
- loaded: 0
3406
- });
3407
- return pending(!!progress.total ? progress : undefined);
3408
- }, [ctx.filteredState]);
3409
- return result;
3410
- }
3411
-
3412
- export { IntrigProvider, IntrigProviderStub, StatusTrap, error, init, isError, isInit, isPending, isSuccess, isSuccessfulDispatch, isValidationError, pending, success, successfulDispatch, useCentralErrorHandling, useCentralPendingStateHandling, useNetworkState, validationError };