@ninetailed/experience.js-react 3.0.1-beta.4 → 3.0.2-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 DELETED
@@ -1,2393 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@ninetailed/experience.js'), require('lodash/isEqual'), require('@ninetailed/experience.js-shared'), require('react-intersection-observer'), require('lodash/get'), require('lodash/has')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', '@ninetailed/experience.js', 'lodash/isEqual', '@ninetailed/experience.js-shared', 'react-intersection-observer', 'lodash/get', 'lodash/has'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.React = {}, global.React, global.experience_js, global.isEqual, global.experience_jsShared, global.reactIntersectionObserver, global.get$1, global.has$1));
5
- })(this, (function (exports, React, experience_js, isEqual, experience_jsShared, reactIntersectionObserver, get$1, has$1) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
- var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
11
- var get__default = /*#__PURE__*/_interopDefaultLegacy(get$1);
12
- var has__default = /*#__PURE__*/_interopDefaultLegacy(has$1);
13
-
14
- var NinetailedContext = /*#__PURE__*/React.createContext(undefined);
15
-
16
- var ExperimentsContext = /*#__PURE__*/React.createContext(undefined);
17
-
18
- var ExperimentsProvider = function ExperimentsProvider(_a) {
19
- var experiments = _a.experiments,
20
- children = _a.children;
21
- return /*#__PURE__*/React__default["default"].createElement(ExperimentsContext.Provider, {
22
- value: {
23
- experiments: experiments
24
- }
25
- }, children);
26
- };
27
-
28
- var NinetailedProvider = function NinetailedProvider(_a) {
29
- var children = _a.children,
30
- clientId = _a.clientId,
31
- _b = _a.experiments,
32
- experiments = _b === void 0 ? [] : _b,
33
- environment = _a.environment,
34
- preview = _a.preview,
35
- url = _a.url,
36
- profile = _a.profile,
37
- locale = _a.locale,
38
- requestTimeout = _a.requestTimeout,
39
- _c = _a.plugins,
40
- plugins = _c === void 0 ? [] : _c,
41
- onLog = _a.onLog,
42
- onError = _a.onError;
43
- var ninetailed = React.useMemo(function () {
44
- return new experience_js.Ninetailed({
45
- clientId: clientId,
46
- environment: environment,
47
- preview: preview
48
- }, {
49
- url: url,
50
- plugins: plugins,
51
- profile: profile,
52
- locale: locale,
53
- requestTimeout: requestTimeout,
54
- onLog: onLog,
55
- onError: onError
56
- });
57
- }, []);
58
- return /*#__PURE__*/React__default["default"].createElement(NinetailedContext.Provider, {
59
- value: ninetailed
60
- }, /*#__PURE__*/React__default["default"].createElement(ExperimentsProvider, {
61
- experiments: experiments
62
- }, children));
63
- };
64
-
65
- var useNinetailed = function useNinetailed() {
66
- var ninetailed = React.useContext(NinetailedContext);
67
-
68
- if (ninetailed === undefined) {
69
- throw new Error('The component using the the context must be a descendant of the NinetailedProvider');
70
- }
71
-
72
- return ninetailed;
73
- };
74
-
75
- /*! *****************************************************************************
76
- Copyright (c) Microsoft Corporation.
77
-
78
- Permission to use, copy, modify, and/or distribute this software for any
79
- purpose with or without fee is hereby granted.
80
-
81
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
82
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
83
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
84
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
85
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
86
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
87
- PERFORMANCE OF THIS SOFTWARE.
88
- ***************************************************************************** */
89
-
90
- var __assign = function() {
91
- __assign = Object.assign || function __assign(t) {
92
- for (var s, i = 1, n = arguments.length; i < n; i++) {
93
- s = arguments[i];
94
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
95
- }
96
- return t;
97
- };
98
- return __assign.apply(this, arguments);
99
- };
100
-
101
- function __rest(s, e) {
102
- var t = {};
103
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
104
- t[p] = s[p];
105
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
106
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
107
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
108
- t[p[i]] = s[p[i]];
109
- }
110
- return t;
111
- }
112
-
113
- var useProfile = function useProfile() {
114
- var ninetailed = useNinetailed();
115
-
116
- var _a = React.useState(ninetailed.profileState),
117
- profileState = _a[0],
118
- setProfileState = _a[1];
119
-
120
- var profileStateRef = React.useRef({});
121
- /**
122
- * This effect compares the old and new profile state before updating it.
123
- * We use a ref to avoid an infinite loop which can happen when an empty profile state was updated with no changes.
124
- * This behaviour occurred as the validation handling on the error property was not set properly in the "CreateProfile" and "UpdateProfile" endpoint types.
125
- * Furthermore, it was also observed, that it "only" occurred when the preview plugin was used in parallel.
126
- */
127
-
128
- React.useEffect(function () {
129
- ninetailed.onProfileChange(function (profileState) {
130
- if (isEqual__default["default"](profileState, profileStateRef.current)) {
131
- experience_jsShared.logger.debug("Profile State Did Not Change", profileState);
132
- return;
133
- } else {
134
- setProfileState(profileState);
135
- profileStateRef.current = profileState;
136
- experience_jsShared.logger.debug("Profile State Changed", profileState);
137
- }
138
- });
139
- }, []);
140
- /**
141
- * Old implementation without profile state deep comparison
142
- */
143
-
144
- /*useEffect(() => {
145
- return ninetailed.onProfileChange((profileState) => {
146
- console.log('profileState', profileState);
147
- setProfileState(profileState);
148
- });
149
- }, []);*/
150
-
151
- return __assign(__assign({}, profileState), {
152
- loading: profileState.status === 'loading'
153
- });
154
- };
155
-
156
- var usePersonalize = function usePersonalize(baseline, variants, options) {
157
- if (options === void 0) {
158
- options = {
159
- holdout: -1
160
- };
161
- }
162
-
163
- var profile = useProfile();
164
- return experience_js.selectVariant(baseline, variants, profile, options);
165
- };
166
-
167
- var TrackHasSeenComponent = function TrackHasSeenComponent(_a) {
168
- var children = _a.children,
169
- variant = _a.variant,
170
- audience = _a.audience,
171
- isPersonalized = _a.isPersonalized;
172
- var ninetailed = useNinetailed();
173
-
174
- var _b = reactIntersectionObserver.useInView({
175
- triggerOnce: true
176
- }),
177
- ref = _b.ref,
178
- inView = _b.inView;
179
-
180
- React.useEffect(function () {
181
- if (experience_jsShared.isBrowser() && inView) {
182
- ninetailed.trackHasSeenComponent({
183
- variant: variant,
184
- audience: audience,
185
- isPersonalized: isPersonalized
186
- });
187
- }
188
- }, [inView]);
189
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
190
- ref: ref
191
- }), children);
192
- };
193
-
194
- var Personalize = function Personalize(_a) {
195
- var Component = _a.component,
196
- LoadingComponent = _a.loadingComponent,
197
- _b = _a.variants,
198
- variants = _b === void 0 ? [] : _b,
199
- _c = _a.holdout,
200
- holdout = _c === void 0 ? -1 : _c,
201
- baseline = __rest(_a, ["component", "loadingComponent", "variants", "holdout"]);
202
-
203
- var _d = usePersonalize(baseline, variants, {
204
- holdout: holdout
205
- }),
206
- loading = _d.loading,
207
- variant = _d.variant,
208
- isPersonalized = _d.isPersonalized,
209
- audience = _d.audience;
210
-
211
- var hasVariants = variants.length > 0;
212
-
213
- if (!hasVariants) {
214
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, baseline, {
215
- ninetailed: {
216
- isPersonalized: isPersonalized,
217
- audience: audience
218
- }
219
- }));
220
- }
221
-
222
- if (loading) {
223
- if (LoadingComponent) {
224
- return /*#__PURE__*/React__default["default"].createElement(LoadingComponent, null);
225
- }
226
-
227
- return /*#__PURE__*/React__default["default"].createElement("div", {
228
- key: "hide",
229
- style: {
230
- opacity: 0
231
- }
232
- }, /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, variant, {
233
- ninetailed: {
234
- isPersonalized: isPersonalized,
235
- audience: audience
236
- }
237
- })));
238
- }
239
-
240
- return /*#__PURE__*/React__default["default"].createElement(TrackHasSeenComponent, {
241
- variant: variant,
242
- audience: audience,
243
- isPersonalized: isPersonalized
244
- }, /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, variant, {
245
- key: "".concat(audience.id, "-").concat(variant.id),
246
- ninetailed: {
247
- isPersonalized: isPersonalized,
248
- audience: audience
249
- }
250
- })));
251
- };
252
-
253
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
254
-
255
- var check = function (it) {
256
- return it && it.Math == Math && it;
257
- };
258
-
259
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
260
- var global$t =
261
- // eslint-disable-next-line es/no-global-this -- safe
262
- check(typeof globalThis == 'object' && globalThis) ||
263
- check(typeof window == 'object' && window) ||
264
- // eslint-disable-next-line no-restricted-globals -- safe
265
- check(typeof self == 'object' && self) ||
266
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
267
- // eslint-disable-next-line no-new-func -- fallback
268
- (function () { return this; })() || Function('return this')();
269
-
270
- var objectGetOwnPropertyDescriptor = {};
271
-
272
- var fails$d = function (exec) {
273
- try {
274
- return !!exec();
275
- } catch (error) {
276
- return true;
277
- }
278
- };
279
-
280
- var fails$c = fails$d;
281
-
282
- // Detect IE8's incomplete defineProperty implementation
283
- var descriptors = !fails$c(function () {
284
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
285
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
286
- });
287
-
288
- var fails$b = fails$d;
289
-
290
- var functionBindNative = !fails$b(function () {
291
- var test = (function () { /* empty */ }).bind();
292
- // eslint-disable-next-line no-prototype-builtins -- safe
293
- return typeof test != 'function' || test.hasOwnProperty('prototype');
294
- });
295
-
296
- var NATIVE_BIND$2 = functionBindNative;
297
-
298
- var call$8 = Function.prototype.call;
299
-
300
- var functionCall = NATIVE_BIND$2 ? call$8.bind(call$8) : function () {
301
- return call$8.apply(call$8, arguments);
302
- };
303
-
304
- var objectPropertyIsEnumerable = {};
305
-
306
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
307
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
308
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
309
-
310
- // Nashorn ~ JDK8 bug
311
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
312
-
313
- // `Object.prototype.propertyIsEnumerable` method implementation
314
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
315
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
316
- var descriptor = getOwnPropertyDescriptor$1(this, V);
317
- return !!descriptor && descriptor.enumerable;
318
- } : $propertyIsEnumerable;
319
-
320
- var createPropertyDescriptor$2 = function (bitmap, value) {
321
- return {
322
- enumerable: !(bitmap & 1),
323
- configurable: !(bitmap & 2),
324
- writable: !(bitmap & 4),
325
- value: value
326
- };
327
- };
328
-
329
- var NATIVE_BIND$1 = functionBindNative;
330
-
331
- var FunctionPrototype$2 = Function.prototype;
332
- var bind = FunctionPrototype$2.bind;
333
- var call$7 = FunctionPrototype$2.call;
334
- var uncurryThis$e = NATIVE_BIND$1 && bind.bind(call$7, call$7);
335
-
336
- var functionUncurryThis = NATIVE_BIND$1 ? function (fn) {
337
- return fn && uncurryThis$e(fn);
338
- } : function (fn) {
339
- return fn && function () {
340
- return call$7.apply(fn, arguments);
341
- };
342
- };
343
-
344
- var uncurryThis$d = functionUncurryThis;
345
-
346
- var toString$5 = uncurryThis$d({}.toString);
347
- var stringSlice$4 = uncurryThis$d(''.slice);
348
-
349
- var classofRaw$1 = function (it) {
350
- return stringSlice$4(toString$5(it), 8, -1);
351
- };
352
-
353
- var global$s = global$t;
354
- var uncurryThis$c = functionUncurryThis;
355
- var fails$a = fails$d;
356
- var classof$4 = classofRaw$1;
357
-
358
- var Object$4 = global$s.Object;
359
- var split = uncurryThis$c(''.split);
360
-
361
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
362
- var indexedObject = fails$a(function () {
363
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
364
- // eslint-disable-next-line no-prototype-builtins -- safe
365
- return !Object$4('z').propertyIsEnumerable(0);
366
- }) ? function (it) {
367
- return classof$4(it) == 'String' ? split(it, '') : Object$4(it);
368
- } : Object$4;
369
-
370
- var global$r = global$t;
371
-
372
- var TypeError$9 = global$r.TypeError;
373
-
374
- // `RequireObjectCoercible` abstract operation
375
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
376
- var requireObjectCoercible$4 = function (it) {
377
- if (it == undefined) throw TypeError$9("Can't call method on " + it);
378
- return it;
379
- };
380
-
381
- // toObject with fallback for non-array-like ES3 strings
382
- var IndexedObject$1 = indexedObject;
383
- var requireObjectCoercible$3 = requireObjectCoercible$4;
384
-
385
- var toIndexedObject$4 = function (it) {
386
- return IndexedObject$1(requireObjectCoercible$3(it));
387
- };
388
-
389
- // `IsCallable` abstract operation
390
- // https://tc39.es/ecma262/#sec-iscallable
391
- var isCallable$c = function (argument) {
392
- return typeof argument == 'function';
393
- };
394
-
395
- var isCallable$b = isCallable$c;
396
-
397
- var isObject$5 = function (it) {
398
- return typeof it == 'object' ? it !== null : isCallable$b(it);
399
- };
400
-
401
- var global$q = global$t;
402
- var isCallable$a = isCallable$c;
403
-
404
- var aFunction = function (argument) {
405
- return isCallable$a(argument) ? argument : undefined;
406
- };
407
-
408
- var getBuiltIn$4 = function (namespace, method) {
409
- return arguments.length < 2 ? aFunction(global$q[namespace]) : global$q[namespace] && global$q[namespace][method];
410
- };
411
-
412
- var uncurryThis$b = functionUncurryThis;
413
-
414
- var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
415
-
416
- var getBuiltIn$3 = getBuiltIn$4;
417
-
418
- var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
419
-
420
- var global$p = global$t;
421
- var userAgent = engineUserAgent;
422
-
423
- var process = global$p.process;
424
- var Deno = global$p.Deno;
425
- var versions = process && process.versions || Deno && Deno.version;
426
- var v8 = versions && versions.v8;
427
- var match, version;
428
-
429
- if (v8) {
430
- match = v8.split('.');
431
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
432
- // but their correct versions are not interesting for us
433
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
434
- }
435
-
436
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
437
- // so check `userAgent` even if `.v8` exists, but 0
438
- if (!version && userAgent) {
439
- match = userAgent.match(/Edge\/(\d+)/);
440
- if (!match || match[1] >= 74) {
441
- match = userAgent.match(/Chrome\/(\d+)/);
442
- if (match) version = +match[1];
443
- }
444
- }
445
-
446
- var engineV8Version = version;
447
-
448
- /* eslint-disable es/no-symbol -- required for testing */
449
-
450
- var V8_VERSION = engineV8Version;
451
- var fails$9 = fails$d;
452
-
453
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
454
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$9(function () {
455
- var symbol = Symbol();
456
- // Chrome 38 Symbol has incorrect toString conversion
457
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
458
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
459
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
460
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
461
- });
462
-
463
- /* eslint-disable es/no-symbol -- required for testing */
464
-
465
- var NATIVE_SYMBOL$1 = nativeSymbol;
466
-
467
- var useSymbolAsUid = NATIVE_SYMBOL$1
468
- && !Symbol.sham
469
- && typeof Symbol.iterator == 'symbol';
470
-
471
- var global$o = global$t;
472
- var getBuiltIn$2 = getBuiltIn$4;
473
- var isCallable$9 = isCallable$c;
474
- var isPrototypeOf = objectIsPrototypeOf;
475
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
476
-
477
- var Object$3 = global$o.Object;
478
-
479
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
480
- return typeof it == 'symbol';
481
- } : function (it) {
482
- var $Symbol = getBuiltIn$2('Symbol');
483
- return isCallable$9($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
484
- };
485
-
486
- var global$n = global$t;
487
-
488
- var String$3 = global$n.String;
489
-
490
- var tryToString$1 = function (argument) {
491
- try {
492
- return String$3(argument);
493
- } catch (error) {
494
- return 'Object';
495
- }
496
- };
497
-
498
- var global$m = global$t;
499
- var isCallable$8 = isCallable$c;
500
- var tryToString = tryToString$1;
501
-
502
- var TypeError$8 = global$m.TypeError;
503
-
504
- // `Assert: IsCallable(argument) is true`
505
- var aCallable$2 = function (argument) {
506
- if (isCallable$8(argument)) return argument;
507
- throw TypeError$8(tryToString(argument) + ' is not a function');
508
- };
509
-
510
- var aCallable$1 = aCallable$2;
511
-
512
- // `GetMethod` abstract operation
513
- // https://tc39.es/ecma262/#sec-getmethod
514
- var getMethod$2 = function (V, P) {
515
- var func = V[P];
516
- return func == null ? undefined : aCallable$1(func);
517
- };
518
-
519
- var global$l = global$t;
520
- var call$6 = functionCall;
521
- var isCallable$7 = isCallable$c;
522
- var isObject$4 = isObject$5;
523
-
524
- var TypeError$7 = global$l.TypeError;
525
-
526
- // `OrdinaryToPrimitive` abstract operation
527
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
528
- var ordinaryToPrimitive$1 = function (input, pref) {
529
- var fn, val;
530
- if (pref === 'string' && isCallable$7(fn = input.toString) && !isObject$4(val = call$6(fn, input))) return val;
531
- if (isCallable$7(fn = input.valueOf) && !isObject$4(val = call$6(fn, input))) return val;
532
- if (pref !== 'string' && isCallable$7(fn = input.toString) && !isObject$4(val = call$6(fn, input))) return val;
533
- throw TypeError$7("Can't convert object to primitive value");
534
- };
535
-
536
- var shared$4 = {exports: {}};
537
-
538
- var global$k = global$t;
539
-
540
- // eslint-disable-next-line es/no-object-defineproperty -- safe
541
- var defineProperty = Object.defineProperty;
542
-
543
- var setGlobal$3 = function (key, value) {
544
- try {
545
- defineProperty(global$k, key, { value: value, configurable: true, writable: true });
546
- } catch (error) {
547
- global$k[key] = value;
548
- } return value;
549
- };
550
-
551
- var global$j = global$t;
552
- var setGlobal$2 = setGlobal$3;
553
-
554
- var SHARED = '__core-js_shared__';
555
- var store$3 = global$j[SHARED] || setGlobal$2(SHARED, {});
556
-
557
- var sharedStore = store$3;
558
-
559
- var store$2 = sharedStore;
560
-
561
- (shared$4.exports = function (key, value) {
562
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
563
- })('versions', []).push({
564
- version: '3.21.1',
565
- mode: 'global',
566
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
567
- license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
568
- source: 'https://github.com/zloirock/core-js'
569
- });
570
-
571
- var global$i = global$t;
572
- var requireObjectCoercible$2 = requireObjectCoercible$4;
573
-
574
- var Object$2 = global$i.Object;
575
-
576
- // `ToObject` abstract operation
577
- // https://tc39.es/ecma262/#sec-toobject
578
- var toObject$3 = function (argument) {
579
- return Object$2(requireObjectCoercible$2(argument));
580
- };
581
-
582
- var uncurryThis$a = functionUncurryThis;
583
- var toObject$2 = toObject$3;
584
-
585
- var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
586
-
587
- // `HasOwnProperty` abstract operation
588
- // https://tc39.es/ecma262/#sec-hasownproperty
589
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
590
- return hasOwnProperty(toObject$2(it), key);
591
- };
592
-
593
- var uncurryThis$9 = functionUncurryThis;
594
-
595
- var id = 0;
596
- var postfix = Math.random();
597
- var toString$4 = uncurryThis$9(1.0.toString);
598
-
599
- var uid$2 = function (key) {
600
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
601
- };
602
-
603
- var global$h = global$t;
604
- var shared$3 = shared$4.exports;
605
- var hasOwn$6 = hasOwnProperty_1;
606
- var uid$1 = uid$2;
607
- var NATIVE_SYMBOL = nativeSymbol;
608
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
609
-
610
- var WellKnownSymbolsStore = shared$3('wks');
611
- var Symbol$1 = global$h.Symbol;
612
- var symbolFor = Symbol$1 && Symbol$1['for'];
613
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
614
-
615
- var wellKnownSymbol$5 = function (name) {
616
- if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
617
- var description = 'Symbol.' + name;
618
- if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
619
- WellKnownSymbolsStore[name] = Symbol$1[name];
620
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
621
- WellKnownSymbolsStore[name] = symbolFor(description);
622
- } else {
623
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
624
- }
625
- } return WellKnownSymbolsStore[name];
626
- };
627
-
628
- var global$g = global$t;
629
- var call$5 = functionCall;
630
- var isObject$3 = isObject$5;
631
- var isSymbol$1 = isSymbol$2;
632
- var getMethod$1 = getMethod$2;
633
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
634
- var wellKnownSymbol$4 = wellKnownSymbol$5;
635
-
636
- var TypeError$6 = global$g.TypeError;
637
- var TO_PRIMITIVE = wellKnownSymbol$4('toPrimitive');
638
-
639
- // `ToPrimitive` abstract operation
640
- // https://tc39.es/ecma262/#sec-toprimitive
641
- var toPrimitive$1 = function (input, pref) {
642
- if (!isObject$3(input) || isSymbol$1(input)) return input;
643
- var exoticToPrim = getMethod$1(input, TO_PRIMITIVE);
644
- var result;
645
- if (exoticToPrim) {
646
- if (pref === undefined) pref = 'default';
647
- result = call$5(exoticToPrim, input, pref);
648
- if (!isObject$3(result) || isSymbol$1(result)) return result;
649
- throw TypeError$6("Can't convert object to primitive value");
650
- }
651
- if (pref === undefined) pref = 'number';
652
- return ordinaryToPrimitive(input, pref);
653
- };
654
-
655
- var toPrimitive = toPrimitive$1;
656
- var isSymbol = isSymbol$2;
657
-
658
- // `ToPropertyKey` abstract operation
659
- // https://tc39.es/ecma262/#sec-topropertykey
660
- var toPropertyKey$2 = function (argument) {
661
- var key = toPrimitive(argument, 'string');
662
- return isSymbol(key) ? key : key + '';
663
- };
664
-
665
- var global$f = global$t;
666
- var isObject$2 = isObject$5;
667
-
668
- var document$1 = global$f.document;
669
- // typeof document.createElement is 'object' in old IE
670
- var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
671
-
672
- var documentCreateElement$1 = function (it) {
673
- return EXISTS$1 ? document$1.createElement(it) : {};
674
- };
675
-
676
- var DESCRIPTORS$6 = descriptors;
677
- var fails$8 = fails$d;
678
- var createElement = documentCreateElement$1;
679
-
680
- // Thanks to IE8 for its funny defineProperty
681
- var ie8DomDefine = !DESCRIPTORS$6 && !fails$8(function () {
682
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
683
- return Object.defineProperty(createElement('div'), 'a', {
684
- get: function () { return 7; }
685
- }).a != 7;
686
- });
687
-
688
- var DESCRIPTORS$5 = descriptors;
689
- var call$4 = functionCall;
690
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
691
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
692
- var toIndexedObject$3 = toIndexedObject$4;
693
- var toPropertyKey$1 = toPropertyKey$2;
694
- var hasOwn$5 = hasOwnProperty_1;
695
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
696
-
697
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
698
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
699
-
700
- // `Object.getOwnPropertyDescriptor` method
701
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
702
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
703
- O = toIndexedObject$3(O);
704
- P = toPropertyKey$1(P);
705
- if (IE8_DOM_DEFINE$1) try {
706
- return $getOwnPropertyDescriptor$1(O, P);
707
- } catch (error) { /* empty */ }
708
- if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call$4(propertyIsEnumerableModule.f, O, P), O[P]);
709
- };
710
-
711
- var objectDefineProperty = {};
712
-
713
- var DESCRIPTORS$4 = descriptors;
714
- var fails$7 = fails$d;
715
-
716
- // V8 ~ Chrome 36-
717
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
718
- var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$7(function () {
719
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
720
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
721
- value: 42,
722
- writable: false
723
- }).prototype != 42;
724
- });
725
-
726
- var global$e = global$t;
727
- var isObject$1 = isObject$5;
728
-
729
- var String$2 = global$e.String;
730
- var TypeError$5 = global$e.TypeError;
731
-
732
- // `Assert: Type(argument) is Object`
733
- var anObject$7 = function (argument) {
734
- if (isObject$1(argument)) return argument;
735
- throw TypeError$5(String$2(argument) + ' is not an object');
736
- };
737
-
738
- var global$d = global$t;
739
- var DESCRIPTORS$3 = descriptors;
740
- var IE8_DOM_DEFINE = ie8DomDefine;
741
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
742
- var anObject$6 = anObject$7;
743
- var toPropertyKey = toPropertyKey$2;
744
-
745
- var TypeError$4 = global$d.TypeError;
746
- // eslint-disable-next-line es/no-object-defineproperty -- safe
747
- var $defineProperty = Object.defineProperty;
748
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
749
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
750
- var ENUMERABLE = 'enumerable';
751
- var CONFIGURABLE$1 = 'configurable';
752
- var WRITABLE = 'writable';
753
-
754
- // `Object.defineProperty` method
755
- // https://tc39.es/ecma262/#sec-object.defineproperty
756
- objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
757
- anObject$6(O);
758
- P = toPropertyKey(P);
759
- anObject$6(Attributes);
760
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
761
- var current = $getOwnPropertyDescriptor(O, P);
762
- if (current && current[WRITABLE]) {
763
- O[P] = Attributes.value;
764
- Attributes = {
765
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
766
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
767
- writable: false
768
- };
769
- }
770
- } return $defineProperty(O, P, Attributes);
771
- } : $defineProperty : function defineProperty(O, P, Attributes) {
772
- anObject$6(O);
773
- P = toPropertyKey(P);
774
- anObject$6(Attributes);
775
- if (IE8_DOM_DEFINE) try {
776
- return $defineProperty(O, P, Attributes);
777
- } catch (error) { /* empty */ }
778
- if ('get' in Attributes || 'set' in Attributes) throw TypeError$4('Accessors not supported');
779
- if ('value' in Attributes) O[P] = Attributes.value;
780
- return O;
781
- };
782
-
783
- var DESCRIPTORS$2 = descriptors;
784
- var definePropertyModule$2 = objectDefineProperty;
785
- var createPropertyDescriptor = createPropertyDescriptor$2;
786
-
787
- var createNonEnumerableProperty$4 = DESCRIPTORS$2 ? function (object, key, value) {
788
- return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
789
- } : function (object, key, value) {
790
- object[key] = value;
791
- return object;
792
- };
793
-
794
- var redefine$2 = {exports: {}};
795
-
796
- var uncurryThis$8 = functionUncurryThis;
797
- var isCallable$6 = isCallable$c;
798
- var store$1 = sharedStore;
799
-
800
- var functionToString = uncurryThis$8(Function.toString);
801
-
802
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
803
- if (!isCallable$6(store$1.inspectSource)) {
804
- store$1.inspectSource = function (it) {
805
- return functionToString(it);
806
- };
807
- }
808
-
809
- var inspectSource$2 = store$1.inspectSource;
810
-
811
- var global$c = global$t;
812
- var isCallable$5 = isCallable$c;
813
- var inspectSource$1 = inspectSource$2;
814
-
815
- var WeakMap$1 = global$c.WeakMap;
816
-
817
- var nativeWeakMap = isCallable$5(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
818
-
819
- var shared$2 = shared$4.exports;
820
- var uid = uid$2;
821
-
822
- var keys = shared$2('keys');
823
-
824
- var sharedKey$2 = function (key) {
825
- return keys[key] || (keys[key] = uid(key));
826
- };
827
-
828
- var hiddenKeys$4 = {};
829
-
830
- var NATIVE_WEAK_MAP = nativeWeakMap;
831
- var global$b = global$t;
832
- var uncurryThis$7 = functionUncurryThis;
833
- var isObject = isObject$5;
834
- var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
835
- var hasOwn$4 = hasOwnProperty_1;
836
- var shared$1 = sharedStore;
837
- var sharedKey$1 = sharedKey$2;
838
- var hiddenKeys$3 = hiddenKeys$4;
839
-
840
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
841
- var TypeError$3 = global$b.TypeError;
842
- var WeakMap = global$b.WeakMap;
843
- var set, get, has;
844
-
845
- var enforce = function (it) {
846
- return has(it) ? get(it) : set(it, {});
847
- };
848
-
849
- var getterFor = function (TYPE) {
850
- return function (it) {
851
- var state;
852
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
853
- throw TypeError$3('Incompatible receiver, ' + TYPE + ' required');
854
- } return state;
855
- };
856
- };
857
-
858
- if (NATIVE_WEAK_MAP || shared$1.state) {
859
- var store = shared$1.state || (shared$1.state = new WeakMap());
860
- var wmget = uncurryThis$7(store.get);
861
- var wmhas = uncurryThis$7(store.has);
862
- var wmset = uncurryThis$7(store.set);
863
- set = function (it, metadata) {
864
- if (wmhas(store, it)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
865
- metadata.facade = it;
866
- wmset(store, it, metadata);
867
- return metadata;
868
- };
869
- get = function (it) {
870
- return wmget(store, it) || {};
871
- };
872
- has = function (it) {
873
- return wmhas(store, it);
874
- };
875
- } else {
876
- var STATE = sharedKey$1('state');
877
- hiddenKeys$3[STATE] = true;
878
- set = function (it, metadata) {
879
- if (hasOwn$4(it, STATE)) throw new TypeError$3(OBJECT_ALREADY_INITIALIZED);
880
- metadata.facade = it;
881
- createNonEnumerableProperty$3(it, STATE, metadata);
882
- return metadata;
883
- };
884
- get = function (it) {
885
- return hasOwn$4(it, STATE) ? it[STATE] : {};
886
- };
887
- has = function (it) {
888
- return hasOwn$4(it, STATE);
889
- };
890
- }
891
-
892
- var internalState = {
893
- set: set,
894
- get: get,
895
- has: has,
896
- enforce: enforce,
897
- getterFor: getterFor
898
- };
899
-
900
- var DESCRIPTORS$1 = descriptors;
901
- var hasOwn$3 = hasOwnProperty_1;
902
-
903
- var FunctionPrototype$1 = Function.prototype;
904
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
905
- var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
906
-
907
- var EXISTS = hasOwn$3(FunctionPrototype$1, 'name');
908
- // additional protection from minified / mangled / dropped function names
909
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
910
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype$1, 'name').configurable));
911
-
912
- var functionName = {
913
- EXISTS: EXISTS,
914
- PROPER: PROPER,
915
- CONFIGURABLE: CONFIGURABLE
916
- };
917
-
918
- var global$a = global$t;
919
- var isCallable$4 = isCallable$c;
920
- var hasOwn$2 = hasOwnProperty_1;
921
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
922
- var setGlobal$1 = setGlobal$3;
923
- var inspectSource = inspectSource$2;
924
- var InternalStateModule = internalState;
925
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
926
-
927
- var getInternalState$1 = InternalStateModule.get;
928
- var enforceInternalState = InternalStateModule.enforce;
929
- var TEMPLATE = String(String).split('String');
930
-
931
- (redefine$2.exports = function (O, key, value, options) {
932
- var unsafe = options ? !!options.unsafe : false;
933
- var simple = options ? !!options.enumerable : false;
934
- var noTargetGet = options ? !!options.noTargetGet : false;
935
- var name = options && options.name !== undefined ? options.name : key;
936
- var state;
937
- if (isCallable$4(value)) {
938
- if (String(name).slice(0, 7) === 'Symbol(') {
939
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
940
- }
941
- if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
942
- createNonEnumerableProperty$2(value, 'name', name);
943
- }
944
- state = enforceInternalState(value);
945
- if (!state.source) {
946
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
947
- }
948
- }
949
- if (O === global$a) {
950
- if (simple) O[key] = value;
951
- else setGlobal$1(key, value);
952
- return;
953
- } else if (!unsafe) {
954
- delete O[key];
955
- } else if (!noTargetGet && O[key]) {
956
- simple = true;
957
- }
958
- if (simple) O[key] = value;
959
- else createNonEnumerableProperty$2(O, key, value);
960
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
961
- })(Function.prototype, 'toString', function toString() {
962
- return isCallable$4(this) && getInternalState$1(this).source || inspectSource(this);
963
- });
964
-
965
- var objectGetOwnPropertyNames = {};
966
-
967
- var ceil = Math.ceil;
968
- var floor$1 = Math.floor;
969
-
970
- // `ToIntegerOrInfinity` abstract operation
971
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
972
- var toIntegerOrInfinity$4 = function (argument) {
973
- var number = +argument;
974
- // eslint-disable-next-line no-self-compare -- safe
975
- return number !== number || number === 0 ? 0 : (number > 0 ? floor$1 : ceil)(number);
976
- };
977
-
978
- var toIntegerOrInfinity$3 = toIntegerOrInfinity$4;
979
-
980
- var max$1 = Math.max;
981
- var min$2 = Math.min;
982
-
983
- // Helper for a popular repeating case of the spec:
984
- // Let integer be ? ToInteger(index).
985
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
986
- var toAbsoluteIndex$1 = function (index, length) {
987
- var integer = toIntegerOrInfinity$3(index);
988
- return integer < 0 ? max$1(integer + length, 0) : min$2(integer, length);
989
- };
990
-
991
- var toIntegerOrInfinity$2 = toIntegerOrInfinity$4;
992
-
993
- var min$1 = Math.min;
994
-
995
- // `ToLength` abstract operation
996
- // https://tc39.es/ecma262/#sec-tolength
997
- var toLength$2 = function (argument) {
998
- return argument > 0 ? min$1(toIntegerOrInfinity$2(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
999
- };
1000
-
1001
- var toLength$1 = toLength$2;
1002
-
1003
- // `LengthOfArrayLike` abstract operation
1004
- // https://tc39.es/ecma262/#sec-lengthofarraylike
1005
- var lengthOfArrayLike$2 = function (obj) {
1006
- return toLength$1(obj.length);
1007
- };
1008
-
1009
- var toIndexedObject$2 = toIndexedObject$4;
1010
- var toAbsoluteIndex = toAbsoluteIndex$1;
1011
- var lengthOfArrayLike$1 = lengthOfArrayLike$2;
1012
-
1013
- // `Array.prototype.{ indexOf, includes }` methods implementation
1014
- var createMethod$2 = function (IS_INCLUDES) {
1015
- return function ($this, el, fromIndex) {
1016
- var O = toIndexedObject$2($this);
1017
- var length = lengthOfArrayLike$1(O);
1018
- var index = toAbsoluteIndex(fromIndex, length);
1019
- var value;
1020
- // Array#includes uses SameValueZero equality algorithm
1021
- // eslint-disable-next-line no-self-compare -- NaN check
1022
- if (IS_INCLUDES && el != el) while (length > index) {
1023
- value = O[index++];
1024
- // eslint-disable-next-line no-self-compare -- NaN check
1025
- if (value != value) return true;
1026
- // Array#indexOf ignores holes, Array#includes - not
1027
- } else for (;length > index; index++) {
1028
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1029
- } return !IS_INCLUDES && -1;
1030
- };
1031
- };
1032
-
1033
- var arrayIncludes = {
1034
- // `Array.prototype.includes` method
1035
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1036
- includes: createMethod$2(true),
1037
- // `Array.prototype.indexOf` method
1038
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
1039
- indexOf: createMethod$2(false)
1040
- };
1041
-
1042
- var uncurryThis$6 = functionUncurryThis;
1043
- var hasOwn$1 = hasOwnProperty_1;
1044
- var toIndexedObject$1 = toIndexedObject$4;
1045
- var indexOf$1 = arrayIncludes.indexOf;
1046
- var hiddenKeys$2 = hiddenKeys$4;
1047
-
1048
- var push$1 = uncurryThis$6([].push);
1049
-
1050
- var objectKeysInternal = function (object, names) {
1051
- var O = toIndexedObject$1(object);
1052
- var i = 0;
1053
- var result = [];
1054
- var key;
1055
- for (key in O) !hasOwn$1(hiddenKeys$2, key) && hasOwn$1(O, key) && push$1(result, key);
1056
- // Don't enum bug & hidden keys
1057
- while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
1058
- ~indexOf$1(result, key) || push$1(result, key);
1059
- }
1060
- return result;
1061
- };
1062
-
1063
- // IE8- don't enum bug keys
1064
- var enumBugKeys$3 = [
1065
- 'constructor',
1066
- 'hasOwnProperty',
1067
- 'isPrototypeOf',
1068
- 'propertyIsEnumerable',
1069
- 'toLocaleString',
1070
- 'toString',
1071
- 'valueOf'
1072
- ];
1073
-
1074
- var internalObjectKeys$1 = objectKeysInternal;
1075
- var enumBugKeys$2 = enumBugKeys$3;
1076
-
1077
- var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
1078
-
1079
- // `Object.getOwnPropertyNames` method
1080
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
1081
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1082
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1083
- return internalObjectKeys$1(O, hiddenKeys$1);
1084
- };
1085
-
1086
- var objectGetOwnPropertySymbols = {};
1087
-
1088
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1089
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1090
-
1091
- var getBuiltIn$1 = getBuiltIn$4;
1092
- var uncurryThis$5 = functionUncurryThis;
1093
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1094
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1095
- var anObject$5 = anObject$7;
1096
-
1097
- var concat$1 = uncurryThis$5([].concat);
1098
-
1099
- // all object keys, includes non-enumerable and symbols
1100
- var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
1101
- var keys = getOwnPropertyNamesModule.f(anObject$5(it));
1102
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1103
- return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
1104
- };
1105
-
1106
- var hasOwn = hasOwnProperty_1;
1107
- var ownKeys = ownKeys$1;
1108
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1109
- var definePropertyModule$1 = objectDefineProperty;
1110
-
1111
- var copyConstructorProperties$1 = function (target, source, exceptions) {
1112
- var keys = ownKeys(source);
1113
- var defineProperty = definePropertyModule$1.f;
1114
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1115
- for (var i = 0; i < keys.length; i++) {
1116
- var key = keys[i];
1117
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
1118
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1119
- }
1120
- }
1121
- };
1122
-
1123
- var fails$6 = fails$d;
1124
- var isCallable$3 = isCallable$c;
1125
-
1126
- var replacement = /#|\.prototype\./;
1127
-
1128
- var isForced$1 = function (feature, detection) {
1129
- var value = data[normalize(feature)];
1130
- return value == POLYFILL ? true
1131
- : value == NATIVE ? false
1132
- : isCallable$3(detection) ? fails$6(detection)
1133
- : !!detection;
1134
- };
1135
-
1136
- var normalize = isForced$1.normalize = function (string) {
1137
- return String(string).replace(replacement, '.').toLowerCase();
1138
- };
1139
-
1140
- var data = isForced$1.data = {};
1141
- var NATIVE = isForced$1.NATIVE = 'N';
1142
- var POLYFILL = isForced$1.POLYFILL = 'P';
1143
-
1144
- var isForced_1 = isForced$1;
1145
-
1146
- var global$9 = global$t;
1147
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1148
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1149
- var redefine$1 = redefine$2.exports;
1150
- var setGlobal = setGlobal$3;
1151
- var copyConstructorProperties = copyConstructorProperties$1;
1152
- var isForced = isForced_1;
1153
-
1154
- /*
1155
- options.target - name of the target object
1156
- options.global - target is the global object
1157
- options.stat - export as static methods of target
1158
- options.proto - export as prototype methods of target
1159
- options.real - real prototype method for the `pure` version
1160
- options.forced - export even if the native feature is available
1161
- options.bind - bind methods to the target, required for the `pure` version
1162
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1163
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
1164
- options.sham - add a flag to not completely full polyfills
1165
- options.enumerable - export as enumerable property
1166
- options.noTargetGet - prevent calling a getter on target
1167
- options.name - the .name of the function if it does not match the key
1168
- */
1169
- var _export = function (options, source) {
1170
- var TARGET = options.target;
1171
- var GLOBAL = options.global;
1172
- var STATIC = options.stat;
1173
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1174
- if (GLOBAL) {
1175
- target = global$9;
1176
- } else if (STATIC) {
1177
- target = global$9[TARGET] || setGlobal(TARGET, {});
1178
- } else {
1179
- target = (global$9[TARGET] || {}).prototype;
1180
- }
1181
- if (target) for (key in source) {
1182
- sourceProperty = source[key];
1183
- if (options.noTargetGet) {
1184
- descriptor = getOwnPropertyDescriptor(target, key);
1185
- targetProperty = descriptor && descriptor.value;
1186
- } else targetProperty = target[key];
1187
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1188
- // contained in target
1189
- if (!FORCED && targetProperty !== undefined) {
1190
- if (typeof sourceProperty == typeof targetProperty) continue;
1191
- copyConstructorProperties(sourceProperty, targetProperty);
1192
- }
1193
- // add a flag to not completely full polyfills
1194
- if (options.sham || (targetProperty && targetProperty.sham)) {
1195
- createNonEnumerableProperty$1(sourceProperty, 'sham', true);
1196
- }
1197
- // extend global
1198
- redefine$1(target, key, sourceProperty, options);
1199
- }
1200
- };
1201
-
1202
- var wellKnownSymbol$3 = wellKnownSymbol$5;
1203
-
1204
- var TO_STRING_TAG$1 = wellKnownSymbol$3('toStringTag');
1205
- var test = {};
1206
-
1207
- test[TO_STRING_TAG$1] = 'z';
1208
-
1209
- var toStringTagSupport = String(test) === '[object z]';
1210
-
1211
- var global$8 = global$t;
1212
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1213
- var isCallable$2 = isCallable$c;
1214
- var classofRaw = classofRaw$1;
1215
- var wellKnownSymbol$2 = wellKnownSymbol$5;
1216
-
1217
- var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
1218
- var Object$1 = global$8.Object;
1219
-
1220
- // ES3 wrong here
1221
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1222
-
1223
- // fallback for IE11 Script Access Denied error
1224
- var tryGet = function (it, key) {
1225
- try {
1226
- return it[key];
1227
- } catch (error) { /* empty */ }
1228
- };
1229
-
1230
- // getting tag from ES6+ `Object.prototype.toString`
1231
- var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1232
- var O, tag, result;
1233
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1234
- // @@toStringTag case
1235
- : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
1236
- // builtinTag case
1237
- : CORRECT_ARGUMENTS ? classofRaw(O)
1238
- // ES3 arguments fallback
1239
- : (result = classofRaw(O)) == 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
1240
- };
1241
-
1242
- var global$7 = global$t;
1243
- var classof$2 = classof$3;
1244
-
1245
- var String$1 = global$7.String;
1246
-
1247
- var toString$3 = function (argument) {
1248
- if (classof$2(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1249
- return String$1(argument);
1250
- };
1251
-
1252
- var anObject$4 = anObject$7;
1253
-
1254
- // `RegExp.prototype.flags` getter implementation
1255
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1256
- var regexpFlags$1 = function () {
1257
- var that = anObject$4(this);
1258
- var result = '';
1259
- if (that.global) result += 'g';
1260
- if (that.ignoreCase) result += 'i';
1261
- if (that.multiline) result += 'm';
1262
- if (that.dotAll) result += 's';
1263
- if (that.unicode) result += 'u';
1264
- if (that.sticky) result += 'y';
1265
- return result;
1266
- };
1267
-
1268
- var fails$5 = fails$d;
1269
- var global$6 = global$t;
1270
-
1271
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1272
- var $RegExp$2 = global$6.RegExp;
1273
-
1274
- var UNSUPPORTED_Y$1 = fails$5(function () {
1275
- var re = $RegExp$2('a', 'y');
1276
- re.lastIndex = 2;
1277
- return re.exec('abcd') != null;
1278
- });
1279
-
1280
- // UC Browser bug
1281
- // https://github.com/zloirock/core-js/issues/1008
1282
- var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$5(function () {
1283
- return !$RegExp$2('a', 'y').sticky;
1284
- });
1285
-
1286
- var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$5(function () {
1287
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1288
- var re = $RegExp$2('^r', 'gy');
1289
- re.lastIndex = 2;
1290
- return re.exec('str') != null;
1291
- });
1292
-
1293
- var regexpStickyHelpers = {
1294
- BROKEN_CARET: BROKEN_CARET,
1295
- MISSED_STICKY: MISSED_STICKY,
1296
- UNSUPPORTED_Y: UNSUPPORTED_Y$1
1297
- };
1298
-
1299
- var objectDefineProperties = {};
1300
-
1301
- var internalObjectKeys = objectKeysInternal;
1302
- var enumBugKeys$1 = enumBugKeys$3;
1303
-
1304
- // `Object.keys` method
1305
- // https://tc39.es/ecma262/#sec-object.keys
1306
- // eslint-disable-next-line es/no-object-keys -- safe
1307
- var objectKeys$1 = Object.keys || function keys(O) {
1308
- return internalObjectKeys(O, enumBugKeys$1);
1309
- };
1310
-
1311
- var DESCRIPTORS = descriptors;
1312
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1313
- var definePropertyModule = objectDefineProperty;
1314
- var anObject$3 = anObject$7;
1315
- var toIndexedObject = toIndexedObject$4;
1316
- var objectKeys = objectKeys$1;
1317
-
1318
- // `Object.defineProperties` method
1319
- // https://tc39.es/ecma262/#sec-object.defineproperties
1320
- // eslint-disable-next-line es/no-object-defineproperties -- safe
1321
- objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1322
- anObject$3(O);
1323
- var props = toIndexedObject(Properties);
1324
- var keys = objectKeys(Properties);
1325
- var length = keys.length;
1326
- var index = 0;
1327
- var key;
1328
- while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
1329
- return O;
1330
- };
1331
-
1332
- var getBuiltIn = getBuiltIn$4;
1333
-
1334
- var html$1 = getBuiltIn('document', 'documentElement');
1335
-
1336
- /* global ActiveXObject -- old IE, WSH */
1337
-
1338
- var anObject$2 = anObject$7;
1339
- var definePropertiesModule = objectDefineProperties;
1340
- var enumBugKeys = enumBugKeys$3;
1341
- var hiddenKeys = hiddenKeys$4;
1342
- var html = html$1;
1343
- var documentCreateElement = documentCreateElement$1;
1344
- var sharedKey = sharedKey$2;
1345
-
1346
- var GT = '>';
1347
- var LT = '<';
1348
- var PROTOTYPE = 'prototype';
1349
- var SCRIPT = 'script';
1350
- var IE_PROTO = sharedKey('IE_PROTO');
1351
-
1352
- var EmptyConstructor = function () { /* empty */ };
1353
-
1354
- var scriptTag = function (content) {
1355
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1356
- };
1357
-
1358
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1359
- var NullProtoObjectViaActiveX = function (activeXDocument) {
1360
- activeXDocument.write(scriptTag(''));
1361
- activeXDocument.close();
1362
- var temp = activeXDocument.parentWindow.Object;
1363
- activeXDocument = null; // avoid memory leak
1364
- return temp;
1365
- };
1366
-
1367
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
1368
- var NullProtoObjectViaIFrame = function () {
1369
- // Thrash, waste and sodomy: IE GC bug
1370
- var iframe = documentCreateElement('iframe');
1371
- var JS = 'java' + SCRIPT + ':';
1372
- var iframeDocument;
1373
- iframe.style.display = 'none';
1374
- html.appendChild(iframe);
1375
- // https://github.com/zloirock/core-js/issues/475
1376
- iframe.src = String(JS);
1377
- iframeDocument = iframe.contentWindow.document;
1378
- iframeDocument.open();
1379
- iframeDocument.write(scriptTag('document.F=Object'));
1380
- iframeDocument.close();
1381
- return iframeDocument.F;
1382
- };
1383
-
1384
- // Check for document.domain and active x support
1385
- // No need to use active x approach when document.domain is not set
1386
- // see https://github.com/es-shims/es5-shim/issues/150
1387
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1388
- // avoid IE GC bug
1389
- var activeXDocument;
1390
- var NullProtoObject = function () {
1391
- try {
1392
- activeXDocument = new ActiveXObject('htmlfile');
1393
- } catch (error) { /* ignore */ }
1394
- NullProtoObject = typeof document != 'undefined'
1395
- ? document.domain && activeXDocument
1396
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1397
- : NullProtoObjectViaIFrame()
1398
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
1399
- var length = enumBugKeys.length;
1400
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1401
- return NullProtoObject();
1402
- };
1403
-
1404
- hiddenKeys[IE_PROTO] = true;
1405
-
1406
- // `Object.create` method
1407
- // https://tc39.es/ecma262/#sec-object.create
1408
- var objectCreate = Object.create || function create(O, Properties) {
1409
- var result;
1410
- if (O !== null) {
1411
- EmptyConstructor[PROTOTYPE] = anObject$2(O);
1412
- result = new EmptyConstructor();
1413
- EmptyConstructor[PROTOTYPE] = null;
1414
- // add "__proto__" for Object.getPrototypeOf polyfill
1415
- result[IE_PROTO] = O;
1416
- } else result = NullProtoObject();
1417
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1418
- };
1419
-
1420
- var fails$4 = fails$d;
1421
- var global$5 = global$t;
1422
-
1423
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1424
- var $RegExp$1 = global$5.RegExp;
1425
-
1426
- var regexpUnsupportedDotAll = fails$4(function () {
1427
- var re = $RegExp$1('.', 's');
1428
- return !(re.dotAll && re.exec('\n') && re.flags === 's');
1429
- });
1430
-
1431
- var fails$3 = fails$d;
1432
- var global$4 = global$t;
1433
-
1434
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
1435
- var $RegExp = global$4.RegExp;
1436
-
1437
- var regexpUnsupportedNcg = fails$3(function () {
1438
- var re = $RegExp('(?<a>b)', 'g');
1439
- return re.exec('b').groups.a !== 'b' ||
1440
- 'b'.replace(re, '$<a>c') !== 'bc';
1441
- });
1442
-
1443
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1444
- /* eslint-disable regexp/no-useless-quantifier -- testing */
1445
- var call$3 = functionCall;
1446
- var uncurryThis$4 = functionUncurryThis;
1447
- var toString$2 = toString$3;
1448
- var regexpFlags = regexpFlags$1;
1449
- var stickyHelpers = regexpStickyHelpers;
1450
- var shared = shared$4.exports;
1451
- var create = objectCreate;
1452
- var getInternalState = internalState.get;
1453
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
1454
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
1455
-
1456
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
1457
- var nativeExec = RegExp.prototype.exec;
1458
- var patchedExec = nativeExec;
1459
- var charAt$3 = uncurryThis$4(''.charAt);
1460
- var indexOf = uncurryThis$4(''.indexOf);
1461
- var replace$1 = uncurryThis$4(''.replace);
1462
- var stringSlice$3 = uncurryThis$4(''.slice);
1463
-
1464
- var UPDATES_LAST_INDEX_WRONG = (function () {
1465
- var re1 = /a/;
1466
- var re2 = /b*/g;
1467
- call$3(nativeExec, re1, 'a');
1468
- call$3(nativeExec, re2, 'a');
1469
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1470
- })();
1471
-
1472
- var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
1473
-
1474
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
1475
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
1476
-
1477
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
1478
-
1479
- if (PATCH) {
1480
- patchedExec = function exec(string) {
1481
- var re = this;
1482
- var state = getInternalState(re);
1483
- var str = toString$2(string);
1484
- var raw = state.raw;
1485
- var result, reCopy, lastIndex, match, i, object, group;
1486
-
1487
- if (raw) {
1488
- raw.lastIndex = re.lastIndex;
1489
- result = call$3(patchedExec, raw, str);
1490
- re.lastIndex = raw.lastIndex;
1491
- return result;
1492
- }
1493
-
1494
- var groups = state.groups;
1495
- var sticky = UNSUPPORTED_Y && re.sticky;
1496
- var flags = call$3(regexpFlags, re);
1497
- var source = re.source;
1498
- var charsAdded = 0;
1499
- var strCopy = str;
1500
-
1501
- if (sticky) {
1502
- flags = replace$1(flags, 'y', '');
1503
- if (indexOf(flags, 'g') === -1) {
1504
- flags += 'g';
1505
- }
1506
-
1507
- strCopy = stringSlice$3(str, re.lastIndex);
1508
- // Support anchored sticky behavior.
1509
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
1510
- source = '(?: ' + source + ')';
1511
- strCopy = ' ' + strCopy;
1512
- charsAdded++;
1513
- }
1514
- // ^(? + rx + ) is needed, in combination with some str slicing, to
1515
- // simulate the 'y' flag.
1516
- reCopy = new RegExp('^(?:' + source + ')', flags);
1517
- }
1518
-
1519
- if (NPCG_INCLUDED) {
1520
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
1521
- }
1522
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
1523
-
1524
- match = call$3(nativeExec, sticky ? reCopy : re, strCopy);
1525
-
1526
- if (sticky) {
1527
- if (match) {
1528
- match.input = stringSlice$3(match.input, charsAdded);
1529
- match[0] = stringSlice$3(match[0], charsAdded);
1530
- match.index = re.lastIndex;
1531
- re.lastIndex += match[0].length;
1532
- } else re.lastIndex = 0;
1533
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
1534
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
1535
- }
1536
- if (NPCG_INCLUDED && match && match.length > 1) {
1537
- // Fix browsers whose `exec` methods don't consistently return `undefined`
1538
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
1539
- call$3(nativeReplace, match[0], reCopy, function () {
1540
- for (i = 1; i < arguments.length - 2; i++) {
1541
- if (arguments[i] === undefined) match[i] = undefined;
1542
- }
1543
- });
1544
- }
1545
-
1546
- if (match && groups) {
1547
- match.groups = object = create(null);
1548
- for (i = 0; i < groups.length; i++) {
1549
- group = groups[i];
1550
- object[group[0]] = match[group[1]];
1551
- }
1552
- }
1553
-
1554
- return match;
1555
- };
1556
- }
1557
-
1558
- var regexpExec$2 = patchedExec;
1559
-
1560
- var $$1 = _export;
1561
- var exec = regexpExec$2;
1562
-
1563
- // `RegExp.prototype.exec` method
1564
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
1565
- $$1({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
1566
- exec: exec
1567
- });
1568
-
1569
- var NATIVE_BIND = functionBindNative;
1570
-
1571
- var FunctionPrototype = Function.prototype;
1572
- var apply$1 = FunctionPrototype.apply;
1573
- var call$2 = FunctionPrototype.call;
1574
-
1575
- // eslint-disable-next-line es/no-reflect -- safe
1576
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$2.bind(apply$1) : function () {
1577
- return call$2.apply(apply$1, arguments);
1578
- });
1579
-
1580
- // TODO: Remove from `core-js@4` since it's moved to entry points
1581
-
1582
- var uncurryThis$3 = functionUncurryThis;
1583
- var redefine = redefine$2.exports;
1584
- var regexpExec$1 = regexpExec$2;
1585
- var fails$2 = fails$d;
1586
- var wellKnownSymbol$1 = wellKnownSymbol$5;
1587
- var createNonEnumerableProperty = createNonEnumerableProperty$4;
1588
-
1589
- var SPECIES = wellKnownSymbol$1('species');
1590
- var RegExpPrototype = RegExp.prototype;
1591
-
1592
- var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1593
- var SYMBOL = wellKnownSymbol$1(KEY);
1594
-
1595
- var DELEGATES_TO_SYMBOL = !fails$2(function () {
1596
- // String methods call symbol-named RegEp methods
1597
- var O = {};
1598
- O[SYMBOL] = function () { return 7; };
1599
- return ''[KEY](O) != 7;
1600
- });
1601
-
1602
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$2(function () {
1603
- // Symbol-named RegExp methods call .exec
1604
- var execCalled = false;
1605
- var re = /a/;
1606
-
1607
- if (KEY === 'split') {
1608
- // We can't use real regex here since it causes deoptimization
1609
- // and serious performance degradation in V8
1610
- // https://github.com/zloirock/core-js/issues/306
1611
- re = {};
1612
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
1613
- // a new one. We need to return the patched regex when creating the new one.
1614
- re.constructor = {};
1615
- re.constructor[SPECIES] = function () { return re; };
1616
- re.flags = '';
1617
- re[SYMBOL] = /./[SYMBOL];
1618
- }
1619
-
1620
- re.exec = function () { execCalled = true; return null; };
1621
-
1622
- re[SYMBOL]('');
1623
- return !execCalled;
1624
- });
1625
-
1626
- if (
1627
- !DELEGATES_TO_SYMBOL ||
1628
- !DELEGATES_TO_EXEC ||
1629
- FORCED
1630
- ) {
1631
- var uncurriedNativeRegExpMethod = uncurryThis$3(/./[SYMBOL]);
1632
- var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
1633
- var uncurriedNativeMethod = uncurryThis$3(nativeMethod);
1634
- var $exec = regexp.exec;
1635
- if ($exec === regexpExec$1 || $exec === RegExpPrototype.exec) {
1636
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
1637
- // The native String method already delegates to @@method (this
1638
- // polyfilled function), leasing to infinite recursion.
1639
- // We avoid it by directly calling the native @@method method.
1640
- return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
1641
- }
1642
- return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
1643
- }
1644
- return { done: false };
1645
- });
1646
-
1647
- redefine(String.prototype, KEY, methods[0]);
1648
- redefine(RegExpPrototype, SYMBOL, methods[1]);
1649
- }
1650
-
1651
- if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
1652
- };
1653
-
1654
- var uncurryThis$2 = functionUncurryThis;
1655
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
1656
- var toString$1 = toString$3;
1657
- var requireObjectCoercible$1 = requireObjectCoercible$4;
1658
-
1659
- var charAt$2 = uncurryThis$2(''.charAt);
1660
- var charCodeAt = uncurryThis$2(''.charCodeAt);
1661
- var stringSlice$2 = uncurryThis$2(''.slice);
1662
-
1663
- var createMethod$1 = function (CONVERT_TO_STRING) {
1664
- return function ($this, pos) {
1665
- var S = toString$1(requireObjectCoercible$1($this));
1666
- var position = toIntegerOrInfinity$1(pos);
1667
- var size = S.length;
1668
- var first, second;
1669
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
1670
- first = charCodeAt(S, position);
1671
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
1672
- || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
1673
- ? CONVERT_TO_STRING
1674
- ? charAt$2(S, position)
1675
- : first
1676
- : CONVERT_TO_STRING
1677
- ? stringSlice$2(S, position, position + 2)
1678
- : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
1679
- };
1680
- };
1681
-
1682
- var stringMultibyte = {
1683
- // `String.prototype.codePointAt` method
1684
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
1685
- codeAt: createMethod$1(false),
1686
- // `String.prototype.at` method
1687
- // https://github.com/mathiasbynens/String.prototype.at
1688
- charAt: createMethod$1(true)
1689
- };
1690
-
1691
- var charAt$1 = stringMultibyte.charAt;
1692
-
1693
- // `AdvanceStringIndex` abstract operation
1694
- // https://tc39.es/ecma262/#sec-advancestringindex
1695
- var advanceStringIndex$1 = function (S, index, unicode) {
1696
- return index + (unicode ? charAt$1(S, index).length : 1);
1697
- };
1698
-
1699
- var uncurryThis$1 = functionUncurryThis;
1700
- var toObject$1 = toObject$3;
1701
-
1702
- var floor = Math.floor;
1703
- var charAt = uncurryThis$1(''.charAt);
1704
- var replace = uncurryThis$1(''.replace);
1705
- var stringSlice$1 = uncurryThis$1(''.slice);
1706
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
1707
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
1708
-
1709
- // `GetSubstitution` abstract operation
1710
- // https://tc39.es/ecma262/#sec-getsubstitution
1711
- var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
1712
- var tailPos = position + matched.length;
1713
- var m = captures.length;
1714
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
1715
- if (namedCaptures !== undefined) {
1716
- namedCaptures = toObject$1(namedCaptures);
1717
- symbols = SUBSTITUTION_SYMBOLS;
1718
- }
1719
- return replace(replacement, symbols, function (match, ch) {
1720
- var capture;
1721
- switch (charAt(ch, 0)) {
1722
- case '$': return '$';
1723
- case '&': return matched;
1724
- case '`': return stringSlice$1(str, 0, position);
1725
- case "'": return stringSlice$1(str, tailPos);
1726
- case '<':
1727
- capture = namedCaptures[stringSlice$1(ch, 1, -1)];
1728
- break;
1729
- default: // \d\d?
1730
- var n = +ch;
1731
- if (n === 0) return match;
1732
- if (n > m) {
1733
- var f = floor(n / 10);
1734
- if (f === 0) return match;
1735
- if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
1736
- return match;
1737
- }
1738
- capture = captures[n - 1];
1739
- }
1740
- return capture === undefined ? '' : capture;
1741
- });
1742
- };
1743
-
1744
- var global$3 = global$t;
1745
- var call$1 = functionCall;
1746
- var anObject$1 = anObject$7;
1747
- var isCallable$1 = isCallable$c;
1748
- var classof$1 = classofRaw$1;
1749
- var regexpExec = regexpExec$2;
1750
-
1751
- var TypeError$2 = global$3.TypeError;
1752
-
1753
- // `RegExpExec` abstract operation
1754
- // https://tc39.es/ecma262/#sec-regexpexec
1755
- var regexpExecAbstract = function (R, S) {
1756
- var exec = R.exec;
1757
- if (isCallable$1(exec)) {
1758
- var result = call$1(exec, R, S);
1759
- if (result !== null) anObject$1(result);
1760
- return result;
1761
- }
1762
- if (classof$1(R) === 'RegExp') return call$1(regexpExec, R, S);
1763
- throw TypeError$2('RegExp#exec called on incompatible receiver');
1764
- };
1765
-
1766
- var apply = functionApply;
1767
- var call = functionCall;
1768
- var uncurryThis = functionUncurryThis;
1769
- var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
1770
- var fails$1 = fails$d;
1771
- var anObject = anObject$7;
1772
- var isCallable = isCallable$c;
1773
- var toIntegerOrInfinity = toIntegerOrInfinity$4;
1774
- var toLength = toLength$2;
1775
- var toString = toString$3;
1776
- var requireObjectCoercible = requireObjectCoercible$4;
1777
- var advanceStringIndex = advanceStringIndex$1;
1778
- var getMethod = getMethod$2;
1779
- var getSubstitution = getSubstitution$1;
1780
- var regExpExec = regexpExecAbstract;
1781
- var wellKnownSymbol = wellKnownSymbol$5;
1782
-
1783
- var REPLACE = wellKnownSymbol('replace');
1784
- var max = Math.max;
1785
- var min = Math.min;
1786
- var concat = uncurryThis([].concat);
1787
- var push = uncurryThis([].push);
1788
- var stringIndexOf = uncurryThis(''.indexOf);
1789
- var stringSlice = uncurryThis(''.slice);
1790
-
1791
- var maybeToString = function (it) {
1792
- return it === undefined ? it : String(it);
1793
- };
1794
-
1795
- // IE <= 11 replaces $0 with the whole match, as if it was $&
1796
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
1797
- var REPLACE_KEEPS_$0 = (function () {
1798
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
1799
- return 'a'.replace(/./, '$0') === '$0';
1800
- })();
1801
-
1802
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
1803
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
1804
- if (/./[REPLACE]) {
1805
- return /./[REPLACE]('a', '$0') === '';
1806
- }
1807
- return false;
1808
- })();
1809
-
1810
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$1(function () {
1811
- var re = /./;
1812
- re.exec = function () {
1813
- var result = [];
1814
- result.groups = { a: '7' };
1815
- return result;
1816
- };
1817
- // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
1818
- return ''.replace(re, '$<a>') !== '7';
1819
- });
1820
-
1821
- // @@replace logic
1822
- fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
1823
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
1824
-
1825
- return [
1826
- // `String.prototype.replace` method
1827
- // https://tc39.es/ecma262/#sec-string.prototype.replace
1828
- function replace(searchValue, replaceValue) {
1829
- var O = requireObjectCoercible(this);
1830
- var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
1831
- return replacer
1832
- ? call(replacer, searchValue, O, replaceValue)
1833
- : call(nativeReplace, toString(O), searchValue, replaceValue);
1834
- },
1835
- // `RegExp.prototype[@@replace]` method
1836
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
1837
- function (string, replaceValue) {
1838
- var rx = anObject(this);
1839
- var S = toString(string);
1840
-
1841
- if (
1842
- typeof replaceValue == 'string' &&
1843
- stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
1844
- stringIndexOf(replaceValue, '$<') === -1
1845
- ) {
1846
- var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
1847
- if (res.done) return res.value;
1848
- }
1849
-
1850
- var functionalReplace = isCallable(replaceValue);
1851
- if (!functionalReplace) replaceValue = toString(replaceValue);
1852
-
1853
- var global = rx.global;
1854
- if (global) {
1855
- var fullUnicode = rx.unicode;
1856
- rx.lastIndex = 0;
1857
- }
1858
- var results = [];
1859
- while (true) {
1860
- var result = regExpExec(rx, S);
1861
- if (result === null) break;
1862
-
1863
- push(results, result);
1864
- if (!global) break;
1865
-
1866
- var matchStr = toString(result[0]);
1867
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1868
- }
1869
-
1870
- var accumulatedResult = '';
1871
- var nextSourcePosition = 0;
1872
- for (var i = 0; i < results.length; i++) {
1873
- result = results[i];
1874
-
1875
- var matched = toString(result[0]);
1876
- var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
1877
- var captures = [];
1878
- // NOTE: This is equivalent to
1879
- // captures = result.slice(1).map(maybeToString)
1880
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
1881
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
1882
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
1883
- for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
1884
- var namedCaptures = result.groups;
1885
- if (functionalReplace) {
1886
- var replacerArgs = concat([matched], captures, position, S);
1887
- if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
1888
- var replacement = toString(apply(replaceValue, undefined, replacerArgs));
1889
- } else {
1890
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
1891
- }
1892
- if (position >= nextSourcePosition) {
1893
- accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
1894
- nextSourcePosition = position + matched.length;
1895
- }
1896
- }
1897
- return accumulatedResult + stringSlice(S, nextSourcePosition);
1898
- }
1899
- ];
1900
- }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
1901
-
1902
- var MergeTag = function MergeTag(_a) {
1903
- var id = _a.id;
1904
-
1905
- var _b = useProfile(),
1906
- loading = _b.loading,
1907
- profile = _b.profile;
1908
-
1909
- if (loading || !profile) {
1910
- return null;
1911
- }
1912
-
1913
- var value = get__default["default"](profile, id.replace(/_/g, '.')); // DON'T CHANGE
1914
-
1915
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, value);
1916
- };
1917
-
1918
- var TrackExperience = function TrackExperience(_a) {
1919
- var children = _a.children,
1920
- experience = _a.experience,
1921
- variant = _a.variant,
1922
- profile = _a.profile;
1923
- var ninetailed = useNinetailed();
1924
-
1925
- var _b = reactIntersectionObserver.useInView({
1926
- triggerOnce: true
1927
- }),
1928
- ref = _b.ref,
1929
- inView = _b.inView;
1930
-
1931
- React.useEffect(function () {
1932
- if (experience_jsShared.isBrowser() && inView) {
1933
- var distribution = experience_js.selectDistribution({
1934
- experience: experience,
1935
- profile: profile
1936
- });
1937
- ninetailed.trackExperience({
1938
- experience: experience,
1939
- component: variant,
1940
- variant: distribution.index
1941
- });
1942
- }
1943
- }, [inView]);
1944
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1945
- ref: ref,
1946
- id: "nt-experience-handle"
1947
- }), children);
1948
- };
1949
-
1950
- var global$2 = global$t;
1951
- var aCallable = aCallable$2;
1952
- var toObject = toObject$3;
1953
- var IndexedObject = indexedObject;
1954
- var lengthOfArrayLike = lengthOfArrayLike$2;
1955
-
1956
- var TypeError$1 = global$2.TypeError;
1957
-
1958
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
1959
- var createMethod = function (IS_RIGHT) {
1960
- return function (that, callbackfn, argumentsLength, memo) {
1961
- aCallable(callbackfn);
1962
- var O = toObject(that);
1963
- var self = IndexedObject(O);
1964
- var length = lengthOfArrayLike(O);
1965
- var index = IS_RIGHT ? length - 1 : 0;
1966
- var i = IS_RIGHT ? -1 : 1;
1967
- if (argumentsLength < 2) while (true) {
1968
- if (index in self) {
1969
- memo = self[index];
1970
- index += i;
1971
- break;
1972
- }
1973
- index += i;
1974
- if (IS_RIGHT ? index < 0 : length <= index) {
1975
- throw TypeError$1('Reduce of empty array with no initial value');
1976
- }
1977
- }
1978
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1979
- memo = callbackfn(memo, self[index], index, O);
1980
- }
1981
- return memo;
1982
- };
1983
- };
1984
-
1985
- var arrayReduce = {
1986
- // `Array.prototype.reduce` method
1987
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1988
- left: createMethod(false),
1989
- // `Array.prototype.reduceRight` method
1990
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1991
- right: createMethod(true)
1992
- };
1993
-
1994
- var fails = fails$d;
1995
-
1996
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1997
- var method = [][METHOD_NAME];
1998
- return !!method && fails(function () {
1999
- // eslint-disable-next-line no-useless-call -- required for testing
2000
- method.call(null, argument || function () { return 1; }, 1);
2001
- });
2002
- };
2003
-
2004
- var classof = classofRaw$1;
2005
- var global$1 = global$t;
2006
-
2007
- var engineIsNode = classof(global$1.process) == 'process';
2008
-
2009
- var $ = _export;
2010
- var $reduce = arrayReduce.left;
2011
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
2012
- var CHROME_VERSION = engineV8Version;
2013
- var IS_NODE = engineIsNode;
2014
-
2015
- var STRICT_METHOD = arrayMethodIsStrict('reduce');
2016
- // Chrome 80-82 has a critical bug
2017
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
2018
- var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
2019
-
2020
- // `Array.prototype.reduce` method
2021
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
2022
- $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
2023
- reduce: function reduce(callbackfn /* , initialValue */) {
2024
- var length = arguments.length;
2025
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
2026
- }
2027
- });
2028
-
2029
- var useExperiments = function useExperiments() {
2030
- var context = React.useContext(ExperimentsContext);
2031
-
2032
- if (context === undefined) {
2033
- throw new Error('The component using the the context must be a descendant of the ExperimentsProvider');
2034
- }
2035
-
2036
- return {
2037
- experiments: context.experiments
2038
- };
2039
- };
2040
-
2041
- var useExperience = function useExperience(_a) {
2042
- var baseline = _a.baseline,
2043
- experiences = _a.experiences;
2044
- var profileState = useProfile();
2045
- var experiments = useExperiments().experiments;
2046
- var hasVariants = experiences.map(function (experience) {
2047
- return experience_js.selectHasExperienceVariants(experience, baseline);
2048
- }).reduce(function (acc, curr) {
2049
- return acc || curr;
2050
- }, false);
2051
- var status = profileState.status,
2052
- profile = profileState.profile;
2053
-
2054
- var baseReturn = __assign(__assign({}, profileState), {
2055
- hasVariants: hasVariants,
2056
- baseline: baseline
2057
- });
2058
-
2059
- var emptyReturn = __assign(__assign({}, baseReturn), {
2060
- experience: null,
2061
- variant: null,
2062
- audience: null,
2063
- isPersonalized: false,
2064
- profile: null
2065
- });
2066
-
2067
- if (status === 'loading') {
2068
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2069
- // @ts-ignore
2070
- return emptyReturn;
2071
- }
2072
-
2073
- if (status === 'error') {
2074
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2075
- // @ts-ignore
2076
- return emptyReturn;
2077
- }
2078
-
2079
- if (!profile) {
2080
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2081
- // @ts-ignore
2082
- return emptyReturn;
2083
- }
2084
-
2085
- var activeExperiments = experience_js.selectActiveExperiments(experiments, profile);
2086
- var experience = experience_js.selectExperience({
2087
- experiences: experiences,
2088
- activeExperiments: activeExperiments,
2089
- profile: profile
2090
- });
2091
-
2092
- if (!experience) {
2093
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2094
- // @ts-ignore
2095
- return emptyReturn;
2096
- }
2097
-
2098
- var audience = experience.audience;
2099
- var variant = experience_js.selectExperienceVariant({
2100
- baseline: baseline,
2101
- experience: experience,
2102
- profile: profile
2103
- });
2104
-
2105
- if (!variant) {
2106
- return __assign(__assign({}, baseReturn), {
2107
- status: 'success',
2108
- loading: false,
2109
- error: null,
2110
- experience: experience,
2111
- variant: null,
2112
- audience: audience ? audience : null,
2113
- profile: profile,
2114
- isPersonalized: false
2115
- });
2116
- }
2117
-
2118
- return __assign(__assign({}, baseReturn), {
2119
- status: 'success',
2120
- loading: false,
2121
- error: null,
2122
- experience: experience,
2123
- variant: variant,
2124
- audience: audience ? audience : null,
2125
- profile: profile,
2126
- isPersonalized: true
2127
- });
2128
- };
2129
-
2130
- var EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
2131
-
2132
- var useJoinExperiment = function useJoinExperiment(_a) {
2133
- var experiences = _a.experiences;
2134
- var identify = useNinetailed().identify; // TODO this gets called twice
2135
-
2136
- return React.useCallback(function (_a) {
2137
- var _b;
2138
-
2139
- var experiment = _a.experiment,
2140
- profile = _a.profile;
2141
- var activeExperiments = experience_js.selectActiveExperiments(experiences, profile);
2142
-
2143
- if (!activeExperiments.length && experiment.type === 'nt_experiment') {
2144
- identify(profile.id, (_b = {}, _b["".concat(EXPERIENCE_TRAIT_PREFIX).concat(experiment.id)] = true, _b));
2145
- }
2146
- }, [experiences]);
2147
- };
2148
-
2149
- var DefaultExperienceLoadingComponent = function DefaultExperienceLoadingComponent(_a) {
2150
- var Component = _a.component;
2151
- _a.experiences;
2152
- var _b = _a.unhideAfterMs,
2153
- unhideAfterMs = _b === void 0 ? 5000 : _b,
2154
- passthroughProps = _a.passthroughProps,
2155
- baseline = __rest(_a, ["component", "experiences", "unhideAfterMs", "passthroughProps"]);
2156
-
2157
- var logger = useNinetailed().logger;
2158
-
2159
- var _c = React.useState(true),
2160
- hidden = _c[0],
2161
- setHidden = _c[1];
2162
-
2163
- React.useEffect(function () {
2164
- var timer = setTimeout(function () {
2165
- setHidden(false);
2166
- logger.error(new Error("The experience was still in loading state after ".concat(unhideAfterMs, "ms. That happens when no events are sent to the Ninetailed API. The baseline is now shown instead.")));
2167
- }, unhideAfterMs);
2168
- return function () {
2169
- clearTimeout(timer);
2170
- };
2171
- }, []);
2172
-
2173
- if (hidden) {
2174
- return /*#__PURE__*/React__default["default"].createElement("div", {
2175
- key: "hide",
2176
- style: {
2177
- opacity: 0
2178
- }
2179
- }, /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2180
- ninetailed: {
2181
- isPersonalized: false,
2182
- audience: {
2183
- id: 'baseline'
2184
- }
2185
- }
2186
- })));
2187
- }
2188
-
2189
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2190
- ninetailed: {
2191
- isPersonalized: false,
2192
- audience: {
2193
- id: 'baseline'
2194
- }
2195
- }
2196
- }));
2197
- };
2198
- var Experience = function Experience(_a) {
2199
- var experiences = _a.experiences,
2200
- Component = _a.component,
2201
- _b = _a.loadingComponent,
2202
- LoadingComponent = _b === void 0 ? DefaultExperienceLoadingComponent : _b,
2203
- passthroughProps = _a.passthroughProps,
2204
- baseline = __rest(_a, ["experiences", "component", "loadingComponent", "passthroughProps"]);
2205
-
2206
- var _c = useExperience({
2207
- baseline: baseline,
2208
- experiences: experiences
2209
- }),
2210
- status = _c.status,
2211
- hasVariants = _c.hasVariants,
2212
- experience = _c.experience,
2213
- variant = _c.variant,
2214
- audience = _c.audience,
2215
- isPersonalized = _c.isPersonalized,
2216
- profile = _c.profile;
2217
-
2218
- var joinExperiment = useJoinExperiment({
2219
- experiences: experiences
2220
- });
2221
- React.useEffect(function () {
2222
- if (status === 'success' && experience && profile) {
2223
- joinExperiment({
2224
- experiment: experience,
2225
- profile: profile
2226
- });
2227
- }
2228
- }, [status, experience, profile]);
2229
-
2230
- if (!hasVariants) {
2231
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline));
2232
- }
2233
-
2234
- if (status === 'loading') {
2235
- return /*#__PURE__*/React__default["default"].createElement(LoadingComponent, __assign({}, baseline, {
2236
- passthroughProps: passthroughProps,
2237
- experiences: experiences,
2238
- component: Component
2239
- }));
2240
- }
2241
-
2242
- if (!experience) {
2243
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2244
- key: baseline.id,
2245
- ninetailed: {
2246
- isPersonalized: false,
2247
- audience: {
2248
- id: 'baseline'
2249
- }
2250
- }
2251
- }));
2252
- }
2253
-
2254
- if (!variant) {
2255
- return /*#__PURE__*/React__default["default"].createElement(TrackExperience, {
2256
- experience: experience,
2257
- variant: baseline,
2258
- // the profile is definitely defined, otherwise there wouldn't be an experience selected
2259
- profile: profile
2260
- }, /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2261
- key: baseline.id,
2262
- ninetailed: {
2263
- isPersonalized: false,
2264
- audience: {
2265
- id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2266
- }
2267
- }
2268
- })));
2269
- }
2270
-
2271
- return /*#__PURE__*/React__default["default"].createElement(TrackExperience, {
2272
- experience: experience,
2273
- variant: variant,
2274
- // the profile is definitely defined, otherwise there wouldn't be an experience selected
2275
- profile: profile
2276
- }, (variant === null || variant === void 0 ? void 0 : variant.hidden) ? null : /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, variant, {
2277
- key: "".concat(experience.id, "-").concat(variant.id),
2278
- ninetailed: {
2279
- isPersonalized: isPersonalized,
2280
- audience: {
2281
- id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2282
- }
2283
- }
2284
- })));
2285
- };
2286
-
2287
- var ESRContext = /*#__PURE__*/React__default["default"].createContext(undefined);
2288
- var ESRProvider = function ESRProvider(_a) {
2289
- var experienceVariantsMap = _a.experienceVariantsMap,
2290
- children = _a.children;
2291
- return /*#__PURE__*/React__default["default"].createElement(ESRContext.Provider, {
2292
- value: {
2293
- experienceVariantsMap: experienceVariantsMap
2294
- }
2295
- }, children);
2296
- };
2297
- var useESR = function useESR() {
2298
- var context = React__default["default"].useContext(ESRContext);
2299
-
2300
- if (context === undefined) {
2301
- throw new Error('The component using the the context must be a descendant of the ESRProvider');
2302
- }
2303
-
2304
- return {
2305
- experienceVariantsMap: context.experienceVariantsMap
2306
- };
2307
- };
2308
- var ESRLoadingComponent = function ESRLoadingComponent(_a) {
2309
- var experiences = _a.experiences,
2310
- Component = _a.component,
2311
- passthroughProps = _a.passthroughProps,
2312
- baseline = __rest(_a, ["experiences", "component", "passthroughProps"]);
2313
-
2314
- var experienceVariantsMap = useESR().experienceVariantsMap;
2315
- var experience = experiences.find(function (experience) {
2316
- return has__default["default"](experienceVariantsMap, experience.id);
2317
- });
2318
-
2319
- if (!experience) {
2320
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2321
- ninetailed: {
2322
- isPersonalized: false,
2323
- audience: {
2324
- id: 'baseline'
2325
- }
2326
- }
2327
- }));
2328
- }
2329
-
2330
- var component = experience.components.find(function (component) {
2331
- return component.baseline.id === baseline.id;
2332
- });
2333
-
2334
- if (!component) {
2335
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2336
- ninetailed: {
2337
- isPersonalized: false,
2338
- audience: {
2339
- id: 'baseline'
2340
- }
2341
- }
2342
- }));
2343
- }
2344
-
2345
- if (experienceVariantsMap[experience.id] === 0) {
2346
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2347
- ninetailed: {
2348
- isPersonalized: false,
2349
- audience: {
2350
- id: 'baseline'
2351
- }
2352
- }
2353
- }));
2354
- }
2355
-
2356
- var variant = component.variants[experienceVariantsMap[experience.id] - 1];
2357
-
2358
- if (!variant) {
2359
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, baseline, {
2360
- ninetailed: {
2361
- isPersonalized: false,
2362
- audience: {
2363
- id: 'baseline'
2364
- }
2365
- }
2366
- }));
2367
- }
2368
-
2369
- return /*#__PURE__*/React__default["default"].createElement(Component, __assign({}, passthroughProps, variant, {
2370
- ninetailed: {
2371
- isPersonalized: false,
2372
- audience: {
2373
- id: 'baseline'
2374
- }
2375
- }
2376
- }));
2377
- };
2378
-
2379
- exports.DefaultExperienceLoadingComponent = DefaultExperienceLoadingComponent;
2380
- exports.ESRLoadingComponent = ESRLoadingComponent;
2381
- exports.ESRProvider = ESRProvider;
2382
- exports.Experience = Experience;
2383
- exports.MergeTag = MergeTag;
2384
- exports.NinetailedProvider = NinetailedProvider;
2385
- exports.Personalize = Personalize;
2386
- exports.TrackHasSeenComponent = TrackHasSeenComponent;
2387
- exports.useNinetailed = useNinetailed;
2388
- exports.usePersonalize = usePersonalize;
2389
- exports.useProfile = useProfile;
2390
-
2391
- Object.defineProperty(exports, '__esModule', { value: true });
2392
-
2393
- }));