@qaiddev/thumbs-embed 1.10.1 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/a11y-dialog.d.ts +77 -0
  2. package/dist/a11y.d.ts +6 -65
  3. package/dist/annotate.d.ts +2 -0
  4. package/dist/chunks/annotate-DGyRcgPt.js +2 -0
  5. package/dist/chunks/annotate-DGyRcgPt.js.map +1 -0
  6. package/dist/chunks/core-BsR7oV99.js +26 -0
  7. package/dist/chunks/core-BsR7oV99.js.map +1 -0
  8. package/dist/chunks/dom-scpOS8nl.js +2 -0
  9. package/dist/chunks/{dom-DvdtcUS8.js.map → dom-scpOS8nl.js.map} +1 -1
  10. package/dist/chunks/modal-DYxcs1Gm.js +2 -0
  11. package/dist/chunks/modal-DYxcs1Gm.js.map +1 -0
  12. package/dist/chunks/recording-BUw5-5Rf.js +2 -0
  13. package/dist/chunks/recording-BUw5-5Rf.js.map +1 -0
  14. package/dist/chunks/screenshot-CNe1irEz.js +2 -0
  15. package/dist/chunks/{screenshot-DYOKg2bS.js.map → screenshot-CNe1irEz.js.map} +1 -1
  16. package/dist/chunks/screenshot-dom-ZYP2w2h0.js +2 -0
  17. package/dist/chunks/{screenshot-dom-CME7tYRE.js.map → screenshot-dom-ZYP2w2h0.js.map} +1 -1
  18. package/dist/chunks/send-C26DRoYc.js +2 -0
  19. package/dist/chunks/send-C26DRoYc.js.map +1 -0
  20. package/dist/chunks/targeting-CMUEe-7C.js +6 -0
  21. package/dist/chunks/targeting-CMUEe-7C.js.map +1 -0
  22. package/dist/chunks/video-BSP4s2te.js +2 -0
  23. package/dist/chunks/{video-Bd_29-rK.js.map → video-BSP4s2te.js.map} +1 -1
  24. package/dist/embed.d.ts +35 -34
  25. package/dist/index.js +1515 -1382
  26. package/dist/index.js.map +1 -1
  27. package/dist/loader.d.ts +6 -4
  28. package/dist/loader.js +1 -6
  29. package/dist/loader.js.map +1 -1
  30. package/dist/modal-positioning.d.ts +0 -27
  31. package/dist/modal.d.ts +2 -0
  32. package/dist/qaid.umd.cjs +14 -14
  33. package/dist/qaid.umd.cjs.map +1 -1
  34. package/dist/quest-config.d.ts +2 -0
  35. package/dist/quest-launcher.d.ts +1 -3
  36. package/dist/recording.d.ts +2 -0
  37. package/dist/send.d.ts +60 -0
  38. package/dist/targeting.d.ts +2 -0
  39. package/dist/tooltip-positioning.d.ts +31 -0
  40. package/package.json +1 -1
  41. package/dist/chunks/annotate-BTLeFQa0.js +0 -355
  42. package/dist/chunks/annotate-BTLeFQa0.js.map +0 -1
  43. package/dist/chunks/core-2nGsCcZq.js +0 -1319
  44. package/dist/chunks/core-2nGsCcZq.js.map +0 -1
  45. package/dist/chunks/dom-DvdtcUS8.js +0 -17
  46. package/dist/chunks/modal-zwBhxWO0.js +0 -219
  47. package/dist/chunks/modal-zwBhxWO0.js.map +0 -1
  48. package/dist/chunks/recording-DNngIGr2.js +0 -321
  49. package/dist/chunks/recording-DNngIGr2.js.map +0 -1
  50. package/dist/chunks/screenshot-DYOKg2bS.js +0 -33
  51. package/dist/chunks/screenshot-dom-CME7tYRE.js +0 -63
  52. package/dist/chunks/targeting-DaBmGVk5.js +0 -296
  53. package/dist/chunks/targeting-DaBmGVk5.js.map +0 -1
  54. package/dist/chunks/video-Bd_29-rK.js +0 -214
@@ -1,1319 +0,0 @@
1
- const Dt = `<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>`, zt = `<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>`, Mt = `<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>`, Lt = `<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>`, Te = `<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>`, Ee = `<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>`, Ie = `<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>`, De = `<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>`, ze = `<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>`, Me = `<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>`, Le = `<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>`, He = `<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>`, Ht = "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}.qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6365f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;inset:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-type-static{width:2.5rem;height:2.5rem;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--qaid-marker, #6365f1);color:var(--qaid-marker-text, white)}.qaid-type-static svg{width:1.25rem;height:1.25rem}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:calc(var(--qaid-font-size, 16px) * 1.125);font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:calc(var(--qaid-font-size, 16px) * .875)}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:var(--qaid-font-size, 16px);resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}button.qaid-btn-record:hover{background:#dc2626;color:#fff}.qaid-recording-indicator{position:fixed;pointer-events:auto;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:calc(var(--qaid-font-size, 16px) * .75);font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;inset:0 0 auto;height:100vh;height:100dvh;display:flex;align-items:center;justify-content:center;padding:16px;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));box-sizing:border-box;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:100%;max-height:100%;overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:calc(var(--qaid-font-size, 16px) * 1.125);font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;max-height:50vh;max-height:50dvh;object-fit:contain;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:calc(var(--qaid-font-size, 16px) * .875);resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-error{margin:0 0 .75rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;color:light-dark(#b91c1c,#fca5a5)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:calc(var(--qaid-font-size, 16px) * .875);color:light-dark(#6b7280,#9ca3af)}.qaid-annotate{position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;gap:.75rem;padding:16px;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(16px,env(safe-area-inset-bottom));box-sizing:border-box;background:#000000d9;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);animation:qaid-fadeIn .2s ease-out}.qaid-annotate-title{margin:0;font-size:var(--qaid-font-size, 16px);font-weight:700;text-align:center;color:#f9fafb}.qaid-annotate-desc{margin:0;font-size:calc(var(--qaid-font-size, 16px) * .8125);line-height:1.4;text-align:center;color:#f9fafbbf}.qaid-annotate-stage{flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto}.qaid-annotate-canvas{max-width:100%;max-height:100%;object-fit:contain;background:light-dark(#ffffff,#111827);border-radius:.5rem;box-shadow:0 10px 30px #00000080;touch-action:none;cursor:crosshair}.qaid-annotate-toolbar{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center;justify-content:center;padding:.5rem .75rem;background:light-dark(#ffffff,#1f2937);border-radius:.75rem;box-shadow:0 10px 30px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5))}.qaid-annotate-tools,.qaid-annotate-actions{display:flex;gap:.375rem;align-items:center}button.qaid-annotate-tool,button.qaid-annotate-action{display:inline-flex;align-items:center;justify-content:center;gap:.375rem;min-width:44px;min-height:44px;padding:0 .75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;background:light-dark(#f9fafb,#111827);color:light-dark(#1f2937,#f9fafb);font-family:inherit;font-size:calc(var(--qaid-font-size, 16px) * .8125);font-weight:600;cursor:pointer;-webkit-appearance:none;appearance:none;transition:background-color .15s,color .15s,border-color .15s,filter .15s}button.qaid-annotate-tool svg,button.qaid-annotate-action svg{width:20px;height:20px}.qaid-annotate-colors{display:flex;gap:.25rem;align-items:center}button.qaid-annotate-swatch{width:28px;height:28px;min-width:28px;padding:0;border-radius:9999px;border:2px solid light-dark(#d1d5db,#4b5563);background:var(--qaid-swatch, #000);cursor:pointer;-webkit-appearance:none;appearance:none;transition:transform .1s,box-shadow .15s,border-color .15s}button.qaid-annotate-swatch:hover{transform:scale(1.12)}button.qaid-annotate-swatch[aria-pressed=true]{border-color:light-dark(#111827,#f9fafb);box-shadow:0 0 0 2px var(--qaid-swatch)}@media(forced-colors:active){button.qaid-annotate-swatch[aria-pressed=true]{outline:2px solid Highlight;outline-offset:1px}}button.qaid-annotate-tool:hover,button.qaid-annotate-action:hover{background:light-dark(#eef2ff,#312e81)}button.qaid-annotate-tool[aria-pressed=true],button.qaid-annotate-done{background:var(--qaid-marker, #6365f1);color:var(--qaid-marker-text, #fff);border-color:var(--qaid-marker, #6365f1)}button.qaid-annotate-done:hover{filter:brightness(.9);background:var(--qaid-marker, #6365f1)}button.qaid-annotate-action:disabled{opacity:.45;cursor:not-allowed}@media(forced-colors:active){button.qaid-annotate-tool[aria-pressed=true],button.qaid-annotate-done{border:2px solid Highlight}.qaid-annotate-canvas{border:1px solid CanvasText}}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-textarea:focus-visible,button.qaid-btn-submit:focus-visible,.qaid-video-preview-box textarea: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}button.qaid-recording-stop{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,.qaid-textarea:focus,button.qaid-btn-submit:focus,.qaid-video-preview-box textarea:focus{outline:2px solid CanvasText;outline-offset:2px}.qaid-selected-marker,.qaid-highlight-box{border-color:Highlight}}.qaid-confirm{display:flex;flex-direction:column;align-items:center;text-align:center;gap:.5rem;padding:.5rem 0}.qaid-confirm-icon{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:9999px;color:#fff;background:var(--qaid-success, #22c55e);margin-bottom:.25rem;animation:qaid-confirm-pop .28s cubic-bezier(.34,1.56,.64,1)}.qaid-confirm-icon .qaid-icon{width:24px;height:24px}.qaid-confirm-error .qaid-confirm-icon{background:var(--qaid-error, #dc2626)}.qaid-confirm-title{margin:0;font-size:var(--qaid-font-size, 16px);font-weight:600;color:var(--qaid-text, light-dark(#111827, #f9fafb))}.qaid-confirm-title:focus-visible{outline:2px solid var(--qaid-primary, #6365f1);outline-offset:3px;border-radius:4px}.qaid-confirm-message{margin:0;font-size:calc(var(--qaid-font-size, 16px) * .875);color:var(--qaid-text-muted, light-dark(#6b7280, #9ca3af))}.qaid-confirm .qaid-confirm-close{margin-top:.5rem;min-width:96px}@keyframes qaid-confirm-pop{0%{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.qaid-confirm-icon{animation:none}}", Bt = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";
26
- let b = 0;
27
- const Ot = "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)}", Pt = {
28
- small: 36,
29
- medium: 48,
30
- large: 64
31
- }, Rt = {
32
- small: 18,
33
- medium: 24,
34
- large: 32
35
- };
36
- function Nt(e, t, i) {
37
- const [o, a, n] = [e, t, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
38
- return 0.2126 * o + 0.7152 * a + 0.0722 * n;
39
- }
40
- function Ut(e) {
41
- if (e.startsWith("#")) {
42
- const i = e.slice(1), o = i.length === 3 ? i.split("").map((n) => n + n).join("") : i, a = parseInt(o, 16);
43
- return {
44
- r: a >> 16 & 255,
45
- g: a >> 8 & 255,
46
- b: a & 255
47
- };
48
- }
49
- const t = e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
50
- return t ? {
51
- r: parseInt(t[1]),
52
- g: parseInt(t[2]),
53
- b: parseInt(t[3])
54
- } : null;
55
- }
56
- function Ft(e) {
57
- const t = Ut(e);
58
- return t && Nt(t.r, t.g, t.b) > 0.4 ? "black" : "white";
59
- }
60
- function _t(e = {}) {
61
- const {
62
- positiveColor: t = "rgb(0, 200, 83)",
63
- negativeColor: i = "rgb(255, 0, 0)",
64
- markerColor: o = "#6365f1",
65
- buttonSize: a = "medium",
66
- modalWidth: n = 400,
67
- backdropOpacity: r = 0.3,
68
- fontFamily: l = "system-ui, -apple-system, sans-serif",
69
- fontSize: c = 16
70
- } = e, d = Pt[a], s = Rt[a], u = Ft(o);
71
- return {
72
- "--qaid-positive": t,
73
- "--qaid-negative": i,
74
- "--qaid-marker": o,
75
- "--qaid-marker-text": u,
76
- "--qaid-btn-size": `${d}px`,
77
- "--qaid-icon-size": `${s}px`,
78
- "--qaid-modal-width": `${n}px`,
79
- "--qaid-backdrop-opacity": String(r),
80
- "--qaid-font-family": l,
81
- "--qaid-font-size": `${c}px`
82
- };
83
- }
84
- function Vt(e, t) {
85
- for (const [i, o] of Object.entries(t))
86
- e.style.setProperty(i, o);
87
- }
88
- function Y() {
89
- return Ht + Ot;
90
- }
91
- function jt() {
92
- if (b++, b > 1) return;
93
- const e = document.createElement("style");
94
- e.id = "qaid-styles", e.textContent = Bt, document.head.appendChild(e);
95
- }
96
- function $t() {
97
- b <= 0 || (b--, b === 0 && document.getElementById("qaid-styles")?.remove());
98
- }
99
- const X = "data-qaid-a11y-live", Kt = "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;", Qt = [
100
- "a[href]",
101
- "button",
102
- "input",
103
- "textarea",
104
- "select",
105
- "[tabindex]"
106
- ].join(",");
107
- function Wt(e) {
108
- return e.ownerDocument || document;
109
- }
110
- function Yt(e, t) {
111
- const i = t ? "assertive" : "polite", o = e.querySelector(
112
- `[${X}="${i}"]`
113
- );
114
- if (o) return o;
115
- const n = Wt(e).createElement("div");
116
- return n.setAttribute(X, i), n.setAttribute("role", t ? "alert" : "status"), n.setAttribute("aria-live", t ? "assertive" : "polite"), n.setAttribute("aria-atomic", "true"), n.style.cssText = Kt, e.appendChild(n), n;
117
- }
118
- function Xt(e, t, i = {}) {
119
- const o = Yt(e, !!i.assertive);
120
- o.textContent = "", o.textContent = t;
121
- }
122
- function Jt(e) {
123
- return e.hasAttribute("disabled") ? !0 : e.disabled === !0;
124
- }
125
- function Gt(e) {
126
- let t = e;
127
- for (; t; ) {
128
- if (t.hasAttribute("hidden")) return !0;
129
- const i = t.style;
130
- if (i && (i.display === "none" || i.visibility === "hidden" || i.visibility === "collapse"))
131
- return !0;
132
- t = t.parentElement;
133
- }
134
- return !1;
135
- }
136
- function J(e) {
137
- return Array.from(
138
- e.querySelectorAll(Qt)
139
- ).filter((i) => !(i.getAttribute("tabindex") === "-1" || i instanceof HTMLInputElement && i.type === "hidden" || i instanceof HTMLAnchorElement && !i.getAttribute("href") || Jt(i) || Gt(i)));
140
- }
141
- function it(e) {
142
- let t = e.activeElement;
143
- for (; t && t.shadowRoot && t.shadowRoot.activeElement; )
144
- t = t.shadowRoot.activeElement;
145
- return t instanceof HTMLElement ? t : null;
146
- }
147
- function Zt(e) {
148
- const t = e.ownerDocument || document;
149
- let i = !1;
150
- const o = (n) => {
151
- if (n.key !== "Tab") return;
152
- const r = J(e);
153
- if (r.length === 0) {
154
- n.preventDefault(), e.focus();
155
- return;
156
- }
157
- const l = r[0], c = r[r.length - 1], d = it(t), s = d ? r.indexOf(d) !== -1 : !1;
158
- n.shiftKey ? (!s || d === l) && (n.preventDefault(), c.focus()) : (!s || d === c) && (n.preventDefault(), l.focus());
159
- };
160
- e.addEventListener("keydown", o);
161
- const a = J(e);
162
- return a.length > 0 ? a[0].focus() : (e.hasAttribute("tabindex") || (e.setAttribute("tabindex", "-1"), i = !0), e.focus()), {
163
- release() {
164
- e.removeEventListener("keydown", o), i && (e.removeAttribute("tabindex"), i = !1);
165
- }
166
- };
167
- }
168
- function te() {
169
- return it(document);
170
- }
171
- function ee(e) {
172
- if (!(!e || typeof e.focus != "function"))
173
- try {
174
- e.focus();
175
- } catch {
176
- }
177
- }
178
- function ie(e, t = {}) {
179
- e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), t.labelledbyId && e.setAttribute("aria-labelledby", t.labelledbyId), t.describedbyId && e.setAttribute("aria-describedby", t.describedbyId), t.label && e.setAttribute("aria-label", t.label);
180
- }
181
- function oe(e, t) {
182
- let i = e;
183
- for (; i && i !== t; ) {
184
- const o = i.parentNode;
185
- if (o === t) return i;
186
- if (o && o.host) {
187
- i = o.host;
188
- continue;
189
- }
190
- if (!o) return null;
191
- i = o;
192
- }
193
- return null;
194
- }
195
- function ne(e) {
196
- const i = (e.ownerDocument || document).body;
197
- if (!i) return () => {
198
- };
199
- const o = oe(e, i), a = [];
200
- return Array.from(i.children).forEach((n) => {
201
- if (!(n instanceof HTMLElement) || o && n === o) return;
202
- const r = n.inert === !0, l = n.getAttribute("aria-hidden");
203
- r && l === "true" || (n.inert = !0, n.setAttribute("aria-hidden", "true"), a.push({ el: n, prevInert: r, prevAriaHidden: l }));
204
- }), function() {
205
- for (; a.length; ) {
206
- const r = a.pop();
207
- r.el.inert = r.prevInert, r.prevAriaHidden === null ? r.el.removeAttribute("aria-hidden") : r.el.setAttribute("aria-hidden", r.prevAriaHidden);
208
- }
209
- };
210
- }
211
- const ot = {
212
- width: 400,
213
- height: 280,
214
- arrowHeight: 12,
215
- gap: 8,
216
- viewportPadding: 16
217
- };
218
- function ae(e, t, i, o, a) {
219
- const n = e.y, r = t - (e.y + e.height);
220
- if (r >= i + o)
221
- return {
222
- top: e.y + e.height + o,
223
- position: "below"
224
- };
225
- if (n >= i + o)
226
- return {
227
- top: e.y - i - o,
228
- position: "above"
229
- };
230
- const l = r > n ? "below" : "above";
231
- let c;
232
- return l === "below" ? c = Math.min(
233
- e.y + e.height + o,
234
- t - i - a
235
- ) : c = Math.max(a, e.y - i - o), { top: c, position: l };
236
- }
237
- function re(e, t, i, o) {
238
- let n = e.x + e.width / 2 - i / 2;
239
- return n = Math.max(o, Math.min(n, t - i - o)), n;
240
- }
241
- function se(e, t, i, o = 24, a = 24) {
242
- const r = e.clickX - t - a / 2;
243
- return Math.max(o, Math.min(r, i - o - a / 2));
244
- }
245
- function de(e, t, i, o = ot) {
246
- const a = o.height + o.arrowHeight, n = ae(
247
- e,
248
- i,
249
- a,
250
- o.gap,
251
- o.viewportPadding
252
- ), r = re(
253
- e,
254
- t,
255
- o.width,
256
- o.viewportPadding
257
- );
258
- return {
259
- top: n.top,
260
- left: r,
261
- position: n.position
262
- };
263
- }
264
- function le(e, t, i, o = {}) {
265
- const a = o.gap ?? 8;
266
- let n = e.bottom + a;
267
- n + t.height > i.height - a && (n = e.top - t.height - a);
268
- let r = e.left;
269
- return r < a ? r = a : r + t.width > i.width - a && (r = i.width - t.width - a), n < a ? n = a : n + t.height > i.height - a && (n = i.height - t.height - a), { top: n, left: r };
270
- }
271
- function Be(e, t, i, o = ot) {
272
- const a = de(e, t, i, o), n = se(
273
- e,
274
- a.left,
275
- o.width
276
- );
277
- return {
278
- modal: a,
279
- arrow: { left: n }
280
- };
281
- }
282
- const ce = 20;
283
- function ue(e) {
284
- const t = [], i = console.error, o = console.warn, a = console.log, n = (r, l) => {
285
- const c = {
286
- message: l.map((d) => String(d)).join(" "),
287
- timestamp: Date.now(),
288
- level: r
289
- };
290
- t.length >= ce && t.shift(), t.push(c), e && e(c);
291
- };
292
- return console.error = function(...r) {
293
- n("error", r), i.apply(console, r);
294
- }, console.warn = function(...r) {
295
- n("warn", r), o.apply(console, r);
296
- }, console.log = function(...r) {
297
- n("log", r), a.apply(console, r);
298
- }, {
299
- errors: t,
300
- restore: () => {
301
- console.error = i, console.warn = o, console.log = a;
302
- }
303
- };
304
- }
305
- function Oe(e, t, i) {
306
- const o = document.createElement(e);
307
- if (t)
308
- for (const [a, n] of Object.entries(t))
309
- a === "className" ? o.className = n : o.setAttribute(a, n);
310
- return o;
311
- }
312
- function he(e = 640) {
313
- return typeof window < "u" && window.innerWidth < e;
314
- }
315
- function Pe(e, t, i) {
316
- const o = i.map((n) => n.style.visibility);
317
- i.forEach((n) => n.style.visibility = "hidden");
318
- const a = document.elementFromPoint(e, t);
319
- return i.forEach((n, r) => n.style.visibility = o[r]), a;
320
- }
321
- function Re(e) {
322
- return e ? e.hasAttribute("data-qaid-embed") || e.hasAttribute("data-qaid-embed-overlay") ? !0 : !!e.closest("[data-qaid-embed], [data-qaid-embed-overlay]") : !1;
323
- }
324
- function Ne(e, t = 0) {
325
- const i = e.getBoundingClientRect();
326
- return {
327
- x: i.left - t,
328
- y: i.top - t,
329
- width: i.width + t * 2,
330
- height: i.height + t * 2
331
- };
332
- }
333
- const fe = "https://unpkg.com/@qaiddev/quests-embed@1/dist/qaid-quests.js", pe = (e) => (
334
- // The URL is a runtime value, not a static specifier — keep Vite from
335
- // trying to analyze/bundle it.
336
- import(
337
- /* @vite-ignore */
338
- e
339
- )
340
- );
341
- let be = pe, p = null, k = null;
342
- const A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
343
- function nt(e, t) {
344
- return `${e.replace(/\/+$/, "")}/${encodeURIComponent(t)}/definition`;
345
- }
346
- function me(e) {
347
- if (A.has(e)) return Promise.resolve();
348
- const t = C.get(e);
349
- if (t) return t;
350
- const i = fetch(e, { headers: { Accept: "application/json" } }).then((o) => o.ok ? o.json() : null).then((o) => {
351
- o && A.set(e, o);
352
- }).catch(() => {
353
- }).finally(() => {
354
- C.delete(e);
355
- });
356
- return C.set(e, i), i;
357
- }
358
- function at(e) {
359
- return p && k === e || (k = e, p = Promise.resolve(be(e)).then((t) => {
360
- const i = t;
361
- if (!i || typeof i.QaidQuests != "function")
362
- throw new Error("quests module has no QaidQuests export");
363
- return i;
364
- }).catch((t) => {
365
- throw p = null, k = null, t;
366
- })), p;
367
- }
368
- async function ge(e) {
369
- const t = await at(e.moduleUrl), i = e.base.replace(/\/+$/, ""), o = nt(i, e.questId), a = (l) => l != null ? { feedbackId: l } : void 0;
370
- let n;
371
- const r = e.feedbackId;
372
- return r instanceof Promise ? n = t.QaidQuests.supports?.asyncMetadata ? r.then(a, () => {
373
- }) : a(await r.catch(() => null)) : n = a(r ?? null), new t.QaidQuests({
374
- endpoint: `${i}/responses`,
375
- configUrl: o,
376
- // Only a definition already in hand. One still loading is left to the
377
- // widget, which shows its own loading state instead of nothing.
378
- questionnaire: A.get(o),
379
- apiKey: e.apiKey || void 0,
380
- metadata: n,
381
- onClose: e.onClose
382
- });
383
- }
384
- const G = "qaid_visitor_id", Z = "qaid_hide_feedback", ve = [
385
- "#ef4444",
386
- "#f59e0b",
387
- "#22c55e",
388
- "#3b82f6",
389
- "#111827",
390
- "#ffffff"
391
- ];
392
- function ye() {
393
- return typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches;
394
- }
395
- function S(e) {
396
- return e ? `${Z}_${e}` : Z;
397
- }
398
- function we(e) {
399
- try {
400
- return localStorage.getItem(S(e)) === "1";
401
- } catch {
402
- return !1;
403
- }
404
- }
405
- function tt(e, t = !0) {
406
- try {
407
- t ? localStorage.setItem(S(e), "1") : localStorage.removeItem(S(e));
408
- } catch {
409
- }
410
- }
411
- function et() {
412
- const e = typeof crypto < "u" ? crypto : void 0;
413
- if (e && typeof e.randomUUID == "function") return e.randomUUID();
414
- const t = new Uint8Array(16);
415
- if (e && typeof e.getRandomValues == "function")
416
- e.getRandomValues(t);
417
- else
418
- for (let o = 0; o < t.length; o++) t[o] = Math.floor(Math.random() * 256);
419
- t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
420
- const i = Array.from(t, (o) => o.toString(16).padStart(2, "0")).join("");
421
- return `${i.slice(0, 8)}-${i.slice(8, 12)}-${i.slice(12, 16)}-${i.slice(16, 20)}-${i.slice(20)}`;
422
- }
423
- function qe() {
424
- try {
425
- let e = localStorage.getItem(G);
426
- return e || (e = et(), localStorage.setItem(G, e)), e;
427
- } catch {
428
- return et();
429
- }
430
- }
431
- class xe {
432
- config;
433
- state = "IDLE";
434
- feedbackData = {
435
- feedbackType: null,
436
- elementSelector: null,
437
- elementText: null,
438
- consoleErrors: []
439
- };
440
- selectedBounds = {
441
- x: 0,
442
- y: 0,
443
- width: 0,
444
- height: 0,
445
- clickX: 0,
446
- clickY: 0,
447
- visible: !1
448
- };
449
- /**
450
- * This feedback's record id, once its POST answers (null if it failed).
451
- * The message box and a linked quest open without waiting for it; the
452
- * PATCHes that need the id wait on this instead.
453
- */
454
- feedbackIdPromise = Promise.resolve(null);
455
- questsPrewarmed = !1;
456
- // A quest launched from a button (in place of the message box), if any.
457
- activeQuest = null;
458
- isMobile = !1;
459
- visitorId;
460
- // Console capture
461
- consoleCapture = null;
462
- // Video recording — the whole subsystem lives in a lazily-loaded chunk
463
- // (recording.ts); a thumbs-only visitor never downloads it.
464
- recording = null;
465
- // Element targeting — also a lazily-loaded chunk (targeting.ts).
466
- targeting = null;
467
- targetingPrewarmed = !1;
468
- // Preload-on-intent: warm the lazily-split feature chunks before first use.
469
- prewarmHandle = null;
470
- prewarmIsTimeout = !1;
471
- videoPrewarmed = !1;
472
- screenshotPrewarmed = !1;
473
- // Shadow DOM
474
- shadowHost = null;
475
- shadowRoot = null;
476
- // Overlay shadow DOM (always on document.body for full-page coverage)
477
- overlayShadowHost = null;
478
- overlayShadowRoot = null;
479
- // DOM elements (inside shadow root)
480
- buttonsContainer = null;
481
- isUserProvidedContainer = !1;
482
- // The message modal lives in a lazily-loaded chunk (modal.ts).
483
- modal = null;
484
- modalPrewarmed = !1;
485
- dismissBtn = null;
486
- // Per-instance CSS variables
487
- cssVars = {};
488
- activeThumbBtn = null;
489
- // Tracks whether the pending activation came from the keyboard (Enter/Space)
490
- // rather than a pointer, so targeting can avoid elementFromPoint(0,0).
491
- keyboardActivation = !1;
492
- // Accessibility: dialog focus management
493
- dialogTrigger = null;
494
- dialogTrap = null;
495
- dialogRestoreInert = null;
496
- // Unique id suffix for aria-labelledby/describedby references
497
- uid = Math.random().toString(36).slice(2, 9);
498
- // Bound event handlers
499
- boundKeyDown;
500
- boundResize;
501
- // Start with buttons slid off-screen (localStorage dismiss, no animation)
502
- _startDismissed = !1;
503
- // DOM persistence (survives framework client-side navigation)
504
- destroyed = !1;
505
- domObserver = null;
506
- boundBeforeSwap = null;
507
- constructor(t) {
508
- this.config = {
509
- endpoint: t.endpoint,
510
- apiKey: t.apiKey ?? "",
511
- container: t.container ?? "",
512
- buttonClass: t.buttonClass ?? "",
513
- direction: t.direction ?? "horizontal",
514
- position: t.position ?? "bottom-right",
515
- offset: {
516
- x: t.offset?.x ?? 16,
517
- y: t.offset?.y ?? 16
518
- },
519
- zIndex: t.zIndex ?? 50,
520
- skipTargeting: t.skipTargeting ?? !1,
521
- singleButton: t.singleButton ?? !1,
522
- feedbackMode: t.feedbackMode ?? "target",
523
- colors: {
524
- positive: t.colors?.positive ?? "rgb(0, 200, 83)",
525
- negative: t.colors?.negative ?? "rgb(255, 0, 0)",
526
- marker: t.colors?.marker ?? "#6365f1"
527
- },
528
- buttonSize: t.buttonSize ?? "medium",
529
- text: {
530
- tooltip: t.text?.tooltip ?? "",
531
- modalTitle: t.text?.modalTitle ?? "Thank you for your feedback!",
532
- modalSubtitle: t.text?.modalSubtitle ?? "Would you like to add a message to help us understand your feedback better?",
533
- placeholder: t.text?.placeholder ?? "Optional: Tell us more about your experience...",
534
- submitButton: t.text?.submitButton ?? "Submit",
535
- skipButton: t.text?.skipButton ?? "Skip",
536
- positiveLabel: t.text?.positiveLabel ?? "Send positive feedback",
537
- negativeLabel: t.text?.negativeLabel ?? "Send negative feedback",
538
- recordLabel: t.text?.recordLabel ?? "Record a screen recording",
539
- dismissLabel: t.text?.dismissLabel ?? "Hide Feedback",
540
- feedbackLabel: t.text?.feedbackLabel ?? "Send feedback",
541
- confirmationTitle: t.text?.confirmationTitle ?? "Thank you!",
542
- confirmationMessage: t.text?.confirmationMessage ?? "Your feedback has been received.",
543
- confirmationClose: t.text?.confirmationClose ?? "Close",
544
- errorTitle: t.text?.errorTitle ?? "Message not sent",
545
- errorMessage: t.text?.errorMessage ?? "Something went wrong, so we did not get your message. Please try again later."
546
- },
547
- hideConfirmation: t.hideConfirmation ?? !1,
548
- modalWidth: t.modalWidth ?? 400,
549
- backdropOpacity: t.backdropOpacity ?? 0.3,
550
- fontFamily: t.fontFamily ?? "system-ui, -apple-system, sans-serif",
551
- fontSize: t.fontSize ?? 16,
552
- captureScreenshot: t.captureScreenshot ?? !1,
553
- annotate: t.annotate ?? !0,
554
- annotationColor: t.annotationColor ?? t.colors?.marker ?? "#6365f1",
555
- annotationPalette: t.annotationPalette ?? ve,
556
- screenshotMethod: t.screenshotMethod ?? "permission",
557
- screenshotOptions: {
558
- quality: t.screenshotOptions?.quality ?? 0.8,
559
- maxWidth: t.screenshotOptions?.maxWidth ?? 1280,
560
- maxHeight: t.screenshotOptions?.maxHeight ?? 800
561
- },
562
- incognito: t.incognito ?? !1,
563
- hideDismiss: t.hideDismiss ?? !1,
564
- positiveIcon: t.positiveIcon ?? "",
565
- negativeIcon: t.negativeIcon ?? "",
566
- feedbackIcon: t.feedbackIcon ?? "",
567
- hideThumbs: t.hideThumbs ?? !1,
568
- css: t.css ?? "",
569
- captureVideo: t.captureVideo ?? !1,
570
- videoOptions: {
571
- maxDuration: t.videoOptions?.maxDuration ?? 15,
572
- redaction: t.videoOptions?.redaction ?? !1
573
- },
574
- recordIcon: t.recordIcon ?? "",
575
- quests: {
576
- base: t.quests?.base ?? "",
577
- up: t.quests?.up ?? "",
578
- down: t.quests?.down ?? "",
579
- video: t.quests?.video ?? "",
580
- // Quest service reuses the feedback API key unless overridden.
581
- apiKey: t.quests?.apiKey ?? t.apiKey ?? "",
582
- moduleUrl: t.quests?.moduleUrl ?? fe
583
- }
584
- }, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = qe(), this.init();
585
- }
586
- applyVars(t) {
587
- Vt(t, this.cssVars);
588
- }
589
- /**
590
- * Announce a message via the shared visually-hidden live regions.
591
- * Prefer the overlay shadow root (which hosts every transient surface and
592
- * is never inerted by its own dialogs) so announcements are not suppressed
593
- * while a dialog aria-hides the main button host.
594
- */
595
- announceMsg(t, i = !1) {
596
- const o = this.overlayShadowRoot ?? this.shadowRoot;
597
- o && Xt(o, t, { assertive: i });
598
- }
599
- /**
600
- * Turn a transient surface into an accessible modal dialog: save the
601
- * invoking control, apply dialog semantics, trap focus, and inert the
602
- * background. Paired with closeDialogA11y() on every close path.
603
- */
604
- openDialogA11y(t, i) {
605
- this.dialogTrigger = te(), ie(t, i), this.dialogTrap = Zt(t), this.dialogRestoreInert = ne(t);
606
- }
607
- closeDialogA11y() {
608
- this.dialogTrap?.release(), this.dialogTrap = null, this.dialogRestoreInert && (this.dialogRestoreInert(), this.dialogRestoreInert = null), ee(this.dialogTrigger), this.dialogTrigger = null;
609
- }
610
- clearActiveThumb() {
611
- this.activeThumbBtn && (this.activeThumbBtn.setAttribute("aria-pressed", "false"), this.activeThumbBtn = null);
612
- }
613
- init() {
614
- jt(), this.cssVars = _t({
615
- positiveColor: this.config.colors.positive,
616
- negativeColor: this.config.colors.negative,
617
- markerColor: this.config.colors.marker,
618
- buttonSize: this.config.buttonSize,
619
- modalWidth: this.config.modalWidth,
620
- backdropOpacity: this.config.backdropOpacity,
621
- fontFamily: this.config.fontFamily,
622
- fontSize: this.config.fontSize
623
- }), !this.config.hideDismiss && we(this.config.apiKey) && (this._startDismissed = !0), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture = ue((t) => {
624
- this.feedbackData.consoleErrors = this.consoleCapture?.errors ?? [];
625
- }), this.feedbackData.consoleErrors = this.consoleCapture.errors, this.observeDom(), (this.config.captureVideo && this.videoSupported() || this.config.captureScreenshot || this.linkedQuestIds().length > 0) && this.schedulePrewarm(() => {
626
- this.config.captureVideo && this.videoSupported() && this.prewarmVideo(), this.config.captureScreenshot && this.prewarmScreenshot(), this.prewarmQuests();
627
- });
628
- }
629
- /**
630
- * Best-effort preload of a lazily-split feature chunk so its first use is
631
- * instant. Warming fetches + compiles (and defines) the module; the feature
632
- * modules have no load-time side effects, so this is safe. Errors are
633
- * swallowed — a failed preload just falls back to an on-demand load.
634
- */
635
- prewarmVideo() {
636
- this.videoPrewarmed || (this.videoPrewarmed = !0, import("./recording-DNngIGr2.js").catch(() => {
637
- }), import("./video-Bd_29-rK.js").catch(() => {
638
- }));
639
- }
640
- prewarmScreenshot() {
641
- this.screenshotPrewarmed || (this.screenshotPrewarmed = !0, (this.shouldCaptureViaDom() ? import("./screenshot-dom-CME7tYRE.js") : import("./screenshot-DYOKg2bS.js")).catch(() => {
642
- }), this.config.annotate && import("./annotate-BTLeFQa0.js").catch(() => {
643
- }));
644
- }
645
- /** Quest ids linked to any button, when quest launching is on. */
646
- linkedQuestIds() {
647
- const t = this.config.quests;
648
- return t.base ? [t.up, t.down, t.video].filter((i) => i) : [];
649
- }
650
- /**
651
- * Load the quests module and fetch every linked quest's definition, so a
652
- * click opens the quest with no network wait. Both are best-effort: a miss
653
- * just means the quest loads on click, as it always did.
654
- */
655
- prewarmQuests() {
656
- if (this.questsPrewarmed) return;
657
- const t = this.linkedQuestIds();
658
- if (t.length !== 0) {
659
- this.questsPrewarmed = !0, at(this.config.quests.moduleUrl).catch(() => {
660
- });
661
- for (const i of t)
662
- me(nt(this.config.quests.base, i));
663
- }
664
- }
665
- /** Run fn when the main thread is idle; cancelled by destroy(). */
666
- schedulePrewarm(t) {
667
- const i = window, o = () => {
668
- this.destroyed || t();
669
- };
670
- typeof i.requestIdleCallback == "function" ? (this.prewarmIsTimeout = !1, this.prewarmHandle = i.requestIdleCallback(o, { timeout: 2e3 })) : (this.prewarmIsTimeout = !0, this.prewarmHandle = window.setTimeout(o, 1200));
671
- }
672
- /**
673
- * Watch for the shadow hosts being removed from the DOM by framework
674
- * client-side navigation (e.g. Astro View Transitions swapping <body>
675
- * contents, or any SPA router that replaces DOM subtrees). If the host
676
- * is disconnected and destroy() wasn't called, re-append it.
677
- *
678
- * Also hooks into Astro's `astro:before-swap` when available, which
679
- * lets us carry elements into the new document before the swap happens
680
- * (avoids a flash of the widget disappearing and reappearing).
681
- */
682
- observeDom() {
683
- this.boundBeforeSwap = (t) => {
684
- const i = t.newDocument;
685
- !i || this.destroyed || (this.shadowHost && i.body.appendChild(this.shadowHost), this.overlayShadowHost && i.body.appendChild(this.overlayShadowHost));
686
- }, document.addEventListener("astro:before-swap", this.boundBeforeSwap), this.domObserver = new MutationObserver(() => {
687
- this.destroyed || (this.shadowHost && !this.shadowHost.isConnected && document.body.appendChild(this.shadowHost), this.overlayShadowHost && !this.overlayShadowHost.isConnected && document.body.appendChild(this.overlayShadowHost));
688
- }), this.domObserver.observe(document.body, { childList: !0 });
689
- }
690
- checkMobile() {
691
- this.isMobile = he();
692
- }
693
- handleResize() {
694
- this.checkMobile();
695
- }
696
- createEmbed() {
697
- this.shadowHost = document.createElement("div"), this.shadowHost.setAttribute("data-qaid-embed", ""), this.shadowHost.style.position = "static", this.shadowHost.style.display = "contents";
698
- let t = null;
699
- 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" });
700
- const i = document.createElement("style");
701
- if (i.textContent = Y(), this.shadowRoot.appendChild(i), this.config.css) {
702
- const d = document.createElement("style");
703
- d.textContent = this.config.css, this.shadowRoot.appendChild(d);
704
- }
705
- const o = this.config.direction === "vertical" ? "qaid-vertical" : "";
706
- if (this.isUserProvidedContainer)
707
- this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${o}`.trim(), this.config.incognito && this.buttonsContainer.classList.add("qaid-incognito");
708
- else {
709
- this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${o}${this.config.incognito ? " qaid-incognito" : ""}`.trim(), this.buttonsContainer.style.pointerEvents = "auto";
710
- const { x: d, y: s } = this.config.offset;
711
- 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 = `${s}px` : this.buttonsContainer.style.top = `${s}px`;
712
- }
713
- this.applyVars(this.buttonsContainer), this.shadowRoot.appendChild(this.buttonsContainer), this.buttonsContainer.addEventListener("keydown", (d) => {
714
- (d.key === "Enter" || d.key === " " || d.key === "Spacebar") && (this.keyboardActivation = !0);
715
- }), this.buttonsContainer.addEventListener("mousedown", () => {
716
- this.keyboardActivation = !1;
717
- }), this.buttonsContainer.addEventListener("pointerdown", () => {
718
- this.keyboardActivation = !1;
719
- });
720
- const a = !!this.config.buttonClass, n = a ? `qaid-btn-structural ${this.config.buttonClass}` : "qaid-btn", l = this.config.text.tooltip || "Feedback for us?", c = document.createElement("div");
721
- if (c.className = "qaid-tooltip-text", c.textContent = l, this.applyVars(c), this.shadowRoot.appendChild(c), this.tooltipElement = c, this.config.singleButton) {
722
- const d = document.createElement("div");
723
- d.className = "qaid-tooltip-wrapper";
724
- const s = document.createElement("button");
725
- s.type = "button", s.className = a ? `${n} qaid-btn-feedback` : "qaid-btn qaid-btn-feedback", s.setAttribute("aria-label", this.config.text.feedbackLabel), s.innerHTML = this.config.feedbackIcon || Lt, s.addEventListener("click", (u) => this.handleThumbClick("neutral", u.currentTarget, u)), s.addEventListener("mouseenter", () => {
726
- this.prewarmTargeting(), this.showTooltip(s);
727
- }), s.addEventListener("mouseleave", () => this.hideTooltip()), d.appendChild(s), this.buttonsContainer.appendChild(d);
728
- } else if (!this.config.hideThumbs) {
729
- const d = document.createElement("div");
730
- d.className = "qaid-tooltip-wrapper";
731
- const s = document.createElement("button");
732
- s.type = "button", s.className = a ? `${n} qaid-btn-up` : "qaid-btn qaid-btn-up", s.setAttribute("aria-label", this.config.text.positiveLabel), s.innerHTML = this.config.positiveIcon || Dt, s.addEventListener("click", (f) => this.handleThumbClick("up", f.currentTarget, f)), s.addEventListener("mouseenter", () => {
733
- this.prewarmTargeting(), this.prewarmQuests(), this.showTooltip(s);
734
- }), s.addEventListener("mouseleave", () => this.hideTooltip()), d.appendChild(s);
735
- const u = document.createElement("div");
736
- u.className = "qaid-tooltip-wrapper";
737
- const h = document.createElement("button");
738
- h.type = "button", h.className = a ? `${n} qaid-btn-down` : "qaid-btn qaid-btn-down", h.setAttribute("aria-label", this.config.text.negativeLabel), h.innerHTML = this.config.negativeIcon || zt, h.addEventListener("click", (f) => this.handleThumbClick("down", f.currentTarget, f)), h.addEventListener("mouseenter", () => {
739
- this.prewarmTargeting(), this.prewarmQuests(), this.showTooltip(h);
740
- }), h.addEventListener("mouseleave", () => this.hideTooltip()), u.appendChild(h), this.buttonsContainer.appendChild(d), this.buttonsContainer.appendChild(u);
741
- }
742
- if (this.config.captureVideo && this.videoSupported()) {
743
- const d = document.createElement("div");
744
- d.className = "qaid-tooltip-wrapper";
745
- const s = document.createElement("button");
746
- s.type = "button", s.className = a ? `${n} qaid-btn-record` : "qaid-btn qaid-btn-record", s.setAttribute("aria-label", this.config.text.recordLabel), s.innerHTML = this.config.recordIcon || Mt, s.addEventListener("click", () => {
747
- this.ensureRecording().then(
748
- (h) => this.config.videoOptions.redaction ? h.startPicking() : h.startRecording()
749
- );
750
- });
751
- const u = () => this.prewarmVideo();
752
- s.addEventListener("mouseenter", () => {
753
- u(), this.showTooltip(s);
754
- }), s.addEventListener("focus", u), s.addEventListener("touchstart", u, { passive: !0 }), s.addEventListener("mouseleave", () => this.hideTooltip()), d.appendChild(s), this.buttonsContainer.appendChild(d);
755
- }
756
- this.config.hideDismiss || (this.dismissBtn = document.createElement("button"), this.dismissBtn.type = "button", this.dismissBtn.className = "qaid-dismiss-btn", this.dismissBtn.setAttribute("aria-label", this.config.text.dismissLabel), this.dismissBtn.title = this.config.text.dismissLabel, this.dismissBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>', this.dismissBtn.addEventListener("click", (d) => {
757
- d.stopPropagation(), this.handleDismiss();
758
- }), this.buttonsContainer.insertBefore(this.dismissBtn, this.buttonsContainer.firstChild), this._startDismissed && this.buttonsContainer.classList.add("qaid-dismissed"));
759
- }
760
- /**
761
- * Lazily create a separate overlay shadow host on document.body.
762
- * This host contains all full-page elements (targeting overlay, marker,
763
- * backdrop, modal, recording indicator, video preview) so they escape
764
- * clip-path / transform containing blocks in user containers.
765
- */
766
- ensureOverlayHost() {
767
- if (this.overlayShadowRoot) return this.overlayShadowRoot;
768
- 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" });
769
- const t = document.createElement("style");
770
- if (t.textContent = Y(), this.overlayShadowRoot.appendChild(t), this.config.css) {
771
- const i = document.createElement("style");
772
- i.textContent = this.config.css, this.overlayShadowRoot.appendChild(i);
773
- }
774
- return this.overlayShadowRoot;
775
- }
776
- tooltipElement = null;
777
- showTooltip(t) {
778
- const i = this.tooltipElement;
779
- i.style.visibility = "hidden", i.classList.add("qaid-tooltip-visible");
780
- const o = t.getBoundingClientRect(), a = i.getBoundingClientRect(), { top: n, left: r } = le(
781
- o,
782
- a,
783
- { width: window.innerWidth, height: window.innerHeight }
784
- );
785
- i.style.top = `${n}px`, i.style.left = `${r}px`, i.style.visibility = "visible";
786
- }
787
- hideTooltip() {
788
- this.tooltipElement.classList.remove("qaid-tooltip-visible");
789
- }
790
- handleDismiss() {
791
- this.buttonsContainer.classList.add("qaid-dismissed"), tt(this.config.apiKey, !0);
792
- }
793
- handleThumbClick(t, i, o) {
794
- if (this.buttonsContainer?.classList.contains("qaid-incognito") && (this.buttonsContainer.classList.remove("qaid-incognito"), tt(this.config.apiKey, !1)), this.prewarmModal(), this.config.skipTargeting || this.config.feedbackMode === "annotate")
795
- this.submitDirectFeedback(t, i);
796
- else {
797
- this.activeThumbBtn = i, i.setAttribute("aria-pressed", "true");
798
- const a = this.keyboardActivation;
799
- this.keyboardActivation = !1, this.ensureTargeting().then((n) => {
800
- this.destroyed || (a ? n.startKeyboard(t) : n.startPointer(t, o));
801
- });
802
- }
803
- }
804
- submitDirectFeedback(t, i) {
805
- this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null;
806
- const o = i.getBoundingClientRect();
807
- this.selectedBounds = {
808
- x: o.left,
809
- y: o.top,
810
- width: o.width,
811
- height: o.height,
812
- clickX: o.left + o.width / 2,
813
- clickY: o.top + o.height / 2,
814
- visible: !1
815
- }, this.submitFeedback();
816
- }
817
- handleKeyDown(t) {
818
- if (t.key === "Escape") {
819
- if (this.recording?.handleEscape()) return;
820
- this.state === "TARGETING" ? this.targeting?.cancel() : this.state === "MODAL_OPEN" && this.modal?.close();
821
- }
822
- }
823
- /** Whether to capture the screenshot with the DOM/canvas method (html2canvas)
824
- * instead of the permission-based Screen Capture API. Explicit "dom" wins;
825
- * otherwise DOM is used on touch devices to avoid the getDisplayMedia prompt. */
826
- shouldCaptureViaDom() {
827
- return this.config.screenshotMethod === "dom" || ye();
828
- }
829
- /**
830
- * Open the full-screen annotation editor over the captured screenshot,
831
- * reusing the overlay shadow host and the shared dialog a11y helpers.
832
- * Resolves with the composited WebP data URL, or null when the user skips
833
- * (caller keeps the original). Pointer events on the overlay host are
834
- * enabled while the editor is open and restored on close.
835
- */
836
- async openAnnotationEditor(t) {
837
- const i = this.ensureOverlayHost(), o = this.overlayShadowHost, a = o.style.pointerEvents;
838
- o.style.pointerEvents = "auto";
839
- try {
840
- const { openAnnotationEditor: n } = await import("./annotate-BTLeFQa0.js");
841
- return await n({
842
- dataUrl: t,
843
- root: i,
844
- quality: this.config.screenshotOptions.quality,
845
- color: this.config.annotationColor,
846
- palette: this.config.annotationPalette,
847
- applyVars: (r) => this.applyVars(r),
848
- announce: (r, l) => this.announceMsg(r, l),
849
- openDialog: (r, l) => this.openDialogA11y(r, l),
850
- closeDialog: () => this.closeDialogA11y()
851
- });
852
- } catch (n) {
853
- return console.error("Annotation editor failed to open:", n), null;
854
- } finally {
855
- o.style.pointerEvents = a;
856
- }
857
- }
858
- async submitFeedback() {
859
- let t = null;
860
- if (this.config.captureScreenshot || this.config.feedbackMode === "annotate")
861
- try {
862
- if (this.shouldCaptureViaDom()) {
863
- const { captureDomScreenshot: r } = await import("./screenshot-dom-CME7tYRE.js");
864
- t = await r(this.config.screenshotOptions);
865
- } else {
866
- const { captureScreenshot: r } = await import("./screenshot-DYOKg2bS.js");
867
- t = await r(this.config.screenshotOptions);
868
- }
869
- t && this.announceMsg("Screenshot captured");
870
- } catch (r) {
871
- console.error("Screenshot capture failed:", r), t = null;
872
- }
873
- t && this.config.annotate && (t = await this.openAnnotationEditor(t) ?? t);
874
- const o = this.feedbackData.elementSelector ? {
875
- x: this.selectedBounds.x,
876
- y: this.selectedBounds.y,
877
- width: this.selectedBounds.width,
878
- height: this.selectedBounds.height
879
- } : null, a = {
880
- feedbackType: this.feedbackData.feedbackType,
881
- pageUrl: window.location.href,
882
- apiKey: this.config.apiKey || void 0,
883
- elementSelector: this.feedbackData.elementSelector,
884
- elementText: this.feedbackData.elementText,
885
- consoleErrors: [...this.feedbackData.consoleErrors],
886
- screenWidth: window.innerWidth,
887
- screenHeight: window.innerHeight,
888
- clickX: this.selectedBounds.clickX,
889
- clickY: this.selectedBounds.clickY,
890
- scrollX: window.scrollX,
891
- scrollY: window.scrollY,
892
- screenshot: t,
893
- visitorId: this.visitorId,
894
- // Include element bounds and user agent for server-side screenshot fallback
895
- elementBounds: o,
896
- userAgent: navigator.userAgent
897
- };
898
- this.feedbackIdPromise = this.postFeedback(a);
899
- const n = this.feedbackData.feedbackType;
900
- if (n && n !== "neutral" && await this.tryLaunchQuest(n, this.feedbackIdPromise)) {
901
- this.resetFeedbackUi();
902
- return;
903
- }
904
- this.state = "MODAL_OPEN";
905
- try {
906
- const r = await this.ensureModal();
907
- if (this.destroyed) return;
908
- r.open(), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto");
909
- } catch (r) {
910
- console.error("Failed to open the feedback modal:", r), this.announceMsg("Thank you for your feedback!", !0), this.resetFeedbackUi();
911
- }
912
- }
913
- /** POST the feedback. Resolves to the new record's id, or null if it failed. */
914
- async postFeedback(t) {
915
- try {
916
- const i = await fetch(this.config.endpoint, {
917
- method: "POST",
918
- headers: { "Content-Type": "application/json" },
919
- body: JSON.stringify(t)
920
- });
921
- if (i.ok) {
922
- const o = await i.json();
923
- return this.announceMsg("Feedback sent"), o.id;
924
- }
925
- } catch (i) {
926
- console.error("Failed to submit feedback:", i), this.announceMsg("Failed to send feedback", !0);
927
- }
928
- return null;
929
- }
930
- /**
931
- * Quest id linked to `type`, or "" when quest launching is disabled
932
- * (no `base`) or this button has no quest configured.
933
- */
934
- questIdFor(t) {
935
- const i = this.config.quests;
936
- return i.base && i[t] || "";
937
- }
938
- /**
939
- * Launch the quest linked to `type`, if any. Resolves `true` when a quest
940
- * was configured and the widget launched; `false` when no quest is
941
- * configured or the widget failed to load (caller falls back to its
942
- * normal UI). The created feedback record id is passed through so the
943
- * quest response can be joined back to it server-side.
944
- */
945
- async tryLaunchQuest(t, i) {
946
- const o = this.questIdFor(t);
947
- if (!o) return !1;
948
- try {
949
- return this.activeQuest?.destroy(), this.activeQuest = await ge({
950
- questId: o,
951
- base: this.config.quests.base,
952
- apiKey: this.config.quests.apiKey || void 0,
953
- moduleUrl: this.config.quests.moduleUrl,
954
- feedbackId: i,
955
- onClose: () => {
956
- this.activeQuest = null;
957
- }
958
- }), !0;
959
- } catch (a) {
960
- return console.error("Failed to launch quest:", a), this.activeQuest = null, !1;
961
- }
962
- }
963
- /**
964
- * Reset the thumbs targeting/marker UI back to idle without opening or
965
- * closing the message modal. Shared by closeModal() and the quest-launch
966
- * path (which bypasses the modal entirely).
967
- */
968
- resetFeedbackUi() {
969
- 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;
970
- }
971
- /**
972
- * Lazily load and instantiate the modal controller. The message modal lives
973
- * in a separate chunk, fetched the first time it opens (and pre-warmed while
974
- * the user targets an element — see prewarmModal).
975
- */
976
- async ensureModal() {
977
- if (!this.modal) {
978
- const { ModalController: t } = await import("./modal-zwBhxWO0.js");
979
- this.modal = new t(this.makeModalHost());
980
- }
981
- return this.modal;
982
- }
983
- /** Narrow view of the embed the modal controller talks back through. */
984
- makeModalHost() {
985
- const t = this;
986
- return {
987
- get config() {
988
- return t.config;
989
- },
990
- get uid() {
991
- return t.uid;
992
- },
993
- get isMobile() {
994
- return t.isMobile;
995
- },
996
- get state() {
997
- return t.state;
998
- },
999
- get boundKeyDown() {
1000
- return t.boundKeyDown;
1001
- },
1002
- get feedbackData() {
1003
- return t.feedbackData;
1004
- },
1005
- get selectedBounds() {
1006
- return t.selectedBounds;
1007
- },
1008
- whenFeedbackId: () => t.feedbackIdPromise,
1009
- ensureOverlayHost: () => t.ensureOverlayHost(),
1010
- applyVars: (i) => t.applyVars(i),
1011
- announceMsg: (i, o) => t.announceMsg(i, o),
1012
- openDialogA11y: (i, o) => t.openDialogA11y(i, o),
1013
- closeDialogA11y: () => t.closeDialogA11y(),
1014
- resetFeedbackUi: () => t.resetFeedbackUi()
1015
- };
1016
- }
1017
- /** Warm the modal chunk while the user is targeting, so it opens instantly. */
1018
- prewarmModal() {
1019
- this.modalPrewarmed || (this.modalPrewarmed = !0, import("./modal-zwBhxWO0.js").catch(() => {
1020
- }));
1021
- }
1022
- /**
1023
- * Lazily load and instantiate the targeting controller. The subsystem (with
1024
- * element-selector) lives in a separate chunk, fetched the first time the
1025
- * user targets — pre-warmed on thumb-button hover (see prewarmTargeting).
1026
- */
1027
- async ensureTargeting() {
1028
- if (!this.targeting) {
1029
- const { TargetingController: t } = await import("./targeting-DaBmGVk5.js");
1030
- this.targeting = new t(this.makeTargetingHost());
1031
- }
1032
- return this.targeting;
1033
- }
1034
- /** Narrow view of the embed the targeting controller talks back through. */
1035
- makeTargetingHost() {
1036
- const t = this;
1037
- return {
1038
- get config() {
1039
- return t.config;
1040
- },
1041
- get cssVars() {
1042
- return t.cssVars;
1043
- },
1044
- get state() {
1045
- return t.state;
1046
- },
1047
- get shadowHost() {
1048
- return t.shadowHost;
1049
- },
1050
- get overlayShadowHost() {
1051
- return t.overlayShadowHost;
1052
- },
1053
- get boundKeyDown() {
1054
- return t.boundKeyDown;
1055
- },
1056
- get feedbackData() {
1057
- return t.feedbackData;
1058
- },
1059
- get selectedBounds() {
1060
- return t.selectedBounds;
1061
- },
1062
- setState: (i) => {
1063
- t.state = i;
1064
- },
1065
- ensureOverlayHost: () => t.ensureOverlayHost(),
1066
- applyVars: (i) => t.applyVars(i),
1067
- announceMsg: (i, o) => t.announceMsg(i, o),
1068
- clearActiveThumb: () => t.clearActiveThumb(),
1069
- submitFeedback: () => t.submitFeedback()
1070
- };
1071
- }
1072
- /** Warm the targeting chunk on thumb-button hover, before the click. */
1073
- prewarmTargeting() {
1074
- this.targetingPrewarmed || this.config.skipTargeting || (this.targetingPrewarmed = !0, import("./targeting-DaBmGVk5.js").catch(() => {
1075
- }));
1076
- }
1077
- // ==================== Video Recording ====================
1078
- /**
1079
- * Cheap synchronous capability check so the record button can render without
1080
- * pulling in the (lazily-loaded) video subsystem. Mirrors
1081
- * isVideoRecordingSupported() in video-capture.ts.
1082
- */
1083
- videoSupported() {
1084
- return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function" && typeof MediaRecorder < "u";
1085
- }
1086
- /**
1087
- * Lazily load and instantiate the recording controller. The whole recording
1088
- * subsystem lives in a separate chunk, fetched only the first time the record
1089
- * button is used (and pre-warmed on hover — see prewarmVideo).
1090
- */
1091
- async ensureRecording() {
1092
- if (!this.recording) {
1093
- const { RecordingController: t } = await import("./recording-DNngIGr2.js");
1094
- this.recording = new t(this.makeRecordingHost());
1095
- }
1096
- return this.recording;
1097
- }
1098
- /** Narrow view of the embed the recording controller talks back through. */
1099
- makeRecordingHost() {
1100
- const t = this;
1101
- return {
1102
- get config() {
1103
- return t.config;
1104
- },
1105
- get visitorId() {
1106
- return t.visitorId;
1107
- },
1108
- get uid() {
1109
- return t.uid;
1110
- },
1111
- get overlayShadowHost() {
1112
- return t.overlayShadowHost;
1113
- },
1114
- get consoleCapture() {
1115
- return t.consoleCapture;
1116
- },
1117
- get boundKeyDown() {
1118
- return t.boundKeyDown;
1119
- },
1120
- get state() {
1121
- return t.state;
1122
- },
1123
- setState: (i) => {
1124
- t.state = i;
1125
- },
1126
- ensureOverlayHost: () => t.ensureOverlayHost(),
1127
- applyVars: (i) => t.applyVars(i),
1128
- announceMsg: (i, o) => t.announceMsg(i, o),
1129
- openDialogA11y: (i, o) => t.openDialogA11y(i, o),
1130
- closeDialogA11y: () => t.closeDialogA11y(),
1131
- setButtonsDisabled: (i) => t.setButtonsDisabled(i),
1132
- tryLaunchQuest: (i, o) => t.tryLaunchQuest(i, o)
1133
- };
1134
- }
1135
- setButtonsDisabled(t) {
1136
- if (!this.buttonsContainer) return;
1137
- this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((o) => {
1138
- t ? o.classList.contains("qaid-btn-record") || (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "");
1139
- });
1140
- }
1141
- /**
1142
- * Destroy the embed and clean up all resources
1143
- */
1144
- destroy() {
1145
- 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) {
1146
- const t = window;
1147
- this.prewarmIsTimeout ? clearTimeout(this.prewarmHandle) : t.cancelIdleCallback?.(this.prewarmHandle), this.prewarmHandle = null;
1148
- }
1149
- 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, $t();
1150
- }
1151
- }
1152
- function rt(e) {
1153
- return document.querySelector(e)?.textContent?.trim() ?? "";
1154
- }
1155
- function ke() {
1156
- const e = document.querySelector(
1157
- 'script[type="application/json"][data-feedback-config]'
1158
- );
1159
- if (!e) return null;
1160
- const t = e.textContent?.trim();
1161
- if (!t) return null;
1162
- try {
1163
- const i = JSON.parse(t);
1164
- return i.cssSelector && !i.css && (i.css = rt(i.cssSelector), delete i.cssSelector), i;
1165
- } catch {
1166
- return null;
1167
- }
1168
- }
1169
- function st(e, t, i) {
1170
- console.warn(`[thumbs-embed] Ignoring ${e}="${t}": expected ${i}.`);
1171
- }
1172
- function Ce(e) {
1173
- const t = [];
1174
- let i = 0, o = "";
1175
- for (const a of e)
1176
- a === "(" && i++, a === ")" && (i = Math.max(0, i - 1)), a === "," && i === 0 ? (t.push(o.trim()), o = "") : o += a;
1177
- return t.push(o.trim()), t;
1178
- }
1179
- function Ae(e, t) {
1180
- if (t === null) return;
1181
- const i = t.trim();
1182
- let o = null;
1183
- if (i.startsWith("[") || i.startsWith("{"))
1184
- try {
1185
- o = JSON.parse(i);
1186
- } catch {
1187
- o = null;
1188
- }
1189
- else
1190
- o = Ce(i);
1191
- if (Array.isArray(o) && o.length > 0 && o.every((a) => typeof a == "string" && a.trim() !== ""))
1192
- return o.map((a) => a.trim());
1193
- st(e, t, "a JSON array of colours or a comma-separated list");
1194
- }
1195
- function m(e, t) {
1196
- if (t !== null) {
1197
- if (t.trim() === "") {
1198
- st(e, t, "a non-empty label");
1199
- return;
1200
- }
1201
- return t;
1202
- }
1203
- }
1204
- function Se(e) {
1205
- const t = e.getAttribute("data-endpoint");
1206
- if (!t) return null;
1207
- const i = e.getAttribute("data-position"), o = e.getAttribute("data-zindex"), a = e.getAttribute("data-positive-color"), n = e.getAttribute("data-negative-color"), r = e.getAttribute("data-marker-color"), l = e.getAttribute("data-container"), c = e.getAttribute("data-button-class"), d = e.getAttribute("data-skip-targeting"), s = e.getAttribute("data-hide-confirmation"), u = e.getAttribute("data-single-button"), h = e.getAttribute("data-feedback-mode"), f = e.getAttribute("data-incognito"), dt = e.getAttribute("data-button-size"), g = e.getAttribute("data-offset-x"), v = e.getAttribute("data-offset-y"), T = e.getAttribute("data-modal-width"), E = e.getAttribute("data-backdrop-opacity"), lt = e.getAttribute("data-font-family"), I = e.getAttribute("data-font-size"), D = e.getAttribute("data-tooltip"), z = e.getAttribute("data-modal-title"), M = e.getAttribute("data-confirmation-title"), L = e.getAttribute("data-confirmation-message"), H = e.getAttribute("data-confirmation-close"), B = e.getAttribute("data-error-title"), O = e.getAttribute("data-error-message"), P = e.getAttribute("data-modal-subtitle"), R = e.getAttribute("data-placeholder"), N = e.getAttribute("data-submit-button"), U = e.getAttribute("data-skip-button"), ct = e.getAttribute("data-positive-icon"), ut = e.getAttribute("data-negative-icon"), ht = e.getAttribute("data-feedback-icon"), F = e.getAttribute("data-feedback-label"), ft = e.getAttribute("data-api-key"), pt = e.getAttribute("data-capture-screenshot"), bt = e.getAttribute("data-annotate"), mt = e.getAttribute("data-annotation-color"), y = e.getAttribute("data-screenshot-quality"), w = e.getAttribute("data-screenshot-max-width"), q = e.getAttribute("data-screenshot-max-height"), gt = e.getAttribute("data-capture-video"), _ = e.getAttribute("data-video-redaction"), vt = e.getAttribute("data-hide-thumbs"), yt = e.getAttribute("data-hide-dismiss"), x = e.getAttribute("data-video-max-duration"), wt = e.getAttribute("data-screenshot-method"), qt = e.getAttribute("data-direction"), V = e.getAttribute("data-css-selector"), xt = e.getAttribute("data-css"), j = m("data-positive-label", e.getAttribute("data-positive-label")), $ = m("data-negative-label", e.getAttribute("data-negative-label")), K = m("data-record-label", e.getAttribute("data-record-label")), Q = m("data-dismiss-label", e.getAttribute("data-dismiss-label")), kt = Ae(
1208
- "data-annotation-palette",
1209
- e.getAttribute("data-annotation-palette")
1210
- ), Ct = e.getAttribute("data-record-icon"), W = e.getAttribute("data-quest-base"), At = e.getAttribute("data-quest-up"), St = e.getAttribute("data-quest-down"), Tt = e.getAttribute("data-quest-video"), Et = e.getAttribute("data-quest-api-key"), It = e.getAttribute("data-quest-module-url");
1211
- return {
1212
- endpoint: t,
1213
- // Inline CSS wins over a selector, as `css` wins over `cssSelector` in
1214
- // the JSON block.
1215
- css: xt || (V ? rt(V) : void 0),
1216
- apiKey: ft ?? void 0,
1217
- captureScreenshot: pt === "true" ? !0 : void 0,
1218
- // Annotation is on by default; only an explicit "false" disables it.
1219
- annotate: bt === "false" ? !1 : void 0,
1220
- annotationColor: mt ?? void 0,
1221
- annotationPalette: kt,
1222
- screenshotOptions: y || w || q ? {
1223
- quality: y ? parseFloat(y) : void 0,
1224
- maxWidth: w ? parseInt(w, 10) : void 0,
1225
- maxHeight: q ? parseInt(q, 10) : void 0
1226
- } : void 0,
1227
- container: l ?? void 0,
1228
- buttonClass: c ?? void 0,
1229
- direction: qt ?? void 0,
1230
- position: i ?? void 0,
1231
- zIndex: o ? parseInt(o, 10) : void 0,
1232
- skipTargeting: d === "true" ? !0 : void 0,
1233
- hideConfirmation: s === "true" ? !0 : void 0,
1234
- singleButton: u === "true" ? !0 : void 0,
1235
- feedbackMode: h ?? void 0,
1236
- incognito: f === "true" ? !0 : void 0,
1237
- buttonSize: dt ?? void 0,
1238
- offset: g || v ? {
1239
- x: g ? parseInt(g, 10) : void 0,
1240
- y: v ? parseInt(v, 10) : void 0
1241
- } : void 0,
1242
- modalWidth: T ? parseInt(T, 10) : void 0,
1243
- backdropOpacity: E ? parseFloat(E) : void 0,
1244
- fontFamily: lt ?? void 0,
1245
- fontSize: I ? parseInt(I, 10) : void 0,
1246
- colors: {
1247
- positive: a ?? void 0,
1248
- negative: n ?? void 0,
1249
- marker: r ?? void 0
1250
- },
1251
- text: D || z || P || R || N || U || F || M || L || H || B || O || j || $ || K || Q ? {
1252
- tooltip: D ?? void 0,
1253
- modalTitle: z ?? void 0,
1254
- modalSubtitle: P ?? void 0,
1255
- placeholder: R ?? void 0,
1256
- submitButton: N ?? void 0,
1257
- skipButton: U ?? void 0,
1258
- feedbackLabel: F ?? void 0,
1259
- confirmationTitle: M ?? void 0,
1260
- confirmationMessage: L ?? void 0,
1261
- confirmationClose: H ?? void 0,
1262
- errorTitle: B ?? void 0,
1263
- errorMessage: O ?? void 0,
1264
- positiveLabel: j,
1265
- negativeLabel: $,
1266
- recordLabel: K,
1267
- dismissLabel: Q
1268
- } : void 0,
1269
- positiveIcon: ct ?? void 0,
1270
- recordIcon: Ct ?? void 0,
1271
- negativeIcon: ut ?? void 0,
1272
- feedbackIcon: ht ?? void 0,
1273
- screenshotMethod: wt ?? void 0,
1274
- captureVideo: gt === "true" ? !0 : void 0,
1275
- hideThumbs: vt === "true" ? !0 : void 0,
1276
- hideDismiss: yt === "true" ? !0 : void 0,
1277
- videoOptions: x || _ ? {
1278
- maxDuration: x ? parseInt(x, 10) : void 0,
1279
- redaction: _ === "true" ? !0 : void 0
1280
- } : void 0,
1281
- quests: W ? {
1282
- base: W,
1283
- up: At ?? void 0,
1284
- down: St ?? void 0,
1285
- video: Tt ?? void 0,
1286
- apiKey: Et ?? void 0,
1287
- moduleUrl: It ?? void 0
1288
- } : void 0
1289
- };
1290
- }
1291
- function Ue() {
1292
- if (typeof document > "u") return;
1293
- const e = () => {
1294
- const t = document.currentScript ?? document.querySelector("script[data-endpoint]"), i = ke() ?? (t ? Se(t) : null);
1295
- i?.endpoint && new xe(i);
1296
- };
1297
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
1298
- }
1299
- export {
1300
- Ee as A,
1301
- De as B,
1302
- Me as D,
1303
- Le as E,
1304
- Lt as F,
1305
- Ie as P,
1306
- xe as Q,
1307
- Te as R,
1308
- He as S,
1309
- Dt as T,
1310
- ze as U,
1311
- Ue as a,
1312
- Be as b,
1313
- Oe as c,
1314
- zt as d,
1315
- Pe as e,
1316
- Ne as g,
1317
- Re as i
1318
- };
1319
- //# sourceMappingURL=core-2nGsCcZq.js.map