@adhese/sdk 0.6.3 → 0.7.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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createDevtools } from "@adhese/sdk-devtools";
2
1
  import { effectScope, shallowReactive, watchEffect, watch, reactive, ref, computed, toValue } from "@vue/runtime-core";
2
+ import { debounce, round, isDeepEqual } from "remeda";
3
3
  import { union, coerce, literal, number, string, ZodIssueCode, NEVER, object, unknown, lazy } from "zod";
4
4
  async function waitForDomLoad() {
5
5
  return new Promise((resolve) => {
@@ -60,108 +60,15 @@ function createEvent() {
60
60
  removeListener
61
61
  };
62
62
  }
63
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
64
- function getDefaultExportFromCjs(x) {
65
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
63
+ const savedIds = /* @__PURE__ */ new Set();
64
+ function uniqueId() {
65
+ let id;
66
+ do
67
+ id = Math.random().toString(36).slice(2);
68
+ while (savedIds.has(id));
69
+ savedIds.add(id);
70
+ return id;
66
71
  }
67
- var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
68
- var _freeGlobal = freeGlobal$1;
69
- var freeGlobal = _freeGlobal;
70
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
71
- var root$a = freeGlobal || freeSelf || Function("return this")();
72
- var _root = root$a;
73
- var root$9 = _root;
74
- var Symbol$5 = root$9.Symbol;
75
- var _Symbol = Symbol$5;
76
- function arrayMap$1(array, iteratee) {
77
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
78
- while (++index < length) {
79
- result[index] = iteratee(array[index], index, array);
80
- }
81
- return result;
82
- }
83
- var _arrayMap = arrayMap$1;
84
- var isArray$4 = Array.isArray;
85
- var isArray_1 = isArray$4;
86
- var Symbol$4 = _Symbol;
87
- var objectProto$b = Object.prototype;
88
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
89
- var nativeObjectToString$1 = objectProto$b.toString;
90
- var symToStringTag$1 = Symbol$4 ? Symbol$4.toStringTag : void 0;
91
- function getRawTag$1(value) {
92
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
93
- try {
94
- value[symToStringTag$1] = void 0;
95
- var unmasked = true;
96
- } catch (e) {
97
- }
98
- var result = nativeObjectToString$1.call(value);
99
- if (unmasked) {
100
- if (isOwn) {
101
- value[symToStringTag$1] = tag;
102
- } else {
103
- delete value[symToStringTag$1];
104
- }
105
- }
106
- return result;
107
- }
108
- var _getRawTag = getRawTag$1;
109
- var objectProto$a = Object.prototype;
110
- var nativeObjectToString = objectProto$a.toString;
111
- function objectToString$1(value) {
112
- return nativeObjectToString.call(value);
113
- }
114
- var _objectToString = objectToString$1;
115
- var Symbol$3 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
116
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
117
- var symToStringTag = Symbol$3 ? Symbol$3.toStringTag : void 0;
118
- function baseGetTag$5(value) {
119
- if (value == null) {
120
- return value === void 0 ? undefinedTag : nullTag;
121
- }
122
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
123
- }
124
- var _baseGetTag = baseGetTag$5;
125
- function isObjectLike$5(value) {
126
- return value != null && typeof value == "object";
127
- }
128
- var isObjectLike_1 = isObjectLike$5;
129
- var baseGetTag$4 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
130
- var symbolTag$1 = "[object Symbol]";
131
- function isSymbol$2(value) {
132
- return typeof value == "symbol" || isObjectLike$4(value) && baseGetTag$4(value) == symbolTag$1;
133
- }
134
- var isSymbol_1 = isSymbol$2;
135
- var Symbol$2 = _Symbol, arrayMap = _arrayMap, isArray$3 = isArray_1, isSymbol$1 = isSymbol_1;
136
- var INFINITY$1 = 1 / 0;
137
- var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
138
- function baseToString$1(value) {
139
- if (typeof value == "string") {
140
- return value;
141
- }
142
- if (isArray$3(value)) {
143
- return arrayMap(value, baseToString$1) + "";
144
- }
145
- if (isSymbol$1(value)) {
146
- return symbolToString ? symbolToString.call(value) : "";
147
- }
148
- var result = value + "";
149
- return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
150
- }
151
- var _baseToString = baseToString$1;
152
- var baseToString = _baseToString;
153
- function toString$2(value) {
154
- return value == null ? "" : baseToString(value);
155
- }
156
- var toString_1 = toString$2;
157
- var toString$1 = toString_1;
158
- var idCounter = 0;
159
- function uniqueId(prefix) {
160
- var id = ++idCounter;
161
- return toString$1(prefix) + id;
162
- }
163
- var uniqueId_1 = uniqueId;
164
- const uniqueId$1 = /* @__PURE__ */ getDefaultExportFromCjs(uniqueId_1);
165
72
  function createSafeFrame({
166
73
  renderFile,
167
74
  context
@@ -182,7 +89,7 @@ function createSafeFrame({
182
89
  const html = ad.ext === "js" && ad.body ? ad.body : ad.tag;
183
90
  if (typeof html !== "string")
184
91
  throw new Error("Ad tag is not a string");
185
- const elementId = element.id || `ad-${ad.id}-${uniqueId$1()}`;
92
+ const elementId = element.id || `ad-${ad.id}-${uniqueId()}`;
186
93
  element.id = elementId;
187
94
  const position = new safeFrame.host.Position({
188
95
  id: elementId,
@@ -283,10 +190,10 @@ function createSlotManager({
283
190
  var _a;
284
191
  const slot = createSlot({
285
192
  ...options,
286
- onDispose,
193
+ onDispose: onDispose2,
287
194
  context
288
195
  });
289
- function onDispose() {
196
+ function onDispose2() {
290
197
  var _a2;
291
198
  slots.delete(slot.name.value);
292
199
  logger.debug("Slot removed", {
@@ -347,141 +254,6 @@ function onTcfConsentChange(callback) {
347
254
  return (_a2 = window.__tcfapi) == null ? void 0 : _a2.call(window, "removeEventListener", 2, callback);
348
255
  };
349
256
  }
350
- function isObject$5(value) {
351
- var type = typeof value;
352
- return value != null && (type == "object" || type == "function");
353
- }
354
- var isObject_1 = isObject$5;
355
- var root$8 = _root;
356
- var now$1 = function() {
357
- return root$8.Date.now();
358
- };
359
- var now_1 = now$1;
360
- var reWhitespace = /\s/;
361
- function trimmedEndIndex$1(string2) {
362
- var index = string2.length;
363
- while (index-- && reWhitespace.test(string2.charAt(index))) {
364
- }
365
- return index;
366
- }
367
- var _trimmedEndIndex = trimmedEndIndex$1;
368
- var trimmedEndIndex = _trimmedEndIndex;
369
- var reTrimStart = /^\s+/;
370
- function baseTrim$1(string2) {
371
- return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
372
- }
373
- var _baseTrim = baseTrim$1;
374
- var baseTrim = _baseTrim, isObject$4 = isObject_1, isSymbol = isSymbol_1;
375
- var NAN = 0 / 0;
376
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
377
- var reIsBinary = /^0b[01]+$/i;
378
- var reIsOctal = /^0o[0-7]+$/i;
379
- var freeParseInt = parseInt;
380
- function toNumber$3(value) {
381
- if (typeof value == "number") {
382
- return value;
383
- }
384
- if (isSymbol(value)) {
385
- return NAN;
386
- }
387
- if (isObject$4(value)) {
388
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
389
- value = isObject$4(other) ? other + "" : other;
390
- }
391
- if (typeof value != "string") {
392
- return value === 0 ? value : +value;
393
- }
394
- value = baseTrim(value);
395
- var isBinary = reIsBinary.test(value);
396
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
397
- }
398
- var toNumber_1 = toNumber$3;
399
- var isObject$3 = isObject_1, now = now_1, toNumber$2 = toNumber_1;
400
- var FUNC_ERROR_TEXT = "Expected a function";
401
- var nativeMax = Math.max, nativeMin$2 = Math.min;
402
- function debounce(func, wait, options) {
403
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
404
- if (typeof func != "function") {
405
- throw new TypeError(FUNC_ERROR_TEXT);
406
- }
407
- wait = toNumber$2(wait) || 0;
408
- if (isObject$3(options)) {
409
- leading = !!options.leading;
410
- maxing = "maxWait" in options;
411
- maxWait = maxing ? nativeMax(toNumber$2(options.maxWait) || 0, wait) : maxWait;
412
- trailing = "trailing" in options ? !!options.trailing : trailing;
413
- }
414
- function invokeFunc(time) {
415
- var args = lastArgs, thisArg = lastThis;
416
- lastArgs = lastThis = void 0;
417
- lastInvokeTime = time;
418
- result = func.apply(thisArg, args);
419
- return result;
420
- }
421
- function leadingEdge(time) {
422
- lastInvokeTime = time;
423
- timerId = setTimeout(timerExpired, wait);
424
- return leading ? invokeFunc(time) : result;
425
- }
426
- function remainingWait(time) {
427
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
428
- return maxing ? nativeMin$2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
429
- }
430
- function shouldInvoke(time) {
431
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
432
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
433
- }
434
- function timerExpired() {
435
- var time = now();
436
- if (shouldInvoke(time)) {
437
- return trailingEdge(time);
438
- }
439
- timerId = setTimeout(timerExpired, remainingWait(time));
440
- }
441
- function trailingEdge(time) {
442
- timerId = void 0;
443
- if (trailing && lastArgs) {
444
- return invokeFunc(time);
445
- }
446
- lastArgs = lastThis = void 0;
447
- return result;
448
- }
449
- function cancel() {
450
- if (timerId !== void 0) {
451
- clearTimeout(timerId);
452
- }
453
- lastInvokeTime = 0;
454
- lastArgs = lastCallTime = lastThis = timerId = void 0;
455
- }
456
- function flush() {
457
- return timerId === void 0 ? result : trailingEdge(now());
458
- }
459
- function debounced() {
460
- var time = now(), isInvoking = shouldInvoke(time);
461
- lastArgs = arguments;
462
- lastThis = this;
463
- lastCallTime = time;
464
- if (isInvoking) {
465
- if (timerId === void 0) {
466
- return leadingEdge(lastCallTime);
467
- }
468
- if (maxing) {
469
- clearTimeout(timerId);
470
- timerId = setTimeout(timerExpired, wait);
471
- return invokeFunc(lastCallTime);
472
- }
473
- }
474
- if (timerId === void 0) {
475
- timerId = setTimeout(timerExpired, wait);
476
- }
477
- return result;
478
- }
479
- debounced.cancel = cancel;
480
- debounced.flush = flush;
481
- return debounced;
482
- }
483
- var debounce_1 = debounce;
484
- const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounce_1);
485
257
  function createQueryDetector({
486
258
  onChange,
487
259
  queries = {
@@ -500,17 +272,19 @@ function createQueryDetector({
500
272
  }
501
273
  return "unknown";
502
274
  }
503
- const handleOnChange = debounce$1(() => {
275
+ const handleOnChange = debounce(() => {
504
276
  void (onChange == null ? void 0 : onChange(getQuery()));
505
277
  logger.debug(`Change device ${getQuery()}`);
506
- }, 50);
278
+ }, {
279
+ waitMs: 50
280
+ });
507
281
  if (onChange) {
508
282
  for (const query of mediaMap.values())
509
- query.addEventListener("change", handleOnChange);
283
+ query.addEventListener("change", handleOnChange.call);
510
284
  }
511
285
  function dispose() {
512
286
  for (const query of mediaMap.values())
513
- query.removeEventListener("change", handleOnChange);
287
+ query.removeEventListener("change", handleOnChange.call);
514
288
  }
515
289
  return {
516
290
  queries: mediaMap,
@@ -518,110 +292,6 @@ function createQueryDetector({
518
292
  dispose
519
293
  };
520
294
  }
521
- var nativeFloor = Math.floor, nativeRandom$1 = Math.random;
522
- function baseRandom$1(lower, upper) {
523
- return lower + nativeFloor(nativeRandom$1() * (upper - lower + 1));
524
- }
525
- var _baseRandom = baseRandom$1;
526
- function eq$3(value, other) {
527
- return value === other || value !== value && other !== other;
528
- }
529
- var eq_1 = eq$3;
530
- var baseGetTag$3 = _baseGetTag, isObject$2 = isObject_1;
531
- var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
532
- function isFunction$2(value) {
533
- if (!isObject$2(value)) {
534
- return false;
535
- }
536
- var tag = baseGetTag$3(value);
537
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
538
- }
539
- var isFunction_1 = isFunction$2;
540
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
541
- function isLength$2(value) {
542
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
543
- }
544
- var isLength_1 = isLength$2;
545
- var isFunction$1 = isFunction_1, isLength$1 = isLength_1;
546
- function isArrayLike$2(value) {
547
- return value != null && isLength$1(value.length) && !isFunction$1(value);
548
- }
549
- var isArrayLike_1 = isArrayLike$2;
550
- var MAX_SAFE_INTEGER = 9007199254740991;
551
- var reIsUint = /^(?:0|[1-9]\d*)$/;
552
- function isIndex$2(value, length) {
553
- var type = typeof value;
554
- length = length == null ? MAX_SAFE_INTEGER : length;
555
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
556
- }
557
- var _isIndex = isIndex$2;
558
- var eq$2 = eq_1, isArrayLike$1 = isArrayLike_1, isIndex$1 = _isIndex, isObject$1 = isObject_1;
559
- function isIterateeCall$1(value, index, object2) {
560
- if (!isObject$1(object2)) {
561
- return false;
562
- }
563
- var type = typeof index;
564
- if (type == "number" ? isArrayLike$1(object2) && isIndex$1(index, object2.length) : type == "string" && index in object2) {
565
- return eq$2(object2[index], value);
566
- }
567
- return false;
568
- }
569
- var _isIterateeCall = isIterateeCall$1;
570
- var toNumber$1 = toNumber_1;
571
- var INFINITY = 1 / 0, MAX_INTEGER = 17976931348623157e292;
572
- function toFinite$2(value) {
573
- if (!value) {
574
- return value === 0 ? value : 0;
575
- }
576
- value = toNumber$1(value);
577
- if (value === INFINITY || value === -INFINITY) {
578
- var sign = value < 0 ? -1 : 1;
579
- return sign * MAX_INTEGER;
580
- }
581
- return value === value ? value : 0;
582
- }
583
- var toFinite_1 = toFinite$2;
584
- var baseRandom = _baseRandom, isIterateeCall = _isIterateeCall, toFinite$1 = toFinite_1;
585
- var freeParseFloat = parseFloat;
586
- var nativeMin$1 = Math.min, nativeRandom = Math.random;
587
- function random(lower, upper, floating) {
588
- if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
589
- upper = floating = void 0;
590
- }
591
- if (floating === void 0) {
592
- if (typeof upper == "boolean") {
593
- floating = upper;
594
- upper = void 0;
595
- } else if (typeof lower == "boolean") {
596
- floating = lower;
597
- lower = void 0;
598
- }
599
- }
600
- if (lower === void 0 && upper === void 0) {
601
- lower = 0;
602
- upper = 1;
603
- } else {
604
- lower = toFinite$1(lower);
605
- if (upper === void 0) {
606
- upper = lower;
607
- lower = 0;
608
- } else {
609
- upper = toFinite$1(upper);
610
- }
611
- }
612
- if (lower > upper) {
613
- var temp = lower;
614
- lower = upper;
615
- upper = temp;
616
- }
617
- if (floating || lower % 1 || upper % 1) {
618
- var rand = nativeRandom();
619
- return nativeMin$1(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
620
- }
621
- return baseRandom(lower, upper);
622
- }
623
- var random_1 = random;
624
- const random$1 = /* @__PURE__ */ getDefaultExportFromCjs(random_1);
625
295
  const defaultLogLevels = ["trace", "debug", "info", "warn", "error"];
626
296
  function createLogger({
627
297
  scope,
@@ -639,7 +309,7 @@ function createLogger({
639
309
  message,
640
310
  attributes,
641
311
  timestamp: Date.now(),
642
- id: uniqueId$1()
312
+ id: uniqueId()
643
313
  });
644
314
  events.log.dispatch({
645
315
  scope,
@@ -647,7 +317,7 @@ function createLogger({
647
317
  message,
648
318
  attributes,
649
319
  timestamp: Date.now(),
650
- id: uniqueId$1()
320
+ id: uniqueId()
651
321
  });
652
322
  if (index >= logLevels.indexOf(currentMinLogLevelThreshold)) {
653
323
  if (["warn", "error", "trace"].includes(level)) {
@@ -706,7 +376,7 @@ function createParameters(options, queryDetector) {
706
376
  tl: options.consent ? "all" : "none",
707
377
  dt: queryDetector.getQuery(),
708
378
  br: queryDetector.getQuery(),
709
- rn: random$1(1e4).toString()
379
+ rn: Math.round(Math.random() * 1e4).toString()
710
380
  }))
711
381
  parameters.set(key, value);
712
382
  return parameters;
@@ -725,7 +395,8 @@ function isPreviewMode() {
725
395
  }
726
396
  function createHook({
727
397
  onRun,
728
- onAdd
398
+ onAdd,
399
+ onDispose: onDispose2
729
400
  }) {
730
401
  const callbacks = /* @__PURE__ */ new Set();
731
402
  function run() {
@@ -737,7 +408,11 @@ function createHook({
737
408
  callbacks.add(callback);
738
409
  onAdd == null ? void 0 : onAdd(callbacks);
739
410
  }
740
- return [run, add];
411
+ function dispose() {
412
+ onDispose2 == null ? void 0 : onDispose2(callbacks);
413
+ callbacks.clear();
414
+ }
415
+ return [run, add, dispose];
741
416
  }
742
417
  let resolveOnInitPromise = () => {
743
418
  };
@@ -745,7 +420,7 @@ let isInit = false;
745
420
  const waitOnInit = new Promise((resolve) => {
746
421
  resolveOnInitPromise = resolve;
747
422
  });
748
- const [runOnInit, onInit] = createHook({
423
+ const [runOnInit, onInit, disposeOnInit] = createHook({
749
424
  onRun(callbacks) {
750
425
  isInit = true;
751
426
  resolveOnInitPromise();
@@ -757,6 +432,24 @@ const [runOnInit, onInit] = createHook({
757
432
  runOnInit();
758
433
  }
759
434
  });
435
+ let resolveOnDisposePromise = () => {
436
+ };
437
+ let isDisposed = false;
438
+ new Promise((resolve) => {
439
+ resolveOnDisposePromise = resolve;
440
+ });
441
+ const [runOnDispose, onDispose, disposeOnDispose] = createHook({
442
+ onRun(callbacks) {
443
+ isDisposed = true;
444
+ resolveOnDisposePromise();
445
+ logger.debug("Disposal completed");
446
+ callbacks.clear();
447
+ },
448
+ onAdd() {
449
+ if (isDisposed)
450
+ runOnDispose();
451
+ }
452
+ });
760
453
  function createAdhese(options) {
761
454
  const scope = effectScope();
762
455
  return scope.run(() => {
@@ -774,6 +467,7 @@ function createAdhese(options) {
774
467
  safeFrame: false,
775
468
  eagerRendering: false,
776
469
  viewabilityTracking: true,
470
+ plugins: [],
777
471
  ...options
778
472
  };
779
473
  setupLogging(mergedOptions);
@@ -870,19 +564,15 @@ function createAdhese(options) {
870
564
  }
871
565
  return domSlots;
872
566
  }
873
- let unmountDevtools;
874
567
  async function toggleDebug() {
875
568
  var _a, _b;
876
569
  context.debug = !context.debug;
877
- if (context.debug && !unmountDevtools) {
878
- unmountDevtools = await createDevtools(context);
570
+ if (context.debug) {
879
571
  logger.setMinLogLevelThreshold("debug");
880
572
  logger.debug("Debug mode enabled");
881
573
  (_a = context.events) == null ? void 0 : _a.debugChange.dispatch(true);
882
574
  } else {
883
575
  logger.debug("Debug mode disabled");
884
- unmountDevtools == null ? void 0 : unmountDevtools();
885
- unmountDevtools = void 0;
886
576
  logger.setMinLogLevelThreshold("info");
887
577
  (_b = context.events) == null ? void 0 : _b.debugChange.dispatch(false);
888
578
  }
@@ -915,7 +605,6 @@ function createAdhese(options) {
915
605
  });
916
606
  function dispose() {
917
607
  var _a, _b;
918
- unmountDevtools == null ? void 0 : unmountDevtools();
919
608
  queryDetector.dispose();
920
609
  slotManager.dispose();
921
610
  queryDetector.dispose();
@@ -924,18 +613,21 @@ function createAdhese(options) {
924
613
  logger.resetLogs();
925
614
  (_b = context.events) == null ? void 0 : _b.dispose();
926
615
  logger.info("Adhese instance disposed");
616
+ runOnDispose();
617
+ disposeOnInit();
618
+ disposeOnDispose();
927
619
  scope.stop();
928
620
  }
621
+ for (const plugin of mergedOptions.plugins)
622
+ plugin(context);
929
623
  onInit(async () => {
930
624
  var _a;
931
625
  if ((slotManager.getAll().length ?? 0) > 0)
932
626
  await fetchAndRenderAllSlots().catch(logger.error);
933
627
  if (mergedOptions.findDomSlotsOnLoad)
934
628
  await findDomSlots2();
935
- if (mergedOptions.debug || window.location.search.includes("adhese_debug=true") || isPreviewMode()) {
936
- unmountDevtools = await createDevtools(context);
629
+ if (mergedOptions.debug || window.location.search.includes("adhese_debug=true") || isPreviewMode())
937
630
  (_a = context.events) == null ? void 0 : _a.debugChange.dispatch(true);
938
- }
939
631
  if (!scope.active)
940
632
  dispose();
941
633
  });
@@ -957,780 +649,6 @@ function createAdhese(options) {
957
649
  };
958
650
  });
959
651
  }
960
- function listCacheClear$1() {
961
- this.__data__ = [];
962
- this.size = 0;
963
- }
964
- var _listCacheClear = listCacheClear$1;
965
- var eq$1 = eq_1;
966
- function assocIndexOf$4(array, key) {
967
- var length = array.length;
968
- while (length--) {
969
- if (eq$1(array[length][0], key)) {
970
- return length;
971
- }
972
- }
973
- return -1;
974
- }
975
- var _assocIndexOf = assocIndexOf$4;
976
- var assocIndexOf$3 = _assocIndexOf;
977
- var arrayProto = Array.prototype;
978
- var splice = arrayProto.splice;
979
- function listCacheDelete$1(key) {
980
- var data = this.__data__, index = assocIndexOf$3(data, key);
981
- if (index < 0) {
982
- return false;
983
- }
984
- var lastIndex = data.length - 1;
985
- if (index == lastIndex) {
986
- data.pop();
987
- } else {
988
- splice.call(data, index, 1);
989
- }
990
- --this.size;
991
- return true;
992
- }
993
- var _listCacheDelete = listCacheDelete$1;
994
- var assocIndexOf$2 = _assocIndexOf;
995
- function listCacheGet$1(key) {
996
- var data = this.__data__, index = assocIndexOf$2(data, key);
997
- return index < 0 ? void 0 : data[index][1];
998
- }
999
- var _listCacheGet = listCacheGet$1;
1000
- var assocIndexOf$1 = _assocIndexOf;
1001
- function listCacheHas$1(key) {
1002
- return assocIndexOf$1(this.__data__, key) > -1;
1003
- }
1004
- var _listCacheHas = listCacheHas$1;
1005
- var assocIndexOf = _assocIndexOf;
1006
- function listCacheSet$1(key, value) {
1007
- var data = this.__data__, index = assocIndexOf(data, key);
1008
- if (index < 0) {
1009
- ++this.size;
1010
- data.push([key, value]);
1011
- } else {
1012
- data[index][1] = value;
1013
- }
1014
- return this;
1015
- }
1016
- var _listCacheSet = listCacheSet$1;
1017
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
1018
- function ListCache$4(entries) {
1019
- var index = -1, length = entries == null ? 0 : entries.length;
1020
- this.clear();
1021
- while (++index < length) {
1022
- var entry = entries[index];
1023
- this.set(entry[0], entry[1]);
1024
- }
1025
- }
1026
- ListCache$4.prototype.clear = listCacheClear;
1027
- ListCache$4.prototype["delete"] = listCacheDelete;
1028
- ListCache$4.prototype.get = listCacheGet;
1029
- ListCache$4.prototype.has = listCacheHas;
1030
- ListCache$4.prototype.set = listCacheSet;
1031
- var _ListCache = ListCache$4;
1032
- var ListCache$3 = _ListCache;
1033
- function stackClear$1() {
1034
- this.__data__ = new ListCache$3();
1035
- this.size = 0;
1036
- }
1037
- var _stackClear = stackClear$1;
1038
- function stackDelete$1(key) {
1039
- var data = this.__data__, result = data["delete"](key);
1040
- this.size = data.size;
1041
- return result;
1042
- }
1043
- var _stackDelete = stackDelete$1;
1044
- function stackGet$1(key) {
1045
- return this.__data__.get(key);
1046
- }
1047
- var _stackGet = stackGet$1;
1048
- function stackHas$1(key) {
1049
- return this.__data__.has(key);
1050
- }
1051
- var _stackHas = stackHas$1;
1052
- var root$7 = _root;
1053
- var coreJsData$1 = root$7["__core-js_shared__"];
1054
- var _coreJsData = coreJsData$1;
1055
- var coreJsData = _coreJsData;
1056
- var maskSrcKey = function() {
1057
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
1058
- return uid ? "Symbol(src)_1." + uid : "";
1059
- }();
1060
- function isMasked$1(func) {
1061
- return !!maskSrcKey && maskSrcKey in func;
1062
- }
1063
- var _isMasked = isMasked$1;
1064
- var funcProto$1 = Function.prototype;
1065
- var funcToString$1 = funcProto$1.toString;
1066
- function toSource$2(func) {
1067
- if (func != null) {
1068
- try {
1069
- return funcToString$1.call(func);
1070
- } catch (e) {
1071
- }
1072
- try {
1073
- return func + "";
1074
- } catch (e) {
1075
- }
1076
- }
1077
- return "";
1078
- }
1079
- var _toSource = toSource$2;
1080
- var isFunction = isFunction_1, isMasked = _isMasked, isObject = isObject_1, toSource$1 = _toSource;
1081
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1082
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
1083
- var funcProto = Function.prototype, objectProto$9 = Object.prototype;
1084
- var funcToString = funcProto.toString;
1085
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1086
- var reIsNative = RegExp(
1087
- "^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1088
- );
1089
- function baseIsNative$1(value) {
1090
- if (!isObject(value) || isMasked(value)) {
1091
- return false;
1092
- }
1093
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1094
- return pattern.test(toSource$1(value));
1095
- }
1096
- var _baseIsNative = baseIsNative$1;
1097
- function getValue$1(object2, key) {
1098
- return object2 == null ? void 0 : object2[key];
1099
- }
1100
- var _getValue = getValue$1;
1101
- var baseIsNative = _baseIsNative, getValue = _getValue;
1102
- function getNative$6(object2, key) {
1103
- var value = getValue(object2, key);
1104
- return baseIsNative(value) ? value : void 0;
1105
- }
1106
- var _getNative = getNative$6;
1107
- var getNative$5 = _getNative, root$6 = _root;
1108
- var Map$4 = getNative$5(root$6, "Map");
1109
- var _Map = Map$4;
1110
- var getNative$4 = _getNative;
1111
- var nativeCreate$4 = getNative$4(Object, "create");
1112
- var _nativeCreate = nativeCreate$4;
1113
- var nativeCreate$3 = _nativeCreate;
1114
- function hashClear$1() {
1115
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
1116
- this.size = 0;
1117
- }
1118
- var _hashClear = hashClear$1;
1119
- function hashDelete$1(key) {
1120
- var result = this.has(key) && delete this.__data__[key];
1121
- this.size -= result ? 1 : 0;
1122
- return result;
1123
- }
1124
- var _hashDelete = hashDelete$1;
1125
- var nativeCreate$2 = _nativeCreate;
1126
- var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
1127
- var objectProto$8 = Object.prototype;
1128
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1129
- function hashGet$1(key) {
1130
- var data = this.__data__;
1131
- if (nativeCreate$2) {
1132
- var result = data[key];
1133
- return result === HASH_UNDEFINED$2 ? void 0 : result;
1134
- }
1135
- return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
1136
- }
1137
- var _hashGet = hashGet$1;
1138
- var nativeCreate$1 = _nativeCreate;
1139
- var objectProto$7 = Object.prototype;
1140
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1141
- function hashHas$1(key) {
1142
- var data = this.__data__;
1143
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
1144
- }
1145
- var _hashHas = hashHas$1;
1146
- var nativeCreate = _nativeCreate;
1147
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
1148
- function hashSet$1(key, value) {
1149
- var data = this.__data__;
1150
- this.size += this.has(key) ? 0 : 1;
1151
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
1152
- return this;
1153
- }
1154
- var _hashSet = hashSet$1;
1155
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
1156
- function Hash$1(entries) {
1157
- var index = -1, length = entries == null ? 0 : entries.length;
1158
- this.clear();
1159
- while (++index < length) {
1160
- var entry = entries[index];
1161
- this.set(entry[0], entry[1]);
1162
- }
1163
- }
1164
- Hash$1.prototype.clear = hashClear;
1165
- Hash$1.prototype["delete"] = hashDelete;
1166
- Hash$1.prototype.get = hashGet;
1167
- Hash$1.prototype.has = hashHas;
1168
- Hash$1.prototype.set = hashSet;
1169
- var _Hash = Hash$1;
1170
- var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
1171
- function mapCacheClear$1() {
1172
- this.size = 0;
1173
- this.__data__ = {
1174
- "hash": new Hash(),
1175
- "map": new (Map$3 || ListCache$2)(),
1176
- "string": new Hash()
1177
- };
1178
- }
1179
- var _mapCacheClear = mapCacheClear$1;
1180
- function isKeyable$1(value) {
1181
- var type = typeof value;
1182
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1183
- }
1184
- var _isKeyable = isKeyable$1;
1185
- var isKeyable = _isKeyable;
1186
- function getMapData$4(map, key) {
1187
- var data = map.__data__;
1188
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1189
- }
1190
- var _getMapData = getMapData$4;
1191
- var getMapData$3 = _getMapData;
1192
- function mapCacheDelete$1(key) {
1193
- var result = getMapData$3(this, key)["delete"](key);
1194
- this.size -= result ? 1 : 0;
1195
- return result;
1196
- }
1197
- var _mapCacheDelete = mapCacheDelete$1;
1198
- var getMapData$2 = _getMapData;
1199
- function mapCacheGet$1(key) {
1200
- return getMapData$2(this, key).get(key);
1201
- }
1202
- var _mapCacheGet = mapCacheGet$1;
1203
- var getMapData$1 = _getMapData;
1204
- function mapCacheHas$1(key) {
1205
- return getMapData$1(this, key).has(key);
1206
- }
1207
- var _mapCacheHas = mapCacheHas$1;
1208
- var getMapData = _getMapData;
1209
- function mapCacheSet$1(key, value) {
1210
- var data = getMapData(this, key), size = data.size;
1211
- data.set(key, value);
1212
- this.size += data.size == size ? 0 : 1;
1213
- return this;
1214
- }
1215
- var _mapCacheSet = mapCacheSet$1;
1216
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
1217
- function MapCache$2(entries) {
1218
- var index = -1, length = entries == null ? 0 : entries.length;
1219
- this.clear();
1220
- while (++index < length) {
1221
- var entry = entries[index];
1222
- this.set(entry[0], entry[1]);
1223
- }
1224
- }
1225
- MapCache$2.prototype.clear = mapCacheClear;
1226
- MapCache$2.prototype["delete"] = mapCacheDelete;
1227
- MapCache$2.prototype.get = mapCacheGet;
1228
- MapCache$2.prototype.has = mapCacheHas;
1229
- MapCache$2.prototype.set = mapCacheSet;
1230
- var _MapCache = MapCache$2;
1231
- var ListCache$1 = _ListCache, Map$2 = _Map, MapCache$1 = _MapCache;
1232
- var LARGE_ARRAY_SIZE = 200;
1233
- function stackSet$1(key, value) {
1234
- var data = this.__data__;
1235
- if (data instanceof ListCache$1) {
1236
- var pairs = data.__data__;
1237
- if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1238
- pairs.push([key, value]);
1239
- this.size = ++data.size;
1240
- return this;
1241
- }
1242
- data = this.__data__ = new MapCache$1(pairs);
1243
- }
1244
- data.set(key, value);
1245
- this.size = data.size;
1246
- return this;
1247
- }
1248
- var _stackSet = stackSet$1;
1249
- var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
1250
- function Stack$1(entries) {
1251
- var data = this.__data__ = new ListCache(entries);
1252
- this.size = data.size;
1253
- }
1254
- Stack$1.prototype.clear = stackClear;
1255
- Stack$1.prototype["delete"] = stackDelete;
1256
- Stack$1.prototype.get = stackGet;
1257
- Stack$1.prototype.has = stackHas;
1258
- Stack$1.prototype.set = stackSet;
1259
- var _Stack = Stack$1;
1260
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
1261
- function setCacheAdd$1(value) {
1262
- this.__data__.set(value, HASH_UNDEFINED);
1263
- return this;
1264
- }
1265
- var _setCacheAdd = setCacheAdd$1;
1266
- function setCacheHas$1(value) {
1267
- return this.__data__.has(value);
1268
- }
1269
- var _setCacheHas = setCacheHas$1;
1270
- var MapCache = _MapCache, setCacheAdd = _setCacheAdd, setCacheHas = _setCacheHas;
1271
- function SetCache$1(values) {
1272
- var index = -1, length = values == null ? 0 : values.length;
1273
- this.__data__ = new MapCache();
1274
- while (++index < length) {
1275
- this.add(values[index]);
1276
- }
1277
- }
1278
- SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
1279
- SetCache$1.prototype.has = setCacheHas;
1280
- var _SetCache = SetCache$1;
1281
- function arraySome$1(array, predicate) {
1282
- var index = -1, length = array == null ? 0 : array.length;
1283
- while (++index < length) {
1284
- if (predicate(array[index], index, array)) {
1285
- return true;
1286
- }
1287
- }
1288
- return false;
1289
- }
1290
- var _arraySome = arraySome$1;
1291
- function cacheHas$1(cache, key) {
1292
- return cache.has(key);
1293
- }
1294
- var _cacheHas = cacheHas$1;
1295
- var SetCache = _SetCache, arraySome = _arraySome, cacheHas = _cacheHas;
1296
- var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
1297
- function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
1298
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
1299
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1300
- return false;
1301
- }
1302
- var arrStacked = stack.get(array);
1303
- var othStacked = stack.get(other);
1304
- if (arrStacked && othStacked) {
1305
- return arrStacked == other && othStacked == array;
1306
- }
1307
- var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
1308
- stack.set(array, other);
1309
- stack.set(other, array);
1310
- while (++index < arrLength) {
1311
- var arrValue = array[index], othValue = other[index];
1312
- if (customizer) {
1313
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
1314
- }
1315
- if (compared !== void 0) {
1316
- if (compared) {
1317
- continue;
1318
- }
1319
- result = false;
1320
- break;
1321
- }
1322
- if (seen) {
1323
- if (!arraySome(other, function(othValue2, othIndex) {
1324
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
1325
- return seen.push(othIndex);
1326
- }
1327
- })) {
1328
- result = false;
1329
- break;
1330
- }
1331
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1332
- result = false;
1333
- break;
1334
- }
1335
- }
1336
- stack["delete"](array);
1337
- stack["delete"](other);
1338
- return result;
1339
- }
1340
- var _equalArrays = equalArrays$2;
1341
- var root$5 = _root;
1342
- var Uint8Array$1 = root$5.Uint8Array;
1343
- var _Uint8Array = Uint8Array$1;
1344
- function mapToArray$1(map) {
1345
- var index = -1, result = Array(map.size);
1346
- map.forEach(function(value, key) {
1347
- result[++index] = [key, value];
1348
- });
1349
- return result;
1350
- }
1351
- var _mapToArray = mapToArray$1;
1352
- function setToArray$1(set) {
1353
- var index = -1, result = Array(set.size);
1354
- set.forEach(function(value) {
1355
- result[++index] = value;
1356
- });
1357
- return result;
1358
- }
1359
- var _setToArray = setToArray$1;
1360
- var Symbol$1 = _Symbol, Uint8Array = _Uint8Array, eq = eq_1, equalArrays$1 = _equalArrays, mapToArray = _mapToArray, setToArray = _setToArray;
1361
- var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
1362
- var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag = "[object Symbol]";
1363
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]";
1364
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1365
- function equalByTag$1(object2, other, tag, bitmask, customizer, equalFunc, stack) {
1366
- switch (tag) {
1367
- case dataViewTag$2:
1368
- if (object2.byteLength != other.byteLength || object2.byteOffset != other.byteOffset) {
1369
- return false;
1370
- }
1371
- object2 = object2.buffer;
1372
- other = other.buffer;
1373
- case arrayBufferTag$1:
1374
- if (object2.byteLength != other.byteLength || !equalFunc(new Uint8Array(object2), new Uint8Array(other))) {
1375
- return false;
1376
- }
1377
- return true;
1378
- case boolTag$1:
1379
- case dateTag$1:
1380
- case numberTag$1:
1381
- return eq(+object2, +other);
1382
- case errorTag$1:
1383
- return object2.name == other.name && object2.message == other.message;
1384
- case regexpTag$1:
1385
- case stringTag$1:
1386
- return object2 == other + "";
1387
- case mapTag$2:
1388
- var convert = mapToArray;
1389
- case setTag$2:
1390
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1391
- convert || (convert = setToArray);
1392
- if (object2.size != other.size && !isPartial) {
1393
- return false;
1394
- }
1395
- var stacked = stack.get(object2);
1396
- if (stacked) {
1397
- return stacked == other;
1398
- }
1399
- bitmask |= COMPARE_UNORDERED_FLAG;
1400
- stack.set(object2, other);
1401
- var result = equalArrays$1(convert(object2), convert(other), bitmask, customizer, equalFunc, stack);
1402
- stack["delete"](object2);
1403
- return result;
1404
- case symbolTag:
1405
- if (symbolValueOf) {
1406
- return symbolValueOf.call(object2) == symbolValueOf.call(other);
1407
- }
1408
- }
1409
- return false;
1410
- }
1411
- var _equalByTag = equalByTag$1;
1412
- function arrayPush$1(array, values) {
1413
- var index = -1, length = values.length, offset = array.length;
1414
- while (++index < length) {
1415
- array[offset + index] = values[index];
1416
- }
1417
- return array;
1418
- }
1419
- var _arrayPush = arrayPush$1;
1420
- var arrayPush = _arrayPush, isArray$2 = isArray_1;
1421
- function baseGetAllKeys$1(object2, keysFunc, symbolsFunc) {
1422
- var result = keysFunc(object2);
1423
- return isArray$2(object2) ? result : arrayPush(result, symbolsFunc(object2));
1424
- }
1425
- var _baseGetAllKeys = baseGetAllKeys$1;
1426
- function arrayFilter$1(array, predicate) {
1427
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
1428
- while (++index < length) {
1429
- var value = array[index];
1430
- if (predicate(value, index, array)) {
1431
- result[resIndex++] = value;
1432
- }
1433
- }
1434
- return result;
1435
- }
1436
- var _arrayFilter = arrayFilter$1;
1437
- function stubArray$1() {
1438
- return [];
1439
- }
1440
- var stubArray_1 = stubArray$1;
1441
- var arrayFilter = _arrayFilter, stubArray = stubArray_1;
1442
- var objectProto$6 = Object.prototype;
1443
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1444
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1445
- var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object2) {
1446
- if (object2 == null) {
1447
- return [];
1448
- }
1449
- object2 = Object(object2);
1450
- return arrayFilter(nativeGetSymbols(object2), function(symbol) {
1451
- return propertyIsEnumerable$1.call(object2, symbol);
1452
- });
1453
- };
1454
- var _getSymbols = getSymbols$1;
1455
- function baseTimes$1(n, iteratee) {
1456
- var index = -1, result = Array(n);
1457
- while (++index < n) {
1458
- result[index] = iteratee(index);
1459
- }
1460
- return result;
1461
- }
1462
- var _baseTimes = baseTimes$1;
1463
- var baseGetTag$2 = _baseGetTag, isObjectLike$3 = isObjectLike_1;
1464
- var argsTag$2 = "[object Arguments]";
1465
- function baseIsArguments$1(value) {
1466
- return isObjectLike$3(value) && baseGetTag$2(value) == argsTag$2;
1467
- }
1468
- var _baseIsArguments = baseIsArguments$1;
1469
- var baseIsArguments = _baseIsArguments, isObjectLike$2 = isObjectLike_1;
1470
- var objectProto$5 = Object.prototype;
1471
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1472
- var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1473
- var isArguments$1 = baseIsArguments(/* @__PURE__ */ function() {
1474
- return arguments;
1475
- }()) ? baseIsArguments : function(value) {
1476
- return isObjectLike$2(value) && hasOwnProperty$4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
1477
- };
1478
- var isArguments_1 = isArguments$1;
1479
- var isBuffer$2 = { exports: {} };
1480
- function stubFalse() {
1481
- return false;
1482
- }
1483
- var stubFalse_1 = stubFalse;
1484
- isBuffer$2.exports;
1485
- (function(module, exports) {
1486
- var root2 = _root, stubFalse2 = stubFalse_1;
1487
- var freeExports = exports && !exports.nodeType && exports;
1488
- var freeModule = freeExports && true && module && !module.nodeType && module;
1489
- var moduleExports = freeModule && freeModule.exports === freeExports;
1490
- var Buffer = moduleExports ? root2.Buffer : void 0;
1491
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
1492
- var isBuffer2 = nativeIsBuffer || stubFalse2;
1493
- module.exports = isBuffer2;
1494
- })(isBuffer$2, isBuffer$2.exports);
1495
- var isBufferExports = isBuffer$2.exports;
1496
- var baseGetTag$1 = _baseGetTag, isLength = isLength_1, isObjectLike$1 = isObjectLike_1;
1497
- var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", mapTag$1 = "[object Map]", numberTag = "[object Number]", objectTag$2 = "[object Object]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", weakMapTag$1 = "[object WeakMap]";
1498
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
1499
- var typedArrayTags = {};
1500
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
1501
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] = typedArrayTags[setTag$1] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
1502
- function baseIsTypedArray$1(value) {
1503
- return isObjectLike$1(value) && isLength(value.length) && !!typedArrayTags[baseGetTag$1(value)];
1504
- }
1505
- var _baseIsTypedArray = baseIsTypedArray$1;
1506
- function baseUnary$1(func) {
1507
- return function(value) {
1508
- return func(value);
1509
- };
1510
- }
1511
- var _baseUnary = baseUnary$1;
1512
- var _nodeUtil = { exports: {} };
1513
- _nodeUtil.exports;
1514
- (function(module, exports) {
1515
- var freeGlobal2 = _freeGlobal;
1516
- var freeExports = exports && !exports.nodeType && exports;
1517
- var freeModule = freeExports && true && module && !module.nodeType && module;
1518
- var moduleExports = freeModule && freeModule.exports === freeExports;
1519
- var freeProcess = moduleExports && freeGlobal2.process;
1520
- var nodeUtil2 = function() {
1521
- try {
1522
- var types = freeModule && freeModule.require && freeModule.require("util").types;
1523
- if (types) {
1524
- return types;
1525
- }
1526
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
1527
- } catch (e) {
1528
- }
1529
- }();
1530
- module.exports = nodeUtil2;
1531
- })(_nodeUtil, _nodeUtil.exports);
1532
- var _nodeUtilExports = _nodeUtil.exports;
1533
- var baseIsTypedArray = _baseIsTypedArray, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
1534
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1535
- var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1536
- var isTypedArray_1 = isTypedArray$2;
1537
- var baseTimes = _baseTimes, isArguments = isArguments_1, isArray$1 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray$1 = isTypedArray_1;
1538
- var objectProto$4 = Object.prototype;
1539
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1540
- function arrayLikeKeys$1(value, inherited) {
1541
- var isArr = isArray$1(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
1542
- for (var key in value) {
1543
- if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1544
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1545
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1546
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
1547
- isIndex(key, length)))) {
1548
- result.push(key);
1549
- }
1550
- }
1551
- return result;
1552
- }
1553
- var _arrayLikeKeys = arrayLikeKeys$1;
1554
- var objectProto$3 = Object.prototype;
1555
- function isPrototype$1(value) {
1556
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$3;
1557
- return value === proto;
1558
- }
1559
- var _isPrototype = isPrototype$1;
1560
- function overArg$1(func, transform) {
1561
- return function(arg) {
1562
- return func(transform(arg));
1563
- };
1564
- }
1565
- var _overArg = overArg$1;
1566
- var overArg = _overArg;
1567
- var nativeKeys$1 = overArg(Object.keys, Object);
1568
- var _nativeKeys = nativeKeys$1;
1569
- var isPrototype = _isPrototype, nativeKeys = _nativeKeys;
1570
- var objectProto$2 = Object.prototype;
1571
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1572
- function baseKeys$1(object2) {
1573
- if (!isPrototype(object2)) {
1574
- return nativeKeys(object2);
1575
- }
1576
- var result = [];
1577
- for (var key in Object(object2)) {
1578
- if (hasOwnProperty$2.call(object2, key) && key != "constructor") {
1579
- result.push(key);
1580
- }
1581
- }
1582
- return result;
1583
- }
1584
- var _baseKeys = baseKeys$1;
1585
- var arrayLikeKeys = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike = isArrayLike_1;
1586
- function keys$1(object2) {
1587
- return isArrayLike(object2) ? arrayLikeKeys(object2) : baseKeys(object2);
1588
- }
1589
- var keys_1 = keys$1;
1590
- var baseGetAllKeys = _baseGetAllKeys, getSymbols = _getSymbols, keys = keys_1;
1591
- function getAllKeys$1(object2) {
1592
- return baseGetAllKeys(object2, keys, getSymbols);
1593
- }
1594
- var _getAllKeys = getAllKeys$1;
1595
- var getAllKeys = _getAllKeys;
1596
- var COMPARE_PARTIAL_FLAG$1 = 1;
1597
- var objectProto$1 = Object.prototype;
1598
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1599
- function equalObjects$1(object2, other, bitmask, customizer, equalFunc, stack) {
1600
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object2), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
1601
- if (objLength != othLength && !isPartial) {
1602
- return false;
1603
- }
1604
- var index = objLength;
1605
- while (index--) {
1606
- var key = objProps[index];
1607
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
1608
- return false;
1609
- }
1610
- }
1611
- var objStacked = stack.get(object2);
1612
- var othStacked = stack.get(other);
1613
- if (objStacked && othStacked) {
1614
- return objStacked == other && othStacked == object2;
1615
- }
1616
- var result = true;
1617
- stack.set(object2, other);
1618
- stack.set(other, object2);
1619
- var skipCtor = isPartial;
1620
- while (++index < objLength) {
1621
- key = objProps[index];
1622
- var objValue = object2[key], othValue = other[key];
1623
- if (customizer) {
1624
- var compared = isPartial ? customizer(othValue, objValue, key, other, object2, stack) : customizer(objValue, othValue, key, object2, other, stack);
1625
- }
1626
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
1627
- result = false;
1628
- break;
1629
- }
1630
- skipCtor || (skipCtor = key == "constructor");
1631
- }
1632
- if (result && !skipCtor) {
1633
- var objCtor = object2.constructor, othCtor = other.constructor;
1634
- if (objCtor != othCtor && ("constructor" in object2 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
1635
- result = false;
1636
- }
1637
- }
1638
- stack["delete"](object2);
1639
- stack["delete"](other);
1640
- return result;
1641
- }
1642
- var _equalObjects = equalObjects$1;
1643
- var getNative$3 = _getNative, root$4 = _root;
1644
- var DataView$1 = getNative$3(root$4, "DataView");
1645
- var _DataView = DataView$1;
1646
- var getNative$2 = _getNative, root$3 = _root;
1647
- var Promise$2 = getNative$2(root$3, "Promise");
1648
- var _Promise = Promise$2;
1649
- var getNative$1 = _getNative, root$2 = _root;
1650
- var Set$2 = getNative$1(root$2, "Set");
1651
- var _Set = Set$2;
1652
- var getNative = _getNative, root$1 = _root;
1653
- var WeakMap$1 = getNative(root$1, "WeakMap");
1654
- var _WeakMap = WeakMap$1;
1655
- var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap = _WeakMap, baseGetTag = _baseGetTag, toSource = _toSource;
1656
- var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
1657
- var dataViewTag = "[object DataView]";
1658
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
1659
- var getTag$1 = baseGetTag;
1660
- if (DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag$1(new Map$1()) != mapTag || Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag || Set$1 && getTag$1(new Set$1()) != setTag || WeakMap && getTag$1(new WeakMap()) != weakMapTag) {
1661
- getTag$1 = function(value) {
1662
- var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1663
- if (ctorString) {
1664
- switch (ctorString) {
1665
- case dataViewCtorString:
1666
- return dataViewTag;
1667
- case mapCtorString:
1668
- return mapTag;
1669
- case promiseCtorString:
1670
- return promiseTag;
1671
- case setCtorString:
1672
- return setTag;
1673
- case weakMapCtorString:
1674
- return weakMapTag;
1675
- }
1676
- }
1677
- return result;
1678
- };
1679
- }
1680
- var _getTag = getTag$1;
1681
- var Stack = _Stack, equalArrays = _equalArrays, equalByTag = _equalByTag, equalObjects = _equalObjects, getTag = _getTag, isArray = isArray_1, isBuffer = isBufferExports, isTypedArray = isTypedArray_1;
1682
- var COMPARE_PARTIAL_FLAG = 1;
1683
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
1684
- var objectProto = Object.prototype;
1685
- var hasOwnProperty = objectProto.hasOwnProperty;
1686
- function baseIsEqualDeep$1(object2, other, bitmask, customizer, equalFunc, stack) {
1687
- var objIsArr = isArray(object2), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object2), othTag = othIsArr ? arrayTag : getTag(other);
1688
- objTag = objTag == argsTag ? objectTag : objTag;
1689
- othTag = othTag == argsTag ? objectTag : othTag;
1690
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
1691
- if (isSameTag && isBuffer(object2)) {
1692
- if (!isBuffer(other)) {
1693
- return false;
1694
- }
1695
- objIsArr = true;
1696
- objIsObj = false;
1697
- }
1698
- if (isSameTag && !objIsObj) {
1699
- stack || (stack = new Stack());
1700
- return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
1701
- }
1702
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1703
- var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1704
- if (objIsWrapped || othIsWrapped) {
1705
- var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
1706
- stack || (stack = new Stack());
1707
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1708
- }
1709
- }
1710
- if (!isSameTag) {
1711
- return false;
1712
- }
1713
- stack || (stack = new Stack());
1714
- return equalObjects(object2, other, bitmask, customizer, equalFunc, stack);
1715
- }
1716
- var _baseIsEqualDeep = baseIsEqualDeep$1;
1717
- var baseIsEqualDeep = _baseIsEqualDeep, isObjectLike = isObjectLike_1;
1718
- function baseIsEqual$1(value, other, bitmask, customizer, stack) {
1719
- if (value === other) {
1720
- return true;
1721
- }
1722
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
1723
- return value !== value && other !== other;
1724
- }
1725
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$1, stack);
1726
- }
1727
- var _baseIsEqual = baseIsEqual$1;
1728
- var baseIsEqual = _baseIsEqual;
1729
- function isEqual(value, other) {
1730
- return baseIsEqual(value, other);
1731
- }
1732
- var isEqual_1 = isEqual;
1733
- const isEqual$1 = /* @__PURE__ */ getDefaultExportFromCjs(isEqual_1);
1734
652
  function addTrackingPixel(url) {
1735
653
  const img = document.createElement("img");
1736
654
  img.src = url.toString();
@@ -1742,32 +660,6 @@ function addTrackingPixel(url) {
1742
660
  img.style.top = "0";
1743
661
  return document.body.appendChild(img);
1744
662
  }
1745
- var toFinite = toFinite_1;
1746
- function toInteger$1(value) {
1747
- var result = toFinite(value), remainder = result % 1;
1748
- return result === result ? remainder ? result - remainder : result : 0;
1749
- }
1750
- var toInteger_1 = toInteger$1;
1751
- var root = _root, toInteger = toInteger_1, toNumber = toNumber_1, toString = toString_1;
1752
- var nativeIsFinite = root.isFinite, nativeMin = Math.min;
1753
- function createRound$1(methodName) {
1754
- var func = Math[methodName];
1755
- return function(number2, precision) {
1756
- number2 = toNumber(number2);
1757
- precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
1758
- if (precision && nativeIsFinite(number2)) {
1759
- var pair = (toString(number2) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
1760
- pair = (toString(value) + "e").split("e");
1761
- return +(pair[0] + "e" + (+pair[1] - precision));
1762
- }
1763
- return func(number2);
1764
- };
1765
- }
1766
- var _createRound = createRound$1;
1767
- var createRound = _createRound;
1768
- var round = createRound("round");
1769
- var round_1 = round;
1770
- const round$1 = /* @__PURE__ */ getDefaultExportFromCjs(round_1);
1771
663
  function useViewabilityObserver({ context, ad, name, element }) {
1772
664
  let timeoutId = null;
1773
665
  const {
@@ -1784,7 +676,7 @@ function useViewabilityObserver({ context, ad, name, element }) {
1784
676
  const isTracked = computed(() => Boolean(trackingPixel.value));
1785
677
  const viewabilityObserver = new IntersectionObserver(([entry]) => {
1786
678
  if (context.options.viewabilityTracking && !trackingPixel.value && ad) {
1787
- const ratio = round$1(entry.intersectionRatio, 1);
679
+ const ratio = round(entry.intersectionRatio, 1);
1788
680
  if (ratio >= threshold && !timeoutId) {
1789
681
  timeoutId = setTimeout(() => {
1790
682
  var _a, _b, _c;
@@ -1916,7 +808,7 @@ function createSlot(options) {
1916
808
  });
1917
809
  watch([ad, isInViewport], async ([newAd, newIsInViewport], [oldAd]) => {
1918
810
  var _a, _b;
1919
- if (!newAd || isEqual$1(newAd, oldAd))
811
+ if (!newAd || oldAd && isDeepEqual(newAd, oldAd))
1920
812
  return;
1921
813
  if (newIsInViewport || context.options.eagerRendering)
1922
814
  await render(newAd);
@@ -2254,8 +1146,16 @@ function parseParameters(parameters) {
2254
1146
  return true;
2255
1147
  logger.warn(`Invalid parameter key: ${key}. Key should be exactly 2 characters long. Key will be ignored.`);
2256
1148
  return false;
1149
+ }).map(([key, value]) => {
1150
+ if (typeof value === "string")
1151
+ return [key, filterSpecialChars(value)];
1152
+ return [key, value.map(filterSpecialChars)];
2257
1153
  }));
2258
1154
  }
1155
+ function filterSpecialChars(value) {
1156
+ const specialRegex = /[^\p{L}\p{N}_]/gu;
1157
+ return value.replaceAll(specialRegex, "_");
1158
+ }
2259
1159
  async function requestAds(options) {
2260
1160
  var _a, _b, _c, _d, _e;
2261
1161
  const { context } = options;
@@ -2306,6 +1206,8 @@ async function requestAd({
2306
1206
  return ad;
2307
1207
  }
2308
1208
  export {
2309
- createAdhese
1209
+ createAdhese,
1210
+ onDispose,
1211
+ onInit
2310
1212
  };
2311
1213
  //# sourceMappingURL=index.js.map