@qaiddev/thumbs-embed 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/qaid.js CHANGED
@@ -1,30 +1,27 @@
1
- var tt = Object.defineProperty;
2
- var et = (e, t, o) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
- var h = (e, t, o) => et(e, typeof t != "symbol" ? t + "" : t, o);
4
- const T = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
1
+ const E = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
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"/>
6
- </svg>`, I = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
3
+ </svg>`, T = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
7
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"/>
8
- </svg>`, it = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
+ </svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
9
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"/>
10
- </svg>`, ot = ".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}button.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.qaid-icon{width:24px;height:24px}.qaid-btn-structural:not(:has(svg)),.qaid-btn:not(:has(svg)){font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-emoji-icon{font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-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:1rem;font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}.qaid-targeting-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;top:0;right:0;bottom:0;left:0;cursor:crosshair;pointer-events:auto;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;top:10px;right:10px;bottom:10px;left:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;top:20px;right:20px;bottom:20px;left:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}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;-moz-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-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;-moz-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;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:.875rem;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:.75rem;font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;-moz-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;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:calc(100vw - 32px);max-height:calc(100vh - 32px);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:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;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:.875rem;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-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;-moz-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:.875rem;color:light-dark(#6b7280,#9ca3af)}", nt = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}.qaid-highlight{outline:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent)!important;outline-offset:2px!important;box-shadow:inset 0 0 0 9999px color-mix(in srgb,var(--qaid-negative) 8%,transparent)!important;transition:outline .1s ease!important}body.qaid-targeting.qaid-type-up .qaid-highlight{outline-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)!important;box-shadow:inset 0 0 0 9999px color-mix(in srgb,var(--qaid-positive) 8%,transparent)!important}";
11
- let q = 0;
12
- const at = "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 svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}", st = {
7
+ </svg>`, Q = "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}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}.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:1rem;font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}.qaid-targeting-overlay{position:fixed;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, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;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-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-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;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:.875rem;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:.75rem;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;display:flex;align-items:center;justify-content:center;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:calc(100vw - 32px);max-height:calc(100vh - 32px);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:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;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:.875rem;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-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;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:.875rem;color:light-dark(#6b7280,#9ca3af)}", tt = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";
8
+ let w = 0;
9
+ const et = "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 svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}", it = {
13
10
  small: 36,
14
11
  medium: 48,
15
12
  large: 64
16
- }, rt = {
13
+ }, ot = {
17
14
  small: 18,
18
15
  medium: 24,
19
16
  large: 32
20
17
  };
21
- function dt(e, t, o) {
22
- const [i, n, a] = [e, t, o].map((s) => (s = s / 255, s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4)));
23
- return 0.2126 * i + 0.7152 * n + 0.0722 * a;
18
+ function nt(e, t, i) {
19
+ const [o, n, a] = [e, t, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
20
+ return 0.2126 * o + 0.7152 * n + 0.0722 * a;
24
21
  }
25
- function ct(e) {
22
+ function at(e) {
26
23
  if (e.startsWith("#")) {
27
- const o = e.slice(1), i = o.length === 3 ? o.split("").map((a) => a + a).join("") : o, n = parseInt(i, 16);
24
+ const i = e.slice(1), o = i.length === 3 ? i.split("").map((a) => a + a).join("") : i, n = parseInt(o, 16);
28
25
  return {
29
26
  r: n >> 16 & 255,
30
27
  g: n >> 8 & 255,
@@ -38,248 +35,247 @@ function ct(e) {
38
35
  b: parseInt(t[3])
39
36
  } : null;
40
37
  }
41
- function lt(e) {
42
- const t = ct(e);
43
- return t && dt(t.r, t.g, t.b) > 0.4 ? "black" : "white";
38
+ function st(e) {
39
+ const t = at(e);
40
+ return t && nt(t.r, t.g, t.b) > 0.4 ? "black" : "white";
44
41
  }
45
- function ht(e = {}) {
42
+ function rt(e = {}) {
46
43
  const {
47
44
  positiveColor: t = "rgb(0, 200, 83)",
48
- negativeColor: o = "rgb(255, 0, 0)",
49
- markerColor: i = "#6366f1",
45
+ negativeColor: i = "rgb(255, 0, 0)",
46
+ markerColor: o = "#6366f1",
50
47
  buttonSize: n = "medium",
51
48
  modalWidth: a = 400,
52
- backdropOpacity: s = 0.3,
49
+ backdropOpacity: r = 0.3,
53
50
  fontFamily: l = "system-ui, -apple-system, sans-serif",
54
51
  fontSize: d = 16
55
- } = e, r = st[n], c = rt[n], u = lt(i);
52
+ } = e, s = it[n], c = ot[n], h = st(o);
56
53
  return {
57
54
  "--qaid-positive": t,
58
- "--qaid-negative": o,
59
- "--qaid-marker": i,
60
- "--qaid-marker-text": u,
61
- "--qaid-btn-size": `${r}px`,
55
+ "--qaid-negative": i,
56
+ "--qaid-marker": o,
57
+ "--qaid-marker-text": h,
58
+ "--qaid-btn-size": `${s}px`,
62
59
  "--qaid-icon-size": `${c}px`,
63
60
  "--qaid-modal-width": `${a}px`,
64
- "--qaid-backdrop-opacity": String(s),
61
+ "--qaid-backdrop-opacity": String(r),
65
62
  "--qaid-font-family": l,
66
63
  "--qaid-font-size": `${d}px`
67
64
  };
68
65
  }
69
- function ut(e, t) {
70
- for (const [o, i] of Object.entries(t))
71
- e.style.setProperty(o, i);
66
+ function dt(e, t) {
67
+ for (const [i, o] of Object.entries(t))
68
+ e.style.setProperty(i, o);
72
69
  }
73
- function A() {
74
- return ot + at;
70
+ function z() {
71
+ return Q + et;
75
72
  }
76
- function pt() {
77
- if (q++, q > 1) return;
73
+ function ct() {
74
+ if (w++, w > 1) return;
78
75
  const e = document.createElement("style");
79
- e.id = "qaid-styles", e.textContent = nt, document.head.appendChild(e);
76
+ e.id = "qaid-styles", e.textContent = tt, document.head.appendChild(e);
80
77
  }
81
- function mt() {
82
- if (!(q <= 0) && (q--, q === 0)) {
78
+ function lt() {
79
+ if (!(w <= 0) && (w--, w === 0)) {
83
80
  const e = document.getElementById("qaid-styles");
84
81
  e && e.remove();
85
82
  }
86
83
  }
87
- const ft = ["data-comp", "data-qa", "data-testid", "data-id"];
88
- function F(e, t = document.body) {
89
- let o = e;
90
- for (; o && o !== t; ) {
91
- for (const i of ft) {
92
- const n = o.getAttribute(i);
84
+ const ht = ["data-comp", "data-qa", "data-testid", "data-id"];
85
+ function V(e, t = document.body) {
86
+ let i = e;
87
+ for (; i && i !== t; ) {
88
+ for (const o of ht) {
89
+ const n = i.getAttribute(o);
93
90
  if (n)
94
- return `${i}="${n}"`;
91
+ return `${o}="${n}"`;
95
92
  }
96
- o = o.parentElement;
93
+ i = i.parentElement;
97
94
  }
98
95
  return null;
99
96
  }
100
- function gt(e, t = 100) {
101
- var i;
102
- const o = ((i = e.textContent) == null ? void 0 : i.trim().slice(0, t)) || "";
103
- return o.length === t ? o + "..." : o;
97
+ function ut(e, t = 100) {
98
+ const i = e.textContent?.trim().slice(0, t) || "";
99
+ return i.length === t ? i + "..." : i;
104
100
  }
105
- function bt(e) {
106
- let t = 1, o = e.previousElementSibling;
107
- for (; o; )
108
- t++, o = o.previousElementSibling;
101
+ function pt(e) {
102
+ let t = 1, i = e.previousElementSibling;
103
+ for (; i; )
104
+ t++, i = i.previousElementSibling;
109
105
  return t;
110
106
  }
111
- function vt(e) {
107
+ function mt(e) {
112
108
  const t = [];
113
- let o = e;
114
- for (; o && o !== document.body && o !== document.documentElement; ) {
115
- const i = o.tagName.toLowerCase(), n = bt(o);
116
- t.unshift(`${i}:nth-child(${n})`), o = o.parentElement;
109
+ let i = e;
110
+ for (; i && i !== document.body && i !== document.documentElement; ) {
111
+ const o = i.tagName.toLowerCase(), n = pt(i);
112
+ t.unshift(`${o}:nth-child(${n})`), i = i.parentElement;
117
113
  }
118
114
  return t.length > 0 ? `body > ${t.join(" > ")}` : "body";
119
115
  }
120
- function yt(e) {
116
+ function ft(e) {
121
117
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
122
118
  }
123
- function wt(e) {
124
- const t = F(e);
125
- return t ? `[${t}]` : e.id ? `#${yt(e.id)}` : vt(e);
119
+ function gt(e) {
120
+ const t = V(e);
121
+ return t ? `[${t}]` : e.id ? `#${ft(e.id)}` : mt(e);
126
122
  }
127
- function qt(e) {
128
- const t = gt(e), o = F(e);
129
- return { selector: wt(e), text: t, dataAttr: o };
123
+ function bt(e) {
124
+ const t = ut(e), i = V(e);
125
+ return { selector: gt(e), text: t, dataAttr: i };
130
126
  }
131
- const W = {
127
+ const U = {
132
128
  width: 400,
133
129
  height: 280,
134
130
  arrowHeight: 12,
135
131
  gap: 8,
136
132
  viewportPadding: 16
137
133
  };
138
- function xt(e, t, o, i, n) {
139
- const a = e.y, s = t - (e.y + e.height);
140
- if (s >= o + i)
134
+ function vt(e, t, i, o, n) {
135
+ const a = e.y, r = t - (e.y + e.height);
136
+ if (r >= i + o)
141
137
  return {
142
- top: e.y + e.height + i,
138
+ top: e.y + e.height + o,
143
139
  position: "below"
144
140
  };
145
- if (a >= o + i)
141
+ if (a >= i + o)
146
142
  return {
147
- top: e.y - o - i,
143
+ top: e.y - i - o,
148
144
  position: "above"
149
145
  };
150
- const l = s > a ? "below" : "above";
146
+ const l = r > a ? "below" : "above";
151
147
  let d;
152
148
  return l === "below" ? d = Math.min(
153
- e.y + e.height + i,
154
- t - o - n
155
- ) : d = Math.max(n, e.y - o - i), { top: d, position: l };
149
+ e.y + e.height + o,
150
+ t - i - n
151
+ ) : d = Math.max(n, e.y - i - o), { top: d, position: l };
156
152
  }
157
- function kt(e, t, o, i) {
158
- let a = e.x + e.width / 2 - o / 2;
159
- return a = Math.max(i, Math.min(a, t - o - i)), a;
153
+ function yt(e, t, i, o) {
154
+ let a = e.x + e.width / 2 - i / 2;
155
+ return a = Math.max(o, Math.min(a, t - i - o)), a;
160
156
  }
161
- function Ct(e, t, o, i = 24, n = 24) {
162
- const s = e.clickX - t - n / 2;
163
- return Math.max(i, Math.min(s, o - i - n / 2));
157
+ function wt(e, t, i, o = 24, n = 24) {
158
+ const r = e.clickX - t - n / 2;
159
+ return Math.max(o, Math.min(r, i - o - n / 2));
164
160
  }
165
- function St(e, t, o, i = W) {
166
- const n = i.height + i.arrowHeight, a = xt(
161
+ function xt(e, t, i, o = U) {
162
+ const n = o.height + o.arrowHeight, a = vt(
167
163
  e,
168
- o,
164
+ i,
169
165
  n,
170
- i.gap,
171
- i.viewportPadding
172
- ), s = kt(
166
+ o.gap,
167
+ o.viewportPadding
168
+ ), r = yt(
173
169
  e,
174
170
  t,
175
- i.width,
176
- i.viewportPadding
171
+ o.width,
172
+ o.viewportPadding
177
173
  );
178
174
  return {
179
175
  top: a.top,
180
- left: s,
176
+ left: r,
181
177
  position: a.position
182
178
  };
183
179
  }
184
- function Et(e, t, o, i = W) {
185
- const n = St(e, t, o, i), a = Ct(
180
+ function qt(e, t, i, o = U) {
181
+ const n = xt(e, t, i, o), a = wt(
186
182
  e,
187
183
  n.left,
188
- i.width
184
+ o.width
189
185
  );
190
186
  return {
191
187
  modal: n,
192
188
  arrow: { left: a }
193
189
  };
194
190
  }
195
- const Tt = 20;
196
- function It(e) {
197
- const t = [], o = console.error, i = console.warn, n = console.log, a = (s, l) => {
191
+ const kt = 20;
192
+ function Ct(e) {
193
+ const t = [], i = console.error, o = console.warn, n = console.log, a = (r, l) => {
198
194
  const d = {
199
- message: l.map((r) => String(r)).join(" "),
195
+ message: l.map((s) => String(s)).join(" "),
200
196
  timestamp: Date.now(),
201
- level: s
197
+ level: r
202
198
  };
203
- t.length >= Tt && t.shift(), t.push(d), e && e(d);
199
+ t.length >= kt && t.shift(), t.push(d), e && e(d);
204
200
  };
205
- return console.error = function(...s) {
206
- a("error", s), o.apply(console, s);
207
- }, console.warn = function(...s) {
208
- a("warn", s), i.apply(console, s);
209
- }, console.log = function(...s) {
210
- a("log", s), n.apply(console, s);
201
+ return console.error = function(...r) {
202
+ a("error", r), i.apply(console, r);
203
+ }, console.warn = function(...r) {
204
+ a("warn", r), o.apply(console, r);
205
+ }, console.log = function(...r) {
206
+ a("log", r), n.apply(console, r);
211
207
  }, {
212
208
  errors: t,
213
209
  restore: () => {
214
- console.error = o, console.warn = i, console.log = n;
210
+ console.error = i, console.warn = o, console.log = n;
215
211
  }
216
212
  };
217
213
  }
218
- const Lt = 20, O = 4096;
219
- function k(e) {
214
+ const St = 20, B = 4096;
215
+ function q(e) {
220
216
  if (e == null) return;
221
217
  const t = typeof e == "string" ? e : JSON.stringify(e);
222
- return t.length > O ? t.slice(0, O) + "…[truncated]" : t;
218
+ return t.length > B ? t.slice(0, B) + "…[truncated]" : t;
223
219
  }
224
220
  function P(e, t) {
225
- e.length >= Lt && e.shift(), e.push(t);
221
+ e.length >= St && e.shift(), e.push(t);
226
222
  }
227
- async function Ht(e) {
223
+ async function Et(e) {
228
224
  try {
229
225
  const t = await e.clone().text();
230
- return k(t);
226
+ return q(t);
231
227
  } catch {
232
228
  return;
233
229
  }
234
230
  }
235
- function Rt() {
231
+ function Tt() {
236
232
  const e = [], t = window.fetch;
237
233
  window.fetch = async function(n, a) {
238
- const s = typeof n == "string" ? n : n instanceof URL ? n.toString() : n.url, l = (a == null ? void 0 : a.method) ?? (typeof n == "object" && "method" in n ? n.method : "GET");
234
+ const r = typeof n == "string" ? n : n instanceof URL ? n.toString() : n.url, l = a?.method ?? (typeof n == "object" && "method" in n ? n.method : "GET");
239
235
  let d;
240
- a != null && a.body && (d = k(a.body));
241
- const r = await t.apply(window, [n, a]);
242
- if (r.status >= 400) {
243
- const c = await Ht(r);
236
+ a?.body && (d = q(a.body));
237
+ const s = await t.apply(window, [n, a]);
238
+ if (s.status >= 400) {
239
+ const c = await Et(s);
244
240
  P(e, {
245
- url: s,
241
+ url: r,
246
242
  method: l.toUpperCase(),
247
- status: r.status,
248
- statusText: r.statusText,
243
+ status: s.status,
244
+ statusText: s.statusText,
249
245
  requestBody: d,
250
246
  responseBody: c,
251
247
  timestamp: Date.now()
252
248
  });
253
249
  }
254
- return r;
250
+ return s;
255
251
  };
256
- const o = XMLHttpRequest.prototype.open, i = XMLHttpRequest.prototype.send;
257
- return XMLHttpRequest.prototype.open = function(n, a, ...s) {
258
- return this._qaid_method = n, this._qaid_url = typeof a == "string" ? a : a.toString(), o.apply(this, [n, a, ...s]);
252
+ const i = XMLHttpRequest.prototype.open, o = XMLHttpRequest.prototype.send;
253
+ return XMLHttpRequest.prototype.open = function(n, a, ...r) {
254
+ return this._qaid_method = n, this._qaid_url = typeof a == "string" ? a : a.toString(), i.apply(this, [n, a, ...r]);
259
255
  }, XMLHttpRequest.prototype.send = function(n) {
260
- const a = this, s = n ? k(n) : void 0;
256
+ const a = this, r = n ? q(n) : void 0;
261
257
  return a.addEventListener("load", function() {
262
258
  a.status >= 400 && P(e, {
263
259
  url: a._qaid_url,
264
260
  method: a._qaid_method.toUpperCase(),
265
261
  status: a.status,
266
262
  statusText: a.statusText,
267
- requestBody: s,
268
- responseBody: k(a.responseText),
263
+ requestBody: r,
264
+ responseBody: q(a.responseText),
269
265
  timestamp: Date.now()
270
266
  });
271
- }), i.apply(this, [n]);
267
+ }), o.apply(this, [n]);
272
268
  }, {
273
269
  errors: e,
274
270
  restore: () => {
275
- window.fetch = t, XMLHttpRequest.prototype.open = o, XMLHttpRequest.prototype.send = i;
271
+ window.fetch = t, XMLHttpRequest.prototype.open = i, XMLHttpRequest.prototype.send = o;
276
272
  }
277
273
  };
278
274
  }
279
- function Dt() {
275
+ function It() {
280
276
  return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function" && typeof MediaRecorder < "u";
281
277
  }
282
- function Mt() {
278
+ function Lt() {
283
279
  if (typeof MediaRecorder > "u") return "";
284
280
  const e = [
285
281
  "video/webm;codecs=vp9",
@@ -292,22 +288,22 @@ function Mt() {
292
288
  return t;
293
289
  return "";
294
290
  }
295
- function zt(e = {}) {
296
- const t = e.maxDuration ?? 15, o = e.videoBitsPerSecond ?? 8e5;
297
- let i = null, n = null, a = [], s = null, l = null, d = null, r = 0, c = null, u = null, p = !1, f = null;
291
+ function Rt(e = {}) {
292
+ const t = e.maxDuration ?? 15, i = e.videoBitsPerSecond ?? 8e5;
293
+ let o = null, n = null, a = [], r = null, l = null, d = null, s = 0, c = null, h = null, u = !1, p = null;
298
294
  function b() {
299
- d !== null && (clearInterval(d), d = null), f !== null && (clearTimeout(f), f = null), i && (i.getTracks().forEach((m) => m.stop()), i = null), n = null, a = [], s = null, l = null, c = null, u = null;
295
+ d !== null && (clearInterval(d), d = null), p !== null && (clearTimeout(p), p = null), o && (o.getTracks().forEach((m) => m.stop()), o = null), n = null, a = [], r = null, l = null, c = null, h = null;
300
296
  }
301
- function g() {
302
- p || (p = !0, n && n.state !== "inactive" && n.stop());
297
+ function f() {
298
+ u || (u = !0, n && n.state !== "inactive" && n.stop());
303
299
  }
304
300
  return {
305
301
  async start() {
306
- p = !1, a = [];
307
- const m = Mt();
302
+ u = !1, a = [];
303
+ const m = Lt();
308
304
  if (!m)
309
305
  throw new Error("No supported video MIME type found");
310
- i = await navigator.mediaDevices.getDisplayMedia({
306
+ o = await navigator.mediaDevices.getDisplayMedia({
311
307
  video: {
312
308
  frameRate: 15
313
309
  },
@@ -315,132 +311,126 @@ function zt(e = {}) {
315
311
  // @ts-expect-error preferCurrentTab is not in the TS types yet
316
312
  preferCurrentTab: !0
317
313
  });
318
- const v = i.getVideoTracks()[0];
314
+ const v = o.getVideoTracks()[0];
319
315
  v && v.addEventListener("ended", () => {
320
- g();
321
- }), n = new MediaRecorder(i, {
316
+ f();
317
+ }), n = new MediaRecorder(o, {
322
318
  mimeType: m,
323
- videoBitsPerSecond: o
324
- }), n.ondataavailable = (y) => {
325
- y.data.size > 0 && a.push(y.data);
319
+ videoBitsPerSecond: i
320
+ }), n.ondataavailable = (g) => {
321
+ g.data.size > 0 && a.push(g.data);
326
322
  }, n.onstop = () => {
327
- const y = new Blob(a, { type: m });
328
- c && c(y), l && l(y), i && i.getTracks().forEach((x) => x.stop());
323
+ const g = new Blob(a, { type: m });
324
+ c && c(g), l && l(g), o && o.getTracks().forEach((x) => x.stop());
329
325
  }, n.onerror = () => {
330
- u && u(new Error("MediaRecorder error"));
331
- }, n.start(1e3), r = Date.now(), d = setInterval(() => {
332
- const y = Math.floor((Date.now() - r) / 1e3);
333
- s && s(y);
334
- }, 1e3), f = setTimeout(() => {
335
- g();
326
+ h && h(new Error("MediaRecorder error"));
327
+ }, n.start(1e3), s = Date.now(), d = setInterval(() => {
328
+ const g = Math.floor((Date.now() - s) / 1e3);
329
+ r && r(g);
330
+ }, 1e3), p = setTimeout(() => {
331
+ f();
336
332
  }, t * 1e3);
337
333
  },
338
334
  stop() {
339
335
  return new Promise((m, v) => {
340
- c = m, u = v, g();
336
+ c = m, h = v, f();
341
337
  });
342
338
  },
343
339
  onTick(m) {
344
- s = m;
340
+ r = m;
345
341
  },
346
342
  onStop(m) {
347
343
  l = m;
348
344
  },
349
345
  destroy() {
350
- g(), b();
346
+ f(), b();
351
347
  }
352
348
  };
353
349
  }
354
- function Bt(e = 640) {
350
+ function Mt(e = 640) {
355
351
  return typeof window < "u" && window.innerWidth < e;
356
352
  }
357
- function $(e, t, o) {
358
- const i = o.map((a) => a.style.visibility);
359
- o.forEach((a) => a.style.visibility = "hidden");
353
+ function A(e, t, i) {
354
+ const o = i.map((a) => a.style.visibility);
355
+ i.forEach((a) => a.style.visibility = "hidden");
360
356
  const n = document.elementFromPoint(e, t);
361
- return o.forEach((a, s) => a.style.visibility = i[s]), n;
357
+ return i.forEach((a, r) => a.style.visibility = o[r]), n;
362
358
  }
363
- function N(e) {
359
+ function O(e) {
364
360
  return e ? e.hasAttribute("data-qaid-embed") || e.hasAttribute("data-qaid-embed-overlay") ? !0 : !!e.closest("[data-qaid-embed], [data-qaid-embed-overlay]") : !1;
365
361
  }
366
- function At(e, t = 0) {
367
- const o = e.getBoundingClientRect();
362
+ function Dt(e, t = 0) {
363
+ const i = e.getBoundingClientRect();
368
364
  return {
369
- x: o.left - t,
370
- y: o.top - t,
371
- width: o.width + t * 2,
372
- height: o.height + t * 2
365
+ x: i.left - t,
366
+ y: i.top - t,
367
+ width: i.width + t * 2,
368
+ height: i.height + t * 2
373
369
  };
374
370
  }
375
- function L(e) {
376
- document.querySelectorAll(`.${e}`).forEach((t) => {
377
- t.classList.remove(e);
378
- });
379
- }
380
- async function Ot(e = {}) {
381
- var n;
382
- const { quality: t = 1, maxWidth: o = 1280, maxHeight: i = 800 } = e;
371
+ async function Ht(e = {}) {
372
+ const { quality: t = 1, maxWidth: i = 1280, maxHeight: o = 800 } = e;
383
373
  try {
384
- if (!((n = navigator.mediaDevices) != null && n.getDisplayMedia))
374
+ if (!navigator.mediaDevices?.getDisplayMedia)
385
375
  return console.warn("Screen Capture API not available"), null;
386
- const a = await navigator.mediaDevices.getDisplayMedia({
376
+ const n = await navigator.mediaDevices.getDisplayMedia({
387
377
  preferCurrentTab: !0,
388
378
  video: {
389
379
  displaySurface: "browser"
390
380
  }
391
- }), s = a.getVideoTracks()[0], l = s.getSettings(), d = document.createElement("video");
392
- d.srcObject = a, d.muted = !0, await new Promise((m) => {
393
- d.onloadedmetadata = () => {
394
- d.play(), m();
381
+ }), a = n.getVideoTracks()[0], r = a.getSettings(), l = document.createElement("video");
382
+ l.srcObject = n, l.muted = !0, await new Promise((f) => {
383
+ l.onloadedmetadata = () => {
384
+ l.play(), f();
395
385
  };
396
- }), await new Promise((m) => {
397
- const v = () => {
398
- d.readyState >= 2 ? m() : requestAnimationFrame(v);
386
+ }), await new Promise((f) => {
387
+ const m = () => {
388
+ l.readyState >= 2 ? f() : requestAnimationFrame(m);
399
389
  };
400
- v();
401
- }), await new Promise((m) => setTimeout(m, 100));
402
- const r = l.width || d.videoWidth, c = l.height || d.videoHeight, u = Math.min(o / r, i / c, 1), p = Math.round(r * u), f = Math.round(c * u), b = document.createElement("canvas");
403
- b.width = p, b.height = f;
404
- const g = b.getContext("2d");
405
- return g ? (g.drawImage(d, 0, 0, p, f), s.stop(), b.toDataURL("image/webp", t)) : (s.stop(), null);
406
- } catch (a) {
407
- return console.warn("Screenshot capture failed:", a), null;
390
+ m();
391
+ }), await new Promise((f) => setTimeout(f, 100));
392
+ const d = r.width || l.videoWidth, s = r.height || l.videoHeight, c = Math.min(i / d, o / s, 1), h = Math.round(d * c), u = Math.round(s * c), p = document.createElement("canvas");
393
+ p.width = h, p.height = u;
394
+ const b = p.getContext("2d");
395
+ return b ? (b.drawImage(l, 0, 0, h, u), a.stop(), p.toDataURL("image/webp", t)) : (a.stop(), null);
396
+ } catch (n) {
397
+ return console.warn("Screenshot capture failed:", n), null;
408
398
  }
409
399
  }
410
- const V = "https://qaid.dev/lib/html2canvas.min.js", Pt = 1e4, $t = 50;
411
- let w = null;
412
- function jt() {
400
+ const $ = "https://qaid.dev/lib/html2canvas.min.js", zt = 1e4, Bt = 50;
401
+ let y = null;
402
+ function Ut() {
413
403
  if (typeof document > "u" || typeof window > "u")
414
404
  return !1;
415
405
  const e = document.createElement("canvas");
416
406
  return typeof e.getContext == "function" && !!e.getContext("2d");
417
407
  }
418
- function Nt() {
419
- return window.html2canvas ? Promise.resolve(!0) : w || (w = new Promise((e) => {
408
+ function Pt() {
409
+ return window.html2canvas ? Promise.resolve(!0) : y || (y = new Promise((e) => {
420
410
  if (!document.querySelector(
421
- `script[src="${V}"]`
411
+ `script[src="${$}"]`
422
412
  )) {
423
413
  const n = document.createElement("script");
424
- n.src = V, n.async = !0, document.head.appendChild(n);
414
+ n.src = $, n.async = !0, document.head.appendChild(n);
425
415
  }
426
- const o = Date.now(), i = () => {
416
+ const i = Date.now(), o = () => {
427
417
  if (window.html2canvas) {
428
418
  e(!0);
429
419
  return;
430
420
  }
431
- if (Date.now() - o > Pt) {
432
- w = null, e(!1);
421
+ if (Date.now() - i > zt) {
422
+ y = null, e(!1);
433
423
  return;
434
424
  }
435
- setTimeout(i, $t);
425
+ setTimeout(o, Bt);
436
426
  };
437
- i();
438
- }), w);
427
+ o();
428
+ }), y);
439
429
  }
440
- async function Vt(e = {}) {
441
- const { quality: t = 0.8, maxWidth: o = 1280, maxHeight: i = 800 } = e;
430
+ async function At(e = {}) {
431
+ const { quality: t = 0.8, maxWidth: i = 1280, maxHeight: o = 800 } = e;
442
432
  try {
443
- if (!await Nt() || !window.html2canvas)
433
+ if (!await Pt() || !window.html2canvas)
444
434
  return console.warn("html2canvas failed to load"), null;
445
435
  const a = await window.html2canvas(document.body, {
446
436
  useCORS: !0,
@@ -452,91 +442,86 @@ async function Vt(e = {}) {
452
442
  height: document.documentElement.clientHeight,
453
443
  x: window.scrollX,
454
444
  y: window.scrollY,
455
- ignoreElements: (r) => {
456
- var c, u, p;
457
- return r instanceof HTMLElement ? r.classList.contains("qaid-buttons") || r.classList.contains("qaid-targeting-overlay") || r.classList.contains("qaid-modal-container") || r.classList.contains("qaid-bottom-sheet") || r.classList.contains("qaid-backdrop") || r.classList.contains("qaid-selected-marker") || r.classList.contains("qaid-tooltip-text") || r.classList.contains("qaid-recording-indicator") || r.classList.contains("qaid-video-preview") || ((p = (c = r.className) == null ? void 0 : (u = c.toString()).startsWith) == null ? void 0 : p.call(u, "qaid-")) : !1;
458
- }
459
- }), s = a.width, l = a.height, d = Math.min(o / s, i / l, 1);
445
+ ignoreElements: (s) => s instanceof HTMLElement ? s.classList.contains("qaid-buttons") || s.classList.contains("qaid-targeting-overlay") || s.classList.contains("qaid-modal-container") || s.classList.contains("qaid-bottom-sheet") || s.classList.contains("qaid-backdrop") || s.classList.contains("qaid-selected-marker") || s.classList.contains("qaid-tooltip-text") || s.classList.contains("qaid-recording-indicator") || s.classList.contains("qaid-video-preview") || s.className?.toString().startsWith?.("qaid-") : !1
446
+ }), r = a.width, l = a.height, d = Math.min(i / r, o / l, 1);
460
447
  if (d < 1) {
461
- const r = Math.round(s * d), c = Math.round(l * d), u = document.createElement("canvas");
462
- u.width = r, u.height = c;
463
- const p = u.getContext("2d");
464
- return p ? (p.drawImage(a, 0, 0, r, c), u.toDataURL("image/webp", t)) : null;
448
+ const s = Math.round(r * d), c = Math.round(l * d), h = document.createElement("canvas");
449
+ h.width = s, h.height = c;
450
+ const u = h.getContext("2d");
451
+ return u ? (u.drawImage(a, 0, 0, s, c), h.toDataURL("image/webp", t)) : null;
465
452
  }
466
453
  return a.toDataURL("image/webp", t);
467
454
  } catch (n) {
468
455
  return console.warn("DOM screenshot capture failed:", n), null;
469
456
  }
470
457
  }
471
- const U = "qaid_visitor_id";
472
- function Ut() {
458
+ const N = "qaid_visitor_id";
459
+ function Ot() {
473
460
  try {
474
- let e = localStorage.getItem(U);
475
- return e || (e = crypto.randomUUID(), localStorage.setItem(U, e)), e;
461
+ let e = localStorage.getItem(N);
462
+ return e || (e = crypto.randomUUID(), localStorage.setItem(N, e)), e;
476
463
  } catch {
477
464
  return crypto.randomUUID();
478
465
  }
479
466
  }
480
- class Ft {
467
+ class $t {
468
+ config;
469
+ state = "IDLE";
470
+ feedbackData = {
471
+ feedbackType: null,
472
+ elementSelector: null,
473
+ elementText: null,
474
+ consoleErrors: []
475
+ };
476
+ selectedBounds = {
477
+ x: 0,
478
+ y: 0,
479
+ width: 0,
480
+ height: 0,
481
+ clickX: 0,
482
+ clickY: 0,
483
+ visible: !1
484
+ };
485
+ feedbackId = null;
486
+ mousePos = { x: 0, y: 0 };
487
+ isMobile = !1;
488
+ visitorId;
489
+ // Console capture
490
+ consoleCapture = null;
491
+ // Video recording
492
+ videoRecorder = null;
493
+ networkCapture = null;
494
+ recordedBlob = null;
495
+ recordingIndicator = null;
496
+ videoPreview = null;
497
+ isRecording = !1;
498
+ isSendingVideo = !1;
499
+ // Shadow DOM
500
+ shadowHost = null;
501
+ shadowRoot = null;
502
+ // Overlay shadow DOM (always on document.body for full-page coverage)
503
+ overlayShadowHost = null;
504
+ overlayShadowRoot = null;
505
+ // DOM elements (inside shadow root)
506
+ buttonsContainer = null;
507
+ isUserProvidedContainer = !1;
508
+ overlayContainer = null;
509
+ captureLayer = null;
510
+ crosshairH = null;
511
+ crosshairV = null;
512
+ scope = null;
513
+ highlightBox = null;
514
+ marker = null;
515
+ modalContainer = null;
516
+ backdrop = null;
517
+ // Per-instance CSS variables
518
+ cssVars = {};
519
+ // Bound event handlers
520
+ boundKeyDown;
521
+ boundMouseMove;
522
+ boundClick;
523
+ boundResize;
481
524
  constructor(t) {
482
- h(this, "config");
483
- h(this, "state", "IDLE");
484
- h(this, "feedbackData", {
485
- feedbackType: null,
486
- elementSelector: null,
487
- elementText: null,
488
- consoleErrors: []
489
- });
490
- h(this, "selectedBounds", {
491
- x: 0,
492
- y: 0,
493
- width: 0,
494
- height: 0,
495
- clickX: 0,
496
- clickY: 0,
497
- visible: !1
498
- });
499
- h(this, "feedbackId", null);
500
- h(this, "mousePos", { x: 0, y: 0 });
501
- h(this, "lastHighlighted", null);
502
- h(this, "isMobile", !1);
503
- h(this, "visitorId");
504
- // Console capture
505
- h(this, "consoleCapture", null);
506
- // Video recording
507
- h(this, "videoRecorder", null);
508
- h(this, "networkCapture", null);
509
- h(this, "recordedBlob", null);
510
- h(this, "recordingIndicator", null);
511
- h(this, "videoPreview", null);
512
- h(this, "isRecording", !1);
513
- h(this, "isSendingVideo", !1);
514
- // Shadow DOM
515
- h(this, "shadowHost", null);
516
- h(this, "shadowRoot", null);
517
- // Overlay shadow DOM (always on document.body for full-page coverage)
518
- h(this, "overlayShadowHost", null);
519
- h(this, "overlayShadowRoot", null);
520
- // DOM elements (inside shadow root)
521
- h(this, "buttonsContainer", null);
522
- h(this, "isUserProvidedContainer", !1);
523
- h(this, "overlayContainer", null);
524
- h(this, "captureLayer", null);
525
- h(this, "crosshairH", null);
526
- h(this, "crosshairV", null);
527
- h(this, "scope", null);
528
- h(this, "marker", null);
529
- h(this, "modalContainer", null);
530
- h(this, "backdrop", null);
531
- // Per-instance CSS variables
532
- h(this, "cssVars", {});
533
- // Bound event handlers
534
- h(this, "boundKeyDown");
535
- h(this, "boundMouseMove");
536
- h(this, "boundClick");
537
- h(this, "boundResize");
538
- h(this, "tooltipElement", null);
539
- var o, i, n, a, s, l, d, r, c, u, p, f, b, g, m;
540
525
  this.config = {
541
526
  endpoint: t.endpoint,
542
527
  apiKey: t.apiKey ?? "",
@@ -545,24 +530,24 @@ class Ft {
545
530
  direction: t.direction ?? "horizontal",
546
531
  position: t.position ?? "bottom-right",
547
532
  offset: {
548
- x: ((o = t.offset) == null ? void 0 : o.x) ?? 16,
549
- y: ((i = t.offset) == null ? void 0 : i.y) ?? 16
533
+ x: t.offset?.x ?? 16,
534
+ y: t.offset?.y ?? 16
550
535
  },
551
536
  zIndex: t.zIndex ?? 50,
552
537
  skipTargeting: t.skipTargeting ?? !1,
553
538
  colors: {
554
- positive: ((n = t.colors) == null ? void 0 : n.positive) ?? "rgb(0, 200, 83)",
555
- negative: ((a = t.colors) == null ? void 0 : a.negative) ?? "rgb(255, 0, 0)",
556
- marker: ((s = t.colors) == null ? void 0 : s.marker) ?? "#6366f1"
539
+ positive: t.colors?.positive ?? "rgb(0, 200, 83)",
540
+ negative: t.colors?.negative ?? "rgb(255, 0, 0)",
541
+ marker: t.colors?.marker ?? "#6366f1"
557
542
  },
558
543
  buttonSize: t.buttonSize ?? "medium",
559
544
  text: {
560
- tooltip: ((l = t.text) == null ? void 0 : l.tooltip) ?? "",
561
- modalTitle: ((d = t.text) == null ? void 0 : d.modalTitle) ?? "Thank you for your feedback!",
562
- modalSubtitle: ((r = t.text) == null ? void 0 : r.modalSubtitle) ?? "Would you like to add a message to help us understand your feedback better?",
563
- placeholder: ((c = t.text) == null ? void 0 : c.placeholder) ?? "Optional: Tell us more about your experience...",
564
- submitButton: ((u = t.text) == null ? void 0 : u.submitButton) ?? "Submit",
565
- skipButton: ((p = t.text) == null ? void 0 : p.skipButton) ?? "Skip"
545
+ tooltip: t.text?.tooltip ?? "",
546
+ modalTitle: t.text?.modalTitle ?? "Thank you for your feedback!",
547
+ modalSubtitle: t.text?.modalSubtitle ?? "Would you like to add a message to help us understand your feedback better?",
548
+ placeholder: t.text?.placeholder ?? "Optional: Tell us more about your experience...",
549
+ submitButton: t.text?.submitButton ?? "Submit",
550
+ skipButton: t.text?.skipButton ?? "Skip"
566
551
  },
567
552
  modalWidth: t.modalWidth ?? 400,
568
553
  backdropOpacity: t.backdropOpacity ?? 0.3,
@@ -571,9 +556,9 @@ class Ft {
571
556
  captureScreenshot: t.captureScreenshot ?? !1,
572
557
  screenshotMethod: t.screenshotMethod ?? "permission",
573
558
  screenshotOptions: {
574
- quality: ((f = t.screenshotOptions) == null ? void 0 : f.quality) ?? 0.8,
575
- maxWidth: ((b = t.screenshotOptions) == null ? void 0 : b.maxWidth) ?? 1280,
576
- maxHeight: ((g = t.screenshotOptions) == null ? void 0 : g.maxHeight) ?? 800
559
+ quality: t.screenshotOptions?.quality ?? 0.8,
560
+ maxWidth: t.screenshotOptions?.maxWidth ?? 1280,
561
+ maxHeight: t.screenshotOptions?.maxHeight ?? 800
577
562
  },
578
563
  incognito: t.incognito ?? !1,
579
564
  positiveIcon: t.positiveIcon ?? "",
@@ -582,16 +567,16 @@ class Ft {
582
567
  css: t.css ?? "",
583
568
  captureVideo: t.captureVideo ?? !1,
584
569
  videoOptions: {
585
- maxDuration: ((m = t.videoOptions) == null ? void 0 : m.maxDuration) ?? 15
570
+ maxDuration: t.videoOptions?.maxDuration ?? 15
586
571
  },
587
572
  recordIcon: t.recordIcon ?? ""
588
- }, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundClick = this.handleClick.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = Ut(), this.init();
573
+ }, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundClick = this.handleClick.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = Ot(), this.init();
589
574
  }
590
575
  applyVars(t) {
591
- ut(t, this.cssVars);
576
+ dt(t, this.cssVars);
592
577
  }
593
578
  init() {
594
- pt(), this.cssVars = ht({
579
+ ct(), this.cssVars = rt({
595
580
  positiveColor: this.config.colors.positive,
596
581
  negativeColor: this.config.colors.negative,
597
582
  markerColor: this.config.colors.marker,
@@ -600,13 +585,12 @@ class Ft {
600
585
  backdropOpacity: this.config.backdropOpacity,
601
586
  fontFamily: this.config.fontFamily,
602
587
  fontSize: this.config.fontSize
603
- }), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture = It((t) => {
604
- var o;
605
- this.feedbackData.consoleErrors = ((o = this.consoleCapture) == null ? void 0 : o.errors) ?? [];
588
+ }), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture = Ct((t) => {
589
+ this.feedbackData.consoleErrors = this.consoleCapture?.errors ?? [];
606
590
  }), this.feedbackData.consoleErrors = this.consoleCapture.errors;
607
591
  }
608
592
  checkMobile() {
609
- this.isMobile = Bt();
593
+ this.isMobile = Mt();
610
594
  }
611
595
  handleResize() {
612
596
  this.checkMobile();
@@ -615,36 +599,36 @@ class Ft {
615
599
  this.shadowHost = document.createElement("div"), this.shadowHost.setAttribute("data-qaid-embed", ""), this.shadowHost.style.position = "static", this.shadowHost.style.display = "contents";
616
600
  let t = null;
617
601
  this.config.container && (t = document.querySelector(this.config.container)), t ? (t.appendChild(this.shadowHost), this.isUserProvidedContainer = !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" });
618
- const o = document.createElement("style");
619
- if (o.textContent = A(), this.shadowRoot.appendChild(o), this.config.css) {
620
- const r = document.createElement("style");
621
- r.textContent = this.config.css, this.shadowRoot.appendChild(r);
602
+ const i = document.createElement("style");
603
+ if (i.textContent = z(), this.shadowRoot.appendChild(i), this.config.css) {
604
+ const s = document.createElement("style");
605
+ s.textContent = this.config.css, this.shadowRoot.appendChild(s);
622
606
  }
623
- const i = this.config.direction === "vertical" ? "qaid-vertical" : "";
607
+ const o = this.config.direction === "vertical" ? "qaid-vertical" : "";
624
608
  if (this.isUserProvidedContainer)
625
- 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");
609
+ this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${o}`.trim(), this.config.incognito && this.buttonsContainer.classList.add("qaid-incognito");
626
610
  else {
627
- 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";
628
- const { x: r, y: c } = this.config.offset;
629
- 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 = `${c}px` : this.buttonsContainer.style.top = `${c}px`;
611
+ this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${o}${this.config.incognito ? " qaid-incognito" : ""}`.trim(), this.buttonsContainer.style.pointerEvents = "auto";
612
+ const { x: s, y: c } = this.config.offset;
613
+ this.config.position.includes("right") ? this.buttonsContainer.style.right = `${s}px` : this.buttonsContainer.style.left = `${s}px`, this.config.position.includes("bottom") ? this.buttonsContainer.style.bottom = `${c}px` : this.buttonsContainer.style.top = `${c}px`;
630
614
  }
631
615
  this.applyVars(this.buttonsContainer), this.shadowRoot.appendChild(this.buttonsContainer);
632
616
  const n = !!this.config.buttonClass, a = n ? `qaid-btn-structural ${this.config.buttonClass}` : "qaid-btn", l = this.config.text.tooltip || "Feedback for us?", d = document.createElement("div");
633
617
  if (d.className = "qaid-tooltip-text", d.textContent = l, this.applyVars(d), this.shadowRoot.appendChild(d), this.tooltipElement = d, !this.config.hideThumbs) {
634
- const r = document.createElement("div");
635
- r.className = "qaid-tooltip-wrapper";
618
+ const s = document.createElement("div");
619
+ s.className = "qaid-tooltip-wrapper";
636
620
  const c = document.createElement("button");
637
- c.type = "button", c.className = n ? `${a} qaid-btn-up` : "qaid-btn qaid-btn-up", c.innerHTML = this.config.positiveIcon || T, c.addEventListener("click", (f) => this.handleThumbClick("up", f.currentTarget)), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), r.appendChild(c);
638
- const u = document.createElement("div");
639
- u.className = "qaid-tooltip-wrapper";
640
- const p = document.createElement("button");
641
- p.type = "button", p.className = n ? `${a} qaid-btn-down` : "qaid-btn qaid-btn-down", p.innerHTML = this.config.negativeIcon || I, p.addEventListener("click", (f) => this.handleThumbClick("down", f.currentTarget)), p.addEventListener("mouseenter", () => this.showTooltip(p)), p.addEventListener("mouseleave", () => this.hideTooltip()), u.appendChild(p), this.buttonsContainer.appendChild(r), this.buttonsContainer.appendChild(u);
621
+ c.type = "button", c.className = n ? `${a} qaid-btn-up` : "qaid-btn qaid-btn-up", c.innerHTML = this.config.positiveIcon || E, c.addEventListener("click", (p) => this.handleThumbClick("up", p.currentTarget, p)), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), s.appendChild(c);
622
+ const h = document.createElement("div");
623
+ h.className = "qaid-tooltip-wrapper";
624
+ const u = document.createElement("button");
625
+ u.type = "button", u.className = n ? `${a} qaid-btn-down` : "qaid-btn qaid-btn-down", u.innerHTML = this.config.negativeIcon || T, u.addEventListener("click", (p) => this.handleThumbClick("down", p.currentTarget, p)), u.addEventListener("mouseenter", () => this.showTooltip(u)), u.addEventListener("mouseleave", () => this.hideTooltip()), h.appendChild(u), this.buttonsContainer.appendChild(s), this.buttonsContainer.appendChild(h);
642
626
  }
643
- if (this.config.captureVideo && Dt()) {
644
- const r = document.createElement("div");
645
- r.className = "qaid-tooltip-wrapper";
627
+ if (this.config.captureVideo && It()) {
628
+ const s = document.createElement("div");
629
+ s.className = "qaid-tooltip-wrapper";
646
630
  const c = document.createElement("button");
647
- c.type = "button", c.className = n ? `${a} qaid-btn-record` : "qaid-btn qaid-btn-record", c.innerHTML = this.config.recordIcon || it, c.addEventListener("click", () => this.startRecording()), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), r.appendChild(c), this.buttonsContainer.appendChild(r);
631
+ c.type = "button", c.className = n ? `${a} qaid-btn-record` : "qaid-btn qaid-btn-record", c.innerHTML = this.config.recordIcon || Z, c.addEventListener("click", () => this.startRecording()), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), s.appendChild(c), this.buttonsContainer.appendChild(s);
648
632
  }
649
633
  }
650
634
  /**
@@ -657,87 +641,94 @@ class Ft {
657
641
  if (this.overlayShadowRoot) return this.overlayShadowRoot;
658
642
  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" });
659
643
  const t = document.createElement("style");
660
- if (t.textContent = A(), this.overlayShadowRoot.appendChild(t), this.config.css) {
661
- const o = document.createElement("style");
662
- o.textContent = this.config.css, this.overlayShadowRoot.appendChild(o);
644
+ if (t.textContent = z(), this.overlayShadowRoot.appendChild(t), this.config.css) {
645
+ const i = document.createElement("style");
646
+ i.textContent = this.config.css, this.overlayShadowRoot.appendChild(i);
663
647
  }
664
648
  return this.overlayShadowRoot;
665
649
  }
650
+ tooltipElement = null;
666
651
  showTooltip(t) {
667
652
  if (!this.tooltipElement) return;
668
- const o = this.tooltipElement, i = 8;
669
- o.style.visibility = "hidden", o.classList.add("qaid-tooltip-visible");
670
- const n = t.getBoundingClientRect(), a = o.getBoundingClientRect(), s = window.innerWidth, l = window.innerHeight;
671
- let d, r;
672
- d = n.bottom + i, d + a.height > l - i && (d = n.top - a.height - i), r = n.left, r < i ? r = i : r + a.width > s - i && (r = s - a.width - i), d < i ? d = i : d + a.height > l - i && (d = l - a.height - i), o.style.top = `${d}px`, o.style.left = `${r}px`, o.style.visibility = "visible";
653
+ const i = this.tooltipElement, o = 8;
654
+ i.style.visibility = "hidden", i.classList.add("qaid-tooltip-visible");
655
+ const n = t.getBoundingClientRect(), a = i.getBoundingClientRect(), r = window.innerWidth, l = window.innerHeight;
656
+ let d, s;
657
+ d = n.bottom + o, d + a.height > l - o && (d = n.top - a.height - o), s = n.left, s < o ? s = o : s + a.width > r - o && (s = r - a.width - o), d < o ? d = o : d + a.height > l - o && (d = l - a.height - o), i.style.top = `${d}px`, i.style.left = `${s}px`, i.style.visibility = "visible";
673
658
  }
674
659
  hideTooltip() {
675
660
  this.tooltipElement && this.tooltipElement.classList.remove("qaid-tooltip-visible");
676
661
  }
677
- handleThumbClick(t, o) {
678
- this.config.skipTargeting ? this.submitDirectFeedback(t, o) : this.startTargeting(t);
662
+ handleThumbClick(t, i, o) {
663
+ this.config.skipTargeting ? this.submitDirectFeedback(t, i) : this.startTargeting(t, o);
679
664
  }
680
- submitDirectFeedback(t, o) {
665
+ submitDirectFeedback(t, i) {
681
666
  this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null;
682
- const i = o.getBoundingClientRect();
667
+ const o = i.getBoundingClientRect();
683
668
  this.selectedBounds = {
684
- x: i.left,
685
- y: i.top,
686
- width: i.width,
687
- height: i.height,
688
- clickX: i.left + i.width / 2,
689
- clickY: i.top + i.height / 2,
669
+ x: o.left,
670
+ y: o.top,
671
+ width: o.width,
672
+ height: o.height,
673
+ clickX: o.left + o.width / 2,
674
+ clickY: o.top + o.height / 2,
690
675
  visible: !1
691
676
  }, this.submitFeedback();
692
677
  }
693
- startTargeting(t) {
694
- this.state = "TARGETING", this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), document.body.style.setProperty("--qaid-positive", this.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.cssVars["--qaid-negative"]), this.createTargetingOverlay(), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), document.addEventListener("keydown", this.boundKeyDown);
678
+ startTargeting(t, i) {
679
+ this.state = "TARGETING", this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, this.mousePos.x = i.clientX, this.mousePos.y = i.clientY, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), document.body.style.setProperty("--qaid-positive", this.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.cssVars["--qaid-negative"]), this.createTargetingOverlay(), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("click", this.boundClick, !0);
695
680
  }
696
681
  createTargetingOverlay() {
697
682
  const t = this.ensureOverlayHost();
698
- this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer", this.captureLayer.addEventListener("mousemove", this.boundMouseMove), this.captureLayer.addEventListener("click", this.boundClick);
699
- const o = document.createElement("div");
700
- o.className = "qaid-vignette", this.crosshairH = document.createElement("div"), this.crosshairH.className = "qaid-crosshair-h", this.crosshairV = document.createElement("div"), this.crosshairV.className = "qaid-crosshair-v", this.scope = document.createElement("div"), this.scope.className = "qaid-scope", this.scope.innerHTML = `
683
+ this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer";
684
+ const i = document.createElement("div");
685
+ i.className = "qaid-vignette", this.crosshairH = document.createElement("div"), this.crosshairH.className = "qaid-crosshair-h", this.crosshairV = document.createElement("div"), this.crosshairV.className = "qaid-crosshair-v", this.scope = document.createElement("div"), this.scope.className = "qaid-scope", this.scope.innerHTML = `
701
686
  <div class="qaid-scope-ring"></div>
702
687
  <div class="qaid-scope-ring-inner"></div>
703
688
  <div class="qaid-scope-dot"></div>
704
- `, this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(o), this.overlayContainer.appendChild(this.crosshairH), this.overlayContainer.appendChild(this.crosshairV), this.overlayContainer.appendChild(this.scope), this.applyVars(this.overlayContainer), t.appendChild(this.overlayContainer);
689
+ `, this.highlightBox = document.createElement("div"), this.highlightBox.className = "qaid-highlight-box", this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(i), this.overlayContainer.appendChild(this.highlightBox), this.overlayContainer.appendChild(this.crosshairH), this.overlayContainer.appendChild(this.crosshairV), this.overlayContainer.appendChild(this.scope), this.crosshairH.style.top = `${this.mousePos.y}px`, this.crosshairV.style.left = `${this.mousePos.x}px`, this.scope.style.left = `${this.mousePos.x}px`, this.scope.style.top = `${this.mousePos.y}px`, this.applyVars(this.overlayContainer), t.appendChild(this.overlayContainer);
705
690
  }
706
691
  handleKeyDown(t) {
707
692
  t.key === "Escape" && (this.isRecording ? this.stopRecording() : this.videoPreview ? this.cancelRecordingPreview() : this.state === "TARGETING" ? this.cancelTargeting() : this.state === "MODAL_OPEN" && this.closeModal());
708
693
  }
709
694
  handleMouseMove(t) {
710
695
  if (this.mousePos.x = t.clientX, this.mousePos.y = t.clientY, this.crosshairH && (this.crosshairH.style.top = `${t.clientY}px`), this.crosshairV && (this.crosshairV.style.left = `${t.clientX}px`), this.scope && (this.scope.style.left = `${t.clientX}px`, this.scope.style.top = `${t.clientY}px`), this.captureLayer && this.shadowHost) {
711
- const o = [this.shadowHost, this.overlayShadowHost].filter(Boolean), i = $(
696
+ const i = [this.shadowHost, this.overlayShadowHost].filter(Boolean), o = A(
712
697
  t.clientX,
713
698
  t.clientY,
714
- o
699
+ i
715
700
  );
716
- i && !N(i) ? (this.lastHighlighted && this.lastHighlighted !== i && this.lastHighlighted.classList.remove("qaid-highlight"), i.classList.add("qaid-highlight"), this.lastHighlighted = i) : this.lastHighlighted && (this.lastHighlighted.classList.remove("qaid-highlight"), this.lastHighlighted = null);
701
+ if (o && !O(o)) {
702
+ if (this.highlightBox) {
703
+ const n = o.getBoundingClientRect();
704
+ this.highlightBox.style.transform = `translate(${n.left}px, ${n.top}px)`, this.highlightBox.style.width = `${n.width}px`, this.highlightBox.style.height = `${n.height}px`, this.highlightBox.style.display = "block";
705
+ }
706
+ } else
707
+ this.highlightBox && (this.highlightBox.style.display = "none");
717
708
  }
718
709
  }
719
710
  handleClick(t) {
720
- if (!this.captureLayer || !this.shadowHost) return;
721
- const o = [this.shadowHost, this.overlayShadowHost].filter(Boolean), i = $(
711
+ if (this.state !== "TARGETING" || !this.shadowHost) return;
712
+ t.preventDefault(), t.stopPropagation();
713
+ const i = [this.shadowHost, this.overlayShadowHost].filter(Boolean), o = A(
722
714
  t.clientX,
723
715
  t.clientY,
724
- o
716
+ i
725
717
  );
726
- if (!i || N(i))
718
+ if (!o || O(o))
727
719
  return;
728
- i.classList.remove("qaid-highlight");
729
- const n = At(i, 8);
720
+ const n = Dt(o, 8);
730
721
  this.selectedBounds = {
731
722
  ...n,
732
723
  clickX: t.clientX,
733
724
  clickY: t.clientY,
734
725
  visible: !0
735
726
  };
736
- const { selector: a, text: s } = qt(i);
737
- this.feedbackData.elementSelector = a, this.feedbackData.elementText = s, L("qaid-highlight"), this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "none"), this.state = "SELECTED", this.showSelectedMarker(), this.submitFeedback();
727
+ const { selector: a, text: r } = bt(o);
728
+ this.feedbackData.elementSelector = a, this.feedbackData.elementText = r, this.removeTargetingOverlay(), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), 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.state = "SELECTED", this.showSelectedMarker(), this.submitFeedback();
738
729
  }
739
730
  cancelTargeting() {
740
- L("qaid-highlight"), this.removeTargetingOverlay(), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), document.removeEventListener("keydown", this.boundKeyDown), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "none"), this.state = "IDLE", this.feedbackData.feedbackType = null, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, this.lastHighlighted = null;
731
+ this.removeTargetingOverlay(), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), 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.state = "IDLE", this.feedbackData.feedbackType = null, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1;
741
732
  }
742
733
  removeTargetingOverlay() {
743
734
  this.overlayContainer && (this.overlayContainer.remove(), this.overlayContainer = null), this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null;
@@ -753,13 +744,13 @@ class Ft {
753
744
  async submitFeedback() {
754
745
  if (!this.feedbackData.feedbackType) return;
755
746
  let t = null;
756
- this.config.captureScreenshot && (this.config.screenshotMethod === "dom" ? t = await Vt(this.config.screenshotOptions) : t = await Ot(this.config.screenshotOptions));
757
- const o = this.feedbackData.elementSelector ? {
747
+ this.config.captureScreenshot && (this.config.screenshotMethod === "dom" ? t = await At(this.config.screenshotOptions) : t = await Ht(this.config.screenshotOptions));
748
+ const i = this.feedbackData.elementSelector ? {
758
749
  x: this.selectedBounds.x,
759
750
  y: this.selectedBounds.y,
760
751
  width: this.selectedBounds.width,
761
752
  height: this.selectedBounds.height
762
- } : null, i = {
753
+ } : null, o = {
763
754
  feedbackType: this.feedbackData.feedbackType,
764
755
  pageUrl: window.location.href,
765
756
  apiKey: this.config.apiKey || void 0,
@@ -775,14 +766,14 @@ class Ft {
775
766
  screenshot: t,
776
767
  visitorId: this.visitorId,
777
768
  // Include element bounds and user agent for server-side screenshot fallback
778
- elementBounds: o,
769
+ elementBounds: i,
779
770
  userAgent: navigator.userAgent
780
771
  };
781
772
  try {
782
773
  const n = await fetch(this.config.endpoint, {
783
774
  method: "POST",
784
775
  headers: { "Content-Type": "application/json" },
785
- body: JSON.stringify(i)
776
+ body: JSON.stringify(o)
786
777
  });
787
778
  if (n.ok) {
788
779
  const a = await n.json();
@@ -798,16 +789,16 @@ class Ft {
798
789
  this.backdrop = document.createElement("div"), this.backdrop.className = "qaid-backdrop", this.backdrop.style.zIndex = String(this.config.zIndex + 2), this.backdrop.style.background = `rgba(0, 0, 0, ${this.config.backdropOpacity})`, this.backdrop.addEventListener("click", () => this.closeModal()), this.applyVars(this.backdrop), this.isMobile ? this.showBottomSheet() : this.showPositionedModal(), t.appendChild(this.backdrop), document.addEventListener("keydown", this.boundKeyDown);
799
790
  }
800
791
  showBottomSheet() {
801
- const t = this.ensureOverlayHost(), o = document.createElement("div");
802
- o.className = "qaid-bottom-sheet", o.style.zIndex = String(this.config.zIndex + 3), o.innerHTML = `
792
+ const t = this.ensureOverlayHost(), i = document.createElement("div");
793
+ i.className = "qaid-bottom-sheet", i.style.zIndex = String(this.config.zIndex + 3), i.innerHTML = `
803
794
  <div class="qaid-bottom-sheet-content">
804
795
  <div class="qaid-bottom-sheet-handle"></div>
805
796
  ${this.getModalContent()}
806
797
  </div>
807
- `, this.applyVars(o), t.appendChild(o), this.modalContainer = o, this.setupModalInteractions();
798
+ `, this.applyVars(i), t.appendChild(i), this.modalContainer = i, this.setupModalInteractions();
808
799
  }
809
800
  showPositionedModal() {
810
- const t = this.ensureOverlayHost(), { modal: o, arrow: i } = Et(
801
+ const t = this.ensureOverlayHost(), { modal: i, arrow: o } = qt(
811
802
  this.selectedBounds,
812
803
  window.innerWidth,
813
804
  window.innerHeight,
@@ -819,18 +810,18 @@ class Ft {
819
810
  viewportPadding: 16
820
811
  }
821
812
  );
822
- this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${o.position}`, this.modalContainer.style.top = `${o.top}px`, this.modalContainer.style.left = `${o.left}px`, this.modalContainer.style.zIndex = String(this.config.zIndex + 3);
813
+ this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${i.position}`, this.modalContainer.style.top = `${i.top}px`, this.modalContainer.style.left = `${i.left}px`, this.modalContainer.style.zIndex = String(this.config.zIndex + 3);
823
814
  const n = document.createElement("div");
824
- n.className = "qaid-modal-arrow", n.style.left = `${i.left}px`;
815
+ n.className = "qaid-modal-arrow", n.style.left = `${o.left}px`;
825
816
  const a = document.createElement("div");
826
817
  a.className = "qaid-modal-box", a.innerHTML = this.getModalContent(), this.modalContainer.appendChild(n), this.modalContainer.appendChild(a), this.applyVars(this.modalContainer), t.appendChild(this.modalContainer), this.setupModalInteractions();
827
818
  }
828
819
  getModalContent() {
829
- const t = this.feedbackData.feedbackType === "up", o = this.config.positiveIcon || T, i = this.config.negativeIcon || I;
820
+ const t = this.feedbackData.feedbackType === "up", i = this.config.positiveIcon || E, o = this.config.negativeIcon || T;
830
821
  return `
831
822
  <div class="qaid-modal-header">
832
823
  <button type="button" class="${this.config.buttonClass ? `qaid-type-toggle qaid-type-toggle-custom ${this.config.buttonClass} ${t ? "qaid-btn-up" : "qaid-btn-down"}` : `qaid-type-toggle ${t ? "qaid-type-up" : "qaid-type-down"}`}" title="Click to switch">
833
- ${t ? o : i}
824
+ ${t ? i : o}
834
825
  </button>
835
826
  <div class="qaid-modal-header-text">
836
827
  <h3 class="qaid-modal-title">${this.config.text.modalTitle}</h3>
@@ -845,19 +836,19 @@ class Ft {
845
836
  }
846
837
  setupModalInteractions() {
847
838
  if (!this.modalContainer) return;
848
- const t = this.modalContainer.querySelector(".qaid-textarea"), o = this.modalContainer.querySelector(".qaid-btn-submit");
839
+ const t = this.modalContainer.querySelector(".qaid-textarea"), i = this.modalContainer.querySelector(".qaid-btn-submit");
849
840
  t && (setTimeout(() => t.focus(), 100), t.addEventListener("input", () => {
850
- o && (o.textContent = t.value.trim() ? this.config.text.submitButton : this.config.text.skipButton);
851
- })), o && o.addEventListener("click", () => {
852
- const n = (t == null ? void 0 : t.value.trim()) || null;
841
+ i && (i.textContent = t.value.trim() ? this.config.text.submitButton : this.config.text.skipButton);
842
+ })), i && i.addEventListener("click", () => {
843
+ const n = t?.value.trim() || null;
853
844
  this.submitMessage(n);
854
845
  });
855
- const i = this.modalContainer.querySelector(".qaid-type-toggle");
856
- i && i.addEventListener("click", () => {
846
+ const o = this.modalContainer.querySelector(".qaid-type-toggle");
847
+ o && o.addEventListener("click", () => {
857
848
  const n = this.feedbackData.feedbackType === "up" ? "down" : "up";
858
- this.feedbackData.feedbackType = n, this.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"));
859
- const a = this.config.positiveIcon || T, s = this.config.negativeIcon || I;
860
- i.innerHTML = n === "up" ? a : s, this.feedbackId && fetch(`${this.config.endpoint}/${this.feedbackId}`, {
849
+ this.feedbackData.feedbackType = n, this.config.buttonClass ? (o.classList.toggle("qaid-btn-up", n === "up"), o.classList.toggle("qaid-btn-down", n === "down")) : (o.classList.toggle("qaid-type-up", n === "up"), o.classList.toggle("qaid-type-down", n === "down"));
850
+ const a = this.config.positiveIcon || E, r = this.config.negativeIcon || T;
851
+ o.innerHTML = n === "up" ? a : r, this.feedbackId && fetch(`${this.config.endpoint}/${this.feedbackId}`, {
861
852
  method: "PATCH",
862
853
  headers: { "Content-Type": "application/json" },
863
854
  body: JSON.stringify({ feedbackType: n })
@@ -872,8 +863,8 @@ class Ft {
872
863
  headers: { "Content-Type": "application/json" },
873
864
  body: JSON.stringify({ message: t })
874
865
  });
875
- } catch (o) {
876
- console.error("Failed to submit feedback message:", o);
866
+ } catch (i) {
867
+ console.error("Failed to submit feedback message:", i);
877
868
  }
878
869
  this.feedbackId = null;
879
870
  }
@@ -890,7 +881,7 @@ class Ft {
890
881
  async startRecording() {
891
882
  if (!(this.isRecording || this.state !== "IDLE"))
892
883
  try {
893
- this.networkCapture = Rt(), this.videoRecorder = zt({
884
+ this.networkCapture = Tt(), this.videoRecorder = Rt({
894
885
  maxDuration: this.config.videoOptions.maxDuration
895
886
  }), this.videoRecorder.onTick((t) => {
896
887
  this.updateRecordingTimer(t);
@@ -914,53 +905,53 @@ class Ft {
914
905
  showRecordingIndicator() {
915
906
  const t = this.ensureOverlayHost();
916
907
  this.recordingIndicator = document.createElement("div"), this.recordingIndicator.className = "qaid-recording-indicator", this.recordingIndicator.style.zIndex = String(this.config.zIndex + 100);
917
- const o = document.createElement("div");
918
- o.className = "qaid-recording-dot";
919
- const i = document.createElement("span");
920
- i.className = "qaid-recording-time", i.textContent = this.formatTime(this.config.videoOptions.maxDuration);
908
+ const i = document.createElement("div");
909
+ i.className = "qaid-recording-dot";
910
+ const o = document.createElement("span");
911
+ o.className = "qaid-recording-time", o.textContent = this.formatTime(this.config.videoOptions.maxDuration);
921
912
  const n = document.createElement("button");
922
- n.type = "button", n.className = "qaid-recording-stop", n.textContent = "Stop", n.addEventListener("click", () => this.stopRecording()), this.recordingIndicator.appendChild(o), this.recordingIndicator.appendChild(i), this.recordingIndicator.appendChild(n), this.applyVars(this.recordingIndicator), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.recordingIndicator);
913
+ n.type = "button", n.className = "qaid-recording-stop", n.textContent = "Stop", n.addEventListener("click", () => this.stopRecording()), this.recordingIndicator.appendChild(i), this.recordingIndicator.appendChild(o), this.recordingIndicator.appendChild(n), this.applyVars(this.recordingIndicator), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.recordingIndicator);
923
914
  }
924
915
  updateRecordingTimer(t) {
925
916
  if (!this.recordingIndicator) return;
926
- const o = this.recordingIndicator.querySelector(".qaid-recording-time");
927
- if (o) {
928
- const i = Math.max(0, this.config.videoOptions.maxDuration - t);
929
- o.textContent = this.formatTime(i);
917
+ const i = this.recordingIndicator.querySelector(".qaid-recording-time");
918
+ if (i) {
919
+ const o = Math.max(0, this.config.videoOptions.maxDuration - t);
920
+ i.textContent = this.formatTime(o);
930
921
  }
931
922
  }
932
923
  formatTime(t) {
933
- const o = Math.floor(t / 60), i = t % 60;
934
- return `${o}:${i.toString().padStart(2, "0")}`;
924
+ const i = Math.floor(t / 60), o = t % 60;
925
+ return `${i}:${o.toString().padStart(2, "0")}`;
935
926
  }
936
927
  removeRecordingIndicator() {
937
928
  this.recordingIndicator && (this.recordingIndicator.remove(), this.recordingIndicator = null);
938
929
  }
939
930
  showRecordingPreview() {
940
931
  if (!this.recordedBlob) return;
941
- const t = this.ensureOverlayHost(), o = URL.createObjectURL(this.recordedBlob);
932
+ const t = this.ensureOverlayHost(), i = URL.createObjectURL(this.recordedBlob);
942
933
  this.videoPreview = document.createElement("div"), this.videoPreview.className = "qaid-video-preview", this.videoPreview.style.zIndex = String(this.config.zIndex + 100);
943
- const i = document.createElement("div");
944
- i.className = "qaid-video-preview-box";
934
+ const o = document.createElement("div");
935
+ o.className = "qaid-video-preview-box";
945
936
  const n = document.createElement("h3");
946
937
  n.textContent = "Review your recording";
947
938
  const a = document.createElement("video");
948
- a.src = o, a.controls = !0, a.autoplay = !0, a.muted = !0;
949
- const s = document.createElement("textarea");
950
- s.placeholder = "Optional: Describe the issue you recorded...";
939
+ a.src = i, a.controls = !0, a.autoplay = !0, a.muted = !0;
940
+ const r = document.createElement("textarea");
941
+ r.placeholder = "Optional: Describe the issue you recorded...";
951
942
  const l = document.createElement("div");
952
943
  l.className = "qaid-video-preview-actions";
953
944
  const d = document.createElement("button");
954
945
  d.type = "button", d.className = "qaid-video-btn qaid-video-btn-cancel", d.textContent = "Cancel", d.addEventListener("click", () => this.cancelRecordingPreview());
955
- const r = document.createElement("button");
956
- r.type = "button", r.className = "qaid-video-btn qaid-video-btn-rerecord", r.textContent = "Re-record", r.addEventListener("click", () => {
946
+ const s = document.createElement("button");
947
+ s.type = "button", s.className = "qaid-video-btn qaid-video-btn-rerecord", s.textContent = "Re-record", s.addEventListener("click", () => {
957
948
  this.cancelRecordingPreview(), this.startRecording();
958
949
  });
959
950
  const c = document.createElement("button");
960
951
  c.type = "button", c.className = "qaid-video-btn qaid-video-btn-send", c.textContent = "Send", c.addEventListener("click", () => {
961
- const u = s.value.trim() || null;
962
- this.submitVideoFeedback(u, c);
963
- }), l.appendChild(d), l.appendChild(r), l.appendChild(c), i.appendChild(n), i.appendChild(a), i.appendChild(s), i.appendChild(l), this.videoPreview.appendChild(i), this.applyVars(this.videoPreview), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.videoPreview), document.addEventListener("keydown", this.boundKeyDown);
952
+ const h = r.value.trim() || null;
953
+ this.submitVideoFeedback(h, c);
954
+ }), l.appendChild(d), l.appendChild(s), l.appendChild(c), o.appendChild(n), o.appendChild(a), o.appendChild(r), o.appendChild(l), this.videoPreview.appendChild(o), this.applyVars(this.videoPreview), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.videoPreview), document.addEventListener("keydown", this.boundKeyDown);
964
955
  }
965
956
  cancelRecordingPreview() {
966
957
  this.removeVideoPreview(), this.cleanupRecording();
@@ -968,19 +959,19 @@ class Ft {
968
959
  removeVideoPreview() {
969
960
  if (this.videoPreview) {
970
961
  const t = this.videoPreview.querySelector("video");
971
- t != null && t.src && URL.revokeObjectURL(t.src), this.videoPreview.remove(), this.videoPreview = null;
962
+ t?.src && URL.revokeObjectURL(t.src), this.videoPreview.remove(), this.videoPreview = null;
972
963
  }
973
964
  document.removeEventListener("keydown", this.boundKeyDown);
974
965
  }
975
- async submitVideoFeedback(t, o) {
966
+ async submitVideoFeedback(t, i) {
976
967
  if (!this.recordedBlob || this.isSendingVideo) return;
977
- this.isSendingVideo = !0, o.disabled = !0, o.textContent = "Sending...";
978
- const i = new FormData();
979
- i.append("video", this.recordedBlob, `recording.${this.recordedBlob.type.includes("mp4") ? "mp4" : "webm"}`), i.append("pageUrl", window.location.href), i.append("visitorId", this.visitorId), this.config.apiKey && i.append("apiKey", this.config.apiKey), t && i.append("message", t), this.consoleCapture && i.append("consoleErrors", JSON.stringify(this.consoleCapture.errors)), this.networkCapture && i.append("networkErrors", JSON.stringify(this.networkCapture.errors));
968
+ this.isSendingVideo = !0, i.disabled = !0, i.textContent = "Sending...";
969
+ const o = new FormData();
970
+ o.append("video", this.recordedBlob, `recording.${this.recordedBlob.type.includes("mp4") ? "mp4" : "webm"}`), o.append("pageUrl", window.location.href), o.append("visitorId", this.visitorId), this.config.apiKey && o.append("apiKey", this.config.apiKey), t && o.append("message", t), this.consoleCapture && o.append("consoleErrors", JSON.stringify(this.consoleCapture.errors)), this.networkCapture && o.append("networkErrors", JSON.stringify(this.networkCapture.errors));
980
971
  try {
981
972
  const n = await fetch(`${this.config.endpoint}/video`, {
982
973
  method: "POST",
983
- body: i
974
+ body: o
984
975
  });
985
976
  n.ok || console.error("Failed to submit video feedback:", await n.text());
986
977
  } catch (n) {
@@ -993,29 +984,26 @@ class Ft {
993
984
  }
994
985
  setButtonsDisabled(t) {
995
986
  if (!this.buttonsContainer) return;
996
- this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((i) => {
997
- t ? i.classList.contains("qaid-btn-record") || (i.disabled = !0, i.style.opacity = "0.5") : (i.disabled = !1, i.style.opacity = "");
987
+ this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((o) => {
988
+ t ? o.classList.contains("qaid-btn-record") || (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "");
998
989
  });
999
990
  }
1000
991
  /**
1001
992
  * Destroy the embed and clean up all resources
1002
993
  */
1003
994
  destroy() {
1004
- this.cleanupRecording(), this.removeVideoPreview(), this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), L("qaid-highlight"), 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.overlayContainer = null, this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null, this.marker = null, this.modalContainer = null, this.backdrop = null, this.tooltipElement = null, mt();
995
+ this.cleanupRecording(), this.removeVideoPreview(), this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), 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.overlayContainer = null, this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null, this.marker = null, this.modalContainer = null, this.backdrop = null, this.tooltipElement = null, lt();
1005
996
  }
1006
997
  }
1007
998
  function _(e) {
1008
- var o;
1009
- const t = document.querySelector(e);
1010
- return ((o = t == null ? void 0 : t.textContent) == null ? void 0 : o.trim()) ?? "";
999
+ return document.querySelector(e)?.textContent?.trim() ?? "";
1011
1000
  }
1012
- function Wt() {
1013
- var o;
1001
+ function Nt() {
1014
1002
  const e = document.querySelector(
1015
1003
  'script[type="application/json"][data-feedback-config]'
1016
1004
  );
1017
1005
  if (!e) return null;
1018
- const t = (o = e.textContent) == null ? void 0 : o.trim();
1006
+ const t = e.textContent?.trim();
1019
1007
  if (!t) return null;
1020
1008
  try {
1021
1009
  const i = JSON.parse(t);
@@ -1024,73 +1012,73 @@ function Wt() {
1024
1012
  return null;
1025
1013
  }
1026
1014
  }
1027
- function _t(e) {
1015
+ function Vt(e) {
1028
1016
  const t = e.getAttribute("data-endpoint");
1029
1017
  if (!t) return null;
1030
- const o = e.getAttribute("data-position"), i = e.getAttribute("data-zindex"), n = e.getAttribute("data-positive-color"), a = e.getAttribute("data-negative-color"), s = e.getAttribute("data-marker-color"), l = e.getAttribute("data-container"), d = e.getAttribute("data-button-class"), r = e.getAttribute("data-skip-targeting"), c = e.getAttribute("data-incognito"), u = e.getAttribute("data-button-size"), p = e.getAttribute("data-offset-x"), f = e.getAttribute("data-offset-y"), b = e.getAttribute("data-modal-width"), g = e.getAttribute("data-backdrop-opacity"), m = e.getAttribute("data-font-family"), v = e.getAttribute("data-font-size"), y = e.getAttribute("data-tooltip"), x = e.getAttribute("data-modal-title"), H = e.getAttribute("data-modal-subtitle"), R = e.getAttribute("data-placeholder"), D = e.getAttribute("data-submit-button"), M = e.getAttribute("data-skip-button"), X = e.getAttribute("data-positive-icon"), j = e.getAttribute("data-negative-icon"), K = e.getAttribute("data-api-key"), Y = e.getAttribute("data-capture-screenshot"), C = e.getAttribute("data-screenshot-quality"), S = e.getAttribute("data-screenshot-max-width"), E = e.getAttribute("data-screenshot-max-height"), J = e.getAttribute("data-capture-video"), G = e.getAttribute("data-hide-thumbs"), z = e.getAttribute("data-video-max-duration"), Z = e.getAttribute("data-screenshot-method"), Q = e.getAttribute("data-direction"), B = e.getAttribute("data-css-selector");
1018
+ const i = e.getAttribute("data-position"), o = e.getAttribute("data-zindex"), n = e.getAttribute("data-positive-color"), a = e.getAttribute("data-negative-color"), r = e.getAttribute("data-marker-color"), l = e.getAttribute("data-container"), d = e.getAttribute("data-button-class"), s = e.getAttribute("data-skip-targeting"), c = e.getAttribute("data-incognito"), h = e.getAttribute("data-button-size"), u = e.getAttribute("data-offset-x"), p = e.getAttribute("data-offset-y"), b = e.getAttribute("data-modal-width"), f = e.getAttribute("data-backdrop-opacity"), m = e.getAttribute("data-font-family"), v = e.getAttribute("data-font-size"), g = e.getAttribute("data-tooltip"), x = e.getAttribute("data-modal-title"), I = e.getAttribute("data-modal-subtitle"), L = e.getAttribute("data-placeholder"), R = e.getAttribute("data-submit-button"), M = e.getAttribute("data-skip-button"), F = e.getAttribute("data-positive-icon"), W = e.getAttribute("data-negative-icon"), X = e.getAttribute("data-api-key"), j = e.getAttribute("data-capture-screenshot"), k = e.getAttribute("data-screenshot-quality"), C = e.getAttribute("data-screenshot-max-width"), S = e.getAttribute("data-screenshot-max-height"), K = e.getAttribute("data-capture-video"), Y = e.getAttribute("data-hide-thumbs"), D = e.getAttribute("data-video-max-duration"), J = e.getAttribute("data-screenshot-method"), G = e.getAttribute("data-direction"), H = e.getAttribute("data-css-selector");
1031
1019
  return {
1032
1020
  endpoint: t,
1033
- css: B ? _(B) : void 0,
1034
- apiKey: K ?? void 0,
1035
- captureScreenshot: Y === "true" ? !0 : void 0,
1036
- screenshotOptions: C || S || E ? {
1037
- quality: C ? parseFloat(C) : void 0,
1038
- maxWidth: S ? parseInt(S, 10) : void 0,
1039
- maxHeight: E ? parseInt(E, 10) : void 0
1021
+ css: H ? _(H) : void 0,
1022
+ apiKey: X ?? void 0,
1023
+ captureScreenshot: j === "true" ? !0 : void 0,
1024
+ screenshotOptions: k || C || S ? {
1025
+ quality: k ? parseFloat(k) : void 0,
1026
+ maxWidth: C ? parseInt(C, 10) : void 0,
1027
+ maxHeight: S ? parseInt(S, 10) : void 0
1040
1028
  } : void 0,
1041
1029
  container: l ?? void 0,
1042
1030
  buttonClass: d ?? void 0,
1043
- direction: Q ?? void 0,
1044
- position: o ?? void 0,
1045
- zIndex: i ? parseInt(i, 10) : void 0,
1046
- skipTargeting: r === "true" ? !0 : void 0,
1031
+ direction: G ?? void 0,
1032
+ position: i ?? void 0,
1033
+ zIndex: o ? parseInt(o, 10) : void 0,
1034
+ skipTargeting: s === "true" ? !0 : void 0,
1047
1035
  incognito: c === "true" ? !0 : void 0,
1048
- buttonSize: u ?? void 0,
1049
- offset: p || f ? {
1050
- x: p ? parseInt(p, 10) : void 0,
1051
- y: f ? parseInt(f, 10) : void 0
1036
+ buttonSize: h ?? void 0,
1037
+ offset: u || p ? {
1038
+ x: u ? parseInt(u, 10) : void 0,
1039
+ y: p ? parseInt(p, 10) : void 0
1052
1040
  } : void 0,
1053
1041
  modalWidth: b ? parseInt(b, 10) : void 0,
1054
- backdropOpacity: g ? parseFloat(g) : void 0,
1042
+ backdropOpacity: f ? parseFloat(f) : void 0,
1055
1043
  fontFamily: m ?? void 0,
1056
1044
  fontSize: v ? parseInt(v, 10) : void 0,
1057
1045
  colors: {
1058
1046
  positive: n ?? void 0,
1059
1047
  negative: a ?? void 0,
1060
- marker: s ?? void 0
1048
+ marker: r ?? void 0
1061
1049
  },
1062
- text: y || x || H || R || D || M ? {
1063
- tooltip: y ?? void 0,
1050
+ text: g || x || I || L || R || M ? {
1051
+ tooltip: g ?? void 0,
1064
1052
  modalTitle: x ?? void 0,
1065
- modalSubtitle: H ?? void 0,
1066
- placeholder: R ?? void 0,
1067
- submitButton: D ?? void 0,
1053
+ modalSubtitle: I ?? void 0,
1054
+ placeholder: L ?? void 0,
1055
+ submitButton: R ?? void 0,
1068
1056
  skipButton: M ?? void 0
1069
1057
  } : void 0,
1070
- positiveIcon: X ?? void 0,
1071
- negativeIcon: j ?? void 0,
1072
- screenshotMethod: Z ?? void 0,
1073
- captureVideo: J === "true" ? !0 : void 0,
1074
- hideThumbs: G === "true" ? !0 : void 0,
1075
- videoOptions: z ? {
1076
- maxDuration: parseInt(z, 10)
1058
+ positiveIcon: F ?? void 0,
1059
+ negativeIcon: W ?? void 0,
1060
+ screenshotMethod: J ?? void 0,
1061
+ captureVideo: K === "true" ? !0 : void 0,
1062
+ hideThumbs: Y === "true" ? !0 : void 0,
1063
+ videoOptions: D ? {
1064
+ maxDuration: parseInt(D, 10)
1077
1065
  } : void 0
1078
1066
  };
1079
1067
  }
1080
1068
  if (typeof document < "u") {
1081
1069
  const e = () => {
1082
- const t = document.currentScript, o = Wt(), i = t ? _t(t) : null, n = o ?? i;
1083
- n != null && n.endpoint && new Ft(n);
1070
+ const t = document.currentScript, i = Nt(), o = t ? Vt(t) : null, n = i ?? o;
1071
+ n?.endpoint && new $t(n);
1084
1072
  };
1085
1073
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
1086
1074
  }
1087
1075
  export {
1088
- Ft as QaidFeedback,
1089
- Vt as captureDomScreenshot,
1090
- Rt as captureNetworkErrors,
1091
- zt as createVideoRecorder,
1092
- Mt as getSupportedMimeType,
1093
- jt as isDomScreenshotSupported,
1094
- Dt as isVideoRecordingSupported
1076
+ $t as QaidFeedback,
1077
+ At as captureDomScreenshot,
1078
+ Tt as captureNetworkErrors,
1079
+ Rt as createVideoRecorder,
1080
+ Lt as getSupportedMimeType,
1081
+ Ut as isDomScreenshotSupported,
1082
+ It as isVideoRecordingSupported
1095
1083
  };
1096
1084
  //# sourceMappingURL=qaid.js.map