@ninetailed/experience.js-react 4.1.0-beta.0 → 4.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -5,22 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
7
  var experience_js = require('@ninetailed/experience.js');
8
- var _debounce = require('lodash/debounce');
9
- var values$1 = require('lodash/values');
8
+ var reactIntersectionObserver = require('react-intersection-observer');
10
9
  var experience_jsShared = require('@ninetailed/experience.js-shared');
11
10
  var isEqual = require('lodash/isEqual');
12
- var reactIntersectionObserver = require('react-intersection-observer');
13
- var get$1 = require('lodash/get');
14
11
  var has$1 = require('lodash/has');
12
+ var _debounce = require('lodash/debounce');
13
+ var values$1 = require('lodash/values');
14
+ var get$1 = require('lodash/get');
15
15
 
16
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
17
 
18
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
20
+ var has__default = /*#__PURE__*/_interopDefaultLegacy(has$1);
19
21
  var _debounce__default = /*#__PURE__*/_interopDefaultLegacy(_debounce);
20
22
  var values__default = /*#__PURE__*/_interopDefaultLegacy(values$1);
21
- var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
22
23
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get$1);
23
- var has__default = /*#__PURE__*/_interopDefaultLegacy(has$1);
24
24
 
25
25
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
26
26
 
@@ -41,7 +41,7 @@ var global$d =
41
41
 
42
42
  var objectGetOwnPropertyDescriptor = {};
43
43
 
