@tracelog/lib 0.8.1 → 0.8.2

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.
Files changed (77) hide show
  1. package/dist/browser/tracelog.esm.js +112 -82
  2. package/dist/browser/tracelog.esm.js.map +1 -1
  3. package/dist/browser/tracelog.js +2 -2
  4. package/dist/browser/tracelog.js.map +1 -1
  5. package/dist/cjs/app.constants.d.ts +1 -0
  6. package/dist/cjs/app.constants.d.ts.map +1 -1
  7. package/dist/cjs/app.constants.js +16 -1
  8. package/dist/cjs/app.constants.js.map +1 -1
  9. package/dist/cjs/constants/config.constants.d.ts +7 -0
  10. package/dist/cjs/constants/config.constants.d.ts.map +1 -1
  11. package/dist/cjs/constants/config.constants.js +11 -3
  12. package/dist/cjs/constants/config.constants.js.map +1 -1
  13. package/dist/cjs/handlers/scroll.handler.d.ts.map +1 -1
  14. package/dist/cjs/handlers/scroll.handler.js +3 -1
  15. package/dist/cjs/handlers/scroll.handler.js.map +1 -1
  16. package/dist/cjs/integrations/google-analytics.integration.d.ts.map +1 -1
  17. package/dist/cjs/integrations/google-analytics.integration.js +6 -2
  18. package/dist/cjs/integrations/google-analytics.integration.js.map +1 -1
  19. package/dist/cjs/managers/sender.manager.d.ts.map +1 -1
  20. package/dist/cjs/managers/sender.manager.js +3 -1
  21. package/dist/cjs/managers/sender.manager.js.map +1 -1
  22. package/dist/cjs/managers/session.manager.d.ts.map +1 -1
  23. package/dist/cjs/managers/session.manager.js +3 -1
  24. package/dist/cjs/managers/session.manager.js.map +1 -1
  25. package/dist/cjs/managers/storage.manager.d.ts.map +1 -1
  26. package/dist/cjs/managers/storage.manager.js +3 -1
  27. package/dist/cjs/managers/storage.manager.js.map +1 -1
  28. package/dist/cjs/utils/emitter.utils.d.ts.map +1 -1
  29. package/dist/cjs/utils/emitter.utils.js +3 -1
  30. package/dist/cjs/utils/emitter.utils.js.map +1 -1
  31. package/dist/cjs/utils/security/sanitize.utils.d.ts.map +1 -1
  32. package/dist/cjs/utils/security/sanitize.utils.js +1 -1
  33. package/dist/cjs/utils/security/sanitize.utils.js.map +1 -1
  34. package/dist/cjs/utils/validations/metadata-validations.utils.d.ts.map +1 -1
  35. package/dist/cjs/utils/validations/metadata-validations.utils.js +2 -2
  36. package/dist/cjs/utils/validations/metadata-validations.utils.js.map +1 -1
  37. package/dist/cjs/utils/validations/type-guards.utils.d.ts +1 -1
  38. package/dist/cjs/utils/validations/type-guards.utils.d.ts.map +1 -1
  39. package/dist/cjs/utils/validations/type-guards.utils.js +2 -3
  40. package/dist/cjs/utils/validations/type-guards.utils.js.map +1 -1
  41. package/dist/esm/app.constants.d.ts +1 -0
  42. package/dist/esm/app.constants.d.ts.map +1 -1
  43. package/dist/esm/app.constants.js +1 -0
  44. package/dist/esm/app.constants.js.map +1 -1
  45. package/dist/esm/constants/config.constants.d.ts +7 -0
  46. package/dist/esm/constants/config.constants.d.ts.map +1 -1
  47. package/dist/esm/constants/config.constants.js +9 -1
  48. package/dist/esm/constants/config.constants.js.map +1 -1
  49. package/dist/esm/handlers/scroll.handler.d.ts.map +1 -1
  50. package/dist/esm/handlers/scroll.handler.js +3 -1
  51. package/dist/esm/handlers/scroll.handler.js.map +1 -1
  52. package/dist/esm/integrations/google-analytics.integration.d.ts.map +1 -1
  53. package/dist/esm/integrations/google-analytics.integration.js +6 -2
  54. package/dist/esm/integrations/google-analytics.integration.js.map +1 -1
  55. package/dist/esm/managers/sender.manager.d.ts.map +1 -1
  56. package/dist/esm/managers/sender.manager.js +3 -1
  57. package/dist/esm/managers/sender.manager.js.map +1 -1
  58. package/dist/esm/managers/session.manager.d.ts.map +1 -1
  59. package/dist/esm/managers/session.manager.js +3 -1
  60. package/dist/esm/managers/session.manager.js.map +1 -1
  61. package/dist/esm/managers/storage.manager.d.ts.map +1 -1
  62. package/dist/esm/managers/storage.manager.js +3 -1
  63. package/dist/esm/managers/storage.manager.js.map +1 -1
  64. package/dist/esm/utils/emitter.utils.d.ts.map +1 -1
  65. package/dist/esm/utils/emitter.utils.js +3 -1
  66. package/dist/esm/utils/emitter.utils.js.map +1 -1
  67. package/dist/esm/utils/security/sanitize.utils.d.ts.map +1 -1
  68. package/dist/esm/utils/security/sanitize.utils.js +2 -2
  69. package/dist/esm/utils/security/sanitize.utils.js.map +1 -1
  70. package/dist/esm/utils/validations/metadata-validations.utils.d.ts.map +1 -1
  71. package/dist/esm/utils/validations/metadata-validations.utils.js +3 -3
  72. package/dist/esm/utils/validations/metadata-validations.utils.js.map +1 -1
  73. package/dist/esm/utils/validations/type-guards.utils.d.ts +1 -1
  74. package/dist/esm/utils/validations/type-guards.utils.d.ts.map +1 -1
  75. package/dist/esm/utils/validations/type-guards.utils.js +3 -4
  76. package/dist/esm/utils/validations/type-guards.utils.js.map +1 -1
  77. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ const Ft = 120, Gt = 8192, $t = 10, zt = 10, Bt = 20, Qt = 1, Xt = 50, jt = 100, Wt = 2e3, Yt = 51200, Kt = 2;
