@tracelog/lib 3.0.0 → 3.1.0-rc.116.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.
@@ -1,7 +1,7 @@
1
- const ln = 9e5;
2
- const cn = 120, un = 49152, dn = 100, hn = 500, fn = 200;
3
- const gn = 1e3, mn = 500, pn = 1e3;
4
- const b = "data-tlog", pt = [
1
+ const fn = 9e5;
2
+ const gn = 120, mn = 49152, pn = 100, Sn = 500, En = 200;
3
+ const vn = 1e3, Tn = 500, _n = 1e3;
4
+ const L = "data-tlog", vt = [
5
5
  "button",
6
6
  "a",
7
7
  'input[type="button"]',
@@ -33,7 +33,7 @@ const b = "data-tlog", pt = [
33
33
  ".menu-item",
34
34
  "[data-testid]",
35
35
  '[tabindex="0"]'
36
- ], St = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], Et = [
36
+ ], Tt = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], _t = [
37
37
  "token",
38
38
  "auth",
39
39
  "key",
@@ -60,15 +60,15 @@ const y = {
60
60
  INVALID_CLICK_THROTTLE: "Click throttle must be a non-negative number",
61
61
  INVALID_MAX_SAME_EVENT_PER_MINUTE: "Max same event per minute must be a positive number",
62
62
  INVALID_SEND_INTERVAL: "Send interval must be between 1000ms (1 second) and 60000ms (60 seconds)"
63
- }, vt = [
63
+ }, yt = [
64
64
  /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
65
65
  /javascript:/gi,
66
66
  /on\w+\s*=/gi,
67
67
  /<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
68
68
  /<embed\b[^>]*>/gi,
69
69
  /<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
70
- ], g = "tlog", z = `${g}:qa_mode`, pe = `${g}:uid`, tt = "tlog_mode", ke = "qa", Ue = "qa_off", le = (n) => n ? `${g}:${n}:queue` : `${g}:queue`, ce = (n) => n ? `${g}:${n}:rate_limit` : `${g}:rate_limit`, Tt = (n) => n ? `${g}:${n}:session` : `${g}:session`, _t = (n) => n ? `${g}:${n}:broadcast` : `${g}:broadcast`, Fe = (n, e) => `${g}:${n}:session_counts:${e}`, Ve = 10080 * 60 * 1e3, He = `${g}:session_counts_last_cleanup`, xe = 3600 * 1e3, ue = (n) => n ? `${g}:${n}:identity` : `${g}:identity`, O = `${g}:pending_identity`;
71
- var F = /* @__PURE__ */ ((n) => (n.Localhost = "localhost:8080", n.Fail = "localhost:9999", n))(F || {}), w = /* @__PURE__ */ ((n) => (n.Mobile = "mobile", n.Tablet = "tablet", n.Desktop = "desktop", n.Unknown = "unknown", n))(w || {}), k = /* @__PURE__ */ ((n) => (n.EVENT = "event", n.QUEUE = "queue", n))(k || {});
70
+ ], g = "tlog", z = `${g}:qa_mode`, Se = `${g}:uid`, nt = "tlog_mode", Ue = "qa", Fe = "qa_off", ce = (n) => n ? `${g}:${n}:queue` : `${g}:queue`, le = (n) => n ? `${g}:${n}:rate_limit` : `${g}:rate_limit`, It = (n) => n ? `${g}:${n}:session` : `${g}:session`, wt = (n) => n ? `${g}:${n}:broadcast` : `${g}:broadcast`, Ve = (n, e) => `${g}:${n}:session_counts:${e}`, He = 10080 * 60 * 1e3, xe = `${g}:session_counts_last_cleanup`, $e = 3600 * 1e3, ue = (n) => n ? `${g}:${n}:identity` : `${g}:identity`, O = `${g}:pending_identity`;
71
+ var F = /* @__PURE__ */ ((n) => (n.Localhost = "localhost:8080", n.Fail = "localhost:9999", n))(F || {}), w = /* @__PURE__ */ ((n) => (n.Mobile = "mobile", n.Tablet = "tablet", n.Desktop = "desktop", n.Unknown = "unknown", n))(w || {}), D = /* @__PURE__ */ ((n) => (n.EVENT = "event", n.QUEUE = "queue", n))(D || {});
72
72
  class M extends Error {
73
73
  constructor(e, t, s) {
74
74
  super(e), this.statusCode = t, this.responseCode = s, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, M);
@@ -86,7 +86,7 @@ class Z extends Error {
86
86
  super(e), this.name = "TimeoutError", Error.captureStackTrace && Error.captureStackTrace(this, Z);
87
87
  }
88
88
  }
89
- var d = /* @__PURE__ */ ((n) => (n.PAGE_VIEW = "page_view", n.CLICK = "click", n.SCROLL = "scroll", n.SESSION_START = "session_start", n.CUSTOM = "custom", n.WEB_VITALS = "web_vitals", n.ERROR = "error", n))(d || {}), Se = /* @__PURE__ */ ((n) => (n.UP = "up", n.DOWN = "down", n))(Se || {}), V = /* @__PURE__ */ ((n) => (n.JS_ERROR = "js_error", n.PROMISE_REJECTION = "promise_rejection", n))(V || {}), ee = /* @__PURE__ */ ((n) => (n.QA = "qa", n))(ee || {});
89
+ var d = /* @__PURE__ */ ((n) => (n.PAGE_VIEW = "page_view", n.CLICK = "click", n.SCROLL = "scroll", n.SESSION_START = "session_start", n.CUSTOM = "custom", n.WEB_VITALS = "web_vitals", n.ERROR = "error", n))(d || {}), Ee = /* @__PURE__ */ ((n) => (n.UP = "up", n.DOWN = "down", n))(Ee || {}), V = /* @__PURE__ */ ((n) => (n.JS_ERROR = "js_error", n.PROMISE_REJECTION = "promise_rejection", n))(V || {}), ee = /* @__PURE__ */ ((n) => (n.QA = "qa", n))(ee || {});
90
90
  class $ extends Error {
91
91
  constructor(e, t, s) {
92
92
  super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
@@ -99,28 +99,34 @@ class m extends $ {
99
99
  super(e, "APP_CONFIG_INVALID", t);
100
100
  }
101
101
  }
102
- class yt extends $ {
102
+ class At extends $ {
103
103
  constructor(e, t = "config") {
104
104
  super(e, "SESSION_TIMEOUT_INVALID", t);
105
105
  }
106
106
  }
107
- class $e extends $ {
107
+ class Be extends $ {
108
108
  constructor(e, t = "config") {
109
109
  super(e, "SAMPLING_RATE_INVALID", t);
110
110
  }
111
111
  }
112
- class Be extends $ {
112
+ class Xe extends $ {
113
113
  constructor(e, t = "config") {
114
114
  super(e, "INTEGRATION_INVALID", t);
115
115
  }
116
116
  }
117
- class Sn extends $ {
117
+ class yn extends $ {
118
118
  constructor(e, t, s = "runtime") {
119
119
  super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
120
120
  }
121
121
  timeoutMs;
122
122
  }
123
- const It = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", wt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", At = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", bt = (n, e) => {
123
+ const Lt = ["gclid", "gbraid", "wbraid", "fbclid", "ttclid"], de = () => {
124
+ const n = new URLSearchParams(window.location.search), e = {};
125
+ return Lt.forEach((s) => {
126
+ const r = n.get(s);
127
+ r && (e[s] = r);
128
+ }), Object.keys(e).length ? e : void 0;
129
+ }, bt = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Mt = "background: #9e9e9e; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Ct = "background: #d32f2f; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;", Rt = (n, e) => {
124
130
  if (e) {
125
131
  if (e instanceof Error) {
126
132
  const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\s*\([^()]+:\d+:\d+\)/g, "");
@@ -139,7 +145,7 @@ const It = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
139
145
  return `[TraceLog] ${n}: ${String(e)}`;
140
146
  }
141
147
  return `[TraceLog] ${n}`;
142
- }, Lt = () => {
148
+ }, Nt = () => {
143
149
  if (typeof window > "u" || typeof sessionStorage > "u")
144
150
  return !1;
145
151
  try {
@@ -148,15 +154,15 @@ const It = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
148
154
  return !1;
149
155
  }
150
156
  }, a = (n, e, t) => {
151
- const { error: s, data: r, showToClient: i = !1, style: o, visibility: l } = t ?? {}, c = s ? bt(e, s) : `[TraceLog] ${e}`, u = n === "error" ? "error" : n === "warn" ? "warn" : "log";
152
- if (!Mt(l, i))
157
+ const { error: s, data: r, showToClient: i = !1, style: o, visibility: c } = t ?? {}, l = s ? Rt(e, s) : `[TraceLog] ${e}`, u = n === "error" ? "error" : n === "warn" ? "warn" : "log";
158
+ if (!Ot(c, i))
153
159
  return;
154
- const p = Rt(l, o), S = r !== void 0 ? Ee(r) : void 0;
155
- Ct(u, c, p, S);
156
- }, Mt = (n, e) => n === "critical" ? !0 : n === "qa" || e ? Lt() : !1, Rt = (n, e) => e !== void 0 && e !== "" ? e : n === "critical" ? At : "", Ct = (n, e, t, s) => {
160
+ const p = Pt(c, o), S = r !== void 0 ? ve(r) : void 0;
161
+ kt(u, l, p, S);
162
+ }, Ot = (n, e) => n === "critical" ? !0 : n === "qa" || e ? Nt() : !1, Pt = (n, e) => e !== void 0 && e !== "" ? e : n === "critical" ? Ct : "", kt = (n, e, t, s) => {
157
163
  const r = t !== void 0 && t !== "", i = r ? `%c${e}` : e;
158
164
  s !== void 0 ? r ? console[n](i, t, s) : console[n](i, s) : r ? console[n](i, t) : console[n](i);
159
- }, Ee = (n) => {
165
+ }, ve = (n) => {
160
166
  const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
161
167
  for (const [s, r] of Object.entries(n)) {
162
168
  const i = s.toLowerCase();
@@ -164,16 +170,16 @@ const It = "background: #ff9800; color: white; font-weight: bold; padding: 2px 8
164
170
  e[s] = "[REDACTED]";
165
171
  continue;
166
172
  }
167
- r !== null && typeof r == "object" && !Array.isArray(r) ? e[s] = Ee(r) : Array.isArray(r) ? e[s] = r.map(
168
- (o) => o !== null && typeof o == "object" && !Array.isArray(o) ? Ee(o) : o
173
+ r !== null && typeof r == "object" && !Array.isArray(r) ? e[s] = ve(r) : Array.isArray(r) ? e[s] = r.map(
174
+ (o) => o !== null && typeof o == "object" && !Array.isArray(o) ? ve(o) : o
169
175
  ) : e[s] = r;
170
176
  }
171
177
  return e;
172
178
  };
173
- let ve, st;
174
- const Nt = () => {
175
- typeof window < "u" && !ve && (ve = window.matchMedia("(pointer: coarse)"), st = window.matchMedia("(hover: none)"));
176
- }, te = "Unknown", Ot = (n) => {
179
+ let Te, rt;
180
+ const Dt = () => {
181
+ typeof window < "u" && !Te && (Te = window.matchMedia("(pointer: coarse)"), rt = window.matchMedia("(hover: none)"));
182
+ }, te = "Unknown", Ut = (n) => {
177
183
  const e = n.userAgentData?.platform;
178
184
  if (e != null && e !== "") {
179
185
  if (/windows/i.test(e)) return "Windows";
@@ -185,7 +191,7 @@ const Nt = () => {
185
191
  }
186
192
  const t = navigator.userAgent;
187
193
  return /Windows/i.test(t) ? "Windows" : /iPhone|iPad|iPod/i.test(t) ? "iOS" : /Mac OS X|Macintosh/i.test(t) ? "macOS" : /Android/i.test(t) ? "Android" : /CrOS/i.test(t) ? "ChromeOS" : /Linux/i.test(t) ? "Linux" : te;
188
- }, Pt = (n) => {
194
+ }, Ft = (n) => {
189
195
  const e = n.userAgentData?.brands;
190
196
  if (e != null && e.length > 0) {
191
197
  const r = e.filter((i) => !/not.?a.?brand|chromium/i.test(i.brand))[0];
@@ -196,26 +202,26 @@ const Nt = () => {
196
202
  }
197
203
  const t = navigator.userAgent;
198
204
  return /Edg\//i.test(t) ? "Edge" : /OPR\//i.test(t) ? "Opera" : /Chrome/i.test(t) ? "Chrome" : /Firefox/i.test(t) ? "Firefox" : /Safari/i.test(t) && !/Chrome/i.test(t) ? "Safari" : te;
199
- }, Dt = () => {
205
+ }, Vt = () => {
200
206
  try {
201
207
  const n = navigator;
202
208
  if (n.userAgentData != null && typeof n.userAgentData.mobile == "boolean") {
203
- const c = n.userAgentData.platform;
204
- return c != null && c !== "" && /ipad|tablet/i.test(c) ? w.Tablet : n.userAgentData.mobile ? w.Mobile : w.Desktop;
209
+ const l = n.userAgentData.platform;
210
+ return l != null && l !== "" && /ipad|tablet/i.test(l) ? w.Tablet : n.userAgentData.mobile ? w.Mobile : w.Desktop;
205
211
  }
206
- Nt();
207
- const e = window.innerWidth, t = ve?.matches ?? !1, s = st?.matches ?? !1, r = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
208
- return e <= 767 || o && r ? w.Mobile : e >= 768 && e <= 1024 || l || t && s && r ? w.Tablet : w.Desktop;
212
+ Dt();
213
+ const e = window.innerWidth, t = Te?.matches ?? !1, s = rt?.matches ?? !1, r = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), o = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), c = /tablet|ipad|android(?!.*mobile)/.test(i);
214
+ return e <= 767 || o && r ? w.Mobile : e >= 768 && e <= 1024 || c || t && s && r ? w.Tablet : w.Desktop;
209
215
  } catch (n) {
210
216
  return a("debug", "Device detection failed, defaulting to desktop", { error: n }), w.Desktop;
211
217
  }
212
- }, kt = () => {
218
+ }, Ht = () => {
213
219
  try {
214
220
  const n = navigator;
215
221
  return {
216
- type: Dt(),
217
- os: Ot(n),
218
- browser: Pt(n)
222
+ type: Vt(),
223
+ os: Ut(n),
224
+ browser: Ft(n)
219
225
  };
220
226
  } catch (n) {
221
227
  return a("debug", "Device info detection failed, using defaults", { error: n }), {
@@ -224,60 +230,60 @@ const Nt = () => {
224
230
  browser: te
225
231
  };
226
232
  }
227
- }, Xe = 500, Ge = 2e3, We = 5e3, Q = 50, Ut = Q * 2, nt = 1, Ft = 1e3, Vt = 10, je = 5e3, Ht = 3, xt = 200, $t = 6e4, Bt = 64, En = {
233
+ }, Ge = 500, We = 2e3, je = 5e3, Q = 50, xt = Q * 2, it = 1, $t = 1e3, Bt = 10, Ke = 5e3, Xt = 3, Gt = 200, Wt = 6e4, jt = 64, In = {
228
234
  LCP: 2500,
229
235
  FCP: 1800,
230
236
  CLS: 0.1,
231
237
  INP: 200,
232
238
  TTFB: 800
233
- }, Ke = {
239
+ }, ze = {
234
240
  LCP: 2500,
235
241
  FCP: 1800,
236
242
  CLS: 0.1,
237
243
  INP: 200,
238
244
  TTFB: 800
239
- }, Xt = {
245
+ }, Kt = {
240
246
  LCP: 4e3,
241
247
  FCP: 3e3,
242
248
  CLS: 0.25,
243
249
  INP: 500,
244
250
  TTFB: 1800
245
- }, Te = "needs-improvement", ze = (n = Te) => {
251
+ }, _e = "needs-improvement", Qe = (n = _e) => {
246
252
  switch (n) {
247
253
  case "all":
248
254
  return { LCP: 0, FCP: 0, CLS: 0, INP: 0, TTFB: 0 };
249
255
  case "needs-improvement":
250
- return Ke;
256
+ return ze;
251
257
  case "poor":
252
- return Xt;
258
+ return Kt;
253
259
  default:
254
- return Ke;
260
+ return ze;
255
261
  }
256
- }, Gt = 50, Wt = "2.10.0", jt = Wt, Kt = () => typeof window < "u" && typeof sessionStorage < "u", zt = () => {
262
+ }, zt = 50, Qt = "3.1.0", Yt = Qt, qt = () => typeof window < "u" && typeof sessionStorage < "u", Jt = () => {
257
263
  try {
258
264
  const n = new URLSearchParams(window.location.search);
259
- n.delete(tt);
265
+ n.delete(nt);
260
266
  const e = n.toString(), t = window.location.pathname + (e ? "?" + e : "") + window.location.hash;
261
267
  window.history.replaceState({}, "", t);
262
268
  } catch {
263
269
  }
264
- }, Qt = () => {
265
- if (!Kt())
270
+ }, Zt = () => {
271
+ if (!qt())
266
272
  return !1;
267
273
  try {
268
- const e = new URLSearchParams(window.location.search).get(tt), t = sessionStorage.getItem(z);
274
+ const e = new URLSearchParams(window.location.search).get(nt), t = sessionStorage.getItem(z);
269
275
  let s = null;
270
- return e === ke ? (s = !0, sessionStorage.setItem(z, "true"), a("info", "QA Mode ACTIVE", {
276
+ return e === Ue ? (s = !0, sessionStorage.setItem(z, "true"), a("info", "QA Mode ACTIVE", {
271
277
  visibility: "qa",
272
- style: It
273
- })) : e === Ue && (s = !1, sessionStorage.setItem(z, "false"), a("info", "QA Mode DISABLED", {
278
+ style: bt
279
+ })) : e === Fe && (s = !1, sessionStorage.setItem(z, "false"), a("info", "QA Mode DISABLED", {
274
280
  visibility: "qa",
275
- style: wt
276
- })), (e === ke || e === Ue) && zt(), s ?? t === "true";
281
+ style: Mt
282
+ })), (e === Ue || e === Fe) && Jt(), s ?? t === "true";
277
283
  } catch {
278
284
  return !1;
279
285
  }
280
- }, Yt = [
286
+ }, ot = () => typeof document < "u" && document.prerendering === !0, es = [
281
287
  "co.uk",
282
288
  "org.uk",
283
289
  "com.au",
@@ -289,37 +295,37 @@ const Nt = () => {
289
295
  "co.in",
290
296
  "com.cn",
291
297
  "co.za"
292
- ], Qe = (n) => {
298
+ ], Ye = (n) => {
293
299
  const e = n.toLowerCase().split(".");
294
300
  if (e.length <= 2)
295
301
  return n.toLowerCase();
296
302
  const t = e.slice(-2).join(".");
297
- return Yt.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
298
- }, qt = (n, e) => n === e ? !0 : Qe(n) === Qe(e), de = () => {
303
+ return es.includes(t) ? e.slice(-3).join(".") : e.slice(-2).join(".");
304
+ }, ts = (n, e) => n === e ? !0 : Ye(n) === Ye(e), he = () => {
299
305
  const n = document.referrer;
300
306
  if (!n)
301
307
  return "Direct";
302
308
  try {
303
309
  const e = new URL(n).hostname.toLowerCase(), t = window.location.hostname.toLowerCase();
304
- return qt(e, t) ? "Direct" : n;
310
+ return ts(e, t) ? "Direct" : n;
305
311
  } catch (e) {
306
312
  return a("debug", "Failed to parse referrer URL, using raw value", { error: e, data: { referrer: n } }), n;
307
313
  }
308
- }, he = () => {
314
+ }, fe = () => {
309
315
  const n = new URLSearchParams(window.location.search), e = {};
310
- return St.forEach((s) => {
316
+ return Tt.forEach((s) => {
311
317
  const r = n.get(s);
312
318
  if (r) {
313
319
  const i = s.split("utm_")[1];
314
320
  e[i] = r;
315
321
  }
316
322
  }), Object.keys(e).length ? e : void 0;
317
- }, rt = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (n) => {
323
+ }, at = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (n) => {
318
324
  const e = Math.random() * 16 | 0;
319
325
  return (n === "x" ? e : e & 3 | 8).toString(16);
320
326
  });
321
327
  let W = 0, j = 0;
322
- const Jt = () => {
328
+ const ss = () => {
323
329
  let n = Date.now();
324
330
  n < j && (n = j), n === j ? W = (W + 1) % 1e3 : W = 0, j = n;
325
331
  const e = W.toString().padStart(3, "0");
@@ -332,13 +338,13 @@ const Jt = () => {
332
338
  } catch {
333
339
  }
334
340
  return t || (t = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")), `${n}-${e}-${t}`;
335
- }, Zt = (n) => {
341
+ }, ns = (n) => {
336
342
  try {
337
343
  return new URL(n).protocol === "https:";
338
344
  } catch {
339
345
  return !1;
340
346
  }
341
- }, es = (n) => {
347
+ }, rs = (n) => {
342
348
  try {
343
349
  const t = new URL(window.location.href).hostname;
344
350
  if (!t || typeof t != "string")
@@ -356,35 +362,35 @@ const Jt = () => {
356
362
  if (!r || r.split(".").length < 2)
357
363
  throw new Error("Invalid domain structure for SaaS");
358
364
  const i = `https://${n}.${r}/collect`;
359
- if (!Zt(i))
365
+ if (!ns(i))
360
366
  throw new Error("Generated URL failed validation");
361
367
  return i;
362
368
  } catch (e) {
363
369
  throw new Error(`Invalid SaaS URL configuration: ${e instanceof Error ? e.message : String(e)}`);
364
370
  }
365
- }, ts = (n) => {
371
+ }, is = (n) => {
366
372
  const e = {};
367
- return n.integrations?.tracelog?.projectId && (e.saas = es(n.integrations.tracelog.projectId)), e;
368
- }, _e = (n, e = []) => {
373
+ return n.integrations?.tracelog?.projectId && (e.saas = rs(n.integrations.tracelog.projectId)), e;
374
+ }, ye = (n, e = []) => {
369
375
  if (!n || typeof n != "string")
370
376
  return a("warn", "Invalid URL provided to normalizeUrl", { data: { type: typeof n } }), n || "";
371
377
  try {
372
- const t = new URL(n), s = t.searchParams, r = [.../* @__PURE__ */ new Set([...Et, ...e])];
378
+ const t = new URL(n), s = t.searchParams, r = [.../* @__PURE__ */ new Set([..._t, ...e])];
373
379
  let i = !1;
374
380
  const o = [];
375
- return r.forEach((l) => {
376
- s.has(l) && (s.delete(l), i = !0, o.push(l));
381
+ return r.forEach((c) => {
382
+ s.has(c) && (s.delete(c), i = !0, o.push(c));
377
383
  }), !i && n.includes("?") ? n : (t.search = s.toString(), t.toString());
378
384
  } catch (t) {
379
385
  return a("warn", "URL normalization failed, returning original", { error: t, data: { urlLength: n?.length } }), n;
380
386
  }
381
- }, Ye = (n) => {
387
+ }, qe = (n) => {
382
388
  if (!n || typeof n != "string" || n.trim().length === 0)
383
389
  return "";
384
390
  let e = n;
385
391
  n.length > 1e3 && (e = n.slice(0, Math.max(0, 1e3)));
386
392
  let t = 0;
387
- for (const r of vt) {
393
+ for (const r of yt) {
388
394
  const i = e;
389
395
  e = e.replace(r, ""), i !== e && t++;
390
396
  }
@@ -394,11 +400,11 @@ const Jt = () => {
394
400
  valueLength: n.length
395
401
  }
396
402
  }), e.trim();
397
- }, ye = (n, e = 0) => {
403
+ }, Ie = (n, e = 0) => {
398
404
  if (n == null)
399
405
  return null;
400
406
  if (typeof n == "string")
401
- return Ye(n);
407
+ return qe(n);
402
408
  if (typeof n == "number")
403
409
  return !Number.isFinite(n) || n < -Number.MAX_SAFE_INTEGER || n > Number.MAX_SAFE_INTEGER ? 0 : n;
404
410
  if (typeof n == "boolean")
@@ -406,30 +412,30 @@ const Jt = () => {
406
412
  if (e > 10)
407
413
  return null;
408
414
  if (Array.isArray(n))
409
- return n.slice(0, 1e3).map((r) => ye(r, e + 1)).filter((r) => r !== null);
415
+ return n.slice(0, 1e3).map((r) => Ie(r, e + 1)).filter((r) => r !== null);
410
416
  if (typeof n == "object") {
411
417
  const t = {}, r = Object.entries(n).slice(0, 200);
412
418
  for (const [i, o] of r) {
413
- const l = Ye(i);
414
- if (l) {
415
- const c = ye(o, e + 1);
416
- c !== null && (t[l] = c);
419
+ const c = qe(i);
420
+ if (c) {
421
+ const l = Ie(o, e + 1);
422
+ l !== null && (t[c] = l);
417
423
  }
418
424
  }
419
425
  return t;
420
426
  }
421
427
  return null;
422
- }, ss = (n) => {
428
+ }, os = (n) => {
423
429
  if (typeof n != "object" || n === null)
424
430
  return {};
425
431
  try {
426
- const e = ye(n);
432
+ const e = Ie(n);
427
433
  return typeof e == "object" && e !== null ? e : {};
428
434
  } catch (e) {
429
435
  const t = e instanceof Error ? e.message : String(e);
430
436
  throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
431
437
  }
432
- }, ns = [
438
+ }, as = [
433
439
  // Email addresses.
434
440
  // Quantifiers are bounded (local part ≤64, each label ≤63, TLD ≤63 per RFC/DNS limits)
435
441
  // and the domain is matched as discrete dot-separated labels so the local-part and
@@ -452,18 +458,18 @@ const Jt = () => {
452
458
  /[?&](token|password|passwd|auth|secret|secret_key|private_key|auth_key|api_key|apikey|access_token)=[^&\s]+/gi
453
459
  ], Y = (n) => {
454
460
  let e = n;
455
- for (const t of ns)
461
+ for (const t of as)
456
462
  e = e.replace(t, "[REDACTED]");
457
463
  return e;
458
- }, rs = (n) => {
464
+ }, cs = (n) => {
459
465
  if (n !== void 0 && (n === null || typeof n != "object"))
460
466
  throw new m("Configuration must be an object", "config");
461
467
  if (n) {
462
468
  if (n.sessionTimeout !== void 0 && (typeof n.sessionTimeout != "number" || n.sessionTimeout < 3e4 || n.sessionTimeout > 864e5))
463
- throw new yt(y.INVALID_SESSION_TIMEOUT, "config");
469
+ throw new At(y.INVALID_SESSION_TIMEOUT, "config");
464
470
  if (n.globalMetadata !== void 0 && (typeof n.globalMetadata != "object" || n.globalMetadata === null))
465
471
  throw new m(y.INVALID_GLOBAL_METADATA, "config");
466
- if (n.integrations && is(n.integrations), n.sensitiveQueryParams !== void 0) {
472
+ if (n.integrations && ls(n.integrations), n.sensitiveQueryParams !== void 0) {
467
473
  if (!Array.isArray(n.sensitiveQueryParams))
468
474
  throw new m(y.INVALID_SENSITIVE_QUERY_PARAMS, "config");
469
475
  for (const e of n.sensitiveQueryParams)
@@ -471,9 +477,9 @@ const Jt = () => {
471
477
  throw new m("All sensitive query params must be strings", "config");
472
478
  }
473
479
  if (n.errorSampling !== void 0 && (typeof n.errorSampling != "number" || n.errorSampling < 0 || n.errorSampling > 1))
474
- throw new $e(y.INVALID_ERROR_SAMPLING_RATE, "config");
480
+ throw new Be(y.INVALID_ERROR_SAMPLING_RATE, "config");
475
481
  if (n.samplingRate !== void 0 && (typeof n.samplingRate != "number" || n.samplingRate < 0 || n.samplingRate > 1))
476
- throw new $e(y.INVALID_SAMPLING_RATE, "config");
482
+ throw new Be(y.INVALID_SAMPLING_RATE, "config");
477
483
  if (n.pageViewThrottleMs !== void 0 && (typeof n.pageViewThrottleMs != "number" || n.pageViewThrottleMs < 0))
478
484
  throw new m(y.INVALID_PAGE_VIEW_THROTTLE, "config");
479
485
  if (n.clickThrottleMs !== void 0 && (typeof n.clickThrottleMs != "number" || n.clickThrottleMs < 0))
@@ -523,19 +529,19 @@ const Jt = () => {
523
529
  }
524
530
  }
525
531
  }
526
- }, is = (n) => {
532
+ }, ls = (n) => {
527
533
  if (n && n.tracelog) {
528
534
  if (!n.tracelog.projectId || typeof n.tracelog.projectId != "string" || n.tracelog.projectId.trim() === "")
529
- throw new Be(y.INVALID_TRACELOG_PROJECT_ID, "config");
535
+ throw new Xe(y.INVALID_TRACELOG_PROJECT_ID, "config");
530
536
  if (n.tracelog.shopify !== void 0 && typeof n.tracelog.shopify != "boolean")
531
- throw new Be("tracelog.shopify must be a boolean", "config");
537
+ throw new Xe("tracelog.shopify must be a boolean", "config");
532
538
  }
533
- }, os = (n) => (rs(n), {
539
+ }, us = (n) => (cs(n), {
534
540
  ...n ?? {},
535
541
  sessionTimeout: n?.sessionTimeout ?? 9e5,
536
542
  globalMetadata: n?.globalMetadata ?? {},
537
543
  sensitiveQueryParams: n?.sensitiveQueryParams ?? [],
538
- errorSampling: n?.errorSampling ?? nt,
544
+ errorSampling: n?.errorSampling ?? it,
539
545
  samplingRate: n?.samplingRate ?? 1,
540
546
  pageViewThrottleMs: n?.pageViewThrottleMs ?? 1e3,
541
547
  clickThrottleMs: n?.clickThrottleMs ?? 300,
@@ -543,18 +549,18 @@ const Jt = () => {
543
549
  sendIntervalMs: n?.sendIntervalMs ?? 1e4,
544
550
  flushOnSpaNavigation: n?.flushOnSpaNavigation ?? !1,
545
551
  flushOnPageHidden: n?.flushOnPageHidden ?? !0
546
- }), Ie = (n, e = /* @__PURE__ */ new Set()) => {
552
+ }), we = (n, e = /* @__PURE__ */ new Set()) => {
547
553
  if (n == null)
548
554
  return !0;
549
555
  const t = typeof n;
550
- return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(n) ? !1 : (e.add(n), Array.isArray(n) ? n.every((s) => Ie(s, e)) : t === "object" ? Object.values(n).every((s) => Ie(s, e)) : !1);
551
- }, as = (n) => typeof n != "object" || n === null ? !1 : Ie(n), we = (n) => {
556
+ return t === "string" || t === "number" || t === "boolean" ? !0 : t === "function" || t === "symbol" || t === "bigint" || e.has(n) ? !1 : (e.add(n), Array.isArray(n) ? n.every((s) => we(s, e)) : t === "object" ? Object.values(n).every((s) => we(s, e)) : !1);
557
+ }, ds = (n) => typeof n != "object" || n === null ? !1 : we(n), Ae = (n) => {
552
558
  if (typeof n != "object" || n === null || Array.isArray(n)) return;
553
559
  const e = {};
554
560
  for (const [t, s] of Object.entries(n))
555
561
  typeof s == "string" && (e[t] = s);
556
562
  return Object.keys(e).length > 0 ? e : void 0;
557
- }, ls = (n) => typeof n != "string" ? {
563
+ }, hs = (n) => typeof n != "string" ? {
558
564
  valid: !1,
559
565
  error: "Event name must be a string"
560
566
  } : n.length === 0 ? {
@@ -569,9 +575,9 @@ const Jt = () => {
569
575
  } : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(n.toLowerCase()) ? {
570
576
  valid: !1,
571
577
  error: "Event name cannot be a reserved word"
572
- } : { valid: !0 }, qe = (n, e, t) => {
573
- const s = ss(e), r = `${t} "${n}" metadata error`;
574
- if (!as(s))
578
+ } : { valid: !0 }, Je = (n, e, t) => {
579
+ const s = os(e), r = `${t} "${n}" metadata error`;
580
+ if (!ds(s))
575
581
  return {
576
582
  valid: !1,
577
583
  error: `${r}: object has invalid types. Valid types are string, number, boolean or string arrays.`
@@ -595,31 +601,31 @@ const Jt = () => {
595
601
  valid: !1,
596
602
  error: `${r}: object has too many keys (max 100 keys).`
597
603
  };
598
- for (const [c, u] of Object.entries(s)) {
604
+ for (const [l, u] of Object.entries(s)) {
599
605
  if (Array.isArray(u)) {
600
606
  if (u.length > 500)
601
607
  return {
602
608
  valid: !1,
603
- error: `${r}: array property "${c}" is too large (max 500 items).`
609
+ error: `${r}: array property "${l}" is too large (max 500 items).`
604
610
  };
605
611
  for (const h of u)
606
612
  if (typeof h == "string" && h.length > 500)
607
613
  return {
608
614
  valid: !1,
609
- error: `${r}: array property "${c}" contains strings that are too long (max 500 characters).`
615
+ error: `${r}: array property "${l}" contains strings that are too long (max 500 characters).`
610
616
  };
611
617
  }
612
618
  if (typeof u == "string" && u.length > 1e3)
613
619
  return {
614
620
  valid: !1,
615
- error: `${r}: property "${c}" is too long (max 1000 characters).`
621
+ error: `${r}: property "${l}" is too long (max 1000 characters).`
616
622
  };
617
623
  }
618
624
  return {
619
625
  valid: !0,
620
626
  sanitizedMetadata: s
621
627
  };
622
- }, cs = (n, e, t) => {
628
+ }, fs = (n, e, t) => {
623
629
  if (Array.isArray(e)) {
624
630
  const s = [], r = `${t} "${n}" metadata error`;
625
631
  for (let i = 0; i < e.length; i++) {
@@ -629,29 +635,29 @@ const Jt = () => {
629
635
  valid: !1,
630
636
  error: `${r}: array item at index ${i} must be an object.`
631
637
  };
632
- const l = qe(n, o, t);
633
- if (!l.valid)
638
+ const c = Je(n, o, t);
639
+ if (!c.valid)
634
640
  return {
635
641
  valid: !1,
636
- error: `${r}: array item at index ${i} is invalid: ${l.error}`
642
+ error: `${r}: array item at index ${i} is invalid: ${c.error}`
637
643
  };
638
- l.sanitizedMetadata && s.push(l.sanitizedMetadata);
644
+ c.sanitizedMetadata && s.push(c.sanitizedMetadata);
639
645
  }
640
646
  return {
641
647
  valid: !0,
642
648
  sanitizedMetadata: s
643
649
  };
644
650
  }
645
- return qe(n, e, t);
646
- }, us = (n, e) => {
647
- const t = ls(n);
651
+ return Je(n, e, t);
652
+ }, gs = (n, e) => {
653
+ const t = hs(n);
648
654
  if (!t.valid)
649
655
  return a("error", "Event name validation failed", {
650
656
  data: { eventName: n, error: t.error }
651
657
  }), t;
652
658
  if (!e)
653
659
  return { valid: !0 };
654
- const s = cs(n, e, "customEvent");
660
+ const s = fs(n, e, "customEvent");
655
661
  return s.valid || a("error", "Event metadata validation failed", {
656
662
  data: {
657
663
  eventName: n,
@@ -659,7 +665,7 @@ const Jt = () => {
659
665
  }
660
666
  }), s;
661
667
  };
662
- class ds {
668
+ class ms {
663
669
  listeners = /* @__PURE__ */ new Map();
664
670
  /**
665
671
  * Subscribes to an event channel
@@ -776,36 +782,53 @@ class ds {
776
782
  this.listeners.clear();
777
783
  }
778
784
  }
779
- const hs = /https?:\/\/\S+/g, fs = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, gs = /0x[0-9a-fA-F]{4,}/g, ms = /(?<!\d)\d{4,}(?!\d)/g, ps = /(['"])[^'"]{20,}\1/g;
780
- function Ss(n) {
781
- return n.replace(hs, "[URL]").replace(fs, "[ID]").replace(gs, "[ADDR]").replace(ms, "[N]").replace(ps, "$1[VAR]$1").toLowerCase().trim();
785
+ const ps = /https?:\/\/\S+/g, Ss = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, Es = /0x[0-9a-fA-F]{4,}/g, vs = /(?<!\d)\d{4,}(?!\d)/g, Ts = /(['"])[^'"]{20,}\1/g;
786
+ function _s(n) {
787
+ return n.replace(ps, "[URL]").replace(Ss, "[ID]").replace(Es, "[ADDR]").replace(vs, "[N]").replace(Ts, "$1[VAR]$1").toLowerCase().trim();
782
788
  }
783
- function Es(n) {
784
- const e = Ss(n.message), t = (n.filename ?? "").trim(), s = t.search(/[?#]/), r = s === -1 ? t : t.slice(0, s), i = n.line == null ? "" : String(n.line);
785
- return `${e}|${r}|${i}`;
789
+ function Ze(n) {
790
+ const e = n.search(/[?#]/);
791
+ return e === -1 ? n : n.slice(0, e);
792
+ }
793
+ function ys(n, e) {
794
+ const t = Ze((n ?? "").trim());
795
+ if (!t) return "";
796
+ let s;
797
+ try {
798
+ s = new URL(t);
799
+ } catch {
800
+ return t;
801
+ }
802
+ if (s.protocol !== "http:" && s.protocol !== "https:") return "";
803
+ const r = Ze((e ?? "").trim());
804
+ return r && t === r ? s.origin : t;
786
805
  }
787
- const fe = { config: {} };
806
+ function Is(n) {
807
+ const e = _s(n.message), t = ys(n.filename, n.page_url), s = n.line == null ? "" : String(n.line);
808
+ return `${e}|${t}|${s}`;
809
+ }
810
+ const ge = { config: {} };
788
811
  class T {
789
812
  /**
790
813
  * Retrieves a value from global state.
791
814
  */
792
815
  get(e) {
793
- return fe[e];
816
+ return ge[e];
794
817
  }
795
818
  /**
796
819
  * Sets a value in global state.
797
820
  */
798
821
  set(e, t) {
799
- fe[e] = t;
822
+ ge[e] = t;
800
823
  }
801
824
  /**
802
825
  * Returns an immutable snapshot of the entire global state.
803
826
  */
804
827
  getState() {
805
- return { ...fe };
828
+ return { ...ge };
806
829
  }
807
830
  }
808
- class vs extends T {
831
+ class ws extends T {
809
832
  storeManager;
810
833
  apiUrl;
811
834
  lastPermanentErrorLog = null;
@@ -850,12 +873,12 @@ class vs extends T {
850
873
  * cases so the migration is one-shot per browser.
851
874
  */
852
875
  migrateLegacyV2Keys() {
853
- const e = this.get("userId") || "anonymous", t = `${le(e)}:saas`, s = `${le(e)}:custom`, r = `${ce(e)}:saas`, i = `${ce(e)}:custom`;
876
+ const e = this.get("userId") || "anonymous", t = `${ce(e)}:saas`, s = `${ce(e)}:custom`, r = `${le(e)}:saas`, i = `${le(e)}:custom`;
854
877
  try {
855
878
  const o = this.storeManager.getItem(t);
856
879
  if (o) {
857
- const l = this.getQueueStorageKey(), c = this.storeManager.getItem(l);
858
- c ? this.mergeLegacyIntoCurrent(l, o, c) : (this.storeManager.setItem(l, o), a("debug", "Migrated v2 SaaS queue to v3 unscoped key")), this.storeManager.removeItem(t);
880
+ const c = this.getQueueStorageKey(), l = this.storeManager.getItem(c);
881
+ l ? this.mergeLegacyIntoCurrent(c, o, l) : (this.storeManager.setItem(c, o), a("debug", "Migrated v2 SaaS queue to v3 unscoped key")), this.storeManager.removeItem(t);
859
882
  }
860
883
  } catch (o) {
861
884
  a("debug", "Failed to migrate v2 SaaS queue, discarding legacy key", { error: o });
@@ -878,17 +901,17 @@ class vs extends T {
878
901
  a("debug", "Legacy or current queue malformed, keeping current only");
879
902
  return;
880
903
  }
881
- const o = new Set(i.events.map((u) => u.id)), l = [
904
+ const o = new Set(i.events.map((u) => u.id)), c = [
882
905
  ...i.events,
883
906
  ...r.events.filter((u) => typeof u.id == "string" && !o.has(u.id))
884
- ], c = {
907
+ ], l = {
885
908
  ...i,
886
- events: l,
909
+ events: c,
887
910
  timestamp: typeof i.timestamp == "number" && typeof r.timestamp == "number" ? Math.min(i.timestamp, r.timestamp) : i.timestamp ?? r.timestamp ?? Date.now(),
888
911
  recoveryFailures: Math.max(i.recoveryFailures ?? 0, r.recoveryFailures ?? 0) || void 0
889
912
  };
890
- this.storeManager.setItem(e, JSON.stringify(c)), a("debug", "Merged v2 SaaS queue into existing v3 queue", {
891
- data: { added: l.length - i.events.length, total: l.length }
913
+ this.storeManager.setItem(e, JSON.stringify(l)), a("debug", "Merged v2 SaaS queue into existing v3 queue", {
914
+ data: { added: c.length - i.events.length, total: c.length }
892
915
  });
893
916
  } catch (r) {
894
917
  a("debug", "Failed to merge legacy queue, keeping current", { error: r });
@@ -896,11 +919,11 @@ class vs extends T {
896
919
  }
897
920
  getQueueStorageKey() {
898
921
  const e = this.get("userId") || "anonymous";
899
- return le(e);
922
+ return ce(e);
900
923
  }
901
924
  getRateLimitStorageKey() {
902
925
  const e = this.get("userId") || "anonymous";
903
- return ce(e);
926
+ return le(e);
904
927
  }
905
928
  getActiveRateLimitKey() {
906
929
  return this.rateLimitStorageKeyAtArm ?? this.getRateLimitStorageKey();
@@ -1051,46 +1074,46 @@ class vs extends T {
1051
1074
  }
1052
1075
  }), !1;
1053
1076
  if (this.consecutiveNetworkFailures >= 3) {
1054
- const l = Date.now() - this.circuitOpenedAt;
1055
- if (l < 12e4)
1077
+ const c = Date.now() - this.circuitOpenedAt;
1078
+ if (c < 12e4)
1056
1079
  return a("debug", "Network circuit open, skipping send", {
1057
1080
  data: {
1058
1081
  consecutiveNetworkFailures: this.consecutiveNetworkFailures,
1059
- cooldownRemainingMs: 12e4 - l
1082
+ cooldownRemainingMs: 12e4 - c
1060
1083
  }
1061
1084
  }), !1;
1062
1085
  }
1063
1086
  const { url: s, payload: r } = this.prepareRequest(t);
1064
1087
  let i = !0, o = !1;
1065
- for (let l = 1; l <= 3; l++)
1088
+ for (let c = 1; c <= 3; c++)
1066
1089
  try {
1067
- return (await this.sendWithTimeout(s, r)).ok ? (l > 1 && a("info", `Send succeeded after ${l - 1} retry attempt(s)`, {
1068
- data: { events: t.events.length, attempt: l }
1090
+ return (await this.sendWithTimeout(s, r)).ok ? (c > 1 && a("info", `Send succeeded after ${c - 1} retry attempt(s)`, {
1091
+ data: { events: t.events.length, attempt: c }
1069
1092
  }), this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, !0) : !1;
1070
- } catch (c) {
1071
- const u = l === 3;
1072
- if (c instanceof M)
1073
- throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, c;
1074
- if (c instanceof J) {
1093
+ } catch (l) {
1094
+ const u = c === 3;
1095
+ if (l instanceof M)
1096
+ throw this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, l;
1097
+ if (l instanceof J) {
1075
1098
  this.consecutiveNetworkFailures = 0, this.circuitOpenedAt = 0, i = !1, o = !0, this.armRateLimitCooldown(Date.now() + 6e4), a("warn", "Rate limited, skipping retries", {
1076
- data: { events: e.events.length, attempt: l, cooldownMs: 6e4 }
1099
+ data: { events: e.events.length, attempt: c, cooldownMs: 6e4 }
1077
1100
  });
1078
1101
  break;
1079
1102
  }
1080
- if (c instanceof Z || (i = !1), c instanceof TypeError || (o = !0), a(
1103
+ if (l instanceof Z || (i = !1), l instanceof TypeError || (o = !0), a(
1081
1104
  u ? "error" : "warn",
1082
- `Send attempt ${l} failed${u ? " (all retries exhausted)" : ", will retry"}`,
1105
+ `Send attempt ${c} failed${u ? " (all retries exhausted)" : ", will retry"}`,
1083
1106
  {
1084
- error: c,
1107
+ error: l,
1085
1108
  data: {
1086
1109
  events: e.events.length,
1087
1110
  url: s.replace(/\/\/[^/]+/, "//[DOMAIN]"),
1088
- attempt: l,
1111
+ attempt: c,
1089
1112
  maxAttempts: 3
1090
1113
  }
1091
1114
  }
1092
1115
  ), !u) {
1093
- await this.backoffDelay(l);
1116
+ await this.backoffDelay(c);
1094
1117
  continue;
1095
1118
  }
1096
1119
  return i ? (a("debug", "All retry attempts timed out, preserving batch for retry", {
@@ -1122,8 +1145,8 @@ class vs extends T {
1122
1145
  });
1123
1146
  if (!o.ok) {
1124
1147
  if (o.status >= 400 && o.status < 500 && o.status !== 408 && o.status !== 429) {
1125
- const c = await this.readTraceLogErrorCode(o), u = c ? `HTTP ${o.status}: ${o.statusText} (${c})` : `HTTP ${o.status}: ${o.statusText}`;
1126
- throw new M(u, o.status, c);
1148
+ const l = await this.readTraceLogErrorCode(o), u = l ? `HTTP ${o.status}: ${o.statusText} (${l})` : `HTTP ${o.status}: ${o.statusText}`;
1149
+ throw new M(u, o.status, l);
1127
1150
  }
1128
1151
  throw o.status === 429 ? new J(`HTTP 429: ${o.statusText}`) : new Error(`HTTP ${o.status}: ${o.statusText}`);
1129
1152
  }
@@ -1137,7 +1160,7 @@ class vs extends T {
1137
1160
  async readTraceLogErrorCode(e) {
1138
1161
  try {
1139
1162
  const t = await e.clone().json();
1140
- if (typeof t.code == "string" && t.code.length > 0 && t.code.length <= Bt)
1163
+ if (typeof t.code == "string" && t.code.length > 0 && t.code.length <= jt)
1141
1164
  return t.code;
1142
1165
  } catch {
1143
1166
  }
@@ -1151,8 +1174,8 @@ class vs extends T {
1151
1174
  const o = new Blob([i], { type: "application/json" });
1152
1175
  if (!this.isSendBeaconAvailable())
1153
1176
  return a("warn", "sendBeacon not available, persisting events for recovery"), this.persistEvents(t), !1;
1154
- const l = navigator.sendBeacon(r, o);
1155
- return l || (a("warn", "sendBeacon rejected request, persisting events for recovery"), this.persistEvents(t)), l;
1177
+ const c = navigator.sendBeacon(r, o);
1178
+ return c || (a("warn", "sendBeacon rejected request, persisting events for recovery"), this.persistEvents(t)), c;
1156
1179
  }
1157
1180
  prepareRequest(e) {
1158
1181
  let t = Date.now();
@@ -1164,7 +1187,7 @@ class vs extends T {
1164
1187
  idempotency_token: e._metadata?.idempotency_token ?? this.computeContentToken(e),
1165
1188
  referer: typeof window < "u" ? window.location.href : void 0,
1166
1189
  timestamp: t,
1167
- client_version: jt
1190
+ client_version: Yt
1168
1191
  }
1169
1192
  };
1170
1193
  return {
@@ -1208,16 +1231,16 @@ class vs extends T {
1208
1231
  return !e.timestamp || typeof e.timestamp != "number" ? !1 : (Date.now() - e.timestamp) / (1e3 * 60 * 60) < 2;
1209
1232
  }
1210
1233
  createRecoveryBody(e) {
1211
- const { timestamp: t, recoveryFailures: s, ...r } = e, i = r.events ?? [], o = Date.now() - 5184e5, l = i.filter((c) => {
1212
- const u = typeof c.timestamp == "number" ? c.timestamp : new Date(c.timestamp).getTime();
1234
+ const { timestamp: t, recoveryFailures: s, ...r } = e, i = r.events ?? [], o = Date.now() - 5184e5, c = i.filter((l) => {
1235
+ const u = typeof l.timestamp == "number" ? l.timestamp : new Date(l.timestamp).getTime();
1213
1236
  return Number.isFinite(u) && u >= o;
1214
1237
  });
1215
- return l.length < i.length && a("debug", "Recovery dropped stale events", {
1238
+ return c.length < i.length && a("debug", "Recovery dropped stale events", {
1216
1239
  data: {
1217
- dropped: i.length - l.length,
1218
- kept: l.length
1240
+ dropped: i.length - c.length,
1241
+ kept: c.length
1219
1242
  }
1220
- }), { ...r, events: l };
1243
+ }), { ...r, events: c };
1221
1244
  }
1222
1245
  persistEvents(e) {
1223
1246
  const t = this.getPersistedData(), s = typeof t?.recoveryFailures == "number" && Number.isFinite(t.recoveryFailures) ? t.recoveryFailures : 0;
@@ -1227,10 +1250,10 @@ class vs extends T {
1227
1250
  try {
1228
1251
  const r = this.getPersistedData();
1229
1252
  if (!s && r && r.timestamp) {
1230
- const l = Date.now() - r.timestamp;
1231
- if (l < 1e3)
1253
+ const c = Date.now() - r.timestamp;
1254
+ if (c < 1e3)
1232
1255
  return a("debug", "Skipping persistence, another tab recently persisted events", {
1233
- data: { timeSinceExisting: l }
1256
+ data: { timeSinceExisting: c }
1234
1257
  }), !0;
1235
1258
  }
1236
1259
  const i = {
@@ -1256,12 +1279,12 @@ class vs extends T {
1256
1279
  }
1257
1280
  logPermanentError(e, t) {
1258
1281
  const s = Date.now(), r = `${t.statusCode ?? "unknown"}:${t.responseCode ?? ""}`;
1259
- (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== r || s - this.lastPermanentErrorLog.timestamp >= $t) && (a("error", e, {
1282
+ (!this.lastPermanentErrorLog || this.lastPermanentErrorLog.key !== r || s - this.lastPermanentErrorLog.timestamp >= Wt) && (a("error", e, {
1260
1283
  data: { status: t.statusCode, code: t.responseCode, message: t.message }
1261
1284
  }), this.lastPermanentErrorLog = { key: r, timestamp: s });
1262
1285
  }
1263
1286
  }
1264
- class Ts extends T {
1287
+ class As extends T {
1265
1288
  bootTime;
1266
1289
  bootTimestamp;
1267
1290
  hasPerformanceNow;
@@ -1295,8 +1318,8 @@ class Ts extends T {
1295
1318
  } : { valid: !0 };
1296
1319
  }
1297
1320
  }
1298
- const _s = new Set(Object.values(d));
1299
- class ys extends T {
1321
+ const Ls = new Set(Object.values(d));
1322
+ class bs extends T {
1300
1323
  dataSenders;
1301
1324
  emitter;
1302
1325
  timeManager;
@@ -1328,9 +1351,9 @@ class ys extends T {
1328
1351
  * @param emitter - Optional event emitter for local event consumption
1329
1352
  */
1330
1353
  constructor(e, t = null) {
1331
- super(), this.emitter = t, this.timeManager = new Ts(), this.dataSenders = [];
1354
+ super(), this.emitter = t, this.timeManager = new As(), this.dataSenders = [];
1332
1355
  const s = this.get("collectApiUrls");
1333
- s?.saas && this.dataSenders.push(new vs(e, s.saas)), this.saveSessionCountsDebounced = this.debounce((r) => {
1356
+ s?.saas && this.dataSenders.push(new ws(e, s.saas)), this.saveSessionCountsDebounced = this.debounce((r) => {
1334
1357
  this.saveSessionCounts(r);
1335
1358
  }, 500), this.cleanupExpiredSessionCounts();
1336
1359
  }
@@ -1363,7 +1386,7 @@ class ys extends T {
1363
1386
  async (t) => t.recoverPersistedEvents({
1364
1387
  onSuccess: (s, r, i) => {
1365
1388
  if (r && r.length > 0) {
1366
- const o = r.map((l) => l.id);
1389
+ const o = r.map((c) => c.id);
1367
1390
  this.removeProcessedEvents(o), i && this.emitEventsQueue(i);
1368
1391
  }
1369
1392
  },
@@ -1440,15 +1463,15 @@ class ys extends T {
1440
1463
  scroll_data: r,
1441
1464
  click_data: i,
1442
1465
  custom_event: o,
1443
- web_vitals: l,
1444
- error_data: c,
1466
+ web_vitals: c,
1467
+ error_data: l,
1445
1468
  page_view: u
1446
1469
  }) {
1447
1470
  if (!e) {
1448
1471
  a("error", "Event type is required - event will be ignored");
1449
1472
  return;
1450
1473
  }
1451
- if (!_s.has(e)) {
1474
+ if (!Ls.has(e)) {
1452
1475
  a("error", "Invalid event type - event will be ignored", {
1453
1476
  data: { type: e }
1454
1477
  });
@@ -1465,8 +1488,8 @@ class ys extends T {
1465
1488
  scroll_data: r,
1466
1489
  click_data: i,
1467
1490
  custom_event: o,
1468
- web_vitals: l,
1469
- error_data: c,
1491
+ web_vitals: c,
1492
+ error_data: l,
1470
1493
  page_view: u
1471
1494
  });
1472
1495
  return;
@@ -1509,19 +1532,19 @@ class ys extends T {
1509
1532
  if (!this.checkPerEventRateLimit(o.name, _))
1510
1533
  return;
1511
1534
  }
1512
- const gt = S === d.SESSION_START, mt = t || this.get("pageUrl"), G = this.buildEventPayload({
1535
+ const St = S === d.SESSION_START, Et = t || this.get("pageUrl"), G = this.buildEventPayload({
1513
1536
  type: S,
1514
- page_url: mt,
1537
+ page_url: Et,
1515
1538
  from_page_url: s,
1516
1539
  scroll_data: r,
1517
1540
  click_data: i,
1518
1541
  custom_event: o,
1519
- web_vitals: l,
1520
- error_data: c,
1542
+ web_vitals: c,
1543
+ error_data: l,
1521
1544
  page_view: u
1522
1545
  });
1523
1546
  if (G && !(!p && !this.shouldSample())) {
1524
- if (gt) {
1547
+ if (St) {
1525
1548
  const _ = this.get("sessionId");
1526
1549
  if (!_) {
1527
1550
  a("error", "Session start event requires sessionId - event will be ignored");
@@ -1927,7 +1950,7 @@ class ys extends T {
1927
1950
  ), r = await Promise.allSettled(s), i = r.some((o) => this.isSuccessfulResult(o));
1928
1951
  if (i) {
1929
1952
  this.removeProcessedEvents(t), this.emitEventsQueue(e);
1930
- const o = r.filter((l) => !this.isSuccessfulResult(l)).length;
1953
+ const o = r.filter((c) => !this.isSuccessfulResult(c)).length;
1931
1954
  o > 0 && a("debug", "Async send completed with some failures, removed from queue and persisted per-integration", {
1932
1955
  data: { eventCount: t.length, failedCount: o, sessionId: e.session_id }
1933
1956
  });
@@ -1981,14 +2004,14 @@ class ys extends T {
1981
2004
  const h = this.createEventSignature(u);
1982
2005
  s.has(h) || r.push(h), s.set(h, u);
1983
2006
  }
1984
- const i = r.map((u) => s.get(u)).filter((u) => !!u).sort((u, h) => u.type === d.SESSION_START && h.type !== d.SESSION_START ? -1 : h.type === d.SESSION_START && u.type !== d.SESSION_START ? 1 : u.timestamp - h.timestamp).map(({ _session_id: u, ...h }) => h), o = this.get("config")?.globalMetadata, l = this.get("identity");
2007
+ const i = r.map((u) => s.get(u)).filter((u) => !!u).sort((u, h) => u.type === d.SESSION_START && h.type !== d.SESSION_START ? -1 : h.type === d.SESSION_START && u.type !== d.SESSION_START ? 1 : u.timestamp - h.timestamp).map(({ _session_id: u, ...h }) => h), o = this.get("config")?.globalMetadata, c = this.get("identity");
1985
2008
  return {
1986
2009
  user_id: this.get("userId"),
1987
2010
  session_id: e,
1988
2011
  device: this.get("device"),
1989
2012
  events: i,
1990
2013
  ...o && { global_metadata: o },
1991
- ...l && { identify: l }
2014
+ ...c && { identify: c }
1992
2015
  };
1993
2016
  }
1994
2017
  buildEventPayload(e) {
@@ -2002,13 +2025,13 @@ class ys extends T {
2002
2025
  o.valid || a("warn", "Event timestamp validation failed", {
2003
2026
  data: { type: e.type, error: o.error }
2004
2027
  });
2005
- const l = this.get("sessionReferrer"), c = this.get("sessionUtm");
2028
+ const c = this.get("sessionReferrer"), l = this.get("sessionUtm"), u = this.get("sessionClickIds");
2006
2029
  return { ...{
2007
- id: Jt(),
2030
+ id: ss(),
2008
2031
  type: e.type,
2009
2032
  page_url: r,
2010
2033
  timestamp: i,
2011
- ...l && { referrer: l },
2034
+ ...c && { referrer: c },
2012
2035
  ...e.from_page_url && { from_page_url: e.from_page_url },
2013
2036
  ...e.scroll_data && { scroll_data: e.scroll_data },
2014
2037
  ...e.click_data && { click_data: e.click_data },
@@ -2016,7 +2039,8 @@ class ys extends T {
2016
2039
  ...e.web_vitals && { web_vitals: e.web_vitals },
2017
2040
  ...e.error_data && { error_data: e.error_data },
2018
2041
  ...e.page_view && { page_view: e.page_view },
2019
- ...c && { utm: c }
2042
+ ...l && { utm: l },
2043
+ ...u && { click_ids: u }
2020
2044
  }, _session_id: t };
2021
2045
  }
2022
2046
  isDuplicateEvent(e) {
@@ -2111,11 +2135,11 @@ class ys extends T {
2111
2135
  emitEvent(e) {
2112
2136
  if (this.emitter) {
2113
2137
  const { _session_id: t, ...s } = e;
2114
- this.emitter.emit(k.EVENT, s);
2138
+ this.emitter.emit(D.EVENT, s);
2115
2139
  }
2116
2140
  }
2117
2141
  emitEventsQueue(e) {
2118
- this.emitter && this.emitter.emit(k.QUEUE, e);
2142
+ this.emitter && this.emitter.emit(D.QUEUE, e);
2119
2143
  }
2120
2144
  /**
2121
2145
  * Creates a debounced version of a function that delays execution until after
@@ -2190,13 +2214,13 @@ class ys extends T {
2190
2214
  loadSessionCounts(e) {
2191
2215
  if (typeof window > "u" || typeof localStorage > "u")
2192
2216
  return this.getInitialCounts();
2193
- const t = this.get("userId") || "anonymous", s = Fe(t, e);
2217
+ const t = this.get("userId") || "anonymous", s = Ve(t, e);
2194
2218
  try {
2195
2219
  const r = localStorage.getItem(s);
2196
2220
  if (!r)
2197
2221
  return this.getInitialCounts();
2198
2222
  const i = JSON.parse(r);
2199
- return i._timestamp && Date.now() - i._timestamp > Ve ? (a("debug", "Session counts expired, clearing", {
2223
+ return i._timestamp && Date.now() - i._timestamp > He ? (a("debug", "Session counts expired, clearing", {
2200
2224
  data: { sessionId: e, age: Date.now() - i._timestamp }
2201
2225
  }), localStorage.removeItem(s), this.getInitialCounts()) : typeof i.total == "number" && typeof i[d.CLICK] == "number" && typeof i[d.PAGE_VIEW] == "number" && typeof i[d.CUSTOM] == "number" && typeof i[d.SCROLL] == "number" ? {
2202
2226
  total: i.total,
@@ -2240,12 +2264,12 @@ class ys extends T {
2240
2264
  cleanupExpiredSessionCounts() {
2241
2265
  if (!(typeof window > "u" || typeof localStorage > "u"))
2242
2266
  try {
2243
- const e = localStorage.getItem(He);
2267
+ const e = localStorage.getItem(xe);
2244
2268
  if (e) {
2245
2269
  const i = Date.now() - parseInt(e, 10);
2246
- if (i < xe) {
2270
+ if (i < $e) {
2247
2271
  a("debug", "Skipping session counts cleanup (throttled)", {
2248
- data: { timeSinceLastCleanup: i, throttleMs: xe }
2272
+ data: { timeSinceLastCleanup: i, throttleMs: $e }
2249
2273
  });
2250
2274
  return;
2251
2275
  }
@@ -2255,17 +2279,17 @@ class ys extends T {
2255
2279
  const o = localStorage.key(i);
2256
2280
  if (o?.startsWith(s))
2257
2281
  try {
2258
- const l = localStorage.getItem(o);
2259
- if (l) {
2260
- const c = JSON.parse(l);
2261
- c._timestamp && Date.now() - c._timestamp > Ve && r.push(o);
2282
+ const c = localStorage.getItem(o);
2283
+ if (c) {
2284
+ const l = JSON.parse(c);
2285
+ l._timestamp && Date.now() - l._timestamp > He && r.push(o);
2262
2286
  }
2263
2287
  } catch {
2264
2288
  }
2265
2289
  }
2266
2290
  r.forEach((i) => {
2267
2291
  localStorage.removeItem(i), a("debug", "Cleaned up expired session counts", { data: { key: i } });
2268
- }), r.length > 0 && a("info", `Cleaned up ${r.length} expired session counts entries`), localStorage.setItem(He, Date.now().toString());
2292
+ }), r.length > 0 && a("info", `Cleaned up ${r.length} expired session counts entries`), localStorage.setItem(xe, Date.now().toString());
2269
2293
  } catch (e) {
2270
2294
  a("warn", "Failed to cleanup expired session counts", { error: e });
2271
2295
  }
@@ -2299,7 +2323,7 @@ class ys extends T {
2299
2323
  * @internal
2300
2324
  */
2301
2325
  saveSessionCounts(e) {
2302
- const t = this.get("userId") || "anonymous", s = Fe(t, e);
2326
+ const t = this.get("userId") || "anonymous", s = Ve(t, e);
2303
2327
  try {
2304
2328
  const r = {
2305
2329
  ...this.sessionEventCounts,
@@ -2315,7 +2339,7 @@ class ys extends T {
2315
2339
  }
2316
2340
  }
2317
2341
  }
2318
- class Is {
2342
+ class Ms {
2319
2343
  /**
2320
2344
  * Gets or creates a unique user ID.
2321
2345
  *
@@ -2333,15 +2357,15 @@ class Is {
2333
2357
  * @returns Persistent unique user ID (UUID v4 format)
2334
2358
  */
2335
2359
  static getId(e) {
2336
- const t = e.getItem(pe);
2360
+ const t = e.getItem(Se);
2337
2361
  if (t)
2338
2362
  return t;
2339
- const s = rt();
2340
- return e.setItem(pe, s), s;
2363
+ const s = at();
2364
+ return e.setItem(Se, s), s;
2341
2365
  }
2342
2366
  }
2343
- const ws = /^\d{13}-[a-z0-9]{9}$/;
2344
- class As extends T {
2367
+ const Cs = /^\d{13}-[a-z0-9]{9}$/;
2368
+ class Rs extends T {
2345
2369
  storageManager;
2346
2370
  eventManager;
2347
2371
  projectId;
@@ -2351,6 +2375,7 @@ class As extends T {
2351
2375
  broadcastChannel = null;
2352
2376
  isTracking = !1;
2353
2377
  needsRenewal = !1;
2378
+ prerenderActivationHandler = null;
2354
2379
  /**
2355
2380
  * Creates a SessionManager instance.
2356
2381
  *
@@ -2367,9 +2392,14 @@ class As extends T {
2367
2392
  return;
2368
2393
  }
2369
2394
  const e = this.getProjectId();
2370
- this.broadcastChannel = new BroadcastChannel(_t(e)), this.broadcastChannel.onmessage = (t) => {
2395
+ this.broadcastChannel = new BroadcastChannel(wt(e)), this.broadcastChannel.onmessage = (t) => {
2371
2396
  const { action: s, sessionId: r, timestamp: i, projectId: o } = t.data ?? {};
2372
- o === e && (s === "session_start" && r && typeof i == "number" && i > Date.now() - 5e3 ? (this.set("sessionId", r), this.persistSession(r, i), this.isTracking && this.setupSessionTimeout()) : s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } }));
2397
+ if (o === e)
2398
+ if (s === "session_start" && r && typeof i == "number" && i > Date.now() - 5e3) {
2399
+ this.set("sessionId", r);
2400
+ const c = this.loadStoredSession();
2401
+ this.set("sessionReferrer", c?.referrer), this.set("sessionUtm", c?.utm), this.set("sessionClickIds", c?.clickIds), this.persistSession(r, i, c?.referrer, c?.utm, c?.clickIds), this.isTracking && this.setupSessionTimeout();
2402
+ } else s && s !== "session_start" && a("debug", "Ignored BroadcastChannel message with unknown action", { data: { action: s } });
2373
2403
  };
2374
2404
  }
2375
2405
  shareSession(e) {
@@ -2387,19 +2417,20 @@ class As extends T {
2387
2417
  const e = this.loadStoredSession();
2388
2418
  if (!e)
2389
2419
  return null;
2390
- if (!ws.test(e.id))
2420
+ if (!Cs.test(e.id))
2391
2421
  return a("warn", "Invalid session ID format recovered from storage, clearing", {
2392
2422
  data: { sessionId: e.id }
2393
2423
  }), this.clearStoredSession(), null;
2394
2424
  const t = this.get("config")?.sessionTimeout ?? 9e5;
2395
2425
  return Date.now() - e.lastActivity > t ? (this.clearStoredSession(), null) : e.id;
2396
2426
  }
2397
- persistSession(e, t = Date.now(), s, r) {
2427
+ persistSession(e, t = Date.now(), s, r, i) {
2398
2428
  this.saveStoredSession({
2399
2429
  id: e,
2400
2430
  lastActivity: t,
2401
2431
  ...s && { referrer: s },
2402
- ...r && { utm: r }
2432
+ ...r && { utm: r },
2433
+ ...i && { clickIds: i }
2403
2434
  });
2404
2435
  }
2405
2436
  clearStoredSession() {
@@ -2432,7 +2463,7 @@ class As extends T {
2432
2463
  this.storageManager.setItem(t, s), this.storageManager.setSessionItem(t, s);
2433
2464
  }
2434
2465
  getSessionStorageKey() {
2435
- return Tt(this.getProjectId());
2466
+ return It(this.getProjectId());
2436
2467
  }
2437
2468
  getProjectId() {
2438
2469
  return this.projectId;
@@ -2471,6 +2502,13 @@ class As extends T {
2471
2502
  * - Prevents race condition with secondary tabs
2472
2503
  * - Ensures secondary tabs can receive session_start message
2473
2504
  *
2505
+ * **Pre-rendering**:
2506
+ * - On a pre-rendered page (`document.prerendering === true`), every observable side
2507
+ * effect (persistence, cross-tab sync, SESSION_START, listeners) is deferred to the
2508
+ * `prerenderingchange` activation event via `activateSession()`. `sessionId` is still
2509
+ * set in state synchronously so `init()` returns a real id. A prerender that is never
2510
+ * activated persists and emits nothing.
2511
+ *
2474
2512
  * **Called by**: `SessionHandler.startTracking()` during `App.init()`
2475
2513
  *
2476
2514
  * **Important**: After successful call, `sessionId` is available in global state
@@ -2495,33 +2533,48 @@ class As extends T {
2495
2533
  return;
2496
2534
  }
2497
2535
  const e = this.recoverSession(), t = e ?? this.generateSessionId();
2498
- let s, r;
2536
+ let s, r, i;
2499
2537
  if (e) {
2500
- const i = this.loadStoredSession();
2501
- s = i?.referrer ?? de(), r = i?.utm ?? he();
2538
+ const o = this.loadStoredSession();
2539
+ s = o?.referrer ?? he(), r = o?.utm ?? fe(), i = o?.clickIds ?? de();
2502
2540
  } else
2503
- s = de(), r = he();
2541
+ s = he(), r = fe(), i = de();
2504
2542
  a("debug", "Session tracking initialized", {
2505
2543
  data: {
2506
2544
  sessionId: t,
2507
2545
  wasRecovered: !!e,
2508
2546
  willEmitSessionStart: !e,
2509
2547
  sessionReferrer: s,
2510
- hasUtm: !!r
2548
+ hasUtm: !!r,
2549
+ hasClickIds: !!i
2511
2550
  }
2512
2551
  }), this.isTracking = !0;
2513
2552
  try {
2514
- this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", r), this.persistSession(t, Date.now(), s, r), this.initCrossTabSync(), this.shareSession(t), e ? a("debug", "Session recovered, skipping SESSION_START", {
2515
- data: { sessionId: t }
2516
- }) : (a("debug", "Emitting SESSION_START event", {
2517
- data: { sessionId: t }
2518
- }), this.eventManager.track({
2519
- type: d.SESSION_START
2520
- })), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
2521
- } catch (i) {
2522
- throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), i;
2553
+ if (this.set("sessionId", t), this.set("sessionReferrer", s), this.set("sessionUtm", r), this.set("sessionClickIds", i), ot()) {
2554
+ this.prerenderActivationHandler = () => {
2555
+ this.prerenderActivationHandler = null, this.activateSession(t, e, s, r, i);
2556
+ }, document.addEventListener("prerenderingchange", this.prerenderActivationHandler, { once: !0 });
2557
+ return;
2558
+ }
2559
+ this.activateSession(t, e, s, r, i);
2560
+ } catch (o) {
2561
+ throw this.isTracking = !1, this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.set("sessionId", null), o;
2523
2562
  }
2524
2563
  }
2564
+ /**
2565
+ * Commits all observable session side effects: persistence, cross-tab sync, the
2566
+ * SESSION_START emit (new sessions only) and the activity/lifecycle/timeout listeners.
2567
+ *
2568
+ * Runs synchronously on a normal page load. On a pre-rendered page it is deferred to
2569
+ * the `prerenderingchange` (activation) event, so a prerender that is never activated
2570
+ * persists nothing and emits nothing.
2571
+ *
2572
+ * BroadcastChannel is initialized before SESSION_START so secondary tabs can receive
2573
+ * the `session_start` message (avoids a cross-tab race).
2574
+ */
2575
+ activateSession(e, t, s, r, i) {
2576
+ this.persistSession(e, Date.now(), s, r, i), this.initCrossTabSync(), this.shareSession(e), t ? a("debug", "Session recovered, skipping SESSION_START", { data: { sessionId: e } }) : (a("debug", "Emitting SESSION_START event", { data: { sessionId: e } }), this.eventManager.track({ type: d.SESSION_START })), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
2577
+ }
2525
2578
  generateSessionId() {
2526
2579
  return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
2527
2580
  }
@@ -2535,7 +2588,13 @@ class As extends T {
2535
2588
  resetSessionTimeout() {
2536
2589
  this.setupSessionTimeout();
2537
2590
  const e = this.get("sessionId");
2538
- e && this.persistSession(e, Date.now(), this.get("sessionReferrer"), this.get("sessionUtm"));
2591
+ e && this.persistSession(
2592
+ e,
2593
+ Date.now(),
2594
+ this.get("sessionReferrer"),
2595
+ this.get("sessionUtm"),
2596
+ this.get("sessionClickIds")
2597
+ );
2539
2598
  }
2540
2599
  clearSessionTimeout() {
2541
2600
  this.sessionTimeoutId && (clearTimeout(this.sessionTimeoutId), this.sessionTimeoutId = null);
@@ -2551,10 +2610,10 @@ class As extends T {
2551
2610
  */
2552
2611
  renewSession() {
2553
2612
  this.needsRenewal = !1;
2554
- const e = this.generateSessionId(), t = de(), s = he();
2613
+ const e = this.generateSessionId(), t = he(), s = fe(), r = de();
2555
2614
  a("debug", "Renewing session after timeout", {
2556
2615
  data: { newSessionId: e }
2557
- }), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", s), this.persistSession(e, Date.now(), t, s), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
2616
+ }), this.set("sessionId", e), this.set("sessionReferrer", t), this.set("sessionUtm", s), this.set("sessionClickIds", r), this.persistSession(e, Date.now(), t, s, r), this.cleanupCrossTabSync(), this.initCrossTabSync(), this.shareSession(e), this.eventManager.track({
2558
2617
  type: d.SESSION_START
2559
2618
  }), this.eventManager.flushPendingEvents(), this.setupSessionTimeout();
2560
2619
  }
@@ -2596,14 +2655,14 @@ class As extends T {
2596
2655
  * Called by session timeout timer.
2597
2656
  */
2598
2657
  enterRenewalMode() {
2599
- this.clearSessionTimeout(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.needsRenewal = !0, a("debug", "Session timed out, entering renewal mode");
2658
+ this.clearSessionTimeout(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.set("sessionClickIds", void 0), this.needsRenewal = !0, a("debug", "Session timed out, entering renewal mode");
2600
2659
  }
2601
2660
  /**
2602
2661
  * Fully resets session state and cleans up all resources.
2603
2662
  * Called by stopTracking() for explicit session termination.
2604
2663
  */
2605
2664
  resetSessionState() {
2606
- this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.needsRenewal = !1, this.isTracking = !1;
2665
+ this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupLifecycleListeners(), this.cleanupCrossTabSync(), this.cleanupPrerenderActivation(), this.clearStoredSession(), this.set("sessionId", null), this.set("hasStartSession", !1), this.set("sessionReferrer", void 0), this.set("sessionUtm", void 0), this.set("sessionClickIds", void 0), this.needsRenewal = !1, this.isTracking = !1;
2607
2666
  }
2608
2667
  /**
2609
2668
  * Stops session tracking and cleans up all resources.
@@ -2669,10 +2728,19 @@ class As extends T {
2669
2728
  * ```
2670
2729
  */
2671
2730
  destroy() {
2672
- this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
2731
+ this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.cleanupPrerenderActivation(), this.isTracking = !1, this.needsRenewal = !1, this.set("hasStartSession", !1);
2732
+ }
2733
+ /**
2734
+ * Removes the pending `prerenderingchange` listener when the manager is torn
2735
+ * down before activation (the discarded-prerender case). On the activation path
2736
+ * `{ once: true }` removes the listener and the handler nulls its own reference,
2737
+ * so this is a no-op then.
2738
+ */
2739
+ cleanupPrerenderActivation() {
2740
+ this.prerenderActivationHandler && (document.removeEventListener("prerenderingchange", this.prerenderActivationHandler), this.prerenderActivationHandler = null);
2673
2741
  }
2674
2742
  }
2675
- class bs extends T {
2743
+ class Ns extends T {
2676
2744
  eventManager;
2677
2745
  storageManager;
2678
2746
  sessionManager = null;
@@ -2707,7 +2775,7 @@ class bs extends T {
2707
2775
  }
2708
2776
  const t = this.get("config")?.integrations?.tracelog?.projectId ?? "custom";
2709
2777
  try {
2710
- this.sessionManager = new As(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
2778
+ this.sessionManager = new Rs(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
2711
2779
  } catch (s) {
2712
2780
  if (this.sessionManager) {
2713
2781
  try {
@@ -2760,7 +2828,7 @@ class bs extends T {
2760
2828
  this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0);
2761
2829
  }
2762
2830
  }
2763
- class Ls extends T {
2831
+ class Os extends T {
2764
2832
  eventManager;
2765
2833
  onTrack;
2766
2834
  originalPushState;
@@ -2800,7 +2868,7 @@ class Ls extends T {
2800
2868
  };
2801
2869
  }
2802
2870
  trackCurrentPage = () => {
2803
- const e = window.location.href, t = _e(e, this.get("config").sensitiveQueryParams);
2871
+ const e = window.location.href, t = ye(e, this.get("config").sensitiveQueryParams);
2804
2872
  if (this.get("pageUrl") === t)
2805
2873
  return;
2806
2874
  const s = Date.now(), r = this.get("config").pageViewThrottleMs ?? 1e3;
@@ -2818,7 +2886,7 @@ class Ls extends T {
2818
2886
  }), this.get("config").flushOnSpaNavigation === !0 && this.eventManager.flushImmediately();
2819
2887
  };
2820
2888
  trackInitialPageView() {
2821
- const e = _e(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
2889
+ const e = ye(window.location.href, this.get("config").sensitiveQueryParams), t = this.extractPageViewData();
2822
2890
  this.lastPageViewTime = Date.now(), this.eventManager.track({
2823
2891
  type: d.PAGE_VIEW,
2824
2892
  page_url: e,
@@ -2834,7 +2902,7 @@ class Ls extends T {
2834
2902
  };
2835
2903
  }
2836
2904
  }
2837
- class Ms extends T {
2905
+ class Ps extends T {
2838
2906
  eventManager;
2839
2907
  lastClickTimes = /* @__PURE__ */ new Map();
2840
2908
  clickHandler;
@@ -2867,7 +2935,7 @@ class Ms extends T {
2867
2935
  const i = this.get("config")?.clickThrottleMs ?? 300;
2868
2936
  if (i > 0 && !this.checkClickThrottle(r, i))
2869
2937
  return;
2870
- const o = this.findTrackingElement(r), l = this.getRelevantClickElement(r), c = this.calculateClickCoordinates(t);
2938
+ const o = this.findTrackingElement(r), c = this.getRelevantClickElement(r), l = this.calculateClickCoordinates(t);
2871
2939
  if (o) {
2872
2940
  const h = this.extractTrackingData(o);
2873
2941
  if (h) {
@@ -2881,11 +2949,11 @@ class Ms extends T {
2881
2949
  });
2882
2950
  }
2883
2951
  }
2884
- if (!c) {
2952
+ if (!l) {
2885
2953
  a("debug", "Click skipped: invalid coordinates (likely synthetic)");
2886
2954
  return;
2887
2955
  }
2888
- const u = this.generateClickData(r, l, c);
2956
+ const u = this.generateClickData(r, c, l);
2889
2957
  this.eventManager.track({
2890
2958
  type: d.CLICK,
2891
2959
  click_data: u
@@ -2902,7 +2970,7 @@ class Ms extends T {
2902
2970
  this.clickHandler && (window.removeEventListener("click", this.clickHandler, !0), this.clickHandler = void 0), this.lastClickTimes.clear(), this.lastPruneTime = 0;
2903
2971
  }
2904
2972
  shouldIgnoreElement(e) {
2905
- return e.hasAttribute(`${b}-ignore`) ? !0 : e.closest(`[${b}-ignore]`) !== null;
2973
+ return e.hasAttribute(`${L}-ignore`) ? !0 : e.closest(`[${L}-ignore]`) !== null;
2906
2974
  }
2907
2975
  /**
2908
2976
  * Checks per-element click throttling to prevent double-clicks and rapid spam
@@ -2932,7 +3000,7 @@ class Ms extends T {
2932
3000
  for (const [s, r] of this.lastClickTimes.entries())
2933
3001
  r < t && this.lastClickTimes.delete(s);
2934
3002
  if (this.lastClickTimes.size > 1e3) {
2935
- const s = Array.from(this.lastClickTimes.entries()).sort((o, l) => o[1] - l[1]), r = this.lastClickTimes.size - 1e3, i = s.slice(0, r);
3003
+ const s = Array.from(this.lastClickTimes.entries()).sort((o, c) => o[1] - c[1]), r = this.lastClickTimes.size - 1e3, i = s.slice(0, r);
2936
3004
  for (const [o] of i)
2937
3005
  this.lastClickTimes.delete(o);
2938
3006
  a("debug", "ClickHandler: Pruned throttle cache", {
@@ -2953,8 +3021,8 @@ class Ms extends T {
2953
3021
  const t = e.getAttribute("data-testid");
2954
3022
  if (t)
2955
3023
  return `[data-testid="${t}"]`;
2956
- const s = e.getAttribute(`${b}-name`);
2957
- return s ? `[${b}-name="${s}"]` : this.getElementPath(e);
3024
+ const s = e.getAttribute(`${L}-name`);
3025
+ return s ? `[${L}-name="${s}"]` : this.getElementPath(e);
2958
3026
  }
2959
3027
  /**
2960
3028
  * Generates a DOM path for an element (e.g., "body>div>button")
@@ -2973,10 +3041,10 @@ class Ms extends T {
2973
3041
  return t.join(">") || "unknown";
2974
3042
  }
2975
3043
  findTrackingElement(e) {
2976
- return e.hasAttribute(`${b}-name`) ? e : e.closest(`[${b}-name]`);
3044
+ return e.hasAttribute(`${L}-name`) ? e : e.closest(`[${L}-name]`);
2977
3045
  }
2978
3046
  getRelevantClickElement(e) {
2979
- for (const t of pt)
3047
+ for (const t of vt)
2980
3048
  try {
2981
3049
  if (e.matches(t))
2982
3050
  return e;
@@ -2994,7 +3062,7 @@ class Ms extends T {
2994
3062
  return typeof t != "number" || typeof s != "number" || !Number.isFinite(t) || !Number.isFinite(s) || t === 0 && s === 0 && !e.isTrusted ? null : { x: t, y: s };
2995
3063
  }
2996
3064
  extractTrackingData(e) {
2997
- const t = e.getAttribute(`${b}-name`), s = e.getAttribute(`${b}-value`);
3065
+ const t = e.getAttribute(`${L}-name`), s = e.getAttribute(`${L}-value`);
2998
3066
  if (t)
2999
3067
  return {
3000
3068
  element: e,
@@ -3003,7 +3071,7 @@ class Ms extends T {
3003
3071
  };
3004
3072
  }
3005
3073
  generateClickData(e, t, s) {
3006
- const { x: r, y: i } = s, o = this.getRelevantText(e, t), l = t.getAttribute("href") ?? void 0;
3074
+ const { x: r, y: i } = s, o = this.getRelevantText(e, t), c = t.getAttribute("href") ?? void 0;
3007
3075
  return {
3008
3076
  x: r,
3009
3077
  y: i,
@@ -3011,7 +3079,7 @@ class Ms extends T {
3011
3079
  ...t.id && { id: t.id },
3012
3080
  ...t.className && { class: t.className },
3013
3081
  ...o && { text: o },
3014
- ...l && { href: l }
3082
+ ...c && { href: c }
3015
3083
  };
3016
3084
  }
3017
3085
  getRelevantText(e, t) {
@@ -3028,7 +3096,7 @@ class Ms extends T {
3028
3096
  };
3029
3097
  }
3030
3098
  }
3031
- class Rs extends T {
3099
+ class ks extends T {
3032
3100
  eventManager;
3033
3101
  containers = [];
3034
3102
  limitWarningLogged = !1;
@@ -3095,7 +3163,7 @@ class Rs extends T {
3095
3163
  return t.tagName.toLowerCase();
3096
3164
  }
3097
3165
  setupScrollContainer(e, t) {
3098
- if (this.containers.some((c) => c.element === e) || e !== window && !this.isElementScrollable(e))
3166
+ if (this.containers.some((l) => l.element === e) || e !== window && !this.isElementScrollable(e))
3099
3167
  return;
3100
3168
  const r = this.getScrollTop(e), i = this.calculateScrollDepth(
3101
3169
  r,
@@ -3109,13 +3177,13 @@ class Rs extends T {
3109
3177
  lastEventTime: 0,
3110
3178
  debounceTimer: null,
3111
3179
  listener: null
3112
- }, l = () => {
3180
+ }, c = () => {
3113
3181
  this.get("suppressNextScroll") || (this.clearContainerTimer(o), o.debounceTimer = window.setTimeout(() => {
3114
- const c = this.calculateScrollData(o);
3115
- c && this.processScrollEvent(o, c, Date.now()), o.debounceTimer = null;
3182
+ const l = this.calculateScrollData(o);
3183
+ l && this.processScrollEvent(o, l, Date.now()), o.debounceTimer = null;
3116
3184
  }, 250));
3117
3185
  };
3118
- o.listener = l, this.containers.push(o), e === window ? window.addEventListener("scroll", l, { passive: !0 }) : e.addEventListener("scroll", l, { passive: !0 });
3186
+ o.listener = c, this.containers.push(o), e === window ? window.addEventListener("scroll", c, { passive: !0 }) : e.addEventListener("scroll", c, { passive: !0 });
3119
3187
  }
3120
3188
  processScrollEvent(e, t, s) {
3121
3189
  if (!this.shouldEmitScrollEvent(e, t, s))
@@ -3154,7 +3222,7 @@ class Rs extends T {
3154
3222
  e.debounceTimer !== null && (clearTimeout(e.debounceTimer), e.debounceTimer = null);
3155
3223
  }
3156
3224
  getScrollDirection(e, t) {
3157
- return e > t ? Se.DOWN : Se.UP;
3225
+ return e > t ? Ee.DOWN : Ee.UP;
3158
3226
  }
3159
3227
  calculateScrollDepth(e, t, s) {
3160
3228
  if (t <= s)
@@ -3166,8 +3234,8 @@ class Rs extends T {
3166
3234
  const { element: t, lastScrollPos: s } = e, r = this.getScrollTop(t);
3167
3235
  if (Math.abs(r - s) < 10 || t === window && !this.isWindowScrollable())
3168
3236
  return null;
3169
- const o = this.getViewportHeight(t), l = this.getScrollHeight(t), c = this.getScrollDirection(r, s), u = this.calculateScrollDepth(r, l, o);
3170
- return e.lastScrollPos = r, { depth: u, direction: c };
3237
+ const o = this.getViewportHeight(t), c = this.getScrollHeight(t), l = this.getScrollDirection(r, s), u = this.calculateScrollDepth(r, c, o);
3238
+ return e.lastScrollPos = r, { depth: u, direction: l };
3171
3239
  }
3172
3240
  getScrollTop(e) {
3173
3241
  return e === window ? window.scrollY : e.scrollTop;
@@ -3183,8 +3251,8 @@ class Rs extends T {
3183
3251
  return s && r;
3184
3252
  }
3185
3253
  }
3186
- const Cs = "tracelog_session_id", Ns = "tracelog_user_id";
3187
- class Os extends T {
3254
+ const Ds = "tracelog_session_id", Us = "tracelog_user_id";
3255
+ class Fs extends T {
3188
3256
  visibilityHandler = null;
3189
3257
  pageshowHandler = null;
3190
3258
  lastSyncedKey = null;
@@ -3205,8 +3273,8 @@ class Os extends T {
3205
3273
  r !== this.lastSyncedKey && (this.lastSyncedKey = r, this.postCartUpdate(e, s));
3206
3274
  }
3207
3275
  postCartUpdate(e, t) {
3208
- const s = { [Cs]: e };
3209
- t.length > 0 && (s[Ns] = t);
3276
+ const s = { [Ds]: e };
3277
+ t.length > 0 && (s[Us] = t);
3210
3278
  try {
3211
3279
  fetch("/cart/update.js", {
3212
3280
  method: "POST",
@@ -3243,7 +3311,7 @@ class Os extends T {
3243
3311
  this.visibilityHandler && (document.removeEventListener("visibilitychange", this.visibilityHandler), this.visibilityHandler = null), this.pageshowHandler && (window.removeEventListener("pageshow", this.pageshowHandler), this.pageshowHandler = null);
3244
3312
  }
3245
3313
  }
3246
- class Ps {
3314
+ class Vs {
3247
3315
  storage;
3248
3316
  sessionStorageRef;
3249
3317
  fallbackStorage = /* @__PURE__ */ new Map();
@@ -3304,7 +3372,7 @@ class Ps {
3304
3372
  const e = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], t = [], s = [];
3305
3373
  for (let i = 0; i < this.storage.length; i++) {
3306
3374
  const o = this.storage.key(i);
3307
- o?.startsWith("tracelog_") && (o.startsWith("tracelog_persisted_events_") ? t.push(o) : e.some((l) => o.startsWith(l)) || s.push(o));
3375
+ o?.startsWith("tracelog_") && (o.startsWith("tracelog_persisted_events_") ? t.push(o) : e.some((c) => o.startsWith(c)) || s.push(o));
3308
3376
  }
3309
3377
  const r = [...t, ...s.slice(0, 5)];
3310
3378
  return r.length === 0 ? !1 : (r.forEach((i) => {
@@ -3356,7 +3424,7 @@ class Ps {
3356
3424
  this.fallbackSessionStorage.delete(e);
3357
3425
  }
3358
3426
  }
3359
- class Ds extends T {
3427
+ class Hs extends T {
3360
3428
  eventManager;
3361
3429
  reportedByNav = /* @__PURE__ */ new Map();
3362
3430
  navigationHistory = [];
@@ -3366,7 +3434,7 @@ class Ds extends T {
3366
3434
  navigationCounter = 0;
3367
3435
  // Counter for handling simultaneous navigations edge case
3368
3436
  constructor(e) {
3369
- super(), this.eventManager = e, this.vitalThresholds = ze(Te);
3437
+ super(), this.eventManager = e, this.vitalThresholds = Qe(_e);
3370
3438
  }
3371
3439
  /**
3372
3440
  * Starts tracking Web Vitals and performance metrics.
@@ -3382,8 +3450,8 @@ class Ds extends T {
3382
3450
  * @returns Promise that resolves when tracking is initialized
3383
3451
  */
3384
3452
  async startTracking() {
3385
- const e = this.get("config"), t = e?.webVitalsMode ?? Te;
3386
- this.vitalThresholds = ze(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals();
3453
+ const e = this.get("config"), t = e?.webVitalsMode ?? _e;
3454
+ this.vitalThresholds = Qe(t), e?.webVitalsThresholds && (this.vitalThresholds = { ...this.vitalThresholds, ...e.webVitalsThresholds }), await this.initWebVitals();
3387
3455
  }
3388
3456
  /**
3389
3457
  * Stops tracking Web Vitals and cleans up resources.
@@ -3423,8 +3491,8 @@ class Ds extends T {
3423
3491
  for (const o of i) {
3424
3492
  if (o.hadRecentInput === !0)
3425
3493
  continue;
3426
- const l = typeof o.value == "number" ? o.value : 0;
3427
- e += l;
3494
+ const c = typeof o.value == "number" ? o.value : 0;
3495
+ e += c;
3428
3496
  }
3429
3497
  this.sendVital({ type: "CLS", value: Number(e.toFixed(2)) });
3430
3498
  },
@@ -3443,8 +3511,8 @@ class Ds extends T {
3443
3511
  let r = 0;
3444
3512
  const i = s.getEntries();
3445
3513
  for (const o of i) {
3446
- const l = (o.processingEnd ?? 0) - (o.startTime ?? 0);
3447
- r = Math.max(r, l);
3514
+ const c = (o.processingEnd ?? 0) - (o.startTime ?? 0);
3515
+ r = Math.max(r, c);
3448
3516
  }
3449
3517
  r > 0 && this.sendVital({ type: "INP", value: Number(r.toFixed(2)) });
3450
3518
  },
@@ -3453,9 +3521,9 @@ class Ds extends T {
3453
3521
  }
3454
3522
  async initWebVitals() {
3455
3523
  try {
3456
- const { onLCP: e, onCLS: t, onFCP: s, onTTFB: r, onINP: i } = await Promise.resolve().then(() => an), o = (l) => (c) => {
3457
- const u = Number(c.value.toFixed(2));
3458
- this.sendVital({ type: l, value: u });
3524
+ const { onLCP: e, onCLS: t, onFCP: s, onTTFB: r, onINP: i } = await Promise.resolve().then(() => hn), o = (c) => (l) => {
3525
+ const u = Number(l.value.toFixed(2));
3526
+ this.sendVital({ type: c, value: u });
3459
3527
  };
3460
3528
  e(o("LCP"), { reportAllChanges: !1 }), t(o("CLS"), { reportAllChanges: !1 }), s(o("FCP"), { reportAllChanges: !1 }), r(o("TTFB"), { reportAllChanges: !1 }), i(o("INP"), { reportAllChanges: !1 });
3461
3529
  } catch (e) {
@@ -3483,7 +3551,7 @@ class Ds extends T {
3483
3551
  return;
3484
3552
  if (s)
3485
3553
  s.add(e.type);
3486
- else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > Gt) {
3554
+ else if (this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type])), this.navigationHistory.push(t), this.navigationHistory.length > zt) {
3487
3555
  const i = this.navigationHistory.shift();
3488
3556
  i && this.reportedByNav.delete(i);
3489
3557
  }
@@ -3544,18 +3612,18 @@ class Ds extends T {
3544
3612
  try {
3545
3613
  if (!this.isObserverSupported(e))
3546
3614
  return !1;
3547
- const i = new PerformanceObserver((o, l) => {
3615
+ const i = new PerformanceObserver((o, c) => {
3548
3616
  try {
3549
- t(o, l);
3550
- } catch (c) {
3617
+ t(o, c);
3618
+ } catch (l) {
3551
3619
  a("debug", "Observer callback failed", {
3552
- error: c,
3620
+ error: l,
3553
3621
  data: { type: e }
3554
3622
  });
3555
3623
  }
3556
3624
  if (r)
3557
3625
  try {
3558
- l.disconnect();
3626
+ c.disconnect();
3559
3627
  } catch {
3560
3628
  }
3561
3629
  });
@@ -3601,7 +3669,7 @@ class se extends T {
3601
3669
  this.resetPageviewCounter();
3602
3670
  }, window.addEventListener("pagehide", this.pagehideHandler, { passive: !0 }), this.emitter && (this.pageviewResetListener = (e) => {
3603
3671
  (e.type === d.SESSION_START || e.type === d.PAGE_VIEW) && this.resetPageviewCounter();
3604
- }, this.emitter.on(k.EVENT, this.pageviewResetListener));
3672
+ }, this.emitter.on(D.EVENT, this.pageviewResetListener));
3605
3673
  }
3606
3674
  /**
3607
3675
  * Stops tracking errors and cleans up resources.
@@ -3612,7 +3680,7 @@ class se extends T {
3612
3680
  * - Resets burst detection counters
3613
3681
  */
3614
3682
  stopTracking() {
3615
- window.removeEventListener("error", this.handleError), window.removeEventListener("unhandledrejection", this.handleRejection), this.pagehideHandler && (window.removeEventListener("pagehide", this.pagehideHandler), this.pagehideHandler = null), this.emitter && this.pageviewResetListener && (this.emitter.off(k.EVENT, this.pageviewResetListener), this.pageviewResetListener = null), this.recentErrors.clear(), this.pageviewSignatureCounts.clear(), this.errorBurstCounter = 0, this.burstWindowStart = 0, this.burstBackoffUntil = 0;
3683
+ window.removeEventListener("error", this.handleError), window.removeEventListener("unhandledrejection", this.handleRejection), this.pagehideHandler && (window.removeEventListener("pagehide", this.pagehideHandler), this.pagehideHandler = null), this.emitter && this.pageviewResetListener && (this.emitter.off(D.EVENT, this.pageviewResetListener), this.pageviewResetListener = null), this.recentErrors.clear(), this.pageviewSignatureCounts.clear(), this.errorBurstCounter = 0, this.burstWindowStart = 0, this.burstBackoffUntil = 0;
3616
3684
  }
3617
3685
  /**
3618
3686
  * Clears the per-pageview signature counter.
@@ -3631,14 +3699,14 @@ class se extends T {
3631
3699
  const e = Date.now();
3632
3700
  if (e < this.burstBackoffUntil)
3633
3701
  return !1;
3634
- if (e - this.burstWindowStart > Ft && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Vt)
3635
- return this.burstBackoffUntil = e + je, a("debug", "Error burst detected - entering cooldown", {
3702
+ if (e - this.burstWindowStart > $t && (this.errorBurstCounter = 0, this.burstWindowStart = e), this.errorBurstCounter++, this.errorBurstCounter > Bt)
3703
+ return this.burstBackoffUntil = e + Ke, a("debug", "Error burst detected - entering cooldown", {
3636
3704
  data: {
3637
3705
  errorsInWindow: this.errorBurstCounter,
3638
- cooldownMs: je
3706
+ cooldownMs: Ke
3639
3707
  }
3640
3708
  }), !1;
3641
- const s = this.get("config").errorSampling ?? nt;
3709
+ const s = this.get("config").errorSampling ?? it;
3642
3710
  return Math.random() < s;
3643
3711
  }
3644
3712
  /**
@@ -3648,17 +3716,13 @@ class se extends T {
3648
3716
  * later signature that recycles the same map key after a counter reset.
3649
3717
  */
3650
3718
  shouldThrottleBySignature(e) {
3651
- const t = Es({
3652
- message: e.message,
3653
- filename: e.filename,
3654
- line: e.line
3655
- }), s = this.pageviewSignatureCounts.get(t) ?? 0;
3656
- if (s >= Ht)
3719
+ const t = Is(e), s = this.pageviewSignatureCounts.get(t) ?? 0;
3720
+ if (s >= Xt)
3657
3721
  return a("debug", "Error throttled (pageview cap)", {
3658
3722
  data: { signature: t, count: s }
3659
3723
  }), !0;
3660
3724
  const r = s + 1;
3661
- return this.pageviewSignatureCounts.set(t, r), this.pageviewSignatureCounts.size > xt && (this.pageviewSignatureCounts.clear(), this.pageviewSignatureCounts.set(t, r)), !1;
3725
+ return this.pageviewSignatureCounts.set(t, r), this.pageviewSignatureCounts.size > Gt && (this.pageviewSignatureCounts.clear(), this.pageviewSignatureCounts.set(t, r)), !1;
3662
3726
  }
3663
3727
  handleError = (e) => {
3664
3728
  if (!this.shouldSample())
@@ -3667,7 +3731,11 @@ class se extends T {
3667
3731
  if (this.shouldSuppressError(V.JS_ERROR, t) || this.shouldThrottleBySignature({
3668
3732
  message: t,
3669
3733
  filename: e.filename,
3670
- line: e.lineno
3734
+ line: e.lineno,
3735
+ // Inline-script errors report the page URL as `filename`; passing the current
3736
+ // page URL lets buildErrorSignatureKey collapse them to origin, byte-identical
3737
+ // to the server cap/dedup hash. normalizeFilename strips query/hash internally.
3738
+ page_url: window.location.href
3671
3739
  }))
3672
3740
  return;
3673
3741
  const s = typeof e.error?.stack == "string" ? this.truncateStack(e.error.stack) : void 0, r = typeof e.error?.name == "string" && e.error.name !== "Error" ? e.error.name : void 0;
@@ -3715,24 +3783,24 @@ class se extends T {
3715
3783
  }
3716
3784
  }
3717
3785
  sanitize(e) {
3718
- const t = e.length > Xe ? e.slice(0, Xe) + "..." : e;
3786
+ const t = e.length > Ge ? e.slice(0, Ge) + "..." : e;
3719
3787
  return Y(t);
3720
3788
  }
3721
3789
  shouldSuppressError(e, t) {
3722
3790
  const s = Date.now(), r = `${e}:${t}`, i = this.recentErrors.get(r);
3723
- return i !== void 0 && s - i < We ? (this.recentErrors.set(r, s), !0) : (this.recentErrors.set(r, s), this.recentErrors.size > Ut ? (this.recentErrors.clear(), this.recentErrors.set(r, s), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
3791
+ return i !== void 0 && s - i < je ? (this.recentErrors.set(r, s), !0) : (this.recentErrors.set(r, s), this.recentErrors.size > xt ? (this.recentErrors.clear(), this.recentErrors.set(r, s), !1) : (this.recentErrors.size > Q && this.pruneOldErrors(), !1));
3724
3792
  }
3725
3793
  static TRUNCATION_SUFFIX = `
3726
3794
  ...truncated`;
3727
3795
  truncateStack(e) {
3728
- if (e.length <= Ge) return Y(e);
3729
- const t = Ge - se.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + se.TRUNCATION_SUFFIX;
3796
+ if (e.length <= We) return Y(e);
3797
+ const t = We - se.TRUNCATION_SUFFIX.length, s = e.slice(0, t) + se.TRUNCATION_SUFFIX;
3730
3798
  return Y(s);
3731
3799
  }
3732
3800
  pruneOldErrors() {
3733
3801
  const e = Date.now();
3734
3802
  for (const [r, i] of this.recentErrors.entries())
3735
- e - i > We && this.recentErrors.delete(r);
3803
+ e - i > je && this.recentErrors.delete(r);
3736
3804
  if (this.recentErrors.size <= Q)
3737
3805
  return;
3738
3806
  const t = Array.from(this.recentErrors.entries()).sort((r, i) => r[1] - i[1]), s = this.recentErrors.size - Q;
@@ -3742,13 +3810,14 @@ class se extends T {
3742
3810
  }
3743
3811
  }
3744
3812
  }
3745
- class ks extends T {
3813
+ class xs extends T {
3746
3814
  isInitialized = !1;
3747
3815
  suppressNextScrollTimer = null;
3748
3816
  pageUnloadHandler = null;
3749
3817
  pageShowHandler = null;
3750
3818
  visibilityFlushHandler = null;
3751
- emitter = new ds();
3819
+ prerenderActivationHandler = null;
3820
+ emitter = new ms();
3752
3821
  managers = {};
3753
3822
  handlers = {};
3754
3823
  integrationInstances = {};
@@ -3763,9 +3832,9 @@ class ks extends T {
3763
3832
  async init(e = {}) {
3764
3833
  if (this.isInitialized)
3765
3834
  return { sessionId: this.get("sessionId") ?? "" };
3766
- this.managers.storage = new Ps();
3835
+ this.managers.storage = new Vs();
3767
3836
  try {
3768
- return this.setupState(e), this.managers.event = new ys(this.managers.storage, this.emitter), this.loadPersistedIdentity(), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((t) => {
3837
+ return this.setupState(e), this.managers.event = new bs(this.managers.storage, this.emitter), this.loadPersistedIdentity(), this.initializeHandlers(), this.setupPageLifecycleListeners(), await this.managers.event.recoverPersistedEvents().catch((t) => {
3769
3838
  a("warn", "Failed to recover persisted events", { error: t });
3770
3839
  }), this.isInitialized = !0, { sessionId: this.get("sessionId") ?? "" };
3771
3840
  } catch (t) {
@@ -3786,7 +3855,7 @@ class ks extends T {
3786
3855
  }
3787
3856
  let r = t;
3788
3857
  t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
3789
- const { valid: i, error: o, sanitizedMetadata: l } = us(e, r);
3858
+ const { valid: i, error: o, sanitizedMetadata: c } = gs(e, r);
3790
3859
  if (!i) {
3791
3860
  if (this.get("mode") === ee.QA)
3792
3861
  throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${o}`);
@@ -3797,7 +3866,7 @@ class ks extends T {
3797
3866
  type: d.CUSTOM,
3798
3867
  custom_event: {
3799
3868
  name: e,
3800
- ...l && { metadata: l }
3869
+ ...c && { metadata: c }
3801
3870
  }
3802
3871
  }), s?.critical === !0 && (this.managers.event.flushImmediatelySync() || a("debug", "Critical event flush returned false (deferred to in-flight send or empty queue)", {
3803
3872
  data: { name: e }
@@ -3821,18 +3890,18 @@ class ks extends T {
3821
3890
  } catch (s) {
3822
3891
  a("warn", "Failed to stop tracking", { error: s });
3823
3892
  }
3824
- }), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.pageUnloadHandler && (window.removeEventListener("pagehide", this.pageUnloadHandler), window.removeEventListener("beforeunload", this.pageUnloadHandler), this.pageUnloadHandler = null), this.pageShowHandler && (window.removeEventListener("pageshow", this.pageShowHandler), this.pageShowHandler = null), this.visibilityFlushHandler && (document.removeEventListener("visibilitychange", this.visibilityFlushHandler), this.visibilityFlushHandler = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.set("suppressNextScroll", !1), this.set("sessionId", null), this.set("identity", void 0), this.clearPersistedIdentity(), this.integrationInstances.shopifyCartLinker?.deactivate(), this.integrationInstances = {}, this.isInitialized = !1, this.handlers = {}, this.managers = {});
3893
+ }), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.pageUnloadHandler && (window.removeEventListener("pagehide", this.pageUnloadHandler), window.removeEventListener("beforeunload", this.pageUnloadHandler), this.pageUnloadHandler = null), this.pageShowHandler && (window.removeEventListener("pageshow", this.pageShowHandler), this.pageShowHandler = null), this.visibilityFlushHandler && (document.removeEventListener("visibilitychange", this.visibilityFlushHandler), this.visibilityFlushHandler = null), this.prerenderActivationHandler && (document.removeEventListener("prerenderingchange", this.prerenderActivationHandler), this.prerenderActivationHandler = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.set("suppressNextScroll", !1), this.set("sessionId", null), this.set("identity", void 0), this.clearPersistedIdentity(), this.integrationInstances.shopifyCartLinker?.deactivate(), this.integrationInstances = {}, this.isInitialized = !1, this.handlers = {}, this.managers = {});
3825
3894
  }
3826
3895
  setupState(e = {}) {
3827
3896
  this.set("config", e);
3828
- const t = Is.getId(this.managers.storage);
3897
+ const t = Ms.getId(this.managers.storage);
3829
3898
  this.set("userId", t);
3830
- const s = ts(e);
3899
+ const s = is(e);
3831
3900
  this.set("collectApiUrls", s);
3832
- const r = kt();
3901
+ const r = Ht();
3833
3902
  this.set("device", r);
3834
- const i = _e(window.location.href, e.sensitiveQueryParams);
3835
- this.set("pageUrl", i), Qt() && this.set("mode", ee.QA);
3903
+ const i = ye(window.location.href, e.sensitiveQueryParams);
3904
+ this.set("pageUrl", i), Zt() && this.set("mode", ee.QA);
3836
3905
  }
3837
3906
  /**
3838
3907
  * @internal Used by api.ts for configuration access
@@ -3887,7 +3956,7 @@ class ks extends T {
3887
3956
  a("warn", "identify() userId exceeds 256 characters", { data: { length: e.trim().length } });
3888
3957
  return;
3889
3958
  }
3890
- const s = e.trim(), r = we(t), i = {
3959
+ const s = e.trim(), r = Ae(t), i = {
3891
3960
  userId: s,
3892
3961
  ...r ? { traits: r } : {}
3893
3962
  };
@@ -3910,8 +3979,8 @@ class ks extends T {
3910
3979
  */
3911
3980
  async resetIdentity() {
3912
3981
  await this.managers.event?.flushImmediately().catch((t) => (a("debug", "Failed to flush before identity reset", { error: t }), !1)), this.set("identity", void 0), this.clearPersistedIdentity();
3913
- const e = rt();
3914
- this.managers.storage.setItem(pe, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
3982
+ const e = at();
3983
+ this.managers.storage.setItem(Se, e), this.set("userId", e), this.set("hasStartSession", !1), this.set("sessionId", null), this.handlers.session?.stopTracking(), this.handlers.session?.startTracking(), a("debug", "Identity reset, new UUID generated");
3915
3984
  }
3916
3985
  /**
3917
3986
  * Returns the project ID used for identity storage scoping.
@@ -3983,7 +4052,7 @@ class ks extends T {
3983
4052
  * localStorage values.
3984
4053
  */
3985
4054
  normalizePersistedIdentity(e) {
3986
- const t = we(e.traits);
4055
+ const t = Ae(e.traits);
3987
4056
  return {
3988
4057
  userId: e.userId.trim(),
3989
4058
  ...t ? { traits: t } : {}
@@ -4013,7 +4082,7 @@ class ks extends T {
4013
4082
  }
4014
4083
  initializeHandlers() {
4015
4084
  const e = this.get("config");
4016
- this.handlers.session = new bs(
4085
+ this.handlers.session = new Ns(
4017
4086
  this.managers.storage,
4018
4087
  this.managers.event
4019
4088
  ), this.handlers.session.startTracking();
@@ -4022,28 +4091,34 @@ class ks extends T {
4022
4091
  this.set("suppressNextScroll", !1);
4023
4092
  }, 500);
4024
4093
  };
4025
- if (this.handlers.pageView = new Ls(this.managers.event, t), this.handlers.pageView.startTracking(), this.handlers.click = new Ms(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new Rs(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new Ds(this.managers.event), this.handlers.performance.startTracking().catch((s) => {
4026
- a("warn", "Failed to start performance tracking", { error: s });
4027
- }), this.handlers.error = new se(this.managers.event, this.emitter), this.handlers.error.startTracking(), e.integrations?.tracelog?.shopify) {
4028
- const s = new Os();
4029
- s.activate(), this.integrationInstances.shopifyCartLinker = s, this.emitter.on(k.EVENT, (r) => {
4030
- r.type === d.SESSION_START && s.onSessionChange();
4031
- });
4032
- }
4094
+ this.handlers.pageView = new Os(this.managers.event, t), this.handlers.click = new Ps(this.managers.event), this.handlers.scroll = new ks(this.managers.event), this.handlers.performance = new Hs(this.managers.event), this.handlers.error = new se(this.managers.event, this.emitter);
4095
+ const s = () => {
4096
+ if (this.handlers.pageView?.startTracking(), this.handlers.click?.startTracking(), this.handlers.scroll?.startTracking(), this.handlers.performance?.startTracking().catch((r) => {
4097
+ a("warn", "Failed to start performance tracking", { error: r });
4098
+ }), this.handlers.error?.startTracking(), e.integrations?.tracelog?.shopify) {
4099
+ const r = new Fs();
4100
+ r.activate(), this.integrationInstances.shopifyCartLinker = r, this.emitter.on(D.EVENT, (i) => {
4101
+ i.type === d.SESSION_START && r.onSessionChange();
4102
+ });
4103
+ }
4104
+ };
4105
+ ot() ? (this.prerenderActivationHandler = () => {
4106
+ this.prerenderActivationHandler = null, s();
4107
+ }, document.addEventListener("prerenderingchange", this.prerenderActivationHandler, { once: !0 })) : s();
4033
4108
  }
4034
4109
  }
4035
- const C = [];
4036
- let f = null, D = !1, A = !1, R = null;
4037
- const Us = async (n) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (A = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : f ? { sessionId: f.getSessionId() ?? "" } : (D && R || (D = !0, R = (async () => {
4110
+ const R = [];
4111
+ let f = null, k = !1, A = !1, C = null;
4112
+ const $s = async (n) => typeof window > "u" || typeof document > "u" ? { sessionId: "" } : (A = !1, window.__traceLogDisabled === !0 ? { sessionId: "" } : f ? { sessionId: f.getSessionId() ?? "" } : (k && C || (k = !0, C = (async () => {
4038
4113
  try {
4039
- const e = os(n ?? {}), t = new ks();
4114
+ const e = us(n ?? {}), t = new xs();
4040
4115
  try {
4041
- C.forEach(({ event: o, callback: l }) => {
4042
- t.on(o, l);
4043
- }), C.length = 0;
4044
- const s = t.init(e), r = new Promise((o, l) => {
4116
+ R.forEach(({ event: o, callback: c }) => {
4117
+ t.on(o, c);
4118
+ }), R.length = 0;
4119
+ const s = t.init(e), r = new Promise((o, c) => {
4045
4120
  setTimeout(() => {
4046
- l(new Error("[TraceLog] Initialization timeout after 10000ms"));
4121
+ c(new Error("[TraceLog] Initialization timeout after 10000ms"));
4047
4122
  }, 1e4);
4048
4123
  }), i = await Promise.race([s, r]);
4049
4124
  return f = t, i;
@@ -4058,9 +4133,9 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4058
4133
  } catch (e) {
4059
4134
  throw f = null, e;
4060
4135
  } finally {
4061
- D = !1, R = null;
4136
+ k = !1, C = null;
4062
4137
  }
4063
- })()), R)), Fs = (n, e, t) => {
4138
+ })()), C)), Bs = (n, e, t) => {
4064
4139
  if (!(typeof window > "u" || typeof document > "u")) {
4065
4140
  if (!f)
4066
4141
  throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
@@ -4068,24 +4143,24 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4068
4143
  throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
4069
4144
  f.sendCustomEvent(n, e, t);
4070
4145
  }
4071
- }, Vs = (n, e) => {
4146
+ }, Xs = (n, e) => {
4072
4147
  if (!(typeof window > "u" || typeof document > "u")) {
4073
- if (!f || D) {
4074
- C.push({ event: n, callback: e });
4148
+ if (!f || k) {
4149
+ R.push({ event: n, callback: e });
4075
4150
  return;
4076
4151
  }
4077
4152
  f.on(n, e);
4078
4153
  }
4079
- }, Hs = (n, e) => {
4154
+ }, Gs = (n, e) => {
4080
4155
  if (!(typeof window > "u" || typeof document > "u")) {
4081
4156
  if (!f) {
4082
- const t = C.findIndex((s) => s.event === n && s.callback === e);
4083
- t !== -1 && C.splice(t, 1);
4157
+ const t = R.findIndex((s) => s.event === n && s.callback === e);
4158
+ t !== -1 && R.splice(t, 1);
4084
4159
  return;
4085
4160
  }
4086
4161
  f.off(n, e);
4087
4162
  }
4088
- }, xs = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, $s = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getSessionId(), Bs = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getUserId(), Xs = () => {
4163
+ }, Ws = () => typeof window > "u" || typeof document > "u" ? !1 : f !== null, js = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getSessionId(), Ks = () => typeof window > "u" || typeof document > "u" || !f ? null : f.getUserId(), zs = () => {
4089
4164
  if (!(typeof window > "u" || typeof document > "u")) {
4090
4165
  if (A)
4091
4166
  throw new Error("[TraceLog] Destroy operation already in progress");
@@ -4095,12 +4170,12 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4095
4170
  }
4096
4171
  A = !0;
4097
4172
  try {
4098
- f.destroy(), f = null, D = !1, R = null, C.length = 0, A = !1;
4173
+ f.destroy(), f = null, k = !1, C = null, R.length = 0, A = !1;
4099
4174
  } catch (n) {
4100
- f = null, D = !1, R = null, C.length = 0, A = !1, a("warn", "Error during destroy, forced cleanup completed", { error: n });
4175
+ f = null, k = !1, C = null, R.length = 0, A = !1, a("warn", "Error during destroy, forced cleanup completed", { error: n });
4101
4176
  }
4102
4177
  }
4103
- }, Gs = (n, e) => {
4178
+ }, Qs = (n, e) => {
4104
4179
  if (!(typeof window > "u" || typeof document > "u")) {
4105
4180
  if (!n || typeof n != "string" || n.trim().length === 0) {
4106
4181
  a("warn", "identify() called with invalid userId");
@@ -4119,7 +4194,7 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4119
4194
  return;
4120
4195
  }
4121
4196
  try {
4122
- const t = we(e), s = {
4197
+ const t = Ae(e), s = {
4123
4198
  userId: n.trim(),
4124
4199
  ...t ? { traits: t } : {}
4125
4200
  };
@@ -4128,7 +4203,7 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4128
4203
  a("debug", "Failed to persist pre-init identity");
4129
4204
  }
4130
4205
  }
4131
- }, Ws = async () => {
4206
+ }, Ys = async () => {
4132
4207
  if (!(typeof window > "u" || typeof document > "u")) {
4133
4208
  if (!f) {
4134
4209
  try {
@@ -4141,31 +4216,31 @@ const Us = async (n) => typeof window > "u" || typeof document > "u" ? { session
4141
4216
  throw new Error("[TraceLog] Cannot reset identity while TraceLog is being destroyed");
4142
4217
  await f.resetIdentity();
4143
4218
  }
4144
- }, vn = {
4145
- init: Us,
4146
- event: Fs,
4147
- on: Vs,
4148
- off: Hs,
4149
- isInitialized: xs,
4150
- getSessionId: $s,
4151
- getUserId: Bs,
4152
- destroy: Xs,
4153
- identify: Gs,
4154
- resetIdentity: Ws
4219
+ }, wn = {
4220
+ init: $s,
4221
+ event: Bs,
4222
+ on: Xs,
4223
+ off: Gs,
4224
+ isInitialized: Ws,
4225
+ getSessionId: js,
4226
+ getUserId: Ks,
4227
+ destroy: zs,
4228
+ identify: Qs,
4229
+ resetIdentity: Ys
4155
4230
  };
4156
- var Ae, L, x, it, ne, ot = -1, N = function(n) {
4231
+ var Le, b, x, ct, ne, lt = -1, N = function(n) {
4157
4232
  addEventListener("pageshow", (function(e) {
4158
- e.persisted && (ot = e.timeStamp, n(e));
4233
+ e.persisted && (lt = e.timeStamp, n(e));
4159
4234
  }), !0);
4160
- }, Oe = function() {
4235
+ }, Pe = function() {
4161
4236
  var n = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
4162
4237
  if (n && n.responseStart > 0 && n.responseStart < performance.now()) return n;
4163
4238
  }, ie = function() {
4164
- var n = Oe();
4239
+ var n = Pe();
4165
4240
  return n && n.activationStart || 0;
4166
4241
  }, E = function(n, e) {
4167
- var t = Oe(), s = "navigate";
4168
- return ot >= 0 ? s = "back-forward-cache" : t && (document.prerendering || ie() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: n, 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 };
4242
+ var t = Pe(), s = "navigate";
4243
+ return lt >= 0 ? s = "back-forward-cache" : t && (document.prerendering || ie() > 0 ? s = "prerender" : document.wasDiscarded ? s = "restore" : t.type && (s = t.type.replace(/_/g, "-"))), { name: n, 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 };
4169
4244
  }, U = function(n, e, t) {
4170
4245
  try {
4171
4246
  if (PerformanceObserver.supportedEntryTypes.includes(n)) {
@@ -4181,11 +4256,11 @@ var Ae, L, x, it, ne, ot = -1, N = function(n) {
4181
4256
  }, v = function(n, e, t, s) {
4182
4257
  var r, i;
4183
4258
  return function(o) {
4184
- e.value >= 0 && (o || s) && ((i = e.value - (r || 0)) || r === void 0) && (r = e.value, e.delta = i, e.rating = (function(l, c) {
4185
- return l > c[1] ? "poor" : l > c[0] ? "needs-improvement" : "good";
4259
+ e.value >= 0 && (o || s) && ((i = e.value - (r || 0)) || r === void 0) && (r = e.value, e.delta = i, e.rating = (function(c, l) {
4260
+ return c > l[1] ? "poor" : c > l[0] ? "needs-improvement" : "good";
4186
4261
  })(e.value, t), n(e));
4187
4262
  };
4188
- }, Pe = function(n) {
4263
+ }, ke = function(n) {
4189
4264
  requestAnimationFrame((function() {
4190
4265
  return requestAnimationFrame((function() {
4191
4266
  return n();
@@ -4200,18 +4275,18 @@ var Ae, L, x, it, ne, ot = -1, N = function(n) {
4200
4275
  return function() {
4201
4276
  e || (n(), e = !0);
4202
4277
  };
4203
- }, P = -1, Je = function() {
4278
+ }, P = -1, et = function() {
4204
4279
  return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
4205
4280
  }, re = function(n) {
4206
- document.visibilityState === "hidden" && P > -1 && (P = n.type === "visibilitychange" ? n.timeStamp : 0, js());
4207
- }, Ze = function() {
4281
+ document.visibilityState === "hidden" && P > -1 && (P = n.type === "visibilitychange" ? n.timeStamp : 0, qs());
4282
+ }, tt = function() {
4208
4283
  addEventListener("visibilitychange", re, !0), addEventListener("prerenderingchange", re, !0);
4209
- }, js = function() {
4284
+ }, qs = function() {
4210
4285
  removeEventListener("visibilitychange", re, !0), removeEventListener("prerenderingchange", re, !0);
4211
4286
  }, De = function() {
4212
- return P < 0 && (P = Je(), Ze(), N((function() {
4287
+ return P < 0 && (P = et(), tt(), N((function() {
4213
4288
  setTimeout((function() {
4214
- P = Je(), Ze();
4289
+ P = et(), tt();
4215
4290
  }), 0);
4216
4291
  }))), { get firstHiddenTime() {
4217
4292
  return P;
@@ -4220,50 +4295,50 @@ var Ae, L, x, it, ne, ot = -1, N = function(n) {
4220
4295
  document.prerendering ? addEventListener("prerenderingchange", (function() {
4221
4296
  return n();
4222
4297
  }), !0) : n();
4223
- }, be = [1800, 3e3], at = function(n, e) {
4298
+ }, be = [1800, 3e3], ut = function(n, e) {
4224
4299
  e = e || {}, X((function() {
4225
4300
  var t, s = De(), r = E("FCP"), i = U("paint", (function(o) {
4226
- o.forEach((function(l) {
4227
- l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (r.value = Math.max(l.startTime - ie(), 0), r.entries.push(l), t(!0)));
4301
+ o.forEach((function(c) {
4302
+ c.name === "first-contentful-paint" && (i.disconnect(), c.startTime < s.firstHiddenTime && (r.value = Math.max(c.startTime - ie(), 0), r.entries.push(c), t(!0)));
4228
4303
  }));
4229
4304
  }));
4230
4305
  i && (t = v(n, r, be, e.reportAllChanges), N((function(o) {
4231
- r = E("FCP"), t = v(n, r, be, e.reportAllChanges), Pe((function() {
4306
+ r = E("FCP"), t = v(n, r, be, e.reportAllChanges), ke((function() {
4232
4307
  r.value = performance.now() - o.timeStamp, t(!0);
4233
4308
  }));
4234
4309
  })));
4235
4310
  }));
4236
- }, Le = [0.1, 0.25], Ks = function(n, e) {
4237
- e = e || {}, at(oe((function() {
4238
- var t, s = E("CLS", 0), r = 0, i = [], o = function(c) {
4239
- c.forEach((function(u) {
4311
+ }, Me = [0.1, 0.25], Js = function(n, e) {
4312
+ e = e || {}, ut(oe((function() {
4313
+ var t, s = E("CLS", 0), r = 0, i = [], o = function(l) {
4314
+ l.forEach((function(u) {
4240
4315
  if (!u.hadRecentInput) {
4241
4316
  var h = i[0], p = i[i.length - 1];
4242
4317
  r && u.startTime - p.startTime < 1e3 && u.startTime - h.startTime < 5e3 ? (r += u.value, i.push(u)) : (r = u.value, i = [u]);
4243
4318
  }
4244
4319
  })), r > s.value && (s.value = r, s.entries = i, t());
4245
- }, l = U("layout-shift", o);
4246
- l && (t = v(n, s, Le, e.reportAllChanges), B((function() {
4247
- o(l.takeRecords()), t(!0);
4320
+ }, c = U("layout-shift", o);
4321
+ c && (t = v(n, s, Me, e.reportAllChanges), B((function() {
4322
+ o(c.takeRecords()), t(!0);
4248
4323
  })), N((function() {
4249
- r = 0, s = E("CLS", 0), t = v(n, s, Le, e.reportAllChanges), Pe((function() {
4324
+ r = 0, s = E("CLS", 0), t = v(n, s, Me, e.reportAllChanges), ke((function() {
4250
4325
  return t();
4251
4326
  }));
4252
4327
  })), setTimeout(t, 0));
4253
4328
  })));
4254
- }, lt = 0, ge = 1 / 0, K = 0, zs = function(n) {
4329
+ }, dt = 0, me = 1 / 0, K = 0, Zs = function(n) {
4255
4330
  n.forEach((function(e) {
4256
- e.interactionId && (ge = Math.min(ge, e.interactionId), K = Math.max(K, e.interactionId), lt = K ? (K - ge) / 7 + 1 : 0);
4331
+ e.interactionId && (me = Math.min(me, e.interactionId), K = Math.max(K, e.interactionId), dt = K ? (K - me) / 7 + 1 : 0);
4257
4332
  }));
4258
- }, ct = function() {
4259
- return Ae ? lt : performance.interactionCount || 0;
4260
- }, Qs = function() {
4261
- "interactionCount" in performance || Ae || (Ae = U("event", zs, { type: "event", buffered: !0, durationThreshold: 0 }));
4262
- }, I = [], q = /* @__PURE__ */ new Map(), ut = 0, Ys = function() {
4263
- var n = Math.min(I.length - 1, Math.floor((ct() - ut) / 50));
4333
+ }, ht = function() {
4334
+ return Le ? dt : performance.interactionCount || 0;
4335
+ }, en = function() {
4336
+ "interactionCount" in performance || Le || (Le = U("event", Zs, { type: "event", buffered: !0, durationThreshold: 0 }));
4337
+ }, I = [], q = /* @__PURE__ */ new Map(), ft = 0, tn = function() {
4338
+ var n = Math.min(I.length - 1, Math.floor((ht() - ft) / 50));
4264
4339
  return I[n];
4265
- }, qs = [], Js = function(n) {
4266
- if (qs.forEach((function(r) {
4340
+ }, sn = [], nn = function(n) {
4341
+ if (sn.forEach((function(r) {
4267
4342
  return r(n);
4268
4343
  })), n.interactionId || n.entryType === "first-input") {
4269
4344
  var e = I[I.length - 1], t = q.get(n.interactionId);
@@ -4280,152 +4355,152 @@ var Ae, L, x, it, ne, ot = -1, N = function(n) {
4280
4355
  }));
4281
4356
  }
4282
4357
  }
4283
- }, dt = function(n) {
4358
+ }, gt = function(n) {
4284
4359
  var e = self.requestIdleCallback || self.setTimeout, t = -1;
4285
4360
  return n = oe(n), document.visibilityState === "hidden" ? n() : (t = e(n), B(n)), t;
4286
- }, Me = [200, 500], Zs = function(n, e) {
4361
+ }, Ce = [200, 500], rn = function(n, e) {
4287
4362
  "PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, X((function() {
4288
4363
  var t;
4289
- Qs();
4290
- var s, r = E("INP"), i = function(l) {
4291
- dt((function() {
4292
- l.forEach(Js);
4293
- var c = Ys();
4294
- c && c.latency !== r.value && (r.value = c.latency, r.entries = c.entries, s());
4364
+ en();
4365
+ var s, r = E("INP"), i = function(c) {
4366
+ gt((function() {
4367
+ c.forEach(nn);
4368
+ var l = tn();
4369
+ l && l.latency !== r.value && (r.value = l.latency, r.entries = l.entries, s());
4295
4370
  }));
4296
4371
  }, o = U("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
4297
- s = v(n, r, Me, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), B((function() {
4372
+ s = v(n, r, Ce, e.reportAllChanges), o && (o.observe({ type: "first-input", buffered: !0 }), B((function() {
4298
4373
  i(o.takeRecords()), s(!0);
4299
4374
  })), N((function() {
4300
- ut = ct(), I.length = 0, q.clear(), r = E("INP"), s = v(n, r, Me, e.reportAllChanges);
4375
+ ft = ht(), I.length = 0, q.clear(), r = E("INP"), s = v(n, r, Ce, e.reportAllChanges);
4301
4376
  })));
4302
4377
  })));
4303
- }, Re = [2500, 4e3], me = {}, en = function(n, e) {
4378
+ }, Re = [2500, 4e3], pe = {}, on = function(n, e) {
4304
4379
  e = e || {}, X((function() {
4305
- var t, s = De(), r = E("LCP"), i = function(c) {
4306
- e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
4380
+ var t, s = De(), r = E("LCP"), i = function(l) {
4381
+ e.reportAllChanges || (l = l.slice(-1)), l.forEach((function(u) {
4307
4382
  u.startTime < s.firstHiddenTime && (r.value = Math.max(u.startTime - ie(), 0), r.entries = [u], t());
4308
4383
  }));
4309
4384
  }, o = U("largest-contentful-paint", i);
4310
4385
  if (o) {
4311
4386
  t = v(n, r, Re, e.reportAllChanges);
4312
- var l = oe((function() {
4313
- me[r.id] || (i(o.takeRecords()), o.disconnect(), me[r.id] = !0, t(!0));
4387
+ var c = oe((function() {
4388
+ pe[r.id] || (i(o.takeRecords()), o.disconnect(), pe[r.id] = !0, t(!0));
4314
4389
  }));
4315
- ["keydown", "click"].forEach((function(c) {
4316
- addEventListener(c, (function() {
4317
- return dt(l);
4390
+ ["keydown", "click"].forEach((function(l) {
4391
+ addEventListener(l, (function() {
4392
+ return gt(c);
4318
4393
  }), { once: !0, capture: !0 });
4319
- })), B(l), N((function(c) {
4320
- r = E("LCP"), t = v(n, r, Re, e.reportAllChanges), Pe((function() {
4321
- r.value = performance.now() - c.timeStamp, me[r.id] = !0, t(!0);
4394
+ })), B(c), N((function(l) {
4395
+ r = E("LCP"), t = v(n, r, Re, e.reportAllChanges), ke((function() {
4396
+ r.value = performance.now() - l.timeStamp, pe[r.id] = !0, t(!0);
4322
4397
  }));
4323
4398
  }));
4324
4399
  }
4325
4400
  }));
4326
- }, Ce = [800, 1800], tn = function n(e) {
4401
+ }, Ne = [800, 1800], an = function n(e) {
4327
4402
  document.prerendering ? X((function() {
4328
4403
  return n(e);
4329
4404
  })) : document.readyState !== "complete" ? addEventListener("load", (function() {
4330
4405
  return n(e);
4331
4406
  }), !0) : setTimeout(e, 0);
4332
- }, sn = function(n, e) {
4407
+ }, cn = function(n, e) {
4333
4408
  e = e || {};
4334
- var t = E("TTFB"), s = v(n, t, Ce, e.reportAllChanges);
4335
- tn((function() {
4336
- var r = Oe();
4409
+ var t = E("TTFB"), s = v(n, t, Ne, e.reportAllChanges);
4410
+ an((function() {
4411
+ var r = Pe();
4337
4412
  r && (t.value = Math.max(r.responseStart - ie(), 0), t.entries = [r], s(!0), N((function() {
4338
- t = E("TTFB", 0), (s = v(n, t, Ce, e.reportAllChanges))(!0);
4413
+ t = E("TTFB", 0), (s = v(n, t, Ne, e.reportAllChanges))(!0);
4339
4414
  })));
4340
4415
  }));
4341
- }, H = { passive: !0, capture: !0 }, nn = /* @__PURE__ */ new Date(), et = function(n, e) {
4342
- L || (L = e, x = n, it = /* @__PURE__ */ new Date(), ft(removeEventListener), ht());
4343
- }, ht = function() {
4344
- if (x >= 0 && x < it - nn) {
4345
- var n = { entryType: "first-input", name: L.type, target: L.target, cancelable: L.cancelable, startTime: L.timeStamp, processingStart: L.timeStamp + x };
4416
+ }, H = { passive: !0, capture: !0 }, ln = /* @__PURE__ */ new Date(), st = function(n, e) {
4417
+ b || (b = e, x = n, ct = /* @__PURE__ */ new Date(), pt(removeEventListener), mt());
4418
+ }, mt = function() {
4419
+ if (x >= 0 && x < ct - ln) {
4420
+ var n = { entryType: "first-input", name: b.type, target: b.target, cancelable: b.cancelable, startTime: b.timeStamp, processingStart: b.timeStamp + x };
4346
4421
  ne.forEach((function(e) {
4347
4422
  e(n);
4348
4423
  })), ne = [];
4349
4424
  }
4350
- }, rn = function(n) {
4425
+ }, un = function(n) {
4351
4426
  if (n.cancelable) {
4352
4427
  var e = (n.timeStamp > 1e12 ? /* @__PURE__ */ new Date() : performance.now()) - n.timeStamp;
4353
4428
  n.type == "pointerdown" ? (function(t, s) {
4354
4429
  var r = function() {
4355
- et(t, s), o();
4430
+ st(t, s), o();
4356
4431
  }, i = function() {
4357
4432
  o();
4358
4433
  }, o = function() {
4359
4434
  removeEventListener("pointerup", r, H), removeEventListener("pointercancel", i, H);
4360
4435
  };
4361
4436
  addEventListener("pointerup", r, H), addEventListener("pointercancel", i, H);
4362
- })(e, n) : et(e, n);
4437
+ })(e, n) : st(e, n);
4363
4438
  }
4364
- }, ft = function(n) {
4439
+ }, pt = function(n) {
4365
4440
  ["mousedown", "keydown", "touchstart", "pointerdown"].forEach((function(e) {
4366
- return n(e, rn, H);
4441
+ return n(e, un, H);
4367
4442
  }));
4368
- }, Ne = [100, 300], on = function(n, e) {
4443
+ }, Oe = [100, 300], dn = function(n, e) {
4369
4444
  e = e || {}, X((function() {
4370
- var t, s = De(), r = E("FID"), i = function(c) {
4371
- c.startTime < s.firstHiddenTime && (r.value = c.processingStart - c.startTime, r.entries.push(c), t(!0));
4372
- }, o = function(c) {
4373
- c.forEach(i);
4374
- }, l = U("first-input", o);
4375
- t = v(n, r, Ne, e.reportAllChanges), l && (B(oe((function() {
4376
- o(l.takeRecords()), l.disconnect();
4445
+ var t, s = De(), r = E("FID"), i = function(l) {
4446
+ l.startTime < s.firstHiddenTime && (r.value = l.processingStart - l.startTime, r.entries.push(l), t(!0));
4447
+ }, o = function(l) {
4448
+ l.forEach(i);
4449
+ }, c = U("first-input", o);
4450
+ t = v(n, r, Oe, e.reportAllChanges), c && (B(oe((function() {
4451
+ o(c.takeRecords()), c.disconnect();
4377
4452
  }))), N((function() {
4378
- var c;
4379
- r = E("FID"), t = v(n, r, Ne, e.reportAllChanges), ne = [], x = -1, L = null, ft(addEventListener), c = i, ne.push(c), ht();
4453
+ var l;
4454
+ r = E("FID"), t = v(n, r, Oe, e.reportAllChanges), ne = [], x = -1, b = null, pt(addEventListener), l = i, ne.push(l), mt();
4380
4455
  })));
4381
4456
  }));
4382
4457
  };
4383
- const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4458
+ const hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4384
4459
  __proto__: null,
4385
- CLSThresholds: Le,
4460
+ CLSThresholds: Me,
4386
4461
  FCPThresholds: be,
4387
- FIDThresholds: Ne,
4388
- INPThresholds: Me,
4462
+ FIDThresholds: Oe,
4463
+ INPThresholds: Ce,
4389
4464
  LCPThresholds: Re,
4390
- TTFBThresholds: Ce,
4391
- onCLS: Ks,
4392
- onFCP: at,
4393
- onFID: on,
4394
- onINP: Zs,
4395
- onLCP: en,
4396
- onTTFB: sn
4465
+ TTFBThresholds: Ne,
4466
+ onCLS: Js,
4467
+ onFCP: ut,
4468
+ onFID: dn,
4469
+ onINP: rn,
4470
+ onLCP: on,
4471
+ onTTFB: cn
4397
4472
  }, Symbol.toStringTag, { value: "Module" }));
4398
4473
  export {
4399
4474
  m as AppConfigValidationError,
4400
- ln as DEFAULT_SESSION_TIMEOUT,
4401
- Te as DEFAULT_WEB_VITALS_MODE,
4475
+ fn as DEFAULT_SESSION_TIMEOUT,
4476
+ _e as DEFAULT_WEB_VITALS_MODE,
4402
4477
  w as DeviceType,
4403
- k as EmitterEvent,
4478
+ D as EmitterEvent,
4404
4479
  V as ErrorType,
4405
4480
  d as EventType,
4406
- Sn as InitializationTimeoutError,
4407
- Be as IntegrationValidationError,
4408
- pn as MAX_ARRAY_LENGTH,
4409
- hn as MAX_CUSTOM_EVENT_ARRAY_SIZE,
4410
- dn as MAX_CUSTOM_EVENT_KEYS,
4411
- cn as MAX_CUSTOM_EVENT_NAME_LENGTH,
4412
- un as MAX_CUSTOM_EVENT_STRING_SIZE,
4413
- fn as MAX_NESTED_OBJECT_KEYS,
4414
- gn as MAX_STRING_LENGTH,
4415
- mn as MAX_STRING_LENGTH_IN_ARRAY,
4481
+ yn as InitializationTimeoutError,
4482
+ Xe as IntegrationValidationError,
4483
+ _n as MAX_ARRAY_LENGTH,
4484
+ Sn as MAX_CUSTOM_EVENT_ARRAY_SIZE,
4485
+ pn as MAX_CUSTOM_EVENT_KEYS,
4486
+ gn as MAX_CUSTOM_EVENT_NAME_LENGTH,
4487
+ mn as MAX_CUSTOM_EVENT_STRING_SIZE,
4488
+ En as MAX_NESTED_OBJECT_KEYS,
4489
+ vn as MAX_STRING_LENGTH,
4490
+ Tn as MAX_STRING_LENGTH_IN_ARRAY,
4416
4491
  ee as Mode,
4417
- ns as PII_PATTERNS,
4492
+ as as PII_PATTERNS,
4418
4493
  M as PermanentError,
4419
4494
  J as RateLimitError,
4420
- $e as SamplingRateValidationError,
4421
- Se as ScrollDirection,
4422
- yt as SessionTimeoutValidationError,
4495
+ Be as SamplingRateValidationError,
4496
+ Ee as ScrollDirection,
4497
+ At as SessionTimeoutValidationError,
4423
4498
  F as SpecialApiUrl,
4424
4499
  Z as TimeoutError,
4425
4500
  $ as TraceLogValidationError,
4426
- En as WEB_VITALS_GOOD_THRESHOLDS,
4427
- Ke as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
4428
- Xt as WEB_VITALS_POOR_THRESHOLDS,
4429
- ze as getWebVitalsThresholds,
4430
- vn as tracelog
4501
+ In as WEB_VITALS_GOOD_THRESHOLDS,
4502
+ ze as WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS,
4503
+ Kt as WEB_VITALS_POOR_THRESHOLDS,
4504
+ Qe as getWebVitalsThresholds,
4505
+ wn as tracelog
4431
4506
  };