clarity-js 0.6.36 → 0.6.39

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.
@@ -75,7 +75,7 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
75
75
 
76
76
  var config$1 = {
77
77
  projectId: null,
78
- delay: 1 * 1000 /* Second */,
78
+ delay: 1 * 1000 /* Time.Second */,
79
79
  lean: false,
80
80
  track: true,
81
81
  content: true,
@@ -95,7 +95,7 @@ function api(method) {
95
95
  // Zone.js, a popular package for Angular, overrides native browser APIs which can lead to inconsistent state for single page applications.
96
96
  // Example issue: https://github.com/angular/angular/issues/31712
97
97
  // As a work around, we ensuring Clarity access APIs outside of Zone (and use native implementation instead)
98
- return window["Zone" /* Zone */] && "__symbol__" /* Symbol */ in window["Zone" /* Zone */] ? window["Zone" /* Zone */]["__symbol__" /* Symbol */](method) : method;
98
+ return window["Zone" /* Constant.Zone */] && "__symbol__" /* Constant.Symbol */ in window["Zone" /* Constant.Zone */] ? window["Zone" /* Constant.Zone */]["__symbol__" /* Constant.Symbol */](method) : method;
99
99
  }
100
100
 
101
101
  var startTime = 0;
@@ -111,7 +111,7 @@ function stop$B() {
111
111
  startTime = 0;
112
112
  }
113
113
 
114
- var version$1 = "0.6.36";
114
+ var version$1 = "0.6.39";
115
115
 
116
116
  // tslint:disable: no-bitwise
117
117
  function hash (input) {
@@ -144,7 +144,7 @@ function reset$o() {
144
144
  // Baseline state holds the previous values - if it is updated in the current payload,
145
145
  // reset the state to current value after sending the previous state
146
146
  if (update$2) {
147
- state$9 = { time: time(), event: 4 /* Baseline */, data: {
147
+ state$9 = { time: time(), event: 4 /* Event.Baseline */, data: {
148
148
  visible: buffer.visible,
149
149
  docWidth: buffer.docWidth,
150
150
  docHeight: buffer.docHeight,
@@ -159,7 +159,7 @@ function reset$o() {
159
159
  };
160
160
  }
161
161
  buffer = buffer ? buffer : {
162
- visible: 1 /* True */,
162
+ visible: 1 /* BooleanFlag.True */,
163
163
  docWidth: 0,
164
164
  docHeight: 0,
165
165
  screenWidth: 0,
@@ -173,15 +173,15 @@ function reset$o() {
173
173
  }
174
174
  function track$7(event, x, y) {
175
175
  switch (event) {
176
- case 8 /* Document */:
176
+ case 8 /* Event.Document */:
177
177
  buffer.docWidth = x;
178
178
  buffer.docHeight = y;
179
179
  break;
180
- case 11 /* Resize */:
180
+ case 11 /* Event.Resize */:
181
181
  buffer.screenWidth = x;
182
182
  buffer.screenHeight = y;
183
183
  break;
184
- case 10 /* Scroll */:
184
+ case 10 /* Event.Scroll */:
185
185
  buffer.scrollX = x;
186
186
  buffer.scrollY = y;
187
187
  break;
@@ -196,7 +196,7 @@ function activity(t) {
196
196
  buffer.activityTime = t;
197
197
  }
198
198
  function visibility(t, visible) {
199
- buffer.visible = visible === "visible" ? 1 /* True */ : 0 /* False */;
199
+ buffer.visible = visible === "visible" ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
200
200
  if (!buffer.visible) {
201
201
  activity(t);
202
202
  }
@@ -204,7 +204,7 @@ function visibility(t, visible) {
204
204
  }
205
205
  function compute$c() {
206
206
  if (update$2) {
207
- encode$1(4 /* Baseline */);
207
+ encode$1(4 /* Event.Baseline */);
208
208
  }
209
209
  }
210
210
  function stop$A() {
@@ -228,12 +228,12 @@ function event(key, value) {
228
228
  if (active() &&
229
229
  key &&
230
230
  value &&
231
- typeof key === "string" /* String */ &&
232
- typeof value === "string" /* String */ &&
231
+ typeof key === "string" /* Constant.String */ &&
232
+ typeof value === "string" /* Constant.String */ &&
233
233
  key.length < 255 &&
234
234
  value.length < 255) {
235
235
  data$j = { key: key, value: value };
236
- encode$1(24 /* Custom */);
236
+ encode$1(24 /* Event.Custom */);
237
237
  }
238
238
  }
239
239
 
@@ -242,7 +242,7 @@ var updates$3 = null;
242
242
  function start$D() {
243
243
  data$i = {};
244
244
  updates$3 = {};
245
- count$1(5 /* InvokeCount */);
245
+ count$1(5 /* Metric.InvokeCount */);
246
246
  }
247
247
  function stop$z() {
248
248
  data$i = {};
@@ -283,7 +283,7 @@ function max(metric, value) {
283
283
  }
284
284
  }
285
285
  function compute$b() {
286
- encode$1(0 /* Metric */);
286
+ encode$1(0 /* Event.Metric */);
287
287
  }
288
288
  function reset$n() {
289
289
  updates$3 = {};
@@ -301,7 +301,7 @@ var last = 0;
301
301
  var interval = 0;
302
302
  var timeout$6 = null;
303
303
  function start$C() {
304
- interval = 60000 /* PingInterval */;
304
+ interval = 60000 /* Setting.PingInterval */;
305
305
  last = 0;
306
306
  }
307
307
  function reset$m() {
@@ -314,8 +314,8 @@ function reset$m() {
314
314
  function ping() {
315
315
  var now = time();
316
316
  data$h = { gap: now - last };
317
- encode$1(25 /* Ping */);
318
- if (data$h.gap < 300000 /* PingTimeout */) {
317
+ encode$1(25 /* Event.Ping */);
318
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
319
319
  timeout$6 = setTimeout(ping, interval);
320
320
  }
321
321
  else {
@@ -352,7 +352,7 @@ function track$6(event, time) {
352
352
  var last = e[e.length - 1];
353
353
  // Add a new entry only if the new event occurs after configured interval
354
354
  // Otherwise, extend the duration of the previous entry
355
- if (time - last[0] > 100 /* SummaryInterval */) {
355
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
356
356
  data$g[event].push([time, 0]);
357
357
  }
358
358
  else {
@@ -361,7 +361,7 @@ function track$6(event, time) {
361
361
  }
362
362
  }
363
363
  function compute$a() {
364
- encode$1(36 /* Summary */);
364
+ encode$1(36 /* Event.Summary */);
365
365
  }
366
366
  function reset$l() {
367
367
  data$g = {};
@@ -380,7 +380,7 @@ var summary = /*#__PURE__*/Object.freeze({
380
380
  var data$f = null;
381
381
  function start$A() {
382
382
  if (!config$1.lean && config$1.upgrade) {
383
- config$1.upgrade("Config" /* Config */);
383
+ config$1.upgrade("Config" /* Constant.Config */);
384
384
  }
385
385
  data$f = null;
386
386
  }
@@ -399,7 +399,7 @@ function upgrade(key) {
399
399
  if (config$1.upgrade) {
400
400
  config$1.upgrade(key);
401
401
  }
402
- encode$1(3 /* Upgrade */);
402
+ encode$1(3 /* Event.Upgrade */);
403
403
  }
404
404
  }
405
405
  function stop$w() {
@@ -419,25 +419,25 @@ function start$z() {
419
419
  reset$k();
420
420
  }
421
421
  function set(variable, value) {
422
- var values = typeof value === "string" /* String */ ? [value] : value;
422
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
423
423
  log$2(variable, values);
424
424
  }
425
425
  function identify(userId, sessionId, pageId) {
426
426
  if (sessionId === void 0) { sessionId = null; }
427
427
  if (pageId === void 0) { pageId = null; }
428
- log$2("userId" /* UserId */, [userId]);
429
- log$2("sessionId" /* SessionId */, [sessionId]);
430
- log$2("pageId" /* PageId */, [pageId]);
428
+ log$2("userId" /* Constant.UserId */, [userId]);
429
+ log$2("sessionId" /* Constant.SessionId */, [sessionId]);
430
+ log$2("pageId" /* Constant.PageId */, [pageId]);
431
431
  }
432
432
  function log$2(variable, value) {
433
433
  if (active() &&
434
434
  variable &&
435
435
  value &&
436
- typeof variable === "string" /* String */ &&
436
+ typeof variable === "string" /* Constant.String */ &&
437
437
  variable.length < 255) {
438
438
  var validValues = variable in data$e ? data$e[variable] : [];
439
439
  for (var i = 0; i < value.length; i++) {
440
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
440
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
441
441
  validValues.push(value[i]);
442
442
  }
443
443
  }
@@ -445,7 +445,7 @@ function log$2(variable, value) {
445
445
  }
446
446
  }
447
447
  function compute$9() {
448
- encode$1(34 /* Variable */);
448
+ encode$1(34 /* Event.Variable */);
449
449
  }
450
450
  function reset$k() {
451
451
  data$e = {};
@@ -465,7 +465,7 @@ var variable = /*#__PURE__*/Object.freeze({
465
465
  stop: stop$v
466
466
  });
467
467
 
468
- /*! *****************************************************************************
468
+ /******************************************************************************
469
469
  Copyright (c) Microsoft Corporation.
470
470
 
471
471
  Permission to use, copy, modify, and/or distribute this software for any
@@ -518,7 +518,7 @@ function __generator(thisArg, body) {
518
518
  }
519
519
  }
520
520
 
521
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
521
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
522
522
  function compress (input) {
523
523
  return __awaiter(this, void 0, void 0, function () {
524
524
  var stream, _a;
@@ -535,7 +535,7 @@ function compress (input) {
535
535
  return [2 /*return*/];
536
536
  });
537
537
  });
538
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
538
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
539
539
  _a = Uint8Array.bind;
540
540
  return [4 /*yield*/, read(stream)];
541
541
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -600,32 +600,37 @@ function compute$8() {
600
600
  compute$4();
601
601
  }
602
602
 
603
+ var catchallRegex = /\S/gi;
604
+ var unicodeRegex = true;
605
+ var digitRegex = null;
606
+ var letterRegex = null;
607
+ var currencyRegex = null;
603
608
  function scrub (value, hint, privacy, mangle) {
604
609
  if (mangle === void 0) { mangle = false; }
605
610
  if (value) {
606
611
  switch (privacy) {
607
- case 0 /* None */:
612
+ case 0 /* Privacy.None */:
608
613
  return value;
609
- case 1 /* Sensitive */:
614
+ case 1 /* Privacy.Sensitive */:
610
615
  switch (hint) {
611
- case "*T" /* TextTag */:
616
+ case "*T" /* Layout.Constant.TextTag */:
612
617
  case "value":
613
618
  case "placeholder":
614
- return redact(value);
619
+ case "click":
615
620
  case "input":
616
- return mangleToken(value);
621
+ return redact(value);
617
622
  }
618
623
  return value;
619
- case 2 /* Text */:
620
- case 3 /* TextImage */:
624
+ case 2 /* Privacy.Text */:
625
+ case 3 /* Privacy.TextImage */:
621
626
  switch (hint) {
622
- case "*T" /* TextTag */:
627
+ case "*T" /* Layout.Constant.TextTag */:
623
628
  return mangle ? mangleText(value) : mask(value);
624
629
  case "src":
625
630
  case "srcset":
626
631
  case "title":
627
632
  case "alt":
628
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
633
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
629
634
  case "value":
630
635
  case "click":
631
636
  case "input":
@@ -645,40 +650,65 @@ function mangleText(value) {
645
650
  var index = value.indexOf(first);
646
651
  var prefix = value.substr(0, index);
647
652
  var suffix = value.substr(index + trimmed.length);
648
- return "" + prefix + trimmed.length.toString(36) + suffix;
653
+ return "".concat(prefix).concat(trimmed.length.toString(36)).concat(suffix);
649
654
  }
650
655
  return value;
651
656
  }
652
657
  function mask(value) {
653
- return value.replace(/\S/gi, "\u2022" /* Mask */);
658
+ return value.replace(catchallRegex, "\u2022" /* Data.Constant.Mask */);
654
659
  }
655
660
  function mangleToken(value) {
656
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
657
- var output = "" /* Empty */;
661
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
662
+ var output = "" /* Layout.Constant.Empty */;
658
663
  for (var i = 0; i < length; i++) {
659
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
664
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
660
665
  }
661
666
  return output;
662
667
  }
663
668
  function redact(value) {
664
669
  var spaceIndex = -1;
670
+ var gap = 0;
665
671
  var hasDigit = false;
666
672
  var hasEmail = false;
667
673
  var hasWhitespace = false;
668
674
  var array = null;
675
+ // Initialize unicode regex, if supported by the browser
676
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
677
+ if (unicodeRegex && digitRegex === null) {
678
+ try {
679
+ digitRegex = new RegExp("\\p{N}", "gu");
680
+ letterRegex = new RegExp("\\p{L}", "gu");
681
+ currencyRegex = new RegExp("\\p{Sc}", "gu");
682
+ }
683
+ catch (_a) {
684
+ unicodeRegex = false;
685
+ }
686
+ }
669
687
  for (var i = 0; i < value.length; i++) {
670
688
  var c = value.charCodeAt(i);
671
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
672
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
673
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
689
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
690
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
691
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
674
692
  // Process each word as an individual token to redact any sensitive information
675
693
  if (i === 0 || i === value.length - 1 || hasWhitespace) {
676
694
  // Performance optimization: Lazy load string -> array conversion only when required
677
695
  if (hasDigit || hasEmail) {
678
696
  if (array === null) {
679
- array = value.split("" /* Empty */);
697
+ array = value.split("" /* Data.Constant.Empty */);
698
+ }
699
+ // Work on a token at a time so we don't have to apply regex to a larger string
700
+ var token = value.substring(spaceIndex + 1, hasWhitespace ? i : i + 1);
701
+ // Check if unicode regex is supported, otherwise fallback to calling mask function on this token
702
+ if (unicodeRegex && currencyRegex !== null) {
703
+ // Do not redact information if the token contains a currency symbol
704
+ token = token.match(currencyRegex) ? token : token.replace(letterRegex, "\u2022" /* Data.Constant.Letter */).replace(digitRegex, "\u2022" /* Data.Constant.Digit */);
705
+ }
706
+ else {
707
+ token = mask(token);
680
708
  }
681
- mutate(array, spaceIndex, hasWhitespace ? i : i + 1);
709
+ // Merge token back into array at the right place
710
+ array.splice(spaceIndex + 1 - gap, token.length, token);
711
+ gap += token.length - 1;
682
712
  }
683
713
  // Reset digit and email flags after every word boundary, except the beginning of string
684
714
  if (hasWhitespace) {
@@ -688,28 +718,23 @@ function redact(value) {
688
718
  }
689
719
  }
690
720
  }
691
- return array ? array.join("" /* Empty */) : value;
692
- }
693
- function mutate(array, start, end) {
694
- for (var i = start + 1; i < end; i++) {
695
- array[i] = "\u2022" /* Mask */;
696
- }
721
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
697
722
  }
698
723
 
699
724
  var history$5 = [];
700
725
  var data$d;
701
726
  function start$x() {
702
727
  history$5 = [];
703
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
728
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
704
729
  }
705
730
  function check$4(id, target, input) {
706
731
  // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
707
- if (id !== null && input && input.length >= 5 /* WordLength */) {
732
+ if (id !== null && input && input.length >= 5 /* Setting.WordLength */) {
708
733
  data$d = { id: id, target: target, hash: hash(input) };
709
734
  // Only encode this event if we haven't already reported this hash
710
735
  if (history$5.indexOf(data$d.hash) < 0) {
711
736
  history$5.push(data$d.hash);
712
- encode$2(41 /* Fraud */);
737
+ encode$2(41 /* Event.Fraud */);
713
738
  }
714
739
  }
715
740
  }
@@ -718,45 +743,45 @@ var TAGS = ["DIV", "TR", "P", "LI", "UL", "A", "BUTTON"];
718
743
  function selector (input, beta) {
719
744
  if (beta === void 0) { beta = false; }
720
745
  var a = input.attributes;
721
- var prefix = input.prefix ? input.prefix[beta ? 1 /* Beta */ : 0 /* Stable */] : null;
722
- var suffix = beta || ((a && !("class" /* Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(" + input.position + ")" : "" /* Empty */;
746
+ var prefix = input.prefix ? input.prefix[beta ? 1 /* Selector.Beta */ : 0 /* Selector.Stable */] : null;
747
+ var suffix = beta || ((a && !("class" /* Constant.Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Constant.Empty */;
723
748
  switch (input.tag) {
724
749
  case "STYLE":
725
750
  case "TITLE":
726
751
  case "LINK":
727
752
  case "META":
728
- case "*T" /* TextTag */:
729
- case "*D" /* DocumentTag */:
730
- return "" /* Empty */;
753
+ case "*T" /* Constant.TextTag */:
754
+ case "*D" /* Constant.DocumentTag */:
755
+ return "" /* Constant.Empty */;
731
756
  case "HTML":
732
- return "HTML" /* HTML */;
757
+ return "HTML" /* Constant.HTML */;
733
758
  default:
734
759
  if (prefix === null) {
735
- return "" /* Empty */;
760
+ return "" /* Constant.Empty */;
736
761
  }
737
- prefix = prefix + ">";
738
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
739
- var selector = "" + prefix + input.tag + suffix;
740
- var classes = "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/) : null;
762
+ prefix = "".concat(prefix, ">");
763
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
764
+ var selector = "".concat(prefix).concat(input.tag).concat(suffix);
765
+ var classes = "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/) : null;
741
766
  if (beta) {
742
767
  // In beta mode, update selector to use "id" field when available. There are two exceptions:
743
768
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
744
769
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
745
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
746
- classes = input.tag !== "BODY" /* BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
747
- selector = classes.length > 0 ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
748
- selector = id && hasDigits(id) === false ? getDomPrefix(prefix) + "#" + id : selector;
770
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
771
+ classes = input.tag !== "BODY" /* Constant.BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
772
+ selector = classes.length > 0 ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
773
+ selector = id && hasDigits(id) === false ? "".concat(getDomPrefix(prefix), "#").concat(id) : selector;
749
774
  }
750
775
  else {
751
776
  // Otherwise, fallback to stable mode, where we include class names as part of the selector
752
- selector = classes ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
777
+ selector = classes ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
753
778
  }
754
779
  return selector;
755
780
  }
756
781
  }
757
782
  function getDomPrefix(prefix) {
758
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
759
- var iframeDomStart = prefix.lastIndexOf("" + "iframe:" /* IFramePrefix */ + "HTML" /* HTML */);
783
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
784
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
760
785
  var domStart = Math.max(shadowDomStart, iframeDomStart);
761
786
  if (domStart < 0) {
762
787
  return "";
@@ -768,7 +793,7 @@ function getDomPrefix(prefix) {
768
793
  function hasDigits(value) {
769
794
  for (var i = 0; i < value.length; i++) {
770
795
  var c = value.charCodeAt(i);
771
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
796
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
772
797
  return true;
773
798
  }
774
799
  }
@@ -805,7 +830,7 @@ function reset$j() {
805
830
  pauseTask = null;
806
831
  }
807
832
  function schedule$1(task, priority) {
808
- if (priority === void 0) { priority = 0 /* Normal */; }
833
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
809
834
  return __awaiter(this, void 0, void 0, function () {
810
835
  var _i, queuedTasks_1, q, promise;
811
836
  return __generator(this, function (_a) {
@@ -817,7 +842,7 @@ function schedule$1(task, priority) {
817
842
  }
818
843
  }
819
844
  promise = new Promise(function (resolve) {
820
- var insert = priority === 1 /* High */ ? "unshift" : "push";
845
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
821
846
  // Queue this task for asynchronous execution later
822
847
  // We also store a unique page identifier (id) along with the task to ensure
823
848
  // ensure that we do not accidentally execute this task in context of a different page
@@ -852,7 +877,7 @@ function run() {
852
877
  return;
853
878
  }
854
879
  if (error) {
855
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
880
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
856
881
  }
857
882
  activeTask = null;
858
883
  run();
@@ -863,13 +888,13 @@ function state$8(timer) {
863
888
  var id = key(timer);
864
889
  if (id in tracker) {
865
890
  var elapsed = performance.now() - tracker[id].start;
866
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
891
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
867
892
  }
868
893
  // If this task is no longer being tracked, send stop message to the caller
869
- return 2 /* Stop */;
894
+ return 2 /* Task.Stop */;
870
895
  }
871
896
  function start$w(timer) {
872
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
897
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
873
898
  }
874
899
  function restart$2(timer) {
875
900
  var id = key(timer);
@@ -886,11 +911,11 @@ function stop$t(timer) {
886
911
  var id = key(timer);
887
912
  var duration = end - tracker[id].start;
888
913
  sum(timer.cost, duration);
889
- count$1(5 /* InvokeCount */);
914
+ count$1(5 /* Metric.InvokeCount */);
890
915
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
891
916
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
892
917
  if (tracker[id].calls > 0) {
893
- sum(4 /* TotalCost */, duration);
918
+ sum(4 /* Metric.TotalCost */, duration);
894
919
  }
895
920
  }
896
921
  function suspend$1(timer) {
@@ -911,13 +936,13 @@ function suspend$1(timer) {
911
936
  case 2:
912
937
  // After we are done with suspending task, ensure that we are still operating in the right context
913
938
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
914
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
939
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
915
940
  }
916
941
  });
917
942
  });
918
943
  }
919
944
  function key(timer) {
920
- return timer.id + "." + timer.cost;
945
+ return "".concat(timer.id, ".").concat(timer.cost);
921
946
  }
922
947
  function wait() {
923
948
  return __awaiter(this, void 0, void 0, function () {
@@ -955,14 +980,14 @@ function requestIdleCallbackPolyfill(callback, options) {
955
980
  var currentTime = performance.now();
956
981
  var elapsed = currentTime - startTime;
957
982
  var duration = currentTime - event.data;
958
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
983
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
959
984
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
960
985
  }
961
986
  else {
962
987
  var didTimeout_1 = elapsed > options.timeout;
963
988
  callback({
964
989
  didTimeout: didTimeout_1,
965
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
990
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
966
991
  });
967
992
  }
968
993
  };
@@ -983,7 +1008,7 @@ function tokenize (tokens) {
983
1008
  var reference = null;
984
1009
  for (var i = 0; i < tokens.length; i++) {
985
1010
  // Only optimize for string values
986
- if (typeof tokens[i] === "string" /* String */) {
1011
+ if (typeof tokens[i] === "string" /* Constant.String */) {
987
1012
  var token = tokens[i];
988
1013
  var index = lookup[token] || -1;
989
1014
  if (index >= 0) {
@@ -1025,10 +1050,10 @@ function encode$4 (type, timer, ts) {
1025
1050
  tokens = [eventTime, type];
1026
1051
  _a = type;
1027
1052
  switch (_a) {
1028
- case 8 /* Document */: return [3 /*break*/, 1];
1029
- case 7 /* Region */: return [3 /*break*/, 2];
1030
- case 5 /* Discover */: return [3 /*break*/, 3];
1031
- case 6 /* Mutation */: return [3 /*break*/, 3];
1053
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1054
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1055
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1056
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1032
1057
  }
1033
1058
  return [3 /*break*/, 10];
1034
1059
  case 1:
@@ -1041,7 +1066,7 @@ function encode$4 (type, timer, ts) {
1041
1066
  case 2:
1042
1067
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1043
1068
  r = _b[_i];
1044
- tokens = [r.time, 7 /* Region */];
1069
+ tokens = [r.time, 7 /* Event.Region */];
1045
1070
  tokens.push(r.data.id);
1046
1071
  tokens.push(r.data.interaction);
1047
1072
  tokens.push(r.data.visibility);
@@ -1052,7 +1077,7 @@ function encode$4 (type, timer, ts) {
1052
1077
  return [3 /*break*/, 10];
1053
1078
  case 3:
1054
1079
  // Check if we are operating within the context of the current page
1055
- if (state$8(timer) === 2 /* Stop */) {
1080
+ if (state$8(timer) === 2 /* Task.Stop */) {
1056
1081
  return [3 /*break*/, 10];
1057
1082
  }
1058
1083
  values = updates$2();
@@ -1063,13 +1088,13 @@ function encode$4 (type, timer, ts) {
1063
1088
  if (!(_c < values_1.length)) return [3 /*break*/, 8];
1064
1089
  value = values_1[_c];
1065
1090
  state = state$8(timer);
1066
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 6];
1091
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1067
1092
  return [4 /*yield*/, suspend$1(timer)];
1068
1093
  case 5:
1069
1094
  state = _e.sent();
1070
1095
  _e.label = 6;
1071
1096
  case 6:
1072
- if (state === 2 /* Stop */) {
1097
+ if (state === 2 /* Task.Stop */) {
1073
1098
  return [3 /*break*/, 8];
1074
1099
  }
1075
1100
  data = value.data;
@@ -1092,9 +1117,9 @@ function encode$4 (type, timer, ts) {
1092
1117
  if (value.previous && active) {
1093
1118
  tokens.push(value.previous);
1094
1119
  }
1095
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1120
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1096
1121
  if (box && box.length === 2) {
1097
- tokens.push("" + "#" /* Box */ + str$1(box[0]) + "." + str$1(box[1]));
1122
+ tokens.push("".concat("#" /* Constant.Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1098
1123
  }
1099
1124
  break;
1100
1125
  case "attributes":
@@ -1116,7 +1141,7 @@ function encode$4 (type, timer, ts) {
1116
1141
  _c++;
1117
1142
  return [3 /*break*/, 4];
1118
1143
  case 8:
1119
- if (type === 6 /* Mutation */) {
1144
+ if (type === 6 /* Event.Mutation */) {
1120
1145
  activity(eventTime);
1121
1146
  }
1122
1147
  queue(tokenize(tokens), !config$1.lean);
@@ -1129,13 +1154,13 @@ function encode$4 (type, timer, ts) {
1129
1154
  }
1130
1155
  function shouldMangle(value) {
1131
1156
  var privacy = value.metadata.privacy;
1132
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1157
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1133
1158
  }
1134
1159
  function size$1(value) {
1135
1160
  if (value.metadata.size !== null && value.metadata.size.length === 0) {
1136
1161
  var img = getNode(value.id);
1137
1162
  if (img) {
1138
- return [Math.floor(img.offsetWidth * 100 /* BoxPrecision */), Math.floor(img.offsetHeight * 100 /* BoxPrecision */)];
1163
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1139
1164
  }
1140
1165
  }
1141
1166
  return value.metadata.size;
@@ -1144,7 +1169,7 @@ function str$1(input) {
1144
1169
  return input.toString(36);
1145
1170
  }
1146
1171
  function attribute(key, value, privacy) {
1147
- return key + "=" + scrub(value, key, privacy);
1172
+ return "".concat(key, "=").concat(scrub(value, key, privacy));
1148
1173
  }
1149
1174
 
1150
1175
  var data$c;
@@ -1175,7 +1200,7 @@ function compute$7() {
1175
1200
  // Check that width or height has changed from before, and also that width & height are not null values
1176
1201
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1177
1202
  data$c = { width: width, height: height };
1178
- encode$4(8 /* Document */);
1203
+ encode$4(8 /* Event.Document */);
1179
1204
  }
1180
1205
  }
1181
1206
  function end() {
@@ -1204,7 +1229,7 @@ function start$u() {
1204
1229
  reset$h();
1205
1230
  }
1206
1231
  function observe$b(root) {
1207
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1232
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1208
1233
  }
1209
1234
  function handler$3(event, root, evt) {
1210
1235
  var frame = iframe(root);
@@ -1230,8 +1255,8 @@ function handler$3(event, root, evt) {
1230
1255
  x = Math.round(l.x + (l.w / 2));
1231
1256
  y = Math.round(l.y + (l.h / 2));
1232
1257
  }
1233
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1234
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1258
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1259
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1235
1260
  // Check for null values before processing this event
1236
1261
  if (x !== null && y !== null) {
1237
1262
  state$7.push({
@@ -1249,7 +1274,7 @@ function handler$3(event, root, evt) {
1249
1274
  text: text(t),
1250
1275
  link: a ? a.href : null,
1251
1276
  hash: null,
1252
- trust: evt.isTrusted ? 1 /* True */ : 0 /* False */
1277
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1253
1278
  }
1254
1279
  });
1255
1280
  schedule$1(encode$3.bind(this, event));
@@ -1264,7 +1289,7 @@ function text(element) {
1264
1289
  // Trim any spaces at the beginning or at the end of string
1265
1290
  // Also, replace multiple occurrence of space characters with a single white space
1266
1291
  // Finally, send only first few characters as specified by the Setting
1267
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1292
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1268
1293
  }
1269
1294
  }
1270
1295
  return output;
@@ -1273,10 +1298,10 @@ function reaction(element) {
1273
1298
  if (element.nodeType === Node.ELEMENT_NODE) {
1274
1299
  var tag = element.tagName.toLowerCase();
1275
1300
  if (UserInputTags.indexOf(tag) >= 0) {
1276
- return 0 /* False */;
1301
+ return 0 /* BooleanFlag.False */;
1277
1302
  }
1278
1303
  }
1279
- return 1 /* True */;
1304
+ return 1 /* BooleanFlag.True */;
1280
1305
  }
1281
1306
  function layout$1(element) {
1282
1307
  var box = null;
@@ -1300,14 +1325,14 @@ function layout$1(element) {
1300
1325
  return box;
1301
1326
  }
1302
1327
  function context(a) {
1303
- if (a && a.hasAttribute("target" /* Target */)) {
1304
- switch (a.getAttribute("target" /* Target */)) {
1305
- case "_blank" /* Blank */: return 1 /* Blank */;
1306
- case "_parent" /* Parent */: return 2 /* Parent */;
1307
- case "_top" /* Top */: return 3 /* Top */;
1328
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1329
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1330
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1331
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1332
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1308
1333
  }
1309
1334
  }
1310
- return 0 /* Self */;
1335
+ return 0 /* BrowsingContext.Self */;
1311
1336
  }
1312
1337
  function reset$h() {
1313
1338
  state$7 = [];
@@ -1321,13 +1346,13 @@ function start$t() {
1321
1346
  reset$g();
1322
1347
  }
1323
1348
  function observe$a(root) {
1324
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1325
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1326
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1349
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1350
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1351
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1327
1352
  }
1328
1353
  function recompute$7(action, evt) {
1329
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1330
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1354
+ state$6.push({ time: time(), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1355
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1331
1356
  }
1332
1357
  function reset$g() {
1333
1358
  state$6 = [];
@@ -1360,9 +1385,9 @@ function recompute$6(evt) {
1360
1385
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1361
1386
  state$5.pop();
1362
1387
  }
1363
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1388
+ state$5.push({ time: time(), event: 27 /* Event.Input */, data: data });
1364
1389
  clearTimeout(timeout$5);
1365
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1390
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, 27 /* Event.Input */);
1366
1391
  }
1367
1392
  }
1368
1393
  function process$6(event) {
@@ -1382,15 +1407,15 @@ function start$r() {
1382
1407
  reset$e();
1383
1408
  }
1384
1409
  function observe$8(root) {
1385
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1386
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1387
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1388
- bind(root, "mousewheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1389
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1390
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1391
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1392
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1393
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1410
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1411
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1412
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1413
+ bind(root, "wheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1414
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1415
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1416
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1417
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1418
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1394
1419
  }
1395
1420
  function mouse(event, root, evt) {
1396
1421
  var frame = iframe(root);
@@ -1429,9 +1454,9 @@ function touch(event, root, evt) {
1429
1454
  }
1430
1455
  function handler$2(current) {
1431
1456
  switch (current.event) {
1432
- case 12 /* MouseMove */:
1433
- case 15 /* MouseWheel */:
1434
- case 19 /* TouchMove */:
1457
+ case 12 /* Event.MouseMove */:
1458
+ case 15 /* Event.MouseWheel */:
1459
+ case 19 /* Event.TouchMove */:
1435
1460
  var length_1 = state$4.length;
1436
1461
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1437
1462
  if (last && similar$1(last, current)) {
@@ -1439,7 +1464,7 @@ function handler$2(current) {
1439
1464
  }
1440
1465
  state$4.push(current);
1441
1466
  clearTimeout(timeout$4);
1442
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1467
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1443
1468
  break;
1444
1469
  default:
1445
1470
  state$4.push(current);
@@ -1459,7 +1484,7 @@ function similar$1(last, current) {
1459
1484
  var distance = Math.sqrt(dx * dx + dy * dy);
1460
1485
  var gap = current.time - last.time;
1461
1486
  var match = current.data.target === last.data.target;
1462
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1487
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1463
1488
  }
1464
1489
  function stop$p() {
1465
1490
  clearTimeout(timeout$4);
@@ -1482,7 +1507,7 @@ function recompute$5() {
1482
1507
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1483
1508
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1484
1509
  };
1485
- encode$3(11 /* Resize */);
1510
+ encode$3(11 /* Event.Resize */);
1486
1511
  }
1487
1512
  function reset$d() {
1488
1513
  data$b = null;
@@ -1518,7 +1543,7 @@ function recompute$4(event) {
1518
1543
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1519
1544
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1520
1545
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1521
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1546
+ var current = { time: time(), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1522
1547
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1523
1548
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1524
1549
  return;
@@ -1530,7 +1555,7 @@ function recompute$4(event) {
1530
1555
  }
1531
1556
  state$3.push(current);
1532
1557
  clearTimeout(timeout$3);
1533
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1558
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1534
1559
  }
1535
1560
  function reset$c() {
1536
1561
  state$3 = [];
@@ -1541,7 +1566,7 @@ function process$4(event) {
1541
1566
  function similar(last, current) {
1542
1567
  var dx = last.data.x - current.data.x;
1543
1568
  var dy = last.data.y - current.data.y;
1544
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1569
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1545
1570
  }
1546
1571
  function stop$n() {
1547
1572
  clearTimeout(timeout$3);
@@ -1576,7 +1601,7 @@ function recompute$3(root) {
1576
1601
  var startNode = data$a.start ? data$a.start : null;
1577
1602
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1578
1603
  clearTimeout(timeout$2);
1579
- process$3(21 /* Selection */);
1604
+ process$3(21 /* Event.Selection */);
1580
1605
  }
1581
1606
  data$a = {
1582
1607
  start: current.anchorNode,
@@ -1586,7 +1611,7 @@ function recompute$3(root) {
1586
1611
  };
1587
1612
  previous = current;
1588
1613
  clearTimeout(timeout$2);
1589
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1614
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1590
1615
  }
1591
1616
  function process$3(event) {
1592
1617
  schedule$1(encode$3.bind(this, event));
@@ -1608,8 +1633,8 @@ function observe$5(root) {
1608
1633
  bind(root, "submit", recompute$2, true);
1609
1634
  }
1610
1635
  function recompute$2(evt) {
1611
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1612
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1636
+ state$2.push({ time: time(), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1637
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1613
1638
  }
1614
1639
  function reset$a() {
1615
1640
  state$2 = [];
@@ -1624,7 +1649,7 @@ function start$m() {
1624
1649
  }
1625
1650
  function recompute$1(evt) {
1626
1651
  data$9 = { name: evt.type };
1627
- encode$3(26 /* Unload */);
1652
+ encode$3(26 /* Event.Unload */);
1628
1653
  stop();
1629
1654
  }
1630
1655
  function reset$9() {
@@ -1641,7 +1666,7 @@ function start$l() {
1641
1666
  }
1642
1667
  function recompute() {
1643
1668
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1644
- encode$3(28 /* Visibility */);
1669
+ encode$3(28 /* Event.Visibility */);
1645
1670
  }
1646
1671
  function reset$8() {
1647
1672
  data$8 = null;
@@ -1703,51 +1728,51 @@ function ld(json) {
1703
1728
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1704
1729
  var key = _a[_i];
1705
1730
  var value = json[key];
1706
- if (key === "@type" /* Type */ && typeof value === "string") {
1731
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1707
1732
  value = value.toLowerCase();
1708
1733
  /* Normalizations */
1709
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1734
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1710
1735
  switch (value) {
1711
- case "article" /* Article */:
1712
- case "recipe" /* Recipe */:
1713
- log(5 /* SchemaType */, json[key]);
1714
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1715
- log(18 /* Headline */, json["headline" /* Headline */]);
1736
+ case "article" /* JsonLD.Article */:
1737
+ case "recipe" /* JsonLD.Recipe */:
1738
+ log(5 /* Dimension.SchemaType */, json[key]);
1739
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1740
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1716
1741
  break;
1717
- case "product" /* Product */:
1718
- log(5 /* SchemaType */, json[key]);
1719
- log(10 /* ProductName */, json["name" /* Name */]);
1720
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1721
- if (json["brand" /* Brand */]) {
1722
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1742
+ case "product" /* JsonLD.Product */:
1743
+ log(5 /* Dimension.SchemaType */, json[key]);
1744
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1745
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1746
+ if (json["brand" /* JsonLD.Brand */]) {
1747
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1723
1748
  }
1724
1749
  break;
1725
- case "aggregaterating" /* AggregateRating */:
1726
- if (json["ratingValue" /* RatingValue */]) {
1727
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1728
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1729
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1750
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1751
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1752
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1753
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1754
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1730
1755
  }
1731
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1732
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1756
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1757
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1733
1758
  break;
1734
- case "person" /* Author */:
1735
- log(8 /* AuthorName */, json["name" /* Name */]);
1759
+ case "person" /* JsonLD.Author */:
1760
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1736
1761
  break;
1737
- case "offer" /* Offer */:
1738
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1739
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1740
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1741
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1742
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1762
+ case "offer" /* JsonLD.Offer */:
1763
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1764
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1765
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1766
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1767
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1743
1768
  break;
1744
- case "brand" /* Brand */:
1745
- log(6 /* ProductBrand */, json["name" /* Name */]);
1769
+ case "brand" /* JsonLD.Brand */:
1770
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1746
1771
  break;
1747
1772
  }
1748
1773
  }
1749
1774
  // Continue parsing nested objects
1750
- if (value !== null && typeof (value) === "object" /* Object */) {
1775
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1751
1776
  ld(value);
1752
1777
  }
1753
1778
  }
@@ -1756,8 +1781,8 @@ function num$1(input, scale) {
1756
1781
  if (scale === void 0) { scale = 1; }
1757
1782
  if (input !== null) {
1758
1783
  switch (typeof input) {
1759
- case "number" /* Number */: return Math.round(input * scale);
1760
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1784
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1785
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1761
1786
  }
1762
1787
  }
1763
1788
  return null;
@@ -1768,11 +1793,11 @@ var newlineRegex = /[\r\n]+/g;
1768
1793
  function processNode (node, source) {
1769
1794
  var child = null;
1770
1795
  // Do not track this change if we are attempting to remove a node before discovering it
1771
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1796
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1772
1797
  return child;
1773
1798
  }
1774
1799
  // Special handling for text nodes that belong to style nodes
1775
- if (source !== 0 /* Discover */ &&
1800
+ if (source !== 0 /* Source.Discover */ &&
1776
1801
  node.nodeType === Node.TEXT_NODE &&
1777
1802
  node.parentElement &&
1778
1803
  node.parentElement.tagName === "STYLE") {
@@ -1785,10 +1810,10 @@ function processNode (node, source) {
1785
1810
  switch (node.nodeType) {
1786
1811
  case Node.DOCUMENT_TYPE_NODE:
1787
1812
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1788
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1813
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1789
1814
  var doctype = node;
1790
1815
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1791
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1816
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1792
1817
  dom[call](node, parent, docData, source);
1793
1818
  break;
1794
1819
  case Node.DOCUMENT_NODE:
@@ -1803,26 +1828,26 @@ function processNode (node, source) {
1803
1828
  if (shadowRoot.host) {
1804
1829
  parse$1(shadowRoot);
1805
1830
  var type = typeof (shadowRoot.constructor);
1806
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1831
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1807
1832
  observe$3(shadowRoot);
1808
1833
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1809
1834
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1810
1835
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1811
1836
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1812
- var style = "" /* Empty */;
1837
+ var style = "" /* Constant.Empty */;
1813
1838
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1814
1839
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1815
1840
  var styleSheet = adoptedStyleSheets_1[_i];
1816
1841
  style += getCssRules(styleSheet);
1817
1842
  }
1818
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1843
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1819
1844
  dom[call](node, shadowRoot.host, fragementData, source);
1820
1845
  }
1821
1846
  else {
1822
1847
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1823
1848
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1824
1849
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1825
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1850
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1826
1851
  }
1827
1852
  }
1828
1853
  break;
@@ -1835,7 +1860,7 @@ function processNode (node, source) {
1835
1860
  // The only exception is when we receive a mutation to remove the text node, in that case
1836
1861
  // parent will be null, but we can still process the node by checking it's an update call.
1837
1862
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1838
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1863
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1839
1864
  dom[call](node, parent, textData, source);
1840
1865
  }
1841
1866
  break;
@@ -1847,20 +1872,20 @@ function processNode (node, source) {
1847
1872
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1848
1873
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1849
1874
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1850
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1851
- tag = "svg:" /* SvgPrefix */ + tag;
1875
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1876
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1852
1877
  }
1853
1878
  switch (tag) {
1854
1879
  case "HTML":
1855
1880
  parent = insideFrame && parent ? iframe(parent) : null;
1856
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1881
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1857
1882
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1858
1883
  dom[call](node, parent, htmlData, source);
1859
1884
  break;
1860
1885
  case "SCRIPT":
1861
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1886
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1862
1887
  try {
1863
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1888
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1864
1889
  }
1865
1890
  catch ( /* do nothing */_a) { /* do nothing */ }
1866
1891
  }
@@ -1868,20 +1893,20 @@ function processNode (node, source) {
1868
1893
  case "NOSCRIPT":
1869
1894
  break;
1870
1895
  case "META":
1871
- var key = ("property" /* Property */ in attributes ?
1872
- "property" /* Property */ :
1873
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1874
- if (key && "content" /* Content */ in attributes) {
1875
- var content = attributes["content" /* Content */];
1896
+ var key = ("property" /* Constant.Property */ in attributes ?
1897
+ "property" /* Constant.Property */ :
1898
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1899
+ if (key && "content" /* Constant.Content */ in attributes) {
1900
+ var content = attributes["content" /* Constant.Content */];
1876
1901
  switch (attributes[key]) {
1877
- case "og:title" /* ogTitle */:
1878
- log(20 /* MetaTitle */, content);
1902
+ case "og:title" /* Constant.ogTitle */:
1903
+ log(20 /* Dimension.MetaTitle */, content);
1879
1904
  break;
1880
- case "og:type" /* ogType */:
1881
- log(19 /* MetaType */, content);
1905
+ case "og:type" /* Constant.ogType */:
1906
+ log(19 /* Dimension.MetaType */, content);
1882
1907
  break;
1883
- case "generator" /* Generator */:
1884
- log(21 /* Generator */, content);
1908
+ case "generator" /* Constant.Generator */:
1909
+ log(21 /* Dimension.Generator */, content);
1885
1910
  break;
1886
1911
  }
1887
1912
  }
@@ -1889,7 +1914,7 @@ function processNode (node, source) {
1889
1914
  case "HEAD":
1890
1915
  var head = { tag: tag, attributes: attributes };
1891
1916
  if (location) {
1892
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1917
+ head.attributes["*B" /* Constant.Base */] = location.protocol + "//" + location.hostname;
1893
1918
  }
1894
1919
  dom[call](node, parent, head, source);
1895
1920
  break;
@@ -1902,7 +1927,7 @@ function processNode (node, source) {
1902
1927
  var frameData = { tag: tag, attributes: attributes };
1903
1928
  if (sameorigin(iframe$1)) {
1904
1929
  monitor(iframe$1);
1905
- frameData.attributes["*O" /* SameOrigin */] = "true";
1930
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1906
1931
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1907
1932
  child = iframe$1.contentDocument;
1908
1933
  }
@@ -1931,7 +1956,7 @@ function observe$3(root) {
1931
1956
  function getStyleValue(style) {
1932
1957
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
1933
1958
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
1934
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
1959
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
1935
1960
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
1936
1961
  if (value.length === 0 || dataset > 0) {
1937
1962
  value = getCssRules(style.sheet);
@@ -1939,14 +1964,14 @@ function getStyleValue(style) {
1939
1964
  return value;
1940
1965
  }
1941
1966
  function getCssRules(sheet) {
1942
- var value = "" /* Empty */;
1967
+ var value = "" /* Constant.Empty */;
1943
1968
  var cssRules = null;
1944
1969
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
1945
1970
  try {
1946
1971
  cssRules = sheet ? sheet.cssRules : [];
1947
1972
  }
1948
1973
  catch (e) {
1949
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
1974
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
1950
1975
  if (e && e.name !== "SecurityError") {
1951
1976
  throw e;
1952
1977
  }
@@ -1970,8 +1995,8 @@ function getAttributes(element) {
1970
1995
  }
1971
1996
  }
1972
1997
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
1973
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
1974
- output["value" /* Value */] = element.value;
1998
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
1999
+ output["value" /* Constant.Value */] = element.value;
1975
2000
  }
1976
2001
  return output;
1977
2002
  }
@@ -1993,13 +2018,13 @@ function traverse (root, timer, source) {
1993
2018
  next = next.nextSibling;
1994
2019
  }
1995
2020
  state = state$8(timer);
1996
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
2021
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
1997
2022
  return [4 /*yield*/, suspend$1(timer)];
1998
2023
  case 2:
1999
2024
  state = _a.sent();
2000
2025
  _a.label = 3;
2001
2026
  case 3:
2002
- if (state === 2 /* Stop */) {
2027
+ if (state === 2 /* Task.Stop */) {
2003
2028
  return [3 /*break*/, 4];
2004
2029
  }
2005
2030
  subnode = processNode(node, source);
@@ -2076,7 +2101,7 @@ function observe$2(node) {
2076
2101
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2077
2102
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2078
2103
  try {
2079
- var m = api("MutationObserver" /* MutationObserver */);
2104
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2080
2105
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2081
2106
  if (observer) {
2082
2107
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2084,7 +2109,7 @@ function observe$2(node) {
2084
2109
  }
2085
2110
  }
2086
2111
  catch (e) {
2087
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2112
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2088
2113
  }
2089
2114
  }
2090
2115
  function monitor(frame) {
@@ -2092,7 +2117,7 @@ function monitor(frame) {
2092
2117
  // This includes cases where iframe location is updated without explicitly updating src attribute
2093
2118
  // E.g. iframe.contentWindow.location.href = "new-location";
2094
2119
  if (has(frame) === false) {
2095
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2120
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2096
2121
  }
2097
2122
  }
2098
2123
  function stop$h() {
@@ -2110,14 +2135,14 @@ function stop$h() {
2110
2135
  timeout$1 = null;
2111
2136
  }
2112
2137
  function active$2() {
2113
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2138
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2114
2139
  }
2115
2140
  function handle$1(m) {
2116
2141
  // Queue up mutation records for asynchronous processing
2117
2142
  var now = time();
2118
- track$6(6 /* Mutation */, now);
2143
+ track$6(6 /* Event.Mutation */, now);
2119
2144
  mutations.push({ time: now, mutations: m });
2120
- schedule$1(process$2, 1 /* High */).then(function () {
2145
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2121
2146
  setTimeout(compute$7);
2122
2147
  measure(compute$6)();
2123
2148
  });
@@ -2128,7 +2153,7 @@ function process$2() {
2128
2153
  return __generator(this, function (_b) {
2129
2154
  switch (_b.label) {
2130
2155
  case 0:
2131
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2156
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2132
2157
  start$w(timer);
2133
2158
  _b.label = 1;
2134
2159
  case 1:
@@ -2140,13 +2165,13 @@ function process$2() {
2140
2165
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2141
2166
  mutation = _a[_i];
2142
2167
  state = state$8(timer);
2143
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2168
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2144
2169
  return [4 /*yield*/, suspend$1(timer)];
2145
2170
  case 3:
2146
2171
  state = _b.sent();
2147
2172
  _b.label = 4;
2148
2173
  case 4:
2149
- if (state === 2 /* Stop */) {
2174
+ if (state === 2 /* Task.Stop */) {
2150
2175
  return [3 /*break*/, 6];
2151
2176
  }
2152
2177
  target = mutation.target;
@@ -2158,17 +2183,17 @@ function process$2() {
2158
2183
  parse$1(target);
2159
2184
  }
2160
2185
  switch (type) {
2161
- case "attributes" /* Attributes */:
2162
- processNode(target, 3 /* Attributes */);
2186
+ case "attributes" /* Constant.Attributes */:
2187
+ processNode(target, 3 /* Source.Attributes */);
2163
2188
  break;
2164
- case "characterData" /* CharacterData */:
2165
- processNode(target, 4 /* CharacterData */);
2189
+ case "characterData" /* Constant.CharacterData */:
2190
+ processNode(target, 4 /* Source.CharacterData */);
2166
2191
  break;
2167
- case "childList" /* ChildList */:
2168
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2169
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2192
+ case "childList" /* Constant.ChildList */:
2193
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2194
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2170
2195
  break;
2171
- case "suspend" /* Suspend */:
2196
+ case "suspend" /* Constant.Suspend */:
2172
2197
  value = get(target);
2173
2198
  if (value) {
2174
2199
  value.metadata.suspend = true;
@@ -2179,7 +2204,7 @@ function process$2() {
2179
2204
  case 5:
2180
2205
  _i++;
2181
2206
  return [3 /*break*/, 2];
2182
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2207
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2183
2208
  case 7:
2184
2209
  _b.sent();
2185
2210
  return [3 /*break*/, 1];
@@ -2193,11 +2218,11 @@ function process$2() {
2193
2218
  function track$5(m, timer) {
2194
2219
  var value = m.target ? get(m.target.parentNode) : null;
2195
2220
  // Check if the parent is already discovered and that the parent is not the document root
2196
- if (value && value.data.tag !== "HTML" /* HTML */) {
2221
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2197
2222
  var inactive = time() > activePeriod;
2198
2223
  var target = get(m.target);
2199
2224
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2200
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2225
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2201
2226
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2202
2227
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2203
2228
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2206,20 +2231,20 @@ function track$5(m, timer) {
2206
2231
  history$4[key] = key in history$4 ? history$4[key] : [0];
2207
2232
  var h = history$4[key];
2208
2233
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2209
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2210
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2234
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2235
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2211
2236
  }
2212
2237
  // Update the counter
2213
2238
  h[0] = inactive ? h[0] + 1 : 1;
2214
2239
  // Return updated mutation type based on if we have already hit the threshold or not
2215
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2240
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2216
2241
  // Store a reference to removedNodes so we can process them later
2217
2242
  // when we resume mutations again on user interactions
2218
2243
  h[1] = m.removedNodes;
2219
- return "suspend" /* Suspend */;
2244
+ return "suspend" /* Constant.Suspend */;
2220
2245
  }
2221
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2222
- return "" /* Empty */;
2246
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2247
+ return "" /* Constant.Empty */;
2223
2248
  }
2224
2249
  }
2225
2250
  return m.type;
@@ -2242,18 +2267,18 @@ function processNodeList(list, source, timer) {
2242
2267
  _a.label = 1;
2243
2268
  case 1:
2244
2269
  if (!(i < length)) return [3 /*break*/, 6];
2245
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2270
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2246
2271
  traverse(list[i], timer, source);
2247
2272
  return [3 /*break*/, 5];
2248
2273
  case 2:
2249
2274
  state = state$8(timer);
2250
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2275
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2251
2276
  return [4 /*yield*/, suspend$1(timer)];
2252
2277
  case 3:
2253
2278
  state = _a.sent();
2254
2279
  _a.label = 4;
2255
2280
  case 4:
2256
- if (state === 2 /* Stop */) {
2281
+ if (state === 2 /* Task.Stop */) {
2257
2282
  return [3 /*break*/, 6];
2258
2283
  }
2259
2284
  processNode(list[i], source);
@@ -2278,7 +2303,7 @@ function schedule(node, fragment) {
2278
2303
  if (timeout$1) {
2279
2304
  clearTimeout(timeout$1);
2280
2305
  }
2281
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2306
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2282
2307
  return node;
2283
2308
  }
2284
2309
  function trigger$1(fragment) {
@@ -2291,7 +2316,7 @@ function trigger$1(fragment) {
2291
2316
  if (shadowRoot && has(node)) {
2292
2317
  continue;
2293
2318
  }
2294
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2319
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2295
2320
  }
2296
2321
  }
2297
2322
  queue$2 = [];
@@ -2319,6 +2344,7 @@ var override = [];
2319
2344
  var unmask = [];
2320
2345
  var updatedFragments = {};
2321
2346
  var maskText = [];
2347
+ var maskInput = [];
2322
2348
  var maskDisable = [];
2323
2349
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2324
2350
  var idMap = null; // Maps node => id.
@@ -2340,8 +2366,9 @@ function reset$7() {
2340
2366
  hashMap = {};
2341
2367
  override = [];
2342
2368
  unmask = [];
2343
- maskText = "password,secret,pass,social,ssn,name,code,dob,cell,mob,contact,hidden,account,cvv,ccv,email,tel,phone,address,addr,card,zip" /* Text */.split("," /* Comma */);
2344
- maskDisable = "radio,checkbox,range,button,reset,submit" /* Disable */.split("," /* Comma */);
2369
+ maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
2370
+ maskInput = "password,secret,pass,social,ssn,name,code,dob,cell,mob,contact,hidden,account,cvv,ccv,email,tel,phone,address,addr,card,zip" /* Mask.Input */.split("," /* Constant.Comma */);
2371
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2345
2372
  idMap = new WeakMap();
2346
2373
  iframeMap = new WeakMap();
2347
2374
  privacyMap = new WeakMap();
@@ -2356,19 +2383,19 @@ function parse$1(root, init) {
2356
2383
  try {
2357
2384
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2358
2385
  if (init) {
2359
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2386
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2360
2387
  }
2361
2388
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2362
2389
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2363
2390
  if ("querySelectorAll" in root) {
2364
- config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "" + x[0]); }); }); // Regions
2365
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2391
+ config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
2392
+ config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
2366
2393
  config$1.fraud.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Check
2367
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2394
+ unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
2368
2395
  }
2369
2396
  }
2370
2397
  catch (e) {
2371
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2398
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2372
2399
  }
2373
2400
  }
2374
2401
  function getId(node, autogen) {
@@ -2391,17 +2418,18 @@ function add(node, parent, data, source) {
2391
2418
  var regionId = exists(node) ? id : null;
2392
2419
  var fragmentId = null;
2393
2420
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2394
- var privacyId = config$1.content ? 1 /* Sensitive */ : 2 /* Text */;
2421
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 2 /* Privacy.Text */;
2395
2422
  if (parentId >= 0 && values[parentId]) {
2396
2423
  parentValue = values[parentId];
2397
2424
  parentValue.children.push(id);
2398
2425
  regionId = regionId === null ? parentValue.region : regionId;
2399
2426
  fragmentId = parentValue.fragment;
2400
2427
  fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
2428
+ privacyId = parentValue.metadata.privacy;
2401
2429
  }
2402
2430
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2403
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2404
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2431
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2432
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2405
2433
  regionId = id;
2406
2434
  }
2407
2435
  nodes[id] = node;
@@ -2479,7 +2507,7 @@ function update$1(node, parent, data, source) {
2479
2507
  }
2480
2508
  function sameorigin(node) {
2481
2509
  var output = false;
2482
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2510
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2483
2511
  var frame = node;
2484
2512
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2485
2513
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2506,11 +2534,11 @@ function privacy(node, value, parent) {
2506
2534
  var attributes = data.attributes || {};
2507
2535
  var tag = data.tag.toUpperCase();
2508
2536
  switch (true) {
2509
- case "data-clarity-mask" /* MaskData */ in attributes:
2510
- metadata.privacy = 3 /* TextImage */;
2537
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2538
+ metadata.privacy = 3 /* Privacy.TextImage */;
2511
2539
  break;
2512
- case "data-clarity-unmask" /* UnmaskData */ in attributes:
2513
- metadata.privacy = 0 /* None */;
2540
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2541
+ metadata.privacy = 0 /* Privacy.None */;
2514
2542
  break;
2515
2543
  case privacyMap.has(node):
2516
2544
  // If this node was explicitly configured to contain sensitive content, honor that privacy setting
@@ -2518,40 +2546,39 @@ function privacy(node, value, parent) {
2518
2546
  break;
2519
2547
  case fraudMap.has(node):
2520
2548
  // If this node was explicitly configured to be evaluated for fraud, then also mask content
2521
- metadata.privacy = 2 /* Text */;
2549
+ metadata.privacy = 2 /* Privacy.Text */;
2522
2550
  break;
2523
- case tag === "*T" /* TextTag */:
2551
+ case tag === "*T" /* Constant.TextTag */:
2524
2552
  // If it's a text node belonging to a STYLE or TITLE tag or one of SCRUB_EXCEPTIONS, then capture content
2525
- var pTag = parent && parent.data ? parent.data.tag : "" /* Empty */;
2526
- var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Stable */] : "" /* Empty */;
2527
- metadata.privacy = pTag === "STYLE" /* StyleTag */ || pTag === "TITLE" /* TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* None */ : current;
2553
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2554
+ var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Selector.Stable */] : "" /* Constant.Empty */;
2555
+ metadata.privacy = pTag === "STYLE" /* Constant.StyleTag */ || pTag === "TITLE" /* Constant.TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2528
2556
  break;
2529
- case "type" /* Type */ in attributes:
2557
+ case "type" /* Constant.Type */ in attributes:
2530
2558
  // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2531
- metadata.privacy = inspect(attributes["type" /* Type */], metadata);
2559
+ metadata.privacy = inspect(attributes["type" /* Constant.Type */], maskInput, metadata);
2532
2560
  break;
2533
- case tag === "INPUT" /* InputTag */ && current === 0 /* None */:
2561
+ case tag === "INPUT" /* Constant.InputTag */ && current === 0 /* Privacy.None */:
2534
2562
  // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2535
- var field_1 = "" /* Empty */;
2563
+ var field_1 = "" /* Constant.Empty */;
2536
2564
  Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2537
- metadata.privacy = inspect(field_1, metadata);
2565
+ metadata.privacy = inspect(field_1, maskInput, metadata);
2538
2566
  break;
2539
- case current === 1 /* Sensitive */ && tag === "INPUT" /* InputTag */:
2567
+ case current === 1 /* Privacy.Sensitive */ && tag === "INPUT" /* Constant.InputTag */:
2568
+ // Look through class names to aggressively mask content
2569
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2540
2570
  // If it's a button or an input option, make an exception to disable masking
2541
- metadata.privacy = maskDisable.indexOf(attributes["type" /* Type */]) >= 0 ? 0 /* None */ : current;
2571
+ metadata.privacy = maskDisable.indexOf(attributes["type" /* Constant.Type */]) >= 0 ? 0 /* Privacy.None */ : current;
2542
2572
  break;
2543
- case current === 1 /* Sensitive */:
2573
+ case current === 1 /* Privacy.Sensitive */:
2544
2574
  // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2545
- metadata.privacy = inspect(attributes["class" /* Class */], metadata);
2546
- break;
2547
- default:
2548
- metadata.privacy = parent ? parent.metadata.privacy : metadata.privacy;
2575
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2549
2576
  break;
2550
2577
  }
2551
2578
  }
2552
- function inspect(input, metadata) {
2553
- if (input && maskText.some(function (x) { return input.indexOf(x) >= 0; })) {
2554
- return 2 /* Text */;
2579
+ function inspect(input, lookup, metadata) {
2580
+ if (input && lookup.some(function (x) { return input.indexOf(x) >= 0; })) {
2581
+ return 2 /* Privacy.Text */;
2555
2582
  }
2556
2583
  return metadata.privacy;
2557
2584
  }
@@ -2643,7 +2670,7 @@ function remove(id, source) {
2643
2670
  }
2644
2671
  function size(value) {
2645
2672
  // If this element is a image node, and is masked, then track box model for the current element
2646
- if (value.data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2673
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2647
2674
  value.metadata.size = [];
2648
2675
  }
2649
2676
  }
@@ -2678,7 +2705,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2678
2705
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2679
2706
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2680
2707
  var uIndex = updateMap.indexOf(id);
2681
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2708
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2682
2709
  updateMap.splice(uIndex, 1);
2683
2710
  updateMap.push(id);
2684
2711
  }
@@ -2724,15 +2751,15 @@ function exists(node) {
2724
2751
  }
2725
2752
  function track$3(id, event) {
2726
2753
  var node = getNode(id);
2727
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2754
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2728
2755
  // Determine the interaction state based on incoming event
2729
- var interaction = 16 /* None */;
2756
+ var interaction = 16 /* InteractionState.None */;
2730
2757
  switch (event) {
2731
- case 9 /* Click */:
2732
- interaction = 20 /* Clicked */;
2758
+ case 9 /* Event.Click */:
2759
+ interaction = 20 /* InteractionState.Clicked */;
2733
2760
  break;
2734
- case 27 /* Input */:
2735
- interaction = 30 /* Input */;
2761
+ case 27 /* Event.Input */:
2762
+ interaction = 30 /* InteractionState.Input */;
2736
2763
  break;
2737
2764
  }
2738
2765
  // Process updates to this region, if applicable
@@ -2760,7 +2787,7 @@ function compute$6() {
2760
2787
  queue$1 = q;
2761
2788
  // Schedule encode only when we have at least one valid data entry
2762
2789
  if (state$1.length > 0) {
2763
- encode$4(7 /* Region */);
2790
+ encode$4(7 /* Event.Region */);
2764
2791
  }
2765
2792
  }
2766
2793
  function handler$1(entries) {
@@ -2776,27 +2803,27 @@ function handler$1(entries) {
2776
2803
  // Also, if these regions ever become non-zero width or height (through AJAX, user action or orientation change) - we will automatically start monitoring them from that point onwards
2777
2804
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2778
2805
  var id = target ? getId(target) : null;
2779
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2806
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2780
2807
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2781
2808
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2782
2809
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2783
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2810
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2784
2811
  // If an element is either visible or was visible and has been scrolled to the end
2785
2812
  // i.e. Scrolled to end is determined by if the starting position of the element + the window height is more than the total element height.
2786
2813
  // starting position is relative to the viewport - so Intersection observer returns a negative value for rect.top to indicate that the element top is above the viewport
2787
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2814
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2788
2815
  // Process updates to this region, if applicable
2789
2816
  process$1(target, data, data.interaction, (scrolledToEnd ?
2790
- 13 /* ScrolledToEnd */ :
2791
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2817
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2818
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2792
2819
  // Stop observing this element now that we have already received scrolled signal
2793
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2820
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2794
2821
  observer$1.unobserve(target);
2795
2822
  }
2796
2823
  }
2797
2824
  }
2798
2825
  if (state$1.length > 0) {
2799
- encode$4(7 /* Region */);
2826
+ encode$4(7 /* Event.Region */);
2800
2827
  }
2801
2828
  }
2802
2829
  function process$1(n, d, s, v) {
@@ -2855,7 +2882,7 @@ function link(node) {
2855
2882
  function metadata$2(node, event, text) {
2856
2883
  if (text === void 0) { text = null; }
2857
2884
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2858
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2885
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2859
2886
  if (node) {
2860
2887
  var value = get(node);
2861
2888
  if (value !== null) {
@@ -2881,15 +2908,15 @@ function encode$3 (type) {
2881
2908
  t = time();
2882
2909
  tokens = [t, type];
2883
2910
  switch (type) {
2884
- case 13 /* MouseDown */:
2885
- case 14 /* MouseUp */:
2886
- case 12 /* MouseMove */:
2887
- case 15 /* MouseWheel */:
2888
- case 16 /* DoubleClick */:
2889
- case 17 /* TouchStart */:
2890
- case 18 /* TouchEnd */:
2891
- case 19 /* TouchMove */:
2892
- case 20 /* TouchCancel */:
2911
+ case 13 /* Event.MouseDown */:
2912
+ case 14 /* Event.MouseUp */:
2913
+ case 12 /* Event.MouseMove */:
2914
+ case 15 /* Event.MouseWheel */:
2915
+ case 16 /* Event.DoubleClick */:
2916
+ case 17 /* Event.TouchStart */:
2917
+ case 18 /* Event.TouchEnd */:
2918
+ case 19 /* Event.TouchMove */:
2919
+ case 20 /* Event.TouchCancel */:
2893
2920
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2894
2921
  entry = _a[_i];
2895
2922
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2904,12 +2931,12 @@ function encode$3 (type) {
2904
2931
  }
2905
2932
  reset$e();
2906
2933
  break;
2907
- case 9 /* Click */:
2934
+ case 9 /* Event.Click */:
2908
2935
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2909
2936
  entry = _c[_b];
2910
2937
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2911
2938
  tokens = [entry.time, entry.event];
2912
- cHash = cTarget.hash.join("." /* Dot */);
2939
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
2913
2940
  tokens.push(cTarget.id);
2914
2941
  tokens.push(entry.data.x);
2915
2942
  tokens.push(entry.data.y);
@@ -2927,7 +2954,7 @@ function encode$3 (type) {
2927
2954
  }
2928
2955
  reset$h();
2929
2956
  break;
2930
- case 38 /* Clipboard */:
2957
+ case 38 /* Event.Clipboard */:
2931
2958
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
2932
2959
  entry = _e[_d];
2933
2960
  tokens = [entry.time, entry.event];
@@ -2940,7 +2967,7 @@ function encode$3 (type) {
2940
2967
  }
2941
2968
  reset$g();
2942
2969
  break;
2943
- case 11 /* Resize */:
2970
+ case 11 /* Event.Resize */:
2944
2971
  r = data$b;
2945
2972
  tokens.push(r.width);
2946
2973
  tokens.push(r.height);
@@ -2948,13 +2975,13 @@ function encode$3 (type) {
2948
2975
  reset$d();
2949
2976
  queue(tokens);
2950
2977
  break;
2951
- case 26 /* Unload */:
2978
+ case 26 /* Event.Unload */:
2952
2979
  u = data$9;
2953
2980
  tokens.push(u.name);
2954
2981
  reset$9();
2955
2982
  queue(tokens);
2956
2983
  break;
2957
- case 27 /* Input */:
2984
+ case 27 /* Event.Input */:
2958
2985
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
2959
2986
  entry = _g[_f];
2960
2987
  iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
@@ -2965,7 +2992,7 @@ function encode$3 (type) {
2965
2992
  }
2966
2993
  reset$f();
2967
2994
  break;
2968
- case 21 /* Selection */:
2995
+ case 21 /* Event.Selection */:
2969
2996
  s = data$a;
2970
2997
  if (s) {
2971
2998
  startTarget = metadata$2(s.start, type);
@@ -2978,7 +3005,7 @@ function encode$3 (type) {
2978
3005
  queue(tokens);
2979
3006
  }
2980
3007
  break;
2981
- case 10 /* Scroll */:
3008
+ case 10 /* Event.Scroll */:
2982
3009
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
2983
3010
  entry = _j[_h];
2984
3011
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -2993,7 +3020,7 @@ function encode$3 (type) {
2993
3020
  }
2994
3021
  reset$c();
2995
3022
  break;
2996
- case 39 /* Submit */:
3023
+ case 39 /* Event.Submit */:
2997
3024
  for (_k = 0, _l = state$2; _k < _l.length; _k++) {
2998
3025
  entry = _l[_k];
2999
3026
  tokens = [entry.time, entry.event];
@@ -3005,7 +3032,7 @@ function encode$3 (type) {
3005
3032
  }
3006
3033
  reset$a();
3007
3034
  break;
3008
- case 22 /* Timeline */:
3035
+ case 22 /* Event.Timeline */:
3009
3036
  for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3010
3037
  entry = _o[_m];
3011
3038
  tokens = [entry.time, entry.event];
@@ -3019,7 +3046,7 @@ function encode$3 (type) {
3019
3046
  }
3020
3047
  reset$5();
3021
3048
  break;
3022
- case 28 /* Visibility */:
3049
+ case 28 /* Event.Visibility */:
3023
3050
  v = data$8;
3024
3051
  tokens.push(v.visible);
3025
3052
  queue(tokens);
@@ -3042,11 +3069,11 @@ function reset$5() {
3042
3069
  updates$1 = [];
3043
3070
  }
3044
3071
  function track$2(time, event, hash, x, y, reaction, context) {
3045
- if (reaction === void 0) { reaction = 1 /* True */; }
3046
- if (context === void 0) { context = 0 /* Self */; }
3072
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3073
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3047
3074
  state.push({
3048
3075
  time: time,
3049
- event: 22 /* Timeline */,
3076
+ event: 22 /* Event.Timeline */,
3050
3077
  data: {
3051
3078
  type: event,
3052
3079
  hash: hash,
@@ -3065,7 +3092,7 @@ function compute$5() {
3065
3092
  var temp = [];
3066
3093
  updates$1 = [];
3067
3094
  var max = data$1.start + data$1.duration;
3068
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3095
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3069
3096
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3070
3097
  var s = state_1[_i];
3071
3098
  if (s.time >= min) {
@@ -3076,7 +3103,7 @@ function compute$5() {
3076
3103
  }
3077
3104
  }
3078
3105
  state = temp; // Drop events less than the min time
3079
- encode$3(22 /* Timeline */);
3106
+ encode$3(22 /* Event.Timeline */);
3080
3107
  }
3081
3108
  function stop$e() {
3082
3109
  state = [];
@@ -3109,10 +3136,10 @@ function queue(tokens, transmit) {
3109
3136
  var type = tokens.length > 1 ? tokens[1] : null;
3110
3137
  var event_1 = JSON.stringify(tokens);
3111
3138
  switch (type) {
3112
- case 5 /* Discover */:
3139
+ case 5 /* Event.Discover */:
3113
3140
  discoverBytes += event_1.length;
3114
- case 37 /* Box */:
3115
- case 6 /* Mutation */:
3141
+ case 37 /* Event.Box */:
3142
+ case 6 /* Event.Mutation */:
3116
3143
  playbackBytes += event_1.length;
3117
3144
  playback.push(event_1);
3118
3145
  break;
@@ -3121,7 +3148,7 @@ function queue(tokens, transmit) {
3121
3148
  break;
3122
3149
  }
3123
3150
  // Increment event count metric
3124
- count$1(25 /* EventCount */);
3151
+ count$1(25 /* Metric.EventCount */);
3125
3152
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3126
3153
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3127
3154
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3134,7 +3161,7 @@ function queue(tokens, transmit) {
3134
3161
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3135
3162
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3136
3163
  if (transmit && timeout === null) {
3137
- if (type !== 25 /* Ping */) {
3164
+ if (type !== 25 /* Event.Ping */) {
3138
3165
  reset$m();
3139
3166
  }
3140
3167
  timeout = setTimeout(upload, gap);
@@ -3163,9 +3190,9 @@ function upload(final) {
3163
3190
  switch (_b.label) {
3164
3191
  case 0:
3165
3192
  timeout = null;
3166
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3193
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3167
3194
  if (sendPlaybackBytes) {
3168
- max(1 /* Playback */, 1 /* True */);
3195
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3169
3196
  }
3170
3197
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3171
3198
  // Otherwise you run a risk of infinite loop.
@@ -3174,8 +3201,8 @@ function upload(final) {
3174
3201
  compute$8();
3175
3202
  last = final === true;
3176
3203
  e = JSON.stringify(envelope(last));
3177
- a = "[" + analysis.join() + "]";
3178
- p = sendPlaybackBytes ? "[" + playback.join() + "]" : "" /* Empty */;
3204
+ a = "[".concat(analysis.join(), "]");
3205
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3179
3206
  encoded = { e: e, a: a, p: p };
3180
3207
  payload = stringify(encoded);
3181
3208
  if (!last) return [3 /*break*/, 1];
@@ -3187,7 +3214,7 @@ function upload(final) {
3187
3214
  _b.label = 3;
3188
3215
  case 3:
3189
3216
  zipped = _a;
3190
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3217
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3191
3218
  send(payload, zipped, data$1.sequence, last);
3192
3219
  // Clear out events now that payload has been dispatched
3193
3220
  analysis = [];
@@ -3202,12 +3229,12 @@ function upload(final) {
3202
3229
  });
3203
3230
  }
3204
3231
  function stringify(encoded) {
3205
- return encoded.p.length > 0 ? "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + ",\"p\":" + encoded.p + "}" : "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + "}";
3232
+ return encoded.p.length > 0 ? "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, ",\"p\":").concat(encoded.p, "}") : "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, "}");
3206
3233
  }
3207
3234
  function send(payload, zipped, sequence, beacon) {
3208
3235
  if (beacon === void 0) { beacon = false; }
3209
3236
  // Upload data if a valid URL is defined in the config
3210
- if (typeof config$1.upload === "string" /* String */) {
3237
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3211
3238
  var url = config$1.upload;
3212
3239
  var dispatched = false;
3213
3240
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3246,7 +3273,7 @@ function send(payload, zipped, sequence, beacon) {
3246
3273
  xhr_1.withCredentials = true;
3247
3274
  if (zipped) {
3248
3275
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3249
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3276
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3250
3277
  xhr_1.send(zipped);
3251
3278
  }
3252
3279
  else {
@@ -3263,13 +3290,13 @@ function send(payload, zipped, sequence, beacon) {
3263
3290
  }
3264
3291
  function check$3(xhr, sequence) {
3265
3292
  var transitData = transit[sequence];
3266
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3293
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3267
3294
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3268
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3295
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3269
3296
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3270
3297
  if (xhr.status >= 400 && xhr.status < 500) {
3271
3298
  // In case of a 4XX response from the server, we bail out instead of trying again
3272
- trigger(6 /* Server */);
3299
+ trigger(6 /* Check.Server */);
3273
3300
  }
3274
3301
  else {
3275
3302
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3290,7 +3317,7 @@ function check$3(xhr, sequence) {
3290
3317
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3291
3318
  // Send back an event only if we were not successful in our first attempt
3292
3319
  if (transitData.attempts > 1) {
3293
- encode$1(2 /* Upload */);
3320
+ encode$1(2 /* Event.Upload */);
3294
3321
  }
3295
3322
  // Handle response if it was a 200 response with a valid body
3296
3323
  if (xhr.status === 200 && xhr.responseText) {
@@ -3301,7 +3328,7 @@ function check$3(xhr, sequence) {
3301
3328
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3302
3329
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3303
3330
  send(transitData.data, null, sequence, true);
3304
- trigger(3 /* Retry */);
3331
+ trigger(3 /* Check.Retry */);
3305
3332
  }
3306
3333
  // Signal that this request completed successfully
3307
3334
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3321,19 +3348,19 @@ function done(sequence) {
3321
3348
  function delay() {
3322
3349
  // Progressively increase delay as we continue to send more payloads from the client to the server
3323
3350
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3324
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3325
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3351
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3352
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3326
3353
  }
3327
3354
  function response(payload) {
3328
- var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Empty */;
3355
+ var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Constant.Empty */;
3329
3356
  switch (key) {
3330
- case "END" /* End */:
3357
+ case "END" /* Constant.End */:
3331
3358
  // Clear out session storage and end the session so we can start fresh the next time
3332
- trigger(6 /* Server */);
3359
+ trigger(6 /* Check.Server */);
3333
3360
  break;
3334
- case "UPGRADE" /* Upgrade */:
3361
+ case "UPGRADE" /* Constant.Upgrade */:
3335
3362
  // Upgrade current session to send back playback information
3336
- upgrade("Auto" /* Auto */);
3363
+ upgrade("Auto" /* Constant.Auto */);
3337
3364
  break;
3338
3365
  }
3339
3366
  }
@@ -3351,7 +3378,7 @@ function handler(error) {
3351
3378
  if (!(e.message in history$3)) {
3352
3379
  history$3[e.message] = 0;
3353
3380
  }
3354
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3381
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3355
3382
  return true;
3356
3383
  }
3357
3384
  // Send back information only if the handled error has valid information
@@ -3363,7 +3390,7 @@ function handler(error) {
3363
3390
  stack: e.stack,
3364
3391
  source: error["filename"]
3365
3392
  };
3366
- encode$2(31 /* ScriptError */);
3393
+ encode$2(31 /* Event.ScriptError */);
3367
3394
  }
3368
3395
  return true;
3369
3396
  }
@@ -3374,7 +3401,7 @@ function encode$2 (type) {
3374
3401
  return __generator(this, function (_a) {
3375
3402
  tokens = [time(), type];
3376
3403
  switch (type) {
3377
- case 31 /* ScriptError */:
3404
+ case 31 /* Event.ScriptError */:
3378
3405
  tokens.push(data$7.message);
3379
3406
  tokens.push(data$7.line);
3380
3407
  tokens.push(data$7.column);
@@ -3382,7 +3409,7 @@ function encode$2 (type) {
3382
3409
  tokens.push(data$7.source);
3383
3410
  queue(tokens);
3384
3411
  break;
3385
- case 33 /* Log */:
3412
+ case 33 /* Event.Log */:
3386
3413
  if (data$6) {
3387
3414
  tokens.push(data$6.code);
3388
3415
  tokens.push(data$6.name);
@@ -3392,7 +3419,7 @@ function encode$2 (type) {
3392
3419
  queue(tokens, false);
3393
3420
  }
3394
3421
  break;
3395
- case 41 /* Fraud */:
3422
+ case 41 /* Event.Fraud */:
3396
3423
  if (data$d) {
3397
3424
  tokens.push(data$d.id);
3398
3425
  tokens.push(data$d.target);
@@ -3415,7 +3442,7 @@ function log$1(code, severity, name, message, stack) {
3415
3442
  if (name === void 0) { name = null; }
3416
3443
  if (message === void 0) { message = null; }
3417
3444
  if (stack === void 0) { stack = null; }
3418
- var key = name ? name + "|" + message : "";
3445
+ var key = name ? "".concat(name, "|").concat(message) : "";
3419
3446
  // While rare, it's possible for code to fail repeatedly during the lifetime of the same page
3420
3447
  // In those cases, we only want to log the failure once and not spam logs with redundant information.
3421
3448
  if (code in history$2 && history$2[code].indexOf(key) >= 0) {
@@ -3429,7 +3456,7 @@ function log$1(code, severity, name, message, stack) {
3429
3456
  else {
3430
3457
  history$2[code] = [key];
3431
3458
  }
3432
- encode$2(33 /* Log */);
3459
+ encode$2(33 /* Event.Log */);
3433
3460
  }
3434
3461
  function stop$c() {
3435
3462
  history$2 = {};
@@ -3450,25 +3477,25 @@ function start$c() {
3450
3477
  var source = e[i];
3451
3478
  var key = e[i + 1];
3452
3479
  switch (source) {
3453
- case 0 /* Javascript */:
3480
+ case 0 /* ExtractSource.Javascript */:
3454
3481
  var variable = e[i + 2];
3455
3482
  variables[key] = parse(variable);
3456
3483
  break;
3457
- case 1 /* Cookie */:
3484
+ case 1 /* ExtractSource.Cookie */:
3458
3485
  /*Todo: Add cookie extract logic*/
3459
3486
  break;
3460
- case 2 /* Text */:
3487
+ case 2 /* ExtractSource.Text */:
3461
3488
  var match_1 = e[i + 2];
3462
3489
  selectors[key] = match_1;
3463
3490
  break;
3464
- case 3 /* Fragment */:
3491
+ case 3 /* ExtractSource.Fragment */:
3465
3492
  fragments = e[i + 2];
3466
3493
  break;
3467
3494
  }
3468
3495
  }
3469
3496
  }
3470
3497
  catch (e) {
3471
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3498
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3472
3499
  }
3473
3500
  }
3474
3501
  function clone(v) {
@@ -3490,9 +3517,9 @@ function compute$4() {
3490
3517
  }
3491
3518
  }
3492
3519
  catch (e) {
3493
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3520
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3494
3521
  }
3495
- encode$1(40 /* Extract */);
3522
+ encode$1(40 /* Event.Extract */);
3496
3523
  }
3497
3524
  function reset$4() {
3498
3525
  keys = [];
@@ -3512,15 +3539,15 @@ function stop$b() {
3512
3539
  }
3513
3540
  function parse(variable) {
3514
3541
  var syntax = [];
3515
- var parts = variable.split("." /* Dot */);
3542
+ var parts = variable.split("." /* Constant.Dot */);
3516
3543
  while (parts.length > 0) {
3517
3544
  var part = parts.shift();
3518
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3519
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3520
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3545
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3546
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3547
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3521
3548
  syntax.push({
3522
3549
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3523
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3550
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3524
3551
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3525
3552
  });
3526
3553
  }
@@ -3538,7 +3565,7 @@ function evaluate(variable, base) {
3538
3565
  var output;
3539
3566
  if (base && base[part.name]) {
3540
3567
  var obj = base[part.name];
3541
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3568
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3542
3569
  output = evaluate(variable, obj);
3543
3570
  }
3544
3571
  else if (Array.isArray(obj)) {
@@ -3560,7 +3587,7 @@ function evaluate(variable, base) {
3560
3587
  }
3561
3588
  function str(input) {
3562
3589
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3563
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3590
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3564
3591
  }
3565
3592
  function match(base, condition) {
3566
3593
  if (condition) {
@@ -3574,7 +3601,7 @@ function encode$1 (event) {
3574
3601
  var t = time();
3575
3602
  var tokens = [t, event];
3576
3603
  switch (event) {
3577
- case 4 /* Baseline */:
3604
+ case 4 /* Event.Baseline */:
3578
3605
  var b = state$9;
3579
3606
  if (b) {
3580
3607
  tokens = [b.time, b.event];
@@ -3592,30 +3619,30 @@ function encode$1 (event) {
3592
3619
  }
3593
3620
  reset$o();
3594
3621
  break;
3595
- case 25 /* Ping */:
3622
+ case 25 /* Event.Ping */:
3596
3623
  tokens.push(data$h.gap);
3597
3624
  queue(tokens);
3598
3625
  break;
3599
- case 35 /* Limit */:
3626
+ case 35 /* Event.Limit */:
3600
3627
  tokens.push(data$4.check);
3601
3628
  queue(tokens, false);
3602
3629
  break;
3603
- case 3 /* Upgrade */:
3630
+ case 3 /* Event.Upgrade */:
3604
3631
  tokens.push(data$f.key);
3605
3632
  queue(tokens);
3606
3633
  break;
3607
- case 2 /* Upload */:
3634
+ case 2 /* Event.Upload */:
3608
3635
  tokens.push(track$1.sequence);
3609
3636
  tokens.push(track$1.attempts);
3610
3637
  tokens.push(track$1.status);
3611
3638
  queue(tokens, false);
3612
3639
  break;
3613
- case 24 /* Custom */:
3640
+ case 24 /* Event.Custom */:
3614
3641
  tokens.push(data$j.key);
3615
3642
  tokens.push(data$j.value);
3616
3643
  queue(tokens);
3617
3644
  break;
3618
- case 34 /* Variable */:
3645
+ case 34 /* Event.Variable */:
3619
3646
  var variableKeys = Object.keys(data$e);
3620
3647
  if (variableKeys.length > 0) {
3621
3648
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3627,7 +3654,7 @@ function encode$1 (event) {
3627
3654
  queue(tokens, false);
3628
3655
  }
3629
3656
  break;
3630
- case 0 /* Metric */:
3657
+ case 0 /* Event.Metric */:
3631
3658
  var metricKeys = Object.keys(updates$3);
3632
3659
  if (metricKeys.length > 0) {
3633
3660
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3642,7 +3669,7 @@ function encode$1 (event) {
3642
3669
  queue(tokens, false);
3643
3670
  }
3644
3671
  break;
3645
- case 1 /* Dimension */:
3672
+ case 1 /* Event.Dimension */:
3646
3673
  var dimensionKeys = Object.keys(updates);
3647
3674
  if (dimensionKeys.length > 0) {
3648
3675
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3655,7 +3682,7 @@ function encode$1 (event) {
3655
3682
  queue(tokens, false);
3656
3683
  }
3657
3684
  break;
3658
- case 36 /* Summary */:
3685
+ case 36 /* Event.Summary */:
3659
3686
  var eventKeys = Object.keys(data$g);
3660
3687
  if (eventKeys.length > 0) {
3661
3688
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3668,7 +3695,7 @@ function encode$1 (event) {
3668
3695
  queue(tokens, false);
3669
3696
  }
3670
3697
  break;
3671
- case 40 /* Extract */:
3698
+ case 40 /* Event.Extract */:
3672
3699
  var extractKeys = keys;
3673
3700
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3674
3701
  var e = extractKeys_1[_d];
@@ -3682,14 +3709,14 @@ function encode$1 (event) {
3682
3709
 
3683
3710
  var data$4;
3684
3711
  function start$b() {
3685
- data$4 = { check: 0 /* None */ };
3712
+ data$4 = { check: 0 /* Check.None */ };
3686
3713
  }
3687
3714
  function check$2(bytes) {
3688
- if (data$4.check === 0 /* None */) {
3715
+ if (data$4.check === 0 /* Check.None */) {
3689
3716
  var reason = data$4.check;
3690
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3691
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3692
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3717
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3718
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3719
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3693
3720
  if (reason !== data$4.check) {
3694
3721
  trigger(reason);
3695
3722
  }
@@ -3701,8 +3728,8 @@ function trigger(reason) {
3701
3728
  stop();
3702
3729
  }
3703
3730
  function compute$3() {
3704
- if (data$4.check !== 0 /* None */) {
3705
- encode$1(35 /* Limit */);
3731
+ if (data$4.check !== 0 /* Check.None */) {
3732
+ encode$1(35 /* Event.Limit */);
3706
3733
  }
3707
3734
  }
3708
3735
  function stop$a() {
@@ -3723,7 +3750,7 @@ function log(dimension, value) {
3723
3750
  // Check valid value before moving ahead
3724
3751
  if (value) {
3725
3752
  // Ensure received value is casted into a string if it wasn't a string to begin with
3726
- value = "" + value;
3753
+ value = "".concat(value);
3727
3754
  if (!(dimension in data$3)) {
3728
3755
  data$3[dimension] = [];
3729
3756
  }
@@ -3736,14 +3763,14 @@ function log(dimension, value) {
3736
3763
  }
3737
3764
  updates[dimension].push(value);
3738
3765
  // Limit check to ensure we have a cap on number of dimensions we can collect
3739
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3740
- trigger(5 /* Collection */);
3766
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3767
+ trigger(5 /* Check.Collection */);
3741
3768
  }
3742
3769
  }
3743
3770
  }
3744
3771
  }
3745
3772
  function compute$2() {
3746
- encode$1(1 /* Dimension */);
3773
+ encode$1(1 /* Event.Dimension */);
3747
3774
  }
3748
3775
  function reset$3() {
3749
3776
  updates = {};
@@ -3754,8 +3781,8 @@ var callbacks = [];
3754
3781
  var rootDomain = null;
3755
3782
  function start$9() {
3756
3783
  rootDomain = null;
3757
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3758
- var title = document && document.title ? document.title : "" /* Empty */;
3784
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3785
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3759
3786
  // Populate ids for this page
3760
3787
  var s = session();
3761
3788
  var u = user();
@@ -3766,27 +3793,27 @@ function start$9() {
3766
3793
  pageNum: s.count
3767
3794
  };
3768
3795
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3769
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3770
- config$1.upload = config$1.track && typeof config$1.upload === "string" /* String */ && s.upload && s.upload.length > "https://" /* HTTPS */.length ? s.upload : config$1.upload;
3796
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3797
+ config$1.upload = config$1.track && typeof config$1.upload === "string" /* Constant.String */ && s.upload && s.upload.length > "https://" /* Constant.HTTPS */.length ? s.upload : config$1.upload;
3771
3798
  // Log dimensions
3772
- log(0 /* UserAgent */, ua);
3773
- log(3 /* PageTitle */, title);
3774
- log(1 /* Url */, location.href);
3775
- log(2 /* Referrer */, document.referrer);
3776
- log(15 /* TabId */, tab());
3777
- log(16 /* PageLanguage */, document.documentElement.lang);
3778
- log(17 /* DocumentDirection */, document.dir);
3799
+ log(0 /* Dimension.UserAgent */, ua);
3800
+ log(3 /* Dimension.PageTitle */, title);
3801
+ log(1 /* Dimension.Url */, location.href);
3802
+ log(2 /* Dimension.Referrer */, document.referrer);
3803
+ log(15 /* Dimension.TabId */, tab());
3804
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3805
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3779
3806
  if (navigator) {
3780
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3807
+ log(9 /* Dimension.Language */, navigator.userLanguage || navigator.language);
3781
3808
  userAgentData();
3782
3809
  }
3783
3810
  // Metrics
3784
- max(0 /* ClientTimestamp */, s.ts);
3785
- max(1 /* Playback */, 0 /* False */);
3811
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3812
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3786
3813
  if (screen) {
3787
- max(14 /* ScreenWidth */, Math.round(screen.width));
3788
- max(15 /* ScreenHeight */, Math.round(screen.height));
3789
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3814
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3815
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3816
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3790
3817
  }
3791
3818
  // Read cookies specified in configuration
3792
3819
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3807,13 +3834,13 @@ function userAgentData() {
3807
3834
  "uaFullVersion"])
3808
3835
  .then(function (ua) {
3809
3836
  var _a;
3810
- log(22 /* Platform */, ua.platform);
3811
- log(23 /* PlatformVersion */, ua.platformVersion);
3837
+ log(22 /* Dimension.Platform */, ua.platform);
3838
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3812
3839
  (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3813
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3840
+ log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version);
3814
3841
  });
3815
- log(25 /* Model */, ua.model);
3816
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3842
+ log(25 /* Dimension.Model */, ua.model);
3843
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3817
3844
  });
3818
3845
  }
3819
3846
  }
@@ -3830,33 +3857,33 @@ function metadata(cb, wait) {
3830
3857
  callbacks.push({ callback: cb, wait: wait });
3831
3858
  }
3832
3859
  function id() {
3833
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3860
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3834
3861
  }
3835
3862
  function consent() {
3836
3863
  if (active()) {
3837
3864
  config$1.track = true;
3838
- track(user(), 1 /* True */);
3865
+ track(user(), 1 /* BooleanFlag.True */);
3839
3866
  }
3840
3867
  }
3841
3868
  function clear() {
3842
3869
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3843
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
3870
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3844
3871
  }
3845
3872
  function tab() {
3846
3873
  var id = shortid();
3847
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3848
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
3874
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
3875
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3849
3876
  id = value ? value : id;
3850
- sessionStorage.setItem("_cltk" /* TabKey */, id);
3877
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3851
3878
  }
3852
3879
  return id;
3853
3880
  }
3854
3881
  function save() {
3855
3882
  var ts = Math.round(Date.now());
3856
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3857
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
3883
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
3884
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3858
3885
  processCallback(upgrade);
3859
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
3886
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3860
3887
  }
3861
3888
  function processCallback(upgrade) {
3862
3889
  if (callbacks.length > 0) {
@@ -3881,10 +3908,10 @@ function track(u, consent) {
3881
3908
  consent = consent === null ? u.consent : consent;
3882
3909
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3883
3910
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3884
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
3911
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3885
3912
  // To avoid cookie churn, write user id cookie only once every day
3886
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3887
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
3913
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
3914
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3888
3915
  }
3889
3916
  }
3890
3917
  function shortid() {
@@ -3895,17 +3922,17 @@ function shortid() {
3895
3922
  return id.toString(36);
3896
3923
  }
3897
3924
  function session() {
3898
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3899
- var value = getCookie("_clsk" /* SessionKey */);
3925
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
3926
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3900
3927
  if (value) {
3901
- var parts = value.split("|" /* Pipe */);
3928
+ var parts = value.split("|" /* Constant.Pipe */);
3902
3929
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3903
3930
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3904
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
3931
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3905
3932
  output.session = parts[0];
3906
3933
  output.count = num(parts[2]) + 1;
3907
3934
  output.upgrade = num(parts[3]);
3908
- output.upload = parts.length >= 6 ? "" + "https://" /* HTTPS */ + parts[5] + "/" + parts[4] : "" + "https://" /* HTTPS */ + parts[4];
3935
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3909
3936
  }
3910
3937
  }
3911
3938
  return output;
@@ -3915,26 +3942,26 @@ function num(string, base) {
3915
3942
  return parseInt(string, base);
3916
3943
  }
3917
3944
  function user() {
3918
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
3919
- var cookie = getCookie("_clck" /* CookieKey */);
3945
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
3946
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
3920
3947
  if (cookie && cookie.length > 0) {
3921
3948
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
3922
- var parts = cookie.split("|" /* Pipe */);
3949
+ var parts = cookie.split("|" /* Constant.Pipe */);
3923
3950
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
3924
3951
  // Count number of times Clarity's user cookie crumb appears in document.cookie (could be on different sub-domains e.g. www.domain.com and .domain.com)
3925
3952
  var count = 0;
3926
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
3953
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
3927
3954
  var c = _a[_i];
3928
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
3955
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
3929
3956
  }
3930
3957
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
3931
3958
  // In both these cases, we go ahead and delete the existing cookie set on current domain
3932
3959
  if (parts.length === 1 || count > 1) {
3933
- var deleted = "" + ";" /* Semicolon */ + "expires=" /* Expires */ + (new Date(0)).toUTCString() + ";path=/" /* Path */;
3960
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
3934
3961
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
3935
- document.cookie = "_clck" /* CookieKey */ + "=" + deleted;
3962
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
3936
3963
  // Second, same thing for current session cookie so it can be re-written later with the root domain
3937
- document.cookie = "_clsk" /* SessionKey */ + "=" + deleted;
3964
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
3938
3965
  }
3939
3966
  // End code for backward compatibility
3940
3967
  // Read version information and timestamp from cookie, if available
@@ -3943,21 +3970,21 @@ function user() {
3943
3970
  }
3944
3971
  // Check if we have explicit consent to track this user
3945
3972
  if (parts.length > 3 && num(parts[3]) === 1) {
3946
- output.consent = 1 /* True */;
3973
+ output.consent = 1 /* BooleanFlag.True */;
3947
3974
  }
3948
3975
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
3949
- config$1.track = config$1.track || output.consent === 1 /* True */;
3976
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
3950
3977
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
3951
3978
  output.id = config$1.track ? parts[0] : output.id;
3952
3979
  }
3953
3980
  return output;
3954
3981
  }
3955
3982
  function getCookie(key) {
3956
- if (supported(document, "cookie" /* Cookie */)) {
3957
- var cookies = document.cookie.split(";" /* Semicolon */);
3983
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
3984
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
3958
3985
  if (cookies) {
3959
3986
  for (var i = 0; i < cookies.length; i++) {
3960
- var pair = cookies[i].split("=" /* Equals */);
3987
+ var pair = cookies[i].split("=" /* Constant.Equals */);
3961
3988
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
3962
3989
  return pair[1];
3963
3990
  }
@@ -3967,23 +3994,23 @@ function getCookie(key) {
3967
3994
  return null;
3968
3995
  }
3969
3996
  function setCookie(key, value, time) {
3970
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
3997
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
3971
3998
  var expiry = new Date();
3972
3999
  expiry.setDate(expiry.getDate() + time);
3973
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
3974
- var cookie = key + "=" + value + ";" /* Semicolon */ + expires + ";path=/" /* Path */;
4000
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
4001
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
3975
4002
  try {
3976
4003
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
3977
4004
  if (rootDomain === null) {
3978
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
4005
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
3979
4006
  // Walk backwards on a domain and attempt to set a cookie, until successful
3980
4007
  for (var i = hostname.length - 1; i >= 0; i--) {
3981
- rootDomain = "." + hostname[i] + (rootDomain ? rootDomain : "" /* Empty */);
4008
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
3982
4009
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
3983
4010
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
3984
4011
  if (i < hostname.length - 1) {
3985
4012
  // Write the cookie on the current computed top level domain
3986
- document.cookie = "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain;
4013
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
3987
4014
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
3988
4015
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
3989
4016
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -3995,13 +4022,13 @@ function setCookie(key, value, time) {
3995
4022
  }
3996
4023
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
3997
4024
  // This forces our code to fall back to always writing cookie to the current domain
3998
- rootDomain = "" /* Empty */;
4025
+ rootDomain = "" /* Constant.Empty */;
3999
4026
  }
4000
4027
  }
4001
4028
  catch (_a) {
4002
- rootDomain = "" /* Empty */;
4029
+ rootDomain = "" /* Constant.Empty */;
4003
4030
  }
4004
- document.cookie = rootDomain ? "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain : cookie;
4031
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4005
4032
  }
4006
4033
  }
4007
4034
 
@@ -4017,8 +4044,8 @@ function start$8() {
4017
4044
  userId: m.userId,
4018
4045
  sessionId: m.sessionId,
4019
4046
  pageNum: m.pageNum,
4020
- upload: 0 /* Async */,
4021
- end: 0 /* False */
4047
+ upload: 0 /* Upload.Async */,
4048
+ end: 0 /* BooleanFlag.False */
4022
4049
  };
4023
4050
  }
4024
4051
  function stop$7() {
@@ -4028,8 +4055,8 @@ function envelope(last) {
4028
4055
  data$1.start = data$1.start + data$1.duration;
4029
4056
  data$1.duration = time() - data$1.start;
4030
4057
  data$1.sequence++;
4031
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4032
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4058
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4059
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4033
4060
  return [
4034
4061
  data$1.version,
4035
4062
  data$1.sequence,
@@ -4082,10 +4109,10 @@ function measure (method) {
4082
4109
  throw report(ex);
4083
4110
  }
4084
4111
  var duration = performance.now() - start;
4085
- sum(4 /* TotalCost */, duration);
4086
- if (duration > 30 /* LongTask */) {
4087
- count$1(7 /* LongTaskCount */);
4088
- max(6 /* ThreadBlockedTime */, duration);
4112
+ sum(4 /* Metric.TotalCost */, duration);
4113
+ if (duration > 30 /* Setting.LongTask */) {
4114
+ count$1(7 /* Metric.LongTaskCount */);
4115
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4089
4116
  }
4090
4117
  };
4091
4118
  }
@@ -4097,7 +4124,7 @@ function bind(target, event, listener, capture) {
4097
4124
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4098
4125
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4099
4126
  try {
4100
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4127
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4101
4128
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4102
4129
  }
4103
4130
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4108,7 +4135,7 @@ function reset$1() {
4108
4135
  var binding = bindings_1[_i];
4109
4136
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4110
4137
  try {
4111
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4138
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4112
4139
  }
4113
4140
  catch ( /* do nothing */_a) { /* do nothing */ }
4114
4141
  }
@@ -4145,8 +4172,8 @@ function start$7() {
4145
4172
  }
4146
4173
  }
4147
4174
  function check$1() {
4148
- if (count++ > 20 /* CallStackDepth */) {
4149
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4175
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4176
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4150
4177
  return false;
4151
4178
  }
4152
4179
  return true;
@@ -4156,15 +4183,15 @@ function compute$1() {
4156
4183
  if (url !== getCurrentUrl()) {
4157
4184
  // If the url changed, start tracking it as a new page
4158
4185
  stop();
4159
- window.setTimeout(restart$1, 250 /* RestartDelay */);
4186
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4160
4187
  }
4161
4188
  }
4162
4189
  function restart$1() {
4163
4190
  start();
4164
- max(29 /* SinglePage */, 1 /* True */);
4191
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4165
4192
  }
4166
4193
  function getCurrentUrl() {
4167
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4194
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4168
4195
  }
4169
4196
  function stop$6() {
4170
4197
  url = null;
@@ -4227,7 +4254,7 @@ function config(override) {
4227
4254
  // not holding the session during inactive time periods.
4228
4255
  function suspend() {
4229
4256
  if (status) {
4230
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4257
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4231
4258
  stop();
4232
4259
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4233
4260
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4235,7 +4262,7 @@ function suspend() {
4235
4262
  }
4236
4263
  function restart() {
4237
4264
  start();
4238
- event("clarity" /* Clarity */, "restart" /* Restart */);
4265
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4239
4266
  }
4240
4267
 
4241
4268
  function start$5() {
@@ -4254,7 +4281,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4254
4281
  });
4255
4282
 
4256
4283
  function start$4() {
4257
- schedule$1(discover, 1 /* High */).then(function () {
4284
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4258
4285
  measure(compute$7)();
4259
4286
  measure(compute$6)();
4260
4287
  });
@@ -4266,12 +4293,12 @@ function discover() {
4266
4293
  switch (_a.label) {
4267
4294
  case 0:
4268
4295
  ts = time();
4269
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4296
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4270
4297
  start$w(timer);
4271
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4298
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4272
4299
  case 1:
4273
4300
  _a.sent();
4274
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4301
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4275
4302
  case 2:
4276
4303
  _a.sent();
4277
4304
  stop$t(timer);
@@ -4310,7 +4337,7 @@ function encode (type) {
4310
4337
  t = time();
4311
4338
  tokens = [t, type];
4312
4339
  switch (type) {
4313
- case 29 /* Navigation */:
4340
+ case 29 /* Event.Navigation */:
4314
4341
  tokens.push(data.fetchStart);
4315
4342
  tokens.push(data.connectStart);
4316
4343
  tokens.push(data.connectEnd);
@@ -4359,11 +4386,11 @@ function compute(entry) {
4359
4386
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4360
4387
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4361
4388
  };
4362
- encode(29 /* Navigation */);
4389
+ encode(29 /* Event.Navigation */);
4363
4390
  }
4364
4391
 
4365
4392
  var observer;
4366
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4393
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4367
4394
  function start$2() {
4368
4395
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4369
4396
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
@@ -4378,7 +4405,7 @@ function start$2() {
4378
4405
  }
4379
4406
  }
4380
4407
  else {
4381
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4408
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4382
4409
  }
4383
4410
  }
4384
4411
  function observe() {
@@ -4398,15 +4425,15 @@ function observe() {
4398
4425
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4399
4426
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4400
4427
  // In those cases, we want to still initialize the metric in Clarity
4401
- if (x === "layout-shift" /* CLS */) {
4402
- sum(9 /* CumulativeLayoutShift */, 0);
4428
+ if (x === "layout-shift" /* Constant.CLS */) {
4429
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4403
4430
  }
4404
4431
  observer.observe({ type: x, buffered: true });
4405
4432
  }
4406
4433
  }
4407
4434
  }
4408
4435
  catch (_a) {
4409
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4436
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4410
4437
  }
4411
4438
  }
4412
4439
  function handle(entries) {
@@ -4417,41 +4444,41 @@ function process(entries) {
4417
4444
  for (var i = 0; i < entries.length; i++) {
4418
4445
  var entry = entries[i];
4419
4446
  switch (entry.entryType) {
4420
- case "navigation" /* Navigation */:
4447
+ case "navigation" /* Constant.Navigation */:
4421
4448
  compute(entry);
4422
4449
  break;
4423
- case "resource" /* Resource */:
4450
+ case "resource" /* Constant.Resource */:
4424
4451
  var name_1 = entry.name;
4425
- log(4 /* NetworkHosts */, host(name_1));
4452
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4426
4453
  if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4427
- max(28 /* UploadTime */, entry.duration);
4454
+ max(28 /* Metric.UploadTime */, entry.duration);
4428
4455
  }
4429
4456
  break;
4430
- case "longtask" /* LongTask */:
4431
- count$1(7 /* LongTaskCount */);
4457
+ case "longtask" /* Constant.LongTask */:
4458
+ count$1(7 /* Metric.LongTaskCount */);
4432
4459
  break;
4433
- case "first-input" /* FID */:
4460
+ case "first-input" /* Constant.FID */:
4434
4461
  if (visible) {
4435
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4462
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4436
4463
  }
4437
4464
  break;
4438
- case "layout-shift" /* CLS */:
4465
+ case "layout-shift" /* Constant.CLS */:
4439
4466
  // Scale the value to avoid sending back floating point number
4440
4467
  if (visible && !entry["hadRecentInput"]) {
4441
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4468
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4442
4469
  }
4443
4470
  break;
4444
- case "largest-contentful-paint" /* LCP */:
4471
+ case "largest-contentful-paint" /* Constant.LCP */:
4445
4472
  if (visible) {
4446
- max(8 /* LargestPaint */, entry.startTime);
4473
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4447
4474
  }
4448
4475
  break;
4449
4476
  }
4450
4477
  }
4451
- if (performance && "memory" /* Memory */ in performance && performance["memory" /* Memory */].usedJSHeapSize) {
4478
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4452
4479
  // Track consumed memory (MBs) where "memory" API is available
4453
4480
  // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4454
- max(30 /* UsedMemory */, Math.abs(performance["memory" /* Memory */].usedJSHeapSize / 1048576 /* MegaByte */));
4481
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4455
4482
  }
4456
4483
  }
4457
4484
  function stop$2() {
@@ -4499,7 +4526,7 @@ function start(config$1) {
4499
4526
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4500
4527
  function pause() {
4501
4528
  if (active()) {
4502
- event("clarity" /* Clarity */, "pause" /* Pause */);
4529
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4503
4530
  pause$1();
4504
4531
  }
4505
4532
  }
@@ -4507,7 +4534,7 @@ function pause() {
4507
4534
  function resume() {
4508
4535
  if (active()) {
4509
4536
  resume$1();
4510
- event("clarity" /* Clarity */, "resume" /* Resume */);
4537
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4511
4538
  }
4512
4539
  }
4513
4540
  function stop() {