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