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