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