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.
package/build/clarity.js CHANGED
@@ -79,7 +79,7 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
79
79
 
80
80
  var config$1 = {
81
81
  projectId: null,
82
- delay: 1 * 1000 /* Second */,
82
+ delay: 1 * 1000 /* Time.Second */,
83
83
  lean: false,
84
84
  track: true,
85
85
  content: true,
@@ -99,7 +99,7 @@ function api(method) {
99
99
  // Zone.js, a popular package for Angular, overrides native browser APIs which can lead to inconsistent state for single page applications.
100
100
  // Example issue: https://github.com/angular/angular/issues/31712
101
101
  // As a work around, we ensuring Clarity access APIs outside of Zone (and use native implementation instead)
102
- return window["Zone" /* Zone */] && "__symbol__" /* Symbol */ in window["Zone" /* Zone */] ? window["Zone" /* Zone */]["__symbol__" /* Symbol */](method) : method;
102
+ return window["Zone" /* Constant.Zone */] && "__symbol__" /* Constant.Symbol */ in window["Zone" /* Constant.Zone */] ? window["Zone" /* Constant.Zone */]["__symbol__" /* Constant.Symbol */](method) : method;
103
103
  }
104
104
 
105
105
  var startTime = 0;
@@ -115,7 +115,7 @@ function stop$B() {
115
115
  startTime = 0;
116
116
  }
117
117
 
118
- var version$1 = "0.6.36";
118
+ var version$1 = "0.6.39";
119
119
 
120
120
  // tslint:disable: no-bitwise
121
121
  function hash (input) {
@@ -148,7 +148,7 @@ function reset$o() {
148
148
  // Baseline state holds the previous values - if it is updated in the current payload,
149
149
  // reset the state to current value after sending the previous state
150
150
  if (update$2) {
151
- state$9 = { time: time(), event: 4 /* Baseline */, data: {
151
+ state$9 = { time: time(), event: 4 /* Event.Baseline */, data: {
152
152
  visible: buffer.visible,
153
153
  docWidth: buffer.docWidth,
154
154
  docHeight: buffer.docHeight,
@@ -163,7 +163,7 @@ function reset$o() {
163
163
  };
164
164
  }
165
165
  buffer = buffer ? buffer : {
166
- visible: 1 /* True */,
166
+ visible: 1 /* BooleanFlag.True */,
167
167
  docWidth: 0,
168
168
  docHeight: 0,
169
169
  screenWidth: 0,
@@ -177,15 +177,15 @@ function reset$o() {
177
177
  }
178
178
  function track$7(event, x, y) {
179
179
  switch (event) {
180
- case 8 /* Document */:
180
+ case 8 /* Event.Document */:
181
181
  buffer.docWidth = x;
182
182
  buffer.docHeight = y;
183
183
  break;
184
- case 11 /* Resize */:
184
+ case 11 /* Event.Resize */:
185
185
  buffer.screenWidth = x;
186
186
  buffer.screenHeight = y;
187
187
  break;
188
- case 10 /* Scroll */:
188
+ case 10 /* Event.Scroll */:
189
189
  buffer.scrollX = x;
190
190
  buffer.scrollY = y;
191
191
  break;
@@ -200,7 +200,7 @@ function activity(t) {
200
200
  buffer.activityTime = t;
201
201
  }
202
202
  function visibility(t, visible) {
203
- buffer.visible = visible === "visible" ? 1 /* True */ : 0 /* False */;
203
+ buffer.visible = visible === "visible" ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
204
204
  if (!buffer.visible) {
205
205
  activity(t);
206
206
  }
@@ -208,7 +208,7 @@ function visibility(t, visible) {
208
208
  }
209
209
  function compute$c() {
210
210
  if (update$2) {
211
- encode$1(4 /* Baseline */);
211
+ encode$1(4 /* Event.Baseline */);
212
212
  }
213
213
  }
214
214
  function stop$A() {
@@ -232,12 +232,12 @@ function event(key, value) {
232
232
  if (active() &&
233
233
  key &&
234
234
  value &&
235
- typeof key === "string" /* String */ &&
236
- typeof value === "string" /* String */ &&
235
+ typeof key === "string" /* Constant.String */ &&
236
+ typeof value === "string" /* Constant.String */ &&
237
237
  key.length < 255 &&
238
238
  value.length < 255) {
239
239
  data$j = { key: key, value: value };
240
- encode$1(24 /* Custom */);
240
+ encode$1(24 /* Event.Custom */);
241
241
  }
242
242
  }
243
243
 
@@ -246,7 +246,7 @@ var updates$3 = null;
246
246
  function start$D() {
247
247
  data$i = {};
248
248
  updates$3 = {};
249
- count$1(5 /* InvokeCount */);
249
+ count$1(5 /* Metric.InvokeCount */);
250
250
  }
251
251
  function stop$z() {
252
252
  data$i = {};
@@ -287,7 +287,7 @@ function max(metric, value) {
287
287
  }
288
288
  }
289
289
  function compute$b() {
290
- encode$1(0 /* Metric */);
290
+ encode$1(0 /* Event.Metric */);
291
291
  }
292
292
  function reset$n() {
293
293
  updates$3 = {};
@@ -305,7 +305,7 @@ var last = 0;
305
305
  var interval = 0;
306
306
  var timeout$6 = null;
307
307
  function start$C() {
308
- interval = 60000 /* PingInterval */;
308
+ interval = 60000 /* Setting.PingInterval */;
309
309
  last = 0;
310
310
  }
311
311
  function reset$m() {
@@ -318,8 +318,8 @@ function reset$m() {
318
318
  function ping() {
319
319
  var now = time();
320
320
  data$h = { gap: now - last };
321
- encode$1(25 /* Ping */);
322
- if (data$h.gap < 300000 /* PingTimeout */) {
321
+ encode$1(25 /* Event.Ping */);
322
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
323
323
  timeout$6 = setTimeout(ping, interval);
324
324
  }
325
325
  else {
@@ -356,7 +356,7 @@ function track$6(event, time) {
356
356
  var last = e[e.length - 1];
357
357
  // Add a new entry only if the new event occurs after configured interval
358
358
  // Otherwise, extend the duration of the previous entry
359
- if (time - last[0] > 100 /* SummaryInterval */) {
359
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
360
360
  data$g[event].push([time, 0]);
361
361
  }
362
362
  else {
@@ -365,7 +365,7 @@ function track$6(event, time) {
365
365
  }
366
366
  }
367
367
  function compute$a() {
368
- encode$1(36 /* Summary */);
368
+ encode$1(36 /* Event.Summary */);
369
369
  }
370
370
  function reset$l() {
371
371
  data$g = {};
@@ -384,7 +384,7 @@ var summary = /*#__PURE__*/Object.freeze({
384
384
  var data$f = null;
385
385
  function start$A() {
386
386
  if (!config$1.lean && config$1.upgrade) {
387
- config$1.upgrade("Config" /* Config */);
387
+ config$1.upgrade("Config" /* Constant.Config */);
388
388
  }
389
389
  data$f = null;
390
390
  }
@@ -403,7 +403,7 @@ function upgrade(key) {
403
403
  if (config$1.upgrade) {
404
404
  config$1.upgrade(key);
405
405
  }
406
- encode$1(3 /* Upgrade */);
406
+ encode$1(3 /* Event.Upgrade */);
407
407
  }
408
408
  }
409
409
  function stop$w() {
@@ -423,25 +423,25 @@ function start$z() {
423
423
  reset$k();
424
424
  }
425
425
  function set(variable, value) {
426
- var values = typeof value === "string" /* String */ ? [value] : value;
426
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
427
427
  log$2(variable, values);
428
428
  }
429
429
  function identify(userId, sessionId, pageId) {
430
430
  if (sessionId === void 0) { sessionId = null; }
431
431
  if (pageId === void 0) { pageId = null; }
432
- log$2("userId" /* UserId */, [userId]);
433
- log$2("sessionId" /* SessionId */, [sessionId]);
434
- log$2("pageId" /* PageId */, [pageId]);
432
+ log$2("userId" /* Constant.UserId */, [userId]);
433
+ log$2("sessionId" /* Constant.SessionId */, [sessionId]);
434
+ log$2("pageId" /* Constant.PageId */, [pageId]);
435
435
  }
436
436
  function log$2(variable, value) {
437
437
  if (active() &&
438
438
  variable &&
439
439
  value &&
440
- typeof variable === "string" /* String */ &&
440
+ typeof variable === "string" /* Constant.String */ &&
441
441
  variable.length < 255) {
442
442
  var validValues = variable in data$e ? data$e[variable] : [];
443
443
  for (var i = 0; i < value.length; i++) {
444
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
444
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
445
445
  validValues.push(value[i]);
446
446
  }
447
447
  }
@@ -449,7 +449,7 @@ function log$2(variable, value) {
449
449
  }
450
450
  }
451
451
  function compute$9() {
452
- encode$1(34 /* Variable */);
452
+ encode$1(34 /* Event.Variable */);
453
453
  }
454
454
  function reset$k() {
455
455
  data$e = {};
@@ -469,7 +469,7 @@ var variable = /*#__PURE__*/Object.freeze({
469
469
  stop: stop$v
470
470
  });
471
471
 
472
- /*! *****************************************************************************
472
+ /******************************************************************************
473
473
  Copyright (c) Microsoft Corporation.
474
474
 
475
475
  Permission to use, copy, modify, and/or distribute this software for any
@@ -522,7 +522,7 @@ function __generator(thisArg, body) {
522
522
  }
523
523
  }
524
524
 
525
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
525
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
526
526
  function compress (input) {
527
527
  return __awaiter(this, void 0, void 0, function () {
528
528
  var stream, _a;
@@ -539,7 +539,7 @@ function compress (input) {
539
539
  return [2 /*return*/];
540
540
  });
541
541
  });
542
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
542
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
543
543
  _a = Uint8Array.bind;
544
544
  return [4 /*yield*/, read(stream)];
545
545
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -604,32 +604,37 @@ function compute$8() {
604
604
  compute$4();
605
605
  }
606
606
 
607
+ var catchallRegex = /\S/gi;
608
+ var unicodeRegex = true;
609
+ var digitRegex = null;
610
+ var letterRegex = null;
611
+ var currencyRegex = null;
607
612
  function scrub (value, hint, privacy, mangle) {
608
613
  if (mangle === void 0) { mangle = false; }
609
614
  if (value) {
610
615
  switch (privacy) {
611
- case 0 /* None */:
616
+ case 0 /* Privacy.None */:
612
617
  return value;
613
- case 1 /* Sensitive */:
618
+ case 1 /* Privacy.Sensitive */:
614
619
  switch (hint) {
615
- case "*T" /* TextTag */:
620
+ case "*T" /* Layout.Constant.TextTag */:
616
621
  case "value":
617
622
  case "placeholder":
618
- return redact(value);
623
+ case "click":
619
624
  case "input":
620
- return mangleToken(value);
625
+ return redact(value);
621
626
  }
622
627
  return value;
623
- case 2 /* Text */:
624
- case 3 /* TextImage */:
628
+ case 2 /* Privacy.Text */:
629
+ case 3 /* Privacy.TextImage */:
625
630
  switch (hint) {
626
- case "*T" /* TextTag */:
631
+ case "*T" /* Layout.Constant.TextTag */:
627
632
  return mangle ? mangleText(value) : mask(value);
628
633
  case "src":
629
634
  case "srcset":
630
635
  case "title":
631
636
  case "alt":
632
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
637
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
633
638
  case "value":
634
639
  case "click":
635
640
  case "input":
@@ -649,40 +654,65 @@ function mangleText(value) {
649
654
  var index = value.indexOf(first);
650
655
  var prefix = value.substr(0, index);
651
656
  var suffix = value.substr(index + trimmed.length);
652
- return "" + prefix + trimmed.length.toString(36) + suffix;
657
+ return "".concat(prefix).concat(trimmed.length.toString(36)).concat(suffix);
653
658
  }
654
659
  return value;
655
660
  }
656
661
  function mask(value) {
657
- return value.replace(/\S/gi, "\u2022" /* Mask */);
662
+ return value.replace(catchallRegex, "\u2022" /* Data.Constant.Mask */);
658
663
  }
659
664
  function mangleToken(value) {
660
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
661
- var output = "" /* Empty */;
665
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
666
+ var output = "" /* Layout.Constant.Empty */;
662
667
  for (var i = 0; i < length; i++) {
663
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
668
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
664
669
  }
665
670
  return output;
666
671
  }
667
672
  function redact(value) {
668
673
  var spaceIndex = -1;
674
+ var gap = 0;
669
675
  var hasDigit = false;
670
676
  var hasEmail = false;
671
677
  var hasWhitespace = false;
672
678
  var array = null;
679
+ // Initialize unicode regex, if supported by the browser
680
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
681
+ if (unicodeRegex && digitRegex === null) {
682
+ try {
683
+ digitRegex = new RegExp("\\p{N}", "gu");
684
+ letterRegex = new RegExp("\\p{L}", "gu");
685
+ currencyRegex = new RegExp("\\p{Sc}", "gu");
686
+ }
687
+ catch (_a) {
688
+ unicodeRegex = false;
689
+ }
690
+ }
673
691
  for (var i = 0; i < value.length; i++) {
674
692
  var c = value.charCodeAt(i);
675
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
676
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
677
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
693
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
694
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
695
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
678
696
  // Process each word as an individual token to redact any sensitive information
679
697
  if (i === 0 || i === value.length - 1 || hasWhitespace) {
680
698
  // Performance optimization: Lazy load string -> array conversion only when required
681
699
  if (hasDigit || hasEmail) {
682
700
  if (array === null) {
683
- array = value.split("" /* Empty */);
701
+ array = value.split("" /* Data.Constant.Empty */);
702
+ }
703
+ // Work on a token at a time so we don't have to apply regex to a larger string
704
+ var token = value.substring(spaceIndex + 1, hasWhitespace ? i : i + 1);
705
+ // Check if unicode regex is supported, otherwise fallback to calling mask function on this token
706
+ if (unicodeRegex && currencyRegex !== null) {
707
+ // Do not redact information if the token contains a currency symbol
708
+ token = token.match(currencyRegex) ? token : token.replace(letterRegex, "\u2022" /* Data.Constant.Letter */).replace(digitRegex, "\u2022" /* Data.Constant.Digit */);
709
+ }
710
+ else {
711
+ token = mask(token);
684
712
  }
685
- mutate(array, spaceIndex, hasWhitespace ? i : i + 1);
713
+ // Merge token back into array at the right place
714
+ array.splice(spaceIndex + 1 - gap, token.length, token);
715
+ gap += token.length - 1;
686
716
  }
687
717
  // Reset digit and email flags after every word boundary, except the beginning of string
688
718
  if (hasWhitespace) {
@@ -692,28 +722,23 @@ function redact(value) {
692
722
  }
693
723
  }
694
724
  }
695
- return array ? array.join("" /* Empty */) : value;
696
- }
697
- function mutate(array, start, end) {
698
- for (var i = start + 1; i < end; i++) {
699
- array[i] = "\u2022" /* Mask */;
700
- }
725
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
701
726
  }
702
727
 
703
728
  var history$5 = [];
704
729
  var data$d;
705
730
  function start$x() {
706
731
  history$5 = [];
707
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
732
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
708
733
  }
709
734
  function check$4(id, target, input) {
710
735
  // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
711
- if (id !== null && input && input.length >= 5 /* WordLength */) {
736
+ if (id !== null && input && input.length >= 5 /* Setting.WordLength */) {
712
737
  data$d = { id: id, target: target, hash: hash(input) };
713
738
  // Only encode this event if we haven't already reported this hash
714
739
  if (history$5.indexOf(data$d.hash) < 0) {
715
740
  history$5.push(data$d.hash);
716
- encode$2(41 /* Fraud */);
741
+ encode$2(41 /* Event.Fraud */);
717
742
  }
718
743
  }
719
744
  }
@@ -722,45 +747,45 @@ var TAGS = ["DIV", "TR", "P", "LI", "UL", "A", "BUTTON"];
722
747
  function selector (input, beta) {
723
748
  if (beta === void 0) { beta = false; }
724
749
  var a = input.attributes;
725
- var prefix = input.prefix ? input.prefix[beta ? 1 /* Beta */ : 0 /* Stable */] : null;
726
- var suffix = beta || ((a && !("class" /* Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(" + input.position + ")" : "" /* Empty */;
750
+ var prefix = input.prefix ? input.prefix[beta ? 1 /* Selector.Beta */ : 0 /* Selector.Stable */] : null;
751
+ var suffix = beta || ((a && !("class" /* Constant.Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Constant.Empty */;
727
752
  switch (input.tag) {
728
753
  case "STYLE":
729
754
  case "TITLE":
730
755
  case "LINK":
731
756
  case "META":
732
- case "*T" /* TextTag */:
733
- case "*D" /* DocumentTag */:
734
- return "" /* Empty */;
757
+ case "*T" /* Constant.TextTag */:
758
+ case "*D" /* Constant.DocumentTag */:
759
+ return "" /* Constant.Empty */;
735
760
  case "HTML":
736
- return "HTML" /* HTML */;
761
+ return "HTML" /* Constant.HTML */;
737
762
  default:
738
763
  if (prefix === null) {
739
- return "" /* Empty */;
764
+ return "" /* Constant.Empty */;
740
765
  }
741
- prefix = prefix + ">";
742
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
743
- var selector = "" + prefix + input.tag + suffix;
744
- var classes = "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/) : null;
766
+ prefix = "".concat(prefix, ">");
767
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
768
+ var selector = "".concat(prefix).concat(input.tag).concat(suffix);
769
+ var classes = "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/) : null;
745
770
  if (beta) {
746
771
  // In beta mode, update selector to use "id" field when available. There are two exceptions:
747
772
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
748
773
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
749
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
750
- classes = input.tag !== "BODY" /* BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
751
- selector = classes.length > 0 ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
752
- selector = id && hasDigits(id) === false ? getDomPrefix(prefix) + "#" + id : selector;
774
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
775
+ classes = input.tag !== "BODY" /* Constant.BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
776
+ selector = classes.length > 0 ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
777
+ selector = id && hasDigits(id) === false ? "".concat(getDomPrefix(prefix), "#").concat(id) : selector;
753
778
  }
754
779
  else {
755
780
  // Otherwise, fallback to stable mode, where we include class names as part of the selector
756
- selector = classes ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
781
+ selector = classes ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
757
782
  }
758
783
  return selector;
759
784
  }
760
785
  }
761
786
  function getDomPrefix(prefix) {
762
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
763
- var iframeDomStart = prefix.lastIndexOf("" + "iframe:" /* IFramePrefix */ + "HTML" /* HTML */);
787
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
788
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
764
789
  var domStart = Math.max(shadowDomStart, iframeDomStart);
765
790
  if (domStart < 0) {
766
791
  return "";
@@ -772,7 +797,7 @@ function getDomPrefix(prefix) {
772
797
  function hasDigits(value) {
773
798
  for (var i = 0; i < value.length; i++) {
774
799
  var c = value.charCodeAt(i);
775
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
800
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
776
801
  return true;
777
802
  }
778
803
  }
@@ -809,7 +834,7 @@ function reset$j() {
809
834
  pauseTask = null;
810
835
  }
811
836
  function schedule$1(task, priority) {
812
- if (priority === void 0) { priority = 0 /* Normal */; }
837
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
813
838
  return __awaiter(this, void 0, void 0, function () {
814
839
  var _i, queuedTasks_1, q, promise;
815
840
  return __generator(this, function (_a) {
@@ -821,7 +846,7 @@ function schedule$1(task, priority) {
821
846
  }
822
847
  }
823
848
  promise = new Promise(function (resolve) {
824
- var insert = priority === 1 /* High */ ? "unshift" : "push";
849
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
825
850
  // Queue this task for asynchronous execution later
826
851
  // We also store a unique page identifier (id) along with the task to ensure
827
852
  // ensure that we do not accidentally execute this task in context of a different page
@@ -856,7 +881,7 @@ function run() {
856
881
  return;
857
882
  }
858
883
  if (error) {
859
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
884
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
860
885
  }
861
886
  activeTask = null;
862
887
  run();
@@ -867,13 +892,13 @@ function state$8(timer) {
867
892
  var id = key(timer);
868
893
  if (id in tracker) {
869
894
  var elapsed = performance.now() - tracker[id].start;
870
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
895
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
871
896
  }
872
897
  // If this task is no longer being tracked, send stop message to the caller
873
- return 2 /* Stop */;
898
+ return 2 /* Task.Stop */;
874
899
  }
875
900
  function start$w(timer) {
876
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
901
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
877
902
  }
878
903
  function restart$2(timer) {
879
904
  var id = key(timer);
@@ -890,11 +915,11 @@ function stop$t(timer) {
890
915
  var id = key(timer);
891
916
  var duration = end - tracker[id].start;
892
917
  sum(timer.cost, duration);
893
- count$1(5 /* InvokeCount */);
918
+ count$1(5 /* Metric.InvokeCount */);
894
919
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
895
920
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
896
921
  if (tracker[id].calls > 0) {
897
- sum(4 /* TotalCost */, duration);
922
+ sum(4 /* Metric.TotalCost */, duration);
898
923
  }
899
924
  }
900
925
  function suspend$1(timer) {
@@ -915,13 +940,13 @@ function suspend$1(timer) {
915
940
  case 2:
916
941
  // After we are done with suspending task, ensure that we are still operating in the right context
917
942
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
918
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
943
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
919
944
  }
920
945
  });
921
946
  });
922
947
  }
923
948
  function key(timer) {
924
- return timer.id + "." + timer.cost;
949
+ return "".concat(timer.id, ".").concat(timer.cost);
925
950
  }
926
951
  function wait() {
927
952
  return __awaiter(this, void 0, void 0, function () {
@@ -959,14 +984,14 @@ function requestIdleCallbackPolyfill(callback, options) {
959
984
  var currentTime = performance.now();
960
985
  var elapsed = currentTime - startTime;
961
986
  var duration = currentTime - event.data;
962
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
987
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
963
988
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
964
989
  }
965
990
  else {
966
991
  var didTimeout_1 = elapsed > options.timeout;
967
992
  callback({
968
993
  didTimeout: didTimeout_1,
969
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
994
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
970
995
  });
971
996
  }
972
997
  };
@@ -987,7 +1012,7 @@ function tokenize (tokens) {
987
1012
  var reference = null;
988
1013
  for (var i = 0; i < tokens.length; i++) {
989
1014
  // Only optimize for string values
990
- if (typeof tokens[i] === "string" /* String */) {
1015
+ if (typeof tokens[i] === "string" /* Constant.String */) {
991
1016
  var token = tokens[i];
992
1017
  var index = lookup[token] || -1;
993
1018
  if (index >= 0) {
@@ -1029,10 +1054,10 @@ function encode$4 (type, timer, ts) {
1029
1054
  tokens = [eventTime, type];
1030
1055
  _a = type;
1031
1056
  switch (_a) {
1032
- case 8 /* Document */: return [3 /*break*/, 1];
1033
- case 7 /* Region */: return [3 /*break*/, 2];
1034
- case 5 /* Discover */: return [3 /*break*/, 3];
1035
- case 6 /* Mutation */: return [3 /*break*/, 3];
1057
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1058
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1059
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1060
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1036
1061
  }
1037
1062
  return [3 /*break*/, 10];
1038
1063
  case 1:
@@ -1045,7 +1070,7 @@ function encode$4 (type, timer, ts) {
1045
1070
  case 2:
1046
1071
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1047
1072
  r = _b[_i];
1048
- tokens = [r.time, 7 /* Region */];
1073
+ tokens = [r.time, 7 /* Event.Region */];
1049
1074
  tokens.push(r.data.id);
1050
1075
  tokens.push(r.data.interaction);
1051
1076
  tokens.push(r.data.visibility);
@@ -1056,7 +1081,7 @@ function encode$4 (type, timer, ts) {
1056
1081
  return [3 /*break*/, 10];
1057
1082
  case 3:
1058
1083
  // Check if we are operating within the context of the current page
1059
- if (state$8(timer) === 2 /* Stop */) {
1084
+ if (state$8(timer) === 2 /* Task.Stop */) {
1060
1085
  return [3 /*break*/, 10];
1061
1086
  }
1062
1087
  values = updates$2();
@@ -1067,13 +1092,13 @@ function encode$4 (type, timer, ts) {
1067
1092
  if (!(_c < values_1.length)) return [3 /*break*/, 8];
1068
1093
  value = values_1[_c];
1069
1094
  state = state$8(timer);
1070
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 6];
1095
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1071
1096
  return [4 /*yield*/, suspend$1(timer)];
1072
1097
  case 5:
1073
1098
  state = _e.sent();
1074
1099
  _e.label = 6;
1075
1100
  case 6:
1076
- if (state === 2 /* Stop */) {
1101
+ if (state === 2 /* Task.Stop */) {
1077
1102
  return [3 /*break*/, 8];
1078
1103
  }
1079
1104
  data = value.data;
@@ -1096,9 +1121,9 @@ function encode$4 (type, timer, ts) {
1096
1121
  if (value.previous && active) {
1097
1122
  tokens.push(value.previous);
1098
1123
  }
1099
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1124
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1100
1125
  if (box && box.length === 2) {
1101
- tokens.push("" + "#" /* Box */ + str$1(box[0]) + "." + str$1(box[1]));
1126
+ tokens.push("".concat("#" /* Constant.Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1102
1127
  }
1103
1128
  break;
1104
1129
  case "attributes":
@@ -1120,7 +1145,7 @@ function encode$4 (type, timer, ts) {
1120
1145
  _c++;
1121
1146
  return [3 /*break*/, 4];
1122
1147
  case 8:
1123
- if (type === 6 /* Mutation */) {
1148
+ if (type === 6 /* Event.Mutation */) {
1124
1149
  activity(eventTime);
1125
1150
  }
1126
1151
  queue(tokenize(tokens), !config$1.lean);
@@ -1133,13 +1158,13 @@ function encode$4 (type, timer, ts) {
1133
1158
  }
1134
1159
  function shouldMangle(value) {
1135
1160
  var privacy = value.metadata.privacy;
1136
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1161
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1137
1162
  }
1138
1163
  function size$1(value) {
1139
1164
  if (value.metadata.size !== null && value.metadata.size.length === 0) {
1140
1165
  var img = getNode(value.id);
1141
1166
  if (img) {
1142
- return [Math.floor(img.offsetWidth * 100 /* BoxPrecision */), Math.floor(img.offsetHeight * 100 /* BoxPrecision */)];
1167
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1143
1168
  }
1144
1169
  }
1145
1170
  return value.metadata.size;
@@ -1148,7 +1173,7 @@ function str$1(input) {
1148
1173
  return input.toString(36);
1149
1174
  }
1150
1175
  function attribute(key, value, privacy) {
1151
- return key + "=" + scrub(value, key, privacy);
1176
+ return "".concat(key, "=").concat(scrub(value, key, privacy));
1152
1177
  }
1153
1178
 
1154
1179
  var data$c;
@@ -1179,7 +1204,7 @@ function compute$7() {
1179
1204
  // Check that width or height has changed from before, and also that width & height are not null values
1180
1205
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1181
1206
  data$c = { width: width, height: height };
1182
- encode$4(8 /* Document */);
1207
+ encode$4(8 /* Event.Document */);
1183
1208
  }
1184
1209
  }
1185
1210
  function end() {
@@ -1208,7 +1233,7 @@ function start$u() {
1208
1233
  reset$h();
1209
1234
  }
1210
1235
  function observe$b(root) {
1211
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1236
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1212
1237
  }
1213
1238
  function handler$3(event, root, evt) {
1214
1239
  var frame = iframe(root);
@@ -1234,8 +1259,8 @@ function handler$3(event, root, evt) {
1234
1259
  x = Math.round(l.x + (l.w / 2));
1235
1260
  y = Math.round(l.y + (l.h / 2));
1236
1261
  }
1237
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1238
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1262
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1263
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1239
1264
  // Check for null values before processing this event
1240
1265
  if (x !== null && y !== null) {
1241
1266
  state$7.push({
@@ -1253,7 +1278,7 @@ function handler$3(event, root, evt) {
1253
1278
  text: text(t),
1254
1279
  link: a ? a.href : null,
1255
1280
  hash: null,
1256
- trust: evt.isTrusted ? 1 /* True */ : 0 /* False */
1281
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1257
1282
  }
1258
1283
  });
1259
1284
  schedule$1(encode$3.bind(this, event));
@@ -1268,7 +1293,7 @@ function text(element) {
1268
1293
  // Trim any spaces at the beginning or at the end of string
1269
1294
  // Also, replace multiple occurrence of space characters with a single white space
1270
1295
  // Finally, send only first few characters as specified by the Setting
1271
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1296
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1272
1297
  }
1273
1298
  }
1274
1299
  return output;
@@ -1277,10 +1302,10 @@ function reaction(element) {
1277
1302
  if (element.nodeType === Node.ELEMENT_NODE) {
1278
1303
  var tag = element.tagName.toLowerCase();
1279
1304
  if (UserInputTags.indexOf(tag) >= 0) {
1280
- return 0 /* False */;
1305
+ return 0 /* BooleanFlag.False */;
1281
1306
  }
1282
1307
  }
1283
- return 1 /* True */;
1308
+ return 1 /* BooleanFlag.True */;
1284
1309
  }
1285
1310
  function layout$1(element) {
1286
1311
  var box = null;
@@ -1304,14 +1329,14 @@ function layout$1(element) {
1304
1329
  return box;
1305
1330
  }
1306
1331
  function context(a) {
1307
- if (a && a.hasAttribute("target" /* Target */)) {
1308
- switch (a.getAttribute("target" /* Target */)) {
1309
- case "_blank" /* Blank */: return 1 /* Blank */;
1310
- case "_parent" /* Parent */: return 2 /* Parent */;
1311
- case "_top" /* Top */: return 3 /* Top */;
1332
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1333
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1334
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1335
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1336
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1312
1337
  }
1313
1338
  }
1314
- return 0 /* Self */;
1339
+ return 0 /* BrowsingContext.Self */;
1315
1340
  }
1316
1341
  function reset$h() {
1317
1342
  state$7 = [];
@@ -1325,13 +1350,13 @@ function start$t() {
1325
1350
  reset$g();
1326
1351
  }
1327
1352
  function observe$a(root) {
1328
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1329
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1330
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1353
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1354
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1355
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1331
1356
  }
1332
1357
  function recompute$7(action, evt) {
1333
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1334
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1358
+ state$6.push({ time: time(), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1359
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1335
1360
  }
1336
1361
  function reset$g() {
1337
1362
  state$6 = [];
@@ -1364,9 +1389,9 @@ function recompute$6(evt) {
1364
1389
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1365
1390
  state$5.pop();
1366
1391
  }
1367
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1392
+ state$5.push({ time: time(), event: 27 /* Event.Input */, data: data });
1368
1393
  clearTimeout(timeout$5);
1369
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1394
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, 27 /* Event.Input */);
1370
1395
  }
1371
1396
  }
1372
1397
  function process$6(event) {
@@ -1386,15 +1411,15 @@ function start$r() {
1386
1411
  reset$e();
1387
1412
  }
1388
1413
  function observe$8(root) {
1389
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1390
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1391
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1392
- bind(root, "mousewheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1393
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1394
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1395
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1396
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1397
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1414
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1415
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1416
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1417
+ bind(root, "wheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1418
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1419
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1420
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1421
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1422
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1398
1423
  }
1399
1424
  function mouse(event, root, evt) {
1400
1425
  var frame = iframe(root);
@@ -1433,9 +1458,9 @@ function touch(event, root, evt) {
1433
1458
  }
1434
1459
  function handler$2(current) {
1435
1460
  switch (current.event) {
1436
- case 12 /* MouseMove */:
1437
- case 15 /* MouseWheel */:
1438
- case 19 /* TouchMove */:
1461
+ case 12 /* Event.MouseMove */:
1462
+ case 15 /* Event.MouseWheel */:
1463
+ case 19 /* Event.TouchMove */:
1439
1464
  var length_1 = state$4.length;
1440
1465
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1441
1466
  if (last && similar$1(last, current)) {
@@ -1443,7 +1468,7 @@ function handler$2(current) {
1443
1468
  }
1444
1469
  state$4.push(current);
1445
1470
  clearTimeout(timeout$4);
1446
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1471
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1447
1472
  break;
1448
1473
  default:
1449
1474
  state$4.push(current);
@@ -1463,7 +1488,7 @@ function similar$1(last, current) {
1463
1488
  var distance = Math.sqrt(dx * dx + dy * dy);
1464
1489
  var gap = current.time - last.time;
1465
1490
  var match = current.data.target === last.data.target;
1466
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1491
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1467
1492
  }
1468
1493
  function stop$p() {
1469
1494
  clearTimeout(timeout$4);
@@ -1486,7 +1511,7 @@ function recompute$5() {
1486
1511
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1487
1512
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1488
1513
  };
1489
- encode$3(11 /* Resize */);
1514
+ encode$3(11 /* Event.Resize */);
1490
1515
  }
1491
1516
  function reset$d() {
1492
1517
  data$b = null;
@@ -1522,7 +1547,7 @@ function recompute$4(event) {
1522
1547
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1523
1548
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1524
1549
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1525
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1550
+ var current = { time: time(), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1526
1551
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1527
1552
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1528
1553
  return;
@@ -1534,7 +1559,7 @@ function recompute$4(event) {
1534
1559
  }
1535
1560
  state$3.push(current);
1536
1561
  clearTimeout(timeout$3);
1537
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1562
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1538
1563
  }
1539
1564
  function reset$c() {
1540
1565
  state$3 = [];
@@ -1545,7 +1570,7 @@ function process$4(event) {
1545
1570
  function similar(last, current) {
1546
1571
  var dx = last.data.x - current.data.x;
1547
1572
  var dy = last.data.y - current.data.y;
1548
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1573
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1549
1574
  }
1550
1575
  function stop$n() {
1551
1576
  clearTimeout(timeout$3);
@@ -1580,7 +1605,7 @@ function recompute$3(root) {
1580
1605
  var startNode = data$a.start ? data$a.start : null;
1581
1606
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1582
1607
  clearTimeout(timeout$2);
1583
- process$3(21 /* Selection */);
1608
+ process$3(21 /* Event.Selection */);
1584
1609
  }
1585
1610
  data$a = {
1586
1611
  start: current.anchorNode,
@@ -1590,7 +1615,7 @@ function recompute$3(root) {
1590
1615
  };
1591
1616
  previous = current;
1592
1617
  clearTimeout(timeout$2);
1593
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1618
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1594
1619
  }
1595
1620
  function process$3(event) {
1596
1621
  schedule$1(encode$3.bind(this, event));
@@ -1612,8 +1637,8 @@ function observe$5(root) {
1612
1637
  bind(root, "submit", recompute$2, true);
1613
1638
  }
1614
1639
  function recompute$2(evt) {
1615
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1616
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1640
+ state$2.push({ time: time(), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1641
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1617
1642
  }
1618
1643
  function reset$a() {
1619
1644
  state$2 = [];
@@ -1628,7 +1653,7 @@ function start$m() {
1628
1653
  }
1629
1654
  function recompute$1(evt) {
1630
1655
  data$9 = { name: evt.type };
1631
- encode$3(26 /* Unload */);
1656
+ encode$3(26 /* Event.Unload */);
1632
1657
  stop();
1633
1658
  }
1634
1659
  function reset$9() {
@@ -1645,7 +1670,7 @@ function start$l() {
1645
1670
  }
1646
1671
  function recompute() {
1647
1672
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1648
- encode$3(28 /* Visibility */);
1673
+ encode$3(28 /* Event.Visibility */);
1649
1674
  }
1650
1675
  function reset$8() {
1651
1676
  data$8 = null;
@@ -1707,51 +1732,51 @@ function ld(json) {
1707
1732
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1708
1733
  var key = _a[_i];
1709
1734
  var value = json[key];
1710
- if (key === "@type" /* Type */ && typeof value === "string") {
1735
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1711
1736
  value = value.toLowerCase();
1712
1737
  /* Normalizations */
1713
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1738
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1714
1739
  switch (value) {
1715
- case "article" /* Article */:
1716
- case "recipe" /* Recipe */:
1717
- log(5 /* SchemaType */, json[key]);
1718
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1719
- log(18 /* Headline */, json["headline" /* Headline */]);
1740
+ case "article" /* JsonLD.Article */:
1741
+ case "recipe" /* JsonLD.Recipe */:
1742
+ log(5 /* Dimension.SchemaType */, json[key]);
1743
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1744
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1720
1745
  break;
1721
- case "product" /* Product */:
1722
- log(5 /* SchemaType */, json[key]);
1723
- log(10 /* ProductName */, json["name" /* Name */]);
1724
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1725
- if (json["brand" /* Brand */]) {
1726
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1746
+ case "product" /* JsonLD.Product */:
1747
+ log(5 /* Dimension.SchemaType */, json[key]);
1748
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1749
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1750
+ if (json["brand" /* JsonLD.Brand */]) {
1751
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1727
1752
  }
1728
1753
  break;
1729
- case "aggregaterating" /* AggregateRating */:
1730
- if (json["ratingValue" /* RatingValue */]) {
1731
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1732
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1733
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1754
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1755
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1756
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1757
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1758
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1734
1759
  }
1735
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1736
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1760
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1761
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1737
1762
  break;
1738
- case "person" /* Author */:
1739
- log(8 /* AuthorName */, json["name" /* Name */]);
1763
+ case "person" /* JsonLD.Author */:
1764
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1740
1765
  break;
1741
- case "offer" /* Offer */:
1742
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1743
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1744
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1745
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1746
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1766
+ case "offer" /* JsonLD.Offer */:
1767
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1768
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1769
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1770
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1771
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1747
1772
  break;
1748
- case "brand" /* Brand */:
1749
- log(6 /* ProductBrand */, json["name" /* Name */]);
1773
+ case "brand" /* JsonLD.Brand */:
1774
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1750
1775
  break;
1751
1776
  }
1752
1777
  }
1753
1778
  // Continue parsing nested objects
1754
- if (value !== null && typeof (value) === "object" /* Object */) {
1779
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1755
1780
  ld(value);
1756
1781
  }
1757
1782
  }
@@ -1760,8 +1785,8 @@ function num$1(input, scale) {
1760
1785
  if (scale === void 0) { scale = 1; }
1761
1786
  if (input !== null) {
1762
1787
  switch (typeof input) {
1763
- case "number" /* Number */: return Math.round(input * scale);
1764
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1788
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1789
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1765
1790
  }
1766
1791
  }
1767
1792
  return null;
@@ -1772,11 +1797,11 @@ var newlineRegex = /[\r\n]+/g;
1772
1797
  function processNode (node, source) {
1773
1798
  var child = null;
1774
1799
  // Do not track this change if we are attempting to remove a node before discovering it
1775
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1800
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1776
1801
  return child;
1777
1802
  }
1778
1803
  // Special handling for text nodes that belong to style nodes
1779
- if (source !== 0 /* Discover */ &&
1804
+ if (source !== 0 /* Source.Discover */ &&
1780
1805
  node.nodeType === Node.TEXT_NODE &&
1781
1806
  node.parentElement &&
1782
1807
  node.parentElement.tagName === "STYLE") {
@@ -1789,10 +1814,10 @@ function processNode (node, source) {
1789
1814
  switch (node.nodeType) {
1790
1815
  case Node.DOCUMENT_TYPE_NODE:
1791
1816
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1792
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1817
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1793
1818
  var doctype = node;
1794
1819
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1795
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1820
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1796
1821
  dom[call](node, parent, docData, source);
1797
1822
  break;
1798
1823
  case Node.DOCUMENT_NODE:
@@ -1807,26 +1832,26 @@ function processNode (node, source) {
1807
1832
  if (shadowRoot.host) {
1808
1833
  parse$1(shadowRoot);
1809
1834
  var type = typeof (shadowRoot.constructor);
1810
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1835
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1811
1836
  observe$3(shadowRoot);
1812
1837
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1813
1838
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1814
1839
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1815
1840
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1816
- var style = "" /* Empty */;
1841
+ var style = "" /* Constant.Empty */;
1817
1842
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1818
1843
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1819
1844
  var styleSheet = adoptedStyleSheets_1[_i];
1820
1845
  style += getCssRules(styleSheet);
1821
1846
  }
1822
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1847
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1823
1848
  dom[call](node, shadowRoot.host, fragementData, source);
1824
1849
  }
1825
1850
  else {
1826
1851
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1827
1852
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1828
1853
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1829
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1854
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1830
1855
  }
1831
1856
  }
1832
1857
  break;
@@ -1839,7 +1864,7 @@ function processNode (node, source) {
1839
1864
  // The only exception is when we receive a mutation to remove the text node, in that case
1840
1865
  // parent will be null, but we can still process the node by checking it's an update call.
1841
1866
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1842
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1867
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1843
1868
  dom[call](node, parent, textData, source);
1844
1869
  }
1845
1870
  break;
@@ -1851,20 +1876,20 @@ function processNode (node, source) {
1851
1876
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1852
1877
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1853
1878
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1854
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1855
- tag = "svg:" /* SvgPrefix */ + tag;
1879
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1880
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1856
1881
  }
1857
1882
  switch (tag) {
1858
1883
  case "HTML":
1859
1884
  parent = insideFrame && parent ? iframe(parent) : null;
1860
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1885
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1861
1886
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1862
1887
  dom[call](node, parent, htmlData, source);
1863
1888
  break;
1864
1889
  case "SCRIPT":
1865
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1890
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1866
1891
  try {
1867
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1892
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1868
1893
  }
1869
1894
  catch ( /* do nothing */_a) { /* do nothing */ }
1870
1895
  }
@@ -1872,20 +1897,20 @@ function processNode (node, source) {
1872
1897
  case "NOSCRIPT":
1873
1898
  break;
1874
1899
  case "META":
1875
- var key = ("property" /* Property */ in attributes ?
1876
- "property" /* Property */ :
1877
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1878
- if (key && "content" /* Content */ in attributes) {
1879
- var content = attributes["content" /* Content */];
1900
+ var key = ("property" /* Constant.Property */ in attributes ?
1901
+ "property" /* Constant.Property */ :
1902
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1903
+ if (key && "content" /* Constant.Content */ in attributes) {
1904
+ var content = attributes["content" /* Constant.Content */];
1880
1905
  switch (attributes[key]) {
1881
- case "og:title" /* ogTitle */:
1882
- log(20 /* MetaTitle */, content);
1906
+ case "og:title" /* Constant.ogTitle */:
1907
+ log(20 /* Dimension.MetaTitle */, content);
1883
1908
  break;
1884
- case "og:type" /* ogType */:
1885
- log(19 /* MetaType */, content);
1909
+ case "og:type" /* Constant.ogType */:
1910
+ log(19 /* Dimension.MetaType */, content);
1886
1911
  break;
1887
- case "generator" /* Generator */:
1888
- log(21 /* Generator */, content);
1912
+ case "generator" /* Constant.Generator */:
1913
+ log(21 /* Dimension.Generator */, content);
1889
1914
  break;
1890
1915
  }
1891
1916
  }
@@ -1893,7 +1918,7 @@ function processNode (node, source) {
1893
1918
  case "HEAD":
1894
1919
  var head = { tag: tag, attributes: attributes };
1895
1920
  if (location) {
1896
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1921
+ head.attributes["*B" /* Constant.Base */] = location.protocol + "//" + location.hostname;
1897
1922
  }
1898
1923
  dom[call](node, parent, head, source);
1899
1924
  break;
@@ -1906,7 +1931,7 @@ function processNode (node, source) {
1906
1931
  var frameData = { tag: tag, attributes: attributes };
1907
1932
  if (sameorigin(iframe$1)) {
1908
1933
  monitor(iframe$1);
1909
- frameData.attributes["*O" /* SameOrigin */] = "true";
1934
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1910
1935
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1911
1936
  child = iframe$1.contentDocument;
1912
1937
  }
@@ -1935,7 +1960,7 @@ function observe$3(root) {
1935
1960
  function getStyleValue(style) {
1936
1961
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
1937
1962
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
1938
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
1963
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
1939
1964
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
1940
1965
  if (value.length === 0 || dataset > 0) {
1941
1966
  value = getCssRules(style.sheet);
@@ -1943,14 +1968,14 @@ function getStyleValue(style) {
1943
1968
  return value;
1944
1969
  }
1945
1970
  function getCssRules(sheet) {
1946
- var value = "" /* Empty */;
1971
+ var value = "" /* Constant.Empty */;
1947
1972
  var cssRules = null;
1948
1973
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
1949
1974
  try {
1950
1975
  cssRules = sheet ? sheet.cssRules : [];
1951
1976
  }
1952
1977
  catch (e) {
1953
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
1978
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
1954
1979
  if (e && e.name !== "SecurityError") {
1955
1980
  throw e;
1956
1981
  }
@@ -1974,8 +1999,8 @@ function getAttributes(element) {
1974
1999
  }
1975
2000
  }
1976
2001
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
1977
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
1978
- output["value" /* Value */] = element.value;
2002
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
2003
+ output["value" /* Constant.Value */] = element.value;
1979
2004
  }
1980
2005
  return output;
1981
2006
  }
@@ -1997,13 +2022,13 @@ function traverse (root, timer, source) {
1997
2022
  next = next.nextSibling;
1998
2023
  }
1999
2024
  state = state$8(timer);
2000
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
2025
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2001
2026
  return [4 /*yield*/, suspend$1(timer)];
2002
2027
  case 2:
2003
2028
  state = _a.sent();
2004
2029
  _a.label = 3;
2005
2030
  case 3:
2006
- if (state === 2 /* Stop */) {
2031
+ if (state === 2 /* Task.Stop */) {
2007
2032
  return [3 /*break*/, 4];
2008
2033
  }
2009
2034
  subnode = processNode(node, source);
@@ -2080,7 +2105,7 @@ function observe$2(node) {
2080
2105
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2081
2106
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2082
2107
  try {
2083
- var m = api("MutationObserver" /* MutationObserver */);
2108
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2084
2109
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2085
2110
  if (observer) {
2086
2111
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2088,7 +2113,7 @@ function observe$2(node) {
2088
2113
  }
2089
2114
  }
2090
2115
  catch (e) {
2091
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2116
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2092
2117
  }
2093
2118
  }
2094
2119
  function monitor(frame) {
@@ -2096,7 +2121,7 @@ function monitor(frame) {
2096
2121
  // This includes cases where iframe location is updated without explicitly updating src attribute
2097
2122
  // E.g. iframe.contentWindow.location.href = "new-location";
2098
2123
  if (has(frame) === false) {
2099
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2124
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2100
2125
  }
2101
2126
  }
2102
2127
  function stop$h() {
@@ -2114,14 +2139,14 @@ function stop$h() {
2114
2139
  timeout$1 = null;
2115
2140
  }
2116
2141
  function active$2() {
2117
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2142
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2118
2143
  }
2119
2144
  function handle$1(m) {
2120
2145
  // Queue up mutation records for asynchronous processing
2121
2146
  var now = time();
2122
- track$6(6 /* Mutation */, now);
2147
+ track$6(6 /* Event.Mutation */, now);
2123
2148
  mutations.push({ time: now, mutations: m });
2124
- schedule$1(process$2, 1 /* High */).then(function () {
2149
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2125
2150
  setTimeout(compute$7);
2126
2151
  measure(compute$6)();
2127
2152
  });
@@ -2132,7 +2157,7 @@ function process$2() {
2132
2157
  return __generator(this, function (_b) {
2133
2158
  switch (_b.label) {
2134
2159
  case 0:
2135
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2160
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2136
2161
  start$w(timer);
2137
2162
  _b.label = 1;
2138
2163
  case 1:
@@ -2144,13 +2169,13 @@ function process$2() {
2144
2169
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2145
2170
  mutation = _a[_i];
2146
2171
  state = state$8(timer);
2147
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2172
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2148
2173
  return [4 /*yield*/, suspend$1(timer)];
2149
2174
  case 3:
2150
2175
  state = _b.sent();
2151
2176
  _b.label = 4;
2152
2177
  case 4:
2153
- if (state === 2 /* Stop */) {
2178
+ if (state === 2 /* Task.Stop */) {
2154
2179
  return [3 /*break*/, 6];
2155
2180
  }
2156
2181
  target = mutation.target;
@@ -2162,17 +2187,17 @@ function process$2() {
2162
2187
  parse$1(target);
2163
2188
  }
2164
2189
  switch (type) {
2165
- case "attributes" /* Attributes */:
2166
- processNode(target, 3 /* Attributes */);
2190
+ case "attributes" /* Constant.Attributes */:
2191
+ processNode(target, 3 /* Source.Attributes */);
2167
2192
  break;
2168
- case "characterData" /* CharacterData */:
2169
- processNode(target, 4 /* CharacterData */);
2193
+ case "characterData" /* Constant.CharacterData */:
2194
+ processNode(target, 4 /* Source.CharacterData */);
2170
2195
  break;
2171
- case "childList" /* ChildList */:
2172
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2173
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2196
+ case "childList" /* Constant.ChildList */:
2197
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2198
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2174
2199
  break;
2175
- case "suspend" /* Suspend */:
2200
+ case "suspend" /* Constant.Suspend */:
2176
2201
  value = get(target);
2177
2202
  if (value) {
2178
2203
  value.metadata.suspend = true;
@@ -2183,7 +2208,7 @@ function process$2() {
2183
2208
  case 5:
2184
2209
  _i++;
2185
2210
  return [3 /*break*/, 2];
2186
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2211
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2187
2212
  case 7:
2188
2213
  _b.sent();
2189
2214
  return [3 /*break*/, 1];
@@ -2197,11 +2222,11 @@ function process$2() {
2197
2222
  function track$5(m, timer) {
2198
2223
  var value = m.target ? get(m.target.parentNode) : null;
2199
2224
  // Check if the parent is already discovered and that the parent is not the document root
2200
- if (value && value.data.tag !== "HTML" /* HTML */) {
2225
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2201
2226
  var inactive = time() > activePeriod;
2202
2227
  var target = get(m.target);
2203
2228
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2204
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2229
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2205
2230
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2206
2231
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2207
2232
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2210,20 +2235,20 @@ function track$5(m, timer) {
2210
2235
  history$4[key] = key in history$4 ? history$4[key] : [0];
2211
2236
  var h = history$4[key];
2212
2237
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2213
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2214
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2238
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2239
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2215
2240
  }
2216
2241
  // Update the counter
2217
2242
  h[0] = inactive ? h[0] + 1 : 1;
2218
2243
  // Return updated mutation type based on if we have already hit the threshold or not
2219
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2244
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2220
2245
  // Store a reference to removedNodes so we can process them later
2221
2246
  // when we resume mutations again on user interactions
2222
2247
  h[1] = m.removedNodes;
2223
- return "suspend" /* Suspend */;
2248
+ return "suspend" /* Constant.Suspend */;
2224
2249
  }
2225
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2226
- return "" /* Empty */;
2250
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2251
+ return "" /* Constant.Empty */;
2227
2252
  }
2228
2253
  }
2229
2254
  return m.type;
@@ -2246,18 +2271,18 @@ function processNodeList(list, source, timer) {
2246
2271
  _a.label = 1;
2247
2272
  case 1:
2248
2273
  if (!(i < length)) return [3 /*break*/, 6];
2249
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2274
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2250
2275
  traverse(list[i], timer, source);
2251
2276
  return [3 /*break*/, 5];
2252
2277
  case 2:
2253
2278
  state = state$8(timer);
2254
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2279
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2255
2280
  return [4 /*yield*/, suspend$1(timer)];
2256
2281
  case 3:
2257
2282
  state = _a.sent();
2258
2283
  _a.label = 4;
2259
2284
  case 4:
2260
- if (state === 2 /* Stop */) {
2285
+ if (state === 2 /* Task.Stop */) {
2261
2286
  return [3 /*break*/, 6];
2262
2287
  }
2263
2288
  processNode(list[i], source);
@@ -2282,7 +2307,7 @@ function schedule(node, fragment) {
2282
2307
  if (timeout$1) {
2283
2308
  clearTimeout(timeout$1);
2284
2309
  }
2285
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2310
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2286
2311
  return node;
2287
2312
  }
2288
2313
  function trigger$1(fragment) {
@@ -2295,7 +2320,7 @@ function trigger$1(fragment) {
2295
2320
  if (shadowRoot && has(node)) {
2296
2321
  continue;
2297
2322
  }
2298
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2323
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2299
2324
  }
2300
2325
  }
2301
2326
  queue$2 = [];
@@ -2323,6 +2348,7 @@ var override = [];
2323
2348
  var unmask = [];
2324
2349
  var updatedFragments = {};
2325
2350
  var maskText = [];
2351
+ var maskInput = [];
2326
2352
  var maskDisable = [];
2327
2353
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2328
2354
  var idMap = null; // Maps node => id.
@@ -2344,8 +2370,9 @@ function reset$7() {
2344
2370
  hashMap = {};
2345
2371
  override = [];
2346
2372
  unmask = [];
2347
- 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 */);
2348
- maskDisable = "radio,checkbox,range,button,reset,submit" /* Disable */.split("," /* Comma */);
2373
+ maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
2374
+ 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 */);
2375
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2349
2376
  idMap = new WeakMap();
2350
2377
  iframeMap = new WeakMap();
2351
2378
  privacyMap = new WeakMap();
@@ -2360,19 +2387,19 @@ function parse$1(root, init) {
2360
2387
  try {
2361
2388
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2362
2389
  if (init) {
2363
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2390
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2364
2391
  }
2365
2392
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2366
2393
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2367
2394
  if ("querySelectorAll" in root) {
2368
- config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "" + x[0]); }); }); // Regions
2369
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2395
+ config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
2396
+ config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
2370
2397
  config$1.fraud.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Check
2371
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2398
+ unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
2372
2399
  }
2373
2400
  }
2374
2401
  catch (e) {
2375
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2402
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2376
2403
  }
2377
2404
  }
2378
2405
  function getId(node, autogen) {
@@ -2395,17 +2422,18 @@ function add(node, parent, data, source) {
2395
2422
  var regionId = exists(node) ? id : null;
2396
2423
  var fragmentId = null;
2397
2424
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2398
- var privacyId = config$1.content ? 1 /* Sensitive */ : 2 /* Text */;
2425
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 2 /* Privacy.Text */;
2399
2426
  if (parentId >= 0 && values[parentId]) {
2400
2427
  parentValue = values[parentId];
2401
2428
  parentValue.children.push(id);
2402
2429
  regionId = regionId === null ? parentValue.region : regionId;
2403
2430
  fragmentId = parentValue.fragment;
2404
2431
  fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
2432
+ privacyId = parentValue.metadata.privacy;
2405
2433
  }
2406
2434
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2407
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2408
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2435
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2436
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2409
2437
  regionId = id;
2410
2438
  }
2411
2439
  nodes[id] = node;
@@ -2483,7 +2511,7 @@ function update$1(node, parent, data, source) {
2483
2511
  }
2484
2512
  function sameorigin(node) {
2485
2513
  var output = false;
2486
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2514
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2487
2515
  var frame = node;
2488
2516
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2489
2517
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2510,11 +2538,11 @@ function privacy(node, value, parent) {
2510
2538
  var attributes = data.attributes || {};
2511
2539
  var tag = data.tag.toUpperCase();
2512
2540
  switch (true) {
2513
- case "data-clarity-mask" /* MaskData */ in attributes:
2514
- metadata.privacy = 3 /* TextImage */;
2541
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2542
+ metadata.privacy = 3 /* Privacy.TextImage */;
2515
2543
  break;
2516
- case "data-clarity-unmask" /* UnmaskData */ in attributes:
2517
- metadata.privacy = 0 /* None */;
2544
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2545
+ metadata.privacy = 0 /* Privacy.None */;
2518
2546
  break;
2519
2547
  case privacyMap.has(node):
2520
2548
  // If this node was explicitly configured to contain sensitive content, honor that privacy setting
@@ -2522,40 +2550,39 @@ function privacy(node, value, parent) {
2522
2550
  break;
2523
2551
  case fraudMap.has(node):
2524
2552
  // If this node was explicitly configured to be evaluated for fraud, then also mask content
2525
- metadata.privacy = 2 /* Text */;
2553
+ metadata.privacy = 2 /* Privacy.Text */;
2526
2554
  break;
2527
- case tag === "*T" /* TextTag */:
2555
+ case tag === "*T" /* Constant.TextTag */:
2528
2556
  // If it's a text node belonging to a STYLE or TITLE tag or one of SCRUB_EXCEPTIONS, then capture content
2529
- var pTag = parent && parent.data ? parent.data.tag : "" /* Empty */;
2530
- var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Stable */] : "" /* Empty */;
2531
- metadata.privacy = pTag === "STYLE" /* StyleTag */ || pTag === "TITLE" /* TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* None */ : current;
2557
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2558
+ var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Selector.Stable */] : "" /* Constant.Empty */;
2559
+ metadata.privacy = pTag === "STYLE" /* Constant.StyleTag */ || pTag === "TITLE" /* Constant.TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2532
2560
  break;
2533
- case "type" /* Type */ in attributes:
2561
+ case "type" /* Constant.Type */ in attributes:
2534
2562
  // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2535
- metadata.privacy = inspect(attributes["type" /* Type */], metadata);
2563
+ metadata.privacy = inspect(attributes["type" /* Constant.Type */], maskInput, metadata);
2536
2564
  break;
2537
- case tag === "INPUT" /* InputTag */ && current === 0 /* None */:
2565
+ case tag === "INPUT" /* Constant.InputTag */ && current === 0 /* Privacy.None */:
2538
2566
  // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2539
- var field_1 = "" /* Empty */;
2567
+ var field_1 = "" /* Constant.Empty */;
2540
2568
  Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2541
- metadata.privacy = inspect(field_1, metadata);
2569
+ metadata.privacy = inspect(field_1, maskInput, metadata);
2542
2570
  break;
2543
- case current === 1 /* Sensitive */ && tag === "INPUT" /* InputTag */:
2571
+ case current === 1 /* Privacy.Sensitive */ && tag === "INPUT" /* Constant.InputTag */:
2572
+ // Look through class names to aggressively mask content
2573
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2544
2574
  // If it's a button or an input option, make an exception to disable masking
2545
- metadata.privacy = maskDisable.indexOf(attributes["type" /* Type */]) >= 0 ? 0 /* None */ : current;
2575
+ metadata.privacy = maskDisable.indexOf(attributes["type" /* Constant.Type */]) >= 0 ? 0 /* Privacy.None */ : current;
2546
2576
  break;
2547
- case current === 1 /* Sensitive */:
2577
+ case current === 1 /* Privacy.Sensitive */:
2548
2578
  // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2549
- metadata.privacy = inspect(attributes["class" /* Class */], metadata);
2550
- break;
2551
- default:
2552
- metadata.privacy = parent ? parent.metadata.privacy : metadata.privacy;
2579
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2553
2580
  break;
2554
2581
  }
2555
2582
  }
2556
- function inspect(input, metadata) {
2557
- if (input && maskText.some(function (x) { return input.indexOf(x) >= 0; })) {
2558
- return 2 /* Text */;
2583
+ function inspect(input, lookup, metadata) {
2584
+ if (input && lookup.some(function (x) { return input.indexOf(x) >= 0; })) {
2585
+ return 2 /* Privacy.Text */;
2559
2586
  }
2560
2587
  return metadata.privacy;
2561
2588
  }
@@ -2647,7 +2674,7 @@ function remove(id, source) {
2647
2674
  }
2648
2675
  function size(value) {
2649
2676
  // If this element is a image node, and is masked, then track box model for the current element
2650
- if (value.data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2677
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2651
2678
  value.metadata.size = [];
2652
2679
  }
2653
2680
  }
@@ -2682,7 +2709,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2682
2709
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2683
2710
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2684
2711
  var uIndex = updateMap.indexOf(id);
2685
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2712
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2686
2713
  updateMap.splice(uIndex, 1);
2687
2714
  updateMap.push(id);
2688
2715
  }
@@ -2728,15 +2755,15 @@ function exists(node) {
2728
2755
  }
2729
2756
  function track$3(id, event) {
2730
2757
  var node = getNode(id);
2731
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2758
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2732
2759
  // Determine the interaction state based on incoming event
2733
- var interaction = 16 /* None */;
2760
+ var interaction = 16 /* InteractionState.None */;
2734
2761
  switch (event) {
2735
- case 9 /* Click */:
2736
- interaction = 20 /* Clicked */;
2762
+ case 9 /* Event.Click */:
2763
+ interaction = 20 /* InteractionState.Clicked */;
2737
2764
  break;
2738
- case 27 /* Input */:
2739
- interaction = 30 /* Input */;
2765
+ case 27 /* Event.Input */:
2766
+ interaction = 30 /* InteractionState.Input */;
2740
2767
  break;
2741
2768
  }
2742
2769
  // Process updates to this region, if applicable
@@ -2764,7 +2791,7 @@ function compute$6() {
2764
2791
  queue$1 = q;
2765
2792
  // Schedule encode only when we have at least one valid data entry
2766
2793
  if (state$1.length > 0) {
2767
- encode$4(7 /* Region */);
2794
+ encode$4(7 /* Event.Region */);
2768
2795
  }
2769
2796
  }
2770
2797
  function handler$1(entries) {
@@ -2780,27 +2807,27 @@ function handler$1(entries) {
2780
2807
  // 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
2781
2808
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2782
2809
  var id = target ? getId(target) : null;
2783
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2810
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2784
2811
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2785
2812
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2786
2813
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2787
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2814
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2788
2815
  // If an element is either visible or was visible and has been scrolled to the end
2789
2816
  // 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.
2790
2817
  // 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
2791
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2818
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2792
2819
  // Process updates to this region, if applicable
2793
2820
  process$1(target, data, data.interaction, (scrolledToEnd ?
2794
- 13 /* ScrolledToEnd */ :
2795
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2821
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2822
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2796
2823
  // Stop observing this element now that we have already received scrolled signal
2797
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2824
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2798
2825
  observer$1.unobserve(target);
2799
2826
  }
2800
2827
  }
2801
2828
  }
2802
2829
  if (state$1.length > 0) {
2803
- encode$4(7 /* Region */);
2830
+ encode$4(7 /* Event.Region */);
2804
2831
  }
2805
2832
  }
2806
2833
  function process$1(n, d, s, v) {
@@ -2859,7 +2886,7 @@ function link(node) {
2859
2886
  function metadata$2(node, event, text) {
2860
2887
  if (text === void 0) { text = null; }
2861
2888
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2862
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2889
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2863
2890
  if (node) {
2864
2891
  var value = get(node);
2865
2892
  if (value !== null) {
@@ -2885,15 +2912,15 @@ function encode$3 (type) {
2885
2912
  t = time();
2886
2913
  tokens = [t, type];
2887
2914
  switch (type) {
2888
- case 13 /* MouseDown */:
2889
- case 14 /* MouseUp */:
2890
- case 12 /* MouseMove */:
2891
- case 15 /* MouseWheel */:
2892
- case 16 /* DoubleClick */:
2893
- case 17 /* TouchStart */:
2894
- case 18 /* TouchEnd */:
2895
- case 19 /* TouchMove */:
2896
- case 20 /* TouchCancel */:
2915
+ case 13 /* Event.MouseDown */:
2916
+ case 14 /* Event.MouseUp */:
2917
+ case 12 /* Event.MouseMove */:
2918
+ case 15 /* Event.MouseWheel */:
2919
+ case 16 /* Event.DoubleClick */:
2920
+ case 17 /* Event.TouchStart */:
2921
+ case 18 /* Event.TouchEnd */:
2922
+ case 19 /* Event.TouchMove */:
2923
+ case 20 /* Event.TouchCancel */:
2897
2924
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2898
2925
  entry = _a[_i];
2899
2926
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2908,12 +2935,12 @@ function encode$3 (type) {
2908
2935
  }
2909
2936
  reset$e();
2910
2937
  break;
2911
- case 9 /* Click */:
2938
+ case 9 /* Event.Click */:
2912
2939
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2913
2940
  entry = _c[_b];
2914
2941
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2915
2942
  tokens = [entry.time, entry.event];
2916
- cHash = cTarget.hash.join("." /* Dot */);
2943
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
2917
2944
  tokens.push(cTarget.id);
2918
2945
  tokens.push(entry.data.x);
2919
2946
  tokens.push(entry.data.y);
@@ -2931,7 +2958,7 @@ function encode$3 (type) {
2931
2958
  }
2932
2959
  reset$h();
2933
2960
  break;
2934
- case 38 /* Clipboard */:
2961
+ case 38 /* Event.Clipboard */:
2935
2962
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
2936
2963
  entry = _e[_d];
2937
2964
  tokens = [entry.time, entry.event];
@@ -2944,7 +2971,7 @@ function encode$3 (type) {
2944
2971
  }
2945
2972
  reset$g();
2946
2973
  break;
2947
- case 11 /* Resize */:
2974
+ case 11 /* Event.Resize */:
2948
2975
  r = data$b;
2949
2976
  tokens.push(r.width);
2950
2977
  tokens.push(r.height);
@@ -2952,13 +2979,13 @@ function encode$3 (type) {
2952
2979
  reset$d();
2953
2980
  queue(tokens);
2954
2981
  break;
2955
- case 26 /* Unload */:
2982
+ case 26 /* Event.Unload */:
2956
2983
  u = data$9;
2957
2984
  tokens.push(u.name);
2958
2985
  reset$9();
2959
2986
  queue(tokens);
2960
2987
  break;
2961
- case 27 /* Input */:
2988
+ case 27 /* Event.Input */:
2962
2989
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
2963
2990
  entry = _g[_f];
2964
2991
  iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
@@ -2969,7 +2996,7 @@ function encode$3 (type) {
2969
2996
  }
2970
2997
  reset$f();
2971
2998
  break;
2972
- case 21 /* Selection */:
2999
+ case 21 /* Event.Selection */:
2973
3000
  s = data$a;
2974
3001
  if (s) {
2975
3002
  startTarget = metadata$2(s.start, type);
@@ -2982,7 +3009,7 @@ function encode$3 (type) {
2982
3009
  queue(tokens);
2983
3010
  }
2984
3011
  break;
2985
- case 10 /* Scroll */:
3012
+ case 10 /* Event.Scroll */:
2986
3013
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
2987
3014
  entry = _j[_h];
2988
3015
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -2997,7 +3024,7 @@ function encode$3 (type) {
2997
3024
  }
2998
3025
  reset$c();
2999
3026
  break;
3000
- case 39 /* Submit */:
3027
+ case 39 /* Event.Submit */:
3001
3028
  for (_k = 0, _l = state$2; _k < _l.length; _k++) {
3002
3029
  entry = _l[_k];
3003
3030
  tokens = [entry.time, entry.event];
@@ -3009,7 +3036,7 @@ function encode$3 (type) {
3009
3036
  }
3010
3037
  reset$a();
3011
3038
  break;
3012
- case 22 /* Timeline */:
3039
+ case 22 /* Event.Timeline */:
3013
3040
  for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3014
3041
  entry = _o[_m];
3015
3042
  tokens = [entry.time, entry.event];
@@ -3023,7 +3050,7 @@ function encode$3 (type) {
3023
3050
  }
3024
3051
  reset$5();
3025
3052
  break;
3026
- case 28 /* Visibility */:
3053
+ case 28 /* Event.Visibility */:
3027
3054
  v = data$8;
3028
3055
  tokens.push(v.visible);
3029
3056
  queue(tokens);
@@ -3046,11 +3073,11 @@ function reset$5() {
3046
3073
  updates$1 = [];
3047
3074
  }
3048
3075
  function track$2(time, event, hash, x, y, reaction, context) {
3049
- if (reaction === void 0) { reaction = 1 /* True */; }
3050
- if (context === void 0) { context = 0 /* Self */; }
3076
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3077
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3051
3078
  state.push({
3052
3079
  time: time,
3053
- event: 22 /* Timeline */,
3080
+ event: 22 /* Event.Timeline */,
3054
3081
  data: {
3055
3082
  type: event,
3056
3083
  hash: hash,
@@ -3069,7 +3096,7 @@ function compute$5() {
3069
3096
  var temp = [];
3070
3097
  updates$1 = [];
3071
3098
  var max = data$1.start + data$1.duration;
3072
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3099
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3073
3100
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3074
3101
  var s = state_1[_i];
3075
3102
  if (s.time >= min) {
@@ -3080,7 +3107,7 @@ function compute$5() {
3080
3107
  }
3081
3108
  }
3082
3109
  state = temp; // Drop events less than the min time
3083
- encode$3(22 /* Timeline */);
3110
+ encode$3(22 /* Event.Timeline */);
3084
3111
  }
3085
3112
  function stop$e() {
3086
3113
  state = [];
@@ -3113,10 +3140,10 @@ function queue(tokens, transmit) {
3113
3140
  var type = tokens.length > 1 ? tokens[1] : null;
3114
3141
  var event_1 = JSON.stringify(tokens);
3115
3142
  switch (type) {
3116
- case 5 /* Discover */:
3143
+ case 5 /* Event.Discover */:
3117
3144
  discoverBytes += event_1.length;
3118
- case 37 /* Box */:
3119
- case 6 /* Mutation */:
3145
+ case 37 /* Event.Box */:
3146
+ case 6 /* Event.Mutation */:
3120
3147
  playbackBytes += event_1.length;
3121
3148
  playback.push(event_1);
3122
3149
  break;
@@ -3125,7 +3152,7 @@ function queue(tokens, transmit) {
3125
3152
  break;
3126
3153
  }
3127
3154
  // Increment event count metric
3128
- count$1(25 /* EventCount */);
3155
+ count$1(25 /* Metric.EventCount */);
3129
3156
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3130
3157
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3131
3158
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3138,7 +3165,7 @@ function queue(tokens, transmit) {
3138
3165
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3139
3166
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3140
3167
  if (transmit && timeout === null) {
3141
- if (type !== 25 /* Ping */) {
3168
+ if (type !== 25 /* Event.Ping */) {
3142
3169
  reset$m();
3143
3170
  }
3144
3171
  timeout = setTimeout(upload, gap);
@@ -3167,9 +3194,9 @@ function upload(final) {
3167
3194
  switch (_b.label) {
3168
3195
  case 0:
3169
3196
  timeout = null;
3170
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3197
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3171
3198
  if (sendPlaybackBytes) {
3172
- max(1 /* Playback */, 1 /* True */);
3199
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3173
3200
  }
3174
3201
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3175
3202
  // Otherwise you run a risk of infinite loop.
@@ -3178,8 +3205,8 @@ function upload(final) {
3178
3205
  compute$8();
3179
3206
  last = final === true;
3180
3207
  e = JSON.stringify(envelope(last));
3181
- a = "[" + analysis.join() + "]";
3182
- p = sendPlaybackBytes ? "[" + playback.join() + "]" : "" /* Empty */;
3208
+ a = "[".concat(analysis.join(), "]");
3209
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3183
3210
  encoded = { e: e, a: a, p: p };
3184
3211
  payload = stringify(encoded);
3185
3212
  if (!last) return [3 /*break*/, 1];
@@ -3191,7 +3218,7 @@ function upload(final) {
3191
3218
  _b.label = 3;
3192
3219
  case 3:
3193
3220
  zipped = _a;
3194
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3221
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3195
3222
  send(payload, zipped, data$1.sequence, last);
3196
3223
  // Clear out events now that payload has been dispatched
3197
3224
  analysis = [];
@@ -3206,12 +3233,12 @@ function upload(final) {
3206
3233
  });
3207
3234
  }
3208
3235
  function stringify(encoded) {
3209
- return encoded.p.length > 0 ? "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + ",\"p\":" + encoded.p + "}" : "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + "}";
3236
+ 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, "}");
3210
3237
  }
3211
3238
  function send(payload, zipped, sequence, beacon) {
3212
3239
  if (beacon === void 0) { beacon = false; }
3213
3240
  // Upload data if a valid URL is defined in the config
3214
- if (typeof config$1.upload === "string" /* String */) {
3241
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3215
3242
  var url = config$1.upload;
3216
3243
  var dispatched = false;
3217
3244
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3250,7 +3277,7 @@ function send(payload, zipped, sequence, beacon) {
3250
3277
  xhr_1.withCredentials = true;
3251
3278
  if (zipped) {
3252
3279
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3253
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3280
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3254
3281
  xhr_1.send(zipped);
3255
3282
  }
3256
3283
  else {
@@ -3267,13 +3294,13 @@ function send(payload, zipped, sequence, beacon) {
3267
3294
  }
3268
3295
  function check$3(xhr, sequence) {
3269
3296
  var transitData = transit[sequence];
3270
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3297
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3271
3298
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3272
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3299
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3273
3300
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3274
3301
  if (xhr.status >= 400 && xhr.status < 500) {
3275
3302
  // In case of a 4XX response from the server, we bail out instead of trying again
3276
- trigger(6 /* Server */);
3303
+ trigger(6 /* Check.Server */);
3277
3304
  }
3278
3305
  else {
3279
3306
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3294,7 +3321,7 @@ function check$3(xhr, sequence) {
3294
3321
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3295
3322
  // Send back an event only if we were not successful in our first attempt
3296
3323
  if (transitData.attempts > 1) {
3297
- encode$1(2 /* Upload */);
3324
+ encode$1(2 /* Event.Upload */);
3298
3325
  }
3299
3326
  // Handle response if it was a 200 response with a valid body
3300
3327
  if (xhr.status === 200 && xhr.responseText) {
@@ -3305,7 +3332,7 @@ function check$3(xhr, sequence) {
3305
3332
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3306
3333
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3307
3334
  send(transitData.data, null, sequence, true);
3308
- trigger(3 /* Retry */);
3335
+ trigger(3 /* Check.Retry */);
3309
3336
  }
3310
3337
  // Signal that this request completed successfully
3311
3338
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3325,19 +3352,19 @@ function done(sequence) {
3325
3352
  function delay() {
3326
3353
  // Progressively increase delay as we continue to send more payloads from the client to the server
3327
3354
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3328
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3329
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3355
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3356
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3330
3357
  }
3331
3358
  function response(payload) {
3332
- var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Empty */;
3359
+ var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Constant.Empty */;
3333
3360
  switch (key) {
3334
- case "END" /* End */:
3361
+ case "END" /* Constant.End */:
3335
3362
  // Clear out session storage and end the session so we can start fresh the next time
3336
- trigger(6 /* Server */);
3363
+ trigger(6 /* Check.Server */);
3337
3364
  break;
3338
- case "UPGRADE" /* Upgrade */:
3365
+ case "UPGRADE" /* Constant.Upgrade */:
3339
3366
  // Upgrade current session to send back playback information
3340
- upgrade("Auto" /* Auto */);
3367
+ upgrade("Auto" /* Constant.Auto */);
3341
3368
  break;
3342
3369
  }
3343
3370
  }
@@ -3355,7 +3382,7 @@ function handler(error) {
3355
3382
  if (!(e.message in history$3)) {
3356
3383
  history$3[e.message] = 0;
3357
3384
  }
3358
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3385
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3359
3386
  return true;
3360
3387
  }
3361
3388
  // Send back information only if the handled error has valid information
@@ -3367,7 +3394,7 @@ function handler(error) {
3367
3394
  stack: e.stack,
3368
3395
  source: error["filename"]
3369
3396
  };
3370
- encode$2(31 /* ScriptError */);
3397
+ encode$2(31 /* Event.ScriptError */);
3371
3398
  }
3372
3399
  return true;
3373
3400
  }
@@ -3378,7 +3405,7 @@ function encode$2 (type) {
3378
3405
  return __generator(this, function (_a) {
3379
3406
  tokens = [time(), type];
3380
3407
  switch (type) {
3381
- case 31 /* ScriptError */:
3408
+ case 31 /* Event.ScriptError */:
3382
3409
  tokens.push(data$7.message);
3383
3410
  tokens.push(data$7.line);
3384
3411
  tokens.push(data$7.column);
@@ -3386,7 +3413,7 @@ function encode$2 (type) {
3386
3413
  tokens.push(data$7.source);
3387
3414
  queue(tokens);
3388
3415
  break;
3389
- case 33 /* Log */:
3416
+ case 33 /* Event.Log */:
3390
3417
  if (data$6) {
3391
3418
  tokens.push(data$6.code);
3392
3419
  tokens.push(data$6.name);
@@ -3396,7 +3423,7 @@ function encode$2 (type) {
3396
3423
  queue(tokens, false);
3397
3424
  }
3398
3425
  break;
3399
- case 41 /* Fraud */:
3426
+ case 41 /* Event.Fraud */:
3400
3427
  if (data$d) {
3401
3428
  tokens.push(data$d.id);
3402
3429
  tokens.push(data$d.target);
@@ -3419,7 +3446,7 @@ function log$1(code, severity, name, message, stack) {
3419
3446
  if (name === void 0) { name = null; }
3420
3447
  if (message === void 0) { message = null; }
3421
3448
  if (stack === void 0) { stack = null; }
3422
- var key = name ? name + "|" + message : "";
3449
+ var key = name ? "".concat(name, "|").concat(message) : "";
3423
3450
  // While rare, it's possible for code to fail repeatedly during the lifetime of the same page
3424
3451
  // In those cases, we only want to log the failure once and not spam logs with redundant information.
3425
3452
  if (code in history$2 && history$2[code].indexOf(key) >= 0) {
@@ -3433,7 +3460,7 @@ function log$1(code, severity, name, message, stack) {
3433
3460
  else {
3434
3461
  history$2[code] = [key];
3435
3462
  }
3436
- encode$2(33 /* Log */);
3463
+ encode$2(33 /* Event.Log */);
3437
3464
  }
3438
3465
  function stop$c() {
3439
3466
  history$2 = {};
@@ -3454,25 +3481,25 @@ function start$c() {
3454
3481
  var source = e[i];
3455
3482
  var key = e[i + 1];
3456
3483
  switch (source) {
3457
- case 0 /* Javascript */:
3484
+ case 0 /* ExtractSource.Javascript */:
3458
3485
  var variable = e[i + 2];
3459
3486
  variables[key] = parse(variable);
3460
3487
  break;
3461
- case 1 /* Cookie */:
3488
+ case 1 /* ExtractSource.Cookie */:
3462
3489
  /*Todo: Add cookie extract logic*/
3463
3490
  break;
3464
- case 2 /* Text */:
3491
+ case 2 /* ExtractSource.Text */:
3465
3492
  var match_1 = e[i + 2];
3466
3493
  selectors[key] = match_1;
3467
3494
  break;
3468
- case 3 /* Fragment */:
3495
+ case 3 /* ExtractSource.Fragment */:
3469
3496
  fragments = e[i + 2];
3470
3497
  break;
3471
3498
  }
3472
3499
  }
3473
3500
  }
3474
3501
  catch (e) {
3475
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3502
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3476
3503
  }
3477
3504
  }
3478
3505
  function clone(v) {
@@ -3494,9 +3521,9 @@ function compute$4() {
3494
3521
  }
3495
3522
  }
3496
3523
  catch (e) {
3497
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3524
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3498
3525
  }
3499
- encode$1(40 /* Extract */);
3526
+ encode$1(40 /* Event.Extract */);
3500
3527
  }
3501
3528
  function reset$4() {
3502
3529
  keys = [];
@@ -3516,15 +3543,15 @@ function stop$b() {
3516
3543
  }
3517
3544
  function parse(variable) {
3518
3545
  var syntax = [];
3519
- var parts = variable.split("." /* Dot */);
3546
+ var parts = variable.split("." /* Constant.Dot */);
3520
3547
  while (parts.length > 0) {
3521
3548
  var part = parts.shift();
3522
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3523
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3524
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3549
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3550
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3551
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3525
3552
  syntax.push({
3526
3553
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3527
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3554
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3528
3555
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3529
3556
  });
3530
3557
  }
@@ -3542,7 +3569,7 @@ function evaluate(variable, base) {
3542
3569
  var output;
3543
3570
  if (base && base[part.name]) {
3544
3571
  var obj = base[part.name];
3545
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3572
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3546
3573
  output = evaluate(variable, obj);
3547
3574
  }
3548
3575
  else if (Array.isArray(obj)) {
@@ -3564,7 +3591,7 @@ function evaluate(variable, base) {
3564
3591
  }
3565
3592
  function str(input) {
3566
3593
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3567
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3594
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3568
3595
  }
3569
3596
  function match(base, condition) {
3570
3597
  if (condition) {
@@ -3578,7 +3605,7 @@ function encode$1 (event) {
3578
3605
  var t = time();
3579
3606
  var tokens = [t, event];
3580
3607
  switch (event) {
3581
- case 4 /* Baseline */:
3608
+ case 4 /* Event.Baseline */:
3582
3609
  var b = state$9;
3583
3610
  if (b) {
3584
3611
  tokens = [b.time, b.event];
@@ -3596,30 +3623,30 @@ function encode$1 (event) {
3596
3623
  }
3597
3624
  reset$o();
3598
3625
  break;
3599
- case 25 /* Ping */:
3626
+ case 25 /* Event.Ping */:
3600
3627
  tokens.push(data$h.gap);
3601
3628
  queue(tokens);
3602
3629
  break;
3603
- case 35 /* Limit */:
3630
+ case 35 /* Event.Limit */:
3604
3631
  tokens.push(data$4.check);
3605
3632
  queue(tokens, false);
3606
3633
  break;
3607
- case 3 /* Upgrade */:
3634
+ case 3 /* Event.Upgrade */:
3608
3635
  tokens.push(data$f.key);
3609
3636
  queue(tokens);
3610
3637
  break;
3611
- case 2 /* Upload */:
3638
+ case 2 /* Event.Upload */:
3612
3639
  tokens.push(track$1.sequence);
3613
3640
  tokens.push(track$1.attempts);
3614
3641
  tokens.push(track$1.status);
3615
3642
  queue(tokens, false);
3616
3643
  break;
3617
- case 24 /* Custom */:
3644
+ case 24 /* Event.Custom */:
3618
3645
  tokens.push(data$j.key);
3619
3646
  tokens.push(data$j.value);
3620
3647
  queue(tokens);
3621
3648
  break;
3622
- case 34 /* Variable */:
3649
+ case 34 /* Event.Variable */:
3623
3650
  var variableKeys = Object.keys(data$e);
3624
3651
  if (variableKeys.length > 0) {
3625
3652
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3631,7 +3658,7 @@ function encode$1 (event) {
3631
3658
  queue(tokens, false);
3632
3659
  }
3633
3660
  break;
3634
- case 0 /* Metric */:
3661
+ case 0 /* Event.Metric */:
3635
3662
  var metricKeys = Object.keys(updates$3);
3636
3663
  if (metricKeys.length > 0) {
3637
3664
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3646,7 +3673,7 @@ function encode$1 (event) {
3646
3673
  queue(tokens, false);
3647
3674
  }
3648
3675
  break;
3649
- case 1 /* Dimension */:
3676
+ case 1 /* Event.Dimension */:
3650
3677
  var dimensionKeys = Object.keys(updates);
3651
3678
  if (dimensionKeys.length > 0) {
3652
3679
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3659,7 +3686,7 @@ function encode$1 (event) {
3659
3686
  queue(tokens, false);
3660
3687
  }
3661
3688
  break;
3662
- case 36 /* Summary */:
3689
+ case 36 /* Event.Summary */:
3663
3690
  var eventKeys = Object.keys(data$g);
3664
3691
  if (eventKeys.length > 0) {
3665
3692
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3672,7 +3699,7 @@ function encode$1 (event) {
3672
3699
  queue(tokens, false);
3673
3700
  }
3674
3701
  break;
3675
- case 40 /* Extract */:
3702
+ case 40 /* Event.Extract */:
3676
3703
  var extractKeys = keys;
3677
3704
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3678
3705
  var e = extractKeys_1[_d];
@@ -3686,14 +3713,14 @@ function encode$1 (event) {
3686
3713
 
3687
3714
  var data$4;
3688
3715
  function start$b() {
3689
- data$4 = { check: 0 /* None */ };
3716
+ data$4 = { check: 0 /* Check.None */ };
3690
3717
  }
3691
3718
  function check$2(bytes) {
3692
- if (data$4.check === 0 /* None */) {
3719
+ if (data$4.check === 0 /* Check.None */) {
3693
3720
  var reason = data$4.check;
3694
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3695
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3696
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3721
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3722
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3723
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3697
3724
  if (reason !== data$4.check) {
3698
3725
  trigger(reason);
3699
3726
  }
@@ -3705,8 +3732,8 @@ function trigger(reason) {
3705
3732
  stop();
3706
3733
  }
3707
3734
  function compute$3() {
3708
- if (data$4.check !== 0 /* None */) {
3709
- encode$1(35 /* Limit */);
3735
+ if (data$4.check !== 0 /* Check.None */) {
3736
+ encode$1(35 /* Event.Limit */);
3710
3737
  }
3711
3738
  }
3712
3739
  function stop$a() {
@@ -3727,7 +3754,7 @@ function log(dimension, value) {
3727
3754
  // Check valid value before moving ahead
3728
3755
  if (value) {
3729
3756
  // Ensure received value is casted into a string if it wasn't a string to begin with
3730
- value = "" + value;
3757
+ value = "".concat(value);
3731
3758
  if (!(dimension in data$3)) {
3732
3759
  data$3[dimension] = [];
3733
3760
  }
@@ -3740,14 +3767,14 @@ function log(dimension, value) {
3740
3767
  }
3741
3768
  updates[dimension].push(value);
3742
3769
  // Limit check to ensure we have a cap on number of dimensions we can collect
3743
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3744
- trigger(5 /* Collection */);
3770
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3771
+ trigger(5 /* Check.Collection */);
3745
3772
  }
3746
3773
  }
3747
3774
  }
3748
3775
  }
3749
3776
  function compute$2() {
3750
- encode$1(1 /* Dimension */);
3777
+ encode$1(1 /* Event.Dimension */);
3751
3778
  }
3752
3779
  function reset$3() {
3753
3780
  updates = {};
@@ -3758,8 +3785,8 @@ var callbacks = [];
3758
3785
  var rootDomain = null;
3759
3786
  function start$9() {
3760
3787
  rootDomain = null;
3761
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3762
- var title = document && document.title ? document.title : "" /* Empty */;
3788
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3789
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3763
3790
  // Populate ids for this page
3764
3791
  var s = session();
3765
3792
  var u = user();
@@ -3770,27 +3797,27 @@ function start$9() {
3770
3797
  pageNum: s.count
3771
3798
  };
3772
3799
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3773
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3774
- 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;
3800
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3801
+ 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;
3775
3802
  // Log dimensions
3776
- log(0 /* UserAgent */, ua);
3777
- log(3 /* PageTitle */, title);
3778
- log(1 /* Url */, location.href);
3779
- log(2 /* Referrer */, document.referrer);
3780
- log(15 /* TabId */, tab());
3781
- log(16 /* PageLanguage */, document.documentElement.lang);
3782
- log(17 /* DocumentDirection */, document.dir);
3803
+ log(0 /* Dimension.UserAgent */, ua);
3804
+ log(3 /* Dimension.PageTitle */, title);
3805
+ log(1 /* Dimension.Url */, location.href);
3806
+ log(2 /* Dimension.Referrer */, document.referrer);
3807
+ log(15 /* Dimension.TabId */, tab());
3808
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3809
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3783
3810
  if (navigator) {
3784
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3811
+ log(9 /* Dimension.Language */, navigator.userLanguage || navigator.language);
3785
3812
  userAgentData();
3786
3813
  }
3787
3814
  // Metrics
3788
- max(0 /* ClientTimestamp */, s.ts);
3789
- max(1 /* Playback */, 0 /* False */);
3815
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3816
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3790
3817
  if (screen) {
3791
- max(14 /* ScreenWidth */, Math.round(screen.width));
3792
- max(15 /* ScreenHeight */, Math.round(screen.height));
3793
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3818
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3819
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3820
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3794
3821
  }
3795
3822
  // Read cookies specified in configuration
3796
3823
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3811,13 +3838,13 @@ function userAgentData() {
3811
3838
  "uaFullVersion"])
3812
3839
  .then(function (ua) {
3813
3840
  var _a;
3814
- log(22 /* Platform */, ua.platform);
3815
- log(23 /* PlatformVersion */, ua.platformVersion);
3841
+ log(22 /* Dimension.Platform */, ua.platform);
3842
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3816
3843
  (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3817
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3844
+ log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version);
3818
3845
  });
3819
- log(25 /* Model */, ua.model);
3820
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3846
+ log(25 /* Dimension.Model */, ua.model);
3847
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3821
3848
  });
3822
3849
  }
3823
3850
  }
@@ -3834,33 +3861,33 @@ function metadata(cb, wait) {
3834
3861
  callbacks.push({ callback: cb, wait: wait });
3835
3862
  }
3836
3863
  function id() {
3837
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3864
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3838
3865
  }
3839
3866
  function consent() {
3840
3867
  if (active()) {
3841
3868
  config$1.track = true;
3842
- track(user(), 1 /* True */);
3869
+ track(user(), 1 /* BooleanFlag.True */);
3843
3870
  }
3844
3871
  }
3845
3872
  function clear() {
3846
3873
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3847
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
3874
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3848
3875
  }
3849
3876
  function tab() {
3850
3877
  var id = shortid();
3851
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3852
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
3878
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
3879
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3853
3880
  id = value ? value : id;
3854
- sessionStorage.setItem("_cltk" /* TabKey */, id);
3881
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3855
3882
  }
3856
3883
  return id;
3857
3884
  }
3858
3885
  function save() {
3859
3886
  var ts = Math.round(Date.now());
3860
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3861
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
3887
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
3888
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3862
3889
  processCallback(upgrade);
3863
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
3890
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3864
3891
  }
3865
3892
  function processCallback(upgrade) {
3866
3893
  if (callbacks.length > 0) {
@@ -3885,10 +3912,10 @@ function track(u, consent) {
3885
3912
  consent = consent === null ? u.consent : consent;
3886
3913
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3887
3914
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3888
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
3915
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3889
3916
  // To avoid cookie churn, write user id cookie only once every day
3890
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3891
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
3917
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
3918
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3892
3919
  }
3893
3920
  }
3894
3921
  function shortid() {
@@ -3899,17 +3926,17 @@ function shortid() {
3899
3926
  return id.toString(36);
3900
3927
  }
3901
3928
  function session() {
3902
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3903
- var value = getCookie("_clsk" /* SessionKey */);
3929
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
3930
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3904
3931
  if (value) {
3905
- var parts = value.split("|" /* Pipe */);
3932
+ var parts = value.split("|" /* Constant.Pipe */);
3906
3933
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3907
3934
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3908
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
3935
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3909
3936
  output.session = parts[0];
3910
3937
  output.count = num(parts[2]) + 1;
3911
3938
  output.upgrade = num(parts[3]);
3912
- output.upload = parts.length >= 6 ? "" + "https://" /* HTTPS */ + parts[5] + "/" + parts[4] : "" + "https://" /* HTTPS */ + parts[4];
3939
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3913
3940
  }
3914
3941
  }
3915
3942
  return output;
@@ -3919,26 +3946,26 @@ function num(string, base) {
3919
3946
  return parseInt(string, base);
3920
3947
  }
3921
3948
  function user() {
3922
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
3923
- var cookie = getCookie("_clck" /* CookieKey */);
3949
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
3950
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
3924
3951
  if (cookie && cookie.length > 0) {
3925
3952
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
3926
- var parts = cookie.split("|" /* Pipe */);
3953
+ var parts = cookie.split("|" /* Constant.Pipe */);
3927
3954
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
3928
3955
  // 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)
3929
3956
  var count = 0;
3930
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
3957
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
3931
3958
  var c = _a[_i];
3932
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
3959
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
3933
3960
  }
3934
3961
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
3935
3962
  // In both these cases, we go ahead and delete the existing cookie set on current domain
3936
3963
  if (parts.length === 1 || count > 1) {
3937
- var deleted = "" + ";" /* Semicolon */ + "expires=" /* Expires */ + (new Date(0)).toUTCString() + ";path=/" /* Path */;
3964
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
3938
3965
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
3939
- document.cookie = "_clck" /* CookieKey */ + "=" + deleted;
3966
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
3940
3967
  // Second, same thing for current session cookie so it can be re-written later with the root domain
3941
- document.cookie = "_clsk" /* SessionKey */ + "=" + deleted;
3968
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
3942
3969
  }
3943
3970
  // End code for backward compatibility
3944
3971
  // Read version information and timestamp from cookie, if available
@@ -3947,21 +3974,21 @@ function user() {
3947
3974
  }
3948
3975
  // Check if we have explicit consent to track this user
3949
3976
  if (parts.length > 3 && num(parts[3]) === 1) {
3950
- output.consent = 1 /* True */;
3977
+ output.consent = 1 /* BooleanFlag.True */;
3951
3978
  }
3952
3979
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
3953
- config$1.track = config$1.track || output.consent === 1 /* True */;
3980
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
3954
3981
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
3955
3982
  output.id = config$1.track ? parts[0] : output.id;
3956
3983
  }
3957
3984
  return output;
3958
3985
  }
3959
3986
  function getCookie(key) {
3960
- if (supported(document, "cookie" /* Cookie */)) {
3961
- var cookies = document.cookie.split(";" /* Semicolon */);
3987
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
3988
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
3962
3989
  if (cookies) {
3963
3990
  for (var i = 0; i < cookies.length; i++) {
3964
- var pair = cookies[i].split("=" /* Equals */);
3991
+ var pair = cookies[i].split("=" /* Constant.Equals */);
3965
3992
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
3966
3993
  return pair[1];
3967
3994
  }
@@ -3971,23 +3998,23 @@ function getCookie(key) {
3971
3998
  return null;
3972
3999
  }
3973
4000
  function setCookie(key, value, time) {
3974
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
4001
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
3975
4002
  var expiry = new Date();
3976
4003
  expiry.setDate(expiry.getDate() + time);
3977
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
3978
- var cookie = key + "=" + value + ";" /* Semicolon */ + expires + ";path=/" /* Path */;
4004
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
4005
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
3979
4006
  try {
3980
4007
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
3981
4008
  if (rootDomain === null) {
3982
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
4009
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
3983
4010
  // Walk backwards on a domain and attempt to set a cookie, until successful
3984
4011
  for (var i = hostname.length - 1; i >= 0; i--) {
3985
- rootDomain = "." + hostname[i] + (rootDomain ? rootDomain : "" /* Empty */);
4012
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
3986
4013
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
3987
4014
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
3988
4015
  if (i < hostname.length - 1) {
3989
4016
  // Write the cookie on the current computed top level domain
3990
- document.cookie = "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain;
4017
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
3991
4018
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
3992
4019
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
3993
4020
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -3999,13 +4026,13 @@ function setCookie(key, value, time) {
3999
4026
  }
4000
4027
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
4001
4028
  // This forces our code to fall back to always writing cookie to the current domain
4002
- rootDomain = "" /* Empty */;
4029
+ rootDomain = "" /* Constant.Empty */;
4003
4030
  }
4004
4031
  }
4005
4032
  catch (_a) {
4006
- rootDomain = "" /* Empty */;
4033
+ rootDomain = "" /* Constant.Empty */;
4007
4034
  }
4008
- document.cookie = rootDomain ? "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain : cookie;
4035
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4009
4036
  }
4010
4037
  }
4011
4038
 
@@ -4021,8 +4048,8 @@ function start$8() {
4021
4048
  userId: m.userId,
4022
4049
  sessionId: m.sessionId,
4023
4050
  pageNum: m.pageNum,
4024
- upload: 0 /* Async */,
4025
- end: 0 /* False */
4051
+ upload: 0 /* Upload.Async */,
4052
+ end: 0 /* BooleanFlag.False */
4026
4053
  };
4027
4054
  }
4028
4055
  function stop$7() {
@@ -4032,8 +4059,8 @@ function envelope(last) {
4032
4059
  data$1.start = data$1.start + data$1.duration;
4033
4060
  data$1.duration = time() - data$1.start;
4034
4061
  data$1.sequence++;
4035
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4036
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4062
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4063
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4037
4064
  return [
4038
4065
  data$1.version,
4039
4066
  data$1.sequence,
@@ -4086,10 +4113,10 @@ function measure (method) {
4086
4113
  throw report(ex);
4087
4114
  }
4088
4115
  var duration = performance.now() - start;
4089
- sum(4 /* TotalCost */, duration);
4090
- if (duration > 30 /* LongTask */) {
4091
- count$1(7 /* LongTaskCount */);
4092
- max(6 /* ThreadBlockedTime */, duration);
4116
+ sum(4 /* Metric.TotalCost */, duration);
4117
+ if (duration > 30 /* Setting.LongTask */) {
4118
+ count$1(7 /* Metric.LongTaskCount */);
4119
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4093
4120
  }
4094
4121
  };
4095
4122
  }
@@ -4101,7 +4128,7 @@ function bind(target, event, listener, capture) {
4101
4128
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4102
4129
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4103
4130
  try {
4104
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4131
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4105
4132
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4106
4133
  }
4107
4134
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4112,7 +4139,7 @@ function reset$1() {
4112
4139
  var binding = bindings_1[_i];
4113
4140
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4114
4141
  try {
4115
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4142
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4116
4143
  }
4117
4144
  catch ( /* do nothing */_a) { /* do nothing */ }
4118
4145
  }
@@ -4149,8 +4176,8 @@ function start$7() {
4149
4176
  }
4150
4177
  }
4151
4178
  function check$1() {
4152
- if (count++ > 20 /* CallStackDepth */) {
4153
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4179
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4180
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4154
4181
  return false;
4155
4182
  }
4156
4183
  return true;
@@ -4160,15 +4187,15 @@ function compute$1() {
4160
4187
  if (url !== getCurrentUrl()) {
4161
4188
  // If the url changed, start tracking it as a new page
4162
4189
  stop();
4163
- window.setTimeout(restart$1, 250 /* RestartDelay */);
4190
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4164
4191
  }
4165
4192
  }
4166
4193
  function restart$1() {
4167
4194
  start();
4168
- max(29 /* SinglePage */, 1 /* True */);
4195
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4169
4196
  }
4170
4197
  function getCurrentUrl() {
4171
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4198
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4172
4199
  }
4173
4200
  function stop$6() {
4174
4201
  url = null;
@@ -4231,7 +4258,7 @@ function config(override) {
4231
4258
  // not holding the session during inactive time periods.
4232
4259
  function suspend() {
4233
4260
  if (status) {
4234
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4261
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4235
4262
  stop();
4236
4263
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4237
4264
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4239,7 +4266,7 @@ function suspend() {
4239
4266
  }
4240
4267
  function restart() {
4241
4268
  start();
4242
- event("clarity" /* Clarity */, "restart" /* Restart */);
4269
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4243
4270
  }
4244
4271
 
4245
4272
  function start$5() {
@@ -4258,7 +4285,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4258
4285
  });
4259
4286
 
4260
4287
  function start$4() {
4261
- schedule$1(discover, 1 /* High */).then(function () {
4288
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4262
4289
  measure(compute$7)();
4263
4290
  measure(compute$6)();
4264
4291
  });
@@ -4270,12 +4297,12 @@ function discover() {
4270
4297
  switch (_a.label) {
4271
4298
  case 0:
4272
4299
  ts = time();
4273
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4300
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4274
4301
  start$w(timer);
4275
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4302
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4276
4303
  case 1:
4277
4304
  _a.sent();
4278
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4305
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4279
4306
  case 2:
4280
4307
  _a.sent();
4281
4308
  stop$t(timer);
@@ -4314,7 +4341,7 @@ function encode (type) {
4314
4341
  t = time();
4315
4342
  tokens = [t, type];
4316
4343
  switch (type) {
4317
- case 29 /* Navigation */:
4344
+ case 29 /* Event.Navigation */:
4318
4345
  tokens.push(data.fetchStart);
4319
4346
  tokens.push(data.connectStart);
4320
4347
  tokens.push(data.connectEnd);
@@ -4363,11 +4390,11 @@ function compute(entry) {
4363
4390
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4364
4391
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4365
4392
  };
4366
- encode(29 /* Navigation */);
4393
+ encode(29 /* Event.Navigation */);
4367
4394
  }
4368
4395
 
4369
4396
  var observer;
4370
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4397
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4371
4398
  function start$2() {
4372
4399
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4373
4400
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
@@ -4382,7 +4409,7 @@ function start$2() {
4382
4409
  }
4383
4410
  }
4384
4411
  else {
4385
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4412
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4386
4413
  }
4387
4414
  }
4388
4415
  function observe() {
@@ -4402,15 +4429,15 @@ function observe() {
4402
4429
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4403
4430
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4404
4431
  // In those cases, we want to still initialize the metric in Clarity
4405
- if (x === "layout-shift" /* CLS */) {
4406
- sum(9 /* CumulativeLayoutShift */, 0);
4432
+ if (x === "layout-shift" /* Constant.CLS */) {
4433
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4407
4434
  }
4408
4435
  observer.observe({ type: x, buffered: true });
4409
4436
  }
4410
4437
  }
4411
4438
  }
4412
4439
  catch (_a) {
4413
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4440
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4414
4441
  }
4415
4442
  }
4416
4443
  function handle(entries) {
@@ -4421,41 +4448,41 @@ function process(entries) {
4421
4448
  for (var i = 0; i < entries.length; i++) {
4422
4449
  var entry = entries[i];
4423
4450
  switch (entry.entryType) {
4424
- case "navigation" /* Navigation */:
4451
+ case "navigation" /* Constant.Navigation */:
4425
4452
  compute(entry);
4426
4453
  break;
4427
- case "resource" /* Resource */:
4454
+ case "resource" /* Constant.Resource */:
4428
4455
  var name_1 = entry.name;
4429
- log(4 /* NetworkHosts */, host(name_1));
4456
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4430
4457
  if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4431
- max(28 /* UploadTime */, entry.duration);
4458
+ max(28 /* Metric.UploadTime */, entry.duration);
4432
4459
  }
4433
4460
  break;
4434
- case "longtask" /* LongTask */:
4435
- count$1(7 /* LongTaskCount */);
4461
+ case "longtask" /* Constant.LongTask */:
4462
+ count$1(7 /* Metric.LongTaskCount */);
4436
4463
  break;
4437
- case "first-input" /* FID */:
4464
+ case "first-input" /* Constant.FID */:
4438
4465
  if (visible) {
4439
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4466
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4440
4467
  }
4441
4468
  break;
4442
- case "layout-shift" /* CLS */:
4469
+ case "layout-shift" /* Constant.CLS */:
4443
4470
  // Scale the value to avoid sending back floating point number
4444
4471
  if (visible && !entry["hadRecentInput"]) {
4445
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4472
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4446
4473
  }
4447
4474
  break;
4448
- case "largest-contentful-paint" /* LCP */:
4475
+ case "largest-contentful-paint" /* Constant.LCP */:
4449
4476
  if (visible) {
4450
- max(8 /* LargestPaint */, entry.startTime);
4477
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4451
4478
  }
4452
4479
  break;
4453
4480
  }
4454
4481
  }
4455
- if (performance && "memory" /* Memory */ in performance && performance["memory" /* Memory */].usedJSHeapSize) {
4482
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4456
4483
  // Track consumed memory (MBs) where "memory" API is available
4457
4484
  // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4458
- max(30 /* UsedMemory */, Math.abs(performance["memory" /* Memory */].usedJSHeapSize / 1048576 /* MegaByte */));
4485
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4459
4486
  }
4460
4487
  }
4461
4488
  function stop$2() {
@@ -4503,7 +4530,7 @@ function start(config$1) {
4503
4530
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4504
4531
  function pause() {
4505
4532
  if (active()) {
4506
- event("clarity" /* Clarity */, "pause" /* Pause */);
4533
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4507
4534
  pause$1();
4508
4535
  }
4509
4536
  }
@@ -4511,7 +4538,7 @@ function pause() {
4511
4538
  function resume() {
4512
4539
  if (active()) {
4513
4540
  resume$1();
4514
- event("clarity" /* Clarity */, "resume" /* Resume */);
4541
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4515
4542
  }
4516
4543
  }
4517
4544
  function stop() {