@fixback/sdk 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- function me(e) {
1
+ function Xn(e) {
2
2
  return `${e.replace(/\/+$/, "")}/api/ingest/boot`;
3
3
  }
4
- function ge(e) {
4
+ function qn(e) {
5
5
  if (typeof e != "object" || e === null) return !1;
6
6
  const t = e;
7
7
  return typeof t.originAllowed == "boolean" && typeof t.canSubmit == "boolean" && typeof t.gate == "string" && (t.tier === null || typeof t.tier == "string");
8
8
  }
9
- async function xe(e, t, o = fetch) {
10
- let n;
9
+ async function Gn(e, t, n = fetch) {
10
+ let r;
11
11
  try {
12
- n = await o(me(e), {
12
+ r = await n(Xn(e), {
13
13
  method: "POST",
14
14
  headers: { "content-type": "application/json" },
15
15
  body: JSON.stringify(t)
@@ -17,37 +17,2304 @@ async function xe(e, t, o = fetch) {
17
17
  } catch {
18
18
  return null;
19
19
  }
20
- if (!n.ok) return null;
21
- let i;
20
+ if (!r.ok) return null;
21
+ let o;
22
22
  try {
23
- i = await n.json();
23
+ o = await r.json();
24
24
  } catch {
25
25
  return null;
26
26
  }
27
- return ge(i) ? i : null;
27
+ return qn(o) ? o : null;
28
28
  }
29
- var J = "fixback.anonymousId";
30
- function Z() {
29
+ var tt = ["data-fixback-root", "data-fixback-overlay"], Pa = tt.map((e) => `[${e}]`).join(",");
30
+ function Wn(e) {
31
+ return e instanceof Element && tt.some((t) => e.hasAttribute(t));
32
+ }
33
+ function Ge(e) {
34
+ let t = e instanceof Node ? e : null;
35
+ for (; t; ) {
36
+ if (t instanceof Element) {
37
+ for (const r of tt) if (t.hasAttribute(r)) return !0;
38
+ }
39
+ const n = t.getRootNode();
40
+ if (n instanceof ShadowRoot && n !== t) {
41
+ t = n.host;
42
+ continue;
43
+ }
44
+ t = t.parentNode;
45
+ }
46
+ return !1;
47
+ }
48
+ function kt(e) {
49
+ const t = globalThis.CSS;
50
+ return t != null && t.escape ? t.escape(e) : e.replace(/[^\w-]/g, (n) => `\\${n}`);
51
+ }
52
+ function Yn(e) {
53
+ let t = 1, n = e.previousElementSibling;
54
+ for (; n; )
55
+ n.tagName === e.tagName && (t += 1), n = n.previousElementSibling;
56
+ return t;
57
+ }
58
+ function Vt(e) {
59
+ if (e.id) return `#${kt(e.id)}`;
60
+ const t = [];
61
+ let n = e;
62
+ for (; n && n.tagName.toLowerCase() !== "html"; ) {
63
+ if (n.id) {
64
+ t.unshift(`#${kt(n.id)}`);
65
+ break;
66
+ }
67
+ const r = n.tagName.toLowerCase(), o = n.parentElement;
68
+ if (o) {
69
+ const i = Array.from(o.children).filter((a) => a.tagName === n.tagName);
70
+ t.unshift(i.length > 1 ? `${r}:nth-of-type(${Yn(n)})` : r);
71
+ } else t.unshift(r);
72
+ n = o;
73
+ }
74
+ return t.join(" > ");
75
+ }
76
+ function Kn(e) {
77
+ const t = e.tagName.toLowerCase();
78
+ if (e.id) return `${t}#${e.id}`;
79
+ const n = e.classList[0];
80
+ return n ? `${t}.${n}` : t;
81
+ }
82
+ function Zn(e) {
83
+ const t = [];
84
+ let n = e;
85
+ for (; n; )
86
+ t.unshift(Kn(n)), n = n.parentElement;
87
+ return t.join(" > ");
88
+ }
89
+ function Jn(e) {
90
+ const t = e.getBoundingClientRect();
91
+ return {
92
+ x: Math.round(t.x),
93
+ y: Math.round(t.y),
94
+ width: Math.round(t.width),
95
+ height: Math.round(t.height)
96
+ };
97
+ }
98
+ function Qn(e) {
99
+ return {
100
+ selector: Vt(e),
101
+ domPath: Zn(e),
102
+ tag: e.tagName.toLowerCase(),
103
+ rect: Jn(e)
104
+ };
105
+ }
106
+ function er(e) {
107
+ var t, n;
108
+ const r = (t = e.doc) !== null && t !== void 0 ? t : document, o = (n = e.ignore) !== null && n !== void 0 ? n : Ge;
109
+ let i = null, a = !1;
110
+ function c(h) {
111
+ var f;
112
+ const b = (f = (typeof h.composedPath == "function" ? h.composedPath() : [])[0]) !== null && f !== void 0 ? f : h.target;
113
+ return b instanceof Element ? o(b) ? null : b : null;
114
+ }
115
+ function l(h) {
116
+ var f;
117
+ a || (i = c(h), (f = e.onHover) === null || f === void 0 || f.call(e, i));
118
+ }
119
+ function d(h) {
120
+ var f;
121
+ if (a) return;
122
+ const b = (f = c(h)) !== null && f !== void 0 ? f : i;
123
+ b && (h.preventDefault(), h.stopPropagation(), s(), e.onPick(b));
124
+ }
125
+ function p(h) {
126
+ if (!a && h.key === "Escape") {
127
+ var f;
128
+ h.preventDefault(), s(), (f = e.onCancel) === null || f === void 0 || f.call(e);
129
+ }
130
+ }
131
+ function s() {
132
+ a || (a = !0, r.removeEventListener("mouseover", l, !0), r.removeEventListener("click", d, !0), r.removeEventListener("keydown", p, !0), i = null);
133
+ }
134
+ return r.addEventListener("mouseover", l, !0), r.addEventListener("click", d, !0), r.addEventListener("keydown", p, !0), { stop: s };
135
+ }
136
+ var tr = 7, Xt = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, qt = new RegExp(`\\d{${tr},}`, "g"), nr = /\b(bearer|token)\s+[\w.\-~+/]+=*/gi, rr = /\bhttps?:\/\/[^\s"'<>]+/gi;
137
+ function or(e) {
138
+ return typeof e != "string" || e.length === 0 ? e : e.replace(Xt, "[redacted-email]").replace(nr, (t, n) => `${n} [redacted]`).replace(qt, "[redacted-number]");
139
+ }
140
+ function Ue(e) {
141
+ return e.replace(Xt, "[redacted-email]").replace(qt, "[redacted-number]");
142
+ }
143
+ function H(e) {
144
+ var t;
145
+ if (typeof e != "string" || e.length === 0) return e;
146
+ let n = e;
147
+ n = n.replace(/(^[a-z][a-z0-9+.-]*:\/\/)[^/@?#]*@/i, "$1"), n = n.replace(/\?[^#]*/, ""), n = n.replace(/#.*$/, (a) => a.includes("=") ? "" : a);
148
+ const r = n.match(/^([a-z][a-z0-9+.-]*:\/\/[^/?#]*)([\s\S]*)$/i);
149
+ if (r) return r[1] + Ue((t = r[2]) !== null && t !== void 0 ? t : "");
150
+ const o = n.match(/^(\/\/[^/?#]*)([\s\S]*)$/);
151
+ if (o) {
152
+ var i;
153
+ return o[1] + Ue((i = o[2]) !== null && i !== void 0 ? i : "");
154
+ }
155
+ return Ue(n);
156
+ }
157
+ function ir(e) {
158
+ const t = { ...e };
159
+ return typeof t.url == "string" && (t.url = H(t.url)), typeof t.from == "string" && (t.from = H(t.from)), typeof t.to == "string" && (t.to = H(t.to)), t;
160
+ }
161
+ function ce(e) {
162
+ return or(e.replace(rr, (t) => H(t)));
163
+ }
164
+ function We(e) {
165
+ if (typeof e == "string") return ce(e);
166
+ if (Array.isArray(e)) return e.map(We);
167
+ if (e && typeof e == "object") {
168
+ const t = {};
169
+ for (const [n, r] of Object.entries(e)) t[n] = We(r);
170
+ return t;
171
+ }
172
+ return e;
173
+ }
174
+ function ar(e) {
175
+ switch (e.t) {
176
+ case "string":
177
+ return typeof e.v == "string" ? {
178
+ t: "string",
179
+ v: ce(e.v)
180
+ } : e;
181
+ case "json":
182
+ return {
183
+ t: "json",
184
+ v: We(e.v)
185
+ };
186
+ case "error": {
187
+ if (!e.v || typeof e.v != "object") return e;
188
+ const t = { ...e.v };
189
+ return typeof t.message == "string" && (t.message = ce(t.message)), typeof t.stack == "string" && (t.stack = ce(t.stack)), {
190
+ t: "error",
191
+ v: t
192
+ };
193
+ }
194
+ default:
195
+ return e;
196
+ }
197
+ }
198
+ function sr(e) {
199
+ const t = { ...e };
200
+ return typeof t.message == "string" && (t.message = ce(t.message)), t.data && (t.data = ir(t.data)), typeof t.url == "string" && (t.url = H(t.url)), Array.isArray(t.args) && (t.args = t.args.map(ar)), t;
201
+ }
202
+ function lr(e) {
203
+ const t = { ...e };
204
+ return typeof t.url == "string" && (t.url = H(t.url)), t.trace && t.trace.length > 0 && (t.trace = t.trace.map(sr)), t;
205
+ }
206
+ function Gt(e, t = {}) {
207
+ const n = t.scrub === !1 ? e : lr(e), r = t.hook;
208
+ if (!r) return n;
209
+ try {
210
+ const o = r(n);
211
+ return o != null ? o : null;
212
+ } catch {
213
+ return n;
214
+ }
215
+ }
216
+ var $e = {
217
+ network: 100,
218
+ console: 80,
219
+ breadcrumbs: 40
220
+ }, cr = 18e4, ur = [
221
+ "log",
222
+ "info",
223
+ "warn",
224
+ "error",
225
+ "assert",
226
+ "debug"
227
+ ], Wt = [
228
+ "warn",
229
+ "error",
230
+ "assert"
231
+ ];
232
+ function dr(e) {
233
+ return e !== void 0 && Wt.includes(e);
234
+ }
235
+ var fr = Wt;
236
+ function pr(e) {
237
+ return fr.includes(e);
238
+ }
239
+ function br(e) {
240
+ return e === "console" ? "console" : e === "fetch" || e === "xhr" || e === "beacon" ? "network" : "breadcrumbs";
241
+ }
242
+ function Fe(e, t) {
243
+ return typeof e != "number" || !Number.isFinite(e) || e < 1 ? t : Math.floor(e);
244
+ }
245
+ function Te() {
246
+ return typeof performance != "undefined" && typeof performance.now == "function" ? performance.now() : Date.now();
247
+ }
248
+ function hr() {
249
+ const e = Math.random().toString(36).slice(2, 8);
250
+ let t = 0;
251
+ return () => `${e}${(t++).toString(36)}`;
252
+ }
253
+ var Et = [
254
+ "network",
255
+ "console",
256
+ "breadcrumbs"
257
+ ];
258
+ function mr(e, t) {
259
+ const n = e.length - t;
260
+ if (n <= 0) return e;
261
+ const r = /* @__PURE__ */ new Set();
262
+ for (let o = 0; o < e.length && r.size < n; o += 1) dr(e[o].crumb.level) || r.add(o);
263
+ for (let o = 0; o < e.length && r.size < n; o += 1) r.has(o) || r.add(o);
264
+ return e.filter((o, i) => !r.has(i));
265
+ }
266
+ function vr(e = {}) {
267
+ var t, n, r, o, i, a;
268
+ const c = {
269
+ network: Fe((t = e.budgets) === null || t === void 0 ? void 0 : t.network, $e.network),
270
+ console: Fe((n = e.budgets) === null || n === void 0 ? void 0 : n.console, $e.console),
271
+ breadcrumbs: Fe((r = e.budgets) === null || r === void 0 ? void 0 : r.breadcrumbs, $e.breadcrumbs)
272
+ }, l = e.maxAgeMs === void 0 ? cr : e.maxAgeMs, d = e.beforeBreadcrumb, p = (o = e.now) !== null && o !== void 0 ? o : Date.now, s = (i = e.mono) !== null && i !== void 0 ? i : Te, h = (a = e.nextId) !== null && a !== void 0 ? a : hr(), f = {
273
+ network: [],
274
+ console: [],
275
+ breadcrumbs: []
276
+ };
277
+ let b = 0;
278
+ function m() {
279
+ if (typeof l != "number" || l <= 0) return;
280
+ const u = p() - l;
281
+ for (const y of Et) {
282
+ const g = f[y];
283
+ g.length > 0 && (f[y] = g.filter((v) => v.crumb.timestamp >= u));
284
+ }
285
+ }
286
+ return {
287
+ add(u) {
288
+ var y;
289
+ let g = u;
290
+ if (d) try {
291
+ g = d(u);
292
+ } catch {
293
+ g = u;
294
+ }
295
+ if (!g) return;
296
+ const v = {
297
+ ...g,
298
+ id: (y = g.id) !== null && y !== void 0 ? y : h(),
299
+ timestamp: typeof g.timestamp == "number" ? g.timestamp : p(),
300
+ mono: typeof g.mono == "number" ? g.mono : s()
301
+ }, w = br(v.category);
302
+ f[w].push({
303
+ crumb: v,
304
+ seq: b++
305
+ }), m();
306
+ const S = f[w], k = c[w];
307
+ S.length > k && (f[w] = w === "console" ? mr(S, k) : S.slice(-k));
308
+ },
309
+ snapshot() {
310
+ m();
311
+ const u = [];
312
+ for (const y of Et) u.push(...f[y]);
313
+ return u.sort((y, g) => (typeof y.crumb.mono == "number" ? y.crumb.mono : y.crumb.timestamp) - (typeof g.crumb.mono == "number" ? g.crumb.mono : g.crumb.timestamp) || y.seq - g.seq), u.map((y) => y.crumb);
314
+ },
315
+ clear() {
316
+ f.network = [], f.console = [], f.breadcrumbs = [], b = 0;
317
+ }
318
+ };
319
+ }
320
+ var St = 300, Ye = 2048;
321
+ var nt = 1024;
322
+ var gr = 2048;
323
+ function K(e, t) {
324
+ return e.length > t ? `${e.slice(0, t)}…` : e;
325
+ }
326
+ function Yt(e) {
327
+ if (typeof e == "string") return e;
328
+ if (e instanceof Error) return `${e.name}: ${e.message}`;
329
+ if (e == null || typeof e == "number" || typeof e == "boolean") return String(e);
330
+ try {
331
+ var t;
332
+ return (t = JSON.stringify(e)) !== null && t !== void 0 ? t : String(e);
333
+ } catch {
334
+ return "[object]";
335
+ }
336
+ }
337
+ function yr(e) {
338
+ const t = e.map(Yt).join(" ");
339
+ return t.length > St ? `${t.slice(0, St)}…` : t;
340
+ }
341
+ function Kt(e) {
342
+ var t;
343
+ const n = {
344
+ name: e.name || "Error",
345
+ message: K(String((t = e.message) !== null && t !== void 0 ? t : ""), nt)
346
+ };
347
+ return typeof e.stack == "string" && e.stack.length > 0 && (n.stack = K(e.stack, gr)), n;
348
+ }
349
+ function Ke(e, t, n) {
350
+ if (e === null) return null;
351
+ const r = typeof e;
352
+ if (r === "string") return K(e, nt);
353
+ if (r === "number") return Number.isFinite(e) ? e : String(e);
354
+ if (r === "boolean") return e;
355
+ if (r === "bigint") return `${e.toString()}n`;
356
+ if (r === "symbol") return e.toString();
357
+ if (r === "function") return "[Function]";
358
+ if (r === "undefined") return null;
359
+ const o = e;
360
+ if (e instanceof Error) {
361
+ const { name: i, message: a } = Kt(e);
362
+ return {
363
+ name: i,
364
+ message: a
365
+ };
366
+ }
367
+ if (n.has(o)) return "[Circular]";
368
+ if (t <= 0) return Array.isArray(e) ? "[Array]" : "[Object]";
369
+ n.add(o);
370
+ try {
371
+ if (Array.isArray(e)) {
372
+ const l = e.slice(0, 100).map((d) => Ke(d, t - 1, n));
373
+ return e.length > 100 && l.push(`… ${e.length - 100} more`), l;
374
+ }
375
+ const i = e, a = Object.keys(i), c = {};
376
+ for (const l of a.slice(0, 100)) {
377
+ const d = i[l];
378
+ typeof d == "undefined" || typeof d == "function" || (c[l] = Ke(d, t - 1, n));
379
+ }
380
+ return a.length > 100 && (c["…"] = `${a.length - 100} more`), c;
381
+ } finally {
382
+ n.delete(o);
383
+ }
384
+ }
385
+ function wr(e) {
386
+ if (e == null) return {
387
+ t: "null",
388
+ v: null
389
+ };
390
+ const t = typeof e;
391
+ return t === "string" ? {
392
+ t: "string",
393
+ v: K(e, nt)
394
+ } : t === "number" ? Number.isFinite(e) ? {
395
+ t: "number",
396
+ v: e
397
+ } : {
398
+ t: "string",
399
+ v: String(e)
400
+ } : t === "boolean" ? {
401
+ t: "bool",
402
+ v: e
403
+ } : t === "bigint" ? {
404
+ t: "string",
405
+ v: `${e.toString()}n`
406
+ } : t === "symbol" ? {
407
+ t: "string",
408
+ v: e.toString()
409
+ } : t === "function" ? {
410
+ t: "string",
411
+ v: "[Function]"
412
+ } : e instanceof Error ? {
413
+ t: "error",
414
+ v: Kt(e)
415
+ } : {
416
+ t: "json",
417
+ v: Ke(e, 4, /* @__PURE__ */ new Set())
418
+ };
419
+ }
420
+ function Oe(e) {
421
+ try {
422
+ var t;
423
+ const n = (t = JSON.stringify(e)) !== null && t !== void 0 ? t : "";
424
+ return typeof TextEncoder != "undefined" ? new TextEncoder().encode(n).length : n.length;
425
+ } catch {
426
+ return Number.POSITIVE_INFINITY;
427
+ }
428
+ }
429
+ function xr(e) {
430
+ if (Oe(e) <= 4096) return e;
431
+ let t = e.slice();
432
+ for (; t.length > 1 && Oe(t) > 4096; ) t = t.slice(0, -1);
433
+ return t.length === 1 && Oe(t) > 4096 ? [{
434
+ t: "string",
435
+ v: "[trace: console argument omitted (too large)]"
436
+ }] : t;
437
+ }
438
+ function Tt(e, t, n, r) {
439
+ const o = xr(t.map(wr));
440
+ return {
441
+ category: "console",
442
+ level: e,
443
+ message: yr(t),
444
+ timestamp: n,
445
+ ...o.length > 0 ? { args: o } : {},
446
+ ...r ? { source: r } : {}
447
+ };
448
+ }
449
+ function kr(e, t, n) {
450
+ const r = K(H(e), Ye), o = K(H(t), Ye);
451
+ return {
452
+ category: "navigation",
453
+ message: `${r} → ${o}`,
454
+ timestamp: n,
455
+ data: {
456
+ from: r,
457
+ to: o
458
+ }
459
+ };
460
+ }
461
+ function Ze(e) {
462
+ return typeof e != "number" || e <= 0 ? "network-error" : e >= 500 ? "http-5xx" : e >= 400 ? "http-4xx" : "ok";
463
+ }
464
+ function rt(e) {
465
+ if (typeof e == "string") return Er(e);
466
+ if (typeof Blob != "undefined" && e instanceof Blob) return e.size;
467
+ if (typeof ArrayBuffer != "undefined" && (e instanceof ArrayBuffer || ArrayBuffer.isView(e)))
468
+ return e.byteLength;
469
+ }
470
+ function Er(e) {
471
+ try {
472
+ return typeof TextEncoder != "undefined" ? new TextEncoder().encode(e).length : e.length;
473
+ } catch {
474
+ return e.length;
475
+ }
476
+ }
477
+ function Zt(e) {
478
+ if (typeof e != "string") return;
479
+ const t = Number.parseInt(e, 10);
480
+ return Number.isFinite(t) && t >= 0 ? t : void 0;
481
+ }
482
+ function Jt(e) {
483
+ var t;
484
+ if (typeof e != "string" || e.length === 0) return;
485
+ const n = (t = e.split(";")[0]) === null || t === void 0 ? void 0 : t.trim();
486
+ return n && n.length > 0 ? n : void 0;
487
+ }
488
+ function xe(e, t) {
489
+ const n = K(H(e.url), Ye), r = typeof e.status == "number" && e.status > 0, o = r ? ` → ${e.status}` : "", i = e.outcome !== "ok" ? ` (${e.outcome})` : "";
490
+ return {
491
+ category: e.api,
492
+ api: e.api,
493
+ method: e.method,
494
+ url: n,
495
+ message: `${e.method} ${n}${o}${i}`,
496
+ timestamp: t,
497
+ ...r ? { status: e.status } : {},
498
+ ...e.statusText ? { statusText: e.statusText } : {},
499
+ ...typeof e.durationMs == "number" ? { durationMs: e.durationMs } : {},
500
+ ...typeof e.reqSize == "number" ? { reqSize: e.reqSize } : {},
501
+ ...typeof e.respSize == "number" ? { respSize: e.respSize } : {},
502
+ ...e.contentType ? { contentType: e.contentType } : {},
503
+ outcome: e.outcome
504
+ };
505
+ }
506
+ function Qt(e) {
507
+ try {
508
+ return Vt(e);
509
+ } catch {
510
+ return e.tagName ? e.tagName.toLowerCase() : "unknown";
511
+ }
512
+ }
513
+ function Sr(e, t) {
514
+ const n = Qt(e);
515
+ return {
516
+ category: "ui.click",
517
+ message: `click ${n}`,
518
+ timestamp: t,
519
+ data: { target: n }
520
+ };
521
+ }
522
+ function Tr(e, t) {
523
+ const n = Qt(e);
524
+ return {
525
+ category: "ui.input",
526
+ message: `input ${n}`,
527
+ timestamp: t,
528
+ data: { target: n }
529
+ };
530
+ }
531
+ function Cr(e) {
532
+ return e instanceof Error ? {
533
+ name: e.name || "Error",
534
+ message: e.message
535
+ } : typeof e == "string" ? {
536
+ name: "Error",
537
+ message: e
538
+ } : {
539
+ name: "Error",
540
+ message: Yt(e)
541
+ };
542
+ }
543
+ function _r(e, t, n) {
544
+ const { name: r, message: o } = Cr(e), i = {
545
+ category: "error",
546
+ level: "error",
547
+ message: o ? `${r}: ${o}` : r,
548
+ timestamp: t,
549
+ data: { errorType: r }
550
+ };
551
+ return n && n.length > 0 ? {
552
+ ...i,
553
+ causedBy: n
554
+ } : i;
555
+ }
556
+ function Ce() {
557
+ }
558
+ function Ar(e) {
559
+ var t, n;
560
+ let r;
561
+ const o = e.match(/^at\s+.+?\s+\((.+)\)$/);
562
+ if (o) r = o[1];
563
+ else {
564
+ const l = e.match(/^at\s+(.+)$/);
565
+ if (l) r = l[1];
566
+ else {
567
+ const d = e.indexOf("@");
568
+ d >= 0 && (r = e.slice(d + 1));
569
+ }
570
+ }
571
+ if (!r) return;
572
+ r = r.replace(/\?[^:]*/, "");
573
+ const i = (t = r.match(/^(.*):(\d+):\d+$/)) !== null && t !== void 0 ? t : r.match(/^(.*):(\d+)$/);
574
+ if (!i) return;
575
+ const a = (n = i[1]) !== null && n !== void 0 ? n : "", c = Number(i[2]);
576
+ if (!(!a || !Number.isFinite(c)))
577
+ return {
578
+ file: a,
579
+ line: c
580
+ };
581
+ }
582
+ function Lr(e, t = 0) {
583
+ if (typeof e != "string" || e.length === 0) return;
584
+ const n = [];
585
+ for (const r of e.split(`
586
+ `)) {
587
+ const o = Ar(r.trim());
588
+ o && n.push(o);
589
+ }
590
+ return n[t];
591
+ }
592
+ var Nr = 1;
593
+ function Ir(e, t, n, r) {
594
+ const o = [];
595
+ for (const i of n) {
596
+ const a = t[i];
597
+ if (typeof a != "function") continue;
598
+ const c = pr(i), l = (...d) => {
599
+ let p;
600
+ if (c) try {
601
+ p = Lr((/* @__PURE__ */ new Error()).stack, Nr);
602
+ } catch {
603
+ p = void 0;
604
+ }
605
+ try {
606
+ i === "assert" ? d[0] || e.add(Tt("assert", d.slice(1), r(), p)) : e.add(Tt(i, d, r(), p));
607
+ } catch {
608
+ }
609
+ return a.apply(t, d);
610
+ };
611
+ t[i] = l, o.push(() => {
612
+ t[i] = a;
613
+ });
614
+ }
615
+ return () => {
616
+ for (const i of o) i();
617
+ };
618
+ }
619
+ function Rr(e) {
620
+ return typeof e == "string" ? e : e instanceof URL ? e.toString() : e.url;
621
+ }
622
+ function Mr(e, t) {
623
+ var n, r;
624
+ return ((n = (r = t == null ? void 0 : t.method) !== null && r !== void 0 ? r : typeof e == "object" && "method" in e ? e.method : void 0) !== null && n !== void 0 ? n : "GET").toUpperCase();
625
+ }
626
+ function Ct(e, t) {
627
+ try {
628
+ var n, r, o;
629
+ return (n = (r = e.headers) === null || r === void 0 || (o = r.get) === null || o === void 0 ? void 0 : o.call(r, t)) !== null && n !== void 0 ? n : null;
630
+ } catch {
631
+ return null;
632
+ }
633
+ }
634
+ function Dr(e) {
635
+ return e.type === "opaque" || e.type === "opaqueredirect" ? "opaque-cors" : Ze(e.status);
636
+ }
637
+ function Pr(e) {
638
+ const t = typeof e == "object" && e !== null && "name" in e ? String(e.name) : "";
639
+ return t === "AbortError" ? "aborted" : t === "TimeoutError" ? "timeout" : "network-error";
640
+ }
641
+ function Br(e, t, n, r, o = Te) {
642
+ const i = t.fetch;
643
+ if (typeof i != "function") return Ce;
644
+ const a = (c, l) => {
645
+ const d = Rr(c), p = Mr(c, l), s = rt(l == null ? void 0 : l.body), h = o(), f = i.call(t, c, l);
646
+ return n(d) ? f : f.then((b) => {
647
+ try {
648
+ e.add(xe({
649
+ api: "fetch",
650
+ method: p,
651
+ url: d,
652
+ status: b.status || void 0,
653
+ statusText: b.statusText || void 0,
654
+ durationMs: Math.max(0, o() - h),
655
+ reqSize: s,
656
+ respSize: Zt(Ct(b, "content-length")),
657
+ contentType: Jt(Ct(b, "content-type")),
658
+ outcome: Dr(b)
659
+ }, r()));
660
+ } catch {
661
+ }
662
+ return b;
663
+ }, (b) => {
664
+ try {
665
+ e.add(xe({
666
+ api: "fetch",
667
+ method: p,
668
+ url: d,
669
+ durationMs: Math.max(0, o() - h),
670
+ reqSize: s,
671
+ outcome: Pr(b)
672
+ }, r()));
673
+ } catch {
674
+ }
675
+ throw b;
676
+ });
677
+ };
678
+ return t.fetch = a, () => {
679
+ t.fetch = i;
680
+ };
681
+ }
682
+ function _t(e, t) {
683
+ try {
684
+ return typeof e.getResponseHeader == "function" ? e.getResponseHeader(t) : null;
685
+ } catch {
686
+ return null;
687
+ }
688
+ }
689
+ function Ur(e) {
690
+ try {
691
+ return e.statusText || void 0;
692
+ } catch {
693
+ return;
694
+ }
695
+ }
696
+ function $r(e, t, n, r, o = Te) {
697
+ const i = t.XMLHttpRequest;
698
+ if (typeof i != "function") return Ce;
699
+ const a = i.prototype, c = a.open, l = a.send;
700
+ return a.open = function(d, p, ...s) {
701
+ return this.__fixbackMeta = {
702
+ method: String(d).toUpperCase(),
703
+ url: String(p)
704
+ }, c.call(this, d, p, ...s);
705
+ }, a.send = function(d) {
706
+ const p = this.__fixbackMeta;
707
+ if (p && !n(p.url)) {
708
+ const s = o(), h = rt(d);
709
+ let f;
710
+ const b = () => {
711
+ f = Ze(this.status || void 0);
712
+ }, m = () => {
713
+ f = "network-error";
714
+ }, u = () => {
715
+ f = "timeout";
716
+ }, y = () => {
717
+ f = "aborted";
718
+ }, g = () => {
719
+ try {
720
+ var v;
721
+ e.add(xe({
722
+ api: "xhr",
723
+ method: p.method,
724
+ url: p.url,
725
+ status: this.status || void 0,
726
+ statusText: Ur(this),
727
+ durationMs: Math.max(0, o() - s),
728
+ reqSize: h,
729
+ respSize: Zt(_t(this, "content-length")),
730
+ contentType: Jt(_t(this, "content-type")),
731
+ outcome: (v = f) !== null && v !== void 0 ? v : Ze(this.status || void 0)
732
+ }, r()));
733
+ } catch {
734
+ }
735
+ this.removeEventListener("load", b), this.removeEventListener("error", m), this.removeEventListener("timeout", u), this.removeEventListener("abort", y), this.removeEventListener("loadend", g);
736
+ };
737
+ this.addEventListener("load", b), this.addEventListener("error", m), this.addEventListener("timeout", u), this.addEventListener("abort", y), this.addEventListener("loadend", g);
738
+ }
739
+ return l.call(this, d);
740
+ }, () => {
741
+ a.open = c, a.send = l;
742
+ };
743
+ }
744
+ function Fr(e, t, n, r) {
745
+ const o = t.navigator;
746
+ if (!o || typeof o.sendBeacon != "function") return Ce;
747
+ const i = o.sendBeacon, a = (l, d, p) => {
748
+ if (!n(l))
749
+ try {
750
+ e.add(xe({
751
+ api: "beacon",
752
+ method: "POST",
753
+ url: l,
754
+ reqSize: rt(d),
755
+ outcome: p
756
+ }, r()));
757
+ } catch {
758
+ }
759
+ }, c = function(l, d) {
760
+ const p = typeof l == "string" ? l : String(l);
761
+ let s;
762
+ try {
763
+ s = i.call(o, l, d);
764
+ } catch (h) {
765
+ throw a(p, d, "network-error"), h;
766
+ }
767
+ return a(p, d, s ? "ok" : "network-error"), s;
768
+ };
769
+ return o.sendBeacon = c, () => {
770
+ o.sendBeacon = i;
771
+ };
772
+ }
773
+ function Or(e, t, n) {
774
+ const r = t.history, o = t.location;
775
+ if (!r || !o) return Ce;
776
+ let i = o.href;
777
+ const a = (s) => {
778
+ try {
779
+ e.add(kr(i, s, n()));
780
+ } catch {
781
+ }
782
+ i = s;
783
+ }, c = r.pushState, l = r.replaceState;
784
+ r.pushState = function(s, h, f) {
785
+ const b = c.call(this, s, h, f);
786
+ return a(o.href), b;
787
+ }, r.replaceState = function(s, h, f) {
788
+ const b = l.call(this, s, h, f);
789
+ return a(o.href), b;
790
+ };
791
+ const d = () => a(o.href), p = () => a(o.href);
792
+ return t.addEventListener("popstate", d), t.addEventListener("hashchange", p), () => {
793
+ r.pushState = c, r.replaceState = l, t.removeEventListener("popstate", d), t.removeEventListener("hashchange", p);
794
+ };
795
+ }
796
+ function At(e) {
797
+ var t;
798
+ const n = (t = (typeof e.composedPath == "function" ? e.composedPath() : [])[0]) !== null && t !== void 0 ? t : e.target;
799
+ return n instanceof Element ? n : null;
800
+ }
801
+ function zr(e, t, n) {
802
+ const r = (i) => {
803
+ const a = At(i);
804
+ if (!(!a || Ge(a)))
805
+ try {
806
+ e.add(Sr(a, n()));
807
+ } catch {
808
+ }
809
+ }, o = (i) => {
810
+ const a = At(i);
811
+ if (!(!a || Ge(a)))
812
+ try {
813
+ e.add(Tr(a, n()));
814
+ } catch {
815
+ }
816
+ };
817
+ return t.addEventListener("click", r, !0), t.addEventListener("input", o, !0), () => {
818
+ t.removeEventListener("click", r, !0), t.removeEventListener("input", o, !0);
819
+ };
820
+ }
821
+ function jr(e, t = {}) {
822
+ var n, r, o, i, a, c, l;
823
+ const d = (n = t.win) !== null && n !== void 0 ? n : globalThis, p = (r = t.doc) !== null && r !== void 0 ? r : typeof document != "undefined" ? document : void 0, s = (o = t.consoleObj) !== null && o !== void 0 ? o : typeof console != "undefined" ? console : void 0, h = (i = t.consoleLevels) !== null && i !== void 0 ? i : ur, f = (a = t.ignoreUrl) !== null && a !== void 0 ? a : (() => !1), b = (c = t.now) !== null && c !== void 0 ? c : Date.now, m = (l = t.mono) !== null && l !== void 0 ? l : Te, u = t.captureConsole !== !1, y = t.captureNetwork !== !1, g = [];
824
+ return s && u && g.push(Ir(e, s, h, b)), d && (y && (g.push(Br(e, d, f, b, m)), g.push($r(e, d, f, b, m)), g.push(Fr(e, d, f, b))), g.push(Or(e, d, b))), p && g.push(zr(e, p, b)), () => {
825
+ for (const v of g) try {
826
+ v();
827
+ } catch {
828
+ }
829
+ };
830
+ }
831
+ var Hr = "#e5484d";
832
+ function Lt(e, t, n, r) {
833
+ return {
834
+ x: Math.round(Math.min(e, n)),
835
+ y: Math.round(Math.min(t, r)),
836
+ width: Math.round(Math.abs(n - e)),
837
+ height: Math.round(Math.abs(r - t))
838
+ };
839
+ }
840
+ function Vr(e, t, n, r, o = 14) {
841
+ const i = Math.atan2(r - t, n - e);
842
+ return [
843
+ {
844
+ x: n,
845
+ y: r
846
+ },
847
+ {
848
+ x: n - o * Math.cos(i - Math.PI / 6),
849
+ y: r - o * Math.sin(i - Math.PI / 6)
850
+ },
851
+ {
852
+ x: n - o * Math.cos(i + Math.PI / 6),
853
+ y: r - o * Math.sin(i + Math.PI / 6)
854
+ }
855
+ ];
856
+ }
857
+ function Xr(e) {
858
+ const t = {};
859
+ return e.element && (t.element = e.element), e.region && (t.region = e.region), e.marks && e.marks.length > 0 && (t.marks = e.marks.slice()), Object.keys(t).length > 0 ? t : void 0;
860
+ }
861
+ function en(e, t) {
862
+ var n;
863
+ const r = {}, o = e.innerWidth;
864
+ typeof o == "number" && o > 0 && (r.viewportWidth = Math.round(o));
865
+ const i = e.innerHeight;
866
+ typeof i == "number" && i > 0 && (r.viewportHeight = Math.round(i));
867
+ const a = (n = e.navigator) === null || n === void 0 ? void 0 : n.userAgent;
868
+ return typeof a == "string" && a.length > 0 && (r.browser = a), t.length > 0 && (r.sdkVersion = t), r;
869
+ }
870
+ function tn(e) {
871
+ var t;
872
+ const n = {};
873
+ e.kind && (n.kind = e.kind);
874
+ const r = (t = e.comment) === null || t === void 0 ? void 0 : t.trim();
875
+ r && (n.comment = r), e.url && (n.url = e.url), e.environment && Object.keys(e.environment).length > 0 && (n.environment = e.environment);
876
+ const o = Xr({
877
+ element: e.element,
878
+ region: e.region,
879
+ marks: e.marks
880
+ });
881
+ return o && (n.annotation = o), e.trace && e.trace.length > 0 && (n.trace = e.trace), n;
882
+ }
883
+ var ze;
884
+ function qr(e, t) {
885
+ return e[13] = 1, e[14] = t >> 8, e[15] = t & 255, e[16] = t >> 8, e[17] = t & 255, e;
886
+ }
887
+ var nn = 112, rn = 72, on = 89, an = 115, je;
888
+ function Gr() {
889
+ const e = /* @__PURE__ */ new Int32Array(256);
890
+ for (let t = 0; t < 256; t++) {
891
+ let n = t;
892
+ for (let r = 0; r < 8; r++) n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
893
+ e[t] = n;
894
+ }
895
+ return e;
896
+ }
897
+ function Wr(e) {
898
+ let t = -1;
899
+ je || (je = Gr());
900
+ for (let n = 0; n < e.length; n++) t = je[(t ^ e[n]) & 255] ^ t >>> 8;
901
+ return t ^ -1;
902
+ }
903
+ function Yr(e) {
904
+ const t = e.length - 1;
905
+ for (let n = t; n >= 4; n--) if (e[n - 4] === 9 && e[n - 3] === nn && e[n - 2] === rn && e[n - 1] === on && e[n] === an) return n - 3;
906
+ return 0;
907
+ }
908
+ function Kr(e, t, n = !1) {
909
+ const r = /* @__PURE__ */ new Uint8Array(13);
910
+ t *= 39.3701, r[0] = nn, r[1] = rn, r[2] = on, r[3] = an, r[4] = t >>> 24, r[5] = t >>> 16, r[6] = t >>> 8, r[7] = t & 255, r[8] = r[4], r[9] = r[5], r[10] = r[6], r[11] = r[7], r[12] = 1;
911
+ const o = Wr(r), i = /* @__PURE__ */ new Uint8Array(4);
912
+ if (i[0] = o >>> 24, i[1] = o >>> 16, i[2] = o >>> 8, i[3] = o & 255, n) {
913
+ const a = Yr(e);
914
+ return e.set(r, a), e.set(i, a + 13), e;
915
+ } else {
916
+ const a = /* @__PURE__ */ new Uint8Array(4);
917
+ a[0] = 0, a[1] = 0, a[2] = 0, a[3] = 9;
918
+ const c = /* @__PURE__ */ new Uint8Array(54);
919
+ return c.set(e, 0), c.set(a, 33), c.set(r, 37), c.set(i, 50), c;
920
+ }
921
+ }
922
+ var sn = "[modern-screenshot]", G = typeof window != "undefined", Zr = G && "Worker" in window, Jr = G && "atob" in window, Ba = G && "btoa" in window, ot = G ? (ze = window.navigator) === null || ze === void 0 ? void 0 : ze.userAgent : "", ln = ot.includes("Chrome"), ke = ot.includes("AppleWebKit") && !ln, it = ot.includes("Firefox"), Qr = (e) => e && "__CONTEXT__" in e, eo = (e) => e.constructor.name === "CSSFontFaceRule", to = (e) => e.constructor.name === "CSSImportRule", no = (e) => e.constructor.name === "CSSLayerBlockRule", z = (e) => e.nodeType === 1, be = (e) => typeof e.className == "object", cn = (e) => e.tagName === "image", ro = (e) => e.tagName === "use", ue = (e) => z(e) && typeof e.style != "undefined" && !be(e), oo = (e) => e.nodeType === 8, io = (e) => e.nodeType === 3, re = (e) => e.tagName === "IMG", _e = (e) => e.tagName === "VIDEO", ao = (e) => e.tagName === "CANVAS", so = (e) => e.tagName === "TEXTAREA", lo = (e) => e.tagName === "INPUT", co = (e) => e.tagName === "STYLE", uo = (e) => e.tagName === "SCRIPT", fo = (e) => e.tagName === "SELECT", po = (e) => e.tagName === "SLOT", bo = (e) => e.tagName === "IFRAME", ho = (...e) => console.warn(sn, ...e);
923
+ function mo(e) {
924
+ var t;
925
+ const n = e == null || (t = e.createElement) === null || t === void 0 ? void 0 : t.call(e, "canvas");
926
+ return n && (n.height = n.width = 1), !!n && "toDataURL" in n && !!n.toDataURL("image/webp").includes("image/webp");
927
+ }
928
+ var Je = (e) => e.startsWith("data:");
929
+ function un(e, t) {
930
+ if (e.match(/^[a-z]+:\/\//i)) return e;
931
+ if (G && e.match(/^\/\//)) return window.location.protocol + e;
932
+ if (e.match(/^[a-z]+:/i) || !G) return e;
933
+ const n = Ae().implementation.createHTMLDocument(), r = n.createElement("base"), o = n.createElement("a");
934
+ return n.head.appendChild(r), n.body.appendChild(o), t && (r.href = t), o.href = e, o.href;
935
+ }
936
+ function Ae(e) {
937
+ var t;
938
+ return (t = e && z(e) ? e == null ? void 0 : e.ownerDocument : e) !== null && t !== void 0 ? t : window.document;
939
+ }
940
+ var Le = "http://www.w3.org/2000/svg";
941
+ function vo(e, t, n) {
942
+ const r = Ae(n).createElementNS(Le, "svg");
943
+ return r.setAttributeNS(null, "width", e.toString()), r.setAttributeNS(null, "height", t.toString()), r.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), r;
944
+ }
945
+ function go(e, t) {
946
+ let n = new XMLSerializer().serializeToString(e);
947
+ return t && (n = n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
948
+ }
949
+ async function yo(e, t = "image/png", n = 1) {
950
+ try {
951
+ return await new Promise((r, o) => {
952
+ e.toBlob((i) => {
953
+ i ? r(i) : o(/* @__PURE__ */ new Error("Blob is null"));
954
+ }, t, n);
955
+ });
956
+ } catch (r) {
957
+ if (Jr) return wo(e.toDataURL(t, n));
958
+ throw r;
959
+ }
960
+ }
961
+ function wo(e) {
962
+ var t, n;
963
+ const [r, o] = e.split(","), i = (t = (n = r.match(/data:(.+);/)) === null || n === void 0 ? void 0 : n[1]) !== null && t !== void 0 ? t : void 0, a = window.atob(o), c = a.length, l = new Uint8Array(c);
964
+ for (let d = 0; d < c; d += 1) l[d] = a.charCodeAt(d);
965
+ return new Blob([l], { type: i });
966
+ }
967
+ function dn(e, t) {
968
+ return new Promise((n, r) => {
969
+ const o = new FileReader();
970
+ o.onload = () => n(o.result), o.onerror = () => r(o.error), o.onabort = () => r(/* @__PURE__ */ new Error(`Failed read blob to ${t}`)), t === "dataUrl" ? o.readAsDataURL(e) : t === "arrayBuffer" && o.readAsArrayBuffer(e);
971
+ });
972
+ }
973
+ var xo = (e) => dn(e, "dataUrl"), ko = (e) => dn(e, "arrayBuffer");
974
+ function ne(e, t) {
975
+ const n = Ae(t).createElement("img");
976
+ return n.decoding = "sync", n.loading = "eager", n.src = e, n;
977
+ }
978
+ function de(e, t) {
979
+ return new Promise((n) => {
980
+ const { timeout: r, ownerDocument: o, onError: i, onWarn: a } = t != null ? t : {}, c = typeof e == "string" ? ne(e, Ae(o)) : e;
981
+ let l = null, d = null;
982
+ function p() {
983
+ n(c), l && clearTimeout(l), d == null || d();
984
+ }
985
+ if (r && (l = setTimeout(p, r)), _e(c)) {
986
+ const s = c.currentSrc || c.src;
987
+ if (!s)
988
+ return c.poster ? de(c.poster, t).then(n) : p();
989
+ if (c.readyState >= 2) return p();
990
+ const h = p, f = (b) => {
991
+ a == null || a("Failed video load", s, b), i == null || i(b), p();
992
+ };
993
+ d = () => {
994
+ c.removeEventListener("loadeddata", h), c.removeEventListener("error", f);
995
+ }, c.addEventListener("loadeddata", h, { once: !0 }), c.addEventListener("error", f, { once: !0 });
996
+ } else {
997
+ const s = cn(c) ? c.href.baseVal : c.currentSrc || c.src;
998
+ if (!s) return p();
999
+ const h = async () => {
1000
+ if (re(c) && "decode" in c) try {
1001
+ await c.decode();
1002
+ } catch (b) {
1003
+ a == null || a("Failed to decode image, trying to render anyway", c.dataset.originalSrc || s, b);
1004
+ }
1005
+ p();
1006
+ }, f = (b) => {
1007
+ a == null || a("Failed image load", c.dataset.originalSrc || s, b), p();
1008
+ };
1009
+ if (re(c) && c.complete) return h();
1010
+ d = () => {
1011
+ c.removeEventListener("load", h), c.removeEventListener("error", f);
1012
+ }, c.addEventListener("load", h, { once: !0 }), c.addEventListener("error", f, { once: !0 });
1013
+ }
1014
+ });
1015
+ }
1016
+ async function Eo(e, t) {
1017
+ ue(e) && (re(e) || _e(e) ? await de(e, t) : await Promise.all(["img", "video"].flatMap((n) => Array.from(e.querySelectorAll(n)).map((r) => de(r, t)))));
1018
+ }
1019
+ var fn = /* @__PURE__ */ (function() {
1020
+ let t = 0;
1021
+ const n = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
1022
+ return () => (t += 1, `u${n()}${t}`);
1023
+ })();
1024
+ function pn(e) {
1025
+ return e == null ? void 0 : e.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
1026
+ }
1027
+ var Nt = 0;
1028
+ function So(e) {
1029
+ const t = `${sn}[#${Nt}]`;
1030
+ return Nt++, {
1031
+ time: (n) => e && console.time(`${t} ${n}`),
1032
+ timeEnd: (n) => e && console.timeEnd(`${t} ${n}`),
1033
+ warn: (...n) => e && ho(...n)
1034
+ };
1035
+ }
1036
+ function To(e) {
1037
+ return { cache: e ? "no-cache" : "force-cache" };
1038
+ }
1039
+ async function at(e, t) {
1040
+ return Qr(e) ? e : Co(e, {
1041
+ ...t,
1042
+ autoDestruct: !0
1043
+ });
1044
+ }
1045
+ async function Co(e, t) {
1046
+ var n, r, o, i, a;
1047
+ const { scale: c = 1, workerUrl: l, workerNumber: d = 1 } = t || {}, p = !!(t != null && t.debug), s = (n = t == null ? void 0 : t.features) !== null && n !== void 0 ? n : !0, h = (r = e.ownerDocument) !== null && r !== void 0 ? r : G ? window.document : void 0, f = (o = (i = e.ownerDocument) === null || i === void 0 ? void 0 : i.defaultView) !== null && o !== void 0 ? o : G ? window : void 0, b = /* @__PURE__ */ new Map(), m = {
1048
+ width: 0,
1049
+ height: 0,
1050
+ quality: 1,
1051
+ type: "image/png",
1052
+ scale: c,
1053
+ backgroundColor: null,
1054
+ style: null,
1055
+ filter: null,
1056
+ maximumCanvasSize: 0,
1057
+ timeout: 3e4,
1058
+ progress: null,
1059
+ debug: p,
1060
+ fetch: {
1061
+ requestInit: To(t == null || (a = t.fetch) === null || a === void 0 ? void 0 : a.bypassingCache),
1062
+ placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
1063
+ bypassingCache: !1,
1064
+ ...t == null ? void 0 : t.fetch
1065
+ },
1066
+ fetchFn: null,
1067
+ font: {},
1068
+ drawImageInterval: 100,
1069
+ workerUrl: null,
1070
+ workerNumber: d,
1071
+ onCloneEachNode: null,
1072
+ onCloneNode: null,
1073
+ onEmbedNode: null,
1074
+ onCreateForeignObjectSvg: null,
1075
+ includeStyleProperties: null,
1076
+ autoDestruct: !1,
1077
+ ...t,
1078
+ __CONTEXT__: !0,
1079
+ log: So(p),
1080
+ node: e,
1081
+ ownerDocument: h,
1082
+ ownerWindow: f,
1083
+ dpi: c === 1 ? null : 96 * c,
1084
+ svgStyleElement: bn(h),
1085
+ svgDefsElement: h == null ? void 0 : h.createElementNS(Le, "defs"),
1086
+ svgStyles: /* @__PURE__ */ new Map(),
1087
+ defaultComputedStyles: /* @__PURE__ */ new Map(),
1088
+ workers: [...Array.from({ length: Zr && l && d ? d : 0 })].map(() => {
1089
+ try {
1090
+ const g = new Worker(l);
1091
+ return g.onmessage = async (v) => {
1092
+ const { url: w, result: S } = v.data;
1093
+ if (S) {
1094
+ var k, N;
1095
+ (k = b.get(w)) === null || k === void 0 || (N = k.resolve) === null || N === void 0 || N.call(k, S);
1096
+ } else {
1097
+ var T, B;
1098
+ (T = b.get(w)) === null || T === void 0 || (B = T.reject) === null || B === void 0 || B.call(T, /* @__PURE__ */ new Error(`Error receiving message from worker: ${w}`));
1099
+ }
1100
+ }, g.onmessageerror = (v) => {
1101
+ var w, S;
1102
+ const { url: k } = v.data;
1103
+ (w = b.get(k)) === null || w === void 0 || (S = w.reject) === null || S === void 0 || S.call(w, /* @__PURE__ */ new Error(`Error receiving message from worker: ${k}`));
1104
+ }, g;
1105
+ } catch (g) {
1106
+ return m.log.warn("Failed to new Worker", g), null;
1107
+ }
1108
+ }).filter(Boolean),
1109
+ fontFamilies: /* @__PURE__ */ new Map(),
1110
+ fontCssTexts: /* @__PURE__ */ new Map(),
1111
+ acceptOfImage: `${[
1112
+ mo(h) && "image/webp",
1113
+ "image/svg+xml",
1114
+ "image/*",
1115
+ "*/*"
1116
+ ].filter(Boolean).join(",")};q=0.8`,
1117
+ requests: b,
1118
+ drawImageCount: 0,
1119
+ tasks: [],
1120
+ features: s,
1121
+ isEnable: (g) => {
1122
+ var v;
1123
+ if (g === "restoreScrollPosition") {
1124
+ var w;
1125
+ return typeof s == "boolean" ? !1 : (w = s[g]) !== null && w !== void 0 ? w : !1;
1126
+ }
1127
+ return typeof s == "boolean" ? s : (v = s[g]) !== null && v !== void 0 ? v : !0;
1128
+ },
1129
+ shadowRoots: []
1130
+ };
1131
+ m.log.time("wait until load"), await Eo(e, {
1132
+ timeout: m.timeout,
1133
+ onWarn: m.log.warn
1134
+ }), m.log.timeEnd("wait until load");
1135
+ const { width: u, height: y } = _o(e, m);
1136
+ return m.width = u, m.height = y, m;
1137
+ }
1138
+ function bn(e) {
1139
+ if (!e) return;
1140
+ const t = e.createElement("style"), n = t.ownerDocument.createTextNode(`
1141
+ .______background-clip--text {
1142
+ background-clip: text;
1143
+ -webkit-background-clip: text;
1144
+ }
1145
+ `);
1146
+ return t.appendChild(n), t;
1147
+ }
1148
+ function _o(e, t) {
1149
+ let { width: n, height: r } = t;
1150
+ if (z(e) && (!n || !r)) {
1151
+ const o = e.getBoundingClientRect();
1152
+ n = n || o.width || Number(e.getAttribute("width")) || 0, r = r || o.height || Number(e.getAttribute("height")) || 0;
1153
+ }
1154
+ return {
1155
+ width: n,
1156
+ height: r
1157
+ };
1158
+ }
1159
+ async function Ao(e, t) {
1160
+ const { log: n, timeout: r, drawImageCount: o, drawImageInterval: i } = t;
1161
+ n.time("image to canvas");
1162
+ const a = await de(e, {
1163
+ timeout: r,
1164
+ onWarn: t.log.warn
1165
+ }), { canvas: c, context2d: l } = Lo(e.ownerDocument, t), d = () => {
1166
+ try {
1167
+ l == null || l.drawImage(a, 0, 0, c.width, c.height);
1168
+ } catch (p) {
1169
+ t.log.warn("Failed to drawImage", p);
1170
+ }
1171
+ };
1172
+ if (d(), t.isEnable("fixSvgXmlDecode")) for (let p = 0; p < o; p++) await new Promise((s) => {
1173
+ setTimeout(() => {
1174
+ l == null || l.clearRect(0, 0, c.width, c.height), d(), s();
1175
+ }, p + i);
1176
+ });
1177
+ return t.drawImageCount = 0, n.timeEnd("image to canvas"), c;
1178
+ }
1179
+ function Lo(e, t) {
1180
+ const { width: n, height: r, scale: o, backgroundColor: i, maximumCanvasSize: a } = t, c = e.createElement("canvas");
1181
+ c.width = Math.floor(n * o), c.height = Math.floor(r * o), c.style.width = `${n}px`, c.style.height = `${r}px`, a && (c.width > a || c.height > a) && (c.width > a && c.height > a ? c.width > c.height ? (c.height *= a / c.width, c.width = a) : (c.width *= a / c.height, c.height = a) : c.width > a ? (c.height *= a / c.width, c.width = a) : (c.width *= a / c.height, c.height = a));
1182
+ const l = c.getContext("2d");
1183
+ return l && i && (l.fillStyle = i, l.fillRect(0, 0, c.width, c.height)), {
1184
+ canvas: c,
1185
+ context2d: l
1186
+ };
1187
+ }
1188
+ function hn(e, t) {
1189
+ if (e.ownerDocument) try {
1190
+ const i = e.toDataURL();
1191
+ if (i !== "data:,") return ne(i, e.ownerDocument);
1192
+ } catch (i) {
1193
+ t.log.warn("Failed to clone canvas", i);
1194
+ }
1195
+ const n = e.cloneNode(!1), r = e.getContext("2d"), o = n.getContext("2d");
1196
+ try {
1197
+ return r && o && o.putImageData(r.getImageData(0, 0, e.width, e.height), 0, 0), n;
1198
+ } catch (i) {
1199
+ t.log.warn("Failed to clone canvas", i);
1200
+ }
1201
+ return n;
1202
+ }
1203
+ function No(e, t) {
1204
+ try {
1205
+ var n;
1206
+ if (!(e == null || (n = e.contentDocument) === null || n === void 0) && n.documentElement) return st(e.contentDocument.documentElement, t);
1207
+ } catch (r) {
1208
+ t.log.warn("Failed to clone iframe", r);
1209
+ }
1210
+ return e.cloneNode(!1);
1211
+ }
1212
+ function Io(e) {
1213
+ const t = e.cloneNode(!1);
1214
+ return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
1215
+ }
1216
+ async function Ro(e, t) {
1217
+ if (e.ownerDocument && !e.currentSrc && e.poster) return ne(e.poster, e.ownerDocument);
1218
+ const n = e.cloneNode(!1);
1219
+ n.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (n.src = e.currentSrc);
1220
+ const r = n.ownerDocument;
1221
+ if (r) {
1222
+ let o = !0;
1223
+ if (await de(n, {
1224
+ onError: () => o = !1,
1225
+ onWarn: t.log.warn
1226
+ }), !o)
1227
+ return e.poster ? ne(e.poster, e.ownerDocument) : n;
1228
+ n.currentTime = e.currentTime, await new Promise((a) => {
1229
+ n.addEventListener("seeked", a, { once: !0 });
1230
+ });
1231
+ const i = r.createElement("canvas");
1232
+ i.width = e.offsetWidth, i.height = e.offsetHeight;
1233
+ try {
1234
+ const a = i.getContext("2d");
1235
+ a && a.drawImage(n, 0, 0, i.width, i.height);
1236
+ } catch (a) {
1237
+ return t.log.warn("Failed to clone video", a), e.poster ? ne(e.poster, e.ownerDocument) : n;
1238
+ }
1239
+ return hn(i, t);
1240
+ }
1241
+ return n;
1242
+ }
1243
+ function Mo(e, t) {
1244
+ return ao(e) ? hn(e, t) : bo(e) ? No(e, t) : re(e) ? Io(e) : _e(e) ? Ro(e, t) : e.cloneNode(!1);
1245
+ }
1246
+ function Do(e) {
1247
+ let t = e.sandbox;
1248
+ if (!t) {
1249
+ const { ownerDocument: n } = e;
1250
+ try {
1251
+ n && (t = n.createElement("iframe"), t.id = `__SANDBOX__${fn()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", n.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
1252
+ } catch (r) {
1253
+ e.log.warn("Failed to getSandBox", r);
1254
+ }
1255
+ }
1256
+ return t;
1257
+ }
1258
+ var Po = [
1259
+ "width",
1260
+ "height",
1261
+ "-webkit-text-fill-color"
1262
+ ], Bo = ["stroke", "fill"];
1263
+ function mn(e, t, n) {
1264
+ const { defaultComputedStyles: r } = n, o = e.nodeName.toLowerCase(), i = be(e) && o !== "svg", a = i ? Bo.map((m) => [m, e.getAttribute(m)]).filter(([, m]) => m !== null) : [], c = [
1265
+ i && "svg",
1266
+ o,
1267
+ a.map((m, u) => `${m}=${u}`).join(","),
1268
+ t
1269
+ ].filter(Boolean).join(":");
1270
+ if (r.has(c)) return r.get(c);
1271
+ const l = Do(n), d = l == null ? void 0 : l.contentWindow;
1272
+ if (!d) return /* @__PURE__ */ new Map();
1273
+ const p = d == null ? void 0 : d.document;
1274
+ let s, h;
1275
+ i ? (s = p.createElementNS(Le, "svg"), h = s.ownerDocument.createElementNS(s.namespaceURI, o), a.forEach(([m, u]) => {
1276
+ h.setAttributeNS(null, m, u);
1277
+ }), s.appendChild(h)) : s = h = p.createElement(o), h.textContent = " ", p.body.appendChild(s);
1278
+ const f = d.getComputedStyle(h, t), b = /* @__PURE__ */ new Map();
1279
+ for (let m = f.length, u = 0; u < m; u++) {
1280
+ const y = f.item(u);
1281
+ Po.includes(y) || b.set(y, f.getPropertyValue(y));
1282
+ }
1283
+ return p.body.removeChild(s), r.set(c, b), b;
1284
+ }
1285
+ function vn(e, t, n) {
1286
+ const r = /* @__PURE__ */ new Map(), o = [], i = /* @__PURE__ */ new Map();
1287
+ if (n) for (const l of n) c(l);
1288
+ else for (let l = e.length, d = 0; d < l; d++) c(e.item(d));
1289
+ for (let l = o.length, d = 0; d < l; d++) {
1290
+ var a;
1291
+ (a = i.get(o[d])) === null || a === void 0 || a.forEach((p, s) => r.set(s, p));
1292
+ }
1293
+ function c(l) {
1294
+ const d = e.getPropertyValue(l), p = e.getPropertyPriority(l), s = l.lastIndexOf("-"), h = s > -1 ? l.substring(0, s) : void 0;
1295
+ if (h) {
1296
+ let f = i.get(h);
1297
+ f || (f = /* @__PURE__ */ new Map(), i.set(h, f)), f.set(l, [d, p]);
1298
+ }
1299
+ t.get(l) === d && !p || (h ? o.push(h) : r.set(l, [d, p]));
1300
+ }
1301
+ return r;
1302
+ }
1303
+ function Uo(e, t, n, r) {
1304
+ var o;
1305
+ const { ownerWindow: i, includeStyleProperties: a, currentParentNodeStyle: c } = r, l = t.style, d = i.getComputedStyle(e), p = mn(e, null, r);
1306
+ c == null || c.forEach((m, u) => {
1307
+ p.delete(u);
1308
+ });
1309
+ const s = vn(d, p, a);
1310
+ if (s.delete("transition-property"), s.delete("all"), s.delete("d"), s.delete("content"), n && (s.delete("position"), s.delete("margin-top"), s.delete("margin-right"), s.delete("margin-bottom"), s.delete("margin-left"), s.delete("margin-block-start"), s.delete("margin-block-end"), s.delete("margin-inline-start"), s.delete("margin-inline-end"), s.set("box-sizing", ["border-box", ""])), ((o = s.get("background-clip")) === null || o === void 0 ? void 0 : o[0]) === "text" && t.classList.add("______background-clip--text"), ln) {
1311
+ var h, f, b;
1312
+ s.has("font-kerning") || s.set("font-kerning", ["normal", ""]), (((h = s.get("overflow-x")) === null || h === void 0 ? void 0 : h[0]) === "hidden" || ((f = s.get("overflow-y")) === null || f === void 0 ? void 0 : f[0]) === "hidden") && ((b = s.get("text-overflow")) === null || b === void 0 ? void 0 : b[0]) === "ellipsis" && e.scrollWidth === e.clientWidth && s.set("text-overflow", ["clip", ""]);
1313
+ }
1314
+ for (let m = l.length, u = 0; u < m; u++) l.removeProperty(l.item(u));
1315
+ return s.forEach(([m, u], y) => {
1316
+ l.setProperty(y, m, u);
1317
+ }), s;
1318
+ }
1319
+ function $o(e, t) {
1320
+ (so(e) || lo(e) || fo(e)) && t.setAttribute("value", e.value);
1321
+ }
1322
+ var Fo = ["::before", "::after"], Oo = [
1323
+ "::-webkit-scrollbar",
1324
+ "::-webkit-scrollbar-button",
1325
+ "::-webkit-scrollbar-thumb",
1326
+ "::-webkit-scrollbar-track",
1327
+ "::-webkit-scrollbar-track-piece",
1328
+ "::-webkit-scrollbar-corner",
1329
+ "::-webkit-resizer"
1330
+ ];
1331
+ function zo(e, t, n, r, o) {
1332
+ const { ownerWindow: i, svgStyleElement: a, svgStyles: c, currentNodeStyle: l } = r;
1333
+ if (!a || !i) return;
1334
+ function d(p) {
1335
+ var s;
1336
+ const h = i.getComputedStyle(e, p);
1337
+ let f = h.getPropertyValue("content");
1338
+ if (!f || f === "none") return;
1339
+ o == null || o(f), f = f.replace(/(')|(")|(counter\(.+\))/g, "");
1340
+ const b = [fn()], m = mn(e, p, r);
1341
+ l == null || l.forEach((w, S) => {
1342
+ m.delete(S);
1343
+ });
1344
+ const u = vn(h, m, r.includeStyleProperties);
1345
+ u.delete("content"), u.delete("-webkit-locale"), ((s = u.get("background-clip")) === null || s === void 0 ? void 0 : s[0]) === "text" && t.classList.add("______background-clip--text");
1346
+ const y = [`content: '${f}';`];
1347
+ if (u.forEach(([w, S], k) => {
1348
+ y.push(`${k}: ${w}${S ? " !important" : ""};`);
1349
+ }), y.length === 1) return;
1350
+ try {
1351
+ t.className = [t.className, ...b].join(" ");
1352
+ } catch (w) {
1353
+ r.log.warn("Failed to copyPseudoClass", w);
1354
+ return;
1355
+ }
1356
+ const g = y.join(`
1357
+ `);
1358
+ let v = c.get(g);
1359
+ v || (v = [], c.set(g, v)), v.push(`.${b[0]}${p}`);
1360
+ }
1361
+ Fo.forEach(d), n && Oo.forEach(d);
1362
+ }
1363
+ var It = /* @__PURE__ */ new Set(["symbol"]);
1364
+ async function Rt(e, t, n, r, o) {
1365
+ if (z(n) && (co(n) || uo(n)) || r.filter && !r.filter(n)) return;
1366
+ It.has(t.nodeName) || It.has(n.nodeName) ? r.currentParentNodeStyle = void 0 : r.currentParentNodeStyle = r.currentNodeStyle;
1367
+ const i = await st(n, r, !1, o);
1368
+ r.isEnable("restoreScrollPosition") && jo(e, i), t.appendChild(i);
1369
+ }
1370
+ async function Mt(e, t, n, r) {
1371
+ let o = e.firstChild;
1372
+ if (z(e) && e.shadowRoot) {
1373
+ var i;
1374
+ o = (i = e.shadowRoot) === null || i === void 0 ? void 0 : i.firstChild, n.shadowRoots.push(e.shadowRoot);
1375
+ }
1376
+ for (let a = o; a; a = a.nextSibling)
1377
+ if (!oo(a))
1378
+ if (z(a) && po(a) && typeof a.assignedNodes == "function") {
1379
+ const c = a.assignedNodes();
1380
+ for (let l = 0; l < c.length; l++) await Rt(e, t, c[l], n, r);
1381
+ } else await Rt(e, t, a, n, r);
1382
+ }
1383
+ function jo(e, t) {
1384
+ if (!ue(e) || !ue(t)) return;
1385
+ const { scrollTop: n, scrollLeft: r } = e;
1386
+ if (!n && !r) return;
1387
+ const { transform: o } = t.style, i = new DOMMatrix(o), { a, b: c, c: l, d } = i;
1388
+ i.a = 1, i.b = 0, i.c = 0, i.d = 1, i.translateSelf(-r, -n), i.a = a, i.b = c, i.c = l, i.d = d, t.style.transform = i.toString();
1389
+ }
1390
+ function Ho(e, t) {
1391
+ const { backgroundColor: n, width: r, height: o, style: i } = t, a = e.style;
1392
+ if (n && a.setProperty("background-color", n, "important"), r && a.setProperty("width", `${r}px`, "important"), o && a.setProperty("height", `${o}px`, "important"), i) for (const c in i) a[c] = i[c];
1393
+ }
1394
+ var Vo = /^[\w-:]+$/;
1395
+ async function st(e, t, n = !1, r) {
1396
+ const { ownerDocument: o, ownerWindow: i, fontFamilies: a, onCloneEachNode: c } = t;
1397
+ if (o && io(e))
1398
+ return r && /\S/.test(e.data) && r(e.data), o.createTextNode(e.data);
1399
+ if (o && i && z(e) && (ue(e) || be(e))) {
1400
+ var l, d;
1401
+ const f = await Mo(e, t);
1402
+ if (t.isEnable("removeAbnormalAttributes")) {
1403
+ const v = f.getAttributeNames();
1404
+ for (let w = v.length, S = 0; S < w; S++) {
1405
+ const k = v[S];
1406
+ Vo.test(k) || f.removeAttribute(k);
1407
+ }
1408
+ }
1409
+ const b = t.currentNodeStyle = Uo(e, f, n, t);
1410
+ n && Ho(f, t);
1411
+ let m = !1;
1412
+ if (t.isEnable("copyScrollbar")) {
1413
+ var p, s;
1414
+ const v = [(p = b.get("overflow-x")) === null || p === void 0 ? void 0 : p[0], (s = b.get("overflow-y")) === null || s === void 0 ? void 0 : s[0]];
1415
+ m = v.includes("scroll") || (v.includes("auto") || v.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
1416
+ }
1417
+ const u = (l = b.get("text-transform")) === null || l === void 0 ? void 0 : l[0], y = pn((d = b.get("font-family")) === null || d === void 0 ? void 0 : d[0]), g = y ? (v) => {
1418
+ u === "uppercase" ? v = v.toUpperCase() : u === "lowercase" ? v = v.toLowerCase() : u === "capitalize" && (v = v[0].toUpperCase() + v.substring(1)), y.forEach((w) => {
1419
+ let S = a.get(w);
1420
+ S || a.set(w, S = /* @__PURE__ */ new Set()), v.split("").forEach((k) => S.add(k));
1421
+ });
1422
+ } : void 0;
1423
+ return zo(e, f, m, t, g), $o(e, f), _e(e) || await Mt(e, f, t, g), await (c == null ? void 0 : c(f)), f;
1424
+ }
1425
+ const h = e.cloneNode(!1);
1426
+ return await Mt(e, h, t), await (c == null ? void 0 : c(h)), h;
1427
+ }
1428
+ function Xo(e) {
1429
+ if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
1430
+ try {
1431
+ e.sandbox.remove();
1432
+ } catch (t) {
1433
+ e.log.warn("Failed to destroyContext", t);
1434
+ }
1435
+ e.sandbox = void 0;
1436
+ }
1437
+ e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
1438
+ }
1439
+ function qo(e) {
1440
+ const { url: t, timeout: n, responseType: r, ...o } = e, i = new AbortController(), a = n ? setTimeout(() => i.abort(), n) : void 0;
1441
+ return fetch(t, {
1442
+ signal: i.signal,
1443
+ ...o
1444
+ }).then((c) => {
1445
+ if (!c.ok) throw new Error("Failed fetch, not 2xx response", { cause: c });
1446
+ switch (r) {
1447
+ case "arrayBuffer":
1448
+ return c.arrayBuffer();
1449
+ case "dataUrl":
1450
+ return c.blob().then(xo);
1451
+ default:
1452
+ return c.text();
1453
+ }
1454
+ }).finally(() => clearTimeout(a));
1455
+ }
1456
+ function fe(e, t) {
1457
+ const { url: n, requestType: r = "text", responseType: o = "text", imageDom: i } = t;
1458
+ let a = n;
1459
+ const { timeout: c, acceptOfImage: l, requests: d, fetchFn: p, fetch: { requestInit: s, bypassingCache: h, placeholderImage: f }, font: b, workers: m, fontFamilies: u } = e;
1460
+ r === "image" && (ke || it) && e.drawImageCount++;
1461
+ let y = d.get(n);
1462
+ if (!y) {
1463
+ h && h instanceof RegExp && h.test(a) && (a += (/\?/.test(a) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
1464
+ const g = r.startsWith("font") && b && b.minify, v = /* @__PURE__ */ new Set();
1465
+ g && r.split(";")[1].split(",").forEach((k) => {
1466
+ u.has(k) && u.get(k).forEach((N) => v.add(N));
1467
+ });
1468
+ const w = g && v.size, S = {
1469
+ url: a,
1470
+ timeout: c,
1471
+ responseType: w ? "arrayBuffer" : o,
1472
+ headers: r === "image" ? { accept: l } : void 0,
1473
+ ...s
1474
+ };
1475
+ y = {
1476
+ type: r,
1477
+ resolve: void 0,
1478
+ reject: void 0,
1479
+ response: null
1480
+ }, y.response = (async () => {
1481
+ if (p && r === "image") {
1482
+ const k = await p(n);
1483
+ if (k) return k;
1484
+ }
1485
+ return !ke && n.startsWith("http") && m.length ? new Promise((k, N) => {
1486
+ m[d.size & m.length - 1].postMessage({
1487
+ rawUrl: n,
1488
+ ...S
1489
+ }), y.resolve = k, y.reject = N;
1490
+ }) : qo(S);
1491
+ })().catch((k) => {
1492
+ if (d.delete(n), r === "image" && f)
1493
+ return e.log.warn("Failed to fetch image base64, trying to use placeholder image", a), typeof f == "string" ? f : f(i);
1494
+ throw k;
1495
+ }), d.set(n, y);
1496
+ }
1497
+ return y.response;
1498
+ }
1499
+ async function gn(e, t, n, r) {
1500
+ if (!yn(e)) return e;
1501
+ for (const [o, i] of Go(e, t)) try {
1502
+ const a = await fe(n, {
1503
+ url: i,
1504
+ requestType: r ? "image" : "text",
1505
+ responseType: "dataUrl"
1506
+ });
1507
+ e = e.replace(Wo(o), `$1${a}$3`);
1508
+ } catch (a) {
1509
+ n.log.warn("Failed to fetch css data url", o, a);
1510
+ }
1511
+ return e;
1512
+ }
1513
+ function yn(e) {
1514
+ return /url\((['"]?)([^'"]+?)\1\)/.test(e);
1515
+ }
1516
+ var wn = /url\((['"]?)([^'"]+?)\1\)/g;
1517
+ function Go(e, t) {
1518
+ const n = [];
1519
+ return e.replace(wn, (r, o, i) => (n.push([i, un(i, t)]), r)), n.filter(([r]) => !Je(r));
1520
+ }
1521
+ function Wo(e) {
1522
+ const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
1523
+ return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
1524
+ }
1525
+ var Yo = [
1526
+ "background-image",
1527
+ "border-image-source",
1528
+ "-webkit-border-image",
1529
+ "-webkit-mask-image",
1530
+ "list-style-image"
1531
+ ];
1532
+ function Ko(e, t) {
1533
+ return Yo.map((n) => {
1534
+ const r = e.getPropertyValue(n);
1535
+ return !r || r === "none" ? null : ((ke || it) && t.drawImageCount++, gn(r, null, t, !0).then((o) => {
1536
+ !o || r === o || e.setProperty(n, o, e.getPropertyPriority(n));
1537
+ }));
1538
+ }).filter(Boolean);
1539
+ }
1540
+ function Zo(e, t) {
1541
+ if (re(e)) {
1542
+ const n = e.currentSrc || e.src;
1543
+ if (!Je(n)) return [fe(t, {
1544
+ url: n,
1545
+ imageDom: e,
1546
+ requestType: "image",
1547
+ responseType: "dataUrl"
1548
+ }).then((r) => {
1549
+ r && (e.srcset = "", e.dataset.originalSrc = n, e.src = r || "");
1550
+ })];
1551
+ (ke || it) && t.drawImageCount++;
1552
+ } else if (be(e) && !Je(e.href.baseVal)) {
1553
+ const n = e.href.baseVal;
1554
+ return [fe(t, {
1555
+ url: n,
1556
+ imageDom: e,
1557
+ requestType: "image",
1558
+ responseType: "dataUrl"
1559
+ }).then((r) => {
1560
+ r && (e.dataset.originalSrc = n, e.href.baseVal = r || "");
1561
+ })];
1562
+ }
1563
+ return [];
1564
+ }
1565
+ function Jo(e, t) {
1566
+ var n;
1567
+ const { ownerDocument: r, svgDefsElement: o } = t, i = (n = e.getAttribute("href")) !== null && n !== void 0 ? n : e.getAttribute("xlink:href");
1568
+ if (!i) return [];
1569
+ const [a, c] = i.split("#");
1570
+ if (c) {
1571
+ const l = `#${c}`, d = t.shadowRoots.reduce((p, s) => p != null ? p : s.querySelector(`svg ${l}`), r == null ? void 0 : r.querySelector(`svg ${l}`));
1572
+ if (a && e.setAttribute("href", l), o != null && o.querySelector(l)) return [];
1573
+ if (d)
1574
+ return o == null || o.appendChild(d.cloneNode(!0)), [];
1575
+ if (a) return [fe(t, {
1576
+ url: a,
1577
+ responseType: "text"
1578
+ }).then((p) => {
1579
+ o == null || o.insertAdjacentHTML("beforeend", p);
1580
+ })];
1581
+ }
1582
+ return [];
1583
+ }
1584
+ function xn(e, t) {
1585
+ const { tasks: n } = t;
1586
+ z(e) && ((re(e) || cn(e)) && n.push(...Zo(e, t)), ro(e) && n.push(...Jo(e, t))), ue(e) && n.push(...Ko(e.style, t)), e.childNodes.forEach((r) => {
1587
+ xn(r, t);
1588
+ });
1589
+ }
1590
+ async function Qo(e, t) {
1591
+ const { ownerDocument: n, svgStyleElement: r, fontFamilies: o, fontCssTexts: i, tasks: a, font: c } = t;
1592
+ if (!(!n || !r || !o.size))
1593
+ if (c && c.cssText) {
1594
+ const l = Pt(c.cssText, t);
1595
+ r.appendChild(n.createTextNode(`${l}
1596
+ `));
1597
+ } else {
1598
+ const l = Array.from(n.styleSheets).filter((f) => {
1599
+ try {
1600
+ return "cssRules" in f && !!f.cssRules.length;
1601
+ } catch (b) {
1602
+ return t.log.warn(`Error while reading CSS rules from ${f.href}`, b), !1;
1603
+ }
1604
+ }), d = n.implementation.createHTMLDocument(""), p = d.createElement("style");
1605
+ d.head.appendChild(p);
1606
+ const s = p.sheet;
1607
+ await Promise.all(l.flatMap((f) => Array.from(f.cssRules).map(async (b) => {
1608
+ if (to(b)) {
1609
+ const m = b.href;
1610
+ let u = "";
1611
+ try {
1612
+ u = await fe(t, {
1613
+ url: m,
1614
+ requestType: "text",
1615
+ responseType: "text"
1616
+ });
1617
+ } catch (g) {
1618
+ t.log.warn(`Error fetch remote css import from ${m}`, g);
1619
+ }
1620
+ const y = u.replace(wn, (g, v, w) => g.replace(w, un(w, m)));
1621
+ for (const g of ti(y)) try {
1622
+ s.insertRule(g, s.cssRules.length);
1623
+ } catch (v) {
1624
+ t.log.warn("Error inserting rule from remote css import", {
1625
+ rule: g,
1626
+ error: v
1627
+ });
1628
+ }
1629
+ }
1630
+ }))), s.cssRules.length && l.push(s);
1631
+ const h = [];
1632
+ l.forEach((f) => {
1633
+ Qe(f.cssRules, h);
1634
+ }), h.filter((f) => {
1635
+ var b;
1636
+ return eo(f) && yn(f.style.getPropertyValue("src")) && ((b = pn(f.style.getPropertyValue("font-family"))) === null || b === void 0 ? void 0 : b.some((m) => o.has(m)));
1637
+ }).forEach((f) => {
1638
+ const b = f, m = i.get(b.cssText);
1639
+ m ? r.appendChild(n.createTextNode(`${m}
1640
+ `)) : a.push(gn(b.cssText, b.parentStyleSheet ? b.parentStyleSheet.href : null, t).then((u) => {
1641
+ u = Pt(u, t), i.set(b.cssText, u), r.appendChild(n.createTextNode(`${u}
1642
+ `));
1643
+ }));
1644
+ });
1645
+ }
1646
+ }
1647
+ var ei = /(\/\*[\s\S]*?\*\/)/g, Dt = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
1648
+ function ti(e) {
1649
+ if (e == null) return [];
1650
+ const t = [];
1651
+ let n = e.replace(ei, "");
1652
+ for (; ; ) {
1653
+ const i = Dt.exec(n);
1654
+ if (!i) break;
1655
+ t.push(i[0]);
1656
+ }
1657
+ n = n.replace(Dt, "");
1658
+ const r = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = /* @__PURE__ */ new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi");
1659
+ for (; ; ) {
1660
+ let i = r.exec(n);
1661
+ if (i)
1662
+ o.lastIndex = r.lastIndex;
1663
+ else if (i = o.exec(n), i) r.lastIndex = o.lastIndex;
1664
+ else break;
1665
+ t.push(i[0]);
1666
+ }
1667
+ return t;
1668
+ }
1669
+ var ni = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ri = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
1670
+ function Pt(e, t) {
1671
+ const { font: n } = t, r = n ? n == null ? void 0 : n.preferredFormat : void 0;
1672
+ return r ? e.replace(ri, (o) => {
1673
+ for (; ; ) {
1674
+ const [i, , a] = ni.exec(o) || [];
1675
+ if (!a) return "";
1676
+ if (a === r) return `src: ${i};`;
1677
+ }
1678
+ }) : e;
1679
+ }
1680
+ function Qe(e, t = []) {
1681
+ for (const n of Array.from(e)) no(n) ? t.push(...Qe(n.cssRules)) : "cssRules" in n ? Qe(n.cssRules, t) : t.push(n);
1682
+ return t;
1683
+ }
1684
+ var oi = /\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;
1685
+ function ii(e) {
1686
+ return oi.test(e.innerHTML);
1687
+ }
1688
+ async function ai(e, t) {
1689
+ const n = await at(e, t);
1690
+ if (z(n.node) && be(n.node) && !ii(n.node)) return n.node;
1691
+ const { ownerDocument: r, log: o, tasks: i, svgStyleElement: a, svgDefsElement: c, svgStyles: l, font: d, progress: p, autoDestruct: s, onCloneNode: h, onEmbedNode: f, onCreateForeignObjectSvg: b } = n;
1692
+ o.time("clone node");
1693
+ const m = await st(n.node, n, !0);
1694
+ if (a && r) {
1695
+ let w = "";
1696
+ l.forEach((S, k) => {
1697
+ w += `${S.join(`,
1698
+ `)} {
1699
+ ${k}
1700
+ }
1701
+ `;
1702
+ }), a.appendChild(r.createTextNode(w));
1703
+ }
1704
+ o.timeEnd("clone node"), await (h == null ? void 0 : h(m)), d !== !1 && z(m) && (o.time("embed web font"), await Qo(m, n), o.timeEnd("embed web font")), o.time("embed node"), xn(m, n);
1705
+ const u = i.length;
1706
+ let y = 0;
1707
+ const g = async () => {
1708
+ for (; ; ) {
1709
+ const w = i.pop();
1710
+ if (!w) break;
1711
+ try {
1712
+ await w;
1713
+ } catch (S) {
1714
+ n.log.warn("Failed to run task", S);
1715
+ }
1716
+ p == null || p(++y, u);
1717
+ }
1718
+ };
1719
+ p == null || p(y, u), await Promise.all([...Array.from({ length: 4 })].map(g)), o.timeEnd("embed node"), await (f == null ? void 0 : f(m));
1720
+ const v = si(m, n);
1721
+ return c && v.insertBefore(c, v.children[0]), a && v.insertBefore(a, v.children[0]), s && Xo(n), await (b == null ? void 0 : b(v)), v;
1722
+ }
1723
+ function si(e, t) {
1724
+ const { width: n, height: r } = t, o = vo(n, r, e.ownerDocument), i = o.ownerDocument.createElementNS(o.namespaceURI, "foreignObject");
1725
+ return i.setAttributeNS(null, "x", "0%"), i.setAttributeNS(null, "y", "0%"), i.setAttributeNS(null, "width", "100%"), i.setAttributeNS(null, "height", "100%"), i.append(e), o.appendChild(i), o;
1726
+ }
1727
+ async function li(e, t) {
1728
+ const n = await at(e, t), r = await ai(n), o = go(r, n.isEnable("removeControlCharacter"));
1729
+ if (!n.autoDestruct) {
1730
+ var i;
1731
+ n.svgStyleElement = bn(n.ownerDocument), n.svgDefsElement = (i = n.ownerDocument) === null || i === void 0 ? void 0 : i.createElementNS(Le, "defs"), n.svgStyles.clear();
1732
+ }
1733
+ return await Ao(ne(o, r.ownerDocument), n);
1734
+ }
1735
+ async function ci(e, t) {
1736
+ const n = await at(e, t), { log: r, type: o, quality: i, dpi: a } = n, c = await li(n);
1737
+ r.time("canvas to blob");
1738
+ const l = await yo(c, o, i);
1739
+ if (["image/png", "image/jpeg"].includes(o) && a) {
1740
+ const d = await ko(l.slice(0, 33));
1741
+ let p = new Uint8Array(d);
1742
+ return o === "image/png" ? p = Kr(p, a) : o === "image/jpeg" && (p = qr(p, a)), r.timeEnd("canvas to blob"), new Blob([p, l.slice(33)], { type: o });
1743
+ }
1744
+ return r.timeEnd("canvas to blob"), l;
1745
+ }
1746
+ var ui = 32, di = /* @__PURE__ */ new Set([
1747
+ "button",
1748
+ "submit",
1749
+ "reset",
1750
+ "checkbox",
1751
+ "radio",
1752
+ "range",
1753
+ "color",
1754
+ "file",
1755
+ "image",
1756
+ "hidden"
1757
+ ]);
1758
+ function He(e) {
1759
+ const t = Math.min(Math.max(e, 1), ui);
1760
+ return "•".repeat(t);
1761
+ }
1762
+ function fi(e) {
1763
+ for (const r of Array.from(e.querySelectorAll("input"))) {
1764
+ var t;
1765
+ const o = ((t = r.getAttribute("type")) !== null && t !== void 0 ? t : "text").toLowerCase();
1766
+ if (di.has(o)) continue;
1767
+ const i = r.value;
1768
+ if (!i) continue;
1769
+ const a = He(i.length);
1770
+ r.value = a, r.setAttribute("value", a);
1771
+ }
1772
+ for (const r of Array.from(e.querySelectorAll("textarea"))) {
1773
+ const o = r.value || r.textContent || "";
1774
+ if (!o) continue;
1775
+ const i = He(o.length);
1776
+ r.value = i, r.textContent = i, r.setAttribute("value", i);
1777
+ }
1778
+ for (const r of Array.from(e.querySelectorAll("[contenteditable]"))) {
1779
+ var n;
1780
+ if (r.getAttribute("contenteditable") === "false") continue;
1781
+ const o = (n = r.textContent) !== null && n !== void 0 ? n : "";
1782
+ o.trim() && (r.textContent = He(o.length));
1783
+ }
1784
+ }
1785
+ var pi = {
1786
+ "image/png": "png",
1787
+ "image/jpeg": "jpg",
1788
+ "image/webp": "webp",
1789
+ "image/gif": "gif"
1790
+ };
1791
+ function kn(e) {
1792
+ var t;
1793
+ return (t = pi[e]) !== null && t !== void 0 ? t : "png";
1794
+ }
1795
+ function Bt(e, t, n) {
1796
+ const r = e == null ? void 0 : e[`inner${n}`], o = t.documentElement[`client${n}`];
1797
+ return Math.max(1, Math.round((typeof r == "number" && r > 0 ? r : o) || 0) || 1);
1798
+ }
1799
+ var bi = 6e3, hi = (e, t) => ci(e, {
1800
+ width: t.width,
1801
+ height: t.height,
1802
+ type: t.type,
1803
+ timeout: bi,
1804
+ filter: t.filter,
1805
+ onCloneNode: t.onCloneNode
1806
+ });
1807
+ async function En(e = {}) {
1808
+ try {
1809
+ var t, n, r, o, i, a;
1810
+ const c = (t = e.doc) !== null && t !== void 0 ? t : document, l = (n = (r = e.win) !== null && r !== void 0 ? r : c.defaultView) !== null && n !== void 0 ? n : void 0, d = (o = e.target) !== null && o !== void 0 ? o : c.documentElement, p = (i = e.type) !== null && i !== void 0 ? i : "image/png", s = Bt(l, c, "Width"), h = Bt(l, c, "Height"), f = await ((a = e.capture) !== null && a !== void 0 ? a : hi)(d, {
1811
+ width: s,
1812
+ height: h,
1813
+ type: p,
1814
+ filter: (b) => !Wn(b),
1815
+ onCloneNode: (b) => fi(b)
1816
+ });
1817
+ return f ? {
1818
+ blob: f,
1819
+ width: s,
1820
+ height: h,
1821
+ type: p
1822
+ } : null;
1823
+ } catch {
1824
+ return null;
1825
+ }
1826
+ }
1827
+ function pe(e) {
1828
+ "@babel/helpers - typeof";
1829
+ return pe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
1830
+ return typeof t;
1831
+ } : function(t) {
1832
+ return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
1833
+ }, pe(e);
1834
+ }
1835
+ function mi(e, t) {
1836
+ if (pe(e) != "object" || !e) return e;
1837
+ var n = e[Symbol.toPrimitive];
1838
+ if (n !== void 0) {
1839
+ var r = n.call(e, t || "default");
1840
+ if (pe(r) != "object") return r;
1841
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1842
+ }
1843
+ return (t === "string" ? String : Number)(e);
1844
+ }
1845
+ function vi(e) {
1846
+ var t = mi(e, "string");
1847
+ return pe(t) == "symbol" ? t : t + "";
1848
+ }
1849
+ function te(e, t, n) {
1850
+ return (t = vi(t)) in e ? Object.defineProperty(e, t, {
1851
+ value: n,
1852
+ enumerable: !0,
1853
+ configurable: !0,
1854
+ writable: !0
1855
+ }) : e[t] = n, e;
1856
+ }
1857
+ function gi(e, t) {
1858
+ if (e == null) return 60;
1859
+ const n = e.trim();
1860
+ if (n === "") return 60;
1861
+ if (/^\d+$/.test(n)) return Number(n);
1862
+ const r = Date.parse(n);
1863
+ return Number.isNaN(r) ? 60 : Math.max(0, Math.ceil((r - t) / 1e3));
1864
+ }
1865
+ var yi = class {
1866
+ constructor(e = Date.now) {
1867
+ te(this, "now", void 0), te(this, "pausedUntil", 0), this.now = e;
1868
+ }
1869
+ isPaused() {
1870
+ return this.now() < this.pausedUntil;
1871
+ }
1872
+ retryAfterSeconds() {
1873
+ return Math.max(0, Math.ceil((this.pausedUntil - this.now()) / 1e3));
1874
+ }
1875
+ hold(e) {
1876
+ const t = this.now(), n = gi(e, t), r = t + n * 1e3;
1877
+ return r > this.pausedUntil && (this.pausedUntil = r), n;
1878
+ }
1879
+ }, wi = "screenshot", xi = new yi();
1880
+ function ki(e) {
1881
+ return `${e.replace(/\/+$/, "")}/api/ingest/feedback`;
1882
+ }
1883
+ function Ei(e) {
1884
+ if (!e) return {};
1885
+ const t = {};
1886
+ return e.signedIdentity && (t.signedIdentity = e.signedIdentity), e.reporterId && (t.reporterId = e.reporterId), e.anonymousId && (t.anonymousId = e.anonymousId), t;
1887
+ }
1888
+ async function Sn(e, t, n = fetch, r = xi) {
1889
+ var o, i;
1890
+ const a = (o = t.content.source) !== null && o !== void 0 ? o : "reporter", c = a === "auto";
1891
+ if (c && r.isPaused()) return {
1892
+ ok: !1,
1893
+ reason: "backpressure",
1894
+ retryAfterSeconds: r.retryAfterSeconds()
1895
+ };
1896
+ const l = {
1897
+ key: t.key,
1898
+ ...Ei(t.identity),
1899
+ ...t.content,
1900
+ source: a
1901
+ }, d = new FormData();
1902
+ if (d.append("payload", JSON.stringify(l)), !((i = t.screenshot) === null || i === void 0) && i.blob) {
1903
+ var p;
1904
+ d.append(wi, t.screenshot.blob, (p = t.screenshot.filename) !== null && p !== void 0 ? p : "screenshot.png");
1905
+ }
1906
+ let s;
1907
+ try {
1908
+ s = await n(ki(e), {
1909
+ method: "POST",
1910
+ body: d
1911
+ });
1912
+ } catch {
1913
+ return {
1914
+ ok: !1,
1915
+ reason: "unreachable"
1916
+ };
1917
+ }
1918
+ if (!s.ok)
1919
+ return c && s.status === 429 ? {
1920
+ ok: !1,
1921
+ reason: "backpressure",
1922
+ retryAfterSeconds: r.hold(s.headers.get("Retry-After"))
1923
+ } : {
1924
+ ok: !1,
1925
+ reason: "refused",
1926
+ status: s.status
1927
+ };
1928
+ try {
1929
+ return {
1930
+ ok: !0,
1931
+ feedback: await s.json()
1932
+ };
1933
+ } catch {
1934
+ return {
1935
+ ok: !0,
1936
+ feedback: null
1937
+ };
1938
+ }
1939
+ }
1940
+ var Ee = "0.3.0";
1941
+ var Si = 2e3;
1942
+ var Ti = 5, Ci = 5;
1943
+ function _i(e) {
1944
+ if (!e || e.length === 0) return [];
1945
+ const t = [];
1946
+ for (let r = e.length - 1; r >= 0 && t.length < Ci; r -= 1) {
1947
+ var n;
1948
+ const o = (n = e[r]) === null || n === void 0 ? void 0 : n.id;
1949
+ typeof o == "string" && o.length > 0 && t.unshift(o);
1950
+ }
1951
+ return t;
1952
+ }
1953
+ var Ai = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, Li = /\bhttps?:\/\/[^\s"')]+/gi, Ni = /\b0x[0-9a-f]+\b/gi, Ii = /\b[0-9a-f]{8,}\b/gi, Ri = /\d{4,}/g;
1954
+ function Mi(e) {
1955
+ return typeof e != "string" || e.length === 0 ? "" : e.replace(Ai, "<uuid>").replace(Li, "<url>").replace(Ni, "<hex>").replace(Ii, "<hex>").replace(Ri, "<n>").trim();
1956
+ }
1957
+ function Di(e) {
1958
+ let t = 2166136261;
1959
+ for (let n = 0; n < e.length; n++)
1960
+ t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
1961
+ return (t >>> 0).toString(36);
1962
+ }
1963
+ function Ve(e) {
1964
+ const t = e.replace(/\?[^:]*/, ""), n = t.lastIndexOf("/");
1965
+ return n >= 0 ? t.slice(n + 1) : t;
1966
+ }
1967
+ function Pi(e) {
1968
+ var t, n, r;
1969
+ const o = e.match(/^at\s+(.+?)\s+\((.+)\)$/);
1970
+ if (o) return `${(t = o[1]) !== null && t !== void 0 ? t : ""}@${Ve((n = o[2]) !== null && n !== void 0 ? n : "")}`;
1971
+ const i = e.match(/^at\s+(.+)$/);
1972
+ if (i) return `@${Ve((r = i[1]) !== null && r !== void 0 ? r : "")}`;
1973
+ const a = e.indexOf("@");
1974
+ return a >= 0 ? `${e.slice(0, a)}@${Ve(e.slice(a + 1))}` : null;
1975
+ }
1976
+ function Bi(e, t = Ti) {
1977
+ if (typeof e != "string" || e.length === 0) return "";
1978
+ const n = [];
1979
+ for (const r of e.split(`
1980
+ `)) {
1981
+ const o = Pi(r.trim());
1982
+ if (o && (n.push(o), n.length >= t))
1983
+ break;
1984
+ }
1985
+ return n.join(" < ");
1986
+ }
1987
+ function Ui(e, t, n) {
1988
+ return Di(`${e}|${Mi(t)}|${Bi(n)}`);
1989
+ }
1990
+ var $i = class {
1991
+ constructor(e) {
1992
+ var t;
1993
+ te(this, "options", void 0), te(this, "tokens", void 0), te(this, "last", void 0), te(this, "now", void 0), this.options = e, this.now = (t = e.now) !== null && t !== void 0 ? t : Date.now, this.tokens = Math.max(0, e.capacity), this.last = this.now();
1994
+ }
1995
+ take() {
1996
+ const e = this.now(), { capacity: t, refillIntervalMs: n } = this.options;
1997
+ if (n > 0 && e > this.last) {
1998
+ const r = Math.floor((e - this.last) / n);
1999
+ r > 0 && (this.tokens = Math.min(t, this.tokens + r), this.last += r * n);
2000
+ }
2001
+ return this.tokens >= 1 ? (this.tokens -= 1, !0) : !1;
2002
+ }
2003
+ };
2004
+ function q(e) {
2005
+ if (typeof e == "string") return e;
2006
+ if (e == null) return "";
2007
+ try {
2008
+ return String(e);
2009
+ } catch {
2010
+ return "";
2011
+ }
2012
+ }
2013
+ function Fi(e) {
2014
+ const t = e, n = t.error;
2015
+ if (n && typeof n == "object") {
2016
+ const o = n;
2017
+ return {
2018
+ type: q(o.name) || "Error",
2019
+ value: q(o.message) || q(t.message),
2020
+ stack: typeof o.stack == "string" ? o.stack : void 0,
2021
+ original: n
2022
+ };
2023
+ }
2024
+ const r = q(t.message);
2025
+ return r ? {
2026
+ type: "Error",
2027
+ value: r,
2028
+ original: r
2029
+ } : null;
2030
+ }
2031
+ function Oi(e) {
2032
+ const t = e.reason;
2033
+ if (t && typeof t == "object") {
2034
+ const r = t;
2035
+ return {
2036
+ type: q(r.name) || "UnhandledRejection",
2037
+ value: q(r.message) || q(t),
2038
+ stack: typeof r.stack == "string" ? r.stack : void 0,
2039
+ original: t
2040
+ };
2041
+ }
2042
+ const n = q(t);
2043
+ return {
2044
+ type: "UnhandledRejection",
2045
+ value: n,
2046
+ original: t != null ? t : n
2047
+ };
2048
+ }
2049
+ var zi = {
2050
+ destroy: () => {
2051
+ },
2052
+ droppedCount: () => 0
2053
+ };
2054
+ function ji(e) {
2055
+ var t, n, r, o, i, a, c, l, d, p, s, h;
2056
+ const f = (t = e.win) !== null && t !== void 0 ? t : typeof window != "undefined" ? window : void 0;
2057
+ if (!f) return zi;
2058
+ const b = f, m = (n = (r = e.doc) !== null && r !== void 0 ? r : b.document) !== null && n !== void 0 ? n : typeof document != "undefined" ? document : void 0, u = (o = e.now) !== null && o !== void 0 ? o : Date.now, y = (i = e.sdkVersion) !== null && i !== void 0 ? i : Ee, g = (a = e.maxDistinct) !== null && a !== void 0 ? a : 20, v = (c = (l = e.deps) === null || l === void 0 ? void 0 : l.captureView) !== null && c !== void 0 ? c : En, w = (d = (p = e.deps) === null || p === void 0 ? void 0 : p.submitReport) !== null && d !== void 0 ? d : Sn, S = new $i({
2059
+ capacity: (s = e.burstCapacity) !== null && s !== void 0 ? s : 5,
2060
+ refillIntervalMs: (h = e.burstRefillMs) !== null && h !== void 0 ? h : Si,
2061
+ now: u
2062
+ }), k = /* @__PURE__ */ new Map();
2063
+ let N = 0;
2064
+ function T(R, I, $) {
2065
+ var M, O;
2066
+ return {
2067
+ ...tn({
2068
+ kind: "bug",
2069
+ url: (M = b.location) === null || M === void 0 ? void 0 : M.href,
2070
+ environment: en(b, y),
2071
+ trace: $.trace ? (O = e.buffer) === null || O === void 0 ? void 0 : O.snapshot() : void 0
2072
+ }),
2073
+ source: "auto",
2074
+ errorSignature: R,
2075
+ occurrences: I
2076
+ };
2077
+ }
2078
+ async function B(R, I, $) {
2079
+ const M = k.get(R);
2080
+ if (!M) return;
2081
+ const O = M.sentCount;
2082
+ M.sentCount = I;
2083
+ try {
2084
+ const W = T(R, I, $), Y = Gt(W, {
2085
+ hook: e.beforeSend,
2086
+ scrub: e.scrub
2087
+ });
2088
+ if (!Y) return;
2089
+ let ie = null;
2090
+ if ($.screenshot) {
2091
+ const Z = await v({
2092
+ doc: m,
2093
+ win: b
2094
+ });
2095
+ ie = Z ? {
2096
+ blob: Z.blob,
2097
+ filename: `screenshot.${kn(Z.type)}`
2098
+ } : null;
2099
+ }
2100
+ !(await w(e.apiUrl, {
2101
+ key: e.key,
2102
+ identity: e.identity,
2103
+ content: Y,
2104
+ screenshot: ie
2105
+ })).ok && M.sentCount === I && (M.sentCount = O);
2106
+ } catch {
2107
+ M.sentCount === I && (M.sentCount = O);
2108
+ }
2109
+ }
2110
+ function x(R) {
2111
+ const I = Ui(R.type, R.value, R.stack), $ = k.get(I);
2112
+ if ($) {
2113
+ $.count += 1, $.lastAt = u();
2114
+ return;
2115
+ }
2116
+ if (!S.take()) {
2117
+ N += 1;
2118
+ return;
2119
+ }
2120
+ if (k.size >= g) {
2121
+ N += 1;
2122
+ return;
2123
+ }
2124
+ const M = u();
2125
+ k.set(I, {
2126
+ count: 1,
2127
+ firstAt: M,
2128
+ lastAt: M,
2129
+ sentCount: 0
2130
+ });
2131
+ try {
2132
+ var O, W;
2133
+ const Y = _i((O = e.buffer) === null || O === void 0 ? void 0 : O.snapshot());
2134
+ (W = e.buffer) === null || W === void 0 || W.add(_r(R.original, M, Y));
2135
+ } catch {
2136
+ }
2137
+ B(I, 1, {
2138
+ screenshot: !0,
2139
+ trace: !0
2140
+ });
2141
+ }
2142
+ const L = (R) => {
2143
+ try {
2144
+ const I = Fi(R);
2145
+ I && x(I);
2146
+ } catch {
2147
+ }
2148
+ }, F = (R) => {
2149
+ try {
2150
+ const I = Oi(R);
2151
+ I && x(I);
2152
+ } catch {
2153
+ }
2154
+ }, D = () => {
2155
+ try {
2156
+ for (const [R, I] of k) I.count > I.sentCount && B(R, I.count, {
2157
+ screenshot: !1,
2158
+ trace: !1
2159
+ });
2160
+ } catch {
2161
+ }
2162
+ }, oe = () => {
2163
+ (m == null ? void 0 : m.visibilityState) === "hidden" && D();
2164
+ };
2165
+ return b.addEventListener("error", L, !0), b.addEventListener("unhandledrejection", F, !0), b.addEventListener("pagehide", D), m == null || m.addEventListener("visibilitychange", oe), {
2166
+ destroy: () => {
2167
+ b.removeEventListener("error", L, !0), b.removeEventListener("unhandledrejection", F, !0), b.removeEventListener("pagehide", D), m == null || m.removeEventListener("visibilitychange", oe);
2168
+ },
2169
+ droppedCount: () => N
2170
+ };
2171
+ }
2172
+ var Ut = "fixback.anonymousId";
2173
+ function $t() {
31
2174
  const e = globalThis.crypto;
32
2175
  return e && typeof e.randomUUID == "function" ? e.randomUUID() : `fb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
33
2176
  }
34
- function ye() {
2177
+ function Hi() {
35
2178
  try {
36
- const e = globalThis.localStorage, t = e.getItem(J);
2179
+ const e = globalThis.localStorage, t = e.getItem(Ut);
37
2180
  if (t) return t;
38
- const o = Z();
39
- return e.setItem(J, o), o;
2181
+ const n = $t();
2182
+ return e.setItem(Ut, n), n;
2183
+ } catch {
2184
+ return $t();
2185
+ }
2186
+ }
2187
+ var Tn = "fixback_invite", Vi = "fixback:reporter:";
2188
+ function Xi(e) {
2189
+ try {
2190
+ const t = new URL(e).searchParams.get(Tn);
2191
+ return t && t.length > 0 ? t : null;
2192
+ } catch {
2193
+ return null;
2194
+ }
2195
+ }
2196
+ function qi(e) {
2197
+ try {
2198
+ const t = new URL(e.location.href);
2199
+ if (!t.searchParams.has("fixback_invite")) return;
2200
+ t.searchParams.delete(Tn);
2201
+ const n = t.searchParams.toString(), r = `${t.pathname}${n ? `?${n}` : ""}${t.hash}`;
2202
+ e.history.replaceState(e.history.state, "", r);
2203
+ } catch {
2204
+ }
2205
+ }
2206
+ function Cn(e) {
2207
+ return `${Vi}${e}`;
2208
+ }
2209
+ function _n() {
2210
+ try {
2211
+ var e;
2212
+ return (e = globalThis.localStorage) !== null && e !== void 0 ? e : null;
2213
+ } catch {
2214
+ return null;
2215
+ }
2216
+ }
2217
+ function Se(e) {
2218
+ if (typeof e != "string") return;
2219
+ const t = e.trim();
2220
+ return t.length > 0 ? t : void 0;
2221
+ }
2222
+ function Gi(e, t, n = _n()) {
2223
+ if (!n) return;
2224
+ const r = Se(t.name), o = Se(t.email), i = {
2225
+ reporterId: t.reporterId,
2226
+ ...r ? { name: r } : {},
2227
+ ...o ? { email: o } : {}
2228
+ };
2229
+ try {
2230
+ n.setItem(Cn(e), JSON.stringify(i));
2231
+ } catch {
2232
+ }
2233
+ }
2234
+ function Ft(e, t = _n()) {
2235
+ if (!t) return null;
2236
+ try {
2237
+ const n = t.getItem(Cn(e));
2238
+ if (!n) return null;
2239
+ const r = JSON.parse(n);
2240
+ if (typeof (r == null ? void 0 : r.reporterId) != "string" || r.reporterId.length === 0) return null;
2241
+ const o = Se(r.name), i = Se(r.email);
2242
+ return {
2243
+ reporterId: r.reporterId,
2244
+ ...o ? { name: o } : {},
2245
+ ...i ? { email: i } : {}
2246
+ };
2247
+ } catch {
2248
+ return null;
2249
+ }
2250
+ }
2251
+ function An(e, t) {
2252
+ return `${e.replace(/\/+$/, "")}/api/invites/${encodeURIComponent(t)}`;
2253
+ }
2254
+ function Wi(e, t) {
2255
+ return `${An(e, t)}/redeem`;
2256
+ }
2257
+ var Ln = /* @__PURE__ */ new Set([
2258
+ "revoked",
2259
+ "expired",
2260
+ "exhausted",
2261
+ "not_found"
2262
+ ]);
2263
+ function Nn(e) {
2264
+ return e === "public" || e === "invited" || e === "internal";
2265
+ }
2266
+ function Yi(e) {
2267
+ if (typeof e != "object" || e === null) return !1;
2268
+ const t = e;
2269
+ return t.status === "pending" ? typeof t.projectId == "string" && (t.kind === "targeted" || t.kind === "shared") && Nn(t.tier) : typeof t.status == "string" && Ln.has(t.status);
2270
+ }
2271
+ function Ki(e) {
2272
+ if (typeof e != "object" || e === null) return !1;
2273
+ const t = e;
2274
+ return t.status === "redeemed" ? typeof t.reporterId == "string" && typeof t.projectId == "string" && Nn(t.tier) : typeof t.status == "string" && Ln.has(t.status);
2275
+ }
2276
+ async function In(e) {
2277
+ try {
2278
+ return await e.json();
40
2279
  } catch {
41
- return Z();
2280
+ return null;
2281
+ }
2282
+ }
2283
+ async function Zi(e, t, n = fetch) {
2284
+ let r;
2285
+ try {
2286
+ r = await n(An(e, t), {
2287
+ method: "GET",
2288
+ headers: { accept: "application/json" }
2289
+ });
2290
+ } catch {
2291
+ return null;
2292
+ }
2293
+ const o = await In(r);
2294
+ return Yi(o) ? o : null;
2295
+ }
2296
+ async function Ji(e, t, n = fetch) {
2297
+ let r;
2298
+ try {
2299
+ r = await n(Wi(e, t), {
2300
+ method: "POST",
2301
+ headers: { accept: "application/json" }
2302
+ });
2303
+ } catch {
2304
+ return null;
42
2305
  }
2306
+ const o = await In(r);
2307
+ return Ki(o) ? o : null;
43
2308
  }
44
- var ke = `
2309
+ var Qi = `
45
2310
  :host {
46
2311
  /* Vendored Signal tokens (packages/ui/src/tokens.css). */
47
2312
  --fb-color-accent: #2f6fed;
48
2313
  --fb-color-accent-hover: #245fd0;
49
2314
  --fb-color-on-emphasis: #ffffff;
50
2315
  --fb-color-text: #0f1720;
2316
+ /* Inverse (dark) surface for the toasts — Signal --fb-ink-900. */
2317
+ --fb-color-surface-inverse: #0f1720;
51
2318
  --fb-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
52
2319
  Helvetica, Arial, sans-serif;
53
2320
 
@@ -59,42 +2326,55 @@ var ke = `
59
2326
  -webkit-font-smoothing: antialiased;
60
2327
  }
61
2328
 
2329
+ /* The pill: Feedback button + divider + tuck control, anchored bottom-right. */
62
2330
  .fb-launcher {
2331
+ position: fixed;
2332
+ right: 20px;
2333
+ bottom: 20px;
2334
+ z-index: 2;
63
2335
  display: inline-flex;
64
- align-items: center;
65
- gap: 8px;
2336
+ align-items: stretch;
66
2337
  box-sizing: border-box;
67
2338
  height: 40px;
68
2339
  margin: 0;
69
- padding: 0 16px;
70
- border: 0;
71
2340
  border-radius: 999px;
72
2341
  background: var(--fb-color-accent);
73
- color: var(--fb-color-on-emphasis);
74
- font-family: inherit;
75
- font-size: 13px;
76
- font-weight: 600;
77
- letter-spacing: 0.01em;
78
- cursor: pointer;
79
2342
  box-shadow:
80
2343
  0 6px 18px rgba(15, 23, 32, 0.16),
81
2344
  0 1px 2px rgba(15, 23, 32, 0.12);
2345
+ transform: translateX(0);
82
2346
  transition:
83
- background-color 120ms ease,
84
- transform 120ms ease;
2347
+ transform 340ms cubic-bezier(0.2, 0.8, 0.3, 1),
2348
+ background-color 120ms ease;
85
2349
  }
86
2350
 
87
2351
  .fb-launcher:hover {
88
2352
  background: var(--fb-color-accent-hover);
89
2353
  }
90
2354
 
91
- .fb-launcher:active {
92
- transform: translateY(1px);
2355
+ .fb-launcher__button {
2356
+ display: inline-flex;
2357
+ align-items: center;
2358
+ gap: 8px;
2359
+ box-sizing: border-box;
2360
+ height: 100%;
2361
+ margin: 0;
2362
+ padding: 0 6px 0 16px;
2363
+ border: 0;
2364
+ background: transparent;
2365
+ color: var(--fb-color-on-emphasis);
2366
+ font-family: inherit;
2367
+ font-size: 13px;
2368
+ font-weight: 600;
2369
+ letter-spacing: 0.01em;
2370
+ cursor: pointer;
93
2371
  }
94
2372
 
95
- .fb-launcher:focus-visible {
96
- outline: 2px solid var(--fb-color-accent);
97
- outline-offset: 2px;
2373
+ .fb-launcher__button:focus-visible,
2374
+ .fb-launcher__tuck:focus-visible {
2375
+ outline: 2px solid var(--fb-color-on-emphasis);
2376
+ outline-offset: -3px;
2377
+ border-radius: 999px;
98
2378
  }
99
2379
 
100
2380
  .fb-launcher__icon {
@@ -108,154 +2388,731 @@ var ke = `
108
2388
  white-space: nowrap;
109
2389
  }
110
2390
 
2391
+ .fb-launcher__divider {
2392
+ width: 1px;
2393
+ margin: 9px 0;
2394
+ flex: none;
2395
+ background: rgba(255, 255, 255, 0.28);
2396
+ }
2397
+
2398
+ .fb-launcher__tuck {
2399
+ display: inline-flex;
2400
+ align-items: center;
2401
+ justify-content: center;
2402
+ box-sizing: border-box;
2403
+ width: 32px;
2404
+ height: 100%;
2405
+ padding: 0;
2406
+ border: 0;
2407
+ background: transparent;
2408
+ color: rgba(255, 255, 255, 0.82);
2409
+ cursor: pointer;
2410
+ }
2411
+
2412
+ .fb-launcher__tuck:hover {
2413
+ color: var(--fb-color-on-emphasis);
2414
+ }
2415
+
2416
+ .fb-launcher__tuck-icon {
2417
+ display: block;
2418
+ width: 14px;
2419
+ height: 14px;
2420
+ }
2421
+
2422
+ /* The corner hover-zone that peeks a tucked launcher back — inert until tucked,
2423
+ * so it never swallows the host page's own bottom-right clicks. */
2424
+ .fb-launcher__peekzone {
2425
+ position: fixed;
2426
+ right: 0;
2427
+ bottom: 0;
2428
+ z-index: 1;
2429
+ width: 160px;
2430
+ height: 160px;
2431
+ pointer-events: none;
2432
+ }
2433
+
2434
+ /* The edge nub: the visible re-reveal affordance, hidden until tucked. */
2435
+ .fb-launcher__nub {
2436
+ position: fixed;
2437
+ right: 0;
2438
+ bottom: 22px;
2439
+ z-index: 2;
2440
+ width: 13px;
2441
+ height: 42px;
2442
+ border-radius: 9px 0 0 9px;
2443
+ background: var(--fb-color-accent);
2444
+ box-shadow: -6px 5px 18px rgba(47, 111, 237, 0.4);
2445
+ cursor: pointer;
2446
+ opacity: 0;
2447
+ transform: translateX(10px);
2448
+ pointer-events: none;
2449
+ transition:
2450
+ opacity 220ms ease,
2451
+ transform 220ms ease;
2452
+ }
2453
+
2454
+ /* Tucked and not peeking: slide the pill off, reveal the nub, arm the zone. */
2455
+ :host([data-fb-hidden]:not([data-fb-peeking])) .fb-launcher {
2456
+ transform: translateX(calc(100% + 30px));
2457
+ }
2458
+
2459
+ :host([data-fb-hidden]:not([data-fb-peeking])) .fb-launcher__nub {
2460
+ opacity: 1;
2461
+ transform: none;
2462
+ pointer-events: auto;
2463
+ }
2464
+
2465
+ :host([data-fb-hidden]) .fb-launcher__peekzone {
2466
+ pointer-events: auto;
2467
+ }
2468
+
2469
+ /* Toasts: the first-visit welcome (above the pill) and the tuck-away hint. */
2470
+ .fb-launcher__welcome,
2471
+ .fb-launcher__hint {
2472
+ position: fixed;
2473
+ right: 20px;
2474
+ z-index: 5;
2475
+ box-sizing: border-box;
2476
+ color: #fff;
2477
+ font-size: 12px;
2478
+ line-height: 1.45;
2479
+ background: var(--fb-color-surface-inverse);
2480
+ border-radius: 10px;
2481
+ box-shadow: 0 12px 30px rgba(15, 40, 70, 0.32);
2482
+ animation: fbToast 300ms ease both;
2483
+ }
2484
+
2485
+ .fb-launcher__welcome {
2486
+ bottom: 70px;
2487
+ max-width: 210px;
2488
+ padding: 9px 13px;
2489
+ }
2490
+
2491
+ .fb-launcher__welcome strong {
2492
+ color: #8fc0ff;
2493
+ font-weight: 600;
2494
+ }
2495
+
2496
+ .fb-launcher__hint {
2497
+ bottom: 20px;
2498
+ max-width: 232px;
2499
+ padding: 10px 13px;
2500
+ }
2501
+
2502
+ /* The pulse that draws the eye while the welcome shows. */
2503
+ .fb-launcher--pulse {
2504
+ animation: fbPulse 1.8s ease-in-out 2;
2505
+ }
2506
+
2507
+ @keyframes fbPulse {
2508
+ 0%,
2509
+ 100% {
2510
+ box-shadow:
2511
+ 0 6px 18px rgba(15, 23, 32, 0.16),
2512
+ 0 0 0 0 rgba(47, 111, 237, 0.45);
2513
+ }
2514
+ 50% {
2515
+ box-shadow:
2516
+ 0 6px 18px rgba(15, 23, 32, 0.16),
2517
+ 0 0 0 12px rgba(47, 111, 237, 0);
2518
+ }
2519
+ }
2520
+
2521
+ @keyframes fbToast {
2522
+ from {
2523
+ opacity: 0;
2524
+ transform: translateY(14px);
2525
+ }
2526
+ to {
2527
+ opacity: 1;
2528
+ transform: none;
2529
+ }
2530
+ }
2531
+
2532
+ /* Reduce motion — the explicit opt-in and the OS setting both still it all. */
2533
+ :host([data-fb-reduce-motion]) .fb-launcher,
2534
+ :host([data-fb-reduce-motion]) .fb-launcher__nub {
2535
+ transition: none;
2536
+ }
2537
+
2538
+ :host([data-fb-reduce-motion]) .fb-launcher--pulse,
2539
+ :host([data-fb-reduce-motion]) .fb-launcher__welcome,
2540
+ :host([data-fb-reduce-motion]) .fb-launcher__hint {
2541
+ animation: none;
2542
+ }
2543
+
111
2544
  @media (prefers-reduced-motion: reduce) {
112
- .fb-launcher {
2545
+ .fb-launcher,
2546
+ .fb-launcher__nub {
113
2547
  transition: none;
114
2548
  }
2549
+ .fb-launcher--pulse,
2550
+ .fb-launcher__welcome,
2551
+ .fb-launcher__hint {
2552
+ animation: none;
2553
+ }
2554
+ }
2555
+ `, Ot = "data-fixback-root", et = "fixback:launch", ea = "fixback:welcomed:", ta = 5e3, na = 4400, ra = 280, oa = '<svg class="fb-launcher__icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M3.25 2h9.5A1.25 1.25 0 0 1 14 3.25v6.5A1.25 1.25 0 0 1 12.75 11H7.6l-3.19 2.55A.6.6 0 0 1 3.4 13.1V11h-.15A1.25 1.25 0 0 1 2 9.75v-6.5A1.25 1.25 0 0 1 3.25 2Z"/></svg>', ia = '<svg class="fb-launcher__tuck-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M4 6l4 4 4-4"/></svg>';
2556
+ function aa(e, t) {
2557
+ const n = ea + (t != null ? t : "default");
2558
+ try {
2559
+ const r = e == null ? void 0 : e.localStorage;
2560
+ return r ? r.getItem(n) === "1" ? !1 : (r.setItem(n, "1"), !0) : !0;
2561
+ } catch {
2562
+ return !0;
2563
+ }
115
2564
  }
116
- `, Q = "data-fixback-root", U = "fixback:launch", we = '<svg class="fb-launcher__icon" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" d="M3.25 2h9.5A1.25 1.25 0 0 1 14 3.25v6.5A1.25 1.25 0 0 1 12.75 11H7.6l-3.19 2.55A.6.6 0 0 1 3.4 13.1V11h-.15A1.25 1.25 0 0 1 2 9.75v-6.5A1.25 1.25 0 0 1 3.25 2Z"/></svg>';
117
- function Ee(e) {
118
- const t = e.ownerDocument, o = t.querySelector(`[${Q}]`);
2565
+ function sa(e, t = {}) {
2566
+ const n = e.ownerDocument, r = n.defaultView, o = n.querySelector(`[${Ot}]`);
119
2567
  o && o.remove();
120
- const n = t.createElement("div");
121
- n.setAttribute(Q, ""), n.style.cssText = "position:fixed;right:20px;bottom:20px;z-index:2147483000;margin:0;padding:0;border:0;";
122
- const i = n.attachShadow({ mode: "open" }), l = t.createElement("style");
123
- l.textContent = ke, i.appendChild(l);
124
- const a = t.createElement("button");
125
- return a.type = "button", a.className = "fb-launcher", a.setAttribute("aria-haspopup", "dialog"), a.setAttribute("aria-label", "Give feedback"), a.innerHTML = `${we}<span class="fb-launcher__label">Feedback</span>`, a.addEventListener("click", () => {
126
- n.dispatchEvent(new CustomEvent(U, {
2568
+ const i = n.createElement("div");
2569
+ i.setAttribute(Ot, ""), i.style.cssText = "position:fixed;right:20px;bottom:20px;z-index:2147483000;margin:0;padding:0;border:0;", t.reduceMotion && i.setAttribute("data-fb-reduce-motion", "true");
2570
+ const a = i.attachShadow({ mode: "open" }), c = n.createElement("style");
2571
+ c.textContent = Qi, a.appendChild(c);
2572
+ const l = n.createElement("div");
2573
+ l.className = "fb-launcher";
2574
+ const d = n.createElement("button");
2575
+ d.type = "button", d.className = "fb-launcher__button", d.setAttribute("aria-haspopup", "dialog"), d.setAttribute("aria-label", "Give feedback"), d.innerHTML = `${oa}<span class="fb-launcher__label">Feedback</span>`, d.addEventListener("click", () => {
2576
+ i.dispatchEvent(new CustomEvent(et, {
127
2577
  bubbles: !0,
128
2578
  composed: !0
129
2579
  }));
130
- }), i.appendChild(a), e.appendChild(n), { host: n };
2580
+ });
2581
+ const p = n.createElement("span");
2582
+ p.className = "fb-launcher__divider", p.setAttribute("aria-hidden", "true");
2583
+ const s = n.createElement("button");
2584
+ s.type = "button", s.className = "fb-launcher__tuck", s.setAttribute("data-fb-tuck", ""), s.setAttribute("aria-label", "Hide feedback button"), s.title = "Tuck away — hover the corner to bring it back", s.innerHTML = ia, l.append(d, p, s);
2585
+ const h = n.createElement("div");
2586
+ h.className = "fb-launcher__peekzone", h.setAttribute("aria-hidden", "true");
2587
+ const f = n.createElement("div");
2588
+ f.className = "fb-launcher__nub", f.setAttribute("role", "button"), f.setAttribute("tabindex", "0"), f.setAttribute("aria-label", "Show feedback button"), a.append(l, h, f);
2589
+ let b = !1, m = !1, u, y, g, v, w;
2590
+ const S = () => {
2591
+ b ? i.setAttribute("data-fb-hidden", "true") : i.removeAttribute("data-fb-hidden"), b && m ? i.setAttribute("data-fb-peeking", "true") : i.removeAttribute("data-fb-peeking");
2592
+ }, k = () => {
2593
+ y !== void 0 && (clearTimeout(y), y = void 0), l.classList.remove("fb-launcher--pulse"), v == null || v.remove(), v = void 0;
2594
+ }, N = () => {
2595
+ g !== void 0 && (clearTimeout(g), g = void 0), w == null || w.remove(), w = void 0;
2596
+ }, T = () => {
2597
+ u !== void 0 && (clearTimeout(u), u = void 0), m || (m = !0, S());
2598
+ }, B = () => {
2599
+ u !== void 0 && clearTimeout(u), u = setTimeout(() => {
2600
+ u = void 0, m = !1, S();
2601
+ }, ra);
2602
+ };
2603
+ for (const D of [
2604
+ l,
2605
+ h,
2606
+ f
2607
+ ])
2608
+ D.addEventListener("mouseenter", T), D.addEventListener("mouseleave", B);
2609
+ const x = () => {
2610
+ u !== void 0 && (clearTimeout(u), u = void 0), b = !1, m = !1, S(), N();
2611
+ }, L = () => {
2612
+ k(), b = !0, m = !1, S(), N(), w = n.createElement("div"), w.className = "fb-launcher__hint", w.setAttribute("role", "status"), w.textContent = "Tucked away down here. Hover the bottom-right corner and I'll bring it back.", a.appendChild(w), g = setTimeout(N, na);
2613
+ };
2614
+ return s.addEventListener("click", L), f.addEventListener("click", x), f.addEventListener("keydown", (D) => {
2615
+ (D.key === "Enter" || D.key === " " || D.key === "Spacebar") && (D.preventDefault(), x());
2616
+ }), aa(r, t.key) && (v = n.createElement("div"), v.className = "fb-launcher__welcome", v.setAttribute("role", "status"), v.innerHTML = "You're all set — tap <strong>Feedback</strong> any time to report something.", a.appendChild(v), t.reduceMotion || l.classList.add("fb-launcher--pulse"), y = setTimeout(k, ta)), e.appendChild(i), {
2617
+ host: i,
2618
+ dispose: () => {
2619
+ u !== void 0 && clearTimeout(u), y !== void 0 && clearTimeout(y), g !== void 0 && clearTimeout(g);
2620
+ }
2621
+ };
131
2622
  }
132
- function Se(e) {
133
- e.host.remove();
2623
+ function la(e) {
2624
+ e.dispose(), e.host.remove();
134
2625
  }
135
- var ne = ["data-fixback-root", "data-fixback-overlay"], Ce = ne.map((e) => `[${e}]`).join(",");
136
- function Te(e) {
137
- let t = e instanceof Node ? e : null;
138
- for (; t; ) {
139
- if (t instanceof Element) {
140
- for (const n of ne) if (t.hasAttribute(n)) return !0;
141
- }
142
- const o = t.getRootNode();
143
- if (o instanceof ShadowRoot && o !== t) {
144
- t = o.host;
145
- continue;
146
- }
147
- t = t.parentNode;
148
- }
149
- return !1;
2626
+ var ca = `
2627
+ :host {
2628
+ --fb-color-accent: #2f6fed;
2629
+ --fb-color-accent-hover: #245fd0;
2630
+ --fb-color-on-emphasis: #ffffff;
2631
+ --fb-color-ink: #0f1720;
2632
+ --fb-color-text: #1a2530;
2633
+ --fb-color-muted: #5a6875;
2634
+ --fb-color-faint: #9aa7b2;
2635
+ --fb-color-hint: #b7c1cb;
2636
+ --fb-color-border: #dce3ea;
2637
+ --fb-color-border-soft: #e6ebf0;
2638
+ --fb-color-surface: #ffffff;
2639
+ --fb-color-card: #f6f8fa;
2640
+ --fb-color-accent-bg: #eaf1fe;
2641
+ --fb-color-success: #2f9e5b;
2642
+ --fb-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto,
2643
+ Helvetica, Arial, sans-serif;
2644
+ --fb-font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas,
2645
+ monospace;
2646
+ all: initial;
150
2647
  }
151
- function Ie(e) {
152
- for (const t of Array.from(e.querySelectorAll(Ce))) t.remove();
2648
+
2649
+ *, *::before, *::after { box-sizing: border-box; }
2650
+
2651
+ .fb-ob-backdrop {
2652
+ position: fixed;
2653
+ inset: 0;
2654
+ z-index: 2147483010;
2655
+ display: flex;
2656
+ align-items: center;
2657
+ justify-content: center;
2658
+ padding: 24px;
2659
+ background: rgba(15, 23, 32, 0.55);
2660
+ backdrop-filter: blur(3px);
2661
+ font-family: var(--fb-font-sans);
2662
+ color: var(--fb-color-text);
2663
+ animation: fb-ob-fade 0.25s ease both;
153
2664
  }
154
- function ee(e) {
155
- const t = globalThis.CSS;
156
- return t != null && t.escape ? t.escape(e) : e.replace(/[^\w-]/g, (o) => `\\${o}`);
2665
+
2666
+ .fb-ob-panel {
2667
+ width: 400px;
2668
+ max-width: 100%;
2669
+ background: var(--fb-color-surface);
2670
+ border-radius: 16px;
2671
+ box-shadow: 0 30px 70px rgba(15, 40, 70, 0.4);
2672
+ overflow: hidden;
2673
+ animation: fb-ob-pop 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both;
157
2674
  }
158
- function Le(e) {
159
- let t = 1, o = e.previousElementSibling;
160
- for (; o; )
161
- o.tagName === e.tagName && (t += 1), o = o.previousElementSibling;
162
- return t;
2675
+
2676
+ .fb-ob-head {
2677
+ padding: 22px 24px 0;
2678
+ display: flex;
2679
+ align-items: center;
2680
+ gap: 10px;
163
2681
  }
164
- function Ae(e) {
165
- if (e.id) return `#${ee(e.id)}`;
166
- const t = [];
167
- let o = e;
168
- for (; o && o.tagName.toLowerCase() !== "html"; ) {
169
- if (o.id) {
170
- t.unshift(`#${ee(o.id)}`);
171
- break;
172
- }
173
- const n = o.tagName.toLowerCase(), i = o.parentElement;
174
- if (i) {
175
- const l = Array.from(i.children).filter((a) => a.tagName === o.tagName);
176
- t.unshift(l.length > 1 ? `${n}:nth-of-type(${Le(o)})` : n);
177
- } else t.unshift(n);
178
- o = i;
179
- }
180
- return t.join(" > ");
2682
+ .fb-ob-mark {
2683
+ width: 22px;
2684
+ height: 22px;
2685
+ border-radius: 6px;
2686
+ background: var(--fb-color-accent);
2687
+ flex: none;
2688
+ display: flex;
2689
+ align-items: center;
2690
+ justify-content: center;
2691
+ }
2692
+ .fb-ob-mark::after {
2693
+ content: "";
2694
+ width: 7px;
2695
+ height: 7px;
2696
+ border-radius: 2px;
2697
+ background: #fff;
2698
+ }
2699
+ .fb-ob-brand { font-size: 15px; font-weight: 600; color: var(--fb-color-ink); }
2700
+ .fb-ob-chip {
2701
+ margin-left: auto;
2702
+ font-family: var(--fb-font-mono);
2703
+ font-size: 10px;
2704
+ color: #8a97a3;
2705
+ border: 1px solid var(--fb-color-border-soft);
2706
+ border-radius: 6px;
2707
+ padding: 2px 7px;
2708
+ }
2709
+
2710
+ .fb-ob-body { padding: 16px 24px 8px; }
2711
+ .fb-ob-title {
2712
+ font-size: 19px;
2713
+ font-weight: 700;
2714
+ color: var(--fb-color-ink);
2715
+ letter-spacing: -0.01em;
2716
+ }
2717
+ .fb-ob-lede {
2718
+ font-size: 13.5px;
2719
+ color: var(--fb-color-muted);
2720
+ line-height: 1.5;
2721
+ margin: 7px 0 0;
2722
+ }
2723
+ .fb-ob-lede strong { color: var(--fb-color-text); }
2724
+
2725
+ .fb-ob-card {
2726
+ margin: 16px 0;
2727
+ padding: 13px 14px;
2728
+ background: var(--fb-color-card);
2729
+ border: 1px solid var(--fb-color-border-soft);
2730
+ border-radius: 10px;
2731
+ display: flex;
2732
+ flex-direction: column;
2733
+ gap: 10px;
2734
+ }
2735
+ .fb-ob-row { display: flex; align-items: center; gap: 10px; }
2736
+ .fb-ob-row + .fb-ob-row {
2737
+ border-top: 1px solid #eef2f6;
2738
+ padding-top: 10px;
2739
+ }
2740
+ .fb-ob-rowlabel {
2741
+ font-family: var(--fb-font-mono);
2742
+ font-size: 10px;
2743
+ color: var(--fb-color-faint);
2744
+ width: 70px;
2745
+ flex: none;
2746
+ }
2747
+ .fb-ob-site { font-size: 13px; color: var(--fb-color-text); font-weight: 500; }
2748
+ .fb-ob-tier {
2749
+ font-size: 11px;
2750
+ font-weight: 600;
2751
+ color: var(--fb-color-accent);
2752
+ background: var(--fb-color-accent-bg);
2753
+ padding: 3px 9px;
2754
+ border-radius: 6px;
2755
+ }
2756
+ .fb-ob-tiernote { font-size: 11.5px; color: #8a97a3; }
2757
+
2758
+ .fb-ob-fieldlabel {
2759
+ display: block;
2760
+ font-family: var(--fb-font-mono);
2761
+ font-size: 10px;
2762
+ letter-spacing: 0.05em;
2763
+ text-transform: uppercase;
2764
+ color: var(--fb-color-faint);
2765
+ margin-bottom: 6px;
2766
+ }
2767
+ .fb-ob-fields { display: flex; gap: 8px; }
2768
+ .fb-ob-input {
2769
+ height: 38px;
2770
+ padding: 0 12px;
2771
+ border: 1px solid var(--fb-color-border);
2772
+ border-radius: 9px;
2773
+ font-family: inherit;
2774
+ font-size: 13px;
2775
+ color: var(--fb-color-text);
2776
+ outline: none;
2777
+ min-width: 0;
2778
+ }
2779
+ .fb-ob-input:focus { border-color: var(--fb-color-accent); }
2780
+ .fb-ob-name { flex: 1; }
2781
+ .fb-ob-email { flex: 1.3; font-family: var(--fb-font-mono); font-size: 12.5px; color: var(--fb-color-muted); }
2782
+
2783
+ .fb-ob-privacy {
2784
+ display: flex;
2785
+ align-items: flex-start;
2786
+ gap: 8px;
2787
+ margin-top: 14px;
2788
+ font-size: 11.5px;
2789
+ color: #8a97a3;
2790
+ line-height: 1.5;
2791
+ }
2792
+ .fb-ob-privacy svg { flex: none; margin-top: 1px; }
2793
+ .fb-ob-privacy strong { color: var(--fb-color-muted); }
2794
+
2795
+ .fb-ob-foot { padding: 16px 24px 22px; }
2796
+ .fb-ob-confirm {
2797
+ width: 100%;
2798
+ height: 44px;
2799
+ border: 0;
2800
+ border-radius: 11px;
2801
+ background: var(--fb-color-accent);
2802
+ color: var(--fb-color-on-emphasis);
2803
+ font-family: inherit;
2804
+ font-size: 14px;
2805
+ font-weight: 600;
2806
+ cursor: pointer;
2807
+ }
2808
+ .fb-ob-confirm:hover { background: var(--fb-color-accent-hover); }
2809
+ .fb-ob-confirm:disabled { opacity: 0.6; cursor: default; }
2810
+
2811
+ @keyframes fb-ob-fade { from { opacity: 0; } to { opacity: 1; } }
2812
+ @keyframes fb-ob-pop {
2813
+ from { opacity: 0; transform: translateY(8px) scale(0.98); }
2814
+ to { opacity: 1; transform: none; }
181
2815
  }
182
- function Ne(e) {
183
- const t = e.tagName.toLowerCase();
184
- if (e.id) return `${t}#${e.id}`;
185
- const o = e.classList[0];
186
- return o ? `${t}.${o}` : t;
2816
+
2817
+ @media (prefers-reduced-motion: reduce) {
2818
+ .fb-ob-backdrop, .fb-ob-panel { animation: none; }
187
2819
  }
188
- function _e(e) {
189
- const t = [];
190
- let o = e;
191
- for (; o; )
192
- t.unshift(Ne(o)), o = o.parentElement;
193
- return t.join(" > ");
2820
+ `, ua = "data-fixback-onboard", da = {
2821
+ invited: "Invited tester",
2822
+ internal: "Internal",
2823
+ public: "Public"
2824
+ }, fa = {
2825
+ invited: "reviewed before it ships",
2826
+ internal: "ships straight through",
2827
+ public: "tracked, not auto-shipped"
2828
+ }, pa = '<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="#2f9e5b" stroke-width="1.5" aria-hidden="true"><path d="M8 1.8 13.5 4v3.5c0 3.6-2.4 5.6-5.5 6.7C4.9 13.1 2.5 11.1 2.5 7.5V4z"/><path d="M5.8 8 7.3 9.5 10.3 6.2"/></svg>';
2829
+ function A(e, t, n = {}, r = []) {
2830
+ const o = e.createElement(t);
2831
+ for (const [i, a] of Object.entries(n)) a !== void 0 && o.setAttribute(i, a);
2832
+ for (const i of r) o.appendChild(typeof i == "string" ? e.createTextNode(i) : i);
2833
+ return o;
194
2834
  }
195
- function Oe(e) {
196
- const t = e.getBoundingClientRect();
197
- return {
198
- x: Math.round(t.x),
199
- y: Math.round(t.y),
200
- width: Math.round(t.width),
201
- height: Math.round(t.height)
2835
+ function we(e) {
2836
+ const t = e.trim();
2837
+ return t.length > 0 ? t : void 0;
2838
+ }
2839
+ function ba(e) {
2840
+ var t, n, r, o, i, a;
2841
+ const c = (t = e.target) !== null && t !== void 0 ? t : document.body, l = (n = e.doc) !== null && n !== void 0 ? n : c.ownerDocument;
2842
+ (r = l.querySelector("[data-fixback-onboard]")) === null || r === void 0 || r.remove();
2843
+ const d = A(l, "div", { [ua]: "" }), p = d.attachShadow({ mode: "open" }), s = l.createElement("style");
2844
+ s.textContent = ca, p.appendChild(s);
2845
+ const h = A(l, "div", { class: "fb-ob-head" }, [
2846
+ A(l, "span", { class: "fb-ob-mark" }),
2847
+ A(l, "span", { class: "fb-ob-brand" }, ["Fixback"]),
2848
+ A(l, "span", { class: "fb-ob-chip" }, ["invite link"])
2849
+ ]), f = A(l, "p", { class: "fb-ob-lede" }, [
2850
+ "You've been invited to give feedback on ",
2851
+ A(l, "strong", {}, [e.origin]),
2852
+ ". Point, mark up, send."
2853
+ ]), b = A(l, "div", { class: "fb-ob-card" }, [A(l, "div", { class: "fb-ob-row" }, [A(l, "span", { class: "fb-ob-rowlabel" }, ["SITE"]), A(l, "span", { class: "fb-ob-site" }, [e.origin])]), A(l, "div", { class: "fb-ob-row" }, [
2854
+ A(l, "span", { class: "fb-ob-rowlabel" }, ["ACCESS"]),
2855
+ A(l, "span", { class: "fb-ob-tier" }, [da[e.tier]]),
2856
+ A(l, "span", { class: "fb-ob-tiernote" }, [fa[e.tier]])
2857
+ ])]), m = A(l, "input", {
2858
+ class: "fb-ob-input fb-ob-name",
2859
+ type: "text",
2860
+ "aria-label": "Name",
2861
+ placeholder: "Name"
2862
+ }), u = A(l, "input", {
2863
+ class: "fb-ob-input fb-ob-email",
2864
+ type: "email",
2865
+ "aria-label": "Email",
2866
+ placeholder: "email@example.com"
2867
+ });
2868
+ !((o = e.defaults) === null || o === void 0) && o.name && (m.value = e.defaults.name), !((i = e.defaults) === null || i === void 0) && i.email && (u.value = e.defaults.email);
2869
+ const y = A(l, "div", { class: "fb-ob-privacy" }), g = A(l, "span");
2870
+ g.innerHTML = pa, y.appendChild((a = g.firstChild) !== null && a !== void 0 ? a : l.createTextNode("")), y.appendChild(A(l, "span", {}, [A(l, "strong", {}, ["Private by default."]), " Anything you type is masked before it leaves your browser."]));
2871
+ const v = A(l, "div", { class: "fb-ob-body" }, [
2872
+ A(l, "div", { class: "fb-ob-title" }, ["You're invited to give feedback"]),
2873
+ f,
2874
+ b,
2875
+ A(l, "label", {
2876
+ class: "fb-ob-fieldlabel",
2877
+ for: "fb-ob-name-input"
2878
+ }, ["Continue as"]),
2879
+ A(l, "div", { class: "fb-ob-fields" }, [m, u]),
2880
+ y
2881
+ ]);
2882
+ m.id = "fb-ob-name-input";
2883
+ const w = A(l, "button", {
2884
+ type: "button",
2885
+ class: "fb-ob-confirm"
2886
+ }, ["Start giving feedback"]), S = A(l, "div", { class: "fb-ob-backdrop" }, [A(l, "div", {
2887
+ class: "fb-ob-panel",
2888
+ role: "dialog",
2889
+ "aria-modal": "true",
2890
+ "aria-label": "Fixback invite"
2891
+ }, [
2892
+ h,
2893
+ v,
2894
+ A(l, "div", { class: "fb-ob-foot" }, [w])
2895
+ ])]);
2896
+ p.appendChild(S);
2897
+ let k = !1;
2898
+ return w.addEventListener("click", () => {
2899
+ if (k) return;
2900
+ k = !0, w.disabled = !0;
2901
+ const N = {
2902
+ ...we(m.value) ? { name: we(m.value) } : {},
2903
+ ...we(u.value) ? { email: we(u.value) } : {}
2904
+ };
2905
+ e.onConfirm(N);
2906
+ }), c.appendChild(d), {
2907
+ host: d,
2908
+ destroy: () => d.remove()
202
2909
  };
203
2910
  }
204
- function Re(e) {
205
- return {
206
- selector: Ae(e),
207
- domPath: _e(e),
208
- tag: e.tagName.toLowerCase(),
209
- rect: Oe(e)
2911
+ var ha = "http://www.w3.org/2000/svg", Xe = "3", zt = 4, ma = '600 16px "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
2912
+ function va(e) {
2913
+ var t, n;
2914
+ const r = (t = e.doc) !== null && t !== void 0 ? t : document, { svg: o, textInput: i } = e, a = (n = e.color) !== null && n !== void 0 ? n : Hr;
2915
+ let c = "arrow", l = e.initialMarks ? e.initialMarks.slice() : [], d = null, p = !1, s = null, h = !1;
2916
+ function f() {
2917
+ var x;
2918
+ (x = e.onChange) === null || x === void 0 || x.call(e, l.slice());
2919
+ }
2920
+ function b(x) {
2921
+ return {
2922
+ x: Math.round(x.clientX),
2923
+ y: Math.round(x.clientY)
2924
+ };
2925
+ }
2926
+ function m(x) {
2927
+ const L = typeof x.composedPath == "function" ? x.composedPath() : [x.target];
2928
+ for (const F of L) {
2929
+ if (F === r) break;
2930
+ if (F instanceof Element) {
2931
+ const D = F.tagName;
2932
+ if (D === "BUTTON" || D === "INPUT" || D === "TEXTAREA") return !0;
2933
+ }
2934
+ }
2935
+ return !1;
2936
+ }
2937
+ function u(x) {
2938
+ return x.type === "pen" ? x.points.length > 1 : x.type === "text" ? x.text.trim().length > 0 : Math.abs(x.x1 - x.x0) > zt || Math.abs(x.y1 - x.y0) > zt;
2939
+ }
2940
+ function y(x) {
2941
+ if (h || p || m(x)) return;
2942
+ const L = b(x);
2943
+ if (c === "text") {
2944
+ w(L);
2945
+ return;
2946
+ }
2947
+ x.cancelable && x.preventDefault(), p = !0, d = c === "pen" ? {
2948
+ type: "pen",
2949
+ points: [L],
2950
+ color: a
2951
+ } : {
2952
+ type: c,
2953
+ x0: L.x,
2954
+ y0: L.y,
2955
+ x1: L.x,
2956
+ y1: L.y,
2957
+ color: a
2958
+ }, T();
2959
+ }
2960
+ function g(x) {
2961
+ if (h || !p || !d) return;
2962
+ const L = b(x);
2963
+ d.type === "pen" ? d = {
2964
+ type: "pen",
2965
+ points: [...d.points, L],
2966
+ color: d.color
2967
+ } : d = {
2968
+ ...d,
2969
+ x1: L.x,
2970
+ y1: L.y
2971
+ }, T();
2972
+ }
2973
+ function v() {
2974
+ if (h || !p) return;
2975
+ p = !1;
2976
+ const x = d;
2977
+ d = null, x && u(x) && (l = [...l, x], f()), T();
2978
+ }
2979
+ function w(x) {
2980
+ s = x, i.value = "", i.style.display = "block", i.style.left = `${x.x}px`, i.style.top = `${x.y}px`, i.onkeydown = S, i.onblur = k, setTimeout(() => {
2981
+ try {
2982
+ i.focus();
2983
+ } catch {
2984
+ }
2985
+ }, 0);
2986
+ }
2987
+ function S(x) {
2988
+ x.key === "Enter" ? (x.preventDefault(), x.stopPropagation(), k()) : x.key === "Escape" && (x.preventDefault(), x.stopPropagation(), N());
2989
+ }
2990
+ function k() {
2991
+ if (!s) return;
2992
+ const x = i.value.trim(), L = s;
2993
+ N(), x.length > 0 && (l = [...l, {
2994
+ type: "text",
2995
+ x: L.x,
2996
+ y: L.y,
2997
+ text: x,
2998
+ color: a
2999
+ }], f(), T());
3000
+ }
3001
+ function N() {
3002
+ s = null, i.onkeydown = null, i.onblur = null, i.value = "", i.style.display = "none";
3003
+ }
3004
+ function T() {
3005
+ for (; o.firstChild; ) o.removeChild(o.firstChild);
3006
+ for (const x of l) o.appendChild(jt(r, x));
3007
+ d && o.appendChild(jt(r, d));
3008
+ }
3009
+ function B() {
3010
+ h || (h = !0, r.removeEventListener("mousedown", y, !0), r.removeEventListener("mousemove", g, !0), r.removeEventListener("mouseup", v, !0), N());
3011
+ }
3012
+ return r.addEventListener("mousedown", y, !0), r.addEventListener("mousemove", g, !0), r.addEventListener("mouseup", v, !0), T(), {
3013
+ setTool: (x) => {
3014
+ c = x;
3015
+ },
3016
+ getTool: () => c,
3017
+ undo: () => {
3018
+ l.length !== 0 && (l = l.slice(0, -1), f(), T());
3019
+ },
3020
+ marks: () => l.slice(),
3021
+ stop: B
210
3022
  };
211
3023
  }
212
- function Me(e) {
213
- var t, o;
214
- const n = (t = e.doc) !== null && t !== void 0 ? t : document, i = (o = e.ignore) !== null && o !== void 0 ? o : Te;
215
- let l = null, a = !1;
216
- function c(u) {
217
- var f;
218
- const y = (f = (typeof u.composedPath == "function" ? u.composedPath() : [])[0]) !== null && f !== void 0 ? f : u.target;
219
- return y instanceof Element ? i(y) ? null : y : null;
3024
+ function jt(e, t) {
3025
+ switch (t.type) {
3026
+ case "box":
3027
+ return ee(e, "rect", {
3028
+ x: String(Math.min(t.x0, t.x1)),
3029
+ y: String(Math.min(t.y0, t.y1)),
3030
+ width: String(Math.abs(t.x1 - t.x0)),
3031
+ height: String(Math.abs(t.y1 - t.y0)),
3032
+ rx: "2",
3033
+ fill: "none",
3034
+ stroke: t.color,
3035
+ "stroke-width": Xe
3036
+ });
3037
+ case "pen":
3038
+ return ee(e, "polyline", {
3039
+ points: t.points.map((n) => `${n.x},${n.y}`).join(" "),
3040
+ fill: "none",
3041
+ stroke: t.color,
3042
+ "stroke-width": Xe,
3043
+ "stroke-linecap": "round",
3044
+ "stroke-linejoin": "round"
3045
+ });
3046
+ case "text": {
3047
+ const n = ee(e, "text", {
3048
+ x: String(t.x),
3049
+ y: String(t.y),
3050
+ fill: t.color,
3051
+ style: `font:${ma}`
3052
+ });
3053
+ return n.textContent = t.text, n;
3054
+ }
3055
+ case "arrow": {
3056
+ const n = ee(e, "g", {});
3057
+ n.appendChild(ee(e, "line", {
3058
+ x1: String(t.x0),
3059
+ y1: String(t.y0),
3060
+ x2: String(t.x1),
3061
+ y2: String(t.y1),
3062
+ stroke: t.color,
3063
+ "stroke-width": Xe,
3064
+ "stroke-linecap": "round"
3065
+ }));
3066
+ const r = Vr(t.x0, t.y0, t.x1, t.y1);
3067
+ return n.appendChild(ee(e, "polygon", {
3068
+ points: r.map((o) => `${o.x},${o.y}`).join(" "),
3069
+ fill: t.color
3070
+ })), n;
3071
+ }
220
3072
  }
221
- function b(u) {
222
- var f;
223
- a || (l = c(u), (f = e.onHover) === null || f === void 0 || f.call(e, l));
3073
+ }
3074
+ function ee(e, t, n) {
3075
+ const r = e.createElementNS(ha, t);
3076
+ for (const [o, i] of Object.entries(n)) r.setAttribute(o, i);
3077
+ return r;
3078
+ }
3079
+ var ga = 12;
3080
+ function ya(e) {
3081
+ var t, n;
3082
+ const r = (t = e.doc) !== null && t !== void 0 ? t : document, o = (n = e.minSize) !== null && n !== void 0 ? n : ga;
3083
+ let i = null, a = !1;
3084
+ function c(h) {
3085
+ a || i || (i = {
3086
+ x: h.clientX,
3087
+ y: h.clientY
3088
+ }, h.cancelable && h.preventDefault());
224
3089
  }
225
- function p(u) {
3090
+ function l(h) {
226
3091
  var f;
227
- if (a) return;
228
- const y = (f = c(u)) !== null && f !== void 0 ? f : l;
229
- y && (u.preventDefault(), u.stopPropagation(), s(), e.onPick(y));
3092
+ a || !i || (f = e.onProgress) === null || f === void 0 || f.call(e, Lt(i.x, i.y, h.clientX, h.clientY));
230
3093
  }
231
- function g(u) {
232
- if (!a && u.key === "Escape") {
3094
+ function d(h) {
3095
+ if (a || !i) return;
3096
+ const f = Lt(i.x, i.y, h.clientX, h.clientY);
3097
+ if (i = null, s(), f.width < o || f.height < o) {
3098
+ var b;
3099
+ (b = e.onCancel) === null || b === void 0 || b.call(e);
3100
+ return;
3101
+ }
3102
+ e.onComplete(f);
3103
+ }
3104
+ function p(h) {
3105
+ if (!a && h.key === "Escape") {
233
3106
  var f;
234
- u.preventDefault(), s(), (f = e.onCancel) === null || f === void 0 || f.call(e);
3107
+ h.preventDefault(), s(), (f = e.onCancel) === null || f === void 0 || f.call(e);
235
3108
  }
236
3109
  }
237
3110
  function s() {
238
- a || (a = !0, n.removeEventListener("mouseover", b, !0), n.removeEventListener("click", p, !0), n.removeEventListener("keydown", g, !0), l = null);
3111
+ a || (a = !0, r.removeEventListener("mousedown", c, !0), r.removeEventListener("mousemove", l, !0), r.removeEventListener("mouseup", d, !0), r.removeEventListener("keydown", p, !0), i = null);
239
3112
  }
240
- return n.addEventListener("mouseover", b, !0), n.addEventListener("click", p, !0), n.addEventListener("keydown", g, !0), { stop: s };
241
- }
242
- function Be(e, t) {
243
- var o;
244
- const n = {}, i = e.innerWidth;
245
- typeof i == "number" && i > 0 && (n.viewportWidth = Math.round(i));
246
- const l = e.innerHeight;
247
- typeof l == "number" && l > 0 && (n.viewportHeight = Math.round(l));
248
- const a = (o = e.navigator) === null || o === void 0 ? void 0 : o.userAgent;
249
- return typeof a == "string" && a.length > 0 && (n.browser = a), t.length > 0 && (n.sdkVersion = t), n;
250
- }
251
- function ze(e) {
252
- var t;
253
- const o = {};
254
- e.kind && (o.kind = e.kind);
255
- const n = (t = e.comment) === null || t === void 0 ? void 0 : t.trim();
256
- return n && (o.comment = n), e.url && (o.url = e.url), e.environment && Object.keys(e.environment).length > 0 && (o.environment = e.environment), e.element && (o.annotation = e.element), o;
3113
+ return r.addEventListener("mousedown", c, !0), r.addEventListener("mousemove", l, !0), r.addEventListener("mouseup", d, !0), r.addEventListener("keydown", p, !0), { stop: s };
257
3114
  }
258
- var Pe = `
3115
+ var wa = `
259
3116
  :host {
260
3117
  --fb-color-accent: #2f6fed;
261
3118
  --fb-color-accent-hover: #245fd0;
@@ -314,6 +3171,15 @@ var Pe = `
314
3171
  flex: none;
315
3172
  }
316
3173
  .fb-ov-brand { font-size: 14px; font-weight: 600; color: var(--fb-color-ink); }
3174
+ .fb-ov-tier {
3175
+ flex: none;
3176
+ font-family: var(--fb-font-mono);
3177
+ font-size: 9.5px;
3178
+ color: var(--fb-color-faint);
3179
+ border: 1px solid var(--fb-color-border-soft);
3180
+ border-radius: 5px;
3181
+ padding: 1px 6px;
3182
+ }
317
3183
  .fb-ov-close {
318
3184
  margin-left: auto;
319
3185
  border: 0;
@@ -400,8 +3266,9 @@ var Pe = `
400
3266
  .fb-ov-status { padding: 0 14px; font-size: 11px; min-height: 0; }
401
3267
  .fb-ov-status.is-error { color: var(--fb-color-bug); }
402
3268
 
403
- .fb-ov-tools { display: flex; align-items: center; gap: 8px; padding: 8px 14px 14px; }
404
- .fb-ov-pickbtn {
3269
+ .fb-ov-tools { display: flex; align-items: center; gap: 7px; padding: 8px 14px 14px; }
3270
+ .fb-ov-pickbtn,
3271
+ .fb-ov-capturebtn {
405
3272
  display: inline-flex;
406
3273
  align-items: center;
407
3274
  gap: 6px;
@@ -414,13 +3281,18 @@ var Pe = `
414
3281
  padding: 8px 11px;
415
3282
  cursor: pointer;
416
3283
  }
417
- .fb-ov-pickbtn:hover { border-color: #cfd8e2; }
418
- .fb-ov-pickbtn.is-active {
3284
+ .fb-ov-capturebtn { padding: 8px 9px; }
3285
+ .fb-ov-pickbtn:hover,
3286
+ .fb-ov-capturebtn:hover { border-color: #cfd8e2; }
3287
+ .fb-ov-pickbtn.is-active,
3288
+ .fb-ov-capturebtn.is-active,
3289
+ .fb-ov-capturebtn.is-attached {
419
3290
  color: var(--fb-color-accent);
420
3291
  border-color: var(--fb-color-accent);
421
3292
  background: var(--fb-color-impr-bg);
422
3293
  }
423
3294
  .fb-ov-pickbtn__glyph { font-size: 14px; line-height: 1; }
3295
+ .fb-ov-icon { display: block; }
424
3296
 
425
3297
  .fb-ov-send {
426
3298
  margin-left: auto;
@@ -450,9 +3322,18 @@ var Pe = `
450
3322
  .fb-ov-done__title { font-size: 15px; font-weight: 600; color: var(--fb-color-ink); }
451
3323
  .fb-ov-done__sub { font-size: 12px; color: var(--fb-color-muted); margin-top: 4px; }
452
3324
 
453
- .fb-ov-pick { position: fixed; inset: 0; pointer-events: none; z-index: 2147483002; display: none; }
454
- .fb-ov-panel.is-picking + .fb-ov-pick { display: block; }
455
- .fb-ov-panel.is-picking { visibility: hidden; }
3325
+ /* The panel is hidden while any full-screen marking layer is active. */
3326
+ .fb-ov-panel.is-marking { visibility: hidden; }
3327
+
3328
+ .fb-ov-pick,
3329
+ .fb-ov-capture,
3330
+ .fb-ov-draw { position: fixed; inset: 0; z-index: 2147483002; display: none; }
3331
+ .fb-ov-pick.is-visible,
3332
+ .fb-ov-capture.is-visible,
3333
+ .fb-ov-draw.is-visible { display: block; }
3334
+
3335
+ /* Element-pick highlight layer — visual only, never intercepts host events. */
3336
+ .fb-ov-pick { pointer-events: none; }
456
3337
  .fb-ov-highlight {
457
3338
  position: absolute;
458
3339
  border: 2px dashed var(--fb-color-accent);
@@ -474,155 +3355,113 @@ var Pe = `
474
3355
  box-shadow: 0 8px 20px rgba(20, 40, 70, 0.25);
475
3356
  }
476
3357
 
477
- @media (prefers-reduced-motion: reduce) {
478
- .fb-ov-highlight { transition: none; }
3358
+ /* Region-capture layer — a dim wash with a live selection box. */
3359
+ .fb-ov-capture { cursor: crosshair; }
3360
+ .fb-ov-capture-dim { position: absolute; inset: 0; background: rgba(15, 23, 32, 0.28); }
3361
+ .fb-ov-capture-sel {
3362
+ position: absolute;
3363
+ border: 2px solid var(--fb-color-accent);
3364
+ border-radius: 4px;
3365
+ box-shadow: 0 0 0 100vmax rgba(15, 23, 32, 0.32);
479
3366
  }
480
- `;
481
- var $e = 32, He = /* @__PURE__ */ new Set([
482
- "button",
483
- "submit",
484
- "reset",
485
- "checkbox",
486
- "radio",
487
- "range",
488
- "color",
489
- "file",
490
- "image",
491
- "hidden"
492
- ]);
493
- function V(e) {
494
- const t = Math.min(Math.max(e, 1), $e);
495
- return "•".repeat(t);
3367
+
3368
+ /* Draw layer — the mark SVG, the region frame, the label input, and the toolbar. */
3369
+ .fb-ov-draw-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
3370
+ .fb-ov-draw-frame {
3371
+ position: absolute;
3372
+ border: 1px solid rgba(47, 111, 237, 0.5);
3373
+ border-radius: 4px;
3374
+ box-shadow: 0 0 0 100vmax rgba(15, 23, 32, 0.18);
3375
+ pointer-events: none;
496
3376
  }
497
- function Ve(e) {
498
- for (const n of Array.from(e.querySelectorAll("input"))) {
499
- var t;
500
- const i = ((t = n.getAttribute("type")) !== null && t !== void 0 ? t : "text").toLowerCase();
501
- if (He.has(i)) continue;
502
- const l = n.value;
503
- if (!l) continue;
504
- const a = V(l.length);
505
- n.value = a, n.setAttribute("value", a);
506
- }
507
- for (const n of Array.from(e.querySelectorAll("textarea"))) {
508
- const i = n.value || n.textContent || "";
509
- if (!i) continue;
510
- const l = V(i.length);
511
- n.value = l, n.textContent = l;
512
- }
513
- for (const n of Array.from(e.querySelectorAll("[contenteditable]"))) {
514
- var o;
515
- if (n.getAttribute("contenteditable") === "false") continue;
516
- const i = (o = n.textContent) !== null && o !== void 0 ? o : "";
517
- i.trim() && (n.textContent = V(i.length));
518
- }
3377
+ .fb-ov-draw-text {
3378
+ position: absolute;
3379
+ display: none;
3380
+ font-family: var(--fb-font-sans);
3381
+ font-size: 15px;
3382
+ font-weight: 600;
3383
+ color: var(--fb-color-bug);
3384
+ background: rgba(255, 255, 255, 0.92);
3385
+ border: 1px dashed var(--fb-color-bug);
3386
+ border-radius: 4px;
3387
+ padding: 2px 6px;
3388
+ outline: none;
3389
+ z-index: 3;
519
3390
  }
520
- function te(e, t, o) {
521
- const n = e == null ? void 0 : e[`inner${o}`], i = t.documentElement[`client${o}`];
522
- return Math.max(1, Math.round((typeof n == "number" && n > 0 ? n : i) || 0) || 1);
3391
+ .fb-ov-draw-toolbar {
3392
+ position: fixed;
3393
+ left: 50%;
3394
+ bottom: 26px;
3395
+ transform: translateX(-50%);
3396
+ display: flex;
3397
+ align-items: center;
3398
+ gap: 5px;
3399
+ background: var(--fb-color-ink);
3400
+ border-radius: 12px;
3401
+ padding: 7px;
3402
+ box-shadow: 0 16px 40px rgba(15, 40, 70, 0.4);
523
3403
  }
524
- function Ue(e, t, o) {
525
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${o}"><foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(e)}</div></foreignObject></svg>`;
3404
+ .fb-ov-drawtool {
3405
+ width: 34px;
3406
+ height: 34px;
3407
+ display: flex;
3408
+ align-items: center;
3409
+ justify-content: center;
3410
+ border: 0;
3411
+ border-radius: 8px;
3412
+ background: transparent;
3413
+ color: #c4ccd4;
3414
+ cursor: pointer;
3415
+ font-family: inherit;
526
3416
  }
527
- var je = 4e3, Fe = (e, { width: t, height: o, type: n }) => new Promise((i) => {
528
- let l = !1;
529
- const a = (c) => {
530
- l || (l = !0, i(c));
531
- };
532
- try {
533
- const c = new Image(), b = setTimeout(() => a(null), je);
534
- c.onload = () => {
535
- try {
536
- const p = document.createElement("canvas");
537
- p.width = t, p.height = o;
538
- const g = p.getContext("2d");
539
- if (!g) {
540
- clearTimeout(b), a(null);
541
- return;
542
- }
543
- g.drawImage(c, 0, 0), p.toBlob((s) => {
544
- clearTimeout(b), a(s);
545
- }, n);
546
- } catch {
547
- clearTimeout(b), a(null);
548
- }
549
- }, c.onerror = () => {
550
- clearTimeout(b), a(null);
551
- }, c.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
552
- } catch {
553
- a(null);
554
- }
555
- });
556
- async function De(e = {}) {
557
- try {
558
- var t, o, n, i, l, a;
559
- const c = (t = e.doc) !== null && t !== void 0 ? t : document, b = (o = (n = e.win) !== null && n !== void 0 ? n : c.defaultView) !== null && o !== void 0 ? o : void 0, p = (i = e.target) !== null && i !== void 0 ? i : c.documentElement, g = (l = e.type) !== null && l !== void 0 ? l : "image/png", s = te(b, c, "Width"), u = te(b, c, "Height"), f = p.cloneNode(!0);
560
- Ie(f), Ve(f);
561
- const y = Ue(f, s, u), h = await ((a = e.rasterize) !== null && a !== void 0 ? a : Fe)(y, {
562
- width: s,
563
- height: u,
564
- type: g
565
- });
566
- return h ? {
567
- blob: h,
568
- width: s,
569
- height: u,
570
- type: g
571
- } : null;
572
- } catch {
573
- return null;
574
- }
3417
+ .fb-ov-drawtool:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
3418
+ .fb-ov-drawtool.is-active { background: var(--fb-color-accent); color: var(--fb-color-on-emphasis); }
3419
+ .fb-ov-drawtool__t { font-weight: 700; font-size: 14px; line-height: 1; }
3420
+ .fb-ov-draw-divider { width: 1px; height: 22px; background: #2a343e; margin: 0 3px; }
3421
+ .fb-ov-draw-undo {
3422
+ width: 34px;
3423
+ height: 34px;
3424
+ display: flex;
3425
+ align-items: center;
3426
+ justify-content: center;
3427
+ border: 0;
3428
+ border-radius: 8px;
3429
+ background: transparent;
3430
+ color: #c4ccd4;
3431
+ cursor: pointer;
575
3432
  }
576
- var Ke = "screenshot";
577
- function qe(e) {
578
- return `${e.replace(/\/+$/, "")}/api/ingest/feedback`;
3433
+ .fb-ov-draw-undo:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: #fff; }
3434
+ .fb-ov-draw-undo:disabled { opacity: 0.4; cursor: default; }
3435
+ .fb-ov-draw-cancel {
3436
+ height: 34px;
3437
+ padding: 0 12px;
3438
+ border: 0;
3439
+ border-radius: 8px;
3440
+ background: transparent;
3441
+ color: var(--fb-color-faint);
3442
+ font-family: inherit;
3443
+ font-size: 12.5px;
3444
+ cursor: pointer;
579
3445
  }
580
- function Xe(e) {
581
- if (!e) return {};
582
- const t = {};
583
- return e.signedIdentity && (t.signedIdentity = e.signedIdentity), e.reporterId && (t.reporterId = e.reporterId), e.anonymousId && (t.anonymousId = e.anonymousId), t;
3446
+ .fb-ov-draw-cancel:hover { color: #fff; }
3447
+ .fb-ov-draw-attach {
3448
+ height: 34px;
3449
+ padding: 0 15px;
3450
+ border: 0;
3451
+ border-radius: 8px;
3452
+ background: var(--fb-color-accent);
3453
+ color: var(--fb-color-on-emphasis);
3454
+ font-family: inherit;
3455
+ font-size: 12.5px;
3456
+ font-weight: 600;
3457
+ cursor: pointer;
584
3458
  }
585
- async function Ye(e, t, o = fetch) {
586
- var n;
587
- const i = {
588
- key: t.key,
589
- ...Xe(t.identity),
590
- ...t.content
591
- }, l = new FormData();
592
- if (l.append("payload", JSON.stringify(i)), !((n = t.screenshot) === null || n === void 0) && n.blob) {
593
- var a;
594
- l.append(Ke, t.screenshot.blob, (a = t.screenshot.filename) !== null && a !== void 0 ? a : "screenshot.png");
595
- }
596
- let c;
597
- try {
598
- c = await o(qe(e), {
599
- method: "POST",
600
- body: l
601
- });
602
- } catch {
603
- return {
604
- ok: !1,
605
- reason: "unreachable"
606
- };
607
- }
608
- if (!c.ok) return {
609
- ok: !1,
610
- reason: "refused",
611
- status: c.status
612
- };
613
- try {
614
- return {
615
- ok: !0,
616
- feedback: await c.json()
617
- };
618
- } catch {
619
- return {
620
- ok: !0,
621
- feedback: null
622
- };
623
- }
3459
+ .fb-ov-draw-attach:hover { background: var(--fb-color-accent-hover); }
3460
+
3461
+ @media (prefers-reduced-motion: reduce) {
3462
+ .fb-ov-highlight { transition: none; }
624
3463
  }
625
- var re = "0.1.0", Ge = "data-fixback-overlay", We = [
3464
+ `, xa = "data-fixback-overlay", ka = "http://www.w3.org/2000/svg", Ea = [
626
3465
  {
627
3466
  value: "bug",
628
3467
  label: "Bug"
@@ -635,257 +3474,595 @@ var re = "0.1.0", Ge = "data-fixback-overlay", We = [
635
3474
  value: "idea",
636
3475
  label: "Idea"
637
3476
  }
638
- ], Je = 1800;
639
- function d(e, t, o = {}, n = []) {
640
- const i = e.createElement(t);
641
- for (const [l, a] of Object.entries(o)) a !== void 0 && i.setAttribute(l, a);
642
- for (const l of n) i.appendChild(typeof l == "string" ? e.createTextNode(l) : l);
643
- return i;
3477
+ ], Sa = [
3478
+ {
3479
+ tool: "arrow",
3480
+ label: "Arrow"
3481
+ },
3482
+ {
3483
+ tool: "box",
3484
+ label: "Box"
3485
+ },
3486
+ {
3487
+ tool: "pen",
3488
+ label: "Pen"
3489
+ },
3490
+ {
3491
+ tool: "text",
3492
+ label: "Text label"
3493
+ }
3494
+ ], Ht = 1800;
3495
+ function C(e, t, n = {}, r = []) {
3496
+ const o = e.createElement(t);
3497
+ for (const [i, a] of Object.entries(n)) a !== void 0 && o.setAttribute(i, a);
3498
+ for (const i of r) o.appendChild(typeof i == "string" ? e.createTextNode(i) : i);
3499
+ return o;
644
3500
  }
645
- var Ze = {
646
- "image/png": "png",
647
- "image/jpeg": "jpg",
648
- "image/webp": "webp",
649
- "image/gif": "gif"
650
- };
651
- function Qe(e) {
652
- var t;
653
- return (t = Ze[e]) !== null && t !== void 0 ? t : "png";
3501
+ function j(e, t, n = {}, r = []) {
3502
+ const o = e.createElementNS(ka, t);
3503
+ for (const [i, a] of Object.entries(n)) o.setAttribute(i, a);
3504
+ for (const i of r) o.appendChild(i);
3505
+ return o;
654
3506
  }
655
- function et(e) {
656
- var t, o, n, i, l, a, c, b, p, g;
657
- const s = (t = e.doc) !== null && t !== void 0 ? t : document, u = (o = (n = e.win) !== null && n !== void 0 ? n : s.defaultView) !== null && o !== void 0 ? o : window, f = (i = e.sdkVersion) !== null && i !== void 0 ? i : re, y = {
658
- captureView: (l = (a = e.deps) === null || a === void 0 ? void 0 : a.captureView) !== null && l !== void 0 ? l : De,
659
- submitReport: (c = (b = e.deps) === null || b === void 0 ? void 0 : b.submitReport) !== null && c !== void 0 ? c : Ye,
660
- startElementPicker: (p = (g = e.deps) === null || g === void 0 ? void 0 : g.startElementPicker) !== null && p !== void 0 ? p : Me
3507
+ function Ta(e) {
3508
+ var t, n, r, o, i, a, c, l, d, p;
3509
+ const s = (t = e.doc) !== null && t !== void 0 ? t : document, h = (n = (r = e.win) !== null && r !== void 0 ? r : s.defaultView) !== null && n !== void 0 ? n : window, f = (o = e.sdkVersion) !== null && o !== void 0 ? o : Ee, b = {
3510
+ captureView: (i = (a = e.deps) === null || a === void 0 ? void 0 : a.captureView) !== null && i !== void 0 ? i : En,
3511
+ submitReport: (c = (l = e.deps) === null || l === void 0 ? void 0 : l.submitReport) !== null && c !== void 0 ? c : Sn,
3512
+ startElementPicker: (d = (p = e.deps) === null || p === void 0 ? void 0 : p.startElementPicker) !== null && d !== void 0 ? d : er
661
3513
  };
662
- let h = null, r = null, E = null, T = null, I = !1;
663
- const x = {
3514
+ let m = null, u = null, y = null, g = null, v = null, w = null, S = null, k = !1, N = "compose";
3515
+ const T = {
664
3516
  kind: "bug",
665
3517
  selectedElement: null,
3518
+ region: null,
3519
+ marks: [],
666
3520
  phase: "compose"
667
3521
  };
668
- function L(v, m) {
669
- r && (r.status.textContent = v, r.status.classList.toggle("is-error", m));
3522
+ function B(E, _) {
3523
+ u && (u.status.textContent = E, u.status.classList.toggle("is-error", _));
670
3524
  }
671
- function j(v) {
672
- if (x.kind = v, !!r)
673
- for (const [m, w] of r.tabs) {
674
- const k = m === v;
675
- w.classList.toggle("is-active", k), w.setAttribute("aria-pressed", String(k));
3525
+ function x(E) {
3526
+ if (T.kind = E, !!u)
3527
+ for (const [_, P] of u.tabs) {
3528
+ const U = _ === E;
3529
+ P.classList.toggle("is-active", U), P.setAttribute("aria-pressed", String(U));
676
3530
  }
677
3531
  }
3532
+ function L(E) {
3533
+ if (N = E, !u) return;
3534
+ const _ = E !== "compose";
3535
+ u.panel.classList.toggle("is-marking", _), u.pickLayer.classList.toggle("is-visible", E === "picking"), u.captureLayer.classList.toggle("is-visible", E === "capturing"), u.drawLayer.classList.toggle("is-visible", E === "drawing"), u.pickBtn.classList.toggle("is-active", E === "picking"), u.captureBtn.classList.toggle("is-active", E === "capturing" || E === "drawing");
3536
+ }
678
3537
  function F() {
679
- r && (x.selectedElement ? (r.mark.classList.add("has-element"), r.selector.textContent = x.selectedElement.selector, r.caption.textContent = "Element selected · masked screenshot on Send", r.pickBtn.textContent = "", r.pickBtn.append(oe(s), s.createTextNode("Change element"))) : (r.mark.classList.remove("has-element"), r.selector.textContent = "", r.caption.textContent = "Masked screenshot attached on Send", r.pickBtn.textContent = "", r.pickBtn.append(oe(s), s.createTextNode("Pick element"))));
3538
+ if (!u) return;
3539
+ const E = !!T.selectedElement, _ = !!T.region, P = T.marks.length;
3540
+ u.mark.classList.toggle("has-element", E), u.selector.textContent = E ? T.selectedElement.selector : "", u.pickBtn.textContent = "", u.pickBtn.append(Ca(s), s.createTextNode(E ? "Change element" : "Pick element")), u.captureBtn.classList.toggle("is-attached", _ || P > 0);
3541
+ const U = [];
3542
+ E && U.push("Element"), _ && U.push("Region"), P > 0 && U.push(`${P} mark${P === 1 ? "" : "s"}`), u.caption.textContent = U.length ? `${U.join(" · ")} · masked screenshot on Send` : "Masked screenshot attached on Send";
680
3543
  }
681
- function ie(v) {
682
- if (!r) return;
683
- if (!v) {
684
- r.highlight.style.display = "none";
3544
+ function D(E) {
3545
+ if (!u) return;
3546
+ if (!E) {
3547
+ u.highlight.style.display = "none";
685
3548
  return;
686
3549
  }
687
- const m = v.getBoundingClientRect();
688
- r.highlight.style.display = "block", r.highlight.style.left = `${m.left}px`, r.highlight.style.top = `${m.top}px`, r.highlight.style.width = `${m.width}px`, r.highlight.style.height = `${m.height}px`;
3550
+ const _ = E.getBoundingClientRect();
3551
+ u.highlight.style.display = "block", u.highlight.style.left = `${_.left}px`, u.highlight.style.top = `${_.top}px`, u.highlight.style.width = `${_.width}px`, u.highlight.style.height = `${_.height}px`;
689
3552
  }
690
- function N() {
691
- E == null || E.stop(), E = null;
3553
+ function oe() {
3554
+ y == null || y.stop(), y = null;
3555
+ }
3556
+ function R() {
3557
+ u && (u.highlight.style.display = "none"), oe(), N === "picking" && L("compose");
3558
+ }
3559
+ function I() {
3560
+ u && (J(), L("picking"), y = b.startElementPicker({
3561
+ doc: s,
3562
+ onHover: D,
3563
+ onPick: (E) => {
3564
+ T.selectedElement = Qn(E), R(), F();
3565
+ },
3566
+ onCancel: R
3567
+ }));
3568
+ }
3569
+ function $(E) {
3570
+ if (!u) return;
3571
+ const _ = u.selBox;
3572
+ if (!E) {
3573
+ _.style.display = "none";
3574
+ return;
3575
+ }
3576
+ _.style.display = "block", _.style.left = `${E.x}px`, _.style.top = `${E.y}px`, _.style.width = `${E.width}px`, _.style.height = `${E.height}px`;
692
3577
  }
693
- function S() {
694
- r && (r.panel.classList.remove("is-picking"), r.pickBtn.classList.remove("is-active"), r.highlight.style.display = "none"), N();
3578
+ function M() {
3579
+ g == null || g.stop(), g = null;
695
3580
  }
696
- function ae() {
697
- r && (N(), r.panel.classList.add("is-picking"), r.pickBtn.classList.add("is-active"), E = y.startElementPicker({
3581
+ function O() {
3582
+ u && (J(), $(null), L("capturing"), g = ya({
698
3583
  doc: s,
699
- onHover: ie,
700
- onPick: (v) => {
701
- x.selectedElement = Re(v), S(), F();
3584
+ onProgress: $,
3585
+ onComplete: (E) => {
3586
+ M(), $(null), Mn(E);
702
3587
  },
703
- onCancel: S
3588
+ onCancel: () => {
3589
+ M(), $(null), L("compose");
3590
+ }
704
3591
  }));
705
3592
  }
706
- function _() {
707
- T !== null && (clearTimeout(T), T = null);
3593
+ function W(E) {
3594
+ u && (u.drawFrame.style.left = `${E.x}px`, u.drawFrame.style.top = `${E.y}px`, u.drawFrame.style.width = `${E.width}px`, u.drawFrame.style.height = `${E.height}px`);
3595
+ }
3596
+ function Y(E) {
3597
+ if (v == null || v.setTool(E), !!u)
3598
+ for (const [_, P] of u.drawTools) P.classList.toggle("is-active", _ === E);
3599
+ }
3600
+ function ie(E) {
3601
+ u && (u.undoBtn.disabled = E.length === 0);
3602
+ }
3603
+ function Z() {
3604
+ v == null || v.stop(), v = null;
3605
+ }
3606
+ function Mn(E) {
3607
+ u && (w = E, W(E), L("drawing"), v = va({
3608
+ doc: s,
3609
+ svg: u.drawSvg,
3610
+ textInput: u.drawText,
3611
+ initialMarks: T.marks,
3612
+ onChange: ie
3613
+ }), Y("arrow"), ie(T.marks));
3614
+ }
3615
+ function Dn() {
3616
+ v && (T.marks = v.marks().slice(), w && (T.region = w)), lt(), F();
3617
+ }
3618
+ function Pn() {
3619
+ lt(), F();
3620
+ }
3621
+ function lt() {
3622
+ Z(), w = null, N === "drawing" && L("compose");
3623
+ }
3624
+ function J() {
3625
+ oe(), M(), Z(), w = null, $(null), u && (u.highlight.style.display = "none"), N !== "compose" && L("compose");
708
3626
  }
709
- async function se() {
710
- if (!(!r || x.phase === "sending")) {
711
- x.phase = "sending", r.sendBtn.disabled = !0, r.sendBtn.textContent = "Sending…", L("", !1);
3627
+ function Ne() {
3628
+ S !== null && (clearTimeout(S), S = null);
3629
+ }
3630
+ async function Bn() {
3631
+ if (!(!u || T.phase === "sending")) {
3632
+ J(), T.phase = "sending", u.sendBtn.disabled = !0, u.sendBtn.textContent = "Sending…", B("", !1);
712
3633
  try {
713
- var v, m;
714
- const w = ze({
715
- kind: x.kind,
716
- comment: r.comment.value,
717
- element: (v = x.selectedElement) !== null && v !== void 0 ? v : void 0,
718
- url: (m = u.location) === null || m === void 0 ? void 0 : m.href,
719
- environment: Be(u, f)
720
- }), k = await y.captureView({
3634
+ var E, _, P, U;
3635
+ const ae = tn({
3636
+ kind: T.kind,
3637
+ comment: u.comment.value,
3638
+ element: (E = T.selectedElement) !== null && E !== void 0 ? E : void 0,
3639
+ region: (_ = T.region) !== null && _ !== void 0 ? _ : void 0,
3640
+ marks: T.marks.length > 0 ? T.marks : void 0,
3641
+ url: (P = h.location) === null || P === void 0 ? void 0 : P.href,
3642
+ environment: en(h, f),
3643
+ trace: (U = e.buffer) === null || U === void 0 ? void 0 : U.snapshot()
3644
+ }), se = Gt(ae, {
3645
+ hook: e.beforeSend,
3646
+ scrub: e.scrub
3647
+ });
3648
+ if (!se) {
3649
+ T.phase = "sent", u.panel.classList.add("is-sent"), S = setTimeout(he, Ht);
3650
+ return;
3651
+ }
3652
+ const Q = await b.captureView({
721
3653
  doc: s,
722
- win: u
723
- }), M = k ? {
724
- blob: k.blob,
725
- filename: `screenshot.${Qe(k.type)}`
726
- } : null, C = await y.submitReport(e.apiUrl, {
3654
+ win: h
3655
+ }), me = Q ? {
3656
+ blob: Q.blob,
3657
+ filename: `screenshot.${kn(Q.type)}`
3658
+ } : null, le = await b.submitReport(e.apiUrl, {
727
3659
  key: e.key,
728
3660
  identity: e.identity,
729
- content: w,
730
- screenshot: M
3661
+ content: se,
3662
+ screenshot: me
731
3663
  });
732
- C.ok ? (x.phase = "sent", r.panel.classList.add("is-sent"), T = setTimeout(R, Je)) : (O(), L(C.reason === "unreachable" ? "Couldn't reach Fixback — try again." : "Fixback couldn't accept this report.", !0));
3664
+ le.ok ? (T.phase = "sent", u.panel.classList.add("is-sent"), S = setTimeout(he, Ht)) : (Ie(), B(le.reason === "unreachable" ? "Couldn't reach Fixback — try again." : "Fixback couldn't accept this report.", !0));
733
3665
  } catch {
734
- O(), L("Something went wrong — try again.", !0);
3666
+ Ie(), B("Something went wrong — try again.", !0);
735
3667
  }
736
3668
  }
737
3669
  }
738
- function O() {
739
- x.phase = "compose", r && (r.sendBtn.disabled = !1, r.sendBtn.textContent = "Send");
740
- }
741
- function le() {
742
- var v;
743
- h = d(s, "div", { [Ge]: "" }), h.style.cssText = "position:fixed;right:20px;bottom:84px;z-index:2147483001;margin:0;padding:0;border:0;display:none;";
744
- const m = h.attachShadow({ mode: "open" }), w = s.createElement("style");
745
- w.textContent = Pe, m.appendChild(w);
746
- const k = d(s, "button", {
3670
+ function Ie() {
3671
+ T.phase = "compose", u && (u.sendBtn.disabled = !1, u.sendBtn.textContent = "Send");
3672
+ }
3673
+ function Un() {
3674
+ var E;
3675
+ m = C(s, "div", { [xa]: "" }), m.style.cssText = "position:fixed;right:20px;bottom:84px;z-index:2147483001;margin:0;padding:0;border:0;display:none;";
3676
+ const _ = m.attachShadow({ mode: "open" }), P = s.createElement("style");
3677
+ P.textContent = wa, _.appendChild(P);
3678
+ const U = C(s, "button", {
747
3679
  type: "button",
748
3680
  class: "fb-ov-close",
749
3681
  "aria-label": "Close"
750
- }, ["✕"]), M = d(s, "div", { class: "fb-ov-head" }, [
751
- d(s, "span", { class: "fb-ov-mark-sq" }),
752
- d(s, "span", { class: "fb-ov-brand" }, ["Fixback"]),
753
- k
754
- ]), C = /* @__PURE__ */ new Map(), D = d(s, "div", { class: "fb-ov-tabs" });
755
- for (const { value: $, label: he } of We) {
756
- const H = d(s, "button", {
3682
+ }, ["✕"]), ae = C(s, "div", { class: "fb-ov-head" }, [C(s, "span", { class: "fb-ov-mark-sq" }), C(s, "span", { class: "fb-ov-brand" }, ["Fixback"])]);
3683
+ e.tier != null && ae.appendChild(C(s, "span", {
3684
+ class: "fb-ov-tier",
3685
+ "aria-label": `Trust tier: ${e.tier}`
3686
+ }, [e.tier])), ae.appendChild(U);
3687
+ const se = /* @__PURE__ */ new Map(), Q = C(s, "div", { class: "fb-ov-tabs" });
3688
+ for (const { value: V, label: ye } of Ea) {
3689
+ const X = C(s, "button", {
757
3690
  type: "button",
758
3691
  class: "fb-ov-tab",
759
- "data-kind": $
760
- }, [he]);
761
- H.addEventListener("click", () => j($)), C.set($, H), D.appendChild(H);
3692
+ "data-kind": V
3693
+ }, [ye]);
3694
+ X.addEventListener("click", () => x(V)), se.set(V, X), Q.appendChild(X);
762
3695
  }
763
- const K = d(s, "span", { class: "fb-ov-selector" }), q = d(s, "span", { class: "fb-ov-mark-caption" }), X = d(s, "div", { class: "fb-ov-mark" }, [K, q]), Y = d(s, "textarea", {
3696
+ const me = C(s, "span", { class: "fb-ov-selector" }), le = C(s, "span", { class: "fb-ov-mark-caption" }), ct = C(s, "div", { class: "fb-ov-mark" }, [me, le]), ut = C(s, "textarea", {
764
3697
  class: "fb-ov-comment",
765
3698
  placeholder: "Describe what you saw or want…",
766
3699
  "aria-label": "Comment"
767
- }), G = d(s, "div", {
3700
+ }), dt = C(s, "div", {
768
3701
  class: "fb-ov-status",
769
3702
  role: "status",
770
3703
  "aria-live": "polite"
771
- }), B = d(s, "button", {
3704
+ }), Re = C(s, "button", {
3705
+ type: "button",
3706
+ class: "fb-ov-pickbtn",
3707
+ title: "Point at an element"
3708
+ });
3709
+ Re.addEventListener("click", () => {
3710
+ T.phase !== "sending" && (N === "picking" ? R() : I());
3711
+ });
3712
+ const ve = C(s, "button", {
772
3713
  type: "button",
773
- class: "fb-ov-pickbtn"
3714
+ class: "fb-ov-capturebtn",
3715
+ title: "Capture a region and draw",
3716
+ "aria-label": "Capture a region and draw"
774
3717
  });
775
- B.addEventListener("click", () => {
776
- x.phase !== "sending" && (r != null && r.panel.classList.contains("is-picking") ? S() : ae());
3718
+ ve.appendChild(_a(s)), ve.addEventListener("click", () => {
3719
+ T.phase !== "sending" && O();
777
3720
  });
778
- const z = d(s, "button", {
3721
+ const Me = C(s, "button", {
779
3722
  type: "button",
780
3723
  class: "fb-ov-send"
781
3724
  }, ["Send"]);
782
- z.addEventListener("click", () => {
783
- se();
3725
+ Me.addEventListener("click", () => {
3726
+ Bn();
784
3727
  });
785
- const ue = d(s, "div", { class: "fb-ov-tools" }, [B, z]), be = d(s, "div", { class: "fb-ov-form" }, [
786
- D,
787
- X,
788
- Y,
789
- G,
790
- ue
791
- ]), pe = d(s, "div", { class: "fb-ov-done" }, [
792
- d(s, "div", { class: "fb-ov-done__check" }, ["✓"]),
793
- d(s, "div", { class: "fb-ov-done__title" }, ["Report sent"]),
794
- d(s, "div", { class: "fb-ov-done__sub" }, ["Thanks — the team can see it now."])
795
- ]), W = d(s, "div", {
3728
+ const zn = C(s, "div", { class: "fb-ov-tools" }, [
3729
+ Re,
3730
+ ve,
3731
+ Me
3732
+ ]), jn = C(s, "div", { class: "fb-ov-form" }, [
3733
+ Q,
3734
+ ct,
3735
+ ut,
3736
+ dt,
3737
+ zn
3738
+ ]), Hn = C(s, "div", { class: "fb-ov-done" }, [
3739
+ C(s, "div", { class: "fb-ov-done__check" }, ["✓"]),
3740
+ C(s, "div", { class: "fb-ov-done__title" }, ["Report sent"]),
3741
+ C(s, "div", { class: "fb-ov-done__sub" }, ["Thanks — the team can see it now."])
3742
+ ]), ft = C(s, "div", {
796
3743
  class: "fb-ov-panel",
797
3744
  role: "dialog",
798
3745
  "aria-label": "Fixback feedback"
799
3746
  }, [
800
- M,
801
- be,
802
- pe
803
- ]), P = d(s, "div", { class: "fb-ov-highlight" });
804
- P.style.display = "none";
805
- const ve = d(s, "div", { class: "fb-ov-pick" }, [d(s, "div", { class: "fb-ov-hint" }, ["Click the element you mean · Esc to cancel"]), P]);
806
- m.appendChild(W), m.appendChild(ve), k.addEventListener("click", R), ((v = e.target) !== null && v !== void 0 ? v : s.body).appendChild(h), r = {
807
- panel: W,
808
- tabs: C,
809
- mark: X,
810
- selector: K,
811
- caption: q,
812
- comment: Y,
813
- status: G,
814
- pickBtn: B,
815
- sendBtn: z,
816
- highlight: P
3747
+ ae,
3748
+ jn,
3749
+ Hn
3750
+ ]), De = C(s, "div", { class: "fb-ov-highlight" });
3751
+ De.style.display = "none";
3752
+ const pt = C(s, "div", { class: "fb-ov-pick" }, [C(s, "div", { class: "fb-ov-hint" }, ["Click the element you mean · Esc to cancel"]), De]), Pe = C(s, "div", { class: "fb-ov-capture-sel" });
3753
+ Pe.style.display = "none";
3754
+ const bt = C(s, "div", { class: "fb-ov-capture" }, [
3755
+ C(s, "div", { class: "fb-ov-capture-dim" }),
3756
+ C(s, "div", { class: "fb-ov-hint" }, ["Drag to capture an area · Esc to cancel"]),
3757
+ Pe
3758
+ ]), ht = j(s, "svg", {
3759
+ class: "fb-ov-draw-svg",
3760
+ width: "100%",
3761
+ height: "100%"
3762
+ }), Be = C(s, "input", {
3763
+ class: "fb-ov-draw-text",
3764
+ placeholder: "label…",
3765
+ "aria-label": "Mark label"
3766
+ });
3767
+ Be.style.display = "none";
3768
+ const mt = C(s, "div", { class: "fb-ov-draw-frame" }), vt = /* @__PURE__ */ new Map(), gt = [];
3769
+ for (const { tool: V, label: ye } of Sa) {
3770
+ const X = C(s, "button", {
3771
+ type: "button",
3772
+ class: "fb-ov-drawtool",
3773
+ "data-tool": V,
3774
+ title: ye,
3775
+ "aria-label": ye
3776
+ });
3777
+ X.appendChild(La(s, V)), X.addEventListener("click", () => Y(V)), vt.set(V, X), gt.push(X);
3778
+ }
3779
+ const ge = C(s, "button", {
3780
+ type: "button",
3781
+ class: "fb-ov-draw-undo",
3782
+ title: "Undo",
3783
+ "aria-label": "Undo"
3784
+ });
3785
+ ge.appendChild(Aa(s)), ge.addEventListener("click", () => v == null ? void 0 : v.undo());
3786
+ const yt = C(s, "button", {
3787
+ type: "button",
3788
+ class: "fb-ov-draw-cancel"
3789
+ }, ["Cancel"]);
3790
+ yt.addEventListener("click", () => Pn());
3791
+ const wt = C(s, "button", {
3792
+ type: "button",
3793
+ class: "fb-ov-draw-attach"
3794
+ }, ["Attach"]);
3795
+ wt.addEventListener("click", () => Dn());
3796
+ const Vn = C(s, "div", { class: "fb-ov-draw-toolbar" }, [
3797
+ ...gt,
3798
+ C(s, "span", { class: "fb-ov-draw-divider" }),
3799
+ ge,
3800
+ yt,
3801
+ wt
3802
+ ]), xt = C(s, "div", { class: "fb-ov-draw" }, [
3803
+ mt,
3804
+ ht,
3805
+ Be,
3806
+ Vn
3807
+ ]);
3808
+ _.append(ft, pt, bt, xt), U.addEventListener("click", he), ((E = e.target) !== null && E !== void 0 ? E : s.body).appendChild(m), u = {
3809
+ panel: ft,
3810
+ tabs: se,
3811
+ mark: ct,
3812
+ selector: me,
3813
+ caption: le,
3814
+ comment: ut,
3815
+ status: dt,
3816
+ pickBtn: Re,
3817
+ captureBtn: ve,
3818
+ sendBtn: Me,
3819
+ highlight: De,
3820
+ pickLayer: pt,
3821
+ captureLayer: bt,
3822
+ selBox: Pe,
3823
+ drawLayer: xt,
3824
+ drawSvg: ht,
3825
+ drawText: Be,
3826
+ drawFrame: mt,
3827
+ drawTools: vt,
3828
+ undoBtn: ge
817
3829
  };
818
3830
  }
819
- function ce() {
820
- (!h || !r) && le();
3831
+ function $n() {
3832
+ (!m || !u) && Un();
821
3833
  }
822
- function de() {
823
- if (ce(), !(!h || !r)) {
824
- _(), S(), x.phase = "compose", x.selectedElement = null, r.panel.classList.remove("is-sent"), r.comment.value = "", O(), L("", !1), j("bug"), F(), h.style.display = "block", I = !0;
3834
+ function Fn() {
3835
+ if ($n(), !(!m || !u)) {
3836
+ Ne(), J(), T.phase = "compose", T.selectedElement = null, T.region = null, T.marks = [], u.panel.classList.remove("is-sent"), u.comment.value = "", Ie(), B("", !1), x("bug"), F(), m.style.display = "block", k = !0;
825
3837
  try {
826
- r.comment.focus();
3838
+ u.comment.focus();
827
3839
  } catch {
828
3840
  }
829
3841
  }
830
3842
  }
831
- function R() {
832
- _(), S(), h && (h.style.display = "none"), I = !1;
3843
+ function he() {
3844
+ Ne(), J(), m && (m.style.display = "none"), k = !1;
833
3845
  }
834
- function fe() {
835
- _(), N(), h == null || h.remove(), h = null, r = null, I = !1;
3846
+ function On() {
3847
+ Ne(), J(), m == null || m.remove(), m = null, u = null, k = !1;
836
3848
  }
837
3849
  return {
838
- open: de,
839
- close: R,
840
- destroy: fe,
3850
+ open: Fn,
3851
+ close: he,
3852
+ destroy: On,
841
3853
  get isOpen() {
842
- return I;
3854
+ return k;
843
3855
  }
844
3856
  };
845
3857
  }
846
- function oe(e) {
847
- return d(e, "span", {
3858
+ function Ca(e) {
3859
+ return C(e, "span", {
848
3860
  class: "fb-ov-pickbtn__glyph",
849
3861
  "aria-hidden": "true"
850
3862
  }, ["⌖"]);
851
3863
  }
852
- var tt = "https://api.fixback.dev", A = { destroy() {
3864
+ function _a(e) {
3865
+ return j(e, "svg", {
3866
+ class: "fb-ov-icon",
3867
+ width: "14",
3868
+ height: "14",
3869
+ viewBox: "0 0 16 16",
3870
+ fill: "none",
3871
+ stroke: "currentColor",
3872
+ "stroke-width": "1.5",
3873
+ "aria-hidden": "true"
3874
+ }, [j(e, "path", { d: "M2 5V2h3M14 5V2h-3M2 11v3h3M14 11v3h-3" })]);
3875
+ }
3876
+ function Aa(e) {
3877
+ return j(e, "svg", {
3878
+ class: "fb-ov-icon",
3879
+ width: "15",
3880
+ height: "15",
3881
+ viewBox: "0 0 16 16",
3882
+ fill: "none",
3883
+ stroke: "currentColor",
3884
+ "stroke-width": "1.6",
3885
+ "aria-hidden": "true"
3886
+ }, [j(e, "path", { d: "M6 4 3 7l3 3M3 7h6a4 4 0 0 1 0 8H7" })]);
3887
+ }
3888
+ function La(e, t) {
3889
+ return t === "text" ? C(e, "span", {
3890
+ class: "fb-ov-drawtool__t",
3891
+ "aria-hidden": "true"
3892
+ }, ["T"]) : j(e, "svg", {
3893
+ class: "fb-ov-icon",
3894
+ width: "15",
3895
+ height: "15",
3896
+ viewBox: "0 0 16 16",
3897
+ fill: "none",
3898
+ stroke: "currentColor",
3899
+ "stroke-width": "1.6",
3900
+ "aria-hidden": "true"
3901
+ }, [{
3902
+ arrow: j(e, "path", { d: "M3 13 13 3M7 3h6v6" }),
3903
+ box: j(e, "rect", {
3904
+ x: "2.5",
3905
+ y: "3.5",
3906
+ width: "11",
3907
+ height: "9",
3908
+ rx: "1"
3909
+ }),
3910
+ pen: j(e, "path", { d: "M3 13l1-3 6-6 2 2-6 6-3 1Z" })
3911
+ }[t]]);
3912
+ }
3913
+ var Na = "https://api.fixback.dev";
3914
+ function Ia(e, t) {
3915
+ const n = e.replace(/\/+$/, "");
3916
+ return t.startsWith(`${n}/api/ingest/`) || t.startsWith(`${n}/api/invites/`);
3917
+ }
3918
+ var qe = { destroy() {
853
3919
  } };
854
- async function ot(e) {
3920
+ function Ra() {
855
3921
  try {
856
- var t, o, n;
857
- if (typeof document == "undefined") return A;
858
- const i = e == null ? void 0 : e.key;
859
- if (typeof i != "string" || i.length === 0) return A;
860
- const l = (t = e.apiUrl) !== null && t !== void 0 ? t : tt, a = (o = e.anonymousId) !== null && o !== void 0 ? o : ye(), c = await xe(l, {
861
- key: i,
862
- signedIdentity: e.signedIdentity,
863
- reporterId: e.reporterId,
864
- anonymousId: a
3922
+ const e = window.location;
3923
+ return e.host || e.hostname || "this site";
3924
+ } catch {
3925
+ return "this site";
3926
+ }
3927
+ }
3928
+ function Ma() {
3929
+ try {
3930
+ return window.location.href;
3931
+ } catch {
3932
+ return "";
3933
+ }
3934
+ }
3935
+ function Da(e) {
3936
+ const { options: t, apiUrl: n, key: r, identity: o, target: i, answer: a } = e, c = sa(i, {
3937
+ key: r,
3938
+ reduceMotion: t.reduceMotion
3939
+ });
3940
+ let l = null, d = () => {
3941
+ };
3942
+ if (t.trace !== !1) {
3943
+ var p, s, h, f, b;
3944
+ const g = (p = t.trace) !== null && p !== void 0 ? p : {}, v = e.answer.capture, w = (s = (h = t.capture) === null || h === void 0 ? void 0 : h.console) !== null && s !== void 0 ? s : typeof (v == null ? void 0 : v.console) == "boolean" ? v.console : !0, S = (f = (b = t.capture) === null || b === void 0 ? void 0 : b.network) !== null && f !== void 0 ? f : typeof (v == null ? void 0 : v.network) == "boolean" ? v.network : !0;
3945
+ l = vr({
3946
+ budgets: g.budgets,
3947
+ maxAgeMs: g.maxAgeMs,
3948
+ beforeBreadcrumb: g.beforeBreadcrumb
3949
+ }), d = jr(l, {
3950
+ consoleLevels: g.consoleLevels,
3951
+ ignoreUrl: (k) => Ia(n, k),
3952
+ captureConsole: w,
3953
+ captureNetwork: S
865
3954
  });
866
- if (!(c != null && c.canSubmit)) return A;
867
- const b = (n = e.target) !== null && n !== void 0 ? n : document.body, p = Ee(b), g = et({
868
- apiUrl: l,
869
- key: i,
870
- identity: {
3955
+ }
3956
+ const m = Ta({
3957
+ apiUrl: n,
3958
+ key: r,
3959
+ identity: o,
3960
+ gate: a.gate,
3961
+ tier: a.tier,
3962
+ sdkVersion: Ee,
3963
+ target: i,
3964
+ buffer: l,
3965
+ beforeSend: t.beforeSend,
3966
+ scrub: t.scrub
3967
+ }), u = () => m.open();
3968
+ c.host.addEventListener(et, u);
3969
+ let y = () => {
3970
+ };
3971
+ return t.autoCapture !== !1 && (y = ji({
3972
+ apiUrl: n,
3973
+ key: r,
3974
+ identity: o,
3975
+ sdkVersion: Ee,
3976
+ buffer: l,
3977
+ beforeSend: t.beforeSend,
3978
+ scrub: t.scrub
3979
+ }).destroy), () => {
3980
+ c.host.removeEventListener(et, u), m.destroy(), la(c), d(), y();
3981
+ };
3982
+ }
3983
+ async function Rn(e, t) {
3984
+ try {
3985
+ var n, r, o;
3986
+ if (typeof document == "undefined") return qe;
3987
+ const i = e == null ? void 0 : e.key;
3988
+ if (typeof i != "string" || i.length === 0) return qe;
3989
+ const a = (n = e.apiUrl) !== null && n !== void 0 ? n : Na, c = (r = e.anonymousId) !== null && r !== void 0 ? r : Hi(), l = (o = e.target) !== null && o !== void 0 ? o : document.body;
3990
+ let d = !1, p = () => {
3991
+ }, s = () => {
3992
+ };
3993
+ const h = { destroy: () => {
3994
+ d = !0, s(), s = () => {
3995
+ }, p(), p = () => {
3996
+ };
3997
+ } }, f = () => {
3998
+ var m;
3999
+ const u = Ft(i);
4000
+ return {
871
4001
  signedIdentity: e.signedIdentity,
872
- reporterId: e.reporterId,
873
- anonymousId: a
874
- },
875
- sdkVersion: re,
876
- target: b
877
- }), s = () => g.open();
878
- return p.host.addEventListener(U, s), { destroy: () => {
879
- p.host.removeEventListener(U, s), g.destroy(), Se(p);
880
- } };
4002
+ reporterId: (m = e.reporterId) !== null && m !== void 0 ? m : u == null ? void 0 : u.reporterId,
4003
+ anonymousId: c
4004
+ };
4005
+ }, b = async (m) => {
4006
+ const u = await Gn(a, {
4007
+ key: i,
4008
+ ...m
4009
+ });
4010
+ d || !(u != null && u.canSubmit) || (p = Da({
4011
+ options: e,
4012
+ apiUrl: a,
4013
+ key: i,
4014
+ identity: m,
4015
+ target: l,
4016
+ answer: u
4017
+ }));
4018
+ };
4019
+ if (t) {
4020
+ const m = await Zi(a, t);
4021
+ if (d) return h;
4022
+ if (m && m.status === "pending") {
4023
+ const u = Ft(i), y = async (v) => {
4024
+ const w = await Ji(a, t);
4025
+ d || (s(), s = () => {
4026
+ }, w && w.status === "redeemed" ? (Gi(i, {
4027
+ reporterId: w.reporterId,
4028
+ name: v.name,
4029
+ email: v.email
4030
+ }), qi(window), await b({
4031
+ signedIdentity: e.signedIdentity,
4032
+ reporterId: w.reporterId,
4033
+ anonymousId: c
4034
+ })) : await b(f()));
4035
+ }, g = ba({
4036
+ origin: Ra(),
4037
+ tier: m.tier,
4038
+ defaults: u ? {
4039
+ name: u.name,
4040
+ email: u.email
4041
+ } : void 0,
4042
+ target: l,
4043
+ onConfirm: (v) => {
4044
+ y(v);
4045
+ }
4046
+ });
4047
+ return s = () => g.destroy(), h;
4048
+ }
4049
+ }
4050
+ return await b(f()), h;
881
4051
  } catch {
882
- return A;
4052
+ return qe;
883
4053
  }
884
4054
  }
4055
+ function Ua(e) {
4056
+ return Rn(e, typeof window != "undefined" ? Xi(Ma()) : null);
4057
+ }
4058
+ function $a(e) {
4059
+ return Rn(e, typeof (e == null ? void 0 : e.token) == "string" && e.token.length > 0 ? e.token : null);
4060
+ }
885
4061
  export {
886
- tt as DEFAULT_API_URL,
887
- U as LAUNCH_EVENT,
888
- ot as init
4062
+ Na as DEFAULT_API_URL,
4063
+ et as LAUNCH_EVENT,
4064
+ Ua as init,
4065
+ $a as redeem
889
4066
  };
890
4067
 
891
4068
  //# sourceMappingURL=index.mjs.map