44
- var fails$d = function (exec) {
44
+ var fails$c = function (exec) {
45
45
  try {
46
46
  return !!exec();
47
47
  } catch (error) {
@@ -49,28 +49,28 @@ var fails$d = function (exec) {
49
49
  }
50
50
  };
51
51
 
52
- var fails$c = fails$d;
52
+ var fails$b = fails$c;
53
53
 
54
54
  // Detect IE8's incomplete defineProperty implementation
55
- var descriptors = !fails$c(function () {
55
+ var descriptors = !fails$b(function () {
56
56
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
57
57
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
58
58
  });
59
59
 
60
- var fails$b = fails$d;
60
+ var fails$a = fails$c;
61
61
 
62
- var functionBindNative = !fails$b(function () {
62
+ var functionBindNative = !fails$a(function () {
63
63
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
64
64
  var test = (function () { /* empty */ }).bind();
65
65
  // eslint-disable-next-line no-prototype-builtins -- safe
66
66
  return typeof test != 'function' || test.hasOwnProperty('prototype');
67
67
  });
68
68
 
69
- var NATIVE_BIND$2 = functionBindNative;
69
+ var NATIVE_BIND$1 = functionBindNative;
70
70
 
71
71
  var call$6 = Function.prototype.call;
72
72
 
73
- var functionCall = NATIVE_BIND$2 ? call$6.bind(call$6) : function () {
73
+ var functionCall = NATIVE_BIND$1 ? call$6.bind(call$6) : function () {
74
74
  return call$6.apply(call$6, arguments);
75
75
  };
76
76
 
@@ -99,41 +99,41 @@ var createPropertyDescriptor$3 = function (bitmap, value) {
99
99
  };
100
100
  };
101
101
 
102
- var NATIVE_BIND$1 = functionBindNative;
102
+ var NATIVE_BIND = functionBindNative;
103
103
 
104
104
  var FunctionPrototype$1 = Function.prototype;
105
105
  var call$5 = FunctionPrototype$1.call;
106
- var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$5, call$5);
106
+ var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype$1.bind.bind(call$5, call$5);
107
107
 
108
- var functionUncurryThis = NATIVE_BIND$1 ? uncurryThisWithBind : function (fn) {
108
+ var functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
109
109
  return function () {
110
110
  return call$5.apply(fn, arguments);
111
111
  };
112
112
  };
113
113
 
114
- var uncurryThis$d = functionUncurryThis;
114
+ var uncurryThis$a = functionUncurryThis;
115
115
 
116
- var toString$3 = uncurryThis$d({}.toString);
117
- var stringSlice$1 = uncurryThis$d(''.slice);
116
+ var toString$3 = uncurryThis$a({}.toString);
117
+ var stringSlice$1 = uncurryThis$a(''.slice);
118
118
 
119
- var classofRaw$2 = function (it) {
119
+ var classofRaw$1 = function (it) {
120
120
  return stringSlice$1(toString$3(it), 8, -1);
121
121
  };
122
122
 
123
- var uncurryThis$c = functionUncurryThis;
124
- var fails$a = fails$d;
125
- var classof$5 = classofRaw$2;
123
+ var uncurryThis$9 = functionUncurryThis;
124
+ var fails$9 = fails$c;
125
+ var classof$3 = classofRaw$1;
126
126
 
127
127
  var $Object$4 = Object;
128
- var split = uncurryThis$c(''.split);
128
+ var split = uncurryThis$9(''.split);
129
129
 
130
130
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
131
- var indexedObject = fails$a(function () {
131
+ var indexedObject = fails$9(function () {
132
132
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
133
133
  // eslint-disable-next-line no-prototype-builtins -- safe
134
134
  return !$Object$4('z').propertyIsEnumerable(0);
135
135
  }) ? function (it) {
136
- return classof$5(it) == 'String' ? split(it, '') : $Object$4(it);
136
+ return classof$3(it) == 'String' ? split(it, '') : $Object$4(it);
137
137
  } : $Object$4;
138
138
 
139
139
  // we can't use just `it == null` since of `document.all` special case
@@ -144,12 +144,12 @@ var isNullOrUndefined$2 = function (it) {
144
144
 
145
145
  var isNullOrUndefined$1 = isNullOrUndefined$2;
146
146
 
147
- var $TypeError$8 = TypeError;
147
+ var $TypeError$7 = TypeError;
148
148
 
149
149
  // `RequireObjectCoercible` abstract operation
150
150
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
151
151
  var requireObjectCoercible$2 = function (it) {
152
- if (isNullOrUndefined$1(it)) throw $TypeError$8("Can't call method on " + it);
152
+ if (isNullOrUndefined$1(it)) throw $TypeError$7("Can't call method on " + it);
153
153
  return it;
154
154
  };
155
155
 
@@ -177,41 +177,41 @@ var documentAll$1 = $documentAll$1.all;
177
177
 
178
178
  // `IsCallable` abstract operation
179
179
  // https://tc39.es/ecma262/#sec-iscallable
180
- var isCallable$h = $documentAll$1.IS_HTMLDDA ? function (argument) {
180
+ var isCallable$g = $documentAll$1.IS_HTMLDDA ? function (argument) {
181
181
  return typeof argument == 'function' || argument === documentAll$1;
182
182
  } : function (argument) {
183
183
  return typeof argument == 'function';
184
184
  };
185
185
 
186
- var isCallable$g = isCallable$h;
186
+ var isCallable$f = isCallable$g;
187
187
  var $documentAll = documentAll_1;
188
188
 
189
189
  var documentAll = $documentAll.all;
190
190
 
191
- var isObject$7 = $documentAll.IS_HTMLDDA ? function (it) {
192
- return typeof it == 'object' ? it !== null : isCallable$g(it) || it === documentAll;
191
+ var isObject$6 = $documentAll.IS_HTMLDDA ? function (it) {
192
+ return typeof it == 'object' ? it !== null : isCallable$f(it) || it === documentAll;
193
193
  } : function (it) {
194
- return typeof it == 'object' ? it !== null : isCallable$g(it);
194
+ return typeof it == 'object' ? it !== null : isCallable$f(it);
195
195
  };
196
196
 
197
197
  var global$c = global$d;
198
- var isCallable$f = isCallable$h;
198
+ var isCallable$e = isCallable$g;
199
199
 
200
200
  var aFunction = function (argument) {
201
- return isCallable$f(argument) ? argument : undefined;
201
+ return isCallable$e(argument) ? argument : undefined;
202
202
  };
203
203
 
204
- var getBuiltIn$5 = function (namespace, method) {
204
+ var getBuiltIn$4 = function (namespace, method) {
205
205
  return arguments.length < 2 ? aFunction(global$c[namespace]) : global$c[namespace] && global$c[namespace][method];
206
206
  };
207
207
 
208
- var uncurryThis$b = functionUncurryThis;
208
+ var uncurryThis$8 = functionUncurryThis;
209
209
 
210
- var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
210
+ var objectIsPrototypeOf = uncurryThis$8({}.isPrototypeOf);
211
211
 
212
- var getBuiltIn$4 = getBuiltIn$5;
212
+ var getBuiltIn$3 = getBuiltIn$4;
213
213
 
214
- var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
214
+ var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
215
215
 
216
216
  var global$b = global$d;
217
217
  var userAgent = engineUserAgent;
@@ -244,10 +244,10 @@ var engineV8Version = version;
244
244
  /* eslint-disable es/no-symbol -- required for testing */
245
245
 
246
246
  var V8_VERSION = engineV8Version;
247
- var fails$9 = fails$d;
247
+ var fails$8 = fails$c;
248
248
 
249
249
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
250
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$9(function () {
250
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$8(function () {
251
251
  var symbol = Symbol();
252
252
  // Chrome 38 Symbol has incorrect toString conversion
253
253
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
@@ -264,8 +264,8 @@ var useSymbolAsUid = NATIVE_SYMBOL$2
264
264
  && !Symbol.sham
265
265
  && typeof Symbol.iterator == 'symbol';
266
266
 
267
- var getBuiltIn$3 = getBuiltIn$5;
268
- var isCallable$e = isCallable$h;
267
+ var getBuiltIn$2 = getBuiltIn$4;
268
+ var isCallable$d = isCallable$g;
269
269
  var isPrototypeOf$1 = objectIsPrototypeOf;
270
270
  var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
271
271
 
@@ -274,8 +274,8 @@ var $Object$3 = Object;
274
274
  var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
275
275
  return typeof it == 'symbol';
276
276
  } : function (it) {
277
- var $Symbol = getBuiltIn$3('Symbol');
278
- return isCallable$e($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$3(it));
277
+ var $Symbol = getBuiltIn$2('Symbol');
278
+ return isCallable$d($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$3(it));
279
279
  };
280
280
 
281
281
  var $String$3 = String;
@@ -288,41 +288,41 @@ var tryToString$1 = function (argument) {
288
288
  }
289
289
  };
290
290
 
291
- var isCallable$d = isCallable$h;
291
+ var isCallable$c = isCallable$g;
292
292
  var tryToString = tryToString$1;
293
293
 
294
- var $TypeError$7 = TypeError;
294
+ var $TypeError$6 = TypeError;
295
295
 
296
296
  // `Assert: IsCallable(argument) is true`
297
- var aCallable$3 = function (argument) {
298
- if (isCallable$d(argument)) return argument;
299
- throw $TypeError$7(tryToString(argument) + ' is not a function');
297
+ var aCallable$2 = function (argument) {
298
+ if (isCallable$c(argument)) return argument;
299
+ throw $TypeError$6(tryToString(argument) + ' is not a function');
300
300
  };
301
301
 
302
- var aCallable$2 = aCallable$3;
302
+ var aCallable$1 = aCallable$2;
303
303
  var isNullOrUndefined = isNullOrUndefined$2;
304
304
 
305
305
  // `GetMethod` abstract operation
306
306
  // https://tc39.es/ecma262/#sec-getmethod
307
307
  var getMethod$1 = function (V, P) {
308
308
  var func = V[P];
309
- return isNullOrUndefined(func) ? undefined : aCallable$2(func);
309
+ return isNullOrUndefined(func) ? undefined : aCallable$1(func);
310
310
  };
311
311
 
312
312
  var call$4 = functionCall;
313
- var isCallable$c = isCallable$h;
314
- var isObject$6 = isObject$7;
313
+ var isCallable$b = isCallable$g;
314
+ var isObject$5 = isObject$6;
315
315
 
316
- var $TypeError$6 = TypeError;
316
+ var $TypeError$5 = TypeError;
317
317
 
318
318
  // `OrdinaryToPrimitive` abstract operation
319
319
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
320
320
  var ordinaryToPrimitive$1 = function (input, pref) {
321
321
  var fn, val;
322
- if (pref === 'string' && isCallable$c(fn = input.toString) && !isObject$6(val = call$4(fn, input))) return val;
323
- if (isCallable$c(fn = input.valueOf) && !isObject$6(val = call$4(fn, input))) return val;
324
- if (pref !== 'string' && isCallable$c(fn = input.toString) && !isObject$6(val = call$4(fn, input))) return val;
325
- throw $TypeError$6("Can't convert object to primitive value");
322
+ if (pref === 'string' && isCallable$b(fn = input.toString) && !isObject$5(val = call$4(fn, input))) return val;
323
+ if (isCallable$b(fn = input.valueOf) && !isObject$5(val = call$4(fn, input))) return val;
324
+ if (pref !== 'string' && isCallable$b(fn = input.toString) && !isObject$5(val = call$4(fn, input))) return val;
325
+ throw $TypeError$5("Can't convert object to primitive value");
326
326
  };
327
327
 
328
328
  var shared$3 = {exports: {}};
@@ -366,27 +366,27 @@ var $Object$2 = Object;
366
366
 
367
367
  // `ToObject` abstract operation
368
368
  // https://tc39.es/ecma262/#sec-toobject
369
- var toObject$5 = function (argument) {
369
+ var toObject$4 = function (argument) {
370
370
  return $Object$2(requireObjectCoercible(argument));
371
371
  };
372
372
 
373
- var uncurryThis$a = functionUncurryThis;
374
- var toObject$4 = toObject$5;
373
+ var uncurryThis$7 = functionUncurryThis;
374
+ var toObject$3 = toObject$4;
375
375
 
376
- var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
376
+ var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
377
377
 
378
378
  // `HasOwnProperty` abstract operation
379
379
  // https://tc39.es/ecma262/#sec-hasownproperty
380
380
  // eslint-disable-next-line es/no-object-hasown -- safe
381
381
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
382
- return hasOwnProperty(toObject$4(it), key);
382
+ return hasOwnProperty(toObject$3(it), key);
383
383
  };
384
384
 
385
- var uncurryThis$9 = functionUncurryThis;
385
+ var uncurryThis$6 = functionUncurryThis;
386
386
 
387
387
  var id = 0;
388
388
  var postfix = Math.random();
389
- var toString$2 = uncurryThis$9(1.0.toString);
389
+ var toString$2 = uncurryThis$6(1.0.toString);
390
390
 
391
391
  var uid$2 = function (key) {
392
392
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
@@ -404,7 +404,7 @@ var Symbol$1 = global$8.Symbol;
404
404
  var symbolFor = Symbol$1 && Symbol$1['for'];
405
405
  var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
406
406
 
407
- var wellKnownSymbol$9 = function (name) {
407
+ var wellKnownSymbol$8 = function (name) {
408
408
  if (!hasOwn$9(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore[name] == 'string')) {
409
409
  var description = 'Symbol.' + name;
410
410
  if (NATIVE_SYMBOL$1 && hasOwn$9(Symbol$1, name)) {
@@ -418,26 +418,26 @@ var wellKnownSymbol$9 = function (name) {
418
418
  };
419
419
 
420
420
  var call$3 = functionCall;
421
- var isObject$5 = isObject$7;
421
+ var isObject$4 = isObject$6;
422
422
  var isSymbol$1 = isSymbol$2;
423
423
  var getMethod = getMethod$1;
424
424
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
425
- var wellKnownSymbol$8 = wellKnownSymbol$9;
425
+ var wellKnownSymbol$7 = wellKnownSymbol$8;
426
426
 
427
- var $TypeError$5 = TypeError;
428
- var TO_PRIMITIVE = wellKnownSymbol$8('toPrimitive');
427
+ var $TypeError$4 = TypeError;
428
+ var TO_PRIMITIVE = wellKnownSymbol$7('toPrimitive');
429
429
 
430
430
  // `ToPrimitive` abstract operation
431
431
  // https://tc39.es/ecma262/#sec-toprimitive
432
432
  var toPrimitive$1 = function (input, pref) {
433
- if (!isObject$5(input) || isSymbol$1(input)) return input;
433
+ if (!isObject$4(input) || isSymbol$1(input)) return input;
434
434
  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
435
435
  var result;
436
436
  if (exoticToPrim) {
437
437
  if (pref === undefined) pref = 'default';
438
438
  result = call$3(exoticToPrim, input, pref);
439
- if (!isObject$5(result) || isSymbol$1(result)) return result;
440
- throw $TypeError$5("Can't convert object to primitive value");
439
+ if (!isObject$4(result) || isSymbol$1(result)) return result;
440
+ throw $TypeError$4("Can't convert object to primitive value");
441
441
  }
442
442
  if (pref === undefined) pref = 'number';
443
443
  return ordinaryToPrimitive(input, pref);
@@ -454,22 +454,22 @@ var toPropertyKey$2 = function (argument) {
454
454
  };
455
455
 
456
456
  var global$7 = global$d;
457
- var isObject$4 = isObject$7;
457
+ var isObject$3 = isObject$6;
458
458
 
459
459
  var document$1 = global$7.document;
460
460
  // typeof document.createElement is 'object' in old IE
461
- var EXISTS$1 = isObject$4(document$1) && isObject$4(document$1.createElement);
461
+ var EXISTS$1 = isObject$3(document$1) && isObject$3(document$1.createElement);
462
462
 
463
463
  var documentCreateElement$2 = function (it) {
464
464
  return EXISTS$1 ? document$1.createElement(it) : {};
465
465
  };
466
466
 
467
467
  var DESCRIPTORS$a = descriptors;
468
- var fails$8 = fails$d;
468
+ var fails$7 = fails$c;
469
469
  var createElement = documentCreateElement$2;
470
470
 
471
471
  // Thanks to IE8 for its funny defineProperty
472
- var ie8DomDefine = !DESCRIPTORS$a && !fails$8(function () {
472
+ var ie8DomDefine = !DESCRIPTORS$a && !fails$7(function () {
473
473
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
474
474
  return Object.defineProperty(createElement('div'), 'a', {
475
475
  get: function () { return 7; }
@@ -502,11 +502,11 @@ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$9 ? $getOwnPropertyDescriptor$1 :
502
502
  var objectDefineProperty = {};
503
503
 
504
504
  var DESCRIPTORS$8 = descriptors;
505
- var fails$7 = fails$d;
505
+ var fails$6 = fails$c;
506
506
 
507
507
  // V8 ~ Chrome 36-
508
508
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
509
- var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$7(function () {
509
+ var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$6(function () {
510
510
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
511
511
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
512
512
  value: 42,
@@ -514,15 +514,15 @@ var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$7(function () {
514
514
  }).prototype != 42;
515
515
  });
516
516
 
517
- var isObject$3 = isObject$7;
517
+ var isObject$2 = isObject$6;
518
518
 
519
519
  var $String$2 = String;
520
- var $TypeError$4 = TypeError;
520
+ var $TypeError$3 = TypeError;
521
521
 
522
522
  // `Assert: Type(argument) is Object`
523
523
  var anObject$5 = function (argument) {
524
- if (isObject$3(argument)) return argument;
525
- throw $TypeError$4($String$2(argument) + ' is not an object');
524
+ if (isObject$2(argument)) return argument;
525
+ throw $TypeError$3($String$2(argument) + ' is not an object');
526
526
  };
527
527
 
528
528
  var DESCRIPTORS$7 = descriptors;
@@ -531,7 +531,7 @@ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
531
531
  var anObject$4 = anObject$5;
532
532
  var toPropertyKey = toPropertyKey$2;
533
533
 
534
- var $TypeError$3 = TypeError;
534
+ var $TypeError$2 = TypeError;
535
535
  // eslint-disable-next-line es/no-object-defineproperty -- safe
536
536
  var $defineProperty = Object.defineProperty;
537
537
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
@@ -564,7 +564,7 @@ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
564
564
  if (IE8_DOM_DEFINE) try {
565
565
  return $defineProperty(O, P, Attributes);
566
566
  } catch (error) { /* empty */ }
567
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError$3('Accessors not supported');
567
+ if ('get' in Attributes || 'set' in Attributes) throw $TypeError$2('Accessors not supported');
568
568
  if ('value' in Attributes) O[P] = Attributes.value;
569
569
  return O;
570
570
  };
@@ -600,27 +600,27 @@ var functionName = {
600
600
  CONFIGURABLE: CONFIGURABLE
601
601
  };
602
602
 
603
- var uncurryThis$8 = functionUncurryThis;
604
- var isCallable$b = isCallable$h;
603
+ var uncurryThis$5 = functionUncurryThis;
604
+ var isCallable$a = isCallable$g;
605
605
  var store$1 = sharedStore;
606
606
 
607
- var functionToString = uncurryThis$8(Function.toString);
607
+ var functionToString = uncurryThis$5(Function.toString);
608
608
 
609
609
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
610
- if (!isCallable$b(store$1.inspectSource)) {
610
+ if (!isCallable$a(store$1.inspectSource)) {
611
611
  store$1.inspectSource = function (it) {
612
612
  return functionToString(it);
613
613
  };
614
614
  }
615
615
 
616
- var inspectSource$2 = store$1.inspectSource;
616
+ var inspectSource$1 = store$1.inspectSource;
617
617
 
618
618
  var global$6 = global$d;
619
- var isCallable$a = isCallable$h;
619
+ var isCallable$9 = isCallable$g;
620
620
 
621
621
  var WeakMap$1 = global$6.WeakMap;
622
622
 
623
- var weakMapBasicDetection = isCallable$a(WeakMap$1) && /native code/.test(String(WeakMap$1));
623
+ var weakMapBasicDetection = isCallable$9(WeakMap$1) && /native code/.test(String(WeakMap$1));
624
624
 
625
625
  var shared$1 = shared$3.exports;
626
626
  var uid = uid$2;
@@ -635,7 +635,7 @@ var hiddenKeys$4 = {};
635
635
 
636
636
  var NATIVE_WEAK_MAP = weakMapBasicDetection;
637
637
  var global$5 = global$d;
638
- var isObject$2 = isObject$7;
638
+ var isObject$1 = isObject$6;
639
639
  var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
640
640
  var hasOwn$6 = hasOwnProperty_1;
641
641
  var shared = sharedStore;
@@ -654,7 +654,7 @@ var enforce = function (it) {
654
654
  var getterFor = function (TYPE) {
655
655
  return function (it) {
656
656
  var state;
657
- if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
657
+ if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
658
658
  throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
659
659
  } return state;
660
660
  };
@@ -704,12 +704,12 @@ var internalState = {
704
704
  getterFor: getterFor
705
705
  };
706
706
 
707
- var fails$6 = fails$d;
708
- var isCallable$9 = isCallable$h;
707
+ var fails$5 = fails$c;
708
+ var isCallable$8 = isCallable$g;
709
709
  var hasOwn$5 = hasOwnProperty_1;
710
710
  var DESCRIPTORS$4 = descriptors;
711
711
  var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
712
- var inspectSource$1 = inspectSource$2;
712
+ var inspectSource = inspectSource$1;
713
713
  var InternalStateModule$1 = internalState;
714
714
 
715
715
  var enforceInternalState = InternalStateModule$1.enforce;
@@ -717,7 +717,7 @@ var getInternalState$1 = InternalStateModule$1.get;
717
717
  // eslint-disable-next-line es/no-object-defineproperty -- safe
718
718
  var defineProperty$5 = Object.defineProperty;
719
719
 
720
- var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$6(function () {
720
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$5(function () {
721
721
  return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
722
722
  });
723
723
 
@@ -751,10 +751,10 @@ var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
751
751
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
752
752
  // eslint-disable-next-line no-extend-native -- required
753
753
  Function.prototype.toString = makeBuiltIn$1(function toString() {
754
- return isCallable$9(this) && getInternalState$1(this).source || inspectSource$1(this);
754
+ return isCallable$8(this) && getInternalState$1(this).source || inspectSource(this);
755
755
  }, 'toString');
756
756
 
757
- var isCallable$8 = isCallable$h;
757
+ var isCallable$7 = isCallable$g;
758
758
  var definePropertyModule$2 = objectDefineProperty;
759
759
  var makeBuiltIn = makeBuiltIn$2.exports;
760
760
  var defineGlobalProperty$1 = defineGlobalProperty$3;
@@ -763,7 +763,7 @@ var defineBuiltIn$3 = function (O, key, value, options) {
763
763
  if (!options) options = {};
764
764
  var simple = options.enumerable;
765
765
  var name = options.name !== undefined ? options.name : key;
766
- if (isCallable$8(value)) makeBuiltIn(value, name, options);
766
+ if (isCallable$7(value)) makeBuiltIn(value, name, options);
767
767
  if (options.global) {
768
768
  if (simple) O[key] = value;
769
769
  else defineGlobalProperty$1(key, value);
@@ -799,13 +799,13 @@ var trunc = mathTrunc;
799
799
 
800
800
  // `ToIntegerOrInfinity` abstract operation
801
801
  // https://tc39.es/ecma262/#sec-tointegerorinfinity
802
- var toIntegerOrInfinity$3 = function (argument) {
802
+ var toIntegerOrInfinity$2 = function (argument) {
803
803
  var number = +argument;
804
804
  // eslint-disable-next-line no-self-compare -- NaN check
805
805
  return number !== number || number === 0 ? 0 : trunc(number);
806
806
  };
807
807
 
808
- var toIntegerOrInfinity$2 = toIntegerOrInfinity$3;
808
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
809
809
 
810
810
  var max = Math.max;
811
811
  var min$1 = Math.min;
@@ -814,37 +814,37 @@ var min$1 = Math.min;
814
814
  // Let integer be ? ToInteger(index).
815
815
  // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
816
816
  var toAbsoluteIndex$1 = function (index, length) {
817
- var integer = toIntegerOrInfinity$2(index);
817
+ var integer = toIntegerOrInfinity$1(index);
818
818
  return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
819
819
  };
820
820
 
821
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$3;
821
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
822
822
 
823
823
  var min = Math.min;
824
824
 
825
825
  // `ToLength` abstract operation
826
826
  // https://tc39.es/ecma262/#sec-tolength
827
827
  var toLength$1 = function (argument) {
828
- return argument > 0 ? min(toIntegerOrInfinity$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
828
+ return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
829
829
  };
830
830
 
831
831
  var toLength = toLength$1;
832
832
 
833
833
  // `LengthOfArrayLike` abstract operation
834
834
  // https://tc39.es/ecma262/#sec-lengthofarraylike
835
- var lengthOfArrayLike$4 = function (obj) {
835
+ var lengthOfArrayLike$2 = function (obj) {
836
836
  return toLength(obj.length);
837
837
  };
838
838
 
839
839
  var toIndexedObject$3 = toIndexedObject$5;
840
840
  var toAbsoluteIndex = toAbsoluteIndex$1;
841
- var lengthOfArrayLike$3 = lengthOfArrayLike$4;
841
+ var lengthOfArrayLike$1 = lengthOfArrayLike$2;
842
842
 
843
843
  // `Array.prototype.{ indexOf, includes }` methods implementation
844
844
  var createMethod$1 = function (IS_INCLUDES) {
845
845
  return function ($this, el, fromIndex) {
846
846
  var O = toIndexedObject$3($this);
847
- var length = lengthOfArrayLike$3(O);
847
+ var length = lengthOfArrayLike$1(O);
848
848
  var index = toAbsoluteIndex(fromIndex, length);
849
849
  var value;
850
850
  // Array#includes uses SameValueZero equality algorithm
@@ -869,13 +869,13 @@ var arrayIncludes = {
869
869
  indexOf: createMethod$1(false)
870
870
  };
871
871
 
872
- var uncurryThis$7 = functionUncurryThis;
872
+ var uncurryThis$4 = functionUncurryThis;
873
873
  var hasOwn$4 = hasOwnProperty_1;
874
874
  var toIndexedObject$2 = toIndexedObject$5;
875
875
  var indexOf = arrayIncludes.indexOf;
876
876
  var hiddenKeys$2 = hiddenKeys$4;
877
877
 
878
- var push = uncurryThis$7([].push);
878
+ var push = uncurryThis$4([].push);
879
879
 
880
880
  var objectKeysInternal = function (object, names) {
881
881
  var O = toIndexedObject$2(object);
@@ -918,16 +918,16 @@ var objectGetOwnPropertySymbols = {};
918
918
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
919
919
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
920
920
 
921
- var getBuiltIn$2 = getBuiltIn$5;
922
- var uncurryThis$6 = functionUncurryThis;
921
+ var getBuiltIn$1 = getBuiltIn$4;
922
+ var uncurryThis$3 = functionUncurryThis;
923
923
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
924
924
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
925
925
  var anObject$3 = anObject$5;
926
926
 
927
- var concat$1 = uncurryThis$6([].concat);
927
+ var concat$1 = uncurryThis$3([].concat);
928
928
 
929
929
  // all object keys, includes non-enumerable and symbols
930
- var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
930
+ var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
931
931
  var keys = getOwnPropertyNamesModule.f(anObject$3(it));
932
932
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
933
933
  return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
@@ -950,8 +950,8 @@ var copyConstructorProperties$2 = function (target, source, exceptions) {
950
950
  }
951
951
  };
952
952
 
953
- var fails$5 = fails$d;
954
- var isCallable$7 = isCallable$h;
953
+ var fails$4 = fails$c;
954
+ var isCallable$6 = isCallable$g;
955
955
 
956
956
  var replacement = /#|\.prototype\./;
957
957
 
@@ -959,7 +959,7 @@ var isForced$1 = function (feature, detection) {
959
959
  var value = data[normalize(feature)];
960
960
  return value == POLYFILL ? true
961
961
  : value == NATIVE ? false
962
- : isCallable$7(detection) ? fails$5(detection)
962
+ : isCallable$6(detection) ? fails$4(detection)
963
963
  : !!detection;
964
964
  };
965
965
 
@@ -1039,24 +1039,24 @@ var objectKeys$2 = Object.keys || function keys(O) {
1039
1039
  };
1040
1040
 
1041
1041
  var DESCRIPTORS$3 = descriptors;
1042
- var uncurryThis$5 = functionUncurryThis;
1042
+ var uncurryThis$2 = functionUncurryThis;
1043
1043
  var call$1 = functionCall;
1044
- var fails$4 = fails$d;
1044
+ var fails$3 = fails$c;
1045
1045
  var objectKeys$1 = objectKeys$2;
1046
1046
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1047
1047
  var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1048
- var toObject$3 = toObject$5;
1048
+ var toObject$2 = toObject$4;
1049
1049
  var IndexedObject$1 = indexedObject;
1050
1050
 
1051
1051
  // eslint-disable-next-line es/no-object-assign -- safe
1052
1052
  var $assign = Object.assign;
1053
1053
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1054
1054
  var defineProperty$4 = Object.defineProperty;
1055
- var concat = uncurryThis$5([].concat);
1055
+ var concat = uncurryThis$2([].concat);
1056
1056
 
1057
1057
  // `Object.assign` method
1058
1058
  // https://tc39.es/ecma262/#sec-object.assign
1059
- var objectAssign = !$assign || fails$4(function () {
1059
+ var objectAssign = !$assign || fails$3(function () {
1060
1060
  // should have correct order of operations (Edge bug)
1061
1061
  if (DESCRIPTORS$3 && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
1062
1062
  enumerable: true,
@@ -1077,7 +1077,7 @@ var objectAssign = !$assign || fails$4(function () {
1077
1077
  alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1078
1078
  return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
1079
1079
  }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1080
- var T = toObject$3(target);
1080
+ var T = toObject$2(target);
1081
1081
  var argumentsLength = arguments.length;
1082
1082
  var index = 1;
1083
1083
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
@@ -1095,98 +1095,18 @@ var objectAssign = !$assign || fails$4(function () {
1095
1095
  } return T;
1096
1096
  } : $assign;
1097
1097
 
1098
- var $$4 = _export;
1098
+ var $$3 = _export;
1099
1099
  var assign = objectAssign;
1100
1100
 
1101
1101
  // `Object.assign` method
1102
1102
  // https://tc39.es/ecma262/#sec-object.assign
1103
1103
  // eslint-disable-next-line es/no-object-assign -- required for testing
1104
- $$4({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1104
+ $$3({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1105
1105
  assign: assign
1106
1106
  });
1107
1107
 
1108
1108
  const NinetailedContext = /*#__PURE__*/React.createContext(undefined);
1109
1109
 
1110
- const ExperimentsContext = /*#__PURE__*/React.createContext(undefined);
1111
-
1112
- var aCallable$1 = aCallable$3;
1113
- var toObject$2 = toObject$5;
1114
- var IndexedObject = indexedObject;
1115
- var lengthOfArrayLike$2 = lengthOfArrayLike$4;
1116
-
1117
- var $TypeError$2 = TypeError;
1118
-
1119
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
1120
- var createMethod = function (IS_RIGHT) {
1121
- return function (that, callbackfn, argumentsLength, memo) {
1122
- aCallable$1(callbackfn);
1123
- var O = toObject$2(that);
1124
- var self = IndexedObject(O);
1125
- var length = lengthOfArrayLike$2(O);
1126
- var index = IS_RIGHT ? length - 1 : 0;
1127
- var i = IS_RIGHT ? -1 : 1;
1128
- if (argumentsLength < 2) while (true) {
1129
- if (index in self) {
1130
- memo = self[index];
1131
- index += i;
1132
- break;
1133
- }
1134
- index += i;
1135
- if (IS_RIGHT ? index < 0 : length <= index) {
1136
- throw $TypeError$2('Reduce of empty array with no initial value');
1137
- }
1138
- }
1139
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1140
- memo = callbackfn(memo, self[index], index, O);
1141
- }
1142
- return memo;
1143
- };
1144
- };
1145
-
1146
- var arrayReduce = {
1147
- // `Array.prototype.reduce` method
1148
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1149
- left: createMethod(false),
1150
- // `Array.prototype.reduceRight` method
1151
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1152
- right: createMethod(true)
1153
- };
1154
-
1155
- var fails$3 = fails$d;
1156
-
1157
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1158
- var method = [][METHOD_NAME];
1159
- return !!method && fails$3(function () {
1160
- // eslint-disable-next-line no-useless-call -- required for testing
1161
- method.call(null, argument || function () { return 1; }, 1);
1162
- });
1163
- };
1164
-
1165
- var classof$4 = classofRaw$2;
1166
- var global$3 = global$d;
1167
-
1168
- var engineIsNode = classof$4(global$3.process) == 'process';
1169
-
1170
- var $$3 = _export;
1171
- var $reduce = arrayReduce.left;
1172
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
1173
- var CHROME_VERSION = engineV8Version;
1174
- var IS_NODE = engineIsNode;
1175
-
1176
- var STRICT_METHOD = arrayMethodIsStrict('reduce');
1177
- // Chrome 80-82 has a critical bug
1178
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
1179
- var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
1180
-
1181
- // `Array.prototype.reduce` method
1182
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1183
- $$3({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
1184
- reduce: function reduce(callbackfn /* , initialValue */) {
1185
- var length = arguments.length;
1186
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
1187
- }
1188
- });
1189
-
1190
1110
  var objectDefineProperties = {};
1191
1111
 
1192
1112
  var DESCRIPTORS$2 = descriptors;
@@ -1210,9 +1130,9 @@ objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.de
1210
1130
  return O;
1211
1131
  };
1212
1132
 
1213
- var getBuiltIn$1 = getBuiltIn$5;
1133
+ var getBuiltIn = getBuiltIn$4;
1214
1134
 
1215
- var html$1 = getBuiltIn$1('document', 'documentElement');
1135
+ var html$1 = getBuiltIn('document', 'documentElement');
1216
1136
 
1217
1137
  /* global ActiveXObject -- old IE, WSH */
1218
1138
 
@@ -1299,11 +1219,11 @@ var objectCreate = Object.create || function create(O, Properties) {
1299
1219
  return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1300
1220
  };
1301
1221
 
1302
- var wellKnownSymbol$7 = wellKnownSymbol$9;
1222
+ var wellKnownSymbol$6 = wellKnownSymbol$8;
1303
1223
  var create$1 = objectCreate;
1304
1224
  var defineProperty$3 = objectDefineProperty.f;
1305
1225
 
1306
- var UNSCOPABLES = wellKnownSymbol$7('unscopables');
1226
+ var UNSCOPABLES = wellKnownSymbol$6('unscopables');
1307
1227
  var ArrayPrototype = Array.prototype;
1308
1228
 
1309
1229
  // Array.prototype[@@unscopables]
@@ -1316,13 +1236,13 @@ if (ArrayPrototype[UNSCOPABLES] == undefined) {
1316
1236
  }
1317
1237
 
1318
1238
  // add a key to Array.prototype[@@unscopables]
1319
- var addToUnscopables$2 = function (key) {
1239
+ var addToUnscopables$1 = function (key) {
1320
1240
  ArrayPrototype[UNSCOPABLES][key] = true;
1321
1241
  };
1322
1242
 
1323
1243
  var iterators = {};
1324
1244
 
1325
- var fails$2 = fails$d;
1245
+ var fails$2 = fails$c;
1326
1246
 
1327
1247
  var correctPrototypeGetter = !fails$2(function () {
1328
1248
  function F() { /* empty */ }
@@ -1332,8 +1252,8 @@ var correctPrototypeGetter = !fails$2(function () {
1332
1252
  });
1333
1253
 
1334
1254
  var hasOwn$2 = hasOwnProperty_1;
1335
- var isCallable$6 = isCallable$h;
1336
- var toObject$1 = toObject$5;
1255
+ var isCallable$5 = isCallable$g;
1256
+ var toObject$1 = toObject$4;
1337
1257
  var sharedKey = sharedKey$3;
1338
1258
  var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1339
1259
 
@@ -1348,19 +1268,19 @@ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf :
1348
1268
  var object = toObject$1(O);
1349
1269
  if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1350
1270
  var constructor = object.constructor;
1351
- if (isCallable$6(constructor) && object instanceof constructor) {
1271
+ if (isCallable$5(constructor) && object instanceof constructor) {
1352
1272
  return constructor.prototype;
1353
1273
  } return object instanceof $Object$1 ? ObjectPrototype : null;
1354
1274
  };
1355
1275
 
1356
- var fails$1 = fails$d;
1357
- var isCallable$5 = isCallable$h;
1358
- var isObject$1 = isObject$7;
1276
+ var fails$1 = fails$c;
1277
+ var isCallable$4 = isCallable$g;
1278
+ var isObject = isObject$6;
1359
1279
  var getPrototypeOf$1 = objectGetPrototypeOf;
1360
1280
  var defineBuiltIn$1 = defineBuiltIn$3;
1361
- var wellKnownSymbol$6 = wellKnownSymbol$9;
1281
+ var wellKnownSymbol$5 = wellKnownSymbol$8;
1362
1282
 
1363
- var ITERATOR$2 = wellKnownSymbol$6('iterator');
1283
+ var ITERATOR$2 = wellKnownSymbol$5('iterator');
1364
1284
  var BUGGY_SAFARI_ITERATORS$1 = false;
1365
1285
 
1366
1286
  // `%IteratorPrototype%` object
@@ -1378,7 +1298,7 @@ if ([].keys) {
1378
1298
  }
1379
1299
  }
1380
1300
 
1381
- var NEW_ITERATOR_PROTOTYPE = !isObject$1(IteratorPrototype$2) || fails$1(function () {
1301
+ var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype$2) || fails$1(function () {
1382
1302
  var test = {};
1383
1303
  // FF44- legacy iterators case
1384
1304
  return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
@@ -1388,7 +1308,7 @@ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1388
1308
 
1389
1309
  // `%IteratorPrototype%[@@iterator]()` method
1390
1310
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1391
- if (!isCallable$5(IteratorPrototype$2[ITERATOR$2])) {
1311
+ if (!isCallable$4(IteratorPrototype$2[ITERATOR$2])) {
1392
1312
  defineBuiltIn$1(IteratorPrototype$2, ITERATOR$2, function () {
1393
1313
  return this;
1394
1314
  });
@@ -1401,9 +1321,9 @@ var iteratorsCore = {
1401
1321
 
1402
1322
  var defineProperty$2 = objectDefineProperty.f;
1403
1323
  var hasOwn$1 = hasOwnProperty_1;
1404
- var wellKnownSymbol$5 = wellKnownSymbol$9;
1324
+ var wellKnownSymbol$4 = wellKnownSymbol$8;
1405
1325
 
1406
- var TO_STRING_TAG$3 = wellKnownSymbol$5('toStringTag');
1326
+ var TO_STRING_TAG$3 = wellKnownSymbol$4('toStringTag');
1407
1327
 
1408
1328
  var setToStringTag$2 = function (target, TAG, STATIC) {
1409
1329
  if (target && !STATIC) target = target.prototype;
@@ -1428,19 +1348,19 @@ var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUME
1428
1348
  return IteratorConstructor;
1429
1349
  };
1430
1350
 
1431
- var isCallable$4 = isCallable$h;
1351
+ var isCallable$3 = isCallable$g;
1432
1352
 
1433
1353
  var $String$1 = String;
1434
1354
  var $TypeError$1 = TypeError;
1435
1355
 
1436
1356
  var aPossiblePrototype$1 = function (argument) {
1437
- if (typeof argument == 'object' || isCallable$4(argument)) return argument;
1357
+ if (typeof argument == 'object' || isCallable$3(argument)) return argument;
1438
1358
  throw $TypeError$1("Can't set " + $String$1(argument) + ' as a prototype');
1439
1359
  };
1440
1360
 
1441
1361
  /* eslint-disable no-proto -- safe */
1442
1362
 
1443
- var uncurryThis$4 = functionUncurryThis;
1363
+ var uncurryThis$1 = functionUncurryThis;
1444
1364
  var anObject = anObject$5;
1445
1365
  var aPossiblePrototype = aPossiblePrototype$1;
1446
1366
 
@@ -1454,7 +1374,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1454
1374
  var setter;
1455
1375
  try {
1456
1376
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1457
- setter = uncurryThis$4(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1377
+ setter = uncurryThis$1(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1458
1378
  setter(test, []);
1459
1379
  CORRECT_SETTER = test instanceof Array;
1460
1380
  } catch (error) { /* empty */ }
@@ -1470,14 +1390,14 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1470
1390
  var $$2 = _export;
1471
1391
  var call = functionCall;
1472
1392
  var FunctionName = functionName;
1473
- var isCallable$3 = isCallable$h;
1393
+ var isCallable$2 = isCallable$g;
1474
1394
  var createIteratorConstructor = iteratorCreateConstructor;
1475
1395
  var getPrototypeOf = objectGetPrototypeOf;
1476
1396
  var setPrototypeOf = objectSetPrototypeOf;
1477
1397
  var setToStringTag = setToStringTag$2;
1478
1398
  var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1479
1399
  var defineBuiltIn = defineBuiltIn$3;
1480
- var wellKnownSymbol$4 = wellKnownSymbol$9;
1400
+ var wellKnownSymbol$3 = wellKnownSymbol$8;
1481
1401
  var Iterators$1 = iterators;
1482
1402
  var IteratorsCore = iteratorsCore;
1483
1403
 
@@ -1485,7 +1405,7 @@ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1485
1405
  var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1486
1406
  var IteratorPrototype = IteratorsCore.IteratorPrototype;
1487
1407
  var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1488
- var ITERATOR$1 = wellKnownSymbol$4('iterator');
1408
+ var ITERATOR$1 = wellKnownSymbol$3('iterator');
1489
1409
  var KEYS = 'keys';
1490
1410
  var VALUES = 'values';
1491
1411
  var ENTRIES = 'entries';
@@ -1522,7 +1442,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1522
1442
  if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1523
1443
  if (setPrototypeOf) {
1524
1444
  setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1525
- } else if (!isCallable$3(CurrentIteratorPrototype[ITERATOR$1])) {
1445
+ } else if (!isCallable$2(CurrentIteratorPrototype[ITERATOR$1])) {
1526
1446
  defineBuiltIn(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1527
1447
  }
1528
1448
  }
@@ -1571,7 +1491,7 @@ var createIterResultObject$1 = function (value, done) {
1571
1491
  };
1572
1492
 
1573
1493
  var toIndexedObject = toIndexedObject$5;
1574
- var addToUnscopables$1 = addToUnscopables$2;
1494
+ var addToUnscopables = addToUnscopables$1;
1575
1495
  var Iterators = iterators;
1576
1496
  var InternalStateModule = internalState;
1577
1497
  var defineProperty$1 = objectDefineProperty.f;
@@ -1622,9 +1542,9 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
1622
1542
  var values = Iterators.Arguments = Iterators.Array;
1623
1543
 
1624
1544
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1625
- addToUnscopables$1('keys');
1626
- addToUnscopables$1('values');
1627
- addToUnscopables$1('entries');
1545
+ addToUnscopables('keys');
1546
+ addToUnscopables('values');
1547
+ addToUnscopables('entries');
1628
1548
 
1629
1549
  // V8 ~ Chrome 45- bug
1630
1550
  if (DESCRIPTORS$1 && values.name !== 'values') try {
@@ -1675,15 +1595,15 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
1675
1595
 
1676
1596
  var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1677
1597
 
1678
- var global$2 = global$d;
1598
+ var global$3 = global$d;
1679
1599
  var DOMIterables = domIterables;
1680
1600
  var DOMTokenListPrototype = domTokenListPrototype;
1681
1601
  var ArrayIteratorMethods = es_array_iterator;
1682
1602
  var createNonEnumerableProperty = createNonEnumerableProperty$4;
1683
- var wellKnownSymbol$3 = wellKnownSymbol$9;
1603
+ var wellKnownSymbol$2 = wellKnownSymbol$8;
1684
1604
 
1685
- var ITERATOR = wellKnownSymbol$3('iterator');
1686
- var TO_STRING_TAG$2 = wellKnownSymbol$3('toStringTag');
1605
+ var ITERATOR = wellKnownSymbol$2('iterator');
1606
+ var TO_STRING_TAG$2 = wellKnownSymbol$2('toStringTag');
1687
1607
  var ArrayValues = ArrayIteratorMethods.values;
1688
1608
 
1689
1609
  var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
@@ -1709,7 +1629,7 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1709
1629
  };
1710
1630
 
1711
1631
  for (var COLLECTION_NAME in DOMIterables) {
1712
- handlePrototype(global$2[COLLECTION_NAME] && global$2[COLLECTION_NAME].prototype, COLLECTION_NAME);
1632
+ handlePrototype(global$3[COLLECTION_NAME] && global$3[COLLECTION_NAME].prototype, COLLECTION_NAME);
1713
1633
  }
1714
1634
 
1715
1635
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
@@ -1751,7 +1671,110 @@ function __awaiter(thisArg, _arguments, P, generator) {
1751
1671
  });
1752
1672
  }
1753
1673
 
1754
- const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
1674
+ var wellKnownSymbol$1 = wellKnownSymbol$8;
1675
+
1676
+ var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
1677
+ var test = {};
1678
+
1679
+ test[TO_STRING_TAG$1] = 'z';
1680
+
1681
+ var toStringTagSupport = String(test) === '[object z]';
1682
+
1683
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1684
+ var isCallable$1 = isCallable$g;
1685
+ var classofRaw = classofRaw$1;
1686
+ var wellKnownSymbol = wellKnownSymbol$8;
1687
+
1688
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1689
+ var $Object = Object;
1690
+
1691
+ // ES3 wrong here
1692
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1693
+
1694
+ // fallback for IE11 Script Access Denied error
1695
+ var tryGet = function (it, key) {
1696
+ try {
1697
+ return it[key];
1698
+ } catch (error) { /* empty */ }
1699
+ };
1700
+
1701
+ // getting tag from ES6+ `Object.prototype.toString`
1702
+ var classof$2 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1703
+ var O, tag, result;
1704
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1705
+ // @@toStringTag case
1706
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1707
+ // builtinTag case
1708
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1709
+ // ES3 arguments fallback
1710
+ : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1711
+ };
1712
+
1713
+ var classof$1 = classof$2;
1714
+
1715
+ var $String = String;
1716
+
1717
+ var toString$1 = function (argument) {
1718
+ if (classof$1(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1719
+ return $String(argument);
1720
+ };
1721
+
1722
+ var $$1 = _export;
1723
+ var DESCRIPTORS = descriptors;
1724
+ var global$2 = global$d;
1725
+ var uncurryThis = functionUncurryThis;
1726
+ var hasOwn = hasOwnProperty_1;
1727
+ var isCallable = isCallable$g;
1728
+ var isPrototypeOf = objectIsPrototypeOf;
1729
+ var toString = toString$1;
1730
+ var defineProperty = objectDefineProperty.f;
1731
+ var copyConstructorProperties = copyConstructorProperties$2;
1732
+
1733
+ var NativeSymbol = global$2.Symbol;
1734
+ var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
1735
+
1736
+ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) ||
1737
+ // Safari 12 bug
1738
+ NativeSymbol().description !== undefined
1739
+ )) {
1740
+ var EmptyStringDescriptionStore = {};
1741
+ // wrap Symbol constructor for correct work with undefined description
1742
+ var SymbolWrapper = function Symbol() {
1743
+ var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
1744
+ var result = isPrototypeOf(SymbolPrototype, this)
1745
+ ? new NativeSymbol(description)
1746
+ // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1747
+ : description === undefined ? NativeSymbol() : NativeSymbol(description);
1748
+ if (description === '') EmptyStringDescriptionStore[result] = true;
1749
+ return result;
1750
+ };
1751
+
1752
+ copyConstructorProperties(SymbolWrapper, NativeSymbol);
1753
+ SymbolWrapper.prototype = SymbolPrototype;
1754
+ SymbolPrototype.constructor = SymbolWrapper;
1755
+
1756
+ var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
1757
+ var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf);
1758
+ var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString);
1759
+ var regexp = /^Symbol\((.*)\)[^)]+$/;
1760
+ var replace = uncurryThis(''.replace);
1761
+ var stringSlice = uncurryThis(''.slice);
1762
+
1763
+ defineProperty(SymbolPrototype, 'description', {
1764
+ configurable: true,
1765
+ get: function description() {
1766
+ var symbol = thisSymbolValue(this);
1767
+ if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
1768
+ var string = symbolDescriptiveString(symbol);
1769
+ var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
1770
+ return desc === '' ? undefined : desc;
1771
+ }
1772
+ });
1773
+
1774
+ $$1({ global: true, constructor: true, forced: true }, {
1775
+ Symbol: SymbolWrapper
1776
+ });
1777
+ }
1755
1778
 
1756
1779
  const useNinetailed = () => {
1757
1780
  const ninetailed = React.useContext(NinetailedContext);
@@ -1761,115 +1784,124 @@ const useNinetailed = () => {
1761
1784
  return ninetailed;
1762
1785
  };
1763
1786
 
1764
- const debounce = (fn, wait, options) => {
1765
- let debouncedArgs = [];
1766
- const debouncedFn = _debounce__default["default"](() => {
1767
- fn.call(undefined, debouncedArgs);
1768
- debouncedArgs = [];
1769
- }, wait, options);
1770
- return (...args) => {
1771
- debouncedArgs.push(values__default["default"](args));
1772
- debouncedFn();
1773
- };
1774
- };
1775
- const useProvideJoinExperiment = ({
1776
- experiments,
1777
- maximumActiveExperiments: _maximumActiveExperiments = 1
1787
+ const TrackExperience = ({
1788
+ children,
1789
+ experience,
1790
+ variant,
1791
+ profile
1778
1792
  }) => {
1793
+ const ninetailed = useNinetailed();
1779
1794
  const {
1780
- identify
1781
- } = useNinetailed();
1782
- const joinExperimentIdentify = debounce(args => {
1783
- const traits = args.slice(0, _maximumActiveExperiments).reduce((traits, [experimentJoinTraits]) => {
1784
- return Object.assign(Object.assign({}, experimentJoinTraits), traits);
1785
- }, {});
1786
- identify('', traits);
1795
+ ref,
1796
+ inView
1797
+ } = reactIntersectionObserver.useInView({
1798
+ triggerOnce: true
1787
1799
  });
1788
- return React.useCallback(data => __awaiter(void 0, void 0, void 0, function* () {
1789
- const {
1790
- experiment,
1791
- profile
1792
- } = data;
1793
- const isExperiment = experiment.type === 'nt_experiment';
1794
- if (!isExperiment) {
1795
- experience_jsShared.logger.warn(`The experience ${experiment.id}, which you tried to join, is not an experiment.`);
1796
- return;
1800
+ React.useEffect(() => {
1801
+ if (experience_jsShared.isBrowser() && inView) {
1802
+ const distribution = experience_js.selectDistribution({
1803
+ experience,
1804
+ profile
1805
+ });
1806
+ ninetailed.trackHasSeenExperience({
1807
+ experience: {
1808
+ id: experience.id,
1809
+ type: experience.type,
1810
+ name: experience.name || '',
1811
+ description: experience.description || ''
1812
+ },
1813
+ audience: experience.audience,
1814
+ selectedVariant: variant,
1815
+ selectedVariantIndex: distribution.index
1816
+ });
1797
1817
  }
1798
- const activeExperiments = experience_js.selectActiveExperiments(experiments, profile);
1799
- if (activeExperiments.length >= _maximumActiveExperiments) {
1800
- experience_jsShared.logger.warn(`The maximum number of active experiments (${_maximumActiveExperiments}) has been reached.`);
1801
- return;
1818
+ }, [inView]);
1819
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1820
+ children: [jsxRuntime.jsx("div", {
1821
+ ref: ref,
1822
+ id: "nt-experience-handle"
1823
+ }), children]
1824
+ });
1825
+ };
1826
+
1827
+ var aCallable = aCallable$2;
1828
+ var toObject = toObject$4;
1829
+ var IndexedObject = indexedObject;
1830
+ var lengthOfArrayLike = lengthOfArrayLike$2;
1831
+
1832
+ var $TypeError = TypeError;
1833
+
1834
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
1835
+ var createMethod = function (IS_RIGHT) {
1836
+ return function (that, callbackfn, argumentsLength, memo) {
1837
+ aCallable(callbackfn);
1838
+ var O = toObject(that);
1839
+ var self = IndexedObject(O);
1840
+ var length = lengthOfArrayLike(O);
1841
+ var index = IS_RIGHT ? length - 1 : 0;
1842
+ var i = IS_RIGHT ? -1 : 1;
1843
+ if (argumentsLength < 2) while (true) {
1844
+ if (index in self) {
1845
+ memo = self[index];
1846
+ index += i;
1847
+ break;
1848
+ }
1849
+ index += i;
1850
+ if (IS_RIGHT ? index < 0 : length <= index) {
1851
+ throw $TypeError('Reduce of empty array with no initial value');
1852
+ }
1802
1853
  }
1803
- if (activeExperiments.some(activeExperiment => activeExperiment.id === experiment.id)) {
1804
- experience_jsShared.logger.debug(`The user is already part of experiment ${experiment.id}. Won't join again.`);
1805
- return;
1854
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1855
+ memo = callbackfn(memo, self[index], index, O);
1806
1856
  }
1807
- joinExperimentIdentify({
1808
- [`${EXPERIENCE_TRAIT_PREFIX}${experiment.id}`]: true
1809
- });
1810
- experience_jsShared.logger.debug(`Sent event to join experiment ${experiment.id}.`);
1811
- }), []);
1857
+ return memo;
1858
+ };
1812
1859
  };
1813
1860
 
1814
- const ExperimentsProvider = ({
1815
- experiments,
1816
- maximumActiveExperiments: _maximumActiveExperiments = 1,
1817
- children
1818
- }) => {
1819
- const joinExperiment = useProvideJoinExperiment({
1820
- experiments,
1821
- maximumActiveExperiments: _maximumActiveExperiments
1822
- });
1823
- return jsxRuntime.jsx(ExperimentsContext.Provider, Object.assign({
1824
- value: {
1825
- experiments,
1826
- joinExperiment
1827
- }
1828
- }, {
1829
- children: children
1830
- }));
1861
+ var arrayReduce = {
1862
+ // `Array.prototype.reduce` method
1863
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
1864
+ left: createMethod(false),
1865
+ // `Array.prototype.reduceRight` method
1866
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1867
+ right: createMethod(true)
1831
1868
  };
1832
1869
 
1833
- const NinetailedProvider = ({
1834
- children,
1835
- clientId,
1836
- experiments: _experiments = [],
1837
- maximumActiveExperiments,
1838
- environment,
1839
- preview,
1840
- url,
1841
- profile,
1842
- locale,
1843
- requestTimeout,
1844
- plugins: _plugins = [],
1845
- onLog,
1846
- onError
1847
- }) => {
1848
- const ninetailed = React.useMemo(() => new experience_js.Ninetailed({
1849
- clientId,
1850
- environment,
1851
- preview
1852
- }, {
1853
- url,
1854
- plugins: _plugins,
1855
- profile,
1856
- locale,
1857
- requestTimeout,
1858
- onLog,
1859
- onError
1860
- }), []);
1861
- return jsxRuntime.jsx(NinetailedContext.Provider, Object.assign({
1862
- value: ninetailed
1863
- }, {
1864
- children: jsxRuntime.jsx(ExperimentsProvider, Object.assign({
1865
- experiments: _experiments,
1866
- maximumActiveExperiments: maximumActiveExperiments
1867
- }, {
1868
- children: children
1869
- }))
1870
- }));
1870
+ var fails = fails$c;
1871
+
1872
+ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1873
+ var method = [][METHOD_NAME];
1874
+ return !!method && fails(function () {
1875
+ // eslint-disable-next-line no-useless-call -- required for testing
1876
+ method.call(null, argument || function () { return 1; }, 1);
1877
+ });
1871
1878
  };
1872
1879
 
1880
+ var classof = classofRaw$1;
1881
+ var global$1 = global$d;
1882
+
1883
+ var engineIsNode = classof(global$1.process) == 'process';
1884
+
1885
+ var $ = _export;
1886
+ var $reduce = arrayReduce.left;
1887
+ var arrayMethodIsStrict = arrayMethodIsStrict$1;
1888
+ var CHROME_VERSION = engineV8Version;
1889
+ var IS_NODE = engineIsNode;
1890
+
1891
+ var STRICT_METHOD = arrayMethodIsStrict('reduce');
1892
+ // Chrome 80-82 has a critical bug
1893
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
1894
+ var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
1895
+
1896
+ // `Array.prototype.reduce` method
1897
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
1898
+ $({ target: 'Array', proto: true, forced: !STRICT_METHOD || CHROME_BUG }, {
1899
+ reduce: function reduce(callbackfn /* , initialValue */) {
1900
+ var length = arguments.length;
1901
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
1902
+ }
1903
+ });
1904
+
1873
1905
  const useProfile = () => {
1874
1906
  const ninetailed = useNinetailed();
1875
1907
  const [profileState, setProfileState] = React.useState(ninetailed.profileState);
@@ -1906,275 +1938,7 @@ const useProfile = () => {
1906
1938
  });
1907
1939
  };
1908
1940
 
1909
- const usePersonalize = (baseline, variants, options = {
1910
- holdout: -1
1911
- }) => {
1912
- const profile = useProfile();
1913
- return experience_js.selectVariant(baseline, variants, profile, options);
1914
- };
1915
-
1916
- const TrackHasSeenComponent = ({
1917
- children,
1918
- variant,
1919
- audience,
1920
- isPersonalized
1921
- }) => {
1922
- const ninetailed = useNinetailed();
1923
- const {
1924
- ref,
1925
- inView
1926
- } = reactIntersectionObserver.useInView({
1927
- triggerOnce: true
1928
- });
1929
- React.useEffect(() => {
1930
- if (experience_jsShared.isBrowser() && inView) {
1931
- ninetailed.trackHasSeenComponent({
1932
- variant,
1933
- audience,
1934
- isPersonalized
1935
- });
1936
- }
1937
- }, [inView]);
1938
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1939
- children: [jsxRuntime.jsx("div", {
1940
- ref: ref
1941
- }), children]
1942
- });
1943
- };
1944
-
1945
- const Personalize = _a => {
1946
- var {
1947
- component: Component,
1948
- loadingComponent: LoadingComponent,
1949
- variants = [],
1950
- holdout = -1
1951
- } = _a,
1952
- baseline = __rest(_a, ["component", "loadingComponent", "variants", "holdout"]);
1953
- const {
1954
- loading,
1955
- variant,
1956
- isPersonalized,
1957
- audience
1958
- } = usePersonalize(baseline, variants, {
1959
- holdout
1960
- });
1961
- const hasVariants = variants.length > 0;
1962
- if (!hasVariants) {
1963
- return jsxRuntime.jsx(Component, Object.assign({}, baseline, {
1964
- ninetailed: {
1965
- isPersonalized,
1966
- audience
1967
- }
1968
- }));
1969
- }
1970
- if (loading) {
1971
- if (LoadingComponent) {
1972
- return jsxRuntime.jsx(LoadingComponent, {});
1973
- }
1974
- return jsxRuntime.jsx("div", Object.assign({
1975
- style: {
1976
- opacity: 0
1977
- }
1978
- }, {
1979
- children: jsxRuntime.jsx(Component, Object.assign({}, variant, {
1980
- ninetailed: {
1981
- isPersonalized,
1982
- audience
1983
- }
1984
- }))
1985
- }), "hide");
1986
- }
1987
- return jsxRuntime.jsx(TrackHasSeenComponent, Object.assign({
1988
- variant: variant,
1989
- audience: audience,
1990
- isPersonalized: isPersonalized
1991
- }, {
1992
- children: /*#__PURE__*/React.createElement(Component, Object.assign({}, variant, {
1993
- key: `${audience.id}-${variant.id}`,
1994
- ninetailed: {
1995
- isPersonalized,
1996
- audience
1997
- }
1998
- }))
1999
- }));
2000
- };
2001
-
2002
- const generateSelectors = id => {
2003
- return id.split('_').map((path, index, paths) => {
2004
- const dotPath = paths.slice(0, index).join('.');
2005
- const underScorePath = paths.slice(index).join('_');
2006
- return [dotPath, underScorePath].filter(path => path !== '').join('.');
2007
- });
2008
- };
2009
- const selectValueFromProfile = (profile, id) => {
2010
- const selectors = generateSelectors(id);
2011
- const matchingSelector = selectors.find(selector => get__default["default"](profile, selector));
2012
- if (!matchingSelector) {
2013
- return null;
2014
- }
2015
- return get__default["default"](profile, matchingSelector);
2016
- };
2017
- const MergeTag = ({
2018
- id
2019
- }) => {
2020
- const {
2021
- loading,
2022
- profile
2023
- } = useProfile();
2024
- if (loading || !profile) {
2025
- return null;
2026
- }
2027
- const value = selectValueFromProfile(profile, id);
2028
- // DON'T CHANGE
2029
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
2030
- children: value
2031
- });
2032
- };
2033
-
2034
- var wellKnownSymbol$2 = wellKnownSymbol$9;
2035
-
2036
- var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
2037
- var test = {};
2038
-
2039
- test[TO_STRING_TAG$1] = 'z';
2040
-
2041
- var toStringTagSupport = String(test) === '[object z]';
2042
-
2043
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
2044
- var isCallable$2 = isCallable$h;
2045
- var classofRaw$1 = classofRaw$2;
2046
- var wellKnownSymbol$1 = wellKnownSymbol$9;
2047
-
2048
- var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
2049
- var $Object = Object;
2050
-
2051
- // ES3 wrong here
2052
- var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
2053
-
2054
- // fallback for IE11 Script Access Denied error
2055
- var tryGet = function (it, key) {
2056
- try {
2057
- return it[key];
2058
- } catch (error) { /* empty */ }
2059
- };
2060
-
2061
- // getting tag from ES6+ `Object.prototype.toString`
2062
- var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
2063
- var O, tag, result;
2064
- return it === undefined ? 'Undefined' : it === null ? 'Null'
2065
- // @@toStringTag case
2066
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
2067
- // builtinTag case
2068
- : CORRECT_ARGUMENTS ? classofRaw$1(O)
2069
- // ES3 arguments fallback
2070
- : (result = classofRaw$1(O)) == 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
2071
- };
2072
-
2073
- var classof$2 = classof$3;
2074
-
2075
- var $String = String;
2076
-
2077
- var toString$1 = function (argument) {
2078
- if (classof$2(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
2079
- return $String(argument);
2080
- };
2081
-
2082
- var $$1 = _export;
2083
- var DESCRIPTORS = descriptors;
2084
- var global$1 = global$d;
2085
- var uncurryThis$3 = functionUncurryThis;
2086
- var hasOwn = hasOwnProperty_1;
2087
- var isCallable$1 = isCallable$h;
2088
- var isPrototypeOf = objectIsPrototypeOf;
2089
- var toString = toString$1;
2090
- var defineProperty = objectDefineProperty.f;
2091
- var copyConstructorProperties = copyConstructorProperties$2;
2092
-
2093
- var NativeSymbol = global$1.Symbol;
2094
- var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
2095
-
2096
- if (DESCRIPTORS && isCallable$1(NativeSymbol) && (!('description' in SymbolPrototype) ||
2097
- // Safari 12 bug
2098
- NativeSymbol().description !== undefined
2099
- )) {
2100
- var EmptyStringDescriptionStore = {};
2101
- // wrap Symbol constructor for correct work with undefined description
2102
- var SymbolWrapper = function Symbol() {
2103
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]);
2104
- var result = isPrototypeOf(SymbolPrototype, this)
2105
- ? new NativeSymbol(description)
2106
- // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
2107
- : description === undefined ? NativeSymbol() : NativeSymbol(description);
2108
- if (description === '') EmptyStringDescriptionStore[result] = true;
2109
- return result;
2110
- };
2111
-
2112
- copyConstructorProperties(SymbolWrapper, NativeSymbol);
2113
- SymbolWrapper.prototype = SymbolPrototype;
2114
- SymbolPrototype.constructor = SymbolWrapper;
2115
-
2116
- var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
2117
- var thisSymbolValue = uncurryThis$3(SymbolPrototype.valueOf);
2118
- var symbolDescriptiveString = uncurryThis$3(SymbolPrototype.toString);
2119
- var regexp = /^Symbol\((.*)\)[^)]+$/;
2120
- var replace = uncurryThis$3(''.replace);
2121
- var stringSlice = uncurryThis$3(''.slice);
2122
-
2123
- defineProperty(SymbolPrototype, 'description', {
2124
- configurable: true,
2125
- get: function description() {
2126
- var symbol = thisSymbolValue(this);
2127
- if (hasOwn(EmptyStringDescriptionStore, symbol)) return '';
2128
- var string = symbolDescriptiveString(symbol);
2129
- var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1');
2130
- return desc === '' ? undefined : desc;
2131
- }
2132
- });
2133
-
2134
- $$1({ global: true, constructor: true, forced: true }, {
2135
- Symbol: SymbolWrapper
2136
- });
2137
- }
2138
-
2139
- const TrackExperience = ({
2140
- children,
2141
- experience,
2142
- variant,
2143
- profile
2144
- }) => {
2145
- const ninetailed = useNinetailed();
2146
- const {
2147
- ref,
2148
- inView
2149
- } = reactIntersectionObserver.useInView({
2150
- triggerOnce: true
2151
- });
2152
- React.useEffect(() => {
2153
- if (experience_jsShared.isBrowser() && inView) {
2154
- const distribution = experience_js.selectDistribution({
2155
- experience,
2156
- profile
2157
- });
2158
- ninetailed.trackHasSeenExperience({
2159
- experience: {
2160
- id: experience.id,
2161
- type: experience.type,
2162
- name: experience.name || '',
2163
- description: experience.description || ''
2164
- },
2165
- audience: experience.audience,
2166
- selectedVariant: variant,
2167
- selectedVariantIndex: distribution.index
2168
- });
2169
- }
2170
- }, [inView]);
2171
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2172
- children: [jsxRuntime.jsx("div", {
2173
- ref: ref,
2174
- id: "nt-experience-handle"
2175
- }), children]
2176
- });
2177
- };
1941
+ const ExperimentsContext = /*#__PURE__*/React.createContext(undefined);
2178
1942
 
2179
1943
  const useExperimentsContext = () => {
2180
1944
  const context = React.useContext(ExperimentsContext);
@@ -2239,7 +2003,9 @@ const useExperience = ({
2239
2003
  if (!experience) {
2240
2004
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2241
2005
  // @ts-ignore
2242
- return emptyReturn;
2006
+ return Object.assign(Object.assign({}, emptyReturn), {
2007
+ profile
2008
+ });
2243
2009
  }
2244
2010
  const audience = experience.audience;
2245
2011
  const variant = experience_js.selectExperienceVariant({
@@ -2276,231 +2042,6 @@ const useJoinExperiment = () => {
2276
2042
  return context.joinExperiment;
2277
2043
  };
2278
2044
 
2279
- var classof$1 = classofRaw$2;
2280
-
2281
- // `IsArray` abstract operation
2282
- // https://tc39.es/ecma262/#sec-isarray
2283
- // eslint-disable-next-line es/no-array-isarray -- safe
2284
- var isArray$2 = Array.isArray || function isArray(argument) {
2285
- return classof$1(argument) == 'Array';
2286
- };
2287
-
2288
- var $TypeError = TypeError;
2289
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
2290
-
2291
- var doesNotExceedSafeInteger$1 = function (it) {
2292
- if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
2293
- return it;
2294
- };
2295
-
2296
- var classofRaw = classofRaw$2;
2297
- var uncurryThis$2 = functionUncurryThis;
2298
-
2299
- var functionUncurryThisClause = function (fn) {
2300
- // Nashorn bug:
2301
- // https://github.com/zloirock/core-js/issues/1128
2302
- // https://github.com/zloirock/core-js/issues/1130
2303
- if (classofRaw(fn) === 'Function') return uncurryThis$2(fn);
2304
- };
2305
-
2306
- var uncurryThis$1 = functionUncurryThisClause;
2307
- var aCallable = aCallable$3;
2308
- var NATIVE_BIND = functionBindNative;
2309
-
2310
- var bind$1 = uncurryThis$1(uncurryThis$1.bind);
2311
-
2312
- // optional / simple context binding
2313
- var functionBindContext = function (fn, that) {
2314
- aCallable(fn);
2315
- return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
2316
- return fn.apply(that, arguments);
2317
- };
2318
- };
2319
-
2320
- var isArray$1 = isArray$2;
2321
- var lengthOfArrayLike$1 = lengthOfArrayLike$4;
2322
- var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
2323
- var bind = functionBindContext;
2324
-
2325
- // `FlattenIntoArray` abstract operation
2326
- // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
2327
- var flattenIntoArray$1 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
2328
- var targetIndex = start;
2329
- var sourceIndex = 0;
2330
- var mapFn = mapper ? bind(mapper, thisArg) : false;
2331
- var element, elementLen;
2332
-
2333
- while (sourceIndex < sourceLen) {
2334
- if (sourceIndex in source) {
2335
- element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
2336
-
2337
- if (depth > 0 && isArray$1(element)) {
2338
- elementLen = lengthOfArrayLike$1(element);
2339
- targetIndex = flattenIntoArray$1(target, original, element, elementLen, targetIndex, depth - 1) - 1;
2340
- } else {
2341
- doesNotExceedSafeInteger(targetIndex + 1);
2342
- target[targetIndex] = element;
2343
- }
2344
-
2345
- targetIndex++;
2346
- }
2347
- sourceIndex++;
2348
- }
2349
- return targetIndex;
2350
- };
2351
-
2352
- var flattenIntoArray_1 = flattenIntoArray$1;
2353
-
2354
- var uncurryThis = functionUncurryThis;
2355
- var fails = fails$d;
2356
- var isCallable = isCallable$h;
2357
- var classof = classof$3;
2358
- var getBuiltIn = getBuiltIn$5;
2359
- var inspectSource = inspectSource$2;
2360
-
2361
- var noop = function () { /* empty */ };
2362
- var empty = [];
2363
- var construct = getBuiltIn('Reflect', 'construct');
2364
- var constructorRegExp = /^\s*(?:class|function)\b/;
2365
- var exec = uncurryThis(constructorRegExp.exec);
2366
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
2367
-
2368
- var isConstructorModern = function isConstructor(argument) {
2369
- if (!isCallable(argument)) return false;
2370
- try {
2371
- construct(noop, empty, argument);
2372
- return true;
2373
- } catch (error) {
2374
- return false;
2375
- }
2376
- };
2377
-
2378
- var isConstructorLegacy = function isConstructor(argument) {
2379
- if (!isCallable(argument)) return false;
2380
- switch (classof(argument)) {
2381
- case 'AsyncFunction':
2382
- case 'GeneratorFunction':
2383
- case 'AsyncGeneratorFunction': return false;
2384
- }
2385
- try {
2386
- // we can't check .prototype since constructors produced by .bind haven't it
2387
- // `Function#toString` throws on some built-it function in some legacy engines
2388
- // (for example, `DOMQuad` and similar in FF41-)
2389
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
2390
- } catch (error) {
2391
- return true;
2392
- }
2393
- };
2394
-
2395
- isConstructorLegacy.sham = true;
2396
-
2397
- // `IsConstructor` abstract operation
2398
- // https://tc39.es/ecma262/#sec-isconstructor
2399
- var isConstructor$1 = !construct || fails(function () {
2400
- var called;
2401
- return isConstructorModern(isConstructorModern.call)
2402
- || !isConstructorModern(Object)
2403
- || !isConstructorModern(function () { called = true; })
2404
- || called;
2405
- }) ? isConstructorLegacy : isConstructorModern;
2406
-
2407
- var isArray = isArray$2;
2408
- var isConstructor = isConstructor$1;
2409
- var isObject = isObject$7;
2410
- var wellKnownSymbol = wellKnownSymbol$9;
2411
-
2412
- var SPECIES = wellKnownSymbol('species');
2413
- var $Array = Array;
2414
-
2415
- // a part of `ArraySpeciesCreate` abstract operation
2416
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
2417
- var arraySpeciesConstructor$1 = function (originalArray) {
2418
- var C;
2419
- if (isArray(originalArray)) {
2420
- C = originalArray.constructor;
2421
- // cross-realm fallback
2422
- if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
2423
- else if (isObject(C)) {
2424
- C = C[SPECIES];
2425
- if (C === null) C = undefined;
2426
- }
2427
- } return C === undefined ? $Array : C;
2428
- };
2429
-
2430
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
2431
-
2432
- // `ArraySpeciesCreate` abstract operation
2433
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
2434
- var arraySpeciesCreate$1 = function (originalArray, length) {
2435
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
2436
- };
2437
-
2438
- var $ = _export;
2439
- var flattenIntoArray = flattenIntoArray_1;
2440
- var toObject = toObject$5;
2441
- var lengthOfArrayLike = lengthOfArrayLike$4;
2442
- var toIntegerOrInfinity = toIntegerOrInfinity$3;
2443
- var arraySpeciesCreate = arraySpeciesCreate$1;
2444
-
2445
- // `Array.prototype.flat` method
2446
- // https://tc39.es/ecma262/#sec-array.prototype.flat
2447
- $({ target: 'Array', proto: true }, {
2448
- flat: function flat(/* depthArg = 1 */) {
2449
- var depthArg = arguments.length ? arguments[0] : undefined;
2450
- var O = toObject(this);
2451
- var sourceLen = lengthOfArrayLike(O);
2452
- var A = arraySpeciesCreate(O, 0);
2453
- A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
2454
- return A;
2455
- }
2456
- });
2457
-
2458
- // this method was added to unscopables after implementation
2459
- // in popular engines, so it's moved to a separate module
2460
- var addToUnscopables = addToUnscopables$2;
2461
-
2462
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2463
- addToUnscopables('flat');
2464
-
2465
- function isRenderPlugin(plugin) {
2466
- return typeof plugin['getRenderWrapper'] === 'function';
2467
- }
2468
-
2469
- const ComponentWrapper = _a => {
2470
- var {
2471
- children
2472
- } = _a,
2473
- props = __rest(_a, ["children"]);
2474
- const {
2475
- plugins
2476
- } = useNinetailed();
2477
- const renderPlugins = plugins.flat().filter(isRenderPlugin).map(plugin => plugin.getRenderWrapper());
2478
- // Initialized as empty object to not override the props of the component by default
2479
- const [enhancedComponentProps, setEnhancedComponentProps] = React.useState({});
2480
- // If there are no render plugins, we can skip the wrapping of the component
2481
- if (!renderPlugins.length) {
2482
- console.info('No Render-Plugins detected.');
2483
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
2484
- children: children
2485
- });
2486
- }
2487
- // Recursively wrap the component with the render plugins. The props are drilled down to the component through each wrapper.
2488
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
2489
- children: renderPlugins.reduce((component, WrapperComponent) => jsxRuntime.jsx(WrapperComponent, Object.assign({}, props, {
2490
- setComponentProps: setEnhancedComponentProps
2491
- }, {
2492
- children: component
2493
- })), jsxRuntime.jsx(jsxRuntime.Fragment, {
2494
- children: React__default["default"].Children.map(children, child => {
2495
- if ( /*#__PURE__*/React__default["default"].isValidElement(child)) {
2496
- return /*#__PURE__*/React__default["default"].cloneElement(child, enhancedComponentProps);
2497
- }
2498
- return null;
2499
- })
2500
- }))
2501
- });
2502
- };
2503
-
2504
2045
  /**
2505
2046
  * This component is used to conditionally render Experiences which may include empty variants.
2506
2047
  * It is essential to intercept the props within the ComponentWrapper to be able to get the current variant.
@@ -2524,6 +2065,35 @@ const ConditionalRenderComponent = _a => {
2524
2065
  });
2525
2066
  };
2526
2067
 
2068
+ const useExperienceSelectionMiddleware = ({
2069
+ experiences,
2070
+ baseline,
2071
+ profile
2072
+ }) => {
2073
+ const {
2074
+ plugins
2075
+ } = useNinetailed();
2076
+ const [_, setCurrentTime] = React.useState(Date.now());
2077
+ const {
2078
+ addListeners,
2079
+ removeListeners,
2080
+ middleware
2081
+ } = React.useMemo(() => experience_js.makeExperienceSelectMiddleware({
2082
+ plugins,
2083
+ experiences,
2084
+ baseline,
2085
+ profile,
2086
+ onChange: () => setCurrentTime(Date.now())
2087
+ }), [plugins, experiences, baseline, profile]);
2088
+ React.useEffect(() => {
2089
+ addListeners();
2090
+ return () => {
2091
+ removeListeners();
2092
+ };
2093
+ }, [addListeners, removeListeners]);
2094
+ return middleware;
2095
+ };
2096
+
2527
2097
  const DefaultExperienceLoadingComponent = _a => {
2528
2098
  var {
2529
2099
  component: Component,
@@ -2581,8 +2151,8 @@ const Experience = _a => {
2581
2151
  const {
2582
2152
  status,
2583
2153
  hasVariants,
2584
- experience,
2585
- variant,
2154
+ experience: originalExperience,
2155
+ variant: originalVariant,
2586
2156
  audience,
2587
2157
  isPersonalized,
2588
2158
  profile
@@ -2590,6 +2160,18 @@ const Experience = _a => {
2590
2160
  baseline,
2591
2161
  experiences
2592
2162
  });
2163
+ const experienceSelectionMiddleware = useExperienceSelectionMiddleware({
2164
+ experiences,
2165
+ baseline,
2166
+ profile
2167
+ });
2168
+ const {
2169
+ experience,
2170
+ variant
2171
+ } = experienceSelectionMiddleware({
2172
+ experience: originalExperience,
2173
+ variant: originalVariant
2174
+ });
2593
2175
  const joinExperiment = useJoinExperiment();
2594
2176
  React.useEffect(() => {
2595
2177
  if (status === 'success' && experience && profile) {
@@ -2614,19 +2196,14 @@ const Experience = _a => {
2614
2196
  }));
2615
2197
  }
2616
2198
  if (!experience) {
2617
- return jsxRuntime.jsx(ComponentWrapper, Object.assign({
2618
- experiences: experiences,
2619
- baseline: baseline
2620
- }, {
2621
- children: jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
2622
- ninetailed: {
2623
- isPersonalized: false,
2624
- audience: {
2625
- id: 'baseline'
2626
- }
2199
+ return jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
2200
+ ninetailed: {
2201
+ isPersonalized: false,
2202
+ audience: {
2203
+ id: 'baseline'
2627
2204
  }
2628
- }))
2629
- }), baseline.id);
2205
+ }
2206
+ }));
2630
2207
  }
2631
2208
  if (!variant) {
2632
2209
  return jsxRuntime.jsx(TrackExperience, Object.assign({
@@ -2635,18 +2212,13 @@ const Experience = _a => {
2635
2212
  // the profile is definitely defined, otherwise there wouldn't be an experience selected
2636
2213
  profile: profile
2637
2214
  }, {
2638
- children: jsxRuntime.jsx(ComponentWrapper, Object.assign({
2639
- experiences: experiences,
2640
- baseline: baseline
2641
- }, {
2642
- children: jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
2643
- ninetailed: {
2644
- isPersonalized: false,
2645
- audience: {
2646
- id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2647
- }
2215
+ children: jsxRuntime.jsx(Component, Object.assign({}, passthroughProps, baseline, {
2216
+ ninetailed: {
2217
+ isPersonalized: false,
2218
+ audience: {
2219
+ id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2648
2220
  }
2649
- }))
2221
+ }
2650
2222
  }))
2651
2223
  }), baseline.id);
2652
2224
  }
@@ -2656,22 +2228,17 @@ const Experience = _a => {
2656
2228
  // the profile is definitely defined, otherwise there wouldn't be an experience selected
2657
2229
  profile: profile
2658
2230
  }, {
2659
- children: jsxRuntime.jsx(ComponentWrapper, Object.assign({
2660
- experiences: experiences,
2661
- baseline: baseline
2662
- }, {
2663
- children: jsxRuntime.jsx(ConditionalRenderComponent, {
2664
- children: /*#__PURE__*/React.createElement(Component, Object.assign({}, Object.assign(Object.assign({}, passthroughProps), variant), {
2665
- key: `${experience.id}-${variant.id}`,
2666
- ninetailed: {
2667
- isPersonalized,
2668
- audience: {
2669
- id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2670
- }
2231
+ children: jsxRuntime.jsx(ConditionalRenderComponent, {
2232
+ children: /*#__PURE__*/React.createElement(Component, Object.assign({}, Object.assign(Object.assign({}, passthroughProps), variant), {
2233
+ key: `${experience.id}-${variant.id}`,
2234
+ ninetailed: {
2235
+ isPersonalized,
2236
+ audience: {
2237
+ id: (audience === null || audience === void 0 ? void 0 : audience.id) || 'all visitors'
2671
2238
  }
2672
- }))
2673
- })
2674
- }))
2239
+ }
2240
+ }))
2241
+ })
2675
2242
  }));
2676
2243
  };
2677
2244
 
@@ -2760,6 +2327,242 @@ const ESRLoadingComponent = _a => {
2760
2327
  }));
2761
2328
  };
2762
2329
 
2330
+ const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
2331
+
2332
+ const debounce = (fn, wait, options) => {
2333
+ let debouncedArgs = [];
2334
+ const debouncedFn = _debounce__default["default"](() => {
2335
+ fn.call(undefined, debouncedArgs);
2336
+ debouncedArgs = [];
2337
+ }, wait, options);
2338
+ return (...args) => {
2339
+ debouncedArgs.push(values__default["default"](args));
2340
+ debouncedFn();
2341
+ };
2342
+ };
2343
+ const useProvideJoinExperiment = ({
2344
+ experiments,
2345
+ maximumActiveExperiments: _maximumActiveExperiments = 1
2346
+ }) => {
2347
+ const {
2348
+ identify
2349
+ } = useNinetailed();
2350
+ const joinExperimentIdentify = debounce(args => {
2351
+ const traits = args.slice(0, _maximumActiveExperiments).reduce((traits, [experimentJoinTraits]) => {
2352
+ return Object.assign(Object.assign({}, experimentJoinTraits), traits);
2353
+ }, {});
2354
+ identify('', traits);
2355
+ });
2356
+ return React.useCallback(data => __awaiter(void 0, void 0, void 0, function* () {
2357
+ const {
2358
+ experiment,
2359
+ profile
2360
+ } = data;
2361
+ const isExperiment = experiment.type === 'nt_experiment';
2362
+ if (!isExperiment) {
2363
+ experience_jsShared.logger.warn(`The experience ${experiment.id}, which you tried to join, is not an experiment.`);
2364
+ return;
2365
+ }
2366
+ const activeExperiments = experience_js.selectActiveExperiments(experiments, profile);
2367
+ if (activeExperiments.length >= _maximumActiveExperiments) {
2368
+ experience_jsShared.logger.warn(`The maximum number of active experiments (${_maximumActiveExperiments}) has been reached.`);
2369
+ return;
2370
+ }
2371
+ if (activeExperiments.some(activeExperiment => activeExperiment.id === experiment.id)) {
2372
+ experience_jsShared.logger.debug(`The user is already part of experiment ${experiment.id}. Won't join again.`);
2373
+ return;
2374
+ }
2375
+ joinExperimentIdentify({
2376
+ [`${EXPERIENCE_TRAIT_PREFIX}${experiment.id}`]: true
2377
+ });
2378
+ experience_jsShared.logger.debug(`Sent event to join experiment ${experiment.id}.`);
2379
+ }), []);
2380
+ };
2381
+
2382
+ const ExperimentsProvider = ({
2383
+ experiments,
2384
+ maximumActiveExperiments: _maximumActiveExperiments = 1,
2385
+ children
2386
+ }) => {
2387
+ const joinExperiment = useProvideJoinExperiment({
2388
+ experiments,
2389
+ maximumActiveExperiments: _maximumActiveExperiments
2390
+ });
2391
+ return jsxRuntime.jsx(ExperimentsContext.Provider, Object.assign({
2392
+ value: {
2393
+ experiments,
2394
+ joinExperiment
2395
+ }
2396
+ }, {
2397
+ children: children
2398
+ }));
2399
+ };
2400
+
2401
+ const NinetailedProvider = ({
2402
+ children,
2403
+ clientId,
2404
+ experiments: _experiments = [],
2405
+ maximumActiveExperiments,
2406
+ environment,
2407
+ preview,
2408
+ url,
2409
+ profile,
2410
+ locale,
2411
+ requestTimeout,
2412
+ plugins: _plugins = [],
2413
+ onLog,
2414
+ onError
2415
+ }) => {
2416
+ const ninetailed = React.useMemo(() => new experience_js.Ninetailed({
2417
+ clientId,
2418
+ environment,
2419
+ preview
2420
+ }, {
2421
+ url,
2422
+ plugins: _plugins,
2423
+ profile,
2424
+ locale,
2425
+ requestTimeout,
2426
+ onLog,
2427
+ onError
2428
+ }), []);
2429
+ return jsxRuntime.jsx(NinetailedContext.Provider, Object.assign({
2430
+ value: ninetailed
2431
+ }, {
2432
+ children: jsxRuntime.jsx(ExperimentsProvider, Object.assign({
2433
+ experiments: _experiments,
2434
+ maximumActiveExperiments: maximumActiveExperiments
2435
+ }, {
2436
+ children: children
2437
+ }))
2438
+ }));
2439
+ };
2440
+
2441
+ const usePersonalize = (baseline, variants, options = {
2442
+ holdout: -1
2443
+ }) => {
2444
+ const profile = useProfile();
2445
+ return experience_js.selectVariant(baseline, variants, profile, options);
2446
+ };
2447
+
2448
+ const TrackHasSeenComponent = ({
2449
+ children,
2450
+ variant,
2451
+ audience,
2452
+ isPersonalized
2453
+ }) => {
2454
+ const ninetailed = useNinetailed();
2455
+ const {
2456
+ ref,
2457
+ inView
2458
+ } = reactIntersectionObserver.useInView({
2459
+ triggerOnce: true
2460
+ });
2461
+ React.useEffect(() => {
2462
+ if (experience_jsShared.isBrowser() && inView) {
2463
+ ninetailed.trackHasSeenComponent({
2464
+ variant,
2465
+ audience,
2466
+ isPersonalized
2467
+ });
2468
+ }
2469
+ }, [inView]);
2470
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2471
+ children: [jsxRuntime.jsx("div", {
2472
+ ref: ref
2473
+ }), children]
2474
+ });
2475
+ };
2476
+
2477
+ const Personalize = _a => {
2478
+ var {
2479
+ component: Component,
2480
+ loadingComponent: LoadingComponent,
2481
+ variants = [],
2482
+ holdout = -1
2483
+ } = _a,
2484
+ baseline = __rest(_a, ["component", "loadingComponent", "variants", "holdout"]);
2485
+ const {
2486
+ loading,
2487
+ variant,
2488
+ isPersonalized,
2489
+ audience
2490
+ } = usePersonalize(baseline, variants, {
2491
+ holdout
2492
+ });
2493
+ const hasVariants = variants.length > 0;
2494
+ if (!hasVariants) {
2495
+ return jsxRuntime.jsx(Component, Object.assign({}, baseline, {
2496
+ ninetailed: {
2497
+ isPersonalized,
2498
+ audience
2499
+ }
2500
+ }));
2501
+ }
2502
+ if (loading) {
2503
+ if (LoadingComponent) {
2504
+ return jsxRuntime.jsx(LoadingComponent, {});
2505
+ }
2506
+ return jsxRuntime.jsx("div", Object.assign({
2507
+ style: {
2508
+ opacity: 0
2509
+ }
2510
+ }, {
2511
+ children: jsxRuntime.jsx(Component, Object.assign({}, variant, {
2512
+ ninetailed: {
2513
+ isPersonalized,
2514
+ audience
2515
+ }
2516
+ }))
2517
+ }), "hide");
2518
+ }
2519
+ return jsxRuntime.jsx(TrackHasSeenComponent, Object.assign({
2520
+ variant: variant,
2521
+ audience: audience,
2522
+ isPersonalized: isPersonalized
2523
+ }, {
2524
+ children: /*#__PURE__*/React.createElement(Component, Object.assign({}, variant, {
2525
+ key: `${audience.id}-${variant.id}`,
2526
+ ninetailed: {
2527
+ isPersonalized,
2528
+ audience
2529
+ }
2530
+ }))
2531
+ }));
2532
+ };
2533
+
2534
+ const generateSelectors = id => {
2535
+ return id.split('_').map((path, index, paths) => {
2536
+ const dotPath = paths.slice(0, index).join('.');
2537
+ const underScorePath = paths.slice(index).join('_');
2538
+ return [dotPath, underScorePath].filter(path => path !== '').join('.');
2539
+ });
2540
+ };
2541
+ const selectValueFromProfile = (profile, id) => {
2542
+ const selectors = generateSelectors(id);
2543
+ const matchingSelector = selectors.find(selector => get__default["default"](profile, selector));
2544
+ if (!matchingSelector) {
2545
+ return null;
2546
+ }
2547
+ return get__default["default"](profile, matchingSelector);
2548
+ };
2549
+ const MergeTag = ({
2550
+ id
2551
+ }) => {
2552
+ const {
2553
+ loading,
2554
+ profile
2555
+ } = useProfile();
2556
+ if (loading || !profile) {
2557
+ return null;
2558
+ }
2559
+ const value = selectValueFromProfile(profile, id);
2560
+ // DON'T CHANGE
2561
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {
2562
+ children: value
2563
+ });
2564
+ };
2565
+
2763
2566
  exports.DefaultExperienceLoadingComponent = DefaultExperienceLoadingComponent;
2764
2567
  exports.ESRLoadingComponent = ESRLoadingComponent;
2765
2568
  exports.ESRProvider = ESRProvider;