@qaiddev/thumbs-embed 1.11.0 → 1.12.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/a11y-dialog.d.ts +77 -0
- package/dist/a11y.d.ts +6 -65
- package/dist/chunks/annotate-DGyRcgPt.js +2 -0
- package/dist/chunks/{annotate-5zJWs-aB.js.map → annotate-DGyRcgPt.js.map} +1 -1
- package/dist/chunks/core-BsR7oV99.js +26 -0
- package/dist/chunks/core-BsR7oV99.js.map +1 -0
- package/dist/chunks/dom-scpOS8nl.js +2 -0
- package/dist/chunks/{dom-DvdtcUS8.js.map → dom-scpOS8nl.js.map} +1 -1
- package/dist/chunks/modal-DYxcs1Gm.js +2 -0
- package/dist/chunks/modal-DYxcs1Gm.js.map +1 -0
- package/dist/chunks/recording-BUw5-5Rf.js +2 -0
- package/dist/chunks/{recording-CPzxRL7f.js.map → recording-BUw5-5Rf.js.map} +1 -1
- package/dist/chunks/screenshot-CNe1irEz.js +2 -0
- package/dist/chunks/{screenshot-DYOKg2bS.js.map → screenshot-CNe1irEz.js.map} +1 -1
- package/dist/chunks/screenshot-dom-ZYP2w2h0.js +2 -0
- package/dist/chunks/{screenshot-dom-CME7tYRE.js.map → screenshot-dom-ZYP2w2h0.js.map} +1 -1
- package/dist/chunks/send-C26DRoYc.js +2 -0
- package/dist/chunks/send-C26DRoYc.js.map +1 -0
- package/dist/chunks/targeting-CMUEe-7C.js +6 -0
- package/dist/chunks/{targeting-mahtuPpo.js.map → targeting-CMUEe-7C.js.map} +1 -1
- package/dist/chunks/video-BSP4s2te.js +2 -0
- package/dist/chunks/{video-Bd_29-rK.js.map → video-BSP4s2te.js.map} +1 -1
- package/dist/embed.d.ts +26 -31
- package/dist/index.js +1495 -1390
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +6 -4
- package/dist/loader.js +1 -6
- package/dist/loader.js.map +1 -1
- package/dist/modal-positioning.d.ts +0 -27
- package/dist/qaid.umd.cjs +14 -14
- package/dist/qaid.umd.cjs.map +1 -1
- package/dist/quest-config.d.ts +2 -0
- package/dist/quest-launcher.d.ts +1 -3
- package/dist/send.d.ts +60 -0
- package/dist/tooltip-positioning.d.ts +31 -0
- package/package.json +1 -1
- package/dist/chunks/annotate-5zJWs-aB.js +0 -357
- package/dist/chunks/core-CL1dwdaN.js +0 -1342
- package/dist/chunks/core-CL1dwdaN.js.map +0 -1
- package/dist/chunks/dom-DvdtcUS8.js +0 -17
- package/dist/chunks/modal-DccueVYZ.js +0 -222
- package/dist/chunks/modal-DccueVYZ.js.map +0 -1
- package/dist/chunks/recording-CPzxRL7f.js +0 -323
- package/dist/chunks/screenshot-DYOKg2bS.js +0 -33
- package/dist/chunks/screenshot-dom-CME7tYRE.js +0 -63
- package/dist/chunks/targeting-mahtuPpo.js +0 -298
- package/dist/chunks/video-Bd_29-rK.js +0 -214
package/dist/index.js
CHANGED
|
@@ -1,328 +1,168 @@
|
|
|
1
|
-
const
|
|
1
|
+
const K = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
2
2
|
<path stroke-linecap="round" stroke-linejoin="round" d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5"/>
|
|
3
|
-
</svg>`,
|
|
3
|
+
</svg>`, W = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
4
4
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10 14H5.236a2 2 0 01-1.789-2.894l3.5-7A2 2 0 018.737 3h4.018a2 2 0 01.485.06l3.76.94m-7 10v5a2 2 0 002 2h.095c.5 0 .905-.405.905-.905 0-.714.211-1.412.608-2.006L17 13V4m-7 10h2m5-10h2a2 2 0 012 2v6a2 2 0 01-2 2h-2.5"/>
|
|
5
|
-
</svg>`,
|
|
5
|
+
</svg>`, Se = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
6
6
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"/>
|
|
7
|
-
</svg>`,
|
|
7
|
+
</svg>`, Tt = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
8
8
|
<path stroke-linecap="round" stroke-linejoin="round" d="M8 10h8M8 14h5m-9 6l3.5-3.5H18a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v14z"/>
|
|
9
|
-
</svg>`,
|
|
9
|
+
</svg>`, Ee = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
10
10
|
<rect x="4" y="6" width="16" height="12" rx="1" stroke-linejoin="round"/>
|
|
11
|
-
</svg>`,
|
|
11
|
+
</svg>`, Te = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
12
12
|
<path stroke-linecap="round" stroke-linejoin="round" d="M5 19L19 5m0 0h-8m8 0v8"/>
|
|
13
|
-
</svg>`,
|
|
13
|
+
</svg>`, Ae = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
14
14
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 20h9M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
15
|
-
</svg>`,
|
|
15
|
+
</svg>`, Le = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
16
16
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3s6 6.4 6 10a6 6 0 01-12 0c0-3.6 6-10 6-10z"/>
|
|
17
|
-
</svg>`,
|
|
17
|
+
</svg>`, De = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
18
18
|
<path stroke-linecap="round" stroke-linejoin="round" d="M9 14L4 9l5-5M4 9h11a5 5 0 010 10h-4"/>
|
|
19
|
-
</svg>`,
|
|
19
|
+
</svg>`, At = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
20
20
|
<path stroke-linecap="round" stroke-linejoin="round" d="M20 6L9 17l-5-5"/>
|
|
21
|
-
</svg>`,
|
|
21
|
+
</svg>`, Ie = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
22
22
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v8m0 4h.01"/>
|
|
23
|
-
</svg>`,
|
|
23
|
+
</svg>`, Me = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
24
24
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6L6 18"/>
|
|
25
|
-
</svg>`,
|
|
26
|
-
let
|
|
27
|
-
const
|
|
25
|
+
</svg>`, Pe = "button{cursor:pointer}.qaid-buttons{display:flex;gap:.5rem}.qaid-buttons.qaid-vertical{flex-direction:column}.qaid-buttons.qaid-auto-container{position:fixed;z-index:50}.qaid-buttons.qaid-auto-container.qaid-bottom-right{bottom:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-bottom-left{bottom:1rem;left:1rem}.qaid-buttons.qaid-auto-container.qaid-top-right{top:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-top-left{top:1rem;left:1rem}.qaid-buttons.qaid-incognito{opacity:0;transition:opacity .2s ease-in-out}.qaid-buttons.qaid-incognito:hover{opacity:1}.qaid-buttons.qaid-dismissed{display:none!important}.qaid-dismiss-btn{width:20px;height:20px;padding:0;border:none;border-radius:50%;background:#0006;color:#fff;display:flex;align-items:center;justify-content:center;align-self:center;opacity:0;transition:opacity .15s,background .15s;cursor:pointer;pointer-events:auto;-webkit-appearance:none;appearance:none}.qaid-dismiss-btn:hover{background:#0009}.qaid-buttons:hover .qaid-dismiss-btn{opacity:1}button.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;-webkit-appearance:none;appearance:none}.qaid-icon{width:24px;height:24px}:where(button.qaid-btn-structural)>svg:where(:not(.qaid-icon):not([width])){width:var(--qaid-icon-size, 24px);height:var(--qaid-icon-size, 24px)}.qaid-btn-structural:not(:has(svg)),.qaid-btn:not(:has(svg)){font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-emoji-icon{font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-buttons,.qaid-buttons *,.qaid-modal-container,.qaid-modal-container *{cursor:pointer!important}.qaid-tooltip-wrapper{position:relative}.qaid-tooltip-text{position:fixed;padding:.5rem .75rem;background:#1f2937;color:#fff;font-size:var(--qaid-font-size, 16px);font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}button.qaid-btn-record:hover{background:#dc2626;color:#fff}button:focus-visible,textarea:focus-visible,a:focus-visible,[tabindex]:focus-visible,[role=button]:focus-visible{outline:2px solid var(--qaid-marker, #6365f1);outline-offset:2px}.qaid-buttons.qaid-incognito:focus-within{opacity:1}.qaid-buttons:focus-within .qaid-dismiss-btn,.qaid-dismiss-btn:focus-visible{opacity:1}.qaid-dismiss-btn{min-width:24px;min-height:24px}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}@media(forced-colors:active){button:focus-visible,textarea:focus-visible,a:focus-visible,[tabindex]:focus-visible,[role=button]:focus-visible{outline:2px solid CanvasText;outline-offset:2px}}", Re = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";
|
|
26
|
+
let I = 0;
|
|
27
|
+
const Be = "button.qaid-btn{width:var(--qaid-btn-size);height:var(--qaid-btn-size);border-radius:50%;border:none;background:#f3f4f6;color:#374151;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);transition:background-color .2s,color .2s,transform .2s;-webkit-appearance:none;appearance:none;--qaid-hover-up-bg:var(--qaid-positive);--qaid-hover-up-color:#fff;--qaid-hover-down-bg:var(--qaid-negative);--qaid-hover-down-color:#fff}button.qaid-btn:hover{transform:scale(1.05)}button.qaid-btn-up:hover{background:var(--qaid-hover-up-bg);color:var(--qaid-hover-up-color)}button.qaid-btn-down:hover{background:var(--qaid-hover-down-bg);color:var(--qaid-hover-down-color)}button.qaid-btn-feedback:hover{background:var(--qaid-marker,#6365f1);color:var(--qaid-marker-text,#fff)}button.qaid-btn svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}", He = {
|
|
28
28
|
small: 36,
|
|
29
29
|
medium: 48,
|
|
30
30
|
large: 64
|
|
31
|
-
},
|
|
31
|
+
}, Oe = {
|
|
32
32
|
small: 18,
|
|
33
33
|
medium: 24,
|
|
34
34
|
large: 32
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
const [
|
|
38
|
-
return 0.2126 *
|
|
36
|
+
function ze(o, t, e) {
|
|
37
|
+
const [i, n, a] = [o, t, e].map((s) => (s = s / 255, s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4)));
|
|
38
|
+
return 0.2126 * i + 0.7152 * n + 0.0722 * a;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
42
|
-
const e =
|
|
40
|
+
function $e(o) {
|
|
41
|
+
if (o.startsWith("#")) {
|
|
42
|
+
const e = o.slice(1), i = e.length === 3 ? e.split("").map((a) => a + a).join("") : e, n = parseInt(i, 16);
|
|
43
43
|
return {
|
|
44
44
|
r: n >> 16 & 255,
|
|
45
45
|
g: n >> 8 & 255,
|
|
46
46
|
b: n & 255
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const t =
|
|
49
|
+
const t = o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
50
50
|
return t ? {
|
|
51
51
|
r: parseInt(t[1]),
|
|
52
52
|
g: parseInt(t[2]),
|
|
53
53
|
b: parseInt(t[3])
|
|
54
54
|
} : null;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const t =
|
|
58
|
-
return t &&
|
|
56
|
+
function _e(o) {
|
|
57
|
+
const t = $e(o);
|
|
58
|
+
return t && ze(t.r, t.g, t.b) > 0.4 ? "black" : "white";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Fe(o = {}) {
|
|
61
61
|
const {
|
|
62
62
|
positiveColor: t = "rgb(0, 200, 83)",
|
|
63
63
|
negativeColor: e = "rgb(255, 0, 0)",
|
|
64
|
-
markerColor:
|
|
64
|
+
markerColor: i = "#6365f1",
|
|
65
65
|
buttonSize: n = "medium",
|
|
66
|
-
modalWidth:
|
|
67
|
-
backdropOpacity:
|
|
68
|
-
fontFamily:
|
|
69
|
-
fontSize:
|
|
70
|
-
} =
|
|
66
|
+
modalWidth: a = 400,
|
|
67
|
+
backdropOpacity: s = 0.3,
|
|
68
|
+
fontFamily: d = "system-ui, -apple-system, sans-serif",
|
|
69
|
+
fontSize: c = 16
|
|
70
|
+
} = o, l = He[n], r = Oe[n], h = _e(i);
|
|
71
71
|
return {
|
|
72
72
|
"--qaid-positive": t,
|
|
73
73
|
"--qaid-negative": e,
|
|
74
|
-
"--qaid-marker":
|
|
74
|
+
"--qaid-marker": i,
|
|
75
75
|
"--qaid-marker-text": h,
|
|
76
|
-
"--qaid-btn-size": `${
|
|
76
|
+
"--qaid-btn-size": `${l}px`,
|
|
77
77
|
"--qaid-icon-size": `${r}px`,
|
|
78
|
-
"--qaid-modal-width": `${
|
|
79
|
-
"--qaid-backdrop-opacity": String(
|
|
80
|
-
"--qaid-font-family":
|
|
81
|
-
"--qaid-font-size": `${
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function Le(i, t) {
|
|
85
|
-
for (const [e, o] of Object.entries(t))
|
|
86
|
-
i.style.setProperty(e, o);
|
|
87
|
-
}
|
|
88
|
-
function dt() {
|
|
89
|
-
return we + xe;
|
|
90
|
-
}
|
|
91
|
-
function Ie() {
|
|
92
|
-
if (D++, D > 1) return;
|
|
93
|
-
const i = document.createElement("style");
|
|
94
|
-
i.id = "qaid-styles", i.textContent = ke, document.head.appendChild(i);
|
|
95
|
-
}
|
|
96
|
-
function De() {
|
|
97
|
-
D <= 0 || (D--, D === 0 && document.getElementById("qaid-styles")?.remove());
|
|
98
|
-
}
|
|
99
|
-
const ct = "data-qaid-a11y-live", Me = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;", Re = [
|
|
100
|
-
"a[href]",
|
|
101
|
-
"button",
|
|
102
|
-
"input",
|
|
103
|
-
"textarea",
|
|
104
|
-
"select",
|
|
105
|
-
"[tabindex]"
|
|
106
|
-
].join(",");
|
|
107
|
-
function Pe(i) {
|
|
108
|
-
return i.ownerDocument || document;
|
|
109
|
-
}
|
|
110
|
-
function Be(i, t) {
|
|
111
|
-
const e = t ? "assertive" : "polite", o = i.querySelector(
|
|
112
|
-
`[${ct}="${e}"]`
|
|
113
|
-
);
|
|
114
|
-
if (o) return o;
|
|
115
|
-
const s = Pe(i).createElement("div");
|
|
116
|
-
return s.setAttribute(ct, e), s.setAttribute("role", t ? "alert" : "status"), s.setAttribute("aria-live", t ? "assertive" : "polite"), s.setAttribute("aria-atomic", "true"), s.style.cssText = Me, i.appendChild(s), s;
|
|
117
|
-
}
|
|
118
|
-
function He(i, t, e = {}) {
|
|
119
|
-
const o = Be(i, !!e.assertive);
|
|
120
|
-
o.textContent = "", o.textContent = t;
|
|
121
|
-
}
|
|
122
|
-
function Oe(i) {
|
|
123
|
-
return i.hasAttribute("disabled") ? !0 : i.disabled === !0;
|
|
124
|
-
}
|
|
125
|
-
function ze(i) {
|
|
126
|
-
let t = i;
|
|
127
|
-
for (; t; ) {
|
|
128
|
-
if (t.hasAttribute("hidden")) return !0;
|
|
129
|
-
const e = t.style;
|
|
130
|
-
if (e && (e.display === "none" || e.visibility === "hidden" || e.visibility === "collapse"))
|
|
131
|
-
return !0;
|
|
132
|
-
t = t.parentElement;
|
|
133
|
-
}
|
|
134
|
-
return !1;
|
|
135
|
-
}
|
|
136
|
-
function lt(i) {
|
|
137
|
-
return Array.from(
|
|
138
|
-
i.querySelectorAll(Re)
|
|
139
|
-
).filter((e) => !(e.getAttribute("tabindex") === "-1" || e instanceof HTMLInputElement && e.type === "hidden" || e instanceof HTMLAnchorElement && !e.getAttribute("href") || Oe(e) || ze(e)));
|
|
140
|
-
}
|
|
141
|
-
function It(i) {
|
|
142
|
-
let t = i.activeElement;
|
|
143
|
-
for (; t && t.shadowRoot && t.shadowRoot.activeElement; )
|
|
144
|
-
t = t.shadowRoot.activeElement;
|
|
145
|
-
return t instanceof HTMLElement ? t : null;
|
|
146
|
-
}
|
|
147
|
-
function $e(i) {
|
|
148
|
-
const t = i.ownerDocument || document;
|
|
149
|
-
let e = !1;
|
|
150
|
-
const o = (s) => {
|
|
151
|
-
if (s.key !== "Tab") return;
|
|
152
|
-
const a = lt(i);
|
|
153
|
-
if (a.length === 0) {
|
|
154
|
-
s.preventDefault(), i.focus();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const c = a[0], l = a[a.length - 1], d = It(t), r = d ? a.indexOf(d) !== -1 : !1;
|
|
158
|
-
s.shiftKey ? (!r || d === c) && (s.preventDefault(), l.focus()) : (!r || d === l) && (s.preventDefault(), c.focus());
|
|
159
|
-
};
|
|
160
|
-
i.addEventListener("keydown", o);
|
|
161
|
-
const n = lt(i);
|
|
162
|
-
return n.length > 0 ? n[0].focus() : (i.hasAttribute("tabindex") || (i.setAttribute("tabindex", "-1"), e = !0), i.focus()), {
|
|
163
|
-
release() {
|
|
164
|
-
i.removeEventListener("keydown", o), e && (i.removeAttribute("tabindex"), e = !1);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function _e() {
|
|
169
|
-
return It(document);
|
|
170
|
-
}
|
|
171
|
-
function Fe(i) {
|
|
172
|
-
if (!(!i || typeof i.focus != "function"))
|
|
173
|
-
try {
|
|
174
|
-
i.focus();
|
|
175
|
-
} catch {
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function Ne(i, t = {}) {
|
|
179
|
-
i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "true"), t.labelledbyId && i.setAttribute("aria-labelledby", t.labelledbyId), t.describedbyId && i.setAttribute("aria-describedby", t.describedbyId), t.label && i.setAttribute("aria-label", t.label);
|
|
180
|
-
}
|
|
181
|
-
function Ve(i, t) {
|
|
182
|
-
let e = i;
|
|
183
|
-
for (; e && e !== t; ) {
|
|
184
|
-
const o = e.parentNode;
|
|
185
|
-
if (o === t) return e;
|
|
186
|
-
if (o && o.host) {
|
|
187
|
-
e = o.host;
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
if (!o) return null;
|
|
191
|
-
e = o;
|
|
192
|
-
}
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
function Ue(i) {
|
|
196
|
-
const e = (i.ownerDocument || document).body;
|
|
197
|
-
if (!e) return () => {
|
|
198
|
-
};
|
|
199
|
-
const o = Ve(i, e), n = [];
|
|
200
|
-
return Array.from(e.children).forEach((s) => {
|
|
201
|
-
if (!(s instanceof HTMLElement) || o && s === o) return;
|
|
202
|
-
const a = s.inert === !0, c = s.getAttribute("aria-hidden");
|
|
203
|
-
a && c === "true" || (s.inert = !0, s.setAttribute("aria-hidden", "true"), n.push({ el: s, prevInert: a, prevAriaHidden: c }));
|
|
204
|
-
}), function() {
|
|
205
|
-
for (; n.length; ) {
|
|
206
|
-
const a = n.pop();
|
|
207
|
-
a.el.inert = a.prevInert, a.prevAriaHidden === null ? a.el.removeAttribute("aria-hidden") : a.el.setAttribute("aria-hidden", a.prevAriaHidden);
|
|
208
|
-
}
|
|
78
|
+
"--qaid-modal-width": `${a}px`,
|
|
79
|
+
"--qaid-backdrop-opacity": String(s),
|
|
80
|
+
"--qaid-font-family": d,
|
|
81
|
+
"--qaid-font-size": `${c}px`
|
|
209
82
|
};
|
|
210
83
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
arrowHeight: 12,
|
|
215
|
-
gap: 8,
|
|
216
|
-
viewportPadding: 16
|
|
217
|
-
};
|
|
218
|
-
function je(i, t, e, o, n) {
|
|
219
|
-
const s = i.y, a = t - (i.y + i.height);
|
|
220
|
-
if (a >= e + o)
|
|
221
|
-
return {
|
|
222
|
-
top: i.y + i.height + o,
|
|
223
|
-
position: "below"
|
|
224
|
-
};
|
|
225
|
-
if (s >= e + o)
|
|
226
|
-
return {
|
|
227
|
-
top: i.y - e - o,
|
|
228
|
-
position: "above"
|
|
229
|
-
};
|
|
230
|
-
const c = a > s ? "below" : "above";
|
|
231
|
-
let l;
|
|
232
|
-
return c === "below" ? l = Math.min(
|
|
233
|
-
i.y + i.height + o,
|
|
234
|
-
t - e - n
|
|
235
|
-
) : l = Math.max(n, i.y - e - o), { top: l, position: c };
|
|
84
|
+
function Ve(o, t) {
|
|
85
|
+
for (const [e, i] of Object.entries(t))
|
|
86
|
+
o.style.setProperty(e, i);
|
|
236
87
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
239
|
-
return s = Math.max(o, Math.min(s, t - e - o)), s;
|
|
88
|
+
function lt() {
|
|
89
|
+
return Pe + Be;
|
|
240
90
|
}
|
|
241
|
-
function
|
|
242
|
-
|
|
243
|
-
|
|
91
|
+
function Ne() {
|
|
92
|
+
if (I++, I > 1) return;
|
|
93
|
+
const o = document.createElement("style");
|
|
94
|
+
o.id = "qaid-styles", o.textContent = Re, document.head.appendChild(o);
|
|
244
95
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
i,
|
|
248
|
-
e,
|
|
249
|
-
n,
|
|
250
|
-
o.gap,
|
|
251
|
-
o.viewportPadding
|
|
252
|
-
), a = Ke(
|
|
253
|
-
i,
|
|
254
|
-
t,
|
|
255
|
-
o.width,
|
|
256
|
-
o.viewportPadding
|
|
257
|
-
);
|
|
258
|
-
return {
|
|
259
|
-
top: s.top,
|
|
260
|
-
left: a,
|
|
261
|
-
position: s.position
|
|
262
|
-
};
|
|
96
|
+
function Ue() {
|
|
97
|
+
I <= 0 || (I--, I === 0 && document.getElementById("qaid-styles")?.remove());
|
|
263
98
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
s + t.height > e.height - n && (s = i.top - t.height - n);
|
|
268
|
-
let a = i.left;
|
|
269
|
-
return a < n ? a = n : a + t.width > e.width - n && (a = e.width - t.width - n), s < n ? s = n : s + t.height > e.height - n && (s = e.height - t.height - n), { top: s, left: a };
|
|
99
|
+
const ht = "data-qaid-a11y-live", je = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;";
|
|
100
|
+
function Ke(o) {
|
|
101
|
+
return o.ownerDocument || document;
|
|
270
102
|
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
n.left,
|
|
275
|
-
o.width
|
|
103
|
+
function We(o, t) {
|
|
104
|
+
const e = t ? "assertive" : "polite", i = o.querySelector(
|
|
105
|
+
`[${ht}="${e}"]`
|
|
276
106
|
);
|
|
277
|
-
return
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
107
|
+
if (i) return i;
|
|
108
|
+
const a = Ke(o).createElement("div");
|
|
109
|
+
return a.setAttribute(ht, e), a.setAttribute("role", t ? "alert" : "status"), a.setAttribute("aria-live", t ? "assertive" : "polite"), a.setAttribute("aria-atomic", "true"), a.style.cssText = je, o.appendChild(a), a;
|
|
110
|
+
}
|
|
111
|
+
function Qe(o, t, e = {}) {
|
|
112
|
+
const i = We(o, !!e.assertive);
|
|
113
|
+
i.textContent = "", i.textContent = t;
|
|
114
|
+
}
|
|
115
|
+
function Xe(o, t, e, i = {}) {
|
|
116
|
+
const n = i.gap ?? 8;
|
|
117
|
+
let a = o.bottom + n;
|
|
118
|
+
a + t.height > e.height - n && (a = o.top - t.height - n);
|
|
119
|
+
let s = o.left;
|
|
120
|
+
return s < n ? s = n : s + t.width > e.width - n && (s = e.width - t.width - n), a < n ? a = n : a + t.height > e.height - n && (a = e.height - t.height - n), { top: a, left: s };
|
|
121
|
+
}
|
|
122
|
+
const Ye = 20;
|
|
123
|
+
function Je(o) {
|
|
124
|
+
const t = [], e = console.error, i = console.warn, n = console.log, a = (s, d) => {
|
|
125
|
+
const c = {
|
|
126
|
+
message: d.map((l) => String(l)).join(" "),
|
|
287
127
|
timestamp: Date.now(),
|
|
288
|
-
level:
|
|
128
|
+
level: s
|
|
289
129
|
};
|
|
290
|
-
t.length >=
|
|
130
|
+
t.length >= Ye && t.shift(), t.push(c), o && o(c);
|
|
291
131
|
};
|
|
292
|
-
return console.error = function(...
|
|
293
|
-
|
|
294
|
-
}, console.warn = function(...
|
|
295
|
-
|
|
296
|
-
}, console.log = function(...
|
|
297
|
-
|
|
132
|
+
return console.error = function(...s) {
|
|
133
|
+
a("error", s), e.apply(console, s);
|
|
134
|
+
}, console.warn = function(...s) {
|
|
135
|
+
a("warn", s), i.apply(console, s);
|
|
136
|
+
}, console.log = function(...s) {
|
|
137
|
+
a("log", s), n.apply(console, s);
|
|
298
138
|
}, {
|
|
299
139
|
errors: t,
|
|
300
140
|
restore: () => {
|
|
301
|
-
console.error = e, console.warn =
|
|
141
|
+
console.error = e, console.warn = i, console.log = n;
|
|
302
142
|
}
|
|
303
143
|
};
|
|
304
144
|
}
|
|
305
|
-
function q(
|
|
306
|
-
const
|
|
145
|
+
function q(o, t, e) {
|
|
146
|
+
const i = document.createElement(o);
|
|
307
147
|
if (t)
|
|
308
|
-
for (const [n,
|
|
309
|
-
n === "className" ?
|
|
310
|
-
return
|
|
148
|
+
for (const [n, a] of Object.entries(t))
|
|
149
|
+
n === "className" ? i.className = a : i.setAttribute(n, a);
|
|
150
|
+
return i;
|
|
311
151
|
}
|
|
312
|
-
function
|
|
313
|
-
return typeof window < "u" && window.innerWidth <
|
|
152
|
+
function Ge(o = 640) {
|
|
153
|
+
return typeof window < "u" && window.innerWidth < o;
|
|
314
154
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
e.forEach((
|
|
318
|
-
const n = document.elementFromPoint(
|
|
319
|
-
return e.forEach((
|
|
155
|
+
function ut(o, t, e) {
|
|
156
|
+
const i = e.map((a) => a.style.visibility);
|
|
157
|
+
e.forEach((a) => a.style.visibility = "hidden");
|
|
158
|
+
const n = document.elementFromPoint(o, t);
|
|
159
|
+
return e.forEach((a, s) => a.style.visibility = i[s]), n;
|
|
320
160
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
161
|
+
function P(o) {
|
|
162
|
+
return o ? o.hasAttribute("data-qaid-embed") || o.hasAttribute("data-qaid-embed-overlay") ? !0 : !!o.closest("[data-qaid-embed], [data-qaid-embed-overlay]") : !1;
|
|
323
163
|
}
|
|
324
|
-
function
|
|
325
|
-
const e =
|
|
164
|
+
function pt(o, t = 0) {
|
|
165
|
+
const e = o.getBoundingClientRect();
|
|
326
166
|
return {
|
|
327
167
|
x: e.left - t,
|
|
328
168
|
y: e.top - t,
|
|
@@ -330,58 +170,7 @@ function ut(i, t = 0) {
|
|
|
330
170
|
height: e.height + t * 2
|
|
331
171
|
};
|
|
332
172
|
}
|
|
333
|
-
const
|
|
334
|
-
// The URL is a runtime value, not a static specifier — keep Vite from
|
|
335
|
-
// trying to analyze/bundle it.
|
|
336
|
-
import(
|
|
337
|
-
/* @vite-ignore */
|
|
338
|
-
i
|
|
339
|
-
)
|
|
340
|
-
);
|
|
341
|
-
let ii = ei, L = null, F = null;
|
|
342
|
-
const K = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map();
|
|
343
|
-
function Mt(i, t) {
|
|
344
|
-
return `${i.replace(/\/+$/, "")}/${encodeURIComponent(t)}/definition`;
|
|
345
|
-
}
|
|
346
|
-
function oi(i) {
|
|
347
|
-
if (K.has(i)) return Promise.resolve();
|
|
348
|
-
const t = N.get(i);
|
|
349
|
-
if (t) return t;
|
|
350
|
-
const e = fetch(i, { headers: { Accept: "application/json" } }).then((o) => o.ok ? o.json() : null).then((o) => {
|
|
351
|
-
o && K.set(i, o);
|
|
352
|
-
}).catch(() => {
|
|
353
|
-
}).finally(() => {
|
|
354
|
-
N.delete(i);
|
|
355
|
-
});
|
|
356
|
-
return N.set(i, e), e;
|
|
357
|
-
}
|
|
358
|
-
function Rt(i) {
|
|
359
|
-
return L && F === i || (F = i, L = Promise.resolve(ii(i)).then((t) => {
|
|
360
|
-
const e = t;
|
|
361
|
-
if (!e || typeof e.QaidQuests != "function")
|
|
362
|
-
throw new Error("quests module has no QaidQuests export");
|
|
363
|
-
return e;
|
|
364
|
-
}).catch((t) => {
|
|
365
|
-
throw L = null, F = null, t;
|
|
366
|
-
})), L;
|
|
367
|
-
}
|
|
368
|
-
async function ni(i) {
|
|
369
|
-
const t = await Rt(i.moduleUrl), e = i.base.replace(/\/+$/, ""), o = Mt(e, i.questId), n = (c) => c != null ? { feedbackId: c } : void 0;
|
|
370
|
-
let s;
|
|
371
|
-
const a = i.feedbackId;
|
|
372
|
-
return a instanceof Promise ? s = t.QaidQuests.supports?.asyncMetadata ? a.then(n, () => {
|
|
373
|
-
}) : n(await a.catch(() => null)) : s = n(a ?? null), new t.QaidQuests({
|
|
374
|
-
endpoint: `${e}/responses`,
|
|
375
|
-
configUrl: o,
|
|
376
|
-
// Only a definition already in hand. One still loading is left to the
|
|
377
|
-
// widget, which shows its own loading state instead of nothing.
|
|
378
|
-
questionnaire: K.get(o),
|
|
379
|
-
apiKey: i.apiKey || void 0,
|
|
380
|
-
metadata: s,
|
|
381
|
-
onClose: i.onClose
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
const pt = "qaid_visitor_id", ft = "qaid_hide_feedback", si = [
|
|
173
|
+
const Lt = "https://unpkg.com/@qaiddev/quests-embed@1/dist/qaid-quests.js", ft = "qaid_visitor_id", mt = "qaid_hide_feedback", Ze = [
|
|
385
174
|
"#ef4444",
|
|
386
175
|
"#f59e0b",
|
|
387
176
|
"#22c55e",
|
|
@@ -389,52 +178,52 @@ const pt = "qaid_visitor_id", ft = "qaid_hide_feedback", si = [
|
|
|
389
178
|
"#111827",
|
|
390
179
|
"#ffffff"
|
|
391
180
|
];
|
|
392
|
-
function
|
|
181
|
+
function to() {
|
|
393
182
|
return typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches;
|
|
394
183
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
184
|
+
function Q(o) {
|
|
185
|
+
return o ? `${mt}_${o}` : mt;
|
|
397
186
|
}
|
|
398
|
-
function
|
|
187
|
+
function eo(o) {
|
|
399
188
|
try {
|
|
400
|
-
return localStorage.getItem(
|
|
189
|
+
return localStorage.getItem(Q(o)) === "1";
|
|
401
190
|
} catch {
|
|
402
191
|
return !1;
|
|
403
192
|
}
|
|
404
193
|
}
|
|
405
|
-
function
|
|
194
|
+
function bt(o, t = !0) {
|
|
406
195
|
try {
|
|
407
|
-
t ? localStorage.setItem(
|
|
196
|
+
t ? localStorage.setItem(Q(o), "1") : localStorage.removeItem(Q(o));
|
|
408
197
|
} catch {
|
|
409
198
|
}
|
|
410
199
|
}
|
|
411
|
-
function
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
200
|
+
function gt() {
|
|
201
|
+
const o = typeof crypto < "u" ? crypto : void 0;
|
|
202
|
+
if (o && typeof o.randomUUID == "function") return o.randomUUID();
|
|
414
203
|
const t = new Uint8Array(16);
|
|
415
|
-
if (
|
|
416
|
-
|
|
204
|
+
if (o && typeof o.getRandomValues == "function")
|
|
205
|
+
o.getRandomValues(t);
|
|
417
206
|
else
|
|
418
|
-
for (let
|
|
207
|
+
for (let i = 0; i < t.length; i++) t[i] = Math.floor(Math.random() * 256);
|
|
419
208
|
t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
420
|
-
const e = Array.from(t, (
|
|
209
|
+
const e = Array.from(t, (i) => i.toString(16).padStart(2, "0")).join("");
|
|
421
210
|
return `${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}`;
|
|
422
211
|
}
|
|
423
|
-
function
|
|
212
|
+
function oo() {
|
|
424
213
|
try {
|
|
425
|
-
let
|
|
426
|
-
return
|
|
214
|
+
let o = localStorage.getItem(ft);
|
|
215
|
+
return o || (o = gt(), localStorage.setItem(ft, o)), o;
|
|
427
216
|
} catch {
|
|
428
|
-
return
|
|
217
|
+
return gt();
|
|
429
218
|
}
|
|
430
219
|
}
|
|
431
|
-
function
|
|
220
|
+
function vt(o, t) {
|
|
432
221
|
const e = document.createElement("style");
|
|
433
222
|
e.setAttribute("data-qaid-feature", ""), e.textContent = t;
|
|
434
|
-
const
|
|
435
|
-
|
|
223
|
+
const i = o.querySelectorAll("style[data-qaid-base], style[data-qaid-feature]"), n = i[i.length - 1];
|
|
224
|
+
o.insertBefore(e, n ? n.nextSibling : o.firstChild);
|
|
436
225
|
}
|
|
437
|
-
class
|
|
226
|
+
class io {
|
|
438
227
|
config;
|
|
439
228
|
state = "IDLE";
|
|
440
229
|
feedbackData = {
|
|
@@ -470,8 +259,10 @@ class ci {
|
|
|
470
259
|
recording = null;
|
|
471
260
|
// Element targeting — also a lazily-loaded chunk (targeting.ts).
|
|
472
261
|
targeting = null;
|
|
473
|
-
targetingPrewarmed = !1;
|
|
474
262
|
// Preload-on-intent: warm the lazily-split feature chunks before first use.
|
|
263
|
+
// The click path (send, message box, targeting) warms when the pointer or
|
|
264
|
+
// focus reaches the buttons, or on idle, whichever comes first.
|
|
265
|
+
clickPathPrewarmed = !1;
|
|
475
266
|
prewarmHandle = null;
|
|
476
267
|
prewarmIsTimeout = !1;
|
|
477
268
|
videoPrewarmed = !1;
|
|
@@ -487,7 +278,6 @@ class ci {
|
|
|
487
278
|
isUserProvidedContainer = !1;
|
|
488
279
|
// The message modal lives in a lazily-loaded chunk (modal.ts).
|
|
489
280
|
modal = null;
|
|
490
|
-
modalPrewarmed = !1;
|
|
491
281
|
dismissBtn = null;
|
|
492
282
|
// Per-instance CSS variables
|
|
493
283
|
cssVars = {};
|
|
@@ -495,10 +285,10 @@ class ci {
|
|
|
495
285
|
// Tracks whether the pending activation came from the keyboard (Enter/Space)
|
|
496
286
|
// rather than a pointer, so targeting can avoid elementFromPoint(0,0).
|
|
497
287
|
keyboardActivation = !1;
|
|
498
|
-
// Accessibility: dialog focus management
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
288
|
+
// Accessibility: dialog focus management. The helpers load with the click
|
|
289
|
+
// path; `dialogClose` undoes the open dialog (trap, inert, focus).
|
|
290
|
+
dialogModule = null;
|
|
291
|
+
dialogClose = null;
|
|
502
292
|
// Unique id suffix for aria-labelledby/describedby references
|
|
503
293
|
uid = Math.random().toString(36).slice(2, 9);
|
|
504
294
|
// Bound event handlers
|
|
@@ -558,7 +348,7 @@ class ci {
|
|
|
558
348
|
captureScreenshot: t.captureScreenshot ?? !1,
|
|
559
349
|
annotate: t.annotate ?? !0,
|
|
560
350
|
annotationColor: t.annotationColor ?? t.colors?.marker ?? "#6365f1",
|
|
561
|
-
annotationPalette: t.annotationPalette ??
|
|
351
|
+
annotationPalette: t.annotationPalette ?? Ze,
|
|
562
352
|
screenshotMethod: t.screenshotMethod ?? "permission",
|
|
563
353
|
screenshotOptions: {
|
|
564
354
|
quality: t.screenshotOptions?.quality ?? 0.8,
|
|
@@ -585,12 +375,12 @@ class ci {
|
|
|
585
375
|
video: t.quests?.video ?? "",
|
|
586
376
|
// Quest service reuses the feedback API key unless overridden.
|
|
587
377
|
apiKey: t.quests?.apiKey ?? t.apiKey ?? "",
|
|
588
|
-
moduleUrl: t.quests?.moduleUrl ??
|
|
378
|
+
moduleUrl: t.quests?.moduleUrl ?? Lt
|
|
589
379
|
}
|
|
590
|
-
}, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId =
|
|
380
|
+
}, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = oo(), this.init();
|
|
591
381
|
}
|
|
592
382
|
applyVars(t) {
|
|
593
|
-
|
|
383
|
+
Ve(t, this.cssVars);
|
|
594
384
|
}
|
|
595
385
|
/**
|
|
596
386
|
* Announce a message via the shared visually-hidden live regions.
|
|
@@ -599,25 +389,31 @@ class ci {
|
|
|
599
389
|
* while a dialog aria-hides the main button host.
|
|
600
390
|
*/
|
|
601
391
|
announceMsg(t, e = !1) {
|
|
602
|
-
const
|
|
603
|
-
|
|
392
|
+
const i = this.overlayShadowRoot ?? this.shadowRoot;
|
|
393
|
+
i && Qe(i, t, { assertive: e });
|
|
394
|
+
}
|
|
395
|
+
/** Load the dialog a11y helpers; every surface that opens a dialog awaits this first. */
|
|
396
|
+
async loadDialogA11y() {
|
|
397
|
+
this.dialogModule ??= await Promise.resolve().then(() => qt);
|
|
604
398
|
}
|
|
605
399
|
/**
|
|
606
400
|
* Turn a transient surface into an accessible modal dialog: save the
|
|
607
401
|
* invoking control, apply dialog semantics, trap focus, and inert the
|
|
608
|
-
* background. Paired with closeDialogA11y() on every close path.
|
|
402
|
+
* background. Paired with closeDialogA11y() on every close path. Callers
|
|
403
|
+
* reach it only after loadDialogA11y() has resolved.
|
|
609
404
|
*/
|
|
610
405
|
openDialogA11y(t, e) {
|
|
611
|
-
this.
|
|
406
|
+
this.dialogClose = this.dialogModule.openDialog(t, e);
|
|
612
407
|
}
|
|
613
408
|
closeDialogA11y() {
|
|
614
|
-
|
|
409
|
+
const t = this.dialogClose;
|
|
410
|
+
this.dialogClose = null, t?.();
|
|
615
411
|
}
|
|
616
412
|
clearActiveThumb() {
|
|
617
413
|
this.activeThumbBtn && (this.activeThumbBtn.setAttribute("aria-pressed", "false"), this.activeThumbBtn = null);
|
|
618
414
|
}
|
|
619
415
|
init() {
|
|
620
|
-
|
|
416
|
+
Ne(), this.cssVars = Fe({
|
|
621
417
|
positiveColor: this.config.colors.positive,
|
|
622
418
|
negativeColor: this.config.colors.negative,
|
|
623
419
|
markerColor: this.config.colors.marker,
|
|
@@ -626,12 +422,28 @@ class ci {
|
|
|
626
422
|
backdropOpacity: this.config.backdropOpacity,
|
|
627
423
|
fontFamily: this.config.fontFamily,
|
|
628
424
|
fontSize: this.config.fontSize
|
|
629
|
-
}), !this.config.hideDismiss &&
|
|
425
|
+
}), !this.config.hideDismiss && eo(this.config.apiKey) && (this._startDismissed = !0), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture = Je((t) => {
|
|
630
426
|
this.feedbackData.consoleErrors = this.consoleCapture?.errors ?? [];
|
|
631
|
-
}), this.feedbackData.consoleErrors = this.consoleCapture.errors, this.observeDom(),
|
|
632
|
-
this.config.captureVideo && this.videoSupported() && this.prewarmVideo(), this.config.captureScreenshot && this.prewarmScreenshot(), this.prewarmQuests();
|
|
427
|
+
}), this.feedbackData.consoleErrors = this.consoleCapture.errors, this.observeDom(), this.schedulePrewarm(() => {
|
|
428
|
+
this.prewarmClickPath(), this.config.captureVideo && this.videoSupported() && this.prewarmVideo(), this.config.captureScreenshot && this.prewarmScreenshot(), this.prewarmQuests();
|
|
633
429
|
});
|
|
634
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Warm everything a thumb click needs: the send flow, the dialog helpers,
|
|
433
|
+
* the message box, and targeting (unless it is skipped). Runs once, on the
|
|
434
|
+
* first of: pointer or focus entering the buttons, or the idle callback.
|
|
435
|
+
*/
|
|
436
|
+
prewarmClickPath() {
|
|
437
|
+
this.clickPathPrewarmed || (this.clickPathPrewarmed = !0, Promise.resolve().then(() => U).catch(() => {
|
|
438
|
+
}), Promise.resolve().then(() => qt).catch(() => {
|
|
439
|
+
}), Promise.resolve().then(() => Ct).catch(() => {
|
|
440
|
+
}), this.skipsTargeting() || Promise.resolve().then(() => St).catch(() => {
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
/** "annotate" mode and skipTargeting both go straight to the send flow. */
|
|
444
|
+
skipsTargeting() {
|
|
445
|
+
return this.config.skipTargeting || this.config.feedbackMode === "annotate";
|
|
446
|
+
}
|
|
635
447
|
/**
|
|
636
448
|
* Best-effort preload of a lazily-split feature chunk so its first use is
|
|
637
449
|
* instant. Warming fetches + compiles (and defines) the module; the feature
|
|
@@ -639,13 +451,13 @@ class ci {
|
|
|
639
451
|
* swallowed — a failed preload just falls back to an on-demand load.
|
|
640
452
|
*/
|
|
641
453
|
prewarmVideo() {
|
|
642
|
-
this.videoPrewarmed || (this.videoPrewarmed = !0, Promise.resolve().then(() =>
|
|
643
|
-
}), Promise.resolve().then(() =>
|
|
454
|
+
this.videoPrewarmed || (this.videoPrewarmed = !0, Promise.resolve().then(() => Et).catch(() => {
|
|
455
|
+
}), Promise.resolve().then(() => Ht).catch(() => {
|
|
644
456
|
}));
|
|
645
457
|
}
|
|
646
458
|
prewarmScreenshot() {
|
|
647
|
-
this.screenshotPrewarmed || (this.screenshotPrewarmed = !0, (this.shouldCaptureViaDom() ? Promise.resolve().then(() =>
|
|
648
|
-
}), this.config.annotate && Promise.resolve().then(() =>
|
|
459
|
+
this.screenshotPrewarmed || (this.screenshotPrewarmed = !0, (this.shouldCaptureViaDom() ? Promise.resolve().then(() => Ot) : Promise.resolve().then(() => ne)).catch(() => {
|
|
460
|
+
}), this.config.annotate && Promise.resolve().then(() => Ft).catch(() => {
|
|
649
461
|
}));
|
|
650
462
|
}
|
|
651
463
|
/** Quest ids linked to any button, when quest launching is on. */
|
|
@@ -661,19 +473,22 @@ class ci {
|
|
|
661
473
|
prewarmQuests() {
|
|
662
474
|
if (this.questsPrewarmed) return;
|
|
663
475
|
const t = this.linkedQuestIds();
|
|
664
|
-
if (t.length
|
|
665
|
-
|
|
476
|
+
if (t.length === 0) return;
|
|
477
|
+
this.questsPrewarmed = !0;
|
|
478
|
+
const { base: e, moduleUrl: i } = this.config.quests;
|
|
479
|
+
Promise.resolve().then(() => Yo).then((n) => {
|
|
480
|
+
n.loadQuestsModule(i).catch(() => {
|
|
666
481
|
});
|
|
667
|
-
for (const
|
|
668
|
-
|
|
669
|
-
}
|
|
482
|
+
for (const a of t) n.prefetchQuestDefinition(n.questDefinitionUrl(e, a));
|
|
483
|
+
}).catch(() => {
|
|
484
|
+
});
|
|
670
485
|
}
|
|
671
486
|
/** Run fn when the main thread is idle; cancelled by destroy(). */
|
|
672
487
|
schedulePrewarm(t) {
|
|
673
|
-
const e = window,
|
|
488
|
+
const e = window, i = () => {
|
|
674
489
|
this.destroyed || t();
|
|
675
490
|
};
|
|
676
|
-
typeof e.requestIdleCallback == "function" ? (this.prewarmIsTimeout = !1, this.prewarmHandle = e.requestIdleCallback(
|
|
491
|
+
typeof e.requestIdleCallback == "function" ? (this.prewarmIsTimeout = !1, this.prewarmHandle = e.requestIdleCallback(i, { timeout: 2e3 })) : (this.prewarmIsTimeout = !0, this.prewarmHandle = window.setTimeout(i, 1200));
|
|
677
492
|
}
|
|
678
493
|
/**
|
|
679
494
|
* Watch for the shadow hosts being removed from the DOM by framework
|
|
@@ -694,7 +509,7 @@ class ci {
|
|
|
694
509
|
}), this.domObserver.observe(document.body, { childList: !0 });
|
|
695
510
|
}
|
|
696
511
|
checkMobile() {
|
|
697
|
-
this.isMobile =
|
|
512
|
+
this.isMobile = Ge();
|
|
698
513
|
}
|
|
699
514
|
handleResize() {
|
|
700
515
|
this.checkMobile();
|
|
@@ -704,63 +519,63 @@ class ci {
|
|
|
704
519
|
let t = null;
|
|
705
520
|
this.config.container && (t = document.querySelector(this.config.container)), t ? (t.appendChild(this.shadowHost), this.isUserProvidedContainer = !0, this.config.hideDismiss = !0) : (this.shadowHost.style.position = "fixed", this.shadowHost.style.display = "block", this.shadowHost.style.inset = "0", this.shadowHost.style.pointerEvents = "none", this.shadowHost.style.zIndex = String(this.config.zIndex), document.body.appendChild(this.shadowHost)), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
|
|
706
521
|
const e = document.createElement("style");
|
|
707
|
-
if (e.setAttribute("data-qaid-base", ""), e.textContent =
|
|
708
|
-
const
|
|
709
|
-
|
|
522
|
+
if (e.setAttribute("data-qaid-base", ""), e.textContent = lt(), this.shadowRoot.appendChild(e), this.config.css) {
|
|
523
|
+
const r = document.createElement("style");
|
|
524
|
+
r.textContent = this.config.css, this.shadowRoot.appendChild(r);
|
|
710
525
|
}
|
|
711
|
-
const
|
|
526
|
+
const i = this.config.direction === "vertical" ? "qaid-vertical" : "";
|
|
712
527
|
if (this.isUserProvidedContainer)
|
|
713
|
-
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${
|
|
528
|
+
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${i}`.trim(), this.config.incognito && this.buttonsContainer.classList.add("qaid-incognito");
|
|
714
529
|
else {
|
|
715
|
-
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${
|
|
716
|
-
const { x:
|
|
717
|
-
this.config.position.includes("right") ? this.buttonsContainer.style.right = `${
|
|
530
|
+
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${i}${this.config.incognito ? " qaid-incognito" : ""}`.trim(), this.buttonsContainer.style.pointerEvents = "auto";
|
|
531
|
+
const { x: r, y: h } = this.config.offset;
|
|
532
|
+
this.config.position.includes("right") ? this.buttonsContainer.style.right = `${r}px` : this.buttonsContainer.style.left = `${r}px`, this.config.position.includes("bottom") ? this.buttonsContainer.style.bottom = `${h}px` : this.buttonsContainer.style.top = `${h}px`;
|
|
718
533
|
}
|
|
719
|
-
this.applyVars(this.buttonsContainer), this.shadowRoot.appendChild(this.buttonsContainer), this.buttonsContainer.addEventListener("keydown", (
|
|
720
|
-
(
|
|
534
|
+
this.applyVars(this.buttonsContainer), this.shadowRoot.appendChild(this.buttonsContainer), this.buttonsContainer.addEventListener("keydown", (r) => {
|
|
535
|
+
(r.key === "Enter" || r.key === " " || r.key === "Spacebar") && (this.keyboardActivation = !0);
|
|
721
536
|
}), this.buttonsContainer.addEventListener("mousedown", () => {
|
|
722
537
|
this.keyboardActivation = !1;
|
|
723
538
|
}), this.buttonsContainer.addEventListener("pointerdown", () => {
|
|
724
539
|
this.keyboardActivation = !1;
|
|
725
540
|
});
|
|
726
|
-
const n =
|
|
541
|
+
const n = () => this.prewarmClickPath();
|
|
542
|
+
this.buttonsContainer.addEventListener("pointerenter", n), this.buttonsContainer.addEventListener("focusin", n);
|
|
543
|
+
const a = !!this.config.buttonClass, s = a ? `qaid-btn-structural ${this.config.buttonClass}` : "qaid-btn", c = this.config.text.tooltip || "Feedback for us?", l = document.createElement("div");
|
|
727
544
|
if (l.className = "qaid-tooltip-text", l.textContent = c, this.applyVars(l), this.shadowRoot.appendChild(l), this.tooltipElement = l, this.config.singleButton) {
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
this.prewarmTargeting(), this.showTooltip(r);
|
|
733
|
-
}), r.addEventListener("mouseleave", () => this.hideTooltip()), d.appendChild(r), this.buttonsContainer.appendChild(d);
|
|
545
|
+
const r = document.createElement("div");
|
|
546
|
+
r.className = "qaid-tooltip-wrapper";
|
|
547
|
+
const h = document.createElement("button");
|
|
548
|
+
h.type = "button", h.className = a ? `${s} qaid-btn-feedback` : "qaid-btn qaid-btn-feedback", h.setAttribute("aria-label", this.config.text.feedbackLabel), h.innerHTML = this.config.feedbackIcon || Tt, h.addEventListener("click", (f) => this.handleThumbClick("neutral", f.currentTarget, f)), h.addEventListener("mouseenter", () => this.showTooltip(h)), h.addEventListener("mouseleave", () => this.hideTooltip()), r.appendChild(h), this.buttonsContainer.appendChild(r);
|
|
734
549
|
} else if (!this.config.hideThumbs) {
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
this.
|
|
740
|
-
}),
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
this.
|
|
746
|
-
}),
|
|
550
|
+
const r = document.createElement("div");
|
|
551
|
+
r.className = "qaid-tooltip-wrapper";
|
|
552
|
+
const h = document.createElement("button");
|
|
553
|
+
h.type = "button", h.className = a ? `${s} qaid-btn-up` : "qaid-btn qaid-btn-up", h.setAttribute("aria-label", this.config.text.positiveLabel), h.innerHTML = this.config.positiveIcon || K, h.addEventListener("click", (g) => this.handleThumbClick("up", g.currentTarget, g)), h.addEventListener("mouseenter", () => {
|
|
554
|
+
this.prewarmQuests(), this.showTooltip(h);
|
|
555
|
+
}), h.addEventListener("mouseleave", () => this.hideTooltip()), r.appendChild(h);
|
|
556
|
+
const f = document.createElement("div");
|
|
557
|
+
f.className = "qaid-tooltip-wrapper";
|
|
558
|
+
const m = document.createElement("button");
|
|
559
|
+
m.type = "button", m.className = a ? `${s} qaid-btn-down` : "qaid-btn qaid-btn-down", m.setAttribute("aria-label", this.config.text.negativeLabel), m.innerHTML = this.config.negativeIcon || W, m.addEventListener("click", (g) => this.handleThumbClick("down", g.currentTarget, g)), m.addEventListener("mouseenter", () => {
|
|
560
|
+
this.prewarmQuests(), this.showTooltip(m);
|
|
561
|
+
}), m.addEventListener("mouseleave", () => this.hideTooltip()), f.appendChild(m), this.buttonsContainer.appendChild(r), this.buttonsContainer.appendChild(f);
|
|
747
562
|
}
|
|
748
563
|
if (this.config.captureVideo && this.videoSupported()) {
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
const
|
|
752
|
-
|
|
564
|
+
const r = document.createElement("div");
|
|
565
|
+
r.className = "qaid-tooltip-wrapper";
|
|
566
|
+
const h = document.createElement("button");
|
|
567
|
+
h.type = "button", h.className = a ? `${s} qaid-btn-record` : "qaid-btn qaid-btn-record", h.setAttribute("aria-label", this.config.text.recordLabel), h.innerHTML = this.config.recordIcon || Se, h.addEventListener("click", () => {
|
|
753
568
|
this.ensureRecording().then(
|
|
754
|
-
(
|
|
569
|
+
(m) => this.config.videoOptions.redaction ? m.startPicking() : m.startRecording()
|
|
755
570
|
);
|
|
756
571
|
});
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}),
|
|
572
|
+
const f = () => this.prewarmVideo();
|
|
573
|
+
h.addEventListener("mouseenter", () => {
|
|
574
|
+
f(), this.showTooltip(h);
|
|
575
|
+
}), h.addEventListener("focus", f), h.addEventListener("touchstart", f, { passive: !0 }), h.addEventListener("mouseleave", () => this.hideTooltip()), r.appendChild(h), this.buttonsContainer.appendChild(r);
|
|
761
576
|
}
|
|
762
|
-
this.config.hideDismiss || (this.dismissBtn = document.createElement("button"), this.dismissBtn.type = "button", this.dismissBtn.className = "qaid-dismiss-btn", this.dismissBtn.setAttribute("aria-label", this.config.text.dismissLabel), this.dismissBtn.title = this.config.text.dismissLabel, this.dismissBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>', this.dismissBtn.addEventListener("click", (
|
|
763
|
-
|
|
577
|
+
this.config.hideDismiss || (this.dismissBtn = document.createElement("button"), this.dismissBtn.type = "button", this.dismissBtn.className = "qaid-dismiss-btn", this.dismissBtn.setAttribute("aria-label", this.config.text.dismissLabel), this.dismissBtn.title = this.config.text.dismissLabel, this.dismissBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>', this.dismissBtn.addEventListener("click", (r) => {
|
|
578
|
+
r.stopPropagation(), this.handleDismiss();
|
|
764
579
|
}), this.buttonsContainer.insertBefore(this.dismissBtn, this.buttonsContainer.firstChild), this._startDismissed && this.buttonsContainer.classList.add("qaid-dismissed"));
|
|
765
580
|
}
|
|
766
581
|
/**
|
|
@@ -773,8 +588,8 @@ class ci {
|
|
|
773
588
|
if (this.overlayShadowRoot) return this.overlayShadowRoot;
|
|
774
589
|
this.overlayShadowHost = document.createElement("div"), this.overlayShadowHost.setAttribute("data-qaid-embed-overlay", ""), this.overlayShadowHost.style.position = "fixed", this.overlayShadowHost.style.inset = "0", this.overlayShadowHost.style.pointerEvents = "none", this.overlayShadowHost.style.zIndex = String(this.config.zIndex), document.body.appendChild(this.overlayShadowHost), this.overlayShadowRoot = this.overlayShadowHost.attachShadow({ mode: "open" });
|
|
775
590
|
const t = document.createElement("style");
|
|
776
|
-
t.setAttribute("data-qaid-base", ""), t.textContent =
|
|
777
|
-
for (const e of this.featureStyles)
|
|
591
|
+
t.setAttribute("data-qaid-base", ""), t.textContent = lt(), this.overlayShadowRoot.appendChild(t);
|
|
592
|
+
for (const e of this.featureStyles) vt(this.overlayShadowRoot, e);
|
|
778
593
|
if (this.config.css) {
|
|
779
594
|
const e = document.createElement("style");
|
|
780
595
|
e.textContent = this.config.css, this.overlayShadowRoot.appendChild(e);
|
|
@@ -793,47 +608,47 @@ class ci {
|
|
|
793
608
|
if (!this.featureStyles.includes(t)) {
|
|
794
609
|
this.featureStyles.push(t);
|
|
795
610
|
for (const e of [this.shadowRoot, this.overlayShadowRoot])
|
|
796
|
-
e &&
|
|
611
|
+
e && vt(e, t);
|
|
797
612
|
}
|
|
798
613
|
}
|
|
799
614
|
tooltipElement = null;
|
|
800
615
|
showTooltip(t) {
|
|
801
616
|
const e = this.tooltipElement;
|
|
802
617
|
e.style.visibility = "hidden", e.classList.add("qaid-tooltip-visible");
|
|
803
|
-
const
|
|
804
|
-
|
|
618
|
+
const i = t.getBoundingClientRect(), n = e.getBoundingClientRect(), { top: a, left: s } = Xe(
|
|
619
|
+
i,
|
|
805
620
|
n,
|
|
806
621
|
{ width: window.innerWidth, height: window.innerHeight }
|
|
807
622
|
);
|
|
808
|
-
e.style.top = `${
|
|
623
|
+
e.style.top = `${a}px`, e.style.left = `${s}px`, e.style.visibility = "visible";
|
|
809
624
|
}
|
|
810
625
|
hideTooltip() {
|
|
811
626
|
this.tooltipElement.classList.remove("qaid-tooltip-visible");
|
|
812
627
|
}
|
|
813
628
|
handleDismiss() {
|
|
814
|
-
this.buttonsContainer.classList.add("qaid-dismissed"),
|
|
629
|
+
this.buttonsContainer.classList.add("qaid-dismissed"), bt(this.config.apiKey, !0);
|
|
815
630
|
}
|
|
816
|
-
handleThumbClick(t, e,
|
|
817
|
-
if (this.buttonsContainer?.classList.contains("qaid-incognito") && (this.buttonsContainer.classList.remove("qaid-incognito"),
|
|
631
|
+
handleThumbClick(t, e, i) {
|
|
632
|
+
if (this.buttonsContainer?.classList.contains("qaid-incognito") && (this.buttonsContainer.classList.remove("qaid-incognito"), bt(this.config.apiKey, !1)), this.prewarmClickPath(), this.skipsTargeting())
|
|
818
633
|
this.submitDirectFeedback(t, e);
|
|
819
634
|
else {
|
|
820
635
|
this.activeThumbBtn = e, e.setAttribute("aria-pressed", "true");
|
|
821
636
|
const n = this.keyboardActivation;
|
|
822
|
-
this.keyboardActivation = !1, this.ensureTargeting().then((
|
|
823
|
-
this.destroyed || (n ?
|
|
637
|
+
this.keyboardActivation = !1, this.ensureTargeting().then((a) => {
|
|
638
|
+
this.destroyed || (n ? a.startKeyboard(t) : a.startPointer(t, i));
|
|
824
639
|
});
|
|
825
640
|
}
|
|
826
641
|
}
|
|
827
642
|
submitDirectFeedback(t, e) {
|
|
828
643
|
this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null;
|
|
829
|
-
const
|
|
644
|
+
const i = e.getBoundingClientRect();
|
|
830
645
|
this.selectedBounds = {
|
|
831
|
-
x:
|
|
832
|
-
y:
|
|
833
|
-
width:
|
|
834
|
-
height:
|
|
835
|
-
clickX:
|
|
836
|
-
clickY:
|
|
646
|
+
x: i.left,
|
|
647
|
+
y: i.top,
|
|
648
|
+
width: i.width,
|
|
649
|
+
height: i.height,
|
|
650
|
+
clickX: i.left + i.width / 2,
|
|
651
|
+
clickY: i.top + i.height / 2,
|
|
837
652
|
visible: !1
|
|
838
653
|
}, this.submitFeedback();
|
|
839
654
|
}
|
|
@@ -847,142 +662,78 @@ class ci {
|
|
|
847
662
|
* instead of the permission-based Screen Capture API. Explicit "dom" wins;
|
|
848
663
|
* otherwise DOM is used on touch devices to avoid the getDisplayMedia prompt. */
|
|
849
664
|
shouldCaptureViaDom() {
|
|
850
|
-
return this.config.screenshotMethod === "dom" ||
|
|
665
|
+
return this.config.screenshotMethod === "dom" || to();
|
|
851
666
|
}
|
|
852
667
|
/**
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* enabled while the editor is open and restored on close.
|
|
668
|
+
* Run the send flow (send.ts, loaded on demand and pre-warmed before the
|
|
669
|
+
* click): screenshot, markup, POST, then a linked quest or the message box.
|
|
670
|
+
* If its chunk will not load, say so and reset rather than leave the
|
|
671
|
+
* visitor stuck mid-flow.
|
|
858
672
|
*/
|
|
859
|
-
async openAnnotationEditor(t) {
|
|
860
|
-
const e = this.ensureOverlayHost(), o = this.overlayShadowHost, n = o.style.pointerEvents;
|
|
861
|
-
o.style.pointerEvents = "auto";
|
|
862
|
-
try {
|
|
863
|
-
const { openAnnotationEditor: s, styles: a } = await Promise.resolve().then(() => qt);
|
|
864
|
-
return this.addFeatureStyles(a), await s({
|
|
865
|
-
dataUrl: t,
|
|
866
|
-
root: e,
|
|
867
|
-
quality: this.config.screenshotOptions.quality,
|
|
868
|
-
color: this.config.annotationColor,
|
|
869
|
-
palette: this.config.annotationPalette,
|
|
870
|
-
applyVars: (c) => this.applyVars(c),
|
|
871
|
-
announce: (c, l) => this.announceMsg(c, l),
|
|
872
|
-
openDialog: (c, l) => this.openDialogA11y(c, l),
|
|
873
|
-
closeDialog: () => this.closeDialogA11y()
|
|
874
|
-
});
|
|
875
|
-
} catch (s) {
|
|
876
|
-
return console.error("Annotation editor failed to open:", s), null;
|
|
877
|
-
} finally {
|
|
878
|
-
o.style.pointerEvents = n;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
673
|
async submitFeedback() {
|
|
882
|
-
let t = null;
|
|
883
|
-
if (this.config.captureScreenshot || this.config.feedbackMode === "annotate")
|
|
884
|
-
try {
|
|
885
|
-
if (this.shouldCaptureViaDom()) {
|
|
886
|
-
const { captureDomScreenshot: a } = await Promise.resolve().then(() => kt);
|
|
887
|
-
t = await a(this.config.screenshotOptions);
|
|
888
|
-
} else {
|
|
889
|
-
const { captureScreenshot: a } = await Promise.resolve().then(() => St);
|
|
890
|
-
t = await a(this.config.screenshotOptions);
|
|
891
|
-
}
|
|
892
|
-
t && this.announceMsg("Screenshot captured");
|
|
893
|
-
} catch (a) {
|
|
894
|
-
console.error("Screenshot capture failed:", a), t = null;
|
|
895
|
-
}
|
|
896
|
-
t && this.config.annotate && (t = await this.openAnnotationEditor(t) ?? t);
|
|
897
|
-
const o = this.feedbackData.elementSelector ? {
|
|
898
|
-
x: this.selectedBounds.x,
|
|
899
|
-
y: this.selectedBounds.y,
|
|
900
|
-
width: this.selectedBounds.width,
|
|
901
|
-
height: this.selectedBounds.height
|
|
902
|
-
} : null, n = {
|
|
903
|
-
feedbackType: this.feedbackData.feedbackType,
|
|
904
|
-
pageUrl: window.location.href,
|
|
905
|
-
apiKey: this.config.apiKey || void 0,
|
|
906
|
-
elementSelector: this.feedbackData.elementSelector,
|
|
907
|
-
elementText: this.feedbackData.elementText,
|
|
908
|
-
consoleErrors: [...this.feedbackData.consoleErrors],
|
|
909
|
-
screenWidth: window.innerWidth,
|
|
910
|
-
screenHeight: window.innerHeight,
|
|
911
|
-
clickX: this.selectedBounds.clickX,
|
|
912
|
-
clickY: this.selectedBounds.clickY,
|
|
913
|
-
scrollX: window.scrollX,
|
|
914
|
-
scrollY: window.scrollY,
|
|
915
|
-
screenshot: t,
|
|
916
|
-
visitorId: this.visitorId,
|
|
917
|
-
// Include element bounds and user agent for server-side screenshot fallback
|
|
918
|
-
elementBounds: o,
|
|
919
|
-
userAgent: navigator.userAgent
|
|
920
|
-
};
|
|
921
|
-
this.feedbackIdPromise = this.postFeedback(n);
|
|
922
|
-
const s = this.feedbackData.feedbackType;
|
|
923
|
-
if (s && s !== "neutral" && await this.tryLaunchQuest(s, this.feedbackIdPromise)) {
|
|
924
|
-
this.resetFeedbackUi();
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
this.state = "MODAL_OPEN";
|
|
928
|
-
try {
|
|
929
|
-
const a = await this.ensureModal();
|
|
930
|
-
if (this.destroyed) return;
|
|
931
|
-
a.open(), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto");
|
|
932
|
-
} catch (a) {
|
|
933
|
-
console.error("Failed to open the feedback modal:", a), this.announceMsg("Thank you for your feedback!", !0), this.resetFeedbackUi();
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
/** POST the feedback. Resolves to the new record's id, or null if it failed. */
|
|
937
|
-
async postFeedback(t) {
|
|
938
674
|
try {
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
});
|
|
944
|
-
if (e.ok) {
|
|
945
|
-
const o = await e.json();
|
|
946
|
-
return this.announceMsg("Feedback sent"), o.id;
|
|
947
|
-
}
|
|
948
|
-
} catch (e) {
|
|
949
|
-
console.error("Failed to submit feedback:", e), this.announceMsg("Failed to send feedback", !0);
|
|
675
|
+
const [t] = await Promise.all([Promise.resolve().then(() => U), this.loadDialogA11y()]);
|
|
676
|
+
await t.submitFeedback(this.makeSendHost());
|
|
677
|
+
} catch (t) {
|
|
678
|
+
console.error("Failed to send feedback:", t), this.announceMsg("Failed to send feedback", !0), this.resetFeedbackUi();
|
|
950
679
|
}
|
|
951
|
-
return null;
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Quest id linked to `type`, or "" when quest launching is disabled
|
|
955
|
-
* (no `base`) or this button has no quest configured.
|
|
956
|
-
*/
|
|
957
|
-
questIdFor(t) {
|
|
958
|
-
const e = this.config.quests;
|
|
959
|
-
return e.base && e[t] || "";
|
|
960
680
|
}
|
|
961
681
|
/**
|
|
962
|
-
* Launch the quest linked to `type
|
|
963
|
-
*
|
|
964
|
-
* configured or the widget failed to load (caller falls back to its
|
|
965
|
-
* normal UI). The created feedback record id is passed through so the
|
|
966
|
-
* quest response can be joined back to it server-side.
|
|
682
|
+
* Launch the quest linked to `type` through the send chunk. Resolves false
|
|
683
|
+
* when none is linked, or when the chunk or the quest will not load.
|
|
967
684
|
*/
|
|
968
685
|
async tryLaunchQuest(t, e) {
|
|
969
|
-
const o = this.questIdFor(t);
|
|
970
|
-
if (!o) return !1;
|
|
971
686
|
try {
|
|
972
|
-
return
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
apiKey: this.config.quests.apiKey || void 0,
|
|
976
|
-
moduleUrl: this.config.quests.moduleUrl,
|
|
977
|
-
feedbackId: e,
|
|
978
|
-
onClose: () => {
|
|
979
|
-
this.activeQuest = null;
|
|
980
|
-
}
|
|
981
|
-
}), !0;
|
|
982
|
-
} catch (n) {
|
|
983
|
-
return console.error("Failed to launch quest:", n), this.activeQuest = null, !1;
|
|
687
|
+
return await (await Promise.resolve().then(() => U)).tryLaunchQuest(this.makeSendHost(), t, e);
|
|
688
|
+
} catch (i) {
|
|
689
|
+
return console.error("Failed to launch quest:", i), !1;
|
|
984
690
|
}
|
|
985
691
|
}
|
|
692
|
+
/** Narrow view of the embed the send flow talks back through. */
|
|
693
|
+
makeSendHost() {
|
|
694
|
+
const t = this;
|
|
695
|
+
return {
|
|
696
|
+
get config() {
|
|
697
|
+
return t.config;
|
|
698
|
+
},
|
|
699
|
+
get visitorId() {
|
|
700
|
+
return t.visitorId;
|
|
701
|
+
},
|
|
702
|
+
get feedbackData() {
|
|
703
|
+
return t.feedbackData;
|
|
704
|
+
},
|
|
705
|
+
get selectedBounds() {
|
|
706
|
+
return t.selectedBounds;
|
|
707
|
+
},
|
|
708
|
+
get destroyed() {
|
|
709
|
+
return t.destroyed;
|
|
710
|
+
},
|
|
711
|
+
get overlayShadowHost() {
|
|
712
|
+
return t.overlayShadowHost;
|
|
713
|
+
},
|
|
714
|
+
get activeQuest() {
|
|
715
|
+
return t.activeQuest;
|
|
716
|
+
},
|
|
717
|
+
set activeQuest(e) {
|
|
718
|
+
t.activeQuest = e;
|
|
719
|
+
},
|
|
720
|
+
setState: (e) => {
|
|
721
|
+
t.state = e;
|
|
722
|
+
},
|
|
723
|
+
setFeedbackId: (e) => {
|
|
724
|
+
t.feedbackIdPromise = e;
|
|
725
|
+
},
|
|
726
|
+
shouldCaptureViaDom: () => t.shouldCaptureViaDom(),
|
|
727
|
+
ensureOverlayHost: () => t.ensureOverlayHost(),
|
|
728
|
+
ensureModal: () => t.ensureModal(),
|
|
729
|
+
addFeatureStyles: (e) => t.addFeatureStyles(e),
|
|
730
|
+
applyVars: (e) => t.applyVars(e),
|
|
731
|
+
announceMsg: (e, i) => t.announceMsg(e, i),
|
|
732
|
+
openDialogA11y: (e, i) => t.openDialogA11y(e, i),
|
|
733
|
+
closeDialogA11y: () => t.closeDialogA11y(),
|
|
734
|
+
resetFeedbackUi: () => t.resetFeedbackUi()
|
|
735
|
+
};
|
|
736
|
+
}
|
|
986
737
|
/**
|
|
987
738
|
* Reset the thumbs targeting/marker UI back to idle without opening or
|
|
988
739
|
* closing the message modal. Shared by closeModal() and the quest-launch
|
|
@@ -993,12 +744,15 @@ class ci {
|
|
|
993
744
|
}
|
|
994
745
|
/**
|
|
995
746
|
* Lazily load and instantiate the modal controller. The message modal lives
|
|
996
|
-
* in a separate chunk, fetched the first time it opens (and pre-warmed
|
|
997
|
-
* the
|
|
747
|
+
* in a separate chunk, fetched the first time it opens (and pre-warmed
|
|
748
|
+
* before the click — see prewarmClickPath).
|
|
998
749
|
*/
|
|
999
750
|
async ensureModal() {
|
|
1000
751
|
if (!this.modal) {
|
|
1001
|
-
const { ModalController: t, styles: e } = await Promise.
|
|
752
|
+
const [{ ModalController: t, styles: e }] = await Promise.all([
|
|
753
|
+
Promise.resolve().then(() => Ct),
|
|
754
|
+
this.loadDialogA11y()
|
|
755
|
+
]);
|
|
1002
756
|
this.addFeatureStyles(e), this.modal = new t(this.makeModalHost());
|
|
1003
757
|
}
|
|
1004
758
|
return this.modal;
|
|
@@ -1031,25 +785,20 @@ class ci {
|
|
|
1031
785
|
whenFeedbackId: () => t.feedbackIdPromise,
|
|
1032
786
|
ensureOverlayHost: () => t.ensureOverlayHost(),
|
|
1033
787
|
applyVars: (e) => t.applyVars(e),
|
|
1034
|
-
announceMsg: (e,
|
|
1035
|
-
openDialogA11y: (e,
|
|
788
|
+
announceMsg: (e, i) => t.announceMsg(e, i),
|
|
789
|
+
openDialogA11y: (e, i) => t.openDialogA11y(e, i),
|
|
1036
790
|
closeDialogA11y: () => t.closeDialogA11y(),
|
|
1037
791
|
resetFeedbackUi: () => t.resetFeedbackUi()
|
|
1038
792
|
};
|
|
1039
793
|
}
|
|
1040
|
-
/** Warm the modal chunk while the user is targeting, so it opens instantly. */
|
|
1041
|
-
prewarmModal() {
|
|
1042
|
-
this.modalPrewarmed || (this.modalPrewarmed = !0, Promise.resolve().then(() => Tt).catch(() => {
|
|
1043
|
-
}));
|
|
1044
|
-
}
|
|
1045
794
|
/**
|
|
1046
795
|
* Lazily load and instantiate the targeting controller. The subsystem (with
|
|
1047
796
|
* element-selector) lives in a separate chunk, fetched the first time the
|
|
1048
|
-
* user targets — pre-warmed
|
|
797
|
+
* user targets — pre-warmed before the click (see prewarmClickPath).
|
|
1049
798
|
*/
|
|
1050
799
|
async ensureTargeting() {
|
|
1051
800
|
if (!this.targeting) {
|
|
1052
|
-
const { TargetingController: t, styles: e } = await Promise.resolve().then(() =>
|
|
801
|
+
const { TargetingController: t, styles: e } = await Promise.resolve().then(() => St);
|
|
1053
802
|
this.addFeatureStyles(e), this.targeting = new t(this.makeTargetingHost());
|
|
1054
803
|
}
|
|
1055
804
|
return this.targeting;
|
|
@@ -1087,16 +836,11 @@ class ci {
|
|
|
1087
836
|
},
|
|
1088
837
|
ensureOverlayHost: () => t.ensureOverlayHost(),
|
|
1089
838
|
applyVars: (e) => t.applyVars(e),
|
|
1090
|
-
announceMsg: (e,
|
|
839
|
+
announceMsg: (e, i) => t.announceMsg(e, i),
|
|
1091
840
|
clearActiveThumb: () => t.clearActiveThumb(),
|
|
1092
841
|
submitFeedback: () => t.submitFeedback()
|
|
1093
842
|
};
|
|
1094
843
|
}
|
|
1095
|
-
/** Warm the targeting chunk on thumb-button hover, before the click. */
|
|
1096
|
-
prewarmTargeting() {
|
|
1097
|
-
this.targetingPrewarmed || this.config.skipTargeting || (this.targetingPrewarmed = !0, Promise.resolve().then(() => Et).catch(() => {
|
|
1098
|
-
}));
|
|
1099
|
-
}
|
|
1100
844
|
// ==================== Video Recording ====================
|
|
1101
845
|
/**
|
|
1102
846
|
* Cheap synchronous capability check so the record button can render without
|
|
@@ -1113,7 +857,10 @@ class ci {
|
|
|
1113
857
|
*/
|
|
1114
858
|
async ensureRecording() {
|
|
1115
859
|
if (!this.recording) {
|
|
1116
|
-
const { RecordingController: t, styles: e } = await Promise.
|
|
860
|
+
const [{ RecordingController: t, styles: e }] = await Promise.all([
|
|
861
|
+
Promise.resolve().then(() => Et),
|
|
862
|
+
this.loadDialogA11y()
|
|
863
|
+
]);
|
|
1117
864
|
this.addFeatureStyles(e), this.recording = new t(this.makeRecordingHost());
|
|
1118
865
|
}
|
|
1119
866
|
return this.recording;
|
|
@@ -1148,17 +895,17 @@ class ci {
|
|
|
1148
895
|
},
|
|
1149
896
|
ensureOverlayHost: () => t.ensureOverlayHost(),
|
|
1150
897
|
applyVars: (e) => t.applyVars(e),
|
|
1151
|
-
announceMsg: (e,
|
|
1152
|
-
openDialogA11y: (e,
|
|
898
|
+
announceMsg: (e, i) => t.announceMsg(e, i),
|
|
899
|
+
openDialogA11y: (e, i) => t.openDialogA11y(e, i),
|
|
1153
900
|
closeDialogA11y: () => t.closeDialogA11y(),
|
|
1154
901
|
setButtonsDisabled: (e) => t.setButtonsDisabled(e),
|
|
1155
|
-
tryLaunchQuest: (e,
|
|
902
|
+
tryLaunchQuest: (e, i) => t.tryLaunchQuest(e, i)
|
|
1156
903
|
};
|
|
1157
904
|
}
|
|
1158
905
|
setButtonsDisabled(t) {
|
|
1159
906
|
if (!this.buttonsContainer) return;
|
|
1160
|
-
this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((
|
|
1161
|
-
t ?
|
|
907
|
+
this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((i) => {
|
|
908
|
+
t ? i.classList.contains("qaid-btn-record") || (i.disabled = !0, i.style.opacity = "0.5") : (i.disabled = !1, i.style.opacity = "");
|
|
1162
909
|
});
|
|
1163
910
|
}
|
|
1164
911
|
/**
|
|
@@ -1169,358 +916,358 @@ class ci {
|
|
|
1169
916
|
const t = window;
|
|
1170
917
|
this.prewarmIsTimeout ? clearTimeout(this.prewarmHandle) : t.cancelIdleCallback?.(this.prewarmHandle), this.prewarmHandle = null;
|
|
1171
918
|
}
|
|
1172
|
-
this.recording?.destroy(), this.recording = null, this.modal?.destroy(), this.modal = null, this.activeQuest?.destroy(), this.activeQuest = null, this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.overlayShadowHost && (this.overlayShadowHost.remove(), this.overlayShadowHost = null, this.overlayShadowRoot = null), this.buttonsContainer = null, this.dismissBtn = null, this.tooltipElement = null,
|
|
919
|
+
this.recording?.destroy(), this.recording = null, this.modal?.destroy(), this.modal = null, this.activeQuest?.destroy(), this.activeQuest = null, this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.overlayShadowHost && (this.overlayShadowHost.remove(), this.overlayShadowHost = null, this.overlayShadowRoot = null), this.buttonsContainer = null, this.dismissBtn = null, this.tooltipElement = null, Ue();
|
|
1173
920
|
}
|
|
1174
921
|
}
|
|
1175
|
-
function
|
|
1176
|
-
return document.querySelector(
|
|
922
|
+
function Dt(o) {
|
|
923
|
+
return document.querySelector(o)?.textContent?.trim() ?? "";
|
|
1177
924
|
}
|
|
1178
|
-
function
|
|
1179
|
-
const
|
|
925
|
+
function no() {
|
|
926
|
+
const o = document.querySelector(
|
|
1180
927
|
'script[type="application/json"][data-feedback-config]'
|
|
1181
928
|
);
|
|
1182
|
-
if (!
|
|
1183
|
-
const t =
|
|
929
|
+
if (!o) return null;
|
|
930
|
+
const t = o.textContent?.trim();
|
|
1184
931
|
if (!t) return null;
|
|
1185
932
|
try {
|
|
1186
933
|
const e = JSON.parse(t);
|
|
1187
|
-
return e.cssSelector && !e.css && (e.css =
|
|
934
|
+
return e.cssSelector && !e.css && (e.css = Dt(e.cssSelector), delete e.cssSelector), e;
|
|
1188
935
|
} catch {
|
|
1189
936
|
return null;
|
|
1190
937
|
}
|
|
1191
938
|
}
|
|
1192
|
-
function
|
|
1193
|
-
console.warn(`[thumbs-embed] Ignoring ${
|
|
939
|
+
function It(o, t, e) {
|
|
940
|
+
console.warn(`[thumbs-embed] Ignoring ${o}="${t}": expected ${e}.`);
|
|
1194
941
|
}
|
|
1195
|
-
function
|
|
942
|
+
function ao(o) {
|
|
1196
943
|
const t = [];
|
|
1197
|
-
let e = 0,
|
|
1198
|
-
for (const n of
|
|
1199
|
-
n === "(" && e++, n === ")" && (e = Math.max(0, e - 1)), n === "," && e === 0 ? (t.push(
|
|
1200
|
-
return t.push(
|
|
944
|
+
let e = 0, i = "";
|
|
945
|
+
for (const n of o)
|
|
946
|
+
n === "(" && e++, n === ")" && (e = Math.max(0, e - 1)), n === "," && e === 0 ? (t.push(i.trim()), i = "") : i += n;
|
|
947
|
+
return t.push(i.trim()), t;
|
|
1201
948
|
}
|
|
1202
|
-
function
|
|
949
|
+
function so(o, t) {
|
|
1203
950
|
if (t === null) return;
|
|
1204
951
|
const e = t.trim();
|
|
1205
|
-
let
|
|
952
|
+
let i = null;
|
|
1206
953
|
if (e.startsWith("[") || e.startsWith("{"))
|
|
1207
954
|
try {
|
|
1208
|
-
|
|
955
|
+
i = JSON.parse(e);
|
|
1209
956
|
} catch {
|
|
1210
|
-
|
|
957
|
+
i = null;
|
|
1211
958
|
}
|
|
1212
959
|
else
|
|
1213
|
-
|
|
1214
|
-
if (Array.isArray(
|
|
1215
|
-
return
|
|
1216
|
-
|
|
960
|
+
i = ao(e);
|
|
961
|
+
if (Array.isArray(i) && i.length > 0 && i.every((n) => typeof n == "string" && n.trim() !== ""))
|
|
962
|
+
return i.map((n) => n.trim());
|
|
963
|
+
It(o, t, "a JSON array of colours or a comma-separated list");
|
|
1217
964
|
}
|
|
1218
|
-
function M(
|
|
965
|
+
function M(o, t) {
|
|
1219
966
|
if (t !== null) {
|
|
1220
967
|
if (t.trim() === "") {
|
|
1221
|
-
|
|
968
|
+
It(o, t, "a non-empty label");
|
|
1222
969
|
return;
|
|
1223
970
|
}
|
|
1224
971
|
return t;
|
|
1225
972
|
}
|
|
1226
973
|
}
|
|
1227
|
-
function
|
|
1228
|
-
const t =
|
|
974
|
+
function ro(o) {
|
|
975
|
+
const t = o.getAttribute("data-endpoint");
|
|
1229
976
|
if (!t) return null;
|
|
1230
|
-
const e =
|
|
977
|
+
const e = o.getAttribute("data-position"), i = o.getAttribute("data-zindex"), n = o.getAttribute("data-positive-color"), a = o.getAttribute("data-negative-color"), s = o.getAttribute("data-marker-color"), d = o.getAttribute("data-container"), c = o.getAttribute("data-button-class"), l = o.getAttribute("data-skip-targeting"), r = o.getAttribute("data-hide-confirmation"), h = o.getAttribute("data-single-button"), f = o.getAttribute("data-feedback-mode"), m = o.getAttribute("data-incognito"), g = o.getAttribute("data-button-size"), v = o.getAttribute("data-offset-x"), w = o.getAttribute("data-offset-y"), x = o.getAttribute("data-modal-width"), u = o.getAttribute("data-backdrop-opacity"), k = o.getAttribute("data-font-family"), y = o.getAttribute("data-font-size"), C = o.getAttribute("data-tooltip"), L = o.getAttribute("data-modal-title"), S = o.getAttribute("data-confirmation-title"), b = o.getAttribute("data-confirmation-message"), E = o.getAttribute("data-confirmation-close"), Y = o.getAttribute("data-error-title"), J = o.getAttribute("data-error-message"), G = o.getAttribute("data-modal-subtitle"), Z = o.getAttribute("data-placeholder"), tt = o.getAttribute("data-submit-button"), et = o.getAttribute("data-skip-button"), ae = o.getAttribute("data-positive-icon"), se = o.getAttribute("data-negative-icon"), re = o.getAttribute("data-feedback-icon"), ot = o.getAttribute("data-feedback-label"), de = o.getAttribute("data-api-key"), ce = o.getAttribute("data-capture-screenshot"), le = o.getAttribute("data-annotate"), he = o.getAttribute("data-annotation-color"), _ = o.getAttribute("data-screenshot-quality"), F = o.getAttribute("data-screenshot-max-width"), V = o.getAttribute("data-screenshot-max-height"), ue = o.getAttribute("data-capture-video"), it = o.getAttribute("data-video-redaction"), pe = o.getAttribute("data-hide-thumbs"), fe = o.getAttribute("data-hide-dismiss"), N = o.getAttribute("data-video-max-duration"), me = o.getAttribute("data-screenshot-method"), be = o.getAttribute("data-direction"), nt = o.getAttribute("data-css-selector"), ge = o.getAttribute("data-css"), at = M("data-positive-label", o.getAttribute("data-positive-label")), st = M("data-negative-label", o.getAttribute("data-negative-label")), rt = M("data-record-label", o.getAttribute("data-record-label")), dt = M("data-dismiss-label", o.getAttribute("data-dismiss-label")), ve = so(
|
|
1231
978
|
"data-annotation-palette",
|
|
1232
|
-
|
|
1233
|
-
),
|
|
979
|
+
o.getAttribute("data-annotation-palette")
|
|
980
|
+
), ye = o.getAttribute("data-record-icon"), ct = o.getAttribute("data-quest-base"), we = o.getAttribute("data-quest-up"), ke = o.getAttribute("data-quest-down"), xe = o.getAttribute("data-quest-video"), qe = o.getAttribute("data-quest-api-key"), Ce = o.getAttribute("data-quest-module-url");
|
|
1234
981
|
return {
|
|
1235
982
|
endpoint: t,
|
|
1236
983
|
// Inline CSS wins over a selector, as `css` wins over `cssSelector` in
|
|
1237
984
|
// the JSON block.
|
|
1238
|
-
css:
|
|
1239
|
-
apiKey:
|
|
1240
|
-
captureScreenshot:
|
|
985
|
+
css: ge || (nt ? Dt(nt) : void 0),
|
|
986
|
+
apiKey: de ?? void 0,
|
|
987
|
+
captureScreenshot: ce === "true" ? !0 : void 0,
|
|
1241
988
|
// Annotation is on by default; only an explicit "false" disables it.
|
|
1242
|
-
annotate:
|
|
1243
|
-
annotationColor:
|
|
1244
|
-
annotationPalette:
|
|
1245
|
-
screenshotOptions:
|
|
1246
|
-
quality:
|
|
1247
|
-
maxWidth:
|
|
1248
|
-
maxHeight:
|
|
989
|
+
annotate: le === "false" ? !1 : void 0,
|
|
990
|
+
annotationColor: he ?? void 0,
|
|
991
|
+
annotationPalette: ve,
|
|
992
|
+
screenshotOptions: _ || F || V ? {
|
|
993
|
+
quality: _ ? parseFloat(_) : void 0,
|
|
994
|
+
maxWidth: F ? parseInt(F, 10) : void 0,
|
|
995
|
+
maxHeight: V ? parseInt(V, 10) : void 0
|
|
1249
996
|
} : void 0,
|
|
1250
|
-
container:
|
|
1251
|
-
buttonClass:
|
|
1252
|
-
direction:
|
|
997
|
+
container: d ?? void 0,
|
|
998
|
+
buttonClass: c ?? void 0,
|
|
999
|
+
direction: be ?? void 0,
|
|
1253
1000
|
position: e ?? void 0,
|
|
1254
|
-
zIndex:
|
|
1255
|
-
skipTargeting:
|
|
1001
|
+
zIndex: i ? parseInt(i, 10) : void 0,
|
|
1002
|
+
skipTargeting: l === "true" ? !0 : void 0,
|
|
1256
1003
|
hideConfirmation: r === "true" ? !0 : void 0,
|
|
1257
1004
|
singleButton: h === "true" ? !0 : void 0,
|
|
1258
1005
|
feedbackMode: f ?? void 0,
|
|
1259
|
-
incognito:
|
|
1260
|
-
buttonSize:
|
|
1261
|
-
offset:
|
|
1262
|
-
x:
|
|
1006
|
+
incognito: m === "true" ? !0 : void 0,
|
|
1007
|
+
buttonSize: g ?? void 0,
|
|
1008
|
+
offset: v || w ? {
|
|
1009
|
+
x: v ? parseInt(v, 10) : void 0,
|
|
1263
1010
|
y: w ? parseInt(w, 10) : void 0
|
|
1264
1011
|
} : void 0,
|
|
1265
1012
|
modalWidth: x ? parseInt(x, 10) : void 0,
|
|
1266
1013
|
backdropOpacity: u ? parseFloat(u) : void 0,
|
|
1267
1014
|
fontFamily: k ?? void 0,
|
|
1268
|
-
fontSize:
|
|
1015
|
+
fontSize: y ? parseInt(y, 10) : void 0,
|
|
1269
1016
|
colors: {
|
|
1270
1017
|
positive: n ?? void 0,
|
|
1271
|
-
negative:
|
|
1272
|
-
marker:
|
|
1018
|
+
negative: a ?? void 0,
|
|
1019
|
+
marker: s ?? void 0
|
|
1273
1020
|
},
|
|
1274
|
-
text: C ||
|
|
1021
|
+
text: C || L || G || Z || tt || et || ot || S || b || E || Y || J || at || st || rt || dt ? {
|
|
1275
1022
|
tooltip: C ?? void 0,
|
|
1276
|
-
modalTitle:
|
|
1277
|
-
modalSubtitle:
|
|
1278
|
-
placeholder:
|
|
1279
|
-
submitButton:
|
|
1280
|
-
skipButton:
|
|
1281
|
-
feedbackLabel:
|
|
1023
|
+
modalTitle: L ?? void 0,
|
|
1024
|
+
modalSubtitle: G ?? void 0,
|
|
1025
|
+
placeholder: Z ?? void 0,
|
|
1026
|
+
submitButton: tt ?? void 0,
|
|
1027
|
+
skipButton: et ?? void 0,
|
|
1028
|
+
feedbackLabel: ot ?? void 0,
|
|
1282
1029
|
confirmationTitle: S ?? void 0,
|
|
1283
|
-
confirmationMessage:
|
|
1284
|
-
confirmationClose:
|
|
1285
|
-
errorTitle:
|
|
1286
|
-
errorMessage:
|
|
1287
|
-
positiveLabel:
|
|
1288
|
-
negativeLabel:
|
|
1289
|
-
recordLabel:
|
|
1290
|
-
dismissLabel:
|
|
1030
|
+
confirmationMessage: b ?? void 0,
|
|
1031
|
+
confirmationClose: E ?? void 0,
|
|
1032
|
+
errorTitle: Y ?? void 0,
|
|
1033
|
+
errorMessage: J ?? void 0,
|
|
1034
|
+
positiveLabel: at,
|
|
1035
|
+
negativeLabel: st,
|
|
1036
|
+
recordLabel: rt,
|
|
1037
|
+
dismissLabel: dt
|
|
1291
1038
|
} : void 0,
|
|
1292
|
-
positiveIcon:
|
|
1293
|
-
recordIcon:
|
|
1294
|
-
negativeIcon:
|
|
1295
|
-
feedbackIcon:
|
|
1296
|
-
screenshotMethod:
|
|
1297
|
-
captureVideo:
|
|
1298
|
-
hideThumbs:
|
|
1299
|
-
hideDismiss:
|
|
1300
|
-
videoOptions:
|
|
1301
|
-
maxDuration:
|
|
1302
|
-
redaction:
|
|
1039
|
+
positiveIcon: ae ?? void 0,
|
|
1040
|
+
recordIcon: ye ?? void 0,
|
|
1041
|
+
negativeIcon: se ?? void 0,
|
|
1042
|
+
feedbackIcon: re ?? void 0,
|
|
1043
|
+
screenshotMethod: me ?? void 0,
|
|
1044
|
+
captureVideo: ue === "true" ? !0 : void 0,
|
|
1045
|
+
hideThumbs: pe === "true" ? !0 : void 0,
|
|
1046
|
+
hideDismiss: fe === "true" ? !0 : void 0,
|
|
1047
|
+
videoOptions: N || it ? {
|
|
1048
|
+
maxDuration: N ? parseInt(N, 10) : void 0,
|
|
1049
|
+
redaction: it === "true" ? !0 : void 0
|
|
1303
1050
|
} : void 0,
|
|
1304
|
-
quests:
|
|
1305
|
-
base:
|
|
1306
|
-
up:
|
|
1307
|
-
down:
|
|
1308
|
-
video:
|
|
1309
|
-
apiKey:
|
|
1310
|
-
moduleUrl:
|
|
1051
|
+
quests: ct ? {
|
|
1052
|
+
base: ct,
|
|
1053
|
+
up: we ?? void 0,
|
|
1054
|
+
down: ke ?? void 0,
|
|
1055
|
+
video: xe ?? void 0,
|
|
1056
|
+
apiKey: qe ?? void 0,
|
|
1057
|
+
moduleUrl: Ce ?? void 0
|
|
1311
1058
|
} : void 0
|
|
1312
1059
|
};
|
|
1313
1060
|
}
|
|
1314
|
-
function
|
|
1061
|
+
function co() {
|
|
1315
1062
|
if (typeof document > "u") return;
|
|
1316
|
-
const
|
|
1317
|
-
const t = document.currentScript ?? document.querySelector("script[data-endpoint]"), e =
|
|
1318
|
-
e?.endpoint && new
|
|
1063
|
+
const o = () => {
|
|
1064
|
+
const t = document.currentScript ?? document.querySelector("script[data-endpoint]"), e = no() ?? (t ? ro(t) : null);
|
|
1065
|
+
e?.endpoint && new io(e);
|
|
1319
1066
|
};
|
|
1320
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
1067
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", o) : o();
|
|
1321
1068
|
}
|
|
1322
|
-
const
|
|
1323
|
-
function
|
|
1324
|
-
const t = typeof
|
|
1325
|
-
return t.length >
|
|
1069
|
+
const lo = 20, yt = 4096;
|
|
1070
|
+
function R(o) {
|
|
1071
|
+
const t = typeof o == "string" ? o : JSON.stringify(o);
|
|
1072
|
+
return t.length > yt ? t.slice(0, yt) + "…[truncated]" : t;
|
|
1326
1073
|
}
|
|
1327
|
-
function
|
|
1328
|
-
|
|
1074
|
+
function wt(o, t) {
|
|
1075
|
+
o.length >= lo && o.shift(), o.push(t);
|
|
1329
1076
|
}
|
|
1330
|
-
async function
|
|
1077
|
+
async function ho(o) {
|
|
1331
1078
|
try {
|
|
1332
|
-
const t = await
|
|
1333
|
-
return
|
|
1079
|
+
const t = await o.clone().text();
|
|
1080
|
+
return R(t);
|
|
1334
1081
|
} catch {
|
|
1335
1082
|
return;
|
|
1336
1083
|
}
|
|
1337
1084
|
}
|
|
1338
|
-
function
|
|
1339
|
-
const
|
|
1340
|
-
window.fetch = async function(n,
|
|
1341
|
-
const
|
|
1342
|
-
let
|
|
1343
|
-
|
|
1344
|
-
const
|
|
1345
|
-
if (
|
|
1346
|
-
const r = await
|
|
1347
|
-
|
|
1348
|
-
url:
|
|
1349
|
-
method:
|
|
1350
|
-
status:
|
|
1351
|
-
statusText:
|
|
1352
|
-
requestBody:
|
|
1085
|
+
function uo() {
|
|
1086
|
+
const o = [], t = window.fetch;
|
|
1087
|
+
window.fetch = async function(n, a) {
|
|
1088
|
+
const s = typeof n == "string" ? n : n instanceof URL ? n.toString() : n.url, d = a?.method ?? (typeof n == "object" && "method" in n ? n.method : "GET");
|
|
1089
|
+
let c;
|
|
1090
|
+
a?.body && (c = R(a.body));
|
|
1091
|
+
const l = await t.apply(window, [n, a]);
|
|
1092
|
+
if (l.status >= 400) {
|
|
1093
|
+
const r = await ho(l);
|
|
1094
|
+
wt(o, {
|
|
1095
|
+
url: s,
|
|
1096
|
+
method: d.toUpperCase(),
|
|
1097
|
+
status: l.status,
|
|
1098
|
+
statusText: l.statusText,
|
|
1099
|
+
requestBody: c,
|
|
1353
1100
|
responseBody: r,
|
|
1354
1101
|
timestamp: Date.now()
|
|
1355
1102
|
});
|
|
1356
1103
|
}
|
|
1357
|
-
return
|
|
1104
|
+
return l;
|
|
1358
1105
|
};
|
|
1359
|
-
const e = XMLHttpRequest.prototype.open,
|
|
1360
|
-
return XMLHttpRequest.prototype.open = function(n,
|
|
1361
|
-
return this._qaid_method = n, this._qaid_url = typeof
|
|
1106
|
+
const e = XMLHttpRequest.prototype.open, i = XMLHttpRequest.prototype.send;
|
|
1107
|
+
return XMLHttpRequest.prototype.open = function(n, a, ...s) {
|
|
1108
|
+
return this._qaid_method = n, this._qaid_url = typeof a == "string" ? a : a.toString(), e.apply(this, [n, a, ...s]);
|
|
1362
1109
|
}, XMLHttpRequest.prototype.send = function(n) {
|
|
1363
|
-
const
|
|
1364
|
-
return
|
|
1365
|
-
|
|
1366
|
-
url:
|
|
1367
|
-
method:
|
|
1368
|
-
status:
|
|
1369
|
-
statusText:
|
|
1370
|
-
requestBody:
|
|
1371
|
-
responseBody:
|
|
1110
|
+
const a = this, s = n ? R(n) : void 0;
|
|
1111
|
+
return a.addEventListener("load", function() {
|
|
1112
|
+
a.status >= 400 && wt(o, {
|
|
1113
|
+
url: a._qaid_url,
|
|
1114
|
+
method: a._qaid_method.toUpperCase(),
|
|
1115
|
+
status: a.status,
|
|
1116
|
+
statusText: a.statusText,
|
|
1117
|
+
requestBody: s,
|
|
1118
|
+
responseBody: R(a.responseText),
|
|
1372
1119
|
timestamp: Date.now()
|
|
1373
1120
|
});
|
|
1374
|
-
}),
|
|
1121
|
+
}), i.apply(this, [n]);
|
|
1375
1122
|
}, {
|
|
1376
|
-
errors:
|
|
1123
|
+
errors: o,
|
|
1377
1124
|
restore: () => {
|
|
1378
|
-
window.fetch = t, XMLHttpRequest.prototype.open = e, XMLHttpRequest.prototype.send =
|
|
1125
|
+
window.fetch = t, XMLHttpRequest.prototype.open = e, XMLHttpRequest.prototype.send = i;
|
|
1379
1126
|
}
|
|
1380
1127
|
};
|
|
1381
1128
|
}
|
|
1382
|
-
function
|
|
1383
|
-
const
|
|
1384
|
-
return /iP(hone|ad|od)/.test(
|
|
1129
|
+
function po() {
|
|
1130
|
+
const o = navigator.userAgent || "";
|
|
1131
|
+
return /iP(hone|ad|od)/.test(o) || // iPadOS 13+ masquerades as "MacIntel" but is a multi-touch device.
|
|
1385
1132
|
navigator.platform === "MacIntel" && (navigator.maxTouchPoints || 0) > 1;
|
|
1386
1133
|
}
|
|
1387
|
-
function
|
|
1388
|
-
const
|
|
1389
|
-
return
|
|
1134
|
+
function fo(o, t, e, i, n) {
|
|
1135
|
+
const a = o >= t, s = e >= i;
|
|
1136
|
+
return a === s ? { width: o, height: t, rotate: 0 } : { width: t, height: o, rotate: n === 270 ? -90 : 90 };
|
|
1390
1137
|
}
|
|
1391
|
-
function
|
|
1138
|
+
function mo(o, t, e) {
|
|
1392
1139
|
if (e.rotate === 0) {
|
|
1393
|
-
|
|
1140
|
+
o.drawImage(t, 0, 0, e.width, e.height);
|
|
1394
1141
|
return;
|
|
1395
1142
|
}
|
|
1396
|
-
|
|
1143
|
+
o.save(), e.rotate === 90 ? (o.translate(e.width, 0), o.rotate(Math.PI / 2)) : (o.translate(0, e.height), o.rotate(-Math.PI / 2)), o.drawImage(t, 0, 0, e.height, e.width), o.restore();
|
|
1397
1144
|
}
|
|
1398
|
-
function
|
|
1399
|
-
const
|
|
1400
|
-
return
|
|
1145
|
+
function bo() {
|
|
1146
|
+
const o = typeof screen < "u" ? screen.orientation : void 0;
|
|
1147
|
+
return o && typeof o.angle == "number" ? o.angle : 0;
|
|
1401
1148
|
}
|
|
1402
|
-
function
|
|
1149
|
+
function Mt(o) {
|
|
1403
1150
|
return new Promise((t) => {
|
|
1404
|
-
if (
|
|
1151
|
+
if (o.videoWidth > 0) {
|
|
1405
1152
|
t();
|
|
1406
1153
|
return;
|
|
1407
1154
|
}
|
|
1408
|
-
|
|
1155
|
+
o.addEventListener("loadedmetadata", () => t(), { once: !0 });
|
|
1409
1156
|
});
|
|
1410
1157
|
}
|
|
1411
|
-
async function
|
|
1158
|
+
async function Pt(o) {
|
|
1412
1159
|
try {
|
|
1413
|
-
await
|
|
1160
|
+
await o.play();
|
|
1414
1161
|
} catch {
|
|
1415
1162
|
}
|
|
1416
1163
|
}
|
|
1417
|
-
async function
|
|
1164
|
+
async function go(o, t = 15) {
|
|
1418
1165
|
const e = document.createElement("canvas");
|
|
1419
1166
|
if (typeof e.captureStream != "function") return null;
|
|
1420
|
-
const
|
|
1421
|
-
if (!
|
|
1167
|
+
const i = e.getContext("2d");
|
|
1168
|
+
if (!i) return null;
|
|
1422
1169
|
const n = document.createElement("video");
|
|
1423
|
-
n.muted = !0, n.playsInline = !0, n.srcObject =
|
|
1424
|
-
const
|
|
1170
|
+
n.muted = !0, n.playsInline = !0, n.srcObject = o, await Mt(n);
|
|
1171
|
+
const a = fo(
|
|
1425
1172
|
n.videoWidth,
|
|
1426
1173
|
n.videoHeight,
|
|
1427
1174
|
window.innerWidth,
|
|
1428
1175
|
window.innerHeight,
|
|
1429
|
-
|
|
1176
|
+
bo()
|
|
1430
1177
|
);
|
|
1431
|
-
e.width =
|
|
1432
|
-
let
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1178
|
+
e.width = a.width, e.height = a.height, await Pt(n);
|
|
1179
|
+
let s = 0;
|
|
1180
|
+
const d = () => {
|
|
1181
|
+
mo(i, n, a), s = requestAnimationFrame(d);
|
|
1435
1182
|
};
|
|
1436
|
-
|
|
1437
|
-
const
|
|
1183
|
+
d();
|
|
1184
|
+
const c = e.captureStream(t);
|
|
1438
1185
|
return {
|
|
1439
|
-
stream:
|
|
1186
|
+
stream: c,
|
|
1440
1187
|
stop: () => {
|
|
1441
|
-
|
|
1188
|
+
s && cancelAnimationFrame(s), s = 0, c.getTracks().forEach((l) => l.stop()), n.pause(), n.srcObject = null;
|
|
1442
1189
|
}
|
|
1443
1190
|
};
|
|
1444
1191
|
}
|
|
1445
|
-
function
|
|
1446
|
-
const
|
|
1447
|
-
return
|
|
1448
|
-
}
|
|
1449
|
-
function
|
|
1450
|
-
|
|
1451
|
-
const
|
|
1452
|
-
for (const
|
|
1453
|
-
const r =
|
|
1454
|
-
|
|
1192
|
+
function vo(o, t, e, i, n) {
|
|
1193
|
+
const a = Math.max(0, Math.min(i, o.left * t)), s = Math.max(0, Math.min(n, o.top * e)), d = Math.max(0, Math.min(i, (o.left + o.width) * t)), c = Math.max(0, Math.min(n, (o.top + o.height) * e)), l = d - a, r = c - s;
|
|
1194
|
+
return l <= 0 || r <= 0 ? null : { x: a, y: s, w: l, h: r };
|
|
1195
|
+
}
|
|
1196
|
+
function yo(o, t, e, i, n, a, s) {
|
|
1197
|
+
o.drawImage(t, 0, 0, i, n);
|
|
1198
|
+
const d = i / Math.max(1, window.innerWidth), c = n / Math.max(1, window.innerHeight);
|
|
1199
|
+
for (const l of e) {
|
|
1200
|
+
const r = vo(
|
|
1201
|
+
l.getBoundingClientRect(),
|
|
1202
|
+
d,
|
|
1455
1203
|
c,
|
|
1456
|
-
|
|
1457
|
-
o,
|
|
1204
|
+
i,
|
|
1458
1205
|
n
|
|
1459
1206
|
);
|
|
1460
|
-
r && (
|
|
1207
|
+
r && (o.save(), s ? (o.filter = `blur(${a}px)`, o.drawImage(t, r.x, r.y, r.w, r.h, r.x, r.y, r.w, r.h)) : (o.fillStyle = "#0b0b0b", o.fillRect(r.x, r.y, r.w, r.h)), o.restore());
|
|
1461
1208
|
}
|
|
1462
1209
|
}
|
|
1463
|
-
async function
|
|
1464
|
-
const
|
|
1465
|
-
if (typeof
|
|
1466
|
-
const
|
|
1467
|
-
if (!
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
let
|
|
1210
|
+
async function wo(o, t, e = {}) {
|
|
1211
|
+
const i = e.frameRate ?? 15, n = e.blurRadius ?? 12, a = document.createElement("canvas");
|
|
1212
|
+
if (typeof a.captureStream != "function") return null;
|
|
1213
|
+
const s = a.getContext("2d");
|
|
1214
|
+
if (!s) return null;
|
|
1215
|
+
const d = "filter" in s, c = document.createElement("video");
|
|
1216
|
+
c.muted = !0, c.playsInline = !0, c.srcObject = o, await Mt(c), a.width = c.videoWidth, a.height = c.videoHeight, await Pt(c);
|
|
1217
|
+
let l = 0;
|
|
1471
1218
|
const r = () => {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1219
|
+
yo(
|
|
1220
|
+
s,
|
|
1221
|
+
c,
|
|
1475
1222
|
t,
|
|
1476
|
-
|
|
1477
|
-
|
|
1223
|
+
a.width,
|
|
1224
|
+
a.height,
|
|
1478
1225
|
n,
|
|
1479
|
-
|
|
1480
|
-
),
|
|
1226
|
+
d
|
|
1227
|
+
), l = requestAnimationFrame(r);
|
|
1481
1228
|
};
|
|
1482
1229
|
r();
|
|
1483
|
-
const h =
|
|
1230
|
+
const h = a.captureStream(i);
|
|
1484
1231
|
return {
|
|
1485
1232
|
stream: h,
|
|
1486
1233
|
stop: () => {
|
|
1487
|
-
|
|
1234
|
+
l && cancelAnimationFrame(l), l = 0, h.getTracks().forEach((f) => f.stop()), c.pause(), c.srcObject = null;
|
|
1488
1235
|
}
|
|
1489
1236
|
};
|
|
1490
1237
|
}
|
|
1491
|
-
const
|
|
1492
|
-
function
|
|
1238
|
+
const Rt = "This browser cannot blur the areas you picked, so the recording was not started.";
|
|
1239
|
+
function ko() {
|
|
1493
1240
|
return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function" && typeof MediaRecorder < "u";
|
|
1494
1241
|
}
|
|
1495
|
-
function
|
|
1242
|
+
function Bt() {
|
|
1496
1243
|
if (typeof MediaRecorder > "u") return "";
|
|
1497
|
-
const
|
|
1244
|
+
const o = [
|
|
1498
1245
|
"video/webm;codecs=vp9",
|
|
1499
1246
|
"video/webm;codecs=vp8",
|
|
1500
1247
|
"video/webm",
|
|
1501
1248
|
"video/mp4"
|
|
1502
1249
|
];
|
|
1503
|
-
for (const t of
|
|
1250
|
+
for (const t of o)
|
|
1504
1251
|
if (MediaRecorder.isTypeSupported(t))
|
|
1505
1252
|
return t;
|
|
1506
1253
|
return "";
|
|
1507
1254
|
}
|
|
1508
|
-
function
|
|
1509
|
-
const t =
|
|
1510
|
-
let
|
|
1255
|
+
function xo(o = {}) {
|
|
1256
|
+
const t = o.maxDuration ?? 15, e = o.videoBitsPerSecond ?? 8e5, i = o.redactionElements ?? [], n = o.redactionBlurRadius;
|
|
1257
|
+
let a = null, s = null, d = null, c = null, l = [], r = null, h = null, f = null, m = 0, g = null, v = null, w = !1, x = null;
|
|
1511
1258
|
function u() {
|
|
1512
|
-
f !== null && (clearInterval(f), f = null), x !== null && (clearTimeout(x), x = null),
|
|
1259
|
+
f !== null && (clearInterval(f), f = null), x !== null && (clearTimeout(x), x = null), s && (s.stop(), s = null), d && (d.stop(), d = null), a && (a.getTracks().forEach((y) => y.stop()), a = null), c = null, l = [], r = null, h = null, g = null, v = null;
|
|
1513
1260
|
}
|
|
1514
1261
|
function k() {
|
|
1515
|
-
w || (w = !0,
|
|
1262
|
+
w || (w = !0, c && c.state !== "inactive" && c.stop());
|
|
1516
1263
|
}
|
|
1517
1264
|
return {
|
|
1518
1265
|
async start() {
|
|
1519
|
-
w = !1,
|
|
1520
|
-
const
|
|
1521
|
-
if (!
|
|
1266
|
+
w = !1, l = [];
|
|
1267
|
+
const y = Bt();
|
|
1268
|
+
if (!y)
|
|
1522
1269
|
throw new Error("No supported video MIME type found");
|
|
1523
|
-
|
|
1270
|
+
a = await navigator.mediaDevices.getDisplayMedia({
|
|
1524
1271
|
video: {
|
|
1525
1272
|
frameRate: 15,
|
|
1526
1273
|
displaySurface: "browser"
|
|
@@ -1532,102 +1279,102 @@ function Ei(i = {}) {
|
|
|
1532
1279
|
monitorTypeSurfaces: "exclude",
|
|
1533
1280
|
surfaceSwitching: "exclude"
|
|
1534
1281
|
});
|
|
1535
|
-
const C =
|
|
1536
|
-
if (
|
|
1537
|
-
throw
|
|
1282
|
+
const C = a.getVideoTracks()[0], L = C?.getSettings?.()?.displaySurface;
|
|
1283
|
+
if (L === "monitor" || L === "window")
|
|
1284
|
+
throw a.getTracks().forEach((b) => b.stop()), a = null, new Error(
|
|
1538
1285
|
"qaid records only the current tab — please share this tab, not a window or your whole screen."
|
|
1539
1286
|
);
|
|
1540
1287
|
C && C.addEventListener("ended", () => {
|
|
1541
1288
|
k();
|
|
1542
1289
|
});
|
|
1543
|
-
let S =
|
|
1544
|
-
if (
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1290
|
+
let S = a;
|
|
1291
|
+
if (po()) {
|
|
1292
|
+
const b = await go(a);
|
|
1293
|
+
b && (s = b, S = b.stream);
|
|
1547
1294
|
}
|
|
1548
|
-
if (
|
|
1549
|
-
const
|
|
1295
|
+
if (i.length > 0) {
|
|
1296
|
+
const b = await wo(S, i, {
|
|
1550
1297
|
blurRadius: n
|
|
1551
1298
|
});
|
|
1552
|
-
if (!
|
|
1553
|
-
throw
|
|
1554
|
-
|
|
1299
|
+
if (!b)
|
|
1300
|
+
throw s && (s.stop(), s = null), a.getTracks().forEach((E) => E.stop()), a = null, new Error(Rt);
|
|
1301
|
+
d = b, S = b.stream;
|
|
1555
1302
|
}
|
|
1556
|
-
|
|
1557
|
-
mimeType:
|
|
1303
|
+
c = new MediaRecorder(S, {
|
|
1304
|
+
mimeType: y,
|
|
1558
1305
|
videoBitsPerSecond: e
|
|
1559
|
-
}),
|
|
1560
|
-
|
|
1561
|
-
},
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
},
|
|
1565
|
-
|
|
1566
|
-
},
|
|
1567
|
-
const
|
|
1568
|
-
r && r(
|
|
1306
|
+
}), c.ondataavailable = (b) => {
|
|
1307
|
+
b.data.size > 0 && l.push(b.data);
|
|
1308
|
+
}, c.onstop = () => {
|
|
1309
|
+
const b = new Blob(l, { type: y });
|
|
1310
|
+
g && g(b), h && h(b), s && (s.stop(), s = null), d && (d.stop(), d = null), a && a.getTracks().forEach((E) => E.stop());
|
|
1311
|
+
}, c.onerror = () => {
|
|
1312
|
+
v && v(new Error("MediaRecorder error"));
|
|
1313
|
+
}, c.start(1e3), m = Date.now(), f = setInterval(() => {
|
|
1314
|
+
const b = Math.floor((Date.now() - m) / 1e3);
|
|
1315
|
+
r && r(b);
|
|
1569
1316
|
}, 1e3), x = setTimeout(() => {
|
|
1570
1317
|
k();
|
|
1571
1318
|
}, t * 1e3);
|
|
1572
1319
|
},
|
|
1573
1320
|
stop() {
|
|
1574
|
-
return new Promise((
|
|
1575
|
-
|
|
1321
|
+
return new Promise((y, C) => {
|
|
1322
|
+
g = y, v = C, k();
|
|
1576
1323
|
});
|
|
1577
1324
|
},
|
|
1578
|
-
onTick(
|
|
1579
|
-
r =
|
|
1325
|
+
onTick(y) {
|
|
1326
|
+
r = y;
|
|
1580
1327
|
},
|
|
1581
|
-
onStop(
|
|
1582
|
-
h =
|
|
1328
|
+
onStop(y) {
|
|
1329
|
+
h = y;
|
|
1583
1330
|
},
|
|
1584
1331
|
destroy() {
|
|
1585
1332
|
k(), u();
|
|
1586
1333
|
}
|
|
1587
1334
|
};
|
|
1588
1335
|
}
|
|
1589
|
-
const
|
|
1336
|
+
const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1590
1337
|
__proto__: null,
|
|
1591
|
-
REDACTION_UNAVAILABLE:
|
|
1592
|
-
createVideoRecorder:
|
|
1593
|
-
getSupportedMimeType:
|
|
1594
|
-
isVideoRecordingSupported:
|
|
1595
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1596
|
-
let
|
|
1597
|
-
function
|
|
1338
|
+
REDACTION_UNAVAILABLE: Rt,
|
|
1339
|
+
createVideoRecorder: xo,
|
|
1340
|
+
getSupportedMimeType: Bt,
|
|
1341
|
+
isVideoRecordingSupported: ko
|
|
1342
|
+
}, Symbol.toStringTag, { value: "Module" })), kt = "https://qaid.dev/lib/html2canvas.min.js", qo = 1e4, Co = 50;
|
|
1343
|
+
let D = null;
|
|
1344
|
+
function So() {
|
|
1598
1345
|
if (typeof document > "u" || typeof window > "u")
|
|
1599
1346
|
return !1;
|
|
1600
|
-
const
|
|
1601
|
-
return typeof
|
|
1347
|
+
const o = document.createElement("canvas");
|
|
1348
|
+
return typeof o.getContext == "function" && !!o.getContext("2d");
|
|
1602
1349
|
}
|
|
1603
|
-
function
|
|
1604
|
-
return window.html2canvas ? Promise.resolve(!0) :
|
|
1350
|
+
function Eo() {
|
|
1351
|
+
return window.html2canvas ? Promise.resolve(!0) : D || (D = new Promise((o) => {
|
|
1605
1352
|
if (!document.querySelector(
|
|
1606
|
-
`script[src="${
|
|
1353
|
+
`script[src="${kt}"]`
|
|
1607
1354
|
)) {
|
|
1608
1355
|
const n = document.createElement("script");
|
|
1609
|
-
n.src =
|
|
1356
|
+
n.src = kt, n.async = !0, document.head.appendChild(n);
|
|
1610
1357
|
}
|
|
1611
|
-
const e = Date.now(),
|
|
1358
|
+
const e = Date.now(), i = () => {
|
|
1612
1359
|
if (window.html2canvas) {
|
|
1613
|
-
|
|
1360
|
+
o(!0);
|
|
1614
1361
|
return;
|
|
1615
1362
|
}
|
|
1616
|
-
if (Date.now() - e >
|
|
1617
|
-
|
|
1363
|
+
if (Date.now() - e > qo) {
|
|
1364
|
+
D = null, o(!1);
|
|
1618
1365
|
return;
|
|
1619
1366
|
}
|
|
1620
|
-
setTimeout(
|
|
1367
|
+
setTimeout(i, Co);
|
|
1621
1368
|
};
|
|
1622
|
-
|
|
1623
|
-
}),
|
|
1369
|
+
i();
|
|
1370
|
+
}), D);
|
|
1624
1371
|
}
|
|
1625
|
-
async function
|
|
1626
|
-
const { quality: t = 0.8, maxWidth: e = 1280, maxHeight:
|
|
1372
|
+
async function To(o = {}) {
|
|
1373
|
+
const { quality: t = 0.8, maxWidth: e = 1280, maxHeight: i = 800 } = o;
|
|
1627
1374
|
try {
|
|
1628
|
-
if (!await
|
|
1375
|
+
if (!await Eo() || !window.html2canvas)
|
|
1629
1376
|
return console.warn("html2canvas failed to load"), null;
|
|
1630
|
-
const
|
|
1377
|
+
const a = await window.html2canvas(document.body, {
|
|
1631
1378
|
useCORS: !0,
|
|
1632
1379
|
allowTaint: !1,
|
|
1633
1380
|
logging: !1,
|
|
@@ -1637,24 +1384,24 @@ async function Mi(i = {}) {
|
|
|
1637
1384
|
height: document.documentElement.clientHeight,
|
|
1638
1385
|
x: window.scrollX,
|
|
1639
1386
|
y: window.scrollY,
|
|
1640
|
-
ignoreElements: (
|
|
1641
|
-
}),
|
|
1642
|
-
if (
|
|
1643
|
-
const
|
|
1644
|
-
h.width =
|
|
1387
|
+
ignoreElements: (l) => l instanceof HTMLElement ? l.classList.contains("qaid-buttons") || l.classList.contains("qaid-targeting-overlay") || l.classList.contains("qaid-modal-container") || l.classList.contains("qaid-bottom-sheet") || l.classList.contains("qaid-backdrop") || l.classList.contains("qaid-selected-marker") || l.classList.contains("qaid-tooltip-text") || l.classList.contains("qaid-recording-indicator") || l.classList.contains("qaid-video-preview") || l.className?.toString().startsWith?.("qaid-") : !1
|
|
1388
|
+
}), s = a.width, d = a.height, c = Math.min(e / s, i / d, 1);
|
|
1389
|
+
if (c < 1) {
|
|
1390
|
+
const l = Math.round(s * c), r = Math.round(d * c), h = document.createElement("canvas");
|
|
1391
|
+
h.width = l, h.height = r;
|
|
1645
1392
|
const f = h.getContext("2d");
|
|
1646
|
-
return f ? (f.drawImage(
|
|
1393
|
+
return f ? (f.drawImage(a, 0, 0, l, r), h.toDataURL("image/webp", t)) : null;
|
|
1647
1394
|
}
|
|
1648
|
-
return
|
|
1395
|
+
return a.toDataURL("image/webp", t);
|
|
1649
1396
|
} catch (n) {
|
|
1650
1397
|
return console.warn("DOM screenshot capture failed:", n), null;
|
|
1651
1398
|
}
|
|
1652
1399
|
}
|
|
1653
|
-
const
|
|
1400
|
+
const Ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1654
1401
|
__proto__: null,
|
|
1655
|
-
captureDomScreenshot:
|
|
1656
|
-
isDomScreenshotSupported:
|
|
1657
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1402
|
+
captureDomScreenshot: To,
|
|
1403
|
+
isDomScreenshotSupported: So
|
|
1404
|
+
}, Symbol.toStringTag, { value: "Module" })), Ao = ".qaid-annotate{position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;gap:.75rem;padding:16px;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));box-sizing:border-box;background:#000000d9;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);animation:qaid-fadeIn .2s ease-out}.qaid-annotate-title{margin:0;font-size:var(--qaid-font-size, 16px);font-weight:700;text-align:center;color:#f9fafb}.qaid-annotate-desc{margin:0;font-size:calc(var(--qaid-font-size, 16px) * .8125);line-height:1.4;text-align:center;color:#f9fafbbf}.qaid-annotate-stage{flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto}.qaid-annotate-canvas{max-width:100%;max-height:100%;object-fit:contain;background:light-dark(#ffffff,#111827);border-radius:.5rem;box-shadow:0 10px 30px #00000080;touch-action:none;cursor:crosshair}.qaid-annotate-toolbar{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;justify-content:center;padding:.5rem .75rem;background:light-dark(#ffffff,#1f2937);border-radius:.75rem;box-shadow:0 10px 30px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5))}.qaid-annotate-tools,.qaid-annotate-actions{display:flex;gap:.375rem;align-items:center}button.qaid-annotate-tool,button.qaid-annotate-action{display:inline-flex;align-items:center;justify-content:center;gap:.375rem;min-width:44px;min-height:44px;padding:0 .75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;background:light-dark(#f9fafb,#111827);color:light-dark(#1f2937,#f9fafb);font-family:inherit;font-size:calc(var(--qaid-font-size, 16px) * .8125);font-weight:600;cursor:pointer;-webkit-appearance:none;appearance:none;transition:background-color .15s,color .15s,border-color .15s,filter .15s}button.qaid-annotate-tool svg,button.qaid-annotate-action svg{width:20px;height:20px}.qaid-annotate-colors{display:flex;gap:.25rem;align-items:center}button.qaid-annotate-swatch{width:28px;height:28px;min-width:28px;padding:0;border-radius:9999px;border:2px solid light-dark(#d1d5db,#4b5563);background:var(--qaid-swatch, #000);cursor:pointer;-webkit-appearance:none;appearance:none;transition:transform .1s,box-shadow .15s,border-color .15s}button.qaid-annotate-swatch:hover{transform:scale(1.12)}button.qaid-annotate-swatch[aria-pressed=true]{border-color:light-dark(#111827,#f9fafb);box-shadow:0 0 0 2px var(--qaid-swatch)}@media(forced-colors:active){button.qaid-annotate-swatch[aria-pressed=true]{outline:2px solid Highlight;outline-offset:1px}}button.qaid-annotate-tool:hover,button.qaid-annotate-action:hover{background:light-dark(#eef2ff,#312e81)}button.qaid-annotate-tool[aria-pressed=true],button.qaid-annotate-done{background:var(--qaid-marker, #6365f1);color:var(--qaid-marker-text, #fff);border-color:var(--qaid-marker, #6365f1)}button.qaid-annotate-done:hover{filter:brightness(.9);background:var(--qaid-marker, #6365f1)}button.qaid-annotate-action:disabled{opacity:.45;cursor:not-allowed}@media(forced-colors:active){button.qaid-annotate-tool[aria-pressed=true],button.qaid-annotate-done{border:2px solid Highlight}.qaid-annotate-canvas{border:1px solid CanvasText}}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}", T = 12, Lo = "#ef4444", Do = ["#ef4444", "#f59e0b", "#22c55e", "#3b82f6", "#111827", "#ffffff"], Io = {
|
|
1658
1405
|
"#ef4444": "red",
|
|
1659
1406
|
"#f59e0b": "amber",
|
|
1660
1407
|
"#22c55e": "green",
|
|
@@ -1666,10 +1413,10 @@ const kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1666
1413
|
"#6365f1": "indigo",
|
|
1667
1414
|
"#6366f1": "indigo"
|
|
1668
1415
|
};
|
|
1669
|
-
function xt(
|
|
1670
|
-
return
|
|
1416
|
+
function xt(o) {
|
|
1417
|
+
return Io[o.toLowerCase()] ?? o;
|
|
1671
1418
|
}
|
|
1672
|
-
const
|
|
1419
|
+
const Mo = 4, Po = 0.8, Ro = {
|
|
1673
1420
|
title: "Annotate screenshot",
|
|
1674
1421
|
instructions: "Draw on the screenshot to highlight or hide details, then choose Done to attach it or Skip to send the original.",
|
|
1675
1422
|
rectangle: "Rectangle",
|
|
@@ -1681,95 +1428,95 @@ const Oi = 4, zi = 0.8, $i = {
|
|
|
1681
1428
|
done: "Done",
|
|
1682
1429
|
colors: "Drawing colour"
|
|
1683
1430
|
};
|
|
1684
|
-
function
|
|
1431
|
+
function O(o, t) {
|
|
1685
1432
|
return {
|
|
1686
|
-
x: Math.min(
|
|
1687
|
-
y: Math.min(
|
|
1688
|
-
w: Math.abs(
|
|
1689
|
-
h: Math.abs(
|
|
1433
|
+
x: Math.min(o.x, t.x),
|
|
1434
|
+
y: Math.min(o.y, t.y),
|
|
1435
|
+
w: Math.abs(o.x - t.x),
|
|
1436
|
+
h: Math.abs(o.y - t.y)
|
|
1690
1437
|
};
|
|
1691
1438
|
}
|
|
1692
|
-
function
|
|
1693
|
-
if (
|
|
1694
|
-
const t =
|
|
1439
|
+
function Bo(o) {
|
|
1440
|
+
if (o.type === "pen") return o.points.length < 2;
|
|
1441
|
+
const t = O(o.points[0], o.points[1]);
|
|
1695
1442
|
return t.w < 3 && t.h < 3;
|
|
1696
1443
|
}
|
|
1697
|
-
function
|
|
1698
|
-
|
|
1699
|
-
const n = Math.atan2(e.y - t.y, e.x - t.x),
|
|
1700
|
-
|
|
1701
|
-
e.x -
|
|
1702
|
-
e.y -
|
|
1703
|
-
),
|
|
1704
|
-
e.x -
|
|
1705
|
-
e.y -
|
|
1706
|
-
),
|
|
1707
|
-
}
|
|
1708
|
-
function
|
|
1444
|
+
function Ho(o, t, e, i) {
|
|
1445
|
+
o.beginPath(), o.moveTo(t.x, t.y), o.lineTo(e.x, e.y), o.stroke();
|
|
1446
|
+
const n = Math.atan2(e.y - t.y, e.x - t.x), a = Math.max(10, i * 3);
|
|
1447
|
+
o.beginPath(), o.moveTo(e.x, e.y), o.lineTo(
|
|
1448
|
+
e.x - a * Math.cos(n - Math.PI / 6),
|
|
1449
|
+
e.y - a * Math.sin(n - Math.PI / 6)
|
|
1450
|
+
), o.moveTo(e.x, e.y), o.lineTo(
|
|
1451
|
+
e.x - a * Math.cos(n + Math.PI / 6),
|
|
1452
|
+
e.y - a * Math.sin(n + Math.PI / 6)
|
|
1453
|
+
), o.stroke();
|
|
1454
|
+
}
|
|
1455
|
+
function Oo(o, t) {
|
|
1709
1456
|
if (t.length !== 0) {
|
|
1710
|
-
|
|
1457
|
+
o.beginPath(), o.moveTo(t[0].x, t[0].y);
|
|
1711
1458
|
for (let e = 1; e < t.length; e++)
|
|
1712
|
-
|
|
1713
|
-
|
|
1459
|
+
o.lineTo(t[e].x, t[e].y);
|
|
1460
|
+
o.stroke();
|
|
1714
1461
|
}
|
|
1715
1462
|
}
|
|
1716
|
-
function
|
|
1717
|
-
|
|
1718
|
-
for (let
|
|
1719
|
-
for (let
|
|
1720
|
-
(Math.floor((
|
|
1721
|
-
a,
|
|
1463
|
+
function zo(o, t, e, i, n) {
|
|
1464
|
+
o.fillStyle = "rgb(15, 23, 42)", o.fillRect(t, e, i, n), o.fillStyle = "rgb(37, 47, 63)";
|
|
1465
|
+
for (let a = e; a < e + n; a += T)
|
|
1466
|
+
for (let s = t; s < t + i; s += T)
|
|
1467
|
+
(Math.floor((s - t) / T) + Math.floor((a - e) / T)) % 2 === 0 && o.fillRect(
|
|
1722
1468
|
s,
|
|
1723
|
-
|
|
1724
|
-
Math.min(
|
|
1469
|
+
a,
|
|
1470
|
+
Math.min(T, t + i - s),
|
|
1471
|
+
Math.min(T, e + n - a)
|
|
1725
1472
|
);
|
|
1726
1473
|
}
|
|
1727
|
-
function
|
|
1728
|
-
switch (
|
|
1474
|
+
function z(o, t) {
|
|
1475
|
+
switch (o.save(), o.strokeStyle = t.color, o.fillStyle = t.color, o.lineWidth = t.strokeWidth, o.lineJoin = "round", o.lineCap = "round", t.type) {
|
|
1729
1476
|
case "rect": {
|
|
1730
|
-
const e =
|
|
1731
|
-
|
|
1477
|
+
const e = O(t.points[0], t.points[1]);
|
|
1478
|
+
o.strokeRect(e.x, e.y, e.w, e.h);
|
|
1732
1479
|
break;
|
|
1733
1480
|
}
|
|
1734
1481
|
case "arrow":
|
|
1735
|
-
|
|
1482
|
+
Ho(o, t.points[0], t.points[1], t.strokeWidth);
|
|
1736
1483
|
break;
|
|
1737
1484
|
case "pen":
|
|
1738
|
-
|
|
1485
|
+
Oo(o, t.points);
|
|
1739
1486
|
break;
|
|
1740
1487
|
case "blur": {
|
|
1741
|
-
const e =
|
|
1742
|
-
|
|
1488
|
+
const e = O(t.points[0], t.points[1]);
|
|
1489
|
+
zo(o, e.x, e.y, e.w, e.h);
|
|
1743
1490
|
break;
|
|
1744
1491
|
}
|
|
1745
1492
|
}
|
|
1746
|
-
|
|
1493
|
+
o.restore();
|
|
1747
1494
|
}
|
|
1748
|
-
function
|
|
1495
|
+
function zt(o) {
|
|
1749
1496
|
return new Promise((t, e) => {
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1497
|
+
const i = new Image();
|
|
1498
|
+
i.onload = () => t(i), i.onerror = () => e(new Error("Failed to load screenshot")), i.src = o;
|
|
1752
1499
|
});
|
|
1753
1500
|
}
|
|
1754
|
-
async function
|
|
1755
|
-
const
|
|
1501
|
+
async function $t(o, t, e = {}) {
|
|
1502
|
+
const i = e.quality ?? Po;
|
|
1756
1503
|
let n;
|
|
1757
1504
|
try {
|
|
1758
|
-
n = await
|
|
1505
|
+
n = await zt(o);
|
|
1759
1506
|
} catch {
|
|
1760
|
-
return
|
|
1761
|
-
}
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
const
|
|
1765
|
-
if (!
|
|
1766
|
-
|
|
1767
|
-
for (const
|
|
1768
|
-
|
|
1769
|
-
return
|
|
1770
|
-
}
|
|
1771
|
-
let
|
|
1772
|
-
class
|
|
1507
|
+
return o;
|
|
1508
|
+
}
|
|
1509
|
+
const a = document.createElement("canvas");
|
|
1510
|
+
a.width = n.naturalWidth || n.width || 1, a.height = n.naturalHeight || n.height || 1;
|
|
1511
|
+
const s = a.getContext("2d");
|
|
1512
|
+
if (!s) return o;
|
|
1513
|
+
s.drawImage(n, 0, 0, a.width, a.height);
|
|
1514
|
+
for (const d of t)
|
|
1515
|
+
z(s, d);
|
|
1516
|
+
return a.toDataURL("image/webp", i);
|
|
1517
|
+
}
|
|
1518
|
+
let $o = 0;
|
|
1519
|
+
class _t {
|
|
1773
1520
|
shapes = [];
|
|
1774
1521
|
tool = "rect";
|
|
1775
1522
|
opts;
|
|
@@ -1777,7 +1524,7 @@ class Vt {
|
|
|
1777
1524
|
color;
|
|
1778
1525
|
palette;
|
|
1779
1526
|
strokeWidth;
|
|
1780
|
-
uid = `qaid-annotate-${
|
|
1527
|
+
uid = `qaid-annotate-${++$o}`;
|
|
1781
1528
|
container;
|
|
1782
1529
|
canvas;
|
|
1783
1530
|
ctx = null;
|
|
@@ -1791,7 +1538,7 @@ class Vt {
|
|
|
1791
1538
|
// after the editor is mounted).
|
|
1792
1539
|
resolveResult;
|
|
1793
1540
|
constructor(t) {
|
|
1794
|
-
this.opts = t, this.labels = {
|
|
1541
|
+
this.opts = t, this.labels = { ...Ro, ...t.labels ?? {} }, this.color = t.color ?? Lo, this.palette = (t.palette && t.palette.length ? t.palette : Do).slice(), this.palette.some((e) => e.toLowerCase() === this.color.toLowerCase()) || this.palette.unshift(this.color), this.strokeWidth = t.strokeWidth ?? Mo;
|
|
1795
1542
|
}
|
|
1796
1543
|
/** Mount the editor and resolve when the user commits (Done) or skips. */
|
|
1797
1544
|
open() {
|
|
@@ -1800,20 +1547,20 @@ class Vt {
|
|
|
1800
1547
|
});
|
|
1801
1548
|
return this.mount(), t;
|
|
1802
1549
|
}
|
|
1803
|
-
toolButton(t, e,
|
|
1550
|
+
toolButton(t, e, i) {
|
|
1804
1551
|
const n = q("button", {
|
|
1805
1552
|
type: "button",
|
|
1806
1553
|
class: "qaid-annotate-tool",
|
|
1807
1554
|
"data-qaid-tool": t,
|
|
1808
1555
|
"aria-pressed": t === this.tool ? "true" : "false",
|
|
1809
|
-
"aria-label": `${
|
|
1810
|
-
title:
|
|
1556
|
+
"aria-label": `${i} tool`,
|
|
1557
|
+
title: i
|
|
1811
1558
|
});
|
|
1812
|
-
return n.innerHTML = `${e}<span class="qaid-annotate-btn-text">${
|
|
1559
|
+
return n.innerHTML = `${e}<span class="qaid-annotate-btn-text">${i}</span>`, n;
|
|
1813
1560
|
}
|
|
1814
1561
|
/** A round colour swatch button for the toolbar's colour group. */
|
|
1815
1562
|
swatchButton(t) {
|
|
1816
|
-
const e = xt(t),
|
|
1563
|
+
const e = xt(t), i = q("button", {
|
|
1817
1564
|
type: "button",
|
|
1818
1565
|
class: "qaid-annotate-swatch",
|
|
1819
1566
|
"data-qaid-color": t,
|
|
@@ -1821,51 +1568,51 @@ class Vt {
|
|
|
1821
1568
|
"aria-label": `Draw in ${e}`,
|
|
1822
1569
|
title: e
|
|
1823
1570
|
});
|
|
1824
|
-
return
|
|
1571
|
+
return i.style.setProperty("--qaid-swatch", t), i;
|
|
1825
1572
|
}
|
|
1826
|
-
actionButton(t, e,
|
|
1827
|
-
const
|
|
1573
|
+
actionButton(t, e, i, n) {
|
|
1574
|
+
const a = q("button", {
|
|
1828
1575
|
type: "button",
|
|
1829
1576
|
class: `qaid-annotate-action ${n}`,
|
|
1830
1577
|
"data-qaid-action": t,
|
|
1831
|
-
"aria-label":
|
|
1832
|
-
title:
|
|
1578
|
+
"aria-label": i,
|
|
1579
|
+
title: i
|
|
1833
1580
|
});
|
|
1834
|
-
return
|
|
1581
|
+
return a.innerHTML = `${e}<span class="qaid-annotate-btn-text">${i}</span>`, a;
|
|
1835
1582
|
}
|
|
1836
1583
|
mount() {
|
|
1837
1584
|
const t = `${this.uid}-title`, e = `${this.uid}-desc`;
|
|
1838
1585
|
this.container = q("div", { class: "qaid-annotate" }), this.opts.applyVars?.(this.container);
|
|
1839
|
-
const
|
|
1586
|
+
const i = q("h2", {
|
|
1840
1587
|
id: t,
|
|
1841
1588
|
class: "qaid-annotate-title"
|
|
1842
1589
|
});
|
|
1843
|
-
|
|
1590
|
+
i.textContent = this.labels.title;
|
|
1844
1591
|
const n = q("p", {
|
|
1845
1592
|
id: e,
|
|
1846
1593
|
class: "qaid-annotate-desc"
|
|
1847
1594
|
});
|
|
1848
1595
|
n.textContent = this.labels.instructions;
|
|
1849
|
-
const
|
|
1850
|
-
this.canvas = document.createElement("canvas"), this.canvas.className = "qaid-annotate-canvas", this.canvas.width = 1, this.canvas.height = 1, this.canvas.setAttribute("role", "img"), this.canvas.setAttribute("aria-label", this.labels.title), this.ctx = this.canvas.getContext("2d"),
|
|
1596
|
+
const a = q("div", { class: "qaid-annotate-stage" });
|
|
1597
|
+
this.canvas = document.createElement("canvas"), this.canvas.className = "qaid-annotate-canvas", this.canvas.width = 1, this.canvas.height = 1, this.canvas.setAttribute("role", "img"), this.canvas.setAttribute("aria-label", this.labels.title), this.ctx = this.canvas.getContext("2d"), a.appendChild(this.canvas), this.toolbar = q("div", {
|
|
1851
1598
|
class: "qaid-annotate-toolbar",
|
|
1852
1599
|
role: "toolbar",
|
|
1853
1600
|
"aria-label": this.labels.title
|
|
1854
1601
|
});
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
const
|
|
1602
|
+
const s = q("div", { class: "qaid-annotate-tools" });
|
|
1603
|
+
s.appendChild(this.toolButton("rect", Ee, this.labels.rectangle)), s.appendChild(this.toolButton("arrow", Te, this.labels.arrow)), s.appendChild(this.toolButton("pen", Ae, this.labels.pen)), s.appendChild(this.toolButton("blur", Le, this.labels.blur));
|
|
1604
|
+
const d = q("div", {
|
|
1858
1605
|
class: "qaid-annotate-colors",
|
|
1859
1606
|
role: "group",
|
|
1860
1607
|
"aria-label": this.labels.colors
|
|
1861
1608
|
});
|
|
1862
|
-
for (const h of this.palette)
|
|
1863
|
-
this.undoBtn = this.actionButton("undo",
|
|
1864
|
-
const
|
|
1865
|
-
r.appendChild(this.undoBtn), r.appendChild(
|
|
1609
|
+
for (const h of this.palette) d.appendChild(this.swatchButton(h));
|
|
1610
|
+
this.undoBtn = this.actionButton("undo", De, this.labels.undo, "qaid-annotate-undo"), this.undoBtn.disabled = !0;
|
|
1611
|
+
const c = this.actionButton("skip", Me, this.labels.skip, "qaid-annotate-skip"), l = this.actionButton("done", At, this.labels.done, "qaid-annotate-done"), r = q("div", { class: "qaid-annotate-actions" });
|
|
1612
|
+
r.appendChild(this.undoBtn), r.appendChild(c), r.appendChild(l), this.toolbar.appendChild(s), this.toolbar.appendChild(d), this.toolbar.appendChild(r), this.container.appendChild(i), this.container.appendChild(n), this.container.appendChild(a), this.container.appendChild(this.toolbar), this.opts.root.appendChild(this.container), this.toolbar.addEventListener("click", this.onToolbarClick), this.canvas.addEventListener("pointerdown", this.onPointerDown), this.container.addEventListener("pointermove", this.onPointerMove), this.container.addEventListener("pointerup", this.onPointerUp), this.container.addEventListener("keydown", this.onKeyDown), this.opts.openDialog?.(this.container, {
|
|
1866
1613
|
labelledbyId: t,
|
|
1867
1614
|
describedbyId: e
|
|
1868
|
-
}), this.opts.announce?.(this.labels.instructions),
|
|
1615
|
+
}), this.opts.announce?.(this.labels.instructions), zt(this.opts.dataUrl).then((h) => {
|
|
1869
1616
|
this.img = h, this.canvas.width = h.naturalWidth || h.width || 1, this.canvas.height = h.naturalHeight || h.height || 1, this.redraw();
|
|
1870
1617
|
}).catch(() => {
|
|
1871
1618
|
this.img = null, this.redraw();
|
|
@@ -1873,9 +1620,9 @@ class Vt {
|
|
|
1873
1620
|
}
|
|
1874
1621
|
/** Convert a pointer event's client coordinates into natural image pixels. */
|
|
1875
1622
|
toImageCoords(t) {
|
|
1876
|
-
const e = this.canvas.getBoundingClientRect(),
|
|
1623
|
+
const e = this.canvas.getBoundingClientRect(), i = this.canvas.width / (e.width || this.canvas.width), n = this.canvas.height / (e.height || this.canvas.height);
|
|
1877
1624
|
return {
|
|
1878
|
-
x: (t.clientX - e.left) *
|
|
1625
|
+
x: (t.clientX - e.left) * i,
|
|
1879
1626
|
y: (t.clientY - e.top) * n
|
|
1880
1627
|
};
|
|
1881
1628
|
}
|
|
@@ -1885,8 +1632,8 @@ class Vt {
|
|
|
1885
1632
|
if (t) {
|
|
1886
1633
|
t.clearRect(0, 0, this.canvas.width, this.canvas.height), this.img && t.drawImage(this.img, 0, 0, this.canvas.width, this.canvas.height);
|
|
1887
1634
|
for (const e of this.shapes)
|
|
1888
|
-
|
|
1889
|
-
this.current &&
|
|
1635
|
+
z(t, e);
|
|
1636
|
+
this.current && z(t, this.current);
|
|
1890
1637
|
}
|
|
1891
1638
|
}
|
|
1892
1639
|
/** Select the active drawing tool and reflect it on the toolbar. */
|
|
@@ -1897,35 +1644,35 @@ class Vt {
|
|
|
1897
1644
|
n.getAttribute("data-qaid-tool") === t ? "true" : "false"
|
|
1898
1645
|
);
|
|
1899
1646
|
});
|
|
1900
|
-
const
|
|
1901
|
-
this.opts.announce?.(`${
|
|
1647
|
+
const i = this.labels[_o[t]];
|
|
1648
|
+
this.opts.announce?.(`${i} tool selected`);
|
|
1902
1649
|
}
|
|
1903
1650
|
/** Set the active drawing colour; subsequent shapes use it. */
|
|
1904
1651
|
selectColor(t) {
|
|
1905
|
-
this.color = t, this.toolbar.querySelectorAll("[data-qaid-color]").forEach((
|
|
1906
|
-
|
|
1652
|
+
this.color = t, this.toolbar.querySelectorAll("[data-qaid-color]").forEach((i) => {
|
|
1653
|
+
i.setAttribute(
|
|
1907
1654
|
"aria-pressed",
|
|
1908
|
-
(
|
|
1655
|
+
(i.getAttribute("data-qaid-color") ?? "").toLowerCase() === t.toLowerCase() ? "true" : "false"
|
|
1909
1656
|
);
|
|
1910
1657
|
}), this.opts.announce?.(`${xt(t)} colour selected`);
|
|
1911
1658
|
}
|
|
1912
1659
|
onToolbarClick = (t) => {
|
|
1913
|
-
const
|
|
1660
|
+
const i = t.target?.closest(
|
|
1914
1661
|
"[data-qaid-tool],[data-qaid-action],[data-qaid-color]"
|
|
1915
1662
|
);
|
|
1916
|
-
if (!
|
|
1917
|
-
const n =
|
|
1663
|
+
if (!i) return;
|
|
1664
|
+
const n = i.getAttribute("data-qaid-color");
|
|
1918
1665
|
if (n) {
|
|
1919
1666
|
this.selectColor(n);
|
|
1920
1667
|
return;
|
|
1921
1668
|
}
|
|
1922
|
-
const
|
|
1923
|
-
if (
|
|
1924
|
-
this.selectTool(
|
|
1669
|
+
const a = i.getAttribute("data-qaid-tool");
|
|
1670
|
+
if (a) {
|
|
1671
|
+
this.selectTool(a);
|
|
1925
1672
|
return;
|
|
1926
1673
|
}
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1674
|
+
const s = i.getAttribute("data-qaid-action");
|
|
1675
|
+
s === "undo" ? this.undo() : s === "skip" ? this.skip() : s === "done" && this.done();
|
|
1929
1676
|
};
|
|
1930
1677
|
onPointerDown = (t) => {
|
|
1931
1678
|
t.preventDefault?.(), this.drawing = !0;
|
|
@@ -1946,7 +1693,7 @@ class Vt {
|
|
|
1946
1693
|
if (!this.drawing || !this.current) return;
|
|
1947
1694
|
this.drawing = !1;
|
|
1948
1695
|
const t = this.current;
|
|
1949
|
-
if (this.current = null,
|
|
1696
|
+
if (this.current = null, Bo(t)) {
|
|
1950
1697
|
this.redraw();
|
|
1951
1698
|
return;
|
|
1952
1699
|
}
|
|
@@ -1975,7 +1722,7 @@ class Vt {
|
|
|
1975
1722
|
/** Composite the annotations and resolve with the new WebP data URL. */
|
|
1976
1723
|
async done() {
|
|
1977
1724
|
if (this.settled) return;
|
|
1978
|
-
const t = await
|
|
1725
|
+
const t = await $t(this.opts.dataUrl, this.shapes, {
|
|
1979
1726
|
quality: this.opts.quality
|
|
1980
1727
|
});
|
|
1981
1728
|
this.opts.announce?.("Annotated screenshot attached"), this.settle(t);
|
|
@@ -1991,333 +1738,398 @@ class Vt {
|
|
|
1991
1738
|
this.toolbar.removeEventListener("click", this.onToolbarClick), this.canvas.removeEventListener("pointerdown", this.onPointerDown), this.container.removeEventListener("pointermove", this.onPointerMove), this.container.removeEventListener("pointerup", this.onPointerUp), this.container.removeEventListener("keydown", this.onKeyDown), this.opts.closeDialog?.(), this.container.remove();
|
|
1992
1739
|
}
|
|
1993
1740
|
}
|
|
1994
|
-
const
|
|
1741
|
+
const _o = {
|
|
1995
1742
|
rect: "rectangle",
|
|
1996
1743
|
arrow: "arrow",
|
|
1997
1744
|
pen: "pen",
|
|
1998
1745
|
blur: "blur"
|
|
1999
1746
|
};
|
|
2000
|
-
function
|
|
2001
|
-
return new
|
|
1747
|
+
function Fo(o) {
|
|
1748
|
+
return new _t(o).open();
|
|
2002
1749
|
}
|
|
2003
|
-
const
|
|
1750
|
+
const Vo = Ao, Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2004
1751
|
__proto__: null,
|
|
2005
|
-
AnnotationEditor:
|
|
2006
|
-
compositeAnnotations:
|
|
2007
|
-
drawShape:
|
|
2008
|
-
openAnnotationEditor:
|
|
2009
|
-
rectFromPoints:
|
|
2010
|
-
styles:
|
|
1752
|
+
AnnotationEditor: _t,
|
|
1753
|
+
compositeAnnotations: $t,
|
|
1754
|
+
drawShape: z,
|
|
1755
|
+
openAnnotationEditor: Fo,
|
|
1756
|
+
rectFromPoints: O,
|
|
1757
|
+
styles: Vo
|
|
2011
1758
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2012
|
-
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
n != null && n !== !1 && o.append(n);
|
|
2024
|
-
return o;
|
|
1759
|
+
co();
|
|
1760
|
+
const No = [
|
|
1761
|
+
"a[href]",
|
|
1762
|
+
"button",
|
|
1763
|
+
"input",
|
|
1764
|
+
"textarea",
|
|
1765
|
+
"select",
|
|
1766
|
+
"[tabindex]"
|
|
1767
|
+
].join(",");
|
|
1768
|
+
function Uo(o) {
|
|
1769
|
+
return o.hasAttribute("disabled") ? !0 : o.disabled === !0;
|
|
2025
1770
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
recordedBlob = null;
|
|
2035
|
-
recordingIndicator = null;
|
|
2036
|
-
videoPreview = null;
|
|
2037
|
-
isRecording = !1;
|
|
2038
|
-
isSendingVideo = !1;
|
|
2039
|
-
// Pre-recording redaction picking.
|
|
2040
|
-
redactPicks = [];
|
|
2041
|
-
redactPickerRoot = null;
|
|
2042
|
-
redactRafId = 0;
|
|
2043
|
-
boundRedactClick = (t) => this.handleRedactPickClick(t);
|
|
2044
|
-
/** Escape-key handler; returns true when it consumed the key. */
|
|
2045
|
-
handleEscape() {
|
|
2046
|
-
return this.isRecording ? (this.stopRecording(), !0) : this.videoPreview ? (this.cancelRecordingPreview(), !0) : this.redactPickerRoot ? (this.finishRedactionPicking(!1), !0) : !1;
|
|
2047
|
-
}
|
|
2048
|
-
destroy() {
|
|
2049
|
-
this.redactRafId && cancelAnimationFrame(this.redactRafId), this.redactRafId = 0, document.removeEventListener("click", this.boundRedactClick, !0), this.redactPickerRoot && (this.redactPickerRoot.remove(), this.redactPickerRoot = null), this.redactPicks = [], this.cleanupRecording(), this.removeVideoPreview();
|
|
2050
|
-
}
|
|
2051
|
-
async startRecording(t = []) {
|
|
2052
|
-
if (!(this.isRecording || this.host.state !== "IDLE"))
|
|
2053
|
-
try {
|
|
2054
|
-
this.networkCapture = gi();
|
|
2055
|
-
const { createVideoRecorder: e } = await Promise.resolve().then(() => _t);
|
|
2056
|
-
this.videoRecorder = e({
|
|
2057
|
-
maxDuration: this.host.config.videoOptions.maxDuration,
|
|
2058
|
-
redactionElements: t
|
|
2059
|
-
}), this.videoRecorder.onTick((o) => {
|
|
2060
|
-
this.updateRecordingTimer(o);
|
|
2061
|
-
}), this.videoRecorder.onStop((o) => {
|
|
2062
|
-
this.isRecording && (this.recordedBlob = o, this.isRecording = !1, this.host.announceMsg("Recording stopped"), this.removeRecordingIndicator(), document.removeEventListener("keydown", this.host.boundKeyDown), this.host.setButtonsDisabled(!1), o && o.size > 0 ? this.showRecordingPreview() : this.cleanupRecording());
|
|
2063
|
-
}), await this.videoRecorder.start(), this.isRecording = !0, this.host.announceMsg("Recording started"), this.host.setButtonsDisabled(!0), this.showRecordingIndicator(), document.addEventListener("keydown", this.host.boundKeyDown);
|
|
2064
|
-
} catch (e) {
|
|
2065
|
-
e instanceof Error && /current tab|cannot blur/i.test(e.message) && this.host.announceMsg(e.message), this.cleanupRecording();
|
|
2066
|
-
}
|
|
1771
|
+
function jo(o) {
|
|
1772
|
+
let t = o;
|
|
1773
|
+
for (; t; ) {
|
|
1774
|
+
if (t.hasAttribute("hidden")) return !0;
|
|
1775
|
+
const e = t.style;
|
|
1776
|
+
if (e && (e.display === "none" || e.visibility === "hidden" || e.visibility === "collapse"))
|
|
1777
|
+
return !0;
|
|
1778
|
+
t = t.parentElement;
|
|
2067
1779
|
}
|
|
2068
|
-
|
|
1780
|
+
return !1;
|
|
1781
|
+
}
|
|
1782
|
+
function X(o) {
|
|
1783
|
+
return Array.from(
|
|
1784
|
+
o.querySelectorAll(No)
|
|
1785
|
+
).filter((e) => !(e.getAttribute("tabindex") === "-1" || e instanceof HTMLInputElement && e.type === "hidden" || e instanceof HTMLAnchorElement && !e.getAttribute("href") || Uo(e) || jo(e)));
|
|
1786
|
+
}
|
|
1787
|
+
function Vt(o) {
|
|
1788
|
+
let t = o.activeElement;
|
|
1789
|
+
for (; t && t.shadowRoot && t.shadowRoot.activeElement; )
|
|
1790
|
+
t = t.shadowRoot.activeElement;
|
|
1791
|
+
return t instanceof HTMLElement ? t : null;
|
|
1792
|
+
}
|
|
1793
|
+
function Nt(o) {
|
|
1794
|
+
const t = o.ownerDocument || document;
|
|
1795
|
+
let e = !1;
|
|
1796
|
+
const i = (a) => {
|
|
1797
|
+
if (a.key !== "Tab") return;
|
|
1798
|
+
const s = X(o);
|
|
1799
|
+
if (s.length === 0) {
|
|
1800
|
+
a.preventDefault(), o.focus();
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
const d = s[0], c = s[s.length - 1], l = Vt(t), r = l ? s.indexOf(l) !== -1 : !1;
|
|
1804
|
+
a.shiftKey ? (!r || l === d) && (a.preventDefault(), c.focus()) : (!r || l === c) && (a.preventDefault(), d.focus());
|
|
1805
|
+
};
|
|
1806
|
+
o.addEventListener("keydown", i);
|
|
1807
|
+
const n = X(o);
|
|
1808
|
+
return n.length > 0 ? n[0].focus() : (o.hasAttribute("tabindex") || (o.setAttribute("tabindex", "-1"), e = !0), o.focus()), {
|
|
1809
|
+
release() {
|
|
1810
|
+
o.removeEventListener("keydown", i), e && (o.removeAttribute("tabindex"), e = !1);
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
function Ut() {
|
|
1815
|
+
return Vt(document);
|
|
1816
|
+
}
|
|
1817
|
+
function jt(o) {
|
|
1818
|
+
if (!(!o || typeof o.focus != "function"))
|
|
2069
1819
|
try {
|
|
2070
|
-
|
|
1820
|
+
o.focus();
|
|
2071
1821
|
} catch {
|
|
2072
|
-
this.recordedBlob = null;
|
|
2073
1822
|
}
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
if (
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
"div",
|
|
2087
|
-
{ class: "qaid-redact-picker", style: "position:fixed;inset:0;pointer-events:none;" },
|
|
2088
|
-
e,
|
|
2089
|
-
// Control bar — the only pointer-interactive part of the overlay.
|
|
2090
|
-
p(
|
|
2091
|
-
"div",
|
|
2092
|
-
{
|
|
2093
|
-
style: "position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:12px;align-items:center;pointer-events:auto;background:#0b1220;color:#fff;border:1px solid #ff6b6b;border-radius:9999px;padding:10px 16px;font:600 13px system-ui,sans-serif;box-shadow:0 8px 30px rgba(0,0,0,.5);"
|
|
2094
|
-
},
|
|
2095
|
-
p("span", {
|
|
2096
|
-
text: "Click sensitive areas to blur",
|
|
2097
|
-
attrs: { "data-qaid-redact-label": "" }
|
|
2098
|
-
}),
|
|
2099
|
-
p("button", {
|
|
2100
|
-
text: "Start recording",
|
|
2101
|
-
attrs: { type: "button" },
|
|
2102
|
-
style: "cursor:pointer;border:0;border-radius:9999px;padding:8px 14px;background:#ff6b6b;color:#0b1220;font:inherit;",
|
|
2103
|
-
on: { click: () => this.finishRedactionPicking(!0) }
|
|
2104
|
-
}),
|
|
2105
|
-
p("button", {
|
|
2106
|
-
text: "Cancel",
|
|
2107
|
-
attrs: { type: "button" },
|
|
2108
|
-
style: "cursor:pointer;border:0;background:transparent;color:#9fb3c8;font:inherit;",
|
|
2109
|
-
on: { click: () => this.finishRedactionPicking(!1) }
|
|
2110
|
-
})
|
|
2111
|
-
)
|
|
2112
|
-
);
|
|
2113
|
-
t.appendChild(o), this.redactPickerRoot = o;
|
|
2114
|
-
const n = () => {
|
|
2115
|
-
this.renderRedactPicks(e), this.redactRafId = requestAnimationFrame(n);
|
|
2116
|
-
};
|
|
2117
|
-
n(), document.addEventListener("click", this.boundRedactClick, !0), document.addEventListener("keydown", this.host.boundKeyDown), this.host.announceMsg("Click sensitive areas to blur, then start recording");
|
|
2118
|
-
}
|
|
2119
|
-
handleRedactPickClick(t) {
|
|
2120
|
-
const e = t.target instanceof Element ? t.target : null;
|
|
2121
|
-
if (!e || R(e) || this.redactPickerRoot?.contains(e)) return;
|
|
2122
|
-
t.preventDefault(), t.stopPropagation();
|
|
2123
|
-
const o = this.redactPicks.indexOf(e);
|
|
2124
|
-
o >= 0 ? this.redactPicks.splice(o, 1) : this.redactPicks.push(e);
|
|
2125
|
-
const n = this.redactPickerRoot?.querySelector("[data-qaid-redact-label]");
|
|
2126
|
-
if (n) {
|
|
2127
|
-
const s = this.redactPicks.length;
|
|
2128
|
-
n.textContent = s === 0 ? "Click sensitive areas to blur" : `${s} area${s === 1 ? "" : "s"} will be blurred`;
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
renderRedactPicks(t) {
|
|
2132
|
-
t.textContent = "";
|
|
2133
|
-
for (const e of this.redactPicks) {
|
|
2134
|
-
const o = e.getBoundingClientRect();
|
|
2135
|
-
o.width <= 0 || o.height <= 0 || t.appendChild(
|
|
2136
|
-
p("div", {
|
|
2137
|
-
style: `position:fixed;left:${o.left}px;top:${o.top}px;width:${o.width}px;height:${o.height}px;border:2px solid #ff6b6b;border-radius:4px;background:rgba(255,107,107,.18);pointer-events:none;`
|
|
2138
|
-
})
|
|
2139
|
-
);
|
|
1823
|
+
}
|
|
1824
|
+
function Kt(o, t = {}) {
|
|
1825
|
+
o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), t.labelledbyId && o.setAttribute("aria-labelledby", t.labelledbyId), t.describedbyId && o.setAttribute("aria-describedby", t.describedbyId), t.label && o.setAttribute("aria-label", t.label);
|
|
1826
|
+
}
|
|
1827
|
+
function Ko(o, t) {
|
|
1828
|
+
let e = o;
|
|
1829
|
+
for (; e && e !== t; ) {
|
|
1830
|
+
const i = e.parentNode;
|
|
1831
|
+
if (i === t) return e;
|
|
1832
|
+
if (i && i.host) {
|
|
1833
|
+
e = i.host;
|
|
1834
|
+
continue;
|
|
2140
1835
|
}
|
|
1836
|
+
if (!i) return null;
|
|
1837
|
+
e = i;
|
|
2141
1838
|
}
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
p("button", {
|
|
2158
|
-
class: "qaid-recording-stop",
|
|
2159
|
-
text: "Stop",
|
|
2160
|
-
attrs: { type: "button" },
|
|
2161
|
-
on: { click: () => this.stopRecording() }
|
|
2162
|
-
})
|
|
2163
|
-
), this.host.applyVars(this.recordingIndicator), t.appendChild(this.recordingIndicator);
|
|
2164
|
-
}
|
|
2165
|
-
updateRecordingTimer(t) {
|
|
2166
|
-
if (!this.recordingIndicator) return;
|
|
2167
|
-
const e = this.recordingIndicator.querySelector(".qaid-recording-time");
|
|
2168
|
-
if (e) {
|
|
2169
|
-
const o = Math.max(0, this.host.config.videoOptions.maxDuration - t);
|
|
2170
|
-
e.textContent = this.formatTime(o), o > 0 && o <= 5 && this.host.announceMsg(`${o} second${o === 1 ? "" : "s"} remaining`);
|
|
1839
|
+
return null;
|
|
1840
|
+
}
|
|
1841
|
+
function Wt(o) {
|
|
1842
|
+
const e = (o.ownerDocument || document).body;
|
|
1843
|
+
if (!e) return () => {
|
|
1844
|
+
};
|
|
1845
|
+
const i = Ko(o, e), n = [];
|
|
1846
|
+
return Array.from(e.children).forEach((a) => {
|
|
1847
|
+
if (!(a instanceof HTMLElement) || i && a === i) return;
|
|
1848
|
+
const s = a.inert === !0, d = a.getAttribute("aria-hidden");
|
|
1849
|
+
s && d === "true" || (a.inert = !0, a.setAttribute("aria-hidden", "true"), n.push({ el: a, prevInert: s, prevAriaHidden: d }));
|
|
1850
|
+
}), function() {
|
|
1851
|
+
for (; n.length; ) {
|
|
1852
|
+
const s = n.pop();
|
|
1853
|
+
s.el.inert = s.prevInert, s.prevAriaHidden === null ? s.el.removeAttribute("aria-hidden") : s.el.setAttribute("aria-hidden", s.prevAriaHidden);
|
|
2171
1854
|
}
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
function Wo(o, t) {
|
|
1858
|
+
const e = Ut();
|
|
1859
|
+
Kt(o, t);
|
|
1860
|
+
const i = Nt(o), n = Wt(o);
|
|
1861
|
+
return () => {
|
|
1862
|
+
i.release(), n(), jt(e);
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1866
|
+
__proto__: null,
|
|
1867
|
+
applyDialog: Kt,
|
|
1868
|
+
createFocusTrap: Nt,
|
|
1869
|
+
getFocusable: X,
|
|
1870
|
+
openDialog: Wo,
|
|
1871
|
+
restoreFocus: jt,
|
|
1872
|
+
saveFocus: Ut,
|
|
1873
|
+
setBackgroundInert: Wt
|
|
1874
|
+
}, Symbol.toStringTag, { value: "Module" })), Qt = (o) => (
|
|
1875
|
+
// The URL is a runtime value, not a static specifier — keep Vite from
|
|
1876
|
+
// trying to analyze/bundle it.
|
|
1877
|
+
import(
|
|
1878
|
+
/* @vite-ignore */
|
|
1879
|
+
o
|
|
1880
|
+
)
|
|
1881
|
+
);
|
|
1882
|
+
let Xt = Qt, A = null, B = null;
|
|
1883
|
+
const $ = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map();
|
|
1884
|
+
function Qo(o) {
|
|
1885
|
+
Xt = o ?? Qt, A = null, B = null, $.clear(), H.clear();
|
|
1886
|
+
}
|
|
1887
|
+
function Yt(o, t) {
|
|
1888
|
+
return `${o.replace(/\/+$/, "")}/${encodeURIComponent(t)}/definition`;
|
|
1889
|
+
}
|
|
1890
|
+
function Xo(o) {
|
|
1891
|
+
if ($.has(o)) return Promise.resolve();
|
|
1892
|
+
const t = H.get(o);
|
|
1893
|
+
if (t) return t;
|
|
1894
|
+
const e = fetch(o, { headers: { Accept: "application/json" } }).then((i) => i.ok ? i.json() : null).then((i) => {
|
|
1895
|
+
i && $.set(o, i);
|
|
1896
|
+
}).catch(() => {
|
|
1897
|
+
}).finally(() => {
|
|
1898
|
+
H.delete(o);
|
|
1899
|
+
});
|
|
1900
|
+
return H.set(o, e), e;
|
|
1901
|
+
}
|
|
1902
|
+
function Jt(o) {
|
|
1903
|
+
return A && B === o || (B = o, A = Promise.resolve(Xt(o)).then((t) => {
|
|
1904
|
+
const e = t;
|
|
1905
|
+
if (!e || typeof e.QaidQuests != "function")
|
|
1906
|
+
throw new Error("quests module has no QaidQuests export");
|
|
1907
|
+
return e;
|
|
1908
|
+
}).catch((t) => {
|
|
1909
|
+
throw A = null, B = null, t;
|
|
1910
|
+
})), A;
|
|
1911
|
+
}
|
|
1912
|
+
async function Gt(o) {
|
|
1913
|
+
const t = await Jt(o.moduleUrl), e = o.base.replace(/\/+$/, ""), i = Yt(e, o.questId), n = (d) => d != null ? { feedbackId: d } : void 0;
|
|
1914
|
+
let a;
|
|
1915
|
+
const s = o.feedbackId;
|
|
1916
|
+
return s instanceof Promise ? a = t.QaidQuests.supports?.asyncMetadata ? s.then(n, () => {
|
|
1917
|
+
}) : n(await s.catch(() => null)) : a = n(s ?? null), new t.QaidQuests({
|
|
1918
|
+
endpoint: `${e}/responses`,
|
|
1919
|
+
configUrl: i,
|
|
1920
|
+
// Only a definition already in hand. One still loading is left to the
|
|
1921
|
+
// widget, which shows its own loading state instead of nothing.
|
|
1922
|
+
questionnaire: $.get(i),
|
|
1923
|
+
apiKey: o.apiKey || void 0,
|
|
1924
|
+
metadata: a,
|
|
1925
|
+
onClose: o.onClose
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
const Yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1929
|
+
__proto__: null,
|
|
1930
|
+
DEFAULT_QUESTS_MODULE_URL: Lt,
|
|
1931
|
+
_setQuestsImporter: Qo,
|
|
1932
|
+
launchQuest: Gt,
|
|
1933
|
+
loadQuestsModule: Jt,
|
|
1934
|
+
prefetchQuestDefinition: Xo,
|
|
1935
|
+
questDefinitionUrl: Yt
|
|
1936
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1937
|
+
async function Zt(o, t) {
|
|
1938
|
+
const e = o.ensureOverlayHost(), i = o.overlayShadowHost, n = i.style.pointerEvents;
|
|
1939
|
+
i.style.pointerEvents = "auto";
|
|
1940
|
+
try {
|
|
1941
|
+
const { openAnnotationEditor: a, styles: s } = await Promise.resolve().then(() => Ft);
|
|
1942
|
+
return o.addFeatureStyles(s), await a({
|
|
1943
|
+
dataUrl: t,
|
|
1944
|
+
root: e,
|
|
1945
|
+
quality: o.config.screenshotOptions.quality,
|
|
1946
|
+
color: o.config.annotationColor,
|
|
1947
|
+
palette: o.config.annotationPalette,
|
|
1948
|
+
applyVars: (d) => o.applyVars(d),
|
|
1949
|
+
announce: (d, c) => o.announceMsg(d, c),
|
|
1950
|
+
openDialog: (d, c) => o.openDialogA11y(d, c),
|
|
1951
|
+
closeDialog: () => o.closeDialogA11y()
|
|
1952
|
+
});
|
|
1953
|
+
} catch (a) {
|
|
1954
|
+
return console.error("Annotation editor failed to open:", a), null;
|
|
1955
|
+
} finally {
|
|
1956
|
+
i.style.pointerEvents = n;
|
|
2172
1957
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
placeholder: "Optional: Describe the issue you recorded...",
|
|
2186
|
-
"aria-label": "Describe the issue you recorded"
|
|
1958
|
+
}
|
|
1959
|
+
async function Jo(o) {
|
|
1960
|
+
const { config: t, feedbackData: e, selectedBounds: i } = o;
|
|
1961
|
+
let n = null;
|
|
1962
|
+
if (t.captureScreenshot || t.feedbackMode === "annotate")
|
|
1963
|
+
try {
|
|
1964
|
+
if (o.shouldCaptureViaDom()) {
|
|
1965
|
+
const { captureDomScreenshot: r } = await Promise.resolve().then(() => Ot);
|
|
1966
|
+
n = await r(t.screenshotOptions);
|
|
1967
|
+
} else {
|
|
1968
|
+
const { captureScreenshot: r } = await Promise.resolve().then(() => ne);
|
|
1969
|
+
n = await r(t.screenshotOptions);
|
|
2187
1970
|
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
attrs: { type: "button" },
|
|
2192
|
-
on: { click: () => this.submitVideoFeedback(a.value.trim() || null, c) }
|
|
2193
|
-
}), l = p(
|
|
2194
|
-
"div",
|
|
2195
|
-
{ class: "qaid-video-preview-box" },
|
|
2196
|
-
n,
|
|
2197
|
-
s,
|
|
2198
|
-
a,
|
|
2199
|
-
p(
|
|
2200
|
-
"div",
|
|
2201
|
-
{ class: "qaid-video-preview-actions" },
|
|
2202
|
-
p("button", {
|
|
2203
|
-
class: "qaid-video-btn qaid-video-btn-cancel",
|
|
2204
|
-
text: "Cancel",
|
|
2205
|
-
attrs: { type: "button" },
|
|
2206
|
-
on: { click: () => this.cancelRecordingPreview() }
|
|
2207
|
-
}),
|
|
2208
|
-
p("button", {
|
|
2209
|
-
class: "qaid-video-btn qaid-video-btn-rerecord",
|
|
2210
|
-
text: "Re-record",
|
|
2211
|
-
attrs: { type: "button" },
|
|
2212
|
-
on: {
|
|
2213
|
-
click: () => {
|
|
2214
|
-
this.cancelRecordingPreview(), this.startRecording();
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
}),
|
|
2218
|
-
c
|
|
2219
|
-
)
|
|
2220
|
-
);
|
|
2221
|
-
this.videoPreview = p(
|
|
2222
|
-
"div",
|
|
2223
|
-
{ class: "qaid-video-preview", style: `z-index:${this.host.config.zIndex + 100}` },
|
|
2224
|
-
l
|
|
2225
|
-
), this.host.applyVars(this.videoPreview), this.host.overlayShadowHost && (this.host.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.videoPreview), this.host.openDialogA11y(l, { labelledbyId: n.id }), document.addEventListener("keydown", this.host.boundKeyDown);
|
|
2226
|
-
}
|
|
2227
|
-
cancelRecordingPreview() {
|
|
2228
|
-
this.removeVideoPreview(), this.cleanupRecording();
|
|
2229
|
-
}
|
|
2230
|
-
removeVideoPreview() {
|
|
2231
|
-
if (this.host.closeDialogA11y(), this.videoPreview) {
|
|
2232
|
-
const t = this.videoPreview.querySelector("video");
|
|
2233
|
-
t?.src && URL.revokeObjectURL(t.src), this.videoPreview.remove(), this.videoPreview = null;
|
|
1971
|
+
n && o.announceMsg("Screenshot captured");
|
|
1972
|
+
} catch (r) {
|
|
1973
|
+
console.error("Screenshot capture failed:", r), n = null;
|
|
2234
1974
|
}
|
|
2235
|
-
|
|
1975
|
+
n && t.annotate && (n = await Zt(o, n) ?? n);
|
|
1976
|
+
const s = e.elementSelector ? {
|
|
1977
|
+
x: i.x,
|
|
1978
|
+
y: i.y,
|
|
1979
|
+
width: i.width,
|
|
1980
|
+
height: i.height
|
|
1981
|
+
} : null, d = {
|
|
1982
|
+
feedbackType: e.feedbackType,
|
|
1983
|
+
pageUrl: window.location.href,
|
|
1984
|
+
apiKey: t.apiKey || void 0,
|
|
1985
|
+
elementSelector: e.elementSelector,
|
|
1986
|
+
elementText: e.elementText,
|
|
1987
|
+
consoleErrors: [...e.consoleErrors],
|
|
1988
|
+
screenWidth: window.innerWidth,
|
|
1989
|
+
screenHeight: window.innerHeight,
|
|
1990
|
+
clickX: i.clickX,
|
|
1991
|
+
clickY: i.clickY,
|
|
1992
|
+
scrollX: window.scrollX,
|
|
1993
|
+
scrollY: window.scrollY,
|
|
1994
|
+
screenshot: n,
|
|
1995
|
+
visitorId: o.visitorId,
|
|
1996
|
+
// Include element bounds and user agent for server-side screenshot fallback
|
|
1997
|
+
elementBounds: s,
|
|
1998
|
+
userAgent: navigator.userAgent
|
|
1999
|
+
}, c = Go(o, d);
|
|
2000
|
+
o.setFeedbackId(c);
|
|
2001
|
+
const l = e.feedbackType;
|
|
2002
|
+
if (l && l !== "neutral" && await te(o, l, c)) {
|
|
2003
|
+
o.resetFeedbackUi();
|
|
2004
|
+
return;
|
|
2236
2005
|
}
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
const a = await fetch(`${this.host.config.endpoint}/video`, {
|
|
2245
|
-
method: "POST",
|
|
2246
|
-
body: o
|
|
2247
|
-
});
|
|
2248
|
-
if (a.ok) {
|
|
2249
|
-
this.host.announceMsg("Recording sent");
|
|
2250
|
-
try {
|
|
2251
|
-
n = (await a.json())?.id ?? null;
|
|
2252
|
-
} catch {
|
|
2253
|
-
}
|
|
2254
|
-
} else
|
|
2255
|
-
console.error("Failed to submit video feedback:", await a.text()), s = a.status === 413 ? "This recording is too large to send. Try a shorter one." : "Your recording could not be sent.";
|
|
2256
|
-
} catch (a) {
|
|
2257
|
-
console.error("Failed to submit video feedback:", a), s = "Your recording could not be sent. Check your connection and try again.";
|
|
2258
|
-
}
|
|
2259
|
-
if (this.isSendingVideo = !1, s) {
|
|
2260
|
-
this.showSendError(s, e);
|
|
2261
|
-
return;
|
|
2262
|
-
}
|
|
2263
|
-
this.removeVideoPreview(), this.cleanupRecording(), await this.host.tryLaunchQuest("video", n);
|
|
2006
|
+
o.setState("MODAL_OPEN");
|
|
2007
|
+
try {
|
|
2008
|
+
const r = await o.ensureModal();
|
|
2009
|
+
if (o.destroyed) return;
|
|
2010
|
+
r.open(), o.overlayShadowHost && (o.overlayShadowHost.style.pointerEvents = "auto");
|
|
2011
|
+
} catch (r) {
|
|
2012
|
+
console.error("Failed to open the feedback modal:", r), o.announceMsg("Thank you for your feedback!", !0), o.resetFeedbackUi();
|
|
2264
2013
|
}
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
if (
|
|
2274
|
-
|
|
2275
|
-
|
|
2014
|
+
}
|
|
2015
|
+
async function Go(o, t) {
|
|
2016
|
+
try {
|
|
2017
|
+
const e = await fetch(o.config.endpoint, {
|
|
2018
|
+
method: "POST",
|
|
2019
|
+
headers: { "Content-Type": "application/json" },
|
|
2020
|
+
body: JSON.stringify(t)
|
|
2021
|
+
});
|
|
2022
|
+
if (e.ok) {
|
|
2023
|
+
const i = await e.json();
|
|
2024
|
+
return o.announceMsg("Feedback sent"), i.id;
|
|
2276
2025
|
}
|
|
2026
|
+
} catch (e) {
|
|
2027
|
+
console.error("Failed to submit feedback:", e), o.announceMsg("Failed to send feedback", !0);
|
|
2277
2028
|
}
|
|
2278
|
-
|
|
2279
|
-
this.isRecording = !1, this.removeRecordingIndicator(), this.videoRecorder && (this.videoRecorder.destroy(), this.videoRecorder = null), this.networkCapture && (this.networkCapture.restore(), this.networkCapture = null), this.recordedBlob && (this.recordedBlob = null), this.host.setButtonsDisabled(!1), this.host.overlayShadowHost && this.host.state === "IDLE" && (this.host.overlayShadowHost.style.pointerEvents = "none");
|
|
2280
|
-
}
|
|
2029
|
+
return null;
|
|
2281
2030
|
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
styles: Ji
|
|
2286
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2287
|
-
async function Gi(i = {}) {
|
|
2288
|
-
const { quality: t = 0.8, maxWidth: e = 1280, maxHeight: o = 800 } = i;
|
|
2031
|
+
async function te(o, t, e) {
|
|
2032
|
+
const i = o.config.quests, n = i.base && i[t] || "";
|
|
2033
|
+
if (!n) return !1;
|
|
2289
2034
|
try {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2035
|
+
return o.activeQuest?.destroy(), o.activeQuest = await Gt({
|
|
2036
|
+
questId: n,
|
|
2037
|
+
base: i.base,
|
|
2038
|
+
apiKey: i.apiKey || void 0,
|
|
2039
|
+
moduleUrl: i.moduleUrl,
|
|
2040
|
+
feedbackId: e,
|
|
2041
|
+
onClose: () => {
|
|
2042
|
+
o.activeQuest = null;
|
|
2296
2043
|
}
|
|
2297
|
-
}),
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
c.play(), g();
|
|
2301
|
-
};
|
|
2302
|
-
}), await new Promise((g) => {
|
|
2303
|
-
const w = () => {
|
|
2304
|
-
c.readyState >= 2 ? g() : requestAnimationFrame(w);
|
|
2305
|
-
};
|
|
2306
|
-
w();
|
|
2307
|
-
}), await new Promise((g) => setTimeout(g, 100));
|
|
2308
|
-
const l = a.width || c.videoWidth, d = a.height || c.videoHeight, r = Math.min(e / l, o / d, 1), h = Math.round(l * r), f = Math.round(d * r), b = document.createElement("canvas");
|
|
2309
|
-
b.width = h, b.height = f;
|
|
2310
|
-
const y = b.getContext("2d");
|
|
2311
|
-
return y ? (y.drawImage(c, 0, 0, h, f), s.stop(), b.toDataURL("image/webp", t)) : (s.stop(), null);
|
|
2312
|
-
} catch (n) {
|
|
2313
|
-
return console.warn("Screenshot capture failed:", n), null;
|
|
2044
|
+
}), !0;
|
|
2045
|
+
} catch (a) {
|
|
2046
|
+
return console.error("Failed to launch quest:", a), o.activeQuest = null, !1;
|
|
2314
2047
|
}
|
|
2315
2048
|
}
|
|
2316
|
-
const
|
|
2049
|
+
const U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2317
2050
|
__proto__: null,
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2051
|
+
openAnnotationEditor: Zt,
|
|
2052
|
+
submitFeedback: Jo,
|
|
2053
|
+
tryLaunchQuest: te
|
|
2054
|
+
}, Symbol.toStringTag, { value: "Module" })), ee = {
|
|
2055
|
+
width: 400,
|
|
2056
|
+
height: 280,
|
|
2057
|
+
arrowHeight: 12,
|
|
2058
|
+
gap: 8,
|
|
2059
|
+
viewportPadding: 16
|
|
2060
|
+
};
|
|
2061
|
+
function Zo(o, t, e, i, n) {
|
|
2062
|
+
const a = o.y, s = t - (o.y + o.height);
|
|
2063
|
+
if (s >= e + i)
|
|
2064
|
+
return {
|
|
2065
|
+
top: o.y + o.height + i,
|
|
2066
|
+
position: "below"
|
|
2067
|
+
};
|
|
2068
|
+
if (a >= e + i)
|
|
2069
|
+
return {
|
|
2070
|
+
top: o.y - e - i,
|
|
2071
|
+
position: "above"
|
|
2072
|
+
};
|
|
2073
|
+
const d = s > a ? "below" : "above";
|
|
2074
|
+
let c;
|
|
2075
|
+
return d === "below" ? c = Math.min(
|
|
2076
|
+
o.y + o.height + i,
|
|
2077
|
+
t - e - n
|
|
2078
|
+
) : c = Math.max(n, o.y - e - i), { top: c, position: d };
|
|
2079
|
+
}
|
|
2080
|
+
function ti(o, t, e, i) {
|
|
2081
|
+
let a = o.x + o.width / 2 - e / 2;
|
|
2082
|
+
return a = Math.max(i, Math.min(a, t - e - i)), a;
|
|
2083
|
+
}
|
|
2084
|
+
function ei(o, t, e, i = 24, n = 24) {
|
|
2085
|
+
const s = o.clickX - t - n / 2;
|
|
2086
|
+
return Math.max(i, Math.min(s, e - i - n / 2));
|
|
2087
|
+
}
|
|
2088
|
+
function oi(o, t, e, i = ee) {
|
|
2089
|
+
const n = i.height + i.arrowHeight, a = Zo(
|
|
2090
|
+
o,
|
|
2091
|
+
e,
|
|
2092
|
+
n,
|
|
2093
|
+
i.gap,
|
|
2094
|
+
i.viewportPadding
|
|
2095
|
+
), s = ti(
|
|
2096
|
+
o,
|
|
2097
|
+
t,
|
|
2098
|
+
i.width,
|
|
2099
|
+
i.viewportPadding
|
|
2100
|
+
);
|
|
2101
|
+
return {
|
|
2102
|
+
top: a.top,
|
|
2103
|
+
left: s,
|
|
2104
|
+
position: a.position
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
function ii(o, t, e, i = ee) {
|
|
2108
|
+
const n = oi(o, t, e, i), a = ei(
|
|
2109
|
+
o,
|
|
2110
|
+
n.left,
|
|
2111
|
+
i.width
|
|
2112
|
+
);
|
|
2113
|
+
return {
|
|
2114
|
+
modal: n,
|
|
2115
|
+
arrow: { left: a }
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
const ni = document;
|
|
2119
|
+
function p(o, t, ...e) {
|
|
2120
|
+
const i = ni.createElement(o);
|
|
2121
|
+
if (t) {
|
|
2122
|
+
if (t.class && (i.className = t.class), t.style && (i.style.cssText = t.style), t.html != null && (i.innerHTML = t.html), t.text != null && (i.textContent = t.text), t.attrs)
|
|
2123
|
+
for (const n in t.attrs) i.setAttribute(n, t.attrs[n]);
|
|
2124
|
+
if (t.on)
|
|
2125
|
+
for (const n in t.on) i.addEventListener(n, t.on[n]);
|
|
2126
|
+
}
|
|
2127
|
+
for (const n of e)
|
|
2128
|
+
n != null && n !== !1 && i.append(n);
|
|
2129
|
+
return i;
|
|
2130
|
+
}
|
|
2131
|
+
const ai = ".qaid-backdrop{position:fixed;inset:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-type-static{width:2.5rem;height:2.5rem;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--qaid-marker, #6365f1);color:var(--qaid-marker-text, white)}.qaid-type-static svg{width:1.25rem;height:1.25rem}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:calc(var(--qaid-font-size, 16px) * 1.125);font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:calc(var(--qaid-font-size, 16px) * .875)}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:var(--qaid-font-size, 16px);resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}.qaid-confirm{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.5rem;padding:.5rem 0}.qaid-confirm-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:9999px;color:#fff;background:var(--qaid-success, #22c55e);margin-bottom:.25rem;animation:qaid-confirm-pop .28s cubic-bezier(.34,1.56,.64,1)}.qaid-confirm-icon .qaid-icon{width:24px;height:24px}.qaid-confirm-error .qaid-confirm-icon{background:var(--qaid-error, #dc2626)}.qaid-confirm-title{margin:0;font-size:var(--qaid-font-size, 16px);font-weight:600;color:var(--qaid-text, light-dark(#111827, #f9fafb))}.qaid-confirm-title:focus-visible{outline:2px solid var(--qaid-primary, #6365f1);outline-offset:3px;border-radius:4px}.qaid-confirm-message{margin:0;font-size:calc(var(--qaid-font-size, 16px) * .875);color:var(--qaid-text-muted, light-dark(#6b7280, #9ca3af))}.qaid-confirm .qaid-confirm-close{margin-top:.5rem;min-width:96px}@keyframes qaid-confirm-pop{0%{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.qaid-confirm-icon{animation:none}}.qaid-textarea:focus-visible,button.qaid-btn-submit:focus-visible{outline:2px solid var(--qaid-marker, #6365f1);outline-offset:2px}@media(forced-colors:active){.qaid-textarea:focus,button.qaid-btn-submit:focus{outline:2px solid CanvasText;outline-offset:2px}}";
|
|
2132
|
+
class si {
|
|
2321
2133
|
constructor(t) {
|
|
2322
2134
|
this.host = t;
|
|
2323
2135
|
}
|
|
@@ -2360,7 +2172,7 @@ class to {
|
|
|
2360
2172
|
), this.host.applyVars(e), t.appendChild(e), this.modalContainer = e, this.setupModalInteractions();
|
|
2361
2173
|
}
|
|
2362
2174
|
showPositionedModal() {
|
|
2363
|
-
const t = this.host.ensureOverlayHost(), { modal: e, arrow:
|
|
2175
|
+
const t = this.host.ensureOverlayHost(), { modal: e, arrow: i } = ii(
|
|
2364
2176
|
this.host.selectedBounds,
|
|
2365
2177
|
window.innerWidth,
|
|
2366
2178
|
window.innerHeight,
|
|
@@ -2374,9 +2186,9 @@ class to {
|
|
|
2374
2186
|
);
|
|
2375
2187
|
this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${e.position}`, this.modalContainer.style.top = `${e.top}px`, this.modalContainer.style.left = `${e.left}px`, this.modalContainer.style.zIndex = String(this.host.config.zIndex + 3);
|
|
2376
2188
|
const n = document.createElement("div");
|
|
2377
|
-
n.className = "qaid-modal-arrow", n.style.left = `${
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2189
|
+
n.className = "qaid-modal-arrow", n.style.left = `${i.left}px`;
|
|
2190
|
+
const a = document.createElement("div");
|
|
2191
|
+
a.className = "qaid-modal-box", a.appendChild(this.buildModalContent()), this.modalContainer.appendChild(n), this.modalContainer.appendChild(a), this.host.applyVars(this.modalContainer), t.appendChild(this.modalContainer), this.setupModalInteractions();
|
|
2380
2192
|
}
|
|
2381
2193
|
/**
|
|
2382
2194
|
* The modal's contents, built as nodes rather than an HTML string.
|
|
@@ -2387,18 +2199,18 @@ class to {
|
|
|
2387
2199
|
* markup, because they are documented as SVG/HTML strings.
|
|
2388
2200
|
*/
|
|
2389
2201
|
buildModalContent() {
|
|
2390
|
-
const { config: t, uid: e } = this.host,
|
|
2202
|
+
const { config: t, uid: e } = this.host, i = t.text, n = this.host.feedbackData.feedbackType, a = n === "up", s = t.positiveIcon || K, d = t.negativeIcon || W, c = t.buttonClass ? `qaid-type-toggle qaid-type-toggle-custom ${t.buttonClass} ${a ? "qaid-btn-up" : "qaid-btn-down"}` : `qaid-type-toggle ${a ? "qaid-type-up" : "qaid-type-down"}`, l = a ? "Feedback type: positive" : "Feedback type: negative", r = n === "neutral" ? p("span", {
|
|
2391
2203
|
class: "qaid-type-static",
|
|
2392
|
-
html: t.feedbackIcon ||
|
|
2204
|
+
html: t.feedbackIcon || Tt,
|
|
2393
2205
|
attrs: { "aria-hidden": "true" }
|
|
2394
2206
|
}) : p("button", {
|
|
2395
|
-
class:
|
|
2396
|
-
html:
|
|
2207
|
+
class: c,
|
|
2208
|
+
html: a ? s : d,
|
|
2397
2209
|
attrs: {
|
|
2398
2210
|
type: "button",
|
|
2399
2211
|
title: "Click to switch",
|
|
2400
|
-
"aria-pressed": String(
|
|
2401
|
-
"aria-label":
|
|
2212
|
+
"aria-pressed": String(a),
|
|
2213
|
+
"aria-label": l
|
|
2402
2214
|
}
|
|
2403
2215
|
}), h = document.createDocumentFragment();
|
|
2404
2216
|
return h.append(
|
|
@@ -2411,26 +2223,26 @@ class to {
|
|
|
2411
2223
|
{ class: "qaid-modal-header-text" },
|
|
2412
2224
|
p("h3", {
|
|
2413
2225
|
class: "qaid-modal-title",
|
|
2414
|
-
text:
|
|
2226
|
+
text: i.modalTitle,
|
|
2415
2227
|
attrs: { id: `qaid-modal-title-${e}` }
|
|
2416
2228
|
}),
|
|
2417
2229
|
p("p", {
|
|
2418
2230
|
class: "qaid-modal-subtitle",
|
|
2419
|
-
text:
|
|
2231
|
+
text: i.modalSubtitle,
|
|
2420
2232
|
attrs: { id: `qaid-modal-subtitle-${e}` }
|
|
2421
2233
|
})
|
|
2422
2234
|
)
|
|
2423
2235
|
),
|
|
2424
2236
|
p("textarea", {
|
|
2425
2237
|
class: "qaid-textarea",
|
|
2426
|
-
attrs: { "aria-label":
|
|
2238
|
+
attrs: { "aria-label": i.modalSubtitle, placeholder: i.placeholder }
|
|
2427
2239
|
}),
|
|
2428
2240
|
p(
|
|
2429
2241
|
"div",
|
|
2430
2242
|
{ class: "qaid-btn-row" },
|
|
2431
2243
|
p("button", {
|
|
2432
2244
|
class: "qaid-btn-submit",
|
|
2433
|
-
text:
|
|
2245
|
+
text: i.skipButton,
|
|
2434
2246
|
attrs: { type: "button" }
|
|
2435
2247
|
})
|
|
2436
2248
|
)
|
|
@@ -2448,29 +2260,29 @@ class to {
|
|
|
2448
2260
|
const n = t?.value.trim() || null;
|
|
2449
2261
|
this.submitMessage(n);
|
|
2450
2262
|
});
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2263
|
+
const i = this.modalContainer.querySelector(".qaid-type-toggle");
|
|
2264
|
+
i && i.addEventListener("click", () => {
|
|
2453
2265
|
const n = this.host.feedbackData.feedbackType === "up" ? "down" : "up";
|
|
2454
|
-
this.host.feedbackData.feedbackType = n, this.host.config.buttonClass ? (
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
const
|
|
2458
|
-
|
|
2459
|
-
|
|
2266
|
+
this.host.feedbackData.feedbackType = n, this.host.config.buttonClass ? (i.classList.toggle("qaid-btn-up", n === "up"), i.classList.toggle("qaid-btn-down", n === "down")) : (i.classList.toggle("qaid-type-up", n === "up"), i.classList.toggle("qaid-type-down", n === "down"));
|
|
2267
|
+
const a = this.host.config.positiveIcon || K, s = this.host.config.negativeIcon || W;
|
|
2268
|
+
i.innerHTML = n === "up" ? a : s;
|
|
2269
|
+
const d = n === "up" ? "Feedback type: positive" : "Feedback type: negative";
|
|
2270
|
+
i.setAttribute("aria-pressed", String(n === "up")), i.setAttribute("aria-label", d), this.host.announceMsg(d), this.host.whenFeedbackId().then((c) => {
|
|
2271
|
+
c && fetch(`${this.host.config.endpoint}/${c}`, {
|
|
2460
2272
|
method: "PATCH",
|
|
2461
2273
|
headers: { "Content-Type": "application/json" },
|
|
2462
2274
|
body: JSON.stringify({ feedbackType: n })
|
|
2463
|
-
}).catch((
|
|
2275
|
+
}).catch((l) => console.error("Failed to update feedback type:", l));
|
|
2464
2276
|
});
|
|
2465
2277
|
});
|
|
2466
2278
|
}
|
|
2467
2279
|
async submitMessage(t) {
|
|
2468
2280
|
let e = null;
|
|
2469
2281
|
this.finalized = !0;
|
|
2470
|
-
const
|
|
2471
|
-
if (
|
|
2282
|
+
const i = await this.host.whenFeedbackId();
|
|
2283
|
+
if (i)
|
|
2472
2284
|
try {
|
|
2473
|
-
const n = await fetch(`${this.host.config.endpoint}/${
|
|
2285
|
+
const n = await fetch(`${this.host.config.endpoint}/${i}`, {
|
|
2474
2286
|
method: "PATCH",
|
|
2475
2287
|
headers: { "Content-Type": "application/json" },
|
|
2476
2288
|
body: JSON.stringify({ message: t })
|
|
@@ -2504,7 +2316,7 @@ class to {
|
|
|
2504
2316
|
this.close();
|
|
2505
2317
|
return;
|
|
2506
2318
|
}
|
|
2507
|
-
const
|
|
2319
|
+
const i = this.host.config.text, n = t ? i.confirmationTitle : i.errorTitle, a = t ? i.confirmationMessage : i.errorMessage, s = p("h3", {
|
|
2508
2320
|
class: "qaid-confirm-title",
|
|
2509
2321
|
text: n,
|
|
2510
2322
|
attrs: { id: `qaid-confirm-title-${this.host.uid}`, tabindex: "-1" }
|
|
@@ -2515,69 +2327,69 @@ class to {
|
|
|
2515
2327
|
{ class: t ? "qaid-confirm" : "qaid-confirm qaid-confirm-error" },
|
|
2516
2328
|
p("span", {
|
|
2517
2329
|
class: "qaid-confirm-icon",
|
|
2518
|
-
html: t ?
|
|
2330
|
+
html: t ? At : Ie,
|
|
2519
2331
|
attrs: { "aria-hidden": "true" }
|
|
2520
2332
|
}),
|
|
2521
|
-
|
|
2522
|
-
p("p", { class: "qaid-confirm-message", text:
|
|
2333
|
+
s,
|
|
2334
|
+
p("p", { class: "qaid-confirm-message", text: a }),
|
|
2523
2335
|
p("button", {
|
|
2524
2336
|
class: "qaid-btn-submit qaid-confirm-close",
|
|
2525
|
-
text:
|
|
2337
|
+
text: i.confirmationClose,
|
|
2526
2338
|
attrs: { type: "button" },
|
|
2527
2339
|
on: { click: () => this.close() }
|
|
2528
2340
|
})
|
|
2529
2341
|
)
|
|
2530
|
-
), requestAnimationFrame(() =>
|
|
2342
|
+
), requestAnimationFrame(() => s.focus()), this.host.announceMsg(`${n} ${a}`, !0);
|
|
2531
2343
|
}
|
|
2532
2344
|
}
|
|
2533
|
-
const
|
|
2345
|
+
const ri = ai, Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2534
2346
|
__proto__: null,
|
|
2535
|
-
ModalController:
|
|
2536
|
-
styles:
|
|
2537
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2538
|
-
function
|
|
2539
|
-
let e =
|
|
2347
|
+
ModalController: si,
|
|
2348
|
+
styles: ri
|
|
2349
|
+
}, Symbol.toStringTag, { value: "Module" })), oe = ["data-comp", "data-qa", "data-testid", "data-id"];
|
|
2350
|
+
function ie(o, t = document.body) {
|
|
2351
|
+
let e = o;
|
|
2540
2352
|
for (; e && e !== t; ) {
|
|
2541
|
-
for (const
|
|
2542
|
-
const n = e.getAttribute(
|
|
2353
|
+
for (const i of oe) {
|
|
2354
|
+
const n = e.getAttribute(i);
|
|
2543
2355
|
if (n)
|
|
2544
|
-
return `${
|
|
2356
|
+
return `${i}="${n}"`;
|
|
2545
2357
|
}
|
|
2546
2358
|
e = e.parentElement;
|
|
2547
2359
|
}
|
|
2548
2360
|
return null;
|
|
2549
2361
|
}
|
|
2550
|
-
function
|
|
2551
|
-
const e =
|
|
2362
|
+
function di(o, t = 100) {
|
|
2363
|
+
const e = o.textContent?.trim().slice(0, t) || "";
|
|
2552
2364
|
return e.length === t ? e + "..." : e;
|
|
2553
2365
|
}
|
|
2554
|
-
function
|
|
2555
|
-
let t = 1, e =
|
|
2366
|
+
function ci(o) {
|
|
2367
|
+
let t = 1, e = o.previousElementSibling;
|
|
2556
2368
|
for (; e; )
|
|
2557
2369
|
t++, e = e.previousElementSibling;
|
|
2558
2370
|
return t;
|
|
2559
2371
|
}
|
|
2560
|
-
function
|
|
2372
|
+
function li(o) {
|
|
2561
2373
|
const t = [];
|
|
2562
|
-
let e =
|
|
2374
|
+
let e = o;
|
|
2563
2375
|
for (; e && e !== document.body && e !== document.documentElement; ) {
|
|
2564
|
-
const
|
|
2565
|
-
t.unshift(`${
|
|
2376
|
+
const i = e.tagName.toLowerCase(), n = ci(e);
|
|
2377
|
+
t.unshift(`${i}:nth-child(${n})`), e = e.parentElement;
|
|
2566
2378
|
}
|
|
2567
2379
|
return t.length > 0 ? `body > ${t.join(" > ")}` : "body";
|
|
2568
2380
|
}
|
|
2569
|
-
function
|
|
2570
|
-
return
|
|
2381
|
+
function hi(o) {
|
|
2382
|
+
return o.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
|
|
2571
2383
|
}
|
|
2572
|
-
function
|
|
2573
|
-
const t =
|
|
2574
|
-
return t ? `[${t}]` :
|
|
2384
|
+
function ui(o) {
|
|
2385
|
+
const t = ie(o);
|
|
2386
|
+
return t ? `[${t}]` : o.id ? `#${hi(o.id)}` : li(o);
|
|
2575
2387
|
}
|
|
2576
|
-
function
|
|
2577
|
-
const t =
|
|
2578
|
-
return { selector:
|
|
2388
|
+
function j(o) {
|
|
2389
|
+
const t = di(o), e = ie(o);
|
|
2390
|
+
return { selector: ui(o), text: t, dataAttr: e };
|
|
2579
2391
|
}
|
|
2580
|
-
const
|
|
2392
|
+
const pi = [
|
|
2581
2393
|
"a[href]",
|
|
2582
2394
|
"button",
|
|
2583
2395
|
"input:not([type=hidden])",
|
|
@@ -2596,79 +2408,79 @@ const ro = [
|
|
|
2596
2408
|
"p",
|
|
2597
2409
|
"li",
|
|
2598
2410
|
"label",
|
|
2599
|
-
...
|
|
2600
|
-
].join(","),
|
|
2601
|
-
function
|
|
2602
|
-
if (
|
|
2603
|
-
const t =
|
|
2411
|
+
...oe.map((o) => `[${o}]`)
|
|
2412
|
+
].join(","), fi = /^(?:A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/;
|
|
2413
|
+
function mi(o) {
|
|
2414
|
+
if (o.hasAttribute("hidden") || o.getAttribute("aria-hidden") === "true") return !1;
|
|
2415
|
+
const t = o.ownerDocument?.defaultView;
|
|
2604
2416
|
if (t && typeof t.getComputedStyle == "function") {
|
|
2605
|
-
const e = t.getComputedStyle(
|
|
2417
|
+
const e = t.getComputedStyle(o);
|
|
2606
2418
|
if (e.display === "none" || e.visibility === "hidden") return !1;
|
|
2607
2419
|
}
|
|
2608
2420
|
return !0;
|
|
2609
2421
|
}
|
|
2610
|
-
function
|
|
2611
|
-
const t =
|
|
2422
|
+
function bi(o = {}) {
|
|
2423
|
+
const t = o.root ?? document.body, e = o.selector ?? pi, i = o.isExcluded ?? (() => !1), n = o.isVisible ?? mi;
|
|
2612
2424
|
return Array.from(t.querySelectorAll(e)).filter(
|
|
2613
|
-
(
|
|
2425
|
+
(a) => !i(a) && n(a)
|
|
2614
2426
|
);
|
|
2615
2427
|
}
|
|
2616
|
-
function
|
|
2617
|
-
const t =
|
|
2618
|
-
root:
|
|
2619
|
-
selector:
|
|
2620
|
-
isExcluded:
|
|
2621
|
-
isVisible:
|
|
2622
|
-
}), e =
|
|
2623
|
-
let
|
|
2624
|
-
const
|
|
2625
|
-
if (
|
|
2626
|
-
const u = t.indexOf(
|
|
2627
|
-
u >= 0 && (
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
function
|
|
2428
|
+
function gi(o) {
|
|
2429
|
+
const t = o.candidates ?? bi({
|
|
2430
|
+
root: o.root,
|
|
2431
|
+
selector: o.selector,
|
|
2432
|
+
isExcluded: o.isExcluded,
|
|
2433
|
+
isVisible: o.isVisible
|
|
2434
|
+
}), e = o.moveFocus ?? !0, i = o.eventTarget ?? document, n = /* @__PURE__ */ new Set();
|
|
2435
|
+
let a = -1, s = !1;
|
|
2436
|
+
const d = o.initial !== void 0 ? o.initial : typeof document < "u" ? document.activeElement : null;
|
|
2437
|
+
if (d) {
|
|
2438
|
+
const u = t.indexOf(d);
|
|
2439
|
+
u >= 0 && (a = u);
|
|
2440
|
+
}
|
|
2441
|
+
a < 0 && t.length > 0 && (a = 0);
|
|
2442
|
+
function c(u) {
|
|
2631
2443
|
if (!e) return;
|
|
2632
2444
|
const k = u;
|
|
2633
2445
|
if (typeof k.focus == "function") {
|
|
2634
|
-
u.getAttribute("tabindex") === null && !
|
|
2446
|
+
u.getAttribute("tabindex") === null && !fi.test(u.tagName) && (u.setAttribute("tabindex", "-1"), n.add(u));
|
|
2635
2447
|
try {
|
|
2636
2448
|
k.focus();
|
|
2637
2449
|
} catch {
|
|
2638
2450
|
}
|
|
2639
2451
|
}
|
|
2640
2452
|
}
|
|
2641
|
-
function
|
|
2642
|
-
const u = t[
|
|
2643
|
-
u && (
|
|
2453
|
+
function l() {
|
|
2454
|
+
const u = t[a];
|
|
2455
|
+
u && (c(u), o.onHighlight?.(u, a));
|
|
2644
2456
|
}
|
|
2645
2457
|
function r(u) {
|
|
2646
|
-
if (
|
|
2458
|
+
if (s || t.length === 0) return;
|
|
2647
2459
|
const k = t.length;
|
|
2648
|
-
|
|
2460
|
+
a = (u % k + k) % k, l();
|
|
2649
2461
|
}
|
|
2650
2462
|
function h() {
|
|
2651
|
-
r(
|
|
2463
|
+
r(a + 1);
|
|
2652
2464
|
}
|
|
2653
2465
|
function f() {
|
|
2654
|
-
r(
|
|
2655
|
-
}
|
|
2656
|
-
function b() {
|
|
2657
|
-
return t[s] ?? null;
|
|
2466
|
+
r(a - 1);
|
|
2658
2467
|
}
|
|
2659
|
-
function
|
|
2660
|
-
|
|
2468
|
+
function m() {
|
|
2469
|
+
return t[a] ?? null;
|
|
2661
2470
|
}
|
|
2662
2471
|
function g() {
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2472
|
+
s || (s = !0, i.removeEventListener("keydown", x, !0), n.forEach((u) => u.removeAttribute("tabindex")), n.clear());
|
|
2473
|
+
}
|
|
2474
|
+
function v() {
|
|
2475
|
+
if (s) return;
|
|
2476
|
+
const u = m();
|
|
2477
|
+
g(), u && o.onSelect(u);
|
|
2666
2478
|
}
|
|
2667
2479
|
function w() {
|
|
2668
|
-
|
|
2480
|
+
s || (g(), o.onCancel?.());
|
|
2669
2481
|
}
|
|
2670
2482
|
function x(u) {
|
|
2671
|
-
if (!
|
|
2483
|
+
if (!s)
|
|
2672
2484
|
switch (u.key) {
|
|
2673
2485
|
case "Tab":
|
|
2674
2486
|
u.preventDefault(), u.stopPropagation(), u.shiftKey ? f() : h();
|
|
@@ -2684,7 +2496,7 @@ function uo(i) {
|
|
|
2684
2496
|
case "Enter":
|
|
2685
2497
|
case " ":
|
|
2686
2498
|
case "Spacebar":
|
|
2687
|
-
u.preventDefault(), u.stopPropagation(),
|
|
2499
|
+
u.preventDefault(), u.stopPropagation(), v();
|
|
2688
2500
|
break;
|
|
2689
2501
|
case "Escape":
|
|
2690
2502
|
case "Esc":
|
|
@@ -2692,21 +2504,21 @@ function uo(i) {
|
|
|
2692
2504
|
break;
|
|
2693
2505
|
}
|
|
2694
2506
|
}
|
|
2695
|
-
return
|
|
2507
|
+
return i.addEventListener("keydown", x, !0), a >= 0 && l(), {
|
|
2696
2508
|
candidates: t,
|
|
2697
|
-
getIndex: () =>
|
|
2698
|
-
getCurrent:
|
|
2509
|
+
getIndex: () => a,
|
|
2510
|
+
getCurrent: m,
|
|
2699
2511
|
next: h,
|
|
2700
2512
|
prev: f,
|
|
2701
2513
|
moveTo: r,
|
|
2702
|
-
select:
|
|
2514
|
+
select: v,
|
|
2703
2515
|
cancel: w,
|
|
2704
2516
|
handleKey: x,
|
|
2705
|
-
stop:
|
|
2517
|
+
stop: g
|
|
2706
2518
|
};
|
|
2707
2519
|
}
|
|
2708
|
-
const
|
|
2709
|
-
class
|
|
2520
|
+
const vi = ".qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6365f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}@media(forced-colors:active){.qaid-selected-marker,.qaid-highlight-box{border-color:Highlight}}", yi = 12;
|
|
2521
|
+
class wi {
|
|
2710
2522
|
constructor(t) {
|
|
2711
2523
|
this.host = t;
|
|
2712
2524
|
}
|
|
@@ -2735,27 +2547,27 @@ class mo {
|
|
|
2735
2547
|
* KeyboardTargetingController owns Tab/Arrow/Enter/Space/Escape.
|
|
2736
2548
|
*/
|
|
2737
2549
|
startKeyboard(t) {
|
|
2738
|
-
this.host.setState("TARGETING"), this.host.feedbackData.feedbackType = t, this.host.feedbackData.elementSelector = null, this.host.feedbackData.elementText = null, this.host.selectedBounds.visible = !1, document.body.style.setProperty("--qaid-positive", this.host.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.host.cssVars["--qaid-negative"]), this.createTargetingOverlay(), this.crosshairH && (this.crosshairH.style.display = "none"), this.crosshairV && (this.crosshairV.style.display = "none"), this.scope && (this.scope.style.display = "none"), this.keyboardController =
|
|
2739
|
-
isExcluded: (e) =>
|
|
2550
|
+
this.host.setState("TARGETING"), this.host.feedbackData.feedbackType = t, this.host.feedbackData.elementSelector = null, this.host.feedbackData.elementText = null, this.host.selectedBounds.visible = !1, document.body.style.setProperty("--qaid-positive", this.host.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.host.cssVars["--qaid-negative"]), this.createTargetingOverlay(), this.crosshairH && (this.crosshairH.style.display = "none"), this.crosshairV && (this.crosshairV.style.display = "none"), this.scope && (this.scope.style.display = "none"), this.keyboardController = gi({
|
|
2551
|
+
isExcluded: (e) => P(e),
|
|
2740
2552
|
onHighlight: (e) => {
|
|
2741
|
-
const
|
|
2742
|
-
n && (n.style.transform = `translate(${
|
|
2743
|
-
const { text:
|
|
2744
|
-
this.host.announceMsg(`Targeting ${
|
|
2553
|
+
const i = e.getBoundingClientRect(), n = this.highlightBox;
|
|
2554
|
+
n && (n.style.transform = `translate(${i.left}px, ${i.top}px)`, n.style.width = `${i.width}px`, n.style.height = `${i.height}px`, n.style.display = "block");
|
|
2555
|
+
const { text: a } = j(e);
|
|
2556
|
+
this.host.announceMsg(`Targeting ${a || e.tagName.toLowerCase()}`);
|
|
2745
2557
|
},
|
|
2746
2558
|
onSelect: (e) => this.selectKeyboardTarget(e),
|
|
2747
2559
|
onCancel: () => this.cancel()
|
|
2748
2560
|
});
|
|
2749
2561
|
}
|
|
2750
2562
|
selectKeyboardTarget(t) {
|
|
2751
|
-
const e =
|
|
2563
|
+
const e = pt(t, 8);
|
|
2752
2564
|
Object.assign(this.host.selectedBounds, e, {
|
|
2753
2565
|
clickX: e.x + e.width / 2,
|
|
2754
2566
|
clickY: e.y + e.height / 2,
|
|
2755
2567
|
visible: !0
|
|
2756
2568
|
});
|
|
2757
|
-
const { selector:
|
|
2758
|
-
this.host.feedbackData.elementSelector =
|
|
2569
|
+
const { selector: i, text: n } = j(t);
|
|
2570
|
+
this.host.feedbackData.elementSelector = i, this.host.feedbackData.elementText = n, this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.keyboardController = null, this.host.clearActiveThumb(), this.host.setState("SELECTED"), this.showSelectedMarker(), this.host.submitFeedback();
|
|
2759
2571
|
}
|
|
2760
2572
|
createTargetingOverlay() {
|
|
2761
2573
|
const t = this.host.ensureOverlayHost();
|
|
@@ -2773,11 +2585,11 @@ class mo {
|
|
|
2773
2585
|
/** Move the crosshair/scope reticle and highlight the element under (x, y). */
|
|
2774
2586
|
updateReticleAt(t, e) {
|
|
2775
2587
|
if (this.mousePos.x = t, this.mousePos.y = e, this.crosshairH && (this.crosshairH.style.top = `${e}px`), this.crosshairV && (this.crosshairV.style.left = `${t}px`), this.scope && (this.scope.style.left = `${t}px`, this.scope.style.top = `${e}px`), this.captureLayer && this.host.shadowHost) {
|
|
2776
|
-
const
|
|
2777
|
-
if (n && !
|
|
2588
|
+
const i = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean), n = ut(t, e, i);
|
|
2589
|
+
if (n && !P(n)) {
|
|
2778
2590
|
if (this.highlightBox) {
|
|
2779
|
-
const
|
|
2780
|
-
this.highlightBox.style.transform = `translate(${
|
|
2591
|
+
const a = n.getBoundingClientRect();
|
|
2592
|
+
this.highlightBox.style.transform = `translate(${a.left}px, ${a.top}px)`, this.highlightBox.style.width = `${a.width}px`, this.highlightBox.style.height = `${a.height}px`, this.highlightBox.style.display = "block";
|
|
2781
2593
|
}
|
|
2782
2594
|
} else this.highlightBox && (this.highlightBox.style.display = "none");
|
|
2783
2595
|
}
|
|
@@ -2791,18 +2603,18 @@ class mo {
|
|
|
2791
2603
|
e && (this.touchStartPos = { x: e.clientX, y: e.clientY }, this.updateReticleAt(e.clientX, e.clientY));
|
|
2792
2604
|
}
|
|
2793
2605
|
handleTouchEnd(t) {
|
|
2794
|
-
const e = t.changedTouches[0],
|
|
2795
|
-
this.touchStartPos = null, !(!e || !
|
|
2606
|
+
const e = t.changedTouches[0], i = this.touchStartPos;
|
|
2607
|
+
this.touchStartPos = null, !(!e || !i || Math.hypot(e.clientX - i.x, e.clientY - i.y) > yi) && (t.preventDefault(), this.selectAt(e.clientX, e.clientY));
|
|
2796
2608
|
}
|
|
2797
2609
|
/** Select the element under (x, y) and tear down targeting. */
|
|
2798
2610
|
selectAt(t, e) {
|
|
2799
|
-
const
|
|
2800
|
-
if (!n ||
|
|
2611
|
+
const i = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean), n = ut(t, e, i);
|
|
2612
|
+
if (!n || P(n))
|
|
2801
2613
|
return;
|
|
2802
|
-
const
|
|
2803
|
-
Object.assign(this.host.selectedBounds,
|
|
2804
|
-
const { selector:
|
|
2805
|
-
this.host.feedbackData.elementSelector =
|
|
2614
|
+
const a = pt(n, 8);
|
|
2615
|
+
Object.assign(this.host.selectedBounds, a, { clickX: t, clickY: e, visible: !0 });
|
|
2616
|
+
const { selector: s, text: d } = j(n);
|
|
2617
|
+
this.host.feedbackData.elementSelector = s, this.host.feedbackData.elementText = d, this.stopTargetingListeners(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.host.setState("SELECTED"), this.host.clearActiveThumb(), this.showSelectedMarker(), this.host.submitFeedback();
|
|
2806
2618
|
}
|
|
2807
2619
|
stopTargetingListeners() {
|
|
2808
2620
|
this.removeTargetingOverlay(), this.touchStartPos = null, document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), document.removeEventListener("touchstart", this.boundTouchStart), document.removeEventListener("touchend", this.boundTouchEnd), document.removeEventListener("keydown", this.host.boundKeyDown);
|
|
@@ -2825,23 +2637,316 @@ class mo {
|
|
|
2825
2637
|
this.keyboardController?.stop(), this.keyboardController = null, this.stopTargetingListeners(), this.hideMarker();
|
|
2826
2638
|
}
|
|
2827
2639
|
}
|
|
2828
|
-
const
|
|
2640
|
+
const ki = vi, St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2641
|
+
__proto__: null,
|
|
2642
|
+
TargetingController: wi,
|
|
2643
|
+
styles: ki
|
|
2644
|
+
}, Symbol.toStringTag, { value: "Module" })), xi = ".qaid-recording-indicator{position:fixed;pointer-events:auto;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:calc(var(--qaid-font-size, 16px) * .75);font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;inset:0 0 auto;height:100vh;height:100dvh;display:flex;align-items:center;justify-content:center;padding:16px;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));box-sizing:border-box;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:100%;max-height:100%;overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:calc(var(--qaid-font-size, 16px) * 1.125);font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;max-height:50vh;max-height:50dvh;object-fit:contain;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:calc(var(--qaid-font-size, 16px) * .875);resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-error{margin:0 0 .75rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;color:light-dark(#b91c1c,#fca5a5)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);color:light-dark(#6b7280,#9ca3af)}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}button.qaid-recording-stop{min-height:24px}.qaid-video-preview-box textarea:focus-visible{outline:2px solid var(--qaid-marker, #6365f1);outline-offset:2px}@media(forced-colors:active){.qaid-video-preview-box textarea:focus{outline:2px solid CanvasText;outline-offset:2px}}";
|
|
2645
|
+
class qi {
|
|
2646
|
+
constructor(t) {
|
|
2647
|
+
this.host = t;
|
|
2648
|
+
}
|
|
2649
|
+
host;
|
|
2650
|
+
videoRecorder = null;
|
|
2651
|
+
networkCapture = null;
|
|
2652
|
+
recordedBlob = null;
|
|
2653
|
+
recordingIndicator = null;
|
|
2654
|
+
videoPreview = null;
|
|
2655
|
+
isRecording = !1;
|
|
2656
|
+
isSendingVideo = !1;
|
|
2657
|
+
// Pre-recording redaction picking.
|
|
2658
|
+
redactPicks = [];
|
|
2659
|
+
redactPickerRoot = null;
|
|
2660
|
+
redactRafId = 0;
|
|
2661
|
+
boundRedactClick = (t) => this.handleRedactPickClick(t);
|
|
2662
|
+
/** Escape-key handler; returns true when it consumed the key. */
|
|
2663
|
+
handleEscape() {
|
|
2664
|
+
return this.isRecording ? (this.stopRecording(), !0) : this.videoPreview ? (this.cancelRecordingPreview(), !0) : this.redactPickerRoot ? (this.finishRedactionPicking(!1), !0) : !1;
|
|
2665
|
+
}
|
|
2666
|
+
destroy() {
|
|
2667
|
+
this.redactRafId && cancelAnimationFrame(this.redactRafId), this.redactRafId = 0, document.removeEventListener("click", this.boundRedactClick, !0), this.redactPickerRoot && (this.redactPickerRoot.remove(), this.redactPickerRoot = null), this.redactPicks = [], this.cleanupRecording(), this.removeVideoPreview();
|
|
2668
|
+
}
|
|
2669
|
+
async startRecording(t = []) {
|
|
2670
|
+
if (!(this.isRecording || this.host.state !== "IDLE"))
|
|
2671
|
+
try {
|
|
2672
|
+
this.networkCapture = uo();
|
|
2673
|
+
const { createVideoRecorder: e } = await Promise.resolve().then(() => Ht);
|
|
2674
|
+
this.videoRecorder = e({
|
|
2675
|
+
maxDuration: this.host.config.videoOptions.maxDuration,
|
|
2676
|
+
redactionElements: t
|
|
2677
|
+
}), this.videoRecorder.onTick((i) => {
|
|
2678
|
+
this.updateRecordingTimer(i);
|
|
2679
|
+
}), this.videoRecorder.onStop((i) => {
|
|
2680
|
+
this.isRecording && (this.recordedBlob = i, this.isRecording = !1, this.host.announceMsg("Recording stopped"), this.removeRecordingIndicator(), document.removeEventListener("keydown", this.host.boundKeyDown), this.host.setButtonsDisabled(!1), i && i.size > 0 ? this.showRecordingPreview() : this.cleanupRecording());
|
|
2681
|
+
}), await this.videoRecorder.start(), this.isRecording = !0, this.host.announceMsg("Recording started"), this.host.setButtonsDisabled(!0), this.showRecordingIndicator(), document.addEventListener("keydown", this.host.boundKeyDown);
|
|
2682
|
+
} catch (e) {
|
|
2683
|
+
e instanceof Error && /current tab|cannot blur/i.test(e.message) && this.host.announceMsg(e.message), this.cleanupRecording();
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
async stopRecording() {
|
|
2687
|
+
try {
|
|
2688
|
+
this.recordedBlob = await this.videoRecorder.stop();
|
|
2689
|
+
} catch {
|
|
2690
|
+
this.recordedBlob = null;
|
|
2691
|
+
}
|
|
2692
|
+
this.isRecording = !1, this.host.announceMsg("Recording stopped"), this.removeRecordingIndicator(), document.removeEventListener("keydown", this.host.boundKeyDown), this.recordedBlob && this.recordedBlob.size > 0 ? this.showRecordingPreview() : this.cleanupRecording();
|
|
2693
|
+
}
|
|
2694
|
+
/**
|
|
2695
|
+
* Pre-recording redaction picker. The user clicks page areas to blur; each
|
|
2696
|
+
* gets an outline that tracks its position, then "Start recording" hands the
|
|
2697
|
+
* picks to the recorder, which blurs their live bounding boxes so the
|
|
2698
|
+
* redaction follows the content as the page scrolls. "Cancel"/Escape aborts.
|
|
2699
|
+
*/
|
|
2700
|
+
startPicking() {
|
|
2701
|
+
if (this.isRecording || this.host.state !== "IDLE") return;
|
|
2702
|
+
this.host.setState("REDACT_PICKING"), this.redactPicks = [];
|
|
2703
|
+
const t = this.host.ensureOverlayHost(), e = p("div", { style: "position:absolute;inset:0;" }), i = p(
|
|
2704
|
+
"div",
|
|
2705
|
+
{ class: "qaid-redact-picker", style: "position:fixed;inset:0;pointer-events:none;" },
|
|
2706
|
+
e,
|
|
2707
|
+
// Control bar — the only pointer-interactive part of the overlay.
|
|
2708
|
+
p(
|
|
2709
|
+
"div",
|
|
2710
|
+
{
|
|
2711
|
+
style: "position:fixed;left:50%;bottom:24px;transform:translateX(-50%);display:flex;gap:12px;align-items:center;pointer-events:auto;background:#0b1220;color:#fff;border:1px solid #ff6b6b;border-radius:9999px;padding:10px 16px;font:600 13px system-ui,sans-serif;box-shadow:0 8px 30px rgba(0,0,0,.5);"
|
|
2712
|
+
},
|
|
2713
|
+
p("span", {
|
|
2714
|
+
text: "Click sensitive areas to blur",
|
|
2715
|
+
attrs: { "data-qaid-redact-label": "" }
|
|
2716
|
+
}),
|
|
2717
|
+
p("button", {
|
|
2718
|
+
text: "Start recording",
|
|
2719
|
+
attrs: { type: "button" },
|
|
2720
|
+
style: "cursor:pointer;border:0;border-radius:9999px;padding:8px 14px;background:#ff6b6b;color:#0b1220;font:inherit;",
|
|
2721
|
+
on: { click: () => this.finishRedactionPicking(!0) }
|
|
2722
|
+
}),
|
|
2723
|
+
p("button", {
|
|
2724
|
+
text: "Cancel",
|
|
2725
|
+
attrs: { type: "button" },
|
|
2726
|
+
style: "cursor:pointer;border:0;background:transparent;color:#9fb3c8;font:inherit;",
|
|
2727
|
+
on: { click: () => this.finishRedactionPicking(!1) }
|
|
2728
|
+
})
|
|
2729
|
+
)
|
|
2730
|
+
);
|
|
2731
|
+
t.appendChild(i), this.redactPickerRoot = i;
|
|
2732
|
+
const n = () => {
|
|
2733
|
+
this.renderRedactPicks(e), this.redactRafId = requestAnimationFrame(n);
|
|
2734
|
+
};
|
|
2735
|
+
n(), document.addEventListener("click", this.boundRedactClick, !0), document.addEventListener("keydown", this.host.boundKeyDown), this.host.announceMsg("Click sensitive areas to blur, then start recording");
|
|
2736
|
+
}
|
|
2737
|
+
handleRedactPickClick(t) {
|
|
2738
|
+
const e = t.target instanceof Element ? t.target : null;
|
|
2739
|
+
if (!e || P(e) || this.redactPickerRoot?.contains(e)) return;
|
|
2740
|
+
t.preventDefault(), t.stopPropagation();
|
|
2741
|
+
const i = this.redactPicks.indexOf(e);
|
|
2742
|
+
i >= 0 ? this.redactPicks.splice(i, 1) : this.redactPicks.push(e);
|
|
2743
|
+
const n = this.redactPickerRoot?.querySelector("[data-qaid-redact-label]");
|
|
2744
|
+
if (n) {
|
|
2745
|
+
const a = this.redactPicks.length;
|
|
2746
|
+
n.textContent = a === 0 ? "Click sensitive areas to blur" : `${a} area${a === 1 ? "" : "s"} will be blurred`;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
renderRedactPicks(t) {
|
|
2750
|
+
t.textContent = "";
|
|
2751
|
+
for (const e of this.redactPicks) {
|
|
2752
|
+
const i = e.getBoundingClientRect();
|
|
2753
|
+
i.width <= 0 || i.height <= 0 || t.appendChild(
|
|
2754
|
+
p("div", {
|
|
2755
|
+
style: `position:fixed;left:${i.left}px;top:${i.top}px;width:${i.width}px;height:${i.height}px;border:2px solid #ff6b6b;border-radius:4px;background:rgba(255,107,107,.18);pointer-events:none;`
|
|
2756
|
+
})
|
|
2757
|
+
);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
finishRedactionPicking(t) {
|
|
2761
|
+
this.redactRafId && cancelAnimationFrame(this.redactRafId), this.redactRafId = 0, document.removeEventListener("click", this.boundRedactClick, !0), document.removeEventListener("keydown", this.host.boundKeyDown), this.redactPickerRoot && (this.redactPickerRoot.remove(), this.redactPickerRoot = null);
|
|
2762
|
+
const e = this.redactPicks;
|
|
2763
|
+
this.redactPicks = [], this.host.setState("IDLE"), t && this.startRecording(e);
|
|
2764
|
+
}
|
|
2765
|
+
showRecordingIndicator() {
|
|
2766
|
+
const t = this.host.ensureOverlayHost();
|
|
2767
|
+
this.recordingIndicator = p(
|
|
2768
|
+
"div",
|
|
2769
|
+
{ class: "qaid-recording-indicator", style: `z-index:${this.host.config.zIndex + 100}` },
|
|
2770
|
+
p("div", { class: "qaid-recording-dot" }),
|
|
2771
|
+
p("span", {
|
|
2772
|
+
class: "qaid-recording-time",
|
|
2773
|
+
text: this.formatTime(this.host.config.videoOptions.maxDuration)
|
|
2774
|
+
}),
|
|
2775
|
+
p("button", {
|
|
2776
|
+
class: "qaid-recording-stop",
|
|
2777
|
+
text: "Stop",
|
|
2778
|
+
attrs: { type: "button" },
|
|
2779
|
+
on: { click: () => this.stopRecording() }
|
|
2780
|
+
})
|
|
2781
|
+
), this.host.applyVars(this.recordingIndicator), t.appendChild(this.recordingIndicator);
|
|
2782
|
+
}
|
|
2783
|
+
updateRecordingTimer(t) {
|
|
2784
|
+
if (!this.recordingIndicator) return;
|
|
2785
|
+
const e = this.recordingIndicator.querySelector(".qaid-recording-time");
|
|
2786
|
+
if (e) {
|
|
2787
|
+
const i = Math.max(0, this.host.config.videoOptions.maxDuration - t);
|
|
2788
|
+
e.textContent = this.formatTime(i), i > 0 && i <= 5 && this.host.announceMsg(`${i} second${i === 1 ? "" : "s"} remaining`);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
formatTime(t) {
|
|
2792
|
+
const e = Math.floor(t / 60), i = t % 60;
|
|
2793
|
+
return `${e}:${i.toString().padStart(2, "0")}`;
|
|
2794
|
+
}
|
|
2795
|
+
removeRecordingIndicator() {
|
|
2796
|
+
this.recordingIndicator && (this.recordingIndicator.remove(), this.recordingIndicator = null);
|
|
2797
|
+
}
|
|
2798
|
+
showRecordingPreview() {
|
|
2799
|
+
const t = this.host.ensureOverlayHost(), e = URL.createObjectURL(this.recordedBlob), i = `qaid-video-title-${this.host.uid}`, n = p("h3", { text: "Review your recording", attrs: { id: i } }), a = p("video");
|
|
2800
|
+
a.src = e, a.controls = !0, a.autoplay = !0, a.muted = !0;
|
|
2801
|
+
const s = p("textarea", {
|
|
2802
|
+
attrs: {
|
|
2803
|
+
placeholder: "Optional: Describe the issue you recorded...",
|
|
2804
|
+
"aria-label": "Describe the issue you recorded"
|
|
2805
|
+
}
|
|
2806
|
+
}), d = p("button", {
|
|
2807
|
+
class: "qaid-video-btn qaid-video-btn-send",
|
|
2808
|
+
text: "Send",
|
|
2809
|
+
attrs: { type: "button" },
|
|
2810
|
+
on: { click: () => this.submitVideoFeedback(s.value.trim() || null, d) }
|
|
2811
|
+
}), c = p(
|
|
2812
|
+
"div",
|
|
2813
|
+
{ class: "qaid-video-preview-box" },
|
|
2814
|
+
n,
|
|
2815
|
+
a,
|
|
2816
|
+
s,
|
|
2817
|
+
p(
|
|
2818
|
+
"div",
|
|
2819
|
+
{ class: "qaid-video-preview-actions" },
|
|
2820
|
+
p("button", {
|
|
2821
|
+
class: "qaid-video-btn qaid-video-btn-cancel",
|
|
2822
|
+
text: "Cancel",
|
|
2823
|
+
attrs: { type: "button" },
|
|
2824
|
+
on: { click: () => this.cancelRecordingPreview() }
|
|
2825
|
+
}),
|
|
2826
|
+
p("button", {
|
|
2827
|
+
class: "qaid-video-btn qaid-video-btn-rerecord",
|
|
2828
|
+
text: "Re-record",
|
|
2829
|
+
attrs: { type: "button" },
|
|
2830
|
+
on: {
|
|
2831
|
+
click: () => {
|
|
2832
|
+
this.cancelRecordingPreview(), this.startRecording();
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
}),
|
|
2836
|
+
d
|
|
2837
|
+
)
|
|
2838
|
+
);
|
|
2839
|
+
this.videoPreview = p(
|
|
2840
|
+
"div",
|
|
2841
|
+
{ class: "qaid-video-preview", style: `z-index:${this.host.config.zIndex + 100}` },
|
|
2842
|
+
c
|
|
2843
|
+
), this.host.applyVars(this.videoPreview), this.host.overlayShadowHost && (this.host.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.videoPreview), this.host.openDialogA11y(c, { labelledbyId: n.id }), document.addEventListener("keydown", this.host.boundKeyDown);
|
|
2844
|
+
}
|
|
2845
|
+
cancelRecordingPreview() {
|
|
2846
|
+
this.removeVideoPreview(), this.cleanupRecording();
|
|
2847
|
+
}
|
|
2848
|
+
removeVideoPreview() {
|
|
2849
|
+
if (this.host.closeDialogA11y(), this.videoPreview) {
|
|
2850
|
+
const t = this.videoPreview.querySelector("video");
|
|
2851
|
+
t?.src && URL.revokeObjectURL(t.src), this.videoPreview.remove(), this.videoPreview = null;
|
|
2852
|
+
}
|
|
2853
|
+
document.removeEventListener("keydown", this.host.boundKeyDown);
|
|
2854
|
+
}
|
|
2855
|
+
async submitVideoFeedback(t, e) {
|
|
2856
|
+
if (!this.recordedBlob || this.isSendingVideo) return;
|
|
2857
|
+
this.isSendingVideo = !0, e.disabled = !0, e.textContent = "Sending...";
|
|
2858
|
+
const i = new FormData();
|
|
2859
|
+
i.append("video", this.recordedBlob, `recording.${this.recordedBlob.type.includes("mp4") ? "mp4" : "webm"}`), i.append("pageUrl", window.location.href), i.append("visitorId", this.host.visitorId), this.host.config.apiKey && i.append("apiKey", this.host.config.apiKey), t && i.append("message", t), this.host.consoleCapture && i.append("consoleErrors", JSON.stringify(this.host.consoleCapture.errors)), this.networkCapture && i.append("networkErrors", JSON.stringify(this.networkCapture.errors));
|
|
2860
|
+
let n = null, a = null;
|
|
2861
|
+
try {
|
|
2862
|
+
const s = await fetch(`${this.host.config.endpoint}/video`, {
|
|
2863
|
+
method: "POST",
|
|
2864
|
+
body: i
|
|
2865
|
+
});
|
|
2866
|
+
if (s.ok) {
|
|
2867
|
+
this.host.announceMsg("Recording sent");
|
|
2868
|
+
try {
|
|
2869
|
+
n = (await s.json())?.id ?? null;
|
|
2870
|
+
} catch {
|
|
2871
|
+
}
|
|
2872
|
+
} else
|
|
2873
|
+
console.error("Failed to submit video feedback:", await s.text()), a = s.status === 413 ? "This recording is too large to send. Try a shorter one." : "Your recording could not be sent.";
|
|
2874
|
+
} catch (s) {
|
|
2875
|
+
console.error("Failed to submit video feedback:", s), a = "Your recording could not be sent. Check your connection and try again.";
|
|
2876
|
+
}
|
|
2877
|
+
if (this.isSendingVideo = !1, a) {
|
|
2878
|
+
this.showSendError(a, e);
|
|
2879
|
+
return;
|
|
2880
|
+
}
|
|
2881
|
+
this.removeVideoPreview(), this.cleanupRecording(), await this.host.tryLaunchQuest("video", n);
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Keep the preview open and say the upload failed. Closing it, as a success
|
|
2885
|
+
* does, told the visitor their recording had arrived when it had not. Send
|
|
2886
|
+
* is re-enabled for another try; Cancel and Re-record still work.
|
|
2887
|
+
*/
|
|
2888
|
+
showSendError(t, e) {
|
|
2889
|
+
this.host.announceMsg(`Failed to send recording. ${t}`, !0), e.disabled = !1, e.textContent = "Send";
|
|
2890
|
+
const i = this.videoPreview?.querySelector(".qaid-video-preview-actions");
|
|
2891
|
+
if (i) {
|
|
2892
|
+
let n = this.videoPreview.querySelector(".qaid-video-error");
|
|
2893
|
+
n || (n = p("p", { class: "qaid-video-error" }), i.before(n)), n.textContent = t;
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
cleanupRecording() {
|
|
2897
|
+
this.isRecording = !1, this.removeRecordingIndicator(), this.videoRecorder && (this.videoRecorder.destroy(), this.videoRecorder = null), this.networkCapture && (this.networkCapture.restore(), this.networkCapture = null), this.recordedBlob && (this.recordedBlob = null), this.host.setButtonsDisabled(!1), this.host.overlayShadowHost && this.host.state === "IDLE" && (this.host.overlayShadowHost.style.pointerEvents = "none");
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
const Ci = xi, Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2901
|
+
__proto__: null,
|
|
2902
|
+
RecordingController: qi,
|
|
2903
|
+
styles: Ci
|
|
2904
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2905
|
+
async function Si(o = {}) {
|
|
2906
|
+
const { quality: t = 0.8, maxWidth: e = 1280, maxHeight: i = 800 } = o;
|
|
2907
|
+
try {
|
|
2908
|
+
if (!navigator.mediaDevices?.getDisplayMedia)
|
|
2909
|
+
return console.warn("Screen Capture API not available"), null;
|
|
2910
|
+
const n = await navigator.mediaDevices.getDisplayMedia({
|
|
2911
|
+
preferCurrentTab: !0,
|
|
2912
|
+
video: {
|
|
2913
|
+
displaySurface: "browser"
|
|
2914
|
+
}
|
|
2915
|
+
}), a = n.getVideoTracks()[0], s = a.getSettings(), d = document.createElement("video");
|
|
2916
|
+
d.srcObject = n, d.muted = !0, await new Promise((v) => {
|
|
2917
|
+
d.onloadedmetadata = () => {
|
|
2918
|
+
d.play(), v();
|
|
2919
|
+
};
|
|
2920
|
+
}), await new Promise((v) => {
|
|
2921
|
+
const w = () => {
|
|
2922
|
+
d.readyState >= 2 ? v() : requestAnimationFrame(w);
|
|
2923
|
+
};
|
|
2924
|
+
w();
|
|
2925
|
+
}), await new Promise((v) => setTimeout(v, 100));
|
|
2926
|
+
const c = s.width || d.videoWidth, l = s.height || d.videoHeight, r = Math.min(e / c, i / l, 1), h = Math.round(c * r), f = Math.round(l * r), m = document.createElement("canvas");
|
|
2927
|
+
m.width = h, m.height = f;
|
|
2928
|
+
const g = m.getContext("2d");
|
|
2929
|
+
return g ? (g.drawImage(d, 0, 0, h, f), a.stop(), m.toDataURL("image/webp", t)) : (a.stop(), null);
|
|
2930
|
+
} catch (n) {
|
|
2931
|
+
return console.warn("Screenshot capture failed:", n), null;
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
const ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2829
2935
|
__proto__: null,
|
|
2830
|
-
|
|
2831
|
-
styles: bo
|
|
2936
|
+
captureScreenshot: Si
|
|
2832
2937
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2833
2938
|
export {
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2939
|
+
_t as AnnotationEditor,
|
|
2940
|
+
io as QaidFeedback,
|
|
2941
|
+
To as captureDomScreenshot,
|
|
2942
|
+
uo as captureNetworkErrors,
|
|
2943
|
+
$t as compositeAnnotations,
|
|
2944
|
+
xo as createVideoRecorder,
|
|
2945
|
+
z as drawShape,
|
|
2946
|
+
Bt as getSupportedMimeType,
|
|
2947
|
+
So as isDomScreenshotSupported,
|
|
2948
|
+
ko as isVideoRecordingSupported,
|
|
2949
|
+
Fo as openAnnotationEditor,
|
|
2950
|
+
O as rectFromPoints
|
|
2846
2951
|
};
|
|
2847
2952
|
//# sourceMappingURL=index.js.map
|