@qaiddev/thumbs-embed 1.12.2 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +74 -10
  2. package/dist/bootstrap.d.ts +29 -4
  3. package/dist/chunks/annotate-Dvrfeb8k.js +2 -0
  4. package/dist/chunks/annotate-Dvrfeb8k.js.map +1 -0
  5. package/dist/chunks/core-C36Mpll9.js +26 -0
  6. package/dist/chunks/core-C36Mpll9.js.map +1 -0
  7. package/dist/chunks/dom-kdwHduNo.js +2 -0
  8. package/dist/chunks/dom-kdwHduNo.js.map +1 -0
  9. package/dist/chunks/html2canvas.esm-Csbr1w14.js +6 -0
  10. package/dist/chunks/html2canvas.esm-Csbr1w14.js.map +1 -0
  11. package/dist/chunks/modal-CXZZ6LG0.js +2 -0
  12. package/dist/chunks/modal-CXZZ6LG0.js.map +1 -0
  13. package/dist/chunks/recording-D_iYhxpC.js +2 -0
  14. package/dist/chunks/recording-D_iYhxpC.js.map +1 -0
  15. package/dist/chunks/screenshot-dom-DO-0UlOz.js +2 -0
  16. package/dist/chunks/screenshot-dom-DO-0UlOz.js.map +1 -0
  17. package/dist/chunks/send-o4flR35U.js +2 -0
  18. package/dist/chunks/send-o4flR35U.js.map +1 -0
  19. package/dist/chunks/{targeting-CMUEe-7C.js → targeting-Jjo_Jyqy.js} +2 -6
  20. package/dist/chunks/{targeting-CMUEe-7C.js.map → targeting-Jjo_Jyqy.js.map} +1 -1
  21. package/dist/dom.d.ts +0 -2
  22. package/dist/embed-loader.d.ts +20 -0
  23. package/dist/embed.d.ts +4 -4
  24. package/dist/embed.js +1 -1
  25. package/dist/embed.js.map +1 -1
  26. package/dist/icons.d.ts +2 -0
  27. package/dist/index.js +6721 -1539
  28. package/dist/index.js.map +1 -1
  29. package/dist/integrity-probe.js +2 -0
  30. package/dist/loader.js +1 -1
  31. package/dist/loader.js.map +1 -1
  32. package/dist/modal.d.ts +7 -2
  33. package/dist/network-capture.d.ts +4 -0
  34. package/dist/origin-key.d.ts +7 -0
  35. package/dist/qaid.umd.cjs +17 -17
  36. package/dist/qaid.umd.cjs.map +1 -1
  37. package/dist/quest-config.d.ts +27 -2
  38. package/dist/quest-launcher.d.ts +12 -0
  39. package/dist/redact.d.ts +40 -0
  40. package/dist/screenshot-dom.d.ts +7 -5
  41. package/dist/send.d.ts +2 -2
  42. package/dist/svg-sanitize.d.ts +35 -0
  43. package/dist/trusted-types.d.ts +36 -0
  44. package/dist/types.d.ts +13 -0
  45. package/package.json +4 -2
  46. package/dist/chunks/annotate-DGyRcgPt.js +0 -2
  47. package/dist/chunks/annotate-DGyRcgPt.js.map +0 -1
  48. package/dist/chunks/core-BsR7oV99.js +0 -26
  49. package/dist/chunks/core-BsR7oV99.js.map +0 -1
  50. package/dist/chunks/dom-scpOS8nl.js +0 -2
  51. package/dist/chunks/dom-scpOS8nl.js.map +0 -1
  52. package/dist/chunks/modal-DYxcs1Gm.js +0 -2
  53. package/dist/chunks/modal-DYxcs1Gm.js.map +0 -1
  54. package/dist/chunks/recording-BUw5-5Rf.js +0 -2
  55. package/dist/chunks/recording-BUw5-5Rf.js.map +0 -1
  56. package/dist/chunks/screenshot-dom-ZYP2w2h0.js +0 -2
  57. package/dist/chunks/screenshot-dom-ZYP2w2h0.js.map +0 -1
  58. package/dist/chunks/send-C26DRoYc.js +0 -2
  59. package/dist/chunks/send-C26DRoYc.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"targeting-CMUEe-7C.js","sources":["../../src/element-selector.ts","../../src/targeting.ts"],"sourcesContent":["/**\n * Element selector generation utilities\n */\n\n/** Data attributes to look for (in priority order) */\nexport const DATA_ATTRS = [\"data-comp\", \"data-qa\", \"data-testid\", \"data-id\"];\n\nexport interface ElementInfo {\n selector: string;\n text: string;\n dataAttr: string | null;\n}\n\n/**\n * Find the first matching data attribute on an element or its ancestors\n */\nexport function findDataAttribute(\n element: Element,\n stopAt: Element = document.body\n): string | null {\n let current: Element | null = element;\n\n while (current && current !== stopAt) {\n for (const attr of DATA_ATTRS) {\n const value = current.getAttribute(attr);\n if (value) {\n return `${attr}=\"${value}\"`;\n }\n }\n current = current.parentElement;\n }\n\n return null;\n}\n\n/**\n * Get truncated text content from an element\n */\nexport function getTruncatedText(element: Element, maxLength = 100): string {\n const textContent = element.textContent?.trim().slice(0, maxLength) || \"\";\n return textContent.length === maxLength ? textContent + \"...\" : textContent;\n}\n\n/**\n * Get the nth-child index of an element among its siblings\n */\nfunction getNthChildIndex(element: Element): number {\n let index = 1;\n let sibling = element.previousElementSibling;\n while (sibling) {\n index++;\n sibling = sibling.previousElementSibling;\n }\n return index;\n}\n\n/**\n * Generate an nth-child path from body to the element\n * This is always a valid CSS selector and uniquely identifies the element\n * Exported for testing\n */\nexport function generateNthChildPath(element: Element): string {\n const path: string[] = [];\n let current: Element | null = element;\n\n while (current && current !== document.body && current !== document.documentElement) {\n const tag = current.tagName.toLowerCase();\n const index = getNthChildIndex(current);\n path.unshift(`${tag}:nth-child(${index})`);\n current = current.parentElement;\n }\n\n return path.length > 0 ? `body > ${path.join(\" > \")}` : \"body\";\n}\n\n/**\n * Escape special CSS characters in a string (for IDs with special chars)\n */\nfunction escapeCSSIdentifier(str: string): string {\n return str.replace(/([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~])/g, \"\\\\$1\");\n}\n\n/**\n * Generate a selector string for an element\n * Priority: data attribute > ID > nth-child path\n */\nexport function generateSelector(element: Element): string {\n // Try data attribute first (on element or ancestors) - most stable\n const dataAttr = findDataAttribute(element);\n if (dataAttr) {\n return `[${dataAttr}]`;\n }\n\n // Try ID (escaped for special characters)\n if (element.id) {\n return `#${escapeCSSIdentifier(element.id)}`;\n }\n\n // Fall back to nth-child path - always valid and unique\n return generateNthChildPath(element);\n}\n\n/**\n * Generate complete element info for feedback\n */\nexport function generateElementInfo(element: Element): ElementInfo {\n const text = getTruncatedText(element);\n const dataAttr = findDataAttribute(element);\n const selector = generateSelector(element);\n\n return { selector, text, dataAttr };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Keyboard element targeting */\n/* */\n/* The mouse targeting path in embed.ts resolves the target with */\n/* elementFromPoint(clientX, clientY). A keyboard-activated thumb produces a */\n/* synthetic click at (0, 0), so a keyboard-only user can never point at a */\n/* real element. This controller provides a coordinate-free alternative: */\n/* Tab / arrow keys move a highlight between candidate elements (seeded from */\n/* document.activeElement), Enter / Space selects, Escape cancels. It never */\n/* hides the cursor — it drives the *native* focus ring instead, so both */\n/* sighted keyboard users and screen readers can follow the highlight. */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Default set of \"targetable\" elements for keyboard navigation: focusable\n * controls, ARIA-role'd nodes, common semantic content, and anything already\n * carrying one of the stable data attributes we key selectors off of.\n */\nexport const TARGETABLE_SELECTOR: string = [\n \"a[href]\",\n \"button\",\n \"input:not([type=hidden])\",\n \"select\",\n \"textarea\",\n \"summary\",\n \"[tabindex]\",\n \"[role]\",\n \"img\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"p\",\n \"li\",\n \"label\",\n ...DATA_ATTRS.map((attr) => `[${attr}]`),\n].join(\",\");\n\n/** Tag names that already take keyboard focus without an added tabindex. */\nconst NATIVELY_FOCUSABLE = /^(?:A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/;\n\n/**\n * Best-effort visibility test used to keep invisible nodes out of the keyboard\n * candidate list. Deliberately layout-free (no getBoundingClientRect) so it is\n * stable in headless/test environments: it only rejects nodes that are\n * explicitly hidden via the `hidden` attribute, `aria-hidden`, or a computed\n * `display:none` / `visibility:hidden`.\n */\nexport function isElementVisible(element: Element): boolean {\n if (element.hasAttribute(\"hidden\")) return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n const view = element.ownerDocument?.defaultView;\n if (view && typeof view.getComputedStyle === \"function\") {\n const style = view.getComputedStyle(element);\n if (style.display === \"none\" || style.visibility === \"hidden\") return false;\n }\n return true;\n}\n\nexport interface CollectTargetableOptions {\n /** Where to search for candidates (default `document.body`). */\n root?: ParentNode;\n /** CSS selector for candidate elements (default {@link TARGETABLE_SELECTOR}). */\n selector?: string;\n /** Return true to drop an element (e.g. the embed's own shadow hosts). */\n isExcluded?: (element: Element) => boolean;\n /** Visibility predicate (default {@link isElementVisible}). */\n isVisible?: (element: Element) => boolean;\n}\n\n/**\n * Collect the ordered list of elements a keyboard user can target. Document\n * order matches the natural Tab order closely enough for feedback targeting.\n */\nexport function collectTargetableElements(\n options: CollectTargetableOptions = {}\n): Element[] {\n const root = options.root ?? document.body;\n const selector = options.selector ?? TARGETABLE_SELECTOR;\n const isExcluded = options.isExcluded ?? (() => false);\n const isVisible = options.isVisible ?? isElementVisible;\n\n return Array.from(root.querySelectorAll(selector)).filter(\n (element) => !isExcluded(element) && isVisible(element)\n );\n}\n\nexport interface KeyboardTargetingOptions {\n /**\n * Explicit candidate list. When omitted, candidates are collected via\n * {@link collectTargetableElements} using `root` / `selector` / `isExcluded`\n * / `isVisible`.\n */\n candidates?: Element[];\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n root?: ParentNode;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n selector?: string;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n isExcluded?: (element: Element) => boolean;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n isVisible?: (element: Element) => boolean;\n /**\n * Element to start the highlight on. Defaults to `document.activeElement`\n * when it is one of the candidates, otherwise the first candidate.\n */\n initial?: Element | null;\n /**\n * Move native focus to the highlighted element (default true). This is what\n * keeps a screen reader / focus ring on the highlight; non-focusable nodes\n * get a temporary `tabindex=\"-1\"` that is removed on {@link stop}. The cursor\n * is never hidden.\n */\n moveFocus?: boolean;\n /** Where the keydown listener is attached (default `document`). */\n eventTarget?: Document | HTMLElement;\n /** Fired whenever the highlighted candidate changes (and once on start). */\n onHighlight?: (element: Element, index: number) => void;\n /** Fired when the user commits a selection (Enter / Space). Auto-stops first. */\n onSelect: (element: Element) => void;\n /** Fired when the user cancels (Escape). Auto-stops first. */\n onCancel?: () => void;\n}\n\nexport interface KeyboardTargetingController {\n /** The (frozen) candidate list being navigated. */\n readonly candidates: readonly Element[];\n /** Index of the highlighted candidate, or -1 when there are none. */\n getIndex(): number;\n /** The highlighted candidate, or null when there are none. */\n getCurrent(): Element | null;\n /** Highlight the next candidate (wraps to the first). */\n next(): void;\n /** Highlight the previous candidate (wraps to the last). */\n prev(): void;\n /** Highlight a specific index (wraps out-of-range values). */\n moveTo(index: number): void;\n /** Commit the current candidate (fires onSelect) and stop. */\n select(): void;\n /** Cancel (fires onCancel) and stop. */\n cancel(): void;\n /**\n * Handle a keydown. Wired automatically to `eventTarget`; exposed so a host\n * can forward events from another surface (e.g. the embed's shadow root).\n */\n handleKey(event: KeyboardEvent): void;\n /** Remove the listener and restore any temporary tabindex. Idempotent. */\n stop(): void;\n}\n\n/**\n * Start a keyboard element-targeting session. The returned controller wires its\n * own capture-phase keydown listener on `eventTarget` and emits the initial\n * highlight synchronously before returning.\n */\nexport function startKeyboardTargeting(\n options: KeyboardTargetingOptions\n): KeyboardTargetingController {\n const candidates =\n options.candidates ??\n collectTargetableElements({\n root: options.root,\n selector: options.selector,\n isExcluded: options.isExcluded,\n isVisible: options.isVisible,\n });\n\n const moveFocus = options.moveFocus ?? true;\n const target: EventTarget = options.eventTarget ?? document;\n const addedTabindex = new Set<Element>();\n\n let index = -1;\n let stopped = false;\n\n // Seed the highlight from the currently focused element when it is a\n // candidate; this makes \"Tab to a control, then hit the thumb\" land on that\n // control rather than the top of the page.\n const seed =\n options.initial !== undefined\n ? options.initial\n : typeof document !== \"undefined\"\n ? document.activeElement\n : null;\n if (seed) {\n const seedIndex = candidates.indexOf(seed);\n if (seedIndex >= 0) index = seedIndex;\n }\n if (index < 0 && candidates.length > 0) index = 0;\n\n function focusCurrent(element: Element): void {\n if (!moveFocus) return;\n const focusable = element as HTMLElement;\n if (typeof focusable.focus !== \"function\") return;\n // Make non-focusable content (p, img, li, …) programmatically focusable so\n // the native focus ring and AT follow the highlight. Never hide the cursor.\n if (\n element.getAttribute(\"tabindex\") === null &&\n !NATIVELY_FOCUSABLE.test(element.tagName)\n ) {\n element.setAttribute(\"tabindex\", \"-1\");\n addedTabindex.add(element);\n }\n try {\n focusable.focus();\n } catch {\n /* focus can throw in detached/headless cases — highlight still works */\n }\n }\n\n function emitHighlight(): void {\n const element = candidates[index];\n if (!element) return;\n focusCurrent(element);\n options.onHighlight?.(element, index);\n }\n\n function moveTo(nextIndex: number): void {\n if (stopped || candidates.length === 0) return;\n const len = candidates.length;\n index = ((nextIndex % len) + len) % len; // wrap in both directions\n emitHighlight();\n }\n\n function next(): void {\n moveTo(index + 1);\n }\n\n function prev(): void {\n moveTo(index - 1);\n }\n\n function getCurrent(): Element | null {\n return candidates[index] ?? null;\n }\n\n function stop(): void {\n if (stopped) return;\n stopped = true;\n target.removeEventListener(\"keydown\", handleKey as EventListener, true);\n addedTabindex.forEach((element) => element.removeAttribute(\"tabindex\"));\n addedTabindex.clear();\n }\n\n function select(): void {\n if (stopped) return;\n const element = getCurrent();\n stop();\n if (element) options.onSelect(element);\n }\n\n function cancel(): void {\n if (stopped) return;\n stop();\n options.onCancel?.();\n }\n\n function handleKey(event: KeyboardEvent): void {\n if (stopped) return;\n switch (event.key) {\n case \"Tab\":\n event.preventDefault();\n event.stopPropagation();\n if (event.shiftKey) prev();\n else next();\n break;\n case \"ArrowDown\":\n case \"ArrowRight\":\n event.preventDefault();\n event.stopPropagation();\n next();\n break;\n case \"ArrowUp\":\n case \"ArrowLeft\":\n event.preventDefault();\n event.stopPropagation();\n prev();\n break;\n case \"Enter\":\n case \" \":\n case \"Spacebar\": // legacy key value\n event.preventDefault();\n event.stopPropagation();\n select();\n break;\n case \"Escape\":\n case \"Esc\": // legacy key value\n event.preventDefault();\n event.stopPropagation();\n cancel();\n break;\n default:\n break;\n }\n }\n\n target.addEventListener(\"keydown\", handleKey as EventListener, true);\n\n // Emit the initial highlight so the caller can position its highlight box.\n if (index >= 0) emitHighlight();\n\n return {\n candidates,\n getIndex: () => index,\n getCurrent,\n next,\n prev,\n moveTo,\n select,\n cancel,\n handleKey,\n stop,\n };\n}\n","/**\n * Element-targeting subsystem — extracted from embed.ts into its own lazily\n * loaded chunk (it also carries `element-selector`, ~14 KB). It's fetched the\n * first time the user starts targeting (and pre-warmed on thumb-button hover,\n * so the reticle appears without a perceptible wait).\n *\n * The controller owns the reticle/overlay, the mouse/touch/keyboard targeting\n * flows, and the selected-element marker; it talks back to the embed through\n * the narrow `TargetingHost` interface.\n */\n\nimport {\n generateElementInfo,\n startKeyboardTargeting,\n type KeyboardTargetingController,\n} from \"./element-selector\";\nimport {\n getElementAtPointUnderOverlay,\n isEmbedElement,\n getElementBounds,\n} from \"./dom-utils\";\nimport type {\n ResolvedFeedbackConfig,\n EmbedState,\n FeedbackData,\n FeedbackType,\n SelectedBounds,\n} from \"./types\";\nimport featureStyles from \"./styles-targeting.css?inline\";\n\n/** A touch that moves more than this (px) is a scroll, not a tap-to-select. */\nconst TOUCH_TAP_SLOP = 12;\n\n/** The slice of the embed the targeting subsystem needs. */\nexport interface TargetingHost {\n readonly config: ResolvedFeedbackConfig;\n readonly cssVars: Record<string, string>;\n readonly state: EmbedState;\n readonly shadowHost: HTMLDivElement | null;\n readonly overlayShadowHost: HTMLDivElement | null;\n readonly boundKeyDown: (e: KeyboardEvent) => void;\n /** Live references, mutated in place. */\n readonly feedbackData: FeedbackData;\n readonly selectedBounds: SelectedBounds;\n setState(state: EmbedState): void;\n ensureOverlayHost(): ShadowRoot;\n applyVars(el: HTMLElement): void;\n announceMsg(message: string, assertive?: boolean): void;\n clearActiveThumb(): void;\n submitFeedback(): Promise<void>;\n}\n\nexport class TargetingController {\n private mousePos = { x: 0, y: 0 };\n private touchStartPos: { x: number; y: number } | null = null;\n private overlayContainer: HTMLDivElement | null = null;\n private captureLayer: HTMLDivElement | null = null;\n private crosshairH: HTMLDivElement | null = null;\n private crosshairV: HTMLDivElement | null = null;\n private scope: HTMLDivElement | null = null;\n private highlightBox: HTMLDivElement | null = null;\n private marker: HTMLDivElement | null = null;\n private keyboardController: KeyboardTargetingController | null = null;\n\n private boundMouseMove = (e: MouseEvent): void => this.handleMouseMove(e);\n private boundClick = (e: MouseEvent): void => this.handleClick(e);\n private boundTouchStart = (e: TouchEvent): void => this.handleTouchStart(e);\n private boundTouchEnd = (e: TouchEvent): void => this.handleTouchEnd(e);\n\n constructor(private host: TargetingHost) {}\n\n startPointer(type: FeedbackType, e: MouseEvent): void {\n this.host.setState(\"TARGETING\");\n this.host.feedbackData.feedbackType = type;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n\n // Track initial mouse position from the click event\n this.mousePos.x = e.clientX;\n this.mousePos.y = e.clientY;\n\n // Add class to body (light DOM — for cursor override)\n document.body.classList.add(\"qaid-targeting\");\n if (type === \"up\") {\n document.body.classList.add(\"qaid-type-up\");\n } else {\n document.body.classList.remove(\"qaid-type-up\");\n }\n\n // Set targeting colors on body so .qaid-highlight rules can resolve them\n document.body.style.setProperty(\"--qaid-positive\", this.host.cssVars[\"--qaid-positive\"]);\n document.body.style.setProperty(\"--qaid-negative\", this.host.cssVars[\"--qaid-negative\"]);\n\n this.createTargetingOverlay();\n\n // Add event listeners on document — overlay is pointer-events:none so scroll works naturally\n document.addEventListener(\"keydown\", this.host.boundKeyDown);\n document.addEventListener(\"mousemove\", this.boundMouseMove);\n document.addEventListener(\"click\", this.boundClick, true);\n // Touch: tap to select (scrolling stays enabled). touchstart is passive\n // (we only read the point); touchend is non-passive so a tap can\n // preventDefault the synthesised click that would otherwise activate the\n // targeted element.\n document.addEventListener(\"touchstart\", this.boundTouchStart, { passive: true });\n document.addEventListener(\"touchend\", this.boundTouchEnd, { passive: false });\n }\n\n /**\n * Keyboard-driven targeting. Mirrors startPointer minus the mouse plumbing:\n * no `qaid-targeting` body class (keeps the cursor visible for keyboard\n * users), no mouse reticle, and no document mouse/click listeners. The\n * KeyboardTargetingController owns Tab/Arrow/Enter/Space/Escape.\n */\n startKeyboard(type: FeedbackType): void {\n this.host.setState(\"TARGETING\");\n this.host.feedbackData.feedbackType = type;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n\n document.body.style.setProperty(\"--qaid-positive\", this.host.cssVars[\"--qaid-positive\"]);\n document.body.style.setProperty(\"--qaid-negative\", this.host.cssVars[\"--qaid-negative\"]);\n\n // Build the highlight box, then hide the mouse reticle (meaningless here)\n this.createTargetingOverlay();\n if (this.crosshairH) this.crosshairH.style.display = \"none\";\n if (this.crosshairV) this.crosshairV.style.display = \"none\";\n if (this.scope) this.scope.style.display = \"none\";\n\n this.keyboardController = startKeyboardTargeting({\n isExcluded: (el) => isEmbedElement(el),\n onHighlight: (el) => {\n const rect = el.getBoundingClientRect();\n const b = this.highlightBox;\n if (b) {\n b.style.transform = `translate(${rect.left}px, ${rect.top}px)`;\n b.style.width = `${rect.width}px`;\n b.style.height = `${rect.height}px`;\n b.style.display = \"block\";\n }\n const { text } = generateElementInfo(el);\n this.host.announceMsg(`Targeting ${text || el.tagName.toLowerCase()}`);\n },\n onSelect: (el) => this.selectKeyboardTarget(el),\n onCancel: () => this.cancel(),\n });\n }\n\n private selectKeyboardTarget(el: Element): void {\n const bounds = getElementBounds(el, 8);\n Object.assign(this.host.selectedBounds, bounds, {\n clickX: bounds.x + bounds.width / 2,\n clickY: bounds.y + bounds.height / 2,\n visible: true,\n });\n\n const { selector, text } = generateElementInfo(el);\n this.host.feedbackData.elementSelector = selector;\n this.host.feedbackData.elementText = text;\n\n // Teardown (controller has already auto-stopped before onSelect fired)\n this.removeTargetingOverlay();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n this.keyboardController = null;\n this.host.clearActiveThumb();\n\n this.host.setState(\"SELECTED\");\n this.showSelectedMarker();\n void this.host.submitFeedback();\n }\n\n private createTargetingOverlay(): void {\n const root = this.host.ensureOverlayHost();\n\n this.overlayContainer = document.createElement(\"div\");\n this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.host.feedbackData.feedbackType}`;\n\n // Capture layer (pointer-events:none — scroll passes through naturally)\n this.captureLayer = document.createElement(\"div\");\n this.captureLayer.className = \"qaid-capture-layer\";\n\n // Vignette\n const vignette = document.createElement(\"div\");\n vignette.className = \"qaid-vignette\";\n\n // Crosshairs\n this.crosshairH = document.createElement(\"div\");\n this.crosshairH.className = \"qaid-crosshair-h\";\n\n this.crosshairV = document.createElement(\"div\");\n this.crosshairV.className = \"qaid-crosshair-v\";\n\n // Scope\n this.scope = document.createElement(\"div\");\n this.scope.className = \"qaid-scope\";\n this.scope.innerHTML = `\n <div class=\"qaid-scope-ring\"></div>\n <div class=\"qaid-scope-ring-inner\"></div>\n <div class=\"qaid-scope-dot\"></div>\n `;\n\n // Highlight box overlay (positioned over hovered elements)\n this.highlightBox = document.createElement(\"div\");\n this.highlightBox.className = \"qaid-highlight-box\";\n\n this.overlayContainer.appendChild(this.captureLayer);\n this.overlayContainer.appendChild(vignette);\n this.overlayContainer.appendChild(this.highlightBox);\n this.overlayContainer.appendChild(this.crosshairH);\n this.overlayContainer.appendChild(this.crosshairV);\n this.overlayContainer.appendChild(this.scope);\n\n // Position crosshairs immediately at current mouse position\n this.crosshairH.style.top = `${this.mousePos.y}px`;\n this.crosshairV.style.left = `${this.mousePos.x}px`;\n this.scope.style.left = `${this.mousePos.x}px`;\n this.scope.style.top = `${this.mousePos.y}px`;\n\n this.host.applyVars(this.overlayContainer);\n root.appendChild(this.overlayContainer);\n }\n\n private handleMouseMove(e: MouseEvent): void {\n this.updateReticleAt(e.clientX, e.clientY);\n }\n\n /** Move the crosshair/scope reticle and highlight the element under (x, y). */\n private updateReticleAt(x: number, y: number): void {\n this.mousePos.x = x;\n this.mousePos.y = y;\n\n if (this.crosshairH) this.crosshairH.style.top = `${y}px`;\n if (this.crosshairV) this.crosshairV.style.left = `${x}px`;\n if (this.scope) {\n this.scope.style.left = `${x}px`;\n this.scope.style.top = `${y}px`;\n }\n\n // Find element underneath — hide both shadow hosts\n if (this.captureLayer && this.host.shadowHost) {\n const hosts = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean) as HTMLElement[];\n const elementUnder = getElementAtPointUnderOverlay(x, y, hosts);\n\n if (elementUnder && !isEmbedElement(elementUnder)) {\n if (this.highlightBox) {\n const rect = elementUnder.getBoundingClientRect();\n this.highlightBox.style.transform = `translate(${rect.left}px, ${rect.top}px)`;\n this.highlightBox.style.width = `${rect.width}px`;\n this.highlightBox.style.height = `${rect.height}px`;\n this.highlightBox.style.display = \"block\";\n }\n } else if (this.highlightBox) {\n this.highlightBox.style.display = \"none\";\n }\n }\n }\n\n private handleClick(e: MouseEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.selectAt(e.clientX, e.clientY);\n }\n\n // ---- Touch targeting (iOS/iPadOS) ----\n private handleTouchStart(e: TouchEvent): void {\n const t = e.touches[0];\n if (!t) return;\n this.touchStartPos = { x: t.clientX, y: t.clientY };\n // Preview what's under the finger; don't preventDefault so scrolling works.\n this.updateReticleAt(t.clientX, t.clientY);\n }\n\n private handleTouchEnd(e: TouchEvent): void {\n // touches is empty on touchend; the lifted point is in changedTouches.\n const t = e.changedTouches[0];\n const start = this.touchStartPos;\n this.touchStartPos = null;\n if (!t || !start) return;\n // A drag beyond the slop threshold is a scroll, not a selection — ignore it.\n const moved = Math.hypot(t.clientX - start.x, t.clientY - start.y);\n if (moved > TOUCH_TAP_SLOP) return;\n e.preventDefault(); // suppress the tap's synthesised click\n this.selectAt(t.clientX, t.clientY);\n }\n\n /** Select the element under (x, y) and tear down targeting. */\n private selectAt(x: number, y: number): void {\n const hosts = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean) as HTMLElement[];\n const target = getElementAtPointUnderOverlay(x, y, hosts);\n\n if (!target || isEmbedElement(target)) {\n return;\n }\n\n const bounds = getElementBounds(target, 8);\n Object.assign(this.host.selectedBounds, bounds, { clickX: x, clickY: y, visible: true });\n\n const { selector, text } = generateElementInfo(target);\n this.host.feedbackData.elementSelector = selector;\n this.host.feedbackData.elementText = text;\n\n // Remove targeting overlay and document listeners\n this.stopTargetingListeners();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n\n this.host.setState(\"SELECTED\");\n this.host.clearActiveThumb();\n\n this.showSelectedMarker();\n void this.host.submitFeedback();\n }\n\n private stopTargetingListeners(): void {\n this.removeTargetingOverlay();\n this.touchStartPos = null;\n document.removeEventListener(\"mousemove\", this.boundMouseMove);\n document.removeEventListener(\"click\", this.boundClick, true);\n document.removeEventListener(\"touchstart\", this.boundTouchStart);\n document.removeEventListener(\"touchend\", this.boundTouchEnd);\n document.removeEventListener(\"keydown\", this.host.boundKeyDown);\n }\n\n cancel(): void {\n this.keyboardController?.stop();\n this.keyboardController = null;\n this.stopTargetingListeners();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n this.host.clearActiveThumb();\n\n this.host.setState(\"IDLE\");\n this.host.feedbackData.feedbackType = null;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n }\n\n private removeTargetingOverlay(): void {\n if (this.overlayContainer) {\n this.overlayContainer.remove();\n this.overlayContainer = null;\n }\n this.captureLayer = null;\n this.crosshairH = null;\n this.crosshairV = null;\n this.scope = null;\n }\n\n private showSelectedMarker(): void {\n const root = this.host.ensureOverlayHost();\n\n this.marker = document.createElement(\"div\");\n this.marker.className = \"qaid-selected-marker\";\n this.marker.style.left = `${this.host.selectedBounds.x}px`;\n this.marker.style.top = `${this.host.selectedBounds.y}px`;\n this.marker.style.width = `${this.host.selectedBounds.width}px`;\n this.marker.style.height = `${this.host.selectedBounds.height}px`;\n this.marker.style.zIndex = String(this.host.config.zIndex + 1);\n\n this.host.applyVars(this.marker);\n root.appendChild(this.marker);\n }\n\n hideMarker(): void {\n if (this.marker) {\n this.marker.remove();\n this.marker = null;\n }\n }\n\n /** Full teardown for embed.destroy(). */\n destroy(): void {\n this.keyboardController?.stop();\n this.keyboardController = null;\n this.stopTargetingListeners();\n this.hideMarker();\n }\n}\n\n/** This feature's shadow-DOM styles; the embed adds them when it loads the chunk. */\nexport const styles = featureStyles;\n"],"names":["DATA_ATTRS","findDataAttribute","element","stopAt","current","attr","value","getTruncatedText","maxLength","textContent","getNthChildIndex","index","sibling","generateNthChildPath","path","tag","escapeCSSIdentifier","str","generateSelector","dataAttr","generateElementInfo","text","TARGETABLE_SELECTOR","NATIVELY_FOCUSABLE","isElementVisible","view","style","collectTargetableElements","options","root","selector","isExcluded","isVisible","startKeyboardTargeting","candidates","moveFocus","target","addedTabindex","stopped","seed","seedIndex","focusCurrent","focusable","emitHighlight","moveTo","nextIndex","len","next","prev","getCurrent","stop","handleKey","select","cancel","event","TOUCH_TAP_SLOP","TargetingController","host","e","type","el","isEmbedElement","rect","b","bounds","getElementBounds","vignette","x","y","hosts","elementUnder","getElementAtPointUnderOverlay","t","start","styles","featureStyles"],"mappings":"qDAKO,MAAMA,EAAa,CAAC,YAAa,UAAW,cAAe,SAAS,EAWpE,SAASC,EACdC,EACAC,EAAkB,SAAS,KACZ,CACf,IAAIC,EAA0BF,EAE9B,KAAOE,GAAWA,IAAYD,GAAQ,CACpC,UAAWE,KAAQL,EAAY,CAC7B,MAAMM,EAAQF,EAAQ,aAAaC,CAAI,EACvC,GAAIC,EACF,MAAO,GAAGD,CAAI,KAAKC,CAAK,GAE5B,CACAF,EAAUA,EAAQ,aACpB,CAEA,OAAO,IACT,CAKO,SAASG,EAAiBL,EAAkBM,E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KAAK,iBAAmB,MAE1B,KAAK,aAAe,KACpB,KAAK,WAAa,KAClB,KAAK,WAAa,KAClB,KAAK,MAAQ,IACf,CAEQ,oBAA2B,CACjC,MAAMQ,EAAO,KAAK,KAAK,kBAAA,EAEvB,KAAK,OAAS,SAAS,cAAc,KAAK,EAC1C,KAAK,OAAO,UAAY,uBACxB,KAAK,OAAO,MAAM,KAAO,GAAG,KAAK,KAAK,eAAe,CAAC,KACtD,KAAK,OAAO,MAAM,IAAM,GAAG,KAAK,KAAK,eAAe,CAAC,KACrD,KAAK,OAAO,MAAM,MAAQ,GAAG,KAAK,KAAK,eAAe,KAAK,KAC3D,KAAK,OAAO,MAAM,OAAS,GAAG,KAAK,KAAK,eAAe,MAAM,KAC7D,KAAK,OAAO,MAAM,OAAS,OAAO,KAAK,KAAK,OAAO,OAAS,CAAC,EAE7D,KAAK,KAAK,UAAU,KAAK,MAAM,EAC/BA,EAAK,YAAY,KAAK,MAAM,CAC9B,CAEA,YAAmB,CACb,KAAK,SACP,KAAK,OAAO,OAAA,EACZ,KAAK,OAAS,KAElB,CAGA,SAAgB,CACd,KAAK,oBAAoB,KAAA,EACzB,KAAK,mBAAqB,KAC1B,KAAK,uBAAA,EACL,KAAK,WAAA,CACP,CACF,CAGO,MAAM6C,EAASC"}
1
+ {"version":3,"file":"targeting-Jjo_Jyqy.js","sources":["../../src/element-selector.ts","../../src/targeting.ts"],"sourcesContent":["/**\n * Element selector generation utilities\n */\n\n/** Data attributes to look for (in priority order) */\nexport const DATA_ATTRS = [\"data-comp\", \"data-qa\", \"data-testid\", \"data-id\"];\n\nexport interface ElementInfo {\n selector: string;\n text: string;\n dataAttr: string | null;\n}\n\n/**\n * Find the first matching data attribute on an element or its ancestors\n */\nexport function findDataAttribute(\n element: Element,\n stopAt: Element = document.body\n): string | null {\n let current: Element | null = element;\n\n while (current && current !== stopAt) {\n for (const attr of DATA_ATTRS) {\n const value = current.getAttribute(attr);\n if (value) {\n return `${attr}=\"${value}\"`;\n }\n }\n current = current.parentElement;\n }\n\n return null;\n}\n\n/**\n * Get truncated text content from an element\n */\nexport function getTruncatedText(element: Element, maxLength = 100): string {\n const textContent = element.textContent?.trim().slice(0, maxLength) || \"\";\n return textContent.length === maxLength ? textContent + \"...\" : textContent;\n}\n\n/**\n * Get the nth-child index of an element among its siblings\n */\nfunction getNthChildIndex(element: Element): number {\n let index = 1;\n let sibling = element.previousElementSibling;\n while (sibling) {\n index++;\n sibling = sibling.previousElementSibling;\n }\n return index;\n}\n\n/**\n * Generate an nth-child path from body to the element\n * This is always a valid CSS selector and uniquely identifies the element\n * Exported for testing\n */\nexport function generateNthChildPath(element: Element): string {\n const path: string[] = [];\n let current: Element | null = element;\n\n while (current && current !== document.body && current !== document.documentElement) {\n const tag = current.tagName.toLowerCase();\n const index = getNthChildIndex(current);\n path.unshift(`${tag}:nth-child(${index})`);\n current = current.parentElement;\n }\n\n return path.length > 0 ? `body > ${path.join(\" > \")}` : \"body\";\n}\n\n/**\n * Escape special CSS characters in a string (for IDs with special chars)\n */\nfunction escapeCSSIdentifier(str: string): string {\n return str.replace(/([!\"#$%&'()*+,./:;<=>?@[\\\\\\]^`{|}~])/g, \"\\\\$1\");\n}\n\n/**\n * Generate a selector string for an element\n * Priority: data attribute > ID > nth-child path\n */\nexport function generateSelector(element: Element): string {\n // Try data attribute first (on element or ancestors) - most stable\n const dataAttr = findDataAttribute(element);\n if (dataAttr) {\n return `[${dataAttr}]`;\n }\n\n // Try ID (escaped for special characters)\n if (element.id) {\n return `#${escapeCSSIdentifier(element.id)}`;\n }\n\n // Fall back to nth-child path - always valid and unique\n return generateNthChildPath(element);\n}\n\n/**\n * Generate complete element info for feedback\n */\nexport function generateElementInfo(element: Element): ElementInfo {\n const text = getTruncatedText(element);\n const dataAttr = findDataAttribute(element);\n const selector = generateSelector(element);\n\n return { selector, text, dataAttr };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Keyboard element targeting */\n/* */\n/* The mouse targeting path in embed.ts resolves the target with */\n/* elementFromPoint(clientX, clientY). A keyboard-activated thumb produces a */\n/* synthetic click at (0, 0), so a keyboard-only user can never point at a */\n/* real element. This controller provides a coordinate-free alternative: */\n/* Tab / arrow keys move a highlight between candidate elements (seeded from */\n/* document.activeElement), Enter / Space selects, Escape cancels. It never */\n/* hides the cursor — it drives the *native* focus ring instead, so both */\n/* sighted keyboard users and screen readers can follow the highlight. */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Default set of \"targetable\" elements for keyboard navigation: focusable\n * controls, ARIA-role'd nodes, common semantic content, and anything already\n * carrying one of the stable data attributes we key selectors off of.\n */\nexport const TARGETABLE_SELECTOR: string = [\n \"a[href]\",\n \"button\",\n \"input:not([type=hidden])\",\n \"select\",\n \"textarea\",\n \"summary\",\n \"[tabindex]\",\n \"[role]\",\n \"img\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"p\",\n \"li\",\n \"label\",\n ...DATA_ATTRS.map((attr) => `[${attr}]`),\n].join(\",\");\n\n/** Tag names that already take keyboard focus without an added tabindex. */\nconst NATIVELY_FOCUSABLE = /^(?:A|BUTTON|INPUT|SELECT|TEXTAREA|SUMMARY)$/;\n\n/**\n * Best-effort visibility test used to keep invisible nodes out of the keyboard\n * candidate list. Deliberately layout-free (no getBoundingClientRect) so it is\n * stable in headless/test environments: it only rejects nodes that are\n * explicitly hidden via the `hidden` attribute, `aria-hidden`, or a computed\n * `display:none` / `visibility:hidden`.\n */\nexport function isElementVisible(element: Element): boolean {\n if (element.hasAttribute(\"hidden\")) return false;\n if (element.getAttribute(\"aria-hidden\") === \"true\") return false;\n const view = element.ownerDocument?.defaultView;\n if (view && typeof view.getComputedStyle === \"function\") {\n const style = view.getComputedStyle(element);\n if (style.display === \"none\" || style.visibility === \"hidden\") return false;\n }\n return true;\n}\n\nexport interface CollectTargetableOptions {\n /** Where to search for candidates (default `document.body`). */\n root?: ParentNode;\n /** CSS selector for candidate elements (default {@link TARGETABLE_SELECTOR}). */\n selector?: string;\n /** Return true to drop an element (e.g. the embed's own shadow hosts). */\n isExcluded?: (element: Element) => boolean;\n /** Visibility predicate (default {@link isElementVisible}). */\n isVisible?: (element: Element) => boolean;\n}\n\n/**\n * Collect the ordered list of elements a keyboard user can target. Document\n * order matches the natural Tab order closely enough for feedback targeting.\n */\nexport function collectTargetableElements(\n options: CollectTargetableOptions = {}\n): Element[] {\n const root = options.root ?? document.body;\n const selector = options.selector ?? TARGETABLE_SELECTOR;\n const isExcluded = options.isExcluded ?? (() => false);\n const isVisible = options.isVisible ?? isElementVisible;\n\n return Array.from(root.querySelectorAll(selector)).filter(\n (element) => !isExcluded(element) && isVisible(element)\n );\n}\n\nexport interface KeyboardTargetingOptions {\n /**\n * Explicit candidate list. When omitted, candidates are collected via\n * {@link collectTargetableElements} using `root` / `selector` / `isExcluded`\n * / `isVisible`.\n */\n candidates?: Element[];\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n root?: ParentNode;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n selector?: string;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n isExcluded?: (element: Element) => boolean;\n /** Passed through to {@link collectTargetableElements} when `candidates` is omitted. */\n isVisible?: (element: Element) => boolean;\n /**\n * Element to start the highlight on. Defaults to `document.activeElement`\n * when it is one of the candidates, otherwise the first candidate.\n */\n initial?: Element | null;\n /**\n * Move native focus to the highlighted element (default true). This is what\n * keeps a screen reader / focus ring on the highlight; non-focusable nodes\n * get a temporary `tabindex=\"-1\"` that is removed on {@link stop}. The cursor\n * is never hidden.\n */\n moveFocus?: boolean;\n /** Where the keydown listener is attached (default `document`). */\n eventTarget?: Document | HTMLElement;\n /** Fired whenever the highlighted candidate changes (and once on start). */\n onHighlight?: (element: Element, index: number) => void;\n /** Fired when the user commits a selection (Enter / Space). Auto-stops first. */\n onSelect: (element: Element) => void;\n /** Fired when the user cancels (Escape). Auto-stops first. */\n onCancel?: () => void;\n}\n\nexport interface KeyboardTargetingController {\n /** The (frozen) candidate list being navigated. */\n readonly candidates: readonly Element[];\n /** Index of the highlighted candidate, or -1 when there are none. */\n getIndex(): number;\n /** The highlighted candidate, or null when there are none. */\n getCurrent(): Element | null;\n /** Highlight the next candidate (wraps to the first). */\n next(): void;\n /** Highlight the previous candidate (wraps to the last). */\n prev(): void;\n /** Highlight a specific index (wraps out-of-range values). */\n moveTo(index: number): void;\n /** Commit the current candidate (fires onSelect) and stop. */\n select(): void;\n /** Cancel (fires onCancel) and stop. */\n cancel(): void;\n /**\n * Handle a keydown. Wired automatically to `eventTarget`; exposed so a host\n * can forward events from another surface (e.g. the embed's shadow root).\n */\n handleKey(event: KeyboardEvent): void;\n /** Remove the listener and restore any temporary tabindex. Idempotent. */\n stop(): void;\n}\n\n/**\n * Start a keyboard element-targeting session. The returned controller wires its\n * own capture-phase keydown listener on `eventTarget` and emits the initial\n * highlight synchronously before returning.\n */\nexport function startKeyboardTargeting(\n options: KeyboardTargetingOptions\n): KeyboardTargetingController {\n const candidates =\n options.candidates ??\n collectTargetableElements({\n root: options.root,\n selector: options.selector,\n isExcluded: options.isExcluded,\n isVisible: options.isVisible,\n });\n\n const moveFocus = options.moveFocus ?? true;\n const target: EventTarget = options.eventTarget ?? document;\n const addedTabindex = new Set<Element>();\n\n let index = -1;\n let stopped = false;\n\n // Seed the highlight from the currently focused element when it is a\n // candidate; this makes \"Tab to a control, then hit the thumb\" land on that\n // control rather than the top of the page.\n const seed =\n options.initial !== undefined\n ? options.initial\n : typeof document !== \"undefined\"\n ? document.activeElement\n : null;\n if (seed) {\n const seedIndex = candidates.indexOf(seed);\n if (seedIndex >= 0) index = seedIndex;\n }\n if (index < 0 && candidates.length > 0) index = 0;\n\n function focusCurrent(element: Element): void {\n if (!moveFocus) return;\n const focusable = element as HTMLElement;\n if (typeof focusable.focus !== \"function\") return;\n // Make non-focusable content (p, img, li, …) programmatically focusable so\n // the native focus ring and AT follow the highlight. Never hide the cursor.\n if (\n element.getAttribute(\"tabindex\") === null &&\n !NATIVELY_FOCUSABLE.test(element.tagName)\n ) {\n element.setAttribute(\"tabindex\", \"-1\");\n addedTabindex.add(element);\n }\n try {\n focusable.focus();\n } catch {\n /* focus can throw in detached/headless cases — highlight still works */\n }\n }\n\n function emitHighlight(): void {\n const element = candidates[index];\n if (!element) return;\n focusCurrent(element);\n options.onHighlight?.(element, index);\n }\n\n function moveTo(nextIndex: number): void {\n if (stopped || candidates.length === 0) return;\n const len = candidates.length;\n index = ((nextIndex % len) + len) % len; // wrap in both directions\n emitHighlight();\n }\n\n function next(): void {\n moveTo(index + 1);\n }\n\n function prev(): void {\n moveTo(index - 1);\n }\n\n function getCurrent(): Element | null {\n return candidates[index] ?? null;\n }\n\n function stop(): void {\n if (stopped) return;\n stopped = true;\n target.removeEventListener(\"keydown\", handleKey as EventListener, true);\n addedTabindex.forEach((element) => element.removeAttribute(\"tabindex\"));\n addedTabindex.clear();\n }\n\n function select(): void {\n if (stopped) return;\n const element = getCurrent();\n stop();\n if (element) options.onSelect(element);\n }\n\n function cancel(): void {\n if (stopped) return;\n stop();\n options.onCancel?.();\n }\n\n function handleKey(event: KeyboardEvent): void {\n if (stopped) return;\n switch (event.key) {\n case \"Tab\":\n event.preventDefault();\n event.stopPropagation();\n if (event.shiftKey) prev();\n else next();\n break;\n case \"ArrowDown\":\n case \"ArrowRight\":\n event.preventDefault();\n event.stopPropagation();\n next();\n break;\n case \"ArrowUp\":\n case \"ArrowLeft\":\n event.preventDefault();\n event.stopPropagation();\n prev();\n break;\n case \"Enter\":\n case \" \":\n case \"Spacebar\": // legacy key value\n event.preventDefault();\n event.stopPropagation();\n select();\n break;\n case \"Escape\":\n case \"Esc\": // legacy key value\n event.preventDefault();\n event.stopPropagation();\n cancel();\n break;\n default:\n break;\n }\n }\n\n target.addEventListener(\"keydown\", handleKey as EventListener, true);\n\n // Emit the initial highlight so the caller can position its highlight box.\n if (index >= 0) emitHighlight();\n\n return {\n candidates,\n getIndex: () => index,\n getCurrent,\n next,\n prev,\n moveTo,\n select,\n cancel,\n handleKey,\n stop,\n };\n}\n","/**\n * Element-targeting subsystem — extracted from embed.ts into its own lazily\n * loaded chunk (it also carries `element-selector`, ~14 KB). It's fetched the\n * first time the user starts targeting (and pre-warmed on thumb-button hover,\n * so the reticle appears without a perceptible wait).\n *\n * The controller owns the reticle/overlay, the mouse/touch/keyboard targeting\n * flows, and the selected-element marker; it talks back to the embed through\n * the narrow `TargetingHost` interface.\n */\n\nimport {\n generateElementInfo,\n startKeyboardTargeting,\n type KeyboardTargetingController,\n} from \"./element-selector\";\nimport {\n getElementAtPointUnderOverlay,\n isEmbedElement,\n getElementBounds,\n} from \"./dom-utils\";\nimport type {\n ResolvedFeedbackConfig,\n EmbedState,\n FeedbackData,\n FeedbackType,\n SelectedBounds,\n} from \"./types\";\nimport featureStyles from \"./styles-targeting.css?inline\";\n\n/** A touch that moves more than this (px) is a scroll, not a tap-to-select. */\nconst TOUCH_TAP_SLOP = 12;\n\n/** The slice of the embed the targeting subsystem needs. */\nexport interface TargetingHost {\n readonly config: ResolvedFeedbackConfig;\n readonly cssVars: Record<string, string>;\n readonly state: EmbedState;\n readonly shadowHost: HTMLDivElement | null;\n readonly overlayShadowHost: HTMLDivElement | null;\n readonly boundKeyDown: (e: KeyboardEvent) => void;\n /** Live references, mutated in place. */\n readonly feedbackData: FeedbackData;\n readonly selectedBounds: SelectedBounds;\n setState(state: EmbedState): void;\n ensureOverlayHost(): ShadowRoot;\n applyVars(el: HTMLElement): void;\n announceMsg(message: string, assertive?: boolean): void;\n clearActiveThumb(): void;\n submitFeedback(): Promise<void>;\n}\n\nexport class TargetingController {\n private mousePos = { x: 0, y: 0 };\n private touchStartPos: { x: number; y: number } | null = null;\n private overlayContainer: HTMLDivElement | null = null;\n private captureLayer: HTMLDivElement | null = null;\n private crosshairH: HTMLDivElement | null = null;\n private crosshairV: HTMLDivElement | null = null;\n private scope: HTMLDivElement | null = null;\n private highlightBox: HTMLDivElement | null = null;\n private marker: HTMLDivElement | null = null;\n private keyboardController: KeyboardTargetingController | null = null;\n\n private boundMouseMove = (e: MouseEvent): void => this.handleMouseMove(e);\n private boundClick = (e: MouseEvent): void => this.handleClick(e);\n private boundTouchStart = (e: TouchEvent): void => this.handleTouchStart(e);\n private boundTouchEnd = (e: TouchEvent): void => this.handleTouchEnd(e);\n\n constructor(private host: TargetingHost) {}\n\n startPointer(type: FeedbackType, e: MouseEvent): void {\n this.host.setState(\"TARGETING\");\n this.host.feedbackData.feedbackType = type;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n\n // Track initial mouse position from the click event\n this.mousePos.x = e.clientX;\n this.mousePos.y = e.clientY;\n\n // Add class to body (light DOM — for cursor override)\n document.body.classList.add(\"qaid-targeting\");\n if (type === \"up\") {\n document.body.classList.add(\"qaid-type-up\");\n } else {\n document.body.classList.remove(\"qaid-type-up\");\n }\n\n // Set targeting colors on body so .qaid-highlight rules can resolve them\n document.body.style.setProperty(\"--qaid-positive\", this.host.cssVars[\"--qaid-positive\"]);\n document.body.style.setProperty(\"--qaid-negative\", this.host.cssVars[\"--qaid-negative\"]);\n\n this.createTargetingOverlay();\n\n // Add event listeners on document — overlay is pointer-events:none so scroll works naturally\n document.addEventListener(\"keydown\", this.host.boundKeyDown);\n document.addEventListener(\"mousemove\", this.boundMouseMove);\n document.addEventListener(\"click\", this.boundClick, true);\n // Touch: tap to select (scrolling stays enabled). touchstart is passive\n // (we only read the point); touchend is non-passive so a tap can\n // preventDefault the synthesised click that would otherwise activate the\n // targeted element.\n document.addEventListener(\"touchstart\", this.boundTouchStart, { passive: true });\n document.addEventListener(\"touchend\", this.boundTouchEnd, { passive: false });\n }\n\n /**\n * Keyboard-driven targeting. Mirrors startPointer minus the mouse plumbing:\n * no `qaid-targeting` body class (keeps the cursor visible for keyboard\n * users), no mouse reticle, and no document mouse/click listeners. The\n * KeyboardTargetingController owns Tab/Arrow/Enter/Space/Escape.\n */\n startKeyboard(type: FeedbackType): void {\n this.host.setState(\"TARGETING\");\n this.host.feedbackData.feedbackType = type;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n\n document.body.style.setProperty(\"--qaid-positive\", this.host.cssVars[\"--qaid-positive\"]);\n document.body.style.setProperty(\"--qaid-negative\", this.host.cssVars[\"--qaid-negative\"]);\n\n // Build the highlight box, then hide the mouse reticle (meaningless here)\n this.createTargetingOverlay();\n if (this.crosshairH) this.crosshairH.style.display = \"none\";\n if (this.crosshairV) this.crosshairV.style.display = \"none\";\n if (this.scope) this.scope.style.display = \"none\";\n\n this.keyboardController = startKeyboardTargeting({\n isExcluded: (el) => isEmbedElement(el),\n onHighlight: (el) => {\n const rect = el.getBoundingClientRect();\n const b = this.highlightBox;\n if (b) {\n b.style.transform = `translate(${rect.left}px, ${rect.top}px)`;\n b.style.width = `${rect.width}px`;\n b.style.height = `${rect.height}px`;\n b.style.display = \"block\";\n }\n const { text } = generateElementInfo(el);\n this.host.announceMsg(`Targeting ${text || el.tagName.toLowerCase()}`);\n },\n onSelect: (el) => this.selectKeyboardTarget(el),\n onCancel: () => this.cancel(),\n });\n }\n\n private selectKeyboardTarget(el: Element): void {\n const bounds = getElementBounds(el, 8);\n Object.assign(this.host.selectedBounds, bounds, {\n clickX: bounds.x + bounds.width / 2,\n clickY: bounds.y + bounds.height / 2,\n visible: true,\n });\n\n const { selector, text } = generateElementInfo(el);\n this.host.feedbackData.elementSelector = selector;\n this.host.feedbackData.elementText = text;\n\n // Teardown (controller has already auto-stopped before onSelect fired)\n this.removeTargetingOverlay();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n this.keyboardController = null;\n this.host.clearActiveThumb();\n\n this.host.setState(\"SELECTED\");\n this.showSelectedMarker();\n void this.host.submitFeedback();\n }\n\n private createTargetingOverlay(): void {\n const root = this.host.ensureOverlayHost();\n\n this.overlayContainer = document.createElement(\"div\");\n this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.host.feedbackData.feedbackType}`;\n\n // Capture layer (pointer-events:none — scroll passes through naturally)\n this.captureLayer = document.createElement(\"div\");\n this.captureLayer.className = \"qaid-capture-layer\";\n\n // Vignette\n const vignette = document.createElement(\"div\");\n vignette.className = \"qaid-vignette\";\n\n // Crosshairs\n this.crosshairH = document.createElement(\"div\");\n this.crosshairH.className = \"qaid-crosshair-h\";\n\n this.crosshairV = document.createElement(\"div\");\n this.crosshairV.className = \"qaid-crosshair-v\";\n\n // Scope\n this.scope = document.createElement(\"div\");\n this.scope.className = \"qaid-scope\";\n for (const part of [\"qaid-scope-ring\", \"qaid-scope-ring-inner\", \"qaid-scope-dot\"]) {\n const div = document.createElement(\"div\");\n div.className = part;\n this.scope.appendChild(div);\n }\n\n // Highlight box overlay (positioned over hovered elements)\n this.highlightBox = document.createElement(\"div\");\n this.highlightBox.className = \"qaid-highlight-box\";\n\n this.overlayContainer.appendChild(this.captureLayer);\n this.overlayContainer.appendChild(vignette);\n this.overlayContainer.appendChild(this.highlightBox);\n this.overlayContainer.appendChild(this.crosshairH);\n this.overlayContainer.appendChild(this.crosshairV);\n this.overlayContainer.appendChild(this.scope);\n\n // Position crosshairs immediately at current mouse position\n this.crosshairH.style.top = `${this.mousePos.y}px`;\n this.crosshairV.style.left = `${this.mousePos.x}px`;\n this.scope.style.left = `${this.mousePos.x}px`;\n this.scope.style.top = `${this.mousePos.y}px`;\n\n this.host.applyVars(this.overlayContainer);\n root.appendChild(this.overlayContainer);\n }\n\n private handleMouseMove(e: MouseEvent): void {\n this.updateReticleAt(e.clientX, e.clientY);\n }\n\n /** Move the crosshair/scope reticle and highlight the element under (x, y). */\n private updateReticleAt(x: number, y: number): void {\n this.mousePos.x = x;\n this.mousePos.y = y;\n\n if (this.crosshairH) this.crosshairH.style.top = `${y}px`;\n if (this.crosshairV) this.crosshairV.style.left = `${x}px`;\n if (this.scope) {\n this.scope.style.left = `${x}px`;\n this.scope.style.top = `${y}px`;\n }\n\n // Find element underneath — hide both shadow hosts\n if (this.captureLayer && this.host.shadowHost) {\n const hosts = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean) as HTMLElement[];\n const elementUnder = getElementAtPointUnderOverlay(x, y, hosts);\n\n if (elementUnder && !isEmbedElement(elementUnder)) {\n if (this.highlightBox) {\n const rect = elementUnder.getBoundingClientRect();\n this.highlightBox.style.transform = `translate(${rect.left}px, ${rect.top}px)`;\n this.highlightBox.style.width = `${rect.width}px`;\n this.highlightBox.style.height = `${rect.height}px`;\n this.highlightBox.style.display = \"block\";\n }\n } else if (this.highlightBox) {\n this.highlightBox.style.display = \"none\";\n }\n }\n }\n\n private handleClick(e: MouseEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.selectAt(e.clientX, e.clientY);\n }\n\n // ---- Touch targeting (iOS/iPadOS) ----\n private handleTouchStart(e: TouchEvent): void {\n const t = e.touches[0];\n if (!t) return;\n this.touchStartPos = { x: t.clientX, y: t.clientY };\n // Preview what's under the finger; don't preventDefault so scrolling works.\n this.updateReticleAt(t.clientX, t.clientY);\n }\n\n private handleTouchEnd(e: TouchEvent): void {\n // touches is empty on touchend; the lifted point is in changedTouches.\n const t = e.changedTouches[0];\n const start = this.touchStartPos;\n this.touchStartPos = null;\n if (!t || !start) return;\n // A drag beyond the slop threshold is a scroll, not a selection — ignore it.\n const moved = Math.hypot(t.clientX - start.x, t.clientY - start.y);\n if (moved > TOUCH_TAP_SLOP) return;\n e.preventDefault(); // suppress the tap's synthesised click\n this.selectAt(t.clientX, t.clientY);\n }\n\n /** Select the element under (x, y) and tear down targeting. */\n private selectAt(x: number, y: number): void {\n const hosts = [this.host.shadowHost, this.host.overlayShadowHost].filter(Boolean) as HTMLElement[];\n const target = getElementAtPointUnderOverlay(x, y, hosts);\n\n if (!target || isEmbedElement(target)) {\n return;\n }\n\n const bounds = getElementBounds(target, 8);\n Object.assign(this.host.selectedBounds, bounds, { clickX: x, clickY: y, visible: true });\n\n const { selector, text } = generateElementInfo(target);\n this.host.feedbackData.elementSelector = selector;\n this.host.feedbackData.elementText = text;\n\n // Remove targeting overlay and document listeners\n this.stopTargetingListeners();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n\n this.host.setState(\"SELECTED\");\n this.host.clearActiveThumb();\n\n this.showSelectedMarker();\n void this.host.submitFeedback();\n }\n\n private stopTargetingListeners(): void {\n this.removeTargetingOverlay();\n this.touchStartPos = null;\n document.removeEventListener(\"mousemove\", this.boundMouseMove);\n document.removeEventListener(\"click\", this.boundClick, true);\n document.removeEventListener(\"touchstart\", this.boundTouchStart);\n document.removeEventListener(\"touchend\", this.boundTouchEnd);\n document.removeEventListener(\"keydown\", this.host.boundKeyDown);\n }\n\n cancel(): void {\n this.keyboardController?.stop();\n this.keyboardController = null;\n this.stopTargetingListeners();\n document.body.classList.remove(\"qaid-targeting\", \"qaid-type-up\");\n document.body.style.removeProperty(\"--qaid-positive\");\n document.body.style.removeProperty(\"--qaid-negative\");\n this.host.clearActiveThumb();\n\n this.host.setState(\"IDLE\");\n this.host.feedbackData.feedbackType = null;\n this.host.feedbackData.elementSelector = null;\n this.host.feedbackData.elementText = null;\n this.host.selectedBounds.visible = false;\n }\n\n private removeTargetingOverlay(): void {\n if (this.overlayContainer) {\n this.overlayContainer.remove();\n this.overlayContainer = null;\n }\n this.captureLayer = null;\n this.crosshairH = null;\n this.crosshairV = null;\n this.scope = null;\n }\n\n private showSelectedMarker(): void {\n const root = this.host.ensureOverlayHost();\n\n this.marker = document.createElement(\"div\");\n this.marker.className = \"qaid-selected-marker\";\n this.marker.style.left = `${this.host.selectedBounds.x}px`;\n this.marker.style.top = `${this.host.selectedBounds.y}px`;\n this.marker.style.width = `${this.host.selectedBounds.width}px`;\n this.marker.style.height = `${this.host.selectedBounds.height}px`;\n this.marker.style.zIndex = String(this.host.config.zIndex + 1);\n\n this.host.applyVars(this.marker);\n root.appendChild(this.marker);\n }\n\n hideMarker(): void {\n if (this.marker) {\n this.marker.remove();\n this.marker = null;\n }\n }\n\n /** Full teardown for embed.destroy(). */\n destroy(): void {\n this.keyboardController?.stop();\n this.keyboardController = null;\n this.stopTargetingListeners();\n this.hideMarker();\n }\n}\n\n/** This feature's shadow-DOM styles; the embed adds them when it loads the chunk. */\nexport const styles = featureStyles;\n"],"names":["DATA_ATTRS","findDataAttribute","element","stopAt","current","attr","value","getTruncatedText","maxLength","textContent","getNthChildIndex","index","sibling","generateNthChildPath","path","tag","escapeCSSIdentifier","str","generateSelector","dataAttr","generateElementInfo","text","TARGETABLE_SELECTOR","NATIVELY_FOCUSABLE","isElementVisible","view","style","collectTargetableElements","options","root","selector","isExcluded","isVisible","startKeyboardTargeting","candidates","moveFocus","target","addedTabindex","stopped","seed","seedIndex","focusCurrent","focusable","emitHighlight","moveTo","nextIndex","len","next","prev","getCurrent","stop","handleKey","select","cancel","event","TOUCH_TAP_SLOP","TargetingController","host","e","type","el","isEmbedElement","rect","b","bounds","getElementBounds","vignette","part","div","x","y","hosts","elementUnder","getElementAtPointUnderOverlay","t","start","styles","featureStyles"],"mappings":"qDAKO,MAAMA,EAAa,CAAC,YAAa,UAAW,cAAe,SAAS,EAWpE,SAASC,EACdC,EACAC,EAAkB,SAAS,KACZ,CACf,IAAIC,EAA0BF,EAE9B,KAAOE,GAAWA,IAAYD,GAAQ,CACpC,UAAWE,KAAQL,EAAY,CAC7B,MAAMM,EAAQF,EAAQ,aAAaC,CAAI,EACvC,GAAIC,EACF,MAAO,GAAGD,CAAI,KAAKC,CAAK,GAE5B,CACAF,EAAUA,EAAQ,aACpB,CAEA,OAAO,IACT,CAKO,SAASG,EAAiBL,EAAkBM,EAAY,IAAa,CAC1E,MAAMC,EAAcP,EAAQ,aAAa,KAAA,EAAO,MAAM,EAAGM,CAAS,GAAK,GACvE,OAAOC,EAA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iB,OAAA,EACtB,KAAK,iBAAmB,MAE1B,KAAK,aAAe,KACpB,KAAK,WAAa,KAClB,KAAK,WAAa,KAClB,KAAK,MAAQ,IACf,CAEQ,oBAA2B,CACjC,MAAMQ,EAAO,KAAK,KAAK,kBAAA,EAEvB,KAAK,OAAS,SAAS,cAAc,KAAK,EAC1C,KAAK,OAAO,UAAY,uBACxB,KAAK,OAAO,MAAM,KAAO,GAAG,KAAK,KAAK,eAAe,CAAC,KACtD,KAAK,OAAO,MAAM,IAAM,GAAG,KAAK,KAAK,eAAe,CAAC,KACrD,KAAK,OAAO,MAAM,MAAQ,GAAG,KAAK,KAAK,eAAe,KAAK,KAC3D,KAAK,OAAO,MAAM,OAAS,GAAG,KAAK,KAAK,eAAe,MAAM,KAC7D,KAAK,OAAO,MAAM,OAAS,OAAO,KAAK,KAAK,OAAO,OAAS,CAAC,EAE7D,KAAK,KAAK,UAAU,KAAK,MAAM,EAC/BA,EAAK,YAAY,KAAK,MAAM,CAC9B,CAEA,YAAmB,CACb,KAAK,SACP,KAAK,OAAO,OAAA,EACZ,KAAK,OAAS,KAElB,CAGA,SAAgB,CACd,KAAK,oBAAoB,KAAA,EACzB,KAAK,mBAAqB,KAC1B,KAAK,uBAAA,EACL,KAAK,WAAA,CACP,CACF,CAGO,MAAM+C,EAASC"}
package/dist/dom.d.ts CHANGED
@@ -18,8 +18,6 @@ export interface ElProps {
18
18
  class?: string;
19
19
  /** Inline styles as a cssText string. */
20
20
  style?: string;
21
- /** innerHTML — for icons / trusted SVG markup. */
22
- html?: string;
23
21
  /** textContent. */
24
22
  text?: string;
25
23
  /** Attributes set via setAttribute (aria-*, data-*, type, role, …). */
@@ -20,8 +20,28 @@
20
20
  * (Distinct from `loader.ts`/`loader.js`, the ESM-only progressive entry this
21
21
  * one delegates to on modern browsers.)
22
22
  *
23
+ * Pinned with Subresource Integrity (`integrity="sha384-…"` on this tag),
24
+ * every file it loads after itself is hash-checked too, with hashes baked in
25
+ * at build time (vite.config.embed.ts):
26
+ *
27
+ * - Where the browser enforces import-map `integrity` (Chrome 127+,
28
+ * Safari 18+, Firefox 138+), it adds an import map listing the sha384 of
29
+ * loader.js and every lazy chunk, then loads the small progressive build.
30
+ * The browser refuses any chunk whose bytes differ.
31
+ * - Everywhere else it loads the single-file UMD bundle with its own hash.
32
+ *
33
+ * No browser lets a page ask whether import-map integrity is enforced, so it
34
+ * finds out: the map also lists integrity-probe.js under a hash that can never
35
+ * match, and it loads that file first. A browser that enforces the map refuses
36
+ * it (onerror: take the progressive build); one that ignores the map, or a
37
+ * page whose CSP blocks the inline map, runs it (onload: take the UMD bundle).
38
+ * A refusal means the check is live, never that it is missing, so a pinned tag
39
+ * never loads an unchecked file. The cost is one tiny request and one console
40
+ * line about the probe's digest.
41
+ *
23
42
  * IMPORTANT: this file must stay ES5-clean and dependency-free. It is the one
24
43
  * script that also runs on the legacy browsers we fall back for, so it can't
25
44
  * use syntax (arrow fns, const/let, template literals) they'd choke on before
26
45
  * the fallback ever loads. Written with var/function on purpose.
27
46
  */
47
+ export {};
package/dist/embed.d.ts CHANGED
@@ -22,11 +22,11 @@ export declare class QaidFeedback {
22
22
  private feedbackData;
23
23
  private selectedBounds;
24
24
  /**
25
- * This feedback's record id, once its POST answers (null if it failed).
26
- * The message box and a linked quest open without waiting for it; the
27
- * PATCHes that need the id wait on this instead.
25
+ * This feedback's record (id + edit token), once its POST answers (null
26
+ * if it failed). The message box and a linked quest open without waiting
27
+ * for it; the PATCHes that need it wait on this instead.
28
28
  */
29
- private feedbackIdPromise;
29
+ private feedbackRecordPromise;
30
30
  private questsPrewarmed;
31
31
  private activeQuest;
32
32
  private isMobile;
package/dist/embed.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){"use strict";(function(){if(typeof document=="undefined")return;function o(){var s=document.currentScript;if(s&&s.src)return s;for(var c=document.getElementsByTagName("script"),r=c.length-1;r>=0;r--){var i=c[r].src||"";if(i.indexOf("thumbs-embed")!==-1&&/\/embed(\.min)?\.js(\?|#|$)/.test(i))return c[r]}return null}var t=o();if(!(!t||!t.src)){for(var d=t.src.substring(0,t.src.lastIndexOf("/")+1),f=("noModule"in HTMLScriptElement.prototype),e=document.createElement("script"),a=t.attributes,n=0;n<a.length;n++){var u=a[n];u.name.indexOf("data-")===0&&e.setAttribute(u.name,u.value)}f?(e.type="module",e.src=d+"loader.js"):(e.defer=!0,e.src=d+"qaid.umd.cjs"),(document.head||document.documentElement).appendChild(e)}})()})();
1
+ (function(){"use strict";var N="qaid-embed",g="__qaidEmbedTrustedTypes";function j(){if(typeof window=="undefined")return null;var n=window,e=n.trustedTypes;if(!e||typeof e.createPolicy!="function")return null;var c=n[g];if(c)return c;var m=Object.create(null),r=Object.create(null),u=null;try{u=e.createPolicy(N,{createScriptURL:function(i){if(m[i]===!0)return i;throw new TypeError("qaid-embed: refused script URL "+i)},createScript:function(i){if(r[i]===!0)return i;throw new TypeError("qaid-embed: refused inline script")}})}catch(i){u=null}var d={policy:u,allowed:m,allowedScripts:r};try{Object.defineProperty(n,g,{value:d,configurable:!0})}catch(i){}return d}function w(n){var e=j();return!e||!e.policy?n:(e.allowed[n]=!0,e.policy.createScriptURL(n))}function C(n){var e=j();if(!e||!e.policy)return n;if(!e.allowedScripts||typeof e.policy.createScript!="function")throw new TypeError("qaid-embed: this page's policy cannot sign scripts");return e.allowedScripts[n]=!0,e.policy.createScript(n)}var T="__qaidThumbsOrigin",v={"loader.js":"sha384-O1+Y2RhMmEtC8CCbd4onyjeKe1Qe+wji7WVLR7MG+nn4DMgklVxnyQVWvmDGhDlh","chunks/annotate-Dvrfeb8k.js":"sha384-aeWzp3H/iOGiiy3e56hMWJKmnnMYsMaGJLA6LQKXp6jzpLfJVjFcRgyNYOEGxIwp","chunks/core-C36Mpll9.js":"sha384-NBSkr2+51LEwgn5qtbC644mMS9apiEDoqc+SR5b2RJUTAZfToEBDzLaFD8n2n+/J","chunks/dom-kdwHduNo.js":"sha384-mmXNhl4XzelgmyQD3XHa/3kWOlsNm/ow6MqGzev47BHjb+to6amzytvwGM7fc/aG","chunks/html2canvas.esm-Csbr1w14.js":"sha384-6MW8rZoxyLmfs5uD4VA0Bxw4e69KwtsimOHDkt/QsDQvFxQDLQd5ljmGjjSAaygi","chunks/modal-CXZZ6LG0.js":"sha384-/oXMalk7mRljteHxJMzD4n73ibH1iJuyviaLdvzkLU0FTK2BIxsvVwkDeqs/BMHS","chunks/recording-D_iYhxpC.js":"sha384-C1ZTvLArsfuJ169VmDGmwukhPNns4aWG95u0DcHtYZFqm6ebUNZhJkSalbkNiVZN","chunks/screenshot-CNe1irEz.js":"sha384-b6vBhmHLg6hQ5rdkVg9UHEcxE9tbYLZdWkO4z3PYM6kCQ0f3Mo8/PLPAUb72k2Am","chunks/screenshot-dom-DO-0UlOz.js":"sha384-QShbeObHMdCj3xAQQjpJ+XV4MAmv8dsByIEOZf7XpXLKTYY7WrdPWDW/qIVP1yb0","chunks/send-o4flR35U.js":"sha384-CSjrZpjNWzcMy+YAqPvUGv3u/FmzR1VFCG+ixaiYbLTDr1DF5//mX4ZvCxDC7Ro8","chunks/targeting-Jjo_Jyqy.js":"sha384-KNgSEiHQBo5qY8BUGcZtmiciKlIqVWsf1T+rcDtOaE3U3ckVnLmW65KnNIKiAE9u","chunks/video-BSP4s2te.js":"sha384-U6PurxQ6ugA7semvNHgyrjd8pDoYY60XG+e7za26M8mol8vmb2kGRUwIj0It78j3"},M="integrity-probe.js";(function(){if(typeof document=="undefined")return;function n(){var t=document.currentScript;if(t&&t.src)return t;for(var s=document.getElementsByTagName("script"),a=s.length-1;a>=0;a--){var l=s[a].src||"";if(l.indexOf("thumbs-embed")!==-1&&/\/embed(\.min)?\.js(\?|#|$)/.test(l))return s[a]}return null}var e=n();if(!e||!e.src)return;for(var c=e.src.substring(0,e.src.lastIndexOf("/")+1),m=("noModule"in HTMLScriptElement.prototype),r=document.createElement("script"),u=e.attributes,d=0;d<u.length;d++){var i=u[d];i.name.indexOf("data-")===0&&r.setAttribute(i.name,i.value)}r[T]=e;var p="sha384-X8qLzKhuubJJcl7N0tjBaxgXJKF31PJiw9bITL98VapCyQ5P6IygJNzxMe2eZe/n",h=typeof v=="object"&&v?v:null,k="sha384-/1OlEapvbDTqaD7Kh2wuedM8GLdPNC4GDz+iVHqB7AOskCLf5AQeL56v6tmeljkL",E=!!e.getAttribute("integrity")&&!0;function q(t){typeof console!="undefined"&&console.warn("[thumbs-embed] "+t)}function L(t,s){try{return t.src=w(s),!0}catch(a){return q("Trusted Types blocked "+s+". Add `trusted-types qaid-embed` to the page's CSP."),!1}}function y(t){(document.head||document.documentElement).appendChild(t)}function O(t){r.type="module",t&&(r.integrity=t,r.crossOrigin="anonymous"),L(r,c+"loader.js")&&y(r)}function f(t){r.defer=!0,t&&(r.integrity=t,r.crossOrigin="anonymous"),L(r,c+"qaid.umd.cjs")&&y(r)}function G(){var t=HTMLScriptElement;return typeof t.supports=="function"&&t.supports("importmap")}function I(){var t=h,s={integrity:{}};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s.integrity[c+a]=t[a]);s.integrity[c+M]=k;var l=document.createElement("script");l.type="importmap";try{l.text=C(JSON.stringify(s))}catch(b){f(p);return}y(l);var o=document.createElement("script");o.type="module",o.crossOrigin="anonymous";var D=!1;function S(b){D||(D=!0,o.parentNode&&o.parentNode.removeChild(o),b?O(t["loader.js"]):f(p))}o.onerror=function(){S(!0)},o.onload=function(){S(!1)};try{o.src=w(c+M)}catch(b){f(p);return}y(o)}m?E?h&&h["loader.js"]&&k&&G()?I():f(p):O(""):f(E?p:"")})()})();
2
2
  //# sourceMappingURL=embed.js.map
package/dist/embed.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"embed.js","sources":["../src/embed-loader.ts"],"sourcesContent":["/**\n * Single-tag embed loader (`dist/embed.js`).\n *\n * A drop-in classic `<script>` that works in every browser. It feature-detects\n * ES-module support and injects the right build, so the page author never has\n * to think about compatibility:\n *\n * - modern browsers → the progressive ESM loader (`loader.js`): a small core,\n * with screenshot / video / annotation / targeting loading on demand.\n * - older browsers → the all-in-one UMD bundle (`qaid.umd.cjs`).\n *\n * The injected build initializes itself from the `data-*` attributes copied\n * across from this tag (or from a `<script type=\"application/json\">` config\n * block already on the page), so exactly one embed is created either way.\n *\n * Usage:\n * <script src=\"https://unpkg.com/@qaiddev/thumbs-embed/dist/embed.js\"\n * data-endpoint=\"/api/feedback\"></script>\n *\n * (Distinct from `loader.ts`/`loader.js`, the ESM-only progressive entry this\n * one delegates to on modern browsers.)\n *\n * IMPORTANT: this file must stay ES5-clean and dependency-free. It is the one\n * script that also runs on the legacy browsers we fall back for, so it can't\n * use syntax (arrow fns, const/let, template literals) they'd choke on before\n * the fallback ever loads. Written with var/function on purpose.\n */\n\n(function () {\n if (typeof document === \"undefined\") return;\n\n // Locate this script tag: prefer document.currentScript (valid for a plain\n // classic script), else find the last <script> whose src looks like embed.js.\n function findSelf(): HTMLScriptElement | null {\n var cur = document.currentScript as HTMLScriptElement | null;\n if (cur && cur.src) return cur;\n var scripts = document.getElementsByTagName(\"script\");\n for (var i = scripts.length - 1; i >= 0; i--) {\n var src = scripts[i].src || \"\";\n if (src.indexOf(\"thumbs-embed\") !== -1 && /\\/embed(\\.min)?\\.js(\\?|#|$)/.test(src)) {\n return scripts[i];\n }\n }\n return null;\n }\n\n var self = findSelf();\n if (!self || !self.src) return;\n\n // Base = the directory that holds embed.js, e.g.\n // \"https://unpkg.com/@qaiddev/thumbs-embed/dist/\". loader.js's own relative\n // chunk imports then resolve against the same (CDN-versioned) base.\n var base = self.src.substring(0, self.src.lastIndexOf(\"/\") + 1);\n\n var supportsModules = \"noModule\" in HTMLScriptElement.prototype;\n\n var entry = document.createElement(\"script\");\n\n // Carry the config across so the injected build's auto-init sees it.\n var attrs = self.attributes;\n for (var j = 0; j < attrs.length; j++) {\n var a = attrs[j];\n if (a.name.indexOf(\"data-\") === 0) entry.setAttribute(a.name, a.value);\n }\n\n if (supportsModules) {\n entry.type = \"module\";\n entry.src = base + \"loader.js\";\n } else {\n // Classic bundle: defer so it runs after the document is parsed, matching\n // the module entry's deferred timing.\n entry.defer = true;\n entry.src = base + \"qaid.umd.cjs\";\n }\n\n (document.head || document.documentElement).appendChild(entry);\n})();\n"],"names":["findSelf","cur","scripts","i","src","self","base","supportsModules","entry","attrs","j","a"],"mappings":"0BA4BC,UAAY,CACX,GAAI,OAAO,UAAa,YAAa,OAIrC,SAASA,GAAqC,CAC5C,IAAIC,EAAM,SAAS,cACnB,GAAIA,GAAOA,EAAI,IAAK,OAAOA,EAE3B,QADIC,EAAU,SAAS,qBAAqB,QAAQ,EAC3CC,EAAID,EAAQ,OAAS,EAAGC,GAAK,EAAGA,IAAK,CAC5C,IAAIC,EAAMF,EAAQC,CAAC,EAAE,KAAO,GAC5B,GAAIC,EAAI,QAAQ,cAAc,IAAM,IAAM,8BAA8B,KAAKA,CAAG,EAC9E,OAAOF,EAAQC,CAAC,CAEpB,CACA,OAAO,IACT,CAEA,IAAIE,EAAOL,EAAA,EACX,GAAI,GAACK,GAAQ,CAACA,EAAK,KAanB,SARIC,EAAOD,EAAK,IAAI,UAAU,EAAGA,EAAK,IAAI,YAAY,GAAG,EAAI,CAAC,EAE1DE,GAAkB,aAAc,kBAAkB,WAElDC,EAAQ,SAAS,cAAc,QAAQ,EAGvCC,EAAQJ,EAAK,WACRK,EAAI,EAAGA,EAAID,EAAM,OAAQC,IAAK,CACrC,IAAIC,EAAIF,EAAMC,CAAC,EACXC,EAAE,KAAK,QAAQ,OAAO,IAAM,GAAGH,EAAM,aAAaG,EAAE,KAAMA,EAAE,KAAK,CACvE,CAEIJ,GACFC,EAAM,KAAO,SACbA,EAAM,IAAMF,EAAO,cAInBE,EAAM,MAAQ,GACdA,EAAM,IAAMF,EAAO,iBAGpB,SAAS,MAAQ,SAAS,iBAAiB,YAAYE,CAAK,EAC/D,GAAA"}
1
+ {"version":3,"file":"embed.js","sources":["../src/trusted-types.ts","../src/origin-key.ts","../src/embed-loader.ts"],"sourcesContent":["/**\n * The embed's one Trusted Types policy, `qaid-embed`.\n *\n * On a page that sets `require-trusted-types-for 'script'`, assigning a plain\n * string to `script.src` throws. The embed computes every script URL it sets\n * itself (its own stage-two file, the quests module), so it passes each one\n * through this policy, which only signs URLs the embed registered a moment\n * before. A partner allows it with `trusted-types qaid-embed`.\n *\n * The policy is created once per page and kept on `window`, because embed.js,\n * the bundle it loads, and quests-embed (which keeps its own copy of this\n * file) all want the same name, and a page's `trusted-types` directive\n * refuses a second policy of one name unless it says `'allow-duplicates'`.\n *\n * When the browser has no Trusted Types, or the page's directive does not\n * list `qaid-embed`, the URL comes back as a plain string. The assignment\n * then works or throws exactly as it would have; callers catch it.\n *\n * ES5-clean on purpose: embed.js, which runs on the oldest browsers we\n * support, bundles this file too.\n */\n\ninterface ScriptUrlPolicy {\n createScriptURL(url: string): unknown;\n /** Absent on a policy an older embed release created on this page. */\n createScript?: (text: string) => unknown;\n}\n\ninterface SharedPolicy {\n policy: ScriptUrlPolicy | null;\n allowed: Record<string, boolean>;\n /** Inline script texts (embed.js's import map) registered a moment before. */\n allowedScripts?: Record<string, boolean>;\n}\n\ninterface TrustedTypesFactory {\n createPolicy(\n name: string,\n rules: {\n createScriptURL: (url: string) => string;\n createScript: (text: string) => string;\n }\n ): ScriptUrlPolicy;\n}\n\nexport var POLICY_NAME = \"qaid-embed\";\nvar KEY = \"__qaidEmbedTrustedTypes\";\n\nfunction shared(): SharedPolicy | null {\n if (typeof window === \"undefined\") return null;\n var w = window as unknown as Record<string, unknown>;\n var tt = w.trustedTypes as TrustedTypesFactory | undefined;\n if (!tt || typeof tt.createPolicy !== \"function\") return null;\n var existing = w[KEY] as SharedPolicy | undefined;\n if (existing) return existing;\n\n var allowed: Record<string, boolean> = Object.create(null);\n var allowedScripts: Record<string, boolean> = Object.create(null);\n var policy: ScriptUrlPolicy | null = null;\n try {\n policy = tt.createPolicy(POLICY_NAME, {\n createScriptURL: function (url: string): string {\n if (allowed[url] === true) return url;\n throw new TypeError(\"qaid-embed: refused script URL \" + url);\n },\n createScript: function (text: string): string {\n if (allowedScripts[text] === true) return text;\n throw new TypeError(\"qaid-embed: refused inline script\");\n },\n });\n } catch (e) {\n // The page's trusted-types directive does not list qaid-embed.\n policy = null;\n }\n var state: SharedPolicy = { policy: policy, allowed: allowed, allowedScripts: allowedScripts };\n try {\n Object.defineProperty(w, KEY, { value: state, configurable: true });\n } catch (e) {\n /* frozen window: keep it local */\n }\n return state;\n}\n\n/**\n * A value for `script.src`: a TrustedScriptURL from the `qaid-embed` policy\n * when one exists, else the string itself.\n */\nexport function trustedScriptUrl(url: string): string {\n var s = shared();\n if (!s || !s.policy) return url;\n s.allowed[url] = true;\n return s.policy.createScriptURL(url) as string;\n}\n\n/**\n * A value for an inline script's `text`: a TrustedScript from the `qaid-embed`\n * policy when one exists, else the string itself. Only embed.js's import map\n * uses it. Throws when the page's policy can't sign scripts (one an older\n * release created); the caller then takes its fallback.\n */\nexport function trustedScript(text: string): string {\n var s = shared();\n if (!s || !s.policy) return text;\n if (!s.allowedScripts || typeof s.policy.createScript !== \"function\") {\n throw new TypeError(\"qaid-embed: this page's policy cannot sign scripts\");\n }\n s.allowedScripts[text] = true;\n return s.policy.createScript(text) as string;\n}\n\n/** @internal Test seam: forget the page's policy. */\nexport function _resetTrustedTypes(): void {\n if (typeof window === \"undefined\") return;\n try {\n delete (window as unknown as Record<string, unknown>)[KEY];\n } catch (e) {\n /* nothing to forget */\n }\n}\n","/**\n * The property embed.js sets on the tag it injects, pointing back at the\n * customer's own `<script src=\".../embed.js\">`. An expando, not an attribute:\n * markup injected into the page can't forge it. Its own module so embed.js\n * (ES5, tiny) can share it with the bootstrap without pulling the bootstrap in.\n */\nexport var ORIGIN_KEY_NAME = \"__qaidThumbsOrigin\";\n","/**\n * Single-tag embed loader (`dist/embed.js`).\n *\n * A drop-in classic `<script>` that works in every browser. It feature-detects\n * ES-module support and injects the right build, so the page author never has\n * to think about compatibility:\n *\n * - modern browsers → the progressive ESM loader (`loader.js`): a small core,\n * with screenshot / video / annotation / targeting loading on demand.\n * - older browsers → the all-in-one UMD bundle (`qaid.umd.cjs`).\n *\n * The injected build initializes itself from the `data-*` attributes copied\n * across from this tag (or from a `<script type=\"application/json\">` config\n * block already on the page), so exactly one embed is created either way.\n *\n * Usage:\n * <script src=\"https://unpkg.com/@qaiddev/thumbs-embed/dist/embed.js\"\n * data-endpoint=\"/api/feedback\"></script>\n *\n * (Distinct from `loader.ts`/`loader.js`, the ESM-only progressive entry this\n * one delegates to on modern browsers.)\n *\n * Pinned with Subresource Integrity (`integrity=\"sha384-…\"` on this tag),\n * every file it loads after itself is hash-checked too, with hashes baked in\n * at build time (vite.config.embed.ts):\n *\n * - Where the browser enforces import-map `integrity` (Chrome 127+,\n * Safari 18+, Firefox 138+), it adds an import map listing the sha384 of\n * loader.js and every lazy chunk, then loads the small progressive build.\n * The browser refuses any chunk whose bytes differ.\n * - Everywhere else it loads the single-file UMD bundle with its own hash.\n *\n * No browser lets a page ask whether import-map integrity is enforced, so it\n * finds out: the map also lists integrity-probe.js under a hash that can never\n * match, and it loads that file first. A browser that enforces the map refuses\n * it (onerror: take the progressive build); one that ignores the map, or a\n * page whose CSP blocks the inline map, runs it (onload: take the UMD bundle).\n * A refusal means the check is live, never that it is missing, so a pinned tag\n * never loads an unchecked file. The cost is one tiny request and one console\n * line about the probe's digest.\n *\n * IMPORTANT: this file must stay ES5-clean and dependency-free. It is the one\n * script that also runs on the legacy browsers we fall back for, so it can't\n * use syntax (arrow fns, const/let, template literals) they'd choke on before\n * the fallback ever loads. Written with var/function on purpose.\n */\n\nimport { trustedScript, trustedScriptUrl } from \"./trusted-types\";\nimport { ORIGIN_KEY_NAME } from \"./origin-key\";\n\n/** sha384 of qaid.umd.cjs, set by vite.config.embed.ts. Empty in tests. */\ndeclare const __QAID_UMD_INTEGRITY__: string | undefined;\n/** sha384 of loader.js and every chunk, keyed by path under dist/. Empty in tests. */\ndeclare const __QAID_MODULE_INTEGRITY__: Record<string, string> | undefined;\n/** A sha384 integrity-probe.js never has. */\ndeclare const __QAID_PROBE_MISMATCH__: string | undefined;\n\n/** The probe file, beside embed.js. */\nvar PROBE_FILE = \"integrity-probe.js\";\n\n(function () {\n if (typeof document === \"undefined\") return;\n\n // Locate this script tag: prefer document.currentScript (valid for a plain\n // classic script), else find the last <script> whose src looks like embed.js.\n function findSelf(): HTMLScriptElement | null {\n var cur = document.currentScript as HTMLScriptElement | null;\n if (cur && cur.src) return cur;\n var scripts = document.getElementsByTagName(\"script\");\n for (var i = scripts.length - 1; i >= 0; i--) {\n var src = scripts[i].src || \"\";\n if (src.indexOf(\"thumbs-embed\") !== -1 && /\\/embed(\\.min)?\\.js(\\?|#|$)/.test(src)) {\n return scripts[i];\n }\n }\n return null;\n }\n\n var self = findSelf();\n if (!self || !self.src) return;\n\n // Base = the directory that holds embed.js, e.g.\n // \"https://unpkg.com/@qaiddev/thumbs-embed/dist/\". loader.js's own relative\n // chunk imports then resolve against the same (CDN-versioned) base.\n var base = self.src.substring(0, self.src.lastIndexOf(\"/\") + 1);\n\n var supportsModules = \"noModule\" in HTMLScriptElement.prototype;\n\n var entry = document.createElement(\"script\");\n\n // Carry the config across so the injected build's auto-init sees it.\n var attrs = self.attributes;\n for (var j = 0; j < attrs.length; j++) {\n var a = attrs[j];\n if (a.name.indexOf(\"data-\") === 0) entry.setAttribute(a.name, a.value);\n }\n\n // Lets the injected build find this tag, for the JSON config block beside\n // it. A property, not an attribute, so page markup can't fake it.\n (entry as unknown as Record<string, unknown>)[ORIGIN_KEY_NAME] = self;\n\n var umdIntegrity = typeof __QAID_UMD_INTEGRITY__ === \"string\" ? __QAID_UMD_INTEGRITY__ : \"\";\n var moduleIntegrity =\n typeof __QAID_MODULE_INTEGRITY__ === \"object\" && __QAID_MODULE_INTEGRITY__ ? __QAID_MODULE_INTEGRITY__ : null;\n var probeMismatch = typeof __QAID_PROBE_MISMATCH__ === \"string\" ? __QAID_PROBE_MISMATCH__ : \"\";\n var pinned = !!self.getAttribute(\"integrity\") && !!umdIntegrity;\n\n function warn(message: string): void {\n if (typeof console !== \"undefined\") console.warn(\"[thumbs-embed] \" + message);\n }\n\n function setSrc(el: HTMLScriptElement, url: string): boolean {\n try {\n el.src = trustedScriptUrl(url);\n return true;\n } catch (e) {\n // A Trusted Types page that doesn't allow the qaid-embed policy.\n warn(\"Trusted Types blocked \" + url + \". Add `trusted-types qaid-embed` to the page's CSP.\");\n return false;\n }\n }\n\n function append(el: HTMLElement): void {\n (document.head || document.documentElement).appendChild(el);\n }\n\n function loadModules(hash: string): void {\n entry.type = \"module\";\n if (hash) {\n entry.integrity = hash;\n entry.crossOrigin = \"anonymous\";\n }\n if (setSrc(entry, base + \"loader.js\")) append(entry);\n }\n\n function loadUmd(hash: string): void {\n // Classic bundle: defer so it runs after the document is parsed, matching\n // the module entry's deferred timing.\n entry.defer = true;\n if (hash) {\n entry.integrity = hash;\n entry.crossOrigin = \"anonymous\";\n }\n if (setSrc(entry, base + \"qaid.umd.cjs\")) append(entry);\n }\n\n function canMapImports(): boolean {\n var S = HTMLScriptElement as unknown as { supports?: (type: string) => boolean };\n return typeof S.supports === \"function\" && S.supports(\"importmap\");\n }\n\n // Pinned on a module browser: try the hashed progressive build, else UMD.\n function loadPinned(): void {\n var hashes = moduleIntegrity as Record<string, string>;\n var map: { integrity: Record<string, string> } = { integrity: {} };\n for (var path in hashes) {\n if (Object.prototype.hasOwnProperty.call(hashes, path)) map.integrity[base + path] = hashes[path];\n }\n map.integrity[base + PROBE_FILE] = probeMismatch;\n\n var importMap = document.createElement(\"script\");\n importMap.type = \"importmap\";\n try {\n importMap.text = trustedScript(JSON.stringify(map));\n } catch (e) {\n loadUmd(umdIntegrity);\n return;\n }\n append(importMap);\n\n var probe = document.createElement(\"script\");\n probe.type = \"module\";\n probe.crossOrigin = \"anonymous\";\n var settled = false;\n function settle(enforced: boolean): void {\n if (settled) return;\n settled = true;\n if (probe.parentNode) probe.parentNode.removeChild(probe);\n if (enforced) loadModules(hashes[\"loader.js\"]);\n else loadUmd(umdIntegrity);\n }\n probe.onerror = function () {\n settle(true);\n };\n probe.onload = function () {\n settle(false);\n };\n try {\n probe.src = trustedScriptUrl(base + PROBE_FILE);\n } catch (e) {\n loadUmd(umdIntegrity);\n return;\n }\n append(probe);\n }\n\n if (!supportsModules) {\n loadUmd(pinned ? umdIntegrity : \"\");\n } else if (!pinned) {\n loadModules(\"\");\n } else if (moduleIntegrity && moduleIntegrity[\"loader.js\"] && probeMismatch && canMapImports()) {\n loadPinned();\n } else {\n loadUmd(umdIntegrity);\n }\n})();\n"],"names":["POLICY_NAME","KEY","shared","w","tt","existing","allowed","allowedScripts","policy","url","text","e","state","trustedScriptUrl","s","trustedScript","ORIGIN_KEY_NAME","PROBE_FILE","findSelf","cur","scripts","i","src","self","base","supportsModules","entry","attrs","j","a","umdIntegrity","moduleIntegrity","define_QAID_MODULE_INTEGRITY_default","probeMismatch","pinned","warn","message","setSrc","el","append","loadModules","hash","loadUmd","canMapImports","S","loadPinned","hashes","map","path","importMap","probe","settled","settle","enforced"],"mappings":"yBA6CO,IAAIA,EAAc,aACrBC,EAAM,0BAEV,SAASC,GAA8B,CACrC,GAAI,OAAO,QAAW,YAAa,OAAO,KAC1C,IAAIC,EAAI,OACJC,EAAKD,EAAE,aACX,GAAI,CAACC,GAAM,OAAOA,EAAG,cAAiB,WAAY,OAAO,KACzD,IAAIC,EAAWF,EAAEF,CAAG,EACpB,GAAII,EAAU,OAAOA,EAErB,IAAIC,EAAmC,OAAO,OAAO,IAAI,EACrDC,EAA0C,OAAO,OAAO,IAAI,EAC5DC,EAAiC,KACrC,GAAI,CACFA,EAASJ,EAAG,aAAaJ,EAAa,CACpC,gBAAiB,SAAUS,EAAqB,CAC9C,GAAIH,EAAQG,CAAG,IAAM,GAAM,OAAOA,EAClC,MAAM,IAAI,UAAU,kCAAoCA,CAAG,CAC7D,EACA,aAAc,SAAUC,EAAsB,CAC5C,GAAIH,EAAeG,CAAI,IAAM,GAAM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CACnE,CAGA,SAASC,GAAmB,CAC1B,IAAIC,EAASf,EACTgB,EAA6C,CAAE,UAAW,EAAC,EAC/D,QAASC,KAAQF,EACX,OAAO,UAAU,eAAe,KAAKA,EAAQE,CAAI,IAAGD,EAAI,UAAUvB,EAAOwB,CAAI,EAAIF,EAAOE,CAAI,GAElGD,EAAI,UAAUvB,EAAOP,CAAU,EAAIgB,EAEnC,IAAIgB,EAAY,SAAS,cAAc,QAAQ,EAC/CA,EAAU,KAAO,YACjB,GAAI,CACFA,EAAU,KAAOlC,EAAc,KAAK,UAAUgC,CAAG,CAAC,CACpD,OAASpC,EAAG,CACV+B,EAAQZ,CAAY,EACpB,MACF,CACAS,EAAOU,CAAS,EAEhB,IAAIC,EAAQ,SAAS,cAAc,QAAQ,EAC3CA,EAAM,KAAO,SACbA,EAAM,YAAc,YACpB,IAAIC,EAAU,GACd,SAASC,EAAOC,EAAyB,CACnCF,IACJA,EAAU,GACND,EAAM,YAAYA,EAAM,WAAW,YAAYA,CAAK,EACpDG,EAAUb,EAAYM,EAAO,WAAW,CAAC,IAChChB,CAAY,EAC3B,CACAoB,EAAM,QAAU,UAAY,CAC1BE,EAAO,EAAI,CACb,EACAF,EAAM,OAAS,UAAY,CACzBE,EAAO,EAAK,CACd,EACA,GAAI,CACFF,EAAM,IAAMrC,EAAiBW,EAAOP,CAAU,CAChD,OAASN,EAAG,CACV+B,EAAQZ,CAAY,EACpB,MACF,CACAS,EAAOW,CAAK,CACd,CAEKzB,EAEOS,EAEDH,GAAmBA,EAAgB,WAAW,GAAKE,GAAiBU,IAC7EE,EAAA,EAEAH,EAAQZ,CAAY,EAJpBU,EAAY,EAAE,EAFdE,EAAQR,EAASJ,EAAe,EAAE,CAQtC,GAAA"}
package/dist/icons.d.ts CHANGED
@@ -6,6 +6,8 @@ export declare const THUMBS_DOWN_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg
6
6
  export declare const RECORD_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"qaid-icon\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <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\"/>\n</svg>";
7
7
  /** Chat-bubble icon for the single, sentiment-free "Feedback" button. */
8
8
  export declare const FEEDBACK_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"qaid-icon\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M8 10h8M8 14h5m-9 6l3.5-3.5H18a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v14z\"/>\n</svg>";
9
+ /** The small X that hides the buttons. */
10
+ export declare const DISMISS_ICON = "<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 2l8 8M10 2l-8 8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>";
9
11
  export declare const RECTANGLE_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"qaid-icon\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"4\" y=\"6\" width=\"16\" height=\"12\" rx=\"1\" stroke-linejoin=\"round\"/>\n</svg>";
10
12
  export declare const ARROW_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"qaid-icon\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5 19L19 5m0 0h-8m8 0v8\"/>\n</svg>";
11
13
  export declare const PENCIL_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"qaid-icon\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 20h9M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z\"/>\n</svg>";