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