@gemx-dev/clarity-js 0.8.86 → 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,
@@ -200,7 +203,7 @@ var startTime = 0;
200
203
  function computeStartTime() {
201
204
  return performance.now() + performance.timeOrigin;
202
205
  }
203
- function start$P() {
206
+ function start$R() {
204
207
  startTime = computeStartTime();
205
208
  }
206
209
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -216,11 +219,11 @@ function time(event) {
216
219
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
217
220
  return Math.max(Math.round(ts + origin - baseline), 0);
218
221
  }
219
- function stop$M() {
222
+ function stop$O() {
220
223
  startTime = 0;
221
224
  }
222
225
 
223
- var version$1 = "0.8.86";
226
+ var version$1 = "0.8.87";
224
227
 
225
228
  // tslint:disable: no-bitwise
226
229
  function hash (input, precision) {
@@ -340,7 +343,7 @@ function url$1(input, electron, truncate) {
340
343
  result = "".concat("https://" /* Data.Constant.HTTPS */).concat("Electron" /* Data.Constant.Electron */);
341
344
  }
342
345
  else {
343
- var drop_1 = config$2.drop;
346
+ var drop_1 = config$3.drop;
344
347
  if (drop_1 && drop_1.length > 0 && input && input.indexOf("?") > 0) {
345
348
  var _a = input.split("?"), path = _a[0], query = _a[1];
346
349
  var swap_1 = "*na*" /* Data.Constant.Dropped */;
@@ -438,9 +441,9 @@ function redact$1(value) {
438
441
  }
439
442
 
440
443
  var state$b = null;
441
- var buffer = null;
444
+ var buffer$1 = null;
442
445
  var update$2 = false;
443
- function start$O() {
446
+ function start$Q() {
444
447
  update$2 = false;
445
448
  reset$u();
446
449
  }
@@ -449,35 +452,35 @@ function reset$u() {
449
452
  // reset the state to current value after sending the previous state
450
453
  if (update$2) {
451
454
  state$b = { time: time(), event: 4 /* Event.Baseline */, data: {
452
- visible: buffer.visible,
453
- docWidth: buffer.docWidth,
454
- docHeight: buffer.docHeight,
455
- screenWidth: buffer.screenWidth,
456
- screenHeight: buffer.screenHeight,
457
- scrollX: buffer.scrollX,
458
- scrollY: buffer.scrollY,
459
- pointerX: buffer.pointerX,
460
- pointerY: buffer.pointerY,
461
- activityTime: buffer.activityTime,
462
- scrollTime: buffer.scrollTime,
463
- pointerTime: buffer.pointerTime,
464
- moveX: buffer.moveX,
465
- moveY: buffer.moveY,
466
- moveTime: buffer.moveTime,
467
- downX: buffer.downX,
468
- downY: buffer.downY,
469
- downTime: buffer.downTime,
470
- upX: buffer.upX,
471
- upY: buffer.upY,
472
- upTime: buffer.upTime,
473
- pointerPrevX: buffer.pointerPrevX,
474
- pointerPrevY: buffer.pointerPrevY,
475
- pointerPrevTime: buffer.pointerPrevTime,
476
- 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,
477
480
  }
478
481
  };
479
482
  }
480
- buffer = buffer ? buffer : {
483
+ buffer$1 = buffer$1 ? buffer$1 : {
481
484
  visible: 1 /* BooleanFlag.True */,
482
485
  docWidth: 0,
483
486
  docHeight: 0,
@@ -508,74 +511,74 @@ function reset$u() {
508
511
  function track$8(event, x, y, time) {
509
512
  switch (event) {
510
513
  case 8 /* Event.Document */:
511
- buffer.docWidth = x;
512
- buffer.docHeight = y;
514
+ buffer$1.docWidth = x;
515
+ buffer$1.docHeight = y;
513
516
  break;
514
517
  case 11 /* Event.Resize */:
515
- buffer.screenWidth = x;
516
- buffer.screenHeight = y;
518
+ buffer$1.screenWidth = x;
519
+ buffer$1.screenHeight = y;
517
520
  break;
518
521
  case 10 /* Event.Scroll */:
519
- buffer.scrollX = x;
520
- buffer.scrollY = y;
521
- buffer.scrollTime = time;
522
+ buffer$1.scrollX = x;
523
+ buffer$1.scrollY = y;
524
+ buffer$1.scrollTime = time;
522
525
  break;
523
526
  case 12 /* Event.MouseMove */:
524
- buffer.moveX = x;
525
- buffer.moveY = y;
526
- buffer.moveTime = time;
527
- buffer.pointerPrevX = buffer.pointerX;
528
- buffer.pointerPrevY = buffer.pointerY;
529
- buffer.pointerPrevTime = buffer.pointerTime;
530
- buffer.pointerX = x;
531
- buffer.pointerY = y;
532
- 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;
533
536
  break;
534
537
  case 13 /* Event.MouseDown */:
535
- buffer.downX = x;
536
- buffer.downY = y;
537
- buffer.downTime = time;
538
- buffer.pointerPrevX = buffer.pointerX;
539
- buffer.pointerPrevY = buffer.pointerY;
540
- buffer.pointerPrevTime = buffer.pointerTime;
541
- buffer.pointerX = x;
542
- buffer.pointerY = y;
543
- 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;
544
547
  break;
545
548
  case 14 /* Event.MouseUp */:
546
- buffer.upX = x;
547
- buffer.upY = y;
548
- buffer.upTime = time;
549
- buffer.pointerPrevX = buffer.pointerX;
550
- buffer.pointerPrevY = buffer.pointerY;
551
- buffer.pointerPrevTime = buffer.pointerTime;
552
- buffer.pointerX = x;
553
- buffer.pointerY = y;
554
- 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;
555
558
  break;
556
559
  default:
557
- buffer.pointerPrevX = buffer.pointerX;
558
- buffer.pointerPrevY = buffer.pointerY;
559
- buffer.pointerPrevTime = buffer.pointerTime;
560
- buffer.pointerX = x;
561
- buffer.pointerY = y;
562
- 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;
563
566
  break;
564
567
  }
565
568
  update$2 = true;
566
569
  }
567
570
  function activity(t) {
568
- buffer.activityTime = t;
571
+ buffer$1.activityTime = t;
569
572
  }
570
573
  function visibility$1(t, visible) {
571
- buffer.visible = visible;
572
- if (!buffer.visible) {
574
+ buffer$1.visible = visible;
575
+ if (!buffer$1.visible) {
573
576
  activity(t);
574
577
  }
575
578
  update$2 = true;
576
579
  }
577
580
  function dynamic$1(modules) {
578
- buffer.modules = Array.from(modules);
581
+ buffer$1.modules = Array.from(modules);
579
582
  update$2 = true;
580
583
  }
581
584
  function compute$g() {
@@ -583,7 +586,7 @@ function compute$g() {
583
586
  encode$1(4 /* Event.Baseline */);
584
587
  }
585
588
  }
586
- function stop$L() {
589
+ function stop$N() {
587
590
  reset$u();
588
591
  }
589
592
 
@@ -593,9 +596,9 @@ var baseline = /*#__PURE__*/Object.freeze({
593
596
  compute: compute$g,
594
597
  dynamic: dynamic$1,
595
598
  reset: reset$u,
596
- start: start$O,
599
+ start: start$Q,
597
600
  get state () { return state$b; },
598
- stop: stop$L,
601
+ stop: stop$N,
599
602
  track: track$8,
600
603
  visibility: visibility$1
601
604
  });
@@ -620,12 +623,12 @@ function event$1(a, b) {
620
623
 
621
624
  var data$k = null;
622
625
  var updates$3 = null;
623
- function start$N() {
626
+ function start$P() {
624
627
  data$k = {};
625
628
  updates$3 = {};
626
629
  count$1(5 /* Metric.InvokeCount */);
627
630
  }
628
- function stop$K() {
631
+ function stop$M() {
629
632
  data$k = {};
630
633
  updates$3 = {};
631
634
  }
@@ -681,7 +684,7 @@ var data$j;
681
684
  var last = 0;
682
685
  var interval = 0;
683
686
  var timeout$7 = null;
684
- function start$M() {
687
+ function start$O() {
685
688
  interval = 60000 /* Setting.PingInterval */;
686
689
  last = 0;
687
690
  }
@@ -703,7 +706,7 @@ function ping() {
703
706
  suspend();
704
707
  }
705
708
  }
706
- function stop$J() {
709
+ function stop$L() {
707
710
  clearTimeout$1(timeout$7);
708
711
  last = 0;
709
712
  interval = 0;
@@ -713,15 +716,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
713
716
  __proto__: null,
714
717
  get data () { return data$j; },
715
718
  reset: reset$s,
716
- start: start$M,
717
- stop: stop$J
719
+ start: start$O,
720
+ stop: stop$L
718
721
  });
719
722
 
720
723
  var data$i = null;
721
- function start$L() {
724
+ function start$N() {
722
725
  data$i = {};
723
726
  }
724
- function stop$I() {
727
+ function stop$K() {
725
728
  data$i = {};
726
729
  }
727
730
  function track$7(event, time) {
@@ -753,8 +756,8 @@ var summary = /*#__PURE__*/Object.freeze({
753
756
  compute: compute$e,
754
757
  get data () { return data$i; },
755
758
  reset: reset$r,
756
- start: start$L,
757
- stop: stop$I,
759
+ start: start$N,
760
+ stop: stop$K,
758
761
  track: track$7
759
762
  });
760
763
 
@@ -893,7 +896,7 @@ function read(stream) {
893
896
  }
894
897
 
895
898
  var data$h = null;
896
- function start$K() {
899
+ function start$M() {
897
900
  reset$q();
898
901
  }
899
902
  function set$1(variable, value) {
@@ -955,7 +958,7 @@ function compute$d() {
955
958
  function reset$q() {
956
959
  data$h = {};
957
960
  }
958
- function stop$H() {
961
+ function stop$J() {
959
962
  reset$q();
960
963
  }
961
964
  function redact(input) {
@@ -995,8 +998,8 @@ var variable = /*#__PURE__*/Object.freeze({
995
998
  identify: identify,
996
999
  reset: reset$q,
997
1000
  set: set$1,
998
- start: start$K,
999
- stop: stop$H
1001
+ start: start$M,
1002
+ stop: stop$J
1000
1003
  });
1001
1004
 
1002
1005
  var data$g = {};
@@ -1005,7 +1008,7 @@ var variables = {};
1005
1008
  var selectors = {};
1006
1009
  var hashes = {};
1007
1010
  var validation = {};
1008
- function start$J() {
1011
+ function start$L() {
1009
1012
  reset$p();
1010
1013
  }
1011
1014
  // Input string is of the following form:
@@ -1121,7 +1124,7 @@ function update$1(key, subkey, value) {
1121
1124
  }
1122
1125
  return;
1123
1126
  }
1124
- function stop$G() {
1127
+ function stop$I() {
1125
1128
  reset$p();
1126
1129
  }
1127
1130
  function parse$1(variable) {
@@ -1194,8 +1197,8 @@ var extract = /*#__PURE__*/Object.freeze({
1194
1197
  data: data$g,
1195
1198
  keys: keys,
1196
1199
  reset: reset$p,
1197
- start: start$J,
1198
- stop: stop$G,
1200
+ start: start$L,
1201
+ stop: stop$I,
1199
1202
  trigger: trigger$2,
1200
1203
  update: update$1
1201
1204
  });
@@ -1223,10 +1226,10 @@ function decodeCookieValue(value) {
1223
1226
 
1224
1227
  var rootDomain = null;
1225
1228
  var COOKIE_SEP = "^" /* Constant.Caret */;
1226
- function start$I() {
1229
+ function start$K() {
1227
1230
  rootDomain = null;
1228
1231
  }
1229
- function stop$F() {
1232
+ function stop$H() {
1230
1233
  rootDomain = null;
1231
1234
  }
1232
1235
  function getCookie(key, limit) {
@@ -1262,7 +1265,7 @@ function getCookie(key, limit) {
1262
1265
  function setCookie(key, value, time) {
1263
1266
  // only write cookies if we are currently in a cookie writing mode (and they are supported)
1264
1267
  // OR if we are trying to write an empty cookie (i.e. clear the cookie value out)
1265
- 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 */))) {
1266
1269
  // Some browsers automatically url encode cookie values if they are not url encoded.
1267
1270
  // We therefore encode and decode cookie values ourselves.
1268
1271
  var encodedValue = encodeCookieValue(value);
@@ -1308,23 +1311,25 @@ var cookie = /*#__PURE__*/Object.freeze({
1308
1311
  COOKIE_SEP: COOKIE_SEP,
1309
1312
  getCookie: getCookie,
1310
1313
  setCookie: setCookie,
1311
- start: start$I,
1312
- stop: stop$F
1314
+ start: start$K,
1315
+ stop: stop$H
1313
1316
  });
1314
1317
 
1315
1318
  var defaultConfig = {
1316
1319
  excludeClassNames: [],
1317
1320
  ignoreMutationClassNames: [],
1321
+ discoverTrigger: null,
1318
1322
  };
1319
1323
  var _config = __assign({}, defaultConfig);
1320
- function start$H() {
1321
- var _a, _b, _c, _d;
1324
+ function start$J() {
1325
+ var _a, _b, _c, _d, _e, _f;
1322
1326
  _config = {
1323
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 : []),
1324
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),
1325
1330
  };
1326
1331
  }
1327
- function stop$E() {
1332
+ function stop$G() {
1328
1333
  _config = __assign({}, defaultConfig);
1329
1334
  }
1330
1335
  function set(config) {
@@ -1338,8 +1343,61 @@ var gemx = /*#__PURE__*/Object.freeze({
1338
1343
  __proto__: null,
1339
1344
  get: get$2,
1340
1345
  set: set,
1341
- start: start$H,
1342
- 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
1343
1401
  });
1344
1402
 
1345
1403
  var signalCallback = null;
@@ -1370,25 +1428,25 @@ function signalsEvent(signalsPayload) {
1370
1428
  }
1371
1429
  }
1372
1430
 
1373
- var modules$3 = [gemx, baseline, dimension, variable, limit, summary, cookie, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1374
- 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() {
1375
1433
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1376
- start$N();
1434
+ start$P();
1377
1435
  modules$3.forEach(function (x) { return measure(x.start)(); });
1378
1436
  }
1379
- function stop$D() {
1437
+ function stop$E() {
1380
1438
  // Stop modules in the reverse order of their initialization
1381
1439
  // The ordering below should respect inter-module dependency.
1382
1440
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1383
1441
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1384
1442
  modules$3.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1385
- stop$K();
1443
+ stop$M();
1386
1444
  }
1387
1445
  function compute$b() {
1388
1446
  compute$g();
1389
1447
  compute$4();
1390
1448
  compute$2();
1391
- if (config$2.mode !== "gemx") {
1449
+ if (config$3.mode !== "gemx") {
1392
1450
  compute$d();
1393
1451
  compute$3();
1394
1452
  compute$f();
@@ -1399,7 +1457,7 @@ function compute$b() {
1399
1457
 
1400
1458
  var history$5 = [];
1401
1459
  var data$f;
1402
- function start$F() {
1460
+ function start$G() {
1403
1461
  history$5 = [];
1404
1462
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1405
1463
  try {
@@ -1412,7 +1470,7 @@ function start$F() {
1412
1470
  }
1413
1471
  function check$5(id, target, input) {
1414
1472
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1415
- 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 */) {
1416
1474
  data$f = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1417
1475
  // Only encode this event if we haven't already reported this hash
1418
1476
  if (history$5.indexOf(data$f.checksum) < 0) {
@@ -1435,7 +1493,7 @@ var MaskTagsList = ["INPUT", "SELECT", "TEXTAREA"];
1435
1493
  var ExcludeClassNamesList = ["load", "active", "fixed", "visible", "focus", "show", "collaps", "animat"];
1436
1494
 
1437
1495
  var state$a = [];
1438
- function start$E() {
1496
+ function start$F() {
1439
1497
  reset$o();
1440
1498
  }
1441
1499
  function observe$c(root) {
@@ -1445,15 +1503,15 @@ function recompute$8(evt) {
1445
1503
  var element = target(evt);
1446
1504
  if (element) {
1447
1505
  var value = element.value;
1448
- 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 */;
1449
1507
  state$a.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1450
- schedule(encode$4.bind(this, 42 /* Event.Change */));
1508
+ schedule$1(encode$4.bind(this, 42 /* Event.Change */));
1451
1509
  }
1452
1510
  }
1453
1511
  function reset$o() {
1454
1512
  state$a = [];
1455
1513
  }
1456
- function stop$C() {
1514
+ function stop$D() {
1457
1515
  reset$o();
1458
1516
  }
1459
1517
 
@@ -1461,9 +1519,9 @@ var change = /*#__PURE__*/Object.freeze({
1461
1519
  __proto__: null,
1462
1520
  observe: observe$c,
1463
1521
  reset: reset$o,
1464
- start: start$E,
1522
+ start: start$F,
1465
1523
  get state () { return state$a; },
1466
- stop: stop$C
1524
+ stop: stop$D
1467
1525
  });
1468
1526
 
1469
1527
  function offset(element) {
@@ -1485,7 +1543,9 @@ function offset(element) {
1485
1543
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1486
1544
  var VM_PATTERN = /VM\d/;
1487
1545
  var state$9 = [];
1488
- function start$D() {
1546
+ var trustedCallback$1 = null;
1547
+ function onTrustedClick(cb) { trustedCallback$1 = cb; }
1548
+ function start$E() {
1489
1549
  reset$n();
1490
1550
  }
1491
1551
  function observe$b(root) {
@@ -1523,7 +1583,7 @@ function handler$4(event, root, evt) {
1523
1583
  // Check for null values before processing this event
1524
1584
  if (x !== null && y !== null) {
1525
1585
  var textInfo = text(t);
1526
- if (config$2.diagnostics) {
1586
+ if (config$3.diagnostics) {
1527
1587
  var el = t;
1528
1588
  console.log("[clarity:click] text debug", {
1529
1589
  tag: el === null || el === void 0 ? void 0 : el.tagName,
@@ -1560,10 +1620,13 @@ function handler$4(event, root, evt) {
1560
1620
  tag: getElementAttribute(t, "tagName").substring(0, 10 /* Setting.ClickTag */),
1561
1621
  class: getElementAttribute(t, "className").substring(0, 50 /* Setting.ClickClass */),
1562
1622
  id: getElementAttribute(t, "id").substring(0, 25 /* Setting.ClickId */),
1563
- source: config$2.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1623
+ source: config$3.diagnostics && !evt.isTrusted ? source() : 0 /* ClickSource.Undefined */
1564
1624
  }
1565
1625
  });
1566
- schedule(encode$4.bind(this, event));
1626
+ if (evt.isTrusted && trustedCallback$1) {
1627
+ trustedCallback$1();
1628
+ }
1629
+ schedule$1(encode$4.bind(this, event));
1567
1630
  }
1568
1631
  }
1569
1632
  function link(node) {
@@ -1716,21 +1779,22 @@ function source() {
1716
1779
  function reset$n() {
1717
1780
  state$9 = [];
1718
1781
  }
1719
- function stop$B() {
1782
+ function stop$C() {
1720
1783
  reset$n();
1721
1784
  }
1722
1785
 
1723
1786
  var click = /*#__PURE__*/Object.freeze({
1724
1787
  __proto__: null,
1725
1788
  observe: observe$b,
1789
+ onTrustedClick: onTrustedClick,
1726
1790
  reset: reset$n,
1727
- start: start$D,
1791
+ start: start$E,
1728
1792
  get state () { return state$9; },
1729
- stop: stop$B
1793
+ stop: stop$C
1730
1794
  });
1731
1795
 
1732
1796
  var state$8 = [];
1733
- function start$C() {
1797
+ function start$D() {
1734
1798
  reset$m();
1735
1799
  }
1736
1800
  function observe$a(root) {
@@ -1740,12 +1804,12 @@ function observe$a(root) {
1740
1804
  }
1741
1805
  function recompute$7(action, evt) {
1742
1806
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1743
- schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1807
+ schedule$1(encode$4.bind(this, 38 /* Event.Clipboard */));
1744
1808
  }
1745
1809
  function reset$m() {
1746
1810
  state$8 = [];
1747
1811
  }
1748
- function stop$A() {
1812
+ function stop$B() {
1749
1813
  reset$m();
1750
1814
  }
1751
1815
 
@@ -1753,14 +1817,14 @@ var clipboard = /*#__PURE__*/Object.freeze({
1753
1817
  __proto__: null,
1754
1818
  observe: observe$a,
1755
1819
  reset: reset$m,
1756
- start: start$C,
1820
+ start: start$D,
1757
1821
  get state () { return state$8; },
1758
- stop: stop$A
1822
+ stop: stop$B
1759
1823
  });
1760
1824
 
1761
1825
  var timeout$6 = null;
1762
1826
  var state$7 = [];
1763
- function start$B() {
1827
+ function start$C() {
1764
1828
  reset$l();
1765
1829
  }
1766
1830
  function observe$9(root) {
@@ -1789,12 +1853,12 @@ function recompute$6(evt) {
1789
1853
  }
1790
1854
  }
1791
1855
  function process$7(event) {
1792
- schedule(encode$4.bind(this, event));
1856
+ schedule$1(encode$4.bind(this, event));
1793
1857
  }
1794
1858
  function reset$l() {
1795
1859
  state$7 = [];
1796
1860
  }
1797
- function stop$z() {
1861
+ function stop$A() {
1798
1862
  clearTimeout$1(timeout$6);
1799
1863
  reset$l();
1800
1864
  }
@@ -1803,9 +1867,9 @@ var input = /*#__PURE__*/Object.freeze({
1803
1867
  __proto__: null,
1804
1868
  observe: observe$9,
1805
1869
  reset: reset$l,
1806
- start: start$B,
1870
+ start: start$C,
1807
1871
  get state () { return state$7; },
1808
- stop: stop$z
1872
+ stop: stop$A
1809
1873
  });
1810
1874
 
1811
1875
  var state$6 = [];
@@ -1813,7 +1877,7 @@ var timeout$5 = null;
1813
1877
  var hasPrimaryTouch = false;
1814
1878
  var primaryTouchId = 0;
1815
1879
  var activeTouchPointIds = new Set();
1816
- function start$A() {
1880
+ function start$B() {
1817
1881
  reset$k();
1818
1882
  }
1819
1883
  function observe$8(root) {
@@ -1907,7 +1971,7 @@ function handler$3(current) {
1907
1971
  }
1908
1972
  }
1909
1973
  function process$6(event) {
1910
- schedule(encode$4.bind(this, event));
1974
+ schedule$1(encode$4.bind(this, event));
1911
1975
  }
1912
1976
  function reset$k() {
1913
1977
  state$6 = [];
@@ -1921,7 +1985,7 @@ function similar$1(last, current) {
1921
1985
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1922
1986
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1923
1987
  }
1924
- function stop$y() {
1988
+ function stop$z() {
1925
1989
  clearTimeout$1(timeout$5);
1926
1990
  // Send out any pending pointer events in the pipeline
1927
1991
  if (state$6.length > 0) {
@@ -1933,9 +1997,9 @@ var pointer = /*#__PURE__*/Object.freeze({
1933
1997
  __proto__: null,
1934
1998
  observe: observe$8,
1935
1999
  reset: reset$k,
1936
- start: start$A,
2000
+ start: start$B,
1937
2001
  get state () { return state$6; },
1938
- stop: stop$y
2002
+ stop: stop$z
1939
2003
  });
1940
2004
 
1941
2005
  /**
@@ -1990,7 +2054,7 @@ var data$e;
1990
2054
  var timeout$4 = null;
1991
2055
  var initialStateLogged = false;
1992
2056
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1993
- function start$z() {
2057
+ function start$A() {
1994
2058
  initialStateLogged = false;
1995
2059
  bind(window, "resize", throttledRecompute$1);
1996
2060
  recompute$5();
@@ -2013,14 +2077,14 @@ function recompute$5() {
2013
2077
  }
2014
2078
  }
2015
2079
  function process$5(event) {
2016
- schedule(encode$4.bind(this, event));
2080
+ schedule$1(encode$4.bind(this, event));
2017
2081
  }
2018
2082
  function reset$j() {
2019
2083
  data$e = null;
2020
2084
  clearTimeout$1(timeout$4);
2021
2085
  throttledRecompute$1.cleanup();
2022
2086
  }
2023
- function stop$x() {
2087
+ function stop$y() {
2024
2088
  reset$j();
2025
2089
  }
2026
2090
 
@@ -2028,15 +2092,17 @@ var resize = /*#__PURE__*/Object.freeze({
2028
2092
  __proto__: null,
2029
2093
  get data () { return data$e; },
2030
2094
  reset: reset$j,
2031
- start: start$z,
2032
- stop: stop$x
2095
+ start: start$A,
2096
+ stop: stop$y
2033
2097
  });
2034
2098
 
2035
2099
  var state$5 = [];
2100
+ var trustedCallback = null;
2101
+ function onTrustedScroll(cb) { trustedCallback = cb; }
2036
2102
  var initialTop = null;
2037
2103
  var initialBottom = null;
2038
2104
  var timeout$3 = null;
2039
- function start$y() {
2105
+ function start$z() {
2040
2106
  state$5 = [];
2041
2107
  recompute$4();
2042
2108
  }
@@ -2075,6 +2141,9 @@ function recompute$4(event) {
2075
2141
  var top = getPositionNode(xPosition, startYPosition);
2076
2142
  var bottom = getPositionNode(xPosition, endYPosition);
2077
2143
  var trust = event && event.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
2144
+ if (event && event.isTrusted && trustedCallback) {
2145
+ trustedCallback();
2146
+ }
2078
2147
  var current = { time: time(event), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y, top: top, bottom: bottom, trust: trust } };
2079
2148
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
2080
2149
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
@@ -2115,7 +2184,7 @@ function reset$i() {
2115
2184
  initialBottom = null;
2116
2185
  }
2117
2186
  function process$4(event) {
2118
- schedule(encode$4.bind(this, event));
2187
+ schedule$1(encode$4.bind(this, event));
2119
2188
  }
2120
2189
  function similar(last, current) {
2121
2190
  var dx = last.data.x - current.data.x;
@@ -2133,7 +2202,7 @@ function compute$a() {
2133
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 */));
2134
2203
  }
2135
2204
  }
2136
- function stop$w() {
2205
+ function stop$x() {
2137
2206
  clearTimeout$1(timeout$3);
2138
2207
  throttledRecompute.cleanup();
2139
2208
  state$5 = [];
@@ -2145,16 +2214,17 @@ var scroll = /*#__PURE__*/Object.freeze({
2145
2214
  __proto__: null,
2146
2215
  compute: compute$a,
2147
2216
  observe: observe$7,
2217
+ onTrustedScroll: onTrustedScroll,
2148
2218
  reset: reset$i,
2149
- start: start$y,
2219
+ start: start$z,
2150
2220
  get state () { return state$5; },
2151
- stop: stop$w
2221
+ stop: stop$x
2152
2222
  });
2153
2223
 
2154
2224
  var data$d = null;
2155
2225
  var previous = null;
2156
2226
  var timeout$2 = null;
2157
- function start$x() {
2227
+ function start$y() {
2158
2228
  reset$h();
2159
2229
  }
2160
2230
  function observe$6(root) {
@@ -2192,13 +2262,13 @@ function recompute$3(root) {
2192
2262
  timeout$2 = setTimeout$1(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
2193
2263
  }
2194
2264
  function process$3(event) {
2195
- schedule(encode$4.bind(this, event));
2265
+ schedule$1(encode$4.bind(this, event));
2196
2266
  }
2197
2267
  function reset$h() {
2198
2268
  previous = null;
2199
2269
  data$d = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
2200
2270
  }
2201
- function stop$v() {
2271
+ function stop$w() {
2202
2272
  reset$h();
2203
2273
  clearTimeout$1(timeout$2);
2204
2274
  }
@@ -2208,12 +2278,12 @@ var selection = /*#__PURE__*/Object.freeze({
2208
2278
  get data () { return data$d; },
2209
2279
  observe: observe$6,
2210
2280
  reset: reset$h,
2211
- start: start$x,
2212
- stop: stop$v
2281
+ start: start$y,
2282
+ stop: stop$w
2213
2283
  });
2214
2284
 
2215
2285
  var state$4 = [];
2216
- function start$w() {
2286
+ function start$x() {
2217
2287
  reset$g();
2218
2288
  }
2219
2289
  function observe$5(root) {
@@ -2221,12 +2291,12 @@ function observe$5(root) {
2221
2291
  }
2222
2292
  function recompute$2(evt) {
2223
2293
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
2224
- schedule(encode$4.bind(this, 39 /* Event.Submit */));
2294
+ schedule$1(encode$4.bind(this, 39 /* Event.Submit */));
2225
2295
  }
2226
2296
  function reset$g() {
2227
2297
  state$4 = [];
2228
2298
  }
2229
- function stop$u() {
2299
+ function stop$v() {
2230
2300
  reset$g();
2231
2301
  }
2232
2302
 
@@ -2234,18 +2304,18 @@ var submit = /*#__PURE__*/Object.freeze({
2234
2304
  __proto__: null,
2235
2305
  observe: observe$5,
2236
2306
  reset: reset$g,
2237
- start: start$w,
2307
+ start: start$x,
2238
2308
  get state () { return state$4; },
2239
- stop: stop$u
2309
+ stop: stop$v
2240
2310
  });
2241
2311
 
2242
2312
  var data$c;
2243
- function start$v() {
2313
+ function start$w() {
2244
2314
  bind(window, "pagehide", recompute$1);
2245
2315
  bind(window, "beforeunload", beforeUnload);
2246
2316
  }
2247
2317
  function beforeUnload() {
2248
- flush();
2318
+ flush$1();
2249
2319
  }
2250
2320
  function recompute$1(evt) {
2251
2321
  data$c = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
@@ -2255,7 +2325,7 @@ function recompute$1(evt) {
2255
2325
  function reset$f() {
2256
2326
  data$c = null;
2257
2327
  }
2258
- function stop$t() {
2328
+ function stop$u() {
2259
2329
  reset$f();
2260
2330
  }
2261
2331
 
@@ -2263,12 +2333,12 @@ var unload = /*#__PURE__*/Object.freeze({
2263
2333
  __proto__: null,
2264
2334
  get data () { return data$c; },
2265
2335
  reset: reset$f,
2266
- start: start$v,
2267
- stop: stop$t
2336
+ start: start$w,
2337
+ stop: stop$u
2268
2338
  });
2269
2339
 
2270
2340
  var data$b;
2271
- function start$u() {
2341
+ function start$v() {
2272
2342
  bind(document, "visibilitychange", recompute);
2273
2343
  recompute();
2274
2344
  }
@@ -2283,7 +2353,7 @@ function recompute(evt) {
2283
2353
  function reset$e() {
2284
2354
  data$b = null;
2285
2355
  }
2286
- function stop$s() {
2356
+ function stop$t() {
2287
2357
  reset$e();
2288
2358
  }
2289
2359
 
@@ -2291,16 +2361,16 @@ var visibility = /*#__PURE__*/Object.freeze({
2291
2361
  __proto__: null,
2292
2362
  get data () { return data$b; },
2293
2363
  reset: reset$e,
2294
- start: start$u,
2295
- stop: stop$s
2364
+ start: start$v,
2365
+ stop: stop$t
2296
2366
  });
2297
2367
 
2298
2368
  var data$a;
2299
- function start$t() {
2369
+ function start$u() {
2300
2370
  bind(window, "focus", function () { return compute$9(1 /* BooleanFlag.True */); });
2301
2371
  bind(window, "blur", function () { return compute$9(0 /* BooleanFlag.False */); });
2302
2372
  }
2303
- function stop$r() {
2373
+ function stop$s() {
2304
2374
  reset$d();
2305
2375
  }
2306
2376
  function reset$d() {
@@ -2315,12 +2385,12 @@ var focus = /*#__PURE__*/Object.freeze({
2315
2385
  __proto__: null,
2316
2386
  get data () { return data$a; },
2317
2387
  reset: reset$d,
2318
- start: start$t,
2319
- stop: stop$r
2388
+ start: start$u,
2389
+ stop: stop$s
2320
2390
  });
2321
2391
 
2322
2392
  var bound = false;
2323
- function start$s() {
2393
+ function start$t() {
2324
2394
  // Only bind once - this listener must persist even when Clarity stops
2325
2395
  // to detect when the page is restored from bfcache
2326
2396
  if (!bound) {
@@ -2341,15 +2411,15 @@ function handler$2(evt) {
2341
2411
  log$1(11 /* Code.BFCache */, 0 /* Severity.Info */);
2342
2412
  }
2343
2413
  }
2344
- function stop$q() {
2414
+ function stop$r() {
2345
2415
  // Intentionally don't remove the listener or reset 'bound' flag
2346
2416
  // We need the listener to persist to detect bfcache restoration
2347
2417
  }
2348
2418
 
2349
2419
  var pageshow = /*#__PURE__*/Object.freeze({
2350
2420
  __proto__: null,
2351
- start: start$s,
2352
- stop: stop$q
2421
+ start: start$t,
2422
+ stop: stop$r
2353
2423
  });
2354
2424
 
2355
2425
  var GEMX$1 = [
@@ -2380,15 +2450,15 @@ var ALL$1 = [
2380
2450
  var GEMX_OBSERVE = { allRoots: [scroll], documentOnly: [click] };
2381
2451
  var ALL_OBSERVE = { allRoots: [scroll], documentOnly: [click, clipboard, pointer, input, selection, change, submit] };
2382
2452
  var modules$2 = ALL$1;
2383
- function start$r() {
2384
- modules$2 = config$2.mode === "gemx" ? GEMX$1 : ALL$1;
2453
+ function start$s() {
2454
+ modules$2 = config$3.mode === "gemx" ? GEMX$1 : ALL$1;
2385
2455
  modules$2.forEach(function (m) { return m.start(); });
2386
2456
  }
2387
- function stop$p() {
2457
+ function stop$q() {
2388
2458
  modules$2.forEach(function (m) { return m.stop(); });
2389
2459
  }
2390
2460
  function observe$4(root) {
2391
- var observeModules = config$2.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2461
+ var observeModules = config$3.mode === "gemx" ? GEMX_OBSERVE : ALL_OBSERVE;
2392
2462
  observeModules.allRoots.forEach(function (m) { return m.observe(root); });
2393
2463
  if (root.nodeType === Node.DOCUMENT_NODE) {
2394
2464
  observeModules.documentOnly.forEach(function (m) { return m.observe(root); });
@@ -2398,8 +2468,8 @@ function observe$4(root) {
2398
2468
  var interaction = /*#__PURE__*/Object.freeze({
2399
2469
  __proto__: null,
2400
2470
  observe: observe$4,
2401
- start: start$r,
2402
- stop: stop$p
2471
+ start: start$s,
2472
+ stop: stop$q
2403
2473
  });
2404
2474
 
2405
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
@@ -2453,7 +2523,7 @@ var styleTimeMap = {};
2453
2523
  var documentNodes = [];
2454
2524
  var createdSheetIds = [];
2455
2525
  function proxyStyleRules$1(win) {
2456
- if ((config$2.lean && config$2.lite) || win === null || win === undefined) {
2526
+ if ((config$3.lean && config$3.lite) || win === null || win === undefined) {
2457
2527
  return;
2458
2528
  }
2459
2529
  win.clarityOverrides = win.clarityOverrides || {};
@@ -2488,11 +2558,11 @@ function proxyStyleRules$1(win) {
2488
2558
  }
2489
2559
  }
2490
2560
  }
2491
- function start$q() {
2561
+ function start$r() {
2492
2562
  proxyStyleRules$1(window);
2493
2563
  }
2494
2564
  function checkDocumentStyles(documentNode, timestamp) {
2495
- if (config$2.lean && config$2.lite) {
2565
+ if (config$3.lean && config$3.lite) {
2496
2566
  return;
2497
2567
  }
2498
2568
  if (documentNodes.indexOf(documentNode) === -1) {
@@ -2544,7 +2614,7 @@ function reset$c() {
2544
2614
  sheetAdoptionState = [];
2545
2615
  sheetUpdateState = [];
2546
2616
  }
2547
- function stop$o() {
2617
+ function stop$p() {
2548
2618
  styleSheetMap = {};
2549
2619
  styleTimeMap = {};
2550
2620
  documentNodes = [];
@@ -2592,7 +2662,7 @@ var animationFinish = null;
2592
2662
  var animationId = 'clarityAnimationId';
2593
2663
  var operationCount = 'clarityOperationCount';
2594
2664
  var maxOperations = 20;
2595
- function start$p() {
2665
+ function start$q() {
2596
2666
  if (window["Animation"] &&
2597
2667
  window["Animation"].prototype &&
2598
2668
  window["KeyframeEffect"] &&
@@ -2647,7 +2717,7 @@ function track$6(time, id, operation, keyFrames, timing, targetId, timeline) {
2647
2717
  });
2648
2718
  encode$5(44 /* Event.Animation */);
2649
2719
  }
2650
- function stop$n() {
2720
+ function stop$o() {
2651
2721
  reset$b();
2652
2722
  }
2653
2723
  function overrideAnimationHelper(functionToOverride, name) {
@@ -2704,7 +2774,7 @@ function register$1(tag) {
2704
2774
  if (!definedElements.has(tag)) {
2705
2775
  definedElements.add(tag);
2706
2776
  elements.push(tag);
2707
- schedule(encode$5.bind(this, 51 /* Event.CustomElement */));
2777
+ schedule$1(encode$5.bind(this, 51 /* Event.CustomElement */));
2708
2778
  }
2709
2779
  }
2710
2780
  function check$4(tag) {
@@ -2713,7 +2783,7 @@ function check$4(tag) {
2713
2783
  register$1(tag);
2714
2784
  }
2715
2785
  }
2716
- function start$o() {
2786
+ function start$p() {
2717
2787
  var _a;
2718
2788
  // Wrap in try-catch to handle Safari iOS where window properties or customElements.define may be readonly
2719
2789
  try {
@@ -2735,7 +2805,7 @@ function start$o() {
2735
2805
  function reset$a() {
2736
2806
  elements.length = 0;
2737
2807
  }
2738
- function stop$m() {
2808
+ function stop$n() {
2739
2809
  reset$a();
2740
2810
  definedElements.clear();
2741
2811
  }
@@ -2885,7 +2955,7 @@ function encode$5 (type, timer, ts) {
2885
2955
  if (type === 6 /* Event.Mutation */) {
2886
2956
  activity(eventTime);
2887
2957
  }
2888
- queue(tokenize(tokens), !config$2.lean);
2958
+ queue(tokenize(tokens), !config$3.lean);
2889
2959
  _o.label = 11;
2890
2960
  case 11: return [3 /*break*/, 13];
2891
2961
  case 12:
@@ -2927,7 +2997,7 @@ var data$9;
2927
2997
  function reset$9() {
2928
2998
  data$9 = null;
2929
2999
  }
2930
- function start$n() {
3000
+ function start$o() {
2931
3001
  reset$9();
2932
3002
  compute$7();
2933
3003
  }
@@ -2954,7 +3024,7 @@ function compute$7() {
2954
3024
  encode$5(8 /* Event.Document */);
2955
3025
  }
2956
3026
  }
2957
- function stop$l() {
3027
+ function stop$m() {
2958
3028
  reset$9();
2959
3029
  }
2960
3030
 
@@ -3006,7 +3076,7 @@ var history$4 = {};
3006
3076
  var observedNodes = new WeakMap();
3007
3077
  // We ignore mutations if these attributes are updated
3008
3078
  var IGNORED_ATTRIBUTES = ["data-google-query-id", "data-load-complete", "data-google-container-id"];
3009
- function start$m() {
3079
+ function start$n() {
3010
3080
  observers = new Set();
3011
3081
  queue$2 = [];
3012
3082
  timeout$1 = null;
@@ -3044,7 +3114,7 @@ function monitor(frame) {
3044
3114
  bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
3045
3115
  }
3046
3116
  }
3047
- function stop$k() {
3117
+ function stop$l() {
3048
3118
  for (var _i = 0, _a = Array.from(observers); _i < _a.length; _i++) {
3049
3119
  var observer = _a[_i];
3050
3120
  if (observer) {
@@ -3076,7 +3146,7 @@ function handle$1(m) {
3076
3146
  var now = time();
3077
3147
  track$7(6 /* Event.Mutation */, now);
3078
3148
  mutations.push({ time: now, mutations: m });
3079
- schedule(process$2, 1 /* Priority.High */).then(function () {
3149
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
3080
3150
  setTimeout$1(compute$7);
3081
3151
  measure(compute$6)();
3082
3152
  });
@@ -3105,7 +3175,7 @@ function processMutation(timer, mutation, instance, timestamp) {
3105
3175
  return [2 /*return*/];
3106
3176
  }
3107
3177
  }
3108
- type = config$2.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3178
+ type = config$3.throttleDom ? track$5(mutation, timer, instance, timestamp) : mutation.type;
3109
3179
  if (type && target && target.ownerDocument) {
3110
3180
  parse(target.ownerDocument);
3111
3181
  }
@@ -3138,7 +3208,7 @@ function process$2() {
3138
3208
  switch (_d.label) {
3139
3209
  case 0:
3140
3210
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
3141
- start$e(timer);
3211
+ start$f(timer);
3142
3212
  _d.label = 1;
3143
3213
  case 1:
3144
3214
  if (!(mutations.length > 0)) return [3 /*break*/, 7];
@@ -3188,7 +3258,7 @@ function process$2() {
3188
3258
  _d.label = 13;
3189
3259
  case 13:
3190
3260
  cleanHistory();
3191
- stop$d(timer);
3261
+ stop$e(timer);
3192
3262
  return [2 /*return*/];
3193
3263
  }
3194
3264
  });
@@ -3297,10 +3367,10 @@ function processThrottledMutations() {
3297
3367
  clearTimeout$1(throttleDelay);
3298
3368
  }
3299
3369
  throttleDelay = setTimeout$1(function () {
3300
- schedule(process$2, 1 /* Priority.High */);
3370
+ schedule$1(process$2, 1 /* Priority.High */);
3301
3371
  }, 33 /* Setting.LookAhead */);
3302
3372
  }
3303
- function schedule$1(node) {
3373
+ function schedule$2(node) {
3304
3374
  // Only schedule manual trigger for this node if it's not already in the queue
3305
3375
  if (queue$2.indexOf(node) < 0) {
3306
3376
  queue$2.push(node);
@@ -3359,7 +3429,7 @@ function proxyStyleRules(win) {
3359
3429
  win.clarityOverrides.InsertRule = win.CSSStyleSheet.prototype.insertRule;
3360
3430
  win.CSSStyleSheet.prototype.insertRule = function () {
3361
3431
  if (active()) {
3362
- schedule$1(this.ownerNode);
3432
+ schedule$2(this.ownerNode);
3363
3433
  }
3364
3434
  return win.clarityOverrides.InsertRule.apply(this, arguments);
3365
3435
  };
@@ -3368,7 +3438,7 @@ function proxyStyleRules(win) {
3368
3438
  win.clarityOverrides.MediaInsertRule = win.CSSMediaRule.prototype.insertRule;
3369
3439
  win.CSSMediaRule.prototype.insertRule = function () {
3370
3440
  if (active()) {
3371
- schedule$1(this.parentStyleSheet.ownerNode);
3441
+ schedule$2(this.parentStyleSheet.ownerNode);
3372
3442
  }
3373
3443
  return win.clarityOverrides.MediaInsertRule.apply(this, arguments);
3374
3444
  };
@@ -3377,7 +3447,7 @@ function proxyStyleRules(win) {
3377
3447
  win.clarityOverrides.DeleteRule = win.CSSStyleSheet.prototype.deleteRule;
3378
3448
  win.CSSStyleSheet.prototype.deleteRule = function () {
3379
3449
  if (active()) {
3380
- schedule$1(this.ownerNode);
3450
+ schedule$2(this.ownerNode);
3381
3451
  }
3382
3452
  return win.clarityOverrides.DeleteRule.apply(this, arguments);
3383
3453
  };
@@ -3386,7 +3456,7 @@ function proxyStyleRules(win) {
3386
3456
  win.clarityOverrides.MediaDeleteRule = win.CSSMediaRule.prototype.deleteRule;
3387
3457
  win.CSSMediaRule.prototype.deleteRule = function () {
3388
3458
  if (active()) {
3389
- schedule$1(this.parentStyleSheet.ownerNode);
3459
+ schedule$2(this.parentStyleSheet.ownerNode);
3390
3460
  }
3391
3461
  return win.clarityOverrides.MediaDeleteRule.apply(this, arguments);
3392
3462
  };
@@ -3399,7 +3469,7 @@ function proxyStyleRules(win) {
3399
3469
  try {
3400
3470
  win.Element.prototype.attachShadow = function () {
3401
3471
  if (active()) {
3402
- return schedule$1(win.clarityOverrides.AttachShadow.apply(this, arguments));
3472
+ return schedule$2(win.clarityOverrides.AttachShadow.apply(this, arguments));
3403
3473
  }
3404
3474
  else {
3405
3475
  return win.clarityOverrides.AttachShadow.apply(this, arguments);
@@ -3931,11 +4001,11 @@ var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
3931
4001
  var iframeContentMap = null; // Maps parent iframe element => iframe's contentDocument & contentWindow
3932
4002
  var privacyMap = null; // Maps node => Privacy (enum)
3933
4003
  var fraudMap = null; // Maps node => FraudId (number)
3934
- function start$l() {
4004
+ function start$m() {
3935
4005
  reset$7();
3936
4006
  parse(document, true);
3937
4007
  }
3938
- function stop$j() {
4008
+ function stop$k() {
3939
4009
  reset$7();
3940
4010
  }
3941
4011
  function reset$7() {
@@ -3966,14 +4036,14 @@ function parse(root, init) {
3966
4036
  try {
3967
4037
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
3968
4038
  if (init) {
3969
- 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)); });
3970
4040
  }
3971
4041
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
3972
4042
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
3973
4043
  if ("querySelectorAll" in root) {
3974
- config$2.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
3975
- config$2.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
3976
- 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
3977
4047
  unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
3978
4048
  }
3979
4049
  }
@@ -4004,7 +4074,7 @@ function add$1(node, parent, data, source) {
4004
4074
  var parentValue = null;
4005
4075
  var regionId = exists(node) ? id : null;
4006
4076
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
4007
- var privacyId = config$2.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4077
+ var privacyId = config$3.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
4008
4078
  if (parentId >= 0 && values$1[parentId]) {
4009
4079
  parentValue = values$1[parentId];
4010
4080
  parentValue.children.push(id);
@@ -4237,6 +4307,9 @@ function get(node) {
4237
4307
  function lookup(hash) {
4238
4308
  return hash in hashMap ? hashMap[hash] : null;
4239
4309
  }
4310
+ function getHashes() {
4311
+ return Object.keys(hashMap);
4312
+ }
4240
4313
  function has$1(node) {
4241
4314
  return nodesMap.has(getId$1(node));
4242
4315
  }
@@ -4308,7 +4381,7 @@ function getPreviousId(node) {
4308
4381
  function track$4(id, source, changed, parentChanged) {
4309
4382
  if (changed === void 0) { changed = true; }
4310
4383
  if (parentChanged === void 0) { parentChanged = false; }
4311
- if (config$2.lean && config$2.lite) {
4384
+ if (config$3.lean && config$3.lite) {
4312
4385
  return;
4313
4386
  }
4314
4387
  // Keep track of the order in which mutations happened, they may not be sequential
@@ -4330,7 +4403,7 @@ var regions = {};
4330
4403
  var queue$1 = [];
4331
4404
  var watch = false;
4332
4405
  var observer$1 = null;
4333
- function start$k() {
4406
+ function start$l() {
4334
4407
  reset$6();
4335
4408
  observer$1 = null;
4336
4409
  regionMap = new WeakMap();
@@ -4458,7 +4531,7 @@ function clone(r) {
4458
4531
  function reset$6() {
4459
4532
  state$2 = [];
4460
4533
  }
4461
- function stop$i() {
4534
+ function stop$j() {
4462
4535
  reset$6();
4463
4536
  regionMap = null;
4464
4537
  regions = {};
@@ -4715,7 +4788,7 @@ function encode$4 (type, ts) {
4715
4788
 
4716
4789
  var state$1 = [];
4717
4790
  var updates$1 = [];
4718
- function start$j() {
4791
+ function start$k() {
4719
4792
  state$1 = [];
4720
4793
  reset$5();
4721
4794
  }
@@ -4762,7 +4835,7 @@ function compute$5() {
4762
4835
  state$1 = temp; // Drop events less than the min time
4763
4836
  encode$4(22 /* Event.Timeline */);
4764
4837
  }
4765
- function stop$h() {
4838
+ function stop$i() {
4766
4839
  state$1 = [];
4767
4840
  reset$5();
4768
4841
  }
@@ -4906,14 +4979,14 @@ function add(node, parent, data) {
4906
4979
  var stopCallbacks = [];
4907
4980
  var active$2 = false;
4908
4981
  var modules$1 = null;
4909
- function start$i() {
4982
+ function start$j() {
4910
4983
  active$2 = true;
4911
4984
  modules$1 = new Set();
4912
- if (config$2.modules && config$2.modules.length > 0) {
4913
- 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); });
4914
4987
  }
4915
4988
  }
4916
- function stop$g() {
4989
+ function stop$h() {
4917
4990
  stopCallbacks.reverse().forEach(function (callback) {
4918
4991
  try {
4919
4992
  callback();
@@ -4965,8 +5038,8 @@ var dynamic = /*#__PURE__*/Object.freeze({
4965
5038
  __proto__: null,
4966
5039
  event: event,
4967
5040
  register: register,
4968
- start: start$i,
4969
- stop: stop$g
5041
+ start: start$j,
5042
+ stop: stop$h
4970
5043
  });
4971
5044
 
4972
5045
  var discoverBytes = 0;
@@ -4978,12 +5051,14 @@ var transit;
4978
5051
  var active$1;
4979
5052
  var queuedTime = 0;
4980
5053
  var leanLimit = false;
5054
+ var hasGemxPayload = false;
4981
5055
  var track$1;
4982
- function start$h() {
5056
+ function start$i() {
4983
5057
  active$1 = true;
4984
5058
  discoverBytes = 0;
4985
5059
  playbackBytes = 0;
4986
5060
  leanLimit = false;
5061
+ hasGemxPayload = false;
4987
5062
  queuedTime = 0;
4988
5063
  playback = [];
4989
5064
  analysis = [];
@@ -4998,7 +5073,7 @@ function queue(tokens, transmit) {
4998
5073
  var now = time();
4999
5074
  var type = tokens.length > 1 ? tokens[1] : null;
5000
5075
  var event = JSON.stringify(tokens);
5001
- if (!config$2.lean) {
5076
+ if (!config$3.lean) {
5002
5077
  leanLimit = false;
5003
5078
  }
5004
5079
  else if (!leanLimit && playbackBytes + event.length > 10485760 /* Setting.PlaybackBytesLimit */) {
@@ -5010,6 +5085,10 @@ function queue(tokens, transmit) {
5010
5085
  if (leanLimit) {
5011
5086
  break;
5012
5087
  }
5088
+ if (isActive()) {
5089
+ hold(tokens, event.length);
5090
+ break; // only gemxPlayback, not playback
5091
+ }
5013
5092
  discoverBytes += event.length;
5014
5093
  case 37 /* Event.Box */:
5015
5094
  case 6 /* Event.Mutation */:
@@ -5021,6 +5100,9 @@ function queue(tokens, transmit) {
5021
5100
  if (leanLimit) {
5022
5101
  break;
5023
5102
  }
5103
+ if (isActive()) {
5104
+ hold(tokens, event.length); // also gemxPlayback, no break
5105
+ }
5024
5106
  playbackBytes += event.length;
5025
5107
  playback.push(event);
5026
5108
  break;
@@ -5050,7 +5132,7 @@ function queue(tokens, transmit) {
5050
5132
  check$2(playbackBytes);
5051
5133
  }
5052
5134
  }
5053
- function flush() {
5135
+ function flush$1() {
5054
5136
  if (!active$1) {
5055
5137
  return;
5056
5138
  }
@@ -5058,7 +5140,30 @@ function flush() {
5058
5140
  timeout = null;
5059
5141
  upload(true);
5060
5142
  }
5061
- 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() {
5062
5167
  clearTimeout$1(timeout);
5063
5168
  upload(true);
5064
5169
  discoverBytes = 0;
@@ -5082,7 +5187,7 @@ function upload(final) {
5082
5187
  return [2 /*return*/];
5083
5188
  }
5084
5189
  timeout = null;
5085
- 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);
5086
5191
  if (sendPlaybackBytes) {
5087
5192
  max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
5088
5193
  }
@@ -5123,6 +5228,7 @@ function upload(final) {
5123
5228
  playbackBytes = 0;
5124
5229
  discoverBytes = 0;
5125
5230
  leanLimit = false;
5231
+ hasGemxPayload = false;
5126
5232
  }
5127
5233
  return [2 /*return*/];
5128
5234
  }
@@ -5135,8 +5241,8 @@ function stringify(encoded) {
5135
5241
  function send(payload, zipped, sequence, beacon) {
5136
5242
  if (beacon === void 0) { beacon = false; }
5137
5243
  // Upload data if a valid URL is defined in the config
5138
- if (typeof config$2.upload === "string" /* Constant.String */) {
5139
- var url_1 = config$2.upload;
5244
+ if (typeof config$3.upload === "string" /* Constant.String */) {
5245
+ var url_1 = config$3.upload;
5140
5246
  var dispatched = false;
5141
5247
  // If it's the last payload, attempt to upload using sendBeacon first.
5142
5248
  // The advantage to using sendBeacon is that browser can decide to upload asynchronously, improving chances of success
@@ -5187,9 +5293,10 @@ function send(payload, zipped, sequence, beacon) {
5187
5293
  }
5188
5294
  }
5189
5295
  }
5190
- else if (config$2.upload) {
5191
- var callback = config$2.upload;
5192
- 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);
5193
5300
  done(sequence);
5194
5301
  }
5195
5302
  }
@@ -5210,7 +5317,7 @@ function check$3(xhr, sequence) {
5210
5317
  // 2: Safari will terminate pending XHR requests with status code 0 if the user navigates away from the page
5211
5318
  // In any case, we switch the upload URL to fallback configuration (if available) before re-trying one more time
5212
5319
  if (xhr.status === 0) {
5213
- 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;
5214
5321
  }
5215
5322
  // Capture the status code and number of attempts so we can report it back to the server
5216
5323
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
@@ -5257,8 +5364,8 @@ function done(sequence) {
5257
5364
  function delay() {
5258
5365
  // Progressively increase delay as we continue to send more payloads from the client to the server
5259
5366
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
5260
- var gap = config$2.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$2.delay;
5261
- 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;
5262
5369
  }
5263
5370
  function response(payload) {
5264
5371
  var lines = payload && payload.length > 0 ? payload.split("\n") : [];
@@ -5276,8 +5383,8 @@ function response(payload) {
5276
5383
  break;
5277
5384
  case "ACTION" /* Constant.Action */:
5278
5385
  // Invoke action callback, if configured and has a valid value
5279
- if (config$2.action && parts.length > 1) {
5280
- config$2.action(parts[1]);
5386
+ if (config$3.action && parts.length > 1) {
5387
+ config$3.action(parts[1]);
5281
5388
  }
5282
5389
  break;
5283
5390
  case "EXTRACT" /* Constant.Extract */:
@@ -5296,7 +5403,7 @@ function response(payload) {
5296
5403
  }
5297
5404
  break;
5298
5405
  case "SNAPSHOT" /* Constant.Snapshot */:
5299
- 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.
5300
5407
  snapshot();
5301
5408
  break;
5302
5409
  }
@@ -5305,7 +5412,7 @@ function response(payload) {
5305
5412
 
5306
5413
  var history$3 = {};
5307
5414
  var data$8;
5308
- function start$g() {
5415
+ function start$h() {
5309
5416
  bind(window, "error", handler);
5310
5417
  history$3 = {};
5311
5418
  }
@@ -5373,7 +5480,7 @@ function encode$2 (type) {
5373
5480
 
5374
5481
  var history$2 = {};
5375
5482
  var data$7;
5376
- function start$f() {
5483
+ function start$g() {
5377
5484
  history$2 = {};
5378
5485
  }
5379
5486
  function log$1(code, severity, name, message, stack) {
@@ -5396,7 +5503,7 @@ function log$1(code, severity, name, message, stack) {
5396
5503
  }
5397
5504
  encode$2(33 /* Event.Log */);
5398
5505
  }
5399
- function stop$e() {
5506
+ function stop$f() {
5400
5507
  history$2 = {};
5401
5508
  }
5402
5509
 
@@ -5429,7 +5536,7 @@ function reset$4() {
5429
5536
  activeTask = null;
5430
5537
  pauseTask = null;
5431
5538
  }
5432
- function schedule(task, priority) {
5539
+ function schedule$1(task, priority) {
5433
5540
  if (priority === void 0) { priority = 0 /* Priority.Normal */; }
5434
5541
  return __awaiter(this, void 0, void 0, function () {
5435
5542
  var _i, queuedTasks_1, q, promise;
@@ -5493,7 +5600,7 @@ function state(timer) {
5493
5600
  // If this task is no longer being tracked, send stop message to the caller
5494
5601
  return 2 /* Task.Stop */;
5495
5602
  }
5496
- function start$e(timer) {
5603
+ function start$f(timer) {
5497
5604
  tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
5498
5605
  }
5499
5606
  function restart$2(timer) {
@@ -5501,12 +5608,12 @@ function restart$2(timer) {
5501
5608
  if (tracker && tracker[id]) {
5502
5609
  var c = tracker[id].calls;
5503
5610
  var y = tracker[id].yield;
5504
- start$e(timer);
5611
+ start$f(timer);
5505
5612
  tracker[id].calls = c + 1;
5506
5613
  tracker[id].yield = y;
5507
5614
  }
5508
5615
  }
5509
- function stop$d(timer) {
5616
+ function stop$e(timer) {
5510
5617
  var end = performance.now();
5511
5618
  var id = key(timer);
5512
5619
  var duration = end - tracker[id].start;
@@ -5527,7 +5634,7 @@ function suspend$1(timer) {
5527
5634
  case 0:
5528
5635
  id = key(timer);
5529
5636
  if (!(id in tracker)) return [3 /*break*/, 2];
5530
- stop$d(timer);
5637
+ stop$e(timer);
5531
5638
  // some customer polyfills for requestIdleCallback return null
5532
5639
  _b = tracker[id];
5533
5640
  return [4 /*yield*/, wait()];
@@ -5598,8 +5705,8 @@ function requestIdleCallbackPolyfill(callback, options) {
5598
5705
  }
5599
5706
  var requestIdleCallback = window["requestIdleCallback"] || requestIdleCallbackPolyfill;
5600
5707
 
5601
- function start$d() {
5602
- schedule(discover, 1 /* Priority.High */).then(function () {
5708
+ function start$e() {
5709
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
5603
5710
  measure(compute$7)();
5604
5711
  measure(compute$6)();
5605
5712
  measure(compute$a)();
@@ -5613,7 +5720,7 @@ function discover() {
5613
5720
  case 0:
5614
5721
  ts = time();
5615
5722
  timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
5616
- start$e(timer);
5723
+ start$f(timer);
5617
5724
  return [4 /*yield*/, traverse$1(document, timer, 0 /* Source.Discover */, ts)];
5618
5725
  case 1:
5619
5726
  _a.sent();
@@ -5621,7 +5728,7 @@ function discover() {
5621
5728
  return [4 /*yield*/, encode$5(5 /* Event.Discover */, timer, ts)];
5622
5729
  case 2:
5623
5730
  _a.sent();
5624
- stop$d(timer);
5731
+ stop$e(timer);
5625
5732
  return [2 /*return*/];
5626
5733
  }
5627
5734
  });
@@ -5629,9 +5736,9 @@ function discover() {
5629
5736
  }
5630
5737
 
5631
5738
  var data$6 = null;
5632
- function start$c() {
5633
- if (!config$2.lean && config$2.upgrade) {
5634
- 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 */);
5635
5742
  }
5636
5743
  data$6 = null;
5637
5744
  }
@@ -5641,24 +5748,24 @@ function start$c() {
5641
5748
  // and send all backed up layout events to the server.
5642
5749
  function upgrade(key) {
5643
5750
  // Upgrade only if Clarity was successfully activated on the page
5644
- if (active() && config$2.lean) {
5645
- config$2.lean = false;
5751
+ if (active() && config$3.lean) {
5752
+ config$3.lean = false;
5646
5753
  data$6 = { key: key };
5647
5754
  // Update metadata to track we have upgraded this session
5648
5755
  callback();
5649
5756
  save();
5650
5757
  // Callback upgrade handler, if configured
5651
- if (config$2.upgrade) {
5652
- config$2.upgrade(key);
5758
+ if (config$3.upgrade) {
5759
+ config$3.upgrade(key);
5653
5760
  }
5654
5761
  encode$1(3 /* Event.Upgrade */);
5655
- if (config$2.lite) {
5656
- start$d();
5657
- start$q();
5762
+ if (config$3.lite) {
5763
+ start$e();
5764
+ start$r();
5658
5765
  }
5659
5766
  }
5660
5767
  }
5661
- function stop$c() {
5768
+ function stop$d() {
5662
5769
  data$6 = null;
5663
5770
  }
5664
5771
 
@@ -5807,7 +5914,7 @@ function encode$1 (event) {
5807
5914
  }
5808
5915
 
5809
5916
  var data$5;
5810
- function start$b() {
5917
+ function start$c() {
5811
5918
  data$5 = { check: 0 /* Check.None */ };
5812
5919
  }
5813
5920
  function check$2(bytes) {
@@ -5835,19 +5942,19 @@ function compute$4() {
5835
5942
  encode$1(35 /* Event.Limit */);
5836
5943
  }
5837
5944
  }
5838
- function stop$b() {
5945
+ function stop$c() {
5839
5946
  data$5 = null;
5840
5947
  }
5841
5948
 
5842
5949
  var data$4 = null;
5843
5950
  var updates = null;
5844
5951
  var limited = false;
5845
- function start$a() {
5952
+ function start$b() {
5846
5953
  data$4 = {};
5847
5954
  updates = {};
5848
5955
  limited = false;
5849
5956
  }
5850
- function stop$a() {
5957
+ function stop$b() {
5851
5958
  data$4 = {};
5852
5959
  updates = {};
5853
5960
  limited = false;
@@ -5889,7 +5996,7 @@ function reset$3() {
5889
5996
 
5890
5997
  var data$3 = null;
5891
5998
  var updateConsent = true;
5892
- function start$9() {
5999
+ function start$a() {
5893
6000
  var _a;
5894
6001
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5895
6002
  updateConsent = true;
@@ -5897,7 +6004,7 @@ function start$9() {
5897
6004
  ics.addListener(["ad_storage" /* Constant.AdStorage */, "analytics_storage" /* Constant.AnalyticsStorage */], processConsent);
5898
6005
  }
5899
6006
  }
5900
- function stop$9() {
6007
+ function stop$a() {
5901
6008
  updateConsent = true;
5902
6009
  }
5903
6010
  function processConsent() {
@@ -5946,7 +6053,7 @@ function compute$2() {
5946
6053
  if (updateConsent) {
5947
6054
  encode$1(47 /* Event.Consent */);
5948
6055
  updateConsent = false;
5949
- if (!config$2.track) {
6056
+ if (!config$3.track) {
5950
6057
  var ics = (_a = window.google_tag_data) === null || _a === void 0 ? void 0 : _a.ics;
5951
6058
  if (ics === null || ics === void 0 ? void 0 : ics.usedUpdate) {
5952
6059
  processConsent();
@@ -5961,7 +6068,7 @@ var electron = 0 /* BooleanFlag.False */;
5961
6068
  var consentStatus = null;
5962
6069
  var cookiesLogged = false;
5963
6070
  var defaultStatus = { source: 7 /* ConsentSource.Default */, ad_Storage: "denied" /* Constant.Denied */, analytics_Storage: "denied" /* Constant.Denied */ };
5964
- function start$8() {
6071
+ function start$9() {
5965
6072
  var _a, _b, _c;
5966
6073
  var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
5967
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 : '';
@@ -5972,13 +6079,13 @@ function start$8() {
5972
6079
  // Populate ids for this page
5973
6080
  var s = session();
5974
6081
  var u = user();
5975
- var projectId = config$2.projectId || hash(location.host);
5976
- var userId = config$2.externalSession && config$2.userId ? config$2.userId : u.id;
5977
- 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;
5978
6085
  data$2 = { projectId: projectId, userId: userId, sessionId: sessionId, pageNum: s.count };
5979
6086
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
5980
- config$2.lean = config$2.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$2.lean;
5981
- 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;
5982
6089
  // Log page metadata as dimensions
5983
6090
  log(0 /* Dimension.UserAgent */, ua);
5984
6091
  log(3 /* Dimension.PageTitle */, title);
@@ -6020,15 +6127,15 @@ function start$8() {
6020
6127
  if (consentStatus === null) {
6021
6128
  consentStatus = {
6022
6129
  source: u.consent ? 6 /* ConsentSource.Cookie */ : 0 /* ConsentSource.Implicit */,
6023
- ad_Storage: config$2.track ? "granted" /* Constant.Granted */ : "denied" /* Constant.Denied */,
6024
- 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 */,
6025
6132
  };
6026
6133
  }
6027
6134
  logCookies();
6028
6135
  var consent = getConsentData(consentStatus);
6029
6136
  config$1(consent);
6030
6137
  // Track ids using a cookie if configuration allows it, skip if using external session
6031
- if (!config$2.externalSession) {
6138
+ if (!config$3.externalSession) {
6032
6139
  track(u);
6033
6140
  }
6034
6141
  }
@@ -6053,7 +6160,7 @@ function logCookies() {
6053
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 */) {
6054
6161
  return;
6055
6162
  }
6056
- 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++) {
6057
6164
  var key = _a[_i];
6058
6165
  var value = getCookie(key);
6059
6166
  if (value) {
@@ -6062,7 +6169,7 @@ function logCookies() {
6062
6169
  }
6063
6170
  cookiesLogged = true;
6064
6171
  }
6065
- function stop$8() {
6172
+ function stop$9() {
6066
6173
  data$2 = null;
6067
6174
  // Reset cookiesLogged so cookies are re-logged on restart. Each session generates new metadata
6068
6175
  // (sessionId, pageNum), and cookie values need to be recorded in the new session's data stream.
@@ -6073,14 +6180,14 @@ function metadata(cb, wait, recall, consentInfo) {
6073
6180
  if (wait === void 0) { wait = true; }
6074
6181
  if (recall === void 0) { recall = false; }
6075
6182
  if (consentInfo === void 0) { consentInfo = false; }
6076
- var upgraded = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6183
+ var upgraded = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6077
6184
  var called = false;
6078
6185
  // if caller hasn't specified that they want to skip waiting for upgrade but we've already upgraded, we need to
6079
6186
  // directly execute the callback in addition to adding to our list as we only process callbacks at the moment
6080
6187
  // we go through the upgrading flow.
6081
6188
  if (data$2 && (upgraded || wait === false)) {
6082
6189
  // Immediately invoke the callback if the caller explicitly doesn't want to wait for the upgrade confirmation
6083
- cb(data$2, !config$2.lean, consentInfo ? consentStatus : undefined);
6190
+ cb(data$2, !config$3.lean, consentInfo ? consentStatus : undefined);
6084
6191
  called = true;
6085
6192
  }
6086
6193
  if (recall || !called) {
@@ -6123,15 +6230,15 @@ function consentv2(consentState, source) {
6123
6230
  consentStatus = updatedStatus;
6124
6231
  callback(true);
6125
6232
  var consentData = getConsentData(consentStatus);
6126
- if (!consentData.analytics_Storage && config$2.track) {
6127
- config$2.track = false;
6233
+ if (!consentData.analytics_Storage && config$3.track) {
6234
+ config$3.track = false;
6128
6235
  clear(true);
6129
6236
  stop();
6130
6237
  window.setTimeout(start, 250 /* Setting.RestartDelay */);
6131
6238
  return;
6132
6239
  }
6133
6240
  if (active() && consentData.analytics_Storage) {
6134
- config$2.track = true;
6241
+ config$3.track = true;
6135
6242
  track(user(), 1 /* BooleanFlag.True */);
6136
6243
  save();
6137
6244
  }
@@ -6163,7 +6270,7 @@ function clear(all) {
6163
6270
  }
6164
6271
  function tab() {
6165
6272
  var id = shortid();
6166
- if (config$2.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6273
+ if (config$3.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
6167
6274
  var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
6168
6275
  id = value ? value : id;
6169
6276
  sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
@@ -6172,15 +6279,15 @@ function tab() {
6172
6279
  }
6173
6280
  function callback(consentUpdate) {
6174
6281
  if (consentUpdate === void 0) { consentUpdate = false; }
6175
- var upgrade = config$2.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6282
+ var upgrade = config$3.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
6176
6283
  processCallback(upgrade, consentUpdate);
6177
6284
  }
6178
6285
  function save() {
6179
- if (!data$2 || !config$2.track || config$2.externalSession)
6286
+ if (!data$2 || !config$3.track || config$3.externalSession)
6180
6287
  return;
6181
6288
  var ts = Math.round(Date.now());
6182
- var upload = config$2.upload && typeof config$2.upload === "string" /* Constant.String */ ? config$2.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
6183
- 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 */;
6184
6291
  setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join(COOKIE_SEP), 1 /* Setting.SessionExpire */);
6185
6292
  }
6186
6293
  function processCallback(upgrade, consentUpdate) {
@@ -6191,7 +6298,7 @@ function processCallback(upgrade, consentUpdate) {
6191
6298
  if (cb.callback &&
6192
6299
  ((!cb.called && !consentUpdate) || (cb.consentInfo && consentUpdate)) && //If consentUpdate is true, we only call the callback if it has consentInfo
6193
6300
  (!cb.wait || upgrade)) {
6194
- cb.callback(data$2, !config$2.lean, cb.consentInfo ? consentStatus : undefined);
6301
+ cb.callback(data$2, !config$3.lean, cb.consentInfo ? consentStatus : undefined);
6195
6302
  cb.called = true;
6196
6303
  if (!cb.recall) {
6197
6304
  callbacks.splice(i, 1);
@@ -6209,7 +6316,7 @@ function track(u, consent) {
6209
6316
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
6210
6317
  var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
6211
6318
  // If DOB is not set in the user object, use the date set in the config as a DOB
6212
- 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;
6213
6320
  // To avoid cookie churn, write user id cookie only once every day
6214
6321
  if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent || u.dob !== dob) {
6215
6322
  var cookieParts = [data$2.userId, 2 /* Setting.CookieVersion */, end.toString(36), consent, dob];
@@ -6225,7 +6332,7 @@ function shortid() {
6225
6332
  }
6226
6333
  function session() {
6227
6334
  var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
6228
- var value = getCookie("_clsk" /* Constant.SessionKey */, !config$2.includeSubdomains);
6335
+ var value = getCookie("_clsk" /* Constant.SessionKey */, !config$3.includeSubdomains);
6229
6336
  if (value) {
6230
6337
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
6231
6338
  var parts = value.includes("^" /* Constant.Caret */) ? value.split("^" /* Constant.Caret */) : value.split("|" /* Constant.Pipe */);
@@ -6246,7 +6353,7 @@ function num(string, base) {
6246
6353
  }
6247
6354
  function user() {
6248
6355
  var output = { id: shortid(), version: 0, expiry: null, consent: 0 /* BooleanFlag.False */, dob: 0 };
6249
- var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$2.includeSubdomains);
6356
+ var cookie = getCookie("_clck" /* Constant.CookieKey */, !config$3.includeSubdomains);
6250
6357
  if (cookie && cookie.length > 0) {
6251
6358
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
6252
6359
  // Maintaining support for pipe separator for backward compatibility, this can be removed in future releases
@@ -6266,15 +6373,15 @@ function user() {
6266
6373
  output.dob = num(parts[4]);
6267
6374
  }
6268
6375
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
6269
- config$2.track = config$2.track || output.consent === 1 /* BooleanFlag.True */;
6376
+ config$3.track = config$3.track || output.consent === 1 /* BooleanFlag.True */;
6270
6377
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
6271
- output.id = config$2.track ? parts[0] : output.id;
6378
+ output.id = config$3.track ? parts[0] : output.id;
6272
6379
  }
6273
6380
  return output;
6274
6381
  }
6275
6382
 
6276
6383
  var data$1 = null;
6277
- function start$7() {
6384
+ function start$8() {
6278
6385
  var m = data$2;
6279
6386
  data$1 = {
6280
6387
  version: version$1,
@@ -6291,7 +6398,7 @@ function start$7() {
6291
6398
  url: ''
6292
6399
  };
6293
6400
  }
6294
- function stop$7() {
6401
+ function stop$8() {
6295
6402
  data$1 = null;
6296
6403
  }
6297
6404
  function envelope(last) {
@@ -6325,7 +6432,7 @@ function reset$2() {
6325
6432
  function report(e) {
6326
6433
  // Do not report the same message twice for the same page
6327
6434
  if (history$1 && history$1.indexOf(e.message) === -1) {
6328
- var url = config$2.report;
6435
+ var url = config$3.report;
6329
6436
  if (url && url.length > 0 && data$1) {
6330
6437
  var payload = { v: data$1.version, p: data$1.projectId, u: data$1.userId, s: data$1.sessionId, n: data$1.pageNum };
6331
6438
  if (e.message) {
@@ -6416,7 +6523,7 @@ var pushState = null;
6416
6523
  var replaceState = null;
6417
6524
  var url = null;
6418
6525
  var count = 0;
6419
- function start$6() {
6526
+ function start$7() {
6420
6527
  url = getCurrentUrl();
6421
6528
  count = 0;
6422
6529
  bind(window, "popstate", compute$1);
@@ -6477,26 +6584,26 @@ function restart$1() {
6477
6584
  function getCurrentUrl() {
6478
6585
  return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
6479
6586
  }
6480
- function stop$6() {
6587
+ function stop$7() {
6481
6588
  url = null;
6482
6589
  count = 0;
6483
6590
  }
6484
6591
 
6485
6592
  var status = false;
6486
- function start$5() {
6593
+ function start$6() {
6487
6594
  status = true;
6488
- start$P();
6595
+ start$R();
6489
6596
  reset$4();
6490
6597
  reset$1();
6491
6598
  reset$2();
6492
- start$6();
6599
+ start$7();
6493
6600
  }
6494
- function stop$5() {
6495
- stop$6();
6601
+ function stop$6() {
6602
+ stop$7();
6496
6603
  reset$2();
6497
6604
  reset$1();
6498
6605
  reset$4();
6499
- stop$M();
6606
+ stop$O();
6500
6607
  status = false;
6501
6608
  }
6502
6609
  function active() {
@@ -6524,8 +6631,8 @@ function config(override) {
6524
6631
  return false;
6525
6632
  }
6526
6633
  for (var key in override) {
6527
- if (key in config$2) {
6528
- config$2[key] = override[key];
6634
+ if (key in config$3) {
6635
+ config$3[key] = override[key];
6529
6636
  }
6530
6637
  }
6531
6638
  return true;
@@ -6551,51 +6658,111 @@ function restart() {
6551
6658
  event$1("clarityGemX" /* Constant.Clarity */, "restart" /* Constant.Restart */);
6552
6659
  }
6553
6660
 
6554
- function start$4() {
6555
- start$F();
6661
+ function start$5() {
6662
+ start$G();
6663
+ start$h();
6556
6664
  start$g();
6557
- start$f();
6558
6665
  }
6559
- function stop$4() {
6560
- stop$e();
6666
+ function stop$5() {
6667
+ stop$f();
6561
6668
  }
6562
6669
 
6563
6670
  var diagnostic = /*#__PURE__*/Object.freeze({
6564
6671
  __proto__: null,
6565
- start: start$4,
6566
- stop: stop$4
6672
+ start: start$5,
6673
+ stop: stop$5
6567
6674
  });
6568
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
+
6569
6734
  function start$3() {
6570
6735
  // The order below is important
6571
6736
  // and is determined by interdependencies of modules
6572
- start$n();
6573
- start$k();
6737
+ start$o();
6574
6738
  start$l();
6575
- if (config$2.delayDom) {
6739
+ start$m();
6740
+ if (config$3.delayDom) {
6576
6741
  // Lazy load layout module as part of page load time performance improvements experiment
6577
6742
  bind(window, 'load', function () {
6578
- start$m();
6743
+ start$n();
6579
6744
  });
6580
6745
  }
6581
6746
  else {
6582
- start$m();
6747
+ start$n();
6583
6748
  }
6584
6749
  // IMPORTANT: Start custom element detection BEFORE discover
6585
6750
  // This ensures pre-existing custom elements are registered before DOM traversal
6586
- start$o();
6587
- start$d();
6588
- start$q();
6589
6751
  start$p();
6752
+ start$4(); // activates upload buffer before discover traverses
6753
+ start$e();
6754
+ start$r();
6755
+ start$q();
6590
6756
  }
6591
6757
  function stop$3() {
6592
- stop$i();
6593
6758
  stop$j();
6594
6759
  stop$k();
6595
6760
  stop$l();
6761
+ stop$m();
6762
+ stop$p();
6596
6763
  stop$o();
6597
6764
  stop$n();
6598
- stop$m();
6765
+ stop$4();
6599
6766
  }
6600
6767
 
6601
6768
  var layout = /*#__PURE__*/Object.freeze({
@@ -6823,7 +6990,7 @@ function process(entries) {
6823
6990
  case "resource" /* Constant.Resource */:
6824
6991
  var name_1 = entry.name;
6825
6992
  log(4 /* Dimension.NetworkHosts */, host(name_1));
6826
- if (name_1 === config$2.upload || name_1 === config$2.fallback) {
6993
+ if (name_1 === config$3.upload || name_1 === config$3.fallback) {
6827
6994
  max(28 /* Metric.UploadTime */, entry.duration);
6828
6995
  }
6829
6996
  break;
@@ -6898,8 +7065,8 @@ function start(config$1) {
6898
7065
  // Check that browser supports required APIs and we do not attempt to start Clarity multiple times
6899
7066
  if (check()) {
6900
7067
  config(config$1);
6901
- start$5();
6902
- start$G();
7068
+ start$6();
7069
+ start$H();
6903
7070
  modules.forEach(function (x) { return measure(x.start)(); });
6904
7071
  // If it's an internal call to start, without explicit configuration,
6905
7072
  // re-process any newly accumulated items in the queue
@@ -6930,8 +7097,8 @@ function stop() {
6930
7097
  if (active()) {
6931
7098
  // Stop modules in the reverse order of their initialization and start queuing up items again
6932
7099
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6933
- stop$D();
6934
- stop$5();
7100
+ stop$E();
7101
+ stop$6();
6935
7102
  setup();
6936
7103
  }
6937
7104
  }