@ninetailed/experience.js 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js ADDED
@@ -0,0 +1,4129 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/get'), require('lodash/throttle'), require('lodash/unionBy'), require('@ninetailed/experience.js-shared'), require('tty'), require('util'), require('os'), require('analytics'), require('lodash/includes'), require('lodash/find')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash/get', 'lodash/throttle', 'lodash/unionBy', '@ninetailed/experience.js-shared', 'tty', 'util', 'os', 'analytics', 'lodash/includes', 'lodash/find'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ExperienceSdkJavascript = {}, global.get$2, global.throttle, global.unionBy, global.experience_jsShared, global.require$$1, global.require$$1$1, global.require$$0, global.Analytics, global.includes, global.find));
5
+ })(this, (function (exports, get$2, throttle, unionBy, experience_jsShared, require$$1, require$$1$1, require$$0, Analytics, includes, find) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var get__default = /*#__PURE__*/_interopDefaultLegacy(get$2);
10
+ var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle);
11
+ var unionBy__default = /*#__PURE__*/_interopDefaultLegacy(unionBy);
12
+ var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
13
+ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
14
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
15
+ var Analytics__default = /*#__PURE__*/_interopDefaultLegacy(Analytics);
16
+ var includes__default = /*#__PURE__*/_interopDefaultLegacy(includes);
17
+ var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
18
+
19
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
20
+
21
+ var check = function (it) {
22
+ return it && it.Math == Math && it;
23
+ };
24
+
25
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
26
+ var global$A =
27
+ // eslint-disable-next-line es/no-global-this -- safe
28
+ check(typeof globalThis == 'object' && globalThis) ||
29
+ check(typeof window == 'object' && window) ||
30
+ // eslint-disable-next-line no-restricted-globals -- safe
31
+ check(typeof self == 'object' && self) ||
32
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
33
+ // eslint-disable-next-line no-new-func -- fallback
34
+ (function () { return this; })() || Function('return this')();
35
+
36
+ var objectGetOwnPropertyDescriptor = {};
37
+
38
+ var fails$b = function (exec) {
39
+ try {
40
+ return !!exec();
41
+ } catch (error) {
42
+ return true;
43
+ }
44
+ };
45
+
46
+ var fails$a = fails$b;
47
+
48
+ // Detect IE8's incomplete defineProperty implementation
49
+ var descriptors = !fails$a(function () {
50
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
51
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
52
+ });
53
+
54
+ var fails$9 = fails$b;
55
+
56
+ var functionBindNative = !fails$9(function () {
57
+ var test = (function () { /* empty */ }).bind();
58
+ // eslint-disable-next-line no-prototype-builtins -- safe
59
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
60
+ });
61
+
62
+ var NATIVE_BIND$3 = functionBindNative;
63
+
64
+ var call$a = Function.prototype.call;
65
+
66
+ var functionCall = NATIVE_BIND$3 ? call$a.bind(call$a) : function () {
67
+ return call$a.apply(call$a, arguments);
68
+ };
69
+
70
+ var objectPropertyIsEnumerable = {};
71
+
72
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
73
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
74
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
75
+
76
+ // Nashorn ~ JDK8 bug
77
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
78
+
79
+ // `Object.prototype.propertyIsEnumerable` method implementation
80
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
81
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
82
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
83
+ return !!descriptor && descriptor.enumerable;
84
+ } : $propertyIsEnumerable;
85
+
86
+ var createPropertyDescriptor$2 = function (bitmap, value) {
87
+ return {
88
+ enumerable: !(bitmap & 1),
89
+ configurable: !(bitmap & 2),
90
+ writable: !(bitmap & 4),
91
+ value: value
92
+ };
93
+ };
94
+
95
+ var NATIVE_BIND$2 = functionBindNative;
96
+
97
+ var FunctionPrototype$2 = Function.prototype;
98
+ var bind$5 = FunctionPrototype$2.bind;
99
+ var call$9 = FunctionPrototype$2.call;
100
+ var uncurryThis$e = NATIVE_BIND$2 && bind$5.bind(call$9, call$9);
101
+
102
+ var functionUncurryThis = NATIVE_BIND$2 ? function (fn) {
103
+ return fn && uncurryThis$e(fn);
104
+ } : function (fn) {
105
+ return fn && function () {
106
+ return call$9.apply(fn, arguments);
107
+ };
108
+ };
109
+
110
+ var uncurryThis$d = functionUncurryThis;
111
+
112
+ var toString$1 = uncurryThis$d({}.toString);
113
+ var stringSlice = uncurryThis$d(''.slice);
114
+
115
+ var classofRaw$1 = function (it) {
116
+ return stringSlice(toString$1(it), 8, -1);
117
+ };
118
+
119
+ var global$z = global$A;
120
+ var uncurryThis$c = functionUncurryThis;
121
+ var fails$8 = fails$b;
122
+ var classof$4 = classofRaw$1;
123
+
124
+ var Object$4 = global$z.Object;
125
+ var split = uncurryThis$c(''.split);
126
+
127
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
128
+ var indexedObject = fails$8(function () {
129
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
130
+ // eslint-disable-next-line no-prototype-builtins -- safe
131
+ return !Object$4('z').propertyIsEnumerable(0);
132
+ }) ? function (it) {
133
+ return classof$4(it) == 'String' ? split(it, '') : Object$4(it);
134
+ } : Object$4;
135
+
136
+ var global$y = global$A;
137
+
138
+ var TypeError$f = global$y.TypeError;
139
+
140
+ // `RequireObjectCoercible` abstract operation
141
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
142
+ var requireObjectCoercible$2 = function (it) {
143
+ if (it == undefined) throw TypeError$f("Can't call method on " + it);
144
+ return it;
145
+ };
146
+
147
+ // toObject with fallback for non-array-like ES3 strings
148
+ var IndexedObject$2 = indexedObject;
149
+ var requireObjectCoercible$1 = requireObjectCoercible$2;
150
+
151
+ var toIndexedObject$3 = function (it) {
152
+ return IndexedObject$2(requireObjectCoercible$1(it));
153
+ };
154
+
155
+ // `IsCallable` abstract operation
156
+ // https://tc39.es/ecma262/#sec-iscallable
157
+ var isCallable$e = function (argument) {
158
+ return typeof argument == 'function';
159
+ };
160
+
161
+ var isCallable$d = isCallable$e;
162
+
163
+ var isObject$7 = function (it) {
164
+ return typeof it == 'object' ? it !== null : isCallable$d(it);
165
+ };
166
+
167
+ var global$x = global$A;
168
+ var isCallable$c = isCallable$e;
169
+
170
+ var aFunction = function (argument) {
171
+ return isCallable$c(argument) ? argument : undefined;
172
+ };
173
+
174
+ var getBuiltIn$7 = function (namespace, method) {
175
+ return arguments.length < 2 ? aFunction(global$x[namespace]) : global$x[namespace] && global$x[namespace][method];
176
+ };
177
+
178
+ var uncurryThis$b = functionUncurryThis;
179
+
180
+ var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
181
+
182
+ var getBuiltIn$6 = getBuiltIn$7;
183
+
184
+ var engineUserAgent = getBuiltIn$6('navigator', 'userAgent') || '';
185
+
186
+ var global$w = global$A;
187
+ var userAgent$3 = engineUserAgent;
188
+
189
+ var process$4 = global$w.process;
190
+ var Deno = global$w.Deno;
191
+ var versions = process$4 && process$4.versions || Deno && Deno.version;
192
+ var v8 = versions && versions.v8;
193
+ var match, version;
194
+
195
+ if (v8) {
196
+ match = v8.split('.');
197
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
198
+ // but their correct versions are not interesting for us
199
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
200
+ }
201
+
202
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
203
+ // so check `userAgent` even if `.v8` exists, but 0
204
+ if (!version && userAgent$3) {
205
+ match = userAgent$3.match(/Edge\/(\d+)/);
206
+ if (!match || match[1] >= 74) {
207
+ match = userAgent$3.match(/Chrome\/(\d+)/);
208
+ if (match) version = +match[1];
209
+ }
210
+ }
211
+
212
+ var engineV8Version = version;
213
+
214
+ /* eslint-disable es/no-symbol -- required for testing */
215
+
216
+ var V8_VERSION$1 = engineV8Version;
217
+ var fails$7 = fails$b;
218
+
219
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
220
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$7(function () {
221
+ var symbol = Symbol();
222
+ // Chrome 38 Symbol has incorrect toString conversion
223
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
224
+ return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
225
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
226
+ !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
227
+ });
228
+
229
+ /* eslint-disable es/no-symbol -- required for testing */
230
+
231
+ var NATIVE_SYMBOL$1 = nativeSymbol;
232
+
233
+ var useSymbolAsUid = NATIVE_SYMBOL$1
234
+ && !Symbol.sham
235
+ && typeof Symbol.iterator == 'symbol';
236
+
237
+ var global$v = global$A;
238
+ var getBuiltIn$5 = getBuiltIn$7;
239
+ var isCallable$b = isCallable$e;
240
+ var isPrototypeOf$2 = objectIsPrototypeOf;
241
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
242
+
243
+ var Object$3 = global$v.Object;
244
+
245
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
246
+ return typeof it == 'symbol';
247
+ } : function (it) {
248
+ var $Symbol = getBuiltIn$5('Symbol');
249
+ return isCallable$b($Symbol) && isPrototypeOf$2($Symbol.prototype, Object$3(it));
250
+ };
251
+
252
+ var global$u = global$A;
253
+
254
+ var String$4 = global$u.String;
255
+
256
+ var tryToString$4 = function (argument) {
257
+ try {
258
+ return String$4(argument);
259
+ } catch (error) {
260
+ return 'Object';
261
+ }
262
+ };
263
+
264
+ var global$t = global$A;
265
+ var isCallable$a = isCallable$e;
266
+ var tryToString$3 = tryToString$4;
267
+
268
+ var TypeError$e = global$t.TypeError;
269
+
270
+ // `Assert: IsCallable(argument) is true`
271
+ var aCallable$6 = function (argument) {
272
+ if (isCallable$a(argument)) return argument;
273
+ throw TypeError$e(tryToString$3(argument) + ' is not a function');
274
+ };
275
+
276
+ var aCallable$5 = aCallable$6;
277
+
278
+ // `GetMethod` abstract operation
279
+ // https://tc39.es/ecma262/#sec-getmethod
280
+ var getMethod$3 = function (V, P) {
281
+ var func = V[P];
282
+ return func == null ? undefined : aCallable$5(func);
283
+ };
284
+
285
+ var global$s = global$A;
286
+ var call$8 = functionCall;
287
+ var isCallable$9 = isCallable$e;
288
+ var isObject$6 = isObject$7;
289
+
290
+ var TypeError$d = global$s.TypeError;
291
+
292
+ // `OrdinaryToPrimitive` abstract operation
293
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
294
+ var ordinaryToPrimitive$1 = function (input, pref) {
295
+ var fn, val;
296
+ if (pref === 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$8(fn, input))) return val;
297
+ if (isCallable$9(fn = input.valueOf) && !isObject$6(val = call$8(fn, input))) return val;
298
+ if (pref !== 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$8(fn, input))) return val;
299
+ throw TypeError$d("Can't convert object to primitive value");
300
+ };
301
+
302
+ var shared$3 = {exports: {}};
303
+
304
+ var global$r = global$A;
305
+
306
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
307
+ var defineProperty$2 = Object.defineProperty;
308
+
309
+ var setGlobal$3 = function (key, value) {
310
+ try {
311
+ defineProperty$2(global$r, key, { value: value, configurable: true, writable: true });
312
+ } catch (error) {
313
+ global$r[key] = value;
314
+ } return value;
315
+ };
316
+
317
+ var global$q = global$A;
318
+ var setGlobal$2 = setGlobal$3;
319
+
320
+ var SHARED = '__core-js_shared__';
321
+ var store$3 = global$q[SHARED] || setGlobal$2(SHARED, {});
322
+
323
+ var sharedStore = store$3;
324
+
325
+ var store$2 = sharedStore;
326
+
327
+ (shared$3.exports = function (key, value) {
328
+ return store$2[key] || (store$2[key] = value !== undefined ? value : {});
329
+ })('versions', []).push({
330
+ version: '3.21.1',
331
+ mode: 'global',
332
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
333
+ license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
334
+ source: 'https://github.com/zloirock/core-js'
335
+ });
336
+
337
+ var global$p = global$A;
338
+ var requireObjectCoercible = requireObjectCoercible$2;
339
+
340
+ var Object$2 = global$p.Object;
341
+
342
+ // `ToObject` abstract operation
343
+ // https://tc39.es/ecma262/#sec-toobject
344
+ var toObject$3 = function (argument) {
345
+ return Object$2(requireObjectCoercible(argument));
346
+ };
347
+
348
+ var uncurryThis$a = functionUncurryThis;
349
+ var toObject$2 = toObject$3;
350
+
351
+ var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
352
+
353
+ // `HasOwnProperty` abstract operation
354
+ // https://tc39.es/ecma262/#sec-hasownproperty
355
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
356
+ return hasOwnProperty(toObject$2(it), key);
357
+ };
358
+
359
+ var uncurryThis$9 = functionUncurryThis;
360
+
361
+ var id = 0;
362
+ var postfix = Math.random();
363
+ var toString = uncurryThis$9(1.0.toString);
364
+
365
+ var uid$2 = function (key) {
366
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
367
+ };
368
+
369
+ var global$o = global$A;
370
+ var shared$2 = shared$3.exports;
371
+ var hasOwn$8 = hasOwnProperty_1;
372
+ var uid$1 = uid$2;
373
+ var NATIVE_SYMBOL = nativeSymbol;
374
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
375
+
376
+ var WellKnownSymbolsStore = shared$2('wks');
377
+ var Symbol$1 = global$o.Symbol;
378
+ var symbolFor = Symbol$1 && Symbol$1['for'];
379
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
380
+
381
+ var wellKnownSymbol$a = function (name) {
382
+ if (!hasOwn$8(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
383
+ var description = 'Symbol.' + name;
384
+ if (NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)) {
385
+ WellKnownSymbolsStore[name] = Symbol$1[name];
386
+ } else if (USE_SYMBOL_AS_UID && symbolFor) {
387
+ WellKnownSymbolsStore[name] = symbolFor(description);
388
+ } else {
389
+ WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
390
+ }
391
+ } return WellKnownSymbolsStore[name];
392
+ };
393
+
394
+ var global$n = global$A;
395
+ var call$7 = functionCall;
396
+ var isObject$5 = isObject$7;
397
+ var isSymbol$1 = isSymbol$2;
398
+ var getMethod$2 = getMethod$3;
399
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
400
+ var wellKnownSymbol$9 = wellKnownSymbol$a;
401
+
402
+ var TypeError$c = global$n.TypeError;
403
+ var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
404
+
405
+ // `ToPrimitive` abstract operation
406
+ // https://tc39.es/ecma262/#sec-toprimitive
407
+ var toPrimitive$1 = function (input, pref) {
408
+ if (!isObject$5(input) || isSymbol$1(input)) return input;
409
+ var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
410
+ var result;
411
+ if (exoticToPrim) {
412
+ if (pref === undefined) pref = 'default';
413
+ result = call$7(exoticToPrim, input, pref);
414
+ if (!isObject$5(result) || isSymbol$1(result)) return result;
415
+ throw TypeError$c("Can't convert object to primitive value");
416
+ }
417
+ if (pref === undefined) pref = 'number';
418
+ return ordinaryToPrimitive(input, pref);
419
+ };
420
+
421
+ var toPrimitive = toPrimitive$1;
422
+ var isSymbol = isSymbol$2;
423
+
424
+ // `ToPropertyKey` abstract operation
425
+ // https://tc39.es/ecma262/#sec-topropertykey
426
+ var toPropertyKey$2 = function (argument) {
427
+ var key = toPrimitive(argument, 'string');
428
+ return isSymbol(key) ? key : key + '';
429
+ };
430
+
431
+ var global$m = global$A;
432
+ var isObject$4 = isObject$7;
433
+
434
+ var document$3 = global$m.document;
435
+ // typeof document.createElement is 'object' in old IE
436
+ var EXISTS$1 = isObject$4(document$3) && isObject$4(document$3.createElement);
437
+
438
+ var documentCreateElement = function (it) {
439
+ return EXISTS$1 ? document$3.createElement(it) : {};
440
+ };
441
+
442
+ var DESCRIPTORS$7 = descriptors;
443
+ var fails$6 = fails$b;
444
+ var createElement$1 = documentCreateElement;
445
+
446
+ // Thanks to IE8 for its funny defineProperty
447
+ var ie8DomDefine = !DESCRIPTORS$7 && !fails$6(function () {
448
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
449
+ return Object.defineProperty(createElement$1('div'), 'a', {
450
+ get: function () { return 7; }
451
+ }).a != 7;
452
+ });
453
+
454
+ var DESCRIPTORS$6 = descriptors;
455
+ var call$6 = functionCall;
456
+ var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
457
+ var createPropertyDescriptor$1 = createPropertyDescriptor$2;
458
+ var toIndexedObject$2 = toIndexedObject$3;
459
+ var toPropertyKey$1 = toPropertyKey$2;
460
+ var hasOwn$7 = hasOwnProperty_1;
461
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
462
+
463
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
464
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
465
+
466
+ // `Object.getOwnPropertyDescriptor` method
467
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
468
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$6 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
469
+ O = toIndexedObject$2(O);
470
+ P = toPropertyKey$1(P);
471
+ if (IE8_DOM_DEFINE$1) try {
472
+ return $getOwnPropertyDescriptor$1(O, P);
473
+ } catch (error) { /* empty */ }
474
+ if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!call$6(propertyIsEnumerableModule$1.f, O, P), O[P]);
475
+ };
476
+
477
+ var objectDefineProperty = {};
478
+
479
+ var DESCRIPTORS$5 = descriptors;
480
+ var fails$5 = fails$b;
481
+
482
+ // V8 ~ Chrome 36-
483
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
484
+ var v8PrototypeDefineBug = DESCRIPTORS$5 && fails$5(function () {
485
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
486
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
487
+ value: 42,
488
+ writable: false
489
+ }).prototype != 42;
490
+ });
491
+
492
+ var global$l = global$A;
493
+ var isObject$3 = isObject$7;
494
+
495
+ var String$3 = global$l.String;
496
+ var TypeError$b = global$l.TypeError;
497
+
498
+ // `Assert: Type(argument) is Object`
499
+ var anObject$8 = function (argument) {
500
+ if (isObject$3(argument)) return argument;
501
+ throw TypeError$b(String$3(argument) + ' is not an object');
502
+ };
503
+
504
+ var global$k = global$A;
505
+ var DESCRIPTORS$4 = descriptors;
506
+ var IE8_DOM_DEFINE = ie8DomDefine;
507
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
508
+ var anObject$7 = anObject$8;
509
+ var toPropertyKey = toPropertyKey$2;
510
+
511
+ var TypeError$a = global$k.TypeError;
512
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
513
+ var $defineProperty = Object.defineProperty;
514
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
515
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
516
+ var ENUMERABLE = 'enumerable';
517
+ var CONFIGURABLE$1 = 'configurable';
518
+ var WRITABLE = 'writable';
519
+
520
+ // `Object.defineProperty` method
521
+ // https://tc39.es/ecma262/#sec-object.defineproperty
522
+ objectDefineProperty.f = DESCRIPTORS$4 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
523
+ anObject$7(O);
524
+ P = toPropertyKey(P);
525
+ anObject$7(Attributes);
526
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
527
+ var current = $getOwnPropertyDescriptor(O, P);
528
+ if (current && current[WRITABLE]) {
529
+ O[P] = Attributes.value;
530
+ Attributes = {
531
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
532
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
533
+ writable: false
534
+ };
535
+ }
536
+ } return $defineProperty(O, P, Attributes);
537
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
538
+ anObject$7(O);
539
+ P = toPropertyKey(P);
540
+ anObject$7(Attributes);
541
+ if (IE8_DOM_DEFINE) try {
542
+ return $defineProperty(O, P, Attributes);
543
+ } catch (error) { /* empty */ }
544
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError$a('Accessors not supported');
545
+ if ('value' in Attributes) O[P] = Attributes.value;
546
+ return O;
547
+ };
548
+
549
+ var DESCRIPTORS$3 = descriptors;
550
+ var definePropertyModule$2 = objectDefineProperty;
551
+ var createPropertyDescriptor = createPropertyDescriptor$2;
552
+
553
+ var createNonEnumerableProperty$3 = DESCRIPTORS$3 ? function (object, key, value) {
554
+ return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
555
+ } : function (object, key, value) {
556
+ object[key] = value;
557
+ return object;
558
+ };
559
+
560
+ var redefine$3 = {exports: {}};
561
+
562
+ var uncurryThis$8 = functionUncurryThis;
563
+ var isCallable$8 = isCallable$e;
564
+ var store$1 = sharedStore;
565
+
566
+ var functionToString = uncurryThis$8(Function.toString);
567
+
568
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
569
+ if (!isCallable$8(store$1.inspectSource)) {
570
+ store$1.inspectSource = function (it) {
571
+ return functionToString(it);
572
+ };
573
+ }
574
+
575
+ var inspectSource$4 = store$1.inspectSource;
576
+
577
+ var global$j = global$A;
578
+ var isCallable$7 = isCallable$e;
579
+ var inspectSource$3 = inspectSource$4;
580
+
581
+ var WeakMap$1 = global$j.WeakMap;
582
+
583
+ var nativeWeakMap = isCallable$7(WeakMap$1) && /native code/.test(inspectSource$3(WeakMap$1));
584
+
585
+ var shared$1 = shared$3.exports;
586
+ var uid = uid$2;
587
+
588
+ var keys = shared$1('keys');
589
+
590
+ var sharedKey$1 = function (key) {
591
+ return keys[key] || (keys[key] = uid(key));
592
+ };
593
+
594
+ var hiddenKeys$3 = {};
595
+
596
+ var NATIVE_WEAK_MAP = nativeWeakMap;
597
+ var global$i = global$A;
598
+ var uncurryThis$7 = functionUncurryThis;
599
+ var isObject$2 = isObject$7;
600
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
601
+ var hasOwn$6 = hasOwnProperty_1;
602
+ var shared = sharedStore;
603
+ var sharedKey = sharedKey$1;
604
+ var hiddenKeys$2 = hiddenKeys$3;
605
+
606
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
607
+ var TypeError$9 = global$i.TypeError;
608
+ var WeakMap = global$i.WeakMap;
609
+ var set$2, get$1, has;
610
+
611
+ var enforce = function (it) {
612
+ return has(it) ? get$1(it) : set$2(it, {});
613
+ };
614
+
615
+ var getterFor = function (TYPE) {
616
+ return function (it) {
617
+ var state;
618
+ if (!isObject$2(it) || (state = get$1(it)).type !== TYPE) {
619
+ throw TypeError$9('Incompatible receiver, ' + TYPE + ' required');
620
+ } return state;
621
+ };
622
+ };
623
+
624
+ if (NATIVE_WEAK_MAP || shared.state) {
625
+ var store = shared.state || (shared.state = new WeakMap());
626
+ var wmget = uncurryThis$7(store.get);
627
+ var wmhas = uncurryThis$7(store.has);
628
+ var wmset = uncurryThis$7(store.set);
629
+ set$2 = function (it, metadata) {
630
+ if (wmhas(store, it)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
631
+ metadata.facade = it;
632
+ wmset(store, it, metadata);
633
+ return metadata;
634
+ };
635
+ get$1 = function (it) {
636
+ return wmget(store, it) || {};
637
+ };
638
+ has = function (it) {
639
+ return wmhas(store, it);
640
+ };
641
+ } else {
642
+ var STATE = sharedKey('state');
643
+ hiddenKeys$2[STATE] = true;
644
+ set$2 = function (it, metadata) {
645
+ if (hasOwn$6(it, STATE)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
646
+ metadata.facade = it;
647
+ createNonEnumerableProperty$2(it, STATE, metadata);
648
+ return metadata;
649
+ };
650
+ get$1 = function (it) {
651
+ return hasOwn$6(it, STATE) ? it[STATE] : {};
652
+ };
653
+ has = function (it) {
654
+ return hasOwn$6(it, STATE);
655
+ };
656
+ }
657
+
658
+ var internalState = {
659
+ set: set$2,
660
+ get: get$1,
661
+ has: has,
662
+ enforce: enforce,
663
+ getterFor: getterFor
664
+ };
665
+
666
+ var DESCRIPTORS$2 = descriptors;
667
+ var hasOwn$5 = hasOwnProperty_1;
668
+
669
+ var FunctionPrototype$1 = Function.prototype;
670
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
671
+ var getDescriptor = DESCRIPTORS$2 && Object.getOwnPropertyDescriptor;
672
+
673
+ var EXISTS = hasOwn$5(FunctionPrototype$1, 'name');
674
+ // additional protection from minified / mangled / dropped function names
675
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
676
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$2 || (DESCRIPTORS$2 && getDescriptor(FunctionPrototype$1, 'name').configurable));
677
+
678
+ var functionName = {
679
+ EXISTS: EXISTS,
680
+ PROPER: PROPER,
681
+ CONFIGURABLE: CONFIGURABLE
682
+ };
683
+
684
+ var global$h = global$A;
685
+ var isCallable$6 = isCallable$e;
686
+ var hasOwn$4 = hasOwnProperty_1;
687
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
688
+ var setGlobal$1 = setGlobal$3;
689
+ var inspectSource$2 = inspectSource$4;
690
+ var InternalStateModule$1 = internalState;
691
+ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
692
+
693
+ var getInternalState$1 = InternalStateModule$1.get;
694
+ var enforceInternalState = InternalStateModule$1.enforce;
695
+ var TEMPLATE = String(String).split('String');
696
+
697
+ (redefine$3.exports = function (O, key, value, options) {
698
+ var unsafe = options ? !!options.unsafe : false;
699
+ var simple = options ? !!options.enumerable : false;
700
+ var noTargetGet = options ? !!options.noTargetGet : false;
701
+ var name = options && options.name !== undefined ? options.name : key;
702
+ var state;
703
+ if (isCallable$6(value)) {
704
+ if (String(name).slice(0, 7) === 'Symbol(') {
705
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
706
+ }
707
+ if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
708
+ createNonEnumerableProperty$1(value, 'name', name);
709
+ }
710
+ state = enforceInternalState(value);
711
+ if (!state.source) {
712
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
713
+ }
714
+ }
715
+ if (O === global$h) {
716
+ if (simple) O[key] = value;
717
+ else setGlobal$1(key, value);
718
+ return;
719
+ } else if (!unsafe) {
720
+ delete O[key];
721
+ } else if (!noTargetGet && O[key]) {
722
+ simple = true;
723
+ }
724
+ if (simple) O[key] = value;
725
+ else createNonEnumerableProperty$1(O, key, value);
726
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
727
+ })(Function.prototype, 'toString', function toString() {
728
+ return isCallable$6(this) && getInternalState$1(this).source || inspectSource$2(this);
729
+ });
730
+
731
+ var objectGetOwnPropertyNames = {};
732
+
733
+ var ceil = Math.ceil;
734
+ var floor = Math.floor;
735
+
736
+ // `ToIntegerOrInfinity` abstract operation
737
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
738
+ var toIntegerOrInfinity$2 = function (argument) {
739
+ var number = +argument;
740
+ // eslint-disable-next-line no-self-compare -- safe
741
+ return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
742
+ };
743
+
744
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
745
+
746
+ var max = Math.max;
747
+ var min$1 = Math.min;
748
+
749
+ // Helper for a popular repeating case of the spec:
750
+ // Let integer be ? ToInteger(index).
751
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
752
+ var toAbsoluteIndex$1 = function (index, length) {
753
+ var integer = toIntegerOrInfinity$1(index);
754
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
755
+ };
756
+
757
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
758
+
759
+ var min = Math.min;
760
+
761
+ // `ToLength` abstract operation
762
+ // https://tc39.es/ecma262/#sec-tolength
763
+ var toLength$1 = function (argument) {
764
+ return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
765
+ };
766
+
767
+ var toLength = toLength$1;
768
+
769
+ // `LengthOfArrayLike` abstract operation
770
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
771
+ var lengthOfArrayLike$3 = function (obj) {
772
+ return toLength(obj.length);
773
+ };
774
+
775
+ var toIndexedObject$1 = toIndexedObject$3;
776
+ var toAbsoluteIndex = toAbsoluteIndex$1;
777
+ var lengthOfArrayLike$2 = lengthOfArrayLike$3;
778
+
779
+ // `Array.prototype.{ indexOf, includes }` methods implementation
780
+ var createMethod$1 = function (IS_INCLUDES) {
781
+ return function ($this, el, fromIndex) {
782
+ var O = toIndexedObject$1($this);
783
+ var length = lengthOfArrayLike$2(O);
784
+ var index = toAbsoluteIndex(fromIndex, length);
785
+ var value;
786
+ // Array#includes uses SameValueZero equality algorithm
787
+ // eslint-disable-next-line no-self-compare -- NaN check
788
+ if (IS_INCLUDES && el != el) while (length > index) {
789
+ value = O[index++];
790
+ // eslint-disable-next-line no-self-compare -- NaN check
791
+ if (value != value) return true;
792
+ // Array#indexOf ignores holes, Array#includes - not
793
+ } else for (;length > index; index++) {
794
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
795
+ } return !IS_INCLUDES && -1;
796
+ };
797
+ };
798
+
799
+ var arrayIncludes = {
800
+ // `Array.prototype.includes` method
801
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
802
+ includes: createMethod$1(true),
803
+ // `Array.prototype.indexOf` method
804
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
805
+ indexOf: createMethod$1(false)
806
+ };
807
+
808
+ var uncurryThis$6 = functionUncurryThis;
809
+ var hasOwn$3 = hasOwnProperty_1;
810
+ var toIndexedObject = toIndexedObject$3;
811
+ var indexOf = arrayIncludes.indexOf;
812
+ var hiddenKeys$1 = hiddenKeys$3;
813
+
814
+ var push = uncurryThis$6([].push);
815
+
816
+ var objectKeysInternal = function (object, names) {
817
+ var O = toIndexedObject(object);
818
+ var i = 0;
819
+ var result = [];
820
+ var key;
821
+ for (key in O) !hasOwn$3(hiddenKeys$1, key) && hasOwn$3(O, key) && push(result, key);
822
+ // Don't enum bug & hidden keys
823
+ while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
824
+ ~indexOf(result, key) || push(result, key);
825
+ }
826
+ return result;
827
+ };
828
+
829
+ // IE8- don't enum bug keys
830
+ var enumBugKeys$2 = [
831
+ 'constructor',
832
+ 'hasOwnProperty',
833
+ 'isPrototypeOf',
834
+ 'propertyIsEnumerable',
835
+ 'toLocaleString',
836
+ 'toString',
837
+ 'valueOf'
838
+ ];
839
+
840
+ var internalObjectKeys$1 = objectKeysInternal;
841
+ var enumBugKeys$1 = enumBugKeys$2;
842
+
843
+ var hiddenKeys = enumBugKeys$1.concat('length', 'prototype');
844
+
845
+ // `Object.getOwnPropertyNames` method
846
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
847
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
848
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
849
+ return internalObjectKeys$1(O, hiddenKeys);
850
+ };
851
+
852
+ var objectGetOwnPropertySymbols = {};
853
+
854
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
855
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
856
+
857
+ var getBuiltIn$4 = getBuiltIn$7;
858
+ var uncurryThis$5 = functionUncurryThis;
859
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
860
+ var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
861
+ var anObject$6 = anObject$8;
862
+
863
+ var concat$1 = uncurryThis$5([].concat);
864
+
865
+ // all object keys, includes non-enumerable and symbols
866
+ var ownKeys$1 = getBuiltIn$4('Reflect', 'ownKeys') || function ownKeys(it) {
867
+ var keys = getOwnPropertyNamesModule.f(anObject$6(it));
868
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
869
+ return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
870
+ };
871
+
872
+ var hasOwn$2 = hasOwnProperty_1;
873
+ var ownKeys = ownKeys$1;
874
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
875
+ var definePropertyModule$1 = objectDefineProperty;
876
+
877
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
878
+ var keys = ownKeys(source);
879
+ var defineProperty = definePropertyModule$1.f;
880
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
881
+ for (var i = 0; i < keys.length; i++) {
882
+ var key = keys[i];
883
+ if (!hasOwn$2(target, key) && !(exceptions && hasOwn$2(exceptions, key))) {
884
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
885
+ }
886
+ }
887
+ };
888
+
889
+ var fails$4 = fails$b;
890
+ var isCallable$5 = isCallable$e;
891
+
892
+ var replacement = /#|\.prototype\./;
893
+
894
+ var isForced$2 = function (feature, detection) {
895
+ var value = data[normalize(feature)];
896
+ return value == POLYFILL ? true
897
+ : value == NATIVE ? false
898
+ : isCallable$5(detection) ? fails$4(detection)
899
+ : !!detection;
900
+ };
901
+
902
+ var normalize = isForced$2.normalize = function (string) {
903
+ return String(string).replace(replacement, '.').toLowerCase();
904
+ };
905
+
906
+ var data = isForced$2.data = {};
907
+ var NATIVE = isForced$2.NATIVE = 'N';
908
+ var POLYFILL = isForced$2.POLYFILL = 'P';
909
+
910
+ var isForced_1 = isForced$2;
911
+
912
+ var global$g = global$A;
913
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
914
+ var createNonEnumerableProperty = createNonEnumerableProperty$3;
915
+ var redefine$2 = redefine$3.exports;
916
+ var setGlobal = setGlobal$3;
917
+ var copyConstructorProperties = copyConstructorProperties$1;
918
+ var isForced$1 = isForced_1;
919
+
920
+ /*
921
+ options.target - name of the target object
922
+ options.global - target is the global object
923
+ options.stat - export as static methods of target
924
+ options.proto - export as prototype methods of target
925
+ options.real - real prototype method for the `pure` version
926
+ options.forced - export even if the native feature is available
927
+ options.bind - bind methods to the target, required for the `pure` version
928
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
929
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
930
+ options.sham - add a flag to not completely full polyfills
931
+ options.enumerable - export as enumerable property
932
+ options.noTargetGet - prevent calling a getter on target
933
+ options.name - the .name of the function if it does not match the key
934
+ */
935
+ var _export = function (options, source) {
936
+ var TARGET = options.target;
937
+ var GLOBAL = options.global;
938
+ var STATIC = options.stat;
939
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
940
+ if (GLOBAL) {
941
+ target = global$g;
942
+ } else if (STATIC) {
943
+ target = global$g[TARGET] || setGlobal(TARGET, {});
944
+ } else {
945
+ target = (global$g[TARGET] || {}).prototype;
946
+ }
947
+ if (target) for (key in source) {
948
+ sourceProperty = source[key];
949
+ if (options.noTargetGet) {
950
+ descriptor = getOwnPropertyDescriptor$1(target, key);
951
+ targetProperty = descriptor && descriptor.value;
952
+ } else targetProperty = target[key];
953
+ FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
954
+ // contained in target
955
+ if (!FORCED && targetProperty !== undefined) {
956
+ if (typeof sourceProperty == typeof targetProperty) continue;
957
+ copyConstructorProperties(sourceProperty, targetProperty);
958
+ }
959
+ // add a flag to not completely full polyfills
960
+ if (options.sham || (targetProperty && targetProperty.sham)) {
961
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
962
+ }
963
+ // extend global
964
+ redefine$2(target, key, sourceProperty, options);
965
+ }
966
+ };
967
+
968
+ var global$f = global$A;
969
+
970
+ var nativePromiseConstructor = global$f.Promise;
971
+
972
+ var redefine$1 = redefine$3.exports;
973
+
974
+ var redefineAll$1 = function (target, src, options) {
975
+ for (var key in src) redefine$1(target, key, src[key], options);
976
+ return target;
977
+ };
978
+
979
+ var global$e = global$A;
980
+ var isCallable$4 = isCallable$e;
981
+
982
+ var String$2 = global$e.String;
983
+ var TypeError$8 = global$e.TypeError;
984
+
985
+ var aPossiblePrototype$1 = function (argument) {
986
+ if (typeof argument == 'object' || isCallable$4(argument)) return argument;
987
+ throw TypeError$8("Can't set " + String$2(argument) + ' as a prototype');
988
+ };
989
+
990
+ /* eslint-disable no-proto -- safe */
991
+
992
+ var uncurryThis$4 = functionUncurryThis;
993
+ var anObject$5 = anObject$8;
994
+ var aPossiblePrototype = aPossiblePrototype$1;
995
+
996
+ // `Object.setPrototypeOf` method
997
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
998
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
999
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1000
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1001
+ var CORRECT_SETTER = false;
1002
+ var test = {};
1003
+ var setter;
1004
+ try {
1005
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1006
+ setter = uncurryThis$4(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1007
+ setter(test, []);
1008
+ CORRECT_SETTER = test instanceof Array;
1009
+ } catch (error) { /* empty */ }
1010
+ return function setPrototypeOf(O, proto) {
1011
+ anObject$5(O);
1012
+ aPossiblePrototype(proto);
1013
+ if (CORRECT_SETTER) setter(O, proto);
1014
+ else O.__proto__ = proto;
1015
+ return O;
1016
+ };
1017
+ }() : undefined);
1018
+
1019
+ var defineProperty$1 = objectDefineProperty.f;
1020
+ var hasOwn$1 = hasOwnProperty_1;
1021
+ var wellKnownSymbol$8 = wellKnownSymbol$a;
1022
+
1023
+ var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
1024
+
1025
+ var setToStringTag$1 = function (target, TAG, STATIC) {
1026
+ if (target && !STATIC) target = target.prototype;
1027
+ if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1028
+ defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1029
+ }
1030
+ };
1031
+
1032
+ var getBuiltIn$3 = getBuiltIn$7;
1033
+ var definePropertyModule = objectDefineProperty;
1034
+ var wellKnownSymbol$7 = wellKnownSymbol$a;
1035
+ var DESCRIPTORS$1 = descriptors;
1036
+
1037
+ var SPECIES$2 = wellKnownSymbol$7('species');
1038
+
1039
+ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1040
+ var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
1041
+ var defineProperty = definePropertyModule.f;
1042
+
1043
+ if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES$2]) {
1044
+ defineProperty(Constructor, SPECIES$2, {
1045
+ configurable: true,
1046
+ get: function () { return this; }
1047
+ });
1048
+ }
1049
+ };
1050
+
1051
+ var global$d = global$A;
1052
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1053
+
1054
+ var TypeError$7 = global$d.TypeError;
1055
+
1056
+ var anInstance$1 = function (it, Prototype) {
1057
+ if (isPrototypeOf$1(Prototype, it)) return it;
1058
+ throw TypeError$7('Incorrect invocation');
1059
+ };
1060
+
1061
+ var uncurryThis$3 = functionUncurryThis;
1062
+ var aCallable$4 = aCallable$6;
1063
+ var NATIVE_BIND$1 = functionBindNative;
1064
+
1065
+ var bind$4 = uncurryThis$3(uncurryThis$3.bind);
1066
+
1067
+ // optional / simple context binding
1068
+ var functionBindContext = function (fn, that) {
1069
+ aCallable$4(fn);
1070
+ return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
1071
+ return fn.apply(that, arguments);
1072
+ };
1073
+ };
1074
+
1075
+ var iterators = {};
1076
+
1077
+ var wellKnownSymbol$6 = wellKnownSymbol$a;
1078
+ var Iterators$1 = iterators;
1079
+
1080
+ var ITERATOR$2 = wellKnownSymbol$6('iterator');
1081
+ var ArrayPrototype = Array.prototype;
1082
+
1083
+ // check on default Array iterator
1084
+ var isArrayIteratorMethod$1 = function (it) {
1085
+ return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$2] === it);
1086
+ };
1087
+
1088
+ var wellKnownSymbol$5 = wellKnownSymbol$a;
1089
+
1090
+ var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1091
+ var test = {};
1092
+
1093
+ test[TO_STRING_TAG$1] = 'z';
1094
+
1095
+ var toStringTagSupport = String(test) === '[object z]';
1096
+
1097
+ var global$c = global$A;
1098
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1099
+ var isCallable$3 = isCallable$e;
1100
+ var classofRaw = classofRaw$1;
1101
+ var wellKnownSymbol$4 = wellKnownSymbol$a;
1102
+
1103
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1104
+ var Object$1 = global$c.Object;
1105
+
1106
+ // ES3 wrong here
1107
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1108
+
1109
+ // fallback for IE11 Script Access Denied error
1110
+ var tryGet = function (it, key) {
1111
+ try {
1112
+ return it[key];
1113
+ } catch (error) { /* empty */ }
1114
+ };
1115
+
1116
+ // getting tag from ES6+ `Object.prototype.toString`
1117
+ var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1118
+ var O, tag, result;
1119
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1120
+ // @@toStringTag case
1121
+ : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
1122
+ // builtinTag case
1123
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1124
+ // ES3 arguments fallback
1125
+ : (result = classofRaw(O)) == 'Object' && isCallable$3(O.callee) ? 'Arguments' : result;
1126
+ };
1127
+
1128
+ var classof$2 = classof$3;
1129
+ var getMethod$1 = getMethod$3;
1130
+ var Iterators = iterators;
1131
+ var wellKnownSymbol$3 = wellKnownSymbol$a;
1132
+
1133
+ var ITERATOR$1 = wellKnownSymbol$3('iterator');
1134
+
1135
+ var getIteratorMethod$2 = function (it) {
1136
+ if (it != undefined) return getMethod$1(it, ITERATOR$1)
1137
+ || getMethod$1(it, '@@iterator')
1138
+ || Iterators[classof$2(it)];
1139
+ };
1140
+
1141
+ var global$b = global$A;
1142
+ var call$5 = functionCall;
1143
+ var aCallable$3 = aCallable$6;
1144
+ var anObject$4 = anObject$8;
1145
+ var tryToString$2 = tryToString$4;
1146
+ var getIteratorMethod$1 = getIteratorMethod$2;
1147
+
1148
+ var TypeError$6 = global$b.TypeError;
1149
+
1150
+ var getIterator$1 = function (argument, usingIterator) {
1151
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1152
+ if (aCallable$3(iteratorMethod)) return anObject$4(call$5(iteratorMethod, argument));
1153
+ throw TypeError$6(tryToString$2(argument) + ' is not iterable');
1154
+ };
1155
+
1156
+ var call$4 = functionCall;
1157
+ var anObject$3 = anObject$8;
1158
+ var getMethod = getMethod$3;
1159
+
1160
+ var iteratorClose$1 = function (iterator, kind, value) {
1161
+ var innerResult, innerError;
1162
+ anObject$3(iterator);
1163
+ try {
1164
+ innerResult = getMethod(iterator, 'return');
1165
+ if (!innerResult) {
1166
+ if (kind === 'throw') throw value;
1167
+ return value;
1168
+ }
1169
+ innerResult = call$4(innerResult, iterator);
1170
+ } catch (error) {
1171
+ innerError = true;
1172
+ innerResult = error;
1173
+ }
1174
+ if (kind === 'throw') throw value;
1175
+ if (innerError) throw innerResult;
1176
+ anObject$3(innerResult);
1177
+ return value;
1178
+ };
1179
+
1180
+ var global$a = global$A;
1181
+ var bind$3 = functionBindContext;
1182
+ var call$3 = functionCall;
1183
+ var anObject$2 = anObject$8;
1184
+ var tryToString$1 = tryToString$4;
1185
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
1186
+ var lengthOfArrayLike$1 = lengthOfArrayLike$3;
1187
+ var isPrototypeOf = objectIsPrototypeOf;
1188
+ var getIterator = getIterator$1;
1189
+ var getIteratorMethod = getIteratorMethod$2;
1190
+ var iteratorClose = iteratorClose$1;
1191
+
1192
+ var TypeError$5 = global$a.TypeError;
1193
+
1194
+ var Result = function (stopped, result) {
1195
+ this.stopped = stopped;
1196
+ this.result = result;
1197
+ };
1198
+
1199
+ var ResultPrototype = Result.prototype;
1200
+
1201
+ var iterate$1 = function (iterable, unboundFunction, options) {
1202
+ var that = options && options.that;
1203
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1204
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1205
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
1206
+ var fn = bind$3(unboundFunction, that);
1207
+ var iterator, iterFn, index, length, result, next, step;
1208
+
1209
+ var stop = function (condition) {
1210
+ if (iterator) iteratorClose(iterator, 'normal', condition);
1211
+ return new Result(true, condition);
1212
+ };
1213
+
1214
+ var callFn = function (value) {
1215
+ if (AS_ENTRIES) {
1216
+ anObject$2(value);
1217
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1218
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
1219
+ };
1220
+
1221
+ if (IS_ITERATOR) {
1222
+ iterator = iterable;
1223
+ } else {
1224
+ iterFn = getIteratorMethod(iterable);
1225
+ if (!iterFn) throw TypeError$5(tryToString$1(iterable) + ' is not iterable');
1226
+ // optimisation for array iterators
1227
+ if (isArrayIteratorMethod(iterFn)) {
1228
+ for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
1229
+ result = callFn(iterable[index]);
1230
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
1231
+ } return new Result(false);
1232
+ }
1233
+ iterator = getIterator(iterable, iterFn);
1234
+ }
1235
+
1236
+ next = iterator.next;
1237
+ while (!(step = call$3(next, iterator)).done) {
1238
+ try {
1239
+ result = callFn(step.value);
1240
+ } catch (error) {
1241
+ iteratorClose(iterator, 'throw', error);
1242
+ }
1243
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
1244
+ } return new Result(false);
1245
+ };
1246
+
1247
+ var wellKnownSymbol$2 = wellKnownSymbol$a;
1248
+
1249
+ var ITERATOR = wellKnownSymbol$2('iterator');
1250
+ var SAFE_CLOSING = false;
1251
+
1252
+ try {
1253
+ var called = 0;
1254
+ var iteratorWithReturn = {
1255
+ next: function () {
1256
+ return { done: !!called++ };
1257
+ },
1258
+ 'return': function () {
1259
+ SAFE_CLOSING = true;
1260
+ }
1261
+ };
1262
+ iteratorWithReturn[ITERATOR] = function () {
1263
+ return this;
1264
+ };
1265
+ // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
1266
+ Array.from(iteratorWithReturn, function () { throw 2; });
1267
+ } catch (error) { /* empty */ }
1268
+
1269
+ var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
1270
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
1271
+ var ITERATION_SUPPORT = false;
1272
+ try {
1273
+ var object = {};
1274
+ object[ITERATOR] = function () {
1275
+ return {
1276
+ next: function () {
1277
+ return { done: ITERATION_SUPPORT = true };
1278
+ }
1279
+ };
1280
+ };
1281
+ exec(object);
1282
+ } catch (error) { /* empty */ }
1283
+ return ITERATION_SUPPORT;
1284
+ };
1285
+
1286
+ var uncurryThis$2 = functionUncurryThis;
1287
+ var fails$3 = fails$b;
1288
+ var isCallable$2 = isCallable$e;
1289
+ var classof$1 = classof$3;
1290
+ var getBuiltIn$2 = getBuiltIn$7;
1291
+ var inspectSource$1 = inspectSource$4;
1292
+
1293
+ var noop = function () { /* empty */ };
1294
+ var empty = [];
1295
+ var construct = getBuiltIn$2('Reflect', 'construct');
1296
+ var constructorRegExp = /^\s*(?:class|function)\b/;
1297
+ var exec = uncurryThis$2(constructorRegExp.exec);
1298
+ var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1299
+
1300
+ var isConstructorModern = function isConstructor(argument) {
1301
+ if (!isCallable$2(argument)) return false;
1302
+ try {
1303
+ construct(noop, empty, argument);
1304
+ return true;
1305
+ } catch (error) {
1306
+ return false;
1307
+ }
1308
+ };
1309
+
1310
+ var isConstructorLegacy = function isConstructor(argument) {
1311
+ if (!isCallable$2(argument)) return false;
1312
+ switch (classof$1(argument)) {
1313
+ case 'AsyncFunction':
1314
+ case 'GeneratorFunction':
1315
+ case 'AsyncGeneratorFunction': return false;
1316
+ }
1317
+ try {
1318
+ // we can't check .prototype since constructors produced by .bind haven't it
1319
+ // `Function#toString` throws on some built-it function in some legacy engines
1320
+ // (for example, `DOMQuad` and similar in FF41-)
1321
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
1322
+ } catch (error) {
1323
+ return true;
1324
+ }
1325
+ };
1326
+
1327
+ isConstructorLegacy.sham = true;
1328
+
1329
+ // `IsConstructor` abstract operation
1330
+ // https://tc39.es/ecma262/#sec-isconstructor
1331
+ var isConstructor$1 = !construct || fails$3(function () {
1332
+ var called;
1333
+ return isConstructorModern(isConstructorModern.call)
1334
+ || !isConstructorModern(Object)
1335
+ || !isConstructorModern(function () { called = true; })
1336
+ || called;
1337
+ }) ? isConstructorLegacy : isConstructorModern;
1338
+
1339
+ var global$9 = global$A;
1340
+ var isConstructor = isConstructor$1;
1341
+ var tryToString = tryToString$4;
1342
+
1343
+ var TypeError$4 = global$9.TypeError;
1344
+
1345
+ // `Assert: IsConstructor(argument) is true`
1346
+ var aConstructor$1 = function (argument) {
1347
+ if (isConstructor(argument)) return argument;
1348
+ throw TypeError$4(tryToString(argument) + ' is not a constructor');
1349
+ };
1350
+
1351
+ var anObject$1 = anObject$8;
1352
+ var aConstructor = aConstructor$1;
1353
+ var wellKnownSymbol$1 = wellKnownSymbol$a;
1354
+
1355
+ var SPECIES$1 = wellKnownSymbol$1('species');
1356
+
1357
+ // `SpeciesConstructor` abstract operation
1358
+ // https://tc39.es/ecma262/#sec-speciesconstructor
1359
+ var speciesConstructor$1 = function (O, defaultConstructor) {
1360
+ var C = anObject$1(O).constructor;
1361
+ var S;
1362
+ return C === undefined || (S = anObject$1(C)[SPECIES$1]) == undefined ? defaultConstructor : aConstructor(S);
1363
+ };
1364
+
1365
+ var NATIVE_BIND = functionBindNative;
1366
+
1367
+ var FunctionPrototype = Function.prototype;
1368
+ var apply$1 = FunctionPrototype.apply;
1369
+ var call$2 = FunctionPrototype.call;
1370
+
1371
+ // eslint-disable-next-line es/no-reflect -- safe
1372
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$2.bind(apply$1) : function () {
1373
+ return call$2.apply(apply$1, arguments);
1374
+ });
1375
+
1376
+ var getBuiltIn$1 = getBuiltIn$7;
1377
+
1378
+ var html$1 = getBuiltIn$1('document', 'documentElement');
1379
+
1380
+ var uncurryThis$1 = functionUncurryThis;
1381
+
1382
+ var arraySlice$1 = uncurryThis$1([].slice);
1383
+
1384
+ var global$8 = global$A;
1385
+
1386
+ var TypeError$3 = global$8.TypeError;
1387
+
1388
+ var validateArgumentsLength$1 = function (passed, required) {
1389
+ if (passed < required) throw TypeError$3('Not enough arguments');
1390
+ return passed;
1391
+ };
1392
+
1393
+ var userAgent$2 = engineUserAgent;
1394
+
1395
+ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
1396
+
1397
+ var classof = classofRaw$1;
1398
+ var global$7 = global$A;
1399
+
1400
+ var engineIsNode = classof(global$7.process) == 'process';
1401
+
1402
+ var global$6 = global$A;
1403
+ var apply = functionApply;
1404
+ var bind$2 = functionBindContext;
1405
+ var isCallable$1 = isCallable$e;
1406
+ var hasOwn = hasOwnProperty_1;
1407
+ var fails$2 = fails$b;
1408
+ var html = html$1;
1409
+ var arraySlice = arraySlice$1;
1410
+ var createElement = documentCreateElement;
1411
+ var validateArgumentsLength = validateArgumentsLength$1;
1412
+ var IS_IOS$1 = engineIsIos;
1413
+ var IS_NODE$3 = engineIsNode;
1414
+
1415
+ var set$1 = global$6.setImmediate;
1416
+ var clear = global$6.clearImmediate;
1417
+ var process$3 = global$6.process;
1418
+ var Dispatch = global$6.Dispatch;
1419
+ var Function$1 = global$6.Function;
1420
+ var MessageChannel = global$6.MessageChannel;
1421
+ var String$1 = global$6.String;
1422
+ var counter = 0;
1423
+ var queue$1 = {};
1424
+ var ONREADYSTATECHANGE = 'onreadystatechange';
1425
+ var location, defer, channel, port;
1426
+
1427
+ try {
1428
+ // Deno throws a ReferenceError on `location` access without `--location` flag
1429
+ location = global$6.location;
1430
+ } catch (error) { /* empty */ }
1431
+
1432
+ var run = function (id) {
1433
+ if (hasOwn(queue$1, id)) {
1434
+ var fn = queue$1[id];
1435
+ delete queue$1[id];
1436
+ fn();
1437
+ }
1438
+ };
1439
+
1440
+ var runner = function (id) {
1441
+ return function () {
1442
+ run(id);
1443
+ };
1444
+ };
1445
+
1446
+ var listener = function (event) {
1447
+ run(event.data);
1448
+ };
1449
+
1450
+ var post = function (id) {
1451
+ // old engines have not location.origin
1452
+ global$6.postMessage(String$1(id), location.protocol + '//' + location.host);
1453
+ };
1454
+
1455
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1456
+ if (!set$1 || !clear) {
1457
+ set$1 = function setImmediate(handler) {
1458
+ validateArgumentsLength(arguments.length, 1);
1459
+ var fn = isCallable$1(handler) ? handler : Function$1(handler);
1460
+ var args = arraySlice(arguments, 1);
1461
+ queue$1[++counter] = function () {
1462
+ apply(fn, undefined, args);
1463
+ };
1464
+ defer(counter);
1465
+ return counter;
1466
+ };
1467
+ clear = function clearImmediate(id) {
1468
+ delete queue$1[id];
1469
+ };
1470
+ // Node.js 0.8-
1471
+ if (IS_NODE$3) {
1472
+ defer = function (id) {
1473
+ process$3.nextTick(runner(id));
1474
+ };
1475
+ // Sphere (JS game engine) Dispatch API
1476
+ } else if (Dispatch && Dispatch.now) {
1477
+ defer = function (id) {
1478
+ Dispatch.now(runner(id));
1479
+ };
1480
+ // Browsers with MessageChannel, includes WebWorkers
1481
+ // except iOS - https://github.com/zloirock/core-js/issues/624
1482
+ } else if (MessageChannel && !IS_IOS$1) {
1483
+ channel = new MessageChannel();
1484
+ port = channel.port2;
1485
+ channel.port1.onmessage = listener;
1486
+ defer = bind$2(port.postMessage, port);
1487
+ // Browsers with postMessage, skip WebWorkers
1488
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1489
+ } else if (
1490
+ global$6.addEventListener &&
1491
+ isCallable$1(global$6.postMessage) &&
1492
+ !global$6.importScripts &&
1493
+ location && location.protocol !== 'file:' &&
1494
+ !fails$2(post)
1495
+ ) {
1496
+ defer = post;
1497
+ global$6.addEventListener('message', listener, false);
1498
+ // IE8-
1499
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
1500
+ defer = function (id) {
1501
+ html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
1502
+ html.removeChild(this);
1503
+ run(id);
1504
+ };
1505
+ };
1506
+ // Rest old browsers
1507
+ } else {
1508
+ defer = function (id) {
1509
+ setTimeout(runner(id), 0);
1510
+ };
1511
+ }
1512
+ }
1513
+
1514
+ var task$1 = {
1515
+ set: set$1,
1516
+ clear: clear
1517
+ };
1518
+
1519
+ var userAgent$1 = engineUserAgent;
1520
+ var global$5 = global$A;
1521
+
1522
+ var engineIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && global$5.Pebble !== undefined;
1523
+
1524
+ var userAgent = engineUserAgent;
1525
+
1526
+ var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
1527
+
1528
+ var global$4 = global$A;
1529
+ var bind$1 = functionBindContext;
1530
+ var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1531
+ var macrotask = task$1.set;
1532
+ var IS_IOS = engineIsIos;
1533
+ var IS_IOS_PEBBLE = engineIsIosPebble;
1534
+ var IS_WEBOS_WEBKIT = engineIsWebosWebkit;
1535
+ var IS_NODE$2 = engineIsNode;
1536
+
1537
+ var MutationObserver = global$4.MutationObserver || global$4.WebKitMutationObserver;
1538
+ var document$2 = global$4.document;
1539
+ var process$2 = global$4.process;
1540
+ var Promise$1 = global$4.Promise;
1541
+ // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
1542
+ var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$4, 'queueMicrotask');
1543
+ var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
1544
+
1545
+ var flush, head, last, notify$1, toggle, node$1, promise, then;
1546
+
1547
+ // modern engines have queueMicrotask method
1548
+ if (!queueMicrotask) {
1549
+ flush = function () {
1550
+ var parent, fn;
1551
+ if (IS_NODE$2 && (parent = process$2.domain)) parent.exit();
1552
+ while (head) {
1553
+ fn = head.fn;
1554
+ head = head.next;
1555
+ try {
1556
+ fn();
1557
+ } catch (error) {
1558
+ if (head) notify$1();
1559
+ else last = undefined;
1560
+ throw error;
1561
+ }
1562
+ } last = undefined;
1563
+ if (parent) parent.enter();
1564
+ };
1565
+
1566
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
1567
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1568
+ if (!IS_IOS && !IS_NODE$2 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
1569
+ toggle = true;
1570
+ node$1 = document$2.createTextNode('');
1571
+ new MutationObserver(flush).observe(node$1, { characterData: true });
1572
+ notify$1 = function () {
1573
+ node$1.data = toggle = !toggle;
1574
+ };
1575
+ // environments with maybe non-completely correct, but existent Promise
1576
+ } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
1577
+ // Promise.resolve without an argument throws an error in LG WebOS 2
1578
+ promise = Promise$1.resolve(undefined);
1579
+ // workaround of WebKit ~ iOS Safari 10.1 bug
1580
+ promise.constructor = Promise$1;
1581
+ then = bind$1(promise.then, promise);
1582
+ notify$1 = function () {
1583
+ then(flush);
1584
+ };
1585
+ // Node.js without promises
1586
+ } else if (IS_NODE$2) {
1587
+ notify$1 = function () {
1588
+ process$2.nextTick(flush);
1589
+ };
1590
+ // for other environments - macrotask based on:
1591
+ // - setImmediate
1592
+ // - MessageChannel
1593
+ // - window.postMessag
1594
+ // - onreadystatechange
1595
+ // - setTimeout
1596
+ } else {
1597
+ // strange IE + webpack dev server bug - use .bind(global)
1598
+ macrotask = bind$1(macrotask, global$4);
1599
+ notify$1 = function () {
1600
+ macrotask(flush);
1601
+ };
1602
+ }
1603
+ }
1604
+
1605
+ var microtask$1 = queueMicrotask || function (fn) {
1606
+ var task = { fn: fn, next: undefined };
1607
+ if (last) last.next = task;
1608
+ if (!head) {
1609
+ head = task;
1610
+ notify$1();
1611
+ } last = task;
1612
+ };
1613
+
1614
+ var newPromiseCapability$2 = {};
1615
+
1616
+ var aCallable$2 = aCallable$6;
1617
+
1618
+ var PromiseCapability = function (C) {
1619
+ var resolve, reject;
1620
+ this.promise = new C(function ($$resolve, $$reject) {
1621
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
1622
+ resolve = $$resolve;
1623
+ reject = $$reject;
1624
+ });
1625
+ this.resolve = aCallable$2(resolve);
1626
+ this.reject = aCallable$2(reject);
1627
+ };
1628
+
1629
+ // `NewPromiseCapability` abstract operation
1630
+ // https://tc39.es/ecma262/#sec-newpromisecapability
1631
+ newPromiseCapability$2.f = function (C) {
1632
+ return new PromiseCapability(C);
1633
+ };
1634
+
1635
+ var anObject = anObject$8;
1636
+ var isObject$1 = isObject$7;
1637
+ var newPromiseCapability$1 = newPromiseCapability$2;
1638
+
1639
+ var promiseResolve$1 = function (C, x) {
1640
+ anObject(C);
1641
+ if (isObject$1(x) && x.constructor === C) return x;
1642
+ var promiseCapability = newPromiseCapability$1.f(C);
1643
+ var resolve = promiseCapability.resolve;
1644
+ resolve(x);
1645
+ return promiseCapability.promise;
1646
+ };
1647
+
1648
+ var global$3 = global$A;
1649
+
1650
+ var hostReportErrors$1 = function (a, b) {
1651
+ var console = global$3.console;
1652
+ if (console && console.error) {
1653
+ arguments.length == 1 ? console.error(a) : console.error(a, b);
1654
+ }
1655
+ };
1656
+
1657
+ var perform$1 = function (exec) {
1658
+ try {
1659
+ return { error: false, value: exec() };
1660
+ } catch (error) {
1661
+ return { error: true, value: error };
1662
+ }
1663
+ };
1664
+
1665
+ var Queue$1 = function () {
1666
+ this.head = null;
1667
+ this.tail = null;
1668
+ };
1669
+
1670
+ Queue$1.prototype = {
1671
+ add: function (item) {
1672
+ var entry = { item: item, next: null };
1673
+ if (this.head) this.tail.next = entry;
1674
+ else this.head = entry;
1675
+ this.tail = entry;
1676
+ },
1677
+ get: function () {
1678
+ var entry = this.head;
1679
+ if (entry) {
1680
+ this.head = entry.next;
1681
+ if (this.tail === entry) this.tail = null;
1682
+ return entry.item;
1683
+ }
1684
+ }
1685
+ };
1686
+
1687
+ var queue = Queue$1;
1688
+
1689
+ var engineIsBrowser = typeof window == 'object';
1690
+
1691
+ var $$2 = _export;
1692
+ var global$2 = global$A;
1693
+ var getBuiltIn = getBuiltIn$7;
1694
+ var call$1 = functionCall;
1695
+ var NativePromise = nativePromiseConstructor;
1696
+ var redefine = redefine$3.exports;
1697
+ var redefineAll = redefineAll$1;
1698
+ var setPrototypeOf = objectSetPrototypeOf;
1699
+ var setToStringTag = setToStringTag$1;
1700
+ var setSpecies = setSpecies$1;
1701
+ var aCallable$1 = aCallable$6;
1702
+ var isCallable = isCallable$e;
1703
+ var isObject = isObject$7;
1704
+ var anInstance = anInstance$1;
1705
+ var inspectSource = inspectSource$4;
1706
+ var iterate = iterate$1;
1707
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
1708
+ var speciesConstructor = speciesConstructor$1;
1709
+ var task = task$1.set;
1710
+ var microtask = microtask$1;
1711
+ var promiseResolve = promiseResolve$1;
1712
+ var hostReportErrors = hostReportErrors$1;
1713
+ var newPromiseCapabilityModule = newPromiseCapability$2;
1714
+ var perform = perform$1;
1715
+ var Queue = queue;
1716
+ var InternalStateModule = internalState;
1717
+ var isForced = isForced_1;
1718
+ var wellKnownSymbol = wellKnownSymbol$a;
1719
+ var IS_BROWSER = engineIsBrowser;
1720
+ var IS_NODE$1 = engineIsNode;
1721
+ var V8_VERSION = engineV8Version;
1722
+
1723
+ var SPECIES = wellKnownSymbol('species');
1724
+ var PROMISE = 'Promise';
1725
+
1726
+ var getInternalState = InternalStateModule.getterFor(PROMISE);
1727
+ var setInternalState = InternalStateModule.set;
1728
+ var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
1729
+ var NativePromisePrototype = NativePromise && NativePromise.prototype;
1730
+ var PromiseConstructor = NativePromise;
1731
+ var PromisePrototype = NativePromisePrototype;
1732
+ var TypeError$2 = global$2.TypeError;
1733
+ var document$1 = global$2.document;
1734
+ var process$1 = global$2.process;
1735
+ var newPromiseCapability = newPromiseCapabilityModule.f;
1736
+ var newGenericPromiseCapability = newPromiseCapability;
1737
+
1738
+ var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$2.dispatchEvent);
1739
+ var NATIVE_REJECTION_EVENT = isCallable(global$2.PromiseRejectionEvent);
1740
+ var UNHANDLED_REJECTION = 'unhandledrejection';
1741
+ var REJECTION_HANDLED = 'rejectionhandled';
1742
+ var PENDING = 0;
1743
+ var FULFILLED = 1;
1744
+ var REJECTED = 2;
1745
+ var HANDLED = 1;
1746
+ var UNHANDLED = 2;
1747
+ var SUBCLASSING = false;
1748
+
1749
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1750
+
1751
+ var FORCED = isForced(PROMISE, function () {
1752
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
1753
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
1754
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1755
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1756
+ // We can't detect it synchronously, so just check versions
1757
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
1758
+ // We can't use @@species feature detection in V8 since it causes
1759
+ // deoptimization and performance degradation
1760
+ // https://github.com/zloirock/core-js/issues/679
1761
+ if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
1762
+ // Detect correctness of subclassing with @@species support
1763
+ var promise = new PromiseConstructor(function (resolve) { resolve(1); });
1764
+ var FakePromise = function (exec) {
1765
+ exec(function () { /* empty */ }, function () { /* empty */ });
1766
+ };
1767
+ var constructor = promise.constructor = {};
1768
+ constructor[SPECIES] = FakePromise;
1769
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
1770
+ if (!SUBCLASSING) return true;
1771
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1772
+ return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
1773
+ });
1774
+
1775
+ var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
1776
+ PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
1777
+ });
1778
+
1779
+ // helpers
1780
+ var isThenable = function (it) {
1781
+ var then;
1782
+ return isObject(it) && isCallable(then = it.then) ? then : false;
1783
+ };
1784
+
1785
+ var callReaction = function (reaction, state) {
1786
+ var value = state.value;
1787
+ var ok = state.state == FULFILLED;
1788
+ var handler = ok ? reaction.ok : reaction.fail;
1789
+ var resolve = reaction.resolve;
1790
+ var reject = reaction.reject;
1791
+ var domain = reaction.domain;
1792
+ var result, then, exited;
1793
+ try {
1794
+ if (handler) {
1795
+ if (!ok) {
1796
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1797
+ state.rejection = HANDLED;
1798
+ }
1799
+ if (handler === true) result = value;
1800
+ else {
1801
+ if (domain) domain.enter();
1802
+ result = handler(value); // can throw
1803
+ if (domain) {
1804
+ domain.exit();
1805
+ exited = true;
1806
+ }
1807
+ }
1808
+ if (result === reaction.promise) {
1809
+ reject(TypeError$2('Promise-chain cycle'));
1810
+ } else if (then = isThenable(result)) {
1811
+ call$1(then, result, resolve, reject);
1812
+ } else resolve(result);
1813
+ } else reject(value);
1814
+ } catch (error) {
1815
+ if (domain && !exited) domain.exit();
1816
+ reject(error);
1817
+ }
1818
+ };
1819
+
1820
+ var notify = function (state, isReject) {
1821
+ if (state.notified) return;
1822
+ state.notified = true;
1823
+ microtask(function () {
1824
+ var reactions = state.reactions;
1825
+ var reaction;
1826
+ while (reaction = reactions.get()) {
1827
+ callReaction(reaction, state);
1828
+ }
1829
+ state.notified = false;
1830
+ if (isReject && !state.rejection) onUnhandled(state);
1831
+ });
1832
+ };
1833
+
1834
+ var dispatchEvent = function (name, promise, reason) {
1835
+ var event, handler;
1836
+ if (DISPATCH_EVENT) {
1837
+ event = document$1.createEvent('Event');
1838
+ event.promise = promise;
1839
+ event.reason = reason;
1840
+ event.initEvent(name, false, true);
1841
+ global$2.dispatchEvent(event);
1842
+ } else event = { promise: promise, reason: reason };
1843
+ if (!NATIVE_REJECTION_EVENT && (handler = global$2['on' + name])) handler(event);
1844
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1845
+ };
1846
+
1847
+ var onUnhandled = function (state) {
1848
+ call$1(task, global$2, function () {
1849
+ var promise = state.facade;
1850
+ var value = state.value;
1851
+ var IS_UNHANDLED = isUnhandled(state);
1852
+ var result;
1853
+ if (IS_UNHANDLED) {
1854
+ result = perform(function () {
1855
+ if (IS_NODE$1) {
1856
+ process$1.emit('unhandledRejection', value, promise);
1857
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1858
+ });
1859
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1860
+ state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
1861
+ if (result.error) throw result.value;
1862
+ }
1863
+ });
1864
+ };
1865
+
1866
+ var isUnhandled = function (state) {
1867
+ return state.rejection !== HANDLED && !state.parent;
1868
+ };
1869
+
1870
+ var onHandleUnhandled = function (state) {
1871
+ call$1(task, global$2, function () {
1872
+ var promise = state.facade;
1873
+ if (IS_NODE$1) {
1874
+ process$1.emit('rejectionHandled', promise);
1875
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1876
+ });
1877
+ };
1878
+
1879
+ var bind = function (fn, state, unwrap) {
1880
+ return function (value) {
1881
+ fn(state, value, unwrap);
1882
+ };
1883
+ };
1884
+
1885
+ var internalReject = function (state, value, unwrap) {
1886
+ if (state.done) return;
1887
+ state.done = true;
1888
+ if (unwrap) state = unwrap;
1889
+ state.value = value;
1890
+ state.state = REJECTED;
1891
+ notify(state, true);
1892
+ };
1893
+
1894
+ var internalResolve = function (state, value, unwrap) {
1895
+ if (state.done) return;
1896
+ state.done = true;
1897
+ if (unwrap) state = unwrap;
1898
+ try {
1899
+ if (state.facade === value) throw TypeError$2("Promise can't be resolved itself");
1900
+ var then = isThenable(value);
1901
+ if (then) {
1902
+ microtask(function () {
1903
+ var wrapper = { done: false };
1904
+ try {
1905
+ call$1(then, value,
1906
+ bind(internalResolve, wrapper, state),
1907
+ bind(internalReject, wrapper, state)
1908
+ );
1909
+ } catch (error) {
1910
+ internalReject(wrapper, error, state);
1911
+ }
1912
+ });
1913
+ } else {
1914
+ state.value = value;
1915
+ state.state = FULFILLED;
1916
+ notify(state, false);
1917
+ }
1918
+ } catch (error) {
1919
+ internalReject({ done: false }, error, state);
1920
+ }
1921
+ };
1922
+
1923
+ // constructor polyfill
1924
+ if (FORCED) {
1925
+ // 25.4.3.1 Promise(executor)
1926
+ PromiseConstructor = function Promise(executor) {
1927
+ anInstance(this, PromisePrototype);
1928
+ aCallable$1(executor);
1929
+ call$1(Internal, this);
1930
+ var state = getInternalState(this);
1931
+ try {
1932
+ executor(bind(internalResolve, state), bind(internalReject, state));
1933
+ } catch (error) {
1934
+ internalReject(state, error);
1935
+ }
1936
+ };
1937
+ PromisePrototype = PromiseConstructor.prototype;
1938
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
1939
+ Internal = function Promise(executor) {
1940
+ setInternalState(this, {
1941
+ type: PROMISE,
1942
+ done: false,
1943
+ notified: false,
1944
+ parent: false,
1945
+ reactions: new Queue(),
1946
+ rejection: false,
1947
+ state: PENDING,
1948
+ value: undefined
1949
+ });
1950
+ };
1951
+ Internal.prototype = redefineAll(PromisePrototype, {
1952
+ // `Promise.prototype.then` method
1953
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
1954
+ // eslint-disable-next-line unicorn/no-thenable -- safe
1955
+ then: function then(onFulfilled, onRejected) {
1956
+ var state = getInternalPromiseState(this);
1957
+ var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
1958
+ state.parent = true;
1959
+ reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
1960
+ reaction.fail = isCallable(onRejected) && onRejected;
1961
+ reaction.domain = IS_NODE$1 ? process$1.domain : undefined;
1962
+ if (state.state == PENDING) state.reactions.add(reaction);
1963
+ else microtask(function () {
1964
+ callReaction(reaction, state);
1965
+ });
1966
+ return reaction.promise;
1967
+ },
1968
+ // `Promise.prototype.catch` method
1969
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
1970
+ 'catch': function (onRejected) {
1971
+ return this.then(undefined, onRejected);
1972
+ }
1973
+ });
1974
+ OwnPromiseCapability = function () {
1975
+ var promise = new Internal();
1976
+ var state = getInternalState(promise);
1977
+ this.promise = promise;
1978
+ this.resolve = bind(internalResolve, state);
1979
+ this.reject = bind(internalReject, state);
1980
+ };
1981
+ newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
1982
+ return C === PromiseConstructor || C === PromiseWrapper
1983
+ ? new OwnPromiseCapability(C)
1984
+ : newGenericPromiseCapability(C);
1985
+ };
1986
+
1987
+ if (isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) {
1988
+ nativeThen = NativePromisePrototype.then;
1989
+
1990
+ if (!SUBCLASSING) {
1991
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
1992
+ redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
1993
+ var that = this;
1994
+ return new PromiseConstructor(function (resolve, reject) {
1995
+ call$1(nativeThen, that, resolve, reject);
1996
+ }).then(onFulfilled, onRejected);
1997
+ // https://github.com/zloirock/core-js/issues/640
1998
+ }, { unsafe: true });
1999
+
2000
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2001
+ redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
2002
+ }
2003
+
2004
+ // make `.constructor === Promise` work for native promise-based APIs
2005
+ try {
2006
+ delete NativePromisePrototype.constructor;
2007
+ } catch (error) { /* empty */ }
2008
+
2009
+ // make `instanceof Promise` work for native promise-based APIs
2010
+ if (setPrototypeOf) {
2011
+ setPrototypeOf(NativePromisePrototype, PromisePrototype);
2012
+ }
2013
+ }
2014
+ }
2015
+
2016
+ $$2({ global: true, wrap: true, forced: FORCED }, {
2017
+ Promise: PromiseConstructor
2018
+ });
2019
+
2020
+ setToStringTag(PromiseConstructor, PROMISE, false);
2021
+ setSpecies(PROMISE);
2022
+
2023
+ PromiseWrapper = getBuiltIn(PROMISE);
2024
+
2025
+ // statics
2026
+ $$2({ target: PROMISE, stat: true, forced: FORCED }, {
2027
+ // `Promise.reject` method
2028
+ // https://tc39.es/ecma262/#sec-promise.reject
2029
+ reject: function reject(r) {
2030
+ var capability = newPromiseCapability(this);
2031
+ call$1(capability.reject, undefined, r);
2032
+ return capability.promise;
2033
+ }
2034
+ });
2035
+
2036
+ $$2({ target: PROMISE, stat: true, forced: FORCED }, {
2037
+ // `Promise.resolve` method
2038
+ // https://tc39.es/ecma262/#sec-promise.resolve
2039
+ resolve: function resolve(x) {
2040
+ return promiseResolve(this, x);
2041
+ }
2042
+ });
2043
+
2044
+ $$2({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
2045
+ // `Promise.all` method
2046
+ // https://tc39.es/ecma262/#sec-promise.all
2047
+ all: function all(iterable) {
2048
+ var C = this;
2049
+ var capability = newPromiseCapability(C);
2050
+ var resolve = capability.resolve;
2051
+ var reject = capability.reject;
2052
+ var result = perform(function () {
2053
+ var $promiseResolve = aCallable$1(C.resolve);
2054
+ var values = [];
2055
+ var counter = 0;
2056
+ var remaining = 1;
2057
+ iterate(iterable, function (promise) {
2058
+ var index = counter++;
2059
+ var alreadyCalled = false;
2060
+ remaining++;
2061
+ call$1($promiseResolve, C, promise).then(function (value) {
2062
+ if (alreadyCalled) return;
2063
+ alreadyCalled = true;
2064
+ values[index] = value;
2065
+ --remaining || resolve(values);
2066
+ }, reject);
2067
+ });
2068
+ --remaining || resolve(values);
2069
+ });
2070
+ if (result.error) reject(result.value);
2071
+ return capability.promise;
2072
+ },
2073
+ // `Promise.race` method
2074
+ // https://tc39.es/ecma262/#sec-promise.race
2075
+ race: function race(iterable) {
2076
+ var C = this;
2077
+ var capability = newPromiseCapability(C);
2078
+ var reject = capability.reject;
2079
+ var result = perform(function () {
2080
+ var $promiseResolve = aCallable$1(C.resolve);
2081
+ iterate(iterable, function (promise) {
2082
+ call$1($promiseResolve, C, promise).then(capability.resolve, reject);
2083
+ });
2084
+ });
2085
+ if (result.error) reject(result.value);
2086
+ return capability.promise;
2087
+ }
2088
+ });
2089
+
2090
+ var internalObjectKeys = objectKeysInternal;
2091
+ var enumBugKeys = enumBugKeys$2;
2092
+
2093
+ // `Object.keys` method
2094
+ // https://tc39.es/ecma262/#sec-object.keys
2095
+ // eslint-disable-next-line es/no-object-keys -- safe
2096
+ var objectKeys$1 = Object.keys || function keys(O) {
2097
+ return internalObjectKeys(O, enumBugKeys);
2098
+ };
2099
+
2100
+ var DESCRIPTORS = descriptors;
2101
+ var uncurryThis = functionUncurryThis;
2102
+ var call = functionCall;
2103
+ var fails$1 = fails$b;
2104
+ var objectKeys = objectKeys$1;
2105
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
2106
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
2107
+ var toObject$1 = toObject$3;
2108
+ var IndexedObject$1 = indexedObject;
2109
+
2110
+ // eslint-disable-next-line es/no-object-assign -- safe
2111
+ var $assign = Object.assign;
2112
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
2113
+ var defineProperty = Object.defineProperty;
2114
+ var concat = uncurryThis([].concat);
2115
+
2116
+ // `Object.assign` method
2117
+ // https://tc39.es/ecma262/#sec-object.assign
2118
+ var objectAssign = !$assign || fails$1(function () {
2119
+ // should have correct order of operations (Edge bug)
2120
+ if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
2121
+ enumerable: true,
2122
+ get: function () {
2123
+ defineProperty(this, 'b', {
2124
+ value: 3,
2125
+ enumerable: false
2126
+ });
2127
+ }
2128
+ }), { b: 2 })).b !== 1) return true;
2129
+ // should work with symbols and should have deterministic property order (V8 bug)
2130
+ var A = {};
2131
+ var B = {};
2132
+ // eslint-disable-next-line es/no-symbol -- safe
2133
+ var symbol = Symbol();
2134
+ var alphabet = 'abcdefghijklmnopqrst';
2135
+ A[symbol] = 7;
2136
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
2137
+ return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
2138
+ }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
2139
+ var T = toObject$1(target);
2140
+ var argumentsLength = arguments.length;
2141
+ var index = 1;
2142
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
2143
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
2144
+ while (argumentsLength > index) {
2145
+ var S = IndexedObject$1(arguments[index++]);
2146
+ var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
2147
+ var length = keys.length;
2148
+ var j = 0;
2149
+ var key;
2150
+ while (length > j) {
2151
+ key = keys[j++];
2152
+ if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
2153
+ }
2154
+ } return T;
2155
+ } : $assign;
2156
+
2157
+ var $$1 = _export;
2158
+ var assign = objectAssign;
2159
+
2160
+ // `Object.assign` method
2161
+ // https://tc39.es/ecma262/#sec-object.assign
2162
+ // eslint-disable-next-line es/no-object-assign -- required for testing
2163
+ $$1({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
2164
+ assign: assign
2165
+ });
2166
+
2167
+ /*! *****************************************************************************
2168
+ Copyright (c) Microsoft Corporation.
2169
+
2170
+ Permission to use, copy, modify, and/or distribute this software for any
2171
+ purpose with or without fee is hereby granted.
2172
+
2173
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2174
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2175
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2176
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2177
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2178
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2179
+ PERFORMANCE OF THIS SOFTWARE.
2180
+ ***************************************************************************** */
2181
+
2182
+ var __assign = function() {
2183
+ __assign = Object.assign || function __assign(t) {
2184
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2185
+ s = arguments[i];
2186
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2187
+ }
2188
+ return t;
2189
+ };
2190
+ return __assign.apply(this, arguments);
2191
+ };
2192
+
2193
+ function __awaiter(thisArg, _arguments, P, generator) {
2194
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2195
+ return new (P || (P = Promise))(function (resolve, reject) {
2196
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2197
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2198
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2199
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2200
+ });
2201
+ }
2202
+
2203
+ function __generator(thisArg, body) {
2204
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
2205
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
2206
+ function verb(n) { return function (v) { return step([n, v]); }; }
2207
+ function step(op) {
2208
+ if (f) throw new TypeError("Generator is already executing.");
2209
+ while (_) try {
2210
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2211
+ if (y = 0, t) op = [op[0] & 2, t.value];
2212
+ switch (op[0]) {
2213
+ case 0: case 1: t = op; break;
2214
+ case 4: _.label++; return { value: op[1], done: false };
2215
+ case 5: _.label++; y = op[1]; op = [0]; continue;
2216
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
2217
+ default:
2218
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
2219
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
2220
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
2221
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
2222
+ if (t[2]) _.ops.pop();
2223
+ _.trys.pop(); continue;
2224
+ }
2225
+ op = body.call(thisArg, _);
2226
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
2227
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
2228
+ }
2229
+ }
2230
+
2231
+ var NINETAILED_CACHE_KEY = '__nt-cache__';
2232
+ var initialize = function initialize(_a, data) {
2233
+ var instance = _a.instance;
2234
+
2235
+ if (data === void 0) {
2236
+ data = {};
2237
+ }
2238
+
2239
+ var cache = experience_jsShared.buildEmptyCache();
2240
+ instance.storage.setItem(NINETAILED_CACHE_KEY, __assign(__assign({}, cache), data));
2241
+ return cache;
2242
+ };
2243
+ var get = function get(_a) {
2244
+ var instance = _a.instance;
2245
+ var cache = instance.storage.getItem(NINETAILED_CACHE_KEY);
2246
+ return cache;
2247
+ };
2248
+ var set = function set(cache, _a) {
2249
+ var instance = _a.instance;
2250
+ instance.storage.setItem(NINETAILED_CACHE_KEY, cache);
2251
+ return cache;
2252
+ };
2253
+ var reset = function reset(_a) {
2254
+ var instance = _a.instance;
2255
+ return initialize({
2256
+ instance: instance
2257
+ });
2258
+ };
2259
+
2260
+ var buildClientLocale = function buildClientLocale() {
2261
+ return navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
2262
+ };
2263
+
2264
+ var buildClientNinetailedRequestContext = function buildClientNinetailedRequestContext() {
2265
+ return {
2266
+ url: window.location.href,
2267
+ referrer: document.referrer,
2268
+ locale: buildClientLocale(),
2269
+ userAgent: navigator.userAgent,
2270
+ document: {
2271
+ title: document.title
2272
+ }
2273
+ };
2274
+ };
2275
+
2276
+ var src = {exports: {}};
2277
+
2278
+ var browser = {exports: {}};
2279
+
2280
+ /**
2281
+ * Helpers.
2282
+ */
2283
+
2284
+ var s = 1000;
2285
+ var m = s * 60;
2286
+ var h = m * 60;
2287
+ var d = h * 24;
2288
+ var w = d * 7;
2289
+ var y = d * 365.25;
2290
+
2291
+ /**
2292
+ * Parse or format the given `val`.
2293
+ *
2294
+ * Options:
2295
+ *
2296
+ * - `long` verbose formatting [false]
2297
+ *
2298
+ * @param {String|Number} val
2299
+ * @param {Object} [options]
2300
+ * @throws {Error} throw an error if val is not a non-empty string or a number
2301
+ * @return {String|Number}
2302
+ * @api public
2303
+ */
2304
+
2305
+ var ms = function(val, options) {
2306
+ options = options || {};
2307
+ var type = typeof val;
2308
+ if (type === 'string' && val.length > 0) {
2309
+ return parse(val);
2310
+ } else if (type === 'number' && isFinite(val)) {
2311
+ return options.long ? fmtLong(val) : fmtShort(val);
2312
+ }
2313
+ throw new Error(
2314
+ 'val is not a non-empty string or a valid number. val=' +
2315
+ JSON.stringify(val)
2316
+ );
2317
+ };
2318
+
2319
+ /**
2320
+ * Parse the given `str` and return milliseconds.
2321
+ *
2322
+ * @param {String} str
2323
+ * @return {Number}
2324
+ * @api private
2325
+ */
2326
+
2327
+ function parse(str) {
2328
+ str = String(str);
2329
+ if (str.length > 100) {
2330
+ return;
2331
+ }
2332
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
2333
+ str
2334
+ );
2335
+ if (!match) {
2336
+ return;
2337
+ }
2338
+ var n = parseFloat(match[1]);
2339
+ var type = (match[2] || 'ms').toLowerCase();
2340
+ switch (type) {
2341
+ case 'years':
2342
+ case 'year':
2343
+ case 'yrs':
2344
+ case 'yr':
2345
+ case 'y':
2346
+ return n * y;
2347
+ case 'weeks':
2348
+ case 'week':
2349
+ case 'w':
2350
+ return n * w;
2351
+ case 'days':
2352
+ case 'day':
2353
+ case 'd':
2354
+ return n * d;
2355
+ case 'hours':
2356
+ case 'hour':
2357
+ case 'hrs':
2358
+ case 'hr':
2359
+ case 'h':
2360
+ return n * h;
2361
+ case 'minutes':
2362
+ case 'minute':
2363
+ case 'mins':
2364
+ case 'min':
2365
+ case 'm':
2366
+ return n * m;
2367
+ case 'seconds':
2368
+ case 'second':
2369
+ case 'secs':
2370
+ case 'sec':
2371
+ case 's':
2372
+ return n * s;
2373
+ case 'milliseconds':
2374
+ case 'millisecond':
2375
+ case 'msecs':
2376
+ case 'msec':
2377
+ case 'ms':
2378
+ return n;
2379
+ default:
2380
+ return undefined;
2381
+ }
2382
+ }
2383
+
2384
+ /**
2385
+ * Short format for `ms`.
2386
+ *
2387
+ * @param {Number} ms
2388
+ * @return {String}
2389
+ * @api private
2390
+ */
2391
+
2392
+ function fmtShort(ms) {
2393
+ var msAbs = Math.abs(ms);
2394
+ if (msAbs >= d) {
2395
+ return Math.round(ms / d) + 'd';
2396
+ }
2397
+ if (msAbs >= h) {
2398
+ return Math.round(ms / h) + 'h';
2399
+ }
2400
+ if (msAbs >= m) {
2401
+ return Math.round(ms / m) + 'm';
2402
+ }
2403
+ if (msAbs >= s) {
2404
+ return Math.round(ms / s) + 's';
2405
+ }
2406
+ return ms + 'ms';
2407
+ }
2408
+
2409
+ /**
2410
+ * Long format for `ms`.
2411
+ *
2412
+ * @param {Number} ms
2413
+ * @return {String}
2414
+ * @api private
2415
+ */
2416
+
2417
+ function fmtLong(ms) {
2418
+ var msAbs = Math.abs(ms);
2419
+ if (msAbs >= d) {
2420
+ return plural(ms, msAbs, d, 'day');
2421
+ }
2422
+ if (msAbs >= h) {
2423
+ return plural(ms, msAbs, h, 'hour');
2424
+ }
2425
+ if (msAbs >= m) {
2426
+ return plural(ms, msAbs, m, 'minute');
2427
+ }
2428
+ if (msAbs >= s) {
2429
+ return plural(ms, msAbs, s, 'second');
2430
+ }
2431
+ return ms + ' ms';
2432
+ }
2433
+
2434
+ /**
2435
+ * Pluralization helper.
2436
+ */
2437
+
2438
+ function plural(ms, msAbs, n, name) {
2439
+ var isPlural = msAbs >= n * 1.5;
2440
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
2441
+ }
2442
+
2443
+ /**
2444
+ * This is the common logic for both the Node.js and web browser
2445
+ * implementations of `debug()`.
2446
+ */
2447
+
2448
+ function setup(env) {
2449
+ createDebug.debug = createDebug;
2450
+ createDebug.default = createDebug;
2451
+ createDebug.coerce = coerce;
2452
+ createDebug.disable = disable;
2453
+ createDebug.enable = enable;
2454
+ createDebug.enabled = enabled;
2455
+ createDebug.humanize = ms;
2456
+ createDebug.destroy = destroy;
2457
+
2458
+ Object.keys(env).forEach(key => {
2459
+ createDebug[key] = env[key];
2460
+ });
2461
+
2462
+ /**
2463
+ * The currently active debug mode names, and names to skip.
2464
+ */
2465
+
2466
+ createDebug.names = [];
2467
+ createDebug.skips = [];
2468
+
2469
+ /**
2470
+ * Map of special "%n" handling functions, for the debug "format" argument.
2471
+ *
2472
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
2473
+ */
2474
+ createDebug.formatters = {};
2475
+
2476
+ /**
2477
+ * Selects a color for a debug namespace
2478
+ * @param {String} namespace The namespace string for the debug instance to be colored
2479
+ * @return {Number|String} An ANSI color code for the given namespace
2480
+ * @api private
2481
+ */
2482
+ function selectColor(namespace) {
2483
+ let hash = 0;
2484
+
2485
+ for (let i = 0; i < namespace.length; i++) {
2486
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
2487
+ hash |= 0; // Convert to 32bit integer
2488
+ }
2489
+
2490
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
2491
+ }
2492
+ createDebug.selectColor = selectColor;
2493
+
2494
+ /**
2495
+ * Create a debugger with the given `namespace`.
2496
+ *
2497
+ * @param {String} namespace
2498
+ * @return {Function}
2499
+ * @api public
2500
+ */
2501
+ function createDebug(namespace) {
2502
+ let prevTime;
2503
+ let enableOverride = null;
2504
+ let namespacesCache;
2505
+ let enabledCache;
2506
+
2507
+ function debug(...args) {
2508
+ // Disabled?
2509
+ if (!debug.enabled) {
2510
+ return;
2511
+ }
2512
+
2513
+ const self = debug;
2514
+
2515
+ // Set `diff` timestamp
2516
+ const curr = Number(new Date());
2517
+ const ms = curr - (prevTime || curr);
2518
+ self.diff = ms;
2519
+ self.prev = prevTime;
2520
+ self.curr = curr;
2521
+ prevTime = curr;
2522
+
2523
+ args[0] = createDebug.coerce(args[0]);
2524
+
2525
+ if (typeof args[0] !== 'string') {
2526
+ // Anything else let's inspect with %O
2527
+ args.unshift('%O');
2528
+ }
2529
+
2530
+ // Apply any `formatters` transformations
2531
+ let index = 0;
2532
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
2533
+ // If we encounter an escaped % then don't increase the array index
2534
+ if (match === '%%') {
2535
+ return '%';
2536
+ }
2537
+ index++;
2538
+ const formatter = createDebug.formatters[format];
2539
+ if (typeof formatter === 'function') {
2540
+ const val = args[index];
2541
+ match = formatter.call(self, val);
2542
+
2543
+ // Now we need to remove `args[index]` since it's inlined in the `format`
2544
+ args.splice(index, 1);
2545
+ index--;
2546
+ }
2547
+ return match;
2548
+ });
2549
+
2550
+ // Apply env-specific formatting (colors, etc.)
2551
+ createDebug.formatArgs.call(self, args);
2552
+
2553
+ const logFn = self.log || createDebug.log;
2554
+ logFn.apply(self, args);
2555
+ }
2556
+
2557
+ debug.namespace = namespace;
2558
+ debug.useColors = createDebug.useColors();
2559
+ debug.color = createDebug.selectColor(namespace);
2560
+ debug.extend = extend;
2561
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
2562
+
2563
+ Object.defineProperty(debug, 'enabled', {
2564
+ enumerable: true,
2565
+ configurable: false,
2566
+ get: () => {
2567
+ if (enableOverride !== null) {
2568
+ return enableOverride;
2569
+ }
2570
+ if (namespacesCache !== createDebug.namespaces) {
2571
+ namespacesCache = createDebug.namespaces;
2572
+ enabledCache = createDebug.enabled(namespace);
2573
+ }
2574
+
2575
+ return enabledCache;
2576
+ },
2577
+ set: v => {
2578
+ enableOverride = v;
2579
+ }
2580
+ });
2581
+
2582
+ // Env-specific initialization logic for debug instances
2583
+ if (typeof createDebug.init === 'function') {
2584
+ createDebug.init(debug);
2585
+ }
2586
+
2587
+ return debug;
2588
+ }
2589
+
2590
+ function extend(namespace, delimiter) {
2591
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
2592
+ newDebug.log = this.log;
2593
+ return newDebug;
2594
+ }
2595
+
2596
+ /**
2597
+ * Enables a debug mode by namespaces. This can include modes
2598
+ * separated by a colon and wildcards.
2599
+ *
2600
+ * @param {String} namespaces
2601
+ * @api public
2602
+ */
2603
+ function enable(namespaces) {
2604
+ createDebug.save(namespaces);
2605
+ createDebug.namespaces = namespaces;
2606
+
2607
+ createDebug.names = [];
2608
+ createDebug.skips = [];
2609
+
2610
+ let i;
2611
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
2612
+ const len = split.length;
2613
+
2614
+ for (i = 0; i < len; i++) {
2615
+ if (!split[i]) {
2616
+ // ignore empty strings
2617
+ continue;
2618
+ }
2619
+
2620
+ namespaces = split[i].replace(/\*/g, '.*?');
2621
+
2622
+ if (namespaces[0] === '-') {
2623
+ createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
2624
+ } else {
2625
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
2626
+ }
2627
+ }
2628
+ }
2629
+
2630
+ /**
2631
+ * Disable debug output.
2632
+ *
2633
+ * @return {String} namespaces
2634
+ * @api public
2635
+ */
2636
+ function disable() {
2637
+ const namespaces = [
2638
+ ...createDebug.names.map(toNamespace),
2639
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
2640
+ ].join(',');
2641
+ createDebug.enable('');
2642
+ return namespaces;
2643
+ }
2644
+
2645
+ /**
2646
+ * Returns true if the given mode name is enabled, false otherwise.
2647
+ *
2648
+ * @param {String} name
2649
+ * @return {Boolean}
2650
+ * @api public
2651
+ */
2652
+ function enabled(name) {
2653
+ if (name[name.length - 1] === '*') {
2654
+ return true;
2655
+ }
2656
+
2657
+ let i;
2658
+ let len;
2659
+
2660
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
2661
+ if (createDebug.skips[i].test(name)) {
2662
+ return false;
2663
+ }
2664
+ }
2665
+
2666
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
2667
+ if (createDebug.names[i].test(name)) {
2668
+ return true;
2669
+ }
2670
+ }
2671
+
2672
+ return false;
2673
+ }
2674
+
2675
+ /**
2676
+ * Convert regexp to namespace
2677
+ *
2678
+ * @param {RegExp} regxep
2679
+ * @return {String} namespace
2680
+ * @api private
2681
+ */
2682
+ function toNamespace(regexp) {
2683
+ return regexp.toString()
2684
+ .substring(2, regexp.toString().length - 2)
2685
+ .replace(/\.\*\?$/, '*');
2686
+ }
2687
+
2688
+ /**
2689
+ * Coerce `val`.
2690
+ *
2691
+ * @param {Mixed} val
2692
+ * @return {Mixed}
2693
+ * @api private
2694
+ */
2695
+ function coerce(val) {
2696
+ if (val instanceof Error) {
2697
+ return val.stack || val.message;
2698
+ }
2699
+ return val;
2700
+ }
2701
+
2702
+ /**
2703
+ * XXX DO NOT USE. This is a temporary stub function.
2704
+ * XXX It WILL be removed in the next major release.
2705
+ */
2706
+ function destroy() {
2707
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
2708
+ }
2709
+
2710
+ createDebug.enable(createDebug.load());
2711
+
2712
+ return createDebug;
2713
+ }
2714
+
2715
+ var common = setup;
2716
+
2717
+ /* eslint-env browser */
2718
+
2719
+ (function (module, exports) {
2720
+ /**
2721
+ * This is the web browser implementation of `debug()`.
2722
+ */
2723
+
2724
+ exports.formatArgs = formatArgs;
2725
+ exports.save = save;
2726
+ exports.load = load;
2727
+ exports.useColors = useColors;
2728
+ exports.storage = localstorage();
2729
+ exports.destroy = (() => {
2730
+ let warned = false;
2731
+
2732
+ return () => {
2733
+ if (!warned) {
2734
+ warned = true;
2735
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
2736
+ }
2737
+ };
2738
+ })();
2739
+
2740
+ /**
2741
+ * Colors.
2742
+ */
2743
+
2744
+ exports.colors = [
2745
+ '#0000CC',
2746
+ '#0000FF',
2747
+ '#0033CC',
2748
+ '#0033FF',
2749
+ '#0066CC',
2750
+ '#0066FF',
2751
+ '#0099CC',
2752
+ '#0099FF',
2753
+ '#00CC00',
2754
+ '#00CC33',
2755
+ '#00CC66',
2756
+ '#00CC99',
2757
+ '#00CCCC',
2758
+ '#00CCFF',
2759
+ '#3300CC',
2760
+ '#3300FF',
2761
+ '#3333CC',
2762
+ '#3333FF',
2763
+ '#3366CC',
2764
+ '#3366FF',
2765
+ '#3399CC',
2766
+ '#3399FF',
2767
+ '#33CC00',
2768
+ '#33CC33',
2769
+ '#33CC66',
2770
+ '#33CC99',
2771
+ '#33CCCC',
2772
+ '#33CCFF',
2773
+ '#6600CC',
2774
+ '#6600FF',
2775
+ '#6633CC',
2776
+ '#6633FF',
2777
+ '#66CC00',
2778
+ '#66CC33',
2779
+ '#9900CC',
2780
+ '#9900FF',
2781
+ '#9933CC',
2782
+ '#9933FF',
2783
+ '#99CC00',
2784
+ '#99CC33',
2785
+ '#CC0000',
2786
+ '#CC0033',
2787
+ '#CC0066',
2788
+ '#CC0099',
2789
+ '#CC00CC',
2790
+ '#CC00FF',
2791
+ '#CC3300',
2792
+ '#CC3333',
2793
+ '#CC3366',
2794
+ '#CC3399',
2795
+ '#CC33CC',
2796
+ '#CC33FF',
2797
+ '#CC6600',
2798
+ '#CC6633',
2799
+ '#CC9900',
2800
+ '#CC9933',
2801
+ '#CCCC00',
2802
+ '#CCCC33',
2803
+ '#FF0000',
2804
+ '#FF0033',
2805
+ '#FF0066',
2806
+ '#FF0099',
2807
+ '#FF00CC',
2808
+ '#FF00FF',
2809
+ '#FF3300',
2810
+ '#FF3333',
2811
+ '#FF3366',
2812
+ '#FF3399',
2813
+ '#FF33CC',
2814
+ '#FF33FF',
2815
+ '#FF6600',
2816
+ '#FF6633',
2817
+ '#FF9900',
2818
+ '#FF9933',
2819
+ '#FFCC00',
2820
+ '#FFCC33'
2821
+ ];
2822
+
2823
+ /**
2824
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2825
+ * and the Firebug extension (any Firefox version) are known
2826
+ * to support "%c" CSS customizations.
2827
+ *
2828
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
2829
+ */
2830
+
2831
+ // eslint-disable-next-line complexity
2832
+ function useColors() {
2833
+ // NB: In an Electron preload script, document will be defined but not fully
2834
+ // initialized. Since we know we're in Chrome, we'll just detect this case
2835
+ // explicitly
2836
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2837
+ return true;
2838
+ }
2839
+
2840
+ // Internet Explorer and Edge do not support colors.
2841
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2842
+ return false;
2843
+ }
2844
+
2845
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
2846
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2847
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
2848
+ // Is firebug? http://stackoverflow.com/a/398120/376773
2849
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
2850
+ // Is firefox >= v31?
2851
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2852
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
2853
+ // Double check webkit in userAgent just in case we are in a worker
2854
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
2855
+ }
2856
+
2857
+ /**
2858
+ * Colorize log arguments if enabled.
2859
+ *
2860
+ * @api public
2861
+ */
2862
+
2863
+ function formatArgs(args) {
2864
+ args[0] = (this.useColors ? '%c' : '') +
2865
+ this.namespace +
2866
+ (this.useColors ? ' %c' : ' ') +
2867
+ args[0] +
2868
+ (this.useColors ? '%c ' : ' ') +
2869
+ '+' + module.exports.humanize(this.diff);
2870
+
2871
+ if (!this.useColors) {
2872
+ return;
2873
+ }
2874
+
2875
+ const c = 'color: ' + this.color;
2876
+ args.splice(1, 0, c, 'color: inherit');
2877
+
2878
+ // The final "%c" is somewhat tricky, because there could be other
2879
+ // arguments passed either before or after the %c, so we need to
2880
+ // figure out the correct index to insert the CSS into
2881
+ let index = 0;
2882
+ let lastC = 0;
2883
+ args[0].replace(/%[a-zA-Z%]/g, match => {
2884
+ if (match === '%%') {
2885
+ return;
2886
+ }
2887
+ index++;
2888
+ if (match === '%c') {
2889
+ // We only are interested in the *last* %c
2890
+ // (the user may have provided their own)
2891
+ lastC = index;
2892
+ }
2893
+ });
2894
+
2895
+ args.splice(lastC, 0, c);
2896
+ }
2897
+
2898
+ /**
2899
+ * Invokes `console.debug()` when available.
2900
+ * No-op when `console.debug` is not a "function".
2901
+ * If `console.debug` is not available, falls back
2902
+ * to `console.log`.
2903
+ *
2904
+ * @api public
2905
+ */
2906
+ exports.log = console.debug || console.log || (() => {});
2907
+
2908
+ /**
2909
+ * Save `namespaces`.
2910
+ *
2911
+ * @param {String} namespaces
2912
+ * @api private
2913
+ */
2914
+ function save(namespaces) {
2915
+ try {
2916
+ if (namespaces) {
2917
+ exports.storage.setItem('debug', namespaces);
2918
+ } else {
2919
+ exports.storage.removeItem('debug');
2920
+ }
2921
+ } catch (error) {
2922
+ // Swallow
2923
+ // XXX (@Qix-) should we be logging these?
2924
+ }
2925
+ }
2926
+
2927
+ /**
2928
+ * Load `namespaces`.
2929
+ *
2930
+ * @return {String} returns the previously persisted debug modes
2931
+ * @api private
2932
+ */
2933
+ function load() {
2934
+ let r;
2935
+ try {
2936
+ r = exports.storage.getItem('debug');
2937
+ } catch (error) {
2938
+ // Swallow
2939
+ // XXX (@Qix-) should we be logging these?
2940
+ }
2941
+
2942
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2943
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
2944
+ r = process.env.DEBUG;
2945
+ }
2946
+
2947
+ return r;
2948
+ }
2949
+
2950
+ /**
2951
+ * Localstorage attempts to return the localstorage.
2952
+ *
2953
+ * This is necessary because safari throws
2954
+ * when a user disables cookies/localstorage
2955
+ * and you attempt to access it.
2956
+ *
2957
+ * @return {LocalStorage}
2958
+ * @api private
2959
+ */
2960
+
2961
+ function localstorage() {
2962
+ try {
2963
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2964
+ // The Browser also has localStorage in the global context.
2965
+ return localStorage;
2966
+ } catch (error) {
2967
+ // Swallow
2968
+ // XXX (@Qix-) should we be logging these?
2969
+ }
2970
+ }
2971
+
2972
+ module.exports = common(exports);
2973
+
2974
+ const {formatters} = module.exports;
2975
+
2976
+ /**
2977
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2978
+ */
2979
+
2980
+ formatters.j = function (v) {
2981
+ try {
2982
+ return JSON.stringify(v);
2983
+ } catch (error) {
2984
+ return '[UnexpectedJSONParseError]: ' + error.message;
2985
+ }
2986
+ };
2987
+ }(browser, browser.exports));
2988
+
2989
+ var node = {exports: {}};
2990
+
2991
+ var hasFlag$1 = (flag, argv = process.argv) => {
2992
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
2993
+ const position = argv.indexOf(prefix + flag);
2994
+ const terminatorPosition = argv.indexOf('--');
2995
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2996
+ };
2997
+
2998
+ const os = require$$0__default["default"];
2999
+ const tty = require$$1__default["default"];
3000
+ const hasFlag = hasFlag$1;
3001
+
3002
+ const {env} = process;
3003
+
3004
+ let forceColor;
3005
+ if (hasFlag('no-color') ||
3006
+ hasFlag('no-colors') ||
3007
+ hasFlag('color=false') ||
3008
+ hasFlag('color=never')) {
3009
+ forceColor = 0;
3010
+ } else if (hasFlag('color') ||
3011
+ hasFlag('colors') ||
3012
+ hasFlag('color=true') ||
3013
+ hasFlag('color=always')) {
3014
+ forceColor = 1;
3015
+ }
3016
+
3017
+ if ('FORCE_COLOR' in env) {
3018
+ if (env.FORCE_COLOR === 'true') {
3019
+ forceColor = 1;
3020
+ } else if (env.FORCE_COLOR === 'false') {
3021
+ forceColor = 0;
3022
+ } else {
3023
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
3024
+ }
3025
+ }
3026
+
3027
+ function translateLevel(level) {
3028
+ if (level === 0) {
3029
+ return false;
3030
+ }
3031
+
3032
+ return {
3033
+ level,
3034
+ hasBasic: true,
3035
+ has256: level >= 2,
3036
+ has16m: level >= 3
3037
+ };
3038
+ }
3039
+
3040
+ function supportsColor(haveStream, streamIsTTY) {
3041
+ if (forceColor === 0) {
3042
+ return 0;
3043
+ }
3044
+
3045
+ if (hasFlag('color=16m') ||
3046
+ hasFlag('color=full') ||
3047
+ hasFlag('color=truecolor')) {
3048
+ return 3;
3049
+ }
3050
+
3051
+ if (hasFlag('color=256')) {
3052
+ return 2;
3053
+ }
3054
+
3055
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
3056
+ return 0;
3057
+ }
3058
+
3059
+ const min = forceColor || 0;
3060
+
3061
+ if (env.TERM === 'dumb') {
3062
+ return min;
3063
+ }
3064
+
3065
+ if (process.platform === 'win32') {
3066
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
3067
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
3068
+ const osRelease = os.release().split('.');
3069
+ if (
3070
+ Number(osRelease[0]) >= 10 &&
3071
+ Number(osRelease[2]) >= 10586
3072
+ ) {
3073
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
3074
+ }
3075
+
3076
+ return 1;
3077
+ }
3078
+
3079
+ if ('CI' in env) {
3080
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
3081
+ return 1;
3082
+ }
3083
+
3084
+ return min;
3085
+ }
3086
+
3087
+ if ('TEAMCITY_VERSION' in env) {
3088
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3089
+ }
3090
+
3091
+ if (env.COLORTERM === 'truecolor') {
3092
+ return 3;
3093
+ }
3094
+
3095
+ if ('TERM_PROGRAM' in env) {
3096
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
3097
+
3098
+ switch (env.TERM_PROGRAM) {
3099
+ case 'iTerm.app':
3100
+ return version >= 3 ? 3 : 2;
3101
+ case 'Apple_Terminal':
3102
+ return 2;
3103
+ // No default
3104
+ }
3105
+ }
3106
+
3107
+ if (/-256(color)?$/i.test(env.TERM)) {
3108
+ return 2;
3109
+ }
3110
+
3111
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
3112
+ return 1;
3113
+ }
3114
+
3115
+ if ('COLORTERM' in env) {
3116
+ return 1;
3117
+ }
3118
+
3119
+ return min;
3120
+ }
3121
+
3122
+ function getSupportLevel(stream) {
3123
+ const level = supportsColor(stream, stream && stream.isTTY);
3124
+ return translateLevel(level);
3125
+ }
3126
+
3127
+ var supportsColor_1 = {
3128
+ supportsColor: getSupportLevel,
3129
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
3130
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
3131
+ };
3132
+
3133
+ /**
3134
+ * Module dependencies.
3135
+ */
3136
+
3137
+ (function (module, exports) {
3138
+ const tty = require$$1__default["default"];
3139
+ const util = require$$1__default$1["default"];
3140
+
3141
+ /**
3142
+ * This is the Node.js implementation of `debug()`.
3143
+ */
3144
+
3145
+ exports.init = init;
3146
+ exports.log = log;
3147
+ exports.formatArgs = formatArgs;
3148
+ exports.save = save;
3149
+ exports.load = load;
3150
+ exports.useColors = useColors;
3151
+ exports.destroy = util.deprecate(
3152
+ () => {},
3153
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
3154
+ );
3155
+
3156
+ /**
3157
+ * Colors.
3158
+ */
3159
+
3160
+ exports.colors = [6, 2, 3, 4, 5, 1];
3161
+
3162
+ try {
3163
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
3164
+ // eslint-disable-next-line import/no-extraneous-dependencies
3165
+ const supportsColor = supportsColor_1;
3166
+
3167
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
3168
+ exports.colors = [
3169
+ 20,
3170
+ 21,
3171
+ 26,
3172
+ 27,
3173
+ 32,
3174
+ 33,
3175
+ 38,
3176
+ 39,
3177
+ 40,
3178
+ 41,
3179
+ 42,
3180
+ 43,
3181
+ 44,
3182
+ 45,
3183
+ 56,
3184
+ 57,
3185
+ 62,
3186
+ 63,
3187
+ 68,
3188
+ 69,
3189
+ 74,
3190
+ 75,
3191
+ 76,
3192
+ 77,
3193
+ 78,
3194
+ 79,
3195
+ 80,
3196
+ 81,
3197
+ 92,
3198
+ 93,
3199
+ 98,
3200
+ 99,
3201
+ 112,
3202
+ 113,
3203
+ 128,
3204
+ 129,
3205
+ 134,
3206
+ 135,
3207
+ 148,
3208
+ 149,
3209
+ 160,
3210
+ 161,
3211
+ 162,
3212
+ 163,
3213
+ 164,
3214
+ 165,
3215
+ 166,
3216
+ 167,
3217
+ 168,
3218
+ 169,
3219
+ 170,
3220
+ 171,
3221
+ 172,
3222
+ 173,
3223
+ 178,
3224
+ 179,
3225
+ 184,
3226
+ 185,
3227
+ 196,
3228
+ 197,
3229
+ 198,
3230
+ 199,
3231
+ 200,
3232
+ 201,
3233
+ 202,
3234
+ 203,
3235
+ 204,
3236
+ 205,
3237
+ 206,
3238
+ 207,
3239
+ 208,
3240
+ 209,
3241
+ 214,
3242
+ 215,
3243
+ 220,
3244
+ 221
3245
+ ];
3246
+ }
3247
+ } catch (error) {
3248
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
3249
+ }
3250
+
3251
+ /**
3252
+ * Build up the default `inspectOpts` object from the environment variables.
3253
+ *
3254
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
3255
+ */
3256
+
3257
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
3258
+ return /^debug_/i.test(key);
3259
+ }).reduce((obj, key) => {
3260
+ // Camel-case
3261
+ const prop = key
3262
+ .substring(6)
3263
+ .toLowerCase()
3264
+ .replace(/_([a-z])/g, (_, k) => {
3265
+ return k.toUpperCase();
3266
+ });
3267
+
3268
+ // Coerce string value into JS value
3269
+ let val = process.env[key];
3270
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
3271
+ val = true;
3272
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
3273
+ val = false;
3274
+ } else if (val === 'null') {
3275
+ val = null;
3276
+ } else {
3277
+ val = Number(val);
3278
+ }
3279
+
3280
+ obj[prop] = val;
3281
+ return obj;
3282
+ }, {});
3283
+
3284
+ /**
3285
+ * Is stdout a TTY? Colored output is enabled when `true`.
3286
+ */
3287
+
3288
+ function useColors() {
3289
+ return 'colors' in exports.inspectOpts ?
3290
+ Boolean(exports.inspectOpts.colors) :
3291
+ tty.isatty(process.stderr.fd);
3292
+ }
3293
+
3294
+ /**
3295
+ * Adds ANSI color escape codes if enabled.
3296
+ *
3297
+ * @api public
3298
+ */
3299
+
3300
+ function formatArgs(args) {
3301
+ const {namespace: name, useColors} = this;
3302
+
3303
+ if (useColors) {
3304
+ const c = this.color;
3305
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
3306
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
3307
+
3308
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
3309
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
3310
+ } else {
3311
+ args[0] = getDate() + name + ' ' + args[0];
3312
+ }
3313
+ }
3314
+
3315
+ function getDate() {
3316
+ if (exports.inspectOpts.hideDate) {
3317
+ return '';
3318
+ }
3319
+ return new Date().toISOString() + ' ';
3320
+ }
3321
+
3322
+ /**
3323
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
3324
+ */
3325
+
3326
+ function log(...args) {
3327
+ return process.stderr.write(util.format(...args) + '\n');
3328
+ }
3329
+
3330
+ /**
3331
+ * Save `namespaces`.
3332
+ *
3333
+ * @param {String} namespaces
3334
+ * @api private
3335
+ */
3336
+ function save(namespaces) {
3337
+ if (namespaces) {
3338
+ process.env.DEBUG = namespaces;
3339
+ } else {
3340
+ // If you set a process.env field to null or undefined, it gets cast to the
3341
+ // string 'null' or 'undefined'. Just delete instead.
3342
+ delete process.env.DEBUG;
3343
+ }
3344
+ }
3345
+
3346
+ /**
3347
+ * Load `namespaces`.
3348
+ *
3349
+ * @return {String} returns the previously persisted debug modes
3350
+ * @api private
3351
+ */
3352
+
3353
+ function load() {
3354
+ return process.env.DEBUG;
3355
+ }
3356
+
3357
+ /**
3358
+ * Init logic for `debug` instances.
3359
+ *
3360
+ * Create a new `inspectOpts` object in case `useColors` is set
3361
+ * differently for a particular `debug` instance.
3362
+ */
3363
+
3364
+ function init(debug) {
3365
+ debug.inspectOpts = {};
3366
+
3367
+ const keys = Object.keys(exports.inspectOpts);
3368
+ for (let i = 0; i < keys.length; i++) {
3369
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
3370
+ }
3371
+ }
3372
+
3373
+ module.exports = common(exports);
3374
+
3375
+ const {formatters} = module.exports;
3376
+
3377
+ /**
3378
+ * Map %o to `util.inspect()`, all on a single line.
3379
+ */
3380
+
3381
+ formatters.o = function (v) {
3382
+ this.inspectOpts.colors = this.useColors;
3383
+ return util.inspect(v, this.inspectOpts)
3384
+ .split('\n')
3385
+ .map(str => str.trim())
3386
+ .join(' ');
3387
+ };
3388
+
3389
+ /**
3390
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
3391
+ */
3392
+
3393
+ formatters.O = function (v) {
3394
+ this.inspectOpts.colors = this.useColors;
3395
+ return util.inspect(v, this.inspectOpts);
3396
+ };
3397
+ }(node, node.exports));
3398
+
3399
+ /**
3400
+ * Detect Electron renderer / nwjs process, which is node, but we should
3401
+ * treat as a browser.
3402
+ */
3403
+
3404
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3405
+ src.exports = browser.exports;
3406
+ } else {
3407
+ src.exports = node.exports;
3408
+ }
3409
+
3410
+ var Debug = src.exports;
3411
+
3412
+ var log = Debug('ninetailed:experience-sdk');
3413
+ var enable = function enable() {
3414
+ Debug.enable('ninetailed:experience-sdk');
3415
+ };
3416
+ var disable = function disable() {
3417
+ return Debug.disable();
3418
+ };
3419
+
3420
+ var BASE_URL = 'https://api.ninetailed.co';
3421
+
3422
+ var fetchWithTimeout = function fetchWithTimeout(input, init) {
3423
+ return __awaiter(void 0, void 0, void 0, function () {
3424
+ var timeout, controller, id, response;
3425
+ return __generator(this, function (_a) {
3426
+ switch (_a.label) {
3427
+ case 0:
3428
+ timeout = init.timeout;
3429
+ controller = new AbortController();
3430
+ id = setTimeout(function () {
3431
+ log("Profile Request timed out.");
3432
+ controller.abort();
3433
+ }, timeout);
3434
+ return [4
3435
+ /*yield*/
3436
+ , fetch(input, __assign(__assign({}, init), {
3437
+ signal: controller.signal
3438
+ }))];
3439
+
3440
+ case 1:
3441
+ response = _a.sent();
3442
+ clearTimeout(id);
3443
+ return [2
3444
+ /*return*/
3445
+ , response];
3446
+ }
3447
+ });
3448
+ });
3449
+ };
3450
+
3451
+ var NinetailedApiClient =
3452
+ /** @class */
3453
+ function () {
3454
+ function NinetailedApiClient(_a) {
3455
+ var apiKey = _a.apiKey,
3456
+ _b = _a.url,
3457
+ url = _b === void 0 ? BASE_URL : _b;
3458
+ this.apiKey = apiKey;
3459
+ this.url = url;
3460
+ }
3461
+
3462
+ NinetailedApiClient.prototype.profile = function (options) {
3463
+ return __awaiter(this, void 0, void 0, function () {
3464
+ var events, anonymousId, body, request, data, error_1;
3465
+ return __generator(this, function (_a) {
3466
+ switch (_a.label) {
3467
+ case 0:
3468
+ log('Sending Profile Request.');
3469
+ events = options.events;
3470
+ anonymousId = events[0].anonymousId;
3471
+ body = options;
3472
+ log('Profile Request Body: ', body);
3473
+ _a.label = 1;
3474
+
3475
+ case 1:
3476
+ _a.trys.push([1, 4,, 5]);
3477
+
3478
+ return [4
3479
+ /*yield*/
3480
+ , fetchWithTimeout("".concat(this.url, "/profile/").concat(anonymousId, "/events"), {
3481
+ method: 'POST',
3482
+ headers: {
3483
+ 'Content-Type': 'application/json',
3484
+ 'x-ninetailed-api-key': this.apiKey
3485
+ },
3486
+ body: JSON.stringify(body),
3487
+ timeout: 8000
3488
+ })];
3489
+
3490
+ case 2:
3491
+ request = _a.sent();
3492
+ log('Profile Request: ', request);
3493
+ return [4
3494
+ /*yield*/
3495
+ , request.json()];
3496
+
3497
+ case 3:
3498
+ data = _a.sent().data;
3499
+ log('Profile Request completed.');
3500
+ return [2
3501
+ /*return*/
3502
+ , data];
3503
+
3504
+ case 4:
3505
+ error_1 = _a.sent(); // TODO only during debug.
3506
+
3507
+ log(error_1);
3508
+ throw error_1;
3509
+
3510
+ case 5:
3511
+ return [2
3512
+ /*return*/
3513
+ ];
3514
+ }
3515
+ });
3516
+ });
3517
+ };
3518
+
3519
+ return NinetailedApiClient;
3520
+ }();
3521
+
3522
+ var NINETAILED_TRACKER_EVENTS = {
3523
+ /**
3524
+ * `profile` - Fires when the profile is returned by the cdp API.
3525
+ */
3526
+ profile: 'profile'
3527
+ };
3528
+ var PLUGIN_NAME = 'ninetailed';
3529
+
3530
+ var delay = function delay(ms) {
3531
+ return new Promise(function (resolve) {
3532
+ return setTimeout(resolve, ms);
3533
+ });
3534
+ };
3535
+
3536
+ var ninetailedPlugin = function ninetailedPlugin(_a) {
3537
+ var apiKey = _a.apiKey,
3538
+ url = _a.url,
3539
+ profile = _a.profile,
3540
+ locale = _a.locale;
3541
+ var apiClient = new NinetailedApiClient({
3542
+ apiKey: apiKey,
3543
+ url: url
3544
+ });
3545
+ var queue = [];
3546
+ var localOnly = false;
3547
+
3548
+ var flush = function flush(instance) {
3549
+ return __awaiter(void 0, void 0, void 0, function () {
3550
+ var events, cache, _a, profile_1, signals, traitsUpdatedAt, sessions, updatedCache, error_1;
3551
+
3552
+ return __generator(this, function (_b) {
3553
+ switch (_b.label) {
3554
+ case 0:
3555
+ events = Object.assign([], queue);
3556
+ log('Start flushing events.');
3557
+ queue = [];
3558
+
3559
+ if (!events.length) {
3560
+ return [2
3561
+ /*return*/
3562
+ ];
3563
+ }
3564
+
3565
+ cache = get({
3566
+ instance: instance
3567
+ });
3568
+ _b.label = 1;
3569
+
3570
+ case 1:
3571
+ _b.trys.push([1, 3,, 4]);
3572
+
3573
+ log('Cache: ', cache);
3574
+ return [4
3575
+ /*yield*/
3576
+ , apiClient.profile({
3577
+ events: events,
3578
+ signals: get__default["default"](cache, 'signals', {}),
3579
+ traits: get__default["default"](cache, 'traits', {}),
3580
+ traitsUpdatedAt: get__default["default"](cache, 'traitsUpdatedAt', new Date().toISOString()),
3581
+ localOnly: localOnly,
3582
+ options: {
3583
+ locale: locale || 'en'
3584
+ },
3585
+ sessions: cache.sessions
3586
+ })];
3587
+
3588
+ case 2:
3589
+ _a = _b.sent(), profile_1 = _a.profile, signals = _a.signals, traitsUpdatedAt = _a.traitsUpdatedAt, sessions = _a.sessions;
3590
+ log('Profile from api: ', profile_1);
3591
+ updatedCache = set({
3592
+ id: profile_1.id,
3593
+ random: profile_1.random,
3594
+ audiences: profile_1.audiences,
3595
+ traits: profile_1.traits,
3596
+ location: profile_1.location,
3597
+ signals: signals,
3598
+ traitsUpdatedAt: traitsUpdatedAt,
3599
+ sessions: sessions,
3600
+ session: profile_1.session
3601
+ }, {
3602
+ instance: instance
3603
+ });
3604
+ instance.dispatch({
3605
+ type: NINETAILED_TRACKER_EVENTS.profile,
3606
+ profile: profile_1,
3607
+ cache: updatedCache
3608
+ });
3609
+ return [3
3610
+ /*break*/
3611
+ , 4];
3612
+
3613
+ case 3:
3614
+ error_1 = _b.sent();
3615
+ log('An error occurred during flushing the events: ', error_1);
3616
+ instance.dispatch({
3617
+ type: NINETAILED_TRACKER_EVENTS.profile,
3618
+ profile: {
3619
+ id: cache.id,
3620
+ random: cache.random,
3621
+ audiences: cache.audiences,
3622
+ traits: cache.traits,
3623
+ location: cache.location,
3624
+ session: cache.session
3625
+ },
3626
+ cache: cache
3627
+ });
3628
+ return [3
3629
+ /*break*/
3630
+ , 4];
3631
+
3632
+ case 4:
3633
+ return [2
3634
+ /*return*/
3635
+ ];
3636
+ }
3637
+ });
3638
+ });
3639
+ };
3640
+
3641
+ var throttledFlush = throttle__default["default"](flush, 200, {
3642
+ leading: false,
3643
+ trailing: true
3644
+ });
3645
+
3646
+ var createEvent = function createEvent(event, instance) {
3647
+ return __awaiter(void 0, void 0, void 0, function () {
3648
+ return __generator(this, function (_a) {
3649
+ queue = unionBy__default["default"]([event], queue, 'messageId');
3650
+ throttledFlush(instance);
3651
+ return [2
3652
+ /*return*/
3653
+ ];
3654
+ });
3655
+ });
3656
+ };
3657
+
3658
+ return {
3659
+ name: 'ninetailed',
3660
+ config: {},
3661
+ initialize: function (_a) {
3662
+ var instance = _a.instance;
3663
+ var cache = get({
3664
+ instance: instance
3665
+ });
3666
+
3667
+ if (profile) {
3668
+ instance.storage.setItem('__anon_id', profile.id);
3669
+ initialize({
3670
+ instance: instance
3671
+ }, __assign(__assign({}, cache), {
3672
+ id: profile.id
3673
+ }));
3674
+ } else {
3675
+ var anonymousId = instance.storage.getItem('__anon_id');
3676
+ initialize({
3677
+ instance: instance
3678
+ }, __assign(__assign({}, cache), {
3679
+ id: anonymousId
3680
+ }));
3681
+ }
3682
+ },
3683
+ page: function (_a) {
3684
+ var payload = _a.payload,
3685
+ instance = _a.instance;
3686
+ return __awaiter(void 0, void 0, void 0, function () {
3687
+ var ctx;
3688
+ return __generator(this, function (_b) {
3689
+ switch (_b.label) {
3690
+ case 0:
3691
+ log('Sending Page event.');
3692
+ ctx = buildClientNinetailedRequestContext();
3693
+ localOnly = payload.localOnly;
3694
+ return [4
3695
+ /*yield*/
3696
+ , createEvent(experience_jsShared.buildPageEvent({
3697
+ // doing this here as the anonymous id is set to late from init
3698
+ anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
3699
+ messageId: payload.meta.rid,
3700
+ timestamp: payload.meta.ts,
3701
+ properties: payload.properties,
3702
+ ctx: ctx
3703
+ }), instance)];
3704
+
3705
+ case 1:
3706
+ _b.sent();
3707
+
3708
+ return [2
3709
+ /*return*/
3710
+ ];
3711
+ }
3712
+ });
3713
+ });
3714
+ },
3715
+ track: function (_a) {
3716
+ var payload = _a.payload,
3717
+ instance = _a.instance;
3718
+ return __awaiter(void 0, void 0, void 0, function () {
3719
+ var ctx;
3720
+ return __generator(this, function (_b) {
3721
+ switch (_b.label) {
3722
+ case 0:
3723
+ log('Sending Track event.');
3724
+ ctx = buildClientNinetailedRequestContext();
3725
+ localOnly = payload.localOnly;
3726
+ return [4
3727
+ /*yield*/
3728
+ , createEvent(experience_jsShared.buildTrackEvent({
3729
+ // doing this here as the anonymous id is set to late from init
3730
+ anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
3731
+ messageId: payload.meta.rid,
3732
+ timestamp: payload.meta.ts,
3733
+ event: payload.event,
3734
+ properties: payload.properties,
3735
+ ctx: ctx
3736
+ }), instance)];
3737
+
3738
+ case 1:
3739
+ _b.sent();
3740
+
3741
+ return [2
3742
+ /*return*/
3743
+ ];
3744
+ }
3745
+ });
3746
+ });
3747
+ },
3748
+ identify: function (_a) {
3749
+ var payload = _a.payload,
3750
+ instance = _a.instance;
3751
+ return __awaiter(void 0, void 0, void 0, function () {
3752
+ var ctx;
3753
+ return __generator(this, function (_b) {
3754
+ switch (_b.label) {
3755
+ case 0:
3756
+ log('Sending Identify event.');
3757
+ localOnly = payload.localOnly;
3758
+ ctx = buildClientNinetailedRequestContext();
3759
+ return [4
3760
+ /*yield*/
3761
+ , createEvent(experience_jsShared.buildIdentifyEvent({
3762
+ // doing this here as the anonymous id is set to late from init
3763
+ anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
3764
+ messageId: payload.meta.rid,
3765
+ timestamp: payload.meta.ts,
3766
+ traits: payload.traits,
3767
+ userId: payload.userId,
3768
+ ctx: ctx
3769
+ }), instance)];
3770
+
3771
+ case 1:
3772
+ _b.sent();
3773
+
3774
+ return [2
3775
+ /*return*/
3776
+ ];
3777
+ }
3778
+ });
3779
+ });
3780
+ },
3781
+ loaded: function () {
3782
+ return true;
3783
+ },
3784
+ methods: {
3785
+ reset: function () {
3786
+ var args = [];
3787
+
3788
+ for (var _i = 0; _i < arguments.length; _i++) {
3789
+ args[_i] = arguments[_i];
3790
+ }
3791
+
3792
+ return __awaiter(void 0, void 0, void 0, function () {
3793
+ var instance, cache;
3794
+ return __generator(this, function (_a) {
3795
+ switch (_a.label) {
3796
+ case 0:
3797
+ instance = args[args.length - 1];
3798
+ cache = reset({
3799
+ instance: instance
3800
+ });
3801
+ return [4
3802
+ /*yield*/
3803
+ , instance.storage.setItem('__anon_id', cache.id)];
3804
+
3805
+ case 1:
3806
+ _a.sent();
3807
+
3808
+ instance.dispatch({
3809
+ type: NINETAILED_TRACKER_EVENTS.profile,
3810
+ profile: {
3811
+ id: cache.id,
3812
+ random: 0,
3813
+ audiences: [],
3814
+ traits: {},
3815
+ location: {}
3816
+ },
3817
+ cache: cache
3818
+ });
3819
+ return [4
3820
+ /*yield*/
3821
+ , delay(10)];
3822
+
3823
+ case 2:
3824
+ _a.sent();
3825
+
3826
+ return [2
3827
+ /*return*/
3828
+ ];
3829
+ }
3830
+ });
3831
+ });
3832
+ },
3833
+ debug: function (enabled) {
3834
+ if (enabled) {
3835
+ enable();
3836
+ log('Debug mode is now enabled.');
3837
+ } else {
3838
+ disable();
3839
+ log('Debug mode is now disabled.');
3840
+ }
3841
+ }
3842
+ }
3843
+ };
3844
+ };
3845
+
3846
+ var global$1 = global$A;
3847
+ var aCallable = aCallable$6;
3848
+ var toObject = toObject$3;
3849
+ var IndexedObject = indexedObject;
3850
+ var lengthOfArrayLike = lengthOfArrayLike$3;
3851
+
3852
+ var TypeError$1 = global$1.TypeError;
3853
+
3854
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
3855
+ var createMethod = function (IS_RIGHT) {
3856
+ return function (that, callbackfn, argumentsLength, memo) {
3857
+ aCallable(callbackfn);
3858
+ var O = toObject(that);
3859
+ var self = IndexedObject(O);
3860
+ var length = lengthOfArrayLike(O);
3861
+ var index = IS_RIGHT ? length - 1 : 0;
3862
+ var i = IS_RIGHT ? -1 : 1;
3863
+ if (argumentsLength < 2) while (true) {
3864
+ if (index in self) {
3865
+ memo = self[index];
3866
+ index += i;
3867
+ break;
3868
+ }
3869
+ index += i;
3870
+ if (IS_RIGHT ? index < 0 : length <= index) {
3871
+ throw TypeError$1('Reduce of empty array with no initial value');
3872
+ }
3873
+ }
3874
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
3875
+ memo = callbackfn(memo, self[index], index, O);
3876
+ }
3877
+ return memo;
3878
+ };
3879
+ };
3880
+
3881
+ var arrayReduce = {
3882
+ // `Array.prototype.reduce` method
3883
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
3884
+ left: createMethod(false),
3885
+ // `Array.prototype.reduceRight` method
3886
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
3887
+ right: createMethod(true)
3888
+ };
3889
+
3890
+ var fails = fails$b;
3891
+
3892
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
3893
+ var method = [][METHOD_NAME];
3894
+ return !!method && fails(function () {
3895
+ // eslint-disable-next-line no-useless-call -- required for testing
3896
+ method.call(null, argument || function () { return 1; }, 1);
3897
+ });
3898
+ };
3899
+
3900
+ var $ = _export;
3901
+ var $reduce = arrayReduce.left;
3902
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
3903
+ var CHROME_VERSION = engineV8Version;
3904
+ var IS_NODE = engineIsNode;
3905
+
3906
+ var STRICT_METHOD = arrayMethodIsStrict('reduce');
3907
+ // Chrome 80-82 has a critical bug
3908
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
3909
+ var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
3910
+
3911
+ // `Array.prototype.reduce` method
3912
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
3913
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
3914
+ reduce: function reduce(callbackfn /* , initialValue */) {
3915
+ var length = arguments.length;
3916
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
3917
+ }
3918
+ });
3919
+
3920
+ var Ninetailed =
3921
+ /** @class */
3922
+ function () {
3923
+ function Ninetailed(apiKey, _a) {
3924
+ var _this = this;
3925
+
3926
+ var plugins = _a.plugins,
3927
+ url = _a.url,
3928
+ profile = _a.profile,
3929
+ locale = _a.locale;
3930
+
3931
+ this.page = function (data, options) {
3932
+ return _this.instance.page(data, _this.buildOptions(options));
3933
+ };
3934
+
3935
+ this.track = function (event, payload, options) {
3936
+ return _this.instance.track(event, payload, _this.buildOptions(options));
3937
+ };
3938
+
3939
+ this.identify = function (uid, traits, options) {
3940
+ return _this.instance.identify(uid, traits, _this.buildOptions(options));
3941
+ };
3942
+
3943
+ this.reset = function () {
3944
+ return _this.instance.plugins[PLUGIN_NAME].reset();
3945
+ };
3946
+
3947
+ this.debug = function (enabled) {
3948
+ return _this.instance.plugins[PLUGIN_NAME].debug(enabled);
3949
+ };
3950
+
3951
+ this.onProfileChange = function (cb) {
3952
+ return _this.instance.on(NINETAILED_TRACKER_EVENTS.profile, function (_a) {
3953
+ var payload = _a.payload;
3954
+ cb(__assign(__assign({}, _this._profileState), {
3955
+ loading: false,
3956
+ profile: payload.profile,
3957
+ error: undefined
3958
+ }));
3959
+ });
3960
+ };
3961
+
3962
+ this.plugins = plugins || [];
3963
+ this._profileState = {
3964
+ loading: !profile,
3965
+ profile: profile,
3966
+ error: undefined,
3967
+ from: profile ? 'hydrated' : 'api'
3968
+ };
3969
+ this.instance = Analytics__default["default"]({
3970
+ app: 'ninetailed',
3971
+ plugins: [ninetailedPlugin({
3972
+ apiKey: apiKey,
3973
+ url: url,
3974
+ profile: profile,
3975
+ locale: locale
3976
+ })]
3977
+ }); // register plugins conditionally
3978
+ // const additionalPlugins: AnalyticsPlugin[] = useMemo(() => {
3979
+ // const importedPlugins = [];
3980
+ // if (options.analyticsPlugins?.googleAnalytics) {
3981
+ // importedPlugins.push(
3982
+ // googleAnalytics({
3983
+ // trackingId: options.analyticsPlugins.googleAnalytics.trackingId,
3984
+ // })
3985
+ // );
3986
+ // }
3987
+ // return importedPlugins;
3988
+ // }, []);
3989
+ // put in private method
3990
+
3991
+ this.onProfileChange(function (profileState) {
3992
+ _this._profileState = profileState;
3993
+ });
3994
+ this.registerWindowHandlers();
3995
+ }
3996
+
3997
+ Object.defineProperty(Ninetailed.prototype, "profileState", {
3998
+ get: function () {
3999
+ return this._profileState;
4000
+ },
4001
+ enumerable: false,
4002
+ configurable: true
4003
+ });
4004
+
4005
+ Ninetailed.prototype.buildOptions = function (options) {
4006
+ if (options === void 0) {
4007
+ options = {};
4008
+ }
4009
+
4010
+ return __assign(__assign({}, options), {
4011
+ plugins: __assign(__assign({
4012
+ all: false,
4013
+ ninetailed: true
4014
+ }, this.plugins.map(function (plugin) {
4015
+ return plugin;
4016
+ }).filter(function (plugin) {
4017
+ return includes__default["default"](plugin.name, 'ninetailed:');
4018
+ }).reduce(function (acc, curr) {
4019
+ var _a;
4020
+
4021
+ return __assign(__assign({}, acc), (_a = {}, _a[curr.name] = true, _a));
4022
+ }, {})), get__default["default"](options, 'plugins'))
4023
+ });
4024
+ };
4025
+
4026
+ Ninetailed.prototype.registerWindowHandlers = function () {
4027
+ if (typeof window !== 'undefined') {
4028
+ window.ninetailed = Object.assign({}, window.ninetailed, {
4029
+ page: this.page.bind(this),
4030
+ track: this.track.bind(this),
4031
+ identify: this.identify.bind(this),
4032
+ reset: this.reset.bind(this),
4033
+ debug: this.debug.bind(this)
4034
+ });
4035
+ }
4036
+ };
4037
+
4038
+ return Ninetailed;
4039
+ }();
4040
+
4041
+ var selectVariant = function selectVariant(baseline, variants, _a, options) {
4042
+ var loading = _a.loading,
4043
+ profile = _a.profile,
4044
+ error = _a.error;
4045
+
4046
+ if (options === void 0) {
4047
+ options = {
4048
+ holdout: -1
4049
+ };
4050
+ }
4051
+
4052
+ if (loading) {
4053
+ return {
4054
+ loading: true,
4055
+ variant: baseline,
4056
+ audience: {
4057
+ id: 'baseline'
4058
+ },
4059
+ isPersonalized: false,
4060
+ error: null
4061
+ };
4062
+ }
4063
+
4064
+ if (error) {
4065
+ return {
4066
+ loading: false,
4067
+ variant: baseline,
4068
+ audience: {
4069
+ id: 'baseline'
4070
+ },
4071
+ isPersonalized: false,
4072
+ error: error
4073
+ };
4074
+ }
4075
+
4076
+ var variant = find__default["default"](variants, function (variant) {
4077
+ var _a;
4078
+
4079
+ return includes__default["default"](profile === null || profile === void 0 ? void 0 : profile.audiences, (_a = variant.audience) === null || _a === void 0 ? void 0 : _a.id);
4080
+ });
4081
+
4082
+ if (variant) {
4083
+ if (options.holdout > profile.random) {
4084
+ return {
4085
+ loading: false,
4086
+ variant: baseline,
4087
+ audience: {
4088
+ id: variant.audience.id
4089
+ },
4090
+ isPersonalized: false,
4091
+ error: null
4092
+ };
4093
+ }
4094
+
4095
+ return {
4096
+ loading: false,
4097
+ variant: variant,
4098
+ audience: {
4099
+ id: variant.audience.id
4100
+ },
4101
+ isPersonalized: true,
4102
+ error: null
4103
+ };
4104
+ }
4105
+ /**
4106
+ * There was no matching audience found.
4107
+ */
4108
+
4109
+
4110
+ return {
4111
+ loading: false,
4112
+ variant: baseline,
4113
+ audience: {
4114
+ id: 'baseline'
4115
+ },
4116
+ isPersonalized: false,
4117
+ error: null
4118
+ };
4119
+ };
4120
+
4121
+ exports.NINETAILED_TRACKER_EVENTS = NINETAILED_TRACKER_EVENTS;
4122
+ exports.Ninetailed = Ninetailed;
4123
+ exports.PLUGIN_NAME = PLUGIN_NAME;
4124
+ exports.ninetailedPlugin = ninetailedPlugin;
4125
+ exports.selectVariant = selectVariant;
4126
+
4127
+ Object.defineProperty(exports, '__esModule', { value: true });
4128
+
4129
+ }));