clarity-js 0.6.34 → 0.6.37

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.
@@ -58,7 +58,6 @@ var metadata$1 = /*#__PURE__*/Object.freeze({
58
58
  get data () { return data$2; },
59
59
  get callbacks () { return callbacks; },
60
60
  get start () { return start$9; },
61
- get userAgentData () { return userAgentData; },
62
61
  get stop () { return stop$8; },
63
62
  get metadata () { return metadata; },
64
63
  get id () { return id; },
@@ -76,7 +75,7 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
76
75
 
77
76
  var config$1 = {
78
77
  projectId: null,
79
- delay: 1 * 1000 /* Second */,
78
+ delay: 1 * 1000 /* Time.Second */,
80
79
  lean: false,
81
80
  track: true,
82
81
  content: true,
@@ -85,6 +84,7 @@ var config$1 = {
85
84
  regions: [],
86
85
  extract: [],
87
86
  cookies: [],
87
+ fraud: [],
88
88
  report: null,
89
89
  upload: null,
90
90
  fallback: null,
@@ -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;
@@ -107,11 +107,11 @@ function time(ts) {
107
107
  ts = ts ? ts : performance.now();
108
108
  return Math.max(Math.round(ts - startTime), 0);
109
109
  }
110
- function stop$C() {
110
+ function stop$B() {
111
111
  startTime = 0;
112
112
  }
113
113
 
114
- var version$1 = "0.6.34";
114
+ var version$1 = "0.6.37";
115
115
 
116
116
  // tslint:disable: no-bitwise
117
117
  function hash (input) {
@@ -138,13 +138,13 @@ var buffer = null;
138
138
  var update$2 = false;
139
139
  function start$E() {
140
140
  update$2 = false;
141
- reset$p();
141
+ reset$o();
142
142
  }
143
- function reset$p() {
143
+ 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$p() {
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$p() {
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,31 +196,31 @@ 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
  }
203
203
  update$2 = true;
204
204
  }
205
- function compute$d() {
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
- function stop$B() {
211
- reset$p();
210
+ function stop$A() {
211
+ reset$o();
212
212
  }
213
213
 
214
214
  var baseline = /*#__PURE__*/Object.freeze({
215
215
  __proto__: null,
216
216
  get state () { return state$9; },
217
217
  start: start$E,
218
- reset: reset$p,
218
+ reset: reset$o,
219
219
  track: track$7,
220
220
  activity: activity,
221
221
  visibility: visibility,
222
- compute: compute$d,
223
- stop: stop$B
222
+ compute: compute$c,
223
+ stop: stop$A
224
224
  });
225
225
 
226
226
  var data$j = null;
@@ -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,22 +242,21 @@ 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
- function stop$A() {
247
+ function stop$z() {
248
248
  data$i = {};
249
249
  updates$3 = {};
250
250
  }
251
- function count$1(metric, increment) {
252
- if (increment === void 0) { increment = 1; }
251
+ function count$1(metric) {
253
252
  if (!(metric in data$i)) {
254
253
  data$i[metric] = 0;
255
254
  }
256
255
  if (!(metric in updates$3)) {
257
256
  updates$3[metric] = 0;
258
257
  }
259
- data$i[metric] += increment;
260
- updates$3[metric] += increment;
258
+ data$i[metric]++;
259
+ updates$3[metric]++;
261
260
  }
262
261
  function sum(metric, value) {
263
262
  if (value !== null) {
@@ -283,10 +282,10 @@ function max(metric, value) {
283
282
  }
284
283
  }
285
284
  }
286
- function compute$c() {
287
- encode$1(0 /* Metric */);
285
+ function compute$b() {
286
+ encode$1(0 /* Event.Metric */);
288
287
  }
289
- function reset$o() {
288
+ function reset$n() {
290
289
  updates$3 = {};
291
290
  }
292
291
 
@@ -302,10 +301,10 @@ var last = 0;
302
301
  var interval = 0;
303
302
  var timeout$6 = null;
304
303
  function start$C() {
305
- interval = 60000 /* PingInterval */;
304
+ interval = 60000 /* Setting.PingInterval */;
306
305
  last = 0;
307
306
  }
308
- function reset$n() {
307
+ function reset$m() {
309
308
  if (timeout$6) {
310
309
  clearTimeout(timeout$6);
311
310
  }
@@ -315,15 +314,15 @@ function reset$n() {
315
314
  function ping() {
316
315
  var now = time();
317
316
  data$h = { gap: now - last };
318
- encode$1(25 /* Ping */);
319
- if (data$h.gap < 300000 /* PingTimeout */) {
317
+ encode$1(25 /* Event.Ping */);
318
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
320
319
  timeout$6 = setTimeout(ping, interval);
321
320
  }
322
321
  else {
323
322
  suspend();
324
323
  }
325
324
  }
326
- function stop$z() {
325
+ function stop$y() {
327
326
  clearTimeout(timeout$6);
328
327
  last = 0;
329
328
  interval = 0;
@@ -333,15 +332,15 @@ var ping$1 = /*#__PURE__*/Object.freeze({
333
332
  __proto__: null,
334
333
  get data () { return data$h; },
335
334
  start: start$C,
336
- reset: reset$n,
337
- stop: stop$z
335
+ reset: reset$m,
336
+ stop: stop$y
338
337
  });
339
338
 
340
339
  var data$g = null;
341
340
  function start$B() {
342
341
  data$g = {};
343
342
  }
344
- function stop$y() {
343
+ function stop$x() {
345
344
  data$g = {};
346
345
  }
347
346
  function track$6(event, time) {
@@ -353,7 +352,7 @@ function track$6(event, time) {
353
352
  var last = e[e.length - 1];
354
353
  // Add a new entry only if the new event occurs after configured interval
355
354
  // Otherwise, extend the duration of the previous entry
356
- if (time - last[0] > 100 /* SummaryInterval */) {
355
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
357
356
  data$g[event].push([time, 0]);
358
357
  }
359
358
  else {
@@ -361,10 +360,10 @@ function track$6(event, time) {
361
360
  }
362
361
  }
363
362
  }
364
- function compute$b() {
365
- encode$1(36 /* Summary */);
363
+ function compute$a() {
364
+ encode$1(36 /* Event.Summary */);
366
365
  }
367
- function reset$m() {
366
+ function reset$l() {
368
367
  data$g = {};
369
368
  }
370
369
 
@@ -372,16 +371,16 @@ var summary = /*#__PURE__*/Object.freeze({
372
371
  __proto__: null,
373
372
  get data () { return data$g; },
374
373
  start: start$B,
375
- stop: stop$y,
374
+ stop: stop$x,
376
375
  track: track$6,
377
- compute: compute$b,
378
- reset: reset$m
376
+ compute: compute$a,
377
+ reset: reset$l
379
378
  });
380
379
 
381
380
  var data$f = null;
382
381
  function start$A() {
383
382
  if (!config$1.lean && config$1.upgrade) {
384
- config$1.upgrade("Config" /* Config */);
383
+ config$1.upgrade("Config" /* Constant.Config */);
385
384
  }
386
385
  data$f = null;
387
386
  }
@@ -400,10 +399,10 @@ function upgrade(key) {
400
399
  if (config$1.upgrade) {
401
400
  config$1.upgrade(key);
402
401
  }
403
- encode$1(3 /* Upgrade */);
402
+ encode$1(3 /* Event.Upgrade */);
404
403
  }
405
404
  }
406
- function stop$x() {
405
+ function stop$w() {
407
406
  data$f = null;
408
407
  }
409
408
 
@@ -412,47 +411,47 @@ var upgrade$1 = /*#__PURE__*/Object.freeze({
412
411
  get data () { return data$f; },
413
412
  start: start$A,
414
413
  upgrade: upgrade,
415
- stop: stop$x
414
+ stop: stop$w
416
415
  });
417
416
 
418
417
  var data$e = null;
419
418
  function start$z() {
420
- reset$l();
419
+ reset$k();
421
420
  }
422
421
  function set(variable, value) {
423
- var values = typeof value === "string" /* String */ ? [value] : value;
422
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
424
423
  log$2(variable, values);
425
424
  }
426
425
  function identify(userId, sessionId, pageId) {
427
426
  if (sessionId === void 0) { sessionId = null; }
428
427
  if (pageId === void 0) { pageId = null; }
429
- log$2("userId" /* UserId */, [userId]);
430
- log$2("sessionId" /* SessionId */, [sessionId]);
431
- 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]);
432
431
  }
433
432
  function log$2(variable, value) {
434
433
  if (active() &&
435
434
  variable &&
436
435
  value &&
437
- typeof variable === "string" /* String */ &&
436
+ typeof variable === "string" /* Constant.String */ &&
438
437
  variable.length < 255) {
439
438
  var validValues = variable in data$e ? data$e[variable] : [];
440
439
  for (var i = 0; i < value.length; i++) {
441
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
440
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
442
441
  validValues.push(value[i]);
443
442
  }
444
443
  }
445
444
  data$e[variable] = validValues;
446
445
  }
447
446
  }
448
- function compute$a() {
449
- encode$1(34 /* Variable */);
447
+ function compute$9() {
448
+ encode$1(34 /* Event.Variable */);
450
449
  }
451
- function reset$l() {
450
+ function reset$k() {
452
451
  data$e = {};
453
452
  }
454
- function stop$w() {
455
- reset$l();
453
+ function stop$v() {
454
+ reset$k();
456
455
  }
457
456
 
458
457
  var variable = /*#__PURE__*/Object.freeze({
@@ -461,12 +460,12 @@ var variable = /*#__PURE__*/Object.freeze({
461
460
  start: start$z,
462
461
  set: set,
463
462
  identify: identify,
464
- compute: compute$a,
465
- reset: reset$l,
466
- stop: stop$w
463
+ compute: compute$9,
464
+ reset: reset$k,
465
+ stop: stop$v
467
466
  });
468
467
 
469
- /*! *****************************************************************************
468
+ /******************************************************************************
470
469
  Copyright (c) Microsoft Corporation.
471
470
 
472
471
  Permission to use, copy, modify, and/or distribute this software for any
@@ -519,7 +518,7 @@ function __generator(thisArg, body) {
519
518
  }
520
519
  }
521
520
 
522
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
521
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
523
522
  function compress (input) {
524
523
  return __awaiter(this, void 0, void 0, function () {
525
524
  var stream, _a;
@@ -536,7 +535,7 @@ function compress (input) {
536
535
  return [2 /*return*/];
537
536
  });
538
537
  });
539
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
538
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
540
539
  _a = Uint8Array.bind;
541
540
  return [4 /*yield*/, read(stream)];
542
541
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -583,20 +582,20 @@ function start$y() {
583
582
  start$D();
584
583
  modules$1.forEach(function (x) { return measure(x.start)(); });
585
584
  }
586
- function stop$v() {
585
+ function stop$u() {
587
586
  // Stop modules in the reverse order of their initialization
588
587
  // The ordering below should respect inter-module dependency.
589
588
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
590
589
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
591
590
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
592
- stop$A();
591
+ stop$z();
593
592
  }
594
- function compute$9() {
595
- compute$a();
596
- compute$d();
597
- compute$2();
593
+ function compute$8() {
594
+ compute$9();
598
595
  compute$c();
596
+ compute$2();
599
597
  compute$b();
598
+ compute$a();
600
599
  compute$3();
601
600
  compute$4();
602
601
  }
@@ -605,11 +604,11 @@ function scrub (value, hint, privacy, mangle) {
605
604
  if (mangle === void 0) { mangle = false; }
606
605
  if (value) {
607
606
  switch (privacy) {
608
- case 0 /* None */:
607
+ case 0 /* Privacy.None */:
609
608
  return value;
610
- case 1 /* Sensitive */:
609
+ case 1 /* Privacy.Sensitive */:
611
610
  switch (hint) {
612
- case "*T" /* TextTag */:
611
+ case "*T" /* Layout.Constant.TextTag */:
613
612
  case "value":
614
613
  case "placeholder":
615
614
  return redact(value);
@@ -617,16 +616,16 @@ function scrub (value, hint, privacy, mangle) {
617
616
  return mangleToken(value);
618
617
  }
619
618
  return value;
620
- case 2 /* Text */:
621
- case 3 /* TextImage */:
619
+ case 2 /* Privacy.Text */:
620
+ case 3 /* Privacy.TextImage */:
622
621
  switch (hint) {
623
- case "*T" /* TextTag */:
622
+ case "*T" /* Layout.Constant.TextTag */:
624
623
  return mangle ? mangleText(value) : mask(value);
625
624
  case "src":
626
625
  case "srcset":
627
626
  case "title":
628
627
  case "alt":
629
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
628
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
630
629
  case "value":
631
630
  case "click":
632
631
  case "input":
@@ -646,18 +645,18 @@ function mangleText(value) {
646
645
  var index = value.indexOf(first);
647
646
  var prefix = value.substr(0, index);
648
647
  var suffix = value.substr(index + trimmed.length);
649
- return "" + prefix + trimmed.length.toString(36) + suffix;
648
+ return "".concat(prefix).concat(trimmed.length.toString(36)).concat(suffix);
650
649
  }
651
650
  return value;
652
651
  }
653
652
  function mask(value) {
654
- return value.replace(/\S/gi, "\u2022" /* Mask */);
653
+ return value.replace(/\S/gi, "\u2022" /* Data.Constant.Mask */);
655
654
  }
656
655
  function mangleToken(value) {
657
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
658
- var output = "" /* Empty */;
656
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
657
+ var output = "" /* Layout.Constant.Empty */;
659
658
  for (var i = 0; i < length; i++) {
660
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
659
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
661
660
  }
662
661
  return output;
663
662
  }
@@ -669,15 +668,15 @@ function redact(value) {
669
668
  var array = null;
670
669
  for (var i = 0; i < value.length; i++) {
671
670
  var c = value.charCodeAt(i);
672
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
673
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
674
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
671
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
672
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
673
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
675
674
  // Process each word as an individual token to redact any sensitive information
676
675
  if (i === 0 || i === value.length - 1 || hasWhitespace) {
677
676
  // Performance optimization: Lazy load string -> array conversion only when required
678
677
  if (hasDigit || hasEmail) {
679
678
  if (array === null) {
680
- array = value.split("" /* Empty */);
679
+ array = value.split("" /* Data.Constant.Empty */);
681
680
  }
682
681
  mutate(array, spaceIndex, hasWhitespace ? i : i + 1);
683
682
  }
@@ -689,11 +688,29 @@ function redact(value) {
689
688
  }
690
689
  }
691
690
  }
692
- return array ? array.join("" /* Empty */) : value;
691
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
693
692
  }
694
693
  function mutate(array, start, end) {
695
694
  for (var i = start + 1; i < end; i++) {
696
- array[i] = "\u2022" /* Mask */;
695
+ array[i] = "\u2022" /* Data.Constant.Mask */;
696
+ }
697
+ }
698
+
699
+ var history$5 = [];
700
+ var data$d;
701
+ function start$x() {
702
+ history$5 = [];
703
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
704
+ }
705
+ function check$4(id, target, input) {
706
+ // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
707
+ if (id !== null && input && input.length >= 5 /* Setting.WordLength */) {
708
+ data$d = { id: id, target: target, hash: hash(input) };
709
+ // Only encode this event if we haven't already reported this hash
710
+ if (history$5.indexOf(data$d.hash) < 0) {
711
+ history$5.push(data$d.hash);
712
+ encode$2(41 /* Event.Fraud */);
713
+ }
697
714
  }
698
715
  }
699
716
 
@@ -701,45 +718,45 @@ var TAGS = ["DIV", "TR", "P", "LI", "UL", "A", "BUTTON"];
701
718
  function selector (input, beta) {
702
719
  if (beta === void 0) { beta = false; }
703
720
  var a = input.attributes;
704
- var prefix = input.prefix ? input.prefix[beta ? 1 /* Beta */ : 0 /* Stable */] : null;
705
- var suffix = beta || ((a && !("class" /* Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(" + input.position + ")" : "" /* Empty */;
721
+ var prefix = input.prefix ? input.prefix[beta ? 1 /* Selector.Beta */ : 0 /* Selector.Stable */] : null;
722
+ var suffix = beta || ((a && !("class" /* Constant.Class */ in a)) || TAGS.indexOf(input.tag) >= 0) ? ":nth-of-type(".concat(input.position, ")") : "" /* Constant.Empty */;
706
723
  switch (input.tag) {
707
724
  case "STYLE":
708
725
  case "TITLE":
709
726
  case "LINK":
710
727
  case "META":
711
- case "*T" /* TextTag */:
712
- case "*D" /* DocumentTag */:
713
- return "" /* Empty */;
728
+ case "*T" /* Constant.TextTag */:
729
+ case "*D" /* Constant.DocumentTag */:
730
+ return "" /* Constant.Empty */;
714
731
  case "HTML":
715
- return "HTML" /* HTML */;
732
+ return "HTML" /* Constant.HTML */;
716
733
  default:
717
734
  if (prefix === null) {
718
- return "" /* Empty */;
735
+ return "" /* Constant.Empty */;
719
736
  }
720
- prefix = prefix + ">";
721
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
722
- var selector = "" + prefix + input.tag + suffix;
723
- var classes = "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/) : null;
737
+ prefix = "".concat(prefix, ">");
738
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
739
+ var selector = "".concat(prefix).concat(input.tag).concat(suffix);
740
+ var classes = "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/) : null;
724
741
  if (beta) {
725
742
  // In beta mode, update selector to use "id" field when available. There are two exceptions:
726
743
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
727
744
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
728
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
729
- classes = input.tag !== "BODY" /* BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
730
- selector = classes.length > 0 ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
731
- selector = id && hasDigits(id) === false ? getDomPrefix(prefix) + "#" + id : selector;
745
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
746
+ classes = input.tag !== "BODY" /* Constant.BodyTag */ && classes ? classes.filter(function (c) { return !hasDigits(c); }) : [];
747
+ selector = classes.length > 0 ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
748
+ selector = id && hasDigits(id) === false ? "".concat(getDomPrefix(prefix), "#").concat(id) : selector;
732
749
  }
733
750
  else {
734
751
  // Otherwise, fallback to stable mode, where we include class names as part of the selector
735
- selector = classes ? "" + prefix + input.tag + "." + classes.join(".") + suffix : selector;
752
+ selector = classes ? "".concat(prefix).concat(input.tag, ".").concat(classes.join(".")).concat(suffix) : selector;
736
753
  }
737
754
  return selector;
738
755
  }
739
756
  }
740
757
  function getDomPrefix(prefix) {
741
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
742
- var iframeDomStart = prefix.lastIndexOf("" + "iframe:" /* IFramePrefix */ + "HTML" /* HTML */);
758
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
759
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
743
760
  var domStart = Math.max(shadowDomStart, iframeDomStart);
744
761
  if (domStart < 0) {
745
762
  return "";
@@ -751,7 +768,7 @@ function getDomPrefix(prefix) {
751
768
  function hasDigits(value) {
752
769
  for (var i = 0; i < value.length; i++) {
753
770
  var c = value.charCodeAt(i);
754
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
771
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
755
772
  return true;
756
773
  }
757
774
  }
@@ -781,14 +798,14 @@ function resume$1() {
781
798
  }
782
799
  }
783
800
  }
784
- function reset$k() {
801
+ function reset$j() {
785
802
  tracker = {};
786
803
  queuedTasks = [];
787
804
  activeTask = null;
788
805
  pauseTask = null;
789
806
  }
790
807
  function schedule$1(task, priority) {
791
- if (priority === void 0) { priority = 0 /* Normal */; }
808
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
792
809
  return __awaiter(this, void 0, void 0, function () {
793
810
  var _i, queuedTasks_1, q, promise;
794
811
  return __generator(this, function (_a) {
@@ -800,7 +817,7 @@ function schedule$1(task, priority) {
800
817
  }
801
818
  }
802
819
  promise = new Promise(function (resolve) {
803
- var insert = priority === 1 /* High */ ? "unshift" : "push";
820
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
804
821
  // Queue this task for asynchronous execution later
805
822
  // We also store a unique page identifier (id) along with the task to ensure
806
823
  // ensure that we do not accidentally execute this task in context of a different page
@@ -835,7 +852,7 @@ function run() {
835
852
  return;
836
853
  }
837
854
  if (error) {
838
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
855
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
839
856
  }
840
857
  activeTask = null;
841
858
  run();
@@ -846,34 +863,34 @@ function state$8(timer) {
846
863
  var id = key(timer);
847
864
  if (id in tracker) {
848
865
  var elapsed = performance.now() - tracker[id].start;
849
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
866
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
850
867
  }
851
868
  // If this task is no longer being tracked, send stop message to the caller
852
- return 2 /* Stop */;
869
+ return 2 /* Task.Stop */;
853
870
  }
854
- function start$x(timer) {
855
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
871
+ function start$w(timer) {
872
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
856
873
  }
857
- function restart$1(timer) {
874
+ function restart$2(timer) {
858
875
  var id = key(timer);
859
876
  if (tracker && tracker[id]) {
860
877
  var c = tracker[id].calls;
861
878
  var y = tracker[id].yield;
862
- start$x(timer);
879
+ start$w(timer);
863
880
  tracker[id].calls = c + 1;
864
881
  tracker[id].yield = y;
865
882
  }
866
883
  }
867
- function stop$u(timer) {
884
+ function stop$t(timer) {
868
885
  var end = performance.now();
869
886
  var id = key(timer);
870
887
  var duration = end - tracker[id].start;
871
888
  sum(timer.cost, duration);
872
- count$1(5 /* InvokeCount */);
889
+ count$1(5 /* Metric.InvokeCount */);
873
890
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
874
891
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
875
892
  if (tracker[id].calls > 0) {
876
- sum(4 /* TotalCost */, duration);
893
+ sum(4 /* Metric.TotalCost */, duration);
877
894
  }
878
895
  }
879
896
  function suspend$1(timer) {
@@ -884,23 +901,23 @@ function suspend$1(timer) {
884
901
  case 0:
885
902
  id = key(timer);
886
903
  if (!(id in tracker)) return [3 /*break*/, 2];
887
- stop$u(timer);
904
+ stop$t(timer);
888
905
  _a = tracker[id];
889
906
  return [4 /*yield*/, wait()];
890
907
  case 1:
891
908
  _a.yield = (_b.sent()).timeRemaining();
892
- restart$1(timer);
909
+ restart$2(timer);
893
910
  _b.label = 2;
894
911
  case 2:
895
912
  // After we are done with suspending task, ensure that we are still operating in the right context
896
913
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
897
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
914
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
898
915
  }
899
916
  });
900
917
  });
901
918
  }
902
919
  function key(timer) {
903
- return timer.id + "." + timer.cost;
920
+ return "".concat(timer.id, ".").concat(timer.cost);
904
921
  }
905
922
  function wait() {
906
923
  return __awaiter(this, void 0, void 0, function () {
@@ -938,14 +955,14 @@ function requestIdleCallbackPolyfill(callback, options) {
938
955
  var currentTime = performance.now();
939
956
  var elapsed = currentTime - startTime;
940
957
  var duration = currentTime - event.data;
941
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
958
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
942
959
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
943
960
  }
944
961
  else {
945
962
  var didTimeout_1 = elapsed > options.timeout;
946
963
  callback({
947
964
  didTimeout: didTimeout_1,
948
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
965
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
949
966
  });
950
967
  }
951
968
  };
@@ -966,7 +983,7 @@ function tokenize (tokens) {
966
983
  var reference = null;
967
984
  for (var i = 0; i < tokens.length; i++) {
968
985
  // Only optimize for string values
969
- if (typeof tokens[i] === "string" /* String */) {
986
+ if (typeof tokens[i] === "string" /* Constant.String */) {
970
987
  var token = tokens[i];
971
988
  var index = lookup[token] || -1;
972
989
  if (index >= 0) {
@@ -996,114 +1013,35 @@ function tokenize (tokens) {
996
1013
  return output;
997
1014
  }
998
1015
 
999
- var data$d = [];
1000
- var enabled = false;
1001
- var observer$2 = null;
1002
- function start$w() {
1003
- reset$j();
1004
- observer$2 = null;
1005
- enabled = window["ResizeObserver"] ? true : false;
1006
- }
1007
- function compute$8(id) {
1008
- if (enabled === false) {
1009
- return;
1010
- }
1011
- observer$2 = observer$2 === null ? new ResizeObserver(handler$4) : observer$2;
1012
- if (observer$2) {
1013
- var value = getValue(id);
1014
- // If this is the first time computing size for this node, go ahead and wire up ResizeObserver
1015
- // In all other cases, value.metadata.size will be null or an array with two elements [width, height]
1016
- // And, in those cases, we will skip through the following section and not attach the observer
1017
- if (value && value.metadata.size !== null && value.metadata.size.length === 0) {
1018
- var node = getNode(id);
1019
- if (node && node.nodeType === Node.ELEMENT_NODE) {
1020
- var e = node;
1021
- var r = e.getBoundingClientRect();
1022
- value.metadata.size = [Math.floor(r.width * 100 /* BoxPrecision */), Math.floor(r.height * 100 /* BoxPrecision */)];
1023
- observer$2.observe(e);
1024
- }
1025
- }
1026
- }
1027
- }
1028
- function handler$4(entries) {
1029
- window.requestAnimationFrame(function () {
1030
- for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
1031
- var entry = entries_1[_i];
1032
- var target = entry.target;
1033
- var id = target ? getId(target) : null;
1034
- if (id) {
1035
- var v = getValue(id);
1036
- var s = v.metadata.size;
1037
- var b = entry.borderBoxSize;
1038
- var w = null;
1039
- var h = null;
1040
- // Check if browser supports borderBoxSize property on ResizeObserverEntry object
1041
- // Otherwise, fall back to using getBoundingClientRect() to be cross browser compatible
1042
- // Reference: https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize
1043
- if (b && b.length > 0) {
1044
- w = Math.floor(b[0].inlineSize * 100 /* BoxPrecision */);
1045
- h = Math.floor(b[0].blockSize * 100 /* BoxPrecision */);
1046
- }
1047
- else {
1048
- var r = target.getBoundingClientRect();
1049
- w = Math.floor(r.width * 100 /* BoxPrecision */);
1050
- h = Math.floor(r.height * 100 /* BoxPrecision */);
1051
- }
1052
- // Capture new width & height only if they are different from what we have in in-memory cache
1053
- if (w !== s[0] && h !== s[1]) {
1054
- s = [w, h];
1055
- data$d.push({ id: id, width: w, height: h });
1056
- }
1057
- }
1058
- }
1059
- // Schedule encode only when we have at least one valid data entry
1060
- if (data$d.length > 0) {
1061
- encode$4(37 /* Box */);
1062
- }
1063
- });
1064
- }
1065
- function reset$j() {
1066
- data$d = [];
1067
- }
1068
- function stop$t() {
1069
- reset$j();
1070
- if (observer$2) {
1071
- observer$2.disconnect();
1072
- observer$2 = null;
1073
- }
1074
- enabled = false;
1075
- }
1076
-
1077
1016
  function encode$4 (type, timer, ts) {
1078
1017
  if (timer === void 0) { timer = null; }
1079
1018
  if (ts === void 0) { ts = null; }
1080
1019
  return __awaiter(this, void 0, void 0, function () {
1081
- var eventTime, tokens, _a, d, _i, _b, r, b, _c, b_1, entry, values, _d, values_1, value, state, data, active, suspend, privacy, mangle, keys, _e, keys_1, key, size, factor, attr;
1082
- return __generator(this, function (_f) {
1083
- switch (_f.label) {
1020
+ var eventTime, tokens, _a, d, _i, _b, r, values, _c, values_1, value, state, data, active, suspend, privacy, mangle, keys, _d, keys_1, key, box, factor, attr;
1021
+ return __generator(this, function (_e) {
1022
+ switch (_e.label) {
1084
1023
  case 0:
1085
1024
  eventTime = ts || time();
1086
1025
  tokens = [eventTime, type];
1087
1026
  _a = type;
1088
1027
  switch (_a) {
1089
- case 8 /* Document */: return [3 /*break*/, 1];
1090
- case 7 /* Region */: return [3 /*break*/, 2];
1091
- case 37 /* Box */: return [3 /*break*/, 3];
1092
- case 5 /* Discover */: return [3 /*break*/, 4];
1093
- case 6 /* Mutation */: return [3 /*break*/, 4];
1028
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1029
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1030
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1031
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1094
1032
  }
1095
- return [3 /*break*/, 11];
1033
+ return [3 /*break*/, 10];
1096
1034
  case 1:
1097
1035
  d = data$c;
1098
1036
  tokens.push(d.width);
1099
1037
  tokens.push(d.height);
1100
1038
  track$7(type, d.width, d.height);
1101
1039
  queue(tokens);
1102
- return [3 /*break*/, 11];
1040
+ return [3 /*break*/, 10];
1103
1041
  case 2:
1104
1042
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1105
1043
  r = _b[_i];
1106
- tokens = [r.time, 7 /* Region */];
1044
+ tokens = [r.time, 7 /* Event.Region */];
1107
1045
  tokens.push(r.data.id);
1108
1046
  tokens.push(r.data.interaction);
1109
1047
  tokens.push(r.data.visibility);
@@ -1111,39 +1049,28 @@ function encode$4 (type, timer, ts) {
1111
1049
  queue(tokens);
1112
1050
  }
1113
1051
  reset$6();
1114
- return [3 /*break*/, 11];
1052
+ return [3 /*break*/, 10];
1115
1053
  case 3:
1116
- b = data$d;
1117
- for (_c = 0, b_1 = b; _c < b_1.length; _c++) {
1118
- entry = b_1[_c];
1119
- tokens.push(entry.id);
1120
- tokens.push(entry.width);
1121
- tokens.push(entry.height);
1122
- }
1123
- reset$j();
1124
- queue(tokens);
1125
- return [3 /*break*/, 11];
1126
- case 4:
1127
1054
  // Check if we are operating within the context of the current page
1128
- if (state$8(timer) === 2 /* Stop */) {
1129
- return [3 /*break*/, 11];
1055
+ if (state$8(timer) === 2 /* Task.Stop */) {
1056
+ return [3 /*break*/, 10];
1130
1057
  }
1131
1058
  values = updates$2();
1132
- if (!(values.length > 0)) return [3 /*break*/, 10];
1133
- _d = 0, values_1 = values;
1134
- _f.label = 5;
1135
- case 5:
1136
- if (!(_d < values_1.length)) return [3 /*break*/, 9];
1137
- value = values_1[_d];
1059
+ if (!(values.length > 0)) return [3 /*break*/, 9];
1060
+ _c = 0, values_1 = values;
1061
+ _e.label = 4;
1062
+ case 4:
1063
+ if (!(_c < values_1.length)) return [3 /*break*/, 8];
1064
+ value = values_1[_c];
1138
1065
  state = state$8(timer);
1139
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 7];
1066
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1140
1067
  return [4 /*yield*/, suspend$1(timer)];
1068
+ case 5:
1069
+ state = _e.sent();
1070
+ _e.label = 6;
1141
1071
  case 6:
1142
- state = _f.sent();
1143
- _f.label = 7;
1144
- case 7:
1145
- if (state === 2 /* Stop */) {
1146
- return [3 /*break*/, 9];
1072
+ if (state === 2 /* Task.Stop */) {
1073
+ return [3 /*break*/, 8];
1147
1074
  }
1148
1075
  data = value.data;
1149
1076
  active = value.metadata.active;
@@ -1151,13 +1078,12 @@ function encode$4 (type, timer, ts) {
1151
1078
  privacy = value.metadata.privacy;
1152
1079
  mangle = shouldMangle(value);
1153
1080
  keys = active ? ["tag", "attributes", "value"] : ["tag"];
1154
- compute$8(value.id);
1155
- for (_e = 0, keys_1 = keys; _e < keys_1.length; _e++) {
1156
- key = keys_1[_e];
1081
+ for (_d = 0, keys_1 = keys; _d < keys_1.length; _d++) {
1082
+ key = keys_1[_d];
1157
1083
  if (data[key]) {
1158
1084
  switch (key) {
1159
1085
  case "tag":
1160
- size = value.metadata.size;
1086
+ box = size$1(value);
1161
1087
  factor = mangle ? -1 : 1;
1162
1088
  tokens.push(value.id * factor);
1163
1089
  if (value.parent && active) {
@@ -1166,9 +1092,9 @@ function encode$4 (type, timer, ts) {
1166
1092
  if (value.previous && active) {
1167
1093
  tokens.push(value.previous);
1168
1094
  }
1169
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1170
- if (size && size.length === 2) {
1171
- tokens.push("" + "#" /* Box */ + str$1(size[0]) + "." + str$1(size[1]));
1095
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1096
+ if (box && box.length === 2) {
1097
+ tokens.push("".concat("#" /* Constant.Box */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1172
1098
  }
1173
1099
  break;
1174
1100
  case "attributes":
@@ -1179,36 +1105,46 @@ function encode$4 (type, timer, ts) {
1179
1105
  }
1180
1106
  break;
1181
1107
  case "value":
1108
+ check$4(value.metadata.fraud, value.id, data[key]);
1182
1109
  tokens.push(scrub(data[key], data.tag, privacy, mangle));
1183
1110
  break;
1184
1111
  }
1185
1112
  }
1186
1113
  }
1187
- _f.label = 8;
1114
+ _e.label = 7;
1115
+ case 7:
1116
+ _c++;
1117
+ return [3 /*break*/, 4];
1188
1118
  case 8:
1189
- _d++;
1190
- return [3 /*break*/, 5];
1191
- case 9:
1192
- if (type === 6 /* Mutation */) {
1119
+ if (type === 6 /* Event.Mutation */) {
1193
1120
  activity(eventTime);
1194
1121
  }
1195
1122
  queue(tokenize(tokens), !config$1.lean);
1196
- _f.label = 10;
1197
- case 10: return [3 /*break*/, 11];
1198
- case 11: return [2 /*return*/];
1123
+ _e.label = 9;
1124
+ case 9: return [3 /*break*/, 10];
1125
+ case 10: return [2 /*return*/];
1199
1126
  }
1200
1127
  });
1201
1128
  });
1202
1129
  }
1203
1130
  function shouldMangle(value) {
1204
1131
  var privacy = value.metadata.privacy;
1205
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1132
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1133
+ }
1134
+ function size$1(value) {
1135
+ if (value.metadata.size !== null && value.metadata.size.length === 0) {
1136
+ var img = getNode(value.id);
1137
+ if (img) {
1138
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1139
+ }
1140
+ }
1141
+ return value.metadata.size;
1206
1142
  }
1207
1143
  function str$1(input) {
1208
1144
  return input.toString(36);
1209
1145
  }
1210
1146
  function attribute(key, value, privacy) {
1211
- return key + "=" + scrub(value, key, privacy);
1147
+ return "".concat(key, "=").concat(scrub(value, key, privacy));
1212
1148
  }
1213
1149
 
1214
1150
  var data$c;
@@ -1239,7 +1175,7 @@ function compute$7() {
1239
1175
  // Check that width or height has changed from before, and also that width & height are not null values
1240
1176
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1241
1177
  data$c = { width: width, height: height };
1242
- encode$4(8 /* Document */);
1178
+ encode$4(8 /* Event.Document */);
1243
1179
  }
1244
1180
  }
1245
1181
  function end() {
@@ -1268,7 +1204,7 @@ function start$u() {
1268
1204
  reset$h();
1269
1205
  }
1270
1206
  function observe$b(root) {
1271
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1207
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1272
1208
  }
1273
1209
  function handler$3(event, root, evt) {
1274
1210
  var frame = iframe(root);
@@ -1294,8 +1230,8 @@ function handler$3(event, root, evt) {
1294
1230
  x = Math.round(l.x + (l.w / 2));
1295
1231
  y = Math.round(l.y + (l.h / 2));
1296
1232
  }
1297
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1298
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1233
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1234
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1299
1235
  // Check for null values before processing this event
1300
1236
  if (x !== null && y !== null) {
1301
1237
  state$7.push({
@@ -1312,7 +1248,8 @@ function handler$3(event, root, evt) {
1312
1248
  context: context(a),
1313
1249
  text: text(t),
1314
1250
  link: a ? a.href : null,
1315
- hash: null
1251
+ hash: null,
1252
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1316
1253
  }
1317
1254
  });
1318
1255
  schedule$1(encode$3.bind(this, event));
@@ -1327,7 +1264,7 @@ function text(element) {
1327
1264
  // Trim any spaces at the beginning or at the end of string
1328
1265
  // Also, replace multiple occurrence of space characters with a single white space
1329
1266
  // Finally, send only first few characters as specified by the Setting
1330
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1267
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1331
1268
  }
1332
1269
  }
1333
1270
  return output;
@@ -1336,10 +1273,10 @@ function reaction(element) {
1336
1273
  if (element.nodeType === Node.ELEMENT_NODE) {
1337
1274
  var tag = element.tagName.toLowerCase();
1338
1275
  if (UserInputTags.indexOf(tag) >= 0) {
1339
- return 0 /* False */;
1276
+ return 0 /* BooleanFlag.False */;
1340
1277
  }
1341
1278
  }
1342
- return 1 /* True */;
1279
+ return 1 /* BooleanFlag.True */;
1343
1280
  }
1344
1281
  function layout$1(element) {
1345
1282
  var box = null;
@@ -1363,14 +1300,14 @@ function layout$1(element) {
1363
1300
  return box;
1364
1301
  }
1365
1302
  function context(a) {
1366
- if (a && a.hasAttribute("target" /* Target */)) {
1367
- switch (a.getAttribute("target" /* Target */)) {
1368
- case "_blank" /* Blank */: return 1 /* Blank */;
1369
- case "_parent" /* Parent */: return 2 /* Parent */;
1370
- case "_top" /* Top */: return 3 /* Top */;
1303
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1304
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1305
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1306
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1307
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1371
1308
  }
1372
1309
  }
1373
- return 0 /* Self */;
1310
+ return 0 /* BrowsingContext.Self */;
1374
1311
  }
1375
1312
  function reset$h() {
1376
1313
  state$7 = [];
@@ -1384,13 +1321,13 @@ function start$t() {
1384
1321
  reset$g();
1385
1322
  }
1386
1323
  function observe$a(root) {
1387
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1388
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1389
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1324
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1325
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1326
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1390
1327
  }
1391
1328
  function recompute$7(action, evt) {
1392
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1393
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1329
+ state$6.push({ time: time(), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1330
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1394
1331
  }
1395
1332
  function reset$g() {
1396
1333
  state$6 = [];
@@ -1411,27 +1348,21 @@ function recompute$6(evt) {
1411
1348
  var input = target(evt);
1412
1349
  var value = get(input);
1413
1350
  if (input && input.type && value) {
1414
- var v = void 0;
1351
+ var v = input.value;
1415
1352
  switch (input.type) {
1416
1353
  case "radio":
1417
1354
  case "checkbox":
1418
1355
  v = input.checked ? "true" : "false";
1419
1356
  break;
1420
- case "range":
1421
- v = input.value;
1422
- break;
1423
- default:
1424
- v = scrub(input.value, "input", value.metadata.privacy);
1425
- break;
1426
1357
  }
1427
1358
  var data = { target: input, value: v };
1428
1359
  // If last entry in the queue is for the same target node as the current one, remove it so we can later swap it with current data.
1429
1360
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1430
1361
  state$5.pop();
1431
1362
  }
1432
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1363
+ state$5.push({ time: time(), event: 27 /* Event.Input */, data: data });
1433
1364
  clearTimeout(timeout$5);
1434
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1365
+ timeout$5 = setTimeout(process$6, 500 /* Setting.LookAhead */, 27 /* Event.Input */);
1435
1366
  }
1436
1367
  }
1437
1368
  function process$6(event) {
@@ -1451,15 +1382,15 @@ function start$r() {
1451
1382
  reset$e();
1452
1383
  }
1453
1384
  function observe$8(root) {
1454
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1455
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1456
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1457
- bind(root, "mousewheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1458
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1459
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1460
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1461
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1462
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1385
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1386
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1387
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1388
+ bind(root, "mousewheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1389
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1390
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1391
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1392
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1393
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1463
1394
  }
1464
1395
  function mouse(event, root, evt) {
1465
1396
  var frame = iframe(root);
@@ -1498,9 +1429,9 @@ function touch(event, root, evt) {
1498
1429
  }
1499
1430
  function handler$2(current) {
1500
1431
  switch (current.event) {
1501
- case 12 /* MouseMove */:
1502
- case 15 /* MouseWheel */:
1503
- case 19 /* TouchMove */:
1432
+ case 12 /* Event.MouseMove */:
1433
+ case 15 /* Event.MouseWheel */:
1434
+ case 19 /* Event.TouchMove */:
1504
1435
  var length_1 = state$4.length;
1505
1436
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1506
1437
  if (last && similar$1(last, current)) {
@@ -1508,7 +1439,7 @@ function handler$2(current) {
1508
1439
  }
1509
1440
  state$4.push(current);
1510
1441
  clearTimeout(timeout$4);
1511
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1442
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1512
1443
  break;
1513
1444
  default:
1514
1445
  state$4.push(current);
@@ -1528,7 +1459,7 @@ function similar$1(last, current) {
1528
1459
  var distance = Math.sqrt(dx * dx + dy * dy);
1529
1460
  var gap = current.time - last.time;
1530
1461
  var match = current.data.target === last.data.target;
1531
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1462
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1532
1463
  }
1533
1464
  function stop$p() {
1534
1465
  clearTimeout(timeout$4);
@@ -1551,7 +1482,7 @@ function recompute$5() {
1551
1482
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1552
1483
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1553
1484
  };
1554
- encode$3(11 /* Resize */);
1485
+ encode$3(11 /* Event.Resize */);
1555
1486
  }
1556
1487
  function reset$d() {
1557
1488
  data$b = null;
@@ -1587,7 +1518,7 @@ function recompute$4(event) {
1587
1518
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1588
1519
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1589
1520
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1590
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1521
+ var current = { time: time(), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1591
1522
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1592
1523
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1593
1524
  return;
@@ -1599,7 +1530,7 @@ function recompute$4(event) {
1599
1530
  }
1600
1531
  state$3.push(current);
1601
1532
  clearTimeout(timeout$3);
1602
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1533
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1603
1534
  }
1604
1535
  function reset$c() {
1605
1536
  state$3 = [];
@@ -1610,7 +1541,7 @@ function process$4(event) {
1610
1541
  function similar(last, current) {
1611
1542
  var dx = last.data.x - current.data.x;
1612
1543
  var dy = last.data.y - current.data.y;
1613
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1544
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1614
1545
  }
1615
1546
  function stop$n() {
1616
1547
  clearTimeout(timeout$3);
@@ -1645,7 +1576,7 @@ function recompute$3(root) {
1645
1576
  var startNode = data$a.start ? data$a.start : null;
1646
1577
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1647
1578
  clearTimeout(timeout$2);
1648
- process$3(21 /* Selection */);
1579
+ process$3(21 /* Event.Selection */);
1649
1580
  }
1650
1581
  data$a = {
1651
1582
  start: current.anchorNode,
@@ -1655,7 +1586,7 @@ function recompute$3(root) {
1655
1586
  };
1656
1587
  previous = current;
1657
1588
  clearTimeout(timeout$2);
1658
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1589
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1659
1590
  }
1660
1591
  function process$3(event) {
1661
1592
  schedule$1(encode$3.bind(this, event));
@@ -1677,8 +1608,8 @@ function observe$5(root) {
1677
1608
  bind(root, "submit", recompute$2, true);
1678
1609
  }
1679
1610
  function recompute$2(evt) {
1680
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1681
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1611
+ state$2.push({ time: time(), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1612
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1682
1613
  }
1683
1614
  function reset$a() {
1684
1615
  state$2 = [];
@@ -1693,7 +1624,7 @@ function start$m() {
1693
1624
  }
1694
1625
  function recompute$1(evt) {
1695
1626
  data$9 = { name: evt.type };
1696
- encode$3(26 /* Unload */);
1627
+ encode$3(26 /* Event.Unload */);
1697
1628
  stop();
1698
1629
  }
1699
1630
  function reset$9() {
@@ -1710,7 +1641,7 @@ function start$l() {
1710
1641
  }
1711
1642
  function recompute() {
1712
1643
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1713
- encode$3(28 /* Visibility */);
1644
+ encode$3(28 /* Event.Visibility */);
1714
1645
  }
1715
1646
  function reset$8() {
1716
1647
  data$8 = null;
@@ -1772,51 +1703,51 @@ function ld(json) {
1772
1703
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1773
1704
  var key = _a[_i];
1774
1705
  var value = json[key];
1775
- if (key === "@type" /* Type */ && typeof value === "string") {
1706
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1776
1707
  value = value.toLowerCase();
1777
1708
  /* Normalizations */
1778
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1709
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1779
1710
  switch (value) {
1780
- case "article" /* Article */:
1781
- case "recipe" /* Recipe */:
1782
- log(5 /* SchemaType */, json[key]);
1783
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1784
- log(18 /* Headline */, json["headline" /* Headline */]);
1711
+ case "article" /* JsonLD.Article */:
1712
+ case "recipe" /* JsonLD.Recipe */:
1713
+ log(5 /* Dimension.SchemaType */, json[key]);
1714
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1715
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1785
1716
  break;
1786
- case "product" /* Product */:
1787
- log(5 /* SchemaType */, json[key]);
1788
- log(10 /* ProductName */, json["name" /* Name */]);
1789
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1790
- if (json["brand" /* Brand */]) {
1791
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1717
+ case "product" /* JsonLD.Product */:
1718
+ log(5 /* Dimension.SchemaType */, json[key]);
1719
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1720
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1721
+ if (json["brand" /* JsonLD.Brand */]) {
1722
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1792
1723
  }
1793
1724
  break;
1794
- case "aggregaterating" /* AggregateRating */:
1795
- if (json["ratingValue" /* RatingValue */]) {
1796
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1797
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1798
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1725
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1726
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1727
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1728
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1729
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1799
1730
  }
1800
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1801
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1731
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1732
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1802
1733
  break;
1803
- case "person" /* Author */:
1804
- log(8 /* AuthorName */, json["name" /* Name */]);
1734
+ case "person" /* JsonLD.Author */:
1735
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1805
1736
  break;
1806
- case "offer" /* Offer */:
1807
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1808
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1809
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1810
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1811
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1737
+ case "offer" /* JsonLD.Offer */:
1738
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1739
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1740
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1741
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1742
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1812
1743
  break;
1813
- case "brand" /* Brand */:
1814
- log(6 /* ProductBrand */, json["name" /* Name */]);
1744
+ case "brand" /* JsonLD.Brand */:
1745
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1815
1746
  break;
1816
1747
  }
1817
1748
  }
1818
1749
  // Continue parsing nested objects
1819
- if (value !== null && typeof (value) === "object" /* Object */) {
1750
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1820
1751
  ld(value);
1821
1752
  }
1822
1753
  }
@@ -1825,23 +1756,23 @@ function num$1(input, scale) {
1825
1756
  if (scale === void 0) { scale = 1; }
1826
1757
  if (input !== null) {
1827
1758
  switch (typeof input) {
1828
- case "number" /* Number */: return Math.round(input * scale);
1829
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1759
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1760
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1830
1761
  }
1831
1762
  }
1832
1763
  return null;
1833
1764
  }
1834
1765
 
1835
- var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror"];
1766
+ var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror", "data-drupal-form-submit-last"];
1836
1767
  var newlineRegex = /[\r\n]+/g;
1837
1768
  function processNode (node, source) {
1838
1769
  var child = null;
1839
1770
  // Do not track this change if we are attempting to remove a node before discovering it
1840
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1771
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1841
1772
  return child;
1842
1773
  }
1843
1774
  // Special handling for text nodes that belong to style nodes
1844
- if (source !== 0 /* Discover */ &&
1775
+ if (source !== 0 /* Source.Discover */ &&
1845
1776
  node.nodeType === Node.TEXT_NODE &&
1846
1777
  node.parentElement &&
1847
1778
  node.parentElement.tagName === "STYLE") {
@@ -1854,10 +1785,10 @@ function processNode (node, source) {
1854
1785
  switch (node.nodeType) {
1855
1786
  case Node.DOCUMENT_TYPE_NODE:
1856
1787
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1857
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1788
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1858
1789
  var doctype = node;
1859
1790
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1860
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1791
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1861
1792
  dom[call](node, parent, docData, source);
1862
1793
  break;
1863
1794
  case Node.DOCUMENT_NODE:
@@ -1872,26 +1803,26 @@ function processNode (node, source) {
1872
1803
  if (shadowRoot.host) {
1873
1804
  parse$1(shadowRoot);
1874
1805
  var type = typeof (shadowRoot.constructor);
1875
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1806
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1876
1807
  observe$3(shadowRoot);
1877
1808
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1878
1809
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1879
1810
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1880
1811
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1881
- var style = "" /* Empty */;
1812
+ var style = "" /* Constant.Empty */;
1882
1813
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1883
1814
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1884
1815
  var styleSheet = adoptedStyleSheets_1[_i];
1885
1816
  style += getCssRules(styleSheet);
1886
1817
  }
1887
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1818
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1888
1819
  dom[call](node, shadowRoot.host, fragementData, source);
1889
1820
  }
1890
1821
  else {
1891
1822
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1892
1823
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1893
1824
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1894
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1825
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1895
1826
  }
1896
1827
  }
1897
1828
  break;
@@ -1904,7 +1835,7 @@ function processNode (node, source) {
1904
1835
  // The only exception is when we receive a mutation to remove the text node, in that case
1905
1836
  // parent will be null, but we can still process the node by checking it's an update call.
1906
1837
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1907
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1838
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1908
1839
  dom[call](node, parent, textData, source);
1909
1840
  }
1910
1841
  break;
@@ -1916,20 +1847,20 @@ function processNode (node, source) {
1916
1847
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1917
1848
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1918
1849
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1919
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1920
- tag = "svg:" /* SvgPrefix */ + tag;
1850
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1851
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1921
1852
  }
1922
1853
  switch (tag) {
1923
1854
  case "HTML":
1924
1855
  parent = insideFrame && parent ? iframe(parent) : null;
1925
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1856
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1926
1857
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1927
1858
  dom[call](node, parent, htmlData, source);
1928
1859
  break;
1929
1860
  case "SCRIPT":
1930
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1861
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1931
1862
  try {
1932
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1863
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1933
1864
  }
1934
1865
  catch ( /* do nothing */_a) { /* do nothing */ }
1935
1866
  }
@@ -1937,20 +1868,20 @@ function processNode (node, source) {
1937
1868
  case "NOSCRIPT":
1938
1869
  break;
1939
1870
  case "META":
1940
- var key = ("property" /* Property */ in attributes ?
1941
- "property" /* Property */ :
1942
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1943
- if (key && "content" /* Content */ in attributes) {
1944
- var content = attributes["content" /* Content */];
1871
+ var key = ("property" /* Constant.Property */ in attributes ?
1872
+ "property" /* Constant.Property */ :
1873
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1874
+ if (key && "content" /* Constant.Content */ in attributes) {
1875
+ var content = attributes["content" /* Constant.Content */];
1945
1876
  switch (attributes[key]) {
1946
- case "og:title" /* ogTitle */:
1947
- log(20 /* MetaTitle */, content);
1877
+ case "og:title" /* Constant.ogTitle */:
1878
+ log(20 /* Dimension.MetaTitle */, content);
1948
1879
  break;
1949
- case "og:type" /* ogType */:
1950
- log(19 /* MetaType */, content);
1880
+ case "og:type" /* Constant.ogType */:
1881
+ log(19 /* Dimension.MetaType */, content);
1951
1882
  break;
1952
- case "generator" /* Generator */:
1953
- log(21 /* Generator */, content);
1883
+ case "generator" /* Constant.Generator */:
1884
+ log(21 /* Dimension.Generator */, content);
1954
1885
  break;
1955
1886
  }
1956
1887
  }
@@ -1958,7 +1889,7 @@ function processNode (node, source) {
1958
1889
  case "HEAD":
1959
1890
  var head = { tag: tag, attributes: attributes };
1960
1891
  if (location) {
1961
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1892
+ head.attributes["*B" /* Constant.Base */] = location.protocol + "//" + location.hostname;
1962
1893
  }
1963
1894
  dom[call](node, parent, head, source);
1964
1895
  break;
@@ -1971,7 +1902,7 @@ function processNode (node, source) {
1971
1902
  var frameData = { tag: tag, attributes: attributes };
1972
1903
  if (sameorigin(iframe$1)) {
1973
1904
  monitor(iframe$1);
1974
- frameData.attributes["*O" /* SameOrigin */] = "true";
1905
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1975
1906
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1976
1907
  child = iframe$1.contentDocument;
1977
1908
  }
@@ -2000,7 +1931,7 @@ function observe$3(root) {
2000
1931
  function getStyleValue(style) {
2001
1932
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
2002
1933
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
2003
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
1934
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
2004
1935
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
2005
1936
  if (value.length === 0 || dataset > 0) {
2006
1937
  value = getCssRules(style.sheet);
@@ -2008,14 +1939,14 @@ function getStyleValue(style) {
2008
1939
  return value;
2009
1940
  }
2010
1941
  function getCssRules(sheet) {
2011
- var value = "" /* Empty */;
1942
+ var value = "" /* Constant.Empty */;
2012
1943
  var cssRules = null;
2013
1944
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
2014
1945
  try {
2015
1946
  cssRules = sheet ? sheet.cssRules : [];
2016
1947
  }
2017
1948
  catch (e) {
2018
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
1949
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
2019
1950
  if (e && e.name !== "SecurityError") {
2020
1951
  throw e;
2021
1952
  }
@@ -2039,8 +1970,8 @@ function getAttributes(element) {
2039
1970
  }
2040
1971
  }
2041
1972
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
2042
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
2043
- output["value" /* Value */] = element.value;
1973
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
1974
+ output["value" /* Constant.Value */] = element.value;
2044
1975
  }
2045
1976
  return output;
2046
1977
  }
@@ -2062,13 +1993,13 @@ function traverse (root, timer, source) {
2062
1993
  next = next.nextSibling;
2063
1994
  }
2064
1995
  state = state$8(timer);
2065
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
1996
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2066
1997
  return [4 /*yield*/, suspend$1(timer)];
2067
1998
  case 2:
2068
1999
  state = _a.sent();
2069
2000
  _a.label = 3;
2070
2001
  case 3:
2071
- if (state === 2 /* Stop */) {
2002
+ if (state === 2 /* Task.Stop */) {
2072
2003
  return [3 /*break*/, 4];
2073
2004
  }
2074
2005
  subnode = processNode(node, source);
@@ -2145,7 +2076,7 @@ function observe$2(node) {
2145
2076
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2146
2077
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2147
2078
  try {
2148
- var m = api("MutationObserver" /* MutationObserver */);
2079
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2149
2080
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2150
2081
  if (observer) {
2151
2082
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2153,7 +2084,7 @@ function observe$2(node) {
2153
2084
  }
2154
2085
  }
2155
2086
  catch (e) {
2156
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2087
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2157
2088
  }
2158
2089
  }
2159
2090
  function monitor(frame) {
@@ -2161,7 +2092,7 @@ function monitor(frame) {
2161
2092
  // This includes cases where iframe location is updated without explicitly updating src attribute
2162
2093
  // E.g. iframe.contentWindow.location.href = "new-location";
2163
2094
  if (has(frame) === false) {
2164
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2095
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2165
2096
  }
2166
2097
  }
2167
2098
  function stop$h() {
@@ -2179,15 +2110,15 @@ function stop$h() {
2179
2110
  timeout$1 = null;
2180
2111
  }
2181
2112
  function active$2() {
2182
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2113
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2183
2114
  }
2184
2115
  function handle$1(m) {
2185
2116
  // Queue up mutation records for asynchronous processing
2186
2117
  var now = time();
2187
- track$6(6 /* Mutation */, now);
2118
+ track$6(6 /* Event.Mutation */, now);
2188
2119
  mutations.push({ time: now, mutations: m });
2189
- schedule$1(process$2, 1 /* High */).then(function () {
2190
- measure(compute$7)();
2120
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2121
+ setTimeout(compute$7);
2191
2122
  measure(compute$6)();
2192
2123
  });
2193
2124
  }
@@ -2197,8 +2128,8 @@ function process$2() {
2197
2128
  return __generator(this, function (_b) {
2198
2129
  switch (_b.label) {
2199
2130
  case 0:
2200
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2201
- start$x(timer);
2131
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2132
+ start$w(timer);
2202
2133
  _b.label = 1;
2203
2134
  case 1:
2204
2135
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2209,13 +2140,13 @@ function process$2() {
2209
2140
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2210
2141
  mutation = _a[_i];
2211
2142
  state = state$8(timer);
2212
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2143
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2213
2144
  return [4 /*yield*/, suspend$1(timer)];
2214
2145
  case 3:
2215
2146
  state = _b.sent();
2216
2147
  _b.label = 4;
2217
2148
  case 4:
2218
- if (state === 2 /* Stop */) {
2149
+ if (state === 2 /* Task.Stop */) {
2219
2150
  return [3 /*break*/, 6];
2220
2151
  }
2221
2152
  target = mutation.target;
@@ -2227,17 +2158,17 @@ function process$2() {
2227
2158
  parse$1(target);
2228
2159
  }
2229
2160
  switch (type) {
2230
- case "attributes" /* Attributes */:
2231
- processNode(target, 3 /* Attributes */);
2161
+ case "attributes" /* Constant.Attributes */:
2162
+ processNode(target, 3 /* Source.Attributes */);
2232
2163
  break;
2233
- case "characterData" /* CharacterData */:
2234
- processNode(target, 4 /* CharacterData */);
2164
+ case "characterData" /* Constant.CharacterData */:
2165
+ processNode(target, 4 /* Source.CharacterData */);
2235
2166
  break;
2236
- case "childList" /* ChildList */:
2237
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2238
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2167
+ case "childList" /* Constant.ChildList */:
2168
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2169
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2239
2170
  break;
2240
- case "suspend" /* Suspend */:
2171
+ case "suspend" /* Constant.Suspend */:
2241
2172
  value = get(target);
2242
2173
  if (value) {
2243
2174
  value.metadata.suspend = true;
@@ -2248,12 +2179,12 @@ function process$2() {
2248
2179
  case 5:
2249
2180
  _i++;
2250
2181
  return [3 /*break*/, 2];
2251
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2182
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2252
2183
  case 7:
2253
2184
  _b.sent();
2254
2185
  return [3 /*break*/, 1];
2255
2186
  case 8:
2256
- stop$u(timer);
2187
+ stop$t(timer);
2257
2188
  return [2 /*return*/];
2258
2189
  }
2259
2190
  });
@@ -2262,11 +2193,11 @@ function process$2() {
2262
2193
  function track$5(m, timer) {
2263
2194
  var value = m.target ? get(m.target.parentNode) : null;
2264
2195
  // Check if the parent is already discovered and that the parent is not the document root
2265
- if (value && value.data.tag !== "HTML" /* HTML */) {
2196
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2266
2197
  var inactive = time() > activePeriod;
2267
2198
  var target = get(m.target);
2268
2199
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2269
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2200
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2270
2201
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2271
2202
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2272
2203
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2275,20 +2206,20 @@ function track$5(m, timer) {
2275
2206
  history$4[key] = key in history$4 ? history$4[key] : [0];
2276
2207
  var h = history$4[key];
2277
2208
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2278
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2279
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2209
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2210
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2280
2211
  }
2281
2212
  // Update the counter
2282
2213
  h[0] = inactive ? h[0] + 1 : 1;
2283
2214
  // Return updated mutation type based on if we have already hit the threshold or not
2284
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2215
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2285
2216
  // Store a reference to removedNodes so we can process them later
2286
2217
  // when we resume mutations again on user interactions
2287
2218
  h[1] = m.removedNodes;
2288
- return "suspend" /* Suspend */;
2219
+ return "suspend" /* Constant.Suspend */;
2289
2220
  }
2290
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2291
- return "" /* Empty */;
2221
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2222
+ return "" /* Constant.Empty */;
2292
2223
  }
2293
2224
  }
2294
2225
  return m.type;
@@ -2311,18 +2242,18 @@ function processNodeList(list, source, timer) {
2311
2242
  _a.label = 1;
2312
2243
  case 1:
2313
2244
  if (!(i < length)) return [3 /*break*/, 6];
2314
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2245
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2315
2246
  traverse(list[i], timer, source);
2316
2247
  return [3 /*break*/, 5];
2317
2248
  case 2:
2318
2249
  state = state$8(timer);
2319
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2250
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2320
2251
  return [4 /*yield*/, suspend$1(timer)];
2321
2252
  case 3:
2322
2253
  state = _a.sent();
2323
2254
  _a.label = 4;
2324
2255
  case 4:
2325
- if (state === 2 /* Stop */) {
2256
+ if (state === 2 /* Task.Stop */) {
2326
2257
  return [3 /*break*/, 6];
2327
2258
  }
2328
2259
  processNode(list[i], source);
@@ -2347,7 +2278,7 @@ function schedule(node, fragment) {
2347
2278
  if (timeout$1) {
2348
2279
  clearTimeout(timeout$1);
2349
2280
  }
2350
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2281
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2351
2282
  return node;
2352
2283
  }
2353
2284
  function trigger$1(fragment) {
@@ -2360,7 +2291,7 @@ function trigger$1(fragment) {
2360
2291
  if (shadowRoot && has(node)) {
2361
2292
  continue;
2362
2293
  }
2363
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2294
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2364
2295
  }
2365
2296
  }
2366
2297
  queue$2 = [];
@@ -2380,10 +2311,6 @@ function generate(target, type) {
2380
2311
  }
2381
2312
 
2382
2313
  var index = 1;
2383
- // Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input#%3Cinput%3E_types
2384
- var DISALLOWED_TYPES = ["password", "hidden", "email", "tel"];
2385
- var DISALLOWED_NAMES = ["addr", "cell", "code", "dob", "email", "mob", "name", "phone", "secret", "social", "ssn", "tel", "zip", "pass", "card", "account", "cvv", "ccv"];
2386
- var DISALLOWED_MATCH = ["address", "password", "contact"];
2387
2314
  var nodes = [];
2388
2315
  var values = [];
2389
2316
  var updateMap = [];
@@ -2391,10 +2318,13 @@ var hashMap = {};
2391
2318
  var override = [];
2392
2319
  var unmask = [];
2393
2320
  var updatedFragments = {};
2321
+ var maskText = [];
2322
+ var maskDisable = [];
2394
2323
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2395
2324
  var idMap = null; // Maps node => id.
2396
2325
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
2397
2326
  var privacyMap = null; // Maps node => Privacy (enum)
2327
+ var fraudMap = null; // Maps node => FraudId (number)
2398
2328
  function start$i() {
2399
2329
  reset$7();
2400
2330
  parse$1(document, true);
@@ -2410,9 +2340,12 @@ function reset$7() {
2410
2340
  hashMap = {};
2411
2341
  override = [];
2412
2342
  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" /* Mask.Text */.split("," /* Constant.Comma */);
2344
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2413
2345
  idMap = new WeakMap();
2414
2346
  iframeMap = new WeakMap();
2415
2347
  privacyMap = new WeakMap();
2348
+ fraudMap = new WeakMap();
2416
2349
  }
2417
2350
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
2418
2351
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -2423,18 +2356,19 @@ function parse$1(root, init) {
2423
2356
  try {
2424
2357
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2425
2358
  if (init) {
2426
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2359
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2427
2360
  }
2428
2361
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2429
2362
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2430
2363
  if ("querySelectorAll" in root) {
2431
- config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "" + x[0]); }); }); // Regions
2432
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2433
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2364
+ 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 /* Privacy.TextImage */); }); }); // Masked Elements
2366
+ 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 /* Privacy.None */); }); }); // Unmasked Elements
2434
2368
  }
2435
2369
  }
2436
2370
  catch (e) {
2437
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2371
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2438
2372
  }
2439
2373
  }
2440
2374
  function getId(node, autogen) {
@@ -2453,22 +2387,22 @@ function add(node, parent, data, source) {
2453
2387
  var id = getId(node, true);
2454
2388
  var parentId = parent ? getId(parent) : null;
2455
2389
  var previousId = getPreviousId(node);
2456
- var privacy = config$1.content ? 1 /* Sensitive */ : 2 /* Text */;
2457
2390
  var parentValue = null;
2458
2391
  var regionId = exists(node) ? id : null;
2459
2392
  var fragmentId = null;
2393
+ var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2394
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 2 /* Privacy.Text */;
2460
2395
  if (parentId >= 0 && values[parentId]) {
2461
2396
  parentValue = values[parentId];
2462
2397
  parentValue.children.push(id);
2463
2398
  regionId = regionId === null ? parentValue.region : regionId;
2464
2399
  fragmentId = parentValue.fragment;
2465
- privacy = parentValue.metadata.privacy;
2400
+ fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
2401
+ privacyId = parentValue.metadata.privacy;
2466
2402
  }
2467
- // Check to see if this particular node should be masked or not
2468
- privacy = getPrivacy(node, data, parentValue, privacy);
2469
2403
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2470
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2471
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2404
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2405
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2472
2406
  regionId = id;
2473
2407
  }
2474
2408
  nodes[id] = node;
@@ -2481,11 +2415,12 @@ function add(node, parent, data, source) {
2481
2415
  selector: null,
2482
2416
  hash: null,
2483
2417
  region: regionId,
2484
- metadata: { active: true, suspend: false, privacy: privacy, position: null, size: null },
2418
+ metadata: { active: true, suspend: false, privacy: privacyId, position: null, fraud: fraudId, size: null },
2485
2419
  fragment: fragmentId,
2486
2420
  };
2421
+ privacy(node, values[id], parentValue);
2487
2422
  updateSelector(values[id]);
2488
- size(values[id], parentValue);
2423
+ size(values[id]);
2489
2424
  track$4(id, source, values[id].fragment);
2490
2425
  }
2491
2426
  function update$1(node, parent, data, source) {
@@ -2545,7 +2480,7 @@ function update$1(node, parent, data, source) {
2545
2480
  }
2546
2481
  function sameorigin(node) {
2547
2482
  var output = false;
2548
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2483
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2549
2484
  var frame = node;
2550
2485
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2551
2486
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2565,75 +2500,61 @@ function iframe(node) {
2565
2500
  var doc = node.nodeType === Node.DOCUMENT_NODE ? node : null;
2566
2501
  return doc && iframeMap.has(doc) ? iframeMap.get(doc) : null;
2567
2502
  }
2568
- function getPrivacy(node, data, parent, privacy) {
2569
- var attributes = data.attributes;
2503
+ function privacy(node, value, parent) {
2504
+ var data = value.data;
2505
+ var metadata = value.metadata;
2506
+ var current = metadata.privacy;
2507
+ var attributes = data.attributes || {};
2570
2508
  var tag = data.tag.toUpperCase();
2571
- // If this node was explicitly configured to contain sensitive content, use that information and return the value
2572
- if (privacyMap.has(node)) {
2573
- return privacyMap.get(node);
2574
- }
2575
- // If it's a text node belonging to a STYLE or TITLE tag;
2576
- // Or, the text node belongs to one of SCRUB_EXCEPTIONS
2577
- // then reset the privacy setting to ensure we capture the content
2578
- if (tag === "*T" /* TextTag */ && parent && parent.data) {
2579
- var path = parent.selector ? parent.selector[0 /* Stable */] : "" /* Empty */;
2580
- privacy = parent.data.tag === "STYLE" /* StyleTag */ || parent.data.tag === "TITLE" /* TitleTag */ ? 0 /* None */ : privacy;
2581
- for (var _i = 0, override_1 = override; _i < override_1.length; _i++) {
2582
- var entry = override_1[_i];
2583
- if (path.indexOf(entry) >= 0) {
2584
- privacy = 0 /* None */;
2585
- break;
2586
- }
2587
- }
2588
- }
2589
- // Do not proceed if attributes are missing for the node
2590
- if (attributes === null || attributes === undefined) {
2591
- return privacy;
2592
- }
2593
- // Look up for sensitive fields
2594
- if ("class" /* Class */ in attributes && privacy === 1 /* Sensitive */) {
2595
- for (var _a = 0, DISALLOWED_MATCH_1 = DISALLOWED_MATCH; _a < DISALLOWED_MATCH_1.length; _a++) {
2596
- var match = DISALLOWED_MATCH_1[_a];
2597
- if (attributes["class" /* Class */].indexOf(match) >= 0) {
2598
- privacy = 2 /* Text */;
2599
- break;
2600
- }
2601
- }
2602
- }
2603
- // Check for disallowed list of fields (e.g. address, phone, etc.) only if the input node is not already masked
2604
- if (tag === "INPUT" /* InputTag */) {
2605
- if (privacy === 0 /* None */) {
2606
- var field = "" /* Empty */;
2607
- // Be aggressive in looking up any attribute (id, class, name, etc.) for disallowed names
2608
- for (var _b = 0, _c = Object.keys(attributes); _b < _c.length; _b++) {
2609
- var attribute = _c[_b];
2610
- field += attributes[attribute].toLowerCase();
2611
- }
2612
- for (var _d = 0, DISALLOWED_NAMES_1 = DISALLOWED_NAMES; _d < DISALLOWED_NAMES_1.length; _d++) {
2613
- var name_1 = DISALLOWED_NAMES_1[_d];
2614
- if (field.indexOf(name_1) >= 0) {
2615
- privacy = 2 /* Text */;
2616
- break;
2617
- }
2618
- }
2619
- }
2620
- else if (privacy === 1 /* Sensitive */) {
2621
- // Mask all input fields with an exception of type=submit; since they do not accept user input
2622
- privacy = attributes && attributes["type" /* Type */] === "submit" /* Submit */ ? 0 /* None */ : 2 /* Text */;
2623
- }
2624
- }
2625
- // Check for disallowed list of types (e.g. password, email, etc.) and set the masked property appropriately
2626
- if ("type" /* Type */ in attributes && DISALLOWED_TYPES.indexOf(attributes["type" /* Type */]) >= 0) {
2627
- privacy = 2 /* Text */;
2628
- }
2629
- // Following two conditions supersede any of the above. If there are explicit instructions to mask / unmask a field, we honor that.
2630
- if ("data-clarity-mask" /* MaskData */ in attributes) {
2631
- privacy = 3 /* TextImage */;
2509
+ switch (true) {
2510
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2511
+ metadata.privacy = 3 /* Privacy.TextImage */;
2512
+ break;
2513
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2514
+ metadata.privacy = 0 /* Privacy.None */;
2515
+ break;
2516
+ case privacyMap.has(node):
2517
+ // If this node was explicitly configured to contain sensitive content, honor that privacy setting
2518
+ metadata.privacy = privacyMap.get(node);
2519
+ break;
2520
+ case fraudMap.has(node):
2521
+ // If this node was explicitly configured to be evaluated for fraud, then also mask content
2522
+ metadata.privacy = 2 /* Privacy.Text */;
2523
+ break;
2524
+ case tag === "*T" /* Constant.TextTag */:
2525
+ // If it's a text node belonging to a STYLE or TITLE tag or one of SCRUB_EXCEPTIONS, then capture content
2526
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2527
+ var pSelector_1 = parent && parent.selector ? parent.selector[0 /* Selector.Stable */] : "" /* Constant.Empty */;
2528
+ metadata.privacy = pTag === "STYLE" /* Constant.StyleTag */ || pTag === "TITLE" /* Constant.TitleTag */ || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2529
+ break;
2530
+ case "type" /* Constant.Type */ in attributes:
2531
+ // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2532
+ metadata.privacy = inspect(attributes["type" /* Constant.Type */], metadata);
2533
+ break;
2534
+ case tag === "INPUT" /* Constant.InputTag */ && current === 0 /* Privacy.None */:
2535
+ // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2536
+ var field_1 = "" /* Constant.Empty */;
2537
+ Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2538
+ metadata.privacy = inspect(field_1, metadata);
2539
+ break;
2540
+ case current === 1 /* Privacy.Sensitive */ && tag === "INPUT" /* Constant.InputTag */:
2541
+ // If it's a button or an input option, make an exception to disable masking
2542
+ metadata.privacy = maskDisable.indexOf(attributes["type" /* Constant.Type */]) >= 0 ? 0 /* Privacy.None */ : current;
2543
+ break;
2544
+ case current === 1 /* Privacy.Sensitive */:
2545
+ // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2546
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], metadata);
2547
+ break;
2548
+ default:
2549
+ metadata.privacy = parent ? parent.metadata.privacy : metadata.privacy;
2550
+ break;
2632
2551
  }
2633
- if ("data-clarity-unmask" /* UnmaskData */ in attributes) {
2634
- privacy = 0 /* None */;
2552
+ }
2553
+ function inspect(input, metadata) {
2554
+ if (input && maskText.some(function (x) { return input.indexOf(x) >= 0; })) {
2555
+ return 2 /* Privacy.Text */;
2635
2556
  }
2636
- return privacy;
2557
+ return metadata.privacy;
2637
2558
  }
2638
2559
  function diff(a, b, field) {
2639
2560
  if (typeof a[field] === "object" && typeof b[field] === "object") {
@@ -2721,17 +2642,9 @@ function remove(id, source) {
2721
2642
  track$4(id, source);
2722
2643
  }
2723
2644
  }
2724
- function size(value, parent) {
2725
- var data = value.data;
2726
- var tag = data.tag;
2727
- // If this element is a text node, is masked, and longer than configured length, then track box model for the parent element
2728
- var isLongText = tag === "*T" /* TextTag */ && data.value && data.value.length > 15 /* ResizeObserverThreshold */;
2729
- var isMasked = value.metadata.privacy === 2 /* Text */ || value.metadata.privacy === 3 /* TextImage */;
2730
- if (isLongText && isMasked && parent && parent.metadata.size === null) {
2731
- parent.metadata.size = [];
2732
- }
2645
+ function size(value) {
2733
2646
  // If this element is a image node, and is masked, then track box model for the current element
2734
- if (data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2647
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2735
2648
  value.metadata.size = [];
2736
2649
  }
2737
2650
  }
@@ -2766,7 +2679,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2766
2679
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2767
2680
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2768
2681
  var uIndex = updateMap.indexOf(id);
2769
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2682
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2770
2683
  updateMap.splice(uIndex, 1);
2771
2684
  updateMap.push(id);
2772
2685
  }
@@ -2812,15 +2725,15 @@ function exists(node) {
2812
2725
  }
2813
2726
  function track$3(id, event) {
2814
2727
  var node = getNode(id);
2815
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2728
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2816
2729
  // Determine the interaction state based on incoming event
2817
- var interaction = 16 /* None */;
2730
+ var interaction = 16 /* InteractionState.None */;
2818
2731
  switch (event) {
2819
- case 9 /* Click */:
2820
- interaction = 20 /* Clicked */;
2732
+ case 9 /* Event.Click */:
2733
+ interaction = 20 /* InteractionState.Clicked */;
2821
2734
  break;
2822
- case 27 /* Input */:
2823
- interaction = 30 /* Input */;
2735
+ case 27 /* Event.Input */:
2736
+ interaction = 30 /* InteractionState.Input */;
2824
2737
  break;
2825
2738
  }
2826
2739
  // Process updates to this region, if applicable
@@ -2848,7 +2761,7 @@ function compute$6() {
2848
2761
  queue$1 = q;
2849
2762
  // Schedule encode only when we have at least one valid data entry
2850
2763
  if (state$1.length > 0) {
2851
- encode$4(7 /* Region */);
2764
+ encode$4(7 /* Event.Region */);
2852
2765
  }
2853
2766
  }
2854
2767
  function handler$1(entries) {
@@ -2864,27 +2777,27 @@ function handler$1(entries) {
2864
2777
  // 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
2865
2778
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2866
2779
  var id = target ? getId(target) : null;
2867
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2780
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2868
2781
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2869
2782
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2870
2783
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2871
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2784
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2872
2785
  // If an element is either visible or was visible and has been scrolled to the end
2873
2786
  // 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.
2874
2787
  // 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
2875
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2788
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2876
2789
  // Process updates to this region, if applicable
2877
2790
  process$1(target, data, data.interaction, (scrolledToEnd ?
2878
- 13 /* ScrolledToEnd */ :
2879
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2791
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2792
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2880
2793
  // Stop observing this element now that we have already received scrolled signal
2881
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2794
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2882
2795
  observer$1.unobserve(target);
2883
2796
  }
2884
2797
  }
2885
2798
  }
2886
2799
  if (state$1.length > 0) {
2887
- encode$4(7 /* Region */);
2800
+ encode$4(7 /* Event.Region */);
2888
2801
  }
2889
2802
  }
2890
2803
  function process$1(n, d, s, v) {
@@ -2940,18 +2853,23 @@ function link(node) {
2940
2853
  }
2941
2854
  return null;
2942
2855
  }
2943
- function metadata$2(node, event) {
2856
+ function metadata$2(node, event, text) {
2857
+ if (text === void 0) { text = null; }
2944
2858
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2945
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2859
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2946
2860
  if (node) {
2947
2861
  var value = get(node);
2948
2862
  if (value !== null) {
2863
+ var metadata_1 = value.metadata;
2949
2864
  output.id = value.id;
2950
2865
  output.hash = value.hash;
2951
- output.privacy = value.metadata.privacy;
2866
+ output.privacy = metadata_1.privacy;
2952
2867
  if (value.region) {
2953
2868
  track$3(value.region, event);
2954
2869
  }
2870
+ if (metadata_1.fraud) {
2871
+ check$4(metadata_1.fraud, value.id, text || value.data.value);
2872
+ }
2955
2873
  }
2956
2874
  }
2957
2875
  return output;
@@ -2964,15 +2882,15 @@ function encode$3 (type) {
2964
2882
  t = time();
2965
2883
  tokens = [t, type];
2966
2884
  switch (type) {
2967
- case 13 /* MouseDown */:
2968
- case 14 /* MouseUp */:
2969
- case 12 /* MouseMove */:
2970
- case 15 /* MouseWheel */:
2971
- case 16 /* DoubleClick */:
2972
- case 17 /* TouchStart */:
2973
- case 18 /* TouchEnd */:
2974
- case 19 /* TouchMove */:
2975
- case 20 /* TouchCancel */:
2885
+ case 13 /* Event.MouseDown */:
2886
+ case 14 /* Event.MouseUp */:
2887
+ case 12 /* Event.MouseMove */:
2888
+ case 15 /* Event.MouseWheel */:
2889
+ case 16 /* Event.DoubleClick */:
2890
+ case 17 /* Event.TouchStart */:
2891
+ case 18 /* Event.TouchEnd */:
2892
+ case 19 /* Event.TouchMove */:
2893
+ case 20 /* Event.TouchCancel */:
2976
2894
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2977
2895
  entry = _a[_i];
2978
2896
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2987,12 +2905,12 @@ function encode$3 (type) {
2987
2905
  }
2988
2906
  reset$e();
2989
2907
  break;
2990
- case 9 /* Click */:
2908
+ case 9 /* Event.Click */:
2991
2909
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2992
2910
  entry = _c[_b];
2993
- cTarget = metadata$2(entry.data.target, entry.event);
2911
+ cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2994
2912
  tokens = [entry.time, entry.event];
2995
- cHash = cTarget.hash.join("." /* Dot */);
2913
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
2996
2914
  tokens.push(cTarget.id);
2997
2915
  tokens.push(entry.data.x);
2998
2916
  tokens.push(entry.data.y);
@@ -3004,12 +2922,13 @@ function encode$3 (type) {
3004
2922
  tokens.push(scrub(entry.data.text, "click", cTarget.privacy));
3005
2923
  tokens.push(entry.data.link);
3006
2924
  tokens.push(cHash);
2925
+ tokens.push(entry.data.trust);
3007
2926
  queue(tokens);
3008
2927
  track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
3009
2928
  }
3010
2929
  reset$h();
3011
2930
  break;
3012
- case 38 /* Clipboard */:
2931
+ case 38 /* Event.Clipboard */:
3013
2932
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
3014
2933
  entry = _e[_d];
3015
2934
  tokens = [entry.time, entry.event];
@@ -3022,7 +2941,7 @@ function encode$3 (type) {
3022
2941
  }
3023
2942
  reset$g();
3024
2943
  break;
3025
- case 11 /* Resize */:
2944
+ case 11 /* Event.Resize */:
3026
2945
  r = data$b;
3027
2946
  tokens.push(r.width);
3028
2947
  tokens.push(r.height);
@@ -3030,24 +2949,24 @@ function encode$3 (type) {
3030
2949
  reset$d();
3031
2950
  queue(tokens);
3032
2951
  break;
3033
- case 26 /* Unload */:
2952
+ case 26 /* Event.Unload */:
3034
2953
  u = data$9;
3035
2954
  tokens.push(u.name);
3036
2955
  reset$9();
3037
2956
  queue(tokens);
3038
2957
  break;
3039
- case 27 /* Input */:
2958
+ case 27 /* Event.Input */:
3040
2959
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
3041
2960
  entry = _g[_f];
3042
- iTarget = metadata$2(entry.data.target, entry.event);
2961
+ iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
3043
2962
  tokens = [entry.time, entry.event];
3044
2963
  tokens.push(iTarget.id);
3045
- tokens.push(entry.data.value);
2964
+ tokens.push(scrub(entry.data.value, "input", iTarget.privacy));
3046
2965
  queue(tokens);
3047
2966
  }
3048
2967
  reset$f();
3049
2968
  break;
3050
- case 21 /* Selection */:
2969
+ case 21 /* Event.Selection */:
3051
2970
  s = data$a;
3052
2971
  if (s) {
3053
2972
  startTarget = metadata$2(s.start, type);
@@ -3060,7 +2979,7 @@ function encode$3 (type) {
3060
2979
  queue(tokens);
3061
2980
  }
3062
2981
  break;
3063
- case 10 /* Scroll */:
2982
+ case 10 /* Event.Scroll */:
3064
2983
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
3065
2984
  entry = _j[_h];
3066
2985
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -3075,7 +2994,7 @@ function encode$3 (type) {
3075
2994
  }
3076
2995
  reset$c();
3077
2996
  break;
3078
- case 39 /* Submit */:
2997
+ case 39 /* Event.Submit */:
3079
2998
  for (_k = 0, _l = state$2; _k < _l.length; _k++) {
3080
2999
  entry = _l[_k];
3081
3000
  tokens = [entry.time, entry.event];
@@ -3087,7 +3006,7 @@ function encode$3 (type) {
3087
3006
  }
3088
3007
  reset$a();
3089
3008
  break;
3090
- case 22 /* Timeline */:
3009
+ case 22 /* Event.Timeline */:
3091
3010
  for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3092
3011
  entry = _o[_m];
3093
3012
  tokens = [entry.time, entry.event];
@@ -3101,7 +3020,7 @@ function encode$3 (type) {
3101
3020
  }
3102
3021
  reset$5();
3103
3022
  break;
3104
- case 28 /* Visibility */:
3023
+ case 28 /* Event.Visibility */:
3105
3024
  v = data$8;
3106
3025
  tokens.push(v.visible);
3107
3026
  queue(tokens);
@@ -3124,11 +3043,11 @@ function reset$5() {
3124
3043
  updates$1 = [];
3125
3044
  }
3126
3045
  function track$2(time, event, hash, x, y, reaction, context) {
3127
- if (reaction === void 0) { reaction = 1 /* True */; }
3128
- if (context === void 0) { context = 0 /* Self */; }
3046
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3047
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3129
3048
  state.push({
3130
3049
  time: time,
3131
- event: 22 /* Timeline */,
3050
+ event: 22 /* Event.Timeline */,
3132
3051
  data: {
3133
3052
  type: event,
3134
3053
  hash: hash,
@@ -3147,7 +3066,7 @@ function compute$5() {
3147
3066
  var temp = [];
3148
3067
  updates$1 = [];
3149
3068
  var max = data$1.start + data$1.duration;
3150
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3069
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3151
3070
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3152
3071
  var s = state_1[_i];
3153
3072
  if (s.time >= min) {
@@ -3158,7 +3077,7 @@ function compute$5() {
3158
3077
  }
3159
3078
  }
3160
3079
  state = temp; // Drop events less than the min time
3161
- encode$3(22 /* Timeline */);
3080
+ encode$3(22 /* Event.Timeline */);
3162
3081
  }
3163
3082
  function stop$e() {
3164
3083
  state = [];
@@ -3191,10 +3110,10 @@ function queue(tokens, transmit) {
3191
3110
  var type = tokens.length > 1 ? tokens[1] : null;
3192
3111
  var event_1 = JSON.stringify(tokens);
3193
3112
  switch (type) {
3194
- case 5 /* Discover */:
3113
+ case 5 /* Event.Discover */:
3195
3114
  discoverBytes += event_1.length;
3196
- case 37 /* Box */:
3197
- case 6 /* Mutation */:
3115
+ case 37 /* Event.Box */:
3116
+ case 6 /* Event.Mutation */:
3198
3117
  playbackBytes += event_1.length;
3199
3118
  playback.push(event_1);
3200
3119
  break;
@@ -3203,7 +3122,7 @@ function queue(tokens, transmit) {
3203
3122
  break;
3204
3123
  }
3205
3124
  // Increment event count metric
3206
- count$1(25 /* EventCount */);
3125
+ count$1(25 /* Metric.EventCount */);
3207
3126
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3208
3127
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3209
3128
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3216,8 +3135,8 @@ function queue(tokens, transmit) {
3216
3135
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3217
3136
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3218
3137
  if (transmit && timeout === null) {
3219
- if (type !== 25 /* Ping */) {
3220
- reset$n();
3138
+ if (type !== 25 /* Event.Ping */) {
3139
+ reset$m();
3221
3140
  }
3222
3141
  timeout = setTimeout(upload, gap);
3223
3142
  queuedTime = now;
@@ -3245,19 +3164,19 @@ function upload(final) {
3245
3164
  switch (_b.label) {
3246
3165
  case 0:
3247
3166
  timeout = null;
3248
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3167
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3249
3168
  if (sendPlaybackBytes) {
3250
- max(1 /* Playback */, 1 /* True */);
3169
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3251
3170
  }
3252
3171
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3253
3172
  // Otherwise you run a risk of infinite loop.
3254
3173
  compute$6();
3255
3174
  compute$5();
3256
- compute$9();
3175
+ compute$8();
3257
3176
  last = final === true;
3258
3177
  e = JSON.stringify(envelope(last));
3259
- a = "[" + analysis.join() + "]";
3260
- p = sendPlaybackBytes ? "[" + playback.join() + "]" : "" /* Empty */;
3178
+ a = "[".concat(analysis.join(), "]");
3179
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3261
3180
  encoded = { e: e, a: a, p: p };
3262
3181
  payload = stringify(encoded);
3263
3182
  if (!last) return [3 /*break*/, 1];
@@ -3269,7 +3188,7 @@ function upload(final) {
3269
3188
  _b.label = 3;
3270
3189
  case 3:
3271
3190
  zipped = _a;
3272
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3191
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3273
3192
  send(payload, zipped, data$1.sequence, last);
3274
3193
  // Clear out events now that payload has been dispatched
3275
3194
  analysis = [];
@@ -3284,12 +3203,12 @@ function upload(final) {
3284
3203
  });
3285
3204
  }
3286
3205
  function stringify(encoded) {
3287
- return encoded.p.length > 0 ? "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + ",\"p\":" + encoded.p + "}" : "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + "}";
3206
+ return encoded.p.length > 0 ? "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, ",\"p\":").concat(encoded.p, "}") : "{\"e\":".concat(encoded.e, ",\"a\":").concat(encoded.a, "}");
3288
3207
  }
3289
3208
  function send(payload, zipped, sequence, beacon) {
3290
3209
  if (beacon === void 0) { beacon = false; }
3291
3210
  // Upload data if a valid URL is defined in the config
3292
- if (typeof config$1.upload === "string" /* String */) {
3211
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3293
3212
  var url = config$1.upload;
3294
3213
  var dispatched = false;
3295
3214
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3328,7 +3247,7 @@ function send(payload, zipped, sequence, beacon) {
3328
3247
  xhr_1.withCredentials = true;
3329
3248
  if (zipped) {
3330
3249
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3331
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3250
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3332
3251
  xhr_1.send(zipped);
3333
3252
  }
3334
3253
  else {
@@ -3345,13 +3264,13 @@ function send(payload, zipped, sequence, beacon) {
3345
3264
  }
3346
3265
  function check$3(xhr, sequence) {
3347
3266
  var transitData = transit[sequence];
3348
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3267
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3349
3268
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3350
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3269
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3351
3270
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3352
3271
  if (xhr.status >= 400 && xhr.status < 500) {
3353
3272
  // In case of a 4XX response from the server, we bail out instead of trying again
3354
- trigger(6 /* Server */);
3273
+ trigger(6 /* Check.Server */);
3355
3274
  }
3356
3275
  else {
3357
3276
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3372,7 +3291,7 @@ function check$3(xhr, sequence) {
3372
3291
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3373
3292
  // Send back an event only if we were not successful in our first attempt
3374
3293
  if (transitData.attempts > 1) {
3375
- encode$1(2 /* Upload */);
3294
+ encode$1(2 /* Event.Upload */);
3376
3295
  }
3377
3296
  // Handle response if it was a 200 response with a valid body
3378
3297
  if (xhr.status === 200 && xhr.responseText) {
@@ -3383,7 +3302,7 @@ function check$3(xhr, sequence) {
3383
3302
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3384
3303
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3385
3304
  send(transitData.data, null, sequence, true);
3386
- trigger(3 /* Retry */);
3305
+ trigger(3 /* Check.Retry */);
3387
3306
  }
3388
3307
  // Signal that this request completed successfully
3389
3308
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3403,19 +3322,19 @@ function done(sequence) {
3403
3322
  function delay() {
3404
3323
  // Progressively increase delay as we continue to send more payloads from the client to the server
3405
3324
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3406
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3407
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3325
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3326
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3408
3327
  }
3409
3328
  function response(payload) {
3410
- var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Empty */;
3329
+ var key = payload && payload.length > 0 ? payload.split(" ")[0] : "" /* Constant.Empty */;
3411
3330
  switch (key) {
3412
- case "END" /* End */:
3331
+ case "END" /* Constant.End */:
3413
3332
  // Clear out session storage and end the session so we can start fresh the next time
3414
- trigger(6 /* Server */);
3333
+ trigger(6 /* Check.Server */);
3415
3334
  break;
3416
- case "UPGRADE" /* Upgrade */:
3335
+ case "UPGRADE" /* Constant.Upgrade */:
3417
3336
  // Upgrade current session to send back playback information
3418
- upgrade("Auto" /* Auto */);
3337
+ upgrade("Auto" /* Constant.Auto */);
3419
3338
  break;
3420
3339
  }
3421
3340
  }
@@ -3433,7 +3352,7 @@ function handler(error) {
3433
3352
  if (!(e.message in history$3)) {
3434
3353
  history$3[e.message] = 0;
3435
3354
  }
3436
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3355
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3437
3356
  return true;
3438
3357
  }
3439
3358
  // Send back information only if the handled error has valid information
@@ -3445,15 +3364,7 @@ function handler(error) {
3445
3364
  stack: e.stack,
3446
3365
  source: error["filename"]
3447
3366
  };
3448
- // In certain cases, ResizeObserver could lead to flood of benign errors - especially when video element is involved.
3449
- // Reference Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=809574
3450
- // Even though it doesn't impact user experience, or show up in console, it can still flood error reporting through on error
3451
- // To mitigate that, we turn off Clarity's ResizeObserver on getting the first instance of this error
3452
- if (e.message.indexOf("ResizeObserver" /* ResizeObserver */) >= 0) {
3453
- stop$t();
3454
- return false;
3455
- }
3456
- encode$2(31 /* ScriptError */);
3367
+ encode$2(31 /* Event.ScriptError */);
3457
3368
  }
3458
3369
  return true;
3459
3370
  }
@@ -3464,7 +3375,7 @@ function encode$2 (type) {
3464
3375
  return __generator(this, function (_a) {
3465
3376
  tokens = [time(), type];
3466
3377
  switch (type) {
3467
- case 31 /* ScriptError */:
3378
+ case 31 /* Event.ScriptError */:
3468
3379
  tokens.push(data$7.message);
3469
3380
  tokens.push(data$7.line);
3470
3381
  tokens.push(data$7.column);
@@ -3472,7 +3383,7 @@ function encode$2 (type) {
3472
3383
  tokens.push(data$7.source);
3473
3384
  queue(tokens);
3474
3385
  break;
3475
- case 33 /* Log */:
3386
+ case 33 /* Event.Log */:
3476
3387
  if (data$6) {
3477
3388
  tokens.push(data$6.code);
3478
3389
  tokens.push(data$6.name);
@@ -3482,6 +3393,14 @@ function encode$2 (type) {
3482
3393
  queue(tokens, false);
3483
3394
  }
3484
3395
  break;
3396
+ case 41 /* Event.Fraud */:
3397
+ if (data$d) {
3398
+ tokens.push(data$d.id);
3399
+ tokens.push(data$d.target);
3400
+ tokens.push(data$d.hash);
3401
+ queue(tokens, false);
3402
+ }
3403
+ break;
3485
3404
  }
3486
3405
  return [2 /*return*/];
3487
3406
  });
@@ -3497,7 +3416,7 @@ function log$1(code, severity, name, message, stack) {
3497
3416
  if (name === void 0) { name = null; }
3498
3417
  if (message === void 0) { message = null; }
3499
3418
  if (stack === void 0) { stack = null; }
3500
- var key = name ? name + "|" + message : "";
3419
+ var key = name ? "".concat(name, "|").concat(message) : "";
3501
3420
  // While rare, it's possible for code to fail repeatedly during the lifetime of the same page
3502
3421
  // In those cases, we only want to log the failure once and not spam logs with redundant information.
3503
3422
  if (code in history$2 && history$2[code].indexOf(key) >= 0) {
@@ -3511,7 +3430,7 @@ function log$1(code, severity, name, message, stack) {
3511
3430
  else {
3512
3431
  history$2[code] = [key];
3513
3432
  }
3514
- encode$2(33 /* Log */);
3433
+ encode$2(33 /* Event.Log */);
3515
3434
  }
3516
3435
  function stop$c() {
3517
3436
  history$2 = {};
@@ -3532,25 +3451,25 @@ function start$c() {
3532
3451
  var source = e[i];
3533
3452
  var key = e[i + 1];
3534
3453
  switch (source) {
3535
- case 0 /* Javascript */:
3454
+ case 0 /* ExtractSource.Javascript */:
3536
3455
  var variable = e[i + 2];
3537
3456
  variables[key] = parse(variable);
3538
3457
  break;
3539
- case 1 /* Cookie */:
3458
+ case 1 /* ExtractSource.Cookie */:
3540
3459
  /*Todo: Add cookie extract logic*/
3541
3460
  break;
3542
- case 2 /* Text */:
3461
+ case 2 /* ExtractSource.Text */:
3543
3462
  var match_1 = e[i + 2];
3544
3463
  selectors[key] = match_1;
3545
3464
  break;
3546
- case 3 /* Fragment */:
3465
+ case 3 /* ExtractSource.Fragment */:
3547
3466
  fragments = e[i + 2];
3548
3467
  break;
3549
3468
  }
3550
3469
  }
3551
3470
  }
3552
3471
  catch (e) {
3553
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3472
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3554
3473
  }
3555
3474
  }
3556
3475
  function clone(v) {
@@ -3572,9 +3491,9 @@ function compute$4() {
3572
3491
  }
3573
3492
  }
3574
3493
  catch (e) {
3575
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3494
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3576
3495
  }
3577
- encode$1(40 /* Extract */);
3496
+ encode$1(40 /* Event.Extract */);
3578
3497
  }
3579
3498
  function reset$4() {
3580
3499
  keys = [];
@@ -3594,15 +3513,15 @@ function stop$b() {
3594
3513
  }
3595
3514
  function parse(variable) {
3596
3515
  var syntax = [];
3597
- var parts = variable.split("." /* Dot */);
3516
+ var parts = variable.split("." /* Constant.Dot */);
3598
3517
  while (parts.length > 0) {
3599
3518
  var part = parts.shift();
3600
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3601
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3602
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3519
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3520
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3521
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3603
3522
  syntax.push({
3604
3523
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3605
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3524
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3606
3525
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3607
3526
  });
3608
3527
  }
@@ -3620,7 +3539,7 @@ function evaluate(variable, base) {
3620
3539
  var output;
3621
3540
  if (base && base[part.name]) {
3622
3541
  var obj = base[part.name];
3623
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3542
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3624
3543
  output = evaluate(variable, obj);
3625
3544
  }
3626
3545
  else if (Array.isArray(obj)) {
@@ -3642,7 +3561,7 @@ function evaluate(variable, base) {
3642
3561
  }
3643
3562
  function str(input) {
3644
3563
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3645
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3564
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3646
3565
  }
3647
3566
  function match(base, condition) {
3648
3567
  if (condition) {
@@ -3656,7 +3575,7 @@ function encode$1 (event) {
3656
3575
  var t = time();
3657
3576
  var tokens = [t, event];
3658
3577
  switch (event) {
3659
- case 4 /* Baseline */:
3578
+ case 4 /* Event.Baseline */:
3660
3579
  var b = state$9;
3661
3580
  if (b) {
3662
3581
  tokens = [b.time, b.event];
@@ -3672,32 +3591,32 @@ function encode$1 (event) {
3672
3591
  tokens.push(b.data.activityTime);
3673
3592
  queue(tokens, false);
3674
3593
  }
3675
- reset$p();
3594
+ reset$o();
3676
3595
  break;
3677
- case 25 /* Ping */:
3596
+ case 25 /* Event.Ping */:
3678
3597
  tokens.push(data$h.gap);
3679
3598
  queue(tokens);
3680
3599
  break;
3681
- case 35 /* Limit */:
3600
+ case 35 /* Event.Limit */:
3682
3601
  tokens.push(data$4.check);
3683
3602
  queue(tokens, false);
3684
3603
  break;
3685
- case 3 /* Upgrade */:
3604
+ case 3 /* Event.Upgrade */:
3686
3605
  tokens.push(data$f.key);
3687
3606
  queue(tokens);
3688
3607
  break;
3689
- case 2 /* Upload */:
3608
+ case 2 /* Event.Upload */:
3690
3609
  tokens.push(track$1.sequence);
3691
3610
  tokens.push(track$1.attempts);
3692
3611
  tokens.push(track$1.status);
3693
3612
  queue(tokens, false);
3694
3613
  break;
3695
- case 24 /* Custom */:
3614
+ case 24 /* Event.Custom */:
3696
3615
  tokens.push(data$j.key);
3697
3616
  tokens.push(data$j.value);
3698
3617
  queue(tokens);
3699
3618
  break;
3700
- case 34 /* Variable */:
3619
+ case 34 /* Event.Variable */:
3701
3620
  var variableKeys = Object.keys(data$e);
3702
3621
  if (variableKeys.length > 0) {
3703
3622
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3705,11 +3624,11 @@ function encode$1 (event) {
3705
3624
  tokens.push(v);
3706
3625
  tokens.push(data$e[v]);
3707
3626
  }
3708
- reset$l();
3627
+ reset$k();
3709
3628
  queue(tokens, false);
3710
3629
  }
3711
3630
  break;
3712
- case 0 /* Metric */:
3631
+ case 0 /* Event.Metric */:
3713
3632
  var metricKeys = Object.keys(updates$3);
3714
3633
  if (metricKeys.length > 0) {
3715
3634
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3720,11 +3639,11 @@ function encode$1 (event) {
3720
3639
  // However, for data over the wire, we round it off to milliseconds precision.
3721
3640
  tokens.push(Math.round(updates$3[m]));
3722
3641
  }
3723
- reset$o();
3642
+ reset$n();
3724
3643
  queue(tokens, false);
3725
3644
  }
3726
3645
  break;
3727
- case 1 /* Dimension */:
3646
+ case 1 /* Event.Dimension */:
3728
3647
  var dimensionKeys = Object.keys(updates);
3729
3648
  if (dimensionKeys.length > 0) {
3730
3649
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3737,7 +3656,7 @@ function encode$1 (event) {
3737
3656
  queue(tokens, false);
3738
3657
  }
3739
3658
  break;
3740
- case 36 /* Summary */:
3659
+ case 36 /* Event.Summary */:
3741
3660
  var eventKeys = Object.keys(data$g);
3742
3661
  if (eventKeys.length > 0) {
3743
3662
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3746,11 +3665,11 @@ function encode$1 (event) {
3746
3665
  tokens.push(key);
3747
3666
  tokens.push([].concat.apply([], data$g[e]));
3748
3667
  }
3749
- reset$m();
3668
+ reset$l();
3750
3669
  queue(tokens, false);
3751
3670
  }
3752
3671
  break;
3753
- case 40 /* Extract */:
3672
+ case 40 /* Event.Extract */:
3754
3673
  var extractKeys = keys;
3755
3674
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3756
3675
  var e = extractKeys_1[_d];
@@ -3764,14 +3683,14 @@ function encode$1 (event) {
3764
3683
 
3765
3684
  var data$4;
3766
3685
  function start$b() {
3767
- data$4 = { check: 0 /* None */ };
3686
+ data$4 = { check: 0 /* Check.None */ };
3768
3687
  }
3769
3688
  function check$2(bytes) {
3770
- if (data$4.check === 0 /* None */) {
3689
+ if (data$4.check === 0 /* Check.None */) {
3771
3690
  var reason = data$4.check;
3772
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3773
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3774
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3691
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3692
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3693
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3775
3694
  if (reason !== data$4.check) {
3776
3695
  trigger(reason);
3777
3696
  }
@@ -3783,8 +3702,8 @@ function trigger(reason) {
3783
3702
  stop();
3784
3703
  }
3785
3704
  function compute$3() {
3786
- if (data$4.check !== 0 /* None */) {
3787
- encode$1(35 /* Limit */);
3705
+ if (data$4.check !== 0 /* Check.None */) {
3706
+ encode$1(35 /* Event.Limit */);
3788
3707
  }
3789
3708
  }
3790
3709
  function stop$a() {
@@ -3805,7 +3724,7 @@ function log(dimension, value) {
3805
3724
  // Check valid value before moving ahead
3806
3725
  if (value) {
3807
3726
  // Ensure received value is casted into a string if it wasn't a string to begin with
3808
- value = "" + value;
3727
+ value = "".concat(value);
3809
3728
  if (!(dimension in data$3)) {
3810
3729
  data$3[dimension] = [];
3811
3730
  }
@@ -3818,14 +3737,14 @@ function log(dimension, value) {
3818
3737
  }
3819
3738
  updates[dimension].push(value);
3820
3739
  // Limit check to ensure we have a cap on number of dimensions we can collect
3821
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3822
- trigger(5 /* Collection */);
3740
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3741
+ trigger(5 /* Check.Collection */);
3823
3742
  }
3824
3743
  }
3825
3744
  }
3826
3745
  }
3827
3746
  function compute$2() {
3828
- encode$1(1 /* Dimension */);
3747
+ encode$1(1 /* Event.Dimension */);
3829
3748
  }
3830
3749
  function reset$3() {
3831
3750
  updates = {};
@@ -3836,8 +3755,8 @@ var callbacks = [];
3836
3755
  var rootDomain = null;
3837
3756
  function start$9() {
3838
3757
  rootDomain = null;
3839
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3840
- var title = document && document.title ? document.title : "" /* Empty */;
3758
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3759
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3841
3760
  // Populate ids for this page
3842
3761
  var s = session();
3843
3762
  var u = user();
@@ -3848,28 +3767,27 @@ function start$9() {
3848
3767
  pageNum: s.count
3849
3768
  };
3850
3769
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3851
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3852
- 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;
3770
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3771
+ 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;
3853
3772
  // Log dimensions
3854
- log(0 /* UserAgent */, ua);
3855
- log(3 /* PageTitle */, title);
3856
- log(1 /* Url */, location.href);
3857
- log(2 /* Referrer */, document.referrer);
3858
- log(15 /* TabId */, tab());
3859
- log(16 /* PageLanguage */, document.documentElement.lang);
3860
- log(17 /* DocumentDirection */, document.dir);
3773
+ log(0 /* Dimension.UserAgent */, ua);
3774
+ log(3 /* Dimension.PageTitle */, title);
3775
+ log(1 /* Dimension.Url */, location.href);
3776
+ log(2 /* Dimension.Referrer */, document.referrer);
3777
+ log(15 /* Dimension.TabId */, tab());
3778
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3779
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3861
3780
  if (navigator) {
3862
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3863
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
3781
+ log(9 /* Dimension.Language */, navigator.userLanguage || navigator.language);
3864
3782
  userAgentData();
3865
3783
  }
3866
3784
  // Metrics
3867
- max(0 /* ClientTimestamp */, s.ts);
3868
- max(1 /* Playback */, 0 /* False */);
3785
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3786
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3869
3787
  if (screen) {
3870
- max(14 /* ScreenWidth */, Math.round(screen.width));
3871
- max(15 /* ScreenHeight */, Math.round(screen.height));
3872
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3788
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3789
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3790
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3873
3791
  }
3874
3792
  // Read cookies specified in configuration
3875
3793
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3890,13 +3808,13 @@ function userAgentData() {
3890
3808
  "uaFullVersion"])
3891
3809
  .then(function (ua) {
3892
3810
  var _a;
3893
- log(22 /* Platform */, ua.platform);
3894
- log(23 /* PlatformVersion */, ua.platformVersion);
3811
+ log(22 /* Dimension.Platform */, ua.platform);
3812
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3895
3813
  (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3896
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3814
+ log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version);
3897
3815
  });
3898
- log(25 /* Model */, ua.model);
3899
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3816
+ log(25 /* Dimension.Model */, ua.model);
3817
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3900
3818
  });
3901
3819
  }
3902
3820
  }
@@ -3913,33 +3831,33 @@ function metadata(cb, wait) {
3913
3831
  callbacks.push({ callback: cb, wait: wait });
3914
3832
  }
3915
3833
  function id() {
3916
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3834
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3917
3835
  }
3918
3836
  function consent() {
3919
3837
  if (active()) {
3920
3838
  config$1.track = true;
3921
- track(user(), 1 /* True */);
3839
+ track(user(), 1 /* BooleanFlag.True */);
3922
3840
  }
3923
3841
  }
3924
3842
  function clear() {
3925
3843
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3926
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
3844
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3927
3845
  }
3928
3846
  function tab() {
3929
3847
  var id = shortid();
3930
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3931
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
3848
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
3849
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3932
3850
  id = value ? value : id;
3933
- sessionStorage.setItem("_cltk" /* TabKey */, id);
3851
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3934
3852
  }
3935
3853
  return id;
3936
3854
  }
3937
3855
  function save() {
3938
3856
  var ts = Math.round(Date.now());
3939
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3940
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
3857
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
3858
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3941
3859
  processCallback(upgrade);
3942
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
3860
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3943
3861
  }
3944
3862
  function processCallback(upgrade) {
3945
3863
  if (callbacks.length > 0) {
@@ -3964,10 +3882,10 @@ function track(u, consent) {
3964
3882
  consent = consent === null ? u.consent : consent;
3965
3883
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3966
3884
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3967
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
3885
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3968
3886
  // To avoid cookie churn, write user id cookie only once every day
3969
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3970
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
3887
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
3888
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3971
3889
  }
3972
3890
  }
3973
3891
  function shortid() {
@@ -3978,17 +3896,17 @@ function shortid() {
3978
3896
  return id.toString(36);
3979
3897
  }
3980
3898
  function session() {
3981
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3982
- var value = getCookie("_clsk" /* SessionKey */);
3899
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
3900
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3983
3901
  if (value) {
3984
- var parts = value.split("|" /* Pipe */);
3902
+ var parts = value.split("|" /* Constant.Pipe */);
3985
3903
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3986
3904
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3987
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
3905
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3988
3906
  output.session = parts[0];
3989
3907
  output.count = num(parts[2]) + 1;
3990
3908
  output.upgrade = num(parts[3]);
3991
- output.upload = parts.length >= 6 ? "" + "https://" /* HTTPS */ + parts[5] + "/" + parts[4] : "" + "https://" /* HTTPS */ + parts[4];
3909
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3992
3910
  }
3993
3911
  }
3994
3912
  return output;
@@ -3998,26 +3916,26 @@ function num(string, base) {
3998
3916
  return parseInt(string, base);
3999
3917
  }
4000
3918
  function user() {
4001
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
4002
- var cookie = getCookie("_clck" /* CookieKey */);
3919
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
3920
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
4003
3921
  if (cookie && cookie.length > 0) {
4004
3922
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
4005
- var parts = cookie.split("|" /* Pipe */);
3923
+ var parts = cookie.split("|" /* Constant.Pipe */);
4006
3924
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
4007
3925
  // 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)
4008
3926
  var count = 0;
4009
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
3927
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
4010
3928
  var c = _a[_i];
4011
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
3929
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
4012
3930
  }
4013
3931
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
4014
3932
  // In both these cases, we go ahead and delete the existing cookie set on current domain
4015
3933
  if (parts.length === 1 || count > 1) {
4016
- var deleted = "" + ";" /* Semicolon */ + "expires=" /* Expires */ + (new Date(0)).toUTCString() + ";path=/" /* Path */;
3934
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
4017
3935
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
4018
- document.cookie = "_clck" /* CookieKey */ + "=" + deleted;
3936
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
4019
3937
  // Second, same thing for current session cookie so it can be re-written later with the root domain
4020
- document.cookie = "_clsk" /* SessionKey */ + "=" + deleted;
3938
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
4021
3939
  }
4022
3940
  // End code for backward compatibility
4023
3941
  // Read version information and timestamp from cookie, if available
@@ -4026,21 +3944,21 @@ function user() {
4026
3944
  }
4027
3945
  // Check if we have explicit consent to track this user
4028
3946
  if (parts.length > 3 && num(parts[3]) === 1) {
4029
- output.consent = 1 /* True */;
3947
+ output.consent = 1 /* BooleanFlag.True */;
4030
3948
  }
4031
3949
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
4032
- config$1.track = config$1.track || output.consent === 1 /* True */;
3950
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
4033
3951
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
4034
3952
  output.id = config$1.track ? parts[0] : output.id;
4035
3953
  }
4036
3954
  return output;
4037
3955
  }
4038
3956
  function getCookie(key) {
4039
- if (supported(document, "cookie" /* Cookie */)) {
4040
- var cookies = document.cookie.split(";" /* Semicolon */);
3957
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
3958
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
4041
3959
  if (cookies) {
4042
3960
  for (var i = 0; i < cookies.length; i++) {
4043
- var pair = cookies[i].split("=" /* Equals */);
3961
+ var pair = cookies[i].split("=" /* Constant.Equals */);
4044
3962
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
4045
3963
  return pair[1];
4046
3964
  }
@@ -4050,23 +3968,23 @@ function getCookie(key) {
4050
3968
  return null;
4051
3969
  }
4052
3970
  function setCookie(key, value, time) {
4053
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
3971
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
4054
3972
  var expiry = new Date();
4055
3973
  expiry.setDate(expiry.getDate() + time);
4056
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
4057
- var cookie = key + "=" + value + ";" /* Semicolon */ + expires + ";path=/" /* Path */;
3974
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
3975
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
4058
3976
  try {
4059
3977
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
4060
3978
  if (rootDomain === null) {
4061
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
3979
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
4062
3980
  // Walk backwards on a domain and attempt to set a cookie, until successful
4063
3981
  for (var i = hostname.length - 1; i >= 0; i--) {
4064
- rootDomain = "." + hostname[i] + (rootDomain ? rootDomain : "" /* Empty */);
3982
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
4065
3983
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
4066
3984
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
4067
3985
  if (i < hostname.length - 1) {
4068
3986
  // Write the cookie on the current computed top level domain
4069
- document.cookie = "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain;
3987
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
4070
3988
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
4071
3989
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
4072
3990
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -4078,13 +3996,13 @@ function setCookie(key, value, time) {
4078
3996
  }
4079
3997
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
4080
3998
  // This forces our code to fall back to always writing cookie to the current domain
4081
- rootDomain = "" /* Empty */;
3999
+ rootDomain = "" /* Constant.Empty */;
4082
4000
  }
4083
4001
  }
4084
4002
  catch (_a) {
4085
- rootDomain = "" /* Empty */;
4003
+ rootDomain = "" /* Constant.Empty */;
4086
4004
  }
4087
- document.cookie = rootDomain ? "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain : cookie;
4005
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4088
4006
  }
4089
4007
  }
4090
4008
 
@@ -4100,8 +4018,8 @@ function start$8() {
4100
4018
  userId: m.userId,
4101
4019
  sessionId: m.sessionId,
4102
4020
  pageNum: m.pageNum,
4103
- upload: 0 /* Async */,
4104
- end: 0 /* False */
4021
+ upload: 0 /* Upload.Async */,
4022
+ end: 0 /* BooleanFlag.False */
4105
4023
  };
4106
4024
  }
4107
4025
  function stop$7() {
@@ -4111,8 +4029,8 @@ function envelope(last) {
4111
4029
  data$1.start = data$1.start + data$1.duration;
4112
4030
  data$1.duration = time() - data$1.start;
4113
4031
  data$1.sequence++;
4114
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4115
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4032
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4033
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4116
4034
  return [
4117
4035
  data$1.version,
4118
4036
  data$1.sequence,
@@ -4165,10 +4083,10 @@ function measure (method) {
4165
4083
  throw report(ex);
4166
4084
  }
4167
4085
  var duration = performance.now() - start;
4168
- sum(4 /* TotalCost */, duration);
4169
- if (duration > 30 /* LongTask */) {
4170
- count$1(7 /* LongTaskCount */);
4171
- max(6 /* ThreadBlockedTime */, duration);
4086
+ sum(4 /* Metric.TotalCost */, duration);
4087
+ if (duration > 30 /* Setting.LongTask */) {
4088
+ count$1(7 /* Metric.LongTaskCount */);
4089
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4172
4090
  }
4173
4091
  };
4174
4092
  }
@@ -4180,7 +4098,7 @@ function bind(target, event, listener, capture) {
4180
4098
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4181
4099
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4182
4100
  try {
4183
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4101
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4184
4102
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4185
4103
  }
4186
4104
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4191,7 +4109,7 @@ function reset$1() {
4191
4109
  var binding = bindings_1[_i];
4192
4110
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4193
4111
  try {
4194
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4112
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4195
4113
  }
4196
4114
  catch ( /* do nothing */_a) { /* do nothing */ }
4197
4115
  }
@@ -4228,8 +4146,8 @@ function start$7() {
4228
4146
  }
4229
4147
  }
4230
4148
  function check$1() {
4231
- if (count++ > 20 /* CallStackDepth */) {
4232
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4149
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4150
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4233
4151
  return false;
4234
4152
  }
4235
4153
  return true;
@@ -4239,11 +4157,15 @@ function compute$1() {
4239
4157
  if (url !== getCurrentUrl()) {
4240
4158
  // If the url changed, start tracking it as a new page
4241
4159
  stop();
4242
- window.setTimeout(start, 250 /* RestartDelay */);
4160
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4243
4161
  }
4244
4162
  }
4163
+ function restart$1() {
4164
+ start();
4165
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4166
+ }
4245
4167
  function getCurrentUrl() {
4246
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4168
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4247
4169
  }
4248
4170
  function stop$6() {
4249
4171
  url = null;
@@ -4254,7 +4176,7 @@ var status = false;
4254
4176
  function start$6() {
4255
4177
  status = true;
4256
4178
  start$F();
4257
- reset$k();
4179
+ reset$j();
4258
4180
  reset$1();
4259
4181
  reset$2();
4260
4182
  start$7();
@@ -4263,8 +4185,8 @@ function stop$5() {
4263
4185
  stop$6();
4264
4186
  reset$2();
4265
4187
  reset$1();
4266
- reset$k();
4267
- stop$C();
4188
+ reset$j();
4189
+ stop$B();
4268
4190
  status = false;
4269
4191
  }
4270
4192
  function active() {
@@ -4306,7 +4228,7 @@ function config(override) {
4306
4228
  // not holding the session during inactive time periods.
4307
4229
  function suspend() {
4308
4230
  if (status) {
4309
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4231
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4310
4232
  stop();
4311
4233
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4312
4234
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4314,10 +4236,11 @@ function suspend() {
4314
4236
  }
4315
4237
  function restart() {
4316
4238
  start();
4317
- event("clarity" /* Clarity */, "restart" /* Restart */);
4239
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4318
4240
  }
4319
4241
 
4320
4242
  function start$5() {
4243
+ start$x();
4321
4244
  start$e();
4322
4245
  start$d();
4323
4246
  }
@@ -4332,7 +4255,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4332
4255
  });
4333
4256
 
4334
4257
  function start$4() {
4335
- schedule$1(discover, 1 /* High */).then(function () {
4258
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4336
4259
  measure(compute$7)();
4337
4260
  measure(compute$6)();
4338
4261
  });
@@ -4344,15 +4267,15 @@ function discover() {
4344
4267
  switch (_a.label) {
4345
4268
  case 0:
4346
4269
  ts = time();
4347
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4348
- start$x(timer);
4349
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4270
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4271
+ start$w(timer);
4272
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4350
4273
  case 1:
4351
4274
  _a.sent();
4352
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4275
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4353
4276
  case 2:
4354
4277
  _a.sent();
4355
- stop$u(timer);
4278
+ stop$t(timer);
4356
4279
  return [2 /*return*/];
4357
4280
  }
4358
4281
  });
@@ -4367,13 +4290,11 @@ function start$3() {
4367
4290
  start$i();
4368
4291
  start$j();
4369
4292
  start$4();
4370
- start$w();
4371
4293
  }
4372
4294
  function stop$3() {
4373
4295
  stop$f();
4374
4296
  stop$g();
4375
4297
  stop$h();
4376
- stop$t();
4377
4298
  end();
4378
4299
  }
4379
4300
 
@@ -4390,7 +4311,7 @@ function encode (type) {
4390
4311
  t = time();
4391
4312
  tokens = [t, type];
4392
4313
  switch (type) {
4393
- case 29 /* Navigation */:
4314
+ case 29 /* Event.Navigation */:
4394
4315
  tokens.push(data.fetchStart);
4395
4316
  tokens.push(data.connectStart);
4396
4317
  tokens.push(data.connectEnd);
@@ -4439,11 +4360,11 @@ function compute(entry) {
4439
4360
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4440
4361
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4441
4362
  };
4442
- encode(29 /* Navigation */);
4363
+ encode(29 /* Event.Navigation */);
4443
4364
  }
4444
4365
 
4445
4366
  var observer;
4446
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4367
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4447
4368
  function start$2() {
4448
4369
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4449
4370
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
@@ -4458,7 +4379,7 @@ function start$2() {
4458
4379
  }
4459
4380
  }
4460
4381
  else {
4461
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4382
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4462
4383
  }
4463
4384
  }
4464
4385
  function observe() {
@@ -4478,15 +4399,15 @@ function observe() {
4478
4399
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4479
4400
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4480
4401
  // In those cases, we want to still initialize the metric in Clarity
4481
- if (x === "layout-shift" /* CLS */) {
4482
- sum(9 /* CumulativeLayoutShift */, 0);
4402
+ if (x === "layout-shift" /* Constant.CLS */) {
4403
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4483
4404
  }
4484
4405
  observer.observe({ type: x, buffered: true });
4485
4406
  }
4486
4407
  }
4487
4408
  }
4488
4409
  catch (_a) {
4489
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4410
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4490
4411
  }
4491
4412
  }
4492
4413
  function handle(entries) {
@@ -4497,33 +4418,42 @@ function process(entries) {
4497
4418
  for (var i = 0; i < entries.length; i++) {
4498
4419
  var entry = entries[i];
4499
4420
  switch (entry.entryType) {
4500
- case "navigation" /* Navigation */:
4421
+ case "navigation" /* Constant.Navigation */:
4501
4422
  compute(entry);
4502
4423
  break;
4503
- case "resource" /* Resource */:
4504
- log(4 /* NetworkHosts */, host(entry.name));
4424
+ case "resource" /* Constant.Resource */:
4425
+ var name_1 = entry.name;
4426
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4427
+ if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4428
+ max(28 /* Metric.UploadTime */, entry.duration);
4429
+ }
4505
4430
  break;
4506
- case "longtask" /* LongTask */:
4507
- count$1(7 /* LongTaskCount */);
4431
+ case "longtask" /* Constant.LongTask */:
4432
+ count$1(7 /* Metric.LongTaskCount */);
4508
4433
  break;
4509
- case "first-input" /* FID */:
4434
+ case "first-input" /* Constant.FID */:
4510
4435
  if (visible) {
4511
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4436
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4512
4437
  }
4513
4438
  break;
4514
- case "layout-shift" /* CLS */:
4439
+ case "layout-shift" /* Constant.CLS */:
4515
4440
  // Scale the value to avoid sending back floating point number
4516
4441
  if (visible && !entry["hadRecentInput"]) {
4517
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4442
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4518
4443
  }
4519
4444
  break;
4520
- case "largest-contentful-paint" /* LCP */:
4445
+ case "largest-contentful-paint" /* Constant.LCP */:
4521
4446
  if (visible) {
4522
- max(8 /* LargestPaint */, entry.startTime);
4447
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4523
4448
  }
4524
4449
  break;
4525
4450
  }
4526
4451
  }
4452
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4453
+ // Track consumed memory (MBs) where "memory" API is available
4454
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4455
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4456
+ }
4527
4457
  }
4528
4458
  function stop$2() {
4529
4459
  if (observer) {
@@ -4570,7 +4500,7 @@ function start(config$1) {
4570
4500
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4571
4501
  function pause() {
4572
4502
  if (active()) {
4573
- event("clarity" /* Clarity */, "pause" /* Pause */);
4503
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4574
4504
  pause$1();
4575
4505
  }
4576
4506
  }
@@ -4578,14 +4508,14 @@ function pause() {
4578
4508
  function resume() {
4579
4509
  if (active()) {
4580
4510
  resume$1();
4581
- event("clarity" /* Clarity */, "resume" /* Resume */);
4511
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4582
4512
  }
4583
4513
  }
4584
4514
  function stop() {
4585
4515
  if (active()) {
4586
4516
  // Stop modules in the reverse order of their initialization
4587
4517
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4588
- stop$v();
4518
+ stop$u();
4589
4519
  stop$5();
4590
4520
  }
4591
4521
  }