@spectosh/browser 0.2.5 → 0.3.1

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.
@@ -0,0 +1,1425 @@
1
+ import { _ as e, v as t } from "./src-mrKmVGmE.js";
2
+ //#region src/point/describe.js
3
+ var n = [
4
+ "data-testid",
5
+ "data-test",
6
+ "data-test-id",
7
+ "data-cy",
8
+ "data-qa"
9
+ ], r = [
10
+ "display",
11
+ "visibility",
12
+ "opacity",
13
+ "pointerEvents",
14
+ "zIndex",
15
+ "overflow",
16
+ "cursor",
17
+ "color",
18
+ "background"
19
+ ], i = /* @__PURE__ */ new Set([
20
+ "id",
21
+ "class",
22
+ "role",
23
+ "type",
24
+ "name",
25
+ "href",
26
+ "disabled",
27
+ "aria-disabled",
28
+ "aria-expanded",
29
+ "aria-busy",
30
+ "aria-hidden",
31
+ "aria-pressed",
32
+ "aria-selected",
33
+ "aria-checked",
34
+ "for",
35
+ "data-specto-src",
36
+ ...n
37
+ ]), a = /* @__PURE__ */ new Set([
38
+ "area",
39
+ "base",
40
+ "br",
41
+ "col",
42
+ "embed",
43
+ "hr",
44
+ "img",
45
+ "input",
46
+ "link",
47
+ "meta",
48
+ "source",
49
+ "track",
50
+ "wbr"
51
+ ]), o = (e) => String(e).replace(/\\/g, "\\\\").replace(/"/g, "\\\""), s = (e) => String(e?.tagName || "").toLowerCase(), c = (e, t) => {
52
+ try {
53
+ return e.getAttribute(t);
54
+ } catch {
55
+ return null;
56
+ }
57
+ }, l = (e) => !!e && e.length <= 64 && !/\d{4,}|^:|:r\w*:|^(ember|react|radix|headlessui|mui|rc|el)[-_:]?\d/i.test(e) && /^[A-Za-z][\w-]*$/.test(e), u = (e) => e && !e.startsWith("specto-") && e.length <= 40 && !/\d{3,}|^(css|sc|jsx|emotion|tw)-|__[A-Za-z0-9]{5,}$|^[a-z0-9]{6,}$/i.test(e);
58
+ function d(e, n, r = "") {
59
+ let i = s(e);
60
+ if (i === "input" || i === "textarea" || i === "select" || c(e, "contenteditable") === "true") return !0;
61
+ if (n) return !t(e, r);
62
+ for (let t = e; t && t.nodeType === 1; t = t.parentElement) if (t.classList?.contains("specto-mask") || t.classList?.contains("specto-block")) return !0;
63
+ return !1;
64
+ }
65
+ function f(e) {
66
+ for (let t of n) {
67
+ let n = c(e, t);
68
+ if (n) return [t, n];
69
+ }
70
+ return null;
71
+ }
72
+ function p(e) {
73
+ let t = s(e), n = e.id;
74
+ if (l(n)) return {
75
+ sel: `${t}#${n}`,
76
+ anchor: !0
77
+ };
78
+ let r = f(e);
79
+ if (r) return {
80
+ sel: `${t}[${r[0]}="${o(r[1])}"]`,
81
+ anchor: !0
82
+ };
83
+ let i = typeof e.className == "string" ? e.className.trim().split(/\s+/).filter(u).slice(0, 2) : [], a = i.length ? `${t}.${i.join(".")}` : t, c = e.parentElement;
84
+ if (c) {
85
+ let n = Array.from(c.children || []).filter((e) => s(e) === t);
86
+ n.length > 1 && (a += `:nth-of-type(${n.indexOf(e) + 1})`);
87
+ }
88
+ return {
89
+ sel: a,
90
+ anchor: !1
91
+ };
92
+ }
93
+ function m(e, t = 5) {
94
+ let n = [];
95
+ for (let r = e, i = 0; r && r.nodeType === 1 && i < t && s(r) !== "html" && s(r) !== "body"; r = r.parentElement, i++) {
96
+ let e = p(r);
97
+ if (n.unshift(e.sel), e.anchor) break;
98
+ }
99
+ return n.join(" > ") || s(e) || "body";
100
+ }
101
+ function h(t, n) {
102
+ let r = c(t, "aria-label") || c(t, "title") || c(t, "alt");
103
+ if (r && !n) return e(r).trim().slice(0, 80);
104
+ let i = c(t, "aria-labelledby");
105
+ if (i && !n) try {
106
+ let t = document.getElementById(i)?.textContent;
107
+ if (t) return e(t).trim().slice(0, 80);
108
+ } catch {}
109
+ if (n) return "";
110
+ let a = (t.innerText ?? t.textContent ?? "").replace(/\s+/g, " ").trim();
111
+ return e(a).slice(0, 80);
112
+ }
113
+ function g(e) {
114
+ let t = c(e, "role");
115
+ if (t) return t;
116
+ let n = s(e);
117
+ return n === "a" && c(e, "href") != null ? "link" : n === "button" || n === "input" && [
118
+ "submit",
119
+ "button",
120
+ "reset"
121
+ ].includes(c(e, "type")) ? "button" : n === "input" ? c(e, "type") === "checkbox" ? "checkbox" : c(e, "type") === "radio" ? "radio" : "textbox" : n === "select" ? "combobox" : n === "textarea" ? "textbox" : /^h[1-6]$/.test(n) ? "heading" : n === "img" ? "img" : null;
122
+ }
123
+ function _(e, { masked: t } = {}) {
124
+ let n = [], r = f(e);
125
+ r && n.push(`[${r[0]}="${o(r[1])}"]`), l(e.id) && n.push(`#${e.id}`);
126
+ let i = g(e), a = h(e, t);
127
+ return i && a && a.length <= 40 && n.push(`role=${i}[name="${o(a)}"]`), n.push(m(e)), [...new Set(n)].slice(0, 6);
128
+ }
129
+ function v(e) {
130
+ let t = null;
131
+ for (let n = e; n && n.nodeType === 1 && !t; n = n.parentElement) t = c(n, "data-specto-src");
132
+ let n = e && Object.keys(e).find((e) => e.startsWith("__reactFiber$") || e.startsWith("__reactInternalInstance$"));
133
+ if (n) for (let r = e[n], i = 0; r && i < 60; r = r.return, i++) {
134
+ let e = r.type;
135
+ if (!e || typeof e == "string") continue;
136
+ let n = e.displayName || e.name || e.render?.displayName || e.render?.name || e.type?.displayName || e.type?.name;
137
+ if (n && /^[A-Z]/.test(n) && !/^(Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|Context)/.test(n)) {
138
+ let e = r._debugSource;
139
+ return !t && e?.fileName && (t = `${String(e.fileName).replace(/^.*?\/(src|app|pages|components)\//, "$1/")}:${e.lineNumber}`), {
140
+ component: n.slice(0, 120),
141
+ source: t
142
+ };
143
+ }
144
+ }
145
+ for (let n = e, r = 0; n && r < 20; n = n.parentElement, r++) {
146
+ let e = n.__vueParentComponent;
147
+ if (e) {
148
+ let n = e.type?.name || e.type?.__name || e.type?.__file && String(e.type.__file).split("/").pop().replace(/\.vue$/, "");
149
+ if (n) return {
150
+ component: n,
151
+ source: t || (e.type?.__file ? String(e.type.__file).replace(/^.*?\/src\//, "src/") : null)
152
+ };
153
+ }
154
+ let r = n.__svelte_meta;
155
+ if (r?.loc?.file) return {
156
+ component: String(r.loc.file).split("/").pop().replace(/\.svelte$/, ""),
157
+ source: t || `${r.loc.file}:${r.loc.line}`
158
+ };
159
+ }
160
+ return {
161
+ component: null,
162
+ source: t
163
+ };
164
+ }
165
+ function y(t) {
166
+ let n = [];
167
+ for (let r = t.parentElement, i = 0; r && r.nodeType === 1 && i < 25 && n.length < 6; r = r.parentElement, i++) {
168
+ let t = s(r);
169
+ if (t === "body" || t === "html") break;
170
+ let i = c(r, "role"), a = c(r, "aria-label");
171
+ ([
172
+ "main",
173
+ "nav",
174
+ "header",
175
+ "footer",
176
+ "aside",
177
+ "form",
178
+ "dialog",
179
+ "section",
180
+ "table"
181
+ ].includes(t) || [
182
+ "dialog",
183
+ "navigation",
184
+ "form",
185
+ "region",
186
+ "tabpanel",
187
+ "menu"
188
+ ].includes(i) || l(r.id) || f(r)) && n.unshift(`${t}${l(r.id) ? `#${r.id}` : ""}${a ? `[${e(a).slice(0, 30)}]` : ""}`);
189
+ }
190
+ return n;
191
+ }
192
+ function b(e) {
193
+ let t = {}, n = s(e);
194
+ e.disabled === !0 || c(e, "aria-disabled") === "true" ? t.disabled = !0 : [
195
+ "button",
196
+ "input",
197
+ "select",
198
+ "textarea"
199
+ ].includes(n) && (t.disabled = !1), n === "input" && ["checkbox", "radio"].includes(c(e, "type")) && (t.checked = !!e.checked);
200
+ let r = c(e, "aria-expanded");
201
+ return r != null && (t.expanded = r === "true"), c(e, "aria-busy") === "true" && (t.busy = !0), Object.keys(t).length ? t : void 0;
202
+ }
203
+ function x(e) {
204
+ try {
205
+ let t = getComputedStyle(e), n = {};
206
+ for (let e of r) {
207
+ let r = e === "background" ? t.backgroundColor : t[e];
208
+ r != null && r !== "" && (n[e] = String(r).slice(0, 80));
209
+ }
210
+ return n;
211
+ } catch {
212
+ return {};
213
+ }
214
+ }
215
+ function S(t, { strict: n = !1, unmask: r = "", maxNodes: o = 60, maxDepth: c = 4, maxChars: l = 4e3 } = {}) {
216
+ let u = 0, f = (t, p, m) => {
217
+ if (u++ > o) return "…";
218
+ if (t.nodeType === 3) {
219
+ let n = String(t.textContent || "").replace(/\s+/g, " ");
220
+ return n.trim() ? m ? n.replace(/\S/g, "•").slice(0, 60) : e(n).slice(0, 120).replace(/</g, "&lt;") : n ? " " : "";
221
+ }
222
+ if (t.nodeType !== 1) return "";
223
+ let h = s(t);
224
+ if ([
225
+ "script",
226
+ "style",
227
+ "noscript",
228
+ "template",
229
+ "svg"
230
+ ].includes(h)) return h === "svg" ? "<svg/>" : "";
231
+ let g = n ? d(t, !0, r) || !!t.closest?.("[contenteditable=\"true\"]") : m || d(t, !1), _ = [];
232
+ for (let n of Array.from(t.attributes || [])) {
233
+ if (!i.has(n.name)) continue;
234
+ let t = n.value;
235
+ if (n.name === "href") try {
236
+ t = new URL(t, location.href).pathname;
237
+ } catch {
238
+ t = "";
239
+ }
240
+ n.name === "class" && (t = t.split(/\s+/).filter((e) => e && !e.startsWith("specto-")).slice(0, 4).join(" ")), _.push(t === "" ? n.name : `${n.name}="${e(t).slice(0, 80).replace(/"/g, "&quot;")}"`);
241
+ }
242
+ h === "input" && _.push("value=\"[masked]\"");
243
+ let v = `<${h}${_.length ? " " + _.join(" ") : ""}>`;
244
+ if (a.has(h)) return v;
245
+ if (p >= c) return `${v}…</${h}>`;
246
+ let y = "";
247
+ for (let e of Array.from(t.childNodes || [])) if (y += f(e, p + 1, g), y.length > l) break;
248
+ return `${v}${y}</${h}>`;
249
+ };
250
+ return f(t, 0, d(t, n, r)).slice(0, l);
251
+ }
252
+ function ee(e, t) {
253
+ let n = f(e);
254
+ return [
255
+ t.component,
256
+ n ? n[1] : null,
257
+ t.name || s(e)
258
+ ].filter(Boolean).slice(0, 2).join(" › ") || s(e);
259
+ }
260
+ function C(t, { strict: n = !1, unmask: r = "" } = {}) {
261
+ let i = d(t, n, r), { component: a, source: o } = v(t), l = h(t, i), u = g(t), f = null;
262
+ try {
263
+ let e = t.getBoundingClientRect();
264
+ f = {
265
+ x: Math.round(e.left),
266
+ y: Math.round(e.top),
267
+ w: Math.round(e.width),
268
+ h: Math.round(e.height)
269
+ };
270
+ } catch {}
271
+ return {
272
+ tag: s(t),
273
+ role: u,
274
+ label: i ? null : c(t, "aria-label") ? e(c(t, "aria-label")).slice(0, 120) : null,
275
+ name: l ? `${l}${u ? ` ${u}` : ""}` : u || s(t),
276
+ component: a,
277
+ source: o,
278
+ selectors: _(t, { masked: i }),
279
+ path: y(t),
280
+ rect: f,
281
+ text: i ? null : l || null,
282
+ state: b(t),
283
+ styles: x(t),
284
+ snapshot: S(t, {
285
+ strict: n,
286
+ unmask: r
287
+ })
288
+ };
289
+ }
290
+ //#endregion
291
+ //#region src/point/context.js
292
+ var w = 1e3, T = 6e3, E = 1e4;
293
+ function D(e, t, n = Date.now()) {
294
+ for (let r = e.length - 1; r >= 0; r--) {
295
+ let i = e[r];
296
+ if (n - i.at > 6e4) break;
297
+ try {
298
+ if (i.el && t(i.el)) return i.at;
299
+ } catch {}
300
+ }
301
+ return null;
302
+ }
303
+ function te({ recent: e, contains: t, now: n = Date.now() }) {
304
+ let r = D(e.clicks || [], t, n), [i, a] = r ? [r - w, r + T] : [n - E, n], o = (e.network || []).filter((e) => e.at >= i && e.at <= a).slice(-20).map((e) => ({
305
+ at: e.at,
306
+ method: e.method,
307
+ url: e.url,
308
+ status: e.status,
309
+ dur: e.dur,
310
+ ...e.error ? { error: !0 } : {}
311
+ })), s = (e.console || []).filter((e) => e.level === "error" || e.level === "warn").slice(-15).map((e) => ({
312
+ at: e.at,
313
+ level: e.level,
314
+ text: e.text
315
+ })), c = (e.event || []).filter((e) => e.type === "error").slice(-5).map((e) => ({
316
+ at: e.at,
317
+ level: "error",
318
+ text: e.message,
319
+ stack: e.stack
320
+ })), l = (e.event || []).filter((e) => [
321
+ "click",
322
+ "nav",
323
+ "rage",
324
+ "dead",
325
+ "custom"
326
+ ].includes(e.type) && e.at <= n && n - e.at < 12e4).slice(-15).map((e) => ({
327
+ at: e.at,
328
+ type: e.type,
329
+ target: e.sel || e.target || null,
330
+ path: e.path || null,
331
+ name: e.name || null
332
+ }));
333
+ return {
334
+ network: o,
335
+ console: [...s, ...c].sort((e, t) => e.at - t.at).slice(-20),
336
+ events: l,
337
+ clickedAt: r
338
+ };
339
+ }
340
+ function ne() {
341
+ let e = navigator.userAgent || "", t = window.innerWidth, n = (navigator.maxTouchPoints || 0) > 0, r = (e) => {
342
+ try {
343
+ return window.matchMedia(e).matches;
344
+ } catch {
345
+ return !1;
346
+ }
347
+ };
348
+ return {
349
+ browser: e.slice(0, 200),
350
+ os: /Windows/.test(e) ? "Windows" : /Mac OS X|Macintosh/.test(e) ? n ? "iPadOS" : "macOS" : /Android/.test(e) ? "Android" : /iPhone|iPad|iOS/.test(e) ? "iOS" : /Linux/.test(e) ? "Linux" : null,
351
+ device: t < 640 ? "phone" : t < 1024 && n ? "tablet" : "desktop",
352
+ locale: navigator.language || null,
353
+ tz: (() => {
354
+ try {
355
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
356
+ } catch {
357
+ return null;
358
+ }
359
+ })(),
360
+ reducedMotion: r("(prefers-reduced-motion: reduce)"),
361
+ colorScheme: r("(prefers-color-scheme: dark)") ? "dark" : "light",
362
+ viewport: {
363
+ w: t,
364
+ h: window.innerHeight
365
+ }
366
+ };
367
+ }
368
+ //#endregion
369
+ //#region src/point/voice.js
370
+ var O = [
371
+ "audio/webm;codecs=opus",
372
+ "audio/ogg;codecs=opus",
373
+ "audio/mp4",
374
+ "audio/webm"
375
+ ], k = .08, A = 700, re = 2e4, ie = () => typeof window < "u" && window.MediaRecorder !== void 0 && !!navigator.mediaDevices?.getUserMedia;
376
+ async function ae({ onPhrase: e = () => {}, keep: t = !1 } = {}) {
377
+ let n = await navigator.mediaDevices.getUserMedia({ audio: {
378
+ channelCount: 1,
379
+ echoCancellation: !0,
380
+ noiseSuppression: !0
381
+ } }), r = O.find((e) => {
382
+ try {
383
+ return MediaRecorder.isTypeSupported(e);
384
+ } catch {
385
+ return !1;
386
+ }
387
+ }) || "", i = {
388
+ ...r ? { mimeType: r } : {},
389
+ audioBitsPerSecond: 16e3
390
+ }, a = Date.now(), o = null, s = null, c = null;
391
+ try {
392
+ s = new (window.AudioContext || window.webkitAudioContext)();
393
+ let e = s.createMediaStreamSource(n);
394
+ o = s.createAnalyser(), o.fftSize = 1024, c = new Uint8Array(o.fftSize), e.connect(o);
395
+ } catch {}
396
+ let l = () => {
397
+ if (!o) return 0;
398
+ o.getByteTimeDomainData(c);
399
+ let e = 0;
400
+ for (let t of c) e += (t - 128) * (t - 128);
401
+ return Math.min(1, Math.sqrt(e / c.length) / 40);
402
+ }, u = null, d = !1, f = () => {
403
+ if (d) return;
404
+ let e = new MediaRecorder(n, i), t = {
405
+ rec: e,
406
+ chunks: [],
407
+ at: Date.now(),
408
+ spoke: !o,
409
+ loudAt: 0
410
+ };
411
+ e.ondataavailable = (e) => {
412
+ e.data?.size && t.chunks.push(e.data);
413
+ }, e.start(), u = t;
414
+ }, p = () => new Promise((t) => {
415
+ let n = u;
416
+ if (u = null, !n) return t();
417
+ n.rec.onstop = () => {
418
+ if (n.spoke && n.chunks.length) {
419
+ let t = n.rec.mimeType || r || "audio/webm";
420
+ try {
421
+ e({
422
+ blob: new Blob(n.chunks, { type: t }),
423
+ mime: t,
424
+ startedAt: n.at,
425
+ endedAt: Date.now()
426
+ });
427
+ } catch {}
428
+ }
429
+ t();
430
+ };
431
+ try {
432
+ n.rec.stop();
433
+ } catch {
434
+ t();
435
+ }
436
+ }), m = () => {
437
+ u && (p(), f());
438
+ };
439
+ f();
440
+ let h = setInterval(() => {
441
+ if (!u) return;
442
+ let e = Date.now();
443
+ o && l() >= k && (u.spoke = !0, u.loudAt = e), u.spoke && (u.loudAt && e - u.loudAt > A || e - u.at > re) && m();
444
+ }, 50), g = null;
445
+ t && (g = {
446
+ rec: new MediaRecorder(n, i),
447
+ chunks: []
448
+ }, g.rec.ondataavailable = (e) => {
449
+ e.data?.size && g.chunks.push(e.data);
450
+ }, g.rec.start(1e3));
451
+ let _ = null;
452
+ return {
453
+ startedAt: a,
454
+ level: l,
455
+ cut: m,
456
+ stop: () => _ || (d = !0, clearInterval(h), _ = (async () => {
457
+ await p();
458
+ let e = null;
459
+ g && (e = await new Promise((e) => {
460
+ let t = g.rec.mimeType || r || "audio/webm", n = () => e({
461
+ blob: new Blob(g.chunks, { type: t }),
462
+ mime: t,
463
+ startedAt: a
464
+ });
465
+ if (g.rec.state === "inactive") return n();
466
+ g.rec.onstop = n;
467
+ try {
468
+ g.rec.stop();
469
+ } catch {
470
+ n();
471
+ }
472
+ }));
473
+ for (let e of n.getTracks()) e.stop();
474
+ try {
475
+ s?.close();
476
+ } catch {}
477
+ return e;
478
+ })(), _)
479
+ };
480
+ }
481
+ function oe(e) {
482
+ return new Promise((t, n) => {
483
+ let r = new FileReader();
484
+ r.onload = () => t(String(r.result).split(",")[1] || ""), r.onerror = () => n(r.error), r.readAsDataURL(e);
485
+ });
486
+ }
487
+ //#endregion
488
+ //#region src/point/entry.js
489
+ var j = "specto-point-used", M = "specto-point-visits", se = "specto-point-visit", ce = "specto-point-hint", N = "specto-point-nudged", P = "specto-point-me", F = "specto-point-hidden", I = 12e3, L = "specto-point-receipts", R = 7776e6, z = () => {
490
+ try {
491
+ return (JSON.parse(localStorage.getItem("specto-point-receipts") || "[]") || []).filter((e) => e && e.r && Date.now() - e.at < R);
492
+ } catch {
493
+ return [];
494
+ }
495
+ }, B = (e) => U.set(localStorage, L, JSON.stringify(e.slice(-20))), le = (e) => {
496
+ let t = z().filter((t) => t.r !== e);
497
+ t.push({
498
+ r: e,
499
+ at: Date.now()
500
+ }), B(t), U.set(localStorage, `${L}-at`, String(Date.now()));
501
+ }, V = (e) => B(z().filter((t) => t.r !== e)), ue = 2e3, H = 2592e6, U = {
502
+ get: (e, t) => {
503
+ try {
504
+ return e.getItem(t);
505
+ } catch {
506
+ return null;
507
+ }
508
+ },
509
+ set: (e, t, n) => {
510
+ try {
511
+ e.setItem(t, n);
512
+ } catch {}
513
+ }
514
+ };
515
+ function de(e, t = location.pathname) {
516
+ return !e?.length || e.some((e) => RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*")}$`).test(t));
517
+ }
518
+ function fe(e) {
519
+ let t = parseInt(String(e).slice(1), 16);
520
+ if (!Number.isFinite(t)) return "#fff";
521
+ let [n, r, i] = [
522
+ t >> 16,
523
+ t >> 8 & 255,
524
+ t & 255
525
+ ].map((e) => (e /= 255, e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4));
526
+ return .2126 * n + .7152 * r + .0722 * i > .4 ? "#0E1320" : "#fff";
527
+ }
528
+ var W = () => /Mac|iPhone|iPad/.test(globalThis.navigator?.platform || "");
529
+ function pe(e, t = W()) {
530
+ return e.trigger === "double-ctrl" ? t ? ["⌘", "⌘"] : ["Ctrl", "Ctrl"] : e.trigger === "chord" ? [
531
+ "Alt",
532
+ "Shift",
533
+ "P"
534
+ ] : e.trigger === "hold-alt" ? [t ? "⌥" : "Alt"] : e.trigger === "hold-ctrl" ? ["Ctrl"] : e.trigger === "custom" ? String(e.shortcut?.label || "").split("+").filter(Boolean) : [];
535
+ }
536
+ function G(e, t = W()) {
537
+ let n = pe(e, t);
538
+ return n.length ? e.trigger.startsWith("hold") ? `hold ${n[0]}` : e.trigger === "double-ctrl" ? n.join(" ") : n.join("+") : "";
539
+ }
540
+ var K = (e) => String(e).replace(/[&<>"]/g, (e) => ({
541
+ "&": "&amp;",
542
+ "<": "&lt;",
543
+ ">": "&gt;",
544
+ "\"": "&quot;"
545
+ })[e]), me = (e, t = "kc") => e.map((e) => `<kbd class="${t}">${K(e)}</kbd>`).join("");
546
+ function he(e) {
547
+ let t = pe(e);
548
+ return t.length ? e.trigger === "double-ctrl" ? `Tap ${t[0] === "⌘" ? "⌘" : "Ctrl"} twice` : e.trigger.startsWith("hold") ? `Hold ${t[0]}` : `Press ${t.join("+")}` : "";
549
+ }
550
+ var ge = [
551
+ "bottom-right",
552
+ "bottom-left",
553
+ "edge"
554
+ ];
555
+ function q(e, t) {
556
+ if (t === !1) return null;
557
+ if (!t || typeof t != "object") return e;
558
+ let n = e || {
559
+ label: "Report a problem",
560
+ position: "bottom-right",
561
+ color: "#0E1320",
562
+ pages: []
563
+ }, r = Array.isArray(t.offset) ? t.offset.slice(0, 2).map((e) => Math.max(0, Math.min(600, Math.round(Number(e) || 0)))) : null;
564
+ return {
565
+ ...n,
566
+ ...ge.includes(t.position) ? { position: t.position } : {},
567
+ ...typeof t.label == "string" && t.label.trim() ? { label: t.label.trim().slice(0, 40) } : {},
568
+ .../^#[0-9a-f]{6}$/i.test(t.color || "") ? { color: t.color } : {},
569
+ ...r && r.length === 2 ? { offset: r } : {}
570
+ };
571
+ }
572
+ function _e(e, { used: t, visits: n, last: r, release: i, now: a = Date.now() }) {
573
+ return !e || t ? !1 : e.when === "monthly" ? !r || a - r.at >= H : e.when === "release" ? !!i && r?.release !== i : n >= 3 && !r;
574
+ }
575
+ function ve(e, t, n) {
576
+ let r = 0;
577
+ if (t.includes("network")) for (let t of e.network || []) t.at > n && (t.error || t.status >= 500) && (r = Math.max(r, t.at));
578
+ for (let i of e.event || []) i.at <= n || (i.type === "error" && t.includes("error") || i.type === "rage" && t.includes("rage") || i.type === "dead" && t.includes("dead")) && (r = Math.max(r, i.at));
579
+ return r;
580
+ }
581
+ function J(e, t, { open: n, may: r, local: i }) {
582
+ let a = e._point, o = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, s = o ? [] : pe(t);
583
+ U.get(sessionStorage, se) || (U.set(sessionStorage, se, "1"), U.set(localStorage, M, String((Number(U.get(localStorage, M)) || 0) + 1)));
584
+ let c = document.createElement("div");
585
+ c.id = "specto-point-entry", c.className = "specto-block", c.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--specto-launcher-z,2147483645)");
586
+ let l = c.attachShadow({ mode: "open" }), u = q(t.launcher, i), d = {};
587
+ try {
588
+ d = JSON.parse(U.get(localStorage, P) || "{}") || {};
589
+ } catch {}
590
+ let f = (e) => {
591
+ d = {
592
+ ...d,
593
+ ...e
594
+ }, U.set(localStorage, P, JSON.stringify(d)), x(), V();
595
+ }, p = () => u?.position === "edge" ? "edge" : d.side || (u?.position === "bottom-left" ? "left" : "right"), m = () => p() === "left" ? "left" : "right";
596
+ l.innerHTML = `<style>${X}</style>
597
+ <button class="pill" type="button" hidden>
598
+ <svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>
599
+ <span class="lbl"></span>${s.length ? `<span class="keys" aria-hidden="true">${me(s)}</span>` : ""}
600
+ </button>
601
+ <div class="menu lmenu" role="menu" aria-label="Report a problem button" hidden>
602
+ <button class="m-open" type="button" role="menuitem">${K(u?.label || "Report a problem")}</button>
603
+ <hr>
604
+ <button class="m-size" type="button" role="menuitem"></button>
605
+ <button class="m-side" type="button" role="menuitem"></button>
606
+ <button class="m-hide" type="button" role="menuitem">Hide for this visit</button>
607
+ <p class="tip">Or drag it out of the way</p>
608
+ </div>
609
+ <div class="menu cmenu" role="menu" aria-label="Report a problem here" hidden>
610
+ <button class="c-go" type="button" role="menuitem"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>Report a problem here</button>
611
+ <p class="tip">Shift + right-click for the browser’s menu</p>
612
+ </div>
613
+ <div class="card nudge" role="dialog" aria-label="Something didn't work?" hidden>
614
+ <div class="hd"><span class="red" aria-hidden="true"></span><b>That didn’t work?</b></div>
615
+ <p>Show us what happened: point at it and say what you expected. Takes 20 seconds.</p>
616
+ <div class="row"><button class="go" type="button">Show us</button><button class="no" type="button">Not now</button>${s.length ? `<span class="or">or ${me(s)}</span>` : ""}</div>
617
+ </div>
618
+ <div class="card hint" role="dialog" aria-label="Report a problem" hidden>
619
+ <div class="hd">${s.length ? `<span class="big" aria-hidden="true">${me(s, "kc lg")}</span>` : ""}<b>Spot something broken?</b></div>
620
+ <p>${s.length ? `${he(t)}, click` : `${o ? "Tap" : "Click"} “${K(q(t.launcher, i)?.label || "Report a problem")}”, then ${o ? "tap" : "click"}`} what’s wrong and tell us. We see exactly what you saw.</p>
621
+ <div class="row"><button class="go" type="button">Try it now</button><button class="no" type="button">Got it</button></div>
622
+ </div>`;
623
+ let h = (e) => l.querySelector(e);
624
+ document.documentElement.appendChild(c);
625
+ let g = h(".pill"), _ = h(".nudge"), v = h(".hint"), y = h(".lmenu"), b = h(".cmenu");
626
+ function x() {
627
+ g.querySelector(".lbl").textContent = u?.label || "", g.className = `pill ${p()}${d.compact && p() !== "edge" ? " compact" : ""}`, g.setAttribute("aria-label", u?.label || "Report a problem"), g.title = `${u?.label || "Report a problem"}${s.length ? ` (${G(t)})` : ""}`, g.style.setProperty("--bg", u?.color || "#0E1320"), g.style.setProperty("--ink", fe(u?.color || "#0E1320"));
628
+ for (let [e, t] of ["x", "y"].entries()) {
629
+ let n = t === "y" && Number.isFinite(d.y) ? d.y : u?.offset?.[e];
630
+ n == null ? c.style.removeProperty(`--specto-launcher-${t}`) : c.style.setProperty(`--specto-launcher-${t}`, `${n}px`);
631
+ }
632
+ y.querySelector(".m-size").textContent = d.compact ? "Show the label" : "Make it smaller", y.querySelector(".m-side").textContent = p() === "left" ? "Move it to the right" : "Move it to the left", y.querySelector(".m-side").hidden = p() === "edge", y.querySelector(".m-size").hidden = p() === "edge", _.classList.toggle("left", m() === "left"), _.classList.toggle("right", m() === "right");
633
+ let e = t.hint?.where === "launcher" ? m() : t.hint?.where === "bottom-left" ? "left" : "right";
634
+ v.classList.toggle("left", e === "left"), v.classList.toggle("right", e === "right"), v.classList.toggle("by", !!u && u.position !== "edge" && e === m());
635
+ }
636
+ x();
637
+ let S = null, ee = 0, C = !1, w = () => {
638
+ y.hidden = !0, b.hidden = !0, C = !1;
639
+ };
640
+ function T() {
641
+ w();
642
+ let e = g.getBoundingClientRect();
643
+ y.style.bottom = `${Math.max(8, innerHeight - e.top + 8)}px`, y.style.left = p() === "left" ? `${Math.max(8, e.left)}px` : "", y.style.right = p() === "left" ? "" : `${Math.max(8, innerWidth - e.right)}px`, y.hidden = !1, C = !0, y.querySelector("button").focus();
644
+ }
645
+ g.addEventListener("click", (e) => {
646
+ S?.moved ? e.preventDefault() : (g.hidden = !0, n("launcher"));
647
+ }), g.addEventListener("contextmenu", (e) => {
648
+ e.preventDefault(), e.stopPropagation(), T();
649
+ }), g.addEventListener("pointerdown", (e) => {
650
+ e.button === 0 && (S = {
651
+ x: e.clientX,
652
+ y: e.clientY,
653
+ moved: !1
654
+ }, e.pointerType !== "mouse" && (ee = setTimeout(() => {
655
+ S && !S.moved && (S = null, T());
656
+ }, 550)));
657
+ });
658
+ let E = (e) => {
659
+ if (!S || !S.moved && Math.hypot(e.clientX - S.x, e.clientY - S.y) < 6) return;
660
+ clearTimeout(ee), S.moved = !0, g.classList.add("dragging");
661
+ let t = g.getBoundingClientRect(), n = p() === "edge";
662
+ g.style.left = `${n ? innerWidth - t.width : Math.min(innerWidth - t.width - 8, Math.max(8, e.clientX - t.width / 2))}px`, g.style.right = "auto", g.style.top = `${Math.min(innerHeight - t.height - 8, Math.max(8, e.clientY - t.height / 2))}px`, g.style.bottom = "auto", g.style.transform = n ? "rotate(180deg)" : "none";
663
+ }, D = (e) => {
664
+ if (clearTimeout(ee), !S?.moved) {
665
+ S = null;
666
+ return;
667
+ }
668
+ let t = g.getBoundingClientRect();
669
+ g.classList.remove("dragging");
670
+ for (let e of [
671
+ "left",
672
+ "right",
673
+ "top",
674
+ "bottom",
675
+ "transform"
676
+ ]) g.style[e] = "";
677
+ let n = Math.round(Math.min(innerHeight - t.height - 8, Math.max(8, innerHeight - t.bottom)));
678
+ f({
679
+ y: n,
680
+ ...p() === "edge" ? {} : { side: e.clientX < innerWidth / 2 ? "left" : "right" }
681
+ }), setTimeout(() => {
682
+ S = null;
683
+ }, 0);
684
+ };
685
+ window.addEventListener("pointermove", E, !0), window.addEventListener("pointerup", D, !0), y.querySelector(".m-open").addEventListener("click", () => {
686
+ w(), g.hidden = !0, n("launcher");
687
+ }), y.querySelector(".m-size").addEventListener("click", () => {
688
+ w(), f({ compact: !d.compact });
689
+ }), y.querySelector(".m-side").addEventListener("click", () => {
690
+ w(), f({ side: p() === "left" ? "right" : "left" });
691
+ }), y.querySelector(".m-hide").addEventListener("click", () => {
692
+ w(), U.set(sessionStorage, F, "1"), V();
693
+ });
694
+ let te = null, ne = (e) => !!e.closest("a[href],input,textarea,select,img,video,[contenteditable=\"\"],[contenteditable=\"true\"]") || !!String(getSelection?.() || "").trim(), O = (e) => {
695
+ if (!t.context || t.context === "off" || e.composedPath?.().includes(c) || document.getElementById("specto-point") || !r()) return;
696
+ let i = e.target instanceof Element ? e.target : null;
697
+ if (i) {
698
+ if (e.shiftKey || e.altKey) {
699
+ if (t.context === "menu" && e.shiftKey) return;
700
+ e.preventDefault(), w(), n("context", i);
701
+ } else t.context !== "menu" || ne(i) || (e.preventDefault(), w(), te = i, b.style.left = `${Math.min(e.clientX, innerWidth - 250)}px`, b.style.top = `${Math.min(e.clientY, innerHeight - 90)}px`, b.hidden = !1, C = !0, b.querySelector("button").focus());
702
+ }
703
+ };
704
+ b.querySelector(".c-go").addEventListener("click", () => {
705
+ let e = te;
706
+ w(), e?.isConnected && n("context", e);
707
+ }), window.addEventListener("contextmenu", O, !0);
708
+ let k = (e) => {
709
+ C && !e.composedPath?.().includes(c) && w();
710
+ }, A = (e) => {
711
+ C && e.key === "Escape" && (w(), g.focus?.());
712
+ };
713
+ window.addEventListener("pointerdown", k, !0), window.addEventListener("keydown", A, !0), window.addEventListener("scroll", w, {
714
+ passive: !0,
715
+ capture: !0
716
+ });
717
+ let re = 0, ie = 0, ae = Date.now(), oe = () => {
718
+ re = Date.now();
719
+ };
720
+ window.addEventListener("keydown", oe, !0);
721
+ let L = () => {
722
+ _.hidden = !0;
723
+ };
724
+ _.querySelector(".go").addEventListener("click", () => {
725
+ L(), n("nudge");
726
+ }), _.querySelector(".no").addEventListener("click", L);
727
+ let R = null;
728
+ try {
729
+ R = JSON.parse(U.get(localStorage, ce) || "null");
730
+ } catch {}
731
+ let z = () => U.get(localStorage, j) === "1", B = () => {
732
+ v.hidden = !0;
733
+ };
734
+ v.querySelector(".go").addEventListener("click", () => {
735
+ B(), n("hint");
736
+ }), v.querySelector(".no").addEventListener("click", B);
737
+ let le = !1, V = () => {
738
+ let e = !!document.getElementById("specto-point"), n = r() && !e, i = !!document.getElementById("specto-feedback-host"), o = U.get(sessionStorage, F) === "1";
739
+ if (g.hidden = !(u && n && !i && !o && de(u.pages)), g.hidden && !y.hidden && w(), e && (L(), B()), t.nudge && n && !ie && !U.get(sessionStorage, N)) {
740
+ let e = ve(a.recent(), t.nudge, ae), n = Date.now() - re < ue || /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName || "") || document.activeElement?.isContentEditable;
741
+ e && !n && (ie = Date.now(), U.set(sessionStorage, N, "1"), B(), _.hidden = !1, setTimeout(L, I)), e && (ae = e);
742
+ }
743
+ if (t.hint && n && !le) {
744
+ le = !0;
745
+ let e = Number(U.get(localStorage, M)) || 0;
746
+ _e(t.hint, {
747
+ used: z(),
748
+ visits: e,
749
+ last: R,
750
+ release: a.release
751
+ }) && (U.set(localStorage, ce, JSON.stringify({
752
+ at: Date.now(),
753
+ release: a.release || null
754
+ })), setTimeout(() => {
755
+ _.hidden && !document.getElementById("specto-point") && (v.hidden = !1);
756
+ }, 1500));
757
+ }
758
+ };
759
+ V();
760
+ let H = setInterval(V, 1e3), W = new MutationObserver(V);
761
+ return W.observe(document.documentElement, { childList: !0 }), {
762
+ launcher(e) {
763
+ u = q(t.launcher, e), x(), V();
764
+ },
765
+ stop() {
766
+ clearInterval(H), W.disconnect(), window.removeEventListener("keydown", oe, !0), window.removeEventListener("pointermove", E, !0), window.removeEventListener("pointerup", D, !0), window.removeEventListener("contextmenu", O, !0), window.removeEventListener("pointerdown", k, !0), window.removeEventListener("keydown", A, !0), window.removeEventListener("scroll", w, !0), c.remove();
767
+ }
768
+ };
769
+ }
770
+ function ye(e, { open: t } = {}) {
771
+ let n = (e || []).filter((e) => e && e.title).slice(0, 3);
772
+ if (!n.length || document.getElementById("specto-point-fixed")) return null;
773
+ let r = document.createElement("div");
774
+ r.id = "specto-point-fixed", r.className = "specto-block", r.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646");
775
+ let i = r.attachShadow({ mode: "open" }), a = n[0];
776
+ i.innerHTML = `<style>${X}${Y}</style>
777
+ <div class="card fixed" role="status" aria-live="polite">
778
+ <button class="x" type="button" aria-label="Dismiss"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3l-6 6"/></svg></button>
779
+ <div class="hd"><span class="okc" aria-hidden="true"><svg viewBox="0 0 12 12"><path d="M2.5 6.2 5 8.5 9.5 3.5"/></svg></span><b></b></div>
780
+ <p class="msg"></p>${n.length > 1 ? `<p class="more">And ${n.length - 1} more you reported ${n.length > 2 ? "are" : "is"} fixed too.</p>` : ""}
781
+ <div class="row"><button class="go" type="button">Got it</button><button class="no still" type="button">Still happening?</button></div>
782
+ </div>`, i.querySelector("b").textContent = `Fixed: ${a.title}`, i.querySelector(".msg").textContent = a.message || "The fix is live. Thank you, it helped.";
783
+ let o = () => r.remove();
784
+ return i.querySelector(".x").addEventListener("click", o), i.querySelector(".go").addEventListener("click", o), i.querySelector(".still").addEventListener("click", () => {
785
+ o(), t?.("fixed", null, a.receipt);
786
+ }), document.documentElement.appendChild(r), { close: o };
787
+ }
788
+ var Y = "\n.card.fixed{top:20px;right:20px;bottom:auto;width:340px;padding:16px 16px 14px}\n.fixed .hd{align-items:flex-start;padding-right:22px}\n.fixed .hd b{line-height:1.4}\n.okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}\n.okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.fixed .more{font-size:12px;color:#8A93A6}\n.fixed .row{margin-top:2px}\n.x{position:absolute;top:8px;right:8px;width:28px;height:28px;border:0;border-radius:6px;background:none;color:#8A93A6;display:flex;align-items:center;justify-content:center;cursor:pointer}\n.x svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}\n.x:hover{color:#F4F5F8}\n@media (max-width:480px){.card.fixed{left:12px;right:12px;width:auto}}\n", X = "\n:host{all:initial}\n*{-webkit-user-select:none;user-select:none}\ninput,textarea{-webkit-user-select:text;user-select:text}\n*{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n[hidden]{display:none!important}\n.kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap}\n.kc.lg{min-width:34px;height:26px;padding:0 8px;font-size:12.5px;border-bottom-width:3px;border-radius:6px}\n.keys,.or,.big{display:inline-flex;align-items:center;gap:3px}\n.pill{position:fixed;bottom:var(--specto-launcher-y,20px);display:inline-flex;align-items:center;gap:10px;height:40px;padding:0 12px 0 11px;border:0;border-radius:999px;background:var(--bg,#0E1320);color:var(--ink,#fff);font:600 13px/1 ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif;cursor:pointer;box-shadow:0 8px 22px rgba(7,10,16,.28);white-space:nowrap}\n.pill.right{right:var(--specto-launcher-x,20px)}.pill.left{left:var(--specto-launcher-x,20px)}\n.pill .ic{width:16px;height:16px;flex:none;fill:none;stroke:#A9A0FF;stroke-width:1.6}\n.pill .ic .d{fill:#A9A0FF;stroke:none}\n.pill .keys{opacity:.7}\n.pill .kc{height:18px;min-width:18px;border-color:currentColor;background:transparent;opacity:.85}\n.pill.edge{right:0;bottom:auto;top:calc(50% + var(--specto-launcher-y,0px) - 20px);height:auto;padding:14px 9px;gap:8px;border-radius:10px 0 0 10px;writing-mode:vertical-rl;transform:translateY(-50%) rotate(180deg)}\n.pill.edge .keys{display:none}\n.pill:hover{filter:brightness(1.12)}\n.pill:focus-visible,.card button:focus-visible{outline:2px solid #5B4BF0;outline-offset:2px}\n.card{position:fixed;bottom:calc(var(--specto-launcher-y,20px) + 52px);width:330px;background:#0E1320;color:#F4F5F8;border-radius:12px;padding:14px 16px;box-shadow:0 12px 32px rgba(7,10,16,.35);font-size:13px;display:flex;flex-direction:column;gap:10px}\n.card.right{right:var(--specto-launcher-x,20px)}.card.left{left:var(--specto-launcher-x,20px)}\n.card.hint:not(.by){bottom:24px}\n.hd{display:flex;align-items:center;gap:10px}\n.hd b{font-size:14px;font-weight:600}\n.red{width:8px;height:8px;border-radius:50%;background:#F87171;flex:none}\n.card p{margin:0;line-height:1.5;color:#C3C8D4}\n.row{display:flex;align-items:center;gap:10px}\n.go{height:34px;padding:0 14px;background:#5B4BF0;border:0;color:#fff;border-radius:8px;font-weight:600;font-size:13px;cursor:pointer}\n.no{height:34px;padding:0 10px;background:none;border:0;color:#8A93A6;font-size:13px;cursor:pointer}\n.or{margin-left:auto;gap:4px;font-size:11px;color:#8A93A6}\n.pill.compact{width:44px;height:44px;padding:0;justify-content:center;gap:0}\n.pill.compact .lbl,.pill.compact .keys{display:none}\n.pill.compact .ic{width:20px;height:20px}\n.pill.compact::after{content:\"\";position:absolute;inset:-4px;border-radius:50%;border:2px solid rgba(169,160,255,.55);animation:sp-pulse 2.4s ease-out 2;pointer-events:none}\n@keyframes sp-pulse{0%{transform:scale(.85);opacity:1}100%{transform:scale(1.35);opacity:0}}\n.pill.dragging{cursor:grabbing;transition:none;box-shadow:0 14px 34px rgba(7,10,16,.4)}\n.menu{position:fixed;min-width:210px;background:#0E1320;color:#F4F5F8;border:1px solid #2a3346;border-radius:10px;padding:5px;box-shadow:0 12px 32px rgba(7,10,16,.4);font-size:13px;display:flex;flex-direction:column}\n.menu button{display:flex;align-items:center;gap:8px;text-align:left;background:none;border:0;color:inherit;font:inherit;padding:8px 10px;border-radius:7px;cursor:pointer}\n.menu button:hover,.menu button:focus-visible{background:rgba(91,75,240,.22);outline:none}\n.menu .m-open,.menu .c-go{font-weight:600}\n.menu .ic{width:16px;height:16px;fill:none;stroke:#A9A0FF;stroke-width:1.6}\n.menu .ic .d{fill:#A9A0FF;stroke:none}\n.menu hr{border:0;border-top:1px solid #232c40;margin:4px 2px}\n.menu .tip{margin:4px 10px 6px;font-size:11px;color:#8A93A6}\n@media (prefers-reduced-motion:reduce){.pill.compact::after{animation:none;opacity:0}}\n@media (max-width:480px){.card{width:calc(100vw - 40px)}}\n", be = [
789
+ "broken",
790
+ "wrong",
791
+ "slow",
792
+ "confusing",
793
+ "idea"
794
+ ], xe = "specto-point-voice", Se = "specto-point-sent", Ce = "specto-point-used", we = 2, Te = 6e3, Ee = [
795
+ "",
796
+ "①",
797
+ "②",
798
+ "③",
799
+ "④",
800
+ "⑤",
801
+ "⑥",
802
+ "⑦",
803
+ "⑧",
804
+ "⑨",
805
+ "⑩"
806
+ ], De = "<svg viewBox=\"0 0 18 18\" aria-hidden=\"true\"><rect x=\"6.5\" y=\"2\" width=\"5\" height=\"9\" rx=\"2.5\"/><path d=\"M3.5 8.5a5.5 5.5 0 0 0 11 0M9 14v2.5\"/></svg>", Oe = "<svg viewBox=\"0 0 12 12\" aria-hidden=\"true\"><path d=\"M2.5 6.2 5 8.5 9.5 3.5\"/></svg>", Z = {
807
+ get: (e) => {
808
+ try {
809
+ return localStorage.getItem(e);
810
+ } catch {
811
+ return null;
812
+ }
813
+ },
814
+ set: (e, t) => {
815
+ try {
816
+ localStorage.setItem(e, t);
817
+ } catch {}
818
+ }
819
+ }, ke = {
820
+ broken: "#F43F5E",
821
+ wrong: "#F59E0B",
822
+ slow: "#8B5CF6",
823
+ confusing: "#0EA5E9",
824
+ idea: "#10B981"
825
+ }, Ae = {
826
+ broken: "Broken",
827
+ wrong: "Wrong",
828
+ slow: "Slow",
829
+ confusing: "Confusing",
830
+ idea: "Idea"
831
+ }, je = "specto-point-howto", Me = 20, Ne = 8, Pe = {
832
+ "double-ctrl": "Double-tap Ctrl",
833
+ "hold-alt": "Hold Alt",
834
+ "hold-ctrl": "Hold Ctrl",
835
+ chord: "Alt + Shift + P"
836
+ }, Fe = [
837
+ "pointerdown",
838
+ "pointerup",
839
+ "mousedown",
840
+ "mouseup",
841
+ "click",
842
+ "dblclick",
843
+ "auxclick",
844
+ "contextmenu",
845
+ "touchstart",
846
+ "touchend"
847
+ ];
848
+ function Q(e, t = {}) {
849
+ if (document.getElementById("specto-point")) return null;
850
+ let n = e._point, r = () => n.strict(), i = () => n.unmask?.() || "", a = [], o = "armed", s = null, c = null, l = null, u = null, f = null, p = null, m = 0, g = [], _ = 0, y = !1, b = !1, x = 0, S = !1, w = !1, T = document.createElement("div");
851
+ T.id = "specto-point", T.className = "specto-block", T.setAttribute("style", "all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646");
852
+ let E = T.attachShadow({ mode: "open" });
853
+ E.innerHTML = `<style>${Ie}</style>
854
+ <div class="ring" data-state="armed" aria-hidden="true"><span class="badge"></span><span class="dot"></span></div>
855
+ <div class="outline" aria-hidden="true"><span class="chip"></span></div>
856
+ <div class="frame" aria-hidden="true"></div>
857
+ <div class="marks"></div>
858
+ <section class="rail" role="region" aria-label="Specto Point — report what is wrong">
859
+ <header><b>Point</b><span class="hint"></span><button class="x" aria-label="Leave Point" title="Leave (Esc)">×</button></header>
860
+ <ol class="list"></ol>
861
+ <p class="empty">Click what is wrong. Drag to frame an area.</p>
862
+ <div class="vcard" hidden>
863
+ <b>Tell us like you’d tell a friend</b>
864
+ <p>Point at things and just talk: “this button does nothing”. Your words show up here as you go.</p>
865
+ <p class="fine">Your browser will ask to use the microphone. We only turn your voice into text; the recording is deleted.</p>
866
+ <button class="vstart" type="button">${De}Start talking</button>
867
+ <p class="fine c">Rather type? Just start typing.</p>
868
+ </div>
869
+ <div class="listening" hidden>
870
+ <div class="lh"><span class="rd" aria-hidden="true"></span>Listening<span class="bars" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span></div>
871
+ <p class="cap" aria-live="polite"></p>
872
+ <p class="fine">Each phrase shows up a moment after you pause, on the marker you were pointing at.</p>
873
+ </div>
874
+ <details class="exp"><summary>Expected / what happened</summary>
875
+ <input class="expected" maxlength="500" placeholder="What did you expect?" aria-label="What did you expect?">
876
+ <input class="actual" maxlength="500" placeholder="What happened instead?" aria-label="What happened instead?">
877
+ </details>
878
+ <label class="keep" hidden><input type="checkbox"> Also send my voice recording (kept 30 days)</label>
879
+ <button class="flowbtn" type="button" title="F — use the page normally while Specto brackets this stretch of the recording">Record a flow</button>
880
+ <div class="row bottom">
881
+ <button class="mic" type="button" hidden aria-label="Talk" title="M — talk instead of typing; your words appear as you go">${De}</button>
882
+ <button class="typei" type="button" hidden>Type instead</button>
883
+ <button class="send" type="button" disabled>Send</button>
884
+ </div>
885
+ <p class="status" role="status" aria-live="polite"></p>
886
+ </section>
887
+ <div class="howto" hidden role="dialog" aria-label="How Point works"></div>`;
888
+ let D = (e) => E.querySelector(e), O = D(".ring"), k = D(".outline"), A = D(".frame"), re = D(".marks"), j = D(".rail"), M = D(".list"), se = D(".status"), ce = D(".hint");
889
+ document.documentElement.appendChild(T);
890
+ let N = document.createElement("style");
891
+ N.id = "specto-point-cursor", N.textContent = "html.specto-point-on,html.specto-point-on *{cursor:none!important}", document.head?.appendChild(N);
892
+ let P = (e) => document.documentElement.classList.toggle("specto-point-on", e);
893
+ P(!0), n.active(!0);
894
+ let F = (e) => e.composedPath?.().includes(T), I = (e, t) => {
895
+ se.textContent = e || "", se.classList.toggle("bad", !!t);
896
+ };
897
+ function L(e) {
898
+ o = e, O.dataset.state = u ? `${e} listening` : e;
899
+ let t = e === "flow";
900
+ P(!t && e !== "sent"), n.active(!t && e !== "sent"), k.style.display = t ? "none" : "", ce.textContent = e === "flow" ? "Use the page — F ends the flow" : "Esc to cancel", D(".flowbtn").textContent = l && !l.end ? "End the flow" : l?.end ? "Flow recorded ✓" : "Record a flow", D(".flowbtn").classList.toggle("on", e === "flow"), D(".send").disabled = b || !(a.length || l?.end || D(".expected").value.trim() || D(".actual").value.trim()), D(".empty").hidden = a.length > 0, O.querySelector(".badge").textContent = e === "marking" || e === "armed" ? String(a.length + 1) : "";
901
+ }
902
+ function R(e) {
903
+ e !== _ && (u && (u.cut(), g.push({
904
+ at: Date.now(),
905
+ marker: e
906
+ })), _ = e);
907
+ }
908
+ function z(e, t) {
909
+ if (a.length >= Me) {
910
+ I(`At most ${Me} markers in one report`, !0);
911
+ return;
912
+ }
913
+ Xe();
914
+ let o = Date.now(), s = C(e, {
915
+ strict: r(),
916
+ unmask: i()
917
+ }), c = te({
918
+ recent: n.recent(),
919
+ contains: (t) => e === t || e.contains(t) || t.contains?.(e),
920
+ now: o
921
+ }), l = {
922
+ n: a.length + 1,
923
+ el: e,
924
+ kind: t ? "region" : "element",
925
+ flag: "broken",
926
+ note: "",
927
+ at: o,
928
+ desc: s,
929
+ ctx: c,
930
+ region: t ? {
931
+ x: t.x + scrollX,
932
+ y: t.y + scrollY,
933
+ w: t.w,
934
+ h: t.h
935
+ } : null
936
+ };
937
+ t && (l.desc.rect = {
938
+ x: Math.round(t.x),
939
+ y: Math.round(t.y),
940
+ w: Math.round(t.w),
941
+ h: Math.round(t.h)
942
+ }), a.push(l), R(l.n), U(), L("marking"), nt || B(e, t);
943
+ }
944
+ function B(e, t) {
945
+ if (innerWidth <= 560) return;
946
+ let n;
947
+ try {
948
+ n = t || e.getBoundingClientRect();
949
+ } catch {
950
+ return;
951
+ }
952
+ let r = j.getBoundingClientRect();
953
+ n.x < r.right && n.x + (n.w ?? n.width) > r.left && n.y < r.bottom && n.y + (n.h ?? n.height) > r.top && j.classList.toggle("left");
954
+ }
955
+ function ue(e) {
956
+ a.splice(e, 1), a.forEach((e, t) => {
957
+ e.n = t + 1;
958
+ }), R(a.length ? a[a.length - 1].n : 0), U(), L(a.length ? "marking" : "armed");
959
+ }
960
+ let H = (e) => {
961
+ e.flag = be[(be.indexOf(e.flag) + 1) % be.length], U();
962
+ };
963
+ function U() {
964
+ M.replaceChildren(...a.map((e, t) => {
965
+ let n = document.createElement("li");
966
+ return n.innerHTML = `<button class="num" type="button" title="Change the flag" style="--c:${ke[e.flag]}">${e.n}</button>
967
+ <span class="what"><span class="name"></span><button class="flag" type="button" style="--c:${ke[e.flag]}">${Ae[e.flag]}</button></span>
968
+ <textarea class="note" rows="1" maxlength="1000" placeholder="${u ? "Talk, or type here" : "Note (optional)"}" aria-label="Note for marker ${e.n}"></textarea>
969
+ <button class="rm" type="button" aria-label="Remove marker ${e.n}">×</button>`, n.dataset.n = String(e.n), n.querySelector(".name").textContent = e.desc.component ? `${e.desc.component} · ${e.desc.name}` : e.desc.name, n.querySelector(".note").value = e.note, n.querySelector(".note").addEventListener("input", (t) => {
970
+ e.note = t.target.value;
971
+ }), n.querySelector(".note").addEventListener("focus", () => R(e.n)), n.querySelector(".num").addEventListener("click", () => H(e)), n.querySelector(".flag").addEventListener("click", () => H(e)), n.querySelector(".rm").addEventListener("click", () => ue(t)), n.addEventListener("pointerenter", () => R(e.n)), n;
972
+ })), re.replaceChildren(...a.map((e) => {
973
+ let t = document.createElement("div");
974
+ return t.className = `mk ${e.kind}`, t.style.setProperty("--c", ke[e.flag]), t.innerHTML = `<button class="pin" type="button" aria-label="Marker ${e.n}: ${Ae[e.flag]} — click to change">${e.n}</button>`, t.querySelector(".pin").addEventListener("click", (t) => {
975
+ t.stopPropagation(), H(e);
976
+ }), e.node = t, t;
977
+ })), de();
978
+ }
979
+ function de() {
980
+ for (let e of a) {
981
+ if (!e.node) continue;
982
+ let t;
983
+ if (e.region) t = {
984
+ left: e.region.x - scrollX,
985
+ top: e.region.y - scrollY,
986
+ width: e.region.w,
987
+ height: e.region.h
988
+ };
989
+ else try {
990
+ t = e.el.getBoundingClientRect();
991
+ } catch {
992
+ t = null;
993
+ }
994
+ !t || !e.region && !e.el.isConnected ? e.node.style.display = "none" : (e.node.style.display = "", e.node.style.transform = `translate(${t.left}px, ${t.top}px)`, e.node.style.width = `${Math.max(4, t.width)}px`, e.node.style.height = `${Math.max(4, t.height)}px`);
995
+ }
996
+ }
997
+ let fe = () => {
998
+ if (!S) {
999
+ if (de(), u) {
1000
+ let e = u.level();
1001
+ O.style.setProperty("--lv", e.toFixed(2)), D(".bars").style.setProperty("--lv", Math.min(1, e * 2.5).toFixed(2));
1002
+ }
1003
+ x = requestAnimationFrame(fe);
1004
+ }
1005
+ };
1006
+ x = requestAnimationFrame(fe);
1007
+ let W = (e, t) => {
1008
+ let n = document.elementFromPoint(e, t);
1009
+ return n && n !== T && n !== document.documentElement ? n : null;
1010
+ };
1011
+ function G(e) {
1012
+ if (!e) {
1013
+ k.style.opacity = "0";
1014
+ return;
1015
+ }
1016
+ let t;
1017
+ try {
1018
+ t = e.getBoundingClientRect();
1019
+ } catch {
1020
+ return;
1021
+ }
1022
+ if (k.style.opacity = "1", k.style.transform = `translate(${t.left}px, ${t.top}px)`, k.style.width = `${t.width}px`, k.style.height = `${t.height}px`, s !== e) {
1023
+ let n = d(e, r(), i()), { component: a } = v(e), o = ee(e, {
1024
+ component: a,
1025
+ name: h(e, n).slice(0, 30)
1026
+ });
1027
+ k.querySelector(".chip").textContent = o, k.classList.toggle("below", t.top < 24);
1028
+ }
1029
+ }
1030
+ let K = (e) => {
1031
+ if (O.style.transform = `translate(${e.clientX}px, ${e.clientY}px)`, O.classList.add("seen"), o === "flow" || o === "sent") return;
1032
+ if (F(e)) {
1033
+ G(null), s = null;
1034
+ return;
1035
+ }
1036
+ if (c && (Math.abs(e.clientX - c.x) > Ne || Math.abs(e.clientY - c.y) > Ne)) {
1037
+ c.region = {
1038
+ x: Math.min(c.x, e.clientX),
1039
+ y: Math.min(c.y, e.clientY),
1040
+ w: Math.abs(e.clientX - c.x),
1041
+ h: Math.abs(e.clientY - c.y)
1042
+ }, Object.assign(A.style, {
1043
+ display: "block",
1044
+ transform: `translate(${c.region.x}px, ${c.region.y}px)`,
1045
+ width: `${c.region.w}px`,
1046
+ height: `${c.region.h}px`
1047
+ }), G(null);
1048
+ return;
1049
+ }
1050
+ let t = W(e.clientX, e.clientY);
1051
+ G(t), s = t;
1052
+ let n = t && a.find((e) => e.el === t || e.el.contains?.(t));
1053
+ n && R(n.n);
1054
+ }, he = (e) => {
1055
+ if (!(S || o === "flow" || o === "sent" || F(e)) && (e.preventDefault(), e.stopImmediatePropagation(), e.type === "pointerdown" && e.button === 0 && (c = {
1056
+ x: e.clientX,
1057
+ y: e.clientY,
1058
+ el: W(e.clientX, e.clientY),
1059
+ region: null
1060
+ }), e.type === "pointerup" && c)) {
1061
+ let e = c;
1062
+ if (c = null, A.style.display = "none", e.region && e.region.w > Ne && e.region.h > Ne) {
1063
+ let t = e.region.x + e.region.w / 2, n = e.region.y + e.region.h / 2;
1064
+ z(W(t, n) || document.body, e.region);
1065
+ } else e.el && z(e.el, null);
1066
+ }
1067
+ }, ge = (e) => {
1068
+ let t = e.composedPath?.()[0];
1069
+ return t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA") && F(e);
1070
+ }, q = (e) => {
1071
+ if (S || o === "sent") return;
1072
+ if (ge(e)) {
1073
+ e.key === "Escape" ? (e.target.blur?.(), j.focus?.()) : e.key === "Enter" && !e.shiftKey && (e.preventDefault(), $e());
1074
+ return;
1075
+ }
1076
+ let t = e.key;
1077
+ if ((!X.hidden || u) && t.length === 1 && t !== "?" && !e.ctrlKey && !e.metaKey && !e.altKey && o !== "flow") Ze(e);
1078
+ else if ((e.ctrlKey || e.metaKey) && (t === "a" || t === "A")) e.preventDefault();
1079
+ else if ([
1080
+ "Escape",
1081
+ "Enter",
1082
+ "Backspace",
1083
+ "f",
1084
+ "F",
1085
+ "m",
1086
+ "M",
1087
+ "?",
1088
+ "Tab"
1089
+ ].includes(t) && (o !== "flow" || [
1090
+ "f",
1091
+ "F",
1092
+ "Escape"
1093
+ ].includes(t))) {
1094
+ if (e.preventDefault(), e.stopImmediatePropagation(), t === "Escape") {
1095
+ if (o === "flow") {
1096
+ J();
1097
+ return;
1098
+ }
1099
+ if (a.length && !y) {
1100
+ y = !0, I("Press Esc again to discard this report"), setTimeout(() => {
1101
+ y = !1;
1102
+ }, 3e3);
1103
+ return;
1104
+ }
1105
+ $();
1106
+ } else t === "Enter" ? s && !a.some((e) => e.el === s) && _e.active ? z(s, null) : $e() : t === "Backspace" ? a.length && ue(a.length - 1) : t === "f" || t === "F" ? o === "flow" ? J() : ve() : t === "m" || t === "M" ? Je() : t === "?" ? Qe(!0) : t === "Tab" && _e.next(e.shiftKey);
1107
+ }
1108
+ }, _e = {
1109
+ active: !1,
1110
+ i: -1,
1111
+ next(e) {
1112
+ let t = Array.from(document.querySelectorAll("a[href],button,input,select,textarea,summary,[tabindex]:not([tabindex=\"-1\"]),[role=button],[role=link]")).filter((e) => {
1113
+ let t = e.getBoundingClientRect();
1114
+ return t.width > 0 && t.height > 0 && !T.contains(e);
1115
+ });
1116
+ if (t.length) {
1117
+ this.active = !0, this.i = (this.i + (e ? -1 : 1) + t.length) % t.length, s = t[this.i];
1118
+ try {
1119
+ s.scrollIntoView({ block: "nearest" });
1120
+ } catch {}
1121
+ G(s);
1122
+ }
1123
+ }
1124
+ };
1125
+ function ve() {
1126
+ l?.end && (l = null), l = {
1127
+ start: Date.now(),
1128
+ end: null
1129
+ }, G(null), L("flow"), ye();
1130
+ }
1131
+ function J() {
1132
+ l && !l.end && (l.end = Date.now(), L(a.length ? "marking" : "armed"), I(`Flow recorded (${Math.round((l.end - l.start) / 1e3)} s)`));
1133
+ }
1134
+ function ye() {
1135
+ if (S || !l || l.end) return;
1136
+ let e = Math.round((Date.now() - l.start) / 1e3);
1137
+ ce.textContent = `Recording the flow ${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")} — F ends it`, setTimeout(ye, 500);
1138
+ }
1139
+ let Y = D(".mic"), X = D(".vcard"), Q = !!t.voice && ie(), Le = t.voiceLang && t.voiceLang !== "auto" ? t.voiceLang : String(navigator.language || "").slice(0, 2).toLowerCase(), Re = String(n.endpoint).replace(/\/api\/point$/, "/api/point-transcribe");
1140
+ Q && (Y.hidden = !1), Q && t.keepAudio && (D(".keep").hidden = !1);
1141
+ let ze = (e) => {
1142
+ let t = 0;
1143
+ for (let n of g) if (n.at <= e) t = n.marker;
1144
+ else break;
1145
+ return t;
1146
+ };
1147
+ function Be(e) {
1148
+ let t = e && M.querySelector(`li[data-n="${e}"]`);
1149
+ return t ? t.querySelector(".note") : (D(".exp").open = !0, D(".actual"));
1150
+ }
1151
+ async function Ve(e) {
1152
+ let t = ze(e.startedAt), r = Date.now();
1153
+ m++, L(o);
1154
+ try {
1155
+ let i = await fetch(Re, {
1156
+ method: "POST",
1157
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1158
+ credentials: "omit",
1159
+ body: JSON.stringify({
1160
+ key: n.key,
1161
+ mime: e.mime,
1162
+ data: await oe(e.blob),
1163
+ lang: Le
1164
+ })
1165
+ }), o = await i.json().catch(() => ({})), s = i.ok ? String(o.text || "").trim() : "";
1166
+ if (s) {
1167
+ We(t, s, e.startedAt, r);
1168
+ let n = a.find((e) => e.n === t), i = Be(n ? t : 0);
1169
+ n && (n.note = `${n.note ? `${n.note} ` : ""}${s}`.slice(0, 1e3)), i && (i.value = n ? n.note : `${i.value ? `${i.value} ` : ""}${s}`.slice(0, 500), i.dispatchEvent(new Event("input")));
1170
+ } else i.ok || I("Some of what you said couldn’t be written down — type it if it’s missing", !0);
1171
+ } catch {
1172
+ I("Some of what you said couldn’t be written down — type it if it’s missing", !0);
1173
+ }
1174
+ m--, L(o);
1175
+ }
1176
+ let He = D(".cap"), Ue = [];
1177
+ function We(e, t, n, r) {
1178
+ Ue.push({
1179
+ n: e,
1180
+ words: t,
1181
+ at: n,
1182
+ end: r
1183
+ }), He.replaceChildren(...Ue.slice(-4).map((e) => {
1184
+ let t = document.createElement("span"), n = a.find((t) => t.n === e.n);
1185
+ return n && (t.className = "said", t.style.setProperty("--c", ke[n.flag])), t.textContent = `${e.words}${n ? ` ${Ee[n.n] || `(${n.n})`}` : ""} `, t;
1186
+ }));
1187
+ }
1188
+ function Ge(e) {
1189
+ Y.classList.toggle("on", e), Y.setAttribute("aria-label", e ? "Stop talking" : "Talk"), D(".typei").hidden = !e, D(".listening").hidden = !e;
1190
+ }
1191
+ async function Ke() {
1192
+ if (!u) return;
1193
+ let e = u;
1194
+ u = null, Ge(!1), L(o), f = await e.stop();
1195
+ }
1196
+ async function qe() {
1197
+ if (Q && !u) {
1198
+ X.hidden = !0, Y.hidden = !1;
1199
+ try {
1200
+ u = await ae({
1201
+ onPhrase: Ve,
1202
+ keep: !!t.keepAudio
1203
+ }), p ||= { startedAt: u.startedAt }, Z.set(xe, "yes"), g.push({
1204
+ at: u.startedAt,
1205
+ marker: _
1206
+ }), Ue.length || (He.textContent = "Say what you see…"), Ge(!0), L(o);
1207
+ } catch (e) {
1208
+ u = null, e?.name === "NotAllowedError" && Z.set(xe, "no"), I(e?.name === "NotAllowedError" ? "The microphone is blocked for this site — type instead" : "The microphone could not start — type instead", !0);
1209
+ }
1210
+ }
1211
+ }
1212
+ let Je = () => u ? Ke() : qe(), Ye = !1;
1213
+ function Xe() {
1214
+ Ye || !Q || u || Z.get(xe) || (Ye = !0, X.hidden = !1, Y.hidden = !0);
1215
+ }
1216
+ D(".typei").addEventListener("click", () => {
1217
+ Ke(), Be(_)?.focus();
1218
+ });
1219
+ function Ze(e) {
1220
+ X.hidden = !0, Y.hidden = !Q, u && Ke();
1221
+ let t = Be(_);
1222
+ t && (e.preventDefault(), e.stopImmediatePropagation(), t.focus(), t.value += e.key, t.dispatchEvent(new Event("input")));
1223
+ }
1224
+ function Qe(e) {
1225
+ let n = !1;
1226
+ try {
1227
+ n = localStorage.getItem(je) === "1";
1228
+ } catch {}
1229
+ if (n && !e) return;
1230
+ try {
1231
+ localStorage.setItem(je, "1");
1232
+ } catch {}
1233
+ w = !0;
1234
+ let r = D(".howto");
1235
+ r.innerHTML = `<div class="scene" aria-hidden="true"><div class="page"><i></i><i></i><b class="btn">Pay</b></div><span class="cur"></span><span class="pinh">1</span><span class="wave"></span></div>
1236
+ <ol><li><b>${Pe[t.trigger] || "Use the shortcut"}</b> to point</li><li><b>Click</b> what is wrong</li>${t.voice ? "<li><b>Say</b> what you see</li>" : "<li><b>Add a note</b> if you like</li>"}<li><b>Enter</b> sends it</li></ol>
1237
+ <button class="ok" type="button">Got it</button>`, r.hidden = !1;
1238
+ let i = () => {
1239
+ r.hidden || (r.hidden = !0, Xe());
1240
+ };
1241
+ r.querySelector(".ok").addEventListener("click", i), setTimeout(i, 9e3);
1242
+ }
1243
+ async function $e() {
1244
+ if (b) return;
1245
+ l && !l.end && J();
1246
+ let r = D(".expected").value.trim(), i = D(".actual").value.trim();
1247
+ if (!a.length && !l?.end && !r && !i) {
1248
+ I("Mark something first — click what is wrong", !0);
1249
+ return;
1250
+ }
1251
+ b = !0, L(o);
1252
+ let s = D(".send");
1253
+ s.innerHTML = "<span class=\"spin\" aria-hidden=\"true\"></span>Sending…", j.classList.add("busy"), I("");
1254
+ try {
1255
+ u && await Ke(), m > 0 && I("Writing down the last of what you said…");
1256
+ for (let e = Date.now() + Te; m > 0 && Date.now() < e;) await new Promise((e) => setTimeout(e, 100));
1257
+ I("");
1258
+ let o = !!(t.keepAudio && D(".keep input").checked && f?.blob?.size), s = {
1259
+ page: location.pathname,
1260
+ release: n.release || void 0,
1261
+ expected: r || void 0,
1262
+ actual: i || void 0,
1263
+ markers: a.map((e) => ({
1264
+ n: e.n,
1265
+ kind: e.kind,
1266
+ flag: e.flag,
1267
+ note: e.note.trim() || void 0,
1268
+ at: e.at,
1269
+ ...e.desc,
1270
+ viewport: {
1271
+ w: innerWidth,
1272
+ h: innerHeight
1273
+ },
1274
+ scroll: {
1275
+ x: Math.round(scrollX),
1276
+ y: Math.round(scrollY)
1277
+ },
1278
+ dpr: devicePixelRatio || 1,
1279
+ events: e.ctx.events,
1280
+ network: e.ctx.network,
1281
+ console: e.ctx.console
1282
+ })),
1283
+ flow: l?.end ? l : void 0,
1284
+ env: ne(),
1285
+ voice: p ? {
1286
+ live: !0,
1287
+ startedAt: p.startedAt,
1288
+ timeline: g,
1289
+ lang: Le || void 0,
1290
+ keep: o,
1291
+ phrases: Ue.map((e) => ({
1292
+ at: e.at,
1293
+ end: e.end,
1294
+ marker: a.some((t) => t.n === e.n) ? e.n : 0,
1295
+ text: e.words
1296
+ }))
1297
+ } : void 0,
1298
+ via: t.via || void 0
1299
+ }, c = {
1300
+ key: n.key,
1301
+ sessionId: e.sessionId || null,
1302
+ report: s,
1303
+ notify: { on: !!t.notify?.tick },
1304
+ ...t.about ? { about: t.about } : {}
1305
+ };
1306
+ o && (c.audio = {
1307
+ mime: f.mime,
1308
+ data: await oe(f.blob)
1309
+ });
1310
+ let d = await fetch(n.endpoint, {
1311
+ method: "POST",
1312
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1313
+ credentials: "omit",
1314
+ body: JSON.stringify(c)
1315
+ }), h = await d.json().catch(() => ({}));
1316
+ if (!d.ok) throw Error(h.error || `HTTP ${d.status}`);
1317
+ et(h.bug, h.receipt, h.reopened);
1318
+ } catch (e) {
1319
+ b = !1, s.textContent = "Send", j.classList.remove("busy"), L(o), I(`Couldn't send: ${String(e?.message || e).slice(0, 80)} — try again`, !0);
1320
+ }
1321
+ }
1322
+ function et(e, r = null, i = !1) {
1323
+ L("sent"), n.active(!1), P(!1), G(null), j.classList.add("done");
1324
+ let a = Math.floor(Number(e)) || 0, o = t.thanks?.message ? t.thanks.message.replace(/\{number\}/g, a ? String(a) : "") : i ? `Thanks — bug #${a} is open again, and the team can see what you saw.` : a ? `Sent as bug #${a} — thank you.` : "Sent — thank you.", s = document.createElement("div");
1325
+ s.className = "thanks", s.innerHTML = `<div class="th"><span class="okc" aria-hidden="true">${Oe}</span><b></b></div>`, s.querySelector("b").textContent = o;
1326
+ let c = (Number(Z.get(Se)) || 0) + 1;
1327
+ Z.set(Se, String(c));
1328
+ let l = pe(t), u = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, d = t.thanks?.teach !== !1 && l.length > 0 && !u && t.via !== "shortcut" && c <= we;
1329
+ if (d) {
1330
+ let e = document.createElement("p");
1331
+ e.className = "teach", e.innerHTML = `Next time, from any page: ${t.trigger === "double-ctrl" ? "tap " : ""}<span class="caps">${me(l)}</span> and click what’s wrong.`, s.append(e);
1332
+ }
1333
+ let f = t.notify && r ? tt(r) : null;
1334
+ f && s.append(f), j.replaceChildren(s), t.onSent?.(e);
1335
+ let p = null, m = (e) => {
1336
+ clearTimeout(p), p = setTimeout($, e);
1337
+ };
1338
+ s.addEventListener("pointerenter", () => clearTimeout(p)), s.addEventListener("focusin", () => clearTimeout(p)), s.addEventListener("pointerleave", () => {
1339
+ s.contains(s.getRootNode().activeElement) || m(2500);
1340
+ }), s.addEventListener("focusout", () => m(2500)), m(f ? 6500 : d ? 5200 : 2600);
1341
+ }
1342
+ function tt(e) {
1343
+ let r = n.endpoint.replace(/\/api\/point$/, "/api/point-notify"), i = (t) => fetch(r, {
1344
+ method: "POST",
1345
+ headers: { "Content-Type": "text/plain;charset=UTF-8" },
1346
+ credentials: "omit",
1347
+ body: JSON.stringify({
1348
+ key: n.key,
1349
+ receipt: e,
1350
+ ...t
1351
+ })
1352
+ }), a = !!n.identified?.(), o = document.createElement("div");
1353
+ o.className = "tell", o.innerHTML = "<label class=\"tick\"><input type=\"checkbox\"><span><b>Tell me when it’s fixed</b><small></small></span></label>";
1354
+ let s = o.querySelector("input"), c = o.querySelector("small");
1355
+ s.checked = !!t.notify.tick, c.textContent = a && t.notify.email ? "Here, and by email" : "We’ll show it here next time you visit", s.checked && le(e);
1356
+ let l = null;
1357
+ return t.notify.email && !a && (l = document.createElement("form"), l.className = "mail", l.innerHTML = "<label for=\"sp-mail\">Email me too (optional)</label><div><input id=\"sp-mail\" type=\"email\" autocomplete=\"email\" placeholder=\"you@example.com\" maxlength=\"254\"><button type=\"submit\">Save</button></div><p class=\"mailmsg\" role=\"status\"></p>", l.hidden = !s.checked, l.addEventListener("submit", async (e) => {
1358
+ e.preventDefault();
1359
+ let t = l.querySelector("input"), n = l.querySelector(".mailmsg"), r = t.value.trim();
1360
+ if (r) {
1361
+ n.textContent = "Saving…";
1362
+ try {
1363
+ let e = await i({
1364
+ on: !0,
1365
+ email: r
1366
+ }), a = await e.json().catch(() => ({}));
1367
+ n.textContent = e.ok ? "Saved — one email when it’s fixed, then we delete it" : a.error || "Couldn’t save it", e.ok && (t.disabled = !0);
1368
+ } catch {
1369
+ n.textContent = "Couldn’t save it";
1370
+ }
1371
+ }
1372
+ }), o.append(l)), s.addEventListener("change", () => {
1373
+ let t = s.checked;
1374
+ t ? le(e) : V(e), l && (l.hidden = !t), i({ on: t }).catch(() => {});
1375
+ }), o;
1376
+ }
1377
+ function $() {
1378
+ if (!S) {
1379
+ S = !0, cancelAnimationFrame(x), u && u.stop(), n.active(!1), P(!1);
1380
+ for (let e of Fe) window.removeEventListener(e, he, !0);
1381
+ window.removeEventListener("pointermove", K, !0), window.removeEventListener("keydown", q, !0), T.remove(), N.remove(), t.onClose?.();
1382
+ }
1383
+ }
1384
+ for (let e of Fe) window.addEventListener(e, he, {
1385
+ capture: !0,
1386
+ passive: !1
1387
+ });
1388
+ try {
1389
+ getSelection()?.removeAllRanges();
1390
+ } catch {}
1391
+ window.addEventListener("pointermove", K, !0), window.addEventListener("keydown", q, !0), D(".x").addEventListener("click", $);
1392
+ let nt = !1, rt = (e, t) => {
1393
+ let n = j.offsetWidth, r = j.offsetHeight;
1394
+ j.style.left = `${Math.min(innerWidth - n - 8, Math.max(8, e))}px`, j.style.top = `${Math.min(innerHeight - Math.min(r, 120), Math.max(8, t))}px`, j.style.right = "auto", j.style.bottom = "auto", nt = !0;
1395
+ }, it = j.querySelector("header");
1396
+ it.title = "Drag to move", it.addEventListener("pointerdown", (e) => {
1397
+ if (e.button !== 0 || e.target.closest("button") || innerWidth <= 560) return;
1398
+ let t = j.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
1399
+ j.classList.add("moving");
1400
+ let i = (e) => rt(e.clientX - n, e.clientY - r), a = () => {
1401
+ j.classList.remove("moving"), window.removeEventListener("pointermove", i, !0), window.removeEventListener("pointerup", a, !0);
1402
+ };
1403
+ window.addEventListener("pointermove", i, !0), window.addEventListener("pointerup", a, !0), e.preventDefault();
1404
+ }), D(".send").addEventListener("click", $e), D(".flowbtn").addEventListener("click", () => l && !l.end ? J() : ve()), Y.addEventListener("click", Je), D(".vstart").addEventListener("click", qe);
1405
+ for (let e of [".expected", ".actual"]) D(e).addEventListener("input", () => L(o));
1406
+ L("armed"), Z.set(Ce, "1");
1407
+ let at = Z.get(xe);
1408
+ return Q && at === "yes" && qe(), Qe(!1), w || Xe(), t.target?.isConnected && !T.contains(t.target) && z(t.target, null), {
1409
+ toggle: () => a.length || l?.end ? $e() : $(),
1410
+ released: () => {
1411
+ !a.length && !l && !w && o === "armed" && $();
1412
+ },
1413
+ close: $,
1414
+ send: $e,
1415
+ get markers() {
1416
+ return a.length;
1417
+ },
1418
+ get state() {
1419
+ return o;
1420
+ }
1421
+ };
1422
+ }
1423
+ var Ie = "\n:host{all:initial}\n*{-webkit-user-select:none;user-select:none}\ninput,textarea{-webkit-user-select:text;user-select:text}\n*{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,\"Segoe UI\",sans-serif}\n[hidden]{display:none!important}\n.ring{position:fixed;left:0;top:0;width:24px;height:24px;margin:-12px 0 0 -12px;border-radius:50%;border:2px solid #94A3B8;background:rgba(148,163,184,.12);pointer-events:none;z-index:4;transition:border-color .15s,background .15s;will-change:transform}\n.ring .dot{position:absolute;left:50%;top:50%;width:4px;height:4px;margin:-2px;border-radius:50%;background:#94A3B8}\n.ring .badge{position:absolute;left:16px;top:-12px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#0E1320;color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;display:none}\n.ring[data-state~=\"marking\"]{border-color:#5B4BF0;background:rgba(91,75,240,.16)}\n.ring[data-state~=\"marking\"] .dot{background:#5B4BF0}\n.ring[data-state~=\"armed\"] .badge,.ring[data-state~=\"marking\"] .badge{display:block}\n.ring[data-state~=\"listening\"]{box-shadow:0 0 0 calc(2px + var(--lv,0) * 10px) rgba(91,75,240,.35)}\n.ring[data-state~=\"flow\"]{width:14px;height:14px;margin:-7px 0 0 -7px;border-color:#F43F5E;background:#F43F5E;opacity:.9}\n.ring[data-state~=\"flow\"] .dot{display:none}\n.ring[data-state~=\"sent\"]{display:none}\n.ring:not(.seen){opacity:0}\n@media (prefers-reduced-motion:reduce){.ring{transition:none}}\n.outline{position:fixed;left:0;top:0;border:1.5px solid #5B4BF0;border-radius:3px;background:rgba(91,75,240,.06);pointer-events:none;opacity:0;z-index:2}\n.outline .chip{position:absolute;left:-1px;bottom:100%;margin-bottom:4px;max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#0E1320;color:#fff;font-size:11px;font-weight:600;padding:3px 7px;border-radius:5px}\n.outline.below .chip{bottom:auto;top:100%;margin:4px 0 0}\n.frame{position:fixed;left:0;top:0;display:none;border:1.5px dashed #5B4BF0;background:rgba(91,75,240,.08);pointer-events:none;z-index:2}\n.marks{position:fixed;left:0;top:0;width:0;height:0;z-index:3}\n.mk{position:fixed;left:0;top:0;border:2px solid var(--c);border-radius:4px;pointer-events:none}\n.mk.region{border-style:dashed}\n.mk .pin{position:absolute;left:-11px;top:-11px;width:22px;height:22px;border-radius:50%;border:2px solid #fff;background:var(--c);color:#fff;font:700 11px/18px ui-sans-serif,system-ui;text-align:center;pointer-events:auto;cursor:pointer;padding:0;box-shadow:0 2px 8px rgba(0,0,0,.35)}\n.rail{position:fixed;top:16px;right:16px;width:320px;max-height:calc(100vh - 32px);overflow:auto;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:12px;padding:12px;box-shadow:0 12px 40px rgba(0,0,0,.45);font-size:13px;z-index:5;cursor:default}\n.rail *{cursor:auto}\n.rail header,.rail header *:not(button){cursor:grab}\n.rail.moving,.rail.moving *{cursor:grabbing!important;user-select:none}\n.rail.left{right:auto;left:16px}\n.rail button{cursor:pointer}\n.rail header{display:flex;align-items:center;gap:8px;margin-bottom:8px}\n.rail header b{font-size:14px}\n.hint{flex:1;color:#94A3B8;font-size:11.5px}\n.x{background:none;border:0;color:#94A3B8;font-size:18px;line-height:1;padding:2px 6px}\n.list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}\n.list li{display:grid;grid-template-columns:22px 1fr 18px;gap:4px 8px;align-items:center;background:#151B2B;border:1px solid #232c40;border-radius:8px;padding:6px 8px}\n.num{width:22px;height:22px;border-radius:50%;border:0;background:var(--c);color:#fff;font-weight:700;font-size:11px;padding:0}\n.what{display:flex;align-items:center;gap:6px;min-width:0}\n.name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}\n.flag{border:1px solid var(--c);color:var(--c);background:transparent;border-radius:999px;font-size:10.5px;font-weight:700;padding:1px 7px}\n.note{grid-column:2/4;grid-row:2;width:100%;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:5px 8px;font-size:12.5px;outline:none;resize:none;min-height:28px;field-sizing:content;max-height:120px;line-height:1.45}\n.vcard{margin-top:10px;background:#151B2B;border:1px solid #3b3a7a;border-radius:10px;padding:12px}\n.vcard b{font-size:13.5px}\n.vcard p{margin:6px 0;color:#C3C8D4;font-size:12.5px;line-height:1.5}\n.vcard .fine{color:#94A3B8;font-size:11.5px}\n.vcard .c{text-align:center;margin-bottom:0}\n.kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace}\n.caps{display:inline-flex;gap:3px;vertical-align:middle;margin:0 2px}\n.vstart{width:100%;height:44px;margin-top:6px;display:flex;align-items:center;justify-content:center;gap:8px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;font-size:13.5px}\n.vstart svg,.mic svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}\n.listening{margin-top:10px;background:rgba(255,255,255,.04);border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:8px}\n.lh{display:flex;align-items:center;gap:8px;font-size:12px;color:#C3C8D4}\n.rd{width:8px;height:8px;border-radius:50%;background:#F87171;box-shadow:0 0 0 4px rgba(248,113,113,.2)}\n.bars{margin-left:auto;display:flex;align-items:flex-end;gap:2px;height:14px}\n.bars i{display:block;width:3px;border-radius:2px;background:#14C8A6;height:calc(3px + var(--lv,0) * 11px)}\n.bars i:nth-child(2){height:calc(5px + var(--lv,0) * 9px)}.bars i:nth-child(3){height:calc(3px + var(--lv,0) * 8px)}.bars i:nth-child(4){height:calc(6px + var(--lv,0) * 8px)}.bars i:nth-child(5){height:calc(2px + var(--lv,0) * 6px)}\n.cap{margin:0;font-size:14px;line-height:1.6;color:#F4F5F8;min-height:1.6em}\n.cap .said{color:var(--c);font-weight:600}\n.listening .fine{margin:0;font-size:11px;color:#8A93A6;line-height:1.5}\n.flowbtn{margin-top:10px;width:100%;background:#151B2B;border:1px solid #2a3346;color:#E6E8EE;border-radius:8px;padding:7px 8px;font-size:12px;font-weight:600}\n.flowbtn.on{border-color:#F43F5E;color:#FDA4AF}\n.bottom{gap:8px}\n.mic{flex:none;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:transparent;border:1px solid rgba(169,160,255,.5);color:#A9A0FF;padding:0}\n.mic.on{background:#F87171;border-color:#F87171;color:#0E1320}\n.typei{height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.12);border-radius:10px;background:transparent;color:#C3C8D4;font-size:13px}\n.send{flex:1;height:44px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;padding:0 16px;font-size:14px}\n.send:disabled{opacity:.45;cursor:default}\n.rail.busy .send:disabled{opacity:1}\n.rail.busy .list,.rail.busy .exp,.rail.busy .flowbtn,.rail.busy .mic,.rail.busy .typei,.rail.busy .listening{opacity:.5;pointer-events:none}\n.send{display:flex;align-items:center;justify-content:center;gap:8px}\n.spin{width:15px;height:15px;border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;animation:sp-spin .7s linear infinite}\n@keyframes sp-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion:reduce){.spin{animation-duration:2s}}\n@media (max-width:560px){.rail{top:auto;left:8px;right:8px;bottom:8px;width:auto;max-height:55vh;border-radius:14px}.howto{width:calc(100vw - 24px);bottom:auto;top:12px}}\n.rail.done{width:auto;max-width:360px;padding:14px 16px}\n.thanks{margin:0;color:#F4F5F8;display:flex;flex-direction:column;gap:8px}\n.th{display:flex;align-items:center;gap:10px}\n.th b{font-size:14px;font-weight:600}\n.okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}\n.okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.teach{margin:0;font-size:13px;line-height:1.7;color:#C3C8D4}\n.tell{border-top:1px solid rgba(255,255,255,.1);padding-top:12px;display:flex;flex-direction:column;gap:10px}\n.tick{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.5;color:#C3C8D4;cursor:pointer}\n.tick input{width:16px;height:16px;margin:2px 0 0;flex:none;accent-color:#14C8A6;cursor:pointer}\n.tick b{display:block;color:#F4F5F8;font-weight:600}\n.tick small{font-size:13px}\n.mail{display:flex;flex-direction:column;gap:6px;padding-left:26px;margin:0}\n.mail label{font-size:12px;color:#C3C8D4}\n.mail div{display:flex;gap:8px}\n.mail input{flex:1;min-width:0;height:34px;border-radius:8px;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.06);color:#F4F5F8;padding:0 10px;font:inherit;font-size:13px}\n.mail input:disabled{opacity:.6}\n.mail button{height:34px;padding:0 14px;border:0;border-radius:8px;background:#F4F5F8;color:#0E1320;font:inherit;font-size:13px;font-weight:600;cursor:pointer}\n.mailmsg{margin:0;font-size:12px;color:#8A93A6}\n.mailmsg:empty{display:none}\n.keep{display:flex;gap:6px;align-items:center;margin-top:10px;font-size:12px;color:#C3C8D4}\n.note:focus,.exp input:focus{border-color:#5B4BF0}\n.rm{grid-column:3;grid-row:1;background:none;border:0;color:#64748B;font-size:15px;padding:0}\n.empty{color:#94A3B8;margin:6px 0 8px;font-size:12.5px}\n.row{display:flex;align-items:center;gap:8px;margin-top:10px}\n.exp{margin-top:10px;color:#94A3B8;font-size:12px}\n.exp summary{cursor:pointer}\n.exp input{display:block;width:100%;margin-top:6px;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:6px 8px;font-size:12.5px;outline:none}\n.status{margin:8px 0 0;font-size:12px;color:#94A3B8;min-height:1em}\n.status:empty{display:none}\n.status.bad{color:#FCA5A5}\n.howto{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);width:360px;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:14px;padding:14px;box-shadow:0 16px 50px rgba(0,0,0,.5);z-index:6;font-size:13px}\n.howto ol{margin:10px 0 8px;padding-left:20px;line-height:1.7}\n.howto .ok{background:#5B4BF0;border:0;color:#fff;border-radius:8px;padding:6px 12px;font-weight:700;cursor:pointer}\n.scene{position:relative;height:96px;border-radius:9px;background:#151B2B;overflow:hidden}\n.scene .page{position:absolute;inset:12px 14px}\n.scene .page i{display:block;height:8px;border-radius:4px;background:#232c40;margin-bottom:8px;width:70%}\n.scene .page i+i{width:45%}\n.scene .btn{position:absolute;right:10px;bottom:6px;background:#2E86F0;color:#fff;font-size:11px;padding:5px 14px;border-radius:6px}\n.scene .cur{position:absolute;left:30px;top:20px;width:18px;height:18px;margin:-9px;border-radius:50%;border:2px solid #94A3B8;animation:sp-move 8s infinite}\n.scene .pinh{position:absolute;right:62px;bottom:20px;width:18px;height:18px;border-radius:50%;background:#F43F5E;color:#fff;font:700 10px/18px ui-sans-serif,system-ui;text-align:center;opacity:0;animation:sp-pin 8s infinite}\n.scene .wave{position:absolute;left:20px;bottom:16px;width:40px;height:10px;border-radius:5px;background:linear-gradient(90deg,#5B4BF0,#2E86F0);opacity:0;animation:sp-wave 8s infinite}\n@keyframes sp-move{0%,8%{transform:translate(0,0);border-color:#94A3B8}30%,100%{transform:translate(250px,52px);border-color:#5B4BF0}}\n@keyframes sp-pin{0%,34%{opacity:0;transform:scale(.4)}40%,100%{opacity:1;transform:scale(1)}}\n@keyframes sp-wave{0%,48%{opacity:0;transform:scaleX(.3)}55%,60%{opacity:1;transform:scaleX(1)}65%,70%{opacity:1;transform:scaleX(.5)}75%,85%{opacity:1;transform:scaleX(1)}92%,100%{opacity:0}}\n@media (prefers-reduced-motion:reduce){.scene .cur,.scene .pinh,.scene .wave{animation:none}.scene .pinh,.scene .wave{opacity:1}.scene .cur{transform:translate(250px,52px)}}\n";
1424
+ //#endregion
1425
+ export { be as FLAGS, J as mountEntry, Q as openPoint, ye as showFixed };