@gemx-dev/clarity-js 0.8.85 → 0.8.87

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.
@@ -2,6 +2,7 @@ var dom = /*#__PURE__*/Object.freeze({
2
2
  __proto__: null,
3
3
  get add () { return add$1; },
4
4
  get get () { return get; },
5
+ get getHashes () { return getHashes; },
5
6
  get getId () { return getId$1; },
6
7
  get getNode () { return getNode; },
7
8
  get getValue () { return getValue; },
@@ -13,8 +14,8 @@ var dom = /*#__PURE__*/Object.freeze({
13
14
  get parse () { return parse; },
14
15
  get removeIFrame () { return removeIFrame; },
15
16
  get sameorigin () { return sameorigin; },
16
- get start () { return start$l; },
17
- get stop () { return stop$j; },
17
+ get start () { return start$m; },
18
+ get stop () { return stop$k; },
18
19
  get update () { return update; },
19
20
  get updates () { return updates$2; }
20
21
  });
@@ -22,24 +23,26 @@ var timeline = /*#__PURE__*/Object.freeze({
22
23
  __proto__: null,
23
24
  get compute () { return compute$5; },
24
25
  get reset () { return reset$5; },
25
- get start () { return start$j; },
26
- get stop () { return stop$h; },
26
+ get start () { return start$k; },
27
+ get stop () { return stop$i; },
27
28
  get track () { return track$2; },
28
29
  get updates () { return updates$1; }
29
30
  });
30
31
  var upload$1 = /*#__PURE__*/Object.freeze({
31
32
  __proto__: null,
32
- get flush () { return flush; },
33
+ get flush () { return flush$1; },
34
+ get inject () { return inject; },
33
35
  get queue () { return queue; },
34
- get start () { return start$h; },
35
- get stop () { return stop$f; },
36
- get track () { return track$1; }
36
+ get start () { return start$i; },
37
+ get stop () { return stop$g; },
38
+ get track () { return track$1; },
39
+ get uploadNow () { return uploadNow; }
37
40
  });
38
41
  var upgrade$1 = /*#__PURE__*/Object.freeze({
39
42
  __proto__: null,
40
43
  get data () { return data$6; },
41
- get start () { return start$c; },
42
- get stop () { return stop$c; },
44
+ get start () { return start$d; },
45
+ get stop () { return stop$d; },
43
46
  get upgrade () { return upgrade; }
44
47
  });
45
48
  var limit = /*#__PURE__*/Object.freeze({
@@ -47,8 +50,8 @@ var limit = /*#__PURE__*/Object.freeze({
47
50
  get check () { return check$2; },
48
51
  get compute () { return compute$4; },
49
52
  get data () { return data$5; },
50
- get start () { return start$b; },
51
- get stop () { return stop$b; },
53
+ get start () { return start$c; },
54
+ get stop () { return stop$c; },
52
55
  get trigger () { return trigger; }
53
56
  });
54
57
  var dimension = /*#__PURE__*/Object.freeze({
@@ -57,8 +60,8 @@ var dimension = /*#__PURE__*/Object.freeze({
57
60
  get data () { return data$4; },
58
61
  get log () { return log; },
59
62
  get reset () { return reset$3; },
60
- get start () { return start$a; },
61
- get stop () { return stop$a; },
63
+ get start () { return start$b; },
64
+ get stop () { return stop$b; },
62
65
  get updates () { return updates; }
63
66
  });
64
67
  var consent$2 = /*#__PURE__*/Object.freeze({
@@ -67,8 +70,8 @@ var consent$2 = /*#__PURE__*/Object.freeze({
67
70
  get config () { return config$1; },
68
71
  get consent () { return consent$1; },
69
72
  get data () { return data$3; },
70
- get start () { return start$9; },
71
- get stop () { return stop$9; },
73
+ get start () { return start$a; },
74
+ get stop () { return stop$a; },
72
75
  get trackConsentv2 () { return trackConsentv2; }
73
76
  });
74
77
  var metadata$1 = /*#__PURE__*/Object.freeze({
@@ -84,15 +87,15 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
84
87
  get metadata () { return metadata; },
85
88
  get save () { return save; },
86
89
  get shortid () { return shortid; },
87
- get start () { return start$8; },
88
- get stop () { return stop$8; }
90
+ get start () { return start$9; },
91
+ get stop () { return stop$9; }
89
92
  });
90
93
  var envelope$1 = /*#__PURE__*/Object.freeze({
91
94
  __proto__: null,
92
95
  get data () { return data$1; },
93
96
  get envelope () { return envelope; },
94
- get start () { return start$7; },
95
- get stop () { return stop$7; }
97
+ get start () { return start$8; },
98
+ get stop () { return stop$8; }
96
99
  });
97
100
  var clarity = /*#__PURE__*/Object.freeze({
98
101
  __proto__: null,
@@ -109,7 +112,7 @@ var clarity = /*#__PURE__*/Object.freeze({
109
112
  get queue () { return queue; },
110
113
  get register () { return register; },
111
114
  get resume () { return resume; },
112
- get schedule () { return schedule; },
115
+ get schedule () { return schedule$1; },
113
116
  get set () { return set$1; },
114
117
  get signal () { return signal; },
115
118
  get start () { return start; },
@@ -157,7 +160,7 @@ function process$8() {
157
160
  }
158
161
  }
159
162
 
160
- var config$2 = {
163
+ var config$3 = {
161
164
  projectId: null,
162
165
  delay: 1 * 1000 /* Time.Second */,
163
166
  lean: false,
@@ -186,6 +189,7 @@ var config$2 = {
186
189
  externalSession: false,
187
190
  userId: null,
188
191
  sessionId: null,
192
+ mode: "gemx",
189
193
  };
190
194
 
191
195
  function api(method) {
@@ -199,7 +203,7 @@ var startTime = 0;
199
203
  function computeStartTime() {
200
204
  return performance.now() + performance.timeOrigin;
201
205
  }
202
- function start$P() {
206
+ function start$R() {
203
207
  startTime = computeStartTime();
204
208
  }
205
209
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -215,11 +219,11 @@ function time(event) {
215
219
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
216
220
  return Math.max(Math.round(ts + origin - baseline), 0);
217
221
  }
218
- function stop$M() {
222
+ function stop$O() {
219
223
  startTime = 0;
220
224
  }
221
225
 
222
- var version$1 = "0.8.85";
226
+ var version$1 = "0.8.87";
223
227
 
224
228
  // tslint:disable: no-bitwise
225
229
  function hash (input, precision) {
@@ -339,7 +343,7 @@ function url$1(input, electron, truncate) {
339
343
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
340
344
  }
341
345
  else {
342
- var drop_1 = config$2.drop;
346
+ var drop_1 = config$3.drop;
343
347
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
344
348
  var _a = input.split("?"), path = _a[0], query = _a[1];
345
349
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -437,9 +441,9 @@ function redact$1(value) {
437
441
  }
438
442
 
439
443
  var state$b = null;
440
- var buffer = null;
444
+ var buffer$1 = null;
441
445
  var update$2 = false;
442
- function start$O() {
446
+ function start$Q() {
443
447
  update$2 = false;
444
448
  reset$u();
445
449
  }
@@ -448,35 +452,35 @@ function reset$u() {
448
452
  // reset the state to current value after sending the previous state
449
453
  if (update$2) {
450
454
  state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
451
- visible: buffer.visible,
452
- docWidth: buffer.docWidth,
453
- docHeight: buffer.docHeight,
454
- screenWidth: buffer.screenWidth,
455
- screenHeight: buffer.screenHeight,
456
- scrollX: buffer.scrollX,
457
- scrollY: buffer.scrollY,
458
- pointerX: buffer.pointerX,
459
- pointerY: buffer.pointerY,
460
- activityTime: buffer.activityTime,
461
- scrollTime: buffer.scrollTime,
462
- pointerTime: buffer.pointerTime,
463
- moveX: buffer.moveX,
464
- moveY: buffer.moveY,
465
- moveTime: buffer.moveTime,
466
- downX: buffer.downX,
467
- downY: buffer.downY,
468
- downTime: buffer.downTime,
469
- upX: buffer.upX,
470
- upY: buffer.upY,
471
- upTime: buffer.upTime,
472
- pointerPrevX: buffer.pointerPrevX,
473
- pointerPrevY: buffer.pointerPrevY,
474
- pointerPrevTime: buffer.pointerPrevTime,
475
- modules: buffer.modules,
455
+ visible: buffer$1.visible,
456
+ docWidth: buffer$1.docWidth,
457
+ docHeight: buffer$1.docHeight,
458
+ screenWidth: buffer$1.screenWidth,
459
+ screenHeight: buffer$1.screenHeight,
460
+ scrollX: buffer$1.scrollX,
461
+ scrollY: buffer$1.scrollY,
462
+ pointerX: buffer$1.pointerX,
463
+ pointerY: buffer$1.pointerY,
464
+ activityTime: buffer$1.activityTime,
465
+ scrollTime: buffer$1.scrollTime,
466
+ pointerTime: buffer$1.pointerTime,
467
+ moveX: buffer$1.moveX,
468
+ moveY: buffer$1.moveY,
469
+ moveTime: buffer$1.moveTime,
470
+ downX: buffer$1.downX,
471
+ downY: buffer$1.downY,
472
+ downTime: buffer$1.downTime,
473
+ upX: buffer$1.upX,
474
+ upY: buffer$1.upY,
475
+ upTime: buffer$1.upTime,
476
+ pointerPrevX: buffer$1.pointerPrevX,
477
+ pointerPrevY: buffer$1.pointerPrevY,
478
+ pointerPrevTime: buffer$1.pointerPrevTime,
479
+ modules: buffer$1.modules,
476
480
  }
477
481
  };
478
482
  }
479
- buffer = buffer ? buffer : {
483
+ buffer$1 = buffer$1 ? buffer$1 : {
480
484
  visible: 1 /* BooleanFlag.True */,
481
485
  docWidth: 0,
482
486
  docHeight: 0,
@@ -507,74 +511,74 @@ function reset$u() {
507
511
  function track$8(event, x, y, time) {
508
512
  switch (event) {
509
513
  case 8 /* Event.Document */:
510
- buffer.docWidth = x;
511
- buffer.docHeight = y;
514
+ buffer$1.docWidth = x;
515
+ buffer$1.docHeight = y;
512
516
  break;
513
517
  case 11 /* Event.Resize */:
514
- buffer.screenWidth = x;
515
- buffer.screenHeight = y;
518
+ buffer$1.screenWidth = x;
519
+ buffer$1.screenHeight = y;
516
520
  break;
517
521
  case 10 /* Event.Scroll */:
518
- buffer.scrollX = x;
519
- buffer.scrollY = y;
520
- buffer.scrollTime = time;
522
+ buffer$1.scrollX = x;
523
+ buffer$1.scrollY = y;
524
+ buffer$1.scrollTime = time;
521
525
  break;
522
526
  case 12 /* Event.MouseMove */:
523
- buffer.moveX = x;
524
- buffer.moveY = y;
525
- buffer.moveTime = time;
526
- buffer.pointerPrevX = buffer.pointerX;
527
- buffer.pointerPrevY = buffer.pointerY;
528
- buffer.pointerPrevTime = buffer.pointerTime;
529
- buffer.pointerX = x;
530
- buffer.pointerY = y;
531
- buffer.pointerTime = time;
527
+ buffer$1.moveX = x;
528
+ buffer$1.moveY = y;
529
+ buffer$1.moveTime = time;
530
+ buffer$1.pointerPrevX = buffer$1.pointerX;
531
+ buffer$1.pointerPrevY = buffer$1.pointerY;
532
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
533
+ buffer$1.pointerX = x;
534
+ buffer$1.pointerY = y;
535
+ buffer$1.pointerTime = time;
532
536
  break;
533
537
  case 13 /* Event.MouseDown */:
534
- buffer.downX = x;
535
- buffer.downY = y;
536
- buffer.downTime = time;
537
- buffer.pointerPrevX = buffer.pointerX;
538
- buffer.pointerPrevY = buffer.pointerY;
539
- buffer.pointerPrevTime = buffer.pointerTime;
540
- buffer.pointerX = x;
541
- buffer.pointerY = y;
542
- buffer.pointerTime = time;
538
+ buffer$1.downX = x;
539
+ buffer$1.downY = y;
540
+ buffer$1.downTime = time;
541
+ buffer$1.pointerPrevX = buffer$1.pointerX;
542
+ buffer$1.pointerPrevY = buffer$1.pointerY;
543
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
544
+ buffer$1.pointerX = x;
545
+ buffer$1.pointerY = y;
546
+ buffer$1.pointerTime = time;
543
547
  break;
544
548
  case 14 /* Event.MouseUp */:
545
- buffer.upX = x;
546
- buffer.upY = y;
547
- buffer.upTime = time;
548
- buffer.pointerPrevX = buffer.pointerX;
549
- buffer.pointerPrevY = buffer.pointerY;
550
- buffer.pointerPrevTime = buffer.pointerTime;
551
- buffer.pointerX = x;
552
- buffer.pointerY = y;
553
- buffer.pointerTime = time;
549
+ buffer$1.upX = x;
550
+ buffer$1.upY = y;
551
+ buffer$1.upTime = time;
552
+ buffer$1.pointerPrevX = buffer$1.pointerX;
553
+ buffer$1.pointerPrevY = buffer$1.pointerY;
554
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
555
+ buffer$1.pointerX = x;
556
+ buffer$1.pointerY = y;
557
+ buffer$1.pointerTime = time;
554
558
  break;
555
559
  default:
556
- buffer.pointerPrevX = buffer.pointerX;
557
- buffer.pointerPrevY = buffer.pointerY;
558
- buffer.pointerPrevTime = buffer.pointerTime;
559
- buffer.pointerX = x;
560
- buffer.pointerY = y;
561
- buffer.pointerTime = time;
560
+ buffer$1.pointerPrevX = buffer$1.pointerX;
561
+ buffer$1.pointerPrevY = buffer$1.pointerY;
562
+ buffer$1.pointerPrevTime = buffer$1.pointerTime;
563
+ buffer$1.pointerX = x;
564
+ buffer$1.pointerY = y;
565
+ buffer$1.pointerTime = time;
562
566
  break;
563
567
  }
564
568
  update$2 = true;
565
569
  }
566
570
  function activity(t) {
567
- buffer.activityTime = t;
571
+ buffer$1.activityTime = t;
568
572
  }
569
573
  function visibility$1(t, visible) {
570
- buffer.visible = visible;
571
- if (!buffer.visible) {
574
+ buffer$1.visible = visible;
575
+ if (!buffer$1.visible) {
572
576
  activity(t);
573
577
  }
574
578
  update$2 = true;
575
579
  }
576
580
  function dynamic$1(modules) {
577
- buffer.modules = Array.from(modules);
581
+ buffer$1.modules = Array.from(modules);
578
582
  update$2 = true;
579
583
  }
580
584
  function compute$g() {
@@ -582,7 +586,7 @@ function compute$g() {
582
586
  encode$1(4 /* Event.Baseline */);
583
587
  }
584
588
  }
585
- function stop$L() {
589
+ function stop$N() {
586
590
  reset$u();
587
591
  }
588
592
 
@@ -592,9 +596,9 @@ var baseline = /*#__PURE__*/Object.freeze({
592
596
  compute: compute$g,
593
597
  dynamic: dynamic$1,
594
598
  reset: reset$u,
595
- start: start$O,
599
+ start: start$Q,
596
600
  get state () { return state$b; },
597
- stop: stop$L,
601
+ stop: stop$N,
598
602
  track: track$8,
599
603
  visibility: visibility$1
600
604
  });
@@ -619,12 +623,12 @@ function event$1(a, b) {
619
623
 
620
624
  var data$k = null;
621
625
  var updates$3 = null;
622
- function start$N() {
626
+ function start$P() {
623
627
  data$k = {};
624
628
  updates$3 = {};
625
629
  count$1(5 /* Metric.InvokeCount */);
626
630
  }
627
- function stop$K() {
631
+ function stop$M() {
628
632
  data$k = {};
629
633
  updates$3 = {};
630
634
  }
@@ -680,7 +684,7 @@ var data$j;
680
684
  var last = 0;
681
685
  var interval = 0;
682
686
  var timeout$7 = null;
683
- function start$M() {
687
+ function start$O() {
684
688
  interval = 60000 /* Setting.PingInterval */;
685
689
  last = 0;
686
690
  }
@@ -702,7 +706,7 @@ function ping() {
702
706
  suspend();
703
707
  }
704
708
  }
705
- function stop$J() {
709
+ function stop$L() {
706
710
  clearTimeout$1(timeout$7);
707
711
  last = 0;
708
712
  interval = 0;
@@ -712,15 +716,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
712
716
  __proto__: null,
713
717
  get data () { return data$j; },
714
718
  reset: reset$s,
715
- start: start$M,
716
- stop: stop$J
719
+ start: start$O,
720
+ stop: stop$L
717
721
  });
718
722
 
719
723
  var data$i = null;
720
- function start$L() {
724
+ function start$N() {
721
725
  data$i = {};
722
726
  }
723
- function stop$I() {
727
+ function stop$K() {
724
728
  data$i = {};
725
729
  }
726
730
  function track$7(event, time) {
@@ -752,8 +756,8 @@ var summary = /*#__PURE__*/Object.freeze({
752
756
  compute: compute$e,
753
757
  get data () { return data$i; },
754
758
  reset: reset$r,
755
- start: start$L,
756
- stop: stop$I,
759
+ start: start$N,
760
+ stop: stop$K,
757
761
  track: track$7
758
762
  });
759
763
 
@@ -892,7 +896,7 @@ function read(stream) {
892
896
  }
893
897
 
894
898
  var data$h = null;
895
- function start$K() {
899
+ function start$M() {
896
900
  reset$q();
897
901
  }
898
902
  function set$1(variable, value) {
@@ -954,7 +958,7 @@ function compute$d() {
954
958
  function reset$q() {
955
959
  data$h = {};
956
960
  }
957
- function stop$H() {
961
+ function stop$J() {
958
962
  reset$q();
959
963
  }
960
964
  function redact(input) {
@@ -994,8 +998,8 @@ var variable = /*#__PURE__*/Object.freeze({
994
998
  identify: identify,
995
999
  reset: reset$q,
996
1000
  set: set$1,
997
- start: start$K,
998
- stop: stop$H
1001
+ start: start$M,
1002
+ stop: stop$J
999
1003
  });
1000
1004
 
1001
1005
  var data$g = {};
@@ -1004,7 +1008,7 @@ var variables = {};
1004
1008
  var selectors = {};
1005
1009
  var hashes = {};
1006
1010
  var validation = {};
1007
- function start$J() {
1011
+ function start$L() {
1008
1012
  reset$p();
1009
1013
  }
1010
1014
  // Input string is of the following form:
@@ -1120,7 +1124,7 @@ function update$1(key, subkey, value) {
1120
1124
  }
1121
1125
  return;
1122
1126
  }
1123
- function stop$G() {
1127
+ function stop$I() {
1124
1128
  reset$p();
1125
1129
  }
1126
1130
  function parse$1(variable) {
@@ -1193,8 +1197,8 @@ var extract = /*#__PURE__*/Object.freeze({
1193
1197
  data: data$g,
1194
1198
  keys: keys,
1195
1199
  reset: reset$p,
1196
- start: start$J,
1197
- stop: stop$G,
1200
+ start: start$L,
1201
+ stop: stop$I,
1198
1202
  trigger: trigger$2,
1199
1203
  update: update$1
1200
1204
  });
@@ -1222,10 +1226,10 @@ function decodeCookieValue(value) {
1222
1226
 
1223
1227
  var rootDomain = null;
1224
1228
  var COOKIE_SEP = "^" /* Constant.Caret */;
1225
- function start$I() {
1229
+ function start$K() {
1226
1230
  rootDomain = null;
1227
1231
  }
1228
- function stop$F() {
1232
+ function stop$H() {
1229
1233
  rootDomain = null;
1230
1234
  }
1231
1235
  function getCookie(key, limit) {
@@ -1261,7 +1265,7 @@ function getCookie(key, limit) {
1261
1265
  function setCookie(key, value, time) {
1262
1266
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1263
1267
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1264
- if ((config$2.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1268
+ if ((config$3.track || value == "" /* Constant.Empty */) && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
1265
1269
  // Some browsers automatically url encode cookie values if they are not url encoded.
1266
1270
  // We therefore encode and decode cookie values ourselves.
1267
1271
  var encodedValue = encodeCookieValue(value);
@@ -1307,21 +1311,25 @@ var cookie = /*#__PURE__*/Object.freeze({
1307
1311
  COOKIE_SEP: COOKIE_SEP,
1308
1312
  getCookie: getCookie,
1309
1313
  setCookie: setCookie,
1310
- start: start$I,
1311
- stop: stop$F
1314
+ start: start$K,
1315
+ stop: stop$H
1312
1316
  });
1313
1317
 
1314
1318
  var defaultConfig = {
1315
1319
  excludeClassNames: [],
1320
+ ignoreMutationClassNames: [],
1321
+ discoverTrigger: null,
1316
1322
  };
1317
1323
  var _config = __assign({}, defaultConfig);
1318
- function start$H() {
1319
- var _a, _b;
1324
+ function start$J() {
1325
+ var _a, _b, _c, _d, _e, _f;
1320
1326
  _config = {
1321
1327
  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 : []),
1328
+ 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 : []),
1329
+ 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),
1322
1330
  };
1323
1331
  }
1324
- function stop$E() {
1332
+ function stop$G() {
1325
1333
  _config = __assign({}, defaultConfig);
1326
1334
  }
1327
1335
  function set(config) {
@@ -1335,8 +1343,61 @@ var gemx = /*#__PURE__*/Object.freeze({
1335
1343
  __proto__: null,
1336
1344
  get: get$2,
1337
1345
  set: set,
1338
- start: start$H,
1339
- stop: stop$E
1346
+ start: start$J,
1347
+ stop: stop$G
1348
+ });
1349
+
1350
+ // Deferred upload buffer for GemX mode.
1351
+ // Buffers ALL playback events until discoverTrigger conditions are met.
1352
+ // Scheduling and trigger logic lives in layout/gemx-discover.ts.
1353
+ var buffer = [];
1354
+ var bufferBytes = 0;
1355
+ var active$4 = false;
1356
+ var maxBytes = 0;
1357
+ var onBytesLimit = null;
1358
+ function start$I() {
1359
+ buffer = [];
1360
+ bufferBytes = 0;
1361
+ active$4 = true;
1362
+ }
1363
+ function config$2(bytesLimit, onLimit) {
1364
+ maxBytes = bytesLimit !== null && bytesLimit !== void 0 ? bytesLimit : 0;
1365
+ onBytesLimit = onLimit !== null && onLimit !== void 0 ? onLimit : null;
1366
+ return true;
1367
+ }
1368
+ function stop$F() {
1369
+ buffer = [];
1370
+ bufferBytes = 0;
1371
+ active$4 = false;
1372
+ maxBytes = 0;
1373
+ onBytesLimit = null;
1374
+ }
1375
+ function isActive() { return active$4; }
1376
+ function getBytes() { return bufferBytes; }
1377
+ function hold(tokens, byteLength) {
1378
+ buffer.push(tokens);
1379
+ bufferBytes += byteLength;
1380
+ if (maxBytes > 0 && bufferBytes >= maxBytes && onBytesLimit) {
1381
+ onBytesLimit();
1382
+ }
1383
+ }
1384
+ function drain() {
1385
+ active$4 = false;
1386
+ var pending = buffer;
1387
+ buffer = [];
1388
+ bufferBytes = 0;
1389
+ return pending;
1390
+ }
1391
+
1392
+ var gemxUpload = /*#__PURE__*/Object.freeze({
1393
+ __proto__: null,
1394
+ config: config$2,
1395
+ drain: drain,
1396
+ getBytes: getBytes,
1397
+ hold: hold,
1398
+ isActive: isActive,
1399
+ start: start$I,
1400
+ stop: stop$F
1340
1401
  });
1341
1402
 
1342
1403
  var signalCallback = null;
@@ -1367,34 +1428,36 @@ function signalsEvent(signalsPayload) {
1367
1428
  }
1368
1429
  }
1369
1430
 
1370
- var modules$3 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1371
- function start$G() {
1431
+ var modules$3 = [gemx, gemxUpload, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1432
+ function start$H() {
1372
1433
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1373
- start$N();
1434
+ start$P();
1374
1435
  modules$3.forEach(function (x) { return measure(x.start)(); });
1375
1436
  }
1376
- function stop$D() {
1437
+ function stop$E() {
1377
1438
  // Stop modules in the reverse order of their initialization
1378
1439
  // The ordering below should respect inter-module dependency.
1379
1440
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1380
1441
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1381
1442
  modules$3.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1382
- stop$K();
1443
+ stop$M();
1383
1444
  }
1384
1445
  function compute$b() {
1385
- compute$d();
1386
1446
  compute$g();
1387
- compute$3();
1388
- compute$f();
1389
- compute$e();
1390
1447
  compute$4();
1391
- compute$c();
1392
1448
  compute$2();
1449
+ if (config$3.mode !== "gemx") {
1450
+ compute$d();
1451
+ compute$3();
1452
+ compute$f();
1453
+ compute$e();
1454
+ compute$c();
1455
+ }
1393
1456
  }
1394
1457
 
1395
1458
  var history$5 = [];
1396
1459
  var data$f;
1397
- function start$F() {
1460
+ function start$G() {
1398
1461
  history$5 = [];
1399
1462
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1400
1463
  try {
@@ -1407,7 +1470,7 @@ function start$F() {
1407
1470
  }
1408
1471
  function check$5(id, target, input) {
1409
1472
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1410
- if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1473
+ if (config$3.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1411
1474
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1412
1475
  // Only encode this event if we haven't already reported this hash
1413
1476
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1430,7 +1493,7 @@ var MaskTagsList = ["INPUT", "SELECT", "TEXTAREA"];
1430
1493
  var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
1431
1494
 
1432
1495
  var state$a = [];
1433
- function start$E() {
1496
+ function start$F() {
1434
1497
  reset$o();
1435
1498
  }
1436
1499
  function observe$c(root) {
@@ -1440,15 +1503,15 @@ function recompute$8(evt) {
1440
1503
  var element = target(evt);
1441
1504
  if (element) {
1442
1505
  var value = element.value;
1443
- var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$2.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1506
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$3.fraud && MaskExcludeList.indexOf(element.type) === -1 ? hash(value, 28 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1444
1507
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1445
- schedule(encode$4.bind(this, 42 /* Event.Change */));
1508
+ schedule$1(encode$4.bind(this, 42 /* Event.Change */));
1446
1509
  }
1447
1510
  }
1448
1511
  function reset$o() {
1449
1512
  state$a = [];
1450
1513
  }
1451
- function stop$C() {
1514
+ function stop$D() {
1452
1515
  reset$o();
1453
1516
  }
1454
1517
 
@@ -1456,9 +1519,9 @@ var change = /*#__PURE__*/Object.freeze({
1456
1519
  __proto__: null,
1457
1520
  observe: observe$c,
1458
1521
  reset: reset$o,
1459
- start: start$E,
1522
+ start: start$F,
1460
1523
  get state () { return state$a; },
1461
- stop: stop$C
1524
+ stop: stop$D
1462
1525
  });
1463
1526
 
1464
1527
  function offset(element) {
@@ -1480,7 +1543,9 @@ function offset(element) {
1480
1543
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1481
1544
  var VM_PATTERN = /VM\d/;
1482
1545
  var state$9 = [];
1483
- function start$D() {
1546
+ var trustedCallback$1 = null;
1547
+ function onTrustedClick(cb) { trustedCallback$1 = cb; }
1548
+ function start$E() {
1484
1549
  reset$n();
1485
1550
  }
1486
1551
  function observe$b(root) {
@@ -1518,7 +1583,7 @@ function handler$4(event, root, evt) {
1518
1583
  // Check for null values before processing this event
1519
1584
  if (x !== null && y !== null) {
1520
1585
  var textInfo = text(t);
1521
- if (config$2.diagnostics) {
1586
+ if (config$3.diagnostics) {
1522
1587
  var el = t;
1523
1588
  console.log("[clarity:click] text debug", {
1524
1589
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1555,10 +1620,13 @@ function handler$4(event, root, evt) {
1555
1620
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1556
1621
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1557
1622
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1558
- source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1623
+ source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1559
1624
  }
1560
1625
  });
1561
- schedule(encode$4.bind(this, event));
1626
+ if (evt.isTrusted && trustedCallback$1) {
1627
+ trustedCallback$1();
1628
+ }
1629
+ schedule$1(encode$4.bind(this, event));
1562
1630
  }
1563
1631
  }
1564
1632
  function link(node) {
@@ -1711,21 +1779,22 @@ function source() {
1711
1779
  function reset$n() {
1712
1780
  state$9 = [];
1713
1781
  }
1714
- function stop$B() {
1782
+ function stop$C() {
1715
1783
  reset$n();
1716
1784
  }
1717
1785
 
1718
1786
  var click = /*#__PURE__*/Object.freeze({
1719
1787
  __proto__: null,
1720
1788
  observe: observe$b,
1789
+ onTrustedClick: onTrustedClick,
1721
1790
  reset: reset$n,
1722
- start: start$D,
1791
+ start: start$E,
1723
1792
  get state () { return state$9; },
1724
- stop: stop$B
1793
+ stop: stop$C
1725
1794
  });
1726
1795
 
1727
1796
  var state$8 = [];
1728
- function start$C() {
1797
+ function start$D() {
1729
1798
  reset$m();
1730
1799
  }
1731
1800
  function observe$a(root) {
@@ -1735,12 +1804,12 @@ function observe$a(root) {
1735
1804
  }
1736
1805
  function recompute$7(action, evt) {
1737
1806
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1738
- schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1807
+ schedule$1(encode$4.bind(this, 38 /* Event.Clipboard */));
1739
1808
  }
1740
1809
  function reset$m() {
1741
1810
  state$8 = [];
1742
1811
  }
1743
- function stop$A() {
1812
+ function stop$B() {
1744
1813
  reset$m();
1745
1814
  }
1746
1815
 
@@ -1748,14 +1817,14 @@ var clipboard = /*#__PURE__*/Object.freeze({
1748
1817
  __proto__: null,
1749
1818
  observe: observe$a,
1750
1819
  reset: reset$m,
1751
- start: start$C,
1820
+ start: start$D,
1752
1821
  get state () { return state$8; },
1753
- stop: stop$A
1822
+ stop: stop$B
1754
1823
  });
1755
1824
 
1756
1825
  var timeout$6 = null;
1757
1826
  var state$7 = [];
1758
- function start$B() {
1827
+ function start$C() {
1759
1828
  reset$l();
1760
1829
  }
1761
1830
  function observe$9(root) {
@@ -1784,12 +1853,12 @@ function recompute$6(evt) {
1784
1853
  }
1785
1854
  }
1786
1855
  function process$7(event) {
1787
- schedule(encode$4.bind(this, event));
1856
+ schedule$1(encode$4.bind(this, event));
1788
1857
  }
1789
1858
  function reset$l() {
1790
1859
  state$7 = [];
1791
1860
  }
1792
- function stop$z() {
1861
+ function stop$A() {
1793
1862
  clearTimeout$1(timeout$6);
1794
1863
  reset$l();
1795
1864
  }
@@ -1798,9 +1867,9 @@ var input = /*#__PURE__*/Object.freeze({
1798
1867
  __proto__: null,
1799
1868
  observe: observe$9,
1800
1869
  reset: reset$l,
1801
- start: start$B,
1870
+ start: start$C,
1802
1871
  get state () { return state$7; },
1803
- stop: stop$z
1872
+ stop: stop$A
1804
1873
  });
1805
1874
 
1806
1875
  var state$6 = [];
@@ -1808,7 +1877,7 @@ var timeout$5 = null;
1808
1877
  var hasPrimaryTouch = false;
1809
1878
  var primaryTouchId = 0;
1810
1879
  var activeTouchPointIds = new Set();
1811
- function start$A() {
1880
+ function start$B() {
1812
1881
  reset$k();
1813
1882
  }
1814
1883
  function observe$8(root) {
@@ -1902,7 +1971,7 @@ function handler$3(current) {
1902
1971
  }
1903
1972
  }
1904
1973
  function process$6(event) {
1905
- schedule(encode$4.bind(this, event));
1974
+ schedule$1(encode$4.bind(this, event));
1906
1975
  }
1907
1976
  function reset$k() {
1908
1977
  state$6 = [];
@@ -1916,7 +1985,7 @@ function similar$1(last, current) {
1916
1985
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1917
1986
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1918
1987
  }
1919
- function stop$y() {
1988
+ function stop$z() {
1920
1989
  clearTimeout$1(timeout$5);
1921
1990
  // Send out any pending pointer events in the pipeline
1922
1991
  if (state$6.length > 0) {
@@ -1928,9 +1997,9 @@ var pointer = /*#__PURE__*/Object.freeze({
1928
1997
  __proto__: null,
1929
1998
  observe: observe$8,
1930
1999
  reset: reset$k,
1931
- start: start$A,
2000
+ start: start$B,
1932
2001
  get state () { return state$6; },
1933
- stop: stop$y
2002
+ stop: stop$z
1934
2003
  });
1935
2004
 
1936
2005
  /**
@@ -1985,7 +2054,7 @@ var data$e;
1985
2054
  var timeout$4 = null;
1986
2055
  var initialStateLogged = false;
1987
2056
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1988
- function start$z() {
2057
+ function start$A() {
1989
2058
  initialStateLogged = false;
1990
2059
  bind(window, "resize", throttledRecompute$1);
1991
2060
  recompute$5();
@@ -2008,14 +2077,14 @@ function recompute$5() {
2008
2077
  }
2009
2078
  }
2010
2079
  function process$5(event) {
2011
- schedule(encode$4.bind(this, event));
2080
+ schedule$1(encode$4.bind(this, event));
2012
2081
  }
2013
2082
  function reset$j() {
2014
2083
  data$e = null;
2015
2084
  clearTimeout$1(timeout$4);
2016
2085
  throttledRecompute$1.cleanup();
2017
2086
  }
2018
- function stop$x() {
2087
+ function stop$y() {
2019
2088
  reset$j();
2020
2089
  }
2021
2090
 
@@ -2023,15 +2092,17 @@ var resize = /*#__PURE__*/Object.freeze({
2023
2092
  __proto__: null,
2024
2093
  get data () { return data$e; },
2025
2094
  reset: reset$j,
2026
- start: start$z,
2027
- stop: stop$x
2095
+ start: start$A,
2096
+ stop: stop$y
2028
2097
  });
2029
2098
 
2030
2099
  var state$5 = [];
2100
+ var trustedCallback = null;
2101
+ function onTrustedScroll(cb) { trustedCallback = cb; }
2031
2102
  var initialTop = null;
2032
2103
  var initialBottom = null;
2033
2104
  var timeout$3 = null;
2034
- function start$y() {
2105
+ function start$z() {
2035
2106
  state$5 = [];
2036
2107
  recompute$4();
2037
2108
  }
@@ -2070,6 +2141,9 @@ function recompute$4(event) {
2070
2141
  var top = getPositionNode(xPosition, startYPosition);
2071
2142
  var bottom = getPositionNode(xPosition, endYPosition);
2072
2143
  var trust = event && event.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
2144
+ if (event && event.isTrusted && trustedCallback) {
2145
+ trustedCallback();
2146
+ }
2073
2147
  var current = { time: time(event), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y, top: top, bottom: bottom, trust: trust } };
2074
2148
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
2075
2149
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
@@ -2110,7 +2184,7 @@ function reset$i() {
2110
2184
  initialBottom = null;
2111
2185
  }
2112
2186
  function process$4(event) {
2113
- schedule(encode$4.bind(this, event));
2187
+ schedule$1(encode$4.bind(this, event));
2114
2188
  }
2115
2189
  function similar(last, current) {
2116
2190
  var dx = last.data.x - current.data.x;
@@ -2128,7 +2202,7 @@ function compute$a() {
2128
2202
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
2129
2203
  }
2130
2204
  }
2131
- function stop$w() {
2205
+ function stop$x() {
2132
2206
  clearTimeout$1(timeout$3);
2133
2207
  throttledRecompute.cleanup();
2134
2208
  state$5 = [];
@@ -2140,16 +2214,17 @@ var scroll = /*#__PURE__*/Object.freeze({
2140
2214
  __proto__: null,
2141
2215
  compute: compute$a,
2142
2216
  observe: observe$7,
2217
+ onTrustedScroll: onTrustedScroll,
2143
2218
  reset: reset$i,
2144
- start: start$y,
2219
+ start: start$z,
2145
2220
  get state () { return state$5; },
2146
- stop: stop$w
2221
+ stop: stop$x
2147
2222
  });
2148
2223
 
2149
2224
  var data$d = null;
2150
2225
  var previous = null;
2151
2226
  var timeout$2 = null;
2152
- function start$x() {
2227
+ function start$y() {
2153
2228
  reset$h();
2154
2229
  }
2155
2230
  function observe$6(root) {
@@ -2187,13 +2262,13 @@ function recompute$3(root) {
2187
2262
  timeout$2 = setTimeout$1(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
2188
2263
  }
2189
2264
  function process$3(event) {
2190
- schedule(encode$4.bind(this, event));
2265
+ schedule$1(encode$4.bind(this, event));
2191
2266
  }
2192
2267
  function reset$h() {
2193
2268
  previous = null;
2194
2269
  data$d = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
2195
2270
  }
2196
- function stop$v() {
2271
+ function stop$w() {
2197
2272
  reset$h();
2198
2273
  clearTimeout$1(timeout$2);
2199
2274
  }
@@ -2203,12 +2278,12 @@ var selection = /*#__PURE__*/Object.freeze({
2203
2278
  get data () { return data$d; },
2204
2279
  observe: observe$6,
2205
2280
  reset: reset$h,
2206
- start: start$x,
2207
- stop: stop$v
2281
+ start: start$y,
2282
+ stop: stop$w
2208
2283
  });
2209
2284
 
2210
2285
  var state$4 = [];
2211
- function start$w() {
2286
+ function start$x() {
2212
2287
  reset$g();
2213
2288
  }
2214
2289
  function observe$5(root) {
@@ -2216,12 +2291,12 @@ function observe$5(root) {
2216
2291
  }
2217
2292
  function recompute$2(evt) {
2218
2293
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
2219
- schedule(encode$4.bind(this, 39 /* Event.Submit */));
2294
+ schedule$1(encode$4.bind(this, 39 /* Event.Submit */));
2220
2295
  }
2221
2296
  function reset$g() {
2222
2297
  state$4 = [];
2223
2298
  }
2224
- function stop$u() {
2299
+ function stop$v() {
2225
2300
  reset$g();
2226
2301
  }
2227
2302
 
@@ -2229,18 +2304,18 @@ var submit = /*#__PURE__*/Object.freeze({
2229
2304
  __proto__: null,
2230
2305
  observe: observe$5,
2231
2306
  reset: reset$g,
2232
- start: start$w,
2307
+ start: start$x,
2233
2308
  get state () { return state$4; },
2234
- stop: stop$u
2309
+ stop: stop$v
2235
2310
  });
2236
2311
 
2237
2312
  var data$c;
2238
- function start$v() {
2313
+ function start$w() {
2239
2314
  bind(window, "pagehide", recompute$1);
2240
2315
  bind(window, "beforeunload", beforeUnload);
2241
2316
  }
2242
2317
  function beforeUnload() {
2243
- flush();
2318
+ flush$1();
2244
2319
  }
2245
2320
  function recompute$1(evt) {
2246
2321
  data$c = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
@@ -2250,7 +2325,7 @@ function recompute$1(evt) {
2250
2325
  function reset$f() {
2251
2326
  data$c = null;
2252
2327
  }
2253
- function stop$t() {
2328
+ function stop$u() {
2254
2329
  reset$f();
2255
2330
  }
2256
2331
 
@@ -2258,12 +2333,12 @@ var unload = /*#__PURE__*/Object.freeze({
2258
2333
  __proto__: null,
2259
2334
  get data () { return data$c; },
2260
2335
  reset: reset$f,
2261
- start: start$v,
2262
- stop: stop$t
2336
+ start: start$w,
2337
+ stop: stop$u
2263
2338
  });
2264
2339
 
2265
2340
  var data$b;
2266
- function start$u() {
2341
+ function start$v() {
2267
2342
  bind(document, "visibilitychange", recompute);
2268
2343
  recompute();
2269
2344
  }
@@ -2278,7 +2353,7 @@ function recompute(evt) {
2278
2353
  function reset$e() {
2279
2354
  data$b = null;
2280
2355
  }
2281
- function stop$s() {
2356
+ function stop$t() {
2282
2357
  reset$e();
2283
2358
  }
2284
2359
 
@@ -2286,16 +2361,16 @@ var visibility = /*#__PURE__*/Object.freeze({
2286
2361
  __proto__: null,
2287
2362
  get data () { return data$b; },
2288
2363
  reset: reset$e,
2289
- start: start$u,
2290
- stop: stop$s
2364
+ start: start$v,
2365
+ stop: stop$t
2291
2366
  });
2292
2367
 
2293
2368
  var data$a;
2294
- function start$t() {
2369
+ function start$u() {
2295
2370
  bind(window, "focus", function () { return compute$9(1 /* BooleanFlag.True */); });
2296
2371
  bind(window, "blur", function () { return compute$9(0 /* BooleanFlag.False */); });
2297
2372
  }
2298
- function stop$r() {
2373
+ function stop$s() {
2299
2374
  reset$d();
2300
2375
  }
2301
2376
  function reset$d() {
@@ -2310,12 +2385,12 @@ var focus = /*#__PURE__*/Object.freeze({
2310
2385
  __proto__: null,
2311
2386
  get data () { return data$a; },
2312
2387
  reset: reset$d,
2313
- start: start$t,
2314
- stop: stop$r
2388
+ start: start$u,
2389
+ stop: stop$s
2315
2390
  });
2316
2391
 
2317
2392
  var bound = false;
2318
- function start$s() {
2393
+ function start$t() {
2319
2394
  // Only bind once - this listener must persist even when Clarity stops
2320
2395
  // to detect when the page is restored from bfcache
2321
2396
  if (!bound) {
@@ -2336,15 +2411,15 @@ function handler$2(evt) {
2336
2411
  log$1(11 /* Code.BFCache */, 0 /* Severity.Info */);
2337
2412
  }
2338
2413
  }
2339
- function stop$q() {
2414
+ function stop$r() {
2340
2415
  // Intentionally don't remove the listener or reset 'bound' flag
2341
2416
  // We need the listener to persist to detect bfcache restoration
2342
2417
  }
2343
2418
 
2344
2419
  var pageshow = /*#__PURE__*/Object.freeze({
2345
2420
  __proto__: null,
2346
- start: start$s,
2347
- stop: stop$q
2421
+ start: start$t,
2422
+ stop: stop$r
2348
2423
  });
2349
2424
 
2350
2425
  var GEMX$1 = [
@@ -2375,17 +2450,15 @@ var ALL$1 = [
2375
2450
  var GEMX_OBSERVE = { allRoots: [scroll], documentOnly: [click] };
2376
2451
  var ALL_OBSERVE = { allRoots: [scroll], documentOnly: [click, clipboard, pointer, input, selection, change, submit] };
2377
2452
  var modules$2 = ALL$1;
2378
- var observeModules = ALL_OBSERVE;
2379
- function start$r() {
2380
- var mode = config$2.mode;
2381
- modules$2 = mode === "gemx" ? GEMX$1 : ALL$1;
2382
- observeModules = mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2453
+ function start$s() {
2454
+ modules$2 = config$3.mode === "gemx" ? GEMX$1 : ALL$1;
2383
2455
  modules$2.forEach(function (m) { return m.start(); });
2384
2456
  }
2385
- function stop$p() {
2457
+ function stop$q() {
2386
2458
  modules$2.forEach(function (m) { return m.stop(); });
2387
2459
  }
2388
2460
  function observe$4(root) {
2461
+ var observeModules = config$3.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2389
2462
  observeModules.allRoots.forEach(function (m) { return m.observe(root); });
2390
2463
  if (root.nodeType === Node.DOCUMENT_NODE) {
2391
2464
  observeModules.documentOnly.forEach(function (m) { return m.observe(root); });
@@ -2395,8 +2468,8 @@ function observe$4(root) {
2395
2468
  var interaction = /*#__PURE__*/Object.freeze({
2396
2469
  __proto__: null,
2397
2470
  observe: observe$4,
2398
- start: start$r,
2399
- stop: stop$p
2471
+ start: start$s,
2472
+ stop: stop$q
2400
2473
  });
2401
2474
 
2402
2475
  // Following code takes an array of tokens and transforms it to optimize for repeating tokens and make it efficient to send over the wire
@@ -2450,7 +2523,7 @@ var styleTimeMap = {};
2450
2523
  var documentNodes = [];
2451
2524
  var createdSheetIds = [];
2452
2525
  function proxyStyleRules$1(win) {
2453
- if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2526
+ if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2454
2527
  return;
2455
2528
  }
2456
2529
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2485,11 +2558,11 @@ function proxyStyleRules$1(win) {
2485
2558
  }
2486
2559
  }
2487
2560
  }
2488
- function start$q() {
2561
+ function start$r() {
2489
2562
  proxyStyleRules$1(window);
2490
2563
  }
2491
2564
  function checkDocumentStyles(documentNode, timestamp) {
2492
- if (config$2.lean && config$2.lite) {
2565
+ if (config$3.lean && config$3.lite) {
2493
2566
  return;
2494
2567
  }
2495
2568
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2541,7 +2614,7 @@ function reset$c() {
2541
2614
  sheetAdoptionState = [];
2542
2615
  sheetUpdateState = [];
2543
2616
  }
2544
- function stop$o() {
2617
+ function stop$p() {
2545
2618
  styleSheetMap = {};
2546
2619
  styleTimeMap = {};
2547
2620
  documentNodes = [];
@@ -2589,7 +2662,7 @@ var animationFinish = null;
2589
2662
  var animationId = 'clarityAnimationId';
2590
2663
  var operationCount = 'clarityOperationCount';
2591
2664
  var maxOperations = 20;
2592
- function start$p() {
2665
+ function start$q() {
2593
2666
  if (window["Animation"] &&
2594
2667
  window["Animation"].prototype &&
2595
2668
  window["KeyframeEffect"] &&
@@ -2644,7 +2717,7 @@ function track$6(time, id, operation, keyFrames, timing, targetId, timeline) {
2644
2717
  });
2645
2718
  encode$5(44 /* Event.Animation */);
2646
2719
  }
2647
- function stop$n() {
2720
+ function stop$o() {
2648
2721
  reset$b();
2649
2722
  }
2650
2723
  function overrideAnimationHelper(functionToOverride, name) {
@@ -2701,7 +2774,7 @@ function register$1(tag) {
2701
2774
  if (!definedElements.has(tag)) {
2702
2775
  definedElements.add(tag);
2703
2776
  elements.push(tag);
2704
- schedule(encode$5.bind(this, 51 /* Event.CustomElement */));
2777
+ schedule$1(encode$5.bind(this, 51 /* Event.CustomElement */));
2705
2778
  }
2706
2779
  }
2707
2780
  function check$4(tag) {
@@ -2710,7 +2783,7 @@ function check$4(tag) {
2710
2783
  register$1(tag);
2711
2784
  }
2712
2785
  }
2713
- function start$o() {
2786
+ function start$p() {
2714
2787
  var _a;
2715
2788
  // Wrap in try-catch to handle Safari iOS where window properties or customElements.define may be readonly
2716
2789
  try {
@@ -2732,7 +2805,7 @@ function start$o() {
2732
2805
  function reset$a() {
2733
2806
  elements.length = 0;
2734
2807
  }
2735
- function stop$m() {
2808
+ function stop$n() {
2736
2809
  reset$a();
2737
2810
  definedElements.clear();
2738
2811
  }
@@ -2882,7 +2955,7 @@ function encode$5 (type, timer, ts) {
2882
2955
  if (type === 6 /* Event.Mutation */) {
2883
2956
  activity(eventTime);
2884
2957
  }
2885
- queue(tokenize(tokens), !config$2.lean);
2958
+ queue(tokenize(tokens), !config$3.lean);
2886
2959
  _o.label = 11;
2887
2960
  case 11: return [3 /*break*/, 13];
2888
2961
  case 12:
@@ -2924,7 +2997,7 @@ var data$9;
2924
2997
  function reset$9() {
2925
2998
  data$9 = null;
2926
2999
  }
2927
- function start$n() {
3000
+ function start$o() {
2928
3001
  reset$9();
2929
3002
  compute$7();
2930
3003
  }
@@ -2951,7 +3024,7 @@ function compute$7() {
2951
3024
  encode$5(8 /* Event.Document */);
2952
3025
  }
2953
3026
  }
2954
- function stop$l() {
3027
+ function stop$m() {
2955
3028
  reset$9();
2956
3029
  }
2957
3030
 
@@ -3003,7 +3076,7 @@ var history$4 = {};
3003
3076
  var observedNodes = new WeakMap();
3004
3077
  // We ignore mutations if these attributes are updated
3005
3078
  var IGNORED_ATTRIBUTES = ["data-google-query-id", "data-load-complete", "data-google-container-id"];
3006
- function start$m() {
3079
+ function start$n() {
3007
3080
  observers = new Set();
3008
3081
  queue$2 = [];
3009
3082
  timeout$1 = null;
@@ -3041,7 +3114,7 @@ function monitor(frame) {
3041
3114
  bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
3042
3115
  }
3043
3116
  }
3044
- function stop$k() {
3117
+ function stop$l() {
3045
3118
  for (var _i = 0, _a = Array.from(observers); _i < _a.length; _i++) {
3046
3119
  var observer = _a[_i];
3047
3120
  if (observer) {
@@ -3073,14 +3146,14 @@ function handle$1(m) {
3073
3146
  var now = time();
3074
3147
  track$7(6 /* Event.Mutation */, now);
3075
3148
  mutations.push({ time: now, mutations: m });
3076
- schedule(process$2, 1 /* Priority.High */).then(function () {
3149
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
3077
3150
  setTimeout$1(compute$7);
3078
3151
  measure(compute$6)();
3079
3152
  });
3080
3153
  }
3081
3154
  function processMutation(timer, mutation, instance, timestamp) {
3082
3155
  return __awaiter(this, void 0, void 0, function () {
3083
- var state$1, target, type;
3156
+ var state$1, target, ignoredClasses, el_1, type;
3084
3157
  return __generator(this, function (_a) {
3085
3158
  switch (_a.label) {
3086
3159
  case 0:
@@ -3095,7 +3168,14 @@ function processMutation(timer, mutation, instance, timestamp) {
3095
3168
  return [2 /*return*/];
3096
3169
  }
3097
3170
  target = mutation.target;
3098
- type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3171
+ ignoredClasses = get$2().ignoreMutationClassNames;
3172
+ if (ignoredClasses.length > 0 && target instanceof Element) {
3173
+ el_1 = target;
3174
+ if (ignoredClasses.some(function (cls) { return el_1.classList.contains(cls); })) {
3175
+ return [2 /*return*/];
3176
+ }
3177
+ }
3178
+ type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3099
3179
  if (type && target && target.ownerDocument) {
3100
3180
  parse(target.ownerDocument);
3101
3181
  }
@@ -3128,7 +3208,7 @@ function process$2() {
3128
3208
  switch (_d.label) {
3129
3209
  case 0:
3130
3210
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
3131
- start$e(timer);
3211
+ start$f(timer);
3132
3212
  _d.label = 1;
3133
3213
  case 1:
3134
3214
  if (!(mutations.length > 0)) return [3 /*break*/, 7];
@@ -3178,7 +3258,7 @@ function process$2() {
3178
3258
  _d.label = 13;
3179
3259
  case 13:
3180
3260
  cleanHistory();
3181
- stop$d(timer);
3261
+ stop$e(timer);
3182
3262
  return [2 /*return*/];
3183
3263
  }
3184
3264
  });
@@ -3287,10 +3367,10 @@ function processThrottledMutations() {
3287
3367
  clearTimeout$1(throttleDelay);
3288
3368
  }
3289
3369
  throttleDelay = setTimeout$1(function () {
3290
- schedule(process$2, 1 /* Priority.High */);
3370
+ schedule$1(process$2, 1 /* Priority.High */);
3291
3371
  }, 33 /* Setting.LookAhead */);
3292
3372
  }
3293
- function schedule$1(node) {
3373
+ function schedule$2(node) {
3294
3374
  // Only schedule manual trigger for this node if it's not already in the queue
3295
3375
  if (queue$2.indexOf(node) < 0) {
3296
3376
  queue$2.push(node);
@@ -3349,7 +3429,7 @@ function proxyStyleRules(win) {
3349
3429
  win.clarityOverrides.InsertRule = win.CSSStyleSheet.prototype.insertRule;
3350
3430
  win.CSSStyleSheet.prototype.insertRule = function () {
3351
3431
  if (active()) {
3352
- schedule$1(this.ownerNode);
3432
+ schedule$2(this.ownerNode);
3353
3433
  }
3354
3434
  return win.clarityOverrides.InsertRule.apply(this, arguments);
3355
3435
  };
@@ -3358,7 +3438,7 @@ function proxyStyleRules(win) {
3358
3438
  win.clarityOverrides.MediaInsertRule = win.CSSMediaRule.prototype.insertRule;
3359
3439
  win.CSSMediaRule.prototype.insertRule = function () {
3360
3440
  if (active()) {
3361
- schedule$1(this.parentStyleSheet.ownerNode);
3441
+ schedule$2(this.parentStyleSheet.ownerNode);
3362
3442
  }
3363
3443
  return win.clarityOverrides.MediaInsertRule.apply(this, arguments);
3364
3444
  };
@@ -3367,7 +3447,7 @@ function proxyStyleRules(win) {
3367
3447
  win.clarityOverrides.DeleteRule = win.CSSStyleSheet.prototype.deleteRule;
3368
3448
  win.CSSStyleSheet.prototype.deleteRule = function () {
3369
3449
  if (active()) {
3370
- schedule$1(this.ownerNode);
3450
+ schedule$2(this.ownerNode);
3371
3451
  }
3372
3452
  return win.clarityOverrides.DeleteRule.apply(this, arguments);
3373
3453
  };
@@ -3376,7 +3456,7 @@ function proxyStyleRules(win) {
3376
3456
  win.clarityOverrides.MediaDeleteRule = win.CSSMediaRule.prototype.deleteRule;
3377
3457
  win.CSSMediaRule.prototype.deleteRule = function () {
3378
3458
  if (active()) {
3379
- schedule$1(this.parentStyleSheet.ownerNode);
3459
+ schedule$2(this.parentStyleSheet.ownerNode);
3380
3460
  }
3381
3461
  return win.clarityOverrides.MediaDeleteRule.apply(this, arguments);
3382
3462
  };
@@ -3389,7 +3469,7 @@ function proxyStyleRules(win) {
3389
3469
  try {
3390
3470
  win.Element.prototype.attachShadow = function () {
3391
3471
  if (active()) {
3392
- return schedule$1(win.clarityOverrides.AttachShadow.apply(this, arguments));
3472
+ return schedule$2(win.clarityOverrides.AttachShadow.apply(this, arguments));
3393
3473
  }
3394
3474
  else {
3395
3475
  return win.clarityOverrides.AttachShadow.apply(this, arguments);
@@ -3921,11 +4001,11 @@ var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
3921
4001
  var iframeContentMap = null; // Maps parent iframe element => iframe's contentDocument & contentWindow
3922
4002
  var privacyMap = null; // Maps node => Privacy (enum)
3923
4003
  var fraudMap = null; // Maps node => FraudId (number)
3924
- function start$l() {
4004
+ function start$m() {
3925
4005
  reset$7();
3926
4006
  parse(document, true);
3927
4007
  }
3928
- function stop$j() {
4008
+ function stop$k() {
3929
4009
  reset$7();
3930
4010
  }
3931
4011
  function reset$7() {
@@ -3956,14 +4036,14 @@ function parse(root, init) {
3956
4036
  try {
3957
4037
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3958
4038
  if (init) {
3959
- config$2.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
4039
+ config$3.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
3960
4040
  }
3961
4041
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3962
4042
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3963
4043
  if ("querySelectorAll" in root) {
3964
- config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3965
- config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3966
- config$2.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
4044
+ config$3.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
4045
+ config$3.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
4046
+ config$3.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
3967
4047
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3968
4048
  }
3969
4049
  }
@@ -3994,7 +4074,7 @@ function add$1(node, parent, data, source) {
3994
4074
  var parentValue = null;
3995
4075
  var regionId = exists(node) ? id : null;
3996
4076
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
3997
- var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4077
+ var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
3998
4078
  if (parentId >= 0 && values$1[parentId]) {
3999
4079
  parentValue = values$1[parentId];
4000
4080
  parentValue.children.push(id);
@@ -4227,6 +4307,9 @@ function get(node) {
4227
4307
  function lookup(hash) {
4228
4308
  return hash in hashMap ? hashMap[hash] : null;
4229
4309
  }
4310
+ function getHashes() {
4311
+ return Object.keys(hashMap);
4312
+ }
4230
4313
  function has$1(node) {
4231
4314
  return nodesMap.has(getId$1(node));
4232
4315
  }
@@ -4298,7 +4381,7 @@ function getPreviousId(node) {
4298
4381
  function track$4(id, source, changed, parentChanged) {
4299
4382
  if (changed === void 0) { changed = true; }
4300
4383
  if (parentChanged === void 0) { parentChanged = false; }
4301
- if (config$2.lean && config$2.lite) {
4384
+ if (config$3.lean && config$3.lite) {
4302
4385
  return;
4303
4386
  }
4304
4387
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4320,7 +4403,7 @@ var regions = {};
4320
4403
  var queue$1 = [];
4321
4404
  var watch = false;
4322
4405
  var observer$1 = null;
4323
- function start$k() {
4406
+ function start$l() {
4324
4407
  reset$6();
4325
4408
  observer$1 = null;
4326
4409
  regionMap = new WeakMap();
@@ -4448,7 +4531,7 @@ function clone(r) {
4448
4531
  function reset$6() {
4449
4532
  state$2 = [];
4450
4533
  }
4451
- function stop$i() {
4534
+ function stop$j() {
4452
4535
  reset$6();
4453
4536
  regionMap = null;
4454
4537
  regions = {};
@@ -4472,10 +4555,10 @@ function metadata$2(node, event, text) {
4472
4555
  var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */ };
4473
4556
  if (node) {
4474
4557
  var value = get(node);
4475
- console.log("[GemX - Target - Metadata]", {
4476
- selector: value.selector,
4477
- hash: value.hash,
4478
- });
4558
+ if (!window.GemXHeatmap.__debug) {
4559
+ window.GemXHeatmap.__debug = [];
4560
+ }
4561
+ window.GemXHeatmap.__debug.push({ event: event, selector: value.selector, hash: value.hash });
4479
4562
  if (value !== null) {
4480
4563
  var metadata_1 = value.metadata;
4481
4564
  output.id = value.id;
@@ -4705,7 +4788,7 @@ function encode$4 (type, ts) {
4705
4788
 
4706
4789
  var state$1 = [];
4707
4790
  var updates$1 = [];
4708
- function start$j() {
4791
+ function start$k() {
4709
4792
  state$1 = [];
4710
4793
  reset$5();
4711
4794
  }
@@ -4752,7 +4835,7 @@ function compute$5() {
4752
4835
  state$1 = temp; // Drop events less than the min time
4753
4836
  encode$4(22 /* Event.Timeline */);
4754
4837
  }
4755
- function stop$h() {
4838
+ function stop$i() {
4756
4839
  state$1 = [];
4757
4840
  reset$5();
4758
4841
  }
@@ -4896,14 +4979,14 @@ function add(node, parent, data) {
4896
4979
  var stopCallbacks = [];
4897
4980
  var active$2 = false;
4898
4981
  var modules$1 = null;
4899
- function start$i() {
4982
+ function start$j() {
4900
4983
  active$2 = true;
4901
4984
  modules$1 = new Set();
4902
- if (config$2.modules && config$2.modules.length > 0) {
4903
- config$2.modules.forEach(function (m) { event(m); });
4985
+ if (config$3.modules && config$3.modules.length > 0) {
4986
+ config$3.modules.forEach(function (m) { event(m); });
4904
4987
  }
4905
4988
  }
4906
- function stop$g() {
4989
+ function stop$h() {
4907
4990
  stopCallbacks.reverse().forEach(function (callback) {
4908
4991
  try {
4909
4992
  callback();
@@ -4955,8 +5038,8 @@ var dynamic = /*#__PURE__*/Object.freeze({
4955
5038
  __proto__: null,
4956
5039
  event: event,
4957
5040
  register: register,
4958
- start: start$i,
4959
- stop: stop$g
5041
+ start: start$j,
5042
+ stop: stop$h
4960
5043
  });
4961
5044
 
4962
5045
  var discoverBytes = 0;
@@ -4968,12 +5051,14 @@ var transit;
4968
5051
  var active$1;
4969
5052
  var queuedTime = 0;
4970
5053
  var leanLimit = false;
5054
+ var hasGemxPayload = false;
4971
5055
  var track$1;
4972
- function start$h() {
5056
+ function start$i() {
4973
5057
  active$1 = true;
4974
5058
  discoverBytes = 0;
4975
5059
  playbackBytes = 0;
4976
5060
  leanLimit = false;
5061
+ hasGemxPayload = false;
4977
5062
  queuedTime = 0;
4978
5063
  playback = [];
4979
5064
  analysis = [];
@@ -4988,7 +5073,7 @@ function queue(tokens, transmit) {
4988
5073
  var now = time();
4989
5074
  var type = tokens.length > 1 ? tokens[1] : null;
4990
5075
  var event = JSON.stringify(tokens);
4991
- if (!config$2.lean) {
5076
+ if (!config$3.lean) {
4992
5077
  leanLimit = false;
4993
5078
  }
4994
5079
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -5000,6 +5085,10 @@ function queue(tokens, transmit) {
5000
5085
  if (leanLimit) {
5001
5086
  break;
5002
5087
  }
5088
+ if (isActive()) {
5089
+ hold(tokens, event.length);
5090
+ break; // only gemxPlayback, not playback
5091
+ }
5003
5092
  discoverBytes += event.length;
5004
5093
  case 37 /* Event.Box */:
5005
5094
  case 6 /* Event.Mutation */:
@@ -5011,6 +5100,9 @@ function queue(tokens, transmit) {
5011
5100
  if (leanLimit) {
5012
5101
  break;
5013
5102
  }
5103
+ if (isActive()) {
5104
+ hold(tokens, event.length); // also gemxPlayback, no break
5105
+ }
5014
5106
  playbackBytes += event.length;
5015
5107
  playback.push(event);
5016
5108
  break;
@@ -5040,7 +5132,7 @@ function queue(tokens, transmit) {
5040
5132
  check$2(playbackBytes);
5041
5133
  }
5042
5134
  }
5043
- function flush() {
5135
+ function flush$1() {
5044
5136
  if (!active$1) {
5045
5137
  return;
5046
5138
  }
@@ -5048,7 +5140,30 @@ function flush() {
5048
5140
  timeout = null;
5049
5141
  upload(true);
5050
5142
  }
5051
- function stop$f() {
5143
+ // Trigger an immediate non-beacon upload (used by gemx-discover after inject).
5144
+ // Unlike flush(), this does NOT set final=true, so playback data is never stripped.
5145
+ function uploadNow() {
5146
+ if (!active$1) {
5147
+ return;
5148
+ }
5149
+ clearTimeout$1(timeout);
5150
+ timeout = null;
5151
+ upload(false);
5152
+ }
5153
+ // Inject pre-buffered tokens directly into playback as discover events.
5154
+ // Used by gemx-discover when trigger fires: all buffered Discover tokens are
5155
+ // counted towards discoverBytes so upload uses MinUploadDelay (fast path).
5156
+ function inject(buffered) {
5157
+ hasGemxPayload = true;
5158
+ for (var _i = 0, buffered_1 = buffered; _i < buffered_1.length; _i++) {
5159
+ var tokens = buffered_1[_i];
5160
+ var e = JSON.stringify(tokens);
5161
+ discoverBytes += e.length;
5162
+ playbackBytes += e.length;
5163
+ playback.push(e);
5164
+ }
5165
+ }
5166
+ function stop$g() {
5052
5167
  clearTimeout$1(timeout);
5053
5168
  upload(true);
5054
5169
  discoverBytes = 0;
@@ -5072,7 +5187,7 @@ function upload(final) {
5072
5187
  return [2 /*return*/];
5073
5188
  }
5074
5189
  timeout = null;
5075
- sendPlaybackBytes = config$2.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5190
+ sendPlaybackBytes = (hasGemxPayload || config$3.lean === false) && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
5076
5191
  if (sendPlaybackBytes) {
5077
5192
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
5078
5193
  }
@@ -5113,6 +5228,7 @@ function upload(final) {
5113
5228
  playbackBytes = 0;
5114
5229
  discoverBytes = 0;
5115
5230
  leanLimit = false;
5231
+ hasGemxPayload = false;
5116
5232
  }
5117
5233
  return [2 /*return*/];
5118
5234
  }
@@ -5125,8 +5241,8 @@ function stringify(encoded) {
5125
5241
  function send(payload, zipped, sequence, beacon) {
5126
5242
  if (beacon === void 0) { beacon = false; }
5127
5243
  // Upload data if a valid URL is defined in the config
5128
- if (typeof config$2.upload === "string" /* Constant.String */) {
5129
- var url_1 = config$2.upload;
5244
+ if (typeof config$3.upload === "string" /* Constant.String */) {
5245
+ var url_1 = config$3.upload;
5130
5246
  var dispatched = false;
5131
5247
  // If it's the last payload, attempt to upload using sendBeacon first.
5132
5248
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5177,9 +5293,10 @@ function send(payload, zipped, sequence, beacon) {
5177
5293
  }
5178
5294
  }
5179
5295
  }
5180
- else if (config$2.upload) {
5181
- var callback = config$2.upload;
5182
- callback(payload);
5296
+ else if (config$3.upload) {
5297
+ var callback = config$3.upload;
5298
+ var uploadType = hasGemxPayload ? "gemx-discover" : undefined;
5299
+ callback(payload, uploadType);
5183
5300
  done(sequence);
5184
5301
  }
5185
5302
  }
@@ -5200,7 +5317,7 @@ function check$3(xhr, sequence) {
5200
5317
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5201
5318
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5202
5319
  if (xhr.status === 0) {
5203
- config$2.upload = config$2.fallback ? config$2.fallback : config$2.upload;
5320
+ config$3.upload = config$3.fallback ? config$3.fallback : config$3.upload;
5204
5321
  }
5205
5322
  // Capture the status code and number of attempts so we can report it back to the server
5206
5323
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5247,8 +5364,8 @@ function done(sequence) {
5247
5364
  function delay() {
5248
5365
  // Progressively increase delay as we continue to send more payloads from the client to the server
5249
5366
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5250
- var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5251
- return typeof config$2.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$2.delay;
5367
+ var gap = config$3.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$3.delay;
5368
+ return typeof config$3.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$3.delay;
5252
5369
  }
5253
5370
  function response(payload) {
5254
5371
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5266,8 +5383,8 @@ function response(payload) {
5266
5383
  break;
5267
5384
  case "ACTION" /* Constant.Action */:
5268
5385
  // Invoke action callback, if configured and has a valid value
5269
- if (config$2.action && parts.length > 1) {
5270
- config$2.action(parts[1]);
5386
+ if (config$3.action && parts.length > 1) {
5387
+ config$3.action(parts[1]);
5271
5388
  }
5272
5389
  break;
5273
5390
  case "EXTRACT" /* Constant.Extract */:
@@ -5286,7 +5403,7 @@ function response(payload) {
5286
5403
  }
5287
5404
  break;
5288
5405
  case "SNAPSHOT" /* Constant.Snapshot */:
5289
- config$2.lean = false; // Disable lean mode to ensure we can send playback information to server.
5406
+ config$3.lean = false; // Disable lean mode to ensure we can send playback information to server.
5290
5407
  snapshot();
5291
5408
  break;
5292
5409
  }
@@ -5295,7 +5412,7 @@ function response(payload) {
5295
5412
 
5296
5413
  var history$3 = {};
5297
5414
  var data$8;
5298
- function start$g() {
5415
+ function start$h() {
5299
5416
  bind(window, "error", handler);
5300
5417
  history$3 = {};
5301
5418
  }
@@ -5363,7 +5480,7 @@ function encode$2 (type) {
5363
5480
 
5364
5481
  var history$2 = {};
5365
5482
  var data$7;
5366
- function start$f() {
5483
+ function start$g() {
5367
5484
  history$2 = {};
5368
5485
  }
5369
5486
  function log$1(code, severity, name, message, stack) {
@@ -5386,7 +5503,7 @@ function log$1(code, severity, name, message, stack) {
5386
5503
  }
5387
5504
  encode$2(33 /* Event.Log */);
5388
5505
  }
5389
- function stop$e() {
5506
+ function stop$f() {
5390
5507
  history$2 = {};
5391
5508
  }
5392
5509
 
@@ -5419,7 +5536,7 @@ function reset$4() {
5419
5536
  activeTask = null;
5420
5537
  pauseTask = null;
5421
5538
  }
5422
- function schedule(task, priority) {
5539
+ function schedule$1(task, priority) {
5423
5540
  if (priority === void 0) { priority = 0 /* Priority.Normal */; }
5424
5541
  return __awaiter(this, void 0, void 0, function () {
5425
5542
  var _i, queuedTasks_1, q, promise;
@@ -5483,7 +5600,7 @@ function state(timer) {
5483
5600
  // If this task is no longer being tracked, send stop message to the caller
5484
5601
  return 2 /* Task.Stop */;
5485
5602
  }
5486
- function start$e(timer) {
5603
+ function start$f(timer) {
5487
5604
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
5488
5605
  }
5489
5606
  function restart$2(timer) {
@@ -5491,12 +5608,12 @@ function restart$2(timer) {
5491
5608
  if (tracker && tracker[id]) {
5492
5609
  var c = tracker[id].calls;
5493
5610
  var y = tracker[id].yield;
5494
- start$e(timer);
5611
+ start$f(timer);
5495
5612
  tracker[id].calls = c + 1;
5496
5613
  tracker[id].yield = y;
5497
5614
  }
5498
5615
  }
5499
- function stop$d(timer) {
5616
+ function stop$e(timer) {
5500
5617
  var end = performance.now();
5501
5618
  var id = key(timer);
5502
5619
  var duration = end - tracker[id].start;
@@ -5517,7 +5634,7 @@ function suspend$1(timer) {
5517
5634
  case 0:
5518
5635
  id = key(timer);
5519
5636
  if (!(id in tracker)) return [3 /*break*/, 2];
5520
- stop$d(timer);
5637
+ stop$e(timer);
5521
5638
  // some customer polyfills for requestIdleCallback return null
5522
5639
  _b = tracker[id];
5523
5640
  return [4 /*yield*/, wait()];
@@ -5588,8 +5705,8 @@ function requestIdleCallbackPolyfill(callback, options) {
5588
5705
  }
5589
5706
  var requestIdleCallback = window["requestIdleCallback"] || requestIdleCallbackPolyfill;
5590
5707
 
5591
- function start$d() {
5592
- schedule(discover, 1 /* Priority.High */).then(function () {
5708
+ function start$e() {
5709
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
5593
5710
  measure(compute$7)();
5594
5711
  measure(compute$6)();
5595
5712
  measure(compute$a)();
@@ -5603,7 +5720,7 @@ function discover() {
5603
5720
  case 0:
5604
5721
  ts = time();
5605
5722
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
5606
- start$e(timer);
5723
+ start$f(timer);
5607
5724
  return [4 /*yield*/, traverse$1(document, timer, 0 /* Source.Discover */, ts)];
5608
5725
  case 1:
5609
5726
  _a.sent();
@@ -5611,7 +5728,7 @@ function discover() {
5611
5728
  return [4 /*yield*/, encode$5(5 /* Event.Discover */, timer, ts)];
5612
5729
  case 2:
5613
5730
  _a.sent();
5614
- stop$d(timer);
5731
+ stop$e(timer);
5615
5732
  return [2 /*return*/];
5616
5733
  }
5617
5734
  });
@@ -5619,9 +5736,9 @@ function discover() {
5619
5736
  }
5620
5737
 
5621
5738
  var data$6 = null;
5622
- function start$c() {
5623
- if (!config$2.lean && config$2.upgrade) {
5624
- config$2.upgrade("Config" /* Constant.Config */);
5739
+ function start$d() {
5740
+ if (!config$3.lean && config$3.upgrade) {
5741
+ config$3.upgrade("Config" /* Constant.Config */);
5625
5742
  }
5626
5743
  data$6 = null;
5627
5744
  }
@@ -5631,24 +5748,24 @@ function start$c() {
5631
5748
  // and send all backed up layout events to the server.
5632
5749
  function upgrade(key) {
5633
5750
  // Upgrade only if Clarity was successfully activated on the page
5634
- if (active() && config$2.lean) {
5635
- config$2.lean = false;
5751
+ if (active() && config$3.lean) {
5752
+ config$3.lean = false;
5636
5753
  data$6 = { key: key };
5637
5754
  // Update metadata to track we have upgraded this session
5638
5755
  callback();
5639
5756
  save();
5640
5757
  // Callback upgrade handler, if configured
5641
- if (config$2.upgrade) {
5642
- config$2.upgrade(key);
5758
+ if (config$3.upgrade) {
5759
+ config$3.upgrade(key);
5643
5760
  }
5644
5761
  encode$1(3 /* Event.Upgrade */);
5645
- if (config$2.lite) {
5646
- start$d();
5647
- start$q();
5762
+ if (config$3.lite) {
5763
+ start$e();
5764
+ start$r();
5648
5765
  }
5649
5766
  }
5650
5767
  }
5651
- function stop$c() {
5768
+ function stop$d() {
5652
5769
  data$6 = null;
5653
5770
  }
5654
5771
 
@@ -5797,7 +5914,7 @@ function encode$1 (event) {
5797
5914
  }
5798
5915
 
5799
5916
  var data$5;
5800
- function start$b() {
5917
+ function start$c() {
5801
5918
  data$5 = { check: 0 /* Check.None */ };
5802
5919
  }
5803
5920
  function check$2(bytes) {
@@ -5825,19 +5942,19 @@ function compute$4() {
5825
5942
  encode$1(35 /* Event.Limit */);
5826
5943
  }
5827
5944
  }
5828
- function stop$b() {
5945
+ function stop$c() {
5829
5946
  data$5 = null;
5830
5947
  }
5831
5948
 
5832
5949
  var data$4 = null;
5833
5950
  var updates = null;
5834
5951
  var limited = false;
5835
- function start$a() {
5952
+ function start$b() {
5836
5953
  data$4 = {};
5837
5954
  updates = {};
5838
5955
  limited = false;
5839
5956
  }
5840
- function stop$a() {
5957
+ function stop$b() {
5841
5958
  data$4 = {};
5842
5959
  updates = {};
5843
5960
  limited = false;
@@ -5879,7 +5996,7 @@ function reset$3() {
5879
5996
 
5880
5997
  var data$3 = null;
5881
5998
  var updateConsent = true;
5882
- function start$9() {
5999
+ function start$a() {
5883
6000
  var _a;
5884
6001
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5885
6002
  updateConsent = true;
@@ -5887,7 +6004,7 @@ function start$9() {
5887
6004
  ics.addListener(["ad_storage" /* Constant.AdStorage */, "analytics_storage" /* Constant.AnalyticsStorage */], processConsent);
5888
6005
  }
5889
6006
  }
5890
- function stop$9() {
6007
+ function stop$a() {
5891
6008
  updateConsent = true;
5892
6009
  }
5893
6010
  function processConsent() {
@@ -5936,7 +6053,7 @@ function compute$2() {
5936
6053
  if (updateConsent) {
5937
6054
  encode$1(47 /* Event.Consent */);
5938
6055
  updateConsent = false;
5939
- if (!config$2.track) {
6056
+ if (!config$3.track) {
5940
6057
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5941
6058
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5942
6059
  processConsent();
@@ -5951,7 +6068,7 @@ var electron = 0 /* BooleanFlag.False */;
5951
6068
  var consentStatus = null;
5952
6069
  var cookiesLogged = false;
5953
6070
  var defaultStatus = { source: 7 /* ConsentSource.Default */, ad_Storage: "denied" /* Constant.Denied */, analytics_Storage: "denied" /* Constant.Denied */ };
5954
- function start$8() {
6071
+ function start$9() {
5955
6072
  var _a, _b, _c;
5956
6073
  var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
5957
6074
  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 : '';
@@ -5962,13 +6079,13 @@ function start$8() {
5962
6079
  // Populate ids for this page
5963
6080
  var s = session();
5964
6081
  var u = user();
5965
- var projectId = config$2.projectId || hash(location.host);
5966
- var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5967
- var sessionId = config$2.externalSession && config$2.sessionId ? config$2.sessionId : s.session;
6082
+ var projectId = config$3.projectId || hash(location.host);
6083
+ var userId = config$3.externalSession && config$3.userId ? config$3.userId : u.id;
6084
+ var sessionId = config$3.externalSession && config$3.sessionId ? config$3.sessionId : s.session;
5968
6085
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5969
6086
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5970
- config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5971
- 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;
6087
+ config$3.lean = config$3.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$3.lean;
6088
+ 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;
5972
6089
  // Log page metadata as dimensions
5973
6090
  log(0 /* Dimension.UserAgent */, ua);
5974
6091
  log(3 /* Dimension.PageTitle */, title);
@@ -6010,15 +6127,15 @@ function start$8() {
6010
6127
  if (consentStatus === null) {
6011
6128
  consentStatus = {
6012
6129
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
6013
- ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6014
- analytics_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6130
+ ad_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6131
+ analytics_Storage: config$3.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6015
6132
  };
6016
6133
  }
6017
6134
  logCookies();
6018
6135
  var consent = getConsentData(consentStatus);
6019
6136
  config$1(consent);
6020
6137
  // Track ids using a cookie if configuration allows it, skip if using external session
6021
- if (!config$2.externalSession) {
6138
+ if (!config$3.externalSession) {
6022
6139
  track(u);
6023
6140
  }
6024
6141
  }
@@ -6043,7 +6160,7 @@ function logCookies() {
6043
6160
  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 */) {
6044
6161
  return;
6045
6162
  }
6046
- for (var _i = 0, _a = config$2.cookies; _i < _a.length; _i++) {
6163
+ for (var _i = 0, _a = config$3.cookies; _i < _a.length; _i++) {
6047
6164
  var key = _a[_i];
6048
6165
  var value = getCookie(key);
6049
6166
  if (value) {
@@ -6052,7 +6169,7 @@ function logCookies() {
6052
6169
  }
6053
6170
  cookiesLogged = true;
6054
6171
  }
6055
- function stop$8() {
6172
+ function stop$9() {
6056
6173
  data$2 = null;
6057
6174
  // Reset cookiesLogged so cookies are re-logged on restart. Each session generates new metadata
6058
6175
  // (sessionId, pageNum), and cookie values need to be recorded in the new session's data stream.
@@ -6063,14 +6180,14 @@ function metadata(cb, wait, recall, consentInfo) {
6063
6180
  if (wait === void 0) { wait = true; }
6064
6181
  if (recall === void 0) { recall = false; }
6065
6182
  if (consentInfo === void 0) { consentInfo = false; }
6066
- var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6183
+ var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6067
6184
  var called = false;
6068
6185
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
6069
6186
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
6070
6187
  // we go through the upgrading flow.
6071
6188
  if (data$2 && (upgraded || wait === false)) {
6072
6189
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
6073
- cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
6190
+ cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
6074
6191
  called = true;
6075
6192
  }
6076
6193
  if (recall || !called) {
@@ -6113,15 +6230,15 @@ function consentv2(consentState, source) {
6113
6230
  consentStatus = updatedStatus;
6114
6231
  callback(true);
6115
6232
  var consentData = getConsentData(consentStatus);
6116
- if (!consentData.analytics_Storage && config$2.track) {
6117
- config$2.track = false;
6233
+ if (!consentData.analytics_Storage && config$3.track) {
6234
+ config$3.track = false;
6118
6235
  clear(true);
6119
6236
  stop();
6120
6237
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
6121
6238
  return;
6122
6239
  }
6123
6240
  if (active() && consentData.analytics_Storage) {
6124
- config$2.track = true;
6241
+ config$3.track = true;
6125
6242
  track(user(), 1 /* BooleanFlag.True */);
6126
6243
  save();
6127
6244
  }
@@ -6153,7 +6270,7 @@ function clear(all) {
6153
6270
  }
6154
6271
  function tab() {
6155
6272
  var id = shortid();
6156
- if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6273
+ if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6157
6274
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
6158
6275
  id = value ? value : id;
6159
6276
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -6162,15 +6279,15 @@ function tab() {
6162
6279
  }
6163
6280
  function callback(consentUpdate) {
6164
6281
  if (consentUpdate === void 0) { consentUpdate = false; }
6165
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6282
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6166
6283
  processCallback(upgrade, consentUpdate);
6167
6284
  }
6168
6285
  function save() {
6169
- if (!data$2 || !config$2.track || config$2.externalSession)
6286
+ if (!data$2 || !config$3.track || config$3.externalSession)
6170
6287
  return;
6171
6288
  var ts = Math.round(Date.now());
6172
- var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6173
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6289
+ var upload = config$3.upload && typeof config$3.upload === "string" /* Constant.String */ ? config$3.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6290
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6174
6291
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6175
6292
  }
6176
6293
  function processCallback(upgrade, consentUpdate) {
@@ -6181,7 +6298,7 @@ function processCallback(upgrade, consentUpdate) {
6181
6298
  if (cb.callback &&
6182
6299
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6183
6300
  (!cb.wait || upgrade)) {
6184
- cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6301
+ cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6185
6302
  cb.called = true;
6186
6303
  if (!cb.recall) {
6187
6304
  callbacks.splice(i, 1);
@@ -6199,7 +6316,7 @@ function track(u, consent) {
6199
6316
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6200
6317
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6201
6318
  // If DOB is not set in the user object, use the date set in the config as a DOB
6202
- var dob = u.dob === 0 ? (config$2.dob === null ? 0 : config$2.dob) : u.dob;
6319
+ var dob = u.dob === 0 ? (config$3.dob === null ? 0 : config$3.dob) : u.dob;
6203
6320
  // To avoid cookie churn, write user id cookie only once every day
6204
6321
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6205
6322
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6215,7 +6332,7 @@ function shortid() {
6215
6332
  }
6216
6333
  function session() {
6217
6334
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6218
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6335
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6219
6336
  if (value) {
6220
6337
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6221
6338
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6236,7 +6353,7 @@ function num(string, base) {
6236
6353
  }
6237
6354
  function user() {
6238
6355
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6239
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6356
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6240
6357
  if (cookie && cookie.length > 0) {
6241
6358
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6242
6359
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6256,15 +6373,15 @@ function user() {
6256
6373
  output.dob = num(parts[4]);
6257
6374
  }
6258
6375
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6259
- config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6376
+ config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6260
6377
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6261
- output.id = config$2.track ? parts[0] : output.id;
6378
+ output.id = config$3.track ? parts[0] : output.id;
6262
6379
  }
6263
6380
  return output;
6264
6381
  }
6265
6382
 
6266
6383
  var data$1 = null;
6267
- function start$7() {
6384
+ function start$8() {
6268
6385
  var m = data$2;
6269
6386
  data$1 = {
6270
6387
  version: version$1,
@@ -6281,7 +6398,7 @@ function start$7() {
6281
6398
  url: ''
6282
6399
  };
6283
6400
  }
6284
- function stop$7() {
6401
+ function stop$8() {
6285
6402
  data$1 = null;
6286
6403
  }
6287
6404
  function envelope(last) {
@@ -6315,7 +6432,7 @@ function reset$2() {
6315
6432
  function report(e) {
6316
6433
  // Do not report the same message twice for the same page
6317
6434
  if (history$1 && history$1.indexOf(e.message) === -1) {
6318
- var url = config$2.report;
6435
+ var url = config$3.report;
6319
6436
  if (url && url.length > 0 && data$1) {
6320
6437
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6321
6438
  if (e.message) {
@@ -6406,7 +6523,7 @@ var pushState = null;
6406
6523
  var replaceState = null;
6407
6524
  var url = null;
6408
6525
  var count = 0;
6409
- function start$6() {
6526
+ function start$7() {
6410
6527
  url = getCurrentUrl();
6411
6528
  count = 0;
6412
6529
  bind(window, "popstate", compute$1);
@@ -6467,26 +6584,26 @@ function restart$1() {
6467
6584
  function getCurrentUrl() {
6468
6585
  return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
6469
6586
  }
6470
- function stop$6() {
6587
+ function stop$7() {
6471
6588
  url = null;
6472
6589
  count = 0;
6473
6590
  }
6474
6591
 
6475
6592
  var status = false;
6476
- function start$5() {
6593
+ function start$6() {
6477
6594
  status = true;
6478
- start$P();
6595
+ start$R();
6479
6596
  reset$4();
6480
6597
  reset$1();
6481
6598
  reset$2();
6482
- start$6();
6599
+ start$7();
6483
6600
  }
6484
- function stop$5() {
6485
- stop$6();
6601
+ function stop$6() {
6602
+ stop$7();
6486
6603
  reset$2();
6487
6604
  reset$1();
6488
6605
  reset$4();
6489
- stop$M();
6606
+ stop$O();
6490
6607
  status = false;
6491
6608
  }
6492
6609
  function active() {
@@ -6514,8 +6631,8 @@ function config(override) {
6514
6631
  return false;
6515
6632
  }
6516
6633
  for (var key in override) {
6517
- if (key in config$2) {
6518
- config$2[key] = override[key];
6634
+ if (key in config$3) {
6635
+ config$3[key] = override[key];
6519
6636
  }
6520
6637
  }
6521
6638
  return true;
@@ -6541,51 +6658,111 @@ function restart() {
6541
6658
  event$1("clarityGemX" /* Constant.Clarity */, "restart" /* Constant.Restart */);
6542
6659
  }
6543
6660
 
6544
- function start$4() {
6545
- start$F();
6661
+ function start$5() {
6662
+ start$G();
6663
+ start$h();
6546
6664
  start$g();
6547
- start$f();
6548
6665
  }
6549
- function stop$4() {
6550
- stop$e();
6666
+ function stop$5() {
6667
+ stop$f();
6551
6668
  }
6552
6669
 
6553
6670
  var diagnostic = /*#__PURE__*/Object.freeze({
6554
6671
  __proto__: null,
6555
- start: start$4,
6556
- stop: stop$4
6672
+ start: start$5,
6673
+ stop: stop$5
6557
6674
  });
6558
6675
 
6676
+ // Called from layout/index.ts before discover.start().
6677
+ // Activates the upload buffer so Event.Discover is held until trigger fires.
6678
+ // discover.start() runs traverse immediately — click/scroll tracking gets valid node ids.
6679
+ function start$4() {
6680
+ var discoverTrigger = get$2().discoverTrigger;
6681
+ if (!discoverTrigger) {
6682
+ return;
6683
+ }
6684
+ config$2(discoverTrigger.maxPlaybackBytes, fire);
6685
+ schedule(discoverTrigger);
6686
+ }
6687
+ function stop$4() {
6688
+ stop$F();
6689
+ }
6690
+ var triggered = false;
6691
+ function fire() {
6692
+ if (triggered) {
6693
+ return;
6694
+ }
6695
+ triggered = true;
6696
+ if (window.GemXHeatmap) {
6697
+ var hashes = getHashes();
6698
+ window.GemXHeatmap.__domSnapshot = hashes;
6699
+ }
6700
+ onTrustedClick(null);
6701
+ onTrustedScroll(null);
6702
+ flush();
6703
+ }
6704
+ function schedule(trigger) {
6705
+ triggered = false;
6706
+ var clickCount = 0;
6707
+ if (trigger.scrollDepthPercent) {
6708
+ onTrustedScroll(function () {
6709
+ var scrolled = window.scrollY + window.innerHeight;
6710
+ var total = document.documentElement.scrollHeight;
6711
+ if ((scrolled / total) * 100 >= trigger.scrollDepthPercent) {
6712
+ fire();
6713
+ }
6714
+ });
6715
+ }
6716
+ if (trigger.clickCount) {
6717
+ onTrustedClick(function () {
6718
+ clickCount++;
6719
+ if (clickCount >= trigger.clickCount) {
6720
+ fire();
6721
+ }
6722
+ });
6723
+ }
6724
+ if (trigger.activeTimeMs) {
6725
+ setTimeout(fire, trigger.activeTimeMs);
6726
+ }
6727
+ // maxPlaybackBytes trigger is handled via gemxUpload.start() callback above
6728
+ }
6729
+ function flush() {
6730
+ inject(drain());
6731
+ uploadNow();
6732
+ }
6733
+
6559
6734
  function start$3() {
6560
6735
  // The order below is important
6561
6736
  // and is determined by interdependencies of modules
6562
- start$n();
6563
- start$k();
6737
+ start$o();
6564
6738
  start$l();
6565
- if (config$2.delayDom) {
6739
+ start$m();
6740
+ if (config$3.delayDom) {
6566
6741
  // Lazy load layout module as part of page load time performance improvements experiment
6567
6742
  bind(window, 'load', function () {
6568
- start$m();
6743
+ start$n();
6569
6744
  });
6570
6745
  }
6571
6746
  else {
6572
- start$m();
6747
+ start$n();
6573
6748
  }
6574
6749
  // IMPORTANT: Start custom element detection BEFORE discover
6575
6750
  // This ensures pre-existing custom elements are registered before DOM traversal
6576
- start$o();
6577
- start$d();
6578
- start$q();
6579
6751
  start$p();
6752
+ start$4(); // activates upload buffer before discover traverses
6753
+ start$e();
6754
+ start$r();
6755
+ start$q();
6580
6756
  }
6581
6757
  function stop$3() {
6582
- stop$i();
6583
6758
  stop$j();
6584
6759
  stop$k();
6585
6760
  stop$l();
6761
+ stop$m();
6762
+ stop$p();
6586
6763
  stop$o();
6587
6764
  stop$n();
6588
- stop$m();
6765
+ stop$4();
6589
6766
  }
6590
6767
 
6591
6768
  var layout = /*#__PURE__*/Object.freeze({
@@ -6813,7 +6990,7 @@ function process(entries) {
6813
6990
  case "resource" /* Constant.Resource */:
6814
6991
  var name_1 = entry.name;
6815
6992
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6816
- if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6993
+ if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6817
6994
  max(28 /* Metric.UploadTime */, entry.duration);
6818
6995
  }
6819
6996
  break;
@@ -6888,8 +7065,8 @@ function start(config$1) {
6888
7065
  // Check that browser supports required APIs and we do not attempt to start Clarity multiple times
6889
7066
  if (check()) {
6890
7067
  config(config$1);
6891
- start$5();
6892
- start$G();
7068
+ start$6();
7069
+ start$H();
6893
7070
  modules.forEach(function (x) { return measure(x.start)(); });
6894
7071
  // If it's an internal call to start, without explicit configuration,
6895
7072
  // re-process any newly accumulated items in the queue
@@ -6920,8 +7097,8 @@ function stop() {
6920
7097
  if (active()) {
6921
7098
  // Stop modules in the reverse order of their initialization and start queuing up items again
6922
7099
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6923
- stop$D();
6924
- stop$5();
7100
+ stop$E();
7101
+ stop$6();
6925
7102
  setup();
6926
7103
  }
6927
7104
  }