2
+ const qt = 1e3, Zt = 500, Jt = 100;
1
3
  const P = "data-tlog", Oe = [
2
4
  "button",
3
5
  "a",
@@ -49,10 +51,10 @@ const m = {
49
51
  /<embed\b[^>]*>/gi,
50
52
  /<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
51
53
  ];
52
- var W = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))(W || {}), _ = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(_ || {}), X = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(X || {});
53
- class y extends Error {
54
+ var j = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))(j || {}), _ = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(_ || {}), W = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(W || {});
55
+ class A extends Error {
54
56
  constructor(e, t) {
55
- super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, y);
57
+ super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, A);
56
58
  }
57
59
  }
58
60
  var d = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.SESSION_END = "session_end", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r))(d || {}), k = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(k || {}), C = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(C || {}), R = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(R || {});
@@ -61,7 +63,7 @@ class b extends Error {
61
63
  super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
62
64
  }
63
65
  }
64
- class A extends b {
66
+ class y extends b {
65
67
  constructor(e, t = "config") {
66
68
  super(e, "APP_CONFIG_INVALID", t);
67
69
  }
@@ -81,7 +83,7 @@ class v extends b {
81
83
  super(e, "INTEGRATION_INVALID", t);
82
84
  }
83
85
  }
84
- class Ft extends b {
86
+ class er extends b {
85
87
  constructor(e, t, s = "runtime") {
86
88
  super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
87
89
  }
@@ -131,7 +133,7 @@ const xe = () => {
131
133
  INP: 200,
132
134
  TTFB: 800,
133
135
  LONG_TASK: 50
134
- }, Qe = 1e3, ve = [
136
+ }, Be = 1e3, ve = [
135
137
  // Email addresses
136
138
  /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
137
139
  // US Phone numbers (various formats)
@@ -146,10 +148,10 @@ const xe = () => {
146
148
  /Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
147
149
  // Passwords in connection strings (protocol://user:password@host)
148
150
  /:\/\/[^:/]+:([^@]+)@/gi
149
- ], ue = 500, de = 5e3, U = 50, je = U * 2, Be = 6e4, he = "tlog_mode", We = "qa", Xe = () => {
151
+ ], ue = 500, de = 5e3, U = 50, Qe = U * 2, Xe = 6e4, he = "tlog_mode", je = "qa", We = () => {
150
152
  if (sessionStorage.getItem(ce) === "true")
151
153
  return !0;
152
- const e = new URLSearchParams(window.location.search), s = e.get(he) === We;
154
+ const e = new URLSearchParams(window.location.search), s = e.get(he) === je;
153
155
  if (s) {
154
156
  sessionStorage.setItem(ce, "true"), e.delete(he);
155
157
  const n = e.toString(), i = `${window.location.pathname}${n ? "?" + n : ""}${window.location.hash}`;
@@ -274,18 +276,18 @@ const xe = () => {
274
276
  }
275
277
  }, Je = (r) => {
276
278
  if (r !== void 0 && (r === null || typeof r != "object"))
277
- throw new A("Configuration must be an object", "config");
279
+ throw new y("Configuration must be an object", "config");
278
280
  if (r) {
279
281
  if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
280
282
  throw new ke(m.INVALID_SESSION_TIMEOUT, "config");
281
283
  if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
282
- throw new A(m.INVALID_GLOBAL_METADATA, "config");
284
+ throw new y(m.INVALID_GLOBAL_METADATA, "config");
283
285
  if (r.scrollContainerSelectors !== void 0 && tt(r.scrollContainerSelectors), r.integrations && rt(r.integrations), r.sensitiveQueryParams !== void 0) {
284
286
  if (!Array.isArray(r.sensitiveQueryParams))
285
- throw new A(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
287
+ throw new y(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
286
288
  for (const e of r.sensitiveQueryParams)
287
289
  if (typeof e != "string")
288
- throw new A("All sensitive query params must be strings", "config");
290
+ throw new y("All sensitive query params must be strings", "config");
289
291
  }
290
292
  if (r.errorSampling !== void 0 && (typeof r.errorSampling != "number" || r.errorSampling < 0 || r.errorSampling > 1))
291
293
  throw new le(m.INVALID_ERROR_SAMPLING_RATE, "config");
@@ -314,7 +316,7 @@ const xe = () => {
314
316
  type: typeof t,
315
317
  isEmpty: t === "" || typeof t == "string" && t.trim() === ""
316
318
  }
317
- }), new A(m.INVALID_SCROLL_CONTAINER_SELECTORS, "config");
319
+ }), new y(m.INVALID_SCROLL_CONTAINER_SELECTORS, "config");
318
320
  if (!et(t))
319
321
  throw o("error", "Invalid or potentially unsafe CSS selector", {
320
322
  showToClient: !0,
@@ -322,7 +324,7 @@ const xe = () => {
322
324
  selector: t,
323
325
  reason: "Failed security validation"
324
326
  }
325
- }), new A("Invalid or potentially unsafe CSS selector", "config");
327
+ }), new y("Invalid or potentially unsafe CSS selector", "config");
326
328
  }
327
329
  }, rt = (r) => {
328
330
  if (r) {
@@ -528,22 +530,24 @@ class lt {
528
530
  }
529
531
  emit(e, t) {
530
532
  const s = this.listeners.get(e);
531
- s && s.forEach((n) => n(t));
533
+ s && s.forEach((n) => {
534
+ n(t);
535
+ });
532
536
  }
533
537
  removeAllListeners() {
534
538
  this.listeners.clear();
535
539
  }
536
540
  }
537
- const Q = {};
541
+ const B = {};
538
542
  class f {
539
543
  get(e) {
540
- return Q[e];
544
+ return B[e];
541
545
  }
542
546
  set(e, t) {
543
- Q[e] = t;
547
+ B[e] = t;
544
548
  }
545
549
  getState() {
546
- return { ...Q };
550
+ return { ...B };
547
551
  }
548
552
  }
549
553
  class ct extends f {
@@ -557,7 +561,7 @@ class ct extends f {
557
561
  return Ge(e);
558
562
  }
559
563
  sendEventsQueueSync(e) {
560
- return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl === W.Fail ? (o("warn", "Fail mode: simulating network failure (sync)", {
564
+ return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail ? (o("warn", "Fail mode: simulating network failure (sync)", {
561
565
  data: { events: e.events.length }
562
566
  }), !1) : this.sendQueueSyncInternal(e);
563
567
  }
@@ -566,7 +570,7 @@ class ct extends f {
566
570
  const s = await this.send(e);
567
571
  return s ? (this.clearPersistedEvents(), t?.onSuccess?.(e.events.length, e.events, e)) : (this.persistEvents(e), t?.onFailure?.()), s;
568
572
  } catch (s) {
569
- return s instanceof y ? (this.logPermanentError("Permanent error, not retrying", s), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
573
+ return s instanceof A ? (this.logPermanentError("Permanent error, not retrying", s), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
570
574
  }
571
575
  }
572
576
  async recoverPersistedEvents(e) {
@@ -579,7 +583,7 @@ class ct extends f {
579
583
  const s = this.createRecoveryBody(t);
580
584
  await this.send(s) ? (this.clearPersistedEvents(), e?.onSuccess?.(t.events.length, t.events, s)) : e?.onFailure?.();
581
585
  } catch (t) {
582
- if (t instanceof y) {
586
+ if (t instanceof A) {
583
587
  this.logPermanentError("Permanent error during recovery, clearing persisted events", t), this.clearPersistedEvents(), e?.onFailure?.();
584
588
  return;
585
589
  }
@@ -591,7 +595,7 @@ class ct extends f {
591
595
  async send(e) {
592
596
  if (this.shouldSkipSend())
593
597
  return this.simulateSuccessfulSend();
594
- if (this.get("config")?.integrations?.custom?.collectApiUrl === W.Fail)
598
+ if (this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail)
595
599
  return o("warn", "Fail mode: simulating network failure", {
596
600
  data: { events: e.events.length }
597
601
  }), !1;
@@ -599,7 +603,7 @@ class ct extends f {
599
603
  try {
600
604
  return (await this.sendWithTimeout(s, n)).ok;
601
605
  } catch (i) {
602
- if (i instanceof y)
606
+ if (i instanceof A)
603
607
  throw i;
604
608
  return o("error", "Send request failed", {
605
609
  error: i,
@@ -611,7 +615,9 @@ class ct extends f {
611
615
  }
612
616
  }
613
617
  async sendWithTimeout(e, t) {
614
- const s = new AbortController(), n = setTimeout(() => s.abort(), 1e4);
618
+ const s = new AbortController(), n = setTimeout(() => {
619
+ s.abort();
620
+ }, 1e4);
615
621
  try {
616
622
  const i = await fetch(e, {
617
623
  method: "POST",
@@ -624,7 +630,7 @@ class ct extends f {
624
630
  }
625
631
  });
626
632
  if (!i.ok)
627
- throw i.status >= 400 && i.status < 500 ? new y(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
633
+ throw i.status >= 400 && i.status < 500 ? new A(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
628
634
  return i;
629
635
  } finally {
630
636
  clearTimeout(n);
@@ -707,7 +713,7 @@ class ct extends f {
707
713
  }
708
714
  logPermanentError(e, t) {
709
715
  const s = Date.now();
710
- (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= Be) && (o("error", e, {
716
+ (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= Xe) && (o("error", e, {
711
717
  data: { status: t.statusCode, message: t.message }
712
718
  }), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
713
719
  }
@@ -963,10 +969,10 @@ class ut extends f {
963
969
  this.eventsQueue = this.eventsQueue.filter((s) => !t.has(s.id));
964
970
  }
965
971
  emitEvent(e) {
966
- this.emitter && this.emitter.emit(X.EVENT, e);
972
+ this.emitter && this.emitter.emit(W.EVENT, e);
967
973
  }
968
974
  emitEventsQueue(e) {
969
- this.emitter && this.emitter.emit(X.QUEUE, e);
975
+ this.emitter && this.emitter.emit(W.QUEUE, e);
970
976
  }
971
977
  }
972
978
  class dt {
@@ -1113,7 +1119,9 @@ class ht extends f {
1113
1119
  this.sessionTimeoutId && (clearTimeout(this.sessionTimeoutId), this.sessionTimeoutId = null);
1114
1120
  }
1115
1121
  setupActivityListeners() {
1116
- this.activityHandler = () => this.resetSessionTimeout(), document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
1122
+ this.activityHandler = () => {
1123
+ this.resetSessionTimeout();
1124
+ }, document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
1117
1125
  }
1118
1126
  cleanupActivityListeners() {
1119
1127
  this.activityHandler && (document.removeEventListener("click", this.activityHandler), document.removeEventListener("keydown", this.activityHandler), document.removeEventListener("scroll", this.activityHandler), this.activityHandler = null);
@@ -1398,7 +1406,9 @@ class St extends f {
1398
1406
  return;
1399
1407
  }
1400
1408
  if (t < 5) {
1401
- setTimeout(() => this.trySetupContainers(e, t + 1), 200);
1409
+ setTimeout(() => {
1410
+ this.trySetupContainers(e, t + 1);
1411
+ }, 200);
1402
1412
  return;
1403
1413
  }
1404
1414
  this.containers.length === 0 && this.setupScrollContainer(window);
@@ -1544,7 +1554,11 @@ class mt extends f {
1544
1554
  async loadScript(e) {
1545
1555
  return new Promise((t, s) => {
1546
1556
  const n = document.createElement("script");
1547
- n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => t(), n.onerror = () => s(new Error("Failed to load Google Analytics script")), document.head.appendChild(n);
1557
+ n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => {
1558
+ t();
1559
+ }, n.onerror = () => {
1560
+ s(new Error("Failed to load Google Analytics script"));
1561
+ }, document.head.appendChild(n);
1548
1562
  });
1549
1563
  }
1550
1564
  configureGtag(e, t) {
@@ -1635,7 +1649,9 @@ class pt {
1635
1649
  const s = this.storage.key(t);
1636
1650
  s?.startsWith("tracelog_") && e.push(s);
1637
1651
  }
1638
- e.forEach((t) => this.storage.removeItem(t)), this.fallbackStorage.clear();
1652
+ e.forEach((t) => {
1653
+ this.storage.removeItem(t);
1654
+ }), this.fallbackStorage.clear();
1639
1655
  } catch (e) {
1640
1656
  o("error", "Failed to clear storage", { error: e }), this.fallbackStorage.clear();
1641
1657
  }
@@ -1833,7 +1849,7 @@ class _t extends f {
1833
1849
  const t = e.getEntries();
1834
1850
  for (const s of t) {
1835
1851
  const n = Number(s.duration.toFixed(2)), i = Date.now();
1836
- i - this.lastLongTaskSentAt >= Qe && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
1852
+ i - this.lastLongTaskSentAt >= Be && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
1837
1853
  }
1838
1854
  },
1839
1855
  { type: "longtask", buffered: !0 }
@@ -1980,7 +1996,7 @@ class Tt extends f {
1980
1996
  }
1981
1997
  shouldSuppressError(e, t) {
1982
1998
  const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
1983
- return i && s - i < de ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > je ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > U && this.pruneOldErrors(), !1));
1999
+ return i && s - i < de ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Qe ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > U && this.pruneOldErrors(), !1));
1984
2000
  }
1985
2001
  pruneOldErrors() {
1986
2002
  const e = Date.now();
@@ -2061,7 +2077,7 @@ class vt extends f {
2061
2077
  this.set("device", n);
2062
2078
  const i = K(window.location.href, e.sensitiveQueryParams);
2063
2079
  this.set("pageUrl", i);
2064
- const a = Xe() ? R.QA : void 0;
2080
+ const a = We() ? R.QA : void 0;
2065
2081
  a && this.set("mode", a);
2066
2082
  }
2067
2083
  async setupIntegrations() {
@@ -2120,13 +2136,13 @@ const It = async (r) => {
2120
2136
  M = !1;
2121
2137
  }
2122
2138
  }
2123
- }, yt = (r, e) => {
2139
+ }, At = (r, e) => {
2124
2140
  if (!h)
2125
2141
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
2126
2142
  if (H)
2127
2143
  throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
2128
2144
  h.sendCustomEvent(r, e);
2129
- }, At = (r, e) => {
2145
+ }, yt = (r, e) => {
2130
2146
  if (!h || M) {
2131
2147
  I.push({ event: r, callback: e });
2132
2148
  return;
@@ -2152,13 +2168,13 @@ const It = async (r) => {
2152
2168
  } finally {
2153
2169
  H = !1;
2154
2170
  }
2155
- }, Gt = {
2171
+ }, tr = {
2156
2172
  WEB_VITALS_THRESHOLDS: Te
2157
2173
  // Business thresholds for performance analysis
2158
- }, $t = {
2174
+ }, rr = {
2159
2175
  PII_PATTERNS: ve
2160
2176
  // Patterns for sensitive data protection
2161
- }, zt = {
2177
+ }, sr = {
2162
2178
  LOW_ACTIVITY_EVENT_COUNT: 50,
2163
2179
  HIGH_ACTIVITY_EVENT_COUNT: 1e3,
2164
2180
  MIN_EVENTS_FOR_DYNAMIC_CALCULATION: 100,
@@ -2168,7 +2184,7 @@ const It = async (r) => {
2168
2184
  MIN_ENGAGED_SESSION_DURATION_MS: 30 * 1e3,
2169
2185
  MIN_SCROLL_DEPTH_ENGAGEMENT: 25
2170
2186
  // 25% scroll depth for engagement
2171
- }, Qt = {
2187
+ }, nr = {
2172
2188
  INACTIVITY_TIMEOUT_MS: 30 * 60 * 1e3,
2173
2189
  // 30min for analytics (vs 15min client)
2174
2190
  SHORT_SESSION_THRESHOLD_MS: 30 * 1e3,
@@ -2176,20 +2192,20 @@ const It = async (r) => {
2176
2192
  LONG_SESSION_THRESHOLD_MS: 30 * 60 * 1e3,
2177
2193
  MAX_REALISTIC_SESSION_DURATION_MS: 8 * 60 * 60 * 1e3
2178
2194
  // Filter outliers
2179
- }, jt = {
2195
+ }, ir = {
2180
2196
  MOBILE_MAX_WIDTH: 768,
2181
2197
  TABLET_MAX_WIDTH: 1024,
2182
2198
  MOBILE_PERFORMANCE_FACTOR: 1.5,
2183
2199
  // Mobile typically 1.5x slower
2184
2200
  TABLET_PERFORMANCE_FACTOR: 1.2
2185
- }, Bt = {
2201
+ }, ar = {
2186
2202
  MIN_TEXT_LENGTH_FOR_ANALYSIS: 10,
2187
2203
  MIN_CLICKS_FOR_HOT_ELEMENT: 10,
2188
2204
  // Popular element threshold
2189
2205
  MIN_SCROLL_COMPLETION_PERCENT: 80,
2190
2206
  // Page consumption threshold
2191
2207
  MIN_TIME_ON_PAGE_FOR_READ_MS: 15 * 1e3
2192
- }, Wt = {
2208
+ }, or = {
2193
2209
  SIGNIFICANT_CHANGE_PERCENT: 20,
2194
2210
  MAJOR_CHANGE_PERCENT: 50,
2195
2211
  MIN_EVENTS_FOR_INSIGHT: 100,
@@ -2199,19 +2215,19 @@ const It = async (r) => {
2199
2215
  LOW_ERROR_RATE_PERCENT: 1,
2200
2216
  HIGH_ERROR_RATE_PERCENT: 5,
2201
2217
  CRITICAL_ERROR_RATE_PERCENT: 10
2202
- }, Xt = {
2218
+ }, lr = {
2203
2219
  SHORT_TERM_TREND_HOURS: 24,
2204
2220
  MEDIUM_TERM_TREND_DAYS: 7,
2205
2221
  LONG_TERM_TREND_DAYS: 30,
2206
2222
  MIN_DATA_POINTS_FOR_TREND: 5,
2207
2223
  WEEKLY_PATTERN_MIN_WEEKS: 4,
2208
2224
  DAILY_PATTERN_MIN_DAYS: 14
2209
- }, Yt = {
2225
+ }, cr = {
2210
2226
  MIN_SEGMENT_SIZE: 10,
2211
2227
  MIN_COHORT_SIZE: 5,
2212
2228
  COHORT_ANALYSIS_DAYS: [1, 3, 7, 14, 30],
2213
2229
  MIN_FUNNEL_EVENTS: 20
2214
- }, Kt = {
2230
+ }, ur = {
2215
2231
  DEFAULT_EVENTS_LIMIT: 5,
2216
2232
  DEFAULT_SESSIONS_LIMIT: 5,
2217
2233
  DEFAULT_PAGES_LIMIT: 5,
@@ -2219,27 +2235,27 @@ const It = async (r) => {
2219
2235
  MAX_TIME_RANGE_DAYS: 365,
2220
2236
  ANALYTICS_BATCH_SIZE: 1e3
2221
2237
  // For historical analysis
2222
- }, qt = {
2238
+ }, dr = {
2223
2239
  ANOMALY_THRESHOLD_SIGMA: 2.5,
2224
2240
  STRONG_ANOMALY_THRESHOLD_SIGMA: 3,
2225
2241
  TRAFFIC_DROP_ALERT_PERCENT: -30,
2226
2242
  TRAFFIC_SPIKE_ALERT_PERCENT: 200,
2227
2243
  MIN_BASELINE_DAYS: 7,
2228
2244
  MIN_EVENTS_FOR_ANOMALY_DETECTION: 50
2229
- }, Zt = {
2245
+ }, hr = {
2230
2246
  PAGE_URL_EXCLUDED: "excluded",
2231
2247
  PAGE_URL_UNKNOWN: "unknown"
2232
- }, Jt = {
2248
+ }, fr = {
2233
2249
  init: It,
2234
- event: yt,
2235
- on: At,
2250
+ event: At,
2251
+ on: yt,
2236
2252
  off: wt,
2237
2253
  isInitialized: Mt,
2238
2254
  destroy: Nt
2239
2255
  };
2240
- var Z, ye = -1, N = function(r) {
2256
+ var Z, Ae = -1, N = function(r) {
2241
2257
  addEventListener("pageshow", function(e) {
2242
- e.persisted && (ye = e.timeStamp, r(e));
2258
+ e.persisted && (Ae = e.timeStamp, r(e));
2243
2259
  }, !0);
2244
2260
  }, ne = function() {
2245
2261
  var r = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
@@ -2249,7 +2265,7 @@ var Z, ye = -1, N = function(r) {
2249
2265
  return r && r.activationStart || 0;
2250
2266
  }, E = function(r, e) {
2251
2267
  var t = ne(), s = "navigate";
2252
- return ye >= 0 ? s = "back-forward-cache" : t && (document.prerendering || F() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
2268
+ return Ae >= 0 ? s = "back-forward-cache" : t && (document.prerendering || F() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: r, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: s };
2253
2269
  }, O = function(r, e, t) {
2254
2270
  try {
2255
2271
  if (PerformanceObserver.supportedEntryTypes.includes(r)) {
@@ -2292,7 +2308,7 @@ var Z, ye = -1, N = function(r) {
2292
2308
  addEventListener("visibilitychange", V, !0), addEventListener("prerenderingchange", V, !0);
2293
2309
  }, Lt = function() {
2294
2310
  removeEventListener("visibilitychange", V, !0), removeEventListener("prerenderingchange", V, !0);
2295
- }, Ae = function() {
2311
+ }, ye = function() {
2296
2312
  return w < 0 && (w = me(), pe(), N(function() {
2297
2313
  setTimeout(function() {
2298
2314
  w = me(), pe();
@@ -2306,7 +2322,7 @@ var Z, ye = -1, N = function(r) {
2306
2322
  }, !0) : r();
2307
2323
  }, J = [1800, 3e3], we = function(r, e) {
2308
2324
  e = e || {}, $(function() {
2309
- var t, s = Ae(), n = E("FCP"), i = O("paint", function(a) {
2325
+ var t, s = ye(), n = E("FCP"), i = O("paint", function(a) {
2310
2326
  a.forEach(function(l) {
2311
2327
  l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - F(), 0), n.entries.push(l), t(!0)));
2312
2328
  });
@@ -2335,9 +2351,9 @@ var Z, ye = -1, N = function(r) {
2335
2351
  });
2336
2352
  }), setTimeout(t, 0));
2337
2353
  }));
2338
- }, Me = 0, j = 1 / 0, D = 0, Rt = function(r) {
2354
+ }, Me = 0, Q = 1 / 0, D = 0, Rt = function(r) {
2339
2355
  r.forEach(function(e) {
2340
- e.interactionId && (j = Math.min(j, e.interactionId), D = Math.max(D, e.interactionId), Me = D ? (D - j) / 7 + 1 : 0);
2356
+ e.interactionId && (Q = Math.min(Q, e.interactionId), D = Math.max(D, e.interactionId), Me = D ? (D - Q) / 7 + 1 : 0);
2341
2357
  });
2342
2358
  }, Ne = function() {
2343
2359
  return Z ? Me : performance.interactionCount || 0;
@@ -2384,9 +2400,9 @@ var Z, ye = -1, N = function(r) {
2384
2400
  Le = Ne(), g.length = 0, x.clear(), n = E("INP"), s = S(r, n, te, e.reportAllChanges);
2385
2401
  }));
2386
2402
  }));
2387
- }, re = [2500, 4e3], B = {}, Ut = function(r, e) {
2403
+ }, re = [2500, 4e3], X = {}, Ut = function(r, e) {
2388
2404
  e = e || {}, $(function() {
2389
- var t, s = Ae(), n = E("LCP"), i = function(c) {
2405
+ var t, s = ye(), n = E("LCP"), i = function(c) {
2390
2406
  e.reportAllChanges || (c = c.slice(-1)), c.forEach(function(u) {
2391
2407
  u.startTime < s.firstHiddenTime && (n.value = Math.max(u.startTime - F(), 0), n.entries = [u], t());
2392
2408
  });
@@ -2394,7 +2410,7 @@ var Z, ye = -1, N = function(r) {
2394
2410
  if (a) {
2395
2411
  t = S(r, n, re, e.reportAllChanges);
2396
2412
  var l = ae(function() {
2397
- B[n.id] || (i(a.takeRecords()), a.disconnect(), B[n.id] = !0, t(!0));
2413
+ X[n.id] || (i(a.takeRecords()), a.disconnect(), X[n.id] = !0, t(!0));
2398
2414
  });
2399
2415
  ["keydown", "click"].forEach(function(c) {
2400
2416
  addEventListener(c, function() {
@@ -2402,7 +2418,7 @@ var Z, ye = -1, N = function(r) {
2402
2418
  }, { once: !0, capture: !0 });
2403
2419
  }), G(l), N(function(c) {
2404
2420
  n = E("LCP"), t = S(r, n, re, e.reportAllChanges), ie(function() {
2405
- n.value = performance.now() - c.timeStamp, B[n.id] = !0, t(!0);
2421
+ n.value = performance.now() - c.timeStamp, X[n.id] = !0, t(!0);
2406
2422
  });
2407
2423
  });
2408
2424
  }
@@ -2437,31 +2453,45 @@ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2437
2453
  onTTFB: xt
2438
2454
  }, Symbol.toStringTag, { value: "Module" }));
2439
2455
  export {
2440
- Kt as ANALYTICS_QUERY_LIMITS,
2441
- qt as ANOMALY_DETECTION,
2442
- A as AppConfigValidationError,
2443
- Bt as CONTENT_ANALYTICS,
2444
- $t as DATA_PROTECTION,
2445
- jt as DEVICE_ANALYTICS,
2456
+ ur as ANALYTICS_QUERY_LIMITS,
2457
+ dr as ANOMALY_DETECTION,
2458
+ y as AppConfigValidationError,
2459
+ ar as CONTENT_ANALYTICS,
2460
+ rr as DATA_PROTECTION,
2461
+ ir as DEVICE_ANALYTICS,
2446
2462
  _ as DeviceType,
2447
- zt as ENGAGEMENT_THRESHOLDS,
2448
- X as EmitterEvent,
2463
+ sr as ENGAGEMENT_THRESHOLDS,
2464
+ W as EmitterEvent,
2449
2465
  C as ErrorType,
2450
2466
  d as EventType,
2451
- Wt as INSIGHT_THRESHOLDS,
2452
- Ft as InitializationTimeoutError,
2467
+ or as INSIGHT_THRESHOLDS,
2468
+ er as InitializationTimeoutError,
2453
2469
  v as IntegrationValidationError,
2470
+ Jt as MAX_ARRAY_LENGTH,
2471
+ zt as MAX_CUSTOM_EVENT_ARRAY_SIZE,
2472
+ jt as MAX_CUSTOM_EVENT_ARRAY_SIZE_BACKEND,
2473
+ Yt as MAX_CUSTOM_EVENT_JSON_SIZE_BACKEND,
2474
+ $t as MAX_CUSTOM_EVENT_KEYS,
2475
+ Xt as MAX_CUSTOM_EVENT_KEYS_BACKEND,
2476
+ Ft as MAX_CUSTOM_EVENT_NAME_LENGTH,
2477
+ Gt as MAX_CUSTOM_EVENT_STRING_SIZE,
2478
+ Qt as MAX_METADATA_NESTING_DEPTH,
2479
+ Kt as MAX_METADATA_NESTING_DEPTH_BACKEND,
2480
+ Bt as MAX_NESTED_OBJECT_KEYS,
2481
+ qt as MAX_STRING_LENGTH,
2482
+ Wt as MAX_STRING_LENGTH_BACKEND,
2483
+ Zt as MAX_STRING_LENGTH_IN_ARRAY,
2454
2484
  R as Mode,
2455
- Gt as PERFORMANCE_CONFIG,
2456
- y as PermanentError,
2457
- Yt as SEGMENTATION_ANALYTICS,
2458
- Qt as SESSION_ANALYTICS,
2459
- Zt as SPECIAL_PAGE_URLS,
2485
+ tr as PERFORMANCE_CONFIG,
2486
+ A as PermanentError,
2487
+ cr as SEGMENTATION_ANALYTICS,
2488
+ nr as SESSION_ANALYTICS,
2489
+ hr as SPECIAL_PAGE_URLS,
2460
2490
  le as SamplingRateValidationError,
2461
2491
  k as ScrollDirection,
2462
2492
  ke as SessionTimeoutValidationError,
2463
- W as SpecialApiUrl,
2464
- Xt as TEMPORAL_ANALYSIS,
2493
+ j as SpecialApiUrl,
2494
+ lr as TEMPORAL_ANALYSIS,
2465
2495
  b as TraceLogValidationError,
2466
- Jt as tracelog
2496
+ fr as tracelog
2467
2497
  };