clarity-js 0.6.42 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/clarity.js CHANGED
@@ -12,6 +12,7 @@ var dom = /*#__PURE__*/Object.freeze({
12
12
  get update () { return update$1; },
13
13
  get sameorigin () { return sameorigin; },
14
14
  get iframe () { return iframe; },
15
+ get hashText () { return hashText; },
15
16
  get getNode () { return getNode; },
16
17
  get getValue () { return getValue; },
17
18
  get get () { return get; },
@@ -79,16 +80,18 @@ var envelope$1 = /*#__PURE__*/Object.freeze({
79
80
 
80
81
  var config$1 = {
81
82
  projectId: null,
82
- delay: 1 * 1000 /* Second */,
83
+ delay: 1 * 1000 /* Time.Second */,
83
84
  lean: false,
84
85
  track: true,
85
86
  content: true,
87
+ drop: [],
86
88
  mask: [],
87
89
  unmask: [],
88
90
  regions: [],
89
91
  extract: [],
90
92
  cookies: [],
91
- fraud: [],
93
+ fraud: true,
94
+ checksum: [],
92
95
  report: null,
93
96
  upload: null,
94
97
  fallback: null,
@@ -100,26 +103,27 @@ function api(method) {
100
103
  // Zone.js, a popular package for Angular, overrides native browser APIs which can lead to inconsistent state for single page applications.
101
104
  // Example issue: https://github.com/angular/angular/issues/31712
102
105
  // As a work around, we ensuring Clarity access APIs outside of Zone (and use native implementation instead)
103
- return window["Zone" /* Zone */] && "__symbol__" /* Symbol */ in window["Zone" /* Zone */] ? window["Zone" /* Zone */]["__symbol__" /* Symbol */](method) : method;
106
+ return window["Zone" /* Constant.Zone */] && "__symbol__" /* Constant.Symbol */ in window["Zone" /* Constant.Zone */] ? window["Zone" /* Constant.Zone */]["__symbol__" /* Constant.Symbol */](method) : method;
104
107
  }
105
108
 
106
109
  var startTime = 0;
107
- function start$F() {
110
+ function start$G() {
108
111
  startTime = performance.now();
109
112
  }
110
- function time(ts) {
111
- if (ts === void 0) { ts = null; }
112
- ts = ts ? ts : performance.now();
113
+ function time(event) {
114
+ if (event === void 0) { event = null; }
115
+ var ts = event && event.timeStamp > 0 ? event.timeStamp : performance.now();
113
116
  return Math.max(Math.round(ts - startTime), 0);
114
117
  }
115
- function stop$B() {
118
+ function stop$C() {
116
119
  startTime = 0;
117
120
  }
118
121
 
119
- var version$1 = "0.6.42";
122
+ var version$1 = "0.7.0";
120
123
 
121
124
  // tslint:disable: no-bitwise
122
- function hash (input) {
125
+ function hash (input, precision) {
126
+ if (precision === void 0) { precision = null; }
123
127
  // Code inspired from C# GetHashCode: https://github.com/Microsoft/referencesource/blob/master/mscorlib/system/string.cs
124
128
  var hash = 0;
125
129
  var hashOne = 5381;
@@ -135,21 +139,164 @@ function hash (input) {
135
139
  // Replace the magic number from C# implementation (1566083941) with a smaller prime number (11579)
136
140
  // This ensures we don't hit integer overflow and prevent collisions
137
141
  hash = Math.abs(hashOne + (hashTwo * 11579));
138
- return hash.toString(36);
142
+ return (precision ? hash % Math.pow(2, precision) : hash).toString(36);
143
+ }
144
+
145
+ var catchallRegex = /\S/gi;
146
+ var unicodeRegex = true;
147
+ var digitRegex = null;
148
+ var letterRegex = null;
149
+ var currencyRegex = null;
150
+ function text$1(value, hint, privacy, mangle) {
151
+ if (mangle === void 0) { mangle = false; }
152
+ if (value) {
153
+ switch (privacy) {
154
+ case 0 /* Privacy.None */:
155
+ return value;
156
+ case 1 /* Privacy.Sensitive */:
157
+ switch (hint) {
158
+ case "*T" /* Layout.Constant.TextTag */:
159
+ case "value":
160
+ case "placeholder":
161
+ case "click":
162
+ return redact(value);
163
+ case "input":
164
+ case "change":
165
+ return mangleToken(value);
166
+ }
167
+ return value;
168
+ case 2 /* Privacy.Text */:
169
+ case 3 /* Privacy.TextImage */:
170
+ switch (hint) {
171
+ case "*T" /* Layout.Constant.TextTag */:
172
+ return mangle ? mangleText(value) : mask(value);
173
+ case "src":
174
+ case "srcset":
175
+ case "title":
176
+ case "alt":
177
+ return privacy === 3 /* Privacy.TextImage */ ? "" /* Data.Constant.Empty */ : value;
178
+ case "value":
179
+ case "click":
180
+ case "input":
181
+ case "change":
182
+ return mangleToken(value);
183
+ case "placeholder":
184
+ return mask(value);
185
+ }
186
+ break;
187
+ case 4 /* Privacy.Exclude */:
188
+ switch (hint) {
189
+ case "value":
190
+ case "input":
191
+ case "click":
192
+ case "change":
193
+ return Array(5 /* Data.Setting.WordLength */).join("\u2022" /* Data.Constant.Mask */);
194
+ case "checksum":
195
+ return "" /* Data.Constant.Empty */;
196
+ }
197
+ }
198
+ }
199
+ return value;
200
+ }
201
+ function url$1(input) {
202
+ var drop = config$1.drop;
203
+ if (drop && drop.length > 0 && input && input.indexOf("?") > 0) {
204
+ var _a = input.split("?"), path = _a[0], query = _a[1];
205
+ var swap_1 = "*na*" /* Data.Constant.Dropped */;
206
+ return path + "?" + query.split("&").map(function (p) { return drop.some(function (x) { return p.indexOf("".concat(x, "=")) === 0; }) ? "".concat(p.split("=")[0], "=").concat(swap_1) : p; }).join("&");
207
+ }
208
+ return input;
209
+ }
210
+ function mangleText(value) {
211
+ var trimmed = value.trim();
212
+ if (trimmed.length > 0) {
213
+ var first = trimmed[0];
214
+ var index = value.indexOf(first);
215
+ var prefix = value.substr(0, index);
216
+ var suffix = value.substr(index + trimmed.length);
217
+ return "".concat(prefix).concat(trimmed.length.toString(36)).concat(suffix);
218
+ }
219
+ return value;
220
+ }
221
+ function mask(value) {
222
+ return value.replace(catchallRegex, "\u2022" /* Data.Constant.Mask */);
223
+ }
224
+ function mangleToken(value) {
225
+ var length = ((Math.floor(value.length / 5 /* Data.Setting.WordLength */) + 1) * 5 /* Data.Setting.WordLength */);
226
+ var output = "" /* Layout.Constant.Empty */;
227
+ for (var i = 0; i < length; i++) {
228
+ output += i > 0 && i % 5 /* Data.Setting.WordLength */ === 0 ? " " /* Data.Constant.Space */ : "\u2022" /* Data.Constant.Mask */;
229
+ }
230
+ return output;
231
+ }
232
+ function redact(value) {
233
+ var spaceIndex = -1;
234
+ var gap = 0;
235
+ var hasDigit = false;
236
+ var hasEmail = false;
237
+ var hasWhitespace = false;
238
+ var array = null;
239
+ // Initialize unicode regex, if supported by the browser
240
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
241
+ if (unicodeRegex && digitRegex === null) {
242
+ try {
243
+ digitRegex = new RegExp("\\p{N}", "gu");
244
+ letterRegex = new RegExp("\\p{L}", "gu");
245
+ currencyRegex = new RegExp("\\p{Sc}", "gu");
246
+ }
247
+ catch (_a) {
248
+ unicodeRegex = false;
249
+ }
250
+ }
251
+ for (var i = 0; i < value.length; i++) {
252
+ var c = value.charCodeAt(i);
253
+ hasDigit = hasDigit || (c >= 48 /* Data.Character.Zero */ && c <= 57 /* Data.Character.Nine */); // Check for digits in the current word
254
+ hasEmail = hasEmail || c === 64 /* Data.Character.At */; // Check for @ sign anywhere within the current word
255
+ hasWhitespace = c === 9 /* Data.Character.Tab */ || c === 10 /* Data.Character.NewLine */ || c === 13 /* Data.Character.Return */ || c === 32 /* Data.Character.Blank */;
256
+ // Process each word as an individual token to redact any sensitive information
257
+ if (i === 0 || i === value.length - 1 || hasWhitespace) {
258
+ // Performance optimization: Lazy load string -> array conversion only when required
259
+ if (hasDigit || hasEmail) {
260
+ if (array === null) {
261
+ array = value.split("" /* Data.Constant.Empty */);
262
+ }
263
+ // Work on a token at a time so we don't have to apply regex to a larger string
264
+ var token = value.substring(spaceIndex + 1, hasWhitespace ? i : i + 1);
265
+ // Check if unicode regex is supported, otherwise fallback to calling mask function on this token
266
+ if (unicodeRegex && currencyRegex !== null) {
267
+ // Do not redact information if the token contains a currency symbol
268
+ token = token.match(currencyRegex) ? token : token.replace(letterRegex, "\u25AA" /* Data.Constant.Letter */).replace(digitRegex, "\u25AB" /* Data.Constant.Digit */);
269
+ }
270
+ else {
271
+ token = mask(token);
272
+ }
273
+ // Merge token back into array at the right place
274
+ array.splice(spaceIndex + 1 - gap, token.length, token);
275
+ gap += token.length - 1;
276
+ }
277
+ // Reset digit and email flags after every word boundary, except the beginning of string
278
+ if (hasWhitespace) {
279
+ hasDigit = false;
280
+ hasEmail = false;
281
+ spaceIndex = i;
282
+ }
283
+ }
284
+ }
285
+ return array ? array.join("" /* Data.Constant.Empty */) : value;
139
286
  }
140
287
 
141
- var state$9 = null;
288
+ var state$a = null;
142
289
  var buffer = null;
143
290
  var update$2 = false;
144
- function start$E() {
291
+ function start$F() {
145
292
  update$2 = false;
146
- reset$p();
293
+ reset$q();
147
294
  }
148
- function reset$p() {
295
+ function reset$q() {
149
296
  // Baseline state holds the previous values - if it is updated in the current payload,
150
297
  // reset the state to current value after sending the previous state
151
298
  if (update$2) {
152
- state$9 = { time: time(), event: 4 /* Baseline */, data: {
299
+ state$a = { time: time(), event: 4 /* Event.Baseline */, data: {
153
300
  visible: buffer.visible,
154
301
  docWidth: buffer.docWidth,
155
302
  docHeight: buffer.docHeight,
@@ -164,7 +311,7 @@ function reset$p() {
164
311
  };
165
312
  }
166
313
  buffer = buffer ? buffer : {
167
- visible: 1 /* True */,
314
+ visible: 1 /* BooleanFlag.True */,
168
315
  docWidth: 0,
169
316
  docHeight: 0,
170
317
  screenWidth: 0,
@@ -178,15 +325,15 @@ function reset$p() {
178
325
  }
179
326
  function track$7(event, x, y) {
180
327
  switch (event) {
181
- case 8 /* Document */:
328
+ case 8 /* Event.Document */:
182
329
  buffer.docWidth = x;
183
330
  buffer.docHeight = y;
184
331
  break;
185
- case 11 /* Resize */:
332
+ case 11 /* Event.Resize */:
186
333
  buffer.screenWidth = x;
187
334
  buffer.screenHeight = y;
188
335
  break;
189
- case 10 /* Scroll */:
336
+ case 10 /* Event.Scroll */:
190
337
  buffer.scrollX = x;
191
338
  buffer.scrollY = y;
192
339
  break;
@@ -201,7 +348,7 @@ function activity(t) {
201
348
  buffer.activityTime = t;
202
349
  }
203
350
  function visibility(t, visible) {
204
- buffer.visible = visible === "visible" ? 1 /* True */ : 0 /* False */;
351
+ buffer.visible = visible === "visible" ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
205
352
  if (!buffer.visible) {
206
353
  activity(t);
207
354
  }
@@ -209,23 +356,23 @@ function visibility(t, visible) {
209
356
  }
210
357
  function compute$c() {
211
358
  if (update$2) {
212
- encode$1(4 /* Baseline */);
359
+ encode$1(4 /* Event.Baseline */);
213
360
  }
214
361
  }
215
- function stop$A() {
216
- reset$p();
362
+ function stop$B() {
363
+ reset$q();
217
364
  }
218
365
 
219
366
  var baseline = /*#__PURE__*/Object.freeze({
220
367
  __proto__: null,
221
- get state () { return state$9; },
222
- start: start$E,
223
- reset: reset$p,
368
+ get state () { return state$a; },
369
+ start: start$F,
370
+ reset: reset$q,
224
371
  track: track$7,
225
372
  activity: activity,
226
373
  visibility: visibility,
227
374
  compute: compute$c,
228
- stop: stop$A
375
+ stop: stop$B
229
376
  });
230
377
 
231
378
  var data$j = null;
@@ -233,23 +380,23 @@ function event(key, value) {
233
380
  if (active() &&
234
381
  key &&
235
382
  value &&
236
- typeof key === "string" /* String */ &&
237
- typeof value === "string" /* String */ &&
383
+ typeof key === "string" /* Constant.String */ &&
384
+ typeof value === "string" /* Constant.String */ &&
238
385
  key.length < 255 &&
239
386
  value.length < 255) {
240
387
  data$j = { key: key, value: value };
241
- encode$1(24 /* Custom */);
388
+ encode$1(24 /* Event.Custom */);
242
389
  }
243
390
  }
244
391
 
245
392
  var data$i = null;
246
393
  var updates$3 = null;
247
- function start$D() {
394
+ function start$E() {
248
395
  data$i = {};
249
396
  updates$3 = {};
250
- count$1(5 /* InvokeCount */);
397
+ count$1(5 /* Metric.InvokeCount */);
251
398
  }
252
- function stop$z() {
399
+ function stop$A() {
253
400
  data$i = {};
254
401
  updates$3 = {};
255
402
  }
@@ -288,9 +435,9 @@ function max(metric, value) {
288
435
  }
289
436
  }
290
437
  function compute$b() {
291
- encode$1(0 /* Metric */);
438
+ encode$1(0 /* Event.Metric */);
292
439
  }
293
- function reset$o() {
440
+ function reset$p() {
294
441
  updates$3 = {};
295
442
  }
296
443
 
@@ -305,11 +452,11 @@ var data$h;
305
452
  var last = 0;
306
453
  var interval = 0;
307
454
  var timeout$6 = null;
308
- function start$C() {
309
- interval = 60000 /* PingInterval */;
455
+ function start$D() {
456
+ interval = 60000 /* Setting.PingInterval */;
310
457
  last = 0;
311
458
  }
312
- function reset$n() {
459
+ function reset$o() {
313
460
  if (timeout$6) {
314
461
  clearTimeout(timeout$6);
315
462
  }
@@ -319,15 +466,15 @@ function reset$n() {
319
466
  function ping() {
320
467
  var now = time();
321
468
  data$h = { gap: now - last };
322
- encode$1(25 /* Ping */);
323
- if (data$h.gap < 300000 /* PingTimeout */) {
469
+ encode$1(25 /* Event.Ping */);
470
+ if (data$h.gap < 300000 /* Setting.PingTimeout */) {
324
471
  timeout$6 = setTimeout(ping, interval);
325
472
  }
326
473
  else {
327
474
  suspend();
328
475
  }
329
476
  }
330
- function stop$y() {
477
+ function stop$z() {
331
478
  clearTimeout(timeout$6);
332
479
  last = 0;
333
480
  interval = 0;
@@ -336,16 +483,16 @@ function stop$y() {
336
483
  var ping$1 = /*#__PURE__*/Object.freeze({
337
484
  __proto__: null,
338
485
  get data () { return data$h; },
339
- start: start$C,
340
- reset: reset$n,
341
- stop: stop$y
486
+ start: start$D,
487
+ reset: reset$o,
488
+ stop: stop$z
342
489
  });
343
490
 
344
491
  var data$g = null;
345
- function start$B() {
492
+ function start$C() {
346
493
  data$g = {};
347
494
  }
348
- function stop$x() {
495
+ function stop$y() {
349
496
  data$g = {};
350
497
  }
351
498
  function track$6(event, time) {
@@ -357,7 +504,7 @@ function track$6(event, time) {
357
504
  var last = e[e.length - 1];
358
505
  // Add a new entry only if the new event occurs after configured interval
359
506
  // Otherwise, extend the duration of the previous entry
360
- if (time - last[0] > 100 /* SummaryInterval */) {
507
+ if (time - last[0] > 100 /* Setting.SummaryInterval */) {
361
508
  data$g[event].push([time, 0]);
362
509
  }
363
510
  else {
@@ -366,26 +513,26 @@ function track$6(event, time) {
366
513
  }
367
514
  }
368
515
  function compute$a() {
369
- encode$1(36 /* Summary */);
516
+ encode$1(36 /* Event.Summary */);
370
517
  }
371
- function reset$m() {
518
+ function reset$n() {
372
519
  data$g = {};
373
520
  }
374
521
 
375
522
  var summary = /*#__PURE__*/Object.freeze({
376
523
  __proto__: null,
377
524
  get data () { return data$g; },
378
- start: start$B,
379
- stop: stop$x,
525
+ start: start$C,
526
+ stop: stop$y,
380
527
  track: track$6,
381
528
  compute: compute$a,
382
- reset: reset$m
529
+ reset: reset$n
383
530
  });
384
531
 
385
532
  var data$f = null;
386
- function start$A() {
533
+ function start$B() {
387
534
  if (!config$1.lean && config$1.upgrade) {
388
- config$1.upgrade("Config" /* Config */);
535
+ config$1.upgrade("Config" /* Constant.Config */);
389
536
  }
390
537
  data$f = null;
391
538
  }
@@ -404,45 +551,45 @@ function upgrade(key) {
404
551
  if (config$1.upgrade) {
405
552
  config$1.upgrade(key);
406
553
  }
407
- encode$1(3 /* Upgrade */);
554
+ encode$1(3 /* Event.Upgrade */);
408
555
  }
409
556
  }
410
- function stop$w() {
557
+ function stop$x() {
411
558
  data$f = null;
412
559
  }
413
560
 
414
561
  var upgrade$1 = /*#__PURE__*/Object.freeze({
415
562
  __proto__: null,
416
563
  get data () { return data$f; },
417
- start: start$A,
564
+ start: start$B,
418
565
  upgrade: upgrade,
419
- stop: stop$w
566
+ stop: stop$x
420
567
  });
421
568
 
422
569
  var data$e = null;
423
- function start$z() {
424
- reset$l();
570
+ function start$A() {
571
+ reset$m();
425
572
  }
426
573
  function set(variable, value) {
427
- var values = typeof value === "string" /* String */ ? [value] : value;
574
+ var values = typeof value === "string" /* Constant.String */ ? [value] : value;
428
575
  log$2(variable, values);
429
576
  }
430
577
  function identify(userId, sessionId, pageId) {
431
578
  if (sessionId === void 0) { sessionId = null; }
432
579
  if (pageId === void 0) { pageId = null; }
433
- log$2("userId" /* UserId */, [userId]);
434
- log$2("sessionId" /* SessionId */, [sessionId]);
435
- log$2("pageId" /* PageId */, [pageId]);
580
+ log$2("userId" /* Constant.UserId */, [userId]);
581
+ log$2("sessionId" /* Constant.SessionId */, [sessionId]);
582
+ log$2("pageId" /* Constant.PageId */, [pageId]);
436
583
  }
437
584
  function log$2(variable, value) {
438
585
  if (active() &&
439
586
  variable &&
440
587
  value &&
441
- typeof variable === "string" /* String */ &&
588
+ typeof variable === "string" /* Constant.String */ &&
442
589
  variable.length < 255) {
443
590
  var validValues = variable in data$e ? data$e[variable] : [];
444
591
  for (var i = 0; i < value.length; i++) {
445
- if (typeof value[i] === "string" /* String */ && value[i].length < 255) {
592
+ if (typeof value[i] === "string" /* Constant.String */ && value[i].length < 255) {
446
593
  validValues.push(value[i]);
447
594
  }
448
595
  }
@@ -450,27 +597,27 @@ function log$2(variable, value) {
450
597
  }
451
598
  }
452
599
  function compute$9() {
453
- encode$1(34 /* Variable */);
600
+ encode$1(34 /* Event.Variable */);
454
601
  }
455
- function reset$l() {
602
+ function reset$m() {
456
603
  data$e = {};
457
604
  }
458
- function stop$v() {
459
- reset$l();
605
+ function stop$w() {
606
+ reset$m();
460
607
  }
461
608
 
462
609
  var variable = /*#__PURE__*/Object.freeze({
463
610
  __proto__: null,
464
611
  get data () { return data$e; },
465
- start: start$z,
612
+ start: start$A,
466
613
  set: set,
467
614
  identify: identify,
468
615
  compute: compute$9,
469
- reset: reset$l,
470
- stop: stop$v
616
+ reset: reset$m,
617
+ stop: stop$w
471
618
  });
472
619
 
473
- /*! *****************************************************************************
620
+ /******************************************************************************
474
621
  Copyright (c) Microsoft Corporation.
475
622
 
476
623
  Permission to use, copy, modify, and/or distribute this software for any
@@ -523,7 +670,7 @@ function __generator(thisArg, body) {
523
670
  }
524
671
  }
525
672
 
526
- var supported$1 = "CompressionStream" /* CompressionStream */ in window;
673
+ var supported$1 = "CompressionStream" /* Constant.CompressionStream */ in window;
527
674
  function compress (input) {
528
675
  return __awaiter(this, void 0, void 0, function () {
529
676
  var stream, _a;
@@ -540,7 +687,7 @@ function compress (input) {
540
687
  return [2 /*return*/];
541
688
  });
542
689
  });
543
- } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* CompressionStream */]("gzip"));
690
+ } }).pipeThrough(new TextEncoderStream()).pipeThrough(new window["CompressionStream" /* Constant.CompressionStream */]("gzip"));
544
691
  _a = Uint8Array.bind;
545
692
  return [4 /*yield*/, read(stream)];
546
693
  case 1: return [2 /*return*/, new (_a.apply(Uint8Array, [void 0, _c.sent()]))()];
@@ -582,18 +729,18 @@ function read(stream) {
582
729
  }
583
730
 
584
731
  var modules$1 = [baseline, dimension, variable, limit, summary, metadata$1, envelope$1, upload$1, ping$1, upgrade$1, extract];
585
- function start$y() {
732
+ function start$z() {
586
733
  // Metric needs to be initialized before we can start measuring. so metric is not wrapped in measure
587
- start$D();
734
+ start$E();
588
735
  modules$1.forEach(function (x) { return measure(x.start)(); });
589
736
  }
590
- function stop$u() {
737
+ function stop$v() {
591
738
  // Stop modules in the reverse order of their initialization
592
739
  // The ordering below should respect inter-module dependency.
593
740
  // E.g. if upgrade depends on upload, then upgrade needs to end before upload.
594
741
  // Similarly, if upload depends on metadata, upload needs to end before metadata.
595
742
  modules$1.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
596
- stop$z();
743
+ stop$A();
597
744
  }
598
745
  function compute$8() {
599
746
  compute$9();
@@ -605,215 +752,100 @@ function compute$8() {
605
752
  compute$4();
606
753
  }
607
754
 
608
- var catchallRegex = /\S/gi;
609
- var unicodeRegex = true;
610
- var digitRegex = null;
611
- var letterRegex = null;
612
- var currencyRegex = null;
613
- function scrub (value, hint, privacy, mangle) {
614
- if (mangle === void 0) { mangle = false; }
615
- if (value) {
616
- switch (privacy) {
617
- case 0 /* None */:
618
- return value;
619
- case 1 /* Sensitive */:
620
- switch (hint) {
621
- case "*T" /* TextTag */:
622
- case "value":
623
- case "placeholder":
624
- case "click":
625
- case "input":
626
- return redact(value);
627
- }
628
- return value;
629
- case 2 /* Text */:
630
- case 3 /* TextImage */:
631
- switch (hint) {
632
- case "*T" /* TextTag */:
633
- return mangle ? mangleText(value) : mask(value);
634
- case "src":
635
- case "srcset":
636
- case "title":
637
- case "alt":
638
- return privacy === 3 /* TextImage */ ? "" /* Empty */ : value;
639
- case "value":
640
- case "click":
641
- case "input":
642
- return mangleToken(value);
643
- case "placeholder":
644
- return mask(value);
645
- }
646
- break;
647
- }
648
- }
649
- return value;
650
- }
651
- function mangleText(value) {
652
- var trimmed = value.trim();
653
- if (trimmed.length > 0) {
654
- var first = trimmed[0];
655
- var index = value.indexOf(first);
656
- var prefix = value.substr(0, index);
657
- var suffix = value.substr(index + trimmed.length);
658
- return "" + prefix + trimmed.length.toString(36) + suffix;
659
- }
660
- return value;
661
- }
662
- function mask(value) {
663
- return value.replace(catchallRegex, "\u2022" /* Mask */);
664
- }
665
- function mangleToken(value) {
666
- var length = ((Math.floor(value.length / 5 /* WordLength */) + 1) * 5 /* WordLength */);
667
- var output = "" /* Empty */;
668
- for (var i = 0; i < length; i++) {
669
- output += i > 0 && i % 5 /* WordLength */ === 0 ? " " /* Space */ : "\u2022" /* Mask */;
670
- }
671
- return output;
672
- }
673
- function redact(value) {
674
- var spaceIndex = -1;
675
- var gap = 0;
676
- var hasDigit = false;
677
- var hasEmail = false;
678
- var hasWhitespace = false;
679
- var array = null;
680
- // Initialize unicode regex, if supported by the browser
681
- // Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes
682
- if (unicodeRegex && digitRegex === null) {
683
- try {
684
- digitRegex = new RegExp("\\p{N}", "gu");
685
- letterRegex = new RegExp("\\p{L}", "gu");
686
- currencyRegex = new RegExp("\\p{Sc}", "gu");
687
- }
688
- catch (_a) {
689
- unicodeRegex = false;
690
- }
691
- }
692
- for (var i = 0; i < value.length; i++) {
693
- var c = value.charCodeAt(i);
694
- hasDigit = hasDigit || (c >= 48 /* Zero */ && c <= 57 /* Nine */); // Check for digits in the current word
695
- hasEmail = hasEmail || c === 64 /* At */; // Check for @ sign anywhere within the current word
696
- hasWhitespace = c === 9 /* Tab */ || c === 10 /* NewLine */ || c === 13 /* Return */ || c === 32 /* Blank */;
697
- // Process each word as an individual token to redact any sensitive information
698
- if (i === 0 || i === value.length - 1 || hasWhitespace) {
699
- // Performance optimization: Lazy load string -> array conversion only when required
700
- if (hasDigit || hasEmail) {
701
- if (array === null) {
702
- array = value.split("" /* Empty */);
703
- }
704
- // Work on a token at a time so we don't have to apply regex to a larger string
705
- var token = value.substring(spaceIndex + 1, hasWhitespace ? i : i + 1);
706
- // Check if unicode regex is supported, otherwise fallback to calling mask function on this token
707
- if (unicodeRegex && currencyRegex !== null) {
708
- // Do not redact information if the token contains a currency symbol
709
- token = token.match(currencyRegex) ? token : token.replace(letterRegex, "\u25AA" /* Letter */).replace(digitRegex, "\u25AB" /* Digit */);
710
- }
711
- else {
712
- token = mask(token);
713
- }
714
- // Merge token back into array at the right place
715
- array.splice(spaceIndex + 1 - gap, token.length, token);
716
- gap += token.length - 1;
717
- }
718
- // Reset digit and email flags after every word boundary, except the beginning of string
719
- if (hasWhitespace) {
720
- hasDigit = false;
721
- hasEmail = false;
722
- spaceIndex = i;
723
- }
724
- }
725
- }
726
- return array ? array.join("" /* Empty */) : value;
727
- }
728
-
729
755
  var history$5 = [];
730
756
  var data$d;
731
- function start$x() {
757
+ function start$y() {
732
758
  history$5 = [];
733
- max(26 /* Automation */, navigator.webdriver ? 1 /* True */ : 0 /* False */);
759
+ max(26 /* Metric.Automation */, navigator.webdriver ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
760
+ try {
761
+ max(31 /* Metric.Iframed */, window.top == window.self ? 1 /* IframeStatus.TopFrame */ : 2 /* IframeStatus.Iframe */);
762
+ }
763
+ catch (ex) {
764
+ max(31 /* Metric.Iframed */, 0 /* IframeStatus.Unknown */);
765
+ }
734
766
  }
735
767
  function check$4(id, target, input) {
736
- // Compute hash for fraud detection. Hash is computed only if input meets the minimum length criteria
737
- if (id !== null && input && input.length >= 5 /* WordLength */) {
738
- data$d = { id: id, target: target, hash: hash(input) };
768
+ // Compute hash for fraud detection, if enabled. Hash is computed only if input meets the minimum length criteria
769
+ if (config$1.fraud && id !== null && input && input.length >= 5 /* Setting.WordLength */) {
770
+ data$d = { id: id, target: target, checksum: hash(input, 24 /* Setting.ChecksumPrecision */) };
739
771
  // Only encode this event if we haven't already reported this hash
740
- if (history$5.indexOf(data$d.hash) < 0) {
741
- history$5.push(data$d.hash);
742
- encode$2(41 /* Fraud */);
772
+ if (history$5.indexOf(data$d.checksum) < 0) {
773
+ history$5.push(data$d.checksum);
774
+ encode$2(41 /* Event.Fraud */);
743
775
  }
744
776
  }
745
777
  }
746
778
 
747
- var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* ExcludeClassNames */.split("," /* Comma */);
779
+ var excludeClassNames = "load,active,fixed,visible,focus,show,collaps,animat" /* Constant.ExcludeClassNames */.split("," /* Constant.Comma */);
748
780
  var selectorMap = {};
749
- function reset$k() {
781
+ function reset$l() {
750
782
  selectorMap = {};
751
783
  }
752
784
  function get$1(input, type) {
753
785
  var a = input.attributes;
754
786
  var prefix = input.prefix ? input.prefix[type] : null;
755
- var suffix = type === 0 /* Alpha */ ? "" + "~" /* Tilde */ + (input.position - 1) : ":nth-of-type(" + input.position + ")";
787
+ var suffix = type === 0 /* Selector.Alpha */ ? "".concat("~" /* Constant.Tilde */).concat(input.position - 1) : ":nth-of-type(".concat(input.position, ")");
756
788
  switch (input.tag) {
757
789
  case "STYLE":
758
790
  case "TITLE":
759
791
  case "LINK":
760
792
  case "META":
761
- case "*T" /* TextTag */:
762
- case "*D" /* DocumentTag */:
763
- return "" /* Empty */;
793
+ case "*T" /* Constant.TextTag */:
794
+ case "*D" /* Constant.DocumentTag */:
795
+ return "" /* Constant.Empty */;
764
796
  case "HTML":
765
- return "HTML" /* HTML */;
797
+ return "HTML" /* Constant.HTML */;
766
798
  default:
767
799
  if (prefix === null) {
768
- return "" /* Empty */;
800
+ return "" /* Constant.Empty */;
769
801
  }
770
- prefix = "" + prefix + ">" /* Separator */;
771
- input.tag = input.tag.indexOf("svg:" /* SvgPrefix */) === 0 ? input.tag.substr("svg:" /* SvgPrefix */.length) : input.tag;
772
- var selector = "" + prefix + input.tag + suffix;
773
- var id = "id" /* Id */ in a && a["id" /* Id */].length > 0 ? a["id" /* Id */] : null;
774
- var classes = input.tag !== "BODY" /* BodyTag */ && "class" /* Class */ in a && a["class" /* Class */].length > 0 ? a["class" /* Class */].trim().split(/\s+/).filter(function (c) { return filter(c); }).join("." /* Period */) : null;
802
+ prefix = "".concat(prefix).concat(">" /* Constant.Separator */);
803
+ input.tag = input.tag.indexOf("svg:" /* Constant.SvgPrefix */) === 0 ? input.tag.substr("svg:" /* Constant.SvgPrefix */.length) : input.tag;
804
+ var selector = "".concat(prefix).concat(input.tag).concat(suffix);
805
+ var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
806
+ var classes = input.tag !== "BODY" /* Constant.BodyTag */ && "class" /* Constant.Class */ in a && a["class" /* Constant.Class */].length > 0 ? a["class" /* Constant.Class */].trim().split(/\s+/).filter(function (c) { return filter(c); }).join("." /* Constant.Period */) : null;
775
807
  if (classes && classes.length > 0) {
776
- if (type === 0 /* Alpha */) {
808
+ if (type === 0 /* Selector.Alpha */) {
777
809
  // In Alpha mode, update selector to use class names, with relative positioning within the parent id container.
778
810
  // If the node has valid class name(s) then drop relative positioning within the parent path to keep things simple.
779
- var key = "" + getDomPath(prefix) + input.tag + "." /* Dot */ + classes;
811
+ var key = "".concat(getDomPath(prefix)).concat(input.tag).concat("." /* Constant.Dot */).concat(classes);
780
812
  if (!(key in selectorMap)) {
781
813
  selectorMap[key] = [];
782
814
  }
783
815
  if (selectorMap[key].indexOf(input.id) < 0) {
784
816
  selectorMap[key].push(input.id);
785
817
  }
786
- selector = "" + key + "~" /* Tilde */ + selectorMap[key].indexOf(input.id);
818
+ selector = "".concat(key).concat("~" /* Constant.Tilde */).concat(selectorMap[key].indexOf(input.id));
787
819
  }
788
820
  else {
789
821
  // In Beta mode, we continue to look at query selectors in context of the full page
790
- selector = "" + prefix + input.tag + "." + classes + suffix;
822
+ selector = "".concat(prefix).concat(input.tag, ".").concat(classes).concat(suffix);
791
823
  }
792
824
  }
793
825
  // Update selector to use "id" field when available. There are two exceptions:
794
826
  // (1) if "id" appears to be an auto generated string token, e.g. guid or a random id containing digits
795
827
  // (2) if "id" appears inside a shadow DOM, in which case we continue to prefix up to shadow DOM to prevent conflicts
796
- selector = id && filter(id) ? "" + getDomPrefix(prefix) + "#" /* Hash */ + id : selector;
828
+ selector = id && filter(id) ? "".concat(getDomPrefix(prefix)).concat("#" /* Constant.Hash */).concat(id) : selector;
797
829
  return selector;
798
830
  }
799
831
  }
800
832
  function getDomPrefix(prefix) {
801
- var shadowDomStart = prefix.lastIndexOf("*S" /* ShadowDomTag */);
802
- var iframeDomStart = prefix.lastIndexOf("" + "iframe:" /* IFramePrefix */ + "HTML" /* HTML */);
833
+ var shadowDomStart = prefix.lastIndexOf("*S" /* Constant.ShadowDomTag */);
834
+ var iframeDomStart = prefix.lastIndexOf("".concat("iframe:" /* Constant.IFramePrefix */).concat("HTML" /* Constant.HTML */));
803
835
  var domStart = Math.max(shadowDomStart, iframeDomStart);
804
836
  if (domStart < 0) {
805
- return "" /* Empty */;
837
+ return "" /* Constant.Empty */;
806
838
  }
807
- return prefix.substring(0, prefix.indexOf(">" /* Separator */, domStart) + 1);
839
+ return prefix.substring(0, prefix.indexOf(">" /* Constant.Separator */, domStart) + 1);
808
840
  }
809
841
  function getDomPath(input) {
810
- var parts = input.split(">" /* Separator */);
842
+ var parts = input.split(">" /* Constant.Separator */);
811
843
  for (var i = 0; i < parts.length; i++) {
812
- var tIndex = parts[i].indexOf("~" /* Tilde */);
813
- var dIndex = parts[i].indexOf("." /* Dot */);
844
+ var tIndex = parts[i].indexOf("~" /* Constant.Tilde */);
845
+ var dIndex = parts[i].indexOf("." /* Constant.Dot */);
814
846
  parts[i] = parts[i].substring(0, dIndex > 0 ? dIndex : (tIndex > 0 ? tIndex : parts[i].length));
815
847
  }
816
- return parts.join(">" /* Separator */);
848
+ return parts.join(">" /* Constant.Separator */);
817
849
  }
818
850
  // Check if the given input string has digits or excluded class names
819
851
  function filter(value) {
@@ -825,7 +857,7 @@ function filter(value) {
825
857
  }
826
858
  for (var i = 0; i < value.length; i++) {
827
859
  var c = value.charCodeAt(i);
828
- if (c >= 48 /* Zero */ && c <= 57 /* Nine */) {
860
+ if (c >= 48 /* Character.Zero */ && c <= 57 /* Character.Nine */) {
829
861
  return false;
830
862
  }
831
863
  }
@@ -834,7 +866,7 @@ function filter(value) {
834
866
 
835
867
  var selector = /*#__PURE__*/Object.freeze({
836
868
  __proto__: null,
837
- reset: reset$k,
869
+ reset: reset$l,
838
870
  get: get$1
839
871
  });
840
872
 
@@ -861,14 +893,14 @@ function resume$1() {
861
893
  }
862
894
  }
863
895
  }
864
- function reset$j() {
896
+ function reset$k() {
865
897
  tracker = {};
866
898
  queuedTasks = [];
867
899
  activeTask = null;
868
900
  pauseTask = null;
869
901
  }
870
902
  function schedule$1(task, priority) {
871
- if (priority === void 0) { priority = 0 /* Normal */; }
903
+ if (priority === void 0) { priority = 0 /* Priority.Normal */; }
872
904
  return __awaiter(this, void 0, void 0, function () {
873
905
  var _i, queuedTasks_1, q, promise;
874
906
  return __generator(this, function (_a) {
@@ -880,7 +912,7 @@ function schedule$1(task, priority) {
880
912
  }
881
913
  }
882
914
  promise = new Promise(function (resolve) {
883
- var insert = priority === 1 /* High */ ? "unshift" : "push";
915
+ var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
884
916
  // Queue this task for asynchronous execution later
885
917
  // We also store a unique page identifier (id) along with the task to ensure
886
918
  // ensure that we do not accidentally execute this task in context of a different page
@@ -915,45 +947,45 @@ function run() {
915
947
  return;
916
948
  }
917
949
  if (error) {
918
- log$1(0 /* RunTask */, 1 /* Warning */, error.name, error.message, error.stack);
950
+ log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
919
951
  }
920
952
  activeTask = null;
921
953
  run();
922
954
  });
923
955
  }
924
956
  }
925
- function state$8(timer) {
957
+ function state$9(timer) {
926
958
  var id = key(timer);
927
959
  if (id in tracker) {
928
960
  var elapsed = performance.now() - tracker[id].start;
929
- return (elapsed > tracker[id].yield) ? 0 /* Wait */ : 1 /* Run */;
961
+ return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
930
962
  }
931
963
  // If this task is no longer being tracked, send stop message to the caller
932
- return 2 /* Stop */;
964
+ return 2 /* Task.Stop */;
933
965
  }
934
- function start$w(timer) {
935
- tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* LongTask */ };
966
+ function start$x(timer) {
967
+ tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
936
968
  }
937
969
  function restart$2(timer) {
938
970
  var id = key(timer);
939
971
  if (tracker && tracker[id]) {
940
972
  var c = tracker[id].calls;
941
973
  var y = tracker[id].yield;
942
- start$w(timer);
974
+ start$x(timer);
943
975
  tracker[id].calls = c + 1;
944
976
  tracker[id].yield = y;
945
977
  }
946
978
  }
947
- function stop$t(timer) {
979
+ function stop$u(timer) {
948
980
  var end = performance.now();
949
981
  var id = key(timer);
950
982
  var duration = end - tracker[id].start;
951
983
  sum(timer.cost, duration);
952
- count$1(5 /* InvokeCount */);
984
+ count$1(5 /* Metric.InvokeCount */);
953
985
  // For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
954
986
  // However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
955
987
  if (tracker[id].calls > 0) {
956
- sum(4 /* TotalCost */, duration);
988
+ sum(4 /* Metric.TotalCost */, duration);
957
989
  }
958
990
  }
959
991
  function suspend$1(timer) {
@@ -964,7 +996,7 @@ function suspend$1(timer) {
964
996
  case 0:
965
997
  id = key(timer);
966
998
  if (!(id in tracker)) return [3 /*break*/, 2];
967
- stop$t(timer);
999
+ stop$u(timer);
968
1000
  _a = tracker[id];
969
1001
  return [4 /*yield*/, wait()];
970
1002
  case 1:
@@ -974,13 +1006,13 @@ function suspend$1(timer) {
974
1006
  case 2:
975
1007
  // After we are done with suspending task, ensure that we are still operating in the right context
976
1008
  // If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
977
- return [2 /*return*/, id in tracker ? 1 /* Run */ : 2 /* Stop */];
1009
+ return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
978
1010
  }
979
1011
  });
980
1012
  });
981
1013
  }
982
1014
  function key(timer) {
983
- return timer.id + "." + timer.cost;
1015
+ return "".concat(timer.id, ".").concat(timer.cost);
984
1016
  }
985
1017
  function wait() {
986
1018
  return __awaiter(this, void 0, void 0, function () {
@@ -1018,14 +1050,14 @@ function requestIdleCallbackPolyfill(callback, options) {
1018
1050
  var currentTime = performance.now();
1019
1051
  var elapsed = currentTime - startTime;
1020
1052
  var duration = currentTime - event.data;
1021
- if (duration > 30 /* LongTask */ && elapsed < options.timeout) {
1053
+ if (duration > 30 /* Setting.LongTask */ && elapsed < options.timeout) {
1022
1054
  requestAnimationFrame(function () { outgoing.postMessage(currentTime); });
1023
1055
  }
1024
1056
  else {
1025
1057
  var didTimeout_1 = elapsed > options.timeout;
1026
1058
  callback({
1027
1059
  didTimeout: didTimeout_1,
1028
- timeRemaining: function () { return didTimeout_1 ? 30 /* LongTask */ : Math.max(0, 30 /* LongTask */ - duration); }
1060
+ timeRemaining: function () { return didTimeout_1 ? 30 /* Setting.LongTask */ : Math.max(0, 30 /* Setting.LongTask */ - duration); }
1029
1061
  });
1030
1062
  }
1031
1063
  };
@@ -1046,7 +1078,7 @@ function tokenize (tokens) {
1046
1078
  var reference = null;
1047
1079
  for (var i = 0; i < tokens.length; i++) {
1048
1080
  // Only optimize for string values
1049
- if (typeof tokens[i] === "string" /* String */) {
1081
+ if (typeof tokens[i] === "string" /* Constant.String */) {
1050
1082
  var token = tokens[i];
1051
1083
  var index = lookup[token] || -1;
1052
1084
  if (index >= 0) {
@@ -1088,10 +1120,10 @@ function encode$4 (type, timer, ts) {
1088
1120
  tokens = [eventTime, type];
1089
1121
  _a = type;
1090
1122
  switch (_a) {
1091
- case 8 /* Document */: return [3 /*break*/, 1];
1092
- case 7 /* Region */: return [3 /*break*/, 2];
1093
- case 5 /* Discover */: return [3 /*break*/, 3];
1094
- case 6 /* Mutation */: return [3 /*break*/, 3];
1123
+ case 8 /* Event.Document */: return [3 /*break*/, 1];
1124
+ case 7 /* Event.Region */: return [3 /*break*/, 2];
1125
+ case 5 /* Event.Discover */: return [3 /*break*/, 3];
1126
+ case 6 /* Event.Mutation */: return [3 /*break*/, 3];
1095
1127
  }
1096
1128
  return [3 /*break*/, 10];
1097
1129
  case 1:
@@ -1104,7 +1136,7 @@ function encode$4 (type, timer, ts) {
1104
1136
  case 2:
1105
1137
  for (_i = 0, _b = state$1; _i < _b.length; _i++) {
1106
1138
  r = _b[_i];
1107
- tokens = [r.time, 7 /* Region */];
1139
+ tokens = [r.time, 7 /* Event.Region */];
1108
1140
  tokens.push(r.data.id);
1109
1141
  tokens.push(r.data.interaction);
1110
1142
  tokens.push(r.data.visibility);
@@ -1115,7 +1147,7 @@ function encode$4 (type, timer, ts) {
1115
1147
  return [3 /*break*/, 10];
1116
1148
  case 3:
1117
1149
  // Check if we are operating within the context of the current page
1118
- if (state$8(timer) === 2 /* Stop */) {
1150
+ if (state$9(timer) === 2 /* Task.Stop */) {
1119
1151
  return [3 /*break*/, 10];
1120
1152
  }
1121
1153
  values = updates$2();
@@ -1125,14 +1157,14 @@ function encode$4 (type, timer, ts) {
1125
1157
  case 4:
1126
1158
  if (!(_c < values_1.length)) return [3 /*break*/, 8];
1127
1159
  value = values_1[_c];
1128
- state = state$8(timer);
1129
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 6];
1160
+ state = state$9(timer);
1161
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 6];
1130
1162
  return [4 /*yield*/, suspend$1(timer)];
1131
1163
  case 5:
1132
1164
  state = _e.sent();
1133
1165
  _e.label = 6;
1134
1166
  case 6:
1135
- if (state === 2 /* Stop */) {
1167
+ if (state === 2 /* Task.Stop */) {
1136
1168
  return [3 /*break*/, 8];
1137
1169
  }
1138
1170
  data = value.data;
@@ -1155,9 +1187,9 @@ function encode$4 (type, timer, ts) {
1155
1187
  if (value.previous && active) {
1156
1188
  tokens.push(value.previous);
1157
1189
  }
1158
- tokens.push(suspend ? "*M" /* SuspendMutationTag */ : data[key]);
1190
+ tokens.push(suspend ? "*M" /* Constant.SuspendMutationTag */ : data[key]);
1159
1191
  if (box && box.length === 2) {
1160
- tokens.push("" + "#" /* Hash */ + str$1(box[0]) + "." + str$1(box[1]));
1192
+ tokens.push("".concat("#" /* Constant.Hash */).concat(str$1(box[0]), ".").concat(str$1(box[1])));
1161
1193
  }
1162
1194
  break;
1163
1195
  case "attributes":
@@ -1169,7 +1201,7 @@ function encode$4 (type, timer, ts) {
1169
1201
  break;
1170
1202
  case "value":
1171
1203
  check$4(value.metadata.fraud, value.id, data[key]);
1172
- tokens.push(scrub(data[key], data.tag, privacy, mangle));
1204
+ tokens.push(text$1(data[key], data.tag, privacy, mangle));
1173
1205
  break;
1174
1206
  }
1175
1207
  }
@@ -1179,7 +1211,7 @@ function encode$4 (type, timer, ts) {
1179
1211
  _c++;
1180
1212
  return [3 /*break*/, 4];
1181
1213
  case 8:
1182
- if (type === 6 /* Mutation */) {
1214
+ if (type === 6 /* Event.Mutation */) {
1183
1215
  activity(eventTime);
1184
1216
  }
1185
1217
  queue(tokenize(tokens), !config$1.lean);
@@ -1192,13 +1224,13 @@ function encode$4 (type, timer, ts) {
1192
1224
  }
1193
1225
  function shouldMangle(value) {
1194
1226
  var privacy = value.metadata.privacy;
1195
- return value.data.tag === "*T" /* TextTag */ && !(privacy === 0 /* None */ || privacy === 1 /* Sensitive */);
1227
+ return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
1196
1228
  }
1197
1229
  function size$1(value) {
1198
1230
  if (value.metadata.size !== null && value.metadata.size.length === 0) {
1199
1231
  var img = getNode(value.id);
1200
1232
  if (img) {
1201
- return [Math.floor(img.offsetWidth * 100 /* BoxPrecision */), Math.floor(img.offsetHeight * 100 /* BoxPrecision */)];
1233
+ return [Math.floor(img.offsetWidth * 100 /* Setting.BoxPrecision */), Math.floor(img.offsetHeight * 100 /* Setting.BoxPrecision */)];
1202
1234
  }
1203
1235
  }
1204
1236
  return value.metadata.size;
@@ -1207,15 +1239,15 @@ function str$1(input) {
1207
1239
  return input.toString(36);
1208
1240
  }
1209
1241
  function attribute(key, value, privacy) {
1210
- return key + "=" + scrub(value, key, privacy);
1242
+ return "".concat(key, "=").concat(text$1(value, key, privacy));
1211
1243
  }
1212
1244
 
1213
1245
  var data$c;
1214
- function reset$i() {
1246
+ function reset$j() {
1215
1247
  data$c = null;
1216
1248
  }
1217
- function start$v() {
1218
- reset$i();
1249
+ function start$w() {
1250
+ reset$j();
1219
1251
  compute$7();
1220
1252
  }
1221
1253
  function compute$7() {
@@ -1238,10 +1270,33 @@ function compute$7() {
1238
1270
  // Check that width or height has changed from before, and also that width & height are not null values
1239
1271
  if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
1240
1272
  data$c = { width: width, height: height };
1241
- encode$4(8 /* Document */);
1273
+ encode$4(8 /* Event.Document */);
1242
1274
  }
1243
1275
  }
1244
1276
  function end() {
1277
+ reset$j();
1278
+ }
1279
+
1280
+ var state$8 = [];
1281
+ function start$v() {
1282
+ reset$i();
1283
+ }
1284
+ function observe$c(root) {
1285
+ bind(root, "change", recompute$8, true);
1286
+ }
1287
+ function recompute$8(evt) {
1288
+ var element = target(evt);
1289
+ if (element) {
1290
+ var value = element.value;
1291
+ var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
1292
+ state$8.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
1293
+ schedule$1(encode$3.bind(this, 42 /* Event.Change */));
1294
+ }
1295
+ }
1296
+ function reset$i() {
1297
+ state$8 = [];
1298
+ }
1299
+ function stop$t() {
1245
1300
  reset$i();
1246
1301
  }
1247
1302
 
@@ -1267,7 +1322,7 @@ function start$u() {
1267
1322
  reset$h();
1268
1323
  }
1269
1324
  function observe$b(root) {
1270
- bind(root, "click", handler$3.bind(this, 9 /* Click */, root), true);
1325
+ bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
1271
1326
  }
1272
1327
  function handler$3(event, root, evt) {
1273
1328
  var frame = iframe(root);
@@ -1293,13 +1348,14 @@ function handler$3(event, root, evt) {
1293
1348
  x = Math.round(l.x + (l.w / 2));
1294
1349
  y = Math.round(l.y + (l.h / 2));
1295
1350
  }
1296
- var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* ClickPrecision */), 0) : 0;
1297
- var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* ClickPrecision */), 0) : 0;
1351
+ var eX = l ? Math.max(Math.floor(((x - l.x) / l.w) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1352
+ var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
1298
1353
  // Check for null values before processing this event
1299
1354
  if (x !== null && y !== null) {
1300
1355
  state$7.push({
1301
- time: time(),
1302
- event: event, data: {
1356
+ time: time(evt),
1357
+ event: event,
1358
+ data: {
1303
1359
  target: t,
1304
1360
  x: x,
1305
1361
  y: y,
@@ -1311,7 +1367,7 @@ function handler$3(event, root, evt) {
1311
1367
  text: text(t),
1312
1368
  link: a ? a.href : null,
1313
1369
  hash: null,
1314
- trust: evt.isTrusted ? 1 /* True */ : 0 /* False */
1370
+ trust: evt.isTrusted ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */
1315
1371
  }
1316
1372
  });
1317
1373
  schedule$1(encode$3.bind(this, event));
@@ -1326,7 +1382,7 @@ function text(element) {
1326
1382
  // Trim any spaces at the beginning or at the end of string
1327
1383
  // Also, replace multiple occurrence of space characters with a single white space
1328
1384
  // Finally, send only first few characters as specified by the Setting
1329
- output = t.trim().replace(/\s+/g, " " /* Space */).substr(0, 25 /* ClickText */);
1385
+ output = t.trim().replace(/\s+/g, " " /* Constant.Space */).substr(0, 25 /* Setting.ClickText */);
1330
1386
  }
1331
1387
  }
1332
1388
  return output;
@@ -1335,10 +1391,10 @@ function reaction(element) {
1335
1391
  if (element.nodeType === Node.ELEMENT_NODE) {
1336
1392
  var tag = element.tagName.toLowerCase();
1337
1393
  if (UserInputTags.indexOf(tag) >= 0) {
1338
- return 0 /* False */;
1394
+ return 0 /* BooleanFlag.False */;
1339
1395
  }
1340
1396
  }
1341
- return 1 /* True */;
1397
+ return 1 /* BooleanFlag.True */;
1342
1398
  }
1343
1399
  function layout$1(element) {
1344
1400
  var box = null;
@@ -1362,14 +1418,14 @@ function layout$1(element) {
1362
1418
  return box;
1363
1419
  }
1364
1420
  function context(a) {
1365
- if (a && a.hasAttribute("target" /* Target */)) {
1366
- switch (a.getAttribute("target" /* Target */)) {
1367
- case "_blank" /* Blank */: return 1 /* Blank */;
1368
- case "_parent" /* Parent */: return 2 /* Parent */;
1369
- case "_top" /* Top */: return 3 /* Top */;
1421
+ if (a && a.hasAttribute("target" /* Constant.Target */)) {
1422
+ switch (a.getAttribute("target" /* Constant.Target */)) {
1423
+ case "_blank" /* Constant.Blank */: return 1 /* BrowsingContext.Blank */;
1424
+ case "_parent" /* Constant.Parent */: return 2 /* BrowsingContext.Parent */;
1425
+ case "_top" /* Constant.Top */: return 3 /* BrowsingContext.Top */;
1370
1426
  }
1371
1427
  }
1372
- return 0 /* Self */;
1428
+ return 0 /* BrowsingContext.Self */;
1373
1429
  }
1374
1430
  function reset$h() {
1375
1431
  state$7 = [];
@@ -1383,13 +1439,13 @@ function start$t() {
1383
1439
  reset$g();
1384
1440
  }
1385
1441
  function observe$a(root) {
1386
- bind(root, "cut", recompute$7.bind(this, 0 /* Cut */), true);
1387
- bind(root, "copy", recompute$7.bind(this, 1 /* Copy */), true);
1388
- bind(root, "paste", recompute$7.bind(this, 2 /* Paste */), true);
1442
+ bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
1443
+ bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
1444
+ bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
1389
1445
  }
1390
1446
  function recompute$7(action, evt) {
1391
- state$6.push({ time: time(), event: 38 /* Clipboard */, data: { target: target(evt), action: action } });
1392
- schedule$1(encode$3.bind(this, 38 /* Clipboard */));
1447
+ state$6.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
1448
+ schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
1393
1449
  }
1394
1450
  function reset$g() {
1395
1451
  state$6 = [];
@@ -1422,9 +1478,9 @@ function recompute$6(evt) {
1422
1478
  if (state$5.length > 0 && (state$5[state$5.length - 1].data.target === data.target)) {
1423
1479
  state$5.pop();
1424
1480
  }
1425
- state$5.push({ time: time(), event: 27 /* Input */, data: data });
1481
+ state$5.push({ time: time(evt), event: 27 /* Event.Input */, data: data });
1426
1482
  clearTimeout(timeout$5);
1427
- timeout$5 = setTimeout(process$6, 500 /* LookAhead */, 27 /* Input */);
1483
+ timeout$5 = setTimeout(process$6, 1000 /* Setting.InputLookAhead */, 27 /* Event.Input */);
1428
1484
  }
1429
1485
  }
1430
1486
  function process$6(event) {
@@ -1444,15 +1500,15 @@ function start$r() {
1444
1500
  reset$e();
1445
1501
  }
1446
1502
  function observe$8(root) {
1447
- bind(root, "mousedown", mouse.bind(this, 13 /* MouseDown */, root), true);
1448
- bind(root, "mouseup", mouse.bind(this, 14 /* MouseUp */, root), true);
1449
- bind(root, "mousemove", mouse.bind(this, 12 /* MouseMove */, root), true);
1450
- bind(root, "wheel", mouse.bind(this, 15 /* MouseWheel */, root), true);
1451
- bind(root, "dblclick", mouse.bind(this, 16 /* DoubleClick */, root), true);
1452
- bind(root, "touchstart", touch.bind(this, 17 /* TouchStart */, root), true);
1453
- bind(root, "touchend", touch.bind(this, 18 /* TouchEnd */, root), true);
1454
- bind(root, "touchmove", touch.bind(this, 19 /* TouchMove */, root), true);
1455
- bind(root, "touchcancel", touch.bind(this, 20 /* TouchCancel */, root), true);
1503
+ bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
1504
+ bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
1505
+ bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
1506
+ bind(root, "wheel", mouse.bind(this, 15 /* Event.MouseWheel */, root), true);
1507
+ bind(root, "dblclick", mouse.bind(this, 16 /* Event.DoubleClick */, root), true);
1508
+ bind(root, "touchstart", touch.bind(this, 17 /* Event.TouchStart */, root), true);
1509
+ bind(root, "touchend", touch.bind(this, 18 /* Event.TouchEnd */, root), true);
1510
+ bind(root, "touchmove", touch.bind(this, 19 /* Event.TouchMove */, root), true);
1511
+ bind(root, "touchcancel", touch.bind(this, 20 /* Event.TouchCancel */, root), true);
1456
1512
  }
1457
1513
  function mouse(event, root, evt) {
1458
1514
  var frame = iframe(root);
@@ -1467,14 +1523,14 @@ function mouse(event, root, evt) {
1467
1523
  }
1468
1524
  // Check for null values before processing this event
1469
1525
  if (x !== null && y !== null) {
1470
- handler$2({ time: time(), event: event, data: { target: target(evt), x: x, y: y } });
1526
+ handler$2({ time: time(evt), event: event, data: { target: target(evt), x: x, y: y } });
1471
1527
  }
1472
1528
  }
1473
1529
  function touch(event, root, evt) {
1474
1530
  var frame = iframe(root);
1475
1531
  var d = frame ? frame.contentDocument.documentElement : document.documentElement;
1476
1532
  var touches = evt.changedTouches;
1477
- var t = time();
1533
+ var t = time(evt);
1478
1534
  if (touches) {
1479
1535
  for (var i = 0; i < touches.length; i++) {
1480
1536
  var entry = touches[i];
@@ -1491,9 +1547,9 @@ function touch(event, root, evt) {
1491
1547
  }
1492
1548
  function handler$2(current) {
1493
1549
  switch (current.event) {
1494
- case 12 /* MouseMove */:
1495
- case 15 /* MouseWheel */:
1496
- case 19 /* TouchMove */:
1550
+ case 12 /* Event.MouseMove */:
1551
+ case 15 /* Event.MouseWheel */:
1552
+ case 19 /* Event.TouchMove */:
1497
1553
  var length_1 = state$4.length;
1498
1554
  var last = length_1 > 1 ? state$4[length_1 - 2] : null;
1499
1555
  if (last && similar$1(last, current)) {
@@ -1501,7 +1557,7 @@ function handler$2(current) {
1501
1557
  }
1502
1558
  state$4.push(current);
1503
1559
  clearTimeout(timeout$4);
1504
- timeout$4 = setTimeout(process$5, 500 /* LookAhead */, current.event);
1560
+ timeout$4 = setTimeout(process$5, 500 /* Setting.LookAhead */, current.event);
1505
1561
  break;
1506
1562
  default:
1507
1563
  state$4.push(current);
@@ -1521,7 +1577,7 @@ function similar$1(last, current) {
1521
1577
  var distance = Math.sqrt(dx * dx + dy * dy);
1522
1578
  var gap = current.time - last.time;
1523
1579
  var match = current.data.target === last.data.target;
1524
- return current.event === last.event && match && distance < 20 /* Distance */ && gap < 25 /* Interval */;
1580
+ return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
1525
1581
  }
1526
1582
  function stop$p() {
1527
1583
  clearTimeout(timeout$4);
@@ -1544,7 +1600,7 @@ function recompute$5() {
1544
1600
  width: de && "clientWidth" in de ? Math.min(de.clientWidth, window.innerWidth) : window.innerWidth,
1545
1601
  height: de && "clientHeight" in de ? Math.min(de.clientHeight, window.innerHeight) : window.innerHeight,
1546
1602
  };
1547
- encode$3(11 /* Resize */);
1603
+ encode$3(11 /* Event.Resize */);
1548
1604
  }
1549
1605
  function reset$d() {
1550
1606
  data$b = null;
@@ -1580,7 +1636,7 @@ function recompute$4(event) {
1580
1636
  // And, if for some reason that is not available, fall back to looking up scrollTop on document.documentElement.
1581
1637
  var x = element === de && "pageXOffset" in w ? Math.round(w.pageXOffset) : Math.round(element.scrollLeft);
1582
1638
  var y = element === de && "pageYOffset" in w ? Math.round(w.pageYOffset) : Math.round(element.scrollTop);
1583
- var current = { time: time(), event: 10 /* Scroll */, data: { target: element, x: x, y: y } };
1639
+ var current = { time: time(event), event: 10 /* Event.Scroll */, data: { target: element, x: x, y: y } };
1584
1640
  // We don't send any scroll events if this is the first event and the current position is top (0,0)
1585
1641
  if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
1586
1642
  return;
@@ -1592,7 +1648,7 @@ function recompute$4(event) {
1592
1648
  }
1593
1649
  state$3.push(current);
1594
1650
  clearTimeout(timeout$3);
1595
- timeout$3 = setTimeout(process$4, 500 /* LookAhead */, 10 /* Scroll */);
1651
+ timeout$3 = setTimeout(process$4, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
1596
1652
  }
1597
1653
  function reset$c() {
1598
1654
  state$3 = [];
@@ -1603,7 +1659,7 @@ function process$4(event) {
1603
1659
  function similar(last, current) {
1604
1660
  var dx = last.data.x - current.data.x;
1605
1661
  var dy = last.data.y - current.data.y;
1606
- return (dx * dx + dy * dy < 20 /* Distance */ * 20 /* Distance */) && (current.time - last.time < 25 /* Interval */);
1662
+ return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
1607
1663
  }
1608
1664
  function stop$n() {
1609
1665
  clearTimeout(timeout$3);
@@ -1638,7 +1694,7 @@ function recompute$3(root) {
1638
1694
  var startNode = data$a.start ? data$a.start : null;
1639
1695
  if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
1640
1696
  clearTimeout(timeout$2);
1641
- process$3(21 /* Selection */);
1697
+ process$3(21 /* Event.Selection */);
1642
1698
  }
1643
1699
  data$a = {
1644
1700
  start: current.anchorNode,
@@ -1648,7 +1704,7 @@ function recompute$3(root) {
1648
1704
  };
1649
1705
  previous = current;
1650
1706
  clearTimeout(timeout$2);
1651
- timeout$2 = setTimeout(process$3, 500 /* LookAhead */, 21 /* Selection */);
1707
+ timeout$2 = setTimeout(process$3, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
1652
1708
  }
1653
1709
  function process$3(event) {
1654
1710
  schedule$1(encode$3.bind(this, event));
@@ -1670,8 +1726,8 @@ function observe$5(root) {
1670
1726
  bind(root, "submit", recompute$2, true);
1671
1727
  }
1672
1728
  function recompute$2(evt) {
1673
- state$2.push({ time: time(), event: 39 /* Submit */, data: { target: target(evt) } });
1674
- schedule$1(encode$3.bind(this, 39 /* Submit */));
1729
+ state$2.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
1730
+ schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
1675
1731
  }
1676
1732
  function reset$a() {
1677
1733
  state$2 = [];
@@ -1686,7 +1742,7 @@ function start$m() {
1686
1742
  }
1687
1743
  function recompute$1(evt) {
1688
1744
  data$9 = { name: evt.type };
1689
- encode$3(26 /* Unload */);
1745
+ encode$3(26 /* Event.Unload */, time(evt));
1690
1746
  stop();
1691
1747
  }
1692
1748
  function reset$9() {
@@ -1701,9 +1757,10 @@ function start$l() {
1701
1757
  bind(document, "visibilitychange", recompute);
1702
1758
  recompute();
1703
1759
  }
1704
- function recompute() {
1760
+ function recompute(evt) {
1761
+ if (evt === void 0) { evt = null; }
1705
1762
  data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
1706
- encode$3(28 /* Visibility */);
1763
+ encode$3(28 /* Event.Visibility */, time(evt));
1707
1764
  }
1708
1765
  function reset$8() {
1709
1766
  data$8 = null;
@@ -1722,6 +1779,7 @@ function start$k() {
1722
1779
  start$l();
1723
1780
  start$p();
1724
1781
  start$o();
1782
+ start$v();
1725
1783
  start$n();
1726
1784
  start$m();
1727
1785
  }
@@ -1735,6 +1793,7 @@ function stop$i() {
1735
1793
  stop$j();
1736
1794
  stop$n();
1737
1795
  stop$m();
1796
+ stop$t();
1738
1797
  stop$l();
1739
1798
  stop$k();
1740
1799
  }
@@ -1748,6 +1807,7 @@ function observe$4(root) {
1748
1807
  observe$8(root);
1749
1808
  observe$9(root);
1750
1809
  observe$6(root);
1810
+ observe$c(root);
1751
1811
  observe$5(root);
1752
1812
  }
1753
1813
  }
@@ -1765,51 +1825,51 @@ function ld(json) {
1765
1825
  for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) {
1766
1826
  var key = _a[_i];
1767
1827
  var value = json[key];
1768
- if (key === "@type" /* Type */ && typeof value === "string") {
1828
+ if (key === "@type" /* JsonLD.Type */ && typeof value === "string") {
1769
1829
  value = value.toLowerCase();
1770
1830
  /* Normalizations */
1771
- value = value.indexOf("article" /* Article */) >= 0 || value.indexOf("posting" /* Posting */) >= 0 ? "article" /* Article */ : value;
1831
+ value = value.indexOf("article" /* JsonLD.Article */) >= 0 || value.indexOf("posting" /* JsonLD.Posting */) >= 0 ? "article" /* JsonLD.Article */ : value;
1772
1832
  switch (value) {
1773
- case "article" /* Article */:
1774
- case "recipe" /* Recipe */:
1775
- log(5 /* SchemaType */, json[key]);
1776
- log(8 /* AuthorName */, json["creator" /* Creator */]);
1777
- log(18 /* Headline */, json["headline" /* Headline */]);
1833
+ case "article" /* JsonLD.Article */:
1834
+ case "recipe" /* JsonLD.Recipe */:
1835
+ log(5 /* Dimension.SchemaType */, json[key]);
1836
+ log(8 /* Dimension.AuthorName */, json["creator" /* JsonLD.Creator */]);
1837
+ log(18 /* Dimension.Headline */, json["headline" /* JsonLD.Headline */]);
1778
1838
  break;
1779
- case "product" /* Product */:
1780
- log(5 /* SchemaType */, json[key]);
1781
- log(10 /* ProductName */, json["name" /* Name */]);
1782
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1783
- if (json["brand" /* Brand */]) {
1784
- log(6 /* ProductBrand */, json["brand" /* Brand */]["name" /* Name */]);
1839
+ case "product" /* JsonLD.Product */:
1840
+ log(5 /* Dimension.SchemaType */, json[key]);
1841
+ log(10 /* Dimension.ProductName */, json["name" /* JsonLD.Name */]);
1842
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1843
+ if (json["brand" /* JsonLD.Brand */]) {
1844
+ log(6 /* Dimension.ProductBrand */, json["brand" /* JsonLD.Brand */]["name" /* JsonLD.Name */]);
1785
1845
  }
1786
1846
  break;
1787
- case "aggregaterating" /* AggregateRating */:
1788
- if (json["ratingValue" /* RatingValue */]) {
1789
- max(11 /* RatingValue */, num$1(json["ratingValue" /* RatingValue */], 100 /* RatingScale */));
1790
- max(18 /* BestRating */, num$1(json["bestRating" /* BestRating */]));
1791
- max(19 /* WorstRating */, num$1(json["worstRating" /* WorstRating */]));
1847
+ case "aggregaterating" /* JsonLD.AggregateRating */:
1848
+ if (json["ratingValue" /* JsonLD.RatingValue */]) {
1849
+ max(11 /* Metric.RatingValue */, num$1(json["ratingValue" /* JsonLD.RatingValue */], 100 /* Setting.RatingScale */));
1850
+ max(18 /* Metric.BestRating */, num$1(json["bestRating" /* JsonLD.BestRating */]));
1851
+ max(19 /* Metric.WorstRating */, num$1(json["worstRating" /* JsonLD.WorstRating */]));
1792
1852
  }
1793
- max(12 /* RatingCount */, num$1(json["ratingCount" /* RatingCount */]));
1794
- max(17 /* ReviewCount */, num$1(json["reviewCount" /* ReviewCount */]));
1853
+ max(12 /* Metric.RatingCount */, num$1(json["ratingCount" /* JsonLD.RatingCount */]));
1854
+ max(17 /* Metric.ReviewCount */, num$1(json["reviewCount" /* JsonLD.ReviewCount */]));
1795
1855
  break;
1796
- case "person" /* Author */:
1797
- log(8 /* AuthorName */, json["name" /* Name */]);
1856
+ case "person" /* JsonLD.Author */:
1857
+ log(8 /* Dimension.AuthorName */, json["name" /* JsonLD.Name */]);
1798
1858
  break;
1799
- case "offer" /* Offer */:
1800
- log(7 /* ProductAvailability */, json["availability" /* Availability */]);
1801
- log(14 /* ProductCondition */, json["itemCondition" /* ItemCondition */]);
1802
- log(13 /* ProductCurrency */, json["priceCurrency" /* PriceCurrency */]);
1803
- log(12 /* ProductSku */, json["sku" /* Sku */]);
1804
- max(13 /* ProductPrice */, num$1(json["price" /* Price */]));
1859
+ case "offer" /* JsonLD.Offer */:
1860
+ log(7 /* Dimension.ProductAvailability */, json["availability" /* JsonLD.Availability */]);
1861
+ log(14 /* Dimension.ProductCondition */, json["itemCondition" /* JsonLD.ItemCondition */]);
1862
+ log(13 /* Dimension.ProductCurrency */, json["priceCurrency" /* JsonLD.PriceCurrency */]);
1863
+ log(12 /* Dimension.ProductSku */, json["sku" /* JsonLD.Sku */]);
1864
+ max(13 /* Metric.ProductPrice */, num$1(json["price" /* JsonLD.Price */]));
1805
1865
  break;
1806
- case "brand" /* Brand */:
1807
- log(6 /* ProductBrand */, json["name" /* Name */]);
1866
+ case "brand" /* JsonLD.Brand */:
1867
+ log(6 /* Dimension.ProductBrand */, json["name" /* JsonLD.Name */]);
1808
1868
  break;
1809
1869
  }
1810
1870
  }
1811
1871
  // Continue parsing nested objects
1812
- if (value !== null && typeof (value) === "object" /* Object */) {
1872
+ if (value !== null && typeof (value) === "object" /* Constant.Object */) {
1813
1873
  ld(value);
1814
1874
  }
1815
1875
  }
@@ -1818,8 +1878,8 @@ function num$1(input, scale) {
1818
1878
  if (scale === void 0) { scale = 1; }
1819
1879
  if (input !== null) {
1820
1880
  switch (typeof input) {
1821
- case "number" /* Number */: return Math.round(input * scale);
1822
- case "string" /* String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Empty */)) * scale);
1881
+ case "number" /* Constant.Number */: return Math.round(input * scale);
1882
+ case "string" /* Constant.String */: return Math.round(parseFloat(input.replace(digitsRegex, "" /* Constant.Empty */)) * scale);
1823
1883
  }
1824
1884
  }
1825
1885
  return null;
@@ -1828,13 +1888,14 @@ function num$1(input, scale) {
1828
1888
  var IGNORE_ATTRIBUTES = ["title", "alt", "onload", "onfocus", "onerror", "data-drupal-form-submit-last"];
1829
1889
  var newlineRegex = /[\r\n]+/g;
1830
1890
  function processNode (node, source) {
1891
+ var _a;
1831
1892
  var child = null;
1832
1893
  // Do not track this change if we are attempting to remove a node before discovering it
1833
- if (source === 2 /* ChildListRemove */ && has(node) === false) {
1894
+ if (source === 2 /* Source.ChildListRemove */ && has(node) === false) {
1834
1895
  return child;
1835
1896
  }
1836
1897
  // Special handling for text nodes that belong to style nodes
1837
- if (source !== 0 /* Discover */ &&
1898
+ if (source !== 0 /* Source.Discover */ &&
1838
1899
  node.nodeType === Node.TEXT_NODE &&
1839
1900
  node.parentElement &&
1840
1901
  node.parentElement.tagName === "STYLE") {
@@ -1847,10 +1908,10 @@ function processNode (node, source) {
1847
1908
  switch (node.nodeType) {
1848
1909
  case Node.DOCUMENT_TYPE_NODE:
1849
1910
  parent = insideFrame && node.parentNode ? iframe(node.parentNode) : parent;
1850
- var docTypePrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1911
+ var docTypePrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1851
1912
  var doctype = node;
1852
1913
  var docAttributes = { name: doctype.name, publicId: doctype.publicId, systemId: doctype.systemId };
1853
- var docData = { tag: docTypePrefix + "*D" /* DocumentTag */, attributes: docAttributes };
1914
+ var docData = { tag: docTypePrefix + "*D" /* Constant.DocumentTag */, attributes: docAttributes };
1854
1915
  dom[call](node, parent, docData, source);
1855
1916
  break;
1856
1917
  case Node.DOCUMENT_NODE:
@@ -1865,26 +1926,26 @@ function processNode (node, source) {
1865
1926
  if (shadowRoot.host) {
1866
1927
  parse$1(shadowRoot);
1867
1928
  var type = typeof (shadowRoot.constructor);
1868
- if (type === "function" /* Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* NativeCode */) >= 0) {
1929
+ if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
1869
1930
  observe$3(shadowRoot);
1870
1931
  // See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
1871
1932
  // At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
1872
1933
  // In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
1873
1934
  // cause any unintended side effect to the page. We will re-evaluate after we gather more real world data on this.
1874
- var style = "" /* Empty */;
1935
+ var style = "" /* Constant.Empty */;
1875
1936
  var adoptedStyleSheets = "adoptedStyleSheets" in shadowRoot ? shadowRoot["adoptedStyleSheets"] : [];
1876
1937
  for (var _i = 0, adoptedStyleSheets_1 = adoptedStyleSheets; _i < adoptedStyleSheets_1.length; _i++) {
1877
1938
  var styleSheet = adoptedStyleSheets_1[_i];
1878
1939
  style += getCssRules(styleSheet);
1879
1940
  }
1880
- var fragementData = { tag: "*S" /* ShadowDomTag */, attributes: { style: style } };
1941
+ var fragementData = { tag: "*S" /* Constant.ShadowDomTag */, attributes: { style: style } };
1881
1942
  dom[call](node, shadowRoot.host, fragementData, source);
1882
1943
  }
1883
1944
  else {
1884
1945
  // If the browser doesn't support shadow DOM natively, we detect that, and send appropriate tag back.
1885
1946
  // The differentiation is important because we don't have to observe pollyfill shadow DOM nodes,
1886
1947
  // the same way we observe real shadow DOM nodes (encapsulation provided by the browser).
1887
- dom[call](node, shadowRoot.host, { tag: "*P" /* PolyfillShadowDomTag */, attributes: {} }, source);
1948
+ dom[call](node, shadowRoot.host, { tag: "*P" /* Constant.PolyfillShadowDomTag */, attributes: {} }, source);
1888
1949
  }
1889
1950
  }
1890
1951
  break;
@@ -1897,7 +1958,7 @@ function processNode (node, source) {
1897
1958
  // The only exception is when we receive a mutation to remove the text node, in that case
1898
1959
  // parent will be null, but we can still process the node by checking it's an update call.
1899
1960
  if (call === "update" || (parent && has(parent) && parent.tagName !== "STYLE")) {
1900
- var textData = { tag: "*T" /* TextTag */, value: node.nodeValue };
1961
+ var textData = { tag: "*T" /* Constant.TextTag */, value: node.nodeValue };
1901
1962
  dom[call](node, parent, textData, source);
1902
1963
  }
1903
1964
  break;
@@ -1909,52 +1970,61 @@ function processNode (node, source) {
1909
1970
  // For correctness, we first look at parentElement and if it not present then fall back to using parentNode
1910
1971
  parent = node.parentElement ? node.parentElement : (node.parentNode ? node.parentNode : null);
1911
1972
  // If we encounter a node that is part of SVG namespace, prefix the tag with SVG_PREFIX
1912
- if (element.namespaceURI === "http://www.w3.org/2000/svg" /* SvgNamespace */) {
1913
- tag = "svg:" /* SvgPrefix */ + tag;
1973
+ if (element.namespaceURI === "http://www.w3.org/2000/svg" /* Constant.SvgNamespace */) {
1974
+ tag = "svg:" /* Constant.SvgPrefix */ + tag;
1914
1975
  }
1915
1976
  switch (tag) {
1916
1977
  case "HTML":
1917
1978
  parent = insideFrame && parent ? iframe(parent) : null;
1918
- var htmlPrefix = insideFrame ? "iframe:" /* IFramePrefix */ : "" /* Empty */;
1979
+ var htmlPrefix = insideFrame ? "iframe:" /* Constant.IFramePrefix */ : "" /* Constant.Empty */;
1919
1980
  var htmlData = { tag: htmlPrefix + tag, attributes: attributes };
1920
1981
  dom[call](node, parent, htmlData, source);
1921
1982
  break;
1922
1983
  case "SCRIPT":
1923
- if ("type" /* Type */ in attributes && attributes["type" /* Type */] === "application/ld+json" /* JsonLD */) {
1984
+ if ("type" /* Constant.Type */ in attributes && attributes["type" /* Constant.Type */] === "application/ld+json" /* Constant.JsonLD */) {
1924
1985
  try {
1925
- ld(JSON.parse(element.text.replace(newlineRegex, "" /* Empty */)));
1986
+ ld(JSON.parse(element.text.replace(newlineRegex, "" /* Constant.Empty */)));
1926
1987
  }
1927
- catch ( /* do nothing */_a) { /* do nothing */ }
1988
+ catch ( /* do nothing */_b) { /* do nothing */ }
1928
1989
  }
1929
1990
  break;
1930
1991
  case "NOSCRIPT":
1931
1992
  break;
1932
1993
  case "META":
1933
- var key = ("property" /* Property */ in attributes ?
1934
- "property" /* Property */ :
1935
- ("name" /* Name */ in attributes ? "name" /* Name */ : null));
1936
- if (key && "content" /* Content */ in attributes) {
1937
- var content = attributes["content" /* Content */];
1994
+ var key = ("property" /* Constant.Property */ in attributes ?
1995
+ "property" /* Constant.Property */ :
1996
+ ("name" /* Constant.Name */ in attributes ? "name" /* Constant.Name */ : null));
1997
+ if (key && "content" /* Constant.Content */ in attributes) {
1998
+ var content = attributes["content" /* Constant.Content */];
1938
1999
  switch (attributes[key]) {
1939
- case "og:title" /* ogTitle */:
1940
- log(20 /* MetaTitle */, content);
2000
+ case "og:title" /* Constant.ogTitle */:
2001
+ log(20 /* Dimension.MetaTitle */, content);
1941
2002
  break;
1942
- case "og:type" /* ogType */:
1943
- log(19 /* MetaType */, content);
2003
+ case "og:type" /* Constant.ogType */:
2004
+ log(19 /* Dimension.MetaType */, content);
1944
2005
  break;
1945
- case "generator" /* Generator */:
1946
- log(21 /* Generator */, content);
2006
+ case "generator" /* Constant.Generator */:
2007
+ log(21 /* Dimension.Generator */, content);
1947
2008
  break;
1948
2009
  }
1949
2010
  }
1950
2011
  break;
1951
2012
  case "HEAD":
1952
2013
  var head = { tag: tag, attributes: attributes };
1953
- if (location) {
1954
- head.attributes["*B" /* Base */] = location.protocol + "//" + location.hostname;
1955
- }
2014
+ var l = insideFrame && ((_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.location) ? node.ownerDocument.location : location;
2015
+ head.attributes["*B" /* Constant.Base */] = l.protocol + "//" + l.hostname + l.pathname;
1956
2016
  dom[call](node, parent, head, source);
1957
2017
  break;
2018
+ case "BASE":
2019
+ // Override the auto detected base path to explicit value specified in this tag
2020
+ var baseHead = get(node.parentElement);
2021
+ if (baseHead) {
2022
+ // We create "a" element so we can generate protocol and hostname for relative paths like "/path/"
2023
+ var a = document.createElement("a");
2024
+ a.href = attributes["href"];
2025
+ baseHead.data.attributes["*B" /* Constant.Base */] = a.protocol + "//" + a.hostname + a.pathname;
2026
+ }
2027
+ break;
1958
2028
  case "STYLE":
1959
2029
  var styleData = { tag: tag, attributes: attributes, value: getStyleValue(element) };
1960
2030
  dom[call](node, parent, styleData, source);
@@ -1964,7 +2034,7 @@ function processNode (node, source) {
1964
2034
  var frameData = { tag: tag, attributes: attributes };
1965
2035
  if (sameorigin(iframe$1)) {
1966
2036
  monitor(iframe$1);
1967
- frameData.attributes["*O" /* SameOrigin */] = "true";
2037
+ frameData.attributes["*O" /* Constant.SameOrigin */] = "true";
1968
2038
  if (iframe$1.contentDocument && iframe$1.contentWindow && iframe$1.contentDocument.readyState !== "loading") {
1969
2039
  child = iframe$1.contentDocument;
1970
2040
  }
@@ -1993,7 +2063,7 @@ function observe$3(root) {
1993
2063
  function getStyleValue(style) {
1994
2064
  // Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
1995
2065
  // Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
1996
- var value = style.textContent ? style.textContent.trim() : "" /* Empty */;
2066
+ var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
1997
2067
  var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
1998
2068
  if (value.length === 0 || dataset > 0) {
1999
2069
  value = getCssRules(style.sheet);
@@ -2001,14 +2071,14 @@ function getStyleValue(style) {
2001
2071
  return value;
2002
2072
  }
2003
2073
  function getCssRules(sheet) {
2004
- var value = "" /* Empty */;
2074
+ var value = "" /* Constant.Empty */;
2005
2075
  var cssRules = null;
2006
2076
  // Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
2007
2077
  try {
2008
2078
  cssRules = sheet ? sheet.cssRules : [];
2009
2079
  }
2010
2080
  catch (e) {
2011
- log$1(1 /* CssRules */, 1 /* Warning */, e ? e.name : null);
2081
+ log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
2012
2082
  if (e && e.name !== "SecurityError") {
2013
2083
  throw e;
2014
2084
  }
@@ -2032,8 +2102,8 @@ function getAttributes(element) {
2032
2102
  }
2033
2103
  }
2034
2104
  // For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
2035
- if (element.tagName === "INPUT" /* InputTag */ && !("value" /* Value */ in output) && element.value) {
2036
- output["value" /* Value */] = element.value;
2105
+ if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
2106
+ output["value" /* Constant.Value */] = element.value;
2037
2107
  }
2038
2108
  return output;
2039
2109
  }
@@ -2054,14 +2124,14 @@ function traverse (root, timer, source) {
2054
2124
  queue.push(next);
2055
2125
  next = next.nextSibling;
2056
2126
  }
2057
- state = state$8(timer);
2058
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 3];
2127
+ state = state$9(timer);
2128
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
2059
2129
  return [4 /*yield*/, suspend$1(timer)];
2060
2130
  case 2:
2061
2131
  state = _a.sent();
2062
2132
  _a.label = 3;
2063
2133
  case 3:
2064
- if (state === 2 /* Stop */) {
2134
+ if (state === 2 /* Task.Stop */) {
2065
2135
  return [3 /*break*/, 4];
2066
2136
  }
2067
2137
  subnode = processNode(node, source);
@@ -2138,7 +2208,7 @@ function observe$2(node) {
2138
2208
  // For this reason, we need to wire up mutations every time we see a new shadow dom.
2139
2209
  // Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
2140
2210
  try {
2141
- var m = api("MutationObserver" /* MutationObserver */);
2211
+ var m = api("MutationObserver" /* Constant.MutationObserver */);
2142
2212
  var observer = m in window ? new window[m](measure(handle$1)) : null;
2143
2213
  if (observer) {
2144
2214
  observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
@@ -2146,7 +2216,7 @@ function observe$2(node) {
2146
2216
  }
2147
2217
  }
2148
2218
  catch (e) {
2149
- log$1(2 /* MutationObserver */, 0 /* Info */, e ? e.name : null);
2219
+ log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
2150
2220
  }
2151
2221
  }
2152
2222
  function monitor(frame) {
@@ -2154,7 +2224,7 @@ function monitor(frame) {
2154
2224
  // This includes cases where iframe location is updated without explicitly updating src attribute
2155
2225
  // E.g. iframe.contentWindow.location.href = "new-location";
2156
2226
  if (has(frame) === false) {
2157
- bind(frame, "load" /* LoadEvent */, generate.bind(this, frame, "childList" /* ChildList */), true);
2227
+ bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
2158
2228
  }
2159
2229
  }
2160
2230
  function stop$h() {
@@ -2172,14 +2242,14 @@ function stop$h() {
2172
2242
  timeout$1 = null;
2173
2243
  }
2174
2244
  function active$2() {
2175
- activePeriod = time() + 3000 /* MutationActivePeriod */;
2245
+ activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
2176
2246
  }
2177
2247
  function handle$1(m) {
2178
2248
  // Queue up mutation records for asynchronous processing
2179
2249
  var now = time();
2180
- track$6(6 /* Mutation */, now);
2250
+ track$6(6 /* Event.Mutation */, now);
2181
2251
  mutations.push({ time: now, mutations: m });
2182
- schedule$1(process$2, 1 /* High */).then(function () {
2252
+ schedule$1(process$2, 1 /* Priority.High */).then(function () {
2183
2253
  setTimeout(compute$7);
2184
2254
  measure(compute$6)();
2185
2255
  });
@@ -2190,8 +2260,8 @@ function process$2() {
2190
2260
  return __generator(this, function (_b) {
2191
2261
  switch (_b.label) {
2192
2262
  case 0:
2193
- timer = { id: id(), cost: 3 /* LayoutCost */ };
2194
- start$w(timer);
2263
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
2264
+ start$x(timer);
2195
2265
  _b.label = 1;
2196
2266
  case 1:
2197
2267
  if (!(mutations.length > 0)) return [3 /*break*/, 8];
@@ -2201,14 +2271,14 @@ function process$2() {
2201
2271
  case 2:
2202
2272
  if (!(_i < _a.length)) return [3 /*break*/, 6];
2203
2273
  mutation = _a[_i];
2204
- state = state$8(timer);
2205
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2274
+ state = state$9(timer);
2275
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2206
2276
  return [4 /*yield*/, suspend$1(timer)];
2207
2277
  case 3:
2208
2278
  state = _b.sent();
2209
2279
  _b.label = 4;
2210
2280
  case 4:
2211
- if (state === 2 /* Stop */) {
2281
+ if (state === 2 /* Task.Stop */) {
2212
2282
  return [3 /*break*/, 6];
2213
2283
  }
2214
2284
  target = mutation.target;
@@ -2220,17 +2290,17 @@ function process$2() {
2220
2290
  parse$1(target);
2221
2291
  }
2222
2292
  switch (type) {
2223
- case "attributes" /* Attributes */:
2224
- processNode(target, 3 /* Attributes */);
2293
+ case "attributes" /* Constant.Attributes */:
2294
+ processNode(target, 3 /* Source.Attributes */);
2225
2295
  break;
2226
- case "characterData" /* CharacterData */:
2227
- processNode(target, 4 /* CharacterData */);
2296
+ case "characterData" /* Constant.CharacterData */:
2297
+ processNode(target, 4 /* Source.CharacterData */);
2228
2298
  break;
2229
- case "childList" /* ChildList */:
2230
- processNodeList(mutation.addedNodes, 1 /* ChildListAdd */, timer);
2231
- processNodeList(mutation.removedNodes, 2 /* ChildListRemove */, timer);
2299
+ case "childList" /* Constant.ChildList */:
2300
+ processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
2301
+ processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
2232
2302
  break;
2233
- case "suspend" /* Suspend */:
2303
+ case "suspend" /* Constant.Suspend */:
2234
2304
  value = get(target);
2235
2305
  if (value) {
2236
2306
  value.metadata.suspend = true;
@@ -2241,12 +2311,12 @@ function process$2() {
2241
2311
  case 5:
2242
2312
  _i++;
2243
2313
  return [3 /*break*/, 2];
2244
- case 6: return [4 /*yield*/, encode$4(6 /* Mutation */, timer, record.time)];
2314
+ case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
2245
2315
  case 7:
2246
2316
  _b.sent();
2247
2317
  return [3 /*break*/, 1];
2248
2318
  case 8:
2249
- stop$t(timer);
2319
+ stop$u(timer);
2250
2320
  return [2 /*return*/];
2251
2321
  }
2252
2322
  });
@@ -2255,11 +2325,11 @@ function process$2() {
2255
2325
  function track$5(m, timer) {
2256
2326
  var value = m.target ? get(m.target.parentNode) : null;
2257
2327
  // Check if the parent is already discovered and that the parent is not the document root
2258
- if (value && value.data.tag !== "HTML" /* HTML */) {
2328
+ if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
2259
2329
  var inactive = time() > activePeriod;
2260
2330
  var target = get(m.target);
2261
2331
  var element = target && target.selector ? target.selector.join() : m.target.nodeName;
2262
- var parent_1 = value.selector ? value.selector.join() : "" /* Empty */;
2332
+ var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
2263
2333
  // We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
2264
2334
  // repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
2265
2335
  // In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
@@ -2268,20 +2338,20 @@ function track$5(m, timer) {
2268
2338
  history$4[key] = key in history$4 ? history$4[key] : [0];
2269
2339
  var h = history$4[key];
2270
2340
  // Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
2271
- if (inactive === false && h[0] >= 10 /* MutationSuspendThreshold */) {
2272
- processNodeList(h[1], 2 /* ChildListRemove */, timer);
2341
+ if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
2342
+ processNodeList(h[1], 2 /* Source.ChildListRemove */, timer);
2273
2343
  }
2274
2344
  // Update the counter
2275
2345
  h[0] = inactive ? h[0] + 1 : 1;
2276
2346
  // Return updated mutation type based on if we have already hit the threshold or not
2277
- if (h[0] === 10 /* MutationSuspendThreshold */) {
2347
+ if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
2278
2348
  // Store a reference to removedNodes so we can process them later
2279
2349
  // when we resume mutations again on user interactions
2280
2350
  h[1] = m.removedNodes;
2281
- return "suspend" /* Suspend */;
2351
+ return "suspend" /* Constant.Suspend */;
2282
2352
  }
2283
- else if (h[0] > 10 /* MutationSuspendThreshold */) {
2284
- return "" /* Empty */;
2353
+ else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
2354
+ return "" /* Constant.Empty */;
2285
2355
  }
2286
2356
  }
2287
2357
  return m.type;
@@ -2304,18 +2374,18 @@ function processNodeList(list, source, timer) {
2304
2374
  _a.label = 1;
2305
2375
  case 1:
2306
2376
  if (!(i < length)) return [3 /*break*/, 6];
2307
- if (!(source === 1 /* ChildListAdd */)) return [3 /*break*/, 2];
2377
+ if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
2308
2378
  traverse(list[i], timer, source);
2309
2379
  return [3 /*break*/, 5];
2310
2380
  case 2:
2311
- state = state$8(timer);
2312
- if (!(state === 0 /* Wait */)) return [3 /*break*/, 4];
2381
+ state = state$9(timer);
2382
+ if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
2313
2383
  return [4 /*yield*/, suspend$1(timer)];
2314
2384
  case 3:
2315
2385
  state = _a.sent();
2316
2386
  _a.label = 4;
2317
2387
  case 4:
2318
- if (state === 2 /* Stop */) {
2388
+ if (state === 2 /* Task.Stop */) {
2319
2389
  return [3 /*break*/, 6];
2320
2390
  }
2321
2391
  processNode(list[i], source);
@@ -2340,7 +2410,7 @@ function schedule(node, fragment) {
2340
2410
  if (timeout$1) {
2341
2411
  clearTimeout(timeout$1);
2342
2412
  }
2343
- timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* LookAhead */);
2413
+ timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
2344
2414
  return node;
2345
2415
  }
2346
2416
  function trigger$1(fragment) {
@@ -2353,7 +2423,7 @@ function trigger$1(fragment) {
2353
2423
  if (shadowRoot && has(node)) {
2354
2424
  continue;
2355
2425
  }
2356
- generate(node, shadowRoot || fragment ? "childList" /* ChildList */ : "characterData" /* CharacterData */);
2426
+ generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
2357
2427
  }
2358
2428
  }
2359
2429
  queue$2 = [];
@@ -2381,8 +2451,9 @@ var override = [];
2381
2451
  var unmask = [];
2382
2452
  var updatedFragments = {};
2383
2453
  var maskText = [];
2384
- var maskInput = [];
2454
+ var maskExclude = [];
2385
2455
  var maskDisable = [];
2456
+ var maskTags = [];
2386
2457
  // The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
2387
2458
  var idMap = null; // Maps node => id.
2388
2459
  var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
@@ -2403,14 +2474,15 @@ function reset$7() {
2403
2474
  hashMap = {};
2404
2475
  override = [];
2405
2476
  unmask = [];
2406
- maskText = "address,password,contact" /* Text */.split("," /* Comma */);
2407
- maskInput = "password,secret,pass,social,ssn,name,code,dob,cell,mob,contact,hidden,account,cvv,ccv,email,tel,phone,address,addr,card,zip" /* Input */.split("," /* Comma */);
2408
- maskDisable = "radio,checkbox,range,button,reset,submit" /* Disable */.split("," /* Comma */);
2477
+ maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
2478
+ maskExclude = "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.split("," /* Constant.Comma */);
2479
+ maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
2480
+ maskTags = "INPUT,SELECT,TEXTAREA" /* Mask.Tags */.split("," /* Constant.Comma */);
2409
2481
  idMap = new WeakMap();
2410
2482
  iframeMap = new WeakMap();
2411
2483
  privacyMap = new WeakMap();
2412
2484
  fraudMap = new WeakMap();
2413
- reset$k();
2485
+ reset$l();
2414
2486
  }
2415
2487
  // We parse new root nodes for any regions or masked nodes in the beginning (document) and
2416
2488
  // later whenever there are new additions or modifications to DOM (mutations)
@@ -2421,19 +2493,19 @@ function parse$1(root, init) {
2421
2493
  try {
2422
2494
  // Parse unmask configuration into separate query selectors and override tokens as part of initialization
2423
2495
  if (init) {
2424
- config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2496
+ config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
2425
2497
  }
2426
2498
  // Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
2427
2499
  // We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
2428
2500
  if ("querySelectorAll" in root) {
2429
- config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "" + x[0]); }); }); // Regions
2430
- config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* TextImage */); }); }); // Masked Elements
2431
- config$1.fraud.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Check
2432
- unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* None */); }); }); // Unmasked Elements
2501
+ config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
2502
+ config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
2503
+ config$1.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
2504
+ unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
2433
2505
  }
2434
2506
  }
2435
2507
  catch (e) {
2436
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
2508
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
2437
2509
  }
2438
2510
  }
2439
2511
  function getId(node, autogen) {
@@ -2456,7 +2528,7 @@ function add(node, parent, data, source) {
2456
2528
  var regionId = exists(node) ? id : null;
2457
2529
  var fragmentId = null;
2458
2530
  var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
2459
- var privacyId = config$1.content ? 1 /* Sensitive */ : 3 /* TextImage */;
2531
+ var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
2460
2532
  if (parentId >= 0 && values[parentId]) {
2461
2533
  parentValue = values[parentId];
2462
2534
  parentValue.children.push(id);
@@ -2466,8 +2538,8 @@ function add(node, parent, data, source) {
2466
2538
  privacyId = parentValue.metadata.privacy;
2467
2539
  }
2468
2540
  // If there's an explicit region attribute set on the element, use it to mark a region on the page
2469
- if (data.attributes && "data-clarity-region" /* RegionData */ in data.attributes) {
2470
- observe$1(node, data.attributes["data-clarity-region" /* RegionData */]);
2541
+ if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
2542
+ observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
2471
2543
  regionId = id;
2472
2544
  }
2473
2545
  nodes[id] = node;
@@ -2545,7 +2617,7 @@ function update$1(node, parent, data, source) {
2545
2617
  }
2546
2618
  function sameorigin(node) {
2547
2619
  var output = false;
2548
- if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* IFrameTag */) {
2620
+ if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
2549
2621
  var frame = node;
2550
2622
  // To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
2551
2623
  // If the browser throws an exception, we assume it's cross-origin and move on.
@@ -2572,11 +2644,21 @@ function privacy(node, value, parent) {
2572
2644
  var attributes = data.attributes || {};
2573
2645
  var tag = data.tag.toUpperCase();
2574
2646
  switch (true) {
2575
- case "data-clarity-mask" /* MaskData */ in attributes:
2576
- metadata.privacy = 3 /* TextImage */;
2647
+ case maskTags.indexOf(tag) >= 0:
2648
+ var type = attributes["type" /* Constant.Type */];
2649
+ var meta_1 = "" /* Constant.Empty */;
2650
+ Object.keys(attributes).forEach(function (x) { return meta_1 += attributes[x].toLowerCase(); });
2651
+ var exclude = maskExclude.some(function (x) { return meta_1.indexOf(x) >= 0; });
2652
+ // Regardless of privacy mode, always mask off user input from input boxes or drop downs with two exceptions:
2653
+ // (1) The node is detected to be one of the excluded fields, in which case we drop everything
2654
+ // (2) The node's type is one of the allowed types (like checkboxes)
2655
+ metadata.privacy = tag === "INPUT" /* Constant.InputTag */ && maskDisable.indexOf(type) >= 0 ? current : (exclude ? 4 /* Privacy.Exclude */ : 2 /* Privacy.Text */);
2656
+ break;
2657
+ case "data-clarity-mask" /* Constant.MaskData */ in attributes:
2658
+ metadata.privacy = 3 /* Privacy.TextImage */;
2577
2659
  break;
2578
- case "data-clarity-unmask" /* UnmaskData */ in attributes:
2579
- metadata.privacy = 0 /* None */;
2660
+ case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
2661
+ metadata.privacy = 0 /* Privacy.None */;
2580
2662
  break;
2581
2663
  case privacyMap.has(node):
2582
2664
  // If this node was explicitly configured to contain sensitive content, honor that privacy setting
@@ -2584,38 +2666,24 @@ function privacy(node, value, parent) {
2584
2666
  break;
2585
2667
  case fraudMap.has(node):
2586
2668
  // If this node was explicitly configured to be evaluated for fraud, then also mask content
2587
- metadata.privacy = 2 /* Text */;
2669
+ metadata.privacy = 2 /* Privacy.Text */;
2588
2670
  break;
2589
- case tag === "*T" /* TextTag */:
2671
+ case tag === "*T" /* Constant.TextTag */:
2590
2672
  // If it's a text node belonging to a STYLE or TITLE tag or one of scrub exceptions, then capture content
2591
- var pTag = parent && parent.data ? parent.data.tag : "" /* Empty */;
2592
- var pSelector_1 = parent && parent.selector ? parent.selector[1 /* Default */] : "" /* Empty */;
2593
- var tags = ["STYLE" /* StyleTag */, "TITLE" /* TitleTag */, "svg:style" /* SvgStyle */];
2594
- metadata.privacy = tags.includes(pTag) || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* None */ : current;
2595
- break;
2596
- case tag === "INPUT" /* InputTag */ && current === 0 /* None */:
2597
- // If even default privacy setting is to not mask, we still scan through input fields for any sensitive information
2598
- var field_1 = "" /* Empty */;
2599
- Object.keys(attributes).forEach(function (x) { return field_1 += attributes[x].toLowerCase(); });
2600
- metadata.privacy = inspect(field_1, maskInput, metadata);
2673
+ var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
2674
+ var pSelector_1 = parent && parent.selector ? parent.selector[1 /* Selector.Default */] : "" /* Constant.Empty */;
2675
+ var tags = ["STYLE" /* Constant.StyleTag */, "TITLE" /* Constant.TitleTag */, "svg:style" /* Constant.SvgStyle */];
2676
+ metadata.privacy = tags.includes(pTag) || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
2601
2677
  break;
2602
- case tag === "INPUT" /* InputTag */ && current === 1 /* Sensitive */:
2603
- // Look through class names to aggressively mask content
2604
- metadata.privacy = inspect(attributes["class" /* Class */], maskText, metadata);
2605
- // If this node has an explicit type assigned to it, go through masking rules to determine right privacy setting
2606
- metadata.privacy = inspect(attributes["type" /* Type */], maskInput, metadata);
2607
- // If it's a button or an input option, make an exception to disable masking in sensitive mode
2608
- metadata.privacy = maskDisable.indexOf(attributes["type" /* Type */]) >= 0 ? 0 /* None */ : metadata.privacy;
2609
- break;
2610
- case current === 1 /* Sensitive */:
2678
+ case current === 1 /* Privacy.Sensitive */:
2611
2679
  // In a mode where we mask sensitive information by default, look through class names to aggressively mask content
2612
- metadata.privacy = inspect(attributes["class" /* Class */], maskText, metadata);
2680
+ metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
2613
2681
  break;
2614
2682
  }
2615
2683
  }
2616
2684
  function inspect(input, lookup, metadata) {
2617
2685
  if (input && lookup.some(function (x) { return input.indexOf(x) >= 0; })) {
2618
- return 2 /* Text */;
2686
+ return 2 /* Privacy.Text */;
2619
2687
  }
2620
2688
  return metadata.privacy;
2621
2689
  }
@@ -2653,7 +2721,7 @@ function updateSelector(value) {
2653
2721
  var d = value.data;
2654
2722
  var p = position(parent, value);
2655
2723
  var s = { id: value.id, tag: d.tag, prefix: prefix, position: p, attributes: d.attributes };
2656
- value.selector = [get$1(s, 0 /* Alpha */), get$1(s, 1 /* Beta */)];
2724
+ value.selector = [get$1(s, 0 /* Selector.Alpha */), get$1(s, 1 /* Selector.Beta */)];
2657
2725
  value.hash = value.selector.map(function (x) { return x ? hash(x) : null; });
2658
2726
  value.hash.forEach(function (h) { return hashMap[h] = value.id; });
2659
2727
  // Match fragment configuration against both alpha and beta hash
@@ -2661,6 +2729,11 @@ function updateSelector(value) {
2661
2729
  value.fragment = value.id;
2662
2730
  }
2663
2731
  }
2732
+ function hashText(hash) {
2733
+ var id = lookup(hash);
2734
+ var node = getNode(id);
2735
+ return node !== null && node.textContent !== null ? node.textContent.substr(0, 25 /* Setting.ClickText */) : '';
2736
+ }
2664
2737
  function getNode(id) {
2665
2738
  if (id in nodes) {
2666
2739
  return nodes[id];
@@ -2708,7 +2781,7 @@ function remove(id, source) {
2708
2781
  }
2709
2782
  function size(value) {
2710
2783
  // If this element is a image node, and is masked, then track box model for the current element
2711
- if (value.data.tag === "IMG" /* ImageTag */ && value.metadata.privacy === 3 /* TextImage */) {
2784
+ if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
2712
2785
  value.metadata.size = [];
2713
2786
  }
2714
2787
  }
@@ -2743,7 +2816,7 @@ function track$4(id, source, fragment, changed, parentChanged) {
2743
2816
  // Edge case: If an element is added later on, and pre-discovered element is moved as a child.
2744
2817
  // In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
2745
2818
  var uIndex = updateMap.indexOf(id);
2746
- if (uIndex >= 0 && source === 1 /* ChildListAdd */ && parentChanged) {
2819
+ if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
2747
2820
  updateMap.splice(uIndex, 1);
2748
2821
  updateMap.push(id);
2749
2822
  }
@@ -2789,15 +2862,15 @@ function exists(node) {
2789
2862
  }
2790
2863
  function track$3(id, event) {
2791
2864
  var node = getNode(id);
2792
- var data = id in regions ? regions[id] : { id: id, visibility: 0 /* Rendered */, interaction: 16 /* None */, name: regionMap.get(node) };
2865
+ var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
2793
2866
  // Determine the interaction state based on incoming event
2794
- var interaction = 16 /* None */;
2867
+ var interaction = 16 /* InteractionState.None */;
2795
2868
  switch (event) {
2796
- case 9 /* Click */:
2797
- interaction = 20 /* Clicked */;
2869
+ case 9 /* Event.Click */:
2870
+ interaction = 20 /* InteractionState.Clicked */;
2798
2871
  break;
2799
- case 27 /* Input */:
2800
- interaction = 30 /* Input */;
2872
+ case 27 /* Event.Input */:
2873
+ interaction = 30 /* InteractionState.Input */;
2801
2874
  break;
2802
2875
  }
2803
2876
  // Process updates to this region, if applicable
@@ -2825,7 +2898,7 @@ function compute$6() {
2825
2898
  queue$1 = q;
2826
2899
  // Schedule encode only when we have at least one valid data entry
2827
2900
  if (state$1.length > 0) {
2828
- encode$4(7 /* Region */);
2901
+ encode$4(7 /* Event.Region */);
2829
2902
  }
2830
2903
  }
2831
2904
  function handler$1(entries) {
@@ -2841,27 +2914,27 @@ function handler$1(entries) {
2841
2914
  // 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
2842
2915
  if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
2843
2916
  var id = target ? getId(target) : null;
2844
- var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* None */, visibility: 0 /* Rendered */ };
2917
+ var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
2845
2918
  // For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
2846
2919
  // However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
2847
2920
  var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
2848
- var visible = viewportRatio > 0.05 /* ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* IntersectionRatio */;
2921
+ var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
2849
2922
  // If an element is either visible or was visible and has been scrolled to the end
2850
2923
  // 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.
2851
2924
  // 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
2852
- var scrolledToEnd = (visible || data.visibility == 10 /* Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2925
+ var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
2853
2926
  // Process updates to this region, if applicable
2854
2927
  process$1(target, data, data.interaction, (scrolledToEnd ?
2855
- 13 /* ScrolledToEnd */ :
2856
- (visible ? 10 /* Visible */ : 0 /* Rendered */)));
2928
+ 13 /* RegionVisibility.ScrolledToEnd */ :
2929
+ (visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
2857
2930
  // Stop observing this element now that we have already received scrolled signal
2858
- if (data.visibility >= 13 /* ScrolledToEnd */ && observer$1) {
2931
+ if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
2859
2932
  observer$1.unobserve(target);
2860
2933
  }
2861
2934
  }
2862
2935
  }
2863
2936
  if (state$1.length > 0) {
2864
- encode$4(7 /* Region */);
2937
+ encode$4(7 /* Event.Region */);
2865
2938
  }
2866
2939
  }
2867
2940
  function process$1(n, d, s, v) {
@@ -2920,7 +2993,7 @@ function link(node) {
2920
2993
  function metadata$2(node, event, text) {
2921
2994
  if (text === void 0) { text = null; }
2922
2995
  // If the node is null, we return a reserved value for id: 0. Valid assignment of id begins from 1+.
2923
- var output = { id: 0, hash: null, privacy: 2 /* Text */, node: node };
2996
+ var output = { id: 0, hash: null, privacy: 2 /* Privacy.Text */, node: node };
2924
2997
  if (node) {
2925
2998
  var value = get(node);
2926
2999
  if (value !== null) {
@@ -2939,22 +3012,23 @@ function metadata$2(node, event, text) {
2939
3012
  return output;
2940
3013
  }
2941
3014
 
2942
- function encode$3 (type) {
3015
+ function encode$3 (type, ts) {
3016
+ if (ts === void 0) { ts = null; }
2943
3017
  return __awaiter(this, void 0, void 0, function () {
2944
- var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, _k, _l, entry, target, _m, _o, entry, v;
2945
- return __generator(this, function (_p) {
2946
- t = time();
3018
+ var t, tokens, _i, _a, entry, pTarget, _b, _c, entry, cTarget, cHash, _d, _e, entry, target, r, u, _f, _g, entry, iTarget, s, startTarget, endTarget, _h, _j, entry, sTarget, _k, _l, entry, target, _m, _o, entry, target, _p, _q, entry, v;
3019
+ return __generator(this, function (_r) {
3020
+ t = ts || time();
2947
3021
  tokens = [t, type];
2948
3022
  switch (type) {
2949
- case 13 /* MouseDown */:
2950
- case 14 /* MouseUp */:
2951
- case 12 /* MouseMove */:
2952
- case 15 /* MouseWheel */:
2953
- case 16 /* DoubleClick */:
2954
- case 17 /* TouchStart */:
2955
- case 18 /* TouchEnd */:
2956
- case 19 /* TouchMove */:
2957
- case 20 /* TouchCancel */:
3023
+ case 13 /* Event.MouseDown */:
3024
+ case 14 /* Event.MouseUp */:
3025
+ case 12 /* Event.MouseMove */:
3026
+ case 15 /* Event.MouseWheel */:
3027
+ case 16 /* Event.DoubleClick */:
3028
+ case 17 /* Event.TouchStart */:
3029
+ case 18 /* Event.TouchEnd */:
3030
+ case 19 /* Event.TouchMove */:
3031
+ case 20 /* Event.TouchCancel */:
2958
3032
  for (_i = 0, _a = state$4; _i < _a.length; _i++) {
2959
3033
  entry = _a[_i];
2960
3034
  pTarget = metadata$2(entry.data.target, entry.event);
@@ -2969,12 +3043,12 @@ function encode$3 (type) {
2969
3043
  }
2970
3044
  reset$e();
2971
3045
  break;
2972
- case 9 /* Click */:
3046
+ case 9 /* Event.Click */:
2973
3047
  for (_b = 0, _c = state$7; _b < _c.length; _b++) {
2974
3048
  entry = _c[_b];
2975
3049
  cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
2976
3050
  tokens = [entry.time, entry.event];
2977
- cHash = cTarget.hash.join("." /* Dot */);
3051
+ cHash = cTarget.hash.join("." /* Constant.Dot */);
2978
3052
  tokens.push(cTarget.id);
2979
3053
  tokens.push(entry.data.x);
2980
3054
  tokens.push(entry.data.y);
@@ -2983,8 +3057,8 @@ function encode$3 (type) {
2983
3057
  tokens.push(entry.data.button);
2984
3058
  tokens.push(entry.data.reaction);
2985
3059
  tokens.push(entry.data.context);
2986
- tokens.push(scrub(entry.data.text, "click", cTarget.privacy));
2987
- tokens.push(entry.data.link);
3060
+ tokens.push(text$1(entry.data.text, "click", cTarget.privacy));
3061
+ tokens.push(url$1(entry.data.link));
2988
3062
  tokens.push(cHash);
2989
3063
  tokens.push(entry.data.trust);
2990
3064
  queue(tokens);
@@ -2992,7 +3066,7 @@ function encode$3 (type) {
2992
3066
  }
2993
3067
  reset$h();
2994
3068
  break;
2995
- case 38 /* Clipboard */:
3069
+ case 38 /* Event.Clipboard */:
2996
3070
  for (_d = 0, _e = state$6; _d < _e.length; _d++) {
2997
3071
  entry = _e[_d];
2998
3072
  tokens = [entry.time, entry.event];
@@ -3005,7 +3079,7 @@ function encode$3 (type) {
3005
3079
  }
3006
3080
  reset$g();
3007
3081
  break;
3008
- case 11 /* Resize */:
3082
+ case 11 /* Event.Resize */:
3009
3083
  r = data$b;
3010
3084
  tokens.push(r.width);
3011
3085
  tokens.push(r.height);
@@ -3013,24 +3087,24 @@ function encode$3 (type) {
3013
3087
  reset$d();
3014
3088
  queue(tokens);
3015
3089
  break;
3016
- case 26 /* Unload */:
3090
+ case 26 /* Event.Unload */:
3017
3091
  u = data$9;
3018
3092
  tokens.push(u.name);
3019
3093
  reset$9();
3020
3094
  queue(tokens);
3021
3095
  break;
3022
- case 27 /* Input */:
3096
+ case 27 /* Event.Input */:
3023
3097
  for (_f = 0, _g = state$5; _f < _g.length; _f++) {
3024
3098
  entry = _g[_f];
3025
3099
  iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
3026
3100
  tokens = [entry.time, entry.event];
3027
3101
  tokens.push(iTarget.id);
3028
- tokens.push(scrub(entry.data.value, "input", iTarget.privacy));
3102
+ tokens.push(text$1(entry.data.value, "input", iTarget.privacy));
3029
3103
  queue(tokens);
3030
3104
  }
3031
3105
  reset$f();
3032
3106
  break;
3033
- case 21 /* Selection */:
3107
+ case 21 /* Event.Selection */:
3034
3108
  s = data$a;
3035
3109
  if (s) {
3036
3110
  startTarget = metadata$2(s.start, type);
@@ -3043,7 +3117,7 @@ function encode$3 (type) {
3043
3117
  queue(tokens);
3044
3118
  }
3045
3119
  break;
3046
- case 10 /* Scroll */:
3120
+ case 10 /* Event.Scroll */:
3047
3121
  for (_h = 0, _j = state$3; _h < _j.length; _h++) {
3048
3122
  entry = _j[_h];
3049
3123
  sTarget = metadata$2(entry.data.target, entry.event);
@@ -3058,22 +3132,38 @@ function encode$3 (type) {
3058
3132
  }
3059
3133
  reset$c();
3060
3134
  break;
3061
- case 39 /* Submit */:
3062
- for (_k = 0, _l = state$2; _k < _l.length; _k++) {
3135
+ case 42 /* Event.Change */:
3136
+ for (_k = 0, _l = state$8; _k < _l.length; _k++) {
3063
3137
  entry = _l[_k];
3064
3138
  tokens = [entry.time, entry.event];
3065
3139
  target = metadata$2(entry.data.target, entry.event);
3066
3140
  if (target.id > 0) {
3141
+ tokens = [entry.time, entry.event];
3067
3142
  tokens.push(target.id);
3143
+ tokens.push(entry.data.type);
3144
+ tokens.push(text$1(entry.data.value, "change", target.privacy));
3145
+ tokens.push(text$1(entry.data.checksum, "checksum", target.privacy));
3068
3146
  queue(tokens);
3069
3147
  }
3070
3148
  }
3071
- reset$a();
3149
+ reset$i();
3072
3150
  break;
3073
- case 22 /* Timeline */:
3074
- for (_m = 0, _o = updates$1; _m < _o.length; _m++) {
3151
+ case 39 /* Event.Submit */:
3152
+ for (_m = 0, _o = state$2; _m < _o.length; _m++) {
3075
3153
  entry = _o[_m];
3076
3154
  tokens = [entry.time, entry.event];
3155
+ target = metadata$2(entry.data.target, entry.event);
3156
+ if (target.id > 0) {
3157
+ tokens.push(target.id);
3158
+ queue(tokens);
3159
+ }
3160
+ }
3161
+ reset$a();
3162
+ break;
3163
+ case 22 /* Event.Timeline */:
3164
+ for (_p = 0, _q = updates$1; _p < _q.length; _p++) {
3165
+ entry = _q[_p];
3166
+ tokens = [entry.time, entry.event];
3077
3167
  tokens.push(entry.data.type);
3078
3168
  tokens.push(entry.data.hash);
3079
3169
  tokens.push(entry.data.x);
@@ -3084,7 +3174,7 @@ function encode$3 (type) {
3084
3174
  }
3085
3175
  reset$5();
3086
3176
  break;
3087
- case 28 /* Visibility */:
3177
+ case 28 /* Event.Visibility */:
3088
3178
  v = data$8;
3089
3179
  tokens.push(v.visible);
3090
3180
  queue(tokens);
@@ -3107,11 +3197,11 @@ function reset$5() {
3107
3197
  updates$1 = [];
3108
3198
  }
3109
3199
  function track$2(time, event, hash, x, y, reaction, context) {
3110
- if (reaction === void 0) { reaction = 1 /* True */; }
3111
- if (context === void 0) { context = 0 /* Self */; }
3200
+ if (reaction === void 0) { reaction = 1 /* BooleanFlag.True */; }
3201
+ if (context === void 0) { context = 0 /* BrowsingContext.Self */; }
3112
3202
  state.push({
3113
3203
  time: time,
3114
- event: 22 /* Timeline */,
3204
+ event: 22 /* Event.Timeline */,
3115
3205
  data: {
3116
3206
  type: event,
3117
3207
  hash: hash,
@@ -3130,7 +3220,7 @@ function compute$5() {
3130
3220
  var temp = [];
3131
3221
  updates$1 = [];
3132
3222
  var max = data$1.start + data$1.duration;
3133
- var min = Math.max(max - 2000 /* TimelineSpan */, 0);
3223
+ var min = Math.max(max - 2000 /* Setting.TimelineSpan */, 0);
3134
3224
  for (var _i = 0, state_1 = state; _i < state_1.length; _i++) {
3135
3225
  var s = state_1[_i];
3136
3226
  if (s.time >= min) {
@@ -3141,7 +3231,7 @@ function compute$5() {
3141
3231
  }
3142
3232
  }
3143
3233
  state = temp; // Drop events less than the min time
3144
- encode$3(22 /* Timeline */);
3234
+ encode$3(22 /* Event.Timeline */);
3145
3235
  }
3146
3236
  function stop$e() {
3147
3237
  state = [];
@@ -3174,10 +3264,10 @@ function queue(tokens, transmit) {
3174
3264
  var type = tokens.length > 1 ? tokens[1] : null;
3175
3265
  var event_1 = JSON.stringify(tokens);
3176
3266
  switch (type) {
3177
- case 5 /* Discover */:
3267
+ case 5 /* Event.Discover */:
3178
3268
  discoverBytes += event_1.length;
3179
- case 37 /* Box */:
3180
- case 6 /* Mutation */:
3269
+ case 37 /* Event.Box */:
3270
+ case 6 /* Event.Mutation */:
3181
3271
  playbackBytes += event_1.length;
3182
3272
  playback.push(event_1);
3183
3273
  break;
@@ -3186,7 +3276,7 @@ function queue(tokens, transmit) {
3186
3276
  break;
3187
3277
  }
3188
3278
  // Increment event count metric
3189
- count$1(25 /* EventCount */);
3279
+ count$1(25 /* Metric.EventCount */);
3190
3280
  // Following two checks are precautionary and act as a fail safe mechanism to get out of unexpected situations.
3191
3281
  // Check 1: If for any reason the upload hasn't happened after waiting for 2x the config.delay time,
3192
3282
  // reset the timer. This allows Clarity to attempt an upload again.
@@ -3199,8 +3289,8 @@ function queue(tokens, transmit) {
3199
3289
  // However, in certain scenarios - like metric calculation - which are triggered as part of an existing upload
3200
3290
  // We enrich the data going out with the existing upload. In these cases, call to upload comes with 'transmit' set to false.
3201
3291
  if (transmit && timeout === null) {
3202
- if (type !== 25 /* Ping */) {
3203
- reset$n();
3292
+ if (type !== 25 /* Event.Ping */) {
3293
+ reset$o();
3204
3294
  }
3205
3295
  timeout = setTimeout(upload, gap);
3206
3296
  queuedTime = now;
@@ -3228,9 +3318,9 @@ function upload(final) {
3228
3318
  switch (_b.label) {
3229
3319
  case 0:
3230
3320
  timeout = null;
3231
- sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* MaxFirstPayloadBytes */ || data$1.sequence > 0);
3321
+ sendPlaybackBytes = config$1.lean === false && playbackBytes > 0 && (playbackBytes < 1048576 /* Setting.MaxFirstPayloadBytes */ || data$1.sequence > 0);
3232
3322
  if (sendPlaybackBytes) {
3233
- max(1 /* Playback */, 1 /* True */);
3323
+ max(1 /* Metric.Playback */, 1 /* BooleanFlag.True */);
3234
3324
  }
3235
3325
  // CAUTION: Ensure "transmit" is set to false in the queue function for following events
3236
3326
  // Otherwise you run a risk of infinite loop.
@@ -3239,8 +3329,8 @@ function upload(final) {
3239
3329
  compute$8();
3240
3330
  last = final === true;
3241
3331
  e = JSON.stringify(envelope(last));
3242
- a = "[" + analysis.join() + "]";
3243
- p = sendPlaybackBytes ? "[" + playback.join() + "]" : "" /* Empty */;
3332
+ a = "[".concat(analysis.join(), "]");
3333
+ p = sendPlaybackBytes ? "[".concat(playback.join(), "]") : "" /* Constant.Empty */;
3244
3334
  encoded = { e: e, a: a, p: p };
3245
3335
  payload = stringify(encoded);
3246
3336
  if (!last) return [3 /*break*/, 1];
@@ -3252,7 +3342,7 @@ function upload(final) {
3252
3342
  _b.label = 3;
3253
3343
  case 3:
3254
3344
  zipped = _a;
3255
- sum(2 /* TotalBytes */, zipped ? zipped.length : payload.length);
3345
+ sum(2 /* Metric.TotalBytes */, zipped ? zipped.length : payload.length);
3256
3346
  send(payload, zipped, data$1.sequence, last);
3257
3347
  // Clear out events now that payload has been dispatched
3258
3348
  analysis = [];
@@ -3267,12 +3357,12 @@ function upload(final) {
3267
3357
  });
3268
3358
  }
3269
3359
  function stringify(encoded) {
3270
- return encoded.p.length > 0 ? "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + ",\"p\":" + encoded.p + "}" : "{\"e\":" + encoded.e + ",\"a\":" + encoded.a + "}";
3360
+ 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, "}");
3271
3361
  }
3272
3362
  function send(payload, zipped, sequence, beacon) {
3273
3363
  if (beacon === void 0) { beacon = false; }
3274
3364
  // Upload data if a valid URL is defined in the config
3275
- if (typeof config$1.upload === "string" /* String */) {
3365
+ if (typeof config$1.upload === "string" /* Constant.String */) {
3276
3366
  var url = config$1.upload;
3277
3367
  var dispatched = false;
3278
3368
  // If it's the last payload, attempt to upload using sendBeacon first.
@@ -3311,7 +3401,7 @@ function send(payload, zipped, sequence, beacon) {
3311
3401
  xhr_1.withCredentials = true;
3312
3402
  if (zipped) {
3313
3403
  // If we do have valid compressed array, send it with appropriate HTTP headers so server can decode it appropriately
3314
- xhr_1.setRequestHeader("Accept" /* Accept */, "application/x-clarity-gzip" /* ClarityGzip */);
3404
+ xhr_1.setRequestHeader("Accept" /* Constant.Accept */, "application/x-clarity-gzip" /* Constant.ClarityGzip */);
3315
3405
  xhr_1.send(zipped);
3316
3406
  }
3317
3407
  else {
@@ -3328,13 +3418,13 @@ function send(payload, zipped, sequence, beacon) {
3328
3418
  }
3329
3419
  function check$3(xhr, sequence) {
3330
3420
  var transitData = transit[sequence];
3331
- if (xhr && xhr.readyState === 4 /* Done */ && transitData) {
3421
+ if (xhr && xhr.readyState === 4 /* XMLReadyState.Done */ && transitData) {
3332
3422
  // Attempt send payload again (as configured in settings) if we do not receive a success (2XX) response code back from the server
3333
- if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* RetryLimit */) {
3423
+ if ((xhr.status < 200 || xhr.status > 208) && transitData.attempts <= 1 /* Setting.RetryLimit */) {
3334
3424
  // We re-attempt in all cases except when server explicitly rejects our request with 4XX error
3335
3425
  if (xhr.status >= 400 && xhr.status < 500) {
3336
3426
  // In case of a 4XX response from the server, we bail out instead of trying again
3337
- trigger(6 /* Server */);
3427
+ trigger(6 /* Check.Server */);
3338
3428
  }
3339
3429
  else {
3340
3430
  // Browser will send status = 0 when it refuses to put network request over the wire
@@ -3355,7 +3445,7 @@ function check$3(xhr, sequence) {
3355
3445
  track$1 = { sequence: sequence, attempts: transitData.attempts, status: xhr.status };
3356
3446
  // Send back an event only if we were not successful in our first attempt
3357
3447
  if (transitData.attempts > 1) {
3358
- encode$1(2 /* Upload */);
3448
+ encode$1(2 /* Event.Upload */);
3359
3449
  }
3360
3450
  // Handle response if it was a 200 response with a valid body
3361
3451
  if (xhr.status === 200 && xhr.responseText) {
@@ -3366,7 +3456,7 @@ function check$3(xhr, sequence) {
3366
3456
  // And, right before we terminate the session, we will attempt one last time to see if we can use
3367
3457
  // different transport option (sendBeacon vs. XHR) to get this data to the server for analysis purposes
3368
3458
  send(transitData.data, null, sequence, true);
3369
- trigger(3 /* Retry */);
3459
+ trigger(3 /* Check.Retry */);
3370
3460
  }
3371
3461
  // Signal that this request completed successfully
3372
3462
  if (xhr.status >= 200 && xhr.status <= 208) {
@@ -3386,21 +3476,21 @@ function done(sequence) {
3386
3476
  function delay() {
3387
3477
  // Progressively increase delay as we continue to send more payloads from the client to the server
3388
3478
  // If we are not uploading data to a server, and instead invoking UploadCallback, in that case keep returning configured value
3389
- var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* MinUploadDelay */ : data$1.sequence * config$1.delay;
3390
- return typeof config$1.upload === "string" /* String */ ? Math.max(Math.min(gap, 30000 /* MaxUploadDelay */), 100 /* MinUploadDelay */) : config$1.delay;
3479
+ var gap = config$1.lean === false && discoverBytes > 0 ? 100 /* Setting.MinUploadDelay */ : data$1.sequence * config$1.delay;
3480
+ return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
3391
3481
  }
3392
3482
  function response(payload) {
3393
- var parts = payload && payload.length > 0 ? payload.split(" ") : ["" /* Empty */];
3483
+ var parts = payload && payload.length > 0 ? payload.split(" ") : ["" /* Constant.Empty */];
3394
3484
  switch (parts[0]) {
3395
- case "END" /* End */:
3485
+ case "END" /* Constant.End */:
3396
3486
  // Clear out session storage and end the session so we can start fresh the next time
3397
- trigger(6 /* Server */);
3487
+ trigger(6 /* Check.Server */);
3398
3488
  break;
3399
- case "UPGRADE" /* Upgrade */:
3489
+ case "UPGRADE" /* Constant.Upgrade */:
3400
3490
  // Upgrade current session to send back playback information
3401
- upgrade("Auto" /* Auto */);
3491
+ upgrade("Auto" /* Constant.Auto */);
3402
3492
  break;
3403
- case "ACTION" /* Action */:
3493
+ case "ACTION" /* Constant.Action */:
3404
3494
  // Invoke action callback, if configured and has a valid value
3405
3495
  if (config$1.action && parts.length > 1) {
3406
3496
  config$1.action(parts[1]);
@@ -3422,7 +3512,7 @@ function handler(error) {
3422
3512
  if (!(e.message in history$3)) {
3423
3513
  history$3[e.message] = 0;
3424
3514
  }
3425
- if (history$3[e.message]++ >= 5 /* ScriptErrorLimit */) {
3515
+ if (history$3[e.message]++ >= 5 /* Setting.ScriptErrorLimit */) {
3426
3516
  return true;
3427
3517
  }
3428
3518
  // Send back information only if the handled error has valid information
@@ -3434,7 +3524,7 @@ function handler(error) {
3434
3524
  stack: e.stack,
3435
3525
  source: error["filename"]
3436
3526
  };
3437
- encode$2(31 /* ScriptError */);
3527
+ encode$2(31 /* Event.ScriptError */);
3438
3528
  }
3439
3529
  return true;
3440
3530
  }
@@ -3445,15 +3535,15 @@ function encode$2 (type) {
3445
3535
  return __generator(this, function (_a) {
3446
3536
  tokens = [time(), type];
3447
3537
  switch (type) {
3448
- case 31 /* ScriptError */:
3538
+ case 31 /* Event.ScriptError */:
3449
3539
  tokens.push(data$7.message);
3450
3540
  tokens.push(data$7.line);
3451
3541
  tokens.push(data$7.column);
3452
3542
  tokens.push(data$7.stack);
3453
- tokens.push(data$7.source);
3543
+ tokens.push(url$1(data$7.source));
3454
3544
  queue(tokens);
3455
3545
  break;
3456
- case 33 /* Log */:
3546
+ case 33 /* Event.Log */:
3457
3547
  if (data$6) {
3458
3548
  tokens.push(data$6.code);
3459
3549
  tokens.push(data$6.name);
@@ -3463,11 +3553,11 @@ function encode$2 (type) {
3463
3553
  queue(tokens, false);
3464
3554
  }
3465
3555
  break;
3466
- case 41 /* Fraud */:
3556
+ case 41 /* Event.Fraud */:
3467
3557
  if (data$d) {
3468
3558
  tokens.push(data$d.id);
3469
3559
  tokens.push(data$d.target);
3470
- tokens.push(data$d.hash);
3560
+ tokens.push(data$d.checksum);
3471
3561
  queue(tokens, false);
3472
3562
  }
3473
3563
  break;
@@ -3486,7 +3576,7 @@ function log$1(code, severity, name, message, stack) {
3486
3576
  if (name === void 0) { name = null; }
3487
3577
  if (message === void 0) { message = null; }
3488
3578
  if (stack === void 0) { stack = null; }
3489
- var key = name ? name + "|" + message : "";
3579
+ var key = name ? "".concat(name, "|").concat(message) : "";
3490
3580
  // While rare, it's possible for code to fail repeatedly during the lifetime of the same page
3491
3581
  // In those cases, we only want to log the failure once and not spam logs with redundant information.
3492
3582
  if (code in history$2 && history$2[code].indexOf(key) >= 0) {
@@ -3500,7 +3590,7 @@ function log$1(code, severity, name, message, stack) {
3500
3590
  else {
3501
3591
  history$2[code] = [key];
3502
3592
  }
3503
- encode$2(33 /* Log */);
3593
+ encode$2(33 /* Event.Log */);
3504
3594
  }
3505
3595
  function stop$c() {
3506
3596
  history$2 = {};
@@ -3521,25 +3611,25 @@ function start$c() {
3521
3611
  var source = e[i];
3522
3612
  var key = e[i + 1];
3523
3613
  switch (source) {
3524
- case 0 /* Javascript */:
3614
+ case 0 /* ExtractSource.Javascript */:
3525
3615
  var variable = e[i + 2];
3526
3616
  variables[key] = parse(variable);
3527
3617
  break;
3528
- case 1 /* Cookie */:
3618
+ case 1 /* ExtractSource.Cookie */:
3529
3619
  /*Todo: Add cookie extract logic*/
3530
3620
  break;
3531
- case 2 /* Text */:
3621
+ case 2 /* ExtractSource.Text */:
3532
3622
  var match_1 = e[i + 2];
3533
3623
  selectors[key] = match_1;
3534
3624
  break;
3535
- case 3 /* Fragment */:
3625
+ case 3 /* ExtractSource.Fragment */:
3536
3626
  fragments = e[i + 2];
3537
3627
  break;
3538
3628
  }
3539
3629
  }
3540
3630
  }
3541
3631
  catch (e) {
3542
- log$1(8 /* Config */, 1 /* Warning */, e ? e.name : null);
3632
+ log$1(8 /* Code.Config */, 1 /* Severity.Warning */, e ? e.name : null);
3543
3633
  }
3544
3634
  }
3545
3635
  function clone(v) {
@@ -3561,9 +3651,9 @@ function compute$4() {
3561
3651
  }
3562
3652
  }
3563
3653
  catch (e) {
3564
- log$1(5 /* Selector */, 1 /* Warning */, e ? e.name : null);
3654
+ log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
3565
3655
  }
3566
- encode$1(40 /* Extract */);
3656
+ encode$1(40 /* Event.Extract */);
3567
3657
  }
3568
3658
  function reset$4() {
3569
3659
  keys = [];
@@ -3583,15 +3673,15 @@ function stop$b() {
3583
3673
  }
3584
3674
  function parse(variable) {
3585
3675
  var syntax = [];
3586
- var parts = variable.split("." /* Dot */);
3676
+ var parts = variable.split("." /* Constant.Dot */);
3587
3677
  while (parts.length > 0) {
3588
3678
  var part = parts.shift();
3589
- var arrayStart = part.indexOf("[" /* ArrayStart */);
3590
- var conditionStart = part.indexOf("{" /* ConditionStart */);
3591
- var conditionEnd = part.indexOf("}" /* ConditionEnd */);
3679
+ var arrayStart = part.indexOf("[" /* Constant.ArrayStart */);
3680
+ var conditionStart = part.indexOf("{" /* Constant.ConditionStart */);
3681
+ var conditionEnd = part.indexOf("}" /* Constant.ConditionEnd */);
3592
3682
  syntax.push({
3593
3683
  name: arrayStart > 0 ? part.substring(0, arrayStart) : (conditionStart > 0 ? part.substring(0, conditionStart) : part),
3594
- type: arrayStart > 0 ? 1 /* Array */ : (conditionStart > 0 ? 2 /* Object */ : 3 /* Simple */),
3684
+ type: arrayStart > 0 ? 1 /* Type.Array */ : (conditionStart > 0 ? 2 /* Type.Object */ : 3 /* Type.Simple */),
3595
3685
  condition: conditionStart > 0 ? part.substring(conditionStart + 1, conditionEnd) : null
3596
3686
  });
3597
3687
  }
@@ -3609,7 +3699,7 @@ function evaluate(variable, base) {
3609
3699
  var output;
3610
3700
  if (base && base[part.name]) {
3611
3701
  var obj = base[part.name];
3612
- if (part.type !== 1 /* Array */ && match(obj, part.condition)) {
3702
+ if (part.type !== 1 /* Type.Array */ && match(obj, part.condition)) {
3613
3703
  output = evaluate(variable, obj);
3614
3704
  }
3615
3705
  else if (Array.isArray(obj)) {
@@ -3631,7 +3721,7 @@ function evaluate(variable, base) {
3631
3721
  }
3632
3722
  function str(input) {
3633
3723
  // Automatically trim string to max of Setting.ExtractLimit to avoid fetching long strings
3634
- return input ? JSON.stringify(input).substring(0, 10000 /* ExtractLimit */) : input;
3724
+ return input ? JSON.stringify(input).substring(0, 10000 /* Setting.ExtractLimit */) : input;
3635
3725
  }
3636
3726
  function match(base, condition) {
3637
3727
  if (condition) {
@@ -3645,8 +3735,8 @@ function encode$1 (event) {
3645
3735
  var t = time();
3646
3736
  var tokens = [t, event];
3647
3737
  switch (event) {
3648
- case 4 /* Baseline */:
3649
- var b = state$9;
3738
+ case 4 /* Event.Baseline */:
3739
+ var b = state$a;
3650
3740
  if (b) {
3651
3741
  tokens = [b.time, b.event];
3652
3742
  tokens.push(b.data.visible);
@@ -3661,32 +3751,32 @@ function encode$1 (event) {
3661
3751
  tokens.push(b.data.activityTime);
3662
3752
  queue(tokens, false);
3663
3753
  }
3664
- reset$p();
3754
+ reset$q();
3665
3755
  break;
3666
- case 25 /* Ping */:
3756
+ case 25 /* Event.Ping */:
3667
3757
  tokens.push(data$h.gap);
3668
3758
  queue(tokens);
3669
3759
  break;
3670
- case 35 /* Limit */:
3760
+ case 35 /* Event.Limit */:
3671
3761
  tokens.push(data$4.check);
3672
3762
  queue(tokens, false);
3673
3763
  break;
3674
- case 3 /* Upgrade */:
3764
+ case 3 /* Event.Upgrade */:
3675
3765
  tokens.push(data$f.key);
3676
3766
  queue(tokens);
3677
3767
  break;
3678
- case 2 /* Upload */:
3768
+ case 2 /* Event.Upload */:
3679
3769
  tokens.push(track$1.sequence);
3680
3770
  tokens.push(track$1.attempts);
3681
3771
  tokens.push(track$1.status);
3682
3772
  queue(tokens, false);
3683
3773
  break;
3684
- case 24 /* Custom */:
3774
+ case 24 /* Event.Custom */:
3685
3775
  tokens.push(data$j.key);
3686
3776
  tokens.push(data$j.value);
3687
3777
  queue(tokens);
3688
3778
  break;
3689
- case 34 /* Variable */:
3779
+ case 34 /* Event.Variable */:
3690
3780
  var variableKeys = Object.keys(data$e);
3691
3781
  if (variableKeys.length > 0) {
3692
3782
  for (var _i = 0, variableKeys_1 = variableKeys; _i < variableKeys_1.length; _i++) {
@@ -3694,11 +3784,11 @@ function encode$1 (event) {
3694
3784
  tokens.push(v);
3695
3785
  tokens.push(data$e[v]);
3696
3786
  }
3697
- reset$l();
3787
+ reset$m();
3698
3788
  queue(tokens, false);
3699
3789
  }
3700
3790
  break;
3701
- case 0 /* Metric */:
3791
+ case 0 /* Event.Metric */:
3702
3792
  var metricKeys = Object.keys(updates$3);
3703
3793
  if (metricKeys.length > 0) {
3704
3794
  for (var _a = 0, metricKeys_1 = metricKeys; _a < metricKeys_1.length; _a++) {
@@ -3709,11 +3799,11 @@ function encode$1 (event) {
3709
3799
  // However, for data over the wire, we round it off to milliseconds precision.
3710
3800
  tokens.push(Math.round(updates$3[m]));
3711
3801
  }
3712
- reset$o();
3802
+ reset$p();
3713
3803
  queue(tokens, false);
3714
3804
  }
3715
3805
  break;
3716
- case 1 /* Dimension */:
3806
+ case 1 /* Event.Dimension */:
3717
3807
  var dimensionKeys = Object.keys(updates);
3718
3808
  if (dimensionKeys.length > 0) {
3719
3809
  for (var _b = 0, dimensionKeys_1 = dimensionKeys; _b < dimensionKeys_1.length; _b++) {
@@ -3726,7 +3816,7 @@ function encode$1 (event) {
3726
3816
  queue(tokens, false);
3727
3817
  }
3728
3818
  break;
3729
- case 36 /* Summary */:
3819
+ case 36 /* Event.Summary */:
3730
3820
  var eventKeys = Object.keys(data$g);
3731
3821
  if (eventKeys.length > 0) {
3732
3822
  for (var _c = 0, eventKeys_1 = eventKeys; _c < eventKeys_1.length; _c++) {
@@ -3735,11 +3825,11 @@ function encode$1 (event) {
3735
3825
  tokens.push(key);
3736
3826
  tokens.push([].concat.apply([], data$g[e]));
3737
3827
  }
3738
- reset$m();
3828
+ reset$n();
3739
3829
  queue(tokens, false);
3740
3830
  }
3741
3831
  break;
3742
- case 40 /* Extract */:
3832
+ case 40 /* Event.Extract */:
3743
3833
  var extractKeys = keys;
3744
3834
  for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
3745
3835
  var e = extractKeys_1[_d];
@@ -3753,14 +3843,14 @@ function encode$1 (event) {
3753
3843
 
3754
3844
  var data$4;
3755
3845
  function start$b() {
3756
- data$4 = { check: 0 /* None */ };
3846
+ data$4 = { check: 0 /* Check.None */ };
3757
3847
  }
3758
3848
  function check$2(bytes) {
3759
- if (data$4.check === 0 /* None */) {
3849
+ if (data$4.check === 0 /* Check.None */) {
3760
3850
  var reason = data$4.check;
3761
- reason = data$1.sequence >= 128 /* PayloadLimit */ ? 1 /* Payload */ : reason;
3762
- reason = time() > 7200000 /* ShutdownLimit */ ? 2 /* Shutdown */ : reason;
3763
- reason = bytes > 10485760 /* PlaybackBytesLimit */ ? 2 /* Shutdown */ : reason;
3851
+ reason = data$1.sequence >= 128 /* Setting.PayloadLimit */ ? 1 /* Check.Payload */ : reason;
3852
+ reason = time() > 7200000 /* Setting.ShutdownLimit */ ? 2 /* Check.Shutdown */ : reason;
3853
+ reason = bytes > 10485760 /* Setting.PlaybackBytesLimit */ ? 2 /* Check.Shutdown */ : reason;
3764
3854
  if (reason !== data$4.check) {
3765
3855
  trigger(reason);
3766
3856
  }
@@ -3772,8 +3862,8 @@ function trigger(reason) {
3772
3862
  stop();
3773
3863
  }
3774
3864
  function compute$3() {
3775
- if (data$4.check !== 0 /* None */) {
3776
- encode$1(35 /* Limit */);
3865
+ if (data$4.check !== 0 /* Check.None */) {
3866
+ encode$1(35 /* Event.Limit */);
3777
3867
  }
3778
3868
  }
3779
3869
  function stop$a() {
@@ -3794,7 +3884,7 @@ function log(dimension, value) {
3794
3884
  // Check valid value before moving ahead
3795
3885
  if (value) {
3796
3886
  // Ensure received value is casted into a string if it wasn't a string to begin with
3797
- value = "" + value;
3887
+ value = "".concat(value);
3798
3888
  if (!(dimension in data$3)) {
3799
3889
  data$3[dimension] = [];
3800
3890
  }
@@ -3807,14 +3897,14 @@ function log(dimension, value) {
3807
3897
  }
3808
3898
  updates[dimension].push(value);
3809
3899
  // Limit check to ensure we have a cap on number of dimensions we can collect
3810
- if (data$3[dimension].length > 128 /* CollectionLimit */) {
3811
- trigger(5 /* Collection */);
3900
+ if (data$3[dimension].length > 128 /* Setting.CollectionLimit */) {
3901
+ trigger(5 /* Check.Collection */);
3812
3902
  }
3813
3903
  }
3814
3904
  }
3815
3905
  }
3816
3906
  function compute$2() {
3817
- encode$1(1 /* Dimension */);
3907
+ encode$1(1 /* Event.Dimension */);
3818
3908
  }
3819
3909
  function reset$3() {
3820
3910
  updates = {};
@@ -3825,39 +3915,40 @@ var callbacks = [];
3825
3915
  var rootDomain = null;
3826
3916
  function start$9() {
3827
3917
  rootDomain = null;
3828
- var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Empty */;
3829
- var title = document && document.title ? document.title : "" /* Empty */;
3918
+ var ua = navigator && "userAgent" in navigator ? navigator.userAgent : "" /* Constant.Empty */;
3919
+ var title = document && document.title ? document.title : "" /* Constant.Empty */;
3830
3920
  // Populate ids for this page
3831
3921
  var s = session();
3832
3922
  var u = user();
3833
- data$2 = {
3834
- projectId: config$1.projectId || hash(location.host),
3835
- userId: u.id,
3836
- sessionId: s.session,
3837
- pageNum: s.count
3838
- };
3923
+ var projectId = config$1.projectId || hash(location.host);
3924
+ data$2 = { projectId: projectId, userId: u.id, sessionId: s.session, pageNum: s.count };
3839
3925
  // Override configuration based on what's in the session storage, unless it is blank (e.g. using upload callback, like in devtools)
3840
- config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* False */ : config$1.lean;
3841
- 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;
3842
- // Log dimensions
3843
- log(0 /* UserAgent */, ua);
3844
- log(3 /* PageTitle */, title);
3845
- log(1 /* Url */, location.href);
3846
- log(2 /* Referrer */, document.referrer);
3847
- log(15 /* TabId */, tab());
3848
- log(16 /* PageLanguage */, document.documentElement.lang);
3849
- log(17 /* DocumentDirection */, document.dir);
3926
+ config$1.lean = config$1.track && s.upgrade !== null ? s.upgrade === 0 /* BooleanFlag.False */ : config$1.lean;
3927
+ 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;
3928
+ // Log page metadata as dimensions
3929
+ log(0 /* Dimension.UserAgent */, ua);
3930
+ log(3 /* Dimension.PageTitle */, title);
3931
+ log(1 /* Dimension.Url */, url$1(location.href));
3932
+ log(2 /* Dimension.Referrer */, document.referrer);
3933
+ log(15 /* Dimension.TabId */, tab());
3934
+ log(16 /* Dimension.PageLanguage */, document.documentElement.lang);
3935
+ log(17 /* Dimension.DocumentDirection */, document.dir);
3936
+ log(26 /* Dimension.DevicePixelRatio */, "".concat(window.devicePixelRatio));
3937
+ // Capture additional metadata as metrics
3938
+ max(0 /* Metric.ClientTimestamp */, s.ts);
3939
+ max(1 /* Metric.Playback */, 0 /* BooleanFlag.False */);
3940
+ // Capture navigator specific dimensions
3850
3941
  if (navigator) {
3851
- log(9 /* Language */, navigator.userLanguage || navigator.language);
3942
+ log(9 /* Dimension.Language */, navigator.language);
3943
+ max(33 /* Metric.HardwareConcurrency */, navigator.hardwareConcurrency);
3944
+ max(32 /* Metric.MaxTouchPoints */, navigator.maxTouchPoints);
3945
+ max(34 /* Metric.DeviceMemory */, Math.round(navigator.deviceMemory));
3852
3946
  userAgentData();
3853
3947
  }
3854
- // Metrics
3855
- max(0 /* ClientTimestamp */, s.ts);
3856
- max(1 /* Playback */, 0 /* False */);
3857
3948
  if (screen) {
3858
- max(14 /* ScreenWidth */, Math.round(screen.width));
3859
- max(15 /* ScreenHeight */, Math.round(screen.height));
3860
- max(16 /* ColorDepth */, Math.round(screen.colorDepth));
3949
+ max(14 /* Metric.ScreenWidth */, Math.round(screen.width));
3950
+ max(15 /* Metric.ScreenHeight */, Math.round(screen.height));
3951
+ max(16 /* Metric.ColorDepth */, Math.round(screen.colorDepth));
3861
3952
  }
3862
3953
  // Read cookies specified in configuration
3863
3954
  for (var _i = 0, _a = config$1.cookies; _i < _a.length; _i++) {
@@ -3871,22 +3962,20 @@ function start$9() {
3871
3962
  track(u);
3872
3963
  }
3873
3964
  function userAgentData() {
3874
- if (navigator["userAgentData"] && navigator["userAgentData"].getHighEntropyValues) {
3875
- navigator["userAgentData"].getHighEntropyValues(["model",
3876
- "platform",
3877
- "platformVersion",
3878
- "uaFullVersion"])
3879
- .then(function (ua) {
3965
+ var uaData = navigator["userAgentData"];
3966
+ if (uaData && uaData.getHighEntropyValues) {
3967
+ uaData.getHighEntropyValues(["model", "platform", "platformVersion", "uaFullVersion"]).then(function (ua) {
3880
3968
  var _a;
3881
- log(22 /* Platform */, ua.platform);
3882
- log(23 /* PlatformVersion */, ua.platformVersion);
3883
- (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) {
3884
- log(24 /* Brand */, brand.name + "~" /* Tilde */ + brand.version);
3885
- });
3886
- log(25 /* Model */, ua.model);
3887
- max(27 /* Mobile */, ua.mobile ? 1 /* True */ : 0 /* False */);
3969
+ log(22 /* Dimension.Platform */, ua.platform);
3970
+ log(23 /* Dimension.PlatformVersion */, ua.platformVersion);
3971
+ (_a = ua.brands) === null || _a === void 0 ? void 0 : _a.forEach(function (brand) { log(24 /* Dimension.Brand */, brand.name + "~" /* Constant.Tilde */ + brand.version); });
3972
+ log(25 /* Dimension.Model */, ua.model);
3973
+ max(27 /* Metric.Mobile */, ua.mobile ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */);
3888
3974
  });
3889
3975
  }
3976
+ else {
3977
+ log(22 /* Dimension.Platform */, navigator.platform);
3978
+ }
3890
3979
  }
3891
3980
  function stop$8() {
3892
3981
  rootDomain = null;
@@ -3901,33 +3990,33 @@ function metadata(cb, wait) {
3901
3990
  callbacks.push({ callback: cb, wait: wait });
3902
3991
  }
3903
3992
  function id() {
3904
- return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Dot */) : "" /* Empty */;
3993
+ return data$2 ? [data$2.userId, data$2.sessionId, data$2.pageNum].join("." /* Constant.Dot */) : "" /* Constant.Empty */;
3905
3994
  }
3906
3995
  function consent() {
3907
3996
  if (active()) {
3908
3997
  config$1.track = true;
3909
- track(user(), 1 /* True */);
3998
+ track(user(), 1 /* BooleanFlag.True */);
3910
3999
  }
3911
4000
  }
3912
4001
  function clear() {
3913
4002
  // Clear any stored information in the cookie that tracks session information so we can restart fresh the next time
3914
- setCookie("_clsk" /* SessionKey */, "" /* Empty */, 0);
4003
+ setCookie("_clsk" /* Constant.SessionKey */, "" /* Constant.Empty */, 0);
3915
4004
  }
3916
4005
  function tab() {
3917
4006
  var id = shortid();
3918
- if (config$1.track && supported(window, "sessionStorage" /* SessionStorage */)) {
3919
- var value = sessionStorage.getItem("_cltk" /* TabKey */);
4007
+ if (config$1.track && supported(window, "sessionStorage" /* Constant.SessionStorage */)) {
4008
+ var value = sessionStorage.getItem("_cltk" /* Constant.TabKey */);
3920
4009
  id = value ? value : id;
3921
- sessionStorage.setItem("_cltk" /* TabKey */, id);
4010
+ sessionStorage.setItem("_cltk" /* Constant.TabKey */, id);
3922
4011
  }
3923
4012
  return id;
3924
4013
  }
3925
4014
  function save() {
3926
4015
  var ts = Math.round(Date.now());
3927
- var upload = config$1.upload && typeof config$1.upload === "string" /* String */ ? config$1.upload.replace("https://" /* HTTPS */, "" /* Empty */) : "" /* Empty */;
3928
- var upgrade = config$1.lean ? 0 /* False */ : 1 /* True */;
4016
+ var upload = config$1.upload && typeof config$1.upload === "string" /* Constant.String */ ? config$1.upload.replace("https://" /* Constant.HTTPS */, "" /* Constant.Empty */) : "" /* Constant.Empty */;
4017
+ var upgrade = config$1.lean ? 0 /* BooleanFlag.False */ : 1 /* BooleanFlag.True */;
3929
4018
  processCallback(upgrade);
3930
- setCookie("_clsk" /* SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Pipe */), 1 /* SessionExpire */);
4019
+ setCookie("_clsk" /* Constant.SessionKey */, [data$2.sessionId, ts, data$2.pageNum, upgrade, upload].join("|" /* Constant.Pipe */), 1 /* Setting.SessionExpire */);
3931
4020
  }
3932
4021
  function processCallback(upgrade) {
3933
4022
  if (callbacks.length > 0) {
@@ -3952,10 +4041,10 @@ function track(u, consent) {
3952
4041
  consent = consent === null ? u.consent : consent;
3953
4042
  // Convert time precision into days to reduce number of bytes we have to write in a cookie
3954
4043
  // E.g. Math.ceil(1628735962643 / (24*60*60*1000)) => 18852 (days) => ejo in base36 (13 bytes => 3 bytes)
3955
- var end = Math.ceil((Date.now() + (365 /* Expire */ * 86400000 /* Day */)) / 86400000 /* Day */);
4044
+ var end = Math.ceil((Date.now() + (365 /* Setting.Expire */ * 86400000 /* Time.Day */)) / 86400000 /* Time.Day */);
3956
4045
  // To avoid cookie churn, write user id cookie only once every day
3957
- if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* CookieInterval */ || u.consent !== consent) {
3958
- setCookie("_clck" /* CookieKey */, [data$2.userId, 1 /* CookieVersion */, end.toString(36), consent].join("|" /* Pipe */), 365 /* Expire */);
4046
+ if (u.expiry === null || Math.abs(end - u.expiry) >= 1 /* Setting.CookieInterval */ || u.consent !== consent) {
4047
+ setCookie("_clck" /* Constant.CookieKey */, [data$2.userId, 1 /* Setting.CookieVersion */, end.toString(36), consent].join("|" /* Constant.Pipe */), 365 /* Setting.Expire */);
3959
4048
  }
3960
4049
  }
3961
4050
  function shortid() {
@@ -3966,17 +4055,17 @@ function shortid() {
3966
4055
  return id.toString(36);
3967
4056
  }
3968
4057
  function session() {
3969
- var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Empty */ };
3970
- var value = getCookie("_clsk" /* SessionKey */);
4058
+ var output = { session: shortid(), ts: Math.round(Date.now()), count: 1, upgrade: null, upload: "" /* Constant.Empty */ };
4059
+ var value = getCookie("_clsk" /* Constant.SessionKey */);
3971
4060
  if (value) {
3972
- var parts = value.split("|" /* Pipe */);
4061
+ var parts = value.split("|" /* Constant.Pipe */);
3973
4062
  // Making it backward & forward compatible by using greater than comparison (v0.6.21)
3974
4063
  // In future version, we can reduce the parts length to be 5 where the last part contains the full upload URL
3975
- if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* SessionTimeout */) {
4064
+ if (parts.length >= 5 && output.ts - num(parts[1]) < 1800000 /* Setting.SessionTimeout */) {
3976
4065
  output.session = parts[0];
3977
4066
  output.count = num(parts[2]) + 1;
3978
4067
  output.upgrade = num(parts[3]);
3979
- output.upload = parts.length >= 6 ? "" + "https://" /* HTTPS */ + parts[5] + "/" + parts[4] : "" + "https://" /* HTTPS */ + parts[4];
4068
+ output.upload = parts.length >= 6 ? "".concat("https://" /* Constant.HTTPS */).concat(parts[5], "/").concat(parts[4]) : "".concat("https://" /* Constant.HTTPS */).concat(parts[4]);
3980
4069
  }
3981
4070
  }
3982
4071
  return output;
@@ -3986,26 +4075,26 @@ function num(string, base) {
3986
4075
  return parseInt(string, base);
3987
4076
  }
3988
4077
  function user() {
3989
- var output = { id: shortid(), expiry: null, consent: 0 /* False */ };
3990
- var cookie = getCookie("_clck" /* CookieKey */);
4078
+ var output = { id: shortid(), expiry: null, consent: 0 /* BooleanFlag.False */ };
4079
+ var cookie = getCookie("_clck" /* Constant.CookieKey */);
3991
4080
  if (cookie && cookie.length > 0) {
3992
4081
  // Splitting and looking up first part for forward compatibility, in case we wish to store additional information in a cookie
3993
- var parts = cookie.split("|" /* Pipe */);
4082
+ var parts = cookie.split("|" /* Constant.Pipe */);
3994
4083
  // For backward compatibility introduced in v0.6.18; following code can be removed with future iterations
3995
4084
  // 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)
3996
4085
  var count = 0;
3997
- for (var _i = 0, _a = document.cookie.split(";" /* Semicolon */); _i < _a.length; _i++) {
4086
+ for (var _i = 0, _a = document.cookie.split(";" /* Constant.Semicolon */); _i < _a.length; _i++) {
3998
4087
  var c = _a[_i];
3999
- count += c.split("=" /* Equals */)[0].trim() === "_clck" /* CookieKey */ ? 1 : 0;
4088
+ count += c.split("=" /* Constant.Equals */)[0].trim() === "_clck" /* Constant.CookieKey */ ? 1 : 0;
4000
4089
  }
4001
4090
  // Check if we either got version-less cookie value or saw multiple copies of the user cookie crumbs
4002
4091
  // In both these cases, we go ahead and delete the existing cookie set on current domain
4003
4092
  if (parts.length === 1 || count > 1) {
4004
- var deleted = "" + ";" /* Semicolon */ + "expires=" /* Expires */ + (new Date(0)).toUTCString() + ";path=/" /* Path */;
4093
+ var deleted = "".concat(";" /* Constant.Semicolon */).concat("expires=" /* Constant.Expires */).concat((new Date(0)).toUTCString()).concat(";path=/" /* Constant.Path */);
4005
4094
  // First, delete current user cookie which might be set on current sub-domain vs. root domain
4006
- document.cookie = "_clck" /* CookieKey */ + "=" + deleted;
4095
+ document.cookie = "".concat("_clck" /* Constant.CookieKey */, "=").concat(deleted);
4007
4096
  // Second, same thing for current session cookie so it can be re-written later with the root domain
4008
- document.cookie = "_clsk" /* SessionKey */ + "=" + deleted;
4097
+ document.cookie = "".concat("_clsk" /* Constant.SessionKey */, "=").concat(deleted);
4009
4098
  }
4010
4099
  // End code for backward compatibility
4011
4100
  // Read version information and timestamp from cookie, if available
@@ -4014,21 +4103,21 @@ function user() {
4014
4103
  }
4015
4104
  // Check if we have explicit consent to track this user
4016
4105
  if (parts.length > 3 && num(parts[3]) === 1) {
4017
- output.consent = 1 /* True */;
4106
+ output.consent = 1 /* BooleanFlag.True */;
4018
4107
  }
4019
4108
  // Set track configuration to true for this user if we have explicit consent, regardless of project setting
4020
- config$1.track = config$1.track || output.consent === 1 /* True */;
4109
+ config$1.track = config$1.track || output.consent === 1 /* BooleanFlag.True */;
4021
4110
  // Get user id from cookie only if we tracking is enabled, otherwise fallback to a random id
4022
4111
  output.id = config$1.track ? parts[0] : output.id;
4023
4112
  }
4024
4113
  return output;
4025
4114
  }
4026
4115
  function getCookie(key) {
4027
- if (supported(document, "cookie" /* Cookie */)) {
4028
- var cookies = document.cookie.split(";" /* Semicolon */);
4116
+ if (supported(document, "cookie" /* Constant.Cookie */)) {
4117
+ var cookies = document.cookie.split(";" /* Constant.Semicolon */);
4029
4118
  if (cookies) {
4030
4119
  for (var i = 0; i < cookies.length; i++) {
4031
- var pair = cookies[i].split("=" /* Equals */);
4120
+ var pair = cookies[i].split("=" /* Constant.Equals */);
4032
4121
  if (pair.length > 1 && pair[0] && pair[0].trim() === key) {
4033
4122
  return pair[1];
4034
4123
  }
@@ -4038,23 +4127,23 @@ function getCookie(key) {
4038
4127
  return null;
4039
4128
  }
4040
4129
  function setCookie(key, value, time) {
4041
- if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Cookie */))) {
4130
+ if (config$1.track && ((navigator && navigator.cookieEnabled) || supported(document, "cookie" /* Constant.Cookie */))) {
4042
4131
  var expiry = new Date();
4043
4132
  expiry.setDate(expiry.getDate() + time);
4044
- var expires = expiry ? "expires=" /* Expires */ + expiry.toUTCString() : "" /* Empty */;
4045
- var cookie = key + "=" + value + ";" /* Semicolon */ + expires + ";path=/" /* Path */;
4133
+ var expires = expiry ? "expires=" /* Constant.Expires */ + expiry.toUTCString() : "" /* Constant.Empty */;
4134
+ var cookie = "".concat(key, "=").concat(value).concat(";" /* Constant.Semicolon */).concat(expires).concat(";path=/" /* Constant.Path */);
4046
4135
  try {
4047
4136
  // Attempt to get the root domain only once and fall back to writing cookie on the current domain.
4048
4137
  if (rootDomain === null) {
4049
- var hostname = location.hostname ? location.hostname.split("." /* Dot */) : [];
4138
+ var hostname = location.hostname ? location.hostname.split("." /* Constant.Dot */) : [];
4050
4139
  // Walk backwards on a domain and attempt to set a cookie, until successful
4051
4140
  for (var i = hostname.length - 1; i >= 0; i--) {
4052
- rootDomain = "." + hostname[i] + (rootDomain ? rootDomain : "" /* Empty */);
4141
+ rootDomain = ".".concat(hostname[i]).concat(rootDomain ? rootDomain : "" /* Constant.Empty */);
4053
4142
  // We do not wish to attempt writing a cookie on the absolute last part of the domain, e.g. .com or .net.
4054
4143
  // So we start attempting after second-last part, e.g. .domain.com (PASS) or .co.uk (FAIL)
4055
4144
  if (i < hostname.length - 1) {
4056
4145
  // Write the cookie on the current computed top level domain
4057
- document.cookie = "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain;
4146
+ document.cookie = "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain);
4058
4147
  // Once written, check if the cookie exists and its value matches exactly with what we intended to set
4059
4148
  // Checking for exact value match helps us eliminate a corner case where the cookie may already be present with a different value
4060
4149
  // If the check is successful, no more action is required and we can return from the function since rootDomain cookie is already set
@@ -4066,13 +4155,13 @@ function setCookie(key, value, time) {
4066
4155
  }
4067
4156
  // Finally, if we were not successful and gone through all the options, play it safe and reset rootDomain to be empty
4068
4157
  // This forces our code to fall back to always writing cookie to the current domain
4069
- rootDomain = "" /* Empty */;
4158
+ rootDomain = "" /* Constant.Empty */;
4070
4159
  }
4071
4160
  }
4072
4161
  catch (_a) {
4073
- rootDomain = "" /* Empty */;
4162
+ rootDomain = "" /* Constant.Empty */;
4074
4163
  }
4075
- document.cookie = rootDomain ? "" + cookie + ";" /* Semicolon */ + "domain=" /* Domain */ + rootDomain : cookie;
4164
+ document.cookie = rootDomain ? "".concat(cookie).concat(";" /* Constant.Semicolon */).concat("domain=" /* Constant.Domain */).concat(rootDomain) : cookie;
4076
4165
  }
4077
4166
  }
4078
4167
 
@@ -4088,8 +4177,8 @@ function start$8() {
4088
4177
  userId: m.userId,
4089
4178
  sessionId: m.sessionId,
4090
4179
  pageNum: m.pageNum,
4091
- upload: 0 /* Async */,
4092
- end: 0 /* False */
4180
+ upload: 0 /* Upload.Async */,
4181
+ end: 0 /* BooleanFlag.False */
4093
4182
  };
4094
4183
  }
4095
4184
  function stop$7() {
@@ -4099,8 +4188,8 @@ function envelope(last) {
4099
4188
  data$1.start = data$1.start + data$1.duration;
4100
4189
  data$1.duration = time() - data$1.start;
4101
4190
  data$1.sequence++;
4102
- data$1.upload = last && "sendBeacon" in navigator ? 1 /* Beacon */ : 0 /* Async */;
4103
- data$1.end = last ? 1 /* True */ : 0 /* False */;
4191
+ data$1.upload = last && "sendBeacon" in navigator ? 1 /* Upload.Beacon */ : 0 /* Upload.Async */;
4192
+ data$1.end = last ? 1 /* BooleanFlag.True */ : 0 /* BooleanFlag.False */;
4104
4193
  return [
4105
4194
  data$1.version,
4106
4195
  data$1.sequence,
@@ -4153,10 +4242,10 @@ function measure (method) {
4153
4242
  throw report(ex);
4154
4243
  }
4155
4244
  var duration = performance.now() - start;
4156
- sum(4 /* TotalCost */, duration);
4157
- if (duration > 30 /* LongTask */) {
4158
- count$1(7 /* LongTaskCount */);
4159
- max(6 /* ThreadBlockedTime */, duration);
4245
+ sum(4 /* Metric.TotalCost */, duration);
4246
+ if (duration > 30 /* Setting.LongTask */) {
4247
+ count$1(7 /* Metric.LongTaskCount */);
4248
+ max(6 /* Metric.ThreadBlockedTime */, duration);
4160
4249
  }
4161
4250
  };
4162
4251
  }
@@ -4168,7 +4257,7 @@ function bind(target, event, listener, capture) {
4168
4257
  // Wrapping following lines inside try / catch to cover edge cases where we might try to access an inaccessible element.
4169
4258
  // E.g. Iframe may start off as same-origin but later turn into cross-origin, and the following lines will throw an exception.
4170
4259
  try {
4171
- target[api("addEventListener" /* AddEventListener */)](event, listener, capture);
4260
+ target[api("addEventListener" /* Constant.AddEventListener */)](event, listener, capture);
4172
4261
  bindings.push({ event: event, target: target, listener: listener, capture: capture });
4173
4262
  }
4174
4263
  catch ( /* do nothing */_a) { /* do nothing */ }
@@ -4179,7 +4268,7 @@ function reset$1() {
4179
4268
  var binding = bindings_1[_i];
4180
4269
  // Wrapping inside try / catch to avoid situations where the element may be destroyed before we get a chance to unbind
4181
4270
  try {
4182
- binding.target[api("removeEventListener" /* RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4271
+ binding.target[api("removeEventListener" /* Constant.RemoveEventListener */)](binding.event, binding.listener, binding.capture);
4183
4272
  }
4184
4273
  catch ( /* do nothing */_a) { /* do nothing */ }
4185
4274
  }
@@ -4216,8 +4305,8 @@ function start$7() {
4216
4305
  }
4217
4306
  }
4218
4307
  function check$1() {
4219
- if (count++ > 20 /* CallStackDepth */) {
4220
- log$1(4 /* CallStackDepth */, 0 /* Info */);
4308
+ if (count++ > 20 /* Setting.CallStackDepth */) {
4309
+ log$1(4 /* Code.CallStackDepth */, 0 /* Severity.Info */);
4221
4310
  return false;
4222
4311
  }
4223
4312
  return true;
@@ -4227,15 +4316,15 @@ function compute$1() {
4227
4316
  if (url !== getCurrentUrl()) {
4228
4317
  // If the url changed, start tracking it as a new page
4229
4318
  stop();
4230
- window.setTimeout(restart$1, 250 /* RestartDelay */);
4319
+ window.setTimeout(restart$1, 250 /* Setting.RestartDelay */);
4231
4320
  }
4232
4321
  }
4233
4322
  function restart$1() {
4234
4323
  start();
4235
- max(29 /* SinglePage */, 1 /* True */);
4324
+ max(29 /* Metric.SinglePage */, 1 /* BooleanFlag.True */);
4236
4325
  }
4237
4326
  function getCurrentUrl() {
4238
- return location.href ? location.href.replace(location.hash, "" /* Empty */) : location.href;
4327
+ return location.href ? location.href.replace(location.hash, "" /* Constant.Empty */) : location.href;
4239
4328
  }
4240
4329
  function stop$6() {
4241
4330
  url = null;
@@ -4245,8 +4334,8 @@ function stop$6() {
4245
4334
  var status = false;
4246
4335
  function start$6() {
4247
4336
  status = true;
4248
- start$F();
4249
- reset$j();
4337
+ start$G();
4338
+ reset$k();
4250
4339
  reset$1();
4251
4340
  reset$2();
4252
4341
  start$7();
@@ -4255,8 +4344,8 @@ function stop$5() {
4255
4344
  stop$6();
4256
4345
  reset$2();
4257
4346
  reset$1();
4258
- reset$j();
4259
- stop$B();
4347
+ reset$k();
4348
+ stop$C();
4260
4349
  status = false;
4261
4350
  }
4262
4351
  function active() {
@@ -4298,7 +4387,7 @@ function config(override) {
4298
4387
  // not holding the session during inactive time periods.
4299
4388
  function suspend() {
4300
4389
  if (status) {
4301
- event("clarity" /* Clarity */, "suspend" /* Suspend */);
4390
+ event("clarity" /* Constant.Clarity */, "suspend" /* Constant.Suspend */);
4302
4391
  stop();
4303
4392
  ["mousemove", "touchstart"].forEach(function (x) { return bind(document, x, restart); });
4304
4393
  ["resize", "scroll", "pageshow"].forEach(function (x) { return bind(window, x, restart); });
@@ -4306,11 +4395,11 @@ function suspend() {
4306
4395
  }
4307
4396
  function restart() {
4308
4397
  start();
4309
- event("clarity" /* Clarity */, "restart" /* Restart */);
4398
+ event("clarity" /* Constant.Clarity */, "restart" /* Constant.Restart */);
4310
4399
  }
4311
4400
 
4312
4401
  function start$5() {
4313
- start$x();
4402
+ start$y();
4314
4403
  start$e();
4315
4404
  start$d();
4316
4405
  }
@@ -4325,7 +4414,7 @@ var diagnostic = /*#__PURE__*/Object.freeze({
4325
4414
  });
4326
4415
 
4327
4416
  function start$4() {
4328
- schedule$1(discover, 1 /* High */).then(function () {
4417
+ schedule$1(discover, 1 /* Priority.High */).then(function () {
4329
4418
  measure(compute$7)();
4330
4419
  measure(compute$6)();
4331
4420
  });
@@ -4337,15 +4426,15 @@ function discover() {
4337
4426
  switch (_a.label) {
4338
4427
  case 0:
4339
4428
  ts = time();
4340
- timer = { id: id(), cost: 3 /* LayoutCost */ };
4341
- start$w(timer);
4342
- return [4 /*yield*/, traverse(document, timer, 0 /* Discover */)];
4429
+ timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
4430
+ start$x(timer);
4431
+ return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
4343
4432
  case 1:
4344
4433
  _a.sent();
4345
- return [4 /*yield*/, encode$4(5 /* Discover */, timer, ts)];
4434
+ return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
4346
4435
  case 2:
4347
4436
  _a.sent();
4348
- stop$t(timer);
4437
+ stop$u(timer);
4349
4438
  return [2 /*return*/];
4350
4439
  }
4351
4440
  });
@@ -4355,7 +4444,7 @@ function discover() {
4355
4444
  function start$3() {
4356
4445
  // The order below is important
4357
4446
  // and is determined by interdependencies of modules
4358
- start$v();
4447
+ start$w();
4359
4448
  start$h();
4360
4449
  start$i();
4361
4450
  start$j();
@@ -4371,7 +4460,8 @@ function stop$3() {
4371
4460
  var layout = /*#__PURE__*/Object.freeze({
4372
4461
  __proto__: null,
4373
4462
  start: start$3,
4374
- stop: stop$3
4463
+ stop: stop$3,
4464
+ hashText: hashText
4375
4465
  });
4376
4466
 
4377
4467
  function encode (type) {
@@ -4381,7 +4471,7 @@ function encode (type) {
4381
4471
  t = time();
4382
4472
  tokens = [t, type];
4383
4473
  switch (type) {
4384
- case 29 /* Navigation */:
4474
+ case 29 /* Event.Navigation */:
4385
4475
  tokens.push(data.fetchStart);
4386
4476
  tokens.push(data.connectStart);
4387
4477
  tokens.push(data.connectEnd);
@@ -4430,12 +4520,16 @@ function compute(entry) {
4430
4520
  encodedSize: entry.encodedBodySize ? entry.encodedBodySize : 0,
4431
4521
  decodedSize: entry.decodedBodySize ? entry.decodedBodySize : 0
4432
4522
  };
4433
- encode(29 /* Navigation */);
4523
+ encode(29 /* Event.Navigation */);
4434
4524
  }
4435
4525
 
4436
4526
  var observer;
4437
- var types = ["navigation" /* Navigation */, "resource" /* Resource */, "longtask" /* LongTask */, "first-input" /* FID */, "layout-shift" /* CLS */, "largest-contentful-paint" /* LCP */];
4527
+ var types = ["navigation" /* Constant.Navigation */, "resource" /* Constant.Resource */, "longtask" /* Constant.LongTask */, "first-input" /* Constant.FID */, "layout-shift" /* Constant.CLS */, "largest-contentful-paint" /* Constant.LCP */];
4438
4528
  function start$2() {
4529
+ // Capture connection properties, if available
4530
+ if (navigator && "connection" in navigator) {
4531
+ log(27 /* Dimension.ConnectionType */, navigator["connection"]["effectiveType"]);
4532
+ }
4439
4533
  // Check the browser support performance observer as a pre-requisite for any performance measurement
4440
4534
  if (window["PerformanceObserver"] && PerformanceObserver.supportedEntryTypes) {
4441
4535
  // Start monitoring performance data after page has finished loading.
@@ -4449,7 +4543,7 @@ function start$2() {
4449
4543
  }
4450
4544
  }
4451
4545
  else {
4452
- log$1(3 /* PerformanceObserver */, 0 /* Info */);
4546
+ log$1(3 /* Code.PerformanceObserver */, 0 /* Severity.Info */);
4453
4547
  }
4454
4548
  }
4455
4549
  function observe() {
@@ -4469,15 +4563,15 @@ function observe() {
4469
4563
  if (PerformanceObserver.supportedEntryTypes.indexOf(x) >= 0) {
4470
4564
  // Initialize CLS with a value of zero. It's possible (and recommended) for sites to not have any cumulative layout shift.
4471
4565
  // In those cases, we want to still initialize the metric in Clarity
4472
- if (x === "layout-shift" /* CLS */) {
4473
- sum(9 /* CumulativeLayoutShift */, 0);
4566
+ if (x === "layout-shift" /* Constant.CLS */) {
4567
+ sum(9 /* Metric.CumulativeLayoutShift */, 0);
4474
4568
  }
4475
4569
  observer.observe({ type: x, buffered: true });
4476
4570
  }
4477
4571
  }
4478
4572
  }
4479
4573
  catch (_a) {
4480
- log$1(3 /* PerformanceObserver */, 1 /* Warning */);
4574
+ log$1(3 /* Code.PerformanceObserver */, 1 /* Severity.Warning */);
4481
4575
  }
4482
4576
  }
4483
4577
  function handle(entries) {
@@ -4488,41 +4582,41 @@ function process(entries) {
4488
4582
  for (var i = 0; i < entries.length; i++) {
4489
4583
  var entry = entries[i];
4490
4584
  switch (entry.entryType) {
4491
- case "navigation" /* Navigation */:
4585
+ case "navigation" /* Constant.Navigation */:
4492
4586
  compute(entry);
4493
4587
  break;
4494
- case "resource" /* Resource */:
4588
+ case "resource" /* Constant.Resource */:
4495
4589
  var name_1 = entry.name;
4496
- log(4 /* NetworkHosts */, host(name_1));
4590
+ log(4 /* Dimension.NetworkHosts */, host(name_1));
4497
4591
  if (name_1 === config$1.upload || name_1 === config$1.fallback) {
4498
- max(28 /* UploadTime */, entry.duration);
4592
+ max(28 /* Metric.UploadTime */, entry.duration);
4499
4593
  }
4500
4594
  break;
4501
- case "longtask" /* LongTask */:
4502
- count$1(7 /* LongTaskCount */);
4595
+ case "longtask" /* Constant.LongTask */:
4596
+ count$1(7 /* Metric.LongTaskCount */);
4503
4597
  break;
4504
- case "first-input" /* FID */:
4598
+ case "first-input" /* Constant.FID */:
4505
4599
  if (visible) {
4506
- max(10 /* FirstInputDelay */, entry["processingStart"] - entry.startTime);
4600
+ max(10 /* Metric.FirstInputDelay */, entry["processingStart"] - entry.startTime);
4507
4601
  }
4508
4602
  break;
4509
- case "layout-shift" /* CLS */:
4603
+ case "layout-shift" /* Constant.CLS */:
4510
4604
  // Scale the value to avoid sending back floating point number
4511
4605
  if (visible && !entry["hadRecentInput"]) {
4512
- sum(9 /* CumulativeLayoutShift */, entry["value"] * 1000);
4606
+ sum(9 /* Metric.CumulativeLayoutShift */, entry["value"] * 1000);
4513
4607
  }
4514
4608
  break;
4515
- case "largest-contentful-paint" /* LCP */:
4609
+ case "largest-contentful-paint" /* Constant.LCP */:
4516
4610
  if (visible) {
4517
- max(8 /* LargestPaint */, entry.startTime);
4611
+ max(8 /* Metric.LargestPaint */, entry.startTime);
4518
4612
  }
4519
4613
  break;
4520
4614
  }
4521
4615
  }
4522
- if (performance && "memory" /* Memory */ in performance && performance["memory" /* Memory */].usedJSHeapSize) {
4616
+ if (performance && "memory" /* Constant.Memory */ in performance && performance["memory" /* Constant.Memory */].usedJSHeapSize) {
4523
4617
  // Track consumed memory (MBs) where "memory" API is available
4524
4618
  // Reference: https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
4525
- max(30 /* UsedMemory */, Math.abs(performance["memory" /* Memory */].usedJSHeapSize / 1048576 /* MegaByte */));
4619
+ max(30 /* Metric.UsedMemory */, Math.abs(performance["memory" /* Constant.Memory */].usedJSHeapSize / 1048576 /* Setting.MegaByte */));
4526
4620
  }
4527
4621
  }
4528
4622
  function stop$2() {
@@ -4559,7 +4653,7 @@ function start(config$1) {
4559
4653
  if (check()) {
4560
4654
  config(config$1);
4561
4655
  start$6();
4562
- start$y();
4656
+ start$z();
4563
4657
  modules.forEach(function (x) { return measure(x.start)(); });
4564
4658
  }
4565
4659
  }
@@ -4570,7 +4664,7 @@ function start(config$1) {
4570
4664
  // performance impact even further. For reference, we are talking single digit milliseconds optimization here, not seconds.
4571
4665
  function pause() {
4572
4666
  if (active()) {
4573
- event("clarity" /* Clarity */, "pause" /* Pause */);
4667
+ event("clarity" /* Constant.Clarity */, "pause" /* Constant.Pause */);
4574
4668
  pause$1();
4575
4669
  }
4576
4670
  }
@@ -4578,14 +4672,14 @@ function pause() {
4578
4672
  function resume() {
4579
4673
  if (active()) {
4580
4674
  resume$1();
4581
- event("clarity" /* Clarity */, "resume" /* Resume */);
4675
+ event("clarity" /* Constant.Clarity */, "resume" /* Constant.Resume */);
4582
4676
  }
4583
4677
  }
4584
4678
  function stop() {
4585
4679
  if (active()) {
4586
4680
  // Stop modules in the reverse order of their initialization
4587
4681
  modules.slice().reverse().forEach(function (x) { return measure(x.stop)(); });
4588
- stop$u();
4682
+ stop$v();
4589
4683
  stop$5();
4590
4684
  }
4591
4685
  }
@@ -4602,7 +4696,8 @@ var clarity = /*#__PURE__*/Object.freeze({
4602
4696
  identify: identify,
4603
4697
  set: set,
4604
4698
  upgrade: upgrade,
4605
- metadata: metadata
4699
+ metadata: metadata,
4700
+ hashText: hashText
4606
4701
  });
4607
4702
 
4608
4703
  var helper = { hash: hash, selector: selector, get: get, getNode: getNode, lookup: lookup };