@ninetailed/experience.js-react 3.0.0-beta.19 → 3.0.0-beta.21

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