clarity-js 0.8.25 → 0.8.27

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.
@@ -81,6 +81,7 @@ var clarity = /*#__PURE__*/Object.freeze({
81
81
  get event () { return event; },
82
82
  get hashText () { return hashText; },
83
83
  get identify () { return identify; },
84
+ get measure () { return measure; },
84
85
  get metadata () { return metadata; },
85
86
  get pause () { return pause; },
86
87
  get queue () { return queue; },
@@ -170,7 +171,7 @@ var startTime = 0;
170
171
  function computeStartTime() {
171
172
  return performance.now() + performance.timeOrigin;
172
173
  }
173
- function start$K() {
174
+ function start$L() {
174
175
  startTime = computeStartTime();
175
176
  }
176
177
  // event.timestamp is number of milliseconds elapsed since the document was loaded
@@ -186,11 +187,11 @@ function time(event) {
186
187
  var origin = event && event.view ? event.view.performance.timeOrigin : performance.timeOrigin;
187
188
  return Math.max(Math.round(ts + origin - baseline), 0);
188
189
  }
189
- function stop$H() {
190
+ function stop$I() {
190
191
  startTime = 0;
191
192
  }
192
193
 
193
- var version$1 = "0.8.25";
194
+ var version$1 = "0.8.27";
194
195
 
195
196
  // tslint:disable: no-bitwise
196
197
  function hash (input, precision) {
@@ -411,11 +412,11 @@ function redact$1(value) {
411
412
  var state$b = null;
412
413
  var buffer = null;
413
414
  var update$2 = false;
414
- function start$J() {
415
+ function start$K() {
415
416
  update$2 = false;
416
- reset$s();
417
+ reset$t();
417
418
  }
418
- function reset$s() {
419
+ function reset$t() {
419
420
  // Baseline state holds the previous values - if it is updated in the current payload,
420
421
  // reset the state to current value after sending the previous state
421
422
  if (update$2) {
@@ -543,38 +544,38 @@ function visibility(t, visible) {
543
544
  }
544
545
  update$2 = true;
545
546
  }
546
- function compute$f() {
547
+ function compute$g() {
547
548
  if (update$2) {
548
549
  encode$1(4 /* Event.Baseline */);
549
550
  }
550
551
  }
551
- function stop$G() {
552
- reset$s();
552
+ function stop$H() {
553
+ reset$t();
553
554
  }
554
555
 
555
556
  var baseline = /*#__PURE__*/Object.freeze({
556
557
  __proto__: null,
557
558
  activity: activity,
558
- compute: compute$f,
559
- reset: reset$s,
560
- start: start$J,
559
+ compute: compute$g,
560
+ reset: reset$t,
561
+ start: start$K,
561
562
  get state () { return state$b; },
562
- stop: stop$G,
563
+ stop: stop$H,
563
564
  track: track$8,
564
565
  visibility: visibility
565
566
  });
566
567
 
567
- var data$k = null;
568
+ var data$l = null;
568
569
  var updateConsent = true;
569
- function start$I() {
570
+ function start$J() {
570
571
  updateConsent = true;
571
572
  }
572
- function stop$F() {
573
+ function stop$G() {
573
574
  updateConsent = true;
574
575
  }
575
576
  function config$1(consent) {
576
577
  trackConsent(consent.analytics_Storage ? 1 /* ConsentType.Implicit */ : 0 /* ConsentType.None */);
577
- data$k = consent;
578
+ data$l = consent;
578
579
  }
579
580
  // When we get consent signal as false, we restart the service and track config as false.
580
581
  function consent$1() {
@@ -584,11 +585,11 @@ function trackConsent(consent) {
584
585
  log(36 /* Dimension.Consent */, consent.toString());
585
586
  }
586
587
  function consentv2$1(consent) {
587
- data$k = consent;
588
+ data$l = consent;
588
589
  encode$1(47 /* Event.Consent */);
589
590
  }
590
591
  // Compute function is called every upload, but we only want to send consent data once.
591
- function compute$e() {
592
+ function compute$f() {
592
593
  if (updateConsent) {
593
594
  encode$1(47 /* Event.Consent */);
594
595
  updateConsent = false;
@@ -597,16 +598,16 @@ function compute$e() {
597
598
 
598
599
  var consent$2 = /*#__PURE__*/Object.freeze({
599
600
  __proto__: null,
600
- compute: compute$e,
601
+ compute: compute$f,
601
602
  config: config$1,
602
603
  consent: consent$1,
603
604
  consentv2: consentv2$1,
604
- get data () { return data$k; },
605
- start: start$I,
606
- stop: stop$F
605
+ get data () { return data$l; },
606
+ start: start$J,
607
+ stop: stop$G
607
608
  });
608
609
 
609
- var data$j = null;
610
+ var data$k = null;
610
611
  // custom events allow 2 parameters or 1 parameter to be passed. If 2 are passed we
611
612
  // consider it a key value pair. If only 1 is passed we only consider the event to have a value.
612
613
  function event(a, b) {
@@ -615,64 +616,64 @@ function event(a, b) {
615
616
  typeof a === "string" /* Constant.String */ &&
616
617
  a.length < 255) {
617
618
  if (b && typeof b === "string" /* Constant.String */ && b.length < 255) {
618
- data$j = { key: a, value: b };
619
+ data$k = { key: a, value: b };
619
620
  }
620
621
  else {
621
- data$j = { value: a };
622
+ data$k = { value: a };
622
623
  }
623
624
  encode$1(24 /* Event.Custom */);
624
625
  }
625
626
  }
626
627
 
627
- var data$i = null;
628
+ var data$j = null;
628
629
  var updates$3 = null;
629
- function start$H() {
630
- data$i = {};
630
+ function start$I() {
631
+ data$j = {};
631
632
  updates$3 = {};
632
633
  count$1(5 /* Metric.InvokeCount */);
633
634
  }
634
- function stop$E() {
635
- data$i = {};
635
+ function stop$F() {
636
+ data$j = {};
636
637
  updates$3 = {};
637
638
  }
638
639
  function count$1(metric) {
639
- if (!(metric in data$i)) {
640
- data$i[metric] = 0;
640
+ if (!(metric in data$j)) {
641
+ data$j[metric] = 0;
641
642
  }
642
643
  if (!(metric in updates$3)) {
643
644
  updates$3[metric] = 0;
644
645
  }
645
- data$i[metric]++;
646
+ data$j[metric]++;
646
647
  updates$3[metric]++;
647
648
  }
648
649
  function sum(metric, value) {
649
650
  if (value !== null) {
650
- if (!(metric in data$i)) {
651
- data$i[metric] = 0;
651
+ if (!(metric in data$j)) {
652
+ data$j[metric] = 0;
652
653
  }
653
654
  if (!(metric in updates$3)) {
654
655
  updates$3[metric] = 0;
655
656
  }
656
- data$i[metric] += value;
657
+ data$j[metric] += value;
657
658
  updates$3[metric] += value;
658
659
  }
659
660
  }
660
661
  function max(metric, value) {
661
662
  // Ensure that we do not process null or NaN values
662
663
  if (value !== null && isNaN(value) === false) {
663
- if (!(metric in data$i)) {
664
- data$i[metric] = 0;
664
+ if (!(metric in data$j)) {
665
+ data$j[metric] = 0;
665
666
  }
666
- if (value > data$i[metric] || data$i[metric] === 0) {
667
+ if (value > data$j[metric] || data$j[metric] === 0) {
667
668
  updates$3[metric] = value;
668
- data$i[metric] = value;
669
+ data$j[metric] = value;
669
670
  }
670
671
  }
671
672
  }
672
- function compute$d() {
673
+ function compute$e() {
673
674
  encode$1(0 /* Event.Metric */);
674
675
  }
675
- function reset$r() {
676
+ function reset$s() {
676
677
  updates$3 = {};
677
678
  }
678
679
 
@@ -683,15 +684,15 @@ function clearTimeout$1(handle) {
683
684
  return window.clearTimeout(handle);
684
685
  }
685
686
 
686
- var data$h;
687
+ var data$i;
687
688
  var last = 0;
688
689
  var interval = 0;
689
690
  var timeout$7 = null;
690
- function start$G() {
691
+ function start$H() {
691
692
  interval = 60000 /* Setting.PingInterval */;
692
693
  last = 0;
693
694
  }
694
- function reset$q() {
695
+ function reset$r() {
695
696
  if (timeout$7) {
696
697
  clearTimeout$1(timeout$7);
697
698
  }
@@ -700,16 +701,16 @@ function reset$q() {
700
701
  }
701
702
  function ping() {
702
703
  var now = time();
703
- data$h = { gap: now - last };
704
+ data$i = { gap: now - last };
704
705
  encode$1(25 /* Event.Ping */);
705
- if (data$h.gap < 300000 /* Setting.PingTimeout */) {
706
+ if (data$i.gap < 300000 /* Setting.PingTimeout */) {
706
707
  timeout$7 = setTimeout$1(ping, interval);
707
708
  }
708
709
  else {
709
710
  suspend();
710
711
  }
711
712
  }
712
- function stop$D() {
713
+ function stop$E() {
713
714
  clearTimeout$1(timeout$7);
714
715
  last = 0;
715
716
  interval = 0;
@@ -717,50 +718,50 @@ function stop$D() {
717
718
 
718
719
  var ping$1 = /*#__PURE__*/Object.freeze({
719
720
  __proto__: null,
720
- get data () { return data$h; },
721
- reset: reset$q,
722
- start: start$G,
723
- stop: stop$D
721
+ get data () { return data$i; },
722
+ reset: reset$r,
723
+ start: start$H,
724
+ stop: stop$E
724
725
  });
725
726
 
726
- var data$g = null;
727
- function start$F() {
728
- data$g = {};
727
+ var data$h = null;
728
+ function start$G() {
729
+ data$h = {};
729
730
  }
730
- function stop$C() {
731
- data$g = {};
731
+ function stop$D() {
732
+ data$h = {};
732
733
  }
733
734
  function track$7(event, time) {
734
- if (!(event in data$g)) {
735
- data$g[event] = [[time, 0]];
735
+ if (!(event in data$h)) {
736
+ data$h[event] = [[time, 0]];
736
737
  }
737
738
  else {
738
- var e = data$g[event];
739
+ var e = data$h[event];
739
740
  var last = e[e.length - 1];
740
741
  // Add a new entry only if the new event occurs after configured interval
741
742
  // Otherwise, extend the duration of the previous entry
742
743
  if (time - last[0] > 100 /* Setting.SummaryInterval */) {
743
- data$g[event].push([time, 0]);
744
+ data$h[event].push([time, 0]);
744
745
  }
745
746
  else {
746
747
  last[1] = time - last[0];
747
748
  }
748
749
  }
749
750
  }
750
- function compute$c() {
751
+ function compute$d() {
751
752
  encode$1(36 /* Event.Summary */);
752
753
  }
753
- function reset$p() {
754
- data$g = {};
754
+ function reset$q() {
755
+ data$h = {};
755
756
  }
756
757
 
757
758
  var summary = /*#__PURE__*/Object.freeze({
758
759
  __proto__: null,
759
- compute: compute$c,
760
- get data () { return data$g; },
761
- reset: reset$p,
762
- start: start$F,
763
- stop: stop$C,
760
+ compute: compute$d,
761
+ get data () { return data$h; },
762
+ reset: reset$q,
763
+ start: start$G,
764
+ stop: stop$D,
764
765
  track: track$7
765
766
  });
766
767
 
@@ -877,9 +878,9 @@ function read(stream) {
877
878
  });
878
879
  }
879
880
 
880
- var data$f = null;
881
- function start$E() {
882
- reset$o();
881
+ var data$g = null;
882
+ function start$F() {
883
+ reset$p();
883
884
  }
884
885
  function set(variable, value) {
885
886
  var values = typeof value === "string" /* Constant.String */ ? [value] : value;
@@ -925,23 +926,23 @@ function log$2(variable, value) {
925
926
  value &&
926
927
  typeof variable === "string" /* Constant.String */ &&
927
928
  variable.length < 255) {
928
- var validValues = variable in data$f ? data$f[variable] : [];
929
+ var validValues = variable in data$g ? data$g[variable] : [];
929
930
  for (var i = 0; i < value.length; i++) {
930
931
  if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
931
932
  validValues.push(value[i]);
932
933
  }
933
934
  }
934
- data$f[variable] = validValues;
935
+ data$g[variable] = validValues;
935
936
  }
936
937
  }
937
- function compute$b() {
938
+ function compute$c() {
938
939
  encode$1(34 /* Event.Variable */);
939
940
  }
940
- function reset$o() {
941
- data$f = {};
941
+ function reset$p() {
942
+ data$g = {};
942
943
  }
943
- function stop$B() {
944
- reset$o();
944
+ function stop$C() {
945
+ reset$p();
945
946
  }
946
947
  function redact(input) {
947
948
  return input && input.length >= 5 /* Setting.WordLength */ ?
@@ -975,23 +976,23 @@ function detect(input) {
975
976
 
976
977
  var variable = /*#__PURE__*/Object.freeze({
977
978
  __proto__: null,
978
- compute: compute$b,
979
- get data () { return data$f; },
979
+ compute: compute$c,
980
+ get data () { return data$g; },
980
981
  identify: identify,
981
- reset: reset$o,
982
+ reset: reset$p,
982
983
  set: set,
983
- start: start$E,
984
- stop: stop$B
984
+ start: start$F,
985
+ stop: stop$C
985
986
  });
986
987
 
987
- var data$e = {};
988
+ var data$f = {};
988
989
  var keys = new Set();
989
990
  var variables = {};
990
991
  var selectors = {};
991
992
  var hashes = {};
992
993
  var validation = {};
993
- function start$D() {
994
- reset$n();
994
+ function start$E() {
995
+ reset$o();
995
996
  }
996
997
  // Input string is of the following form:
997
998
  // EXTRACT 101|element { "1": ".class1", "2": "~window.a.b", "3": "!abc"}
@@ -1043,7 +1044,7 @@ function trigger$2(input) {
1043
1044
  function clone$1(v) {
1044
1045
  return JSON.parse(JSON.stringify(v));
1045
1046
  }
1046
- function compute$a() {
1047
+ function compute$b() {
1047
1048
  try {
1048
1049
  for (var v in variables) {
1049
1050
  var key = parseInt(v);
@@ -1087,27 +1088,27 @@ function compute$a() {
1087
1088
  log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
1088
1089
  }
1089
1090
  }
1090
- function reset$n() {
1091
+ function reset$o() {
1091
1092
  keys.clear();
1092
1093
  }
1093
1094
  function update$1(key, subkey, value) {
1094
1095
  var update = false;
1095
- if (!(key in data$e)) {
1096
- data$e[key] = {};
1096
+ if (!(key in data$f)) {
1097
+ data$f[key] = {};
1097
1098
  update = true;
1098
1099
  }
1099
1100
  if (!isEmpty(hashes[key])
1100
- && (!(subkey in data$e[key]) || data$e[key][subkey] != value)) {
1101
+ && (!(subkey in data$f[key]) || data$f[key][subkey] != value)) {
1101
1102
  update = true;
1102
1103
  }
1103
- data$e[key][subkey] = value;
1104
+ data$f[key][subkey] = value;
1104
1105
  if (update) {
1105
1106
  keys.add(key);
1106
1107
  }
1107
1108
  return;
1108
1109
  }
1109
- function stop$A() {
1110
- reset$n();
1110
+ function stop$B() {
1111
+ reset$o();
1111
1112
  }
1112
1113
  function parse$1(variable) {
1113
1114
  var syntax = [];
@@ -1175,12 +1176,12 @@ function isEmpty(obj) {
1175
1176
  var extract = /*#__PURE__*/Object.freeze({
1176
1177
  __proto__: null,
1177
1178
  clone: clone$1,
1178
- compute: compute$a,
1179
- data: data$e,
1179
+ compute: compute$b,
1180
+ data: data$f,
1180
1181
  keys: keys,
1181
- reset: reset$n,
1182
- start: start$D,
1183
- stop: stop$A,
1182
+ reset: reset$o,
1183
+ start: start$E,
1184
+ stop: stop$B,
1184
1185
  trigger: trigger$2,
1185
1186
  update: update$1
1186
1187
  });
@@ -1214,33 +1215,33 @@ function signalsEvent(signalsPayload) {
1214
1215
  }
1215
1216
 
1216
1217
  var modules$1 = [baseline, dimension, variable, limit, summary, consent$2, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
1217
- function start$C() {
1218
+ function start$D() {
1218
1219
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
1219
- start$H();
1220
+ start$I();
1220
1221
  modules$1.forEach(function (x) { return measure(x.start)(); });
1221
1222
  }
1222
- function stop$z() {
1223
+ function stop$A() {
1223
1224
  // Stop modules in the reverse order of their initialization
1224
1225
  // The ordering below should respect inter-module dependency.
1225
1226
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
1226
1227
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
1227
1228
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
1228
- stop$E();
1229
+ stop$F();
1229
1230
  }
1230
- function compute$9() {
1231
- compute$b();
1232
- compute$f();
1231
+ function compute$a() {
1232
+ compute$c();
1233
+ compute$g();
1233
1234
  compute$2();
1235
+ compute$e();
1234
1236
  compute$d();
1235
- compute$c();
1236
1237
  compute$3();
1237
- compute$a();
1238
- compute$e();
1238
+ compute$b();
1239
+ compute$f();
1239
1240
  }
1240
1241
 
1241
1242
  var history$5 = [];
1242
- var data$d;
1243
- function start$B() {
1243
+ var data$e;
1244
+ function start$C() {
1244
1245
  history$5 = [];
1245
1246
  max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
1246
1247
  try {
@@ -1254,18 +1255,18 @@ function start$B() {
1254
1255
  function check$4(id, target, input) {
1255
1256
  // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
1256
1257
  if (config$2.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
1257
- data$d = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1258
+ data$e = { id: id, target: target, checksum: hash(input, 28 /* Setting.ChecksumPrecision */) };
1258
1259
  // Only encode this event if we haven't already reported this hash
1259
- if (history$5.indexOf(data$d.checksum) < 0) {
1260
- history$5.push(data$d.checksum);
1260
+ if (history$5.indexOf(data$e.checksum) < 0) {
1261
+ history$5.push(data$e.checksum);
1261
1262
  encode$2(41 /* Event.Fraud */);
1262
1263
  }
1263
1264
  }
1264
1265
  }
1265
1266
 
1266
1267
  var state$a = [];
1267
- function start$A() {
1268
- reset$m();
1268
+ function start$B() {
1269
+ reset$n();
1269
1270
  }
1270
1271
  function observe$c(root) {
1271
1272
  bind(root, "change", recompute$8, true);
@@ -1279,11 +1280,11 @@ function recompute$8(evt) {
1279
1280
  schedule(encode$4.bind(this, 42 /* Event.Change */));
1280
1281
  }
1281
1282
  }
1282
- function reset$m() {
1283
+ function reset$n() {
1283
1284
  state$a = [];
1284
1285
  }
1285
- function stop$y() {
1286
- reset$m();
1286
+ function stop$z() {
1287
+ reset$n();
1287
1288
  }
1288
1289
 
1289
1290
  function offset(element) {
@@ -1304,8 +1305,8 @@ function offset(element) {
1304
1305
 
1305
1306
  var UserInputTags = ["input", "textarea", "radio", "button", "canvas", "select"];
1306
1307
  var state$9 = [];
1307
- function start$z() {
1308
- reset$l();
1308
+ function start$A() {
1309
+ reset$m();
1309
1310
  }
1310
1311
  function observe$b(root) {
1311
1312
  bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
@@ -1431,16 +1432,16 @@ function context(a) {
1431
1432
  }
1432
1433
  return 0 /* BrowsingContext.Self */;
1433
1434
  }
1434
- function reset$l() {
1435
+ function reset$m() {
1435
1436
  state$9 = [];
1436
1437
  }
1437
- function stop$x() {
1438
- reset$l();
1438
+ function stop$y() {
1439
+ reset$m();
1439
1440
  }
1440
1441
 
1441
1442
  var state$8 = [];
1442
- function start$y() {
1443
- reset$k();
1443
+ function start$z() {
1444
+ reset$l();
1444
1445
  }
1445
1446
  function observe$a(root) {
1446
1447
  bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
@@ -1451,17 +1452,17 @@ function recompute$7(action, evt) {
1451
1452
  state$8.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1452
1453
  schedule(encode$4.bind(this, 38 /* Event.Clipboard */));
1453
1454
  }
1454
- function reset$k() {
1455
+ function reset$l() {
1455
1456
  state$8 = [];
1456
1457
  }
1457
- function stop$w() {
1458
- reset$k();
1458
+ function stop$x() {
1459
+ reset$l();
1459
1460
  }
1460
1461
 
1461
1462
  var timeout$6 = null;
1462
1463
  var state$7 = [];
1463
- function start$x() {
1464
- reset$j();
1464
+ function start$y() {
1465
+ reset$k();
1465
1466
  }
1466
1467
  function observe$9(root) {
1467
1468
  bind(root, "input", recompute$6, true);
@@ -1491,12 +1492,12 @@ function recompute$6(evt) {
1491
1492
  function process$7(event) {
1492
1493
  schedule(encode$4.bind(this, event));
1493
1494
  }
1494
- function reset$j() {
1495
+ function reset$k() {
1495
1496
  state$7 = [];
1496
1497
  }
1497
- function stop$v() {
1498
+ function stop$w() {
1498
1499
  clearTimeout$1(timeout$6);
1499
- reset$j();
1500
+ reset$k();
1500
1501
  }
1501
1502
 
1502
1503
  var state$6 = [];
@@ -1504,8 +1505,8 @@ var timeout$5 = null;
1504
1505
  var hasPrimaryTouch = false;
1505
1506
  var primaryTouchId = 0;
1506
1507
  var activeTouchPointIds = new Set();
1507
- function start$w() {
1508
- reset$i();
1508
+ function start$x() {
1509
+ reset$j();
1509
1510
  }
1510
1511
  function observe$8(root) {
1511
1512
  bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
@@ -1600,7 +1601,7 @@ function handler$2(current) {
1600
1601
  function process$6(event) {
1601
1602
  schedule(encode$4.bind(this, event));
1602
1603
  }
1603
- function reset$i() {
1604
+ function reset$j() {
1604
1605
  state$6 = [];
1605
1606
  }
1606
1607
  function similar$1(last, current) {
@@ -1612,7 +1613,7 @@ function similar$1(last, current) {
1612
1613
  var sameId = current.data.id !== undefined ? current.data.id === last.data.id : true;
1613
1614
  return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.PointerInterval */ && sameId;
1614
1615
  }
1615
- function stop$u() {
1616
+ function stop$v() {
1616
1617
  clearTimeout$1(timeout$5);
1617
1618
  // Send out any pending pointer events in the pipeline
1618
1619
  if (state$6.length > 0) {
@@ -1668,11 +1669,11 @@ function throttle(func, duration) {
1668
1669
  return throttledFunction;
1669
1670
  }
1670
1671
 
1671
- var data$c;
1672
+ var data$d;
1672
1673
  var timeout$4 = null;
1673
1674
  var initialStateLogged = false;
1674
1675
  var throttledRecompute$1 = throttle(recompute$5, 500 /* Setting.LookAhead */);
1675
- function start$v() {
1676
+ function start$w() {
1676
1677
  initialStateLogged = false;
1677
1678
  bind(window, "resize", throttledRecompute$1);
1678
1679
  recompute$5();
@@ -1681,7 +1682,7 @@ function recompute$5() {
1681
1682
  var de = document.documentElement;
1682
1683
  // window.innerWidth includes width of the scrollbar and is not a true representation of the viewport width.
1683
1684
  // Therefore, when possible, use documentElement's clientWidth property.
1684
- data$c = {
1685
+ data$d = {
1685
1686
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1686
1687
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1687
1688
  };
@@ -1697,20 +1698,20 @@ function recompute$5() {
1697
1698
  function process$5(event) {
1698
1699
  schedule(encode$4.bind(this, event));
1699
1700
  }
1700
- function reset$h() {
1701
- data$c = null;
1701
+ function reset$i() {
1702
+ data$d = null;
1702
1703
  clearTimeout$1(timeout$4);
1703
1704
  throttledRecompute$1.cleanup();
1704
1705
  }
1705
- function stop$t() {
1706
- reset$h();
1706
+ function stop$u() {
1707
+ reset$i();
1707
1708
  }
1708
1709
 
1709
1710
  var state$5 = [];
1710
1711
  var initialTop = null;
1711
1712
  var initialBottom = null;
1712
1713
  var timeout$3 = null;
1713
- function start$u() {
1714
+ function start$v() {
1714
1715
  state$5 = [];
1715
1716
  recompute$4();
1716
1717
  }
@@ -1782,7 +1783,7 @@ function getPositionNode(x, y) {
1782
1783
  }
1783
1784
  return node;
1784
1785
  }
1785
- function reset$g() {
1786
+ function reset$h() {
1786
1787
  state$5 = [];
1787
1788
  initialTop = null;
1788
1789
  initialBottom = null;
@@ -1795,7 +1796,7 @@ function similar(last, current) {
1795
1796
  var dy = last.data.y - current.data.y;
1796
1797
  return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 50 /* Setting.ScrollInterval */);
1797
1798
  }
1798
- function compute$8() {
1799
+ function compute$9() {
1799
1800
  var _a, _b;
1800
1801
  if (initialTop) {
1801
1802
  var top_1 = metadata$2(initialTop, null);
@@ -1806,7 +1807,7 @@ function compute$8() {
1806
1807
  log(32 /* Dimension.InitialScrollBottom */, (_b = bottom === null || bottom === void 0 ? void 0 : bottom.hash) === null || _b === void 0 ? void 0 : _b.join("." /* Constant.Dot */));
1807
1808
  }
1808
1809
  }
1809
- function stop$s() {
1810
+ function stop$t() {
1810
1811
  clearTimeout$1(timeout$3);
1811
1812
  throttledRecompute.cleanup();
1812
1813
  state$5 = [];
@@ -1814,11 +1815,11 @@ function stop$s() {
1814
1815
  initialBottom = null;
1815
1816
  }
1816
1817
 
1817
- var data$b = null;
1818
+ var data$c = null;
1818
1819
  var previous = null;
1819
1820
  var timeout$2 = null;
1820
- function start$t() {
1821
- reset$f();
1821
+ function start$u() {
1822
+ reset$g();
1822
1823
  }
1823
1824
  function observe$6(root) {
1824
1825
  bind(root, "selectstart", recompute$3.bind(this, root), true);
@@ -1839,12 +1840,12 @@ function recompute$3(root) {
1839
1840
  (current.anchorNode === current.focusNode && current.anchorOffset === current.focusOffset)) {
1840
1841
  return;
1841
1842
  }
1842
- var startNode = data$b.start ? data$b.start : null;
1843
- if (previous !== null && data$b.start !== null && startNode !== current.anchorNode) {
1843
+ var startNode = data$c.start ? data$c.start : null;
1844
+ if (previous !== null && data$c.start !== null && startNode !== current.anchorNode) {
1844
1845
  clearTimeout$1(timeout$2);
1845
1846
  process$3(21 /* Event.Selection */);
1846
1847
  }
1847
- data$b = {
1848
+ data$c = {
1848
1849
  start: current.anchorNode,
1849
1850
  startOffset: current.anchorOffset,
1850
1851
  end: current.focusNode,
@@ -1857,18 +1858,18 @@ function recompute$3(root) {
1857
1858
  function process$3(event) {
1858
1859
  schedule(encode$4.bind(this, event));
1859
1860
  }
1860
- function reset$f() {
1861
+ function reset$g() {
1861
1862
  previous = null;
1862
- data$b = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
1863
+ data$c = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
1863
1864
  }
1864
- function stop$r() {
1865
- reset$f();
1865
+ function stop$s() {
1866
+ reset$g();
1866
1867
  clearTimeout$1(timeout$2);
1867
1868
  }
1868
1869
 
1869
1870
  var state$4 = [];
1870
- function start$s() {
1871
- reset$e();
1871
+ function start$t() {
1872
+ reset$f();
1872
1873
  }
1873
1874
  function observe$5(root) {
1874
1875
  bind(root, "submit", recompute$2, true);
@@ -1877,22 +1878,39 @@ function recompute$2(evt) {
1877
1878
  state$4.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1878
1879
  schedule(encode$4.bind(this, 39 /* Event.Submit */));
1879
1880
  }
1880
- function reset$e() {
1881
+ function reset$f() {
1881
1882
  state$4 = [];
1882
1883
  }
1883
- function stop$q() {
1884
- reset$e();
1884
+ function stop$r() {
1885
+ reset$f();
1885
1886
  }
1886
1887
 
1887
- var data$a;
1888
- function start$r() {
1888
+ var data$b;
1889
+ function start$s() {
1889
1890
  bind(window, "pagehide", recompute$1);
1890
1891
  }
1891
1892
  function recompute$1(evt) {
1892
- data$a = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
1893
+ data$b = { name: evt.type, persisted: evt.persisted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */ };
1893
1894
  encode$4(26 /* Event.Unload */, time(evt));
1894
1895
  stop();
1895
1896
  }
1897
+ function reset$e() {
1898
+ data$b = null;
1899
+ }
1900
+ function stop$q() {
1901
+ reset$e();
1902
+ }
1903
+
1904
+ var data$a;
1905
+ function start$r() {
1906
+ bind(document, "visibilitychange", recompute);
1907
+ recompute();
1908
+ }
1909
+ function recompute(evt) {
1910
+ if (evt === void 0) { evt = null; }
1911
+ data$a = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1912
+ encode$4(28 /* Event.Visibility */, time(evt));
1913
+ }
1896
1914
  function reset$d() {
1897
1915
  data$a = null;
1898
1916
  }
@@ -1902,48 +1920,49 @@ function stop$p() {
1902
1920
 
1903
1921
  var data$9;
1904
1922
  function start$q() {
1905
- bind(document, "visibilitychange", recompute);
1906
- recompute();
1923
+ bind(window, "focus", function () { return compute$8(1 /* BooleanFlag.True */); });
1924
+ bind(window, "blur", function () { return compute$8(0 /* BooleanFlag.False */); });
1907
1925
  }
1908
- function recompute(evt) {
1909
- if (evt === void 0) { evt = null; }
1910
- data$9 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1911
- encode$4(28 /* Event.Visibility */, time(evt));
1926
+ function stop$o() {
1927
+ reset$c();
1912
1928
  }
1913
1929
  function reset$c() {
1914
1930
  data$9 = null;
1915
1931
  }
1916
- function stop$o() {
1917
- reset$c();
1932
+ function compute$8(focus) {
1933
+ data$9 = { focused: focus };
1934
+ encode$4(49 /* Event.Focus */);
1918
1935
  }
1919
1936
 
1920
1937
  function start$p() {
1921
1938
  start$i();
1939
+ start$A();
1922
1940
  start$z();
1941
+ start$x();
1923
1942
  start$y();
1924
1943
  start$w();
1925
- start$x();
1926
- start$v();
1944
+ start$r();
1927
1945
  start$q();
1946
+ start$v();
1928
1947
  start$u();
1948
+ start$B();
1929
1949
  start$t();
1930
- start$A();
1931
1950
  start$s();
1932
- start$r();
1933
1951
  }
1934
1952
  function stop$n() {
1935
1953
  stop$g();
1954
+ stop$y();
1936
1955
  stop$x();
1956
+ stop$v();
1937
1957
  stop$w();
1938
1958
  stop$u();
1939
- stop$v();
1940
- stop$t();
1959
+ stop$p();
1941
1960
  stop$o();
1961
+ stop$t();
1942
1962
  stop$s();
1963
+ stop$z();
1943
1964
  stop$r();
1944
- stop$y();
1945
1965
  stop$q();
1946
- stop$p();
1947
1966
  }
1948
1967
  function observe$4(root) {
1949
1968
  observe$7(root);
@@ -3938,7 +3957,7 @@ function metadata$2(node, event, text) {
3938
3957
  function encode$4 (type, ts) {
3939
3958
  if (ts === void 0) { ts = null; }
3940
3959
  return __awaiter(this, void 0, void 0, function () {
3941
- var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, top_1, bottom, sTopHash, sBottomHash, _k, _l, entry, target, _m, _o, entry, target, _p, _q, entry, v;
3960
+ var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, top_1, bottom, sTopHash, sBottomHash, _k, _l, entry, target, _m, _o, entry, target, _p, _q, entry, v, f;
3942
3961
  return __generator(this, function (_r) {
3943
3962
  t = ts || time();
3944
3963
  tokens = [t, type];
@@ -3972,7 +3991,7 @@ function encode$4 (type, ts) {
3972
3991
  }
3973
3992
  }
3974
3993
  }
3975
- reset$i();
3994
+ reset$j();
3976
3995
  break;
3977
3996
  case 9 /* Event.Click */:
3978
3997
  case 48 /* Event.ContextMenu */:
@@ -3997,7 +4016,7 @@ function encode$4 (type, ts) {
3997
4016
  queue(tokens);
3998
4017
  track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
3999
4018
  }
4000
- reset$l();
4019
+ reset$m();
4001
4020
  break;
4002
4021
  case 38 /* Event.Clipboard */:
4003
4022
  for (_d = 0, _e = state$8; _d < _e.length; _d++) {
@@ -4010,21 +4029,21 @@ function encode$4 (type, ts) {
4010
4029
  queue(tokens);
4011
4030
  }
4012
4031
  }
4013
- reset$k();
4032
+ reset$l();
4014
4033
  break;
4015
4034
  case 11 /* Event.Resize */:
4016
- r = data$c;
4035
+ r = data$d;
4017
4036
  tokens.push(r.width);
4018
4037
  tokens.push(r.height);
4019
4038
  track$8(type, r.width, r.height);
4020
- reset$h();
4039
+ reset$i();
4021
4040
  queue(tokens);
4022
4041
  break;
4023
4042
  case 26 /* Event.Unload */:
4024
- u = data$a;
4043
+ u = data$b;
4025
4044
  tokens.push(u.name);
4026
4045
  tokens.push(u.persisted);
4027
- reset$d();
4046
+ reset$e();
4028
4047
  queue(tokens);
4029
4048
  break;
4030
4049
  case 27 /* Event.Input */:
@@ -4037,10 +4056,10 @@ function encode$4 (type, ts) {
4037
4056
  tokens.push(entry.data.trust);
4038
4057
  queue(tokens);
4039
4058
  }
4040
- reset$j();
4059
+ reset$k();
4041
4060
  break;
4042
4061
  case 21 /* Event.Selection */:
4043
- s = data$b;
4062
+ s = data$c;
4044
4063
  if (s) {
4045
4064
  startTarget = metadata$2(s.start, type);
4046
4065
  endTarget = metadata$2(s.end, type);
@@ -4048,7 +4067,7 @@ function encode$4 (type, ts) {
4048
4067
  tokens.push(s.startOffset);
4049
4068
  tokens.push(endTarget.id);
4050
4069
  tokens.push(s.endOffset);
4051
- reset$f();
4070
+ reset$g();
4052
4071
  queue(tokens);
4053
4072
  }
4054
4073
  break;
@@ -4071,7 +4090,7 @@ function encode$4 (type, ts) {
4071
4090
  track$8(entry.event, entry.data.x, entry.data.y, entry.time);
4072
4091
  }
4073
4092
  }
4074
- reset$g();
4093
+ reset$h();
4075
4094
  break;
4076
4095
  case 42 /* Event.Change */:
4077
4096
  for (_k = 0, _l = state$a; _k < _l.length; _k++) {
@@ -4087,7 +4106,7 @@ function encode$4 (type, ts) {
4087
4106
  queue(tokens);
4088
4107
  }
4089
4108
  }
4090
- reset$m();
4109
+ reset$n();
4091
4110
  break;
4092
4111
  case 39 /* Event.Submit */:
4093
4112
  for (_m = 0, _o = state$4; _m < _o.length; _m++) {
@@ -4099,7 +4118,7 @@ function encode$4 (type, ts) {
4099
4118
  queue(tokens);
4100
4119
  }
4101
4120
  }
4102
- reset$e();
4121
+ reset$f();
4103
4122
  break;
4104
4123
  case 22 /* Event.Timeline */:
4105
4124
  for (_p = 0, _q = updates$1; _p < _q.length; _p++) {
@@ -4116,12 +4135,19 @@ function encode$4 (type, ts) {
4116
4135
  reset$5();
4117
4136
  break;
4118
4137
  case 28 /* Event.Visibility */:
4119
- v = data$9;
4138
+ v = data$a;
4120
4139
  tokens.push(v.visible);
4121
4140
  queue(tokens);
4122
4141
  visibility(t, v.visible);
4142
+ reset$d();
4143
+ break;
4144
+ case 49 /* Event.Focus */: {
4145
+ f = data$9;
4146
+ tokens.push(f.focused);
4147
+ queue(tokens, false);
4123
4148
  reset$c();
4124
4149
  break;
4150
+ }
4125
4151
  }
4126
4152
  return [2 /*return*/];
4127
4153
  });
@@ -4434,7 +4460,7 @@ function queue(tokens, transmit) {
4434
4460
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
4435
4461
  if (transmit && timeout === null) {
4436
4462
  if (type !== 25 /* Event.Ping */) {
4437
- reset$q();
4463
+ reset$r();
4438
4464
  }
4439
4465
  timeout = setTimeout$1(upload, gap);
4440
4466
  queuedTime = now;
@@ -4473,7 +4499,7 @@ function upload(final) {
4473
4499
  // Otherwise you run a risk of infinite loop.
4474
4500
  compute$5();
4475
4501
  compute$4();
4476
- compute$9();
4502
+ compute$a();
4477
4503
  compute$7();
4478
4504
  last = final === true;
4479
4505
  // In some cases envelope has null data because it's part of the shutdown process while there's one upload call queued which might introduce runtime error
@@ -4482,6 +4508,10 @@ function upload(final) {
4482
4508
  e = JSON.stringify(envelope(last));
4483
4509
  a = "[".concat(analysis.join(), "]");
4484
4510
  p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
4511
+ // For final (beacon) payloads, If size is too large, we need to remove playback data
4512
+ if (last && p.length > 0 && (e.length + a.length + p.length > 65536 /* Setting.MaxBeaconPayloadBytes */)) {
4513
+ p = "" /* Constant.Empty */;
4514
+ }
4485
4515
  encoded = { e: e, a: a, p: p };
4486
4516
  payload = stringify(encoded);
4487
4517
  if (!last) return [3 /*break*/, 1];
@@ -4737,10 +4767,10 @@ function encode$2 (type) {
4737
4767
  }
4738
4768
  break;
4739
4769
  case 41 /* Event.Fraud */:
4740
- if (data$d) {
4741
- tokens.push(data$d.id);
4742
- tokens.push(data$d.target);
4743
- tokens.push(data$d.checksum);
4770
+ if (data$e) {
4771
+ tokens.push(data$e.id);
4772
+ tokens.push(data$e.target);
4773
+ tokens.push(data$e.checksum);
4744
4774
  queue(tokens, false);
4745
4775
  }
4746
4776
  break;
@@ -4981,7 +5011,7 @@ function start$c() {
4981
5011
  schedule(discover, 1 /* Priority.High */).then(function () {
4982
5012
  measure(compute$6)();
4983
5013
  measure(compute$5)();
4984
- measure(compute$8)();
5014
+ measure(compute$9)();
4985
5015
  });
4986
5016
  }
4987
5017
  function discover() {
@@ -5075,11 +5105,11 @@ function encode$1 (event) {
5075
5105
  tokens.push(b.data.pointerPrevTime);
5076
5106
  queue(tokens, false);
5077
5107
  }
5078
- reset$s();
5108
+ reset$t();
5079
5109
  break;
5080
5110
  }
5081
5111
  case 25 /* Event.Ping */:
5082
- tokens.push(data$h.gap);
5112
+ tokens.push(data$i.gap);
5083
5113
  queue(tokens);
5084
5114
  break;
5085
5115
  case 35 /* Event.Limit */:
@@ -5098,19 +5128,19 @@ function encode$1 (event) {
5098
5128
  break;
5099
5129
  case 24 /* Event.Custom */:
5100
5130
  // not all custom events have a key - if it wasn't passed server handles just value
5101
- data$j.key && tokens.push(data$j.key);
5102
- tokens.push(data$j.value);
5131
+ data$k.key && tokens.push(data$k.key);
5132
+ tokens.push(data$k.value);
5103
5133
  queue(tokens);
5104
5134
  break;
5105
5135
  case 34 /* Event.Variable */: {
5106
- var variableKeys = Object.keys(data$f);
5136
+ var variableKeys = Object.keys(data$g);
5107
5137
  if (variableKeys.length > 0) {
5108
5138
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
5109
5139
  var v = variableKeys_1[_i];
5110
5140
  tokens.push(v);
5111
- tokens.push(data$f[v]);
5141
+ tokens.push(data$g[v]);
5112
5142
  }
5113
- reset$o();
5143
+ reset$p();
5114
5144
  queue(tokens, false);
5115
5145
  }
5116
5146
  break;
@@ -5126,7 +5156,7 @@ function encode$1 (event) {
5126
5156
  // However, for data over the wire, we round it off to milliseconds precision.
5127
5157
  tokens.push(Math.round(updates$3[m]));
5128
5158
  }
5129
- reset$r();
5159
+ reset$s();
5130
5160
  queue(tokens, false);
5131
5161
  }
5132
5162
  break;
@@ -5146,15 +5176,15 @@ function encode$1 (event) {
5146
5176
  break;
5147
5177
  }
5148
5178
  case 36 /* Event.Summary */: {
5149
- var eventKeys = Object.keys(data$g);
5179
+ var eventKeys = Object.keys(data$h);
5150
5180
  if (eventKeys.length > 0) {
5151
5181
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
5152
5182
  var e = eventKeys_1[_c];
5153
5183
  var key = parseInt(e, 10);
5154
5184
  tokens.push(key);
5155
- tokens.push([].concat.apply([], data$g[e]));
5185
+ tokens.push([].concat.apply([], data$h[e]));
5156
5186
  }
5157
- reset$p();
5187
+ reset$q();
5158
5188
  queue(tokens, false);
5159
5189
  }
5160
5190
  break;
@@ -5164,21 +5194,21 @@ function encode$1 (event) {
5164
5194
  extractKeys.forEach(function (e) {
5165
5195
  tokens.push(e);
5166
5196
  var token = [];
5167
- for (var d in data$e[e]) {
5197
+ for (var d in data$f[e]) {
5168
5198
  var key = parseInt(d, 10);
5169
5199
  token.push(key);
5170
- token.push(data$e[e][d]);
5200
+ token.push(data$f[e][d]);
5171
5201
  }
5172
5202
  tokens.push(token);
5173
5203
  });
5174
- reset$n();
5204
+ reset$o();
5175
5205
  queue(tokens, false);
5176
5206
  break;
5177
5207
  }
5178
5208
  case 47 /* Event.Consent */:
5179
- tokens.push(data$k.source);
5180
- tokens.push(data$k.ad_Storage);
5181
- tokens.push(data$k.analytics_Storage);
5209
+ tokens.push(data$l.source);
5210
+ tokens.push(data$l.ad_Storage);
5211
+ tokens.push(data$l.analytics_Storage);
5182
5212
  queue(tokens, false);
5183
5213
  break;
5184
5214
  }
@@ -5729,6 +5759,7 @@ function measure (method) {
5729
5759
  if (duration > 30 /* Setting.LongTask */) {
5730
5760
  count$1(7 /* Metric.LongTaskCount */);
5731
5761
  max(6 /* Metric.ThreadBlockedTime */, duration);
5762
+ method.dn && log$1(9 /* Code.FunctionExecutionTime */, 0 /* Severity.Info */, "".concat(method.dn, "-").concat(duration));
5732
5763
  }
5733
5764
  };
5734
5765
  }
@@ -5839,7 +5870,7 @@ function stop$6() {
5839
5870
  var status = false;
5840
5871
  function start$5() {
5841
5872
  status = true;
5842
- start$K();
5873
+ start$L();
5843
5874
  reset$4();
5844
5875
  reset$1();
5845
5876
  reset$2();
@@ -5850,7 +5881,7 @@ function stop$5() {
5850
5881
  reset$2();
5851
5882
  reset$1();
5852
5883
  reset$4();
5853
- stop$H();
5884
+ stop$I();
5854
5885
  status = false;
5855
5886
  }
5856
5887
  function active() {
@@ -5906,7 +5937,7 @@ function restart() {
5906
5937
  }
5907
5938
 
5908
5939
  function start$4() {
5909
- start$B();
5940
+ start$C();
5910
5941
  start$f();
5911
5942
  start$e();
5912
5943
  }
@@ -6246,7 +6277,7 @@ function start(config$1) {
6246
6277
  if (check()) {
6247
6278
  config(config$1);
6248
6279
  start$5();
6249
- start$C();
6280
+ start$D();
6250
6281
  modules.forEach(function (x) { return measure(x.start)(); });
6251
6282
  // If it's an internal call to start, without explicit configuration,
6252
6283
  // re-process any newly accumulated items in the queue
@@ -6277,7 +6308,7 @@ function stop() {
6277
6308
  if (active()) {
6278
6309
  // Stop modules in the reverse order of their initialization and start queuing up items again
6279
6310
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
6280
- stop$z();
6311
+ stop$A();
6281
6312
  stop$5();
6282
6313
  setup();
6283
6314
  }