@gemx-dev/clarity-js 0.8.86 → 0.8.88

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/build/clarity.js CHANGED
@@ -4,6 +4,7 @@ var dom = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
5
5
  get add () { return add$1; },
6
6
  get get () { return get; },
7
+ get getHashes () { return getHashes; },
7
8
  get getId () { return getId$1; },
8
9
  get getNode () { return getNode; },
9
10
  get getValue () { return getValue; },
@@ -15,8 +16,8 @@ var dom = /*#__PURE__*/Object.freeze({
15
16
  get parse () { return parse; },
16
17
  get removeIFrame () { return removeIFrame; },
17
18
  get sameorigin () { return sameorigin; },
18
- get start () { return start$l; },
19
- get stop () { return stop$j; },
19
+ get start () { return start$m; },
20
+ get stop () { return stop$k; },
20
21
  get update () { return update; },
21
22
  get updates () { return updates$2; }
22
23
  });
@@ -24,24 +25,26 @@ var timeline = /*#__PURE__*/Object.freeze({
24
25
  __proto__: null,
25
26
  get compute () { return compute$5; },
26
27
  get reset () { return reset$5; },
27
- get start () { return start$j; },
28
- get stop () { return stop$h; },
28
+ get start () { return start$k; },
29
+ get stop () { return stop$i; },
29
30
  get track () { return track$2; },
30
31
  get updates () { return updates$1; }
31
32
  });
32
33
  var upload$1 = /*#__PURE__*/Object.freeze({
33
34
  __proto__: null,
34
- get flush () { return flush; },
35
+ get flush () { return flush$1; },
36
+ get inject () { return inject; },
35
37
  get queue () { return queue; },
36
- get start () { return start$h; },
37
- get stop () { return stop$f; },
38
- get track () { return track$1; }
38
+ get start () { return start$i; },
39
+ get stop () { return stop$g; },
40
+ get track () { return track$1; },
41
+ get uploadNow () { return uploadNow; }
39
42
  });
40
43
  var upgrade$1 = /*#__PURE__*/Object.freeze({
41
44
  __proto__: null,
42
45
  get data () { return data$6; },
43
- get start () { return start$c; },
44
- get stop () { return stop$c; },
46
+ get start () { return start$d; },
47
+ get stop () { return stop$d; },
45
48
  get upgrade () { return upgrade; }
46
49
  });
47
50
  var limit = /*#__PURE__*/Object.freeze({
@@ -49,8 +52,8 @@ var limit = /*#__PURE__*/Object.freeze({
49
52
  get check () { return check$2; },
50
53
  get compute () { return compute$4; },
51
54
  get data () { return data$5; },
52
- get start () { return start$b; },
53
- get stop () { return stop$b; },
55
+ get start () { return start$c; },
56
+ get stop () { return stop$c; },
54
57
  get trigger () { return trigger; }
55
58
  });
56
59
  var dimension = /*#__PURE__*/Object.freeze({
@@ -59,8 +62,8 @@ var dimension = /*#__PURE__*/Object.freeze({
59
62
  get data () { return data$4; },
60
63
  get log () { return log; },
61
64
  get reset () { return reset$3; },
62
- get start () { return start$a; },
63
- get stop () { return stop$a; },
65
+ get start () { return start$b; },
66
+ get stop () { return stop$b; },
64
67
  get updates () { return updates; }
65
68
  });
66
69
  var consent$2 = /*#__PURE__*/Object.freeze({
@@ -69,8 +72,8 @@ var consent$2 = /*#__PURE__*/Object.freeze({
69
72
  get config () { return config$1; },
70
73
  get consent () { return consent$1; },
71
74
  get data () { return data$3; },
72
- get start () { return start$9; },
73
- get stop () { return stop$9; },
75
+ get start () { return start$a; },
76
+ get stop () { return stop$a; },
74
77
  get trackConsentv2 () { return trackConsentv2; }
75
78
  });
76
79
  var metadata$1 = /*#__PURE__*/Object.freeze({
@@ -86,15 +89,15 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
86
89
  get metadata () { return metadata; },
87
90
  get save () { return save; },
88
91
  get shortid () { return shortid; },
89
- get start () { return start$8; },
90
- get stop () { return stop$8; }
92
+ get start () { return start$9; },
93
+ get stop () { return stop$9; }
91
94
  });
92
95
  var envelope$1 = /*#__PURE__*/Object.freeze({
93
96
  __proto__: null,
94
97
  get data () { return data$1; },
95
98
  get envelope () { return envelope; },
96
- get start () { return start$7; },
97
- get stop () { return stop$7; }
99
+ get start () { return start$8; },
100
+ get stop () { return stop$8; }
98
101
  });
99
102
  var clarity = /*#__PURE__*/Object.freeze({
100
103
  __proto__: null,
@@ -111,7 +114,7 @@ var clarity = /*#__PURE__*/Object.freeze({
111
114
  get queue () { return queue; },
112
115
  get register () { return register; },
113
116
  get resume () { return resume; },
114
- get schedule () { return schedule; },
117
+ get schedule () { return schedule$1; },
115
118
  get set () { return set$1; },
116
119
  get signal () { return signal; },
117
120
  get start () { return start; },
@@ -159,7 +162,7 @@ function process$8() {
159
162
  }
160
163
  }
161
164
 
162
- var config$2 = {
165
+ var config$3 = {
163
166
  projectId: null,
164
167
  delay: 1 * 1000 /* Time.Second */,
165
168
  lean: false,
@@ -202,7 +205,7 @@ var startTime = 0;
202
205
  function computeStartTime() {
203
206
  return performance.now() + performance.timeOrigin;
204
207
  }
205
- function start$P() {
208
+ function start$R() {
206
209
  startTime = computeStartTime();
207
210
  }
208
211
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -218,11 +221,11 @@ function time(event) {
218
221
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
219
222
  return Math.max(Math.round(ts + origin - baseline), 0);
220
223
  }
221
- function stop$M() {
224
+ function stop$O() {
222
225
  startTime = 0;
223
226
  }
224
227
 
225
- var version$1 = "0.8.86";
228
+ var version$1 = "0.8.88";
226
229
 
227
230
  // tslint:disable: no-bitwise
228
231
  function hash (input, precision) {
@@ -342,7 +345,7 @@ function url$1(input, electron, truncate) {
342
345
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
343
346
  }
344
347
  else {
345
- var drop_1 = config$2.drop;
348
+ var drop_1 = config$3.drop;
346
349
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
347
350
  var _a = input.split("?"), path = _a[0], query = _a[1];
348
351
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -440,9 +443,9 @@ function redact$1(value) {
440
443
  }
441
444
 
442
445
  var state$b = null;
443
- var buffer = null;
446
+ var buffer$1 = null;
444
447
  var update$2 = false;
445
- function start$O() {
448
+ function start$Q() {
446
449
  update$2 = false;
447
450
  reset$u();
448
451
  }
@@ -451,35 +454,35 @@ function reset$u() {
451
454
  // reset the state to current value after sending the previous state
452
455
  if (update$2) {
453
456
  state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
454
- visible: buffer.visible,
455
- docWidth: buffer.docWidth,
456
- docHeight: buffer.docHeight,
457
- screenWidth: buffer.screenWidth,
458
- screenHeight: buffer.screenHeight,
459
- scrollX: buffer.scrollX,
460
- scrollY: buffer.scrollY,
461
- pointerX: buffer.pointerX,
462
- pointerY: buffer.pointerY,
463
- activityTime: buffer.activityTime,
464
- scrollTime: buffer.scrollTime,
465
- pointerTime: buffer.pointerTime,
466
- moveX: buffer.moveX,
467
- moveY: buffer.moveY,
468
- moveTime: buffer.moveTime,
469
- downX: buffer.downX,
470
- downY: buffer.downY,
471
- downTime: buffer.downTime,
472
- upX: buffer.upX,
473
- upY: buffer.upY,
474
- upTime: buffer.upTime,
475
- pointerPrevX: buffer.pointerPrevX,
476
- pointerPrevY: buffer.pointerPrevY,
477
- pointerPrevTime: buffer.pointerPrevTime,
478
- modules: buffer.modules,
457
+ visible: buffer$1.visible,
458
+ docWidth: buffer$1.docWidth,
459
+ docHeight: buffer$1.docHeight,
460
+ screenWidth: buffer$1.screenWidth,
461
+ screenHeight: buffer$1.screenHeight,
462
+ scrollX: buffer$1.scrollX,
463
+ scrollY: buffer$1.scrollY,
464
+ pointerX: buffer$1.pointerX,
465
+ pointerY: buffer$1.pointerY,
466
+ activityTime: buffer$1.activityTime,
467
+ scrollTime: buffer$1.scrollTime,
468
+ pointerTime: buffer$1.pointerTime,
469
+ moveX: buffer$1.moveX,
470
+ moveY: buffer$1.moveY,
471
+ moveTime: buffer$1.moveTime,
472
+ downX: buffer$1.downX,
473
+ downY: buffer$1.downY,
474
+ downTime: buffer$1.downTime,
475
+ upX: buffer$1.upX,
476
+ upY: buffer$1.upY,
477
+ upTime: buffer$1.upTime,
478
+ pointerPrevX: buffer$1.pointerPrevX,
479
+ pointerPrevY: buffer$1.pointerPrevY,
480
+ pointerPrevTime: buffer$1.pointerPrevTime,
481
+ modules: buffer$1.modules,
479
482
  }
480
483
  };
481
484
  }
482
- buffer = buffer ? buffer : {
485
+ buffer$1 = buffer$1 ? buffer$1 : {
483
486
  visible: 1 /* BooleanFlag.True */,
484
487
  docWidth: 0,
485
488
  docHeight: 0,
@@ -510,74 +513,74 @@ function reset$u() {
510
513
  function track$8(event, x, y, time) {
511
514
  switch (event) {
512
515
  case 8 /* Event.Document */:
513
- buffer.docWidth = x;
514
- buffer.docHeight = y;
516
+ buffer$1.docWidth = x;
517
+ buffer$1.docHeight = y;
515
518
  break;
516
519
  case 11 /* Event.Resize */:
517
- buffer.screenWidth = x;
518
- buffer.screenHeight = y;
520
+ buffer$1.screenWidth = x;
521
+ buffer$1.screenHeight = y;
519
522
  break;
520
523
  case 10 /* Event.Scroll */:
521
- buffer.scrollX = x;
522
- buffer.scrollY = y;
523
- buffer.scrollTime = time;
524
+ buffer$1.scrollX = x;
525
+ buffer$1.scrollY = y;
526
+ buffer$1.scrollTime = time;
524
527
  break;
525
528
  case 12 /* Event.MouseMove */:
526
- buffer.moveX = x;
527
- buffer.moveY = y;
528
- buffer.moveTime = time;
529
- buffer.pointerPrevX = buffer.pointerX;
530
- buffer.pointerPrevY = buffer.pointerY;
531
- buffer.pointerPrevTime = buffer.pointerTime;
532
- buffer.pointerX = x;
533
- buffer.pointerY = y;
534
- buffer.pointerTime = time;
529
+ buffer$1.moveX = x;
530
+ buffer$1.moveY = y;
531
+ buffer$1.moveTime = time;
532
+ buffer$1.pointerPrevX = buffer$1.pointerX;
533
+ buffer$1.pointerPrevY = buffer$1.pointerY;
534
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
535
+ buffer$1.pointerX = x;
536
+ buffer$1.pointerY = y;
537
+ buffer$1.pointerTime = time;
535
538
  break;
536
539
  case 13 /* Event.MouseDown */:
537
- buffer.downX = x;
538
- buffer.downY = y;
539
- buffer.downTime = time;
540
- buffer.pointerPrevX = buffer.pointerX;
541
- buffer.pointerPrevY = buffer.pointerY;
542
- buffer.pointerPrevTime = buffer.pointerTime;
543
- buffer.pointerX = x;
544
- buffer.pointerY = y;
545
- buffer.pointerTime = time;
540
+ buffer$1.downX = x;
541
+ buffer$1.downY = y;
542
+ buffer$1.downTime = time;
543
+ buffer$1.pointerPrevX = buffer$1.pointerX;
544
+ buffer$1.pointerPrevY = buffer$1.pointerY;
545
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
546
+ buffer$1.pointerX = x;
547
+ buffer$1.pointerY = y;
548
+ buffer$1.pointerTime = time;
546
549
  break;
547
550
  case 14 /* Event.MouseUp */:
548
- buffer.upX = x;
549
- buffer.upY = y;
550
- buffer.upTime = time;
551
- buffer.pointerPrevX = buffer.pointerX;
552
- buffer.pointerPrevY = buffer.pointerY;
553
- buffer.pointerPrevTime = buffer.pointerTime;
554
- buffer.pointerX = x;
555
- buffer.pointerY = y;
556
- buffer.pointerTime = time;
551
+ buffer$1.upX = x;
552
+ buffer$1.upY = y;
553
+ buffer$1.upTime = time;
554
+ buffer$1.pointerPrevX = buffer$1.pointerX;
555
+ buffer$1.pointerPrevY = buffer$1.pointerY;
556
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
557
+ buffer$1.pointerX = x;
558
+ buffer$1.pointerY = y;
559
+ buffer$1.pointerTime = time;
557
560
  break;
558
561
  default:
559
- buffer.pointerPrevX = buffer.pointerX;
560
- buffer.pointerPrevY = buffer.pointerY;
561
- buffer.pointerPrevTime = buffer.pointerTime;
562
- buffer.pointerX = x;
563
- buffer.pointerY = y;
564
- buffer.pointerTime = time;
562
+ buffer$1.pointerPrevX = buffer$1.pointerX;
563
+ buffer$1.pointerPrevY = buffer$1.pointerY;
564
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
565
+ buffer$1.pointerX = x;
566
+ buffer$1.pointerY = y;
567
+ buffer$1.pointerTime = time;
565
568
  break;
566
569
  }
567
570
  update$2 = true;
568
571
  }
569
572
  function activity(t) {
570
- buffer.activityTime = t;
573
+ buffer$1.activityTime = t;
571
574
  }
572
575
  function visibility$1(t, visible) {
573
- buffer.visible = visible;
574
- if (!buffer.visible) {
576
+ buffer$1.visible = visible;
577
+ if (!buffer$1.visible) {
575
578
  activity(t);
576
579
  }
577
580
  update$2 = true;
578
581
  }
579
582
  function dynamic$1(modules) {
580
- buffer.modules = Array.from(modules);
583
+ buffer$1.modules = Array.from(modules);
581
584
  update$2 = true;
582
585
  }
583
586
  function compute$g() {
@@ -585,7 +588,7 @@ function compute$g() {
585
588
  encode$1(4 /* Event.Baseline */);
586
589
  }
587
590
  }
588
- function stop$L() {
591
+ function stop$N() {
589
592
  reset$u();
590
593
  }
591
594
 
@@ -595,9 +598,9 @@ var baseline = /*#__PURE__*/Object.freeze({
595
598
  compute: compute$g,
596
599
  dynamic: dynamic$1,
597
600
  reset: reset$u,
598
- start: start$O,
601
+ start: start$Q,
599
602
  get state () { return state$b; },
600
- stop: stop$L,
603
+ stop: stop$N,
601
604
  track: track$8,
602
605
  visibility: visibility$1
603
606
  });
@@ -622,12 +625,12 @@ function event$1(a, b) {
622
625
 
623
626
  var data$k = null;
624
627
  var updates$3 = null;
625
- function start$N() {
628
+ function start$P() {
626
629
  data$k = {};
627
630
  updates$3 = {};
628
631
  count$1(5 /* Metric.InvokeCount */);
629
632
  }
630
- function stop$K() {
633
+ function stop$M() {
631
634
  data$k = {};
632
635
  updates$3 = {};
633
636
  }
@@ -683,7 +686,7 @@ var data$j;
683
686
  var last = 0;
684
687
  var interval = 0;
685
688
  var timeout$7 = null;
686
- function start$M() {
689
+ function start$O() {
687
690
  interval = 60000 /* Setting.PingInterval */;
688
691
  last = 0;
689
692
  }
@@ -705,7 +708,7 @@ function ping() {
705
708
  suspend();
706
709
  }
707
710
  }
708
- function stop$J() {
711
+ function stop$L() {
709
712
  clearTimeout$1(timeout$7);
710
713
  last = 0;
711
714
  interval = 0;
@@ -715,15 +718,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
715
718
  __proto__: null,
716
719
  get data () { return data$j; },
717
720
  reset: reset$s,
718
- start: start$M,
719
- stop: stop$J
721
+ start: start$O,
722
+ stop: stop$L
720
723
  });
721
724
 
722
725
  var data$i = null;
723
- function start$L() {
726
+ function start$N() {
724
727
  data$i = {};
725
728
  }
726
- function stop$I() {
729
+ function stop$K() {
727
730
  data$i = {};
728
731
  }
729
732
  function track$7(event, time) {
@@ -755,8 +758,8 @@ var summary = /*#__PURE__*/Object.freeze({
755
758
  compute: compute$e,
756
759
  get data () { return data$i; },
757
760
  reset: reset$r,
758
- start: start$L,
759
- stop: stop$I,
761
+ start: start$N,
762
+ stop: stop$K,
760
763
  track: track$7
761
764
  });
762
765
 
@@ -895,7 +898,7 @@ function read(stream) {
895
898
  }
896
899
 
897
900
  var data$h = null;
898
- function start$K() {
901
+ function start$M() {
899
902
  reset$q();
900
903
  }
901
904
  function set$1(variable, value) {
@@ -957,7 +960,7 @@ function compute$d() {
957
960
  function reset$q() {
958
961
  data$h = {};
959
962
  }
960
- function stop$H() {
963
+ function stop$J() {
961
964
  reset$q();
962
965
  }
963
966
  function redact(input) {
@@ -997,8 +1000,8 @@ var variable = /*#__PURE__*/Object.freeze({
997
1000
  identify: identify,
998
1001
  reset: reset$q,
999
1002
  set: set$1,
1000
- start: start$K,
1001
- stop: stop$H
1003
+ start: start$M,
1004
+ stop: stop$J
1002
1005
  });
1003
1006
 
1004
1007
  var data$g = {};
@@ -1007,7 +1010,7 @@ var variables = {};
1007
1010
  var selectors = {};
1008
1011
  var hashes = {};
1009
1012
  var validation = {};
1010
- function start$J() {
1013
+ function start$L() {
1011
1014
  reset$p();
1012
1015
  }
1013
1016
  // Input string is of the following form:
@@ -1123,7 +1126,7 @@ function update$1(key, subkey, value) {
1123
1126
  }
1124
1127
  return;
1125
1128
  }
1126
- function stop$G() {
1129
+ function stop$I() {
1127
1130
  reset$p();
1128
1131
  }
1129
1132
  function parse$1(variable) {
@@ -1196,8 +1199,8 @@ var extract = /*#__PURE__*/Object.freeze({
1196
1199
  data: data$g,
1197
1200
  keys: keys,
1198
1201
  reset: reset$p,
1199
- start: start$J,
1200
- stop: stop$G,
1202
+ start: start$L,
1203
+ stop: stop$I,
1201
1204
  trigger: trigger$2,
1202
1205
  update: update$1
1203
1206
  });
@@ -1225,10 +1228,10 @@ function decodeCookieValue(value) {
1225
1228
 
1226
1229
  var rootDomain = null;
1227
1230
  var COOKIE_SEP = "^" /* Constant.Caret */;
1228
- function start$I() {
1231
+ function start$K() {
1229
1232
  rootDomain = null;
1230
1233
  }
1231
- function stop$F() {
1234
+ function stop$H() {
1232
1235
  rootDomain = null;
1233
1236
  }
1234
1237
  function getCookie(key, limit) {
@@ -1264,7 +1267,7 @@ function getCookie(key, limit) {
1264
1267
  function setCookie(key, value, time) {
1265
1268
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1266
1269
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1267
- if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1270
+ if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1268
1271
  // Some browsers automatically url encode cookie values if they are not url encoded.
1269
1272
  // We therefore encode and decode cookie values ourselves.
1270
1273
  var encodedValue = encodeCookieValue(value);
@@ -1310,23 +1313,25 @@ var cookie = /*#__PURE__*/Object.freeze({
1310
1313
  COOKIE_SEP: COOKIE_SEP,
1311
1314
  getCookie: getCookie,
1312
1315
  setCookie: setCookie,
1313
- start: start$I,
1314
- stop: stop$F
1316
+ start: start$K,
1317
+ stop: stop$H
1315
1318
  });
1316
1319
 
1317
1320
  var defaultConfig = {
1318
1321
  excludeClassNames: [],
1319
1322
  ignoreMutationClassNames: [],
1323
+ discoverTrigger: null,
1320
1324
  };
1321
1325
  var _config = __assign({}, defaultConfig);
1322
- function start$H() {
1323
- var _a, _b, _c, _d;
1326
+ function start$J() {
1327
+ var _a, _b, _c, _d, _e, _f;
1324
1328
  _config = {
1325
1329
  excludeClassNames: ((_b = (_a = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _a === void 0 ? void 0 : _a.excludeClassNames) !== null && _b !== void 0 ? _b : []),
1326
1330
  ignoreMutationClassNames: ((_d = (_c = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _c === void 0 ? void 0 : _c.ignoreMutationClassNames) !== null && _d !== void 0 ? _d : []),
1331
+ discoverTrigger: ((_f = (_e = window === null || window === void 0 ? void 0 : window.GemXHeatmap) === null || _e === void 0 ? void 0 : _e.discoverTrigger) !== null && _f !== void 0 ? _f : null),
1327
1332
  };
1328
1333
  }
1329
- function stop$E() {
1334
+ function stop$G() {
1330
1335
  _config = __assign({}, defaultConfig);
1331
1336
  }
1332
1337
  function set(config) {
@@ -1340,8 +1345,61 @@ var gemx = /*#__PURE__*/Object.freeze({
1340
1345
  __proto__: null,
1341
1346
  get: get$2,
1342
1347
  set: set,
1343
- start: start$H,
1344
- stop: stop$E
1348
+ start: start$J,
1349
+ stop: stop$G
1350
+ });
1351
+
1352
+ // Deferred upload buffer for GemX mode.
1353
+ // Buffers ALL playback events until discoverTrigger conditions are met.
1354
+ // Scheduling and trigger logic lives in layout/gemx-discover.ts.
1355
+ var buffer = [];
1356
+ var bufferBytes = 0;
1357
+ var active$4 = false;
1358
+ var maxBytes = 0;
1359
+ var onBytesLimit = null;
1360
+ function start$I() {
1361
+ buffer = [];
1362
+ bufferBytes = 0;
1363
+ active$4 = true;
1364
+ }
1365
+ function config$2(bytesLimit, onLimit) {
1366
+ maxBytes = bytesLimit !== null && bytesLimit !== void 0 ? bytesLimit : 0;
1367
+ onBytesLimit = onLimit !== null && onLimit !== void 0 ? onLimit : null;
1368
+ return true;
1369
+ }
1370
+ function stop$F() {
1371
+ buffer = [];
1372
+ bufferBytes = 0;
1373
+ active$4 = false;
1374
+ maxBytes = 0;
1375
+ onBytesLimit = null;
1376
+ }
1377
+ function isActive() { return active$4; }
1378
+ function getBytes() { return bufferBytes; }
1379
+ function hold(tokens, byteLength) {
1380
+ buffer.push(tokens);
1381
+ bufferBytes += byteLength;
1382
+ if (maxBytes > 0 && bufferBytes >= maxBytes && onBytesLimit) {
1383
+ onBytesLimit();
1384
+ }
1385
+ }
1386
+ function drain() {
1387
+ active$4 = false;
1388
+ var pending = buffer;
1389
+ buffer = [];
1390
+ bufferBytes = 0;
1391
+ return pending;
1392
+ }
1393
+
1394
+ var gemxUpload = /*#__PURE__*/Object.freeze({
1395
+ __proto__: null,
1396
+ config: config$2,
1397
+ drain: drain,
1398
+ getBytes: getBytes,
1399
+ hold: hold,
1400
+ isActive: isActive,
1401
+ start: start$I,
1402
+ stop: stop$F
1345
1403
  });
1346
1404
 
1347
1405
  var signalCallback = null;
@@ -1372,25 +1430,25 @@ function signalsEvent(signalsPayload) {
1372
1430
  }
1373
1431
  }
1374
1432
 
1375
- var modules$3 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1376
- function start$G() {
1433
+ var modules$3 = [gemx, gemxUpload, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1434
+ function start$H() {
1377
1435
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1378
- start$N();
1436
+ start$P();
1379
1437
  modules$3.forEach(function (x) { return measure(x.start)(); });
1380
1438
  }
1381
- function stop$D() {
1439
+ function stop$E() {
1382
1440
  // Stop modules in the reverse order of their initialization
1383
1441
  // The ordering below should respect inter-module dependency.
1384
1442
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1385
1443
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1386
1444
  modules$3.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1387
- stop$K();
1445
+ stop$M();
1388
1446
  }
1389
1447
  function compute$b() {
1390
1448
  compute$g();
1391
1449
  compute$4();
1392
1450
  compute$2();
1393
- if (config$2.mode !== "gemx") {
1451
+ if (config$3.mode !== "gemx") {
1394
1452
  compute$d();
1395
1453
  compute$3();
1396
1454
  compute$f();
@@ -1401,7 +1459,7 @@ function compute$b() {
1401
1459
 
1402
1460
  var history$5 = [];
1403
1461
  var data$f;
1404
- function start$F() {
1462
+ function start$G() {
1405
1463
  history$5 = [];
1406
1464
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1407
1465
  try {
@@ -1414,7 +1472,7 @@ function start$F() {
1414
1472
  }
1415
1473
  function check$5(id, target, input) {
1416
1474
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1417
- if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1475
+ if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1418
1476
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1419
1477
  // Only encode this event if we haven't already reported this hash
1420
1478
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1437,7 +1495,7 @@ var MaskTagsList = ["INPUT", "SELECT", "TEXTAREA"];
1437
1495
  var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
1438
1496
 
1439
1497
  var state$a = [];
1440
- function start$E() {
1498
+ function start$F() {
1441
1499
  reset$o();
1442
1500
  }
1443
1501
  function observe$c(root) {
@@ -1447,15 +1505,15 @@ function recompute$8(evt) {
1447
1505
  var element = target(evt);
1448
1506
  if (element) {
1449
1507
  var value = element.value;
1450
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1508
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1451
1509
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1452
- schedule(encode$4.bind(this, 42 /* Event.Change */));
1510
+ schedule$1(encode$4.bind(this, 42 /* Event.Change */));
1453
1511
  }
1454
1512
  }
1455
1513
  function reset$o() {
1456
1514
  state$a = [];
1457
1515
  }
1458
- function stop$C() {
1516
+ function stop$D() {
1459
1517
  reset$o();
1460
1518
  }
1461
1519
 
@@ -1463,9 +1521,9 @@ var change = /*#__PURE__*/Object.freeze({
1463
1521
  __proto__: null,
1464
1522
  observe: observe$c,
1465
1523
  reset: reset$o,
1466
- start: start$E,
1524
+ start: start$F,
1467
1525
  get state () { return state$a; },
1468
- stop: stop$C
1526
+ stop: stop$D
1469
1527
  });
1470
1528
 
1471
1529
  function offset(element) {
@@ -1487,7 +1545,9 @@ function offset(element) {
1487
1545
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1488
1546
  var VM_PATTERN = /VM\d/;
1489
1547
  var state$9 = [];
1490
- function start$D() {
1548
+ var trustedCallback$1 = null;
1549
+ function onTrustedClick(cb) { trustedCallback$1 = cb; }
1550
+ function start$E() {
1491
1551
  reset$n();
1492
1552
  }
1493
1553
  function observe$b(root) {
@@ -1525,7 +1585,7 @@ function handler$4(event, root, evt) {
1525
1585
  // Check for null values before processing this event
1526
1586
  if (x !== null && y !== null) {
1527
1587
  var textInfo = text(t);
1528
- if (config$2.diagnostics) {
1588
+ if (config$3.diagnostics) {
1529
1589
  var el = t;
1530
1590
  console.log("[clarity:click] text debug", {
1531
1591
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1562,10 +1622,13 @@ function handler$4(event, root, evt) {
1562
1622
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1563
1623
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1564
1624
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1565
- source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1625
+ source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1566
1626
  }
1567
1627
  });
1568
- schedule(encode$4.bind(this, event));
1628
+ if (evt.isTrusted && trustedCallback$1) {
1629
+ trustedCallback$1();
1630
+ }
1631
+ schedule$1(encode$4.bind(this, event));
1569
1632
  }
1570
1633
  }
1571
1634
  function link(node) {
@@ -1718,21 +1781,22 @@ function source() {
1718
1781
  function reset$n() {
1719
1782
  state$9 = [];
1720
1783
  }
1721
- function stop$B() {
1784
+ function stop$C() {
1722
1785
  reset$n();
1723
1786
  }
1724
1787
 
1725
1788
  var click = /*#__PURE__*/Object.freeze({
1726
1789
  __proto__: null,
1727
1790
  observe: observe$b,
1791
+ onTrustedClick: onTrustedClick,
1728
1792
  reset: reset$n,
1729
- start: start$D,
1793
+ start: start$E,
1730
1794
  get state () { return state$9; },
1731
- stop: stop$B
1795
+ stop: stop$C
1732
1796
  });
1733
1797
 
1734
1798
  var state$8 = [];
1735
- function start$C() {
1799
+ function start$D() {
1736
1800
  reset$m();
1737
1801
  }
1738
1802
  function observe$a(root) {
@@ -1742,12 +1806,12 @@ function observe$a(root) {
1742
1806
  }
1743
1807
  function recompute$7(action, evt) {
1744
1808
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1745
- schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1809
+ schedule$1(encode$4.bind(this, 38 /* Event.Clipboard */));
1746
1810
  }
1747
1811
  function reset$m() {
1748
1812
  state$8 = [];
1749
1813
  }
1750
- function stop$A() {
1814
+ function stop$B() {
1751
1815
  reset$m();
1752
1816
  }
1753
1817
 
@@ -1755,14 +1819,14 @@ var clipboard = /*#__PURE__*/Object.freeze({
1755
1819
  __proto__: null,
1756
1820
  observe: observe$a,
1757
1821
  reset: reset$m,
1758
- start: start$C,
1822
+ start: start$D,
1759
1823
  get state () { return state$8; },
1760
- stop: stop$A
1824
+ stop: stop$B
1761
1825
  });
1762
1826
 
1763
1827
  var timeout$6 = null;
1764
1828
  var state$7 = [];
1765
- function start$B() {
1829
+ function start$C() {
1766
1830
  reset$l();
1767
1831
  }
1768
1832
  function observe$9(root) {
@@ -1791,12 +1855,12 @@ function recompute$6(evt) {
1791
1855
  }
1792
1856
  }
1793
1857
  function process$7(event) {
1794
- schedule(encode$4.bind(this, event));
1858
+ schedule$1(encode$4.bind(this, event));
1795
1859
  }
1796
1860
  function reset$l() {
1797
1861
  state$7 = [];
1798
1862
  }
1799
- function stop$z() {
1863
+ function stop$A() {
1800
1864
  clearTimeout$1(timeout$6);
1801
1865
  reset$l();
1802
1866
  }
@@ -1805,9 +1869,9 @@ var input = /*#__PURE__*/Object.freeze({
1805
1869
  __proto__: null,
1806
1870
  observe: observe$9,
1807
1871
  reset: reset$l,
1808
- start: start$B,
1872
+ start: start$C,
1809
1873
  get state () { return state$7; },
1810
- stop: stop$z
1874
+ stop: stop$A
1811
1875
  });
1812
1876
 
1813
1877
  var state$6 = [];
@@ -1815,7 +1879,7 @@ var timeout$5 = null;
1815
1879
  var hasPrimaryTouch = false;
1816
1880
  var primaryTouchId = 0;
1817
1881
  var activeTouchPointIds = new Set();
1818
- function start$A() {
1882
+ function start$B() {
1819
1883
  reset$k();
1820
1884
  }
1821
1885
  function observe$8(root) {
@@ -1909,7 +1973,7 @@ function handler$3(current) {
1909
1973
  }
1910
1974
  }
1911
1975
  function process$6(event) {
1912
- schedule(encode$4.bind(this, event));
1976
+ schedule$1(encode$4.bind(this, event));
1913
1977
  }
1914
1978
  function reset$k() {
1915
1979
  state$6 = [];
@@ -1923,7 +1987,7 @@ function similar$1(last, current) {
1923
1987
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1924
1988
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1925
1989
  }
1926
- function stop$y() {
1990
+ function stop$z() {
1927
1991
  clearTimeout$1(timeout$5);
1928
1992
  // Send out any pending pointer events in the pipeline
1929
1993
  if (state$6.length > 0) {
@@ -1935,9 +1999,9 @@ var pointer = /*#__PURE__*/Object.freeze({
1935
1999
  __proto__: null,
1936
2000
  observe: observe$8,
1937
2001
  reset: reset$k,
1938
- start: start$A,
2002
+ start: start$B,
1939
2003
  get state () { return state$6; },
1940
- stop: stop$y
2004
+ stop: stop$z
1941
2005
  });
1942
2006
 
1943
2007
  /**
@@ -1992,7 +2056,7 @@ var data$e;
1992
2056
  var timeout$4 = null;
1993
2057
  var initialStateLogged = false;
1994
2058
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1995
- function start$z() {
2059
+ function start$A() {
1996
2060
  initialStateLogged = false;
1997
2061
  bind(window, "resize", throttledRecompute$1);
1998
2062
  recompute$5();
@@ -2015,14 +2079,14 @@ function recompute$5() {
2015
2079
  }
2016
2080
  }
2017
2081
  function process$5(event) {
2018
- schedule(encode$4.bind(this, event));
2082
+ schedule$1(encode$4.bind(this, event));
2019
2083
  }
2020
2084
  function reset$j() {
2021
2085
  data$e = null;
2022
2086
  clearTimeout$1(timeout$4);
2023
2087
  throttledRecompute$1.cleanup();
2024
2088
  }
2025
- function stop$x() {
2089
+ function stop$y() {
2026
2090
  reset$j();
2027
2091
  }
2028
2092
 
@@ -2030,15 +2094,17 @@ var resize = /*#__PURE__*/Object.freeze({
2030
2094
  __proto__: null,
2031
2095
  get data () { return data$e; },
2032
2096
  reset: reset$j,
2033
- start: start$z,
2034
- stop: stop$x
2097
+ start: start$A,
2098
+ stop: stop$y
2035
2099
  });
2036
2100
 
2037
2101
  var state$5 = [];
2102
+ var trustedCallback = null;
2103
+ function onTrustedScroll(cb) { trustedCallback = cb; }
2038
2104
  var initialTop = null;
2039
2105
  var initialBottom = null;
2040
2106
  var timeout$3 = null;
2041
- function start$y() {
2107
+ function start$z() {
2042
2108
  state$5 = [];
2043
2109
  recompute$4();
2044
2110
  }
@@ -2077,6 +2143,9 @@ function recompute$4(event) {
2077
2143
  var top = getPositionNode(xPosition, startYPosition);
2078
2144
  var bottom = getPositionNode(xPosition, endYPosition);
2079
2145
  var trust = event && event.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
2146
+ if (event && event.isTrusted && trustedCallback) {
2147
+ trustedCallback();
2148
+ }
2080
2149
  var current = { time: time(event), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y, top: top, bottom: bottom, trust: trust } };
2081
2150
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
2082
2151
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
@@ -2117,7 +2186,7 @@ function reset$i() {
2117
2186
  initialBottom = null;
2118
2187
  }
2119
2188
  function process$4(event) {
2120
- schedule(encode$4.bind(this, event));
2189
+ schedule$1(encode$4.bind(this, event));
2121
2190
  }
2122
2191
  function similar(last, current) {
2123
2192
  var dx = last.data.x - current.data.x;
@@ -2135,7 +2204,7 @@ function compute$a() {
2135
2204
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
2136
2205
  }
2137
2206
  }
2138
- function stop$w() {
2207
+ function stop$x() {
2139
2208
  clearTimeout$1(timeout$3);
2140
2209
  throttledRecompute.cleanup();
2141
2210
  state$5 = [];
@@ -2147,16 +2216,17 @@ var scroll = /*#__PURE__*/Object.freeze({
2147
2216
  __proto__: null,
2148
2217
  compute: compute$a,
2149
2218
  observe: observe$7,
2219
+ onTrustedScroll: onTrustedScroll,
2150
2220
  reset: reset$i,
2151
- start: start$y,
2221
+ start: start$z,
2152
2222
  get state () { return state$5; },
2153
- stop: stop$w
2223
+ stop: stop$x
2154
2224
  });
2155
2225
 
2156
2226
  var data$d = null;
2157
2227
  var previous = null;
2158
2228
  var timeout$2 = null;
2159
- function start$x() {
2229
+ function start$y() {
2160
2230
  reset$h();
2161
2231
  }
2162
2232
  function observe$6(root) {
@@ -2194,13 +2264,13 @@ function recompute$3(root) {
2194
2264
  timeout$2 = setTimeout$1(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
2195
2265
  }
2196
2266
  function process$3(event) {
2197
- schedule(encode$4.bind(this, event));
2267
+ schedule$1(encode$4.bind(this, event));
2198
2268
  }
2199
2269
  function reset$h() {
2200
2270
  previous = null;
2201
2271
  data$d = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
2202
2272
  }
2203
- function stop$v() {
2273
+ function stop$w() {
2204
2274
  reset$h();
2205
2275
  clearTimeout$1(timeout$2);
2206
2276
  }
@@ -2210,12 +2280,12 @@ var selection = /*#__PURE__*/Object.freeze({
2210
2280
  get data () { return data$d; },
2211
2281
  observe: observe$6,
2212
2282
  reset: reset$h,
2213
- start: start$x,
2214
- stop: stop$v
2283
+ start: start$y,
2284
+ stop: stop$w
2215
2285
  });
2216
2286
 
2217
2287
  var state$4 = [];
2218
- function start$w() {
2288
+ function start$x() {
2219
2289
  reset$g();
2220
2290
  }
2221
2291
  function observe$5(root) {
@@ -2223,12 +2293,12 @@ function observe$5(root) {
2223
2293
  }
2224
2294
  function recompute$2(evt) {
2225
2295
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
2226
- schedule(encode$4.bind(this, 39 /* Event.Submit */));
2296
+ schedule$1(encode$4.bind(this, 39 /* Event.Submit */));
2227
2297
  }
2228
2298
  function reset$g() {
2229
2299
  state$4 = [];
2230
2300
  }
2231
- function stop$u() {
2301
+ function stop$v() {
2232
2302
  reset$g();
2233
2303
  }
2234
2304
 
@@ -2236,18 +2306,18 @@ var submit = /*#__PURE__*/Object.freeze({
2236
2306
  __proto__: null,
2237
2307
  observe: observe$5,
2238
2308
  reset: reset$g,
2239
- start: start$w,
2309
+ start: start$x,
2240
2310
  get state () { return state$4; },
2241
- stop: stop$u
2311
+ stop: stop$v
2242
2312
  });
2243
2313
 
2244
2314
  var data$c;
2245
- function start$v() {
2315
+ function start$w() {
2246
2316
  bind(window, "pagehide", recompute$1);
2247
2317
  bind(window, "beforeunload", beforeUnload);
2248
2318
  }
2249
2319
  function beforeUnload() {
2250
- flush();
2320
+ flush$1();
2251
2321
  }
2252
2322
  function recompute$1(evt) {
2253
2323
  data$c = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
@@ -2257,7 +2327,7 @@ function recompute$1(evt) {
2257
2327
  function reset$f() {
2258
2328
  data$c = null;
2259
2329
  }
2260
- function stop$t() {
2330
+ function stop$u() {
2261
2331
  reset$f();
2262
2332
  }
2263
2333
 
@@ -2265,12 +2335,12 @@ var unload = /*#__PURE__*/Object.freeze({
2265
2335
  __proto__: null,
2266
2336
  get data () { return data$c; },
2267
2337
  reset: reset$f,
2268
- start: start$v,
2269
- stop: stop$t
2338
+ start: start$w,
2339
+ stop: stop$u
2270
2340
  });
2271
2341
 
2272
2342
  var data$b;
2273
- function start$u() {
2343
+ function start$v() {
2274
2344
  bind(document, "visibilitychange", recompute);
2275
2345
  recompute();
2276
2346
  }
@@ -2285,7 +2355,7 @@ function recompute(evt) {
2285
2355
  function reset$e() {
2286
2356
  data$b = null;
2287
2357
  }
2288
- function stop$s() {
2358
+ function stop$t() {
2289
2359
  reset$e();
2290
2360
  }
2291
2361
 
@@ -2293,16 +2363,16 @@ var visibility = /*#__PURE__*/Object.freeze({
2293
2363
  __proto__: null,
2294
2364
  get data () { return data$b; },
2295
2365
  reset: reset$e,
2296
- start: start$u,
2297
- stop: stop$s
2366
+ start: start$v,
2367
+ stop: stop$t
2298
2368
  });
2299
2369
 
2300
2370
  var data$a;
2301
- function start$t() {
2371
+ function start$u() {
2302
2372
  bind(window, "focus", function () { return compute$9(1 /* BooleanFlag.True */); });
2303
2373
  bind(window, "blur", function () { return compute$9(0 /* BooleanFlag.False */); });
2304
2374
  }
2305
- function stop$r() {
2375
+ function stop$s() {
2306
2376
  reset$d();
2307
2377
  }
2308
2378
  function reset$d() {
@@ -2317,12 +2387,12 @@ var focus = /*#__PURE__*/Object.freeze({
2317
2387
  __proto__: null,
2318
2388
  get data () { return data$a; },
2319
2389
  reset: reset$d,
2320
- start: start$t,
2321
- stop: stop$r
2390
+ start: start$u,
2391
+ stop: stop$s
2322
2392
  });
2323
2393
 
2324
2394
  var bound = false;
2325
- function start$s() {
2395
+ function start$t() {
2326
2396
  // Only bind once - this listener must persist even when Clarity stops
2327
2397
  // to detect when the page is restored from bfcache
2328
2398
  if (!bound) {
@@ -2343,15 +2413,15 @@ function handler$2(evt) {
2343
2413
  log$1(11 /* Code.BFCache */, 0 /* Severity.Info */);
2344
2414
  }
2345
2415
  }
2346
- function stop$q() {
2416
+ function stop$r() {
2347
2417
  // Intentionally don't remove the listener or reset 'bound' flag
2348
2418
  // We need the listener to persist to detect bfcache restoration
2349
2419
  }
2350
2420
 
2351
2421
  var pageshow = /*#__PURE__*/Object.freeze({
2352
2422
  __proto__: null,
2353
- start: start$s,
2354
- stop: stop$q
2423
+ start: start$t,
2424
+ stop: stop$r
2355
2425
  });
2356
2426
 
2357
2427
  var GEMX$1 = [
@@ -2382,15 +2452,15 @@ var ALL$1 = [
2382
2452
  var GEMX_OBSERVE = { allRoots: [scroll], documentOnly: [click] };
2383
2453
  var ALL_OBSERVE = { allRoots: [scroll], documentOnly: [click, clipboard, pointer, input, selection, change, submit] };
2384
2454
  var modules$2 = ALL$1;
2385
- function start$r() {
2386
- modules$2 = config$2.mode === "gemx" ? GEMX$1 : ALL$1;
2455
+ function start$s() {
2456
+ modules$2 = config$3.mode === "gemx" ? GEMX$1 : ALL$1;
2387
2457
  modules$2.forEach(function (m) { return m.start(); });
2388
2458
  }
2389
- function stop$p() {
2459
+ function stop$q() {
2390
2460
  modules$2.forEach(function (m) { return m.stop(); });
2391
2461
  }
2392
2462
  function observe$4(root) {
2393
- var observeModules = config$2.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2463
+ var observeModules = config$3.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2394
2464
  observeModules.allRoots.forEach(function (m) { return m.observe(root); });
2395
2465
  if (root.nodeType === Node.DOCUMENT_NODE) {
2396
2466
  observeModules.documentOnly.forEach(function (m) { return m.observe(root); });
@@ -2400,8 +2470,8 @@ function observe$4(root) {
2400
2470
  var interaction = /*#__PURE__*/Object.freeze({
2401
2471
  __proto__: null,
2402
2472
  observe: observe$4,
2403
- start: start$r,
2404
- stop: stop$p
2473
+ start: start$s,
2474
+ stop: stop$q
2405
2475
  });
2406
2476
 
2407
2477
  // Following code takes an array of tokens and transforms it to optimize for repeating tokens and make it efficient to send over the wire
@@ -2455,7 +2525,7 @@ var styleTimeMap = {};
2455
2525
  var documentNodes = [];
2456
2526
  var createdSheetIds = [];
2457
2527
  function proxyStyleRules$1(win) {
2458
- if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2528
+ if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2459
2529
  return;
2460
2530
  }
2461
2531
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2490,11 +2560,11 @@ function proxyStyleRules$1(win) {
2490
2560
  }
2491
2561
  }
2492
2562
  }
2493
- function start$q() {
2563
+ function start$r() {
2494
2564
  proxyStyleRules$1(window);
2495
2565
  }
2496
2566
  function checkDocumentStyles(documentNode, timestamp) {
2497
- if (config$2.lean && config$2.lite) {
2567
+ if (config$3.lean && config$3.lite) {
2498
2568
  return;
2499
2569
  }
2500
2570
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2546,7 +2616,7 @@ function reset$c() {
2546
2616
  sheetAdoptionState = [];
2547
2617
  sheetUpdateState = [];
2548
2618
  }
2549
- function stop$o() {
2619
+ function stop$p() {
2550
2620
  styleSheetMap = {};
2551
2621
  styleTimeMap = {};
2552
2622
  documentNodes = [];
@@ -2594,7 +2664,7 @@ var animationFinish = null;
2594
2664
  var animationId = 'clarityAnimationId';
2595
2665
  var operationCount = 'clarityOperationCount';
2596
2666
  var maxOperations = 20;
2597
- function start$p() {
2667
+ function start$q() {
2598
2668
  if (window["Animation"] &&
2599
2669
  window["Animation"].prototype &&
2600
2670
  window["KeyframeEffect"] &&
@@ -2649,7 +2719,7 @@ function track$6(time, id, operation, keyFrames, timing, targetId, timeline) {
2649
2719
  });
2650
2720
  encode$5(44 /* Event.Animation */);
2651
2721
  }
2652
- function stop$n() {
2722
+ function stop$o() {
2653
2723
  reset$b();
2654
2724
  }
2655
2725
  function overrideAnimationHelper(functionToOverride, name) {
@@ -2706,7 +2776,7 @@ function register$1(tag) {
2706
2776
  if (!definedElements.has(tag)) {
2707
2777
  definedElements.add(tag);
2708
2778
  elements.push(tag);
2709
- schedule(encode$5.bind(this, 51 /* Event.CustomElement */));
2779
+ schedule$1(encode$5.bind(this, 51 /* Event.CustomElement */));
2710
2780
  }
2711
2781
  }
2712
2782
  function check$4(tag) {
@@ -2715,7 +2785,7 @@ function check$4(tag) {
2715
2785
  register$1(tag);
2716
2786
  }
2717
2787
  }
2718
- function start$o() {
2788
+ function start$p() {
2719
2789
  var _a;
2720
2790
  // Wrap in try-catch to handle Safari iOS where window properties or customElements.define may be readonly
2721
2791
  try {
@@ -2737,7 +2807,7 @@ function start$o() {
2737
2807
  function reset$a() {
2738
2808
  elements.length = 0;
2739
2809
  }
2740
- function stop$m() {
2810
+ function stop$n() {
2741
2811
  reset$a();
2742
2812
  definedElements.clear();
2743
2813
  }
@@ -2887,7 +2957,7 @@ function encode$5 (type, timer, ts) {
2887
2957
  if (type === 6 /* Event.Mutation */) {
2888
2958
  activity(eventTime);
2889
2959
  }
2890
- queue(tokenize(tokens), !config$2.lean);
2960
+ queue(tokenize(tokens), !config$3.lean);
2891
2961
  _o.label = 11;
2892
2962
  case 11: return [3 /*break*/, 13];
2893
2963
  case 12:
@@ -2929,7 +2999,7 @@ var data$9;
2929
2999
  function reset$9() {
2930
3000
  data$9 = null;
2931
3001
  }
2932
- function start$n() {
3002
+ function start$o() {
2933
3003
  reset$9();
2934
3004
  compute$7();
2935
3005
  }
@@ -2956,7 +3026,7 @@ function compute$7() {
2956
3026
  encode$5(8 /* Event.Document */);
2957
3027
  }
2958
3028
  }
2959
- function stop$l() {
3029
+ function stop$m() {
2960
3030
  reset$9();
2961
3031
  }
2962
3032
 
@@ -3008,7 +3078,7 @@ var history$4 = {};
3008
3078
  var observedNodes = new WeakMap();
3009
3079
  // We ignore mutations if these attributes are updated
3010
3080
  var IGNORED_ATTRIBUTES = ["data-google-query-id", "data-load-complete", "data-google-container-id"];
3011
- function start$m() {
3081
+ function start$n() {
3012
3082
  observers = new Set();
3013
3083
  queue$2 = [];
3014
3084
  timeout$1 = null;
@@ -3046,7 +3116,7 @@ function monitor(frame) {
3046
3116
  bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
3047
3117
  }
3048
3118
  }
3049
- function stop$k() {
3119
+ function stop$l() {
3050
3120
  for (var _i = 0, _a = Array.from(observers); _i < _a.length; _i++) {
3051
3121
  var observer = _a[_i];
3052
3122
  if (observer) {
@@ -3078,7 +3148,7 @@ function handle$1(m) {
3078
3148
  var now = time();
3079
3149
  track$7(6 /* Event.Mutation */, now);
3080
3150
  mutations.push({ time: now, mutations: m });
3081
- schedule(process$2, 1 /* Priority.High */).then(function () {
3151
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
3082
3152
  setTimeout$1(compute$7);
3083
3153
  measure(compute$6)();
3084
3154
  });
@@ -3107,7 +3177,7 @@ function processMutation(timer, mutation, instance, timestamp) {
3107
3177
  return [2 /*return*/];
3108
3178
  }
3109
3179
  }
3110
- type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3180
+ type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3111
3181
  if (type && target && target.ownerDocument) {
3112
3182
  parse(target.ownerDocument);
3113
3183
  }
@@ -3140,7 +3210,7 @@ function process$2() {
3140
3210
  switch (_d.label) {
3141
3211
  case 0:
3142
3212
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
3143
- start$e(timer);
3213
+ start$f(timer);
3144
3214
  _d.label = 1;
3145
3215
  case 1:
3146
3216
  if (!(mutations.length > 0)) return [3 /*break*/, 7];
@@ -3190,7 +3260,7 @@ function process$2() {
3190
3260
  _d.label = 13;
3191
3261
  case 13:
3192
3262
  cleanHistory();
3193
- stop$d(timer);
3263
+ stop$e(timer);
3194
3264
  return [2 /*return*/];
3195
3265
  }
3196
3266
  });
@@ -3299,10 +3369,10 @@ function processThrottledMutations() {
3299
3369
  clearTimeout$1(throttleDelay);
3300
3370
  }
3301
3371
  throttleDelay = setTimeout$1(function () {
3302
- schedule(process$2, 1 /* Priority.High */);
3372
+ schedule$1(process$2, 1 /* Priority.High */);
3303
3373
  }, 33 /* Setting.LookAhead */);
3304
3374
  }
3305
- function schedule$1(node) {
3375
+ function schedule$2(node) {
3306
3376
  // Only schedule manual trigger for this node if it's not already in the queue
3307
3377
  if (queue$2.indexOf(node) < 0) {
3308
3378
  queue$2.push(node);
@@ -3361,7 +3431,7 @@ function proxyStyleRules(win) {
3361
3431
  win.clarityOverrides.InsertRule = win.CSSStyleSheet.prototype.insertRule;
3362
3432
  win.CSSStyleSheet.prototype.insertRule = function () {
3363
3433
  if (active()) {
3364
- schedule$1(this.ownerNode);
3434
+ schedule$2(this.ownerNode);
3365
3435
  }
3366
3436
  return win.clarityOverrides.InsertRule.apply(this, arguments);
3367
3437
  };
@@ -3370,7 +3440,7 @@ function proxyStyleRules(win) {
3370
3440
  win.clarityOverrides.MediaInsertRule = win.CSSMediaRule.prototype.insertRule;
3371
3441
  win.CSSMediaRule.prototype.insertRule = function () {
3372
3442
  if (active()) {
3373
- schedule$1(this.parentStyleSheet.ownerNode);
3443
+ schedule$2(this.parentStyleSheet.ownerNode);
3374
3444
  }
3375
3445
  return win.clarityOverrides.MediaInsertRule.apply(this, arguments);
3376
3446
  };
@@ -3379,7 +3449,7 @@ function proxyStyleRules(win) {
3379
3449
  win.clarityOverrides.DeleteRule = win.CSSStyleSheet.prototype.deleteRule;
3380
3450
  win.CSSStyleSheet.prototype.deleteRule = function () {
3381
3451
  if (active()) {
3382
- schedule$1(this.ownerNode);
3452
+ schedule$2(this.ownerNode);
3383
3453
  }
3384
3454
  return win.clarityOverrides.DeleteRule.apply(this, arguments);
3385
3455
  };
@@ -3388,7 +3458,7 @@ function proxyStyleRules(win) {
3388
3458
  win.clarityOverrides.MediaDeleteRule = win.CSSMediaRule.prototype.deleteRule;
3389
3459
  win.CSSMediaRule.prototype.deleteRule = function () {
3390
3460
  if (active()) {
3391
- schedule$1(this.parentStyleSheet.ownerNode);
3461
+ schedule$2(this.parentStyleSheet.ownerNode);
3392
3462
  }
3393
3463
  return win.clarityOverrides.MediaDeleteRule.apply(this, arguments);
3394
3464
  };
@@ -3401,7 +3471,7 @@ function proxyStyleRules(win) {
3401
3471
  try {
3402
3472
  win.Element.prototype.attachShadow = function () {
3403
3473
  if (active()) {
3404
- return schedule$1(win.clarityOverrides.AttachShadow.apply(this, arguments));
3474
+ return schedule$2(win.clarityOverrides.AttachShadow.apply(this, arguments));
3405
3475
  }
3406
3476
  else {
3407
3477
  return win.clarityOverrides.AttachShadow.apply(this, arguments);
@@ -3933,11 +4003,11 @@ var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
3933
4003
  var iframeContentMap = null; // Maps parent iframe element => iframe's contentDocument & contentWindow
3934
4004
  var privacyMap = null; // Maps node => Privacy (enum)
3935
4005
  var fraudMap = null; // Maps node => FraudId (number)
3936
- function start$l() {
4006
+ function start$m() {
3937
4007
  reset$7();
3938
4008
  parse(document, true);
3939
4009
  }
3940
- function stop$j() {
4010
+ function stop$k() {
3941
4011
  reset$7();
3942
4012
  }
3943
4013
  function reset$7() {
@@ -3968,14 +4038,14 @@ function parse(root, init) {
3968
4038
  try {
3969
4039
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3970
4040
  if (init) {
3971
- config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
4041
+ config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3972
4042
  }
3973
4043
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3974
4044
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3975
4045
  if ("querySelectorAll" in root) {
3976
- config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3977
- config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3978
- config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
4046
+ config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
4047
+ config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
4048
+ config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3979
4049
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3980
4050
  }
3981
4051
  }
@@ -4006,7 +4076,7 @@ function add$1(node, parent, data, source) {
4006
4076
  var parentValue = null;
4007
4077
  var regionId = exists(node) ? id : null;
4008
4078
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
4009
- var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4079
+ var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4010
4080
  if (parentId >= 0 && values$1[parentId]) {
4011
4081
  parentValue = values$1[parentId];
4012
4082
  parentValue.children.push(id);
@@ -4239,6 +4309,9 @@ function get(node) {
4239
4309
  function lookup(hash) {
4240
4310
  return hash in hashMap ? hashMap[hash] : null;
4241
4311
  }
4312
+ function getHashes() {
4313
+ return Object.keys(hashMap);
4314
+ }
4242
4315
  function has$1(node) {
4243
4316
  return nodesMap.has(getId$1(node));
4244
4317
  }
@@ -4310,7 +4383,7 @@ function getPreviousId(node) {
4310
4383
  function track$4(id, source, changed, parentChanged) {
4311
4384
  if (changed === void 0) { changed = true; }
4312
4385
  if (parentChanged === void 0) { parentChanged = false; }
4313
- if (config$2.lean && config$2.lite) {
4386
+ if (config$3.lean && config$3.lite) {
4314
4387
  return;
4315
4388
  }
4316
4389
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4332,7 +4405,7 @@ var regions = {};
4332
4405
  var queue$1 = [];
4333
4406
  var watch = false;
4334
4407
  var observer$1 = null;
4335
- function start$k() {
4408
+ function start$l() {
4336
4409
  reset$6();
4337
4410
  observer$1 = null;
4338
4411
  regionMap = new WeakMap();
@@ -4460,7 +4533,7 @@ function clone(r) {
4460
4533
  function reset$6() {
4461
4534
  state$2 = [];
4462
4535
  }
4463
- function stop$i() {
4536
+ function stop$j() {
4464
4537
  reset$6();
4465
4538
  regionMap = null;
4466
4539
  regions = {};
@@ -4717,7 +4790,7 @@ function encode$4 (type, ts) {
4717
4790
 
4718
4791
  var state$1 = [];
4719
4792
  var updates$1 = [];
4720
- function start$j() {
4793
+ function start$k() {
4721
4794
  state$1 = [];
4722
4795
  reset$5();
4723
4796
  }
@@ -4764,7 +4837,7 @@ function compute$5() {
4764
4837
  state$1 = temp; // Drop events less than the min time
4765
4838
  encode$4(22 /* Event.Timeline */);
4766
4839
  }
4767
- function stop$h() {
4840
+ function stop$i() {
4768
4841
  state$1 = [];
4769
4842
  reset$5();
4770
4843
  }
@@ -4908,14 +4981,14 @@ function add(node, parent, data) {
4908
4981
  var stopCallbacks = [];
4909
4982
  var active$2 = false;
4910
4983
  var modules$1 = null;
4911
- function start$i() {
4984
+ function start$j() {
4912
4985
  active$2 = true;
4913
4986
  modules$1 = new Set();
4914
- if (config$2.modules && config$2.modules.length > 0) {
4915
- config$2.modules.forEach(function (m) { event(m); });
4987
+ if (config$3.modules && config$3.modules.length > 0) {
4988
+ config$3.modules.forEach(function (m) { event(m); });
4916
4989
  }
4917
4990
  }
4918
- function stop$g() {
4991
+ function stop$h() {
4919
4992
  stopCallbacks.reverse().forEach(function (callback) {
4920
4993
  try {
4921
4994
  callback();
@@ -4967,8 +5040,8 @@ var dynamic = /*#__PURE__*/Object.freeze({
4967
5040
  __proto__: null,
4968
5041
  event: event,
4969
5042
  register: register,
4970
- start: start$i,
4971
- stop: stop$g
5043
+ start: start$j,
5044
+ stop: stop$h
4972
5045
  });
4973
5046
 
4974
5047
  var discoverBytes = 0;
@@ -4980,12 +5053,14 @@ var transit;
4980
5053
  var active$1;
4981
5054
  var queuedTime = 0;
4982
5055
  var leanLimit = false;
5056
+ var hasGemxPayload = false;
4983
5057
  var track$1;
4984
- function start$h() {
5058
+ function start$i() {
4985
5059
  active$1 = true;
4986
5060
  discoverBytes = 0;
4987
5061
  playbackBytes = 0;
4988
5062
  leanLimit = false;
5063
+ hasGemxPayload = false;
4989
5064
  queuedTime = 0;
4990
5065
  playback = [];
4991
5066
  analysis = [];
@@ -5000,7 +5075,7 @@ function queue(tokens, transmit) {
5000
5075
  var now = time();
5001
5076
  var type = tokens.length > 1 ? tokens[1] : null;
5002
5077
  var event = JSON.stringify(tokens);
5003
- if (!config$2.lean) {
5078
+ if (!config$3.lean) {
5004
5079
  leanLimit = false;
5005
5080
  }
5006
5081
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -5012,6 +5087,10 @@ function queue(tokens, transmit) {
5012
5087
  if (leanLimit) {
5013
5088
  break;
5014
5089
  }
5090
+ if (isActive()) {
5091
+ hold(tokens, event.length);
5092
+ break; // only gemxPlayback, not playback
5093
+ }
5015
5094
  discoverBytes += event.length;
5016
5095
  case 37 /* Event.Box */:
5017
5096
  case 6 /* Event.Mutation */:
@@ -5023,6 +5102,9 @@ function queue(tokens, transmit) {
5023
5102
  if (leanLimit) {
5024
5103
  break;
5025
5104
  }
5105
+ if (isActive()) {
5106
+ hold(tokens, event.length); // also gemxPlayback, no break
5107
+ }
5026
5108
  playbackBytes += event.length;
5027
5109
  playback.push(event);
5028
5110
  break;
@@ -5052,7 +5134,7 @@ function queue(tokens, transmit) {
5052
5134
  check$2(playbackBytes);
5053
5135
  }
5054
5136
  }
5055
- function flush() {
5137
+ function flush$1() {
5056
5138
  if (!active$1) {
5057
5139
  return;
5058
5140
  }
@@ -5060,7 +5142,30 @@ function flush() {
5060
5142
  timeout = null;
5061
5143
  upload(true);
5062
5144
  }
5063
- function stop$f() {
5145
+ // Trigger an immediate non-beacon upload (used by gemx-discover after inject).
5146
+ // Unlike flush(), this does NOT set final=true, so playback data is never stripped.
5147
+ function uploadNow() {
5148
+ if (!active$1) {
5149
+ return;
5150
+ }
5151
+ clearTimeout$1(timeout);
5152
+ timeout = null;
5153
+ upload(false);
5154
+ }
5155
+ // Inject pre-buffered tokens directly into playback as discover events.
5156
+ // Used by gemx-discover when trigger fires: all buffered Discover tokens are
5157
+ // counted towards discoverBytes so upload uses MinUploadDelay (fast path).
5158
+ function inject(buffered) {
5159
+ hasGemxPayload = true;
5160
+ for (var _i = 0, buffered_1 = buffered; _i < buffered_1.length; _i++) {
5161
+ var tokens = buffered_1[_i];
5162
+ var e = JSON.stringify(tokens);
5163
+ discoverBytes += e.length;
5164
+ playbackBytes += e.length;
5165
+ playback.push(e);
5166
+ }
5167
+ }
5168
+ function stop$g() {
5064
5169
  clearTimeout$1(timeout);
5065
5170
  upload(true);
5066
5171
  discoverBytes = 0;
@@ -5084,7 +5189,7 @@ function upload(final) {
5084
5189
  return [2 /*return*/];
5085
5190
  }
5086
5191
  timeout = null;
5087
- sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5192
+ sendPlaybackBytes = (hasGemxPayload || config$3.lean === false) && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5088
5193
  if (sendPlaybackBytes) {
5089
5194
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
5090
5195
  }
@@ -5125,6 +5230,7 @@ function upload(final) {
5125
5230
  playbackBytes = 0;
5126
5231
  discoverBytes = 0;
5127
5232
  leanLimit = false;
5233
+ hasGemxPayload = false;
5128
5234
  }
5129
5235
  return [2 /*return*/];
5130
5236
  }
@@ -5137,8 +5243,8 @@ function stringify(encoded) {
5137
5243
  function send(payload, zipped, sequence, beacon) {
5138
5244
  if (beacon === void 0) { beacon = false; }
5139
5245
  // Upload data if a valid URL is defined in the config
5140
- if (typeof config$2.upload === "string" /* Constant.String */) {
5141
- var url_1 = config$2.upload;
5246
+ if (typeof config$3.upload === "string" /* Constant.String */) {
5247
+ var url_1 = config$3.upload;
5142
5248
  var dispatched = false;
5143
5249
  // If it's the last payload, attempt to upload using sendBeacon first.
5144
5250
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5189,9 +5295,10 @@ function send(payload, zipped, sequence, beacon) {
5189
5295
  }
5190
5296
  }
5191
5297
  }
5192
- else if (config$2.upload) {
5193
- var callback = config$2.upload;
5194
- callback(payload);
5298
+ else if (config$3.upload) {
5299
+ var callback = config$3.upload;
5300
+ var uploadType = hasGemxPayload ? "gemx-discover" : undefined;
5301
+ callback(payload, uploadType);
5195
5302
  done(sequence);
5196
5303
  }
5197
5304
  }
@@ -5212,7 +5319,7 @@ function check$3(xhr, sequence) {
5212
5319
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5213
5320
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5214
5321
  if (xhr.status === 0) {
5215
- config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
5322
+ config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
5216
5323
  }
5217
5324
  // Capture the status code and number of attempts so we can report it back to the server
5218
5325
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5259,8 +5366,8 @@ function done(sequence) {
5259
5366
  function delay() {
5260
5367
  // Progressively increase delay as we continue to send more payloads from the client to the server
5261
5368
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5262
- var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5263
- return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
5369
+ var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
5370
+ return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
5264
5371
  }
5265
5372
  function response(payload) {
5266
5373
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5278,8 +5385,8 @@ function response(payload) {
5278
5385
  break;
5279
5386
  case "ACTION" /* Constant.Action */:
5280
5387
  // Invoke action callback, if configured and has a valid value
5281
- if (config$2.action && parts.length > 1) {
5282
- config$2.action(parts[1]);
5388
+ if (config$3.action && parts.length > 1) {
5389
+ config$3.action(parts[1]);
5283
5390
  }
5284
5391
  break;
5285
5392
  case "EXTRACT" /* Constant.Extract */:
@@ -5298,7 +5405,7 @@ function response(payload) {
5298
5405
  }
5299
5406
  break;
5300
5407
  case "SNAPSHOT" /* Constant.Snapshot */:
5301
- config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5408
+ config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
5302
5409
  snapshot();
5303
5410
  break;
5304
5411
  }
@@ -5307,7 +5414,7 @@ function response(payload) {
5307
5414
 
5308
5415
  var history$3 = {};
5309
5416
  var data$8;
5310
- function start$g() {
5417
+ function start$h() {
5311
5418
  bind(window, "error", handler);
5312
5419
  history$3 = {};
5313
5420
  }
@@ -5375,7 +5482,7 @@ function encode$2 (type) {
5375
5482
 
5376
5483
  var history$2 = {};
5377
5484
  var data$7;
5378
- function start$f() {
5485
+ function start$g() {
5379
5486
  history$2 = {};
5380
5487
  }
5381
5488
  function log$1(code, severity, name, message, stack) {
@@ -5398,7 +5505,7 @@ function log$1(code, severity, name, message, stack) {
5398
5505
  }
5399
5506
  encode$2(33 /* Event.Log */);
5400
5507
  }
5401
- function stop$e() {
5508
+ function stop$f() {
5402
5509
  history$2 = {};
5403
5510
  }
5404
5511
 
@@ -5431,7 +5538,7 @@ function reset$4() {
5431
5538
  activeTask = null;
5432
5539
  pauseTask = null;
5433
5540
  }
5434
- function schedule(task, priority) {
5541
+ function schedule$1(task, priority) {
5435
5542
  if (priority === void 0) { priority = 0 /* Priority.Normal */; }
5436
5543
  return __awaiter(this, void 0, void 0, function () {
5437
5544
  var _i, queuedTasks_1, q, promise;
@@ -5495,7 +5602,7 @@ function state(timer) {
5495
5602
  // If this task is no longer being tracked, send stop message to the caller
5496
5603
  return 2 /* Task.Stop */;
5497
5604
  }
5498
- function start$e(timer) {
5605
+ function start$f(timer) {
5499
5606
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
5500
5607
  }
5501
5608
  function restart$2(timer) {
@@ -5503,12 +5610,12 @@ function restart$2(timer) {
5503
5610
  if (tracker && tracker[id]) {
5504
5611
  var c = tracker[id].calls;
5505
5612
  var y = tracker[id].yield;
5506
- start$e(timer);
5613
+ start$f(timer);
5507
5614
  tracker[id].calls = c + 1;
5508
5615
  tracker[id].yield = y;
5509
5616
  }
5510
5617
  }
5511
- function stop$d(timer) {
5618
+ function stop$e(timer) {
5512
5619
  var end = performance.now();
5513
5620
  var id = key(timer);
5514
5621
  var duration = end - tracker[id].start;
@@ -5529,7 +5636,7 @@ function suspend$1(timer) {
5529
5636
  case 0:
5530
5637
  id = key(timer);
5531
5638
  if (!(id in tracker)) return [3 /*break*/, 2];
5532
- stop$d(timer);
5639
+ stop$e(timer);
5533
5640
  // some customer polyfills for requestIdleCallback return null
5534
5641
  _b = tracker[id];
5535
5642
  return [4 /*yield*/, wait()];
@@ -5600,8 +5707,8 @@ function requestIdleCallbackPolyfill(callback, options) {
5600
5707
  }
5601
5708
  var requestIdleCallback = window["requestIdleCallback"] || requestIdleCallbackPolyfill;
5602
5709
 
5603
- function start$d() {
5604
- schedule(discover, 1 /* Priority.High */).then(function () {
5710
+ function start$e() {
5711
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
5605
5712
  measure(compute$7)();
5606
5713
  measure(compute$6)();
5607
5714
  measure(compute$a)();
@@ -5615,7 +5722,7 @@ function discover() {
5615
5722
  case 0:
5616
5723
  ts = time();
5617
5724
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
5618
- start$e(timer);
5725
+ start$f(timer);
5619
5726
  return [4 /*yield*/, traverse$1(document, timer, 0 /* Source.Discover */, ts)];
5620
5727
  case 1:
5621
5728
  _a.sent();
@@ -5623,7 +5730,7 @@ function discover() {
5623
5730
  return [4 /*yield*/, encode$5(5 /* Event.Discover */, timer, ts)];
5624
5731
  case 2:
5625
5732
  _a.sent();
5626
- stop$d(timer);
5733
+ stop$e(timer);
5627
5734
  return [2 /*return*/];
5628
5735
  }
5629
5736
  });
@@ -5631,9 +5738,9 @@ function discover() {
5631
5738
  }
5632
5739
 
5633
5740
  var data$6 = null;
5634
- function start$c() {
5635
- if (!config$2.lean && config$2.upgrade) {
5636
- config$2.upgrade("Config" /* Constant.Config */);
5741
+ function start$d() {
5742
+ if (!config$3.lean && config$3.upgrade) {
5743
+ config$3.upgrade("Config" /* Constant.Config */);
5637
5744
  }
5638
5745
  data$6 = null;
5639
5746
  }
@@ -5643,24 +5750,24 @@ function start$c() {
5643
5750
  // and send all backed up layout events to the server.
5644
5751
  function upgrade(key) {
5645
5752
  // Upgrade only if Clarity was successfully activated on the page
5646
- if (active() && config$2.lean) {
5647
- config$2.lean = false;
5753
+ if (active() && config$3.lean) {
5754
+ config$3.lean = false;
5648
5755
  data$6 = { key: key };
5649
5756
  // Update metadata to track we have upgraded this session
5650
5757
  callback();
5651
5758
  save();
5652
5759
  // Callback upgrade handler, if configured
5653
- if (config$2.upgrade) {
5654
- config$2.upgrade(key);
5760
+ if (config$3.upgrade) {
5761
+ config$3.upgrade(key);
5655
5762
  }
5656
5763
  encode$1(3 /* Event.Upgrade */);
5657
- if (config$2.lite) {
5658
- start$d();
5659
- start$q();
5764
+ if (config$3.lite) {
5765
+ start$e();
5766
+ start$r();
5660
5767
  }
5661
5768
  }
5662
5769
  }
5663
- function stop$c() {
5770
+ function stop$d() {
5664
5771
  data$6 = null;
5665
5772
  }
5666
5773
 
@@ -5809,7 +5916,7 @@ function encode$1 (event) {
5809
5916
  }
5810
5917
 
5811
5918
  var data$5;
5812
- function start$b() {
5919
+ function start$c() {
5813
5920
  data$5 = { check: 0 /* Check.None */ };
5814
5921
  }
5815
5922
  function check$2(bytes) {
@@ -5837,19 +5944,19 @@ function compute$4() {
5837
5944
  encode$1(35 /* Event.Limit */);
5838
5945
  }
5839
5946
  }
5840
- function stop$b() {
5947
+ function stop$c() {
5841
5948
  data$5 = null;
5842
5949
  }
5843
5950
 
5844
5951
  var data$4 = null;
5845
5952
  var updates = null;
5846
5953
  var limited = false;
5847
- function start$a() {
5954
+ function start$b() {
5848
5955
  data$4 = {};
5849
5956
  updates = {};
5850
5957
  limited = false;
5851
5958
  }
5852
- function stop$a() {
5959
+ function stop$b() {
5853
5960
  data$4 = {};
5854
5961
  updates = {};
5855
5962
  limited = false;
@@ -5891,7 +5998,7 @@ function reset$3() {
5891
5998
 
5892
5999
  var data$3 = null;
5893
6000
  var updateConsent = true;
5894
- function start$9() {
6001
+ function start$a() {
5895
6002
  var _a;
5896
6003
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5897
6004
  updateConsent = true;
@@ -5899,7 +6006,7 @@ function start$9() {
5899
6006
  ics.addListener(["ad_storage" /* Constant.AdStorage */, "analytics_storage" /* Constant.AnalyticsStorage */], processConsent);
5900
6007
  }
5901
6008
  }
5902
- function stop$9() {
6009
+ function stop$a() {
5903
6010
  updateConsent = true;
5904
6011
  }
5905
6012
  function processConsent() {
@@ -5948,7 +6055,7 @@ function compute$2() {
5948
6055
  if (updateConsent) {
5949
6056
  encode$1(47 /* Event.Consent */);
5950
6057
  updateConsent = false;
5951
- if (!config$2.track) {
6058
+ if (!config$3.track) {
5952
6059
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5953
6060
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5954
6061
  processConsent();
@@ -5963,7 +6070,7 @@ var electron = 0 /* BooleanFlag.False */;
5963
6070
  var consentStatus = null;
5964
6071
  var cookiesLogged = false;
5965
6072
  var defaultStatus = { source: 7 /* ConsentSource.Default */, ad_Storage: "denied" /* Constant.Denied */, analytics_Storage: "denied" /* Constant.Denied */ };
5966
- function start$8() {
6073
+ function start$9() {
5967
6074
  var _a, _b, _c;
5968
6075
  var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
5969
6076
  var timezone = (_c = (typeof Intl !== 'undefined' && ((_b = (_a = Intl === null || Intl === void 0 ? void 0 : Intl.DateTimeFormat()) === null || _a === void 0 ? void 0 : _a.resolvedOptions()) === null || _b === void 0 ? void 0 : _b.timeZone))) !== null && _c !== void 0 ? _c : '';
@@ -5974,13 +6081,13 @@ function start$8() {
5974
6081
  // Populate ids for this page
5975
6082
  var s = session();
5976
6083
  var u = user();
5977
- var projectId = config$2.projectId || hash(location.host);
5978
- var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5979
- var sessionId = config$2.externalSession && config$2.sessionId ? config$2.sessionId : s.session;
6084
+ var projectId = config$3.projectId || hash(location.host);
6085
+ var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
6086
+ var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5980
6087
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5981
6088
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5982
- config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5983
- config$2.upload = config$2.track && typeof config$2.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$2.upload;
6089
+ config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
6090
+ config$3.upload = config$3.track && typeof config$3.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$3.upload;
5984
6091
  // Log page metadata as dimensions
5985
6092
  log(0 /* Dimension.UserAgent */, ua);
5986
6093
  log(3 /* Dimension.PageTitle */, title);
@@ -6022,15 +6129,15 @@ function start$8() {
6022
6129
  if (consentStatus === null) {
6023
6130
  consentStatus = {
6024
6131
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
6025
- ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6026
- analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6132
+ ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6133
+ analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6027
6134
  };
6028
6135
  }
6029
6136
  logCookies();
6030
6137
  var consent = getConsentData(consentStatus);
6031
6138
  config$1(consent);
6032
6139
  // Track ids using a cookie if configuration allows it, skip if using external session
6033
- if (!config$2.externalSession) {
6140
+ if (!config$3.externalSession) {
6034
6141
  track(u);
6035
6142
  }
6036
6143
  }
@@ -6055,7 +6162,7 @@ function logCookies() {
6055
6162
  if (cookiesLogged || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.analytics_Storage) !== "granted" /* Constant.Granted */ || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_Storage) !== "granted" /* Constant.Granted */) {
6056
6163
  return;
6057
6164
  }
6058
- for (var _i = 0, _a = config$2.cookies; _i < _a.length; _i++) {
6165
+ for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
6059
6166
  var key = _a[_i];
6060
6167
  var value = getCookie(key);
6061
6168
  if (value) {
@@ -6064,7 +6171,7 @@ function logCookies() {
6064
6171
  }
6065
6172
  cookiesLogged = true;
6066
6173
  }
6067
- function stop$8() {
6174
+ function stop$9() {
6068
6175
  data$2 = null;
6069
6176
  // Reset cookiesLogged so cookies are re-logged on restart. Each session generates new metadata
6070
6177
  // (sessionId, pageNum), and cookie values need to be recorded in the new session's data stream.
@@ -6075,14 +6182,14 @@ function metadata(cb, wait, recall, consentInfo) {
6075
6182
  if (wait === void 0) { wait = true; }
6076
6183
  if (recall === void 0) { recall = false; }
6077
6184
  if (consentInfo === void 0) { consentInfo = false; }
6078
- var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6185
+ var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6079
6186
  var called = false;
6080
6187
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
6081
6188
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
6082
6189
  // we go through the upgrading flow.
6083
6190
  if (data$2 && (upgraded || wait === false)) {
6084
6191
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
6085
- cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
6192
+ cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
6086
6193
  called = true;
6087
6194
  }
6088
6195
  if (recall || !called) {
@@ -6125,15 +6232,15 @@ function consentv2(consentState, source) {
6125
6232
  consentStatus = updatedStatus;
6126
6233
  callback(true);
6127
6234
  var consentData = getConsentData(consentStatus);
6128
- if (!consentData.analytics_Storage && config$2.track) {
6129
- config$2.track = false;
6235
+ if (!consentData.analytics_Storage && config$3.track) {
6236
+ config$3.track = false;
6130
6237
  clear(true);
6131
6238
  stop();
6132
6239
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
6133
6240
  return;
6134
6241
  }
6135
6242
  if (active() && consentData.analytics_Storage) {
6136
- config$2.track = true;
6243
+ config$3.track = true;
6137
6244
  track(user(), 1 /* BooleanFlag.True */);
6138
6245
  save();
6139
6246
  }
@@ -6165,7 +6272,7 @@ function clear(all) {
6165
6272
  }
6166
6273
  function tab() {
6167
6274
  var id = shortid();
6168
- if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6275
+ if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6169
6276
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
6170
6277
  id = value ? value : id;
6171
6278
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -6174,15 +6281,15 @@ function tab() {
6174
6281
  }
6175
6282
  function callback(consentUpdate) {
6176
6283
  if (consentUpdate === void 0) { consentUpdate = false; }
6177
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6284
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6178
6285
  processCallback(upgrade, consentUpdate);
6179
6286
  }
6180
6287
  function save() {
6181
- if (!data$2 || !config$2.track || config$2.externalSession)
6288
+ if (!data$2 || !config$3.track || config$3.externalSession)
6182
6289
  return;
6183
6290
  var ts = Math.round(Date.now());
6184
- var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6185
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6291
+ var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6292
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6186
6293
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6187
6294
  }
6188
6295
  function processCallback(upgrade, consentUpdate) {
@@ -6193,7 +6300,7 @@ function processCallback(upgrade, consentUpdate) {
6193
6300
  if (cb.callback &&
6194
6301
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6195
6302
  (!cb.wait || upgrade)) {
6196
- cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6303
+ cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6197
6304
  cb.called = true;
6198
6305
  if (!cb.recall) {
6199
6306
  callbacks.splice(i, 1);
@@ -6211,7 +6318,7 @@ function track(u, consent) {
6211
6318
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6212
6319
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6213
6320
  // If DOB is not set in the user object, use the date set in the config as a DOB
6214
- var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
6321
+ var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
6215
6322
  // To avoid cookie churn, write user id cookie only once every day
6216
6323
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6217
6324
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6227,7 +6334,7 @@ function shortid() {
6227
6334
  }
6228
6335
  function session() {
6229
6336
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6230
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6337
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6231
6338
  if (value) {
6232
6339
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6233
6340
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6248,7 +6355,7 @@ function num(string, base) {
6248
6355
  }
6249
6356
  function user() {
6250
6357
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6251
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6358
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6252
6359
  if (cookie && cookie.length > 0) {
6253
6360
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6254
6361
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6268,15 +6375,15 @@ function user() {
6268
6375
  output.dob = num(parts[4]);
6269
6376
  }
6270
6377
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6271
- config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6378
+ config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6272
6379
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6273
- output.id = config$2.track ? parts[0] : output.id;
6380
+ output.id = config$3.track ? parts[0] : output.id;
6274
6381
  }
6275
6382
  return output;
6276
6383
  }
6277
6384
 
6278
6385
  var data$1 = null;
6279
- function start$7() {
6386
+ function start$8() {
6280
6387
  var m = data$2;
6281
6388
  data$1 = {
6282
6389
  version: version$1,
@@ -6293,7 +6400,7 @@ function start$7() {
6293
6400
  url: ''
6294
6401
  };
6295
6402
  }
6296
- function stop$7() {
6403
+ function stop$8() {
6297
6404
  data$1 = null;
6298
6405
  }
6299
6406
  function envelope(last) {
@@ -6327,7 +6434,7 @@ function reset$2() {
6327
6434
  function report(e) {
6328
6435
  // Do not report the same message twice for the same page
6329
6436
  if (history$1 && history$1.indexOf(e.message) === -1) {
6330
- var url = config$2.report;
6437
+ var url = config$3.report;
6331
6438
  if (url && url.length > 0 && data$1) {
6332
6439
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6333
6440
  if (e.message) {
@@ -6418,7 +6525,7 @@ var pushState = null;
6418
6525
  var replaceState = null;
6419
6526
  var url = null;
6420
6527
  var count = 0;
6421
- function start$6() {
6528
+ function start$7() {
6422
6529
  url = getCurrentUrl();
6423
6530
  count = 0;
6424
6531
  bind(window, "popstate", compute$1);
@@ -6479,26 +6586,26 @@ function restart$1() {
6479
6586
  function getCurrentUrl() {
6480
6587
  return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
6481
6588
  }
6482
- function stop$6() {
6589
+ function stop$7() {
6483
6590
  url = null;
6484
6591
  count = 0;
6485
6592
  }
6486
6593
 
6487
6594
  var status = false;
6488
- function start$5() {
6595
+ function start$6() {
6489
6596
  status = true;
6490
- start$P();
6597
+ start$R();
6491
6598
  reset$4();
6492
6599
  reset$1();
6493
6600
  reset$2();
6494
- start$6();
6601
+ start$7();
6495
6602
  }
6496
- function stop$5() {
6497
- stop$6();
6603
+ function stop$6() {
6604
+ stop$7();
6498
6605
  reset$2();
6499
6606
  reset$1();
6500
6607
  reset$4();
6501
- stop$M();
6608
+ stop$O();
6502
6609
  status = false;
6503
6610
  }
6504
6611
  function active() {
@@ -6526,8 +6633,8 @@ function config(override) {
6526
6633
  return false;
6527
6634
  }
6528
6635
  for (var key in override) {
6529
- if (key in config$2) {
6530
- config$2[key] = override[key];
6636
+ if (key in config$3) {
6637
+ config$3[key] = override[key];
6531
6638
  }
6532
6639
  }
6533
6640
  return true;
@@ -6553,51 +6660,111 @@ function restart() {
6553
6660
  event$1("clarityGemX" /* Constant.Clarity */, "restart" /* Constant.Restart */);
6554
6661
  }
6555
6662
 
6556
- function start$4() {
6557
- start$F();
6663
+ function start$5() {
6664
+ start$G();
6665
+ start$h();
6558
6666
  start$g();
6559
- start$f();
6560
6667
  }
6561
- function stop$4() {
6562
- stop$e();
6668
+ function stop$5() {
6669
+ stop$f();
6563
6670
  }
6564
6671
 
6565
6672
  var diagnostic = /*#__PURE__*/Object.freeze({
6566
6673
  __proto__: null,
6567
- start: start$4,
6568
- stop: stop$4
6674
+ start: start$5,
6675
+ stop: stop$5
6569
6676
  });
6570
6677
 
6678
+ // Called from layout/index.ts before discover.start().
6679
+ // Activates the upload buffer so Event.Discover is held until trigger fires.
6680
+ // discover.start() runs traverse immediately — click/scroll tracking gets valid node ids.
6681
+ function start$4() {
6682
+ var discoverTrigger = get$2().discoverTrigger;
6683
+ if (!discoverTrigger) {
6684
+ return;
6685
+ }
6686
+ config$2(discoverTrigger.maxPlaybackBytes, fire);
6687
+ schedule(discoverTrigger);
6688
+ }
6689
+ function stop$4() {
6690
+ stop$F();
6691
+ }
6692
+ var triggered = false;
6693
+ function fire() {
6694
+ if (triggered) {
6695
+ return;
6696
+ }
6697
+ triggered = true;
6698
+ if (window.GemXHeatmap) {
6699
+ var hashes = getHashes();
6700
+ window.GemXHeatmap.__domSnapshot = hashes;
6701
+ }
6702
+ onTrustedClick(null);
6703
+ onTrustedScroll(null);
6704
+ flush();
6705
+ }
6706
+ function schedule(trigger) {
6707
+ triggered = false;
6708
+ var clickCount = 0;
6709
+ if (trigger.scrollDepthPercent) {
6710
+ onTrustedScroll(function () {
6711
+ var scrolled = window.scrollY + window.innerHeight;
6712
+ var total = document.documentElement.scrollHeight;
6713
+ if ((scrolled / total) * 100 >= trigger.scrollDepthPercent) {
6714
+ fire();
6715
+ }
6716
+ });
6717
+ }
6718
+ if (trigger.clickCount) {
6719
+ onTrustedClick(function () {
6720
+ clickCount++;
6721
+ if (clickCount >= trigger.clickCount) {
6722
+ fire();
6723
+ }
6724
+ });
6725
+ }
6726
+ if (trigger.activeTimeMs) {
6727
+ setTimeout(fire, trigger.activeTimeMs);
6728
+ }
6729
+ // maxPlaybackBytes trigger is handled via gemxUpload.start() callback above
6730
+ }
6731
+ function flush() {
6732
+ inject(drain());
6733
+ uploadNow();
6734
+ }
6735
+
6571
6736
  function start$3() {
6572
6737
  // The order below is important
6573
6738
  // and is determined by interdependencies of modules
6574
- start$n();
6575
- start$k();
6739
+ start$o();
6576
6740
  start$l();
6577
- if (config$2.delayDom) {
6741
+ start$m();
6742
+ if (config$3.delayDom) {
6578
6743
  // Lazy load layout module as part of page load time performance improvements experiment
6579
6744
  bind(window, 'load', function () {
6580
- start$m();
6745
+ start$n();
6581
6746
  });
6582
6747
  }
6583
6748
  else {
6584
- start$m();
6749
+ start$n();
6585
6750
  }
6586
6751
  // IMPORTANT: Start custom element detection BEFORE discover
6587
6752
  // This ensures pre-existing custom elements are registered before DOM traversal
6588
- start$o();
6589
- start$d();
6590
- start$q();
6591
6753
  start$p();
6754
+ start$4(); // activates upload buffer before discover traverses
6755
+ start$e();
6756
+ start$r();
6757
+ start$q();
6592
6758
  }
6593
6759
  function stop$3() {
6594
- stop$i();
6595
6760
  stop$j();
6596
6761
  stop$k();
6597
6762
  stop$l();
6763
+ stop$m();
6764
+ stop$p();
6598
6765
  stop$o();
6599
6766
  stop$n();
6600
- stop$m();
6767
+ stop$4();
6601
6768
  }
6602
6769
 
6603
6770
  var layout = /*#__PURE__*/Object.freeze({
@@ -6825,7 +6992,7 @@ function process(entries) {
6825
6992
  case "resource" /* Constant.Resource */:
6826
6993
  var name_1 = entry.name;
6827
6994
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6828
- if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6995
+ if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6829
6996
  max(28 /* Metric.UploadTime */, entry.duration);
6830
6997
  }
6831
6998
  break;
@@ -6900,8 +7067,8 @@ function start(config$1) {
6900
7067
  // Check that browser supports required APIs and we do not attempt to start Clarity multiple times
6901
7068
  if (check()) {
6902
7069
  config(config$1);
6903
- start$5();
6904
- start$G();
7070
+ start$6();
7071
+ start$H();
6905
7072
  modules.forEach(function (x) { return measure(x.start)(); });
6906
7073
  // If it's an internal call to start, without explicit configuration,
6907
7074
  // re-process any newly accumulated items in the queue
@@ -6932,8 +7099,8 @@ function stop() {
6932
7099
  if (active()) {
6933
7100
  // Stop modules in the reverse order of their initialization and start queuing up items again
6934
7101
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6935
- stop$D();
6936
- stop$5();
7102
+ stop$E();
7103
+ stop$6();
6937
7104
  setup();
6938
7105
  }
6939
7106
  }