@qaiddev/thumbs-embed 1.0.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/qaid.js ADDED
@@ -0,0 +1,703 @@
1
+ var O = Object.defineProperty;
2
+ var N = (i, t, e) => t in i ? O(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var d = (i, t, e) => N(i, typeof t != "symbol" ? t + "" : t, e);
4
+ const y = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
+ <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"/>
6
+ </svg>`, q = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
7
+ <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"/>
8
+ </svg>`, P = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}.qaid-widget,.qaid-widget *,.qaid-modal-container,.qaid-modal-container *{cursor:pointer!important}.qaid-widget.qaid-auto-container{position:fixed;z-index:50;display:flex;gap:.5rem}.qaid-widget.qaid-auto-container.qaid-bottom-right{bottom:1rem;right:1rem}.qaid-widget.qaid-auto-container.qaid-bottom-left{bottom:1rem;left:1rem}.qaid-widget.qaid-auto-container.qaid-top-right{top:1rem;right:1rem}.qaid-widget.qaid-auto-container.qaid-top-left{top:1rem;left:1rem}.qaid-widget.qaid-incognito{opacity:0;transition:opacity .2s ease-in-out}.qaid-widget.qaid-incognito:hover{opacity:1}.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.qaid-icon{width:24px;height: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-tooltip-wrapper{position:relative}.qaid-tooltip-text{position:fixed;padding:.5rem .75rem;background:#1f2937;color:#fff;font-size:1rem;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}.qaid-targeting-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;top:0;right:0;bottom:0;left:0;cursor:crosshair;pointer-events:auto;z-index:9999}.qaid-banner{position:fixed;top:0;left:0;right:0;padding:.75rem 1rem;text-align:center;z-index:10000;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);animation:qaid-slideDown .2s ease-out}.qaid-banner-up{background:color-mix(in srgb,var(--qaid-positive) 90%,transparent);color:#fff}.qaid-banner-down{background:color-mix(in srgb,var(--qaid-negative) 90%,transparent);color:#fff}.qaid-banner-text{font-weight:500}.qaid-banner-hint{margin-left:.5rem;opacity:.75}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;top:0;right:0;bottom:0;left: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-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;top:10px;right:10px;bottom:10px;left: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;top:20px;right:20px;bottom:20px;left: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-highlight{outline:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent)!important;outline-offset:2px!important;background-color:color-mix(in srgb,var(--qaid-negative) 10%,transparent)!important;transition:outline .1s ease,background-color .1s ease}body.qaid-targeting.qaid-type-up .qaid-highlight{outline-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)!important;background-color:color-mix(in srgb,var(--qaid-positive) 10%,transparent)!important}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);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)}}.qaid-backdrop{position:fixed;top:0;right:0;bottom:0;left: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}.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0}.qaid-type-toggle:hover{transform:scale(1.1)}.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;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}.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s}.qaid-btn-submit:hover{filter:brightness(.85)}.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)}}";
9
+ let k = !1;
10
+ const U = {
11
+ small: 36,
12
+ medium: 48,
13
+ large: 64
14
+ }, W = {
15
+ small: 18,
16
+ medium: 24,
17
+ large: 32
18
+ };
19
+ function j(i, t, e) {
20
+ const [o, n, a] = [i, t, e].map((s) => (s = s / 255, s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4)));
21
+ return 0.2126 * o + 0.7152 * n + 0.0722 * a;
22
+ }
23
+ function X(i) {
24
+ if (i.startsWith("#")) {
25
+ const e = i.slice(1), o = e.length === 3 ? e.split("").map((a) => a + a).join("") : e, n = parseInt(o, 16);
26
+ return {
27
+ r: n >> 16 & 255,
28
+ g: n >> 8 & 255,
29
+ b: n & 255
30
+ };
31
+ }
32
+ const t = i.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
33
+ return t ? {
34
+ r: parseInt(t[1]),
35
+ g: parseInt(t[2]),
36
+ b: parseInt(t[3])
37
+ } : null;
38
+ }
39
+ function Y(i) {
40
+ const t = X(i);
41
+ return t && j(t.r, t.g, t.b) > 0.4 ? "black" : "white";
42
+ }
43
+ function R(i = {}) {
44
+ if (k) return;
45
+ k = !0;
46
+ const {
47
+ positiveColor: t = "rgb(0, 200, 83)",
48
+ negativeColor: e = "rgb(255, 0, 0)",
49
+ markerColor: o = "#6366f1",
50
+ // skipButtonStyles kept for backwards compatibility but no longer used
51
+ buttonSize: n = "medium",
52
+ modalWidth: a = 400,
53
+ backdropOpacity: s = 0.3,
54
+ fontFamily: l = "system-ui, -apple-system, sans-serif",
55
+ fontSize: r = 16
56
+ } = i, c = U[n], p = W[n], f = Y(o), h = `:root{--qaid-positive:${t};--qaid-negative:${e};--qaid-marker:${o};--qaid-marker-text:${f};--qaid-btn-size:${c}px;--qaid-icon-size:${p}px;--qaid-modal-width:${a}px;--qaid-backdrop-opacity:${s};--qaid-font-family:${l};--qaid-font-size:${r}px}`, u = ".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}.qaid-btn:hover{transform:scale(1.05)}.qaid-btn-up:hover{background:var(--qaid-positive);color:#fff}.qaid-btn-down:hover{background:var(--qaid-negative);color:#fff}.qaid-btn svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}", m = document.createElement("style");
57
+ m.id = "qaid-styles", m.textContent = h + P + u, document.head.appendChild(m);
58
+ }
59
+ function K() {
60
+ const i = document.getElementById("qaid-styles");
61
+ i && (i.remove(), k = !1);
62
+ }
63
+ const _ = ["data-comp", "data-qa", "data-testid", "data-id"];
64
+ function A(i, t = document.body) {
65
+ let e = i;
66
+ for (; e && e !== t; ) {
67
+ for (const o of _) {
68
+ const n = e.getAttribute(o);
69
+ if (n)
70
+ return `${o}="${n}"`;
71
+ }
72
+ e = e.parentElement;
73
+ }
74
+ return null;
75
+ }
76
+ function V(i, t = 100) {
77
+ var o;
78
+ const e = ((o = i.textContent) == null ? void 0 : o.trim().slice(0, t)) || "";
79
+ return e.length === t ? e + "..." : e;
80
+ }
81
+ function J(i) {
82
+ let t = 1, e = i.previousElementSibling;
83
+ for (; e; )
84
+ t++, e = e.previousElementSibling;
85
+ return t;
86
+ }
87
+ function G(i) {
88
+ const t = [];
89
+ let e = i;
90
+ for (; e && e !== document.body && e !== document.documentElement; ) {
91
+ const o = e.tagName.toLowerCase(), n = J(e);
92
+ t.unshift(`${o}:nth-child(${n})`), e = e.parentElement;
93
+ }
94
+ return t.length > 0 ? `body > ${t.join(" > ")}` : "body";
95
+ }
96
+ function Z(i) {
97
+ return i.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
98
+ }
99
+ function Q(i) {
100
+ const t = A(i);
101
+ return t ? `[${t}]` : i.id ? `#${Z(i.id)}` : G(i);
102
+ }
103
+ function tt(i) {
104
+ const t = V(i), e = A(i);
105
+ return { selector: Q(i), text: t, dataAttr: e };
106
+ }
107
+ const B = {
108
+ width: 400,
109
+ height: 280,
110
+ arrowHeight: 12,
111
+ gap: 8,
112
+ viewportPadding: 16
113
+ };
114
+ function et(i, t, e, o, n) {
115
+ const a = i.y, s = t - (i.y + i.height);
116
+ if (s >= e + o)
117
+ return {
118
+ top: i.y + i.height + o,
119
+ position: "below"
120
+ };
121
+ if (a >= e + o)
122
+ return {
123
+ top: i.y - e - o,
124
+ position: "above"
125
+ };
126
+ const l = s > a ? "below" : "above";
127
+ let r;
128
+ return l === "below" ? r = Math.min(
129
+ i.y + i.height + o,
130
+ t - e - n
131
+ ) : r = Math.max(n, i.y - e - o), { top: r, position: l };
132
+ }
133
+ function it(i, t, e, o) {
134
+ let a = i.x + i.width / 2 - e / 2;
135
+ return a = Math.max(o, Math.min(a, t - e - o)), a;
136
+ }
137
+ function ot(i, t, e, o = 24, n = 24) {
138
+ const s = i.clickX - t - n / 2;
139
+ return Math.max(o, Math.min(s, e - o - n / 2));
140
+ }
141
+ function nt(i, t, e, o = B) {
142
+ const n = o.height + o.arrowHeight, a = et(
143
+ i,
144
+ e,
145
+ n,
146
+ o.gap,
147
+ o.viewportPadding
148
+ ), s = it(
149
+ i,
150
+ t,
151
+ o.width,
152
+ o.viewportPadding
153
+ );
154
+ return {
155
+ top: a.top,
156
+ left: s,
157
+ position: a.position
158
+ };
159
+ }
160
+ function at(i, t, e, o = B) {
161
+ const n = nt(i, t, e, o), a = ot(
162
+ i,
163
+ n.left,
164
+ o.width
165
+ );
166
+ return {
167
+ modal: n,
168
+ arrow: { left: a }
169
+ };
170
+ }
171
+ const st = 20;
172
+ function rt(i) {
173
+ const t = [], e = console.error, o = console.warn, n = console.log, a = (s, l) => {
174
+ const r = {
175
+ message: l.map((c) => String(c)).join(" "),
176
+ timestamp: Date.now(),
177
+ level: s
178
+ };
179
+ t.length >= st && t.shift(), t.push(r), i && i(r);
180
+ };
181
+ return console.error = function(...s) {
182
+ a("error", s), e.apply(console, s);
183
+ }, console.warn = function(...s) {
184
+ a("warn", s), o.apply(console, s);
185
+ }, console.log = function(...s) {
186
+ a("log", s), n.apply(console, s);
187
+ }, {
188
+ errors: t,
189
+ restore: () => {
190
+ console.error = e, console.warn = o, console.log = n;
191
+ }
192
+ };
193
+ }
194
+ function dt(i = 640) {
195
+ return typeof window < "u" && window.innerWidth < i;
196
+ }
197
+ function M(i, t, e) {
198
+ const o = e.style.pointerEvents;
199
+ e.style.pointerEvents = "none";
200
+ const n = document.elementFromPoint(i, t);
201
+ return e.style.pointerEvents = o, n;
202
+ }
203
+ function $(i) {
204
+ return i ? !!(i.closest(".qaid-widget") || i.closest(".qaid-targeting-overlay") || i.closest(".qaid-modal-container") || i.closest(".qaid-bottom-sheet")) : !1;
205
+ }
206
+ function lt(i, t = 0) {
207
+ const e = i.getBoundingClientRect();
208
+ return {
209
+ x: e.left - t,
210
+ y: e.top - t,
211
+ width: e.width + t * 2,
212
+ height: e.height + t * 2
213
+ };
214
+ }
215
+ function x(i) {
216
+ document.querySelectorAll(`.${i}`).forEach((t) => {
217
+ t.classList.remove(i);
218
+ });
219
+ }
220
+ async function ct(i = {}) {
221
+ var n;
222
+ const { quality: t = 1, maxWidth: e = 1280, maxHeight: o = 800 } = i;
223
+ try {
224
+ if (!((n = navigator.mediaDevices) != null && n.getDisplayMedia))
225
+ return console.warn("Screen Capture API not available"), null;
226
+ const a = await navigator.mediaDevices.getDisplayMedia({
227
+ preferCurrentTab: !0,
228
+ video: {
229
+ displaySurface: "browser"
230
+ }
231
+ }), s = a.getVideoTracks()[0], l = s.getSettings(), r = document.createElement("video");
232
+ r.srcObject = a, r.muted = !0, await new Promise((g) => {
233
+ r.onloadedmetadata = () => {
234
+ r.play(), g();
235
+ };
236
+ }), await new Promise((g) => {
237
+ const v = () => {
238
+ r.readyState >= 2 ? g() : requestAnimationFrame(v);
239
+ };
240
+ v();
241
+ }), await new Promise((g) => setTimeout(g, 100));
242
+ const c = l.width || r.videoWidth, p = l.height || r.videoHeight, f = Math.min(e / c, o / p, 1), h = Math.round(c * f), u = Math.round(p * f), m = document.createElement("canvas");
243
+ m.width = h, m.height = u;
244
+ const b = m.getContext("2d");
245
+ return b ? (b.drawImage(r, 0, 0, h, u), s.stop(), m.toDataURL("image/webp", t)) : (s.stop(), null);
246
+ } catch (a) {
247
+ return console.warn("Screenshot capture failed:", a), null;
248
+ }
249
+ }
250
+ const D = "qaid_visitor_id";
251
+ function ht() {
252
+ try {
253
+ let i = localStorage.getItem(D);
254
+ return i || (i = crypto.randomUUID(), localStorage.setItem(D, i)), i;
255
+ } catch {
256
+ return crypto.randomUUID();
257
+ }
258
+ }
259
+ class pt {
260
+ constructor(t) {
261
+ d(this, "config");
262
+ d(this, "state", "IDLE");
263
+ d(this, "feedbackData", {
264
+ feedbackType: null,
265
+ elementSelector: null,
266
+ elementText: null,
267
+ consoleErrors: []
268
+ });
269
+ d(this, "selectedBounds", {
270
+ x: 0,
271
+ y: 0,
272
+ width: 0,
273
+ height: 0,
274
+ clickX: 0,
275
+ clickY: 0,
276
+ visible: !1
277
+ });
278
+ d(this, "feedbackId", null);
279
+ d(this, "mousePos", { x: 0, y: 0 });
280
+ d(this, "lastHighlighted", null);
281
+ d(this, "isMobile", !1);
282
+ d(this, "visitorId");
283
+ // Console capture
284
+ d(this, "consoleCapture", null);
285
+ // Server-side feature flags
286
+ d(this, "allowedFeatures", null);
287
+ // DOM elements
288
+ d(this, "container", null);
289
+ d(this, "isUserProvidedContainer", !1);
290
+ d(this, "overlayContainer", null);
291
+ d(this, "captureLayer", null);
292
+ d(this, "crosshairH", null);
293
+ d(this, "crosshairV", null);
294
+ d(this, "scope", null);
295
+ d(this, "marker", null);
296
+ d(this, "modalContainer", null);
297
+ d(this, "backdrop", null);
298
+ // Bound event handlers
299
+ d(this, "boundKeyDown");
300
+ d(this, "boundMouseMove");
301
+ d(this, "boundClick");
302
+ d(this, "boundResize");
303
+ d(this, "tooltipElement", null);
304
+ var e, o, n, a, s, l, r, c, p, f, h, u, m, b, g, v;
305
+ this.config = {
306
+ endpoint: t.endpoint,
307
+ apiKey: t.apiKey ?? "",
308
+ container: t.container ?? "",
309
+ buttonClass: t.buttonClass ?? "",
310
+ position: t.position ?? "bottom-right",
311
+ offset: {
312
+ x: ((e = t.offset) == null ? void 0 : e.x) ?? 16,
313
+ y: ((o = t.offset) == null ? void 0 : o.y) ?? 16
314
+ },
315
+ zIndex: t.zIndex ?? 50,
316
+ skipTargeting: t.skipTargeting ?? !1,
317
+ colors: {
318
+ positive: ((n = t.colors) == null ? void 0 : n.positive) ?? "rgb(0, 200, 83)",
319
+ negative: ((a = t.colors) == null ? void 0 : a.negative) ?? "rgb(255, 0, 0)",
320
+ marker: ((s = t.colors) == null ? void 0 : s.marker) ?? "#6366f1"
321
+ },
322
+ buttonSize: t.buttonSize ?? "medium",
323
+ text: {
324
+ tooltip: ((l = t.text) == null ? void 0 : l.tooltip) ?? "",
325
+ bannerText: ((r = t.text) == null ? void 0 : r.bannerText) ?? "Click on any element to target it with your feedback",
326
+ bannerHint: ((c = t.text) == null ? void 0 : c.bannerHint) ?? "(Press Escape to cancel)",
327
+ modalTitle: ((p = t.text) == null ? void 0 : p.modalTitle) ?? "Thank you for your feedback!",
328
+ modalSubtitle: ((f = t.text) == null ? void 0 : f.modalSubtitle) ?? "Would you like to add a message to help us understand your feedback better?",
329
+ placeholder: ((h = t.text) == null ? void 0 : h.placeholder) ?? "Optional: Tell us more about your experience...",
330
+ submitButton: ((u = t.text) == null ? void 0 : u.submitButton) ?? "Submit",
331
+ skipButton: ((m = t.text) == null ? void 0 : m.skipButton) ?? "Skip"
332
+ },
333
+ modalWidth: t.modalWidth ?? 400,
334
+ backdropOpacity: t.backdropOpacity ?? 0.3,
335
+ fontFamily: t.fontFamily ?? "system-ui, -apple-system, sans-serif",
336
+ fontSize: t.fontSize ?? 16,
337
+ captureScreenshot: t.captureScreenshot ?? !1,
338
+ screenshotOptions: {
339
+ quality: ((b = t.screenshotOptions) == null ? void 0 : b.quality) ?? 0.8,
340
+ maxWidth: ((g = t.screenshotOptions) == null ? void 0 : g.maxWidth) ?? 1280,
341
+ maxHeight: ((v = t.screenshotOptions) == null ? void 0 : v.maxHeight) ?? 800
342
+ },
343
+ incognito: t.incognito ?? !1,
344
+ positiveIcon: t.positiveIcon ?? "",
345
+ negativeIcon: t.negativeIcon ?? ""
346
+ }, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundClick = this.handleClick.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = ht(), this.init();
347
+ }
348
+ init() {
349
+ R({
350
+ positiveColor: this.config.colors.positive,
351
+ negativeColor: this.config.colors.negative,
352
+ markerColor: this.config.colors.marker,
353
+ skipButtonStyles: !!this.config.buttonClass,
354
+ buttonSize: this.config.buttonSize,
355
+ modalWidth: this.config.modalWidth,
356
+ backdropOpacity: this.config.backdropOpacity,
357
+ fontFamily: this.config.fontFamily,
358
+ fontSize: this.config.fontSize
359
+ }), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.fetchAllowedFeatures(), this.consoleCapture = rt((t) => {
360
+ var e;
361
+ this.feedbackData.consoleErrors = ((e = this.consoleCapture) == null ? void 0 : e.errors) ?? [];
362
+ }), this.feedbackData.consoleErrors = this.consoleCapture.errors;
363
+ }
364
+ async fetchAllowedFeatures() {
365
+ if (this.config.apiKey)
366
+ try {
367
+ const e = `${this.config.endpoint.replace(/\/feedback\/?$/, "")}/features?apiKey=${encodeURIComponent(this.config.apiKey)}`, o = await fetch(e);
368
+ o.ok && (this.allowedFeatures = await o.json());
369
+ } catch {
370
+ }
371
+ }
372
+ checkMobile() {
373
+ this.isMobile = dt();
374
+ }
375
+ handleResize() {
376
+ this.checkMobile();
377
+ }
378
+ createEmbed() {
379
+ let t = null;
380
+ if (this.config.container && (t = document.querySelector(this.config.container)), t)
381
+ this.container = t, this.container.classList.add("qaid-widget", `qaid-${this.config.position}`), this.config.incognito && this.container.classList.add("qaid-incognito"), this.isUserProvidedContainer = !0;
382
+ else {
383
+ this.container = document.createElement("div"), this.container.className = `qaid-widget qaid-auto-container qaid-${this.config.position}${this.config.incognito ? " qaid-incognito" : ""}`, this.container.style.zIndex = String(this.config.zIndex);
384
+ const { x: u, y: m } = this.config.offset;
385
+ this.config.position.includes("right") ? this.container.style.right = `${u}px` : this.container.style.left = `${u}px`, this.config.position.includes("bottom") ? this.container.style.bottom = `${m}px` : this.container.style.top = `${m}px`, document.body.appendChild(this.container);
386
+ }
387
+ const e = this.config.fontFamily, o = e && e !== "system-ui, -apple-system, sans-serif";
388
+ o && (this.container.style.fontFamily = e);
389
+ const n = !!this.config.buttonClass, a = n ? `qaid-btn-structural ${this.config.buttonClass}` : "qaid-btn", s = this.config.skipTargeting ? "Send feedback" : "Any feedback? Click to start, Esc to cancel", l = this.config.text.tooltip || s, r = document.createElement("div");
390
+ r.className = "qaid-tooltip-text", r.textContent = l, o && (r.style.fontFamily = e), document.body.appendChild(r), this.tooltipElement = r;
391
+ const c = document.createElement("div");
392
+ c.className = "qaid-tooltip-wrapper";
393
+ const p = document.createElement("button");
394
+ p.type = "button", p.className = n ? `${a} qaid-btn-up` : "qaid-btn qaid-btn-up", p.innerHTML = this.config.positiveIcon || y, p.addEventListener("click", (u) => this.handleThumbClick("up", u.currentTarget)), p.addEventListener("mouseenter", () => this.showTooltip(p)), p.addEventListener("mouseleave", () => this.hideTooltip()), c.appendChild(p);
395
+ const f = document.createElement("div");
396
+ f.className = "qaid-tooltip-wrapper";
397
+ const h = document.createElement("button");
398
+ h.type = "button", h.className = n ? `${a} qaid-btn-down` : "qaid-btn qaid-btn-down", h.innerHTML = this.config.negativeIcon || q, h.addEventListener("click", (u) => this.handleThumbClick("down", u.currentTarget)), h.addEventListener("mouseenter", () => this.showTooltip(h)), h.addEventListener("mouseleave", () => this.hideTooltip()), f.appendChild(h), this.container.appendChild(c), this.container.appendChild(f);
399
+ }
400
+ showTooltip(t) {
401
+ if (!this.tooltipElement) return;
402
+ const e = this.tooltipElement, o = 8;
403
+ e.style.visibility = "hidden", e.classList.add("qaid-tooltip-visible");
404
+ const n = t.getBoundingClientRect(), a = e.getBoundingClientRect(), s = window.innerWidth, l = window.innerHeight;
405
+ let r, c;
406
+ r = n.bottom + o, r + a.height > l - o && (r = n.top - a.height - o), c = n.left, c < o ? c = o : c + a.width > s - o && (c = s - a.width - o), r < o ? r = o : r + a.height > l - o && (r = l - a.height - o), e.style.top = `${r}px`, e.style.left = `${c}px`, e.style.visibility = "visible";
407
+ }
408
+ hideTooltip() {
409
+ this.tooltipElement && this.tooltipElement.classList.remove("qaid-tooltip-visible");
410
+ }
411
+ handleThumbClick(t, e) {
412
+ this.config.skipTargeting ? this.submitDirectFeedback(t, e) : this.startTargeting(t);
413
+ }
414
+ submitDirectFeedback(t, e) {
415
+ this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null;
416
+ const o = e.getBoundingClientRect();
417
+ this.selectedBounds = {
418
+ x: o.left,
419
+ y: o.top,
420
+ width: o.width,
421
+ height: o.height,
422
+ clickX: o.left + o.width / 2,
423
+ clickY: o.top + o.height / 2,
424
+ visible: !1
425
+ }, this.submitFeedback();
426
+ }
427
+ startTargeting(t) {
428
+ this.state = "TARGETING", this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), this.createTargetingOverlay(), document.addEventListener("keydown", this.boundKeyDown);
429
+ }
430
+ createTargetingOverlay() {
431
+ this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer", this.captureLayer.addEventListener("mousemove", this.boundMouseMove), this.captureLayer.addEventListener("click", this.boundClick);
432
+ const t = document.createElement("div");
433
+ t.className = `qaid-banner qaid-banner-${this.feedbackData.feedbackType}`;
434
+ const e = this.config.fontFamily;
435
+ e && e !== "system-ui, -apple-system, sans-serif" && (t.style.fontFamily = e), t.innerHTML = `
436
+ <span class="qaid-banner-text">${this.config.text.bannerText}</span>
437
+ <span class="qaid-banner-hint">${this.config.text.bannerHint}</span>
438
+ `;
439
+ const o = document.createElement("div");
440
+ o.className = "qaid-vignette", this.crosshairH = document.createElement("div"), this.crosshairH.className = "qaid-crosshair-h", this.crosshairV = document.createElement("div"), this.crosshairV.className = "qaid-crosshair-v", this.scope = document.createElement("div"), this.scope.className = "qaid-scope", this.scope.innerHTML = `
441
+ <div class="qaid-scope-ring"></div>
442
+ <div class="qaid-scope-ring-inner"></div>
443
+ <div class="qaid-scope-dot"></div>
444
+ `, this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(t), this.overlayContainer.appendChild(o), this.overlayContainer.appendChild(this.crosshairH), this.overlayContainer.appendChild(this.crosshairV), this.overlayContainer.appendChild(this.scope), document.body.appendChild(this.overlayContainer);
445
+ }
446
+ handleKeyDown(t) {
447
+ t.key === "Escape" && (this.state === "TARGETING" ? this.cancelTargeting() : this.state === "MODAL_OPEN" && this.closeModal());
448
+ }
449
+ handleMouseMove(t) {
450
+ if (this.mousePos.x = t.clientX, this.mousePos.y = t.clientY, this.crosshairH && (this.crosshairH.style.top = `${t.clientY}px`), this.crosshairV && (this.crosshairV.style.left = `${t.clientX}px`), this.scope && (this.scope.style.left = `${t.clientX}px`, this.scope.style.top = `${t.clientY}px`), this.captureLayer) {
451
+ const e = M(
452
+ t.clientX,
453
+ t.clientY,
454
+ this.captureLayer
455
+ );
456
+ e && !$(e) ? (this.lastHighlighted && this.lastHighlighted !== e && this.lastHighlighted.classList.remove("qaid-highlight"), e.classList.add("qaid-highlight"), this.lastHighlighted = e) : this.lastHighlighted && (this.lastHighlighted.classList.remove("qaid-highlight"), this.lastHighlighted = null);
457
+ }
458
+ }
459
+ handleClick(t) {
460
+ if (!this.captureLayer) return;
461
+ const e = M(
462
+ t.clientX,
463
+ t.clientY,
464
+ this.captureLayer
465
+ );
466
+ if (!e || $(e))
467
+ return;
468
+ e.classList.remove("qaid-highlight");
469
+ const o = lt(e, 8);
470
+ this.selectedBounds = {
471
+ ...o,
472
+ clickX: t.clientX,
473
+ clickY: t.clientY,
474
+ visible: !0
475
+ };
476
+ const { selector: n, text: a } = tt(e);
477
+ this.feedbackData.elementSelector = n, this.feedbackData.elementText = a, x("qaid-highlight"), this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), this.state = "SELECTED", this.showSelectedMarker(), this.submitFeedback();
478
+ }
479
+ cancelTargeting() {
480
+ x("qaid-highlight"), this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.removeEventListener("keydown", this.boundKeyDown), this.state = "IDLE", this.feedbackData.feedbackType = null, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, this.lastHighlighted = null;
481
+ }
482
+ removeTargetingOverlay() {
483
+ this.overlayContainer && (this.overlayContainer.remove(), this.overlayContainer = null), this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null;
484
+ }
485
+ showSelectedMarker() {
486
+ this.selectedBounds.visible && (this.marker = document.createElement("div"), this.marker.className = "qaid-selected-marker", this.marker.style.left = `${this.selectedBounds.x}px`, this.marker.style.top = `${this.selectedBounds.y}px`, this.marker.style.width = `${this.selectedBounds.width}px`, this.marker.style.height = `${this.selectedBounds.height}px`, this.marker.style.zIndex = String(this.config.zIndex + 1), document.body.appendChild(this.marker));
487
+ }
488
+ hideSelectedMarker() {
489
+ this.marker && (this.marker.remove(), this.marker = null);
490
+ }
491
+ async submitFeedback() {
492
+ var a;
493
+ if (!this.feedbackData.feedbackType) return;
494
+ let t = null;
495
+ const e = ((a = this.allowedFeatures) == null ? void 0 : a.screenshots) !== !1;
496
+ this.config.captureScreenshot && e && (t = await ct(this.config.screenshotOptions));
497
+ const o = this.feedbackData.elementSelector ? {
498
+ x: this.selectedBounds.x,
499
+ y: this.selectedBounds.y,
500
+ width: this.selectedBounds.width,
501
+ height: this.selectedBounds.height
502
+ } : null, n = {
503
+ feedbackType: this.feedbackData.feedbackType,
504
+ pageUrl: window.location.href,
505
+ apiKey: this.config.apiKey || void 0,
506
+ elementSelector: this.feedbackData.elementSelector,
507
+ elementText: this.feedbackData.elementText,
508
+ consoleErrors: [...this.feedbackData.consoleErrors],
509
+ screenWidth: window.innerWidth,
510
+ screenHeight: window.innerHeight,
511
+ clickX: this.selectedBounds.clickX,
512
+ clickY: this.selectedBounds.clickY,
513
+ scrollX: window.scrollX,
514
+ scrollY: window.scrollY,
515
+ screenshot: t,
516
+ visitorId: this.visitorId,
517
+ // Include element bounds and user agent for server-side screenshot fallback
518
+ elementBounds: o,
519
+ userAgent: navigator.userAgent
520
+ };
521
+ try {
522
+ const s = await fetch(this.config.endpoint, {
523
+ method: "POST",
524
+ headers: { "Content-Type": "application/json" },
525
+ body: JSON.stringify(n)
526
+ });
527
+ if (s.ok) {
528
+ const l = await s.json();
529
+ this.feedbackId = l.id;
530
+ }
531
+ } catch (s) {
532
+ console.error("Failed to submit feedback:", s);
533
+ }
534
+ this.state = "MODAL_OPEN", this.showModal();
535
+ }
536
+ showModal() {
537
+ this.backdrop = document.createElement("div"), this.backdrop.className = "qaid-backdrop", this.backdrop.style.zIndex = String(this.config.zIndex + 2), this.backdrop.style.background = `rgba(0, 0, 0, ${this.config.backdropOpacity})`, this.backdrop.addEventListener("click", () => this.closeModal()), this.isMobile ? this.showBottomSheet() : this.showPositionedModal(), document.body.appendChild(this.backdrop), document.addEventListener("keydown", this.boundKeyDown);
538
+ }
539
+ showBottomSheet() {
540
+ const t = document.createElement("div");
541
+ t.className = "qaid-bottom-sheet", t.style.zIndex = String(this.config.zIndex + 3);
542
+ const e = this.config.fontFamily;
543
+ e && e !== "system-ui, -apple-system, sans-serif" && (t.style.fontFamily = e), t.innerHTML = `
544
+ <div class="qaid-bottom-sheet-content">
545
+ <div class="qaid-bottom-sheet-handle"></div>
546
+ ${this.getModalContent()}
547
+ </div>
548
+ `, document.body.appendChild(t), this.modalContainer = t, this.setupModalInteractions();
549
+ }
550
+ showPositionedModal() {
551
+ const { modal: t, arrow: e } = at(
552
+ this.selectedBounds,
553
+ window.innerWidth,
554
+ window.innerHeight,
555
+ {
556
+ width: this.config.modalWidth,
557
+ height: 280,
558
+ arrowHeight: 12,
559
+ gap: 8,
560
+ viewportPadding: 16
561
+ }
562
+ );
563
+ this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${t.position}`, this.modalContainer.style.top = `${t.top}px`, this.modalContainer.style.left = `${t.left}px`, this.modalContainer.style.zIndex = String(this.config.zIndex + 3);
564
+ const o = this.config.fontFamily;
565
+ o && o !== "system-ui, -apple-system, sans-serif" && (this.modalContainer.style.fontFamily = o);
566
+ const n = document.createElement("div");
567
+ n.className = "qaid-modal-arrow", n.style.left = `${e.left}px`;
568
+ const a = document.createElement("div");
569
+ a.className = "qaid-modal-box", a.innerHTML = this.getModalContent(), this.modalContainer.appendChild(n), this.modalContainer.appendChild(a), document.body.appendChild(this.modalContainer), this.setupModalInteractions();
570
+ }
571
+ getModalContent() {
572
+ const t = this.feedbackData.feedbackType === "up", e = this.config.positiveIcon || y, o = this.config.negativeIcon || q;
573
+ return `
574
+ <div class="qaid-modal-header">
575
+ <button type="button" class="${this.config.buttonClass ? `qaid-type-toggle qaid-type-toggle-custom ${this.config.buttonClass} ${t ? "qaid-btn-up" : "qaid-btn-down"}` : `qaid-type-toggle ${t ? "qaid-type-up" : "qaid-type-down"}`}" title="Click to switch">
576
+ ${t ? e : o}
577
+ </button>
578
+ <div class="qaid-modal-header-text">
579
+ <h3 class="qaid-modal-title">${this.config.text.modalTitle}</h3>
580
+ <p class="qaid-modal-subtitle">${this.config.text.modalSubtitle}</p>
581
+ </div>
582
+ </div>
583
+ <textarea class="qaid-textarea" placeholder="${this.config.text.placeholder}"></textarea>
584
+ <div class="qaid-btn-row">
585
+ <button type="button" class="qaid-btn-submit">${this.config.text.skipButton}</button>
586
+ </div>
587
+ `;
588
+ }
589
+ setupModalInteractions() {
590
+ if (!this.modalContainer) return;
591
+ const t = this.modalContainer.querySelector(".qaid-textarea"), e = this.modalContainer.querySelector(".qaid-btn-submit");
592
+ t && (setTimeout(() => t.focus(), 100), t.addEventListener("input", () => {
593
+ e && (e.textContent = t.value.trim() ? this.config.text.submitButton : this.config.text.skipButton);
594
+ })), e && e.addEventListener("click", () => {
595
+ const n = (t == null ? void 0 : t.value.trim()) || null;
596
+ this.submitMessage(n);
597
+ });
598
+ const o = this.modalContainer.querySelector(".qaid-type-toggle");
599
+ o && o.addEventListener("click", () => {
600
+ const n = this.feedbackData.feedbackType === "up" ? "down" : "up";
601
+ this.feedbackData.feedbackType = n, this.config.buttonClass ? (o.classList.toggle("qaid-btn-up", n === "up"), o.classList.toggle("qaid-btn-down", n === "down")) : (o.classList.toggle("qaid-type-up", n === "up"), o.classList.toggle("qaid-type-down", n === "down"));
602
+ const a = this.config.positiveIcon || y, s = this.config.negativeIcon || q;
603
+ o.innerHTML = n === "up" ? a : s, this.feedbackId && fetch(`${this.config.endpoint}/${this.feedbackId}`, {
604
+ method: "PATCH",
605
+ headers: { "Content-Type": "application/json" },
606
+ body: JSON.stringify({ feedbackType: n })
607
+ }).catch((l) => console.error("Failed to update feedback type:", l));
608
+ });
609
+ }
610
+ async submitMessage(t) {
611
+ if (this.feedbackId) {
612
+ try {
613
+ await fetch(`${this.config.endpoint}/${this.feedbackId}`, {
614
+ method: "PATCH",
615
+ headers: { "Content-Type": "application/json" },
616
+ body: JSON.stringify({ message: t })
617
+ });
618
+ } catch (e) {
619
+ console.error("Failed to submit feedback message:", e);
620
+ }
621
+ this.feedbackId = null;
622
+ }
623
+ this.closeModal();
624
+ }
625
+ closeModal() {
626
+ this.state === "MODAL_OPEN" && this.feedbackId && fetch(`${this.config.endpoint}/${this.feedbackId}`, {
627
+ method: "PATCH",
628
+ headers: { "Content-Type": "application/json" },
629
+ body: JSON.stringify({ message: null })
630
+ }).catch((t) => console.error("Failed to finalize feedback:", t)), this.modalContainer && (this.modalContainer.remove(), this.modalContainer = null), this.backdrop && (this.backdrop.remove(), this.backdrop = null), document.removeEventListener("keydown", this.boundKeyDown), this.hideSelectedMarker(), this.state = "IDLE", this.feedbackId = null, this.feedbackData.feedbackType = null, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1;
631
+ }
632
+ /**
633
+ * Destroy the embed and clean up all resources
634
+ */
635
+ destroy() {
636
+ this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), x("qaid-highlight"), document.body.classList.remove("qaid-targeting", "qaid-type-up"), this.container && (this.isUserProvidedContainer ? (this.container.innerHTML = "", this.container.classList.remove("qaid-widget", `qaid-${this.config.position}`)) : this.container.remove(), this.container = null), this.removeTargetingOverlay(), this.hideSelectedMarker(), this.modalContainer && (this.modalContainer.remove(), this.modalContainer = null), this.backdrop && (this.backdrop.remove(), this.backdrop = null), this.tooltipElement && (this.tooltipElement.remove(), this.tooltipElement = null), K();
637
+ }
638
+ }
639
+ function ut() {
640
+ var e;
641
+ const i = document.querySelector(
642
+ 'script[type="application/json"][data-feedback-config]'
643
+ );
644
+ if (!i) return null;
645
+ const t = (e = i.textContent) == null ? void 0 : e.trim();
646
+ if (!t) return null;
647
+ try {
648
+ return JSON.parse(t);
649
+ } catch {
650
+ return null;
651
+ }
652
+ }
653
+ function mt(i) {
654
+ const t = i.getAttribute("data-endpoint");
655
+ if (!t) return null;
656
+ const e = i.getAttribute("data-position"), o = i.getAttribute("data-zindex"), n = i.getAttribute("data-positive-color"), a = i.getAttribute("data-negative-color"), s = i.getAttribute("data-marker-color"), l = i.getAttribute("data-container"), r = i.getAttribute("data-button-class"), c = i.getAttribute("data-skip-targeting"), p = i.getAttribute("data-incognito"), f = i.getAttribute("data-button-size"), h = i.getAttribute("data-offset-x"), u = i.getAttribute("data-offset-y"), m = i.getAttribute("data-modal-width"), b = i.getAttribute("data-backdrop-opacity"), g = i.getAttribute("data-font-family"), v = i.getAttribute("data-font-size"), w = i.getAttribute("data-tooltip"), C = i.getAttribute("data-banner-text"), T = i.getAttribute("data-banner-hint"), S = i.getAttribute("data-modal-title"), E = i.getAttribute("data-modal-subtitle"), I = i.getAttribute("data-placeholder"), z = i.getAttribute("data-submit-button"), L = i.getAttribute("data-skip-button"), H = i.getAttribute("data-positive-icon"), F = i.getAttribute("data-negative-icon");
657
+ return {
658
+ endpoint: t,
659
+ container: l ?? void 0,
660
+ buttonClass: r ?? void 0,
661
+ position: e ?? void 0,
662
+ zIndex: o ? parseInt(o, 10) : void 0,
663
+ skipTargeting: c === "true" ? !0 : void 0,
664
+ incognito: p === "true" ? !0 : void 0,
665
+ buttonSize: f ?? void 0,
666
+ offset: h || u ? {
667
+ x: h ? parseInt(h, 10) : void 0,
668
+ y: u ? parseInt(u, 10) : void 0
669
+ } : void 0,
670
+ modalWidth: m ? parseInt(m, 10) : void 0,
671
+ backdropOpacity: b ? parseFloat(b) : void 0,
672
+ fontFamily: g ?? void 0,
673
+ fontSize: v ? parseInt(v, 10) : void 0,
674
+ colors: {
675
+ positive: n ?? void 0,
676
+ negative: a ?? void 0,
677
+ marker: s ?? void 0
678
+ },
679
+ text: w || C || T || S || E || I || z || L ? {
680
+ tooltip: w ?? void 0,
681
+ bannerText: C ?? void 0,
682
+ bannerHint: T ?? void 0,
683
+ modalTitle: S ?? void 0,
684
+ modalSubtitle: E ?? void 0,
685
+ placeholder: I ?? void 0,
686
+ submitButton: z ?? void 0,
687
+ skipButton: L ?? void 0
688
+ } : void 0,
689
+ positiveIcon: H ?? void 0,
690
+ negativeIcon: F ?? void 0
691
+ };
692
+ }
693
+ if (typeof document < "u") {
694
+ const i = () => {
695
+ const t = document.currentScript, e = ut(), o = t ? mt(t) : null, n = e ?? o;
696
+ n != null && n.endpoint && new pt(n);
697
+ };
698
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", i) : i();
699
+ }
700
+ export {
701
+ pt as FeedbackEmbed
702
+ };
703
+ //# sourceMappingURL=qaid.js.map