@qaiddev/thumbs-embed 1.13.0 → 1.14.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.
Files changed (38) hide show
  1. package/README.md +20 -12
  2. package/dist/chunks/{annotate-1zompTEi.js → annotate-Dvrfeb8k.js} +2 -2
  3. package/dist/chunks/{annotate-1zompTEi.js.map → annotate-Dvrfeb8k.js.map} +1 -1
  4. package/dist/chunks/core-C36Mpll9.js +26 -0
  5. package/dist/chunks/core-C36Mpll9.js.map +1 -0
  6. package/dist/chunks/modal-CXZZ6LG0.js +2 -0
  7. package/dist/chunks/modal-CXZZ6LG0.js.map +1 -0
  8. package/dist/chunks/recording-D_iYhxpC.js +2 -0
  9. package/dist/chunks/recording-D_iYhxpC.js.map +1 -0
  10. package/dist/chunks/send-o4flR35U.js +2 -0
  11. package/dist/chunks/{send-C3IvslZA.js.map → send-o4flR35U.js.map} +1 -1
  12. package/dist/chunks/{targeting-Bpbt68Pp.js → targeting-Jjo_Jyqy.js} +2 -2
  13. package/dist/chunks/{targeting-Bpbt68Pp.js.map → targeting-Jjo_Jyqy.js.map} +1 -1
  14. package/dist/embed-loader.d.ts +18 -5
  15. package/dist/embed.d.ts +4 -4
  16. package/dist/embed.js +1 -1
  17. package/dist/embed.js.map +1 -1
  18. package/dist/index.js +1563 -1479
  19. package/dist/index.js.map +1 -1
  20. package/dist/integrity-probe.js +2 -0
  21. package/dist/loader.js +1 -1
  22. package/dist/modal.d.ts +7 -2
  23. package/dist/network-capture.d.ts +4 -0
  24. package/dist/qaid.umd.cjs +15 -15
  25. package/dist/qaid.umd.cjs.map +1 -1
  26. package/dist/quest-config.d.ts +3 -3
  27. package/dist/redact.d.ts +40 -0
  28. package/dist/send.d.ts +2 -2
  29. package/dist/trusted-types.d.ts +7 -0
  30. package/dist/types.d.ts +13 -0
  31. package/package.json +1 -1
  32. package/dist/chunks/core-vu1EieDc.js +0 -26
  33. package/dist/chunks/core-vu1EieDc.js.map +0 -1
  34. package/dist/chunks/modal-5G2DhiUE.js +0 -2
  35. package/dist/chunks/modal-5G2DhiUE.js.map +0 -1
  36. package/dist/chunks/recording-CVwPTtB0.js +0 -2
  37. package/dist/chunks/recording-CVwPTtB0.js.map +0 -1
  38. package/dist/chunks/send-C3IvslZA.js +0 -2
@@ -7,15 +7,15 @@
7
7
  * changed file on the CDN refuses to load instead of running.
8
8
  */
9
9
  /** The quests-embed release this thumbs-embed release opens quests with. */
10
- export declare const QUESTS_VERSION = "1.11.0";
10
+ export declare const QUESTS_VERSION = "1.12.0";
11
11
  /** Default ES-module URL for the quests embed: one exact release on unpkg. */
12
- export declare const DEFAULT_QUESTS_MODULE_URL = "https://unpkg.com/@qaiddev/quests-embed@1.11.0/dist/qaid-quests.js";
12
+ export declare const DEFAULT_QUESTS_MODULE_URL = "https://unpkg.com/@qaiddev/quests-embed@1.12.0/dist/qaid-quests.js";
13
13
  /**
14
14
  * Subresource Integrity of {@link DEFAULT_QUESTS_MODULE_URL}: the sha384 of
15
15
  * quests-embed's `dist/qaid-quests.js` at {@link QUESTS_VERSION}. Change the
16
16
  * two together.
17
17
  */
18
- export declare const DEFAULT_QUESTS_MODULE_INTEGRITY = "sha384-w5xVbyvdrJUM+he0J0AFPtdzfem3CLSbVKUydXWcMAP28z2anhQmlNgWGulyY7kl";
18
+ export declare const DEFAULT_QUESTS_MODULE_INTEGRITY = "sha384-oM2IICRGTBJ5EmRM+mZIB0Pe8vlwoYOch6taqlZ3+k+1Zptxqwigi+5mwLOQprtj";
19
19
  /**
20
20
  * The module URL to use for a configured `moduleUrl`. A custom URL is kept
21
21
  * only when it is same-origin with the page (self-hosting) or one exact
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Redaction for captured debugging context (2026-11 audit).
3
+ *
4
+ * The embed attaches console messages and failed network calls to a report so
5
+ * a team can see what broke. That context comes from the partner's page and
6
+ * goes to qaid's server, so it must not carry the visitor's secrets. The aim is
7
+ * to keep what helps debugging (which call failed, with what status, and what
8
+ * the app logged) and drop what nobody needs to see:
9
+ *
10
+ * - Request bodies are never captured (a 401 on a login form would carry the
11
+ * password).
12
+ * - A response body is replaced by REDACTED when the status is 401 or 403, or
13
+ * the URL looks like sign-in, auth, token, password, session or OAuth.
14
+ * - URL query (and fragment) parameters named like a credential have their
15
+ * values replaced, and any user:password@ is removed.
16
+ * - Console messages and kept response bodies have obvious secrets replaced:
17
+ * Bearer/Basic credentials, JWTs, password=… style pairs, long hex or
18
+ * base64 keys, and card-number-like digit runs. Each is then capped.
19
+ */
20
+ export declare const REDACTED = "[redacted]";
21
+ /** Longest console message kept, in characters. */
22
+ export declare const MAX_CONSOLE_MESSAGE = 1000;
23
+ /** Replace obvious secrets in free text. */
24
+ export declare function redactText(text: string): string;
25
+ /** Cut `text` to `max` characters, marking the cut. */
26
+ export declare function capLength(text: string, max: number): string;
27
+ /** A console message, safe to send: secrets replaced, then capped. */
28
+ export declare function redactConsoleMessage(text: string): string;
29
+ /**
30
+ * A URL with credential-like query and fragment parameters replaced and any
31
+ * user:password@ removed. A relative URL stays relative.
32
+ */
33
+ export declare function redactUrl(raw: string): string;
34
+ /** True when a URL looks like sign-in, auth or credentials. */
35
+ export declare function isSensitiveUrl(raw: string): boolean;
36
+ /**
37
+ * A failed response's body, safe to send: REDACTED for auth failures and
38
+ * sign-in-ish URLs, otherwise with obvious secrets replaced.
39
+ */
40
+ export declare function redactResponseBody(url: string, status: number, body: string | undefined): string | undefined;
package/dist/send.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { type QuestInstance } from "./quest-launcher";
12
12
  import type { ModalController } from "./modal";
13
- import type { ResolvedFeedbackConfig, EmbedState, FeedbackData, SelectedBounds } from "./types";
13
+ import type { ResolvedFeedbackConfig, EmbedState, FeedbackData, SelectedBounds, FeedbackRecord } from "./types";
14
14
  /** The slice of the embed the send flow needs. */
15
15
  export interface SendHost {
16
16
  readonly config: ResolvedFeedbackConfig;
@@ -24,7 +24,7 @@ export interface SendHost {
24
24
  activeQuest: QuestInstance | null;
25
25
  setState(state: EmbedState): void;
26
26
  /** Record the pending POST, which the message box's PATCHes wait on. */
27
- setFeedbackId(id: Promise<number | null>): void;
27
+ setFeedbackRecord(record: Promise<FeedbackRecord | null>): void;
28
28
  shouldCaptureViaDom(): boolean;
29
29
  ensureOverlayHost(): ShadowRoot;
30
30
  ensureModal(): Promise<ModalController>;
@@ -25,5 +25,12 @@ export declare var POLICY_NAME: string;
25
25
  * when one exists, else the string itself.
26
26
  */
27
27
  export declare function trustedScriptUrl(url: string): string;
28
+ /**
29
+ * A value for an inline script's `text`: a TrustedScript from the `qaid-embed`
30
+ * policy when one exists, else the string itself. Only embed.js's import map
31
+ * uses it. Throws when the page's policy can't sign scripts (one an older
32
+ * release created); the caller then takes its fallback.
33
+ */
34
+ export declare function trustedScript(text: string): string;
28
35
  /** @internal Test seam: forget the page's policy. */
29
36
  export declare function _resetTrustedTypes(): void;
package/dist/types.d.ts CHANGED
@@ -213,7 +213,9 @@ export interface NetworkError {
213
213
  method: string;
214
214
  status: number;
215
215
  statusText: string;
216
+ /** Never set since 2026-11: a request body can hold a password. Kept for old readers. */
216
217
  requestBody?: string;
218
+ /** Absent or "[redacted]" for 401/403 and sign-in-ish URLs; secrets replaced otherwise. */
217
219
  responseBody?: string;
218
220
  timestamp: number;
219
221
  }
@@ -290,6 +292,17 @@ export interface FeedbackPayload {
290
292
  */
291
293
  export interface FeedbackResponse {
292
294
  id: number;
295
+ /**
296
+ * Proof that this visitor created the record. Newer servers send it with
297
+ * the create response and require it on every PATCH to `endpoint/{id}`;
298
+ * older servers omit it.
299
+ */
300
+ editToken?: string;
301
+ }
302
+ /** The record a feedback POST created: what its follow-up PATCHes need. */
303
+ export interface FeedbackRecord {
304
+ id: number;
305
+ editToken?: string;
293
306
  }
294
307
  /**
295
308
  * Payload for updating feedback with a message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qaiddev/thumbs-embed",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Precision User Feedback",
5
5
  "type": "module",
6
6
  "main": "./dist/qaid.umd.cjs",
@@ -1,26 +0,0 @@
1
- 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">
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>`,G=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
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>`,_t=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
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>`,X=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
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>`,Ut='<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>',Ft=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
10
- <rect x="4" y="6" width="16" height="12" rx="1" stroke-linejoin="round"/>
11
- </svg>`,Vt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
12
- <path stroke-linecap="round" stroke-linejoin="round" d="M5 19L19 5m0 0h-8m8 0v8"/>
13
- </svg>`,$t=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
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>`,Kt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
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>`,Wt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
18
- <path stroke-linecap="round" stroke-linejoin="round" d="M9 14L4 9l5-5M4 9h11a5 5 0 010 10h-4"/>
19
- </svg>`,jt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
20
- <path stroke-linecap="round" stroke-linejoin="round" d="M20 6L9 17l-5-5"/>
21
- </svg>`,Qt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
22
- <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v8m0 4h.01"/>
23
- </svg>`,Yt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
24
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6L6 18"/>
25
- </svg>`,Gt="http://www.w3.org/2000/svg",J={};for(const e of["svg","g","path","circle","ellipse","rect","line","polyline","polygon","title","desc","defs","linearGradient","radialGradient","stop","clipPath"])J[e.toLowerCase()]=e;const Z={};for(const e of["viewBox","width","height","preserveAspectRatio","version","fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","clip-rule","clip-path","clipPathUnits","opacity","vector-effect","shape-rendering","d","points","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","transform","class","id","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","aria-hidden","aria-label","focusable","role"])Z[e.toLowerCase()]=e;const Xt=new Set(["title","desc"]),tt=5e4,Jt=1e3,Zt={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:"\xA0"};function et(e){return e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(t,o)=>{if(o[0]==="#"){const i=o[1]==="x"||o[1]==="X"?parseInt(o.slice(2),16):parseInt(o.slice(1),10);return i>0&&i<=1114111?String.fromCodePoint(i):""}return Zt[o.toLowerCase()]??t})}const ot=/url\(\s*(['"]?)#[A-Za-z_][\w.:-]*\1\s*\)/gi;function te(e,t){const o=t.replace(/[\u0000- \u007f-\u009f]+/g,"").toLowerCase();if(/(java|vb)script:|data:|expression\(/.test(o))return!1;const i=t.replace(ot,"");return/url\(/.test(i.replace(/[\u0000- \u007f-\u009f]+/g,"").toLowerCase())?!1:e==="clip-path"?/^\s*none\s*$/i.test(t)||new RegExp(`^\\s*${ot.source}\\s*$`,"i").test(t):!0}function it(e){if(typeof e!="string"||typeof document>"u")return null;const t=e.trim();if(!t||t.length>tt)return null;let o=null,i=!1,s=0;const a=[];let n=0;const u=()=>a[a.length-1];for(;n<t.length&&!i;){const m=t.indexOf("<",n),p=m===-1?t.length:m;if(p>n){const c=t.slice(n,p),f=u();if(f?.node&&Xt.has(f.name))f.node.appendChild(document.createTextNode(et(c)));else if(!f&&c.trim())return null}if(m===-1)break;if(n=m,t.startsWith("<!--",n)){const c=t.indexOf("-->",n+4);if(c===-1)return null;n=c+3;continue}if(t.startsWith("<?",n)){if(o)return null;const c=t.indexOf("?>",n+2);if(c===-1)return null;n=c+2;continue}if(t.startsWith("<!",n))return null;if(t[n+1]==="/"){const c=/^<\/\s*([A-Za-z][\w:.-]*)\s*>/.exec(t.slice(n,n+200));if(!c)return null;n+=c[0].length;const f=c[1].toLowerCase(),b=a.map(g=>g.name).lastIndexOf(f);b!==-1&&(a.length=b,b===0&&(i=!0));continue}const d=/^<([A-Za-z][\w:.-]*)/.exec(t.slice(n,n+200));if(!d)return null;const l=d[1].toLowerCase();n+=d[0].length;const h=[];let v=!1,k=!1;for(;n<t.length;){const c=/^\s*/.exec(t.slice(n,n+1e3))[0];if(n+=c.length,t.startsWith("/>",n)){v=!0,k=!0,n+=2;break}if(t[n]===">"){k=!0,n+=1;break}const f=/^([^\s=/>"'<]+)/.exec(t.slice(n,n+200));if(!f)return null;const b=f[1];n+=b.length;let g="";const A=/^\s*=\s*/.exec(t.slice(n,n+1e3));if(A){n+=A[0].length;const q=t[n];if(q==='"'||q==="'"){const w=t.indexOf(q,n+1);if(w===-1)return null;g=t.slice(n+1,w),n=w+1}else{const w=/^[^\s>]+/.exec(t.slice(n,n+tt));if(!w)return null;g=w[0],g.endsWith("/")&&t[n+g.length]===">"&&(g=g.slice(0,-1)),n+=g.length}}h.push([b,et(g)])}if(!k||++s>Jt)return null;const y=u();if(y){if(!y.node){v||a.push({name:l,node:null});continue}}else if(o||l!=="svg")return null;const S=J[l];if(!S){v||a.push({name:l,node:null});continue}const C=document.createElementNS(Gt,S);for(const[c,f]of h){const b=Z[c.toLowerCase()];b&&te(b,f)&&C.setAttribute(b,f)}y?y.node.appendChild(C):o=C,v?y||(i=!0):a.push({name:l,node:C})}return o}function nt(e,t){return(e?it(e):null)??it(t)}function x(e,t,o){e.textContent="",e.appendChild(nt(t,o))}const ee="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}}",oe="body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";let E=0;const ie="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)}",ne={small:36,medium:48,large:64},se={small:18,medium:24,large:32};function ae(e,t,o){const[i,s,a]=[e,t,o].map(n=>(n=n/255,n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)));return .2126*i+.7152*s+.0722*a}function re(e){if(e.startsWith("#")){const o=e.slice(1),i=o.length===3?o.split("").map(a=>a+a).join(""):o,s=parseInt(i,16);return{r:s>>16&255,g:s>>8&255,b:s&255}}const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);return t?{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])}:null}function de(e){const t=re(e);return t&&ae(t.r,t.g,t.b)>.4?"black":"white"}function le(e={}){const{positiveColor:t="rgb(0, 200, 83)",negativeColor:o="rgb(255, 0, 0)",markerColor:i="#6365f1",buttonSize:s="medium",modalWidth:a=400,backdropOpacity:n=.3,fontFamily:u="system-ui, -apple-system, sans-serif",fontSize:m=16}=e,p=ne[s],d=se[s],r=de(i);return{"--qaid-positive":t,"--qaid-negative":o,"--qaid-marker":i,"--qaid-marker-text":r,"--qaid-btn-size":`${p}px`,"--qaid-icon-size":`${d}px`,"--qaid-modal-width":`${a}px`,"--qaid-backdrop-opacity":String(n),"--qaid-font-family":u,"--qaid-font-size":`${m}px`}}function ce(e,t){for(const[o,i]of Object.entries(t))e.style.setProperty(o,i)}function st(){return ee+ie}function ue(){if(E++,E>1)return;const e=document.createElement("style");e.id="qaid-styles",e.textContent=oe,document.head.appendChild(e)}function he(){E<=0||(E--,E===0&&document.getElementById("qaid-styles")?.remove())}const at="data-qaid-a11y-live",fe="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;";function pe(e){return e.ownerDocument||document}function me(e,t){const o=t?"assertive":"polite",i=e.querySelector(`[${at}="${o}"]`);if(i)return i;const a=pe(e).createElement("div");return a.setAttribute(at,o),a.setAttribute("role",t?"alert":"status"),a.setAttribute("aria-live",t?"assertive":"polite"),a.setAttribute("aria-atomic","true"),a.style.cssText=fe,e.appendChild(a),a}function be(e,t,o={}){const i=me(e,!!o.assertive);i.textContent="",i.textContent=t}function ge(e,t,o,i={}){const s=i.gap??8;let a=e.bottom+s;a+t.height>o.height-s&&(a=e.top-t.height-s);let n=e.left;return n<s?n=s:n+t.width>o.width-s&&(n=o.width-t.width-s),a<s?a=s:a+t.height>o.height-s&&(a=o.height-t.height-s),{top:a,left:n}}const ve=20;function ye(e){const t=[],o=console.error,i=console.warn,s=console.log,a=(n,u)=>{const m={message:u.map(p=>String(p)).join(" "),timestamp:Date.now(),level:n};t.length>=ve&&t.shift(),t.push(m),e&&e(m)};return console.error=function(...n){a("error",n),o.apply(console,n)},console.warn=function(...n){a("warn",n),i.apply(console,n)},console.log=function(...n){a("log",n),s.apply(console,n)},{errors:t,restore:()=>{console.error=o,console.warn=i,console.log=s}}}function we(e,t,o){const i=document.createElement(e);if(t)for(const[s,a]of Object.entries(t))s==="className"?i.className=a:i.setAttribute(s,a);if(o)for(const s of o)typeof s=="string"?i.appendChild(document.createTextNode(s)):i.appendChild(s);return i}function ke(e=640){return typeof window<"u"&&window.innerWidth<e}function Ce(e,t,o){const i=o.map(a=>a.style.visibility);o.forEach(a=>a.style.visibility="hidden");const s=document.elementFromPoint(e,t);return o.forEach((a,n)=>a.style.visibility=i[n]),s}function qe(e){return e?e.hasAttribute("data-qaid-embed")||e.hasAttribute("data-qaid-embed-overlay")?!0:!!e.closest("[data-qaid-embed], [data-qaid-embed-overlay]"):!1}function xe(e,t=0){const o=e.getBoundingClientRect();return{x:o.left-t,y:o.top-t,width:o.width+t*2,height:o.height+t*2}}const Se="1.11.0",T=`https://unpkg.com/@qaiddev/quests-embed@${Se}/dist/qaid-quests.js`,Ae="sha384-w5xVbyvdrJUM+he0J0AFPtdzfem3CLSbVKUydXWcMAP28z2anhQmlNgWGulyY7kl",Ee=/^https:\/\/unpkg\.com\/@qaiddev\/quests-embed@\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?\//;let rt=!1;function Te(e){if(!e)return T;if(e===T)return e;try{const t=typeof location<"u"?location.href:void 0,o=new URL(e,t);if(Ee.test(o.href)&&!/%2e|%2f|%5c/i.test(o.pathname)||t&&o.origin===new URL(t).origin&&(o.protocol==="https:"||o.protocol==="http:"))return o.href}catch{}return rt||(rt=!0,console.warn(`[thumbs-embed] Ignoring quests moduleUrl "${e}": use a same-origin URL or https://unpkg.com/@qaiddev/quests-embed@<exact version>/\u2026. Using ${T}.`)),T}const dt="qaid_visitor_id",lt="qaid_hide_feedback",Ie=["#ef4444","#f59e0b","#22c55e","#3b82f6","#111827","#ffffff"];function Le(){return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function B(e){return e?`${lt}_${e}`:lt}function De(e){try{return localStorage.getItem(B(e))==="1"}catch{return!1}}function ct(e,t=!0){try{t?localStorage.setItem(B(e),"1"):localStorage.removeItem(B(e))}catch{}}function ut(){const e=typeof crypto<"u"?crypto:void 0;if(e&&typeof e.randomUUID=="function")return e.randomUUID();const t=new Uint8Array(16);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const o=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}function Me(){try{let e=localStorage.getItem(dt);return e||(e=ut(),localStorage.setItem(dt,e)),e}catch{return ut()}}function ht(e,t){const o=document.createElement("style");o.setAttribute("data-qaid-feature",""),o.textContent=t;const i=e.querySelectorAll("style[data-qaid-base], style[data-qaid-feature]"),s=i[i.length-1];e.insertBefore(o,s?s.nextSibling:e.firstChild)}class ft{config;state="IDLE";feedbackData={feedbackType:null,elementSelector:null,elementText:null,consoleErrors:[]};selectedBounds={x:0,y:0,width:0,height:0,clickX:0,clickY:0,visible:!1};feedbackIdPromise=Promise.resolve(null);questsPrewarmed=!1;activeQuest=null;isMobile=!1;visitorId;consoleCapture=null;recording=null;targeting=null;clickPathPrewarmed=!1;prewarmHandle=null;prewarmIsTimeout=!1;videoPrewarmed=!1;screenshotPrewarmed=!1;shadowHost=null;shadowRoot=null;overlayShadowHost=null;overlayShadowRoot=null;buttonsContainer=null;isUserProvidedContainer=!1;modal=null;dismissBtn=null;cssVars={};activeThumbBtn=null;keyboardActivation=!1;dialogModule=null;dialogClose=null;uid=Math.random().toString(36).slice(2,9);boundKeyDown;boundResize;_startDismissed=!1;destroyed=!1;domObserver=null;boundBeforeSwap=null;constructor(t){this.config={endpoint:t.endpoint,apiKey:t.apiKey??"",container:t.container??"",buttonClass:t.buttonClass??"",direction:t.direction??"horizontal",position:t.position??"bottom-right",offset:{x:t.offset?.x??16,y:t.offset?.y??16},zIndex:t.zIndex??50,skipTargeting:t.skipTargeting??!1,singleButton:t.singleButton??!1,feedbackMode:t.feedbackMode??"target",colors:{positive:t.colors?.positive??"rgb(0, 200, 83)",negative:t.colors?.negative??"rgb(255, 0, 0)",marker:t.colors?.marker??"#6365f1"},buttonSize:t.buttonSize??"medium",text:{tooltip:t.text?.tooltip??"",modalTitle:t.text?.modalTitle??"Thank you for your feedback!",modalSubtitle:t.text?.modalSubtitle??"Would you like to add a message to help us understand your feedback better?",placeholder:t.text?.placeholder??"Optional: Tell us more about your experience...",submitButton:t.text?.submitButton??"Submit",skipButton:t.text?.skipButton??"Skip",positiveLabel:t.text?.positiveLabel??"Send positive feedback",negativeLabel:t.text?.negativeLabel??"Send negative feedback",recordLabel:t.text?.recordLabel??"Record a screen recording",dismissLabel:t.text?.dismissLabel??"Hide Feedback",feedbackLabel:t.text?.feedbackLabel??"Send feedback",confirmationTitle:t.text?.confirmationTitle??"Thank you!",confirmationMessage:t.text?.confirmationMessage??"Your feedback has been received.",confirmationClose:t.text?.confirmationClose??"Close",errorTitle:t.text?.errorTitle??"Message not sent",errorMessage:t.text?.errorMessage??"Something went wrong, so we did not get your message. Please try again later."},hideConfirmation:t.hideConfirmation??!1,modalWidth:t.modalWidth??400,backdropOpacity:t.backdropOpacity??.3,fontFamily:t.fontFamily??"system-ui, -apple-system, sans-serif",fontSize:t.fontSize??16,captureScreenshot:t.captureScreenshot??!1,annotate:t.annotate??!0,annotationColor:t.annotationColor??t.colors?.marker??"#6365f1",annotationPalette:t.annotationPalette??Ie,screenshotMethod:t.screenshotMethod??"permission",screenshotOptions:{quality:t.screenshotOptions?.quality??.8,maxWidth:t.screenshotOptions?.maxWidth??1280,maxHeight:t.screenshotOptions?.maxHeight??800},incognito:t.incognito??!1,hideDismiss:t.hideDismiss??!1,positiveIcon:t.positiveIcon??"",negativeIcon:t.negativeIcon??"",feedbackIcon:t.feedbackIcon??"",hideThumbs:t.hideThumbs??!1,css:t.css??"",captureVideo:t.captureVideo??!1,videoOptions:{maxDuration:t.videoOptions?.maxDuration??15,redaction:t.videoOptions?.redaction??!1},recordIcon:t.recordIcon??"",quests:{base:t.quests?.base??"",up:t.quests?.up??"",down:t.quests?.down??"",video:t.quests?.video??"",apiKey:t.quests?.apiKey??t.apiKey??"",moduleUrl:Te(t.quests?.moduleUrl)}},this.boundKeyDown=this.handleKeyDown.bind(this),this.boundResize=this.handleResize.bind(this),this.visitorId=Me(),this.init()}applyVars(t){ce(t,this.cssVars)}announceMsg(t,o=!1){const i=this.overlayShadowRoot??this.shadowRoot;i&&be(i,t,{assertive:o})}async loadDialogA11y(){this.dialogModule??=await import("./send-C3IvslZA.js").then(t=>t.a)}openDialogA11y(t,o){this.dialogClose=this.dialogModule.openDialog(t,o)}closeDialogA11y(){const t=this.dialogClose;this.dialogClose=null,t?.()}clearActiveThumb(){this.activeThumbBtn&&(this.activeThumbBtn.setAttribute("aria-pressed","false"),this.activeThumbBtn=null)}init(){ue(),this.cssVars=le({positiveColor:this.config.colors.positive,negativeColor:this.config.colors.negative,markerColor:this.config.colors.marker,buttonSize:this.config.buttonSize,modalWidth:this.config.modalWidth,backdropOpacity:this.config.backdropOpacity,fontFamily:this.config.fontFamily,fontSize:this.config.fontSize}),!this.config.hideDismiss&&De(this.config.apiKey)&&(this._startDismissed=!0),this.checkMobile(),window.addEventListener("resize",this.boundResize),this.createEmbed(),this.consoleCapture=ye(t=>{this.feedbackData.consoleErrors=this.consoleCapture?.errors??[]}),this.feedbackData.consoleErrors=this.consoleCapture.errors,this.observeDom(),this.schedulePrewarm(()=>{this.prewarmClickPath(),this.config.captureVideo&&this.videoSupported()&&this.prewarmVideo(),this.config.captureScreenshot&&this.prewarmScreenshot(),this.prewarmQuests()})}prewarmClickPath(){this.clickPathPrewarmed||(this.clickPathPrewarmed=!0,import("./send-C3IvslZA.js").then(t=>t.s).catch(()=>{}),import("./send-C3IvslZA.js").then(t=>t.a).catch(()=>{}),import("./modal-5G2DhiUE.js").catch(()=>{}),this.skipsTargeting()||import("./targeting-Bpbt68Pp.js").catch(()=>{}))}skipsTargeting(){return this.config.skipTargeting||this.config.feedbackMode==="annotate"}prewarmVideo(){this.videoPrewarmed||(this.videoPrewarmed=!0,import("./recording-CVwPTtB0.js").catch(()=>{}),import("./video-BSP4s2te.js").catch(()=>{}))}prewarmScreenshot(){this.screenshotPrewarmed||(this.screenshotPrewarmed=!0,(this.shouldCaptureViaDom()?import("./screenshot-dom-DO-0UlOz.js"):import("./screenshot-CNe1irEz.js")).catch(()=>{}),this.config.annotate&&import("./annotate-1zompTEi.js").catch(()=>{}))}linkedQuestIds(){const t=this.config.quests;return t.base?[t.up,t.down,t.video].filter(o=>o):[]}prewarmQuests(){if(this.questsPrewarmed)return;const t=this.linkedQuestIds();if(t.length===0)return;this.questsPrewarmed=!0;const{base:o,moduleUrl:i}=this.config.quests;import("./send-C3IvslZA.js").then(s=>s.q).then(s=>{s.loadQuestsModule(i).catch(()=>{});for(const a of t)s.prefetchQuestDefinition(s.questDefinitionUrl(o,a))}).catch(()=>{})}schedulePrewarm(t){const o=window,i=()=>{this.destroyed||t()};typeof o.requestIdleCallback=="function"?(this.prewarmIsTimeout=!1,this.prewarmHandle=o.requestIdleCallback(i,{timeout:2e3})):(this.prewarmIsTimeout=!0,this.prewarmHandle=window.setTimeout(i,1200))}observeDom(){this.boundBeforeSwap=t=>{const o=t.newDocument;!o||this.destroyed||(this.shadowHost&&o.body.appendChild(this.shadowHost),this.overlayShadowHost&&o.body.appendChild(this.overlayShadowHost))},document.addEventListener("astro:before-swap",this.boundBeforeSwap),this.domObserver=new MutationObserver(()=>{this.destroyed||(this.shadowHost&&!this.shadowHost.isConnected&&document.body.appendChild(this.shadowHost),this.overlayShadowHost&&!this.overlayShadowHost.isConnected&&document.body.appendChild(this.overlayShadowHost))}),this.domObserver.observe(document.body,{childList:!0})}checkMobile(){this.isMobile=ke()}handleResize(){this.checkMobile()}createEmbed(){this.shadowHost=document.createElement("div"),this.shadowHost.setAttribute("data-qaid-embed",""),this.shadowHost.style.position="static",this.shadowHost.style.display="contents";let t=null;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"});const o=document.createElement("style");if(o.setAttribute("data-qaid-base",""),o.textContent=st(),this.shadowRoot.appendChild(o),this.config.css){const d=document.createElement("style");d.textContent=this.config.css,this.shadowRoot.appendChild(d)}const i=this.config.direction==="vertical"?"qaid-vertical":"";if(this.isUserProvidedContainer)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");else{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";const{x:d,y:r}=this.config.offset;this.config.position.includes("right")?this.buttonsContainer.style.right=`${d}px`:this.buttonsContainer.style.left=`${d}px`,this.config.position.includes("bottom")?this.buttonsContainer.style.bottom=`${r}px`:this.buttonsContainer.style.top=`${r}px`}this.applyVars(this.buttonsContainer),this.shadowRoot.appendChild(this.buttonsContainer),this.buttonsContainer.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" "||d.key==="Spacebar")&&(this.keyboardActivation=!0)}),this.buttonsContainer.addEventListener("mousedown",()=>{this.keyboardActivation=!1}),this.buttonsContainer.addEventListener("pointerdown",()=>{this.keyboardActivation=!1});const s=()=>this.prewarmClickPath();this.buttonsContainer.addEventListener("pointerenter",s),this.buttonsContainer.addEventListener("focusin",s);const a=!!this.config.buttonClass,n=a?`qaid-btn-structural ${this.config.buttonClass}`:"qaid-btn",m=this.config.text.tooltip||"Feedback for us?",p=document.createElement("div");if(p.className="qaid-tooltip-text",p.textContent=m,this.applyVars(p),this.shadowRoot.appendChild(p),this.tooltipElement=p,this.config.singleButton){const d=document.createElement("div");d.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${n} qaid-btn-feedback`:"qaid-btn qaid-btn-feedback",r.setAttribute("aria-label",this.config.text.feedbackLabel),x(r,this.config.feedbackIcon,X),r.addEventListener("click",l=>this.handleThumbClick("neutral",l.currentTarget,l)),r.addEventListener("mouseenter",()=>this.showTooltip(r)),r.addEventListener("mouseleave",()=>this.hideTooltip()),d.appendChild(r),this.buttonsContainer.appendChild(d)}else if(!this.config.hideThumbs){const d=document.createElement("div");d.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${n} qaid-btn-up`:"qaid-btn qaid-btn-up",r.setAttribute("aria-label",this.config.text.positiveLabel),x(r,this.config.positiveIcon,Y),r.addEventListener("click",v=>this.handleThumbClick("up",v.currentTarget,v)),r.addEventListener("mouseenter",()=>{this.prewarmQuests(),this.showTooltip(r)}),r.addEventListener("mouseleave",()=>this.hideTooltip()),d.appendChild(r);const l=document.createElement("div");l.className="qaid-tooltip-wrapper";const h=document.createElement("button");h.type="button",h.className=a?`${n} qaid-btn-down`:"qaid-btn qaid-btn-down",h.setAttribute("aria-label",this.config.text.negativeLabel),x(h,this.config.negativeIcon,G),h.addEventListener("click",v=>this.handleThumbClick("down",v.currentTarget,v)),h.addEventListener("mouseenter",()=>{this.prewarmQuests(),this.showTooltip(h)}),h.addEventListener("mouseleave",()=>this.hideTooltip()),l.appendChild(h),this.buttonsContainer.appendChild(d),this.buttonsContainer.appendChild(l)}if(this.config.captureVideo&&this.videoSupported()){const d=document.createElement("div");d.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${n} qaid-btn-record`:"qaid-btn qaid-btn-record",r.setAttribute("aria-label",this.config.text.recordLabel),x(r,this.config.recordIcon,_t),r.addEventListener("click",()=>{this.ensureRecording().then(h=>this.config.videoOptions.redaction?h.startPicking():h.startRecording())});const l=()=>this.prewarmVideo();r.addEventListener("mouseenter",()=>{l(),this.showTooltip(r)}),r.addEventListener("focus",l),r.addEventListener("touchstart",l,{passive:!0}),r.addEventListener("mouseleave",()=>this.hideTooltip()),d.appendChild(r),this.buttonsContainer.appendChild(d)}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,x(this.dismissBtn,null,Ut),this.dismissBtn.addEventListener("click",d=>{d.stopPropagation(),this.handleDismiss()}),this.buttonsContainer.insertBefore(this.dismissBtn,this.buttonsContainer.firstChild),this._startDismissed&&this.buttonsContainer.classList.add("qaid-dismissed"))}ensureOverlayHost(){if(this.overlayShadowRoot)return this.overlayShadowRoot;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"});const t=document.createElement("style");t.setAttribute("data-qaid-base",""),t.textContent=st(),this.overlayShadowRoot.appendChild(t);for(const o of this.featureStyles)ht(this.overlayShadowRoot,o);if(this.config.css){const o=document.createElement("style");o.textContent=this.config.css,this.overlayShadowRoot.appendChild(o)}return this.overlayShadowRoot}featureStyles=[];addFeatureStyles(t){if(!this.featureStyles.includes(t)){this.featureStyles.push(t);for(const o of[this.shadowRoot,this.overlayShadowRoot])o&&ht(o,t)}}tooltipElement=null;showTooltip(t){const o=this.tooltipElement;o.style.visibility="hidden",o.classList.add("qaid-tooltip-visible");const i=t.getBoundingClientRect(),s=o.getBoundingClientRect(),{top:a,left:n}=ge(i,s,{width:window.innerWidth,height:window.innerHeight});o.style.top=`${a}px`,o.style.left=`${n}px`,o.style.visibility="visible"}hideTooltip(){this.tooltipElement.classList.remove("qaid-tooltip-visible")}handleDismiss(){this.buttonsContainer.classList.add("qaid-dismissed"),ct(this.config.apiKey,!0)}handleThumbClick(t,o,i){if(this.buttonsContainer?.classList.contains("qaid-incognito")&&(this.buttonsContainer.classList.remove("qaid-incognito"),ct(this.config.apiKey,!1)),this.prewarmClickPath(),this.skipsTargeting())this.submitDirectFeedback(t,o);else{this.activeThumbBtn=o,o.setAttribute("aria-pressed","true");const s=this.keyboardActivation;this.keyboardActivation=!1,this.ensureTargeting().then(a=>{this.destroyed||(s?a.startKeyboard(t):a.startPointer(t,i))})}}submitDirectFeedback(t,o){this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null;const i=o.getBoundingClientRect();this.selectedBounds={x:i.left,y:i.top,width:i.width,height:i.height,clickX:i.left+i.width/2,clickY:i.top+i.height/2,visible:!1},this.submitFeedback()}handleKeyDown(t){if(t.key==="Escape"){if(this.recording?.handleEscape())return;this.state==="TARGETING"?this.targeting?.cancel():this.state==="MODAL_OPEN"&&this.modal?.close()}}shouldCaptureViaDom(){return this.config.screenshotMethod==="dom"||Le()}async submitFeedback(){try{const[t]=await Promise.all([import("./send-C3IvslZA.js").then(o=>o.s),this.loadDialogA11y()]);await t.submitFeedback(this.makeSendHost())}catch(t){console.error("Failed to send feedback:",t),this.announceMsg("Failed to send feedback",!0),this.resetFeedbackUi()}}async tryLaunchQuest(t,o){try{return await(await import("./send-C3IvslZA.js").then(s=>s.s)).tryLaunchQuest(this.makeSendHost(),t,o)}catch(i){return console.error("Failed to launch quest:",i),!1}}makeSendHost(){const t=this;return{get config(){return t.config},get visitorId(){return t.visitorId},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},get destroyed(){return t.destroyed},get overlayShadowHost(){return t.overlayShadowHost},get activeQuest(){return t.activeQuest},set activeQuest(o){t.activeQuest=o},setState:o=>{t.state=o},setFeedbackId:o=>{t.feedbackIdPromise=o},shouldCaptureViaDom:()=>t.shouldCaptureViaDom(),ensureOverlayHost:()=>t.ensureOverlayHost(),ensureModal:()=>t.ensureModal(),addFeatureStyles:o=>t.addFeatureStyles(o),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),resetFeedbackUi:()=>t.resetFeedbackUi()}}resetFeedbackUi(){this.targeting?.hideMarker(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="none"),this.state="IDLE",this.feedbackIdPromise=Promise.resolve(null),this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}async ensureModal(){if(!this.modal){const[{ModalController:t,styles:o}]=await Promise.all([import("./modal-5G2DhiUE.js"),this.loadDialogA11y()]);this.addFeatureStyles(o),this.modal=new t(this.makeModalHost())}return this.modal}makeModalHost(){const t=this;return{get config(){return t.config},get uid(){return t.uid},get isMobile(){return t.isMobile},get state(){return t.state},get boundKeyDown(){return t.boundKeyDown},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},whenFeedbackId:()=>t.feedbackIdPromise,ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),resetFeedbackUi:()=>t.resetFeedbackUi()}}async ensureTargeting(){if(!this.targeting){const{TargetingController:t,styles:o}=await import("./targeting-Bpbt68Pp.js");this.addFeatureStyles(o),this.targeting=new t(this.makeTargetingHost())}return this.targeting}makeTargetingHost(){const t=this;return{get config(){return t.config},get cssVars(){return t.cssVars},get state(){return t.state},get shadowHost(){return t.shadowHost},get overlayShadowHost(){return t.overlayShadowHost},get boundKeyDown(){return t.boundKeyDown},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},setState:o=>{t.state=o},ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),clearActiveThumb:()=>t.clearActiveThumb(),submitFeedback:()=>t.submitFeedback()}}videoSupported(){return typeof navigator<"u"&&!!navigator.mediaDevices&&typeof navigator.mediaDevices.getDisplayMedia=="function"&&typeof MediaRecorder<"u"}async ensureRecording(){if(!this.recording){const[{RecordingController:t,styles:o}]=await Promise.all([import("./recording-CVwPTtB0.js"),this.loadDialogA11y()]);this.addFeatureStyles(o),this.recording=new t(this.makeRecordingHost())}return this.recording}makeRecordingHost(){const t=this;return{get config(){return t.config},get visitorId(){return t.visitorId},get uid(){return t.uid},get overlayShadowHost(){return t.overlayShadowHost},get consoleCapture(){return t.consoleCapture},get boundKeyDown(){return t.boundKeyDown},get state(){return t.state},setState:o=>{t.state=o},ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),setButtonsDisabled:o=>t.setButtonsDisabled(o),tryLaunchQuest:(o,i)=>t.tryLaunchQuest(o,i)}}setButtonsDisabled(t){if(!this.buttonsContainer)return;this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach(i=>{t?i.classList.contains("qaid-btn-record")||(i.disabled=!0,i.style.opacity="0.5"):(i.disabled=!1,i.style.opacity="")})}destroy(){if(this.destroyed=!0,this.domObserver&&(this.domObserver.disconnect(),this.domObserver=null),this.boundBeforeSwap&&(document.removeEventListener("astro:before-swap",this.boundBeforeSwap),this.boundBeforeSwap=null),this.targeting?.destroy(),this.targeting=null,this.clearActiveThumb(),this.closeDialogA11y(),this.prewarmHandle!==null){const t=window;this.prewarmIsTimeout?clearTimeout(this.prewarmHandle):t.cancelIdleCallback?.(this.prewarmHandle),this.prewarmHandle=null}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,he()}}var He="__qaidThumbsOrigin";function pt(e){return document.querySelector(e)?.textContent?.trim()??""}const mt=He;function bt(e){const t=e.split(/[?#]/)[0];return t.substring(t.lastIndexOf("/")+1)}function Be(e){const t=document.currentScript;if(t&&t.tagName==="SCRIPT")return t;if(!e)return null;const o=Array.from(document.getElementsByTagName("script")).filter(u=>u.src),i=o.find(u=>u.src===e);if(i)return i;const s=o.filter(u=>u[mt]);if(s.length===1)return s[0];const a=bt(e),n=o.filter(u=>bt(u.src)===a);return n.length===1?n[0]:null}function gt(e){return!!e&&e.tagName==="SCRIPT"&&(e.getAttribute("type")||"").trim().toLowerCase()==="application/json"}function Oe(e){const t=e[mt],o=t&&t.tagName==="SCRIPT"?t:e,i=o.getAttribute("data-config-id")||e.getAttribute("data-config-id");if(i){const s=document.getElementById(i);return gt(s)?s:null}for(const s of[o.previousElementSibling,o.nextElementSibling])if(gt(s)&&s.hasAttribute("data-feedback-config"))return s;return null}function Ne(e){const t=Oe(e);if(!t)return null;const o=t.textContent?.trim();if(!o)return null;try{const i=JSON.parse(o);return i.cssSelector&&!i.css&&(i.css=pt(i.cssSelector),delete i.cssSelector),i}catch{return null}}function vt(e,t,o){console.warn(`[thumbs-embed] Ignoring ${e}="${t}": expected ${o}.`)}function Re(e){const t=[];let o=0,i="";for(const s of e)s==="("&&o++,s===")"&&(o=Math.max(0,o-1)),s===","&&o===0?(t.push(i.trim()),i=""):i+=s;return t.push(i.trim()),t}function Pe(e,t){if(t===null)return;const o=t.trim();let i=null;if(o.startsWith("[")||o.startsWith("{"))try{i=JSON.parse(o)}catch{i=null}else i=Re(o);if(Array.isArray(i)&&i.length>0&&i.every(s=>typeof s=="string"&&s.trim()!==""))return i.map(s=>s.trim());vt(e,t,"a JSON array of colours or a comma-separated list")}function I(e,t){if(t!==null){if(t.trim()===""){vt(e,t,"a non-empty label");return}return t}}function ze(e){const t=e.getAttribute("data-endpoint");if(!t)return null;const o=e.getAttribute("data-position"),i=e.getAttribute("data-zindex"),s=e.getAttribute("data-positive-color"),a=e.getAttribute("data-negative-color"),n=e.getAttribute("data-marker-color"),u=e.getAttribute("data-container"),m=e.getAttribute("data-button-class"),p=e.getAttribute("data-skip-targeting"),d=e.getAttribute("data-hide-confirmation"),r=e.getAttribute("data-single-button"),l=e.getAttribute("data-feedback-mode"),h=e.getAttribute("data-incognito"),v=e.getAttribute("data-button-size"),k=e.getAttribute("data-offset-x"),y=e.getAttribute("data-offset-y"),S=e.getAttribute("data-modal-width"),C=e.getAttribute("data-backdrop-opacity"),c=e.getAttribute("data-font-family"),f=e.getAttribute("data-font-size"),b=e.getAttribute("data-tooltip"),g=e.getAttribute("data-modal-title"),A=e.getAttribute("data-confirmation-title"),q=e.getAttribute("data-confirmation-message"),w=e.getAttribute("data-confirmation-close"),O=e.getAttribute("data-error-title"),N=e.getAttribute("data-error-message"),R=e.getAttribute("data-modal-subtitle"),P=e.getAttribute("data-placeholder"),z=e.getAttribute("data-submit-button"),_=e.getAttribute("data-skip-button"),wt=e.getAttribute("data-positive-icon"),kt=e.getAttribute("data-negative-icon"),Ct=e.getAttribute("data-feedback-icon"),U=e.getAttribute("data-feedback-label"),qt=e.getAttribute("data-api-key"),xt=e.getAttribute("data-capture-screenshot"),St=e.getAttribute("data-annotate"),At=e.getAttribute("data-annotation-color"),L=e.getAttribute("data-screenshot-quality"),D=e.getAttribute("data-screenshot-max-width"),M=e.getAttribute("data-screenshot-max-height"),Et=e.getAttribute("data-capture-video"),F=e.getAttribute("data-video-redaction"),Tt=e.getAttribute("data-hide-thumbs"),It=e.getAttribute("data-hide-dismiss"),H=e.getAttribute("data-video-max-duration"),Lt=e.getAttribute("data-screenshot-method"),Dt=e.getAttribute("data-direction"),V=e.getAttribute("data-css-selector"),Mt=e.getAttribute("data-css"),$=I("data-positive-label",e.getAttribute("data-positive-label")),K=I("data-negative-label",e.getAttribute("data-negative-label")),W=I("data-record-label",e.getAttribute("data-record-label")),j=I("data-dismiss-label",e.getAttribute("data-dismiss-label")),Ht=Pe("data-annotation-palette",e.getAttribute("data-annotation-palette")),Bt=e.getAttribute("data-record-icon"),Q=e.getAttribute("data-quest-base"),Ot=e.getAttribute("data-quest-up"),Nt=e.getAttribute("data-quest-down"),Rt=e.getAttribute("data-quest-video"),Pt=e.getAttribute("data-quest-api-key"),zt=e.getAttribute("data-quest-module-url");return{endpoint:t,css:Mt||(V?pt(V):void 0),apiKey:qt??void 0,captureScreenshot:xt==="true"?!0:void 0,annotate:St==="false"?!1:void 0,annotationColor:At??void 0,annotationPalette:Ht,screenshotOptions:L||D||M?{quality:L?parseFloat(L):void 0,maxWidth:D?parseInt(D,10):void 0,maxHeight:M?parseInt(M,10):void 0}:void 0,container:u??void 0,buttonClass:m??void 0,direction:Dt??void 0,position:o??void 0,zIndex:i?parseInt(i,10):void 0,skipTargeting:p==="true"?!0:void 0,hideConfirmation:d==="true"?!0:void 0,singleButton:r==="true"?!0:void 0,feedbackMode:l??void 0,incognito:h==="true"?!0:void 0,buttonSize:v??void 0,offset:k||y?{x:k?parseInt(k,10):void 0,y:y?parseInt(y,10):void 0}:void 0,modalWidth:S?parseInt(S,10):void 0,backdropOpacity:C?parseFloat(C):void 0,fontFamily:c??void 0,fontSize:f?parseInt(f,10):void 0,colors:{positive:s??void 0,negative:a??void 0,marker:n??void 0},text:b||g||R||P||z||_||U||A||q||w||O||N||$||K||W||j?{tooltip:b??void 0,modalTitle:g??void 0,modalSubtitle:R??void 0,placeholder:P??void 0,submitButton:z??void 0,skipButton:_??void 0,feedbackLabel:U??void 0,confirmationTitle:A??void 0,confirmationMessage:q??void 0,confirmationClose:w??void 0,errorTitle:O??void 0,errorMessage:N??void 0,positiveLabel:$,negativeLabel:K,recordLabel:W,dismissLabel:j}:void 0,positiveIcon:wt??void 0,recordIcon:Bt??void 0,negativeIcon:kt??void 0,feedbackIcon:Ct??void 0,screenshotMethod:Lt??void 0,captureVideo:Et==="true"?!0:void 0,hideThumbs:Tt==="true"?!0:void 0,hideDismiss:It==="true"?!0:void 0,videoOptions:H||F?{maxDuration:H?parseInt(H,10):void 0,redaction:F==="true"?!0:void 0}:void 0,quests:Q?{base:Q,up:Ot??void 0,down:Nt??void 0,video:Rt??void 0,apiKey:Pt??void 0,moduleUrl:zt??void 0}:void 0}}function _e(e){if(typeof document>"u")return;const t=Be(e);if(!t)return;const o=()=>{const i=Ne(t)??ze(t);i?.endpoint&&new ft(i)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o):o()}var Ue="qaid-embed",yt="__qaidEmbedTrustedTypes";function Fe(){if(typeof window>"u")return null;var e=window,t=e.trustedTypes;if(!t||typeof t.createPolicy!="function")return null;var o=e[yt];if(o)return o;var i=Object.create(null),s=null;try{s=t.createPolicy(Ue,{createScriptURL:function(n){if(i[n]===!0)return n;throw new TypeError("qaid-embed: refused script URL "+n)}})}catch{s=null}var a={policy:s,allowed:i};try{Object.defineProperty(e,yt,{value:a,configurable:!0})}catch{}return a}function Ve(e){var t=Fe();return!t||!t.policy?e:(t.allowed[e]=!0,t.policy.createScriptURL(e))}export{Vt as A,Kt as B,T as D,Qt as E,X as F,$t as P,ft as Q,Ft as R,Yt as S,Y as T,Wt as U,Ae as a,jt as b,we as c,_e as d,G as e,Ce as f,xe as g,qe as h,nt as i,x as s,Ve as t};
26
- //# sourceMappingURL=core-vu1EieDc.js.map