@sailfish-ai/recorder 1.11.5 → 1.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +19 -1
  2. package/dist/chunkSerializer.js +70 -23
  3. package/dist/chunkSerializer.js.br +0 -0
  4. package/dist/chunkSerializer.js.gz +0 -0
  5. package/dist/chunks/chunkSerializer-DDukZpgl.js +116 -0
  6. package/dist/chunks/chunkSerializer-DDukZpgl.js.br +0 -0
  7. package/dist/chunks/chunkSerializer-DDukZpgl.js.gz +0 -0
  8. package/dist/chunks/chunkSerializer-FQtY90Av.js +115 -0
  9. package/dist/chunks/chunkSerializer-FQtY90Av.js.br +0 -0
  10. package/dist/chunks/chunkSerializer-FQtY90Av.js.gz +0 -0
  11. package/dist/chunks/{index-DiGs9it7.js → index-C-qbsfKe.js} +724 -548
  12. package/dist/chunks/index-C-qbsfKe.js.br +0 -0
  13. package/dist/chunks/index-C-qbsfKe.js.gz +0 -0
  14. package/dist/chunks/{index-CIK1iDN9.js → index-D6axlCRu.js} +757 -577
  15. package/dist/chunks/index-D6axlCRu.js.br +0 -0
  16. package/dist/chunks/index-D6axlCRu.js.gz +0 -0
  17. package/dist/clockSync.js +196 -0
  18. package/dist/clockSync.js.br +0 -0
  19. package/dist/clockSync.js.gz +0 -0
  20. package/dist/errorInterceptor.js +42 -4
  21. package/dist/errorInterceptor.js.br +0 -0
  22. package/dist/errorInterceptor.js.gz +0 -0
  23. package/dist/graphql.js +5 -0
  24. package/dist/graphql.js.br +0 -0
  25. package/dist/graphql.js.gz +0 -0
  26. package/dist/inAppReportIssueModal/index.js +4 -1
  27. package/dist/inAppReportIssueModal/index.js.br +0 -0
  28. package/dist/inAppReportIssueModal/index.js.gz +0 -0
  29. package/dist/inAppReportIssueModal/integrations.js +36 -0
  30. package/dist/inAppReportIssueModal/integrations.js.br +0 -0
  31. package/dist/inAppReportIssueModal/integrations.js.gz +0 -0
  32. package/dist/inAppReportIssueModal/state.js +8 -0
  33. package/dist/inAppReportIssueModal/state.js.br +0 -0
  34. package/dist/inAppReportIssueModal/state.js.gz +0 -0
  35. package/dist/index.js +67 -5
  36. package/dist/index.js.br +0 -0
  37. package/dist/index.js.gz +0 -0
  38. package/dist/privacyMask.js +93 -0
  39. package/dist/privacyMask.js.br +0 -0
  40. package/dist/privacyMask.js.gz +0 -0
  41. package/dist/recorder.cjs +2 -2
  42. package/dist/recorder.cjs.br +0 -0
  43. package/dist/recorder.cjs.gz +0 -0
  44. package/dist/recorder.js +17 -14
  45. package/dist/recorder.js.br +0 -0
  46. package/dist/recorder.js.gz +0 -0
  47. package/dist/recorder.umd.cjs +1338 -1140
  48. package/dist/recorder.umd.cjs.br +0 -0
  49. package/dist/recorder.umd.cjs.gz +0 -0
  50. package/dist/recording.js +84 -13
  51. package/dist/recording.js.br +0 -0
  52. package/dist/recording.js.gz +0 -0
  53. package/dist/types/chunkSerializer.d.ts +14 -0
  54. package/dist/types/clockSync.d.ts +70 -0
  55. package/dist/types/inAppReportIssueModal/integrations.d.ts +1 -0
  56. package/dist/types/inAppReportIssueModal/state.d.ts +2 -0
  57. package/dist/types/index.d.ts +16 -2
  58. package/dist/types/privacyMask.d.ts +46 -0
  59. package/dist/types/recording.d.ts +1 -0
  60. package/dist/types/types.d.ts +23 -0
  61. package/dist/types/websocket.d.ts +1 -0
  62. package/dist/websocket.js +111 -0
  63. package/dist/websocket.js.br +0 -0
  64. package/dist/websocket.js.gz +0 -0
  65. package/package.json +1 -1
  66. package/dist/chunks/chunkSerializer-C8qtomKe.js +0 -95
  67. package/dist/chunks/chunkSerializer-C8qtomKe.js.br +0 -0
  68. package/dist/chunks/chunkSerializer-C8qtomKe.js.gz +0 -0
  69. package/dist/chunks/chunkSerializer-RWnu-UfC.js +0 -94
  70. package/dist/chunks/chunkSerializer-RWnu-UfC.js.br +0 -0
  71. package/dist/chunks/chunkSerializer-RWnu-UfC.js.gz +0 -0
  72. package/dist/chunks/index-CIK1iDN9.js.br +0 -0
  73. package/dist/chunks/index-CIK1iDN9.js.gz +0 -0
  74. package/dist/chunks/index-DiGs9it7.js.br +0 -0
  75. package/dist/chunks/index-DiGs9it7.js.gz +0 -0
@@ -1,3 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1
4
  import e from "reconnecting-websocket";
2
5
  import { EventType as t } from "@sailfish-rrweb/types";
3
6
  function readDebugFlag() {
@@ -35,30 +38,96 @@ function uuidv4() {
35
38
  return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
36
39
  });
37
40
  }
38
- const n = "X-Sf3-Rid", i = 0, o = 1, a = 2, s = 4, r = "recordingEvents";
41
+ const n = "X-Sf3-Rid", i = 0, o = 1, s = 2, r = 4, a = "undefined" != typeof performance && "function" == typeof performance.now;
42
+ function monotonicNow() {
43
+ return a ? performance.now() : Date.now();
44
+ }
45
+ function timeOriginMs() {
46
+ return a ? performance.timeOrigin : 0;
47
+ }
48
+ class ClockSyncManager {
49
+ constructor() {
50
+ __publicField(this, "samples", []);
51
+ __publicField(this, "pending", /* @__PURE__ */ new Map());
52
+ __publicField(this, "estimatedOffsetMs", null);
53
+ __publicField(this, "bestRttMs", null);
54
+ __publicField(this, "lastSyncMonoMs", null);
55
+ }
56
+ beginSync(e2) {
57
+ const t2 = { requestId: e2, clientSendMonoMs: monotonicNow() };
58
+ return this.pending.set(e2, t2), t2;
59
+ }
60
+ abandonSync(e2) {
61
+ this.pending.delete(e2);
62
+ }
63
+ recordTimeSyncResponse(e2) {
64
+ const t2 = this.pending.get(e2.requestId);
65
+ if (!t2) return null;
66
+ this.pending.delete(e2.requestId);
67
+ const n2 = monotonicNow(), i2 = n2 - t2.clientSendMonoMs;
68
+ if (i2 < 0 || !isFinite(i2)) return null;
69
+ const o2 = (t2.clientSendMonoMs + n2) / 2, s2 = (e2.serverReceivedAtMs + e2.serverSentAtMs) / 2 - o2, r2 = { clientSendMonoMs: t2.clientSendMonoMs, clientReceiveMonoMs: n2, serverReceiveWallMs: e2.serverReceivedAtMs, serverSendWallMs: e2.serverSentAtMs, rttMs: i2, estimatedOffsetMs: s2, browserWallAtSyncMs: Date.now() };
70
+ return this.samples.push(r2), this.pruneSamples(n2), this.recompute(n2), r2;
71
+ }
72
+ estimateServerTime(e2) {
73
+ return null == this.estimatedOffsetMs ? null : this.estimatedOffsetMs + e2;
74
+ }
75
+ getSyncMetadata() {
76
+ const e2 = monotonicNow(), t2 = null != this.lastSyncMonoMs ? e2 - this.lastSyncMonoMs : null;
77
+ return { offsetMs: this.estimatedOffsetMs, rttMs: this.bestRttMs, syncAgeMs: t2 };
78
+ }
79
+ getBrowserClockSkewMs() {
80
+ if (0 === this.samples.length) return null;
81
+ const e2 = this.samples[this.samples.length - 1], t2 = e2.estimatedOffsetMs + e2.clientReceiveMonoMs;
82
+ return e2.browserWallAtSyncMs - t2;
83
+ }
84
+ reset() {
85
+ this.samples = [], this.pending.clear(), this.estimatedOffsetMs = null, this.bestRttMs = null, this.lastSyncMonoMs = null;
86
+ }
87
+ pruneSamples(e2) {
88
+ if (0 === this.samples.length) return;
89
+ const t2 = e2 - 6e5;
90
+ this.samples = this.samples.filter((e3) => e3.clientReceiveMonoMs >= t2), this.samples.length > 20 && (this.samples = this.samples.slice(this.samples.length - 20));
91
+ }
92
+ recompute(e2) {
93
+ const t2 = this.samples.filter((e3) => e3.rttMs <= 500).sort((e3, t3) => e3.rttMs - t3.rttMs).slice(0, 5);
94
+ if (0 === t2.length) return this.lastSyncMonoMs = e2, void (this.bestRttMs = null);
95
+ const n2 = t2.map((e3) => e3.estimatedOffsetMs).sort((e3, t3) => e3 - t3);
96
+ this.estimatedOffsetMs = n2[Math.floor(n2.length / 2)], this.bestRttMs = t2[0].rttMs, this.lastSyncMonoMs = e2;
97
+ }
98
+ }
39
99
  let l = null;
100
+ function getClockSyncManager() {
101
+ return l || (l = new ClockSyncManager()), l;
102
+ }
103
+ function buildEventTimeEnvelope(e2, t2) {
104
+ const n2 = getClockSyncManager(), i2 = n2.getSyncMetadata(), o2 = n2.estimateServerTime(e2);
105
+ return { client: { wallTimeMs: t2, monotonicMs: e2, timeOriginMs: timeOriginMs() }, serverEstimated: { eventTimeMs: o2, offsetMs: i2.offsetMs, rttMs: i2.rttMs, syncAgeMs: i2.syncAgeMs } };
106
+ }
107
+ const c = "recordingEvents";
108
+ let d = null;
40
109
  function openDb$1() {
41
110
  return (function hasIndexedDB$1() {
42
111
  return "undefined" != typeof globalThis && !!globalThis.indexedDB;
43
- })() ? l || (l = new Promise((e2) => {
112
+ })() ? d || (d = new Promise((e2) => {
44
113
  try {
45
114
  const t2 = globalThis.indexedDB.open("leapsEventDB", 1);
46
115
  t2.onupgradeneeded = () => {
47
116
  const e3 = t2.result;
48
- e3.objectStoreNames.contains(r) || e3.createObjectStore(r, { keyPath: "id", autoIncrement: true });
117
+ e3.objectStoreNames.contains(c) || e3.createObjectStore(c, { keyPath: "id", autoIncrement: true });
49
118
  }, t2.onsuccess = () => e2(t2.result), t2.onerror = () => e2(null), t2.onblocked = () => {
50
119
  e2(null);
51
120
  };
52
121
  } catch {
53
122
  e2(null);
54
123
  }
55
- }), l) : Promise.resolve(null);
124
+ }), d) : Promise.resolve(null);
56
125
  }
57
126
  function withStore$1(e2, t2) {
58
127
  return openDb$1().then((n2) => n2 ? new Promise((i2) => {
59
128
  try {
60
- const o2 = n2.transaction(r, e2), a2 = o2.objectStore(r);
61
- Promise.resolve(t2(a2)).then((e3) => {
129
+ const o2 = n2.transaction(c, e2), s2 = o2.objectStore(c);
130
+ Promise.resolve(t2(s2)).then((e3) => {
62
131
  o2.oncomplete = () => i2(e3), o2.onerror = () => i2(null);
63
132
  }).catch(() => i2(null));
64
133
  } catch {
@@ -71,29 +140,29 @@ async function deleteEventsByIds(e2) {
71
140
  for (const n2 of e2) t2.delete(n2);
72
141
  });
73
142
  }
74
- const c = "notifyMessages";
75
- let d = null;
143
+ const u = "notifyMessages";
144
+ let p = null;
76
145
  function openDb() {
77
146
  return (function hasIndexedDB() {
78
147
  return "undefined" != typeof globalThis && !!globalThis.indexedDB;
79
- })() ? d || (d = new Promise((e2) => {
148
+ })() ? p || (p = new Promise((e2) => {
80
149
  try {
81
150
  const t2 = globalThis.indexedDB.open("leapsNotifyDB", 1);
82
151
  t2.onupgradeneeded = () => {
83
152
  const e3 = t2.result;
84
- e3.objectStoreNames.contains(c) || e3.createObjectStore(c, { keyPath: "id", autoIncrement: true });
153
+ e3.objectStoreNames.contains(u) || e3.createObjectStore(u, { keyPath: "id", autoIncrement: true });
85
154
  }, t2.onsuccess = () => e2(t2.result), t2.onerror = () => e2(null), t2.onblocked = () => e2(null);
86
155
  } catch {
87
156
  e2(null);
88
157
  }
89
- }), d) : Promise.resolve(null);
158
+ }), p) : Promise.resolve(null);
90
159
  }
91
160
  async function withStore(e2, t2) {
92
161
  const n2 = await openDb();
93
162
  return n2 ? new Promise((i2) => {
94
163
  try {
95
- const o2 = n2.transaction(c, e2), a2 = o2.objectStore(c);
96
- Promise.resolve(t2(a2)).then((e3) => {
164
+ const o2 = n2.transaction(u, e2), s2 = o2.objectStore(u);
165
+ Promise.resolve(t2(s2)).then((e3) => {
97
166
  o2.oncomplete = () => i2(e3), o2.onerror = () => i2(null);
98
167
  }).catch(() => i2(null));
99
168
  } catch {
@@ -111,25 +180,25 @@ async function deleteNotifyMessageById(e2) {
111
180
  t2.delete(e2);
112
181
  });
113
182
  }
114
- const u = "undefined" != typeof globalThis && void 0 !== globalThis.window, p = "undefined" != typeof globalThis && void 0 !== globalThis.document, f = "undefined" != typeof globalThis && "localStorage" in globalThis, g = "undefined" != typeof globalThis && "sessionStorage" in globalThis, m = "sailfishSessionId", h = "__sailfish_refresh__";
115
- let y = null;
183
+ const f = "undefined" != typeof globalThis && void 0 !== globalThis.window, g = "undefined" != typeof globalThis && void 0 !== globalThis.document, m = "undefined" != typeof globalThis && "localStorage" in globalThis, h = "undefined" != typeof globalThis && "sessionStorage" in globalThis, y = "sailfishSessionId", S = "__sailfish_refresh__";
184
+ let b = null;
116
185
  function getOrSetSessionId() {
117
- if (!u) return uuidv4();
118
- if (y) return y;
119
- const e2 = window.name.startsWith(h);
186
+ if (!f) return uuidv4();
187
+ if (b) return b;
188
+ const e2 = window.name.startsWith(S);
120
189
  if (e2 && (window.name = window.name.substring(20)), e2) {
121
- const e3 = window.sessionStorage.getItem(m);
122
- if (e3) return y = e3, e3;
190
+ const e3 = window.sessionStorage.getItem(y);
191
+ if (e3) return b = e3, e3;
123
192
  }
124
193
  const t2 = uuidv4();
125
- y = t2;
194
+ b = t2;
126
195
  try {
127
- window.sessionStorage.setItem(m, t2);
196
+ window.sessionStorage.setItem(y, t2);
128
197
  } catch (e3) {
129
198
  }
130
199
  return t2;
131
200
  }
132
- let b = false;
201
+ let v = false;
133
202
  function buildBatches(e2, t2, n2) {
134
203
  const i2 = {};
135
204
  for (const t3 of e2) {
@@ -138,13 +207,13 @@ function buildBatches(e2, t2, n2) {
138
207
  }
139
208
  const o2 = [];
140
209
  for (const e3 in i2) {
141
- const a2 = i2[e3];
142
- let s2 = [], r2 = 0;
143
- for (const e4 of a2) {
210
+ const s2 = i2[e3];
211
+ let r2 = [], a2 = 0;
212
+ for (const e4 of s2) {
144
213
  const i3 = t2(e4);
145
- r2 + i3 > n2 && (s2.length > 0 && (o2.push(s2), s2 = [], r2 = 0), i3 > n2) || (s2.push(e4), r2 += i3);
214
+ a2 + i3 > n2 && (r2.length > 0 && (o2.push(r2), r2 = [], a2 = 0), i3 > n2) || (r2.push(e4), a2 += i3);
146
215
  }
147
- s2.length > 0 && o2.push(s2);
216
+ r2.length > 0 && o2.push(r2);
148
217
  }
149
218
  return o2;
150
219
  }
@@ -157,22 +226,42 @@ function withAppUrlMetadata(e2) {
157
226
  return { ...e2 ?? {}, appUrl: (e2 == null ? void 0 : e2.appUrl) ?? ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.href) };
158
227
  }
159
228
  /[1-9][0-9]{12}/.test(Date.now().toString()) || (w = () => (/* @__PURE__ */ new Date()).getTime());
160
- const v = readDebugFlag(), S = "per_session";
161
- let k = null, x = null, I = false, T = null, E = null, C = "", $ = "", F = false;
162
- const L = [];
229
+ const k = readDebugFlag(), x = "per_session";
230
+ let I = null, T = null, E = false, M = null, C = null;
231
+ let $ = null, F = 0;
232
+ function requestTimeSync() {
233
+ if (!isWebSocketOpen(T)) return;
234
+ const e2 = getClockSyncManager(), t2 = (function makeTimeSyncRequestId() {
235
+ return F += 1, `ts-${F}-${Math.random().toString(36).slice(2, 10)}`;
236
+ })();
237
+ e2.beginSync(t2);
238
+ wsSendPayload({ type: "time-sync-request", requestId: t2, clientSentAtMs: Date.now() }) || e2.abandonSync(t2);
239
+ }
240
+ function enrichEventWithTimeSync(e2) {
241
+ if (!e2 || "object" != typeof e2) return;
242
+ if (e2.client && null != e2.client.monotonicMs) {
243
+ if (!(null == e2.client.timeOriginMs || Math.abs(e2.client.timeOriginMs - timeOriginMs()) <= 1)) return;
244
+ const t3 = buildEventTimeEnvelope(e2.client.monotonicMs, e2.client.wallTimeMs ?? Date.now());
245
+ return void (e2.serverEstimated ? null == e2.serverEstimated.eventTimeMs && null != t3.serverEstimated.eventTimeMs && (e2.serverEstimated = t3.serverEstimated) : e2.serverEstimated = t3.serverEstimated);
246
+ }
247
+ const t2 = buildEventTimeEnvelope(monotonicNow(), Date.now());
248
+ e2.client = t2.client, e2.serverEstimated = t2.serverEstimated;
249
+ }
250
+ let A = "", L = "", R = false;
251
+ const D = [];
163
252
  function onNavigationChange(e2) {
164
- L.push(e2);
253
+ D.push(e2);
165
254
  }
166
255
  function _updateHrefCache() {
167
- C = window.location.href, $ = window.location.origin + window.location.pathname;
168
- for (const e2 of L) try {
256
+ A = window.location.href, L = window.location.origin + window.location.pathname;
257
+ for (const e2 of D) try {
169
258
  e2();
170
259
  } catch (e3) {
171
260
  }
172
261
  }
173
262
  function ensureHrefCache() {
174
- if (F || "undefined" == typeof window) return;
175
- F = true, _updateHrefCache(), window.addEventListener("popstate", _updateHrefCache), window.addEventListener("hashchange", _updateHrefCache);
263
+ if (R || "undefined" == typeof window) return;
264
+ R = true, _updateHrefCache(), window.addEventListener("popstate", _updateHrefCache), window.addEventListener("hashchange", _updateHrefCache);
176
265
  const e2 = history.pushState;
177
266
  history.pushState = function(...t3) {
178
267
  e2.apply(this, t3), _updateHrefCache();
@@ -183,48 +272,48 @@ function ensureHrefCache() {
183
272
  };
184
273
  }
185
274
  function getCachedHref() {
186
- return C || ("undefined" != typeof window ? window.location.href : "");
275
+ return A || ("undefined" != typeof window ? window.location.href : "");
187
276
  }
188
277
  function getCachedHrefNoQuery() {
189
- return $ || ("undefined" != typeof window ? window.location.origin + window.location.pathname : "");
278
+ return L || ("undefined" != typeof window ? window.location.origin + window.location.pathname : "");
190
279
  }
191
- const M = [];
192
- let A = null;
280
+ const _ = [];
281
+ let P = null;
193
282
  function queueEventForIDB(e2) {
194
- M.push(e2), M.length >= 50 ? _flushIDBQueue() : A || (A = setTimeout(_flushIDBQueue, 100));
283
+ _.push(e2), _.length >= 50 ? _flushIDBQueue() : P || (P = setTimeout(_flushIDBQueue, 100));
195
284
  }
196
285
  function _flushIDBQueue() {
197
- if (A && (clearTimeout(A), A = null), 0 === M.length) return;
286
+ if (P && (clearTimeout(P), P = null), 0 === _.length) return;
198
287
  !(async function saveEventsToIDB(e2) {
199
288
  await withStore$1("readwrite", async (t2) => {
200
289
  for (const n2 of e2) t2.add({ timestamp: Date.now(), data: n2 });
201
290
  });
202
- })(M.splice(0));
291
+ })(_.splice(0));
203
292
  }
204
- let R = false, D = null, _ = null, P = false;
205
- const B = "sailfish_funcspan_global_state";
293
+ let B = false, O = null, j = null, U = false;
294
+ const N = "sailfish_funcspan_global_state";
206
295
  function wsSendPayload(e2) {
207
- if (!isWebSocketOpen(x)) return false;
208
- if (k) try {
209
- return k.postMessage({ type: "send", payload: e2 }), true;
296
+ if (!isWebSocketOpen(T)) return false;
297
+ if (I) try {
298
+ return I.postMessage({ type: "send", payload: e2 }), true;
210
299
  } catch {
211
300
  return false;
212
301
  }
213
302
  try {
214
- return x.send(JSON.stringify(e2)), true;
303
+ return T.send(JSON.stringify(e2)), true;
215
304
  } catch {
216
305
  return false;
217
306
  }
218
307
  }
219
308
  function wsSendRaw(e2) {
220
- if (!isWebSocketOpen(x)) return false;
221
- if (k) try {
222
- return k.postMessage({ type: "sendRaw", payload: e2 }), true;
309
+ if (!isWebSocketOpen(T)) return false;
310
+ if (I) try {
311
+ return I.postMessage({ type: "sendRaw", payload: e2 }), true;
223
312
  } catch {
224
313
  return false;
225
314
  }
226
315
  try {
227
- return x.send(e2), true;
316
+ return T.send(e2), true;
228
317
  } catch {
229
318
  return false;
230
319
  }
@@ -233,40 +322,40 @@ function saveGlobalFuncSpanState(e2, t2) {
233
322
  try {
234
323
  if ("undefined" == typeof localStorage) return;
235
324
  const n2 = { enabled: e2, expirationTimestampMs: t2, savedAt: Date.now() };
236
- localStorage.setItem(B, JSON.stringify(n2)), v && console.log("[Sailfish] Saved funcSpan state to localStorage:", n2);
325
+ localStorage.setItem(N, JSON.stringify(n2)), k && console.log("[Sailfish] Saved funcSpan state to localStorage:", n2);
237
326
  } catch (e3) {
238
- v && console.warn("[Sailfish] Failed to save funcSpan state to localStorage:", e3);
327
+ k && console.warn("[Sailfish] Failed to save funcSpan state to localStorage:", e3);
239
328
  }
240
329
  }
241
330
  function clearGlobalFuncSpanState() {
242
331
  try {
243
332
  if ("undefined" == typeof localStorage) return;
244
- localStorage.removeItem(B), v && console.log("[Sailfish] Cleared funcSpan state from localStorage");
333
+ localStorage.removeItem(N), k && console.log("[Sailfish] Cleared funcSpan state from localStorage");
245
334
  } catch (e2) {
246
- v && console.warn("[Sailfish] Failed to clear funcSpan state from localStorage:", e2);
335
+ k && console.warn("[Sailfish] Failed to clear funcSpan state from localStorage:", e2);
247
336
  }
248
337
  }
249
338
  function clearStaleFuncSpanState() {
250
- R = false, _ = null, P = false, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Cleared stale function span tracking state (backend validation failed)");
339
+ B = false, j = null, U = false, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Cleared stale function span tracking state (backend validation failed)");
251
340
  }
252
- let j = false;
341
+ let q = false;
253
342
  function restoreFuncSpanState() {
254
- if (j) return;
255
- j = true;
343
+ if (q) return;
344
+ q = true;
256
345
  const e2 = (function loadGlobalFuncSpanState() {
257
346
  try {
258
347
  if ("undefined" == typeof localStorage) return null;
259
- const e3 = localStorage.getItem(B);
348
+ const e3 = localStorage.getItem(N);
260
349
  if (!e3) return null;
261
350
  const t2 = JSON.parse(e3);
262
- return v && console.log("[Sailfish] Loaded funcSpan state from localStorage:", t2), t2;
351
+ return k && console.log("[Sailfish] Loaded funcSpan state from localStorage:", t2), t2;
263
352
  } catch (e3) {
264
- return v && console.warn("[Sailfish] Failed to load funcSpan state from localStorage:", e3), null;
353
+ return k && console.warn("[Sailfish] Failed to load funcSpan state from localStorage:", e3), null;
265
354
  }
266
355
  })();
267
- if (e2 && e2.enabled) if (R = true, _ = e2.expirationTimestampMs, P = false, v && console.log("[Sailfish] Restored global function span tracking from localStorage:", { enabled: true, expirationTime: _ }), null !== _) {
268
- Date.now() >= _ ? (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Persisted tracking already expired, cleared state")) : v && console.log("[Sailfish] Function span tracking is active and valid (temporary until WebSocket confirms)");
269
- } else v && console.log("[Sailfish] Function span tracking is active (no expiration, temporary until WebSocket confirms)");
356
+ if (e2 && e2.enabled) if (B = true, j = e2.expirationTimestampMs, U = false, k && console.log("[Sailfish] Restored global function span tracking from localStorage:", { enabled: true, expirationTime: j }), null !== j) {
357
+ Date.now() >= j ? (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Persisted tracking already expired, cleared state")) : k && console.log("[Sailfish] Function span tracking is active and valid (temporary until WebSocket confirms)");
358
+ } else k && console.log("[Sailfish] Function span tracking is active (no expiration, temporary until WebSocket confirms)");
270
359
  }
271
360
  function isWebSocketOpen(e2) {
272
361
  return (e2 == null ? void 0 : e2.readyState) === WebSocket.OPEN;
@@ -278,7 +367,7 @@ async function flushNotifyQueue() {
278
367
  n2.onsuccess = () => t2(n2.result), n2.onerror = () => t2([]);
279
368
  })) ?? [];
280
369
  })();
281
- if (isWebSocketOpen(x)) try {
370
+ if (isWebSocketOpen(T)) try {
282
371
  for (const t2 of e2) {
283
372
  if (!wsSendRaw(t2.value)) break;
284
373
  await deleteNotifyMessageById(t2.id);
@@ -287,9 +376,9 @@ async function flushNotifyQueue() {
287
376
  }
288
377
  }
289
378
  async function flushBufferedEvents() {
290
- if (isWebSocketOpen(x)) if (T) await T;
379
+ if (isWebSocketOpen(T)) if (M) await M;
291
380
  else {
292
- T = (async () => {
381
+ M = (async () => {
293
382
  var _a, _b;
294
383
  const e2 = await (async function getAllIndexedEvents() {
295
384
  const e3 = await withStore$1("readonly", (e4) => new Promise((t4) => {
@@ -307,8 +396,8 @@ async function flushBufferedEvents() {
307
396
  for (const e3 of Object.values(t2)) {
308
397
  const t3 = buildBatches(e3, (e4) => eventSize(e4.data), 52428800);
309
398
  for (const e4 of t3) {
310
- if (!isWebSocketOpen(x)) break;
311
- const t4 = e4.map((e5) => (e5.data.appUrl || (e5.data.appUrl = getCachedHref()), e5.data)), n2 = e4.map((e5) => e5.id).filter((e5) => null != e5);
399
+ if (!isWebSocketOpen(T)) break;
400
+ const t4 = e4.map((e5) => (e5.data.appUrl || (e5.data.appUrl = getCachedHref()), enrichEventWithTimeSync(e5.data), e5.data)), n2 = e4.map((e5) => e5.id).filter((e5) => null != e5);
312
401
  try {
313
402
  wsSendPayload({ type: "events", events: t4, mapUuid: window.sfMapUuid }) && await deleteEventsByIds(n2);
314
403
  } catch (e5) {
@@ -317,64 +406,73 @@ async function flushBufferedEvents() {
317
406
  }
318
407
  })();
319
408
  try {
320
- await T;
409
+ await M;
321
410
  } finally {
322
- T = null;
411
+ M = null;
323
412
  }
324
413
  }
325
414
  }
326
415
  function sendEvent(e2) {
327
- e2.app_url || (e2.app_url = getCachedHref()), !I && isWebSocketOpen(x) && wsSendPayload({ type: "event", event: e2, mapUuid: window.sfMapUuid }) || queueEventForIDB(e2);
416
+ e2.app_url || (e2.app_url = getCachedHref()), enrichEventWithTimeSync(e2), !E && isWebSocketOpen(T) && wsSendPayload({ type: "event", event: e2, mapUuid: window.sfMapUuid }) || queueEventForIDB(e2);
328
417
  }
329
418
  function handleWsOpen() {
330
- v && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (R ? "ENABLED" : "DISABLED"))), (async () => {
419
+ k && (console.log("[Sailfish] WebSocket connection opened"), console.log("[Sailfish] Function span tracking state: " + (B ? "ENABLED" : "DISABLED"))), (async () => {
331
420
  try {
332
- I = true, await flushNotifyQueue(), await flushBufferedEvents();
421
+ E = true, await flushNotifyQueue(), await flushBufferedEvents();
333
422
  } finally {
334
- I = false;
423
+ E = false;
335
424
  }
336
- null != E && clearInterval(E), E = window.setInterval(() => {
425
+ null != C && clearInterval(C), C = window.setInterval(() => {
337
426
  flushBufferedEvents();
338
427
  }, 2e3);
428
+ })(), (function kickoffTimeSyncBurst() {
429
+ if ("undefined" != typeof window) for (let e2 = 0; e2 < 3; e2++) window.setTimeout(requestTimeSync, 250 * e2);
430
+ })(), (function startTimeSyncInterval() {
431
+ null == $ && "undefined" != typeof window && ($ = window.setInterval(() => {
432
+ requestTimeSync();
433
+ }, 6e4));
339
434
  })();
340
435
  }
341
436
  function handleWsClose() {
342
- null != E && (clearInterval(E), E = null), v && console.log("[Sailfish] WebSocket closed");
437
+ null != C && (clearInterval(C), C = null), (function stopTimeSyncInterval() {
438
+ null != $ && "undefined" != typeof window && (window.clearInterval($), $ = null);
439
+ })(), k && console.log("[Sailfish] WebSocket closed");
343
440
  }
344
441
  function handleWsMessage(e2) {
345
442
  try {
346
443
  const t2 = JSON.parse(e2);
347
- if ("funcSpanTrackingControl" === t2.type) if (v && console.log("[Sailfish] Received funcSpanTrackingControl message:", { enabled: t2.enabled, timeoutSeconds: t2.timeoutSeconds, expirationTimestampMs: t2.expirationTimestampMs }), null !== D && (window.clearTimeout(D), D = null), R = t2.enabled, P = false, v && console.log("[Sailfish] Function span tracking " + (t2.enabled ? "ENABLED (GLOBAL)" : "DISABLED (GLOBAL)")), t2.enabled) {
444
+ if ("time-sync-response" === t2.type) return void getClockSyncManager().recordTimeSyncResponse({ requestId: t2.requestId, serverReceivedAtMs: t2.serverReceivedAtMs, serverSentAtMs: t2.serverSentAtMs });
445
+ if ("funcSpanTrackingControl" === t2.type) if (k && console.log("[Sailfish] Received funcSpanTrackingControl message:", { enabled: t2.enabled, timeoutSeconds: t2.timeoutSeconds, expirationTimestampMs: t2.expirationTimestampMs }), null !== O && (window.clearTimeout(O), O = null), B = t2.enabled, U = false, k && console.log("[Sailfish] Function span tracking " + (t2.enabled ? "ENABLED (GLOBAL)" : "DISABLED (GLOBAL)")), t2.enabled) {
348
446
  if (t2.expirationTimestampMs) {
349
- _ = t2.expirationTimestampMs;
350
- const e3 = Date.now(), n2 = _ - e3;
351
- v && console.log(`[Sailfish] Server expiration timestamp: ${_}, ms until expiration: ${n2}`), n2 > 0 ? (saveGlobalFuncSpanState(true, _), D = window.setTimeout(() => {
352
- P || (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] GLOBAL function span tracking auto-disabled at server expiration time"), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), v && console.log("[Sailfish] Notified backend that function span tracking expired"));
353
- }, n2)) : (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Tracking already expired, not enabling"));
447
+ j = t2.expirationTimestampMs;
448
+ const e3 = Date.now(), n2 = j - e3;
449
+ k && console.log(`[Sailfish] Server expiration timestamp: ${j}, ms until expiration: ${n2}`), n2 > 0 ? (saveGlobalFuncSpanState(true, j), O = window.setTimeout(() => {
450
+ U || (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] GLOBAL function span tracking auto-disabled at server expiration time"), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), k && console.log("[Sailfish] Notified backend that function span tracking expired"));
451
+ }, n2)) : (B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Tracking already expired, not enabling"));
354
452
  } else {
355
453
  const e3 = t2.timeoutSeconds || 3600;
356
- e3 > 0 && (_ = Date.now() + 1e3 * e3, saveGlobalFuncSpanState(true, _), D = window.setTimeout(() => {
357
- P || (R = false, _ = null, clearGlobalFuncSpanState(), v && console.log(`[Sailfish] GLOBAL function span tracking auto-disabled after ${e3}s (legacy)`), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), v && console.log("[Sailfish] Notified backend that function span tracking expired (legacy timeout)"));
454
+ e3 > 0 && (j = Date.now() + 1e3 * e3, saveGlobalFuncSpanState(true, j), O = window.setTimeout(() => {
455
+ U || (B = false, j = null, clearGlobalFuncSpanState(), k && console.log(`[Sailfish] GLOBAL function span tracking auto-disabled after ${e3}s (legacy)`), wsSendPayload({ type: "funcSpanTrackingExpired", sessionId: getOrSetSessionId(), expiredAt: Date.now() }), k && console.log("[Sailfish] Notified backend that function span tracking expired (legacy timeout)"));
358
456
  }, 1e3 * e3));
359
457
  }
360
458
  try {
361
459
  const e3 = getOrSetSessionId();
362
- wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }), v && console.log(`[Sailfish] GLOBAL tracking session report sent for session: ${e3}`);
460
+ wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: e3, enabled: true, configurationType: "global" }), k && console.log(`[Sailfish] GLOBAL tracking session report sent for session: ${e3}`);
363
461
  } catch (e3) {
364
- v && console.warn("[Sailfish] Failed to send GLOBAL tracking session report:", e3);
462
+ k && console.warn("[Sailfish] Failed to send GLOBAL tracking session report:", e3);
365
463
  }
366
- } else _ = null, clearGlobalFuncSpanState();
464
+ } else j = null, clearGlobalFuncSpanState();
367
465
  } catch (e3) {
368
466
  }
369
467
  }
370
- function initializeWebSocket(t2, n2, i2, o2, a2 = false) {
468
+ function initializeWebSocket(t2, n2, i2, o2, s2 = false) {
371
469
  ensureHrefCache();
372
- const s2 = (function getWebSocketHost(e2) {
470
+ const r2 = (function getWebSocketHost(e2) {
373
471
  const t3 = new URL(e2);
374
472
  return `${t3.hostname}${t3.port ? `:${t3.port}` : ""}`;
375
473
  })(t2);
376
- let r2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${s2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.11.5`;
377
- if (o2 && (r2 += `&envValue=${encodeURIComponent(o2)}`), k = a2 ? (function tryCreateWsWorker() {
474
+ let a2 = `${"https:" === new URL(t2).protocol ? "wss" : "ws"}://${r2}/ws/notify/?apiKey=${n2}&sessionId=${i2}&sender=JS%2FTS&version=1.12.4`;
475
+ if (o2 && (a2 += `&envValue=${encodeURIComponent(o2)}`), I = s2 ? (function tryCreateWsWorker() {
378
476
  if ("undefined" == typeof Worker) return null;
379
477
  try {
380
478
  const e2 = new Blob(['\nvar ws = null;\nvar wsUrl = "";\nvar reconnectTimer = null;\nvar reconnectDelay = 1000;\nvar MAX_RECONNECT_DELAY = 30000;\nvar CONNECTION_TIMEOUT = 30000;\nvar queue = [];\nvar MAX_QUEUE = 500;\n\nfunction enqueue(str) {\n if (queue.length >= MAX_QUEUE) queue.shift();\n queue.push(str);\n}\n\nfunction drain() {\n while (queue.length > 0) {\n if (!ws || ws.readyState !== 1) break;\n try { ws.send(queue.shift()); } catch (e) { break; }\n }\n}\n\nfunction connect() {\n if (ws && (ws.readyState === 0 || ws.readyState === 1)) return;\n try { ws = new WebSocket(wsUrl); } catch (e) { scheduleReconnect(); return; }\n var tid = setTimeout(function() { if (ws && ws.readyState === 0) ws.close(); }, CONNECTION_TIMEOUT);\n ws.onopen = function() {\n clearTimeout(tid);\n reconnectDelay = 1000;\n drain();\n postMessage({ type: "open" });\n };\n ws.onclose = function() {\n clearTimeout(tid);\n ws = null;\n postMessage({ type: "close" });\n scheduleReconnect();\n };\n ws.onerror = function() {};\n ws.onmessage = function(e) {\n postMessage({ type: "message", data: e.data });\n };\n}\n\nfunction scheduleReconnect() {\n if (reconnectTimer) return;\n reconnectTimer = setTimeout(function() {\n reconnectTimer = null;\n reconnectDelay = Math.min(reconnectDelay * 1.5, MAX_RECONNECT_DELAY);\n connect();\n }, reconnectDelay);\n}\n\nself.onmessage = function(e) {\n var msg = e.data;\n if (msg.type === "init") {\n wsUrl = msg.wsUrl;\n connect();\n } else if (msg.type === "send") {\n try {\n var s = JSON.stringify(msg.payload);\n if (ws && ws.readyState === 1) { ws.send(s); }\n else { enqueue(s); }\n } catch (e) {}\n } else if (msg.type === "sendRaw") {\n if (ws && ws.readyState === 1) {\n try { ws.send(msg.payload); } catch (e) { enqueue(msg.payload); }\n } else { enqueue(msg.payload); }\n } else if (msg.type === "close") {\n if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }\n if (ws) { ws.close(); ws = null; }\n }\n};\n'], { type: "application/javascript" }), t3 = URL.createObjectURL(e2), n3 = new Worker(t3);
@@ -382,182 +480,197 @@ function initializeWebSocket(t2, n2, i2, o2, a2 = false) {
382
480
  } catch {
383
481
  return null;
384
482
  }
385
- })() : null, k) {
386
- const e2 = k, t3 = { readyState: WebSocket.CONNECTING, close: () => {
387
- t3.readyState = WebSocket.CLOSED, e2.postMessage({ type: "close" }), e2.terminate(), k = null, null != E && (clearInterval(E), E = null);
483
+ })() : null, I) {
484
+ const e2 = I, t3 = { readyState: WebSocket.CONNECTING, close: () => {
485
+ t3.readyState = WebSocket.CLOSED, e2.postMessage({ type: "close" }), e2.terminate(), I = null, null != C && (clearInterval(C), C = null);
388
486
  } };
389
- return x = t3, k.onmessage = (e3) => {
487
+ return T = t3, I.onmessage = (e3) => {
390
488
  const n3 = e3.data;
391
489
  "open" === n3.type ? (t3.readyState = WebSocket.OPEN, handleWsOpen()) : "close" === n3.type ? (t3.readyState = WebSocket.CLOSED, handleWsClose()) : "message" === n3.type && handleWsMessage(n3.data);
392
- }, k.onerror = () => {
393
- v && console.warn("[Sailfish] WebSocket worker error");
394
- }, k.postMessage({ type: "init", wsUrl: r2 }), v && console.log("[Sailfish] WebSocket running in Web Worker (off main thread)"), t3;
490
+ }, I.onerror = () => {
491
+ k && console.warn("[Sailfish] WebSocket worker error");
492
+ }, I.postMessage({ type: "init", wsUrl: a2 }), k && console.log("[Sailfish] WebSocket running in Web Worker (off main thread)"), t3;
395
493
  }
396
- v && console.log("[Sailfish] WebSocket running on main thread (Worker unavailable)");
397
- const l2 = new e(r2, [], { connectionTimeout: 3e4 }), c2 = { get readyState() {
494
+ k && console.log("[Sailfish] WebSocket running on main thread (Worker unavailable)");
495
+ const l2 = new e(a2, [], { connectionTimeout: 3e4 }), c2 = { get readyState() {
398
496
  return l2.readyState;
399
497
  }, close: () => {
400
- l2.close(), null != E && (clearInterval(E), E = null);
498
+ l2.close(), null != C && (clearInterval(C), C = null);
401
499
  } };
402
- return x = c2, l2.addEventListener("open", () => handleWsOpen()), l2.addEventListener("close", () => handleWsClose()), l2.addEventListener("message", (e2) => handleWsMessage(e2.data)), c2;
500
+ return T = c2, l2.addEventListener("open", () => handleWsOpen()), l2.addEventListener("close", () => handleWsClose()), l2.addEventListener("message", (e2) => handleWsMessage(e2.data)), c2;
403
501
  }
404
502
  function sendMessage(e2) {
405
- "sessionId" in e2 || (e2.sessionId = getOrSetSessionId()), e2.app_url || (e2.app_url = getCachedHref()), I || !isWebSocketOpen(x) ? saveNotifyMessageToIDB(JSON.stringify(e2)) : wsSendPayload(e2) || saveNotifyMessageToIDB(JSON.stringify(e2));
503
+ "sessionId" in e2 || (e2.sessionId = getOrSetSessionId()), e2.app_url || (e2.app_url = getCachedHref()), enrichEventWithTimeSync(e2), E || !isWebSocketOpen(T) ? saveNotifyMessageToIDB(JSON.stringify(e2)) : wsSendPayload(e2) || saveNotifyMessageToIDB(JSON.stringify(e2));
406
504
  }
407
505
  function enableFunctionSpanTracking() {
408
- if (v && console.log("[Sailfish] enableFunctionSpanTracking() called - Report Issue recording started (LOCAL MODE)"), R = true, P = true, _ = null, null !== D && (window.clearTimeout(D), D = null), isWebSocketOpen(x)) {
409
- wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType: S });
410
- } else v && console.warn("[Sailfish] WebSocket not open, cannot report LOCAL tracking session");
506
+ if (k && console.log("[Sailfish] enableFunctionSpanTracking() called - Report Issue recording started (LOCAL MODE)"), B = true, U = true, j = null, null !== O && (window.clearTimeout(O), O = null), isWebSocketOpen(T)) {
507
+ wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: true, configurationType: x });
508
+ } else k && console.warn("[Sailfish] WebSocket not open, cannot report LOCAL tracking session");
411
509
  }
412
510
  function disableFunctionSpanTracking() {
413
- if (v && console.log("[Sailfish] disableFunctionSpanTracking() called - Report Issue recording stopped"), isWebSocketOpen(x)) {
414
- wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType: S });
511
+ if (k && console.log("[Sailfish] disableFunctionSpanTracking() called - Report Issue recording stopped"), isWebSocketOpen(T)) {
512
+ wsSendPayload({ type: "funcSpanTrackingSessionReport", sessionId: getOrSetSessionId(), enabled: false, configurationType: x });
415
513
  } else console.warn("[FUNCSPAN STOP] ✗ WebSocket not open, cannot notify tracking end");
416
- P && (R = false, P = false, _ = null, v && console.log("[Sailfish] LOCAL tracking mode disabled")), null !== D && (window.clearTimeout(D), D = null);
514
+ U && (B = false, U = false, j = null, k && console.log("[Sailfish] LOCAL tracking mode disabled")), null !== O && (window.clearTimeout(O), O = null);
417
515
  }
418
516
  function isFunctionSpanTrackingEnabled() {
419
- return R;
517
+ return B;
420
518
  }
421
519
  function initializeFunctionSpanTrackingFromApi(e2) {
422
- e2 && !R ? (R = true, P = false, _ = null, v && console.log("[Sailfish] Function span tracking initialized as ENABLED from API check")) : !e2 && R && (R = false, P = false, _ = null, v && console.log("[Sailfish] Function span tracking initialized as DISABLED from API check"));
520
+ e2 && !B ? (B = true, U = false, j = null, k && console.log("[Sailfish] Function span tracking initialized as ENABLED from API check")) : !e2 && B && (B = false, U = false, j = null, k && console.log("[Sailfish] Function span tracking initialized as DISABLED from API check"));
423
521
  }
424
522
  function getFuncSpanHeader() {
425
- if (!R) return null;
426
- if (null !== _) {
427
- if (Date.now() >= _) return R = false, _ = null, clearGlobalFuncSpanState(), v && console.log("[Sailfish] Function span tracking expired on header check - disabling now"), null;
523
+ if (!B) return null;
524
+ if (null !== j) {
525
+ if (Date.now() >= j) return B = false, j = null, clearGlobalFuncSpanState(), k && console.log("[Sailfish] Function span tracking expired on header check - disabling now"), null;
428
526
  }
429
527
  return { name: "X-Sf3-FunctionSpanCaptureOverride", value: "1-1-10-10-1-1.0-1-0-0" };
430
528
  }
431
- const O = Object.freeze(Object.defineProperty({ __proto__: null, clearStaleFuncSpanState, disableFunctionSpanTracking, enableFunctionSpanTracking, ensureHrefCache, flushBufferedEvents, getCachedHref, getCachedHrefNoQuery, getFuncSpanHeader, initializeFunctionSpanTrackingFromApi, initializeWebSocket, isFunctionSpanTrackingEnabled, onNavigationChange, restoreFuncSpanState, sendEvent, sendMessage }, Symbol.toStringTag, { value: "Module" }));
432
- let U = null, z = null;
529
+ const z = Object.freeze(Object.defineProperty({ __proto__: null, clearStaleFuncSpanState, disableFunctionSpanTracking, enableFunctionSpanTracking, ensureHrefCache, flushBufferedEvents, getCachedHref, getCachedHrefNoQuery, getFuncSpanHeader, initializeFunctionSpanTrackingFromApi, initializeWebSocket, isFunctionSpanTrackingEnabled, onNavigationChange, requestTimeSync, restoreFuncSpanState, sendEvent, sendMessage }, Symbol.toStringTag, { value: "Module" }));
530
+ let H = null, W = null;
433
531
  function getIdentifiedUser() {
434
- return U;
532
+ return H;
435
533
  }
436
534
  function identify(e2, t2 = {}, n2 = false) {
437
535
  const i2 = { type: "identify", userId: e2, traits: t2 };
438
- U && U.userId === e2 && JSON.stringify(U.traits) === JSON.stringify(t2) || (U = { userId: e2, traits: t2, overwrite: n2 }, sendMessage(i2));
536
+ H && H.userId === e2 && JSON.stringify(H.traits) === JSON.stringify(t2) || (H = { userId: e2, traits: t2, overwrite: n2 }, sendMessage(i2));
439
537
  }
440
538
  function addOrUpdateMetadata(e2) {
441
539
  const t2 = { type: "addOrUpdateMetadata", metadata: e2 };
442
- z && JSON.stringify(z) === JSON.stringify(e2) || (z = e2, sendMessage(t2));
540
+ W && JSON.stringify(W) === JSON.stringify(e2) || (W = e2, sendMessage(t2));
443
541
  }
444
542
  function trackingEvent(e2) {
445
543
  sendMessage({ type: "trackingEvent", trackingData: e2, timestamp: w() });
446
544
  }
447
- let N = null;
448
- const H = ["https://api.ipify.org?format=json", "https://api.ip.sb/jsonip", "https://api4.my-ip.io/ip.json"];
545
+ let K = null;
546
+ const V = ["https://api.ipify.org?format=json", "https://api.ip.sb/jsonip", "https://api4.my-ip.io/ip.json"];
449
547
  function fetchAndSendIp(e2) {
450
- N !== e2 && (N = e2, (async () => {
451
- for (const e3 of H) try {
548
+ K !== e2 && (K = e2, (async () => {
549
+ for (const e3 of V) try {
452
550
  const t2 = new AbortController(), n2 = setTimeout(() => t2.abort(), 5e3), i2 = await fetch(e3, { signal: t2.signal });
453
551
  if (clearTimeout(n2), !i2.ok) continue;
454
- const o2 = await i2.json(), a2 = o2.ip || o2.origin || null;
455
- if (a2 && "string" == typeof a2 && a2.length <= 45) return void sendMessage({ type: "visitorIp", ip: a2, timestamp: w() });
552
+ const o2 = await i2.json(), s2 = o2.ip || o2.origin || null;
553
+ if (s2 && "string" == typeof s2 && s2.length <= 45) return void sendMessage({ type: "visitorIp", ip: s2, timestamp: w() });
456
554
  } catch {
457
555
  }
458
- N = null;
556
+ K = null;
459
557
  })().catch(() => {
460
- N = null;
558
+ K = null;
461
559
  }));
462
560
  }
463
- let q = null;
561
+ let G = null;
464
562
  async function getSourceMapModule() {
465
- return q || (q = await import("source-map-js")), q;
563
+ return G || (G = await import("source-map-js")), G;
466
564
  }
467
- const W = /* @__PURE__ */ new Map(), K = /(?:\(|\s|^)(https?:\/\/[^)\s]+|\/[^)\s]+|[^)\s]+)?\/?([^/]+\.js)(?:\?[^:)]*)?:(\d+):(\d+)/;
565
+ const Q = /* @__PURE__ */ new Map(), J = /(?:\(|\s|^)(https?:\/\/[^)\s]+|\/[^)\s]+|[^)\s]+)?\/?([^/]+\.js)(?:\?[^:)]*)?:(\d+):(\d+)/;
468
566
  async function getConsumerFor(e2, t2) {
469
567
  const n2 = (e2 || `/assets/${t2}`).split("?")[0], i2 = [`${n2}.map`, n2.replace(/\.js$/, ".js.map"), `/assets/${t2}.map`], { SourceMapConsumer: o2 } = await getSourceMapModule();
470
568
  for (const e3 of i2) try {
471
- if (W.has(e3)) return W.get(e3);
569
+ if (Q.has(e3)) return Q.get(e3);
472
570
  const t3 = await fetch(e3);
473
571
  if (!t3.ok) continue;
474
572
  const n3 = await t3.json();
475
573
  if (!n3 || !n3.mappings || !n3.sources) continue;
476
574
  const i3 = await new o2(n3);
477
- return W.set(e3, i3), i3;
575
+ return Q.set(e3, i3), i3;
478
576
  } catch {
479
577
  }
480
578
  return null;
481
579
  }
482
- async function captureError(e2, t2 = false) {
483
- let n2, i2;
484
- e2 instanceof Error ? (n2 = e2.message, i2 = e2.stack || "No stack trace") : "string" == typeof e2 ? (n2 = e2, i2 = "No stack trace available") : (n2 = "Unknown error occurred", i2 = "No stack trace available");
485
- const o2 = await (async function resolveStackTrace(e3) {
580
+ async function captureError(e2, t2 = false, n2) {
581
+ let i2, o2;
582
+ const s2 = [];
583
+ e2 instanceof Error ? (i2 = e2.message || e2.name, o2 = e2.stack || "No stack trace", s2.push(`${e2.name}: ${i2}`)) : "string" == typeof e2 ? (i2 = e2, o2 = "No stack trace available", s2.push(t2 ? `Uncaught (in promise) ${e2}` : e2)) : (i2 = (function describeNonError(e3) {
584
+ if (null === e3) return "null";
585
+ if (void 0 === e3) return "undefined";
586
+ if ("string" == typeof e3) return e3;
587
+ if ("number" == typeof e3 || "boolean" == typeof e3 || "bigint" == typeof e3) return String(e3);
588
+ if (e3 instanceof Event) {
589
+ const t3 = e3.target, n3 = (t3 == null ? void 0 : t3.tagName) ? `<${t3.tagName.toLowerCase()}>` : "";
590
+ return `[${e3.type} Event${n3 ? ` on ${n3}` : ""}${e3.isTrusted ? " trusted" : ""}]`;
591
+ }
592
+ try {
593
+ return JSON.stringify(e3);
594
+ } catch {
595
+ return Object.prototype.toString.call(e3);
596
+ }
597
+ })(e2), o2 = "No stack trace available", s2.push(t2 ? `Uncaught (in promise) ${i2}` : i2)), (n2 == null ? void 0 : n2.filename) && s2.push(`at ${n2.filename}:${n2.lineno ?? 0}:${n2.colno ?? 0}`);
598
+ const r2 = await (async function resolveStackTrace(e3) {
486
599
  if (!e3) return ["No stack trace available"];
487
600
  const t3 = Array.isArray(e3) ? e3 : e3.split("\n"), n3 = [];
488
601
  for (const e4 of t3) {
489
- const t4 = e4.match(K);
602
+ const t4 = e4.match(J);
490
603
  if (!t4) {
491
604
  n3.push(e4);
492
605
  continue;
493
606
  }
494
- const [, i3, o3, a3, s3] = t4, r3 = parseInt(a3, 10), l2 = Math.max(0, parseInt(s3, 10) - 1);
495
- if (!Number.isFinite(r3) || !Number.isFinite(l2)) {
607
+ const [, i3, o3, s3, r3] = t4, a3 = parseInt(s3, 10), l3 = Math.max(0, parseInt(r3, 10) - 1);
608
+ if (!Number.isFinite(a3) || !Number.isFinite(l3)) {
496
609
  n3.push(e4 + " [Invalid line/column]");
497
610
  continue;
498
611
  }
499
- const c2 = await getConsumerFor(i3, o3);
500
- if (!c2) {
612
+ const c3 = await getConsumerFor(i3, o3);
613
+ if (!c3) {
501
614
  n3.push(`${e4} [No source map found for ${o3}]`);
502
615
  continue;
503
616
  }
504
617
  const { SourceMapConsumer: d2 } = await getSourceMapModule();
505
- let u2 = c2.originalPositionFor({ line: r3, column: l2, bias: d2.GREATEST_LOWER_BOUND });
506
- if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c2.originalPositionFor({ line: r3, column: Math.max(0, l2 - e5), bias: d2.GREATEST_LOWER_BOUND }), !u2.source || null == u2.line); e5++) ;
618
+ let u2 = c3.originalPositionFor({ line: a3, column: l3, bias: d2.GREATEST_LOWER_BOUND });
619
+ if (!u2.source || null == u2.line) for (let e5 = 1; e5 <= 20 && (u2 = c3.originalPositionFor({ line: a3, column: Math.max(0, l3 - e5), bias: d2.GREATEST_LOWER_BOUND }), !u2.source || null == u2.line); e5++) ;
507
620
  if (u2.source && null != u2.line) {
508
621
  const e5 = u2.name || "anonymous";
509
622
  n3.push(`${u2.source}:${u2.line}:${u2.column ?? 0} (${e5})`);
510
623
  } else n3.push(`${e4} [No mapping found in ${o3}]`);
511
624
  }
512
625
  return n3;
513
- })(i2), a2 = o2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")), s2 = a2.length > 0 ? a2 : o2, r2 = Date.now();
514
- sendMessage({ type: "event", event: { type: 6, timestamp: r2, data: { payload: { message: n2, stack: i2, trace: s2, filteredStack: a2, userAgent: navigator.userAgent, url: window.location.href, timestamp: r2, level: "error" } } } });
515
- }
516
- const V = readDebugFlag();
517
- const G = readDebugFlag();
518
- function sendGraphQLRequest(e2, t2, n2, i2 = 5, o2 = 2e3, a2 = 2) {
519
- const s2 = `${n2.backendApi}/graphql/?apiKey=${n2.apiKey}`;
520
- return G && console.log(`Initial GraphQL request for ${e2} at ${s2}`), (function exponentialBackoff(e3, t3, n3 = 5, i3 = 2e3, o3 = 2) {
521
- let a3 = 0;
626
+ })(o2), a2 = r2.filter((e3) => !e3.includes("chunk-") && !e3.includes("react-dom")), l2 = a2.length > 0 ? a2 : r2, c2 = Date.now();
627
+ sendMessage({ type: "event", event: { type: 6, timestamp: c2, data: { payload: { message: i2, stack: o2, trace: l2, filteredStack: a2, payload: s2, userAgent: navigator.userAgent, url: window.location.href, timestamp: c2, level: "error" } } } });
628
+ }
629
+ const X = readDebugFlag();
630
+ const Z = readDebugFlag();
631
+ function sendGraphQLRequest(e2, t2, n2, i2 = 5, o2 = 2e3, s2 = 2) {
632
+ const r2 = `${n2.backendApi}/graphql/?apiKey=${n2.apiKey}`;
633
+ return Z && console.log(`Initial GraphQL request for ${e2} at ${r2}`), (function exponentialBackoff(e3, t3, n3 = 5, i3 = 2e3, o3 = 2) {
634
+ let s3 = 0;
522
635
  const attemptRequest = async () => {
523
636
  try {
524
637
  return await e3();
525
638
  } catch (e4) {
526
- if (a3++, a3 > n3) throw e4;
527
- const s3 = i3 * Math.pow(o3, a3 - 1);
528
- return V && console.log(`Attempt ${a3} failed: ${t3}; Retrying in ${s3}ms...`), await new Promise((e5) => setTimeout(e5, s3)), attemptRequest();
639
+ if (s3++, s3 > n3) throw e4;
640
+ const r3 = i3 * Math.pow(o3, s3 - 1);
641
+ return X && console.log(`Attempt ${s3} failed: ${t3}; Retrying in ${r3}ms...`), await new Promise((e5) => setTimeout(e5, r3)), attemptRequest();
529
642
  }
530
643
  };
531
644
  return attemptRequest();
532
- })(() => fetch(s2, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ operationName: e2, query: t2, variables: n2 }) }).then((e3) => {
533
- if (G && console.log(`Received response with status: ${e3.status}`), !e3.ok) throw new Error(`GraphQL request failed with status ${e3.status}`);
645
+ })(() => fetch(r2, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ operationName: e2, query: t2, variables: n2 }) }).then((e3) => {
646
+ if (Z && console.log(`Received response with status: ${e3.status}`), !e3.ok) throw new Error(`GraphQL request failed with status ${e3.status}`);
534
647
  return e3.json();
535
- }), "Sending GraphQL request to Sailfish AI", i2, o2, a2);
648
+ }), "Sending GraphQL request to Sailfish AI", i2, o2, s2);
536
649
  }
537
650
  function fetchCaptureSettings(e2, t2) {
538
- return sendGraphQLRequest("GetCaptureSettingsFromApiKey", "\n query GetCaptureSettingsFromApiKey($apiKey: String!) {\n captureSettingsFromApiKey(apiKey: $apiKey) {\n recordCanvas\n recordCrossOriginIframes\n collectFonts\n inlineImages\n recordPassword\n recordRealName\n recordCreditCardInfo\n recordSsn\n recordDob\n sampling\n textEditThrottleEnabled\n }\n }\n ", { apiKey: e2, backendApi: t2 });
651
+ return sendGraphQLRequest("GetCaptureSettingsFromApiKey", "\n query GetCaptureSettingsFromApiKey($apiKey: String!) {\n captureSettingsFromApiKey(apiKey: $apiKey) {\n recordCanvas\n recordCrossOriginIframes\n collectFonts\n inlineImages\n recordPassword\n recordRealName\n recordCreditCardInfo\n recordSsn\n recordDob\n sampling\n textEditThrottleEnabled\n maskInputSelector\n maskTextSelector\n blockSelector\n unmaskSelector\n maskInputOptions\n }\n }\n ", { apiKey: e2, backendApi: t2 });
539
652
  }
540
653
  function fetchFunctionSpanTrackingEnabled(e2, t2) {
541
654
  return sendGraphQLRequest("GetFunctionSpanTrackingEnabledFromApiKey", "\n query GetFunctionSpanTrackingEnabledFromApiKey($apiKey: String!) {\n isFunctionSpanTrackingEnabledFromApiKey(apiKey: $apiKey)\n }\n ", { apiKey: e2, backendApi: t2 });
542
655
  }
543
- function startRecordingSession(e2, t2, n2, i2, o2, a2, s2, r2, l2) {
544
- return sendGraphQLRequest("StartSession", "mutation StartSession(\n $apiKey: UUID!,\n $recordingSessionId: UUID!,\n $serviceIdentifier: String!,\n $serviceVersion: String,\n $mapUuid: String,\n $gitSha: String,\n $library: String,\n $serviceAdditionalMetadata: JSON,\n $startRecordingFilePath: String,\n $startRecordingLineNumber: Int\n ) {\n startRecordingSession(\n companyApiKey: $apiKey,\n sessionId: $recordingSessionId,\n serviceIdentifier: $serviceIdentifier,\n serviceVersion: $serviceVersion,\n mapUuid: $mapUuid,\n gitSha: $gitSha,\n library: $library,\n serviceAdditionalMetadata: $serviceAdditionalMetadata,\n startRecordingFilePath: $startRecordingFilePath,\n startRecordingLineNumber: $startRecordingLineNumber\n ) {\n id\n }\n }", { apiKey: e2, recordingSessionId: t2, backendApi: n2, serviceIdentifier: i2, serviceVersion: o2, mapUuid: a2, gitSha: s2, library: r2, serviceAdditionalMetadata: l2, startRecordingFilePath: null, startRecordingLineNumber: null });
656
+ function startRecordingSession(e2, t2, n2, i2, o2, s2, r2, a2, l2) {
657
+ return sendGraphQLRequest("StartSession", "mutation StartSession(\n $apiKey: UUID!,\n $recordingSessionId: UUID!,\n $serviceIdentifier: String!,\n $serviceVersion: String,\n $mapUuid: String,\n $gitSha: String,\n $library: String,\n $serviceAdditionalMetadata: JSON,\n $startRecordingFilePath: String,\n $startRecordingLineNumber: Int\n ) {\n startRecordingSession(\n companyApiKey: $apiKey,\n sessionId: $recordingSessionId,\n serviceIdentifier: $serviceIdentifier,\n serviceVersion: $serviceVersion,\n mapUuid: $mapUuid,\n gitSha: $gitSha,\n library: $library,\n serviceAdditionalMetadata: $serviceAdditionalMetadata,\n startRecordingFilePath: $startRecordingFilePath,\n startRecordingLineNumber: $startRecordingLineNumber\n ) {\n id\n }\n }", { apiKey: e2, recordingSessionId: t2, backendApi: n2, serviceIdentifier: i2, serviceVersion: o2, mapUuid: s2, gitSha: r2, library: a2, serviceAdditionalMetadata: l2, startRecordingFilePath: null, startRecordingLineNumber: null });
545
658
  }
546
659
  function sendDomainsToNotPropagateHeaderTo(e2, t2, n2) {
547
660
  return sendGraphQLRequest("DomainsToNotPassHeaderTo", "mutation DomainsToNotPassHeaderTo($apiKey: String!, $domains: [String!]!) {\n domainsToNotPassHeaderTo(apiKey: $apiKey, domains: $domains)\n }", { apiKey: e2, domains: t2, backendApi: n2 });
548
661
  }
549
- function createTriageFromRecorder(e2, t2, n2, i2, o2, a2, s2) {
550
- return sendGraphQLRequest("CreateTriageFromRecorder", "mutation CreateTriageFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $triageSource: TriageSourceEnum\n ) {\n createTriageFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n triageSource: $triageSource\n ) {\n id\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: a2, triageSource: s2, backendApi: t2 });
662
+ function createTriageFromRecorder(e2, t2, n2, i2, o2, s2, r2) {
663
+ return sendGraphQLRequest("CreateTriageFromRecorder", "mutation CreateTriageFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $triageSource: TriageSourceEnum\n ) {\n createTriageFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n triageSource: $triageSource\n ) {\n id\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, triageSource: r2, backendApi: t2 });
551
664
  }
552
665
  function fetchEngineeringTicketPlatformIntegrations(e2, t2) {
553
666
  return sendGraphQLRequest("GetEngineeringTicketPlatformIntegrationsFromApiKey", "query GetEngineeringTicketPlatformIntegrationsFromApiKey($apiKey: String!) {\n getEngineeringTicketPlatformIntegrationsFromApiKey(apiKey: $apiKey) {\n pushAutoIdentifiedIssues\n provider\n clientId\n defaultPriority\n defaultProject\n defaultTeam\n primaryCloudId\n installed\n projects\n teams\n workflowStates\n webhookState\n clouds\n labels\n sprints\n users\n fieldConfigurations\n invalidFields\n jiraReporterAccountId\n }\n }", { apiKey: e2, backendApi: t2 });
554
667
  }
555
- function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2, a2, s2, r2, l2, c2, d2, u2, p2, f2, g2, m2) {
556
- return sendGraphQLRequest("CreateTriageAndIssueFromRecorder", "mutation CreateTriageAndIssueFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $issueName: String,\n $issueDescription: String,\n $createEngineeringTicket: Boolean,\n $teamId: String,\n $projectId: String,\n $priority: Int,\n $labels: [String!],\n $issueType: String,\n $customFields: JSON,\n $triageSource: TriageSourceEnum\n ) {\n createTriageAndIssueFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n issueName: $issueName,\n issueDescription: $issueDescription,\n createEngineeringTicket: $createEngineeringTicket,\n teamId: $teamId,\n projectId: $projectId,\n priority: $priority,\n labels: $labels,\n issueType: $issueType,\n customFields: $customFields,\n triageSource: $triageSource\n ) {\n id\n title\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: a2, issueName: s2, issueDescription: r2, createEngineeringTicket: l2, teamId: c2, projectId: d2, priority: u2, labels: p2, issueType: f2, customFields: g2, triageSource: m2, backendApi: t2 });
668
+ function createTriageAndIssueFromRecorder(e2, t2, n2, i2, o2, s2, r2, a2, l2, c2, d2, u2, p2, f2, g2, m2) {
669
+ return sendGraphQLRequest("CreateTriageAndIssueFromRecorder", "mutation CreateTriageAndIssueFromRecorder(\n $apiKey: String!,\n $recordingSessionId: String!,\n $timestampStart: String!,\n $timestampEnd: String!,\n $description: String,\n $issueName: String,\n $issueDescription: String,\n $createEngineeringTicket: Boolean,\n $teamId: String,\n $projectId: String,\n $priority: Int,\n $labels: [String!],\n $issueType: String,\n $customFields: JSON,\n $triageSource: TriageSourceEnum\n ) {\n createTriageAndIssueFromRecorder(\n apiKey: $apiKey,\n recordingSessionId: $recordingSessionId,\n timestampStart: $timestampStart,\n timestampEnd: $timestampEnd,\n description: $description,\n issueName: $issueName,\n issueDescription: $issueDescription,\n createEngineeringTicket: $createEngineeringTicket,\n teamId: $teamId,\n projectId: $projectId,\n priority: $priority,\n labels: $labels,\n issueType: $issueType,\n customFields: $customFields,\n triageSource: $triageSource\n ) {\n id\n title\n }\n }\n ", { apiKey: e2, recordingSessionId: n2, timestampStart: i2, timestampEnd: o2, description: s2, issueName: r2, issueDescription: a2, createEngineeringTicket: l2, teamId: c2, projectId: d2, priority: u2, labels: p2, issueType: f2, customFields: g2, triageSource: m2, backendApi: t2 });
557
670
  }
558
- const Q = ["/node_modules/", "/@sailfish-ai/", "/@sailfish-rrweb/", "/dist/", "/webpack/", "/vite/", "/__vite", "/react-dom/", "/react/", "/scheduler/", "/<", "/chrome-extension://", "/extensions/"];
671
+ const Y = ["/node_modules/", "/@sailfish-ai/", "/@sailfish-rrweb/", "/dist/", "/webpack/", "/vite/", "/__vite", "/react-dom/", "/react/", "/scheduler/", "/<", "/chrome-extension://", "/extensions/"];
559
672
  function shouldSkipFrame(e2) {
560
- return Q.some((t2) => e2.includes(t2));
673
+ return Y.some((t2) => e2.includes(t2));
561
674
  }
562
675
  function normalizeFilePath(e2) {
563
676
  let t2 = e2;
@@ -623,8 +736,17 @@ function yieldToMain() {
623
736
  var _a;
624
737
  return "undefined" != typeof globalThis && ((_a = globalThis.scheduler) == null ? void 0 : _a.yield) ? globalThis.scheduler.yield() : new Promise((e2) => setTimeout(e2, 0));
625
738
  }
626
- let J = null;
627
- const X = "sailfishSanitize", Z = "zendesk_chat", Y = "Zendesk";
739
+ function closestSafe(e2, t2) {
740
+ if (!e2 || !t2) return false;
741
+ try {
742
+ return !!e2.closest(t2);
743
+ } catch {
744
+ return false;
745
+ }
746
+ }
747
+ const ee = { color: true, date: true, "datetime-local": true, email: true, month: true, number: true, range: true, search: true, tel: true, text: true, time: true, url: true, week: true, textarea: true, select: true, password: true };
748
+ let te = null;
749
+ const ne = "sailfishSanitize", ie = "zendesk_chat", oe = "Zendesk";
628
750
  function zE_safe(...e2) {
629
751
  try {
630
752
  if ((function hasZendesk() {
@@ -638,15 +760,15 @@ function maskInputFn(e2, t2) {
638
760
  var _a;
639
761
  if ("hidden" === t2.type) return "";
640
762
  const n2 = { creditCard: /\b(?:\d[ -]*?){13,16}\b/, ssn: /\b\d{3}-\d{2}-\d{4}\b/ };
641
- return t2.closest(".mask") ? "*".repeat(e2.length) : t2.hasAttribute("data-cc") || ((_a = t2.getAttribute("autocomplete")) == null ? void 0 : _a.startsWith("cc-")) || n2.creditCard.test(e2) ? "**** **** **** " + e2.slice(-4) : t2.hasAttribute("data-ssn") || n2.ssn.test(e2) ? "***-**-" + e2.slice(-4) : t2.hasAttribute("data-dob") ? "**/**/" + e2.slice(-4) : e2;
763
+ return t2.hasAttribute("data-cc") || ((_a = t2.getAttribute("autocomplete")) == null ? void 0 : _a.startsWith("cc-")) || n2.creditCard.test(e2) ? "**** **** **** " + e2.slice(-4) : t2.hasAttribute("data-ssn") || n2.ssn.test(e2) ? "***-**-" + e2.slice(-4) : t2.hasAttribute("data-dob") ? "**/**/" + e2.slice(-4) : "*".repeat(e2.length);
642
764
  }
643
- let ee = true, te = null, ne = null, ie = null, oe = null;
765
+ let se = true, re = null, ae = null, le = null, ce = null;
644
766
  function invalidateUrlCache() {
645
- ee = true;
767
+ se = true;
646
768
  }
647
- const getUrlAndStoredUuids = () => (ee && (function _refreshSessionStorageCache() {
648
- te = sessionStorage.getItem("pageVisitUUID"), ne = sessionStorage.getItem("prevPageVisitUUID"), ie = sessionStorage.getItem("tabVisibilityChanged"), oe = sessionStorage.getItem("tabVisibilityState"), ee = false;
649
- })(), { page_visit_uuid: te, prev_page_visit_uuid: ne, href: getCachedHrefNoQuery(), tabVisibilityChanged: ie, tabVisibilityState: oe });
769
+ const getUrlAndStoredUuids = () => (se && (function _refreshSessionStorageCache() {
770
+ re = sessionStorage.getItem("pageVisitUUID"), ae = sessionStorage.getItem("prevPageVisitUUID"), le = sessionStorage.getItem("tabVisibilityChanged"), ce = sessionStorage.getItem("tabVisibilityState"), se = false;
771
+ })(), { page_visit_uuid: re, prev_page_visit_uuid: ae, href: getCachedHrefNoQuery(), tabVisibilityChanged: le, tabVisibilityState: ce });
650
772
  function initializeDomContentEvents(e2) {
651
773
  document.addEventListener("readystatechange", () => {
652
774
  const t2 = { type: 24, data: { source: 0, info: "" }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() };
@@ -655,13 +777,13 @@ function initializeDomContentEvents(e2) {
655
777
  t2.data.source = i;
656
778
  break;
657
779
  case "complete":
658
- t2.data.source = a;
780
+ t2.data.source = s;
659
781
  }
660
782
  t2.data.info && sendEvent(t2);
661
783
  }), document.addEventListener("DOMContentLoaded", () => {
662
784
  sendEvent({ type: 24, data: { source: o }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
663
785
  }), window.addEventListener("pagehide", () => {
664
- sendEvent({ type: 24, data: { source: s }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
786
+ sendEvent({ type: 24, data: { source: r }, timestamp: Date.now(), sessionId: e2, ...getUrlAndStoredUuids() });
665
787
  });
666
788
  }
667
789
  async function initializePerformancePlugin(e2) {
@@ -681,14 +803,14 @@ async function initializePerformancePlugin(e2) {
681
803
  async function initializeConsolePlugin(e2, n2) {
682
804
  const { getRecordConsolePlugin: i2 } = await import("@sailfish-rrweb/rrweb-plugin-console-record");
683
805
  await yieldToMain();
684
- const { name: o2, observer: a2 } = i2(e2);
685
- a2((e3) => {
686
- const i3 = e3, [a3, s2] = getCallerLocationFromTrace(i3 == null ? void 0 : i3.trace, 0), [r2, l2] = getCallerLocation(2), c2 = a3 ?? r2, d2 = s2 ?? l2, u2 = { ...i3, sourceFile: c2, sourceLine: d2 };
806
+ const { name: o2, observer: s2 } = i2(e2);
807
+ s2((e3) => {
808
+ const i3 = e3, [s3, r2] = getCallerLocationFromTrace(i3 == null ? void 0 : i3.trace, 0), [a2, l2] = getCallerLocation(2), c2 = s3 ?? a2, d2 = r2 ?? l2, u2 = { ...i3, sourceFile: c2, sourceLine: d2 };
687
809
  sendEvent({ type: t.Plugin, timestamp: Date.now(), data: { plugin: o2, payload: u2 }, sessionId: n2, ...getUrlAndStoredUuids() });
688
810
  }, window, e2);
689
811
  }
690
- async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2 = false) {
691
- const c2 = initializeWebSocket(n2, i2, o2, a2, r2);
812
+ async function initializeRecording(e2, n2, i2, o2, s2, r2 = true, a2 = false, l2 = false) {
813
+ const c2 = initializeWebSocket(n2, i2, o2, s2, a2);
692
814
  try {
693
815
  const n3 = (function createThrottledEmit(e3, t2 = 1e3) {
694
816
  if (!e3) return { emit: (e4) => sendEvent(e4), flush: () => {
@@ -703,8 +825,8 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
703
825
  const t3 = e4.data, n5 = (t3 == null ? void 0 : t3.adds) && t3.adds.length > 0, i4 = (t3 == null ? void 0 : t3.removes) && t3.removes.length > 0;
704
826
  if (n5 || i4) return void sendEvent(e4);
705
827
  }
706
- const a3 = `3:${o3}:${((_b = e4.data) == null ? void 0 : _b.id) || "unknown"}`;
707
- n4.set(a3, e4), i3 || (i3 = setInterval(() => {
828
+ const s3 = `3:${o3}:${((_b = e4.data) == null ? void 0 : _b.id) || "unknown"}`;
829
+ n4.set(s3, e4), i3 || (i3 = setInterval(() => {
708
830
  0 !== n4.size && (n4.forEach((e5) => sendEvent(e5)), n4.clear());
709
831
  }, t2));
710
832
  }, flush: () => {
@@ -720,24 +842,43 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
720
842
  console.warn("[Sailfish] Failed to enable Fiber tracking:", e3);
721
843
  }
722
844
  const { record: n4 } = await import("@sailfish-rrweb/rrweb-record-only");
723
- if (J = n4, await yieldToMain(), l2) {
724
- const { chunkedSnapshot: i3 } = await import("./chunkSerializer-C8qtomKe.js"), o3 = n4.mirror;
725
- let a3 = true;
726
- const s3 = [];
845
+ te = n4, await yieldToMain();
846
+ const i3 = e2.unmaskSelector || void 0, o3 = e2.blockSelector || void 0, s3 = e2.maskTextSelector || void 0, r3 = e2.maskInputSelector || void 0, a3 = { ...e2.maskInputOptions ?? {} }, c3 = r3 ? { ...ee } : a3, d2 = (function buildMaskInputFn(e3) {
847
+ const { baseFn: t2, unmaskSelector: n5, maskInputSelector: i4, adminMaskInputOptions: o4 } = e3;
848
+ return n5 || i4 ? (e4, s4) => {
849
+ if ("hidden" === s4.type) return "";
850
+ if (closestSafe(s4, n5)) return e4;
851
+ const r4 = (s4.type || "").toLowerCase(), a4 = (s4.tagName || "").toLowerCase(), l3 = true === o4[r4] || true === o4[a4], c4 = (function matchesSelectorSafe(e5, t3) {
852
+ if (!t3) return false;
853
+ try {
854
+ return e5.matches(t3);
855
+ } catch {
856
+ return false;
857
+ }
858
+ })(s4, i4);
859
+ return l3 || c4 ? t2(e4, s4) : e4;
860
+ } : t2;
861
+ })({ baseFn: maskInputFn, unmaskSelector: i3, maskInputSelector: r3, adminMaskInputOptions: a3 }), u2 = /* @__PURE__ */ (function makeMaskTextFn(e3) {
862
+ return (t2, n5) => closestSafe(n5, e3) ? t2 : t2.replace(/\S/g, "*");
863
+ })(i3);
864
+ if (l2) {
865
+ const { chunkedSnapshot: a4 } = await import("./chunkSerializer-DDukZpgl.js"), l3 = n4.mirror;
866
+ let p2 = true;
867
+ const f2 = [];
727
868
  n4({ emit(e3) {
728
- a3 ? s3.push(e3) : emitWithContext(e3);
729
- }, maskInputOptions: { text: true }, maskInputFn, ...e2, maskTextClass: e2.maskTextClass ?? X, recordDOM: false });
730
- const r3 = Date.now(), l3 = await i3(document, o3, { chunkSize: 500, maxChunkMs: 16, blockClass: e2.blockClass, blockSelector: e2.blockSelector, maskTextClass: e2.maskTextClass ?? X, maskTextSelector: e2.maskTextSelector });
731
- if (l3) {
732
- emitWithContext({ type: t.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp: r3 }), emitWithContext({ type: t.FullSnapshot, data: { node: l3, initialOffset: { left: void 0 !== window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft, top: void 0 !== window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop } }, timestamp: r3 });
733
- for (const e3 of s3) emitWithContext(e3);
734
- a3 = false;
735
- } else console.warn("[Sailfish] chunkSnapshot serialization failed; session continues without initial DOM snapshot"), a3 = false;
869
+ p2 ? f2.push(e3) : emitWithContext(e3);
870
+ }, ...e2, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, maskInputSelector: r3, maskTextSelector: s3, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne, recordDOM: false });
871
+ const g2 = Date.now(), m2 = await a4(document, l3, { chunkSize: 500, maxChunkMs: 16, blockClass: e2.blockClass, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne, maskTextSelector: s3, maskInputSelector: r3, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, unmaskSelector: i3 });
872
+ if (m2) {
873
+ emitWithContext({ type: t.Meta, data: { href: window.location.href, width: document.documentElement.clientWidth || document.body.clientWidth, height: document.documentElement.clientHeight || document.body.clientHeight }, timestamp: g2 }), emitWithContext({ type: t.FullSnapshot, data: { node: m2, initialOffset: { left: void 0 !== window.pageXOffset ? window.pageXOffset : document.documentElement.scrollLeft, top: void 0 !== window.pageYOffset ? window.pageYOffset : document.documentElement.scrollTop } }, timestamp: g2 });
874
+ for (const e3 of f2) emitWithContext(e3);
875
+ p2 = false;
876
+ } else console.warn("[Sailfish] chunkSnapshot serialization failed; session continues without initial DOM snapshot"), p2 = false;
736
877
  } else n4({ emit(e3) {
737
878
  emitWithContext(e3);
738
- }, maskInputOptions: { text: true }, maskInputFn, ...e2, maskTextClass: e2.maskTextClass ?? X });
879
+ }, ...e2, maskInputOptions: c3, maskInputFn: d2, maskTextFn: u2, maskInputSelector: r3, maskTextSelector: s3, blockSelector: o3, maskTextClass: e2.maskTextClass ?? ne });
739
880
  };
740
- if (s2) {
881
+ if (r2) {
741
882
  let e3 = false;
742
883
  const startOnce = () => {
743
884
  e3 || (e3 = true, startHeavyWork());
@@ -767,11 +908,11 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
767
908
  zE_safe("messenger:set", "conversationTags", [`sailfish-session-${o2}`]);
768
909
  });
769
910
  const handleWidgetOpen = () => {
770
- J == null ? void 0 : J.addSailfishEvent(t.SailfishCustom, { action: "customer support chat opened", element_id: Z, provider: Y });
911
+ te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "customer support chat opened", element_id: ie, provider: oe });
771
912
  }, handleWidgetClose = () => {
772
- J == null ? void 0 : J.addSailfishEvent(t.SailfishCustom, { action: "customer support chat closed", element_id: Z, provider: Y });
913
+ te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "customer support chat closed", element_id: ie, provider: oe });
773
914
  }, handleUnreadMessages = (e3) => {
774
- J == null ? void 0 : J.addSailfishEvent(t.SailfishCustom, { action: "zendesk unreadmessages", element_id: Z, provider: Y });
915
+ te == null ? void 0 : te.addSailfishEvent(t.SailfishCustom, { action: "zendesk unreadmessages", element_id: ie, provider: oe });
775
916
  };
776
917
  suppressConsoleLogsDuringCall(() => {
777
918
  zE_safe("messenger:on", "open", handleWidgetOpen), zE_safe("messenger:on", "close", handleWidgetClose), zE_safe("messenger:on", "unreadMessages", handleUnreadMessages);
@@ -782,7 +923,7 @@ async function initializeRecording(e2, n2, i2, o2, a2, s2 = true, r2 = false, l2
782
923
  }
783
924
  return c2;
784
925
  }
785
- const ae = [(e2) => (function checkNextJs() {
926
+ const de = [(e2) => (function checkNextJs() {
786
927
  try {
787
928
  if (void 0 !== globalThis.__NEXT_DATA__) return "nextjs";
788
929
  } catch {
@@ -844,35 +985,52 @@ const ae = [(e2) => (function checkNextJs() {
844
985
  }
845
986
  return null;
846
987
  }];
847
- const se = ["jira", "linear", "zendesk"];
848
- let re = null;
849
- const le = /* @__PURE__ */ new Map();
988
+ const ue = "sf-create-issue-preference", pe = "sf-create-eng-ticket-preference";
989
+ function getInitialState() {
990
+ const e2 = (function loadUserPreferences() {
991
+ return { createIssue: m && "true" === localStorage.getItem(ue), createEngTicket: m && "true" === localStorage.getItem(pe) };
992
+ })();
993
+ return { mode: "lookback", description: "", occurredInThisTab: true, createIssue: e2.createIssue, issueName: "", issueDescription: "", createEngTicket: e2.createEngTicket, engTicketTeam: "", engTicketProject: "", engTicketPriority: 0, engTicketLabels: [], engTicketSprint: "", engTicketIssueType: "", engTicketCustomFields: {} };
994
+ }
995
+ let fe = getInitialState(), ge = null, me = null, he = null, ye = false, Se = false;
996
+ function setSprintDefaulted(e2) {
997
+ Se = e2;
998
+ }
999
+ function setTimerInterval(e2) {
1000
+ he = e2;
1001
+ }
1002
+ function setIsRecording(e2) {
1003
+ ye = e2;
1004
+ }
1005
+ const be = ["jira", "linear", "zendesk"];
1006
+ let ve = null;
1007
+ const we = /* @__PURE__ */ new Map();
850
1008
  function getIntegrationData() {
851
- return re;
1009
+ return ve;
852
1010
  }
853
1011
  function hasValidIntegration() {
854
- return null !== re && true === re.installed;
1012
+ return null !== ve && true === ve.installed;
855
1013
  }
856
1014
  function resolveIntegration(e2) {
857
1015
  var _a;
858
1016
  if ((e2 == null ? void 0 : e2.errors) && e2.errors.length > 0) return console.error("GraphQL errors fetching integrations:", e2.errors), null;
859
1017
  const t2 = (_a = e2 == null ? void 0 : e2.data) == null ? void 0 : _a.getEngineeringTicketPlatformIntegrationsFromApiKey, n2 = (t2 || []).filter((e3) => {
860
1018
  var _a2;
861
- return se.includes(((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase()) || "") && true === e3.installed;
1019
+ return be.includes(((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase()) || "") && true === e3.installed;
862
1020
  });
863
1021
  if (0 === n2.length) return console.warn("No valid installed integrations found"), null;
864
1022
  const i2 = n2.find((e3) => {
865
1023
  var _a2;
866
1024
  return "jira" === ((_a2 = e3.provider) == null ? void 0 : _a2.toLowerCase());
867
1025
  }) || n2[0];
868
- return (i2 == null ? void 0 : i2.primaryCloudId) && le.set(i2.primaryCloudId, i2), i2;
1026
+ return (i2 == null ? void 0 : i2.primaryCloudId) && we.set(i2.primaryCloudId, i2), i2;
869
1027
  }
870
1028
  async function refreshIntegrationData(e2, t2) {
871
1029
  try {
872
1030
  const n2 = resolveIntegration(await fetchEngineeringTicketPlatformIntegrations(e2, t2));
873
- return re = n2, n2;
1031
+ return ve = n2, n2;
874
1032
  } catch (e3) {
875
- return console.error("Error refreshing integration data:", e3), re;
1033
+ return console.error("Error refreshing integration data:", e3), ve;
876
1034
  }
877
1035
  }
878
1036
  function populateSelectOptions(e2, t2, n2) {
@@ -897,6 +1055,16 @@ function populatePriorityOptions(e2, t2, n2) {
897
1055
  }
898
1056
  null != n2 ? e2.value = String(n2) : i2 || (e2.value = "0");
899
1057
  }
1058
+ function pickDefaultActiveSprint(e2, t2, n2) {
1059
+ const i2 = (e2 || []).filter((e3) => "active" === e3.state);
1060
+ if (!i2.length) return null;
1061
+ const o2 = (function _projectBoardIds(e3, t3) {
1062
+ if (!e3) return [];
1063
+ const n3 = (t3 || []).find((t4) => t4.id === e3 || t4.key === e3);
1064
+ return ((n3 == null ? void 0 : n3.boards) || (n3 == null ? void 0 : n3.board_ids) || []).map((e4) => "object" == typeof e4 ? e4.id : e4);
1065
+ })(t2, n2);
1066
+ return (o2.length ? i2.find((e3) => o2.some((t3) => String(t3) === String(e3.originBoardId))) : null) || i2[0];
1067
+ }
900
1068
  function populateSprintOptions(e2, t2, n2) {
901
1069
  e2.innerHTML = "";
902
1070
  const i2 = document.createElement("option");
@@ -907,8 +1075,8 @@ function populateSprintOptions(e2, t2, n2) {
907
1075
  }), n2 && (e2.value = n2);
908
1076
  }
909
1077
  function getSprintFieldId() {
910
- if (!(re == null ? void 0 : re.fieldConfigurations)) return "customfield_10020";
911
- const e2 = Array.isArray(re.fieldConfigurations) ? re.fieldConfigurations : [];
1078
+ if (!(ve == null ? void 0 : ve.fieldConfigurations)) return "customfield_10020";
1079
+ const e2 = Array.isArray(ve.fieldConfigurations) ? ve.fieldConfigurations : [];
912
1080
  for (const t2 of e2) {
913
1081
  const e3 = (t2.fields || []).find((e4) => {
914
1082
  var _a;
@@ -920,12 +1088,12 @@ function getSprintFieldId() {
920
1088
  }
921
1089
  function updateIssueTypeOptions(e2, t2) {
922
1090
  var _a;
923
- if (!(re == null ? void 0 : re.projects) || !t2) {
1091
+ if (!(ve == null ? void 0 : ve.projects) || !t2) {
924
1092
  e2.innerHTML = "";
925
1093
  const t3 = document.createElement("option");
926
1094
  return t3.value = "", t3.disabled = true, t3.selected = true, t3.textContent = "Select project first...", t3.style.color = "#9ca3af", e2.appendChild(t3), void (e2.style.color = "#9ca3af");
927
1095
  }
928
- const n2 = re.projects.find((e3) => e3.id === t2);
1096
+ const n2 = ve.projects.find((e3) => e3.id === t2);
929
1097
  if (!n2 || !n2.issue_types) {
930
1098
  e2.innerHTML = "";
931
1099
  const t3 = document.createElement("option");
@@ -944,17 +1112,17 @@ function updateIssueTypeOptions(e2, t2) {
944
1112
  }), n3 = i2.find((e3) => {
945
1113
  var _a2;
946
1114
  return "task" === ((_a2 = e3.name) == null ? void 0 : _a2.toLowerCase());
947
- }), a2 = (t3 == null ? void 0 : t3.id) || (n3 == null ? void 0 : n3.id) || ((_a = i2[0]) == null ? void 0 : _a.id);
948
- a2 ? (e2.value = a2, e2.style.color = "#000") : (o2.selected = true, e2.style.color = "#9ca3af");
1115
+ }), s2 = (t3 == null ? void 0 : t3.id) || (n3 == null ? void 0 : n3.id) || ((_a = i2[0]) == null ? void 0 : _a.id);
1116
+ s2 ? (e2.value = s2, e2.style.color = "#000") : (o2.selected = true, e2.style.color = "#9ca3af");
949
1117
  }
950
1118
  }
951
1119
  function getFieldsForProject(e2, t2) {
952
- if (!(re == null ? void 0 : re.fieldConfigurations) || !e2) return [];
953
- const n2 = Array.isArray(re.fieldConfigurations) ? re.fieldConfigurations.find((n3) => !(n3.project_key !== e2 && String(n3.project_id) !== String(e2) || t2 && String(n3.issue_type_id) !== String(t2))) : re.fieldConfigurations[e2];
1120
+ if (!(ve == null ? void 0 : ve.fieldConfigurations) || !e2) return [];
1121
+ const n2 = Array.isArray(ve.fieldConfigurations) ? ve.fieldConfigurations.find((n3) => !(n3.project_key !== e2 && String(n3.project_id) !== String(e2) || t2 && String(n3.issue_type_id) !== String(t2))) : ve.fieldConfigurations[e2];
954
1122
  return n2 && n2.fields ? n2.fields : [];
955
1123
  }
956
1124
  function getUsers() {
957
- return (re == null ? void 0 : re.users) ? re.users : [];
1125
+ return (ve == null ? void 0 : ve.users) ? ve.users : [];
958
1126
  }
959
1127
  function getDefaultReporterAccountId() {
960
1128
  const e2 = getUsers(), t2 = getIdentifiedUser();
@@ -963,16 +1131,16 @@ function getDefaultReporterAccountId() {
963
1131
  const n3 = e2.filter(t3);
964
1132
  return 1 === n3.length ? n3[0] : null;
965
1133
  };
966
- let a2 = i2 ? findUnique((e3) => (e3.email || e3.emailAddress || "").toLowerCase().trim() === i2) : null;
967
- if (!a2 && o2 && (a2 = findUnique((e3) => (e3.name || e3.displayName || "").toLowerCase().trim() === o2)), !a2 && i2) {
1134
+ let s2 = i2 ? findUnique((e3) => (e3.email || e3.emailAddress || "").toLowerCase().trim() === i2) : null;
1135
+ if (!s2 && o2 && (s2 = findUnique((e3) => (e3.name || e3.displayName || "").toLowerCase().trim() === o2)), !s2 && i2) {
968
1136
  const e3 = i2.split("@")[0];
969
- e3.length >= 3 && (a2 = findUnique((t3) => (t3.name || t3.displayName || "").toLowerCase().trim().includes(e3)));
1137
+ e3.length >= 3 && (s2 = findUnique((t3) => (t3.name || t3.displayName || "").toLowerCase().trim().includes(e3)));
970
1138
  }
971
- return a2 && (a2.id || a2.accountId) || null;
1139
+ return s2 && (s2.id || s2.accountId) || null;
972
1140
  }
973
1141
  function lastReporterStorageKey() {
974
- if (!re) return null;
975
- const e2 = re.primaryCloudId || re.provider || "";
1142
+ if (!ve) return null;
1143
+ const e2 = ve.primaryCloudId || ve.provider || "";
976
1144
  return e2 ? `sf-veritas:lastReporter:${e2}` : null;
977
1145
  }
978
1146
  function getSavedLastReporterAccountId() {
@@ -999,51 +1167,44 @@ function getValidSavedReporterAccountId() {
999
1167
  return getUsers().some((t2) => (t2.accountId || t2.id) === e2 && false !== t2.active) ? e2 : null;
1000
1168
  }
1001
1169
  function getProjectsForTeam(e2) {
1002
- if (!re) return [];
1003
- const t2 = re.teams && Array.isArray(re.teams) && re.teams.length > 0;
1170
+ if (!ve) return [];
1171
+ const t2 = ve.teams && Array.isArray(ve.teams) && ve.teams.length > 0;
1004
1172
  if (t2 && e2) {
1005
- const t3 = re.teams.find((t4) => t4.id === e2);
1173
+ const t3 = ve.teams.find((t4) => t4.id === e2);
1006
1174
  return (t3 == null ? void 0 : t3.projects) || [];
1007
1175
  }
1008
- return !t2 && re.projects ? re.projects : [];
1176
+ return !t2 && ve.projects ? ve.projects : [];
1009
1177
  }
1010
1178
  function updateFormWithIntegrationData(e2) {
1011
1179
  var _a;
1012
- if (!re) return e2;
1013
- const t2 = re.teams && Array.isArray(re.teams) && re.teams.length > 0, n2 = document.getElementById("sf-eng-ticket-team");
1014
- n2 && t2 && (populateSelectOptions(n2, re.teams, re.defaultTeam), e2.engTicketTeam ? n2.value = e2.engTicketTeam : e2.engTicketTeam = n2.value);
1180
+ if (!ve) return e2;
1181
+ const t2 = ve.teams && Array.isArray(ve.teams) && ve.teams.length > 0, n2 = document.getElementById("sf-eng-ticket-team");
1182
+ n2 && t2 && (populateSelectOptions(n2, ve.teams, ve.defaultTeam), e2.engTicketTeam ? n2.value = e2.engTicketTeam : e2.engTicketTeam = n2.value);
1015
1183
  const i2 = document.getElementById("sf-eng-ticket-project");
1016
1184
  if (i2) {
1017
- populateSelectOptions(i2, t2 ? getProjectsForTeam(e2.engTicketTeam) : re.projects || [], re.defaultProject), e2.engTicketProject ? i2.value = e2.engTicketProject : e2.engTicketProject = i2.value;
1185
+ populateSelectOptions(i2, t2 ? getProjectsForTeam(e2.engTicketTeam) : ve.projects || [], ve.defaultProject), e2.engTicketProject ? i2.value = e2.engTicketProject : e2.engTicketProject = i2.value;
1018
1186
  }
1019
1187
  const o2 = document.getElementById("sf-eng-ticket-priority");
1020
- o2 && (populatePriorityOptions(o2, re.provider || "", re.defaultPriority), e2.engTicketPriority ? o2.value = String(e2.engTicketPriority) : e2.engTicketPriority = Number(o2.value));
1021
- const a2 = document.getElementById("sf-eng-ticket-sprint"), s2 = "jira" === ((_a = re.provider) == null ? void 0 : _a.toLowerCase());
1022
- a2 && s2 && re.sprints && populateSprintOptions(a2, re.sprints, e2.engTicketSprint || void 0);
1023
- const r2 = document.getElementById("sf-eng-ticket-type");
1024
- return r2 && s2 && e2.engTicketProject && (updateIssueTypeOptions(r2, e2.engTicketProject), e2.engTicketIssueType ? (r2.value = e2.engTicketIssueType, r2.style.color = "#000") : r2.value && (e2.engTicketIssueType = r2.value)), e2;
1025
- }
1026
- const ce = Object.freeze(Object.defineProperty({ __proto__: null, fetchIntegrationData: async function fetchIntegrationData(e2, t2) {
1027
- if (!re) try {
1188
+ o2 && (populatePriorityOptions(o2, ve.provider || "", ve.defaultPriority), e2.engTicketPriority ? o2.value = String(e2.engTicketPriority) : e2.engTicketPriority = Number(o2.value));
1189
+ const s2 = document.getElementById("sf-eng-ticket-sprint"), r2 = "jira" === ((_a = ve.provider) == null ? void 0 : _a.toLowerCase());
1190
+ if (s2 && r2 && ve.sprints) {
1191
+ if (!e2.engTicketSprint && !Se) {
1192
+ const t3 = pickDefaultActiveSprint(ve.sprints, e2.engTicketProject, ve.projects || []);
1193
+ (t3 == null ? void 0 : t3.id) && (e2.engTicketSprint = String(t3.id), setSprintDefaulted(true));
1194
+ }
1195
+ populateSprintOptions(s2, ve.sprints, e2.engTicketSprint || void 0), e2.engTicketSprint && (s2.style.color = "");
1196
+ }
1197
+ const a2 = document.getElementById("sf-eng-ticket-type");
1198
+ return a2 && r2 && e2.engTicketProject && (updateIssueTypeOptions(a2, e2.engTicketProject), e2.engTicketIssueType ? (a2.value = e2.engTicketIssueType, a2.style.color = "#000") : a2.value && (e2.engTicketIssueType = a2.value)), e2;
1199
+ }
1200
+ const ke = Object.freeze(Object.defineProperty({ __proto__: null, fetchIntegrationData: async function fetchIntegrationData(e2, t2) {
1201
+ if (!ve) try {
1028
1202
  const n2 = await fetchEngineeringTicketPlatformIntegrations(e2, t2);
1029
- re = resolveIntegration(n2);
1203
+ ve = resolveIntegration(n2);
1030
1204
  } catch (e3) {
1031
- console.error("Error fetching integration data:", e3), re = null;
1205
+ console.error("Error fetching integration data:", e3), ve = null;
1032
1206
  }
1033
- }, getDefaultReporterAccountId, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSavedLastReporterAccountId, getSprintFieldId, getUsers, getValidSavedReporterAccountId, hasValidIntegration, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, saveLastReporterAccountId, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" })), de = "sf-create-issue-preference", ue = "sf-create-eng-ticket-preference";
1034
- function getInitialState() {
1035
- const e2 = (function loadUserPreferences() {
1036
- return { createIssue: f && "true" === localStorage.getItem(de), createEngTicket: f && "true" === localStorage.getItem(ue) };
1037
- })();
1038
- return { mode: "lookback", description: "", occurredInThisTab: true, createIssue: e2.createIssue, issueName: "", issueDescription: "", createEngTicket: e2.createEngTicket, engTicketTeam: "", engTicketProject: "", engTicketPriority: 0, engTicketLabels: [], engTicketSprint: "", engTicketIssueType: "", engTicketCustomFields: {} };
1039
- }
1040
- let pe = getInitialState(), fe = null, ge = null, me = null, he = false;
1041
- function setTimerInterval(e2) {
1042
- me = e2;
1043
- }
1044
- function setIsRecording(e2) {
1045
- he = e2;
1046
- }
1207
+ }, getDefaultReporterAccountId, getFieldsForProject, getIntegrationData, getProjectsForTeam, getSavedLastReporterAccountId, getSprintFieldId, getUsers, getValidSavedReporterAccountId, hasValidIntegration, pickDefaultActiveSprint, populatePriorityOptions, populateSelectOptions, populateSprintOptions, refreshIntegrationData, saveLastReporterAccountId, updateFormWithIntegrationData, updateIssueTypeOptions }, Symbol.toStringTag, { value: "Module" }));
1047
1208
  function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
1048
1209
  return `
1049
1210
  <div style="position:relative;">
@@ -1077,9 +1238,9 @@ function renderCustomMultiSelect(e2, t2, n2, i2, o2 = false) {
1077
1238
  </div>
1078
1239
  `;
1079
1240
  }
1080
- const ye = { enabled: false, openModalExistingMode: { key: "e", requireCmdCtrl: false }, openModalCaptureNewMode: { key: "n", requireCmdCtrl: false }, closeModal: { key: "escape", requireCmdCtrl: false }, submitReport: { key: "enter", requireCmdCtrl: true }, startRecording: { key: "r", requireCmdCtrl: false }, stopRecording: { key: "escape", requireCmdCtrl: true } }, be = { shortcuts: { ...ye }, resolveSessionId: null, apiKey: null, backendApi: null, triageBaseUrl: "https://app.sailfishqa.com", deactivateIsolation: () => {
1241
+ const xe = { enabled: false, openModalExistingMode: { key: "e", requireCmdCtrl: false }, openModalCaptureNewMode: { key: "n", requireCmdCtrl: false }, closeModal: { key: "escape", requireCmdCtrl: false }, submitReport: { key: "enter", requireCmdCtrl: true }, startRecording: { key: "r", requireCmdCtrl: false }, stopRecording: { key: "escape", requireCmdCtrl: true } }, Ie = { shortcuts: { ...xe }, resolveSessionId: null, apiKey: null, backendApi: null, triageBaseUrl: "https://app.sailfishqa.com", deactivateIsolation: () => {
1081
1242
  }, integrationData: null, showEngTicketFieldsDefault: false };
1082
- let we = null, ve = false;
1243
+ let Te = null, Ee = false;
1083
1244
  function setupCustomMultiSelectListeners(e2, t2) {
1084
1245
  const n2 = document.getElementById(`${e2}-container`), i2 = document.getElementById(`${e2}-dropdown`);
1085
1246
  if (!n2 || !i2) return;
@@ -1096,16 +1257,16 @@ function setupCustomMultiSelectListeners(e2, t2) {
1096
1257
  </span>`);
1097
1258
  }
1098
1259
  });
1099
- const a2 = n2.querySelector(".sf-multiselect-chips");
1100
- return a2 && (a2.innerHTML = o2.join("") || '<span style="color:#9ca3af;">Select...</span>', a2.querySelectorAll(".sf-multiselect-chip-remove").forEach((e4) => {
1260
+ const s2 = n2.querySelector(".sf-multiselect-chips");
1261
+ return s2 && (s2.innerHTML = o2.join("") || '<span style="color:#9ca3af;">Select...</span>', s2.querySelectorAll(".sf-multiselect-chip-remove").forEach((e4) => {
1101
1262
  e4.addEventListener("click", (n3) => {
1102
1263
  n3.stopPropagation();
1103
- const o3 = e4.dataset.value || "", a3 = i2.querySelector(`.sf-multiselect-option[data-value="${o3}"]`);
1104
- a3 && (a3.dataset.selected = "false", a3.style.backgroundColor = ""), updateChipsDisplay();
1105
- const s2 = [];
1264
+ const o3 = e4.dataset.value || "", s3 = i2.querySelector(`.sf-multiselect-option[data-value="${o3}"]`);
1265
+ s3 && (s3.dataset.selected = "false", s3.style.backgroundColor = ""), updateChipsDisplay();
1266
+ const r2 = [];
1106
1267
  i2.querySelectorAll(".sf-multiselect-option").forEach((e5) => {
1107
- "true" === e5.dataset.selected && s2.push(e5.dataset.value || "");
1108
- }), t2(s2);
1268
+ "true" === e5.dataset.selected && r2.push(e5.dataset.value || "");
1269
+ }), t2(r2);
1109
1270
  });
1110
1271
  })), e3;
1111
1272
  }
@@ -1114,8 +1275,8 @@ function setupCustomMultiSelectListeners(e2, t2) {
1114
1275
  n3.stopPropagation();
1115
1276
  const i3 = e3, o2 = "true" === i3.dataset.selected;
1116
1277
  i3.dataset.selected = String(!o2), i3.style.backgroundColor = o2 ? "" : "#e0f2fe";
1117
- const a2 = updateChipsDisplay();
1118
- t2(a2);
1278
+ const s2 = updateChipsDisplay();
1279
+ t2(s2);
1119
1280
  });
1120
1281
  }), updateChipsDisplay(), document.addEventListener("click", (e3) => {
1121
1282
  const t3 = e3.target;
@@ -1128,14 +1289,14 @@ function renderDynamicFields(e2, t2) {
1128
1289
  if (!e2) return void (n2.innerHTML = '<div style="font-size:14px; color:#64748B;">Select a project to see additional fields</div>');
1129
1290
  const i2 = getFieldsForProject(e2, t2), o2 = getUsers();
1130
1291
  if (!i2 || 0 === i2.length) return void (n2.innerHTML = "");
1131
- const a2 = i2.map((e3) => (function renderDynamicField(e4, t3, n3 = []) {
1292
+ const s2 = i2.map((e3) => (function renderDynamicField(e4, t3, n3 = []) {
1132
1293
  var _a, _b, _c, _d;
1133
- const i3 = e4.fieldId || e4.key, o3 = e4.name, a3 = (_a = e4.schema) == null ? void 0 : _a.type, s2 = (_b = e4.schema) == null ? void 0 : _b.system, r2 = (_c = e4.schema) == null ? void 0 : _c.custom, l2 = e4.required || false, c2 = e4.allowedValues, d2 = ["summary", "description", "project", "issuetype", "priority"];
1134
- if (d2.includes(i3) || d2.includes(s2)) return null;
1294
+ const i3 = e4.fieldId || e4.key, o3 = e4.name, s3 = (_a = e4.schema) == null ? void 0 : _a.type, r2 = (_b = e4.schema) == null ? void 0 : _b.system, a2 = (_c = e4.schema) == null ? void 0 : _c.custom, l2 = e4.required || false, c2 = e4.allowedValues, d2 = ["summary", "description", "project", "issuetype", "priority"];
1295
+ if (d2.includes(i3) || d2.includes(r2)) return null;
1135
1296
  const u2 = l2 ? '<span style="color:#ef4444;">*</span>' : "", p2 = "width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none;";
1136
- switch (a3) {
1297
+ switch (s3) {
1137
1298
  case "string":
1138
- return r2 && r2.includes("textarea") ? `
1299
+ return a2 && a2.includes("textarea") ? `
1139
1300
  <div>
1140
1301
  <label for="${i3}" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
1141
1302
  ${o3} ${u2}
@@ -1207,7 +1368,7 @@ function renderDynamicFields(e2, t2) {
1207
1368
  const e5 = n3.map((e6) => {
1208
1369
  const n4 = e6.email ? `${e6.name} (${e6.email})` : e6.name, i4 = t3 === e6.id ? "selected" : "";
1209
1370
  return `<option value="${e6.id}" ${i4}>${n4}</option>`;
1210
- }).join(""), a4 = t3 && n3.some((e6) => e6.id === t3);
1371
+ }).join(""), s4 = t3 && n3.some((e6) => e6.id === t3);
1211
1372
  return `
1212
1373
  <div>
1213
1374
  <label for="${i3}" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
@@ -1217,10 +1378,10 @@ function renderDynamicFields(e2, t2) {
1217
1378
  id="${i3}"
1218
1379
  class="sf-dynamic-field"
1219
1380
  data-field-id="${i3}"
1220
- style="${p2} appearance:none; cursor:pointer; background-color: white; ${a4 ? "" : "color: #9ca3af;"}"
1381
+ style="${p2} appearance:none; cursor:pointer; background-color: white; ${s4 ? "" : "color: #9ca3af;"}"
1221
1382
  ${l2 ? "required" : ""}
1222
1383
  >
1223
- <option value="" ${a4 ? "" : "selected"} style="color: #9ca3af;">Select ${o3.toLowerCase()}...</option>
1384
+ <option value="" ${s4 ? "" : "selected"} style="color: #9ca3af;">Select ${o3.toLowerCase()}...</option>
1224
1385
  ${e5}
1225
1386
  </select>
1226
1387
  </div>
@@ -1253,7 +1414,7 @@ function renderDynamicFields(e2, t2) {
1253
1414
  }
1254
1415
  return null;
1255
1416
  case "array":
1256
- return "labels" === s2 ? null : c2 && c2.length > 0 ? renderCustomMultiSelect(i3, o3, c2, Array.isArray(t3) ? t3 : [], l2) : null;
1417
+ return "labels" === r2 ? null : c2 && c2.length > 0 ? renderCustomMultiSelect(i3, o3, c2, Array.isArray(t3) ? t3 : [], l2) : null;
1257
1418
  case "parent":
1258
1419
  case "issuelink":
1259
1420
  return `
@@ -1292,22 +1453,22 @@ function renderDynamicFields(e2, t2) {
1292
1453
  </div>
1293
1454
  ` : null;
1294
1455
  }
1295
- })(e3, pe.engTicketCustomFields[e3.fieldId || e3.key], o2)).filter(Boolean).join("");
1296
- n2.innerHTML = a2 || "", i2.forEach((e3) => {
1456
+ })(e3, fe.engTicketCustomFields[e3.fieldId || e3.key], o2)).filter(Boolean).join("");
1457
+ n2.innerHTML = s2 || "", i2.forEach((e3) => {
1297
1458
  var _a;
1298
1459
  const t3 = e3.fieldId || e3.key, n3 = (_a = e3.schema) == null ? void 0 : _a.type, i3 = e3.allowedValues;
1299
1460
  "array" === n3 && i3 && i3.length > 0 && setupCustomMultiSelectListeners(t3, (e4) => {
1300
- pe.engTicketCustomFields[t3] = e4;
1461
+ fe.engTicketCustomFields[t3] = e4;
1301
1462
  });
1302
1463
  });
1303
1464
  }
1304
1465
  function generateEngTicketFieldsHTML() {
1305
1466
  var _a;
1306
- const e2 = be.integrationData;
1467
+ const e2 = Ie.integrationData;
1307
1468
  if (!e2) return "";
1308
1469
  const t2 = "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase());
1309
1470
  let n2 = "<div style='display:flex; flex-direction:column; gap:12px;'>";
1310
- return e2.teams && Array.isArray(e2.teams) && e2.teams.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-team" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Team\n </label>\n <select id="sf-eng-ticket-team"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select team...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-project" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Project\n </label>\n <select id="sf-eng-ticket-project"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project...</option>\n </select>\n </div>\n ', t2 && (n2 += '\n <div>\n <label for="sf-eng-ticket-type" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Issue Type\n </label>\n <select id="sf-eng-ticket-type"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project first...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-priority" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Priority\n </label>\n <select id="sf-eng-ticket-priority"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white;">\n </select>\n </div>\n ', e2.labels && Array.isArray(e2.labels) && e2.labels.length > 0 && (n2 += renderCustomMultiSelect("sf-eng-ticket-labels", "Labels", e2.labels, pe.engTicketLabels, false)), t2 && e2.sprints && Array.isArray(e2.sprints) && e2.sprints.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-sprint" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Sprint\n </label>\n <select id="sf-eng-ticket-sprint"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select sprint...</option>\n </select>\n </div>\n '), n2 += '\n <div id="sf-dynamic-fields-container" style="display: flex; flex-direction: column; gap: 12px;"></div>\n ', n2 += "</div>", n2;
1471
+ return e2.teams && Array.isArray(e2.teams) && e2.teams.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-team" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Team\n </label>\n <select id="sf-eng-ticket-team"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select team...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-project" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Project\n </label>\n <select id="sf-eng-ticket-project"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project...</option>\n </select>\n </div>\n ', t2 && (n2 += '\n <div>\n <label for="sf-eng-ticket-type" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Issue Type\n </label>\n <select id="sf-eng-ticket-type"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select project first...</option>\n </select>\n </div>\n '), n2 += '\n <div>\n <label for="sf-eng-ticket-priority" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Priority\n </label>\n <select id="sf-eng-ticket-priority"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white;">\n </select>\n </div>\n ', e2.labels && Array.isArray(e2.labels) && e2.labels.length > 0 && (n2 += renderCustomMultiSelect("sf-eng-ticket-labels", "Labels", e2.labels, fe.engTicketLabels, false)), t2 && e2.sprints && Array.isArray(e2.sprints) && e2.sprints.length > 0 && (n2 += '\n <div>\n <label for="sf-eng-ticket-sprint" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">\n Sprint\n </label>\n <select id="sf-eng-ticket-sprint"\n style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none; appearance:none; cursor:pointer; background-color: white; color: #9ca3af;">\n <option value="" selected style="color: #9ca3af;">Select sprint...</option>\n </select>\n </div>\n '), n2 += '\n <div id="sf-dynamic-fields-container" style="display: flex; flex-direction: column; gap: 12px;"></div>\n ', n2 += "</div>", n2;
1311
1472
  }
1312
1473
  function getShortcutKeyCmdCtrlLabel() {
1313
1474
  return (function isMacPlatform() {
@@ -1321,19 +1482,19 @@ function getShortcutLabelFromContext(e2) {
1321
1482
  return e3.requireCmdCtrl && t2.push(getShortcutKeyCmdCtrlLabel()), t2.push((function formatShortcutKeyLabel(e4) {
1322
1483
  return ({ escape: "esc" }[e4.toLowerCase()] || e4).toUpperCase();
1323
1484
  })(e3.key)), t2.map((e4) => `<span style="background: #F1F5F9; border:1px solid #cbd5e1; border-radius: 4px; padding: 0 4px; font-weight: 500; font-size: 12px; color: #94A3B8; line-height: 16px;">${e4}</span>`).join(e3.requireCmdCtrl ? " + " : "");
1324
- })(be.shortcuts[e2]);
1485
+ })(Ie.shortcuts[e2]);
1325
1486
  }
1326
1487
  function getSessionIdSafely() {
1327
- if (!be.resolveSessionId) throw new Error("getSessionId not defined");
1328
- return be.resolveSessionId();
1488
+ if (!Ie.resolveSessionId) throw new Error("getSessionId not defined");
1489
+ return Ie.resolveSessionId();
1329
1490
  }
1330
1491
  function openReportIssueModal(e2) {
1331
- he ? stopRecording() : (ve = (e2 == null ? void 0 : e2.showEngTicketFields) ?? be.showEngTicketFieldsDefault, injectModalHTML(), we && document.body.appendChild(we));
1492
+ ye ? stopRecording() : (Ee = (e2 == null ? void 0 : e2.showEngTicketFields) ?? Ie.showEngTicketFieldsDefault, injectModalHTML(), Te && document.body.appendChild(Te));
1332
1493
  }
1333
1494
  function closeModal() {
1334
- be.deactivateIsolation(), document.activeElement instanceof HTMLElement && document.activeElement.blur(), (we == null ? void 0 : we.parentNode) && we.parentNode.removeChild(we), we = null, he || (function resetState() {
1335
- pe = getInitialState(), fe = null, ge = null;
1336
- })(), me && (clearInterval(me), setTimerInterval(null));
1495
+ Ie.deactivateIsolation(), document.activeElement instanceof HTMLElement && document.activeElement.blur(), (Te == null ? void 0 : Te.parentNode) && Te.parentNode.removeChild(Te), Te = null, ye || (function resetState() {
1496
+ fe = getInitialState(), ge = null, me = null, Se = false;
1497
+ })(), he && (clearInterval(he), setTimerInterval(null));
1337
1498
  }
1338
1499
  function activateModalIsolation(e2) {
1339
1500
  e2.setAttribute("role", "dialog"), e2.setAttribute("aria-modal", "true"), e2.hasAttribute("tabindex") || e2.setAttribute("tabindex", "-1");
@@ -1350,10 +1511,10 @@ function activateModalIsolation(e2) {
1350
1511
  n3 && (e2.contains(n3) || (t3.stopImmediatePropagation(), t3.preventDefault(), refocus()));
1351
1512
  }, o2 = ["mousedown", "mouseup", "click", "pointerdown", "pointerup", "touchstart", "touchend", "wheel", "keydown", "keyup", "focus", "focusin", "focusout", "blur"];
1352
1513
  o2.forEach((e3) => document.addEventListener(e3, quarantine, true));
1353
- let a2 = 0, s2 = null;
1354
- const r2 = t2 instanceof HTMLTextAreaElement ? t2 : null, refocus = () => {
1355
- if ((e2.querySelector(":focus") || r2 || t2 || e2).focus({ preventScroll: true }), r2 && document.activeElement === r2 && s2) try {
1356
- r2.setSelectionRange(s2.start, s2.end, "none");
1514
+ let s2 = 0, r2 = null;
1515
+ const a2 = t2 instanceof HTMLTextAreaElement ? t2 : null, refocus = () => {
1516
+ if ((e2.querySelector(":focus") || a2 || t2 || e2).focus({ preventScroll: true }), a2 && document.activeElement === a2 && r2) try {
1517
+ a2.setSelectionRange(r2.start, r2.end, "none");
1357
1518
  } catch {
1358
1519
  }
1359
1520
  }, selectionInsideModal = () => {
@@ -1370,13 +1531,13 @@ function activateModalIsolation(e2) {
1370
1531
  const watchdog = () => {
1371
1532
  const t3 = document.activeElement, n3 = t3 === document.body || null == t3 || !e2.contains(t3), i3 = selectionInsideModal();
1372
1533
  n3 && !i3 ? (l2 += 1, l2 >= 2 && (refocus(), l2 = 0)) : (l2 = 0, (() => {
1373
- if (r2 && document.activeElement === r2) try {
1374
- s2 = { start: r2.selectionStart ?? r2.value.length, end: r2.selectionEnd ?? r2.value.length };
1534
+ if (a2 && document.activeElement === a2) try {
1535
+ r2 = { start: a2.selectionStart ?? a2.value.length, end: a2.selectionEnd ?? a2.value.length };
1375
1536
  } catch {
1376
1537
  }
1377
- })()), a2 = window.requestAnimationFrame(watchdog);
1538
+ })()), s2 = window.requestAnimationFrame(watchdog);
1378
1539
  };
1379
- a2 = window.requestAnimationFrame(watchdog);
1540
+ s2 = window.requestAnimationFrame(watchdog);
1380
1541
  const onBlurLike = () => {
1381
1542
  setTimeout(() => {
1382
1543
  const t3 = document.activeElement;
@@ -1388,13 +1549,13 @@ function activateModalIsolation(e2) {
1388
1549
  n2.remove(), i2.remove();
1389
1550
  } catch {
1390
1551
  }
1391
- o2.forEach((e3) => document.removeEventListener(e3, quarantine, true)), window.removeEventListener("blur", onBlurLike, true), document.removeEventListener("focusout", onBlurLike, true), a2 && cancelAnimationFrame(a2);
1552
+ o2.forEach((e3) => document.removeEventListener(e3, quarantine, true)), window.removeEventListener("blur", onBlurLike, true), document.removeEventListener("focusout", onBlurLike, true), s2 && cancelAnimationFrame(s2);
1392
1553
  };
1393
1554
  }
1394
1555
  function injectModalHTML(e2 = "lookback") {
1395
- we && (we.remove(), we = null), we = document.createElement("div"), we.id = "sf-report-issue-modal";
1556
+ Te && (Te.remove(), Te = null), Te = document.createElement("div"), Te.id = "sf-report-issue-modal";
1396
1557
  const t2 = "startnow" === e2;
1397
- we.innerHTML = `
1558
+ Te.innerHTML = `
1398
1559
  <div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
1399
1560
  <div style="position:fixed; top:50%; left:50%; transform:translate(-50%, -50%);
1400
1561
  background:#fff; border-radius:12px;
@@ -1449,7 +1610,7 @@ function injectModalHTML(e2 = "lookback") {
1449
1610
  <textarea id="sf-issue-description" placeholder="Add description here"
1450
1611
  style="width:100%; height:80px; padding:8px 12px; font-size:14px;
1451
1612
  border:1px solid #cbd5e1; border-radius:6px; margin-bottom:20px;
1452
- resize:none; outline:none;">${pe.description}</textarea>
1613
+ resize:none; outline:none;">${fe.description}</textarea>
1453
1614
 
1454
1615
  <!-- When did this happen Section -->
1455
1616
  <div id="sf-lookback-container" style="display:${t2 ? "none" : "block"}; margin-bottom:20px;">
@@ -1515,34 +1676,34 @@ function injectModalHTML(e2 = "lookback") {
1515
1676
  <!-- Checkboxes on same line -->
1516
1677
  <div style="display:flex; align-items:center; gap:24px; margin-bottom:16px;">
1517
1678
  <label style="display:flex; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
1518
- <input type="checkbox" id="sf-create-issue-checkbox" ${pe.createIssue ? "checked" : ""}
1679
+ <input type="checkbox" id="sf-create-issue-checkbox" ${fe.createIssue ? "checked" : ""}
1519
1680
  style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
1520
1681
  Create an Issue
1521
1682
  </label>
1522
1683
 
1523
- <label id="sf-create-eng-ticket-label" style="display:${be.integrationData && ve ? "flex" : "none"}; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
1524
- <input type="checkbox" id="sf-create-eng-ticket-checkbox" ${pe.createEngTicket ? "checked" : ""}
1684
+ <label id="sf-create-eng-ticket-label" style="display:${Ie.integrationData && Ee ? "flex" : "none"}; align-items:center; gap:8px; font-size:14px; font-weight:500; cursor:pointer;">
1685
+ <input type="checkbox" id="sf-create-eng-ticket-checkbox" ${fe.createEngTicket ? "checked" : ""}
1525
1686
  style="width:16px; height:16px; accent-color:#295DBF; cursor:pointer;">
1526
1687
  Create an Eng Ticket
1527
1688
  </label>
1528
1689
  </div>
1529
1690
 
1530
1691
  <!-- Issue Title Field (always shown when create issue is checked) -->
1531
- <div id="sf-issue-fields-container" style="display:${pe.createIssue ? "block" : "none"};">
1692
+ <div id="sf-issue-fields-container" style="display:${fe.createIssue ? "block" : "none"};">
1532
1693
  <div style="display:flex; flex-direction:column; gap:12px;">
1533
1694
  <div>
1534
1695
  <label for="sf-issue-name" style="display:block; font-size:14px; font-weight:500; margin-bottom:6px;">
1535
1696
  Title <span style="color:#ef4444;">*</span>
1536
1697
  </label>
1537
1698
  <input type="text" id="sf-issue-name" placeholder="Enter title"
1538
- value="${pe.issueName}"
1699
+ value="${fe.issueName}"
1539
1700
  style="width:100%; padding:8px 12px; font-size:14px; border:1px solid #cbd5e1; border-radius:6px; outline:none;">
1540
1701
  </div>
1541
1702
  </div>
1542
1703
  </div>
1543
1704
 
1544
1705
  <!-- Engineering Ticket Fields (shown when create eng ticket is checked) -->
1545
- <div id="sf-eng-ticket-fields-container" style="display:${pe.createEngTicket && be.integrationData ? "block" : "none"}; margin-top: ${pe.createIssue ? "12px" : "0"};">
1706
+ <div id="sf-eng-ticket-fields-container" style="display:${fe.createEngTicket && Ie.integrationData ? "block" : "none"}; margin-top: ${fe.createIssue ? "12px" : "0"};">
1546
1707
  ${generateEngTicketFieldsHTML()}
1547
1708
  </div>
1548
1709
  </div>
@@ -1585,8 +1746,8 @@ function injectModalHTML(e2 = "lookback") {
1585
1746
  </div>
1586
1747
  </div>
1587
1748
  </div>
1588
- `, pe.mode = e2, document.body.appendChild(we), (function bindListeners() {
1589
- const e3 = we == null ? void 0 : we.querySelectorAll(".sf-issue-tab"), t3 = document.getElementById("sf-start-recording-btn"), n2 = document.getElementById("sf-modal-close-btn"), i2 = document.getElementById("sf-issue-submit-btn"), o2 = document.getElementById("sf-lookback-minutes");
1749
+ `, fe.mode = e2, document.body.appendChild(Te), (function bindListeners() {
1750
+ const e3 = Te == null ? void 0 : Te.querySelectorAll(".sf-issue-tab"), t3 = document.getElementById("sf-start-recording-btn"), n2 = document.getElementById("sf-modal-close-btn"), i2 = document.getElementById("sf-issue-submit-btn"), o2 = document.getElementById("sf-lookback-minutes");
1590
1751
  e3 == null ? void 0 : e3.forEach((e4) => {
1591
1752
  e4.addEventListener("click", (e5) => {
1592
1753
  const t4 = e5.currentTarget.dataset.mode;
@@ -1594,10 +1755,10 @@ function injectModalHTML(e2 = "lookback") {
1594
1755
  });
1595
1756
  }), n2 && (n2.onclick = closeModal);
1596
1757
  o2 && o2.addEventListener("change", () => {
1597
- "lookback" === pe.mode && (i2.disabled = false, i2.style.opacity = "1", i2.style.cursor = "pointer");
1758
+ "lookback" === fe.mode && (i2.disabled = false, i2.style.opacity = "1", i2.style.cursor = "pointer");
1598
1759
  });
1599
- const a2 = we == null ? void 0 : we.querySelectorAll(".sf-collapsible-header");
1600
- a2 == null ? void 0 : a2.forEach((e4) => {
1760
+ const s2 = Te == null ? void 0 : Te.querySelectorAll(".sf-collapsible-header");
1761
+ s2 == null ? void 0 : s2.forEach((e4) => {
1601
1762
  e4.addEventListener("click", (e5) => {
1602
1763
  const t4 = e5.currentTarget, n3 = t4.dataset.target, i3 = document.getElementById(n3), o3 = t4.querySelector(".sf-chevron");
1603
1764
  if (i3 && o3) {
@@ -1608,22 +1769,22 @@ function injectModalHTML(e2 = "lookback") {
1608
1769
  }
1609
1770
  });
1610
1771
  });
1611
- const s2 = document.getElementById("sf-create-issue-checkbox"), r2 = document.getElementById("sf-issue-fields-container"), l2 = document.getElementById("sf-create-eng-ticket-checkbox"), c2 = document.getElementById("sf-eng-ticket-fields-container");
1612
- s2 && s2.addEventListener("change", () => {
1613
- const e4 = s2.checked;
1614
- pe.createIssue = e4, localStorage.setItem(de, String(e4)), r2 && (r2.style.display = e4 ? "block" : "none"), !e4 && l2 && (l2.checked = false, pe.createEngTicket = false, localStorage.setItem(ue, "false"), c2 && (c2.style.display = "none"));
1772
+ const r2 = document.getElementById("sf-create-issue-checkbox"), a2 = document.getElementById("sf-issue-fields-container"), l2 = document.getElementById("sf-create-eng-ticket-checkbox"), c2 = document.getElementById("sf-eng-ticket-fields-container");
1773
+ r2 && r2.addEventListener("change", () => {
1774
+ const e4 = r2.checked;
1775
+ fe.createIssue = e4, localStorage.setItem(ue, String(e4)), a2 && (a2.style.display = e4 ? "block" : "none"), !e4 && l2 && (l2.checked = false, fe.createEngTicket = false, localStorage.setItem(pe, "false"), c2 && (c2.style.display = "none"));
1615
1776
  });
1616
1777
  l2 && l2.addEventListener("change", async () => {
1617
1778
  var _a;
1618
1779
  const e4 = l2.checked;
1619
- if (pe.createEngTicket = e4, localStorage.setItem(ue, String(e4)), e4 && !pe.createIssue && (pe.createIssue = true, localStorage.setItem(de, "true"), s2 && (s2.checked = true), r2 && (r2.style.display = "block")), c2 && (c2.style.display = e4 ? "block" : "none"), e4) {
1620
- if (!hasValidIntegration()) return l2.checked = false, pe.createEngTicket = false, localStorage.setItem(ue, "false"), c2 && (c2.style.display = "none"), void alert("No engineering ticket integration found. Please install and configure an integration (Jira, Linear, or Zendesk) first.");
1780
+ if (fe.createEngTicket = e4, localStorage.setItem(pe, String(e4)), e4 && !fe.createIssue && (fe.createIssue = true, localStorage.setItem(ue, "true"), r2 && (r2.checked = true), a2 && (a2.style.display = "block")), c2 && (c2.style.display = e4 ? "block" : "none"), e4) {
1781
+ if (!hasValidIntegration()) return l2.checked = false, fe.createEngTicket = false, localStorage.setItem(pe, "false"), c2 && (c2.style.display = "none"), void alert("No engineering ticket integration found. Please install and configure an integration (Jira, Linear, or Zendesk) first.");
1621
1782
  const e5 = getIntegrationData();
1622
1783
  if (e5) {
1623
- if (!pe.engTicketTeam && e5.defaultTeam && (pe.engTicketTeam = e5.defaultTeam), !pe.engTicketProject && e5.defaultProject && (pe.engTicketProject = e5.defaultProject), !pe.engTicketPriority && e5.defaultPriority && (pe.engTicketPriority = e5.defaultPriority), updateFormWithIntegrationData(pe), "jira" === ((_a = e5.provider) == null ? void 0 : _a.toLowerCase()) && pe.engTicketProject && !pe.engTicketCustomFields.reporter) {
1624
- if (getFieldsForProject(pe.engTicketProject, pe.engTicketIssueType).find((e6) => "reporter" === e6.fieldId)) {
1784
+ if (!fe.engTicketTeam && e5.defaultTeam && (fe.engTicketTeam = e5.defaultTeam), !fe.engTicketProject && e5.defaultProject && (fe.engTicketProject = e5.defaultProject), !fe.engTicketPriority && e5.defaultPriority && (fe.engTicketPriority = e5.defaultPriority), updateFormWithIntegrationData(fe), "jira" === ((_a = e5.provider) == null ? void 0 : _a.toLowerCase()) && fe.engTicketProject && !fe.engTicketCustomFields.reporter) {
1785
+ if (getFieldsForProject(fe.engTicketProject, fe.engTicketIssueType).find((e6) => "reporter" === e6.fieldId)) {
1625
1786
  const t5 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
1626
- pe.engTicketCustomFields.reporter = t5 || e5.jiraReporterAccountId || "";
1787
+ fe.engTicketCustomFields.reporter = t5 || e5.jiraReporterAccountId || "";
1627
1788
  }
1628
1789
  }
1629
1790
  const t4 = document.getElementById("sf-eng-ticket-project"), n3 = document.getElementById("sf-eng-ticket-type");
@@ -1633,11 +1794,11 @@ function injectModalHTML(e2 = "lookback") {
1633
1794
  });
1634
1795
  const d2 = document.getElementById("sf-issue-name");
1635
1796
  d2 && d2.addEventListener("input", () => {
1636
- pe.issueName = d2.value;
1797
+ fe.issueName = d2.value;
1637
1798
  });
1638
1799
  bindEngTicketListeners(), t3 && (t3.onclick = () => {
1639
1800
  const e4 = document.getElementById("sf-issue-description");
1640
- e4 && (pe.description = e4.value), (function startCountdownThenRecord() {
1801
+ e4 && (fe.description = e4.value), (function startCountdownThenRecord() {
1641
1802
  if (document.getElementById("sf-countdown-overlay")) return;
1642
1803
  const e5 = document.createElement("div");
1643
1804
  e5.id = "sf-countdown-overlay", e5.style.cssText = "\n position: fixed;\n inset: 0;\n background: rgba(0,0,0,0.6);\n z-index: 10001;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 80px;\n font-weight: bold;\n color: white;\n font-family: sans-serif;\n ";
@@ -1647,10 +1808,10 @@ function injectModalHTML(e2 = "lookback") {
1647
1808
  if (t4--, t4 > 0) e5.textContent = t4.toString();
1648
1809
  else {
1649
1810
  clearInterval(n3), document.body.removeChild(e5), (function setRecordingStartTime(e6) {
1650
- fe = e6;
1811
+ ge = e6;
1651
1812
  })(Date.now()), setIsRecording(true);
1652
1813
  try {
1653
- const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() => O);
1814
+ const { enableFunctionSpanTracking: e6 } = await Promise.resolve().then(() => z);
1654
1815
  e6();
1655
1816
  } catch (e6) {
1656
1817
  console.error("[Report Issue] Failed to enable function span tracking:", e6);
@@ -1677,7 +1838,7 @@ function injectModalHTML(e2 = "lookback") {
1677
1838
  const t5 = e6.querySelector("#sf-recording-timer");
1678
1839
  if (!t5) return;
1679
1840
  const n4 = setInterval(() => {
1680
- const e7 = Date.now() - (fe ?? Date.now()), n5 = Math.floor(e7 / 6e4).toString().padStart(2, "0"), i3 = Math.floor(e7 % 6e4 / 1e3).toString().padStart(2, "0");
1841
+ const e7 = Date.now() - (ge ?? Date.now()), n5 = Math.floor(e7 / 6e4).toString().padStart(2, "0"), i3 = Math.floor(e7 % 6e4 / 1e3).toString().padStart(2, "0");
1681
1842
  t5.textContent = `${n5}:${i3}`;
1682
1843
  }, 1e3);
1683
1844
  setTimerInterval(n4);
@@ -1686,33 +1847,33 @@ function injectModalHTML(e2 = "lookback") {
1686
1847
  }, 1e3);
1687
1848
  })();
1688
1849
  });
1689
- we == null ? void 0 : we.addEventListener("click", (e4) => {
1850
+ Te == null ? void 0 : Te.addEventListener("click", (e4) => {
1690
1851
  var _a;
1691
1852
  if (e4.target.closest("#sf-issue-submit-btn")) {
1692
- const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 = pe.mode;
1693
- if (pe.description = e5, pe.createIssue && !pe.issueName.trim()) return void alert("Issue title is required when creating an issue.");
1853
+ const e5 = ((_a = document.getElementById("sf-issue-description")) == null ? void 0 : _a.value) || "", t4 = fe.mode;
1854
+ if (fe.description = e5, fe.createIssue && !fe.issueName.trim()) return void alert("Issue title is required when creating an issue.");
1694
1855
  let n3, i3;
1695
- if ("startnow" === t4) n3 = fe ?? Date.now() - 3e5, i3 = ge ?? Date.now();
1856
+ if ("startnow" === t4) n3 = ge ?? Date.now() - 3e5, i3 = me ?? Date.now();
1696
1857
  else {
1697
1858
  const e6 = 60 * Number((o2 == null ? void 0 : o2.value) || "2") * 1e3;
1698
1859
  i3 = Date.now(), n3 = i3 - e6;
1699
1860
  }
1700
- if (pe.createIssue) {
1701
- const o3 = document.getElementById("sf-issue-name"), a3 = document.getElementById("sf-eng-ticket-team"), s3 = document.getElementById("sf-eng-ticket-project"), r3 = document.getElementById("sf-eng-ticket-priority"), l3 = document.getElementById("sf-eng-ticket-type"), c3 = (o3 == null ? void 0 : o3.value) || "", d3 = e5, u2 = (a3 == null ? void 0 : a3.value) || "", p2 = (s3 == null ? void 0 : s3.value) || "", f2 = r3 ? Number(r3.value) : 0, g2 = pe.engTicketLabels, m2 = (l3 == null ? void 0 : l3.value) || "", h2 = { ...pe.engTicketCustomFields };
1861
+ if (fe.createIssue) {
1862
+ const o3 = document.getElementById("sf-issue-name"), s3 = document.getElementById("sf-eng-ticket-team"), r3 = document.getElementById("sf-eng-ticket-project"), a3 = document.getElementById("sf-eng-ticket-priority"), l3 = document.getElementById("sf-eng-ticket-type"), c3 = (o3 == null ? void 0 : o3.value) || "", d3 = e5, u2 = (s3 == null ? void 0 : s3.value) || "", p2 = (r3 == null ? void 0 : r3.value) || "", f2 = a3 ? Number(a3.value) : 0, g2 = fe.engTicketLabels, m2 = (l3 == null ? void 0 : l3.value) || "", h2 = { ...fe.engTicketCustomFields };
1702
1863
  document.querySelectorAll(".sf-dynamic-field").forEach((e6) => {
1703
1864
  const t5 = e6, n4 = t5.dataset.fieldId;
1704
1865
  n4 && ("checkbox" === t5.type ? h2[n4] = t5.checked : "number" === t5.type ? h2[n4] = parseFloat(t5.value) || null : t5.classList.contains("sf-custom-multiselect") || (h2[n4] = t5.value));
1705
1866
  });
1706
- const y2 = document.getElementById("sf-eng-ticket-sprint"), b2 = (y2 == null ? void 0 : y2.value) || pe.engTicketSprint;
1707
- if (b2) {
1867
+ const y2 = document.getElementById("sf-eng-ticket-sprint"), S2 = (y2 == null ? void 0 : y2.value) || fe.engTicketSprint;
1868
+ if (S2) {
1708
1869
  const e6 = getSprintFieldId();
1709
- h2[e6] = parseInt(b2, 10);
1870
+ h2[e6] = parseInt(S2, 10);
1710
1871
  }
1711
- closeModal(), (async function createTriageAndIssue(e6, t5, n4, i4, o4, a4, s4, r4, l4, c4, d4, u3, p3) {
1872
+ closeModal(), (async function createTriageAndIssue(e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3) {
1712
1873
  var _a2, _b, _c;
1713
1874
  try {
1714
1875
  showStatusModal(true);
1715
- const f3 = await createTriageAndIssueFromRecorder(be.apiKey, be.backendApi, getSessionIdSafely(), e6, t5, n4, i4, o4, a4, s4, r4, l4, c4, d4, u3, p3);
1876
+ const f3 = await createTriageAndIssueFromRecorder(Ie.apiKey, Ie.backendApi, getSessionIdSafely(), e6, t5, n4, i4, o4, s4, r4, a4, l4, c4, d4, u3, p3);
1716
1877
  if ((_a2 = f3 == null ? void 0 : f3.errors) == null ? void 0 : _a2.length) {
1717
1878
  const e7 = f3.errors.map((e8) => e8.message).join("; ");
1718
1879
  return console.error("GraphQL error creating triage and issue:", e7), void showStatusModal(false, null, e7);
@@ -1722,33 +1883,33 @@ function injectModalHTML(e2 = "lookback") {
1722
1883
  } catch (e7) {
1723
1884
  console.error("Error creating triage and issue:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
1724
1885
  }
1725
- })(`${n3}`, `${i3}`, e5, c3, d3, pe.createEngTicket, u2, p2, f2, g2, m2, h2, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
1886
+ })(`${n3}`, `${i3}`, e5, c3, d3, fe.createEngTicket, u2, p2, f2, g2, m2, h2, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
1726
1887
  } else closeModal(), (async function createTriage(e6, t5, n4, i4) {
1727
1888
  var _a2, _b, _c;
1728
1889
  try {
1729
1890
  showStatusModal(true);
1730
- const o3 = await createTriageFromRecorder(be.apiKey, be.backendApi, getSessionIdSafely(), e6, t5, n4, i4);
1891
+ const o3 = await createTriageFromRecorder(Ie.apiKey, Ie.backendApi, getSessionIdSafely(), e6, t5, n4, i4);
1731
1892
  if ((_a2 = o3 == null ? void 0 : o3.errors) == null ? void 0 : _a2.length) {
1732
1893
  const e7 = o3.errors.map((e8) => e8.message).join("; ");
1733
1894
  return console.error("GraphQL error creating triage:", e7), void showStatusModal(false, null, e7);
1734
1895
  }
1735
- const a3 = (_c = (_b = o3 == null ? void 0 : o3.data) == null ? void 0 : _b.createTriageFromRecorder) == null ? void 0 : _c.id;
1736
- a3 ? showStatusModal(false, { type: "triage", id: a3 }) : (console.error("No Triage ID returned from backend."), showStatusModal(false, null, "No triage was created. Please try again."));
1896
+ const s3 = (_c = (_b = o3 == null ? void 0 : o3.data) == null ? void 0 : _b.createTriageFromRecorder) == null ? void 0 : _c.id;
1897
+ s3 ? showStatusModal(false, { type: "triage", id: s3 }) : (console.error("No Triage ID returned from backend."), showStatusModal(false, null, "No triage was created. Please try again."));
1737
1898
  } catch (e7) {
1738
1899
  console.error("Error creating triage:", e7), showStatusModal(false, null, "Something went wrong. Please try again.");
1739
1900
  }
1740
1901
  })(`${n3}`, `${i3}`, e5, "startnow" === t4 ? "RECORDED" : "LOOKBACK");
1741
1902
  }
1742
1903
  });
1743
- })(), be.deactivateIsolation = activateModalIsolation(we), be.integrationData && pe.createEngTicket ? initializeEngTicketForm() : be.integrationData || (pe.createEngTicket = false), be.apiKey && be.backendApi && refreshIntegrationData(be.apiKey, be.backendApi).then((e3) => {
1904
+ })(), Ie.deactivateIsolation = activateModalIsolation(Te), Ie.integrationData && fe.createEngTicket ? initializeEngTicketForm() : Ie.integrationData || (fe.createEngTicket = false), Ie.apiKey && Ie.backendApi && refreshIntegrationData(Ie.apiKey, Ie.backendApi).then((e3) => {
1744
1905
  if (!e3 || !document.getElementById("sf-report-issue-modal")) return;
1745
- be.integrationData = e3;
1906
+ Ie.integrationData = e3;
1746
1907
  const t3 = document.getElementById("sf-eng-ticket-fields-container");
1747
1908
  if (t3) {
1748
1909
  const e4 = generateEngTicketFieldsHTML();
1749
- e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(pe), renderDynamicFields(pe.engTicketProject, pe.engTicketIssueType));
1910
+ e4 && (t3.innerHTML = e4, initializeEngTicketForm(), bindEngTicketListeners(), updateFormWithIntegrationData(fe), renderDynamicFields(fe.engTicketProject, fe.engTicketIssueType));
1750
1911
  }
1751
- if (ve) {
1912
+ if (Ee) {
1752
1913
  const e4 = document.getElementById("sf-create-eng-ticket-label");
1753
1914
  e4 && (e4.style.display = "flex");
1754
1915
  }
@@ -1756,40 +1917,40 @@ function injectModalHTML(e2 = "lookback") {
1756
1917
  }
1757
1918
  function initializeEngTicketForm() {
1758
1919
  var _a;
1759
- const e2 = be.integrationData;
1920
+ const e2 = Ie.integrationData;
1760
1921
  if (e2) {
1761
- if (!pe.engTicketTeam && e2.defaultTeam && (pe.engTicketTeam = e2.defaultTeam), !pe.engTicketProject && e2.defaultProject && (pe.engTicketProject = e2.defaultProject), !pe.engTicketPriority && e2.defaultPriority && (pe.engTicketPriority = e2.defaultPriority), updateFormWithIntegrationData(pe), "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase()) && pe.engTicketProject && !pe.engTicketCustomFields.reporter) {
1762
- if (getFieldsForProject(pe.engTicketProject, pe.engTicketIssueType).find((e3) => "reporter" === e3.fieldId)) {
1922
+ if (!fe.engTicketTeam && e2.defaultTeam && (fe.engTicketTeam = e2.defaultTeam), !fe.engTicketProject && e2.defaultProject && (fe.engTicketProject = e2.defaultProject), !fe.engTicketPriority && e2.defaultPriority && (fe.engTicketPriority = e2.defaultPriority), updateFormWithIntegrationData(fe), "jira" === ((_a = e2.provider) == null ? void 0 : _a.toLowerCase()) && fe.engTicketProject && !fe.engTicketCustomFields.reporter) {
1923
+ if (getFieldsForProject(fe.engTicketProject, fe.engTicketIssueType).find((e3) => "reporter" === e3.fieldId)) {
1763
1924
  const t2 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
1764
- pe.engTicketCustomFields.reporter = t2 || e2.jiraReporterAccountId || "";
1925
+ fe.engTicketCustomFields.reporter = t2 || e2.jiraReporterAccountId || "";
1765
1926
  }
1766
1927
  }
1767
- pe.engTicketProject && renderDynamicFields(pe.engTicketProject, pe.engTicketIssueType);
1928
+ fe.engTicketProject && renderDynamicFields(fe.engTicketProject, fe.engTicketIssueType);
1768
1929
  }
1769
1930
  }
1770
1931
  function setActiveTab(e2) {
1771
- pe.mode = e2;
1772
- const t2 = we == null ? void 0 : we.querySelector("#sf-tab-lookback"), n2 = we == null ? void 0 : we.querySelector("#sf-tab-startnow");
1932
+ fe.mode = e2;
1933
+ const t2 = Te == null ? void 0 : Te.querySelector("#sf-tab-lookback"), n2 = Te == null ? void 0 : Te.querySelector("#sf-tab-startnow");
1773
1934
  "lookback" === e2 ? (t2.style.background = "white", t2.style.color = "#0F172A", n2.style.background = "transparent", n2.style.color = "#64748B") : (n2.style.background = "white", n2.style.color = "#0F172A", t2.style.background = "transparent", t2.style.color = "#64748B");
1774
1935
  }
1775
1936
  function updateModeSpecificUI(e2) {
1776
- const t2 = document.querySelector("#sf-issue-mode-info div"), n2 = document.getElementById("sf-issue-submit-btn"), i2 = document.getElementById("sf-record-button-container"), o2 = document.getElementById("sf-recording-timer-label"), a2 = document.getElementById("sf-recording-timer-display"), s2 = document.getElementById("sf-modal-footer"), r2 = document.getElementById("sf-lookback-container");
1777
- if (t2 && n2 && i2 && o2 && a2 && s2 && r2) if ("startnow" === e2) {
1778
- i2.style.display = "block", r2.style.display = "none", s2.style.justifyContent = "space-between", t2.textContent = "I want to reproduce the issue right now.";
1779
- const e3 = null !== fe && null !== ge;
1780
- if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed", fe && ge) {
1781
- const e4 = Math.floor((ge - fe) / 1e3), t3 = String(Math.floor(e4 / 60)).padStart(2, "0"), n3 = String(e4 % 60).padStart(2, "0");
1782
- o2.style.display = "block", a2.textContent = `${t3}:${n3}`;
1937
+ const t2 = document.querySelector("#sf-issue-mode-info div"), n2 = document.getElementById("sf-issue-submit-btn"), i2 = document.getElementById("sf-record-button-container"), o2 = document.getElementById("sf-recording-timer-label"), s2 = document.getElementById("sf-recording-timer-display"), r2 = document.getElementById("sf-modal-footer"), a2 = document.getElementById("sf-lookback-container");
1938
+ if (t2 && n2 && i2 && o2 && s2 && r2 && a2) if ("startnow" === e2) {
1939
+ i2.style.display = "block", a2.style.display = "none", r2.style.justifyContent = "space-between", t2.textContent = "I want to reproduce the issue right now.";
1940
+ const e3 = null !== ge && null !== me;
1941
+ if (n2.disabled = !e3, n2.style.opacity = e3 ? "1" : "0.4", n2.style.cursor = e3 ? "pointer" : "not-allowed", ge && me) {
1942
+ const e4 = Math.floor((me - ge) / 1e3), t3 = String(Math.floor(e4 / 60)).padStart(2, "0"), n3 = String(e4 % 60).padStart(2, "0");
1943
+ o2.style.display = "block", s2.textContent = `${t3}:${n3}`;
1783
1944
  } else o2.style.display = "none";
1784
- } else i2.style.display = "none", o2.style.display = "none", r2.style.display = "block", s2.style.justifyContent = "flex-end", t2.textContent = "Something already happened. Capture the past few minutes.", n2.disabled = false, n2.style.opacity = "1", n2.style.cursor = "pointer";
1945
+ } else i2.style.display = "none", o2.style.display = "none", a2.style.display = "block", r2.style.justifyContent = "flex-end", t2.textContent = "Something already happened. Capture the past few minutes.", n2.disabled = false, n2.style.opacity = "1", n2.style.cursor = "pointer";
1785
1946
  }
1786
1947
  function bindEngTicketListeners() {
1787
- const e2 = document.getElementById("sf-eng-ticket-team"), t2 = document.getElementById("sf-eng-ticket-project"), n2 = document.getElementById("sf-eng-ticket-priority"), i2 = document.getElementById("sf-eng-ticket-labels-container"), o2 = document.getElementById("sf-eng-ticket-type"), a2 = document.getElementById("sf-eng-ticket-sprint");
1948
+ const e2 = document.getElementById("sf-eng-ticket-team"), t2 = document.getElementById("sf-eng-ticket-project"), n2 = document.getElementById("sf-eng-ticket-priority"), i2 = document.getElementById("sf-eng-ticket-labels-container"), o2 = document.getElementById("sf-eng-ticket-type"), s2 = document.getElementById("sf-eng-ticket-sprint");
1788
1949
  e2 && e2.addEventListener("change", () => {
1789
- pe.engTicketTeam = e2.value, e2.style.color = e2.value ? "" : "#9ca3af";
1950
+ fe.engTicketTeam = e2.value, e2.style.color = e2.value ? "" : "#9ca3af";
1790
1951
  const t3 = document.getElementById("sf-eng-ticket-project");
1791
1952
  if (t3) {
1792
- pe.engTicketProject = "", pe.engTicketCustomFields = {};
1953
+ fe.engTicketProject = "", fe.engTicketCustomFields = {};
1793
1954
  const n3 = getProjectsForTeam(e2.value);
1794
1955
  t3.innerHTML = '<option value="">Select project...</option>', n3.forEach((e3) => {
1795
1956
  const n4 = document.createElement("option");
@@ -1798,41 +1959,41 @@ function bindEngTicketListeners() {
1798
1959
  }
1799
1960
  }), t2 && t2.addEventListener("change", () => {
1800
1961
  var _a;
1801
- pe.engTicketProject = t2.value, t2.style.color = t2.value ? "" : "#9ca3af", pe.engTicketCustomFields = {};
1962
+ fe.engTicketProject = t2.value, t2.style.color = t2.value ? "" : "#9ca3af", fe.engTicketCustomFields = {};
1802
1963
  const e3 = getIntegrationData();
1803
- if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value), pe.engTicketIssueType = o2.value), e3 && "jira" === ((_a = e3.provider) == null ? void 0 : _a.toLowerCase()) && t2.value) {
1804
- if (getFieldsForProject(t2.value, pe.engTicketIssueType).find((e4) => "reporter" === e4.fieldId)) {
1964
+ if (e3 && o2 && (updateIssueTypeOptions(o2, t2.value), fe.engTicketIssueType = o2.value), e3 && "jira" === ((_a = e3.provider) == null ? void 0 : _a.toLowerCase()) && t2.value) {
1965
+ if (getFieldsForProject(t2.value, fe.engTicketIssueType).find((e4) => "reporter" === e4.fieldId)) {
1805
1966
  const t3 = getValidSavedReporterAccountId() || getDefaultReporterAccountId();
1806
- pe.engTicketCustomFields.reporter = t3 || e3.jiraReporterAccountId || "";
1967
+ fe.engTicketCustomFields.reporter = t3 || e3.jiraReporterAccountId || "";
1807
1968
  }
1808
1969
  }
1809
- renderDynamicFields(t2.value, pe.engTicketIssueType);
1810
- }), a2 && a2.addEventListener("change", () => {
1811
- pe.engTicketSprint = a2.value, a2.style.color = a2.value ? "" : "#9ca3af";
1970
+ renderDynamicFields(t2.value, fe.engTicketIssueType);
1971
+ }), s2 && s2.addEventListener("change", () => {
1972
+ fe.engTicketSprint = s2.value, s2.style.color = s2.value ? "" : "#9ca3af", setSprintDefaulted(true);
1812
1973
  }), n2 && n2.addEventListener("change", () => {
1813
- pe.engTicketPriority = Number(n2.value);
1974
+ fe.engTicketPriority = Number(n2.value);
1814
1975
  }), i2 && setupCustomMultiSelectListeners("sf-eng-ticket-labels", (e3) => {
1815
- pe.engTicketLabels = e3;
1976
+ fe.engTicketLabels = e3;
1816
1977
  }), o2 && o2.addEventListener("change", () => {
1817
- pe.engTicketIssueType = o2.value, o2.style.color = o2.value ? "" : "#9ca3af";
1978
+ fe.engTicketIssueType = o2.value, o2.style.color = o2.value ? "" : "#9ca3af";
1818
1979
  const e3 = document.getElementById("sf-eng-ticket-project");
1819
1980
  if (e3 && e3.value) {
1820
- const t3 = pe.engTicketCustomFields.reporter;
1821
- pe.engTicketCustomFields = {}, t3 && (pe.engTicketCustomFields.reporter = t3), renderDynamicFields(e3.value, o2.value);
1981
+ const t3 = fe.engTicketCustomFields.reporter;
1982
+ fe.engTicketCustomFields = {}, t3 && (fe.engTicketCustomFields.reporter = t3), renderDynamicFields(e3.value, o2.value);
1822
1983
  }
1823
1984
  });
1824
- const s2 = document.getElementById("sf-dynamic-fields-container");
1825
- s2 && (s2.addEventListener("input", (e3) => {
1985
+ const r2 = document.getElementById("sf-dynamic-fields-container");
1986
+ r2 && (r2.addEventListener("input", (e3) => {
1826
1987
  const t3 = e3.target;
1827
1988
  if (t3.classList.contains("sf-dynamic-field")) {
1828
1989
  const e4 = t3.dataset.fieldId;
1829
- e4 && ("checkbox" === t3.type ? pe.engTicketCustomFields[e4] = t3.checked : "number" === t3.type ? pe.engTicketCustomFields[e4] = parseFloat(t3.value) || null : pe.engTicketCustomFields[e4] = t3.value);
1990
+ e4 && ("checkbox" === t3.type ? fe.engTicketCustomFields[e4] = t3.checked : "number" === t3.type ? fe.engTicketCustomFields[e4] = parseFloat(t3.value) || null : fe.engTicketCustomFields[e4] = t3.value);
1830
1991
  }
1831
- }), s2.addEventListener("change", (e3) => {
1992
+ }), r2.addEventListener("change", (e3) => {
1832
1993
  const t3 = e3.target;
1833
1994
  if (t3.classList.contains("sf-dynamic-field")) {
1834
1995
  const e4 = t3.dataset.fieldId;
1835
- if (e4 && (pe.engTicketCustomFields[e4] = t3.value, "reporter" === e4 && t3.value && saveLastReporterAccountId(t3.value)), "SELECT" === t3.tagName) {
1996
+ if (e4 && (fe.engTicketCustomFields[e4] = t3.value, "reporter" === e4 && t3.value && saveLastReporterAccountId(t3.value)), "SELECT" === t3.tagName) {
1836
1997
  const e5 = t3;
1837
1998
  e5.style.color = e5.value ? "" : "#9ca3af";
1838
1999
  }
@@ -1842,10 +2003,10 @@ function bindEngTicketListeners() {
1842
2003
  async function stopRecording() {
1843
2004
  var _a;
1844
2005
  !(function setRecordingEndTime(e2) {
1845
- ge = e2;
1846
- })(Date.now()), setIsRecording(false), me && (clearInterval(me), setTimerInterval(null)), (_a = document.getElementById("sf-recording-indicator")) == null ? void 0 : _a.remove();
2006
+ me = e2;
2007
+ })(Date.now()), setIsRecording(false), he && (clearInterval(he), setTimerInterval(null)), (_a = document.getElementById("sf-recording-indicator")) == null ? void 0 : _a.remove();
1847
2008
  try {
1848
- const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() => O);
2009
+ const { disableFunctionSpanTracking: e2 } = await Promise.resolve().then(() => z);
1849
2010
  e2();
1850
2011
  } catch (e2) {
1851
2012
  console.error("[Report Issue] Failed to disable function span tracking:", e2);
@@ -1858,21 +2019,21 @@ async function stopRecording() {
1858
2019
  t3 && (t3.textContent = "Re-record");
1859
2020
  }
1860
2021
  const t2 = document.getElementById("sf-recording-timer-label"), n2 = document.getElementById("sf-recording-timer-display");
1861
- if (t2 && n2 && fe && ge) {
1862
- const e3 = Math.floor((ge - fe) / 1e3), i3 = Math.floor(e3 / 60).toString().padStart(2, "0"), o3 = (e3 % 60).toString().padStart(2, "0");
2022
+ if (t2 && n2 && ge && me) {
2023
+ const e3 = Math.floor((me - ge) / 1e3), i3 = Math.floor(e3 / 60).toString().padStart(2, "0"), o3 = (e3 % 60).toString().padStart(2, "0");
1863
2024
  n2.textContent = `${i3}:${o3}`, t2.style.display = "block";
1864
2025
  }
1865
2026
  const i2 = document.getElementById("sf-issue-description");
1866
- i2 && (i2.value = pe.description);
2027
+ i2 && (i2.value = fe.description);
1867
2028
  const o2 = document.querySelector('input[value="startnow"]');
1868
2029
  o2 && (o2.checked = true);
1869
- const a2 = document.getElementById("sf-inline-record-chip"), s2 = document.getElementById("sf-inline-record-timer");
1870
- if (a2 && s2) {
1871
- const e3 = Math.floor(((ge ?? 0) - (fe ?? 0)) / 1e3), t3 = Math.floor(e3 / 60).toString().padStart(2, "0"), n3 = Math.floor(e3 % 60).toString().padStart(2, "0");
1872
- s2.textContent = `${t3}:${n3}`, s2.style.color = "black", a2.style.display = "flex";
2030
+ const s2 = document.getElementById("sf-inline-record-chip"), r2 = document.getElementById("sf-inline-record-timer");
2031
+ if (s2 && r2) {
2032
+ const e3 = Math.floor(((me ?? 0) - (ge ?? 0)) / 1e3), t3 = Math.floor(e3 / 60).toString().padStart(2, "0"), n3 = Math.floor(e3 % 60).toString().padStart(2, "0");
2033
+ r2.textContent = `${t3}:${n3}`, r2.style.color = "black", s2.style.display = "flex";
1873
2034
  }
1874
- const r2 = document.getElementById("sf-issue-submit-btn");
1875
- r2.disabled = false, r2.style.opacity = "1", r2.style.cursor = "pointer";
2035
+ const a2 = document.getElementById("sf-issue-submit-btn");
2036
+ a2.disabled = false, a2.style.opacity = "1", a2.style.cursor = "pointer";
1876
2037
  })();
1877
2038
  }
1878
2039
  function showStatusModal(e2, t2, n2) {
@@ -1882,10 +2043,10 @@ function showStatusModal(e2, t2, n2) {
1882
2043
  var _a2, _b;
1883
2044
  (_a2 = document.getElementById("sf-report-issue-modal")) == null ? void 0 : _a2.remove(), (_b = document.getElementById("sf-triage-status-modal")) == null ? void 0 : _b.remove();
1884
2045
  })();
1885
- const o2 = !e3 && i2, a2 = n3 ? `${be.triageBaseUrl}/issues/${n3}?from=inAppReportIssue` : t3 ? `${be.triageBaseUrl}/triage/${t3}?from=inAppReportIssue` : "", s2 = document.createElement("div");
1886
- s2.id = "sf-triage-status-modal", Object.assign(s2.style, { position: "fixed", inset: "0", zIndex: "9998", display: "flex", alignItems: "center", justifyContent: "center" });
1887
- const r2 = e3 ? "Reporting Issue..." : o2 ? "Failed to report issue" : "Issue reported!", l2 = e3 ? '<p style="font-size:14px; color:#64748b; line-height:20px;">This may take ~10 seconds</p>' : o2 ? `<p style="font-size:14px; color:#ef4444; line-height:20px;">${i2}</p>` : "", c2 = e3 ? '<div style="display:flex; justify-content:center; align-items:center; padding: 40px 0;">\n <div style="width:24px; height:24px; border:2px solid #295dbf; border-top:2px solid white; border-radius:50%; animation:spin 1s linear infinite;"></div>\n </div>' : "", d2 = e3 ? "" : '<div id="sf-copied-status" style="display:none; font-size:12px; font-weight:500; color:white;\n background-color:#22c55e; padding:4px 8px; border-radius:6px; white-space:nowrap; align-items:center; gap:6px;">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M21 7.5L9 19.5L3 13.5L5.25 11.25L9 15L18.75 5.25L21 7.5Z" fill="white"/>\n </svg>\n Copied\n </div>';
1888
- s2.innerHTML = `
2046
+ const o2 = !e3 && i2, s2 = n3 ? `${Ie.triageBaseUrl}/issues/${n3}?from=inAppReportIssue` : t3 ? `${Ie.triageBaseUrl}/triage/${t3}?from=inAppReportIssue` : "", r2 = document.createElement("div");
2047
+ r2.id = "sf-triage-status-modal", Object.assign(r2.style, { position: "fixed", inset: "0", zIndex: "9998", display: "flex", alignItems: "center", justifyContent: "center" });
2048
+ const a2 = e3 ? "Reporting Issue..." : o2 ? "Failed to report issue" : "Issue reported!", l2 = e3 ? '<p style="font-size:14px; color:#64748b; line-height:20px;">This may take ~10 seconds</p>' : o2 ? `<p style="font-size:14px; color:#ef4444; line-height:20px;">${i2}</p>` : "", c2 = e3 ? '<div style="display:flex; justify-content:center; align-items:center; padding: 40px 0;">\n <div style="width:24px; height:24px; border:2px solid #295dbf; border-top:2px solid white; border-radius:50%; animation:spin 1s linear infinite;"></div>\n </div>' : "", d2 = e3 ? "" : '<div id="sf-copied-status" style="display:none; font-size:12px; font-weight:500; color:white;\n background-color:#22c55e; padding:4px 8px; border-radius:6px; white-space:nowrap; align-items:center; gap:6px;">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M21 7.5L9 19.5L3 13.5L5.25 11.25L9 15L18.75 5.25L21 7.5Z" fill="white"/>\n </svg>\n Copied\n </div>';
2049
+ r2.innerHTML = `
1889
2050
  <div style="position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998;"></div>
1890
2051
  <div id="sf-triage-card"
1891
2052
  style="position:relative; background:#fff; padding:24px; border-radius:12px; width:300px; max-width:90%;
@@ -1901,7 +2062,7 @@ function showStatusModal(e2, t2, n2) {
1901
2062
  </svg>
1902
2063
  </button>
1903
2064
 
1904
- <h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${r2}</h2>
2065
+ <h2 style="font-size:18px; font-weight:600; margin-bottom:${e3 || o2 ? 8 : 40}px; line-height:28px;">${a2}</h2>
1905
2066
  ${l2}
1906
2067
  ${c2}
1907
2068
 
@@ -1926,28 +2087,28 @@ function showStatusModal(e2, t2, n2) {
1926
2087
  <style>
1927
2088
  @keyframes spin { to { transform: rotate(360deg); } }
1928
2089
  </style>
1929
- `, document.body.appendChild(s2);
1930
- const u2 = s2.querySelector("#sf-triage-card");
2090
+ `, document.body.appendChild(r2);
2091
+ const u2 = r2.querySelector("#sf-triage-card");
1931
2092
  (_a = document.getElementById("sf-triage-modal-close")) == null ? void 0 : _a.addEventListener("click", () => {
1932
- fadeCardAndRemove(s2, u2, 300);
2093
+ fadeCardAndRemove(r2, u2, 300);
1933
2094
  });
1934
2095
  const p2 = document.getElementById("sf-copy-triage-link"), f2 = document.getElementById("sf-view-triage-btn");
1935
2096
  e3 ? (p2.disabled = true, p2.style.opacity = "0.4", p2.style.cursor = "not-allowed", f2.disabled = true, f2.style.opacity = "0.4", f2.style.cursor = "not-allowed") : (p2.disabled = false, p2.addEventListener("click", () => {
1936
- navigator.clipboard.writeText(a2).then(() => {
2097
+ navigator.clipboard.writeText(s2).then(() => {
1937
2098
  const e4 = document.getElementById("sf-copied-status");
1938
2099
  e4 && (e4.style.display = "flex");
1939
2100
  });
1940
2101
  }), f2.disabled = false, f2.addEventListener("click", () => {
1941
- (t3 || n3) && window.open(a2, "_blank");
1942
- }), o2 || setTimeout(() => fadeCardAndRemove(s2, u2, 300), 1e4));
2102
+ (t3 || n3) && window.open(s2, "_blank");
2103
+ }), o2 || setTimeout(() => fadeCardAndRemove(r2, u2, 300), 1e4));
1943
2104
  })(e2, "triage" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, "issue" === (t2 == null ? void 0 : t2.type) ? t2.id : void 0, n2);
1944
2105
  }
1945
2106
  function fadeCardAndRemove(e2, t2, n2 = 300) {
1946
2107
  t2.style.opacity = "0", t2.addEventListener("transitionend", () => e2.remove(), { once: true }), setTimeout(() => e2.remove(), n2 + 100);
1947
2108
  }
1948
- const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueContext: be, openReportIssueModal, setupIssueReporting: function setupIssueReporting(e2) {
1949
- be.apiKey = e2.apiKey, be.backendApi = e2.backendApi, be.resolveSessionId = e2.getSessionId, be.integrationData = e2.integrationData || null, be.showEngTicketFieldsDefault = e2.showEngTicketFieldsInReportIssueModalDefault ?? false, e2.customBaseUrl && (be.triageBaseUrl = e2.customBaseUrl), be.shortcuts = (function mergeShortcutsConfig(e3) {
1950
- const t3 = { ...ye };
2109
+ const Me = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueContext: Ie, openReportIssueModal, setupIssueReporting: function setupIssueReporting(e2) {
2110
+ Ie.apiKey = e2.apiKey, Ie.backendApi = e2.backendApi, Ie.resolveSessionId = e2.getSessionId, Ie.integrationData = e2.integrationData || null, Ie.showEngTicketFieldsDefault = e2.showEngTicketFieldsInReportIssueModalDefault ?? false, e2.customBaseUrl && (Ie.triageBaseUrl = e2.customBaseUrl), Ie.shortcuts = (function mergeShortcutsConfig(e3) {
2111
+ const t3 = { ...xe };
1951
2112
  if (!e3) return t3;
1952
2113
  "boolean" == typeof e3.enabled && (t3.enabled = e3.enabled);
1953
2114
  const n2 = ["openModalExistingMode", "openModalCaptureNewMode", "closeModal", "submitReport", "startRecording", "stopRecording"];
@@ -1957,54 +2118,55 @@ const Se = Object.freeze(Object.defineProperty({ __proto__: null, ReportIssueCon
1957
2118
  }
1958
2119
  return t3;
1959
2120
  })(e2.shortcuts);
1960
- const { shortcuts: t2 } = be;
2121
+ const { shortcuts: t2 } = Ie;
1961
2122
  window.addEventListener("keydown", (e3) => {
1962
2123
  const n2 = (function isTypingInInput() {
1963
2124
  const e4 = document.activeElement;
1964
2125
  return e4 instanceof HTMLInputElement || e4 instanceof HTMLTextAreaElement || e4 instanceof HTMLElement && e4.isContentEditable;
1965
- })(), i2 = e3.key.toLowerCase(), o2 = e3.metaKey || e3.ctrlKey, a2 = !!document.getElementById("sf-report-issue-modal"), s2 = !n2 && (t2.enabled || a2), shortcutUsed = (e4) => i2 === t2[e4].key && o2 === t2[e4].requireCmdCtrl, r2 = a2 ? (e4) => {
2126
+ })(), i2 = e3.key.toLowerCase(), o2 = e3.metaKey || e3.ctrlKey, s2 = !!document.getElementById("sf-report-issue-modal"), r2 = !n2 && (t2.enabled || s2), shortcutUsed = (e4) => i2 === t2[e4].key && o2 === t2[e4].requireCmdCtrl, a2 = s2 ? (e4) => {
1966
2127
  setActiveTab(e4), updateModeSpecificUI(e4);
1967
2128
  } : injectModalHTML;
1968
- if (s2 && shortcutUsed("openModalExistingMode")) return e3.preventDefault(), void r2("lookback");
1969
- if (s2 && shortcutUsed("openModalCaptureNewMode")) return e3.preventDefault(), void r2("startnow");
1970
- if (a2 && !he && shortcutUsed("closeModal")) return e3.preventDefault(), void closeModal();
1971
- if (a2 && shortcutUsed("submitReport")) {
2129
+ if (r2 && shortcutUsed("openModalExistingMode")) return e3.preventDefault(), void a2("lookback");
2130
+ if (r2 && shortcutUsed("openModalCaptureNewMode")) return e3.preventDefault(), void a2("startnow");
2131
+ if (s2 && !ye && shortcutUsed("closeModal")) return e3.preventDefault(), void closeModal();
2132
+ if (s2 && shortcutUsed("submitReport")) {
1972
2133
  const t3 = document.getElementById("sf-issue-submit-btn");
1973
2134
  return void (t3 && !t3.disabled && (e3.preventDefault(), t3.click()));
1974
2135
  }
1975
- if (he && i2 === t2.stopRecording.key && o2 === t2.stopRecording.requireCmdCtrl) return e3.preventDefault(), void stopRecording();
1976
- if (a2 && "startnow" === pe.mode && i2 === t2.startRecording.key && o2 === t2.startRecording.requireCmdCtrl && !n2) {
2136
+ if (ye && i2 === t2.stopRecording.key && o2 === t2.stopRecording.requireCmdCtrl) return e3.preventDefault(), void stopRecording();
2137
+ if (s2 && "startnow" === fe.mode && i2 === t2.startRecording.key && o2 === t2.startRecording.requireCmdCtrl && !n2) {
1977
2138
  const t3 = document.getElementById("sf-start-recording-btn");
1978
2139
  return void (t3 && (e3.preventDefault(), t3.click()));
1979
2140
  }
1980
2141
  });
1981
- } }, Symbol.toStringTag, { value: "Module" })), ke = readDebugFlag(), xe = /* @__PURE__ */ new Map();
2142
+ } }, Symbol.toStringTag, { value: "Module" })), Ce = readDebugFlag(), $e = /* @__PURE__ */ new Map();
1982
2143
  function getCachedRegex(e2, t2) {
1983
2144
  const n2 = `${e2}|${t2}`;
1984
- let i2 = xe.get(n2);
1985
- return i2 || (i2 = new RegExp(e2, t2), xe.set(n2, i2)), i2;
2145
+ let i2 = $e.get(n2);
2146
+ return i2 || (i2 = new RegExp(e2, t2), $e.set(n2, i2)), i2;
1986
2147
  }
1987
- const Ie = new Set([".js", ".mjs", ".cjs", ".ts", ".css", ".scss", ".sass", ".less", ".styl", ".stylus", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".avif", ".bmp", ".ico", ".tiff", ".tif", ".heic", ".woff", ".woff2", ".ttf", ".otf", ".eot", ".mp4", ".webm", ".ogv", ".mp3", ".wav", ".flac", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".csv", ".json", ".xml", ".txt", ".zip", ".rar", ".gz", ".tar", ".7z", ".map", ".webmanifest"].map((e2) => e2.toLowerCase())), Te = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], Ee = [400, 403], Ce = "CORS", $e = 1, Fe = "authorization", Le = "Authorization", Me = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {}, enableFiberTracking: false }, Ae = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
2148
+ const Fe = new Set([".js", ".mjs", ".cjs", ".ts", ".css", ".scss", ".sass", ".less", ".styl", ".stylus", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".avif", ".bmp", ".ico", ".tiff", ".tif", ".heic", ".woff", ".woff2", ".ttf", ".otf", ".eot", ".mp4", ".webm", ".ogv", ".mp3", ".wav", ".flac", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".csv", ".json", ".xml", ".txt", ".zip", ".rar", ".gz", ".tar", ".7z", ".map", ".webmanifest"].map((e2) => e2.toLowerCase())), Ae = ["t.co", "*.twitter.com", "*.gravatar.com", "*.googleapis.com", "*.amazonaws.com", "*.smooch.io", "*.zendesk.com", "*.zdassets.com"], Le = [400, 403], Re = "CORS", De = 1, _e = "authorization", Pe = "Authorization", Be = { recordCanvas: false, recordCrossOriginIframes: false, collectFonts: false, inlineImages: false, recordPassword: false, recordRealName: true, recordCreditCardInfo: false, recordSsn: false, recordDob: false, sampling: {}, enableFiberTracking: false, maskInputSelector: "", maskTextSelector: "", blockSelector: "", unmaskSelector: "", maskInputOptions: { password: true } }, Oe = { level: ["info", "log", "warn", "error"], lengthThreshold: 1e4, stringifyOptions: { stringLengthLimit: 1e3, numOfKeysLimit: 20, depthOfLimit: 4 }, logger: "console" };
1988
2149
  function maskAuthorizationHeader(e2) {
1989
- const t2 = e2[Fe] ? Fe : e2[Le] ? Le : null;
2150
+ const t2 = e2[_e] ? _e : e2[Pe] ? Pe : null;
1990
2151
  if (!t2) return;
1991
2152
  const n2 = e2[t2], i2 = n2.indexOf(" ");
1992
2153
  if (-1 !== i2) {
1993
- const o2 = n2.slice(0, i2 + 1), a2 = n2.slice(i2 + 1);
1994
- a2.length > 8 ? e2[t2] = o2 + a2.slice(0, 4) + "*".repeat(a2.length - 8) + a2.slice(-4) : e2[t2] = o2 + "*".repeat(a2.length);
2154
+ const o2 = n2.slice(0, i2 + 1), s2 = n2.slice(i2 + 1);
2155
+ s2.length > 8 ? e2[t2] = o2 + s2.slice(0, 4) + "*".repeat(s2.length - 8) + s2.slice(-4) : e2[t2] = o2 + "*".repeat(s2.length);
1995
2156
  } else n2.length > 8 ? e2[t2] = n2.slice(0, 4) + "*".repeat(n2.length - 8) + n2.slice(-4) : e2[t2] = "*".repeat(n2.length);
1996
2157
  }
1997
2158
  function trackDomainChangesOnce() {
1998
2159
  const e2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
1999
2160
  if (e2.routeWatcherIntervalId) return;
2000
2161
  let t2 = window.location.href.split("?")[0];
2001
- const checkDomainChange = (e3 = false) => {
2002
- const n3 = window.location.href.split("?")[0];
2003
- if (e3 || n3 !== t2) {
2004
- t2 = n3;
2005
- const e4 = uuidv4(), i2 = sessionStorage.getItem("pageVisitUUID") ?? "";
2006
- sessionStorage.setItem("pageVisitUUID", e4), sessionStorage.setItem("prevPageVisitUUID", i2), invalidateUrlCache();
2007
- sendMessage({ type: "routeChange", data: { url: n3, timestamp: Date.now(), page_visit_uuid: e4, prev_page_visit_uuid: i2 } });
2162
+ const checkDomainChange = (n3 = false) => {
2163
+ const i2 = window.location.href.split("?")[0];
2164
+ if (n3 || i2 !== t2) {
2165
+ t2 = i2;
2166
+ const o2 = uuidv4(), s2 = sessionStorage.getItem("pageVisitUUID") ?? "";
2167
+ sessionStorage.setItem("pageVisitUUID", o2), sessionStorage.setItem("prevPageVisitUUID", s2), invalidateUrlCache();
2168
+ const r2 = Date.now();
2169
+ e2.internalDebugLogs && console.log("[sf-recorder] mint pageVisitUUID", { url: i2, newUuid: o2, prevUuid: s2, forceSend: n3, timestamp: r2, stack: new Error().stack }), sendMessage({ type: "routeChange", data: { url: i2, timestamp: r2, page_visit_uuid: o2, prev_page_visit_uuid: s2 } });
2008
2170
  }
2009
2171
  }, n2 = /* @__PURE__ */ (function debounce(e3, t3) {
2010
2172
  let n3;
@@ -2017,14 +2179,14 @@ function trackDomainChangesOnce() {
2017
2179
  function sendUserDeviceUuid() {
2018
2180
  sendMessage({ type: "userDeviceUuid", userDeviceUuid: (function getOrSetUserDeviceUuid() {
2019
2181
  let e2 = null;
2020
- if (f) try {
2182
+ if (m) try {
2021
2183
  e2 = localStorage.getItem("sailfishUserDeviceUuid");
2022
2184
  } catch {
2023
2185
  }
2024
2186
  if (!e2) {
2025
2187
  e2 = uuidv4();
2026
2188
  try {
2027
- f && localStorage.setItem("sailfishUserDeviceUuid", e2);
2189
+ m && localStorage.setItem("sailfishUserDeviceUuid", e2);
2028
2190
  } catch {
2029
2191
  }
2030
2192
  }
@@ -2033,52 +2195,63 @@ function sendUserDeviceUuid() {
2033
2195
  }
2034
2196
  function handleVisibilityChange() {
2035
2197
  const e2 = document.visibilityState, t2 = Date.now();
2036
- "visible" === e2 && getOrSetSessionId();
2198
+ "visible" === e2 && (getOrSetSessionId(), requestTimeSync());
2037
2199
  try {
2038
- sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }), ke && console.log(`[Sailfish] Tab became ${e2}, sent visibility change event`);
2200
+ sendMessage({ type: "visibilityChange", data: { state: e2, url: window.location.href.split("?")[0], timestamp: t2, ...getUrlAndStoredUuids() } }), Ce && console.log(`[Sailfish] Tab became ${e2}, sent visibility change event`);
2039
2201
  } catch (e3) {
2040
2202
  console.warn("[Sailfish] Failed to send visibility change event:", e3);
2041
2203
  }
2042
2204
  sessionStorage.setItem("tabVisibilityChanged", t2.toString()), sessionStorage.setItem("tabVisibilityState", e2), invalidateUrlCache();
2043
2205
  }
2044
2206
  function clearPageVisitDataFromSessionStorage() {
2045
- g && (sessionStorage.removeItem("pageVisitUUID"), sessionStorage.removeItem("prevPageVisitUUID"), sessionStorage.removeItem("tabVisibilityChanged"), sessionStorage.removeItem("tabVisibilityState"), invalidateUrlCache());
2207
+ h && (sessionStorage.removeItem("pageVisitUUID"), sessionStorage.removeItem("prevPageVisitUUID"), sessionStorage.removeItem("tabVisibilityChanged"), sessionStorage.removeItem("tabVisibilityState"), invalidateUrlCache());
2046
2208
  }
2047
- let Re = false;
2209
+ let je = false;
2048
2210
  function _ensureModuleSideEffects() {
2049
- Re || (Re = true, restoreFuncSpanState(), (function ensureSessionListeners() {
2050
- b || (b = true, u && window.addEventListener("beforeunload", () => {
2051
- window.name = h + window.name;
2211
+ je || (je = true, restoreFuncSpanState(), (function ensureSessionListeners() {
2212
+ v || (v = true, f && window.addEventListener("beforeunload", () => {
2213
+ window.name = S + window.name;
2052
2214
  }));
2053
- })(), u && (sendUserDeviceUuid(), (function sendTimeZone() {
2215
+ })(), f && (sendUserDeviceUuid(), (function sendTimeZone() {
2054
2216
  sendMessage({ type: "timeZone", timezone: Intl.DateTimeFormat().resolvedOptions().timeZone });
2055
- })()), p && document.addEventListener("visibilitychange", handleVisibilityChange), u && window.addEventListener("beforeunload", () => {
2217
+ })()), g && document.addEventListener("visibilitychange", handleVisibilityChange), f && (window.addEventListener("beforeunload", () => {
2056
2218
  clearPageVisitDataFromSessionStorage();
2057
- }));
2219
+ }), window.addEventListener("online", () => {
2220
+ requestTimeSync();
2221
+ })));
2058
2222
  }
2059
2223
  function matchParsedUrlAgainstPatterns(e2, t2) {
2060
- const { hostname: n2, pathname: i2, port: o2 } = e2, a2 = n2.startsWith("www.") ? n2.slice(4).toLowerCase() : n2.toLowerCase();
2224
+ const { hostname: n2, pathname: i2, port: o2 } = e2, s2 = n2.startsWith("www.") ? n2.slice(4).toLowerCase() : n2.toLowerCase();
2061
2225
  return t2.some((e3) => {
2062
2226
  const t3 = String(e3 || "").replace(/^[a-zA-Z]+:\/\//, "");
2063
- let [n3, s2] = t3.split("/", 2), r2 = "";
2064
- n3.includes(":") && ([n3, r2] = n3.split(":"));
2065
- const l2 = getCachedRegex(`^${n3.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`, "i"), c2 = a2.startsWith("www.") ? a2.slice(4) : a2;
2066
- if (r2 && "*" !== r2 && o2 !== r2) return false;
2227
+ let [n3, r2] = t3.split("/", 2), a2 = "";
2228
+ n3.includes(":") && ([n3, a2] = n3.split(":"));
2229
+ const l2 = getCachedRegex(`^${n3.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`, "i"), c2 = s2.startsWith("www.") ? s2.slice(4) : s2;
2230
+ if (a2 && "*" !== a2 && o2 !== a2) return false;
2067
2231
  if (n3.startsWith("*.")) {
2068
2232
  const e4 = n3.slice(2).toLowerCase();
2069
- if (!(a2 === e4 || c2 === e4 || a2.endsWith("." + e4))) return false;
2070
- if (s2) {
2071
- return getCachedRegex(`^/${s2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
2233
+ if (!(s2 === e4 || c2 === e4 || s2.endsWith("." + e4))) return false;
2234
+ if (r2) {
2235
+ return getCachedRegex(`^/${r2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
2072
2236
  }
2073
2237
  return true;
2074
2238
  }
2075
- if (!l2.test(c2) && !l2.test(a2)) return false;
2076
- if (s2) {
2077
- return getCachedRegex(`^/${s2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
2239
+ if (!l2.test(c2) && !l2.test(s2)) return false;
2240
+ if (r2) {
2241
+ return getCachedRegex(`^/${r2.replace(/\*/g, ".*").replace(/\/$/, "")}`, "i").test(i2);
2078
2242
  }
2079
2243
  return true;
2080
2244
  });
2081
2245
  }
2246
+ function toAbsoluteUrl(e2) {
2247
+ if ("string" != typeof e2 || 0 === e2.length) return e2;
2248
+ try {
2249
+ const t2 = "undefined" != typeof window ? window.location.href : "http://localhost/";
2250
+ return new URL(e2, t2).href;
2251
+ } catch {
2252
+ return e2;
2253
+ }
2254
+ }
2082
2255
  function matchUrlWithWildcard(e2, t2) {
2083
2256
  let n2, i2;
2084
2257
  if ("string" == typeof e2 ? n2 = e2 : "undefined" != typeof URL && e2 instanceof URL ? n2 = e2.href : "undefined" != typeof Request && e2 instanceof Request ? n2 = e2.url : null != e2 && "function" == typeof e2.toString && (n2 = e2.toString()), !n2) return false;
@@ -2091,7 +2264,7 @@ function matchUrlWithWildcard(e2, t2) {
2091
2264
  return matchParsedUrlAgainstPatterns(i2, t2);
2092
2265
  }
2093
2266
  function createSkipHeadersPropagationChecker(e2 = [], t2 = []) {
2094
- const n2 = [...Te, ...e2], i2 = t2.length > 0;
2267
+ const n2 = [...Ae, ...e2], i2 = t2.length > 0;
2095
2268
  return function shouldSkipHeadersPropagation(e3) {
2096
2269
  let o2;
2097
2270
  try {
@@ -2099,12 +2272,12 @@ function createSkipHeadersPropagationChecker(e2 = [], t2 = []) {
2099
2272
  } catch {
2100
2273
  return true;
2101
2274
  }
2102
- const a2 = o2.pathname.toLowerCase(), s2 = a2.lastIndexOf(".");
2103
- return !(-1 === s2 || !Ie.has(a2.slice(s2))) || (!(!i2 || matchParsedUrlAgainstPatterns(o2, t2)) || !!matchParsedUrlAgainstPatterns(o2, n2));
2275
+ const s2 = o2.pathname.toLowerCase(), r2 = s2.lastIndexOf(".");
2276
+ return !(-1 === r2 || !Fe.has(s2.slice(r2))) || (!(!i2 || matchParsedUrlAgainstPatterns(o2, t2)) || !!matchParsedUrlAgainstPatterns(o2, n2));
2104
2277
  };
2105
2278
  }
2106
2279
  function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i2 = []) {
2107
- const o2 = window.fetch, a2 = getOrSetSessionId(), s2 = createSkipHeadersPropagationChecker(e2, i2), r2 = ["text/event-stream", "application/x-ndjson", "application/stream+json", "application/grpc", "application/grpc-web"], l2 = ["application/octet-stream"];
2280
+ const o2 = window.fetch, s2 = getOrSetSessionId(), r2 = createSkipHeadersPropagationChecker(e2, i2), a2 = ["text/event-stream", "application/x-ndjson", "application/stream+json", "application/grpc", "application/grpc-web"], l2 = ["application/octet-stream"];
2108
2281
  window.fetch = new Proxy(o2, { apply: async (e3, i3, o3) => {
2109
2282
  let c2, d2 = o3[0], u2 = o3[1] || {};
2110
2283
  if ("string" == typeof d2) c2 = d2;
@@ -2113,113 +2286,115 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
2113
2286
  if (!(d2 instanceof URL)) return e3.apply(i3, o3);
2114
2287
  c2 = d2.href;
2115
2288
  }
2116
- return s2(c2) ? e3.apply(i3, o3) : (async function injectHeaderWrapper(e4, i4, o4, a3, s3, c3, d3) {
2289
+ return r2(c2) ? e3.apply(i3, o3) : (async function injectHeaderWrapper(e4, i4, o4, s3, r3, c3, d3) {
2117
2290
  var _a, _b;
2118
2291
  if (!c3) return e4.apply(i4, o4);
2119
2292
  let u3 = uuidv4();
2120
- const p2 = getUrlAndStoredUuids(), f2 = s3.method || "GET", g2 = Date.now();
2293
+ const p2 = getUrlAndStoredUuids(), f2 = r3.method || "GET", g2 = Date.now();
2121
2294
  let m2, h2 = {}, y2 = null;
2122
2295
  try {
2123
- if (a3 instanceof Request) {
2124
- a3.headers.forEach((e5, t3) => {
2296
+ if (s3 instanceof Request) {
2297
+ s3.headers.forEach((e5, t3) => {
2125
2298
  h2[t3] = e5;
2126
2299
  });
2127
2300
  try {
2128
- y2 = a3.clone();
2301
+ y2 = s3.clone();
2129
2302
  } catch (e5) {
2130
2303
  y2 = null;
2131
2304
  }
2132
- } else s3.headers && (s3.headers instanceof Headers ? s3.headers.forEach((e5, t3) => {
2305
+ } else r3.headers && (r3.headers instanceof Headers ? r3.headers.forEach((e5, t3) => {
2133
2306
  h2[t3] = e5;
2134
- }) : Array.isArray(s3.headers) ? s3.headers.forEach(([e5, t3]) => {
2307
+ }) : Array.isArray(r3.headers) ? r3.headers.forEach(([e5, t3]) => {
2135
2308
  h2[e5] = t3;
2136
- }) : h2 = { ...s3.headers }), m2 = s3.body;
2309
+ }) : h2 = { ...r3.headers }), m2 = r3.body;
2137
2310
  } catch (e5) {
2138
- ke && console.warn("[Sailfish] Failed to capture request data:", e5);
2311
+ Ce && console.warn("[Sailfish] Failed to capture request data:", e5);
2139
2312
  }
2140
2313
  delete h2[n];
2141
- const b2 = getFuncSpanHeader();
2142
- b2 && delete h2[b2.name];
2143
- const w2 = `${c3}/${p2.page_visit_uuid}/${u3}`;
2144
- h2[n] = w2, b2 && (h2[b2.name] = b2.value);
2314
+ const S2 = getFuncSpanHeader();
2315
+ S2 && delete h2[S2.name];
2316
+ const b2 = `${c3}/${p2.page_visit_uuid}/${u3}`;
2317
+ h2[n] = b2, S2 && (h2[S2.name] = S2.value);
2145
2318
  maskAuthorizationHeader(h2);
2146
2319
  try {
2147
- let b3 = await (async function injectHeader(e5, t3, i5, o5, a4, s4, r3) {
2320
+ let S3 = await (async function injectHeader(e5, t3, i5, o5, s4, r4, a3) {
2148
2321
  const l3 = getFuncSpanHeader();
2149
2322
  if (i5 instanceof Request) {
2150
2323
  const c4 = i5.clone(), d4 = new Headers(c4.headers);
2151
- d4.set(n, `${a4}/${s4}/${r3}`), l3 && (d4.set(l3.name, l3.value), ke && console.log("[Sailfish] Added funcspan header to HTTP Request:", { url: i5.url, header: l3.name }));
2324
+ d4.set(n, `${s4}/${r4}/${a3}`), l3 && (d4.set(l3.name, l3.value), Ce && console.log("[Sailfish] Added funcspan header to HTTP Request:", { url: i5.url, header: l3.name }));
2152
2325
  const u4 = new Request(c4, { headers: d4 });
2153
2326
  return await e5.call(t3, u4, o5);
2154
2327
  }
2155
2328
  {
2156
2329
  const c4 = { ...o5 }, d4 = new Headers(o5.headers || {});
2157
- return d4.set(n, `${a4}/${s4}/${r3}`), l3 && (d4.set(l3.name, l3.value), ke && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof i5 ? i5 : i5.href, header: l3.name })), c4.headers = d4, await e5.call(t3, i5, c4);
2330
+ return d4.set(n, `${s4}/${r4}/${a3}`), l3 && (d4.set(l3.name, l3.value), Ce && console.log("[Sailfish] Added funcspan header to HTTP fetch:", { url: "string" == typeof i5 ? i5 : i5.href, header: l3.name })), c4.headers = d4, await e5.call(t3, i5, c4);
2158
2331
  }
2159
- })(e4, i4, a3, s3, c3, p2.page_visit_uuid, u3), w3 = false;
2160
- Ee.includes(b3.status) && (ke && console.log("Perform retry as status was fail:", b3), delete h2[n], b3 = await (async function retryWithoutPropagateHeaders(e5, t3, i5, o5) {
2332
+ })(e4, i4, s3, r3, c3, p2.page_visit_uuid, u3), b3 = false;
2333
+ Le.includes(S3.status) && (Ce && console.log("Perform retry as status was fail:", S3), delete h2[n], S3 = await (async function retryWithoutPropagateHeaders(e5, t3, i5, o5) {
2161
2334
  try {
2162
- let o6 = i5[0], a4 = i5[1] || {};
2335
+ let o6 = i5[0], s4 = i5[1] || {};
2163
2336
  if ("string" == typeof o6 || o6 instanceof URL) {
2164
- const i6 = { ...a4 }, s4 = new Headers(a4.headers || {});
2165
- s4.delete(n), i6.headers = s4;
2337
+ const i6 = { ...s4 }, r4 = new Headers(s4.headers || {});
2338
+ r4.delete(n), i6.headers = r4;
2166
2339
  return await e5.call(t3, o6, i6);
2167
2340
  }
2168
2341
  if (o6 instanceof Request) {
2169
- const i6 = o6.clone(), s4 = new Headers(i6.headers);
2170
- s4.delete(n);
2171
- const r3 = new Request(i6, { headers: s4 });
2172
- return await e5.call(t3, r3, a4);
2342
+ const i6 = o6.clone(), r4 = new Headers(i6.headers);
2343
+ r4.delete(n);
2344
+ const a3 = new Request(i6, { headers: r4 });
2345
+ return await e5.call(t3, a3, s4);
2173
2346
  }
2174
2347
  return e5.apply(t3, i5);
2175
2348
  } catch (e6) {
2176
- throw ke && console.log(`Retry without ${n} for ${o5} also failed:`, e6), e6;
2349
+ throw Ce && console.log(`Retry without ${n} for ${o5} also failed:`, e6), e6;
2177
2350
  }
2178
- })(e4, i4, o4, d3), w3 = true);
2179
- const v2 = Date.now(), S2 = b3.status, k2 = b3.ok, x2 = k2 ? "" : `Request Error: ${b3.statusText}`;
2180
- let I2 = null;
2351
+ })(e4, i4, o4, d3), b3 = true);
2352
+ const v2 = Date.now(), w2 = (function captureClientTime() {
2353
+ return { wallTimeMs: Date.now(), monotonicMs: monotonicNow(), timeOriginMs: timeOriginMs() };
2354
+ })(), k2 = S3.status, x2 = S3.ok, I2 = x2 ? "" : `Request Error: ${S3.statusText}`;
2355
+ let T2 = null;
2181
2356
  try {
2182
- I2 = {}, b3.headers.forEach((e5, t3) => {
2183
- I2[t3] = e5;
2357
+ T2 = {}, S3.headers.forEach((e5, t3) => {
2358
+ T2[t3] = e5;
2184
2359
  });
2185
2360
  } catch (e5) {
2186
- ke && console.warn("[Sailfish] Failed to capture response headers:", e5), I2 = null;
2361
+ Ce && console.warn("[Sailfish] Failed to capture response headers:", e5), T2 = null;
2187
2362
  }
2188
- const T2 = { type: 27, timestamp: v2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: v2, response_code: S2, success: k2, error: x2, method: f2, url: d3, retry_without_trace_id: w3, request_headers: h2, request_body: m2, response_headers: I2, response_body: null }, ...p2 }, sendEventWithBody = (e5) => {
2189
- T2.data.response_body = e5, y2 ? y2.text().then((e6) => {
2190
- T2.data.request_body = e6, sendEvent(T2);
2363
+ const E2 = { type: 27, timestamp: v2, sessionId: c3, client: w2, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: v2, response_code: k2, success: x2, error: I2, method: f2, url: toAbsoluteUrl(d3), retry_without_trace_id: b3, request_headers: h2, request_body: m2, response_headers: T2, response_body: null }, ...p2 }, sendEventWithBody = (e5) => {
2364
+ E2.data.response_body = e5, y2 ? y2.text().then((e6) => {
2365
+ E2.data.request_body = e6, sendEvent(E2);
2191
2366
  }, () => {
2192
- sendEvent(T2);
2193
- }) : sendEvent(T2);
2194
- }, E2 = 1024 * t2.captureResponseBodyMaxMb * 1024;
2367
+ sendEvent(E2);
2368
+ }) : sendEvent(E2);
2369
+ }, M2 = 1024 * t2.captureResponseBodyMaxMb * 1024;
2195
2370
  if (0 === t2.captureResponseBodyMaxMb) sendEventWithBody(null);
2196
2371
  else if ((function shouldSkipBodyCapture(e5) {
2197
2372
  const t3 = e5.headers.get("content-type");
2198
2373
  if (!t3) return false;
2199
2374
  const n2 = t3.toLowerCase();
2200
2375
  return l2.some((e6) => n2.includes(e6));
2201
- })(b3)) sendEventWithBody(null);
2376
+ })(S3)) sendEventWithBody(null);
2202
2377
  else if ((function isStreamingResponse(e5) {
2203
2378
  const t3 = e5.headers.get("content-type");
2204
2379
  if (!t3) return false;
2205
2380
  const n2 = t3.toLowerCase();
2206
- return r2.some((e6) => n2.includes(e6));
2207
- })(b3)) if (t2.captureStreamingResponseBody) try {
2381
+ return a2.some((e6) => n2.includes(e6));
2382
+ })(S3)) if (t2.captureStreamingResponseBody) try {
2208
2383
  (async function readStreamPrefix(e5, t3, n2) {
2209
2384
  const i5 = e5.body;
2210
2385
  if (!i5) return null;
2211
- const o5 = i5.getReader(), a4 = new TextDecoder(), s4 = [];
2212
- let r3 = 0;
2386
+ const o5 = i5.getReader(), s4 = new TextDecoder(), r4 = [];
2387
+ let a3 = 0;
2213
2388
  const readWithLimit = async () => {
2214
2389
  try {
2215
- for (; r3 < t3; ) {
2390
+ for (; a3 < t3; ) {
2216
2391
  const { done: e6, value: t4 } = await o5.read();
2217
2392
  if (e6) break;
2218
- r3 += t4.byteLength, s4.push(a4.decode(t4, { stream: true }));
2393
+ a3 += t4.byteLength, r4.push(s4.decode(t4, { stream: true }));
2219
2394
  }
2220
- return s4.push(a4.decode()), s4.join("");
2395
+ return r4.push(s4.decode()), r4.join("");
2221
2396
  } catch {
2222
- return s4.length > 0 ? s4.join("") : null;
2397
+ return r4.length > 0 ? r4.join("") : null;
2223
2398
  } finally {
2224
2399
  try {
2225
2400
  o5.cancel();
@@ -2233,7 +2408,7 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
2233
2408
  o5.cancel();
2234
2409
  } catch {
2235
2410
  }
2236
- e6(s4.length > 0 ? s4.join("") : null);
2411
+ e6(r4.length > 0 ? r4.join("") : null);
2237
2412
  }, n2))]);
2238
2413
  } catch {
2239
2414
  try {
@@ -2242,40 +2417,40 @@ function setupFetchInterceptor(e2 = [], t2 = { captureStreamingResponseBody: tru
2242
2417
  }
2243
2418
  return null;
2244
2419
  }
2245
- })(b3.clone(), 1024 * t2.captureStreamPrefixKb, t2.captureStreamTimeoutMs).then((e5) => sendEventWithBody(e5), () => sendEventWithBody(null));
2420
+ })(S3.clone(), 1024 * t2.captureStreamPrefixKb, t2.captureStreamTimeoutMs).then((e5) => sendEventWithBody(e5), () => sendEventWithBody(null));
2246
2421
  } catch {
2247
2422
  sendEventWithBody(null);
2248
2423
  }
2249
2424
  else sendEventWithBody(null);
2250
2425
  else {
2251
- const e5 = b3.headers.get("content-length"), t3 = e5 ? parseInt(e5, 10) : NaN;
2252
- if (!isNaN(t3) && t3 > E2) sendEventWithBody(null);
2426
+ const e5 = S3.headers.get("content-length"), t3 = e5 ? parseInt(e5, 10) : NaN;
2427
+ if (!isNaN(t3) && t3 > M2) sendEventWithBody(null);
2253
2428
  else try {
2254
- b3.clone().text().then((e6) => {
2255
- e6.length > E2 ? sendEventWithBody(null) : sendEventWithBody(e6);
2429
+ S3.clone().text().then((e6) => {
2430
+ e6.length > M2 ? sendEventWithBody(null) : sendEventWithBody(e6);
2256
2431
  }, () => sendEventWithBody(null));
2257
2432
  } catch {
2258
2433
  sendEventWithBody(null);
2259
2434
  }
2260
2435
  }
2261
- return b3;
2436
+ return S3;
2262
2437
  } catch (t3) {
2263
- const n2 = Date.now(), a4 = false, s4 = ((_a = t3.response) == null ? void 0 : _a.status) || 500, r3 = t3.message || "Fetch request failed";
2264
- if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(Ce.toLowerCase()))) return e4.apply(i4, o4);
2438
+ const n2 = Date.now(), s4 = false, r4 = ((_a = t3.response) == null ? void 0 : _a.status) || 500, a3 = t3.message || "Fetch request failed";
2439
+ if (t3 instanceof TypeError && ((_b = t3 == null ? void 0 : t3.message) == null ? void 0 : _b.toLowerCase().includes(Re.toLowerCase()))) return e4.apply(i4, o4);
2265
2440
  let l3 = m2;
2266
2441
  if (y2) try {
2267
2442
  l3 = await y2.text();
2268
2443
  } catch {
2269
2444
  l3 = null;
2270
2445
  }
2271
- throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code: s4, success: a4, error: r3, method: f2, url: d3, request_headers: h2, request_body: l3, response_body: null }, ...p2 }), t3;
2446
+ throw sendEvent({ type: 27, timestamp: n2, sessionId: c3, data: { request_id: u3, session_id: c3, timestamp_start: g2, timestamp_end: n2, response_code: r4, success: s4, error: a3, method: f2, url: toAbsoluteUrl(d3), request_headers: h2, request_body: l3, response_body: null }, ...p2 }), t3;
2272
2447
  }
2273
- })(e3, i3, o3, d2, u2, a2, c2);
2448
+ })(e3, i3, o3, d2, u2, s2, c2);
2274
2449
  } });
2275
2450
  }
2276
- async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = ["*"], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: a2, serviceIdentifier: s2, gitSha: r2, serviceAdditionalMetadata: l2, enableIpTracking: c2, captureStreamingResponseBody: d2 = true, captureResponseBodyMaxMb: u2 = 10, captureStreamPrefixKb: p2 = 64, captureStreamTimeoutMs: f2 = 1e4, enableFiberTracking: m2 = false, deferRecording: h2, deferRecordingStart: y2, chunkSnapshot: b2, useWsWorker: w2 = true, capturePerformanceMetrics: v2 = true, maskTextClass: S2, library: k2, headlessRecording: x2 = false }) {
2451
+ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo: i2 = ["*"], domainsToNotPropagateHeaderTo: o2 = [], serviceVersion: s2, serviceIdentifier: r2, gitSha: a2, serviceAdditionalMetadata: l2, enableIpTracking: c2, captureStreamingResponseBody: d2 = true, captureResponseBodyMaxMb: u2 = 10, captureStreamPrefixKb: p2 = 64, captureStreamTimeoutMs: f2 = 1e4, enableFiberTracking: g2 = false, deferRecording: m2, deferRecordingStart: y2, chunkSnapshot: S2, useWsWorker: b2 = true, capturePerformanceMetrics: v2 = true, maskTextClass: w2, maskInputSelector: k2, maskTextSelector: x2, blockSelector: I2, unmaskSelector: T2, maskInputOptions: E2, library: M2, headlessRecording: C2 = false }) {
2277
2452
  var _a, _b;
2278
- if (!x2 && (function isHeadlessOrLighthouse() {
2453
+ if (!C2 && (function isHeadlessOrLighthouse() {
2279
2454
  try {
2280
2455
  if ("undefined" == typeof navigator) return false;
2281
2456
  const e3 = navigator;
@@ -2286,20 +2461,20 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2286
2461
  return false;
2287
2462
  }
2288
2463
  })()) return;
2289
- const I2 = h2 ?? y2 ?? true, T2 = getOrSetSessionId(), E2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
2290
- if (E2.sessionId = T2, E2.apiKey = e2, E2.backendApi = t2, E2.serviceAdditionalMetadata = l2, E2.initialized && E2.sessionId === T2 && E2.ws && 1 === E2.ws.readyState) return void trackDomainChangesOnce();
2291
- const C2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
2292
- sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), E2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i3 = []) {
2293
- const o3 = XMLHttpRequest.prototype.open, a3 = XMLHttpRequest.prototype.send, s3 = XMLHttpRequest.prototype.setRequestHeader, r3 = getOrSetSessionId(), l3 = createSkipHeadersPropagationChecker(e3, i3);
2464
+ const $2 = m2 ?? y2 ?? true, F2 = getOrSetSessionId(), A2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
2465
+ if (A2.sessionId = F2, A2.apiKey = e2, A2.backendApi = t2, A2.serviceAdditionalMetadata = l2, A2.initialized && A2.sessionId === F2 && A2.ws && 1 === A2.ws.readyState) return void trackDomainChangesOnce();
2466
+ const L2 = { captureStreamingResponseBody: d2, captureResponseBodyMaxMb: u2, captureStreamPrefixKb: p2, captureStreamTimeoutMs: f2 };
2467
+ sessionStorage.getItem("pageVisitUUID") || (sessionStorage.setItem("pageVisitUUID", uuidv4()), invalidateUrlCache()), A2.xhrPatched || (!(function setupXMLHttpRequestInterceptor(e3 = [], t3 = { captureStreamingResponseBody: true, captureResponseBodyMaxMb: 10, captureStreamPrefixKb: 64, captureStreamTimeoutMs: 1e4 }, i3 = []) {
2468
+ const o3 = XMLHttpRequest.prototype.open, s3 = XMLHttpRequest.prototype.send, r3 = XMLHttpRequest.prototype.setRequestHeader, a3 = getOrSetSessionId(), l3 = createSkipHeadersPropagationChecker(e3, i3);
2294
2469
  XMLHttpRequest.prototype.setRequestHeader = function(e4, t4) {
2295
- return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4, s3.call(this, e4, t4);
2470
+ return this._capturedRequestHeaders || (this._capturedRequestHeaders = {}), this._capturedRequestHeaders[e4] = t4, r3.call(this, e4, t4);
2296
2471
  }, XMLHttpRequest.prototype.open = function(e4, t4, ...n2) {
2297
2472
  return this._requestUrl = "string" == typeof t4 && t4.length > 0 ? t4 : null, this._requestMethod = e4, this._capturedRequestHeaders = {}, o3.apply(this, [e4, t4, ...n2]);
2298
2473
  }, XMLHttpRequest.prototype.send = function(...e4) {
2299
2474
  const i4 = this._requestUrl;
2300
- if (!i4) return a3.apply(this, e4);
2301
- if (l3(i4)) return a3.apply(this, e4);
2302
- const o4 = sessionStorage.getItem("pageVisitUUID"), s4 = uuidv4(), c3 = `${r3}/${o4}/${s4}`;
2475
+ if (!i4) return s3.apply(this, e4);
2476
+ if (l3(i4)) return s3.apply(this, e4);
2477
+ const o4 = sessionStorage.getItem("pageVisitUUID"), r4 = uuidv4(), c3 = `${a3}/${o4}/${r4}`;
2303
2478
  try {
2304
2479
  this.setRequestHeader(n, c3);
2305
2480
  } catch (e5) {
@@ -2307,19 +2482,19 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2307
2482
  }
2308
2483
  const d3 = getFuncSpanHeader();
2309
2484
  if (d3) try {
2310
- this.setRequestHeader(d3.name, d3.value), ke && console.log("[Sailfish] Added funcspan header to XMLHttpRequest:", { url: i4, header: d3.name });
2485
+ this.setRequestHeader(d3.name, d3.value), Ce && console.log("[Sailfish] Added funcspan header to XMLHttpRequest:", { url: i4, header: d3.name });
2311
2486
  } catch (e5) {
2312
- ke && console.warn(`[Sailfish] Could not set funcspan header for ${i4}`, e5);
2487
+ Ce && console.warn(`[Sailfish] Could not set funcspan header for ${i4}`, e5);
2313
2488
  }
2314
2489
  const u3 = Date.now();
2315
2490
  let p3 = false;
2316
- const f3 = e4[0], g2 = { ...this._capturedRequestHeaders };
2317
- maskAuthorizationHeader(g2);
2318
- const emitFinished = (e5, t4, n2, o5, a4) => {
2491
+ const f3 = e4[0], g3 = { ...this._capturedRequestHeaders };
2492
+ maskAuthorizationHeader(g3);
2493
+ const emitFinished = (e5, t4, n2, o5, s4) => {
2319
2494
  if (p3) return;
2320
2495
  p3 = true;
2321
2496
  const l4 = Date.now();
2322
- sendEvent({ type: 27, timestamp: l4, sessionId: r3, data: { request_id: s4, session_id: r3, timestamp_start: u3, timestamp_end: l4, response_code: t4, success: e5, error: n2, method: this._requestMethod, url: i4, request_headers: g2, request_body: f3, response_headers: a4, response_body: o5 }, ...getUrlAndStoredUuids() });
2497
+ sendEvent({ type: 27, timestamp: l4, sessionId: a3, data: { request_id: r4, session_id: a3, timestamp_start: u3, timestamp_end: l4, response_code: t4, success: e5, error: n2, method: this._requestMethod, url: toAbsoluteUrl(i4), request_headers: g3, request_body: f3, response_headers: s4, response_body: o5 }, ...getUrlAndStoredUuids() });
2323
2498
  };
2324
2499
  return this.addEventListener("load", () => {
2325
2500
  const e5 = this.status || 0;
@@ -2342,7 +2517,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2342
2517
  2 === t4.length && (i5[t4[0]] = t4[1]);
2343
2518
  });
2344
2519
  } catch (e6) {
2345
- ke && console.warn("[Sailfish] Failed to capture XHR response headers:", e6), i5 = null;
2520
+ Ce && console.warn("[Sailfish] Failed to capture XHR response headers:", e6), i5 = null;
2346
2521
  }
2347
2522
  if (e5 >= 200 && e5 < 300) emitFinished(true, e5, "", n2, i5);
2348
2523
  else {
@@ -2352,26 +2527,26 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2352
2527
  }, { once: true }), this.addEventListener("error", () => {
2353
2528
  const e5 = this.status || 0, t4 = 0 === e5 ? "Network or CORS failure" : this.statusText || `Error ${e5}`;
2354
2529
  emitFinished(false, e5, t4);
2355
- }, { once: true }), a3.apply(this, e4);
2530
+ }, { once: true }), s3.apply(this, e4);
2356
2531
  };
2357
- })(o2, C2, i2), E2.xhrPatched = true), E2.fetchPatched || (setupFetchInterceptor(o2, C2, i2), E2.fetchPatched = true), await yieldToMain(), E2.domEventsInit || (initializeDomContentEvents(T2), E2.domEventsInit = true), await yieldToMain(), E2.consoleInit || (initializeConsolePlugin(Ae, T2), E2.consoleInit = true), await yieldToMain(), E2.errorInit || (!(function initializeErrorInterceptor() {
2532
+ })(o2, L2, i2), A2.xhrPatched = true), A2.fetchPatched || (setupFetchInterceptor(o2, L2, i2), A2.fetchPatched = true), await yieldToMain(), A2.domEventsInit || (initializeDomContentEvents(F2), A2.domEventsInit = true), await yieldToMain(), A2.consoleInit || (initializeConsolePlugin(Oe, F2), A2.consoleInit = true), await yieldToMain(), A2.errorInit || (!(function initializeErrorInterceptor() {
2358
2533
  window.addEventListener("error", (e3) => {
2359
- captureError(e3.error || e3.message);
2534
+ captureError(e3.error ?? e3.message, false, { filename: e3.filename, lineno: e3.lineno, colno: e3.colno });
2360
2535
  }), window.addEventListener("unhandledrejection", (e3) => {
2361
2536
  captureError(e3.reason, true);
2362
2537
  });
2363
- })(), E2.errorInit = true), await yieldToMain(), !E2.perfInit && v2 && (initializePerformancePlugin(T2), E2.perfInit = true), await yieldToMain(), _ensureModuleSideEffects(), (function storeCredentialsAndConnection({ apiKey: e3, backendApi: t3 }) {
2364
- g && (sessionStorage.setItem("sailfishApiKey", e3), sessionStorage.setItem("sailfishBackendApi", t3));
2365
- })({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || E2.ws && 1 === E2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
2538
+ })(), A2.errorInit = true), await yieldToMain(), !A2.perfInit && v2 && (initializePerformancePlugin(F2), A2.perfInit = true), await yieldToMain(), _ensureModuleSideEffects(), (function storeCredentialsAndConnection({ apiKey: e3, backendApi: t3 }) {
2539
+ h && (sessionStorage.setItem("sailfishApiKey", e3), sessionStorage.setItem("sailfishBackendApi", t3));
2540
+ })({ apiKey: e2, backendApi: t2 }), !isFunctionSpanTrackingEnabled() || A2.ws && 1 === A2.ws.readyState || fetchFunctionSpanTrackingEnabled(e2, t2).then((e3) => {
2366
2541
  var _a2;
2367
- ((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ? ke && console.log("[Sailfish] Function span tracking state validated with backend: ACTIVE") : (clearStaleFuncSpanState(), ke && console.log("[Sailfish] Cleared stale function span tracking state - backend validation shows tracking is not active"));
2542
+ ((_a2 = e3.data) == null ? void 0 : _a2.isFunctionSpanTrackingEnabledFromApiKey) ?? false ? Ce && console.log("[Sailfish] Function span tracking state validated with backend: ACTIVE") : (clearStaleFuncSpanState(), Ce && console.log("[Sailfish] Cleared stale function span tracking state - backend validation shows tracking is not active"));
2368
2543
  }).catch((e3) => {
2369
- ke && console.warn("[Sailfish] Failed to validate function span tracking status with backend:", e3);
2370
- }), E2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...Te], t2).catch((e3) => console.error("Failed to send domains to not propagate header to:", e3)), E2.sentDoNotPropagateOnce = true), (async function gatherAndCacheDeviceInfo() {
2544
+ Ce && console.warn("[Sailfish] Failed to validate function span tracking status with backend:", e3);
2545
+ }), A2.sentDoNotPropagateOnce || (sendDomainsToNotPropagateHeaderTo(e2, [...o2, ...Ae], t2).catch((e3) => console.error("Failed to send domains to not propagate header to:", e3)), A2.sentDoNotPropagateOnce = true), (async function gatherAndCacheDeviceInfo() {
2371
2546
  sendMessage({ type: "deviceInfo", data: { deviceInfo: { language: navigator.language, userAgent: navigator.userAgent } } });
2372
- })(), c2 && fetchAndSendIp(T2);
2547
+ })(), c2 && fetchAndSendIp(F2);
2373
2548
  try {
2374
- const n2 = r2 ?? (function readGitSha() {
2549
+ const n2 = a2 ?? (function readGitSha() {
2375
2550
  var _a2;
2376
2551
  try {
2377
2552
  const e3 = globalThis;
@@ -2388,7 +2563,7 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2388
2563
  if ("string" == typeof e3 && e3) return e3;
2389
2564
  } catch {
2390
2565
  }
2391
- })(), i3 = s2 ?? "", o3 = a2 ?? "", c3 = k2 ?? "JS/TS", d3 = (function getMapUuidFromWindow() {
2566
+ })(), i3 = r2 ?? "", o3 = s2 ?? "", c3 = M2 ?? "JS/TS", d3 = (function getMapUuidFromWindow() {
2392
2567
  try {
2393
2568
  const e3 = window;
2394
2569
  if (e3 && "string" == typeof e3.sfMapUuid && e3.sfMapUuid) return e3.sfMapUuid;
@@ -2401,41 +2576,43 @@ async function startRecording({ apiKey: e2, backendApi: t2 = "https://api-servic
2401
2576
  } catch {
2402
2577
  }
2403
2578
  const n3 = t3, i4 = [];
2404
- for (const e4 of ae) {
2579
+ for (const e4 of de) {
2405
2580
  const t4 = e4(n3);
2406
2581
  t4 && !i4.includes(t4) && i4.push(t4);
2407
2582
  }
2408
2583
  return { framework: i4[0] ?? null, additionalFrameworks: i4.slice(1), serviceRole: "frontend" };
2409
2584
  })(), f3 = { ...u3, serviceRole: p3.serviceRole, ...null !== p3.framework && { framework: p3.framework }, ...p3.additionalFrameworks.length > 0 && { additionalFrameworks: p3.additionalFrameworks } };
2410
2585
  await yieldToMain();
2411
- const [g2, h3] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, T2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Me, ...(_a = g2.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: m2, ...void 0 !== S2 ? { maskTextClass: S2 } : {} };
2412
- if (E2.ws && 1 === E2.ws.readyState) return;
2413
- if ((_b = h3.data) == null ? void 0 : _b.startRecordingSession) {
2586
+ const [m3, h2] = await Promise.all([fetchCaptureSettings(e2, t2), startRecordingSession(e2, F2, t2, i3, o3, d3, n2, c3, f3)]), y3 = { ...Be, ...(_a = m3.data) == null ? void 0 : _a.captureSettingsFromApiKey, enableFiberTracking: g2, ...void 0 !== w2 ? { maskTextClass: w2 } : {}, ...void 0 !== k2 ? { maskInputSelector: k2 } : {}, ...void 0 !== x2 ? { maskTextSelector: x2 } : {}, ...void 0 !== I2 ? { blockSelector: I2 } : {}, ...void 0 !== T2 ? { unmaskSelector: T2 } : {}, ...void 0 !== E2 ? { maskInputOptions: E2 } : {} };
2587
+ if (A2.ws && 1 === A2.ws.readyState) return;
2588
+ if ((_b = h2.data) == null ? void 0 : _b.startRecordingSession) {
2414
2589
  const n3 = (l2 == null ? void 0 : l2.env) || (l2 == null ? void 0 : l2.environment);
2415
2590
  await yieldToMain();
2416
- const i4 = await initializeRecording(y3, t2, e2, T2, n3, I2, w2, b2 ?? false);
2417
- E2.ws = i4, E2.initialized = true, trackDomainChangesOnce(), E2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
2591
+ const i4 = await initializeRecording(y3, t2, e2, F2, n3, $2, b2, S2 ?? false);
2592
+ A2.ws = i4, A2.initialized = true, trackDomainChangesOnce(), A2.sentMapUuidOnce || (!(function sendMapUuidIfAvailable(e3 = "", t3 = "") {
2418
2593
  window.sfMapUuid && sendMessage({ type: "mapUuid", data: { mapUuid: window.sfMapUuid, serviceIdentifier: e3, serviceVersion: t3 } });
2419
- })(s2, a2), E2.sentMapUuidOnce = true);
2420
- } else console.error("Failed to start recording session:", h3.errors || h3);
2594
+ })(r2, s2), A2.sentMapUuidOnce = true);
2595
+ } else console.error("Failed to start recording session:", h2.errors || h2);
2421
2596
  } catch (e3) {
2422
2597
  console.error("Error starting recording:", e3);
2423
2598
  }
2424
2599
  }
2425
2600
  const initRecorder = async (e2) => {
2426
2601
  if ("undefined" == typeof window) return;
2427
- const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {}), n2 = getOrSetSessionId();
2602
+ const t2 = window.__sailfish_recorder || (window.__sailfish_recorder = {});
2603
+ t2.internalDebugLogs = true === e2.enableInternalDebugLogs;
2604
+ const n2 = getOrSetSessionId();
2428
2605
  return clearPageVisitDataFromSessionStorage(), t2.initialized && t2.sessionId === n2 && t2.ws && 1 === t2.ws.readyState ? void 0 : (t2.initPromise || (t2.initPromise = (async () => {
2429
2606
  try {
2430
2607
  if (t2.hasLoggedInitOnce || (console.log("Initializing Sailfish Recorder (first run) …"), t2.hasLoggedInitOnce = true), await startRecording(e2), !t2.issueReportingInit) {
2431
- const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData: a2 }] = await Promise.all([Promise.resolve().then(() => Se), Promise.resolve().then(() => ce)]);
2432
- let s2 = null;
2608
+ const n3 = e2.backendApi ?? "https://api-service.sailfishqa.com", [{ setupIssueReporting: i2 }, { fetchIntegrationData: o2, getIntegrationData: s2 }] = await Promise.all([Promise.resolve().then(() => Me), Promise.resolve().then(() => ke)]);
2609
+ let r2 = null;
2433
2610
  try {
2434
- await o2(e2.apiKey, n3), s2 = a2();
2611
+ await o2(e2.apiKey, n3), r2 = s2();
2435
2612
  } catch (e3) {
2436
2613
  console.warn("[Sailfish] Failed to fetch integration data for issue reporting:", e3);
2437
2614
  }
2438
- i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: s2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
2615
+ i2({ apiKey: e2.apiKey, backendApi: n3, getSessionId: () => getOrSetSessionId(), shortcuts: e2.reportIssueShortcuts, customBaseUrl: e2.customBaseUrl, integrationData: r2, showEngTicketFieldsInReportIssueModalDefault: e2.showEngTicketFieldsInReportIssueModalDefault }), t2.issueReportingInit = true;
2439
2616
  }
2440
2617
  } catch (e3) {
2441
2618
  console.warn("[Sailfish] Recorder initialization failed:", e3);
@@ -2448,26 +2625,29 @@ export {
2448
2625
  initializeDomContentEvents as A,
2449
2626
  initializeFunctionSpanTrackingFromApi as B,
2450
2627
  initializePerformancePlugin as C,
2451
- Me as D,
2628
+ Be as D,
2452
2629
  initializeRecording as E,
2453
2630
  initializeWebSocket as F,
2454
2631
  invalidateUrlCache as G,
2455
2632
  isFunctionSpanTrackingEnabled as H,
2456
- matchUrlWithWildcard as I,
2457
- w as J,
2458
- onNavigationChange as K,
2459
- openReportIssueModal as L,
2460
- restoreFuncSpanState as M,
2461
- sendDomainsToNotPropagateHeaderTo as N,
2462
- sendEvent as O,
2463
- sendGraphQLRequest as P,
2464
- sendMessage as Q,
2465
- startRecording as R,
2466
- $e as S,
2467
- startRecordingSession as T,
2468
- trackingEvent as U,
2469
- withAppUrlMetadata as V,
2470
- Ae as a,
2633
+ maskInputFn as I,
2634
+ matchUrlWithWildcard as J,
2635
+ w as K,
2636
+ onNavigationChange as L,
2637
+ openReportIssueModal as M,
2638
+ requestTimeSync as N,
2639
+ restoreFuncSpanState as O,
2640
+ sendDomainsToNotPropagateHeaderTo as P,
2641
+ sendEvent as Q,
2642
+ sendGraphQLRequest as R,
2643
+ De as S,
2644
+ sendMessage as T,
2645
+ startRecording as U,
2646
+ startRecordingSession as V,
2647
+ toAbsoluteUrl as W,
2648
+ trackingEvent as X,
2649
+ withAppUrlMetadata as Y,
2650
+ Oe as a,
2471
2651
  addOrUpdateMetadata as b,
2472
2652
  buildBatches as c,
2473
2653
  clearStaleFuncSpanState as d,