@ninetailed/experience.js-plugin-preview 3.0.1-beta.4 → 3.0.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js DELETED
@@ -1,1229 +0,0 @@
1
- import union from 'lodash/union';
2
-
3
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
-
5
- var check = function (it) {
6
- return it && it.Math == Math && it;
7
- };
8
-
9
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
10
- var global$l =
11
- // eslint-disable-next-line es/no-global-this -- safe
12
- check(typeof globalThis == 'object' && globalThis) ||
13
- check(typeof window == 'object' && window) ||
14
- // eslint-disable-next-line no-restricted-globals -- safe
15
- check(typeof self == 'object' && self) ||
16
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
17
- // eslint-disable-next-line no-new-func -- fallback
18
- (function () { return this; })() || Function('return this')();
19
-
20
- var objectGetOwnPropertyDescriptor = {};
21
-
22
- var fails$8 = function (exec) {
23
- try {
24
- return !!exec();
25
- } catch (error) {
26
- return true;
27
- }
28
- };
29
-
30
- var fails$7 = fails$8;
31
-
32
- // Detect IE8's incomplete defineProperty implementation
33
- var descriptors = !fails$7(function () {
34
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
35
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
36
- });
37
-
38
- var fails$6 = fails$8;
39
-
40
- var functionBindNative = !fails$6(function () {
41
- var test = (function () { /* empty */ }).bind();
42
- // eslint-disable-next-line no-prototype-builtins -- safe
43
- return typeof test != 'function' || test.hasOwnProperty('prototype');
44
- });
45
-
46
- var NATIVE_BIND$1 = functionBindNative;
47
-
48
- var call$5 = Function.prototype.call;
49
-
50
- var functionCall = NATIVE_BIND$1 ? call$5.bind(call$5) : function () {
51
- return call$5.apply(call$5, arguments);
52
- };
53
-
54
- var objectPropertyIsEnumerable = {};
55
-
56
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
57
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
58
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
59
-
60
- // Nashorn ~ JDK8 bug
61
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
62
-
63
- // `Object.prototype.propertyIsEnumerable` method implementation
64
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
65
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
66
- var descriptor = getOwnPropertyDescriptor$1(this, V);
67
- return !!descriptor && descriptor.enumerable;
68
- } : $propertyIsEnumerable;
69
-
70
- var createPropertyDescriptor$2 = function (bitmap, value) {
71
- return {
72
- enumerable: !(bitmap & 1),
73
- configurable: !(bitmap & 2),
74
- writable: !(bitmap & 4),
75
- value: value
76
- };
77
- };
78
-
79
- var NATIVE_BIND = functionBindNative;
80
-
81
- var FunctionPrototype$1 = Function.prototype;
82
- var bind = FunctionPrototype$1.bind;
83
- var call$4 = FunctionPrototype$1.call;
84
- var uncurryThis$a = NATIVE_BIND && bind.bind(call$4, call$4);
85
-
86
- var functionUncurryThis = NATIVE_BIND ? function (fn) {
87
- return fn && uncurryThis$a(fn);
88
- } : function (fn) {
89
- return fn && function () {
90
- return call$4.apply(fn, arguments);
91
- };
92
- };
93
-
94
- var uncurryThis$9 = functionUncurryThis;
95
-
96
- var toString$1 = uncurryThis$9({}.toString);
97
- var stringSlice = uncurryThis$9(''.slice);
98
-
99
- var classofRaw = function (it) {
100
- return stringSlice(toString$1(it), 8, -1);
101
- };
102
-
103
- var global$k = global$l;
104
- var uncurryThis$8 = functionUncurryThis;
105
- var fails$5 = fails$8;
106
- var classof = classofRaw;
107
-
108
- var Object$3 = global$k.Object;
109
- var split = uncurryThis$8(''.split);
110
-
111
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
112
- var indexedObject = fails$5(function () {
113
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
114
- // eslint-disable-next-line no-prototype-builtins -- safe
115
- return !Object$3('z').propertyIsEnumerable(0);
116
- }) ? function (it) {
117
- return classof(it) == 'String' ? split(it, '') : Object$3(it);
118
- } : Object$3;
119
-
120
- var global$j = global$l;
121
-
122
- var TypeError$6 = global$j.TypeError;
123
-
124
- // `RequireObjectCoercible` abstract operation
125
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
126
- var requireObjectCoercible$2 = function (it) {
127
- if (it == undefined) throw TypeError$6("Can't call method on " + it);
128
- return it;
129
- };
130
-
131
- // toObject with fallback for non-array-like ES3 strings
132
- var IndexedObject$1 = indexedObject;
133
- var requireObjectCoercible$1 = requireObjectCoercible$2;
134
-
135
- var toIndexedObject$3 = function (it) {
136
- return IndexedObject$1(requireObjectCoercible$1(it));
137
- };
138
-
139
- // `IsCallable` abstract operation
140
- // https://tc39.es/ecma262/#sec-iscallable
141
- var isCallable$9 = function (argument) {
142
- return typeof argument == 'function';
143
- };
144
-
145
- var isCallable$8 = isCallable$9;
146
-
147
- var isObject$5 = function (it) {
148
- return typeof it == 'object' ? it !== null : isCallable$8(it);
149
- };
150
-
151
- var global$i = global$l;
152
- var isCallable$7 = isCallable$9;
153
-
154
- var aFunction = function (argument) {
155
- return isCallable$7(argument) ? argument : undefined;
156
- };
157
-
158
- var getBuiltIn$3 = function (namespace, method) {
159
- return arguments.length < 2 ? aFunction(global$i[namespace]) : global$i[namespace] && global$i[namespace][method];
160
- };
161
-
162
- var uncurryThis$7 = functionUncurryThis;
163
-
164
- var objectIsPrototypeOf = uncurryThis$7({}.isPrototypeOf);
165
-
166
- var getBuiltIn$2 = getBuiltIn$3;
167
-
168
- var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';
169
-
170
- var global$h = global$l;
171
- var userAgent = engineUserAgent;
172
-
173
- var process = global$h.process;
174
- var Deno = global$h.Deno;
175
- var versions = process && process.versions || Deno && Deno.version;
176
- var v8 = versions && versions.v8;
177
- var match, version;
178
-
179
- if (v8) {
180
- match = v8.split('.');
181
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
182
- // but their correct versions are not interesting for us
183
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
184
- }
185
-
186
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
187
- // so check `userAgent` even if `.v8` exists, but 0
188
- if (!version && userAgent) {
189
- match = userAgent.match(/Edge\/(\d+)/);
190
- if (!match || match[1] >= 74) {
191
- match = userAgent.match(/Chrome\/(\d+)/);
192
- if (match) version = +match[1];
193
- }
194
- }
195
-
196
- var engineV8Version = version;
197
-
198
- /* eslint-disable es/no-symbol -- required for testing */
199
-
200
- var V8_VERSION = engineV8Version;
201
- var fails$4 = fails$8;
202
-
203
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
204
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$4(function () {
205
- var symbol = Symbol();
206
- // Chrome 38 Symbol has incorrect toString conversion
207
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
208
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
209
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
210
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
211
- });
212
-
213
- /* eslint-disable es/no-symbol -- required for testing */
214
-
215
- var NATIVE_SYMBOL$1 = nativeSymbol;
216
-
217
- var useSymbolAsUid = NATIVE_SYMBOL$1
218
- && !Symbol.sham
219
- && typeof Symbol.iterator == 'symbol';
220
-
221
- var global$g = global$l;
222
- var getBuiltIn$1 = getBuiltIn$3;
223
- var isCallable$6 = isCallable$9;
224
- var isPrototypeOf = objectIsPrototypeOf;
225
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
226
-
227
- var Object$2 = global$g.Object;
228
-
229
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
230
- return typeof it == 'symbol';
231
- } : function (it) {
232
- var $Symbol = getBuiltIn$1('Symbol');
233
- return isCallable$6($Symbol) && isPrototypeOf($Symbol.prototype, Object$2(it));
234
- };
235
-
236
- var global$f = global$l;
237
-
238
- var String$2 = global$f.String;
239
-
240
- var tryToString$1 = function (argument) {
241
- try {
242
- return String$2(argument);
243
- } catch (error) {
244
- return 'Object';
245
- }
246
- };
247
-
248
- var global$e = global$l;
249
- var isCallable$5 = isCallable$9;
250
- var tryToString = tryToString$1;
251
-
252
- var TypeError$5 = global$e.TypeError;
253
-
254
- // `Assert: IsCallable(argument) is true`
255
- var aCallable$1 = function (argument) {
256
- if (isCallable$5(argument)) return argument;
257
- throw TypeError$5(tryToString(argument) + ' is not a function');
258
- };
259
-
260
- var aCallable = aCallable$1;
261
-
262
- // `GetMethod` abstract operation
263
- // https://tc39.es/ecma262/#sec-getmethod
264
- var getMethod$1 = function (V, P) {
265
- var func = V[P];
266
- return func == null ? undefined : aCallable(func);
267
- };
268
-
269
- var global$d = global$l;
270
- var call$3 = functionCall;
271
- var isCallable$4 = isCallable$9;
272
- var isObject$4 = isObject$5;
273
-
274
- var TypeError$4 = global$d.TypeError;
275
-
276
- // `OrdinaryToPrimitive` abstract operation
277
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
278
- var ordinaryToPrimitive$1 = function (input, pref) {
279
- var fn, val;
280
- if (pref === 'string' && isCallable$4(fn = input.toString) && !isObject$4(val = call$3(fn, input))) return val;
281
- if (isCallable$4(fn = input.valueOf) && !isObject$4(val = call$3(fn, input))) return val;
282
- if (pref !== 'string' && isCallable$4(fn = input.toString) && !isObject$4(val = call$3(fn, input))) return val;
283
- throw TypeError$4("Can't convert object to primitive value");
284
- };
285
-
286
- var shared$3 = {exports: {}};
287
-
288
- var global$c = global$l;
289
-
290
- // eslint-disable-next-line es/no-object-defineproperty -- safe
291
- var defineProperty$1 = Object.defineProperty;
292
-
293
- var setGlobal$3 = function (key, value) {
294
- try {
295
- defineProperty$1(global$c, key, { value: value, configurable: true, writable: true });
296
- } catch (error) {
297
- global$c[key] = value;
298
- } return value;
299
- };
300
-
301
- var global$b = global$l;
302
- var setGlobal$2 = setGlobal$3;
303
-
304
- var SHARED = '__core-js_shared__';
305
- var store$3 = global$b[SHARED] || setGlobal$2(SHARED, {});
306
-
307
- var sharedStore = store$3;
308
-
309
- var store$2 = sharedStore;
310
-
311
- (shared$3.exports = function (key, value) {
312
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
313
- })('versions', []).push({
314
- version: '3.21.1',
315
- mode: 'global',
316
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
317
- license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
318
- source: 'https://github.com/zloirock/core-js'
319
- });
320
-
321
- var global$a = global$l;
322
- var requireObjectCoercible = requireObjectCoercible$2;
323
-
324
- var Object$1 = global$a.Object;
325
-
326
- // `ToObject` abstract operation
327
- // https://tc39.es/ecma262/#sec-toobject
328
- var toObject$2 = function (argument) {
329
- return Object$1(requireObjectCoercible(argument));
330
- };
331
-
332
- var uncurryThis$6 = functionUncurryThis;
333
- var toObject$1 = toObject$2;
334
-
335
- var hasOwnProperty = uncurryThis$6({}.hasOwnProperty);
336
-
337
- // `HasOwnProperty` abstract operation
338
- // https://tc39.es/ecma262/#sec-hasownproperty
339
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
340
- return hasOwnProperty(toObject$1(it), key);
341
- };
342
-
343
- var uncurryThis$5 = functionUncurryThis;
344
-
345
- var id = 0;
346
- var postfix = Math.random();
347
- var toString = uncurryThis$5(1.0.toString);
348
-
349
- var uid$2 = function (key) {
350
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
351
- };
352
-
353
- var global$9 = global$l;
354
- var shared$2 = shared$3.exports;
355
- var hasOwn$6 = hasOwnProperty_1;
356
- var uid$1 = uid$2;
357
- var NATIVE_SYMBOL = nativeSymbol;
358
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
359
-
360
- var WellKnownSymbolsStore = shared$2('wks');
361
- var Symbol$1 = global$9.Symbol;
362
- var symbolFor = Symbol$1 && Symbol$1['for'];
363
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
364
-
365
- var wellKnownSymbol$1 = function (name) {
366
- if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
367
- var description = 'Symbol.' + name;
368
- if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
369
- WellKnownSymbolsStore[name] = Symbol$1[name];
370
- } else if (USE_SYMBOL_AS_UID && symbolFor) {
371
- WellKnownSymbolsStore[name] = symbolFor(description);
372
- } else {
373
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
374
- }
375
- } return WellKnownSymbolsStore[name];
376
- };
377
-
378
- var global$8 = global$l;
379
- var call$2 = functionCall;
380
- var isObject$3 = isObject$5;
381
- var isSymbol$1 = isSymbol$2;
382
- var getMethod = getMethod$1;
383
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
384
- var wellKnownSymbol = wellKnownSymbol$1;
385
-
386
- var TypeError$3 = global$8.TypeError;
387
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
388
-
389
- // `ToPrimitive` abstract operation
390
- // https://tc39.es/ecma262/#sec-toprimitive
391
- var toPrimitive$1 = function (input, pref) {
392
- if (!isObject$3(input) || isSymbol$1(input)) return input;
393
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
394
- var result;
395
- if (exoticToPrim) {
396
- if (pref === undefined) pref = 'default';
397
- result = call$2(exoticToPrim, input, pref);
398
- if (!isObject$3(result) || isSymbol$1(result)) return result;
399
- throw TypeError$3("Can't convert object to primitive value");
400
- }
401
- if (pref === undefined) pref = 'number';
402
- return ordinaryToPrimitive(input, pref);
403
- };
404
-
405
- var toPrimitive = toPrimitive$1;
406
- var isSymbol = isSymbol$2;
407
-
408
- // `ToPropertyKey` abstract operation
409
- // https://tc39.es/ecma262/#sec-topropertykey
410
- var toPropertyKey$2 = function (argument) {
411
- var key = toPrimitive(argument, 'string');
412
- return isSymbol(key) ? key : key + '';
413
- };
414
-
415
- var global$7 = global$l;
416
- var isObject$2 = isObject$5;
417
-
418
- var document$1 = global$7.document;
419
- // typeof document.createElement is 'object' in old IE
420
- var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
421
-
422
- var documentCreateElement = function (it) {
423
- return EXISTS$1 ? document$1.createElement(it) : {};
424
- };
425
-
426
- var DESCRIPTORS$6 = descriptors;
427
- var fails$3 = fails$8;
428
- var createElement = documentCreateElement;
429
-
430
- // Thanks to IE8 for its funny defineProperty
431
- var ie8DomDefine = !DESCRIPTORS$6 && !fails$3(function () {
432
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
433
- return Object.defineProperty(createElement('div'), 'a', {
434
- get: function () { return 7; }
435
- }).a != 7;
436
- });
437
-
438
- var DESCRIPTORS$5 = descriptors;
439
- var call$1 = functionCall;
440
- var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
441
- var createPropertyDescriptor$1 = createPropertyDescriptor$2;
442
- var toIndexedObject$2 = toIndexedObject$3;
443
- var toPropertyKey$1 = toPropertyKey$2;
444
- var hasOwn$5 = hasOwnProperty_1;
445
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
446
-
447
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
448
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
449
-
450
- // `Object.getOwnPropertyDescriptor` method
451
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
452
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
453
- O = toIndexedObject$2(O);
454
- P = toPropertyKey$1(P);
455
- if (IE8_DOM_DEFINE$1) try {
456
- return $getOwnPropertyDescriptor$1(O, P);
457
- } catch (error) { /* empty */ }
458
- if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call$1(propertyIsEnumerableModule$1.f, O, P), O[P]);
459
- };
460
-
461
- var objectDefineProperty = {};
462
-
463
- var DESCRIPTORS$4 = descriptors;
464
- var fails$2 = fails$8;
465
-
466
- // V8 ~ Chrome 36-
467
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
468
- var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$2(function () {
469
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
470
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
471
- value: 42,
472
- writable: false
473
- }).prototype != 42;
474
- });
475
-
476
- var global$6 = global$l;
477
- var isObject$1 = isObject$5;
478
-
479
- var String$1 = global$6.String;
480
- var TypeError$2 = global$6.TypeError;
481
-
482
- // `Assert: Type(argument) is Object`
483
- var anObject$2 = function (argument) {
484
- if (isObject$1(argument)) return argument;
485
- throw TypeError$2(String$1(argument) + ' is not an object');
486
- };
487
-
488
- var global$5 = global$l;
489
- var DESCRIPTORS$3 = descriptors;
490
- var IE8_DOM_DEFINE = ie8DomDefine;
491
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
492
- var anObject$1 = anObject$2;
493
- var toPropertyKey = toPropertyKey$2;
494
-
495
- var TypeError$1 = global$5.TypeError;
496
- // eslint-disable-next-line es/no-object-defineproperty -- safe
497
- var $defineProperty = Object.defineProperty;
498
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
499
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
500
- var ENUMERABLE = 'enumerable';
501
- var CONFIGURABLE$1 = 'configurable';
502
- var WRITABLE = 'writable';
503
-
504
- // `Object.defineProperty` method
505
- // https://tc39.es/ecma262/#sec-object.defineproperty
506
- objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
507
- anObject$1(O);
508
- P = toPropertyKey(P);
509
- anObject$1(Attributes);
510
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
511
- var current = $getOwnPropertyDescriptor(O, P);
512
- if (current && current[WRITABLE]) {
513
- O[P] = Attributes.value;
514
- Attributes = {
515
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
516
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
517
- writable: false
518
- };
519
- }
520
- } return $defineProperty(O, P, Attributes);
521
- } : $defineProperty : function defineProperty(O, P, Attributes) {
522
- anObject$1(O);
523
- P = toPropertyKey(P);
524
- anObject$1(Attributes);
525
- if (IE8_DOM_DEFINE) try {
526
- return $defineProperty(O, P, Attributes);
527
- } catch (error) { /* empty */ }
528
- if ('get' in Attributes || 'set' in Attributes) throw TypeError$1('Accessors not supported');
529
- if ('value' in Attributes) O[P] = Attributes.value;
530
- return O;
531
- };
532
-
533
- var DESCRIPTORS$2 = descriptors;
534
- var definePropertyModule$1 = objectDefineProperty;
535
- var createPropertyDescriptor = createPropertyDescriptor$2;
536
-
537
- var createNonEnumerableProperty$3 = DESCRIPTORS$2 ? function (object, key, value) {
538
- return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value));
539
- } : function (object, key, value) {
540
- object[key] = value;
541
- return object;
542
- };
543
-
544
- var redefine$1 = {exports: {}};
545
-
546
- var uncurryThis$4 = functionUncurryThis;
547
- var isCallable$3 = isCallable$9;
548
- var store$1 = sharedStore;
549
-
550
- var functionToString = uncurryThis$4(Function.toString);
551
-
552
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
553
- if (!isCallable$3(store$1.inspectSource)) {
554
- store$1.inspectSource = function (it) {
555
- return functionToString(it);
556
- };
557
- }
558
-
559
- var inspectSource$2 = store$1.inspectSource;
560
-
561
- var global$4 = global$l;
562
- var isCallable$2 = isCallable$9;
563
- var inspectSource$1 = inspectSource$2;
564
-
565
- var WeakMap$1 = global$4.WeakMap;
566
-
567
- var nativeWeakMap = isCallable$2(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
568
-
569
- var shared$1 = shared$3.exports;
570
- var uid = uid$2;
571
-
572
- var keys = shared$1('keys');
573
-
574
- var sharedKey$1 = function (key) {
575
- return keys[key] || (keys[key] = uid(key));
576
- };
577
-
578
- var hiddenKeys$3 = {};
579
-
580
- var NATIVE_WEAK_MAP = nativeWeakMap;
581
- var global$3 = global$l;
582
- var uncurryThis$3 = functionUncurryThis;
583
- var isObject = isObject$5;
584
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
585
- var hasOwn$4 = hasOwnProperty_1;
586
- var shared = sharedStore;
587
- var sharedKey = sharedKey$1;
588
- var hiddenKeys$2 = hiddenKeys$3;
589
-
590
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
591
- var TypeError = global$3.TypeError;
592
- var WeakMap = global$3.WeakMap;
593
- var set, get, has;
594
-
595
- var enforce = function (it) {
596
- return has(it) ? get(it) : set(it, {});
597
- };
598
-
599
- var getterFor = function (TYPE) {
600
- return function (it) {
601
- var state;
602
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
603
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
604
- } return state;
605
- };
606
- };
607
-
608
- if (NATIVE_WEAK_MAP || shared.state) {
609
- var store = shared.state || (shared.state = new WeakMap());
610
- var wmget = uncurryThis$3(store.get);
611
- var wmhas = uncurryThis$3(store.has);
612
- var wmset = uncurryThis$3(store.set);
613
- set = function (it, metadata) {
614
- if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
615
- metadata.facade = it;
616
- wmset(store, it, metadata);
617
- return metadata;
618
- };
619
- get = function (it) {
620
- return wmget(store, it) || {};
621
- };
622
- has = function (it) {
623
- return wmhas(store, it);
624
- };
625
- } else {
626
- var STATE = sharedKey('state');
627
- hiddenKeys$2[STATE] = true;
628
- set = function (it, metadata) {
629
- if (hasOwn$4(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
630
- metadata.facade = it;
631
- createNonEnumerableProperty$2(it, STATE, metadata);
632
- return metadata;
633
- };
634
- get = function (it) {
635
- return hasOwn$4(it, STATE) ? it[STATE] : {};
636
- };
637
- has = function (it) {
638
- return hasOwn$4(it, STATE);
639
- };
640
- }
641
-
642
- var internalState = {
643
- set: set,
644
- get: get,
645
- has: has,
646
- enforce: enforce,
647
- getterFor: getterFor
648
- };
649
-
650
- var DESCRIPTORS$1 = descriptors;
651
- var hasOwn$3 = hasOwnProperty_1;
652
-
653
- var FunctionPrototype = Function.prototype;
654
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
655
- var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
656
-
657
- var EXISTS = hasOwn$3(FunctionPrototype, 'name');
658
- // additional protection from minified / mangled / dropped function names
659
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
660
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
661
-
662
- var functionName = {
663
- EXISTS: EXISTS,
664
- PROPER: PROPER,
665
- CONFIGURABLE: CONFIGURABLE
666
- };
667
-
668
- var global$2 = global$l;
669
- var isCallable$1 = isCallable$9;
670
- var hasOwn$2 = hasOwnProperty_1;
671
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
672
- var setGlobal$1 = setGlobal$3;
673
- var inspectSource = inspectSource$2;
674
- var InternalStateModule = internalState;
675
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
676
-
677
- var getInternalState = InternalStateModule.get;
678
- var enforceInternalState = InternalStateModule.enforce;
679
- var TEMPLATE = String(String).split('String');
680
-
681
- (redefine$1.exports = function (O, key, value, options) {
682
- var unsafe = options ? !!options.unsafe : false;
683
- var simple = options ? !!options.enumerable : false;
684
- var noTargetGet = options ? !!options.noTargetGet : false;
685
- var name = options && options.name !== undefined ? options.name : key;
686
- var state;
687
- if (isCallable$1(value)) {
688
- if (String(name).slice(0, 7) === 'Symbol(') {
689
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
690
- }
691
- if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
692
- createNonEnumerableProperty$1(value, 'name', name);
693
- }
694
- state = enforceInternalState(value);
695
- if (!state.source) {
696
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
697
- }
698
- }
699
- if (O === global$2) {
700
- if (simple) O[key] = value;
701
- else setGlobal$1(key, value);
702
- return;
703
- } else if (!unsafe) {
704
- delete O[key];
705
- } else if (!noTargetGet && O[key]) {
706
- simple = true;
707
- }
708
- if (simple) O[key] = value;
709
- else createNonEnumerableProperty$1(O, key, value);
710
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
711
- })(Function.prototype, 'toString', function toString() {
712
- return isCallable$1(this) && getInternalState(this).source || inspectSource(this);
713
- });
714
-
715
- var objectGetOwnPropertyNames = {};
716
-
717
- var ceil = Math.ceil;
718
- var floor = Math.floor;
719
-
720
- // `ToIntegerOrInfinity` abstract operation
721
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
722
- var toIntegerOrInfinity$2 = function (argument) {
723
- var number = +argument;
724
- // eslint-disable-next-line no-self-compare -- safe
725
- return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
726
- };
727
-
728
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
729
-
730
- var max = Math.max;
731
- var min$1 = Math.min;
732
-
733
- // Helper for a popular repeating case of the spec:
734
- // Let integer be ? ToInteger(index).
735
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
736
- var toAbsoluteIndex$1 = function (index, length) {
737
- var integer = toIntegerOrInfinity$1(index);
738
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
739
- };
740
-
741
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
742
-
743
- var min = Math.min;
744
-
745
- // `ToLength` abstract operation
746
- // https://tc39.es/ecma262/#sec-tolength
747
- var toLength$1 = function (argument) {
748
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
749
- };
750
-
751
- var toLength = toLength$1;
752
-
753
- // `LengthOfArrayLike` abstract operation
754
- // https://tc39.es/ecma262/#sec-lengthofarraylike
755
- var lengthOfArrayLike$1 = function (obj) {
756
- return toLength(obj.length);
757
- };
758
-
759
- var toIndexedObject$1 = toIndexedObject$3;
760
- var toAbsoluteIndex = toAbsoluteIndex$1;
761
- var lengthOfArrayLike = lengthOfArrayLike$1;
762
-
763
- // `Array.prototype.{ indexOf, includes }` methods implementation
764
- var createMethod = function (IS_INCLUDES) {
765
- return function ($this, el, fromIndex) {
766
- var O = toIndexedObject$1($this);
767
- var length = lengthOfArrayLike(O);
768
- var index = toAbsoluteIndex(fromIndex, length);
769
- var value;
770
- // Array#includes uses SameValueZero equality algorithm
771
- // eslint-disable-next-line no-self-compare -- NaN check
772
- if (IS_INCLUDES && el != el) while (length > index) {
773
- value = O[index++];
774
- // eslint-disable-next-line no-self-compare -- NaN check
775
- if (value != value) return true;
776
- // Array#indexOf ignores holes, Array#includes - not
777
- } else for (;length > index; index++) {
778
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
779
- } return !IS_INCLUDES && -1;
780
- };
781
- };
782
-
783
- var arrayIncludes = {
784
- // `Array.prototype.includes` method
785
- // https://tc39.es/ecma262/#sec-array.prototype.includes
786
- includes: createMethod(true),
787
- // `Array.prototype.indexOf` method
788
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
789
- indexOf: createMethod(false)
790
- };
791
-
792
- var uncurryThis$2 = functionUncurryThis;
793
- var hasOwn$1 = hasOwnProperty_1;
794
- var toIndexedObject = toIndexedObject$3;
795
- var indexOf = arrayIncludes.indexOf;
796
- var hiddenKeys$1 = hiddenKeys$3;
797
-
798
- var push = uncurryThis$2([].push);
799
-
800
- var objectKeysInternal = function (object, names) {
801
- var O = toIndexedObject(object);
802
- var i = 0;
803
- var result = [];
804
- var key;
805
- for (key in O) !hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O, key) && push(result, key);
806
- // Don't enum bug & hidden keys
807
- while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
808
- ~indexOf(result, key) || push(result, key);
809
- }
810
- return result;
811
- };
812
-
813
- // IE8- don't enum bug keys
814
- var enumBugKeys$2 = [
815
- 'constructor',
816
- 'hasOwnProperty',
817
- 'isPrototypeOf',
818
- 'propertyIsEnumerable',
819
- 'toLocaleString',
820
- 'toString',
821
- 'valueOf'
822
- ];
823
-
824
- var internalObjectKeys$1 = objectKeysInternal;
825
- var enumBugKeys$1 = enumBugKeys$2;
826
-
827
- var hiddenKeys = enumBugKeys$1.concat('length', 'prototype');
828
-
829
- // `Object.getOwnPropertyNames` method
830
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
831
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
832
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
833
- return internalObjectKeys$1(O, hiddenKeys);
834
- };
835
-
836
- var objectGetOwnPropertySymbols = {};
837
-
838
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
839
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
840
-
841
- var getBuiltIn = getBuiltIn$3;
842
- var uncurryThis$1 = functionUncurryThis;
843
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
844
- var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
845
- var anObject = anObject$2;
846
-
847
- var concat$1 = uncurryThis$1([].concat);
848
-
849
- // all object keys, includes non-enumerable and symbols
850
- var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
851
- var keys = getOwnPropertyNamesModule.f(anObject(it));
852
- var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
853
- return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
854
- };
855
-
856
- var hasOwn = hasOwnProperty_1;
857
- var ownKeys = ownKeys$1;
858
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
859
- var definePropertyModule = objectDefineProperty;
860
-
861
- var copyConstructorProperties$1 = function (target, source, exceptions) {
862
- var keys = ownKeys(source);
863
- var defineProperty = definePropertyModule.f;
864
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
865
- for (var i = 0; i < keys.length; i++) {
866
- var key = keys[i];
867
- if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
868
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
869
- }
870
- }
871
- };
872
-
873
- var fails$1 = fails$8;
874
- var isCallable = isCallable$9;
875
-
876
- var replacement = /#|\.prototype\./;
877
-
878
- var isForced$1 = function (feature, detection) {
879
- var value = data[normalize(feature)];
880
- return value == POLYFILL ? true
881
- : value == NATIVE ? false
882
- : isCallable(detection) ? fails$1(detection)
883
- : !!detection;
884
- };
885
-
886
- var normalize = isForced$1.normalize = function (string) {
887
- return String(string).replace(replacement, '.').toLowerCase();
888
- };
889
-
890
- var data = isForced$1.data = {};
891
- var NATIVE = isForced$1.NATIVE = 'N';
892
- var POLYFILL = isForced$1.POLYFILL = 'P';
893
-
894
- var isForced_1 = isForced$1;
895
-
896
- var global$1 = global$l;
897
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
898
- var createNonEnumerableProperty = createNonEnumerableProperty$3;
899
- var redefine = redefine$1.exports;
900
- var setGlobal = setGlobal$3;
901
- var copyConstructorProperties = copyConstructorProperties$1;
902
- var isForced = isForced_1;
903
-
904
- /*
905
- options.target - name of the target object
906
- options.global - target is the global object
907
- options.stat - export as static methods of target
908
- options.proto - export as prototype methods of target
909
- options.real - real prototype method for the `pure` version
910
- options.forced - export even if the native feature is available
911
- options.bind - bind methods to the target, required for the `pure` version
912
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
913
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
914
- options.sham - add a flag to not completely full polyfills
915
- options.enumerable - export as enumerable property
916
- options.noTargetGet - prevent calling a getter on target
917
- options.name - the .name of the function if it does not match the key
918
- */
919
- var _export = function (options, source) {
920
- var TARGET = options.target;
921
- var GLOBAL = options.global;
922
- var STATIC = options.stat;
923
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
924
- if (GLOBAL) {
925
- target = global$1;
926
- } else if (STATIC) {
927
- target = global$1[TARGET] || setGlobal(TARGET, {});
928
- } else {
929
- target = (global$1[TARGET] || {}).prototype;
930
- }
931
- if (target) for (key in source) {
932
- sourceProperty = source[key];
933
- if (options.noTargetGet) {
934
- descriptor = getOwnPropertyDescriptor(target, key);
935
- targetProperty = descriptor && descriptor.value;
936
- } else targetProperty = target[key];
937
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
938
- // contained in target
939
- if (!FORCED && targetProperty !== undefined) {
940
- if (typeof sourceProperty == typeof targetProperty) continue;
941
- copyConstructorProperties(sourceProperty, targetProperty);
942
- }
943
- // add a flag to not completely full polyfills
944
- if (options.sham || (targetProperty && targetProperty.sham)) {
945
- createNonEnumerableProperty(sourceProperty, 'sham', true);
946
- }
947
- // extend global
948
- redefine(target, key, sourceProperty, options);
949
- }
950
- };
951
-
952
- var internalObjectKeys = objectKeysInternal;
953
- var enumBugKeys = enumBugKeys$2;
954
-
955
- // `Object.keys` method
956
- // https://tc39.es/ecma262/#sec-object.keys
957
- // eslint-disable-next-line es/no-object-keys -- safe
958
- var objectKeys$1 = Object.keys || function keys(O) {
959
- return internalObjectKeys(O, enumBugKeys);
960
- };
961
-
962
- var DESCRIPTORS = descriptors;
963
- var uncurryThis = functionUncurryThis;
964
- var call = functionCall;
965
- var fails = fails$8;
966
- var objectKeys = objectKeys$1;
967
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
968
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
969
- var toObject = toObject$2;
970
- var IndexedObject = indexedObject;
971
-
972
- // eslint-disable-next-line es/no-object-assign -- safe
973
- var $assign = Object.assign;
974
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
975
- var defineProperty = Object.defineProperty;
976
- var concat = uncurryThis([].concat);
977
-
978
- // `Object.assign` method
979
- // https://tc39.es/ecma262/#sec-object.assign
980
- var objectAssign = !$assign || fails(function () {
981
- // should have correct order of operations (Edge bug)
982
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
983
- enumerable: true,
984
- get: function () {
985
- defineProperty(this, 'b', {
986
- value: 3,
987
- enumerable: false
988
- });
989
- }
990
- }), { b: 2 })).b !== 1) return true;
991
- // should work with symbols and should have deterministic property order (V8 bug)
992
- var A = {};
993
- var B = {};
994
- // eslint-disable-next-line es/no-symbol -- safe
995
- var symbol = Symbol();
996
- var alphabet = 'abcdefghijklmnopqrst';
997
- A[symbol] = 7;
998
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
999
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
1000
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1001
- var T = toObject(target);
1002
- var argumentsLength = arguments.length;
1003
- var index = 1;
1004
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1005
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
1006
- while (argumentsLength > index) {
1007
- var S = IndexedObject(arguments[index++]);
1008
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1009
- var length = keys.length;
1010
- var j = 0;
1011
- var key;
1012
- while (length > j) {
1013
- key = keys[j++];
1014
- if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];
1015
- }
1016
- } return T;
1017
- } : $assign;
1018
-
1019
- var $ = _export;
1020
- var assign = objectAssign;
1021
-
1022
- // `Object.assign` method
1023
- // https://tc39.es/ecma262/#sec-object.assign
1024
- // eslint-disable-next-line es/no-object-assign -- required for testing
1025
- $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
1026
- assign: assign
1027
- });
1028
-
1029
- const CONTAINER_WIDTH = 432;
1030
- const BUTTON_WIDTH = 48;
1031
- const BUTTON_HEIGHT = 192;
1032
- const BUTTON_BOTTOM_POSITION = 128;
1033
- const TRANSFORM_CLOSED = `translate(${CONTAINER_WIDTH - BUTTON_WIDTH}px, 0px)`;
1034
- const TRANSFORM_CLOSED_HIDE = `translate(${CONTAINER_WIDTH}px, 0px)`;
1035
- const TRANSFORM_OPEN = `translate(0px, 0px)`;
1036
- class WidgetContainer {
1037
- constructor(options) {
1038
- var _a, _b;
1039
-
1040
- this.options = options;
1041
- this.container = document.createElement('div');
1042
- this.container.style.position = 'fixed';
1043
- this.container.style.zIndex = '999999';
1044
- this.container.style.right = '0px';
1045
- this.container.style.bottom = `${BUTTON_BOTTOM_POSITION}px`;
1046
- this.container.style.width = `${CONTAINER_WIDTH}px`;
1047
- this.container.style.height = `${BUTTON_HEIGHT}px`;
1048
-
1049
- if ((_b = (_a = options.ui) === null || _a === void 0 ? void 0 : _a.opener) === null || _b === void 0 ? void 0 : _b.hide) {
1050
- this.container.style.transform = TRANSFORM_CLOSED_HIDE;
1051
- } else {
1052
- this.container.style.transform = TRANSFORM_CLOSED;
1053
- }
1054
-
1055
- this.container.style.transitionTimingFunction = 'cubic-bezier(0.4, 0, 0.2, 1)';
1056
- this.container.style.transitionDuration = '700ms';
1057
- this.container.style.transitionProperty = 'transform';
1058
- document.body.appendChild(this.container);
1059
- }
1060
-
1061
- open() {
1062
- this.container.style.transform = TRANSFORM_OPEN;
1063
- this.container.style.height = '100vh';
1064
- this.container.style.bottom = `0px`;
1065
- }
1066
-
1067
- close() {
1068
- var _a, _b;
1069
-
1070
- if ((_b = (_a = this.options.ui) === null || _a === void 0 ? void 0 : _a.opener) === null || _b === void 0 ? void 0 : _b.hide) {
1071
- this.container.style.transform = TRANSFORM_CLOSED_HIDE;
1072
- } else {
1073
- this.container.style.transform = TRANSFORM_CLOSED;
1074
- }
1075
-
1076
- setTimeout(() => {
1077
- this.container.style.height = `${BUTTON_HEIGHT}px`;
1078
- this.container.style.bottom = `${BUTTON_BOTTOM_POSITION}px`;
1079
- }, 700);
1080
- }
1081
-
1082
- get element() {
1083
- return this.container;
1084
- }
1085
-
1086
- }
1087
-
1088
- const NinetailedPreviewPlugin = ({
1089
- clientId,
1090
- secret,
1091
- url,
1092
- environment,
1093
- ui
1094
- }) => {
1095
- let isOpen = false;
1096
- let activatedAudiences = [];
1097
- let audiences = [];
1098
- let lastProfile;
1099
- return {
1100
- name: 'ninetailed:preview' + Math.random(),
1101
- config: {},
1102
- initialize: ({
1103
- instance
1104
- }) => {
1105
- var _a;
1106
-
1107
- if (typeof window !== 'undefined') {
1108
- const {
1109
- PreviewBridge
1110
- } = require('@ninetailed/experience.js-preview-bridge');
1111
-
1112
- const container = new WidgetContainer({
1113
- ui
1114
- });
1115
- const preview = PreviewBridge({
1116
- url
1117
- });
1118
- preview.render(container.element);
1119
-
1120
- const open = () => {
1121
- container.open();
1122
- isOpen = true;
1123
- instance.dispatch({
1124
- type: 'preview:change'
1125
- });
1126
- };
1127
-
1128
- const close = () => {
1129
- container.close();
1130
- setTimeout(() => {
1131
- isOpen = false;
1132
- instance.dispatch({
1133
- type: 'preview:change'
1134
- });
1135
- }, 700);
1136
- };
1137
-
1138
- const toggle = () => {
1139
- if (isOpen) {
1140
- close();
1141
- } else {
1142
- open();
1143
- }
1144
- };
1145
-
1146
- const activateAudience = id => {
1147
- activatedAudiences = union(activatedAudiences, [id]);
1148
- instance.dispatch({
1149
- type: 'profile',
1150
- profile: lastProfile
1151
- });
1152
- };
1153
-
1154
- const deactivateAudience = id => {
1155
- activatedAudiences = activatedAudiences.filter(activatedAudience => activatedAudience !== id);
1156
- instance.dispatch({
1157
- type: 'profile',
1158
- profile: lastProfile
1159
- });
1160
- };
1161
-
1162
- const buildPreviewPlugin = () => ({
1163
- open: () => open(),
1164
- close: () => close(),
1165
- toggle: () => toggle(),
1166
- isOpen,
1167
- activateAudience: id => activateAudience(id),
1168
- deactivateAudience: id => deactivateAudience(id),
1169
- activatedAudiences,
1170
- audiences
1171
- });
1172
-
1173
- window.ninetailed = Object.assign({}, window.ninetailed, {
1174
- plugins: Object.assign(Object.assign({}, (_a = window.ninetailed) === null || _a === void 0 ? void 0 : _a.plugins), {
1175
- preview: buildPreviewPlugin()
1176
- })
1177
- });
1178
-
1179
- const buildNinetailed = () => {
1180
- var _a;
1181
-
1182
- return Object.assign({}, window.ninetailed, {
1183
- version: '1.5.1',
1184
- plugins: Object.assign(Object.assign({}, (_a = window.ninetailed) === null || _a === void 0 ? void 0 : _a.plugins), {
1185
- preview: buildPreviewPlugin()
1186
- }),
1187
- credentials: {
1188
- clientId,
1189
- secret,
1190
- environment
1191
- }
1192
- });
1193
- };
1194
-
1195
- instance.on('profile', () => {
1196
- preview.updateProps({
1197
- props: buildNinetailed()
1198
- });
1199
- });
1200
- instance.on('preview:change', () => {
1201
- preview.updateProps({
1202
- props: buildNinetailed()
1203
- });
1204
- });
1205
- }
1206
- },
1207
- profile: ({
1208
- payload
1209
- }) => {
1210
- var _a;
1211
-
1212
- audiences = ((_a = payload === null || payload === void 0 ? void 0 : payload.profile) === null || _a === void 0 ? void 0 : _a.audiences) || [];
1213
- lastProfile = payload.profile;
1214
- return Object.assign(Object.assign({}, payload), {
1215
- profile: Object.assign(Object.assign({}, payload.profile), {
1216
- audiences: union(audiences, activatedAudiences)
1217
- })
1218
- });
1219
- },
1220
- loaded: () => true
1221
- };
1222
- };
1223
-
1224
- if (typeof window === 'object' && !('process' in window)) {
1225
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1226
- window.process = {};
1227
- }
1228
-
1229
- export { NinetailedPreviewPlugin, NinetailedPreviewPlugin as default };