clarity-js 0.6.35 → 0.6.38

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