@weatherboard/annotation 0.4.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADOPTING.md +147 -10
- package/COMPATIBILITY.md +29 -0
- package/README.md +84 -10
- package/dist/anchor.cjs +1 -1
- package/dist/anchor.cjs.map +2 -2
- package/dist/anchor.mjs.map +2 -2
- package/dist/arming.d.cts +18 -21
- package/dist/arming.d.mts +18 -21
- package/dist/arming.d.ts +18 -21
- package/dist/bootstrap-runtime.d.cts +30 -0
- package/dist/bootstrap-runtime.d.mts +30 -0
- package/dist/bootstrap-runtime.d.ts +30 -0
- package/dist/bootstrap.cjs +2 -0
- package/dist/bootstrap.cjs.map +7 -0
- package/dist/bootstrap.d.cts +8 -0
- package/dist/bootstrap.d.mts +8 -0
- package/dist/bootstrap.d.ts +8 -0
- package/dist/bootstrap.mjs +2 -0
- package/dist/bootstrap.mjs.map +7 -0
- package/dist/host.cjs +1 -1
- package/dist/host.cjs.map +3 -3
- package/dist/host.mjs +1 -1
- package/dist/host.mjs.map +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +10 -4
- package/dist/index.d.mts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +4 -4
- package/dist/markers.cjs +2 -2
- package/dist/markers.cjs.map +2 -2
- package/dist/markers.mjs +2 -2
- package/dist/markers.mjs.map +2 -2
- package/dist/page-capture.cjs +2 -0
- package/dist/page-capture.cjs.map +7 -0
- package/dist/page-capture.d.cts +115 -0
- package/dist/page-capture.d.mts +115 -0
- package/dist/page-capture.d.ts +115 -0
- package/dist/page-capture.mjs +2 -0
- package/dist/page-capture.mjs.map +7 -0
- package/dist/protocol.cjs +1 -1
- package/dist/protocol.cjs.map +3 -3
- package/dist/protocol.d.cts +19 -0
- package/dist/protocol.d.mts +19 -0
- package/dist/protocol.d.ts +19 -0
- package/dist/protocol.mjs +1 -1
- package/dist/protocol.mjs.map +3 -3
- package/dist/read.cjs +1 -1
- package/dist/read.cjs.map +2 -2
- package/dist/read.mjs +1 -1
- package/dist/read.mjs.map +2 -2
- package/dist/screenshot.d.cts +56 -7
- package/dist/screenshot.d.mts +56 -7
- package/dist/screenshot.d.ts +56 -7
- package/dist/selection.cjs +5 -0
- package/dist/selection.cjs.map +7 -0
- package/dist/selection.d.cts +27 -0
- package/dist/selection.d.mts +27 -0
- package/dist/selection.d.ts +27 -0
- package/dist/selection.mjs +5 -0
- package/dist/selection.mjs.map +7 -0
- package/dist/session.d.cts +17 -0
- package/dist/session.d.mts +17 -0
- package/dist/session.d.ts +17 -0
- package/dist/shortcut.d.cts +52 -0
- package/dist/shortcut.d.mts +52 -0
- package/dist/shortcut.d.ts +52 -0
- package/dist/toolbar.d.cts +13 -0
- package/dist/toolbar.d.mts +13 -0
- package/dist/toolbar.d.ts +13 -0
- package/dist/transport.d.cts +10 -0
- package/dist/transport.d.mts +10 -0
- package/dist/transport.d.ts +10 -0
- package/package.json +45 -10
package/dist/index.d.cts
CHANGED
|
@@ -28,10 +28,16 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export { createAnnotationSdk, emptyAnnotationState, type AnnotationSdk, type AnnotationSdkOptions, type AnnotationState, type CommentCollector, type CommentRequest, } from "./sdk.cjs";
|
|
30
30
|
export { assertConcreteEndpoint, createEgress, httpTransport, postMessageTransport, refusalReason, safeIssueUrl, safeRefusalReason, HTTP_TRANSPORT_TIMEOUT_MS, type AnnotationTransport, type IngestRefusal, type EgressErrorHandler, type EgressFailure, type EgressOutcome, type FetchLike, type FrameMessageKind, type HttpTransportOptions, type SendReceipt, } from "./transport.cjs";
|
|
31
|
-
export { createAnnotationToolbar, mountAnnotation, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.cjs";
|
|
32
|
-
export { isAnnotatableBuild, readArming, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.cjs";
|
|
31
|
+
export { createAnnotationToolbar, mountAnnotation, matchesHotkey, DEFAULT_HOTKEY, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.cjs";
|
|
32
|
+
export { isAnnotatableBuild, readArming, needsArming, tokenExpiry, ANNOTATION_TOKENS_COOKIE, REARM_BEFORE_EXPIRY_S, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.cjs";
|
|
33
33
|
export { createOverlay, OVERLAY_ID, type Overlay } from "./overlay.cjs";
|
|
34
|
-
export {
|
|
34
|
+
export { ANNOTATION_OPEN_INTENT_STORAGE_KEY } from "./session.cjs";
|
|
35
|
+
export { attachScreenshot, captureScreenshot, captureScreenshotSync, resolveScreenshotOptions, findCaptureSource, isMediaElement, intrinsicSize, fitWithin, MAX_SCREENSHOT_BYTES, MAX_SCREENSHOT_EDGE, SCREENSHOT_TIMEOUT_MS, MAX_VIEWPORT_DATA_URL_LENGTH, MAX_VIEWPORT_IMAGE_BYTES, MAX_VIEWPORT_WIDTH, VIEWPORT_TIMEOUT_MS, type CanvasLike, type CanvasContextLike, type CaptureCandidate, type Screenshot, type ScreenshotOptions, } from "./screenshot.cjs";
|
|
36
|
+
/**
|
|
37
|
+
* Types only: the viewport capture's code is loaded on demand (A-2385), so it
|
|
38
|
+
* is never re-exported here as a value — that would put it in every page.
|
|
39
|
+
*/
|
|
40
|
+
export type { CanvasRead, CanvasReadout, PageRenderer, PageRenderOptions, ViewportShot, } from "./page-capture.cjs";
|
|
35
41
|
export { installStateCollector, defaultStateCollectorOptions, RingBuffer, describeArg, formatConsoleArgs, firstStack, isFailedStatus, DEFAULT_LIMIT, type StateCollector, type StateCollectorOptions, } from "./state.cjs";
|
|
36
42
|
export { parseSourceRef, collectSourceChain, findAnnotatedAncestor, domPath, summariseText, resolveTarget, SRC_ATTR, NAME_ATTR, MAX_TEXT, MAX_CHAIN, type ElementLike, } from "./target.cjs";
|
|
37
|
-
export { ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.cjs";
|
|
43
|
+
export { ANNOTATION_MODE_HEADER, FIRST_PARTY_ANNOTATION_MODE, ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -28,10 +28,16 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export { createAnnotationSdk, emptyAnnotationState, type AnnotationSdk, type AnnotationSdkOptions, type AnnotationState, type CommentCollector, type CommentRequest, } from "./sdk.mjs";
|
|
30
30
|
export { assertConcreteEndpoint, createEgress, httpTransport, postMessageTransport, refusalReason, safeIssueUrl, safeRefusalReason, HTTP_TRANSPORT_TIMEOUT_MS, type AnnotationTransport, type IngestRefusal, type EgressErrorHandler, type EgressFailure, type EgressOutcome, type FetchLike, type FrameMessageKind, type HttpTransportOptions, type SendReceipt, } from "./transport.mjs";
|
|
31
|
-
export { createAnnotationToolbar, mountAnnotation, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.mjs";
|
|
32
|
-
export { isAnnotatableBuild, readArming, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.mjs";
|
|
31
|
+
export { createAnnotationToolbar, mountAnnotation, matchesHotkey, DEFAULT_HOTKEY, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.mjs";
|
|
32
|
+
export { isAnnotatableBuild, readArming, needsArming, tokenExpiry, ANNOTATION_TOKENS_COOKIE, REARM_BEFORE_EXPIRY_S, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.mjs";
|
|
33
33
|
export { createOverlay, OVERLAY_ID, type Overlay } from "./overlay.mjs";
|
|
34
|
-
export {
|
|
34
|
+
export { ANNOTATION_OPEN_INTENT_STORAGE_KEY } from "./session.mjs";
|
|
35
|
+
export { attachScreenshot, captureScreenshot, captureScreenshotSync, resolveScreenshotOptions, findCaptureSource, isMediaElement, intrinsicSize, fitWithin, MAX_SCREENSHOT_BYTES, MAX_SCREENSHOT_EDGE, SCREENSHOT_TIMEOUT_MS, MAX_VIEWPORT_DATA_URL_LENGTH, MAX_VIEWPORT_IMAGE_BYTES, MAX_VIEWPORT_WIDTH, VIEWPORT_TIMEOUT_MS, type CanvasLike, type CanvasContextLike, type CaptureCandidate, type Screenshot, type ScreenshotOptions, } from "./screenshot.mjs";
|
|
36
|
+
/**
|
|
37
|
+
* Types only: the viewport capture's code is loaded on demand (A-2385), so it
|
|
38
|
+
* is never re-exported here as a value — that would put it in every page.
|
|
39
|
+
*/
|
|
40
|
+
export type { CanvasRead, CanvasReadout, PageRenderer, PageRenderOptions, ViewportShot, } from "./page-capture.mjs";
|
|
35
41
|
export { installStateCollector, defaultStateCollectorOptions, RingBuffer, describeArg, formatConsoleArgs, firstStack, isFailedStatus, DEFAULT_LIMIT, type StateCollector, type StateCollectorOptions, } from "./state.mjs";
|
|
36
42
|
export { parseSourceRef, collectSourceChain, findAnnotatedAncestor, domPath, summariseText, resolveTarget, SRC_ATTR, NAME_ATTR, MAX_TEXT, MAX_CHAIN, type ElementLike, } from "./target.mjs";
|
|
37
|
-
export { ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.mjs";
|
|
43
|
+
export { ANNOTATION_MODE_HEADER, FIRST_PARTY_ANNOTATION_MODE, ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.mjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -28,10 +28,16 @@
|
|
|
28
28
|
*/
|
|
29
29
|
export { createAnnotationSdk, emptyAnnotationState, type AnnotationSdk, type AnnotationSdkOptions, type AnnotationState, type CommentCollector, type CommentRequest, } from "./sdk.js";
|
|
30
30
|
export { assertConcreteEndpoint, createEgress, httpTransport, postMessageTransport, refusalReason, safeIssueUrl, safeRefusalReason, HTTP_TRANSPORT_TIMEOUT_MS, type AnnotationTransport, type IngestRefusal, type EgressErrorHandler, type EgressFailure, type EgressOutcome, type FetchLike, type FrameMessageKind, type HttpTransportOptions, type SendReceipt, } from "./transport.js";
|
|
31
|
-
export { createAnnotationToolbar, mountAnnotation, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.js";
|
|
32
|
-
export { isAnnotatableBuild, readArming, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.js";
|
|
31
|
+
export { createAnnotationToolbar, mountAnnotation, matchesHotkey, DEFAULT_HOTKEY, DEFAULT_LABELS, TOOLBAR_ID, type AnnotationToolbar, type AnnotationToolbarLabels, type AnnotationToolbarOptions, type MountAnnotationOptions, type MountedAnnotation, } from "./toolbar.js";
|
|
32
|
+
export { isAnnotatableBuild, readArming, needsArming, tokenExpiry, ANNOTATION_TOKENS_COOKIE, REARM_BEFORE_EXPIRY_S, CAPTURE_TOKEN_STORAGE_KEY, READ_TOKEN_STORAGE_KEY, REVIEW_RUN_STORAGE_KEY, type Arming, type ArmingOptions, type StorageLike, } from "./arming.js";
|
|
33
33
|
export { createOverlay, OVERLAY_ID, type Overlay } from "./overlay.js";
|
|
34
|
-
export {
|
|
34
|
+
export { ANNOTATION_OPEN_INTENT_STORAGE_KEY } from "./session.js";
|
|
35
|
+
export { attachScreenshot, captureScreenshot, captureScreenshotSync, resolveScreenshotOptions, findCaptureSource, isMediaElement, intrinsicSize, fitWithin, MAX_SCREENSHOT_BYTES, MAX_SCREENSHOT_EDGE, SCREENSHOT_TIMEOUT_MS, MAX_VIEWPORT_DATA_URL_LENGTH, MAX_VIEWPORT_IMAGE_BYTES, MAX_VIEWPORT_WIDTH, VIEWPORT_TIMEOUT_MS, type CanvasLike, type CanvasContextLike, type CaptureCandidate, type Screenshot, type ScreenshotOptions, } from "./screenshot.js";
|
|
36
|
+
/**
|
|
37
|
+
* Types only: the viewport capture's code is loaded on demand (A-2385), so it
|
|
38
|
+
* is never re-exported here as a value — that would put it in every page.
|
|
39
|
+
*/
|
|
40
|
+
export type { CanvasRead, CanvasReadout, PageRenderer, PageRenderOptions, ViewportShot, } from "./page-capture.js";
|
|
35
41
|
export { installStateCollector, defaultStateCollectorOptions, RingBuffer, describeArg, formatConsoleArgs, firstStack, isFailedStatus, DEFAULT_LIMIT, type StateCollector, type StateCollectorOptions, } from "./state.js";
|
|
36
42
|
export { parseSourceRef, collectSourceChain, findAnnotatedAncestor, domPath, summariseText, resolveTarget, SRC_ATTR, NAME_ATTR, MAX_TEXT, MAX_CHAIN, type ElementLike, } from "./target.js";
|
|
37
|
-
export { ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.js";
|
|
43
|
+
export { ANNOTATION_MODE_HEADER, FIRST_PARTY_ANNOTATION_MODE, ANNOTATION_ARMED_COOKIE, ANNOTATION_ARMED_COOKIES, ANNOTATION_TOKEN_PARAM, ANNOTATION_ARMED_VALUE, ANNOTATION_TOKEN_PARAMS, armedCookie, CAPTURE_TOKEN_PARAM, READ_TOKEN_PARAM, clearedCookie, isAnnotationArmed, REVIEW_RUN_PARAM, LEGACY_ANNOTATION_ARMED_COOKIE, LEGACY_ANNOTATION_TOKEN_PARAM, readAnnotationToken, selectionOf, SDK_VERSION, isParentMessage, assertConcreteOrigin, type AnnotationPayload, type BuildInfo, type ConsoleEntry, type FrameToParent, type NetworkEntry, type ParentToFrame, type SourceRef, type TargetInfo, } from "./protocol.js";
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Re=e=>{throw TypeError(e)};var _e=(e,t,n)=>t.has(e)||Re("Cannot "+n);var L=(e,t,n)=>(_e(e,t,"read from private field"),n?n.call(e):t.get(e)),le=(e,t,n)=>t.has(e)?Re("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ke=(e,t,n,r)=>(_e(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var j="1",V="data-src",ce="data-src-name";function ct(e){return e.selection==="region"?"region":"element"}var ut=new Set(["annotate:enable","annotate:disable","annotate:ping"]);function ue(e){if(typeof e!="object"||e===null)return!1;let t=e.type;return typeof t=="string"&&ut.has(t)}function q(e){if(!e||e==="*")throw new Error("[annotation] a concrete parent origin is required; '*' would broadcast annotation payloads to any embedder.");return e}var Me="ai_annotate",de="ai_annotate_armed",Y="ai_capture",z="ai_run",J="ai_read",Ne="1";function dt(e=de){return`${e}=${Ne}; Path=/; SameSite=Lax; Secure`}function pe(e){return`${e}=; Path=/; SameSite=Lax; Secure; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT`}var Ie="pits_annotate",Le="pits_annotate_armed",Z=[Me,Ie],Q=[de,Le];function fe(e){return e.split(";").some(t=>{let n=t.trimStart();return Q.some(r=>n.startsWith(`${r}=`))})}function pt(e){for(let t of Z){let n=e.get(t);if(n!==null&&n.length>0)return n}return null}var Pe="ai-annotation-overlay",ft="2147483000";function me(e){let t=e.createElement("div");t.id=Pe,t.style.cssText=["position:fixed","top:0","left:0","pointer-events:none",`z-index:${ft}`,"display:none","box-sizing:border-box","border:2px solid #2563eb","background:rgba(37,99,235,0.12)","border-radius:2px"].join(";");let n=e.createElement("div");return n.style.cssText=["position:absolute","left:0","top:-20px","font:11px/16px ui-monospace,SFMono-Regular,Menlo,monospace","color:#fff","background:#2563eb","padding:1px 5px","border-radius:2px","white-space:nowrap","max-width:60vw","overflow:hidden","text-overflow:ellipsis"].join(";"),t.appendChild(n),e.body.appendChild(t),{show(r,o){t.style.display="block",t.style.transform=`translate(${r.x}px, ${r.y}px)`,t.style.width=`${r.w}px`,t.style.height=`${r.h}px`,n.style.top=r.y<20?"100%":"-20px",n.textContent=o??"",n.style.display=o?"block":"none"},hide(){t.style.display="none"},destroy(){t.remove()},contains(r){return r instanceof Node&&t.contains(r)}}}var ge=200,Fe=8;function he(e){if(!e)return null;let t=e.lastIndexOf(":");if(t<=0)return null;let n=e.lastIndexOf(":",t-1);if(n<=0)return null;let r=e.slice(0,n),o=Number(e.slice(n+1,t)),a=Number(e.slice(t+1));return!r||!Number.isFinite(o)||!Number.isFinite(a)?null:{file:r,line:o,column:a}}function Ue(e,t=Fe){let n=[],r=e;for(;r&&n.length<t;){let o=he(r.getAttribute(V));if(o){let a=n[n.length-1];a&&a.file===o.file&&a.line===o.line||n.push(o)}r=r.parentElement}return n}function De(e){let t=e;for(;t;){if(he(t.getAttribute(V)))return t;t=t.parentElement}return null}function mt(e){let t=e.classList;return(typeof t?.value=="string"?t.value:"").split(/\s+/).filter(Boolean)}function He(e,t=6){let n=[],r=e;for(;r&&n.length<t;){let o=(r.tagName||"").toLowerCase();if(!o||o==="html")break;let a=o;if(r.id)return n.unshift(`${o}#${r.id}`),n.join(" > ");let s=mt(r).slice(0,2);if(s.length>0&&(a+=`.${s.join(".")}`),n.unshift(a),o==="body")break;r=r.parentElement}return n.join(" > ")}function Ke(e){if(!e)return;let t=e.replace(/\s+/g," ").trim();if(t)return t.length>ge?`${t.slice(0,ge-1)}\u2026`:t}function be(e,t){let n=De(e),r=Ue(e),o=r[0],a={domPath:He(e),boundingBox:t.boundingBox};o&&(a.source=o),r.length>0&&(a.sourceChain=r);let s=n?.getAttribute(ce);s&&(a.componentName=s);let c=Ke(e.textContent);return c&&(a.textContent=c),a}var gt=2048;function ee(e){if(typeof e!="string"||e.length===0||e.length>gt)return;let t;try{t=new URL(e)}catch{return}if(!(t.protocol!=="https:"&&t.protocol!=="http:"))return t.href}var $e=300;function Ee(e){if(typeof e!="string")return;let t=e.replace(/[\u0000-\u001f\u007f-\u009f]+/g," ").replace(/\s+/g," ").trim();if(t.length!==0)return t.length>$e?`${t.slice(0,$e-1).trimEnd()}\u2026`:t}function ye(e){return Ee(e?.reason)}function Ae(e,t=window){let n=q(e);return{name:"postMessage",carries:()=>!0,send(r){t.parent.postMessage(r,n)}}}function Be(e){if(!e||e==="*")throw new Error("[annotation] a concrete ingest endpoint is required; '*' is not an address and an empty one posts nowhere.");let t;try{t=new URL(e)}catch{throw new Error(`[annotation] the ingest endpoint must be an absolute URL, got ${JSON.stringify(e)}; a relative one resolves against the product's own origin and the capture is lost there.`)}if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error(`[annotation] the ingest endpoint must be http(s), got ${t.protocol}`);return t.toString()}var qe=8e3;function ht(e){let t=Be(e.endpoint);if(!e.captureToken)throw new Error("[annotation] a capture token is required; the ingest rejects an unsigned capture and the reviewer would only find out after writing one.");let n=e.captureToken,r=e.timeoutMs??qe,o=e.fetch??globalThis.fetch;return{name:"http",carries:a=>a==="annotate:capture",async send(a){if(!o)throw new Error("[annotation] no fetch implementation is available for the ingest");let s=new AbortController,c=setTimeout(()=>s.abort(),r);try{let f=await o(t,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n}`},credentials:"omit",body:JSON.stringify(a),signal:s.signal});if(!f.ok){let m;try{let p=await f.json?.();m=Ee(p?.error)}catch{m=void 0}let g=new Error(`[annotation] the ingest rejected the capture: ${m??`HTTP ${f.status}`}`);throw g.status=f.status,m!==void 0&&(g.reason=m),g}try{let m=await f.json?.(),g=ee(m?.issueUrl);if(g!==void 0)return{issueUrl:g}}catch{}return{}}catch(f){throw s.signal.aborted?new Error(`[annotation] the capture timed out after ${r}ms`,{cause:f}):f}finally{clearTimeout(c)}}}}function xe(e,t){let n=(r,o)=>{let a={message:r,transport:e.name,error:o};if(t){t(a);return}console.error("[annotation] a capture could not be delivered",a)};return async r=>{if(!e.carries(r.type))return{status:"declined"};try{return{status:"sent",receipt:await e.send(r)??{}}}catch(o){return n(r,o),{status:"failed",error:o}}}}var bt=49152,Et=480,yt=250,At=[{edge:480,quality:.7},{edge:240,quality:.5}],xt=["image/webp","image/jpeg"];function Te(e,t){let n=e===!1?{enabled:!1}:e??{};return{enabled:n.enabled??!0,maxBytes:n.maxBytes??49152,maxEdge:n.maxEdge??480,timeoutMs:n.timeoutMs??250,createCanvas:n.createCanvas??(()=>t?.createElement("canvas")??null)}}var Tt=new Set(["IMG","CANVAS","VIDEO"]),vt="img,canvas,video",St=4;function te(e){return!!e&&Tt.has(e.tagName.toUpperCase())}function Xe(e,t=St){if(!e)return null;if(te(e))return e;let n=e.querySelector?.(vt)??null;if(te(n))return n;let r=e.parentElement??null;for(let o=0;r&&o<t;o++){if(te(r))return r;r=r.parentElement??null}return null}function Ge(e){let t=e.tagName.toUpperCase(),n=t==="IMG"?{w:e.naturalWidth,h:e.naturalHeight}:t==="VIDEO"?{w:e.videoWidth,h:e.videoHeight}:{w:e.width,h:e.height},r=Math.floor(n.w??0),o=Math.floor(n.h??0);return!Number.isFinite(r)||!Number.isFinite(o)||r<1||o<1||t==="IMG"&&e.complete===!1?null:{w:r,h:o}}function We(e,t){let n=Math.min(1,t/Math.max(e.w,e.h));return{w:Math.max(1,Math.round(e.w*n)),h:Math.max(1,Math.round(e.h*n))}}function Ct(e,t,n,r){let o;try{o=r.createCanvas()}catch{return null}if(!o)return null;try{o.width=t.w,o.height=t.h;let a=o.getContext("2d");if(!a)return null;a.drawImage(e,0,0,t.w,t.h);for(let s of xt){let c;try{c=o.toDataURL(s,n)}catch{return null}if(!(typeof c!="string"||!c.startsWith(`data:${s}`)))return c.length<=r.maxBytes?c:null}return null}catch{return null}}function je(e,t){if(!t.enabled)return null;let n=Xe(e);if(!n)return null;let r=Ge(n);if(!r)return null;for(let o of At){let a=We(r,Math.min(t.maxEdge,o.edge)),s=Ct(n,a,o.quality,t);if(s)return{dataUrl:s,region:"element"}}return null}function Ve(e,t){return t.enabled?new Promise(n=>{let r=!1,o=s=>{r||(r=!0,n(s))},a=setTimeout(()=>o(null),t.timeoutMs);a.unref?.(),Promise.resolve().then(()=>je(e,t)).then(o,()=>o(null)).finally(()=>clearTimeout(a))}):Promise.resolve(null)}async function ne(e,t,n){let r;try{r=await Ve(t,n)}catch{r=null}return r?{...e,screenshot:r}:e}var wt={consoleErrors:[],failedRequests:[],featureFlags:{}},Ot=()=>({...wt});function ve(e){let t=e.parentOrigin===void 0?null:q(e.parentOrigin),n=window,r=n.document,o=Te(e.screenshot,r),a=!1,s=null,c=0,f=null,m=!1,g=e.transport??(t===null?null:Ae(t,n));if(g===null)throw new Error("[annotation] the SDK needs a `transport` or a `parentOrigin`; with neither there is nowhere for a capture to go and every one of them would be lost in silence.");let p=xe(g,e.onEgressError),u=l=>{let d=l.getBoundingClientRect();return{x:d.x,y:d.y,w:d.width,h:d.height}},A=l=>be(l,{boundingBox:u(l)}),T=l=>{if(l.componentName&&l.source){let d=l.source.file.split("/").pop()??l.source.file;return`${l.componentName} \xB7 ${d}:${l.source.line}`}return l.source?`${l.source.file}:${l.source.line}`:l.componentName??null},x=l=>{!a||m||c||(c=n.requestAnimationFrame(()=>{c=0;let d=r.elementFromPoint(l.clientX,l.clientY);if(!d||s&&s.contains(d)||e.ignoreElement?.(d)||d===f)return;f=d;let b=A(d);s?.show(b.boundingBox,T(b)),p({type:"annotate:hover",target:b})}))},R=(l,d)=>({schemaVersion:1,capturedAt:new Date().toISOString(),build:e.build,page:{url:n.location.href,route:e.getRoute(),viewport:{w:n.innerWidth,h:n.innerHeight,dpr:n.devicePixelRatio},userAgent:n.navigator.userAgent},target:A(l),state:{consoleErrors:d.consoleErrors,failedRequests:d.failedRequests,featureFlags:d.featureFlags},comment:""}),N=l=>{let d={type:"annotate:capture",payload:l},b=()=>{p(d).then(O=>e.onCaptureResult?.(O,b))};b()},_=l=>{if(!a)return;let d=l.target;if(!(d instanceof Element)||e.ignoreElement?.(d)||(l.preventDefault(),l.stopPropagation(),m))return;let b=R(d,e.getState()),O=e.collectComment;if(!O){if(!o.enabled){N(b);return}ne(b,d,o).then(C=>N(C),()=>N(b));return}let H={x:l.clientX,y:l.clientY},K=o.enabled?ne(b,d,o).then(C=>C,()=>b):Promise.resolve(b),I=()=>{m=!0;let C=null,W=O({target:b.target,point:H}).then(y=>y,y=>(C={error:y},null));Promise.all([K,W]).then(([y,U])=>{if(m=!1,C!==null){e.onCaptureResult?.({status:"failed",error:C.error},I);return}U!==null&&N(U===""?y:{...y,comment:U})})};I()},P=l=>{!a||m||l.key!=="Escape"||(p({type:"annotate:cancel"}),k())};function F(){a||(a=!0,s??(s=me(r)),r.addEventListener("mousemove",x,!0),r.addEventListener("click",_,!0),r.addEventListener("keydown",P,!0))}function k(){a&&(a=!1,f=null,c&&(n.cancelAnimationFrame(c),c=0),r.removeEventListener("mousemove",x,!0),r.removeEventListener("click",_,!0),r.removeEventListener("keydown",P,!0),s?.hide())}let S=l=>{if(l.origin===t&&ue(l.data))switch(l.data.type){case"annotate:enable":F();break;case"annotate:disable":k();break;case"annotate:ping":p({type:"annotate:ready",sdkVersion:"1",build:e.build});break}};return t!==null&&n.addEventListener("message",S),p({type:"annotate:ready",sdkVersion:"1",build:e.build}),{enable:F,disable:k,isEnabled:()=>a,destroy(){k(),t!==null&&n.removeEventListener("message",S),s?.destroy(),s=null}}}var re="ai.annotation.capture",oe="ai.annotation.run",ae="ai.annotation.read",Ye=[...Z,Y,J,z];function v(e,t){try{return e()}catch{return t}}function Rt(e){return v(()=>e?.sessionStorage??null,null)}function _t(e={}){let t=e.doc??document,n=t.defaultView??null,r=e.storage===void 0?Rt(n):e.storage,o=e.url??t.URL,a=v(()=>new URL(o),null),s=null,c=null,f=null;if(a!==null&&(s=a.searchParams.get(Y)||null,c=a.searchParams.get(J)||null,f=a.searchParams.get(z)||null,Ye.some(u=>a.searchParams.has(u)))){for(let A of Ye)a.searchParams.delete(A);let u=e.history??n?.history;v(()=>{u?.replaceState(n?.history?.state??null,"",a.toString())},void 0)}let m=()=>{for(let p of Q)v(()=>{t.cookie=pe(p)},void 0);r&&(v(()=>r.removeItem(re),void 0),v(()=>r.removeItem(ae),void 0),v(()=>r.removeItem(oe),void 0))},g=fe(v(()=>t.cookie,""));return g?(r&&(s!==null?v(()=>r.setItem(re,s),void 0):s=v(()=>r.getItem(re),null),c!==null?v(()=>r.setItem(ae,c),void 0):c=v(()=>r.getItem(ae),null),f!==null?v(()=>r.setItem(oe,f),void 0):f=v(()=>r.getItem(oe),null)),{armed:g,captureToken:s,readToken:c,runId:f,disarm:m}):{armed:!1,captureToken:null,readToken:null,runId:null,disarm:m}}var kt=["preview","staging","development"];function Se(e){return kt.includes(e.env)}var Je={region:"Annotation",expand:"Open the annotation toolbar",collapse:"Close the annotation toolbar",start:"Start annotating",stop:"Stop annotating",done:"Done",comment:"What is wrong here?",placeholder:"The heading wraps onto three lines on mobile\u2026",send:"Send",cancel:"Cancel",sent:"Sent",issue:"View issue",failed:"That did not send",retry:"Retry"},Ze="ai-annotation-toolbar",Mt="2147483001",Qe=288,ze=190,D=12,Nt=`
|
|
1
|
+
var Fe=e=>{throw TypeError(e)};var Ve=(e,t,n)=>t.has(e)||Fe("Cannot "+n);var L=(e,t,n)=>(Ve(e,t,"read from private field"),n?n.call(e):t.get(e)),ye=(e,t,n)=>t.has(e)?Fe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),He=(e,t,n,r)=>(Ve(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var oe="1",kt="x-weatherboard-annotation-mode",Ct="first-party",ae="data-src",Te="data-src-name";function It(e){return e.selection==="region"?"region":"element"}function Nt(e){try{return JSON.stringify(e)??String(e)}catch{return"[unserialisable]"}}function Be(e,t){console.error(`[annotation] ${e}: protocol drift, nothing was acted on: ${Nt(t)}`)}var Mt=new Set(["annotate:enable","annotate:disable","annotate:ping"]);function xe(e){if(typeof e!="object"||e===null)return!1;let t=e.type;return typeof t=="string"&&Mt.has(t)}function Z(e){if(!e||e==="*")throw new Error("[annotation] a concrete parent origin is required; '*' would broadcast annotation payloads to any embedder.");return e}var $e="ai_annotate",ve="ai_annotate_armed",ie="ai_capture",se="ai_run",le="ai_read",We="1";function Pt(e=ve){return`${e}=${We}; Path=/; SameSite=Lax; Secure`}function Oe(e){return`${e}=; Path=/; SameSite=Lax; Secure; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT`}var Ge="pits_annotate",Ye="pits_annotate_armed",ue=[$e,Ge],ce=[ve,Ye];function Se(e){return e.split(";").some(t=>{let n=t.trimStart();return ce.some(r=>n.startsWith(`${r}=`))})}function Lt(e){for(let t of ue){let n=e.get(t);if(n!==null&&n.length>0)return n}return null}var Xe="ai-annotation-overlay",Ut="2147483000";function _e(e){let t=e.createElement("div");t.id=Xe,t.style.cssText=["position:fixed","top:0","left:0","pointer-events:none",`z-index:${Ut}`,"display:none","box-sizing:border-box","border:2px solid #2563eb","background:rgba(37,99,235,0.12)","border-radius:2px"].join(";");let n=e.createElement("div");return n.style.cssText=["position:absolute","left:0","top:-20px","font:11px/16px ui-monospace,SFMono-Regular,Menlo,monospace","color:#fff","background:#2563eb","padding:1px 5px","border-radius:2px","white-space:nowrap","max-width:60vw","overflow:hidden","text-overflow:ellipsis"].join(";"),t.appendChild(n),e.body.appendChild(t),{show(r,o){t.style.display="block",t.style.transform=`translate(${r.x}px, ${r.y}px)`,t.style.width=`${r.w}px`,t.style.height=`${r.h}px`,n.style.top=r.y<20?"100%":"-20px",n.textContent=o??"",n.style.display=o?"block":"none"},hide(){t.style.display="none"},destroy(){t.remove()},contains(r){return r instanceof Node&&t.contains(r)}}}var Re=200,qe=8;function we(e){if(!e)return null;let t=e.lastIndexOf(":");if(t<=0)return null;let n=e.lastIndexOf(":",t-1);if(n<=0)return null;let r=e.slice(0,n),o=Number(e.slice(n+1,t)),a=Number(e.slice(t+1));return!r||!Number.isFinite(o)||!Number.isFinite(a)?null:{file:r,line:o,column:a}}function je(e,t=qe){let n=[],r=e;for(;r&&n.length<t;){let o=we(r.getAttribute(ae));if(o){let a=n[n.length-1];a&&a.file===o.file&&a.line===o.line||n.push(o)}r=r.parentElement}return n}function Je(e){let t=e;for(;t;){if(we(t.getAttribute(ae)))return t;t=t.parentElement}return null}function Dt(e){let t=e.classList;return(typeof t?.value=="string"?t.value:"").split(/\s+/).filter(Boolean)}function ze(e,t=6){let n=[],r=e;for(;r&&n.length<t;){let o=(r.tagName||"").toLowerCase();if(!o||o==="html")break;let a=o;if(r.id)return n.unshift(`${o}#${r.id}`),n.join(" > ");let i=Dt(r).slice(0,2);if(i.length>0&&(a+=`.${i.join(".")}`),n.unshift(a),o==="body")break;r=r.parentElement}return n.join(" > ")}function Ze(e){if(!e)return;let t=e.replace(/\s+/g," ").trim();if(t)return t.length>Re?`${t.slice(0,Re-1)}\u2026`:t}function ke(e,t){let n=Je(e),r=je(e),o=r[0],a={domPath:ze(e),boundingBox:t.boundingBox};o&&(a.source=o),r.length>0&&(a.sourceChain=r);let i=n?.getAttribute(Te);i&&(a.componentName=i);let s=Ze(e.textContent);return s&&(a.textContent=s),a}var Kt=2048;function N(e){if(typeof e!="string"||e.length===0||e.length>Kt)return;let t;try{t=new URL(e)}catch{return}if(!(t.protocol!=="https:"&&t.protocol!=="http:"))return t.href}var Qe=300;function de(e){if(typeof e!="string")return;let t=e.replace(/[\u0000-\u001f\u007f-\u009f]+/g," ").replace(/\s+/g," ").trim();if(t.length!==0)return t.length>Qe?`${t.slice(0,Qe-1).trimEnd()}\u2026`:t}function Ce(e){return de(e?.reason)}function Ie(e,t=window){let n=Z(e);return{name:"postMessage",carries:()=>!0,send(r){t.parent.postMessage(r,n)}}}function et(e){if(!e||e==="*")throw new Error("[annotation] a concrete ingest endpoint is required; '*' is not an address and an empty one posts nowhere.");let t;try{t=new URL(e)}catch{throw new Error(`[annotation] the ingest endpoint must be an absolute URL, got ${JSON.stringify(e)}; a relative one resolves against the product's own origin and the capture is lost there.`)}if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error(`[annotation] the ingest endpoint must be http(s), got ${t.protocol}`);return t.toString()}var tt=8e3;function Ft(e){let t=et(e.endpoint);if(!e.captureToken)throw new Error("[annotation] a capture token is required; the ingest rejects an unsigned capture and the reviewer would only find out after writing one.");let n=e.captureToken,r=e.timeoutMs??tt,o=e.fetch??globalThis.fetch;return{name:"http",carries:a=>a==="annotate:capture",async send(a){if(!o)throw new Error("[annotation] no fetch implementation is available for the ingest");let i=new AbortController,s=setTimeout(()=>i.abort(),r);try{let c=await o(t,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n}`},credentials:"omit",body:JSON.stringify(a),signal:i.signal});if(!c.ok){let p;try{let f=await c.json?.();p=de(f?.error)}catch{p=void 0}let g=new Error(`[annotation] the ingest rejected the capture: ${p??`HTTP ${c.status}`}`);throw g.status=c.status,p!==void 0&&(g.reason=p),g}try{let p=await c.json?.(),g=N(p?.progressUrl);if(p?.kind==="saved"&&typeof p.feedbackId=="string"&&/^[a-zA-Z0-9-]{1,80}$/.test(p.feedbackId)){let u=N(p.recoveryUrl);return{...g?{progressUrl:g}:{},saved:{feedbackId:p.feedbackId,...u?{recoveryUrl:u}:{},message:de(p.error)??"Capture saved. Finish filing in the console."}}}let f=N(p?.issueUrl??p?.url);if(f!==void 0||g!==void 0)return{...f?{issueUrl:f}:{},...g?{progressUrl:g}:{}}}catch{}return{}}catch(c){throw i.signal.aborted?new Error(`[annotation] the capture timed out after ${r}ms`,{cause:c}):c}finally{clearTimeout(s)}}}}function Ne(e,t){let n=(r,o)=>{let a={message:r,transport:e.name,error:o};if(t){t(a);return}console.error("[annotation] a capture could not be delivered",a)};return async r=>{if(!e.carries(r.type))return{status:"declined"};try{return{status:"sent",receipt:await e.send(r)??{}}}catch(o){return n(r,o),{status:"failed",error:o}}}}var Vt=1600,Ht=1048576,Bt=23+4*Math.ceil(349525.3333333333),nt=4e3,$t=()=>import("./page-capture.mjs"),rt=48*1024,fe=480,ot=250,Wt=[{edge:fe,quality:.7},{edge:fe/2,quality:.5}],Gt=["image/webp","image/jpeg"];function Me(e,t){let n=e===!1?{enabled:!1}:e??{},r=n.createCanvas??(()=>t?.createElement("canvas")??null);return{enabled:n.enabled??!0,maxBytes:n.maxBytes??rt,maxEdge:n.maxEdge??fe,timeoutMs:n.timeoutMs??ot,createCanvas:r,doc:t??null,page:n.page??!0,maxViewportWidth:n.maxViewportWidth??1600,maxViewportBytes:n.maxViewportBytes??1048576,viewportTimeoutMs:n.viewportTimeoutMs??nt,loadRenderer:n.loadRenderer??null,readCanvas:n.readCanvas??null}}var Yt=new Set(["IMG","CANVAS","VIDEO"]),Xt="img,canvas,video",qt=4;function pe(e){return!!e&&Yt.has(e.tagName.toUpperCase())}function at(e,t=qt){if(!e)return null;if(pe(e))return e;let n=e.querySelector?.(Xt)??null;if(pe(n))return n;let r=e.parentElement??null;for(let o=0;r&&o<t;o++){if(pe(r))return r;r=r.parentElement??null}return null}function it(e){let t=e.tagName.toUpperCase(),n=t==="IMG"?{w:e.naturalWidth,h:e.naturalHeight}:t==="VIDEO"?{w:e.videoWidth,h:e.videoHeight}:{w:e.width,h:e.height},r=Math.floor(n.w??0),o=Math.floor(n.h??0);return!Number.isFinite(r)||!Number.isFinite(o)||r<1||o<1||t==="IMG"&&e.complete===!1?null:{w:r,h:o}}function st(e,t){let n=Math.min(1,t/Math.max(e.w,e.h));return{w:Math.max(1,Math.round(e.w*n)),h:Math.max(1,Math.round(e.h*n))}}function jt(e,t,n,r){let o;try{o=r.createCanvas()}catch{return null}if(!o)return null;try{o.width=t.w,o.height=t.h;let a=o.getContext("2d");if(!a)return null;a.drawImage(e,0,0,t.w,t.h);for(let i of Gt){let s;try{s=o.toDataURL(i,n)}catch{return null}if(!(typeof s!="string"||!s.startsWith(`data:${i}`)))return s.length<=r.maxBytes?s:null}return null}catch{return null}}function lt(e,t){if(!t.enabled)return null;let n=at(e);if(!n)return null;let r=it(n);if(!r)return null;for(let o of Wt){let a=st(r,Math.min(t.maxEdge,o.edge)),i=jt(n,a,o.quality,t);if(i)return{dataUrl:i,region:"element"}}return null}function Jt(e,t){let n=e.doc;return!e.page||n===null?Promise.resolve(null):new Promise(r=>{let o=!1,a=c=>{o||(o=!0,r(c))},i=setTimeout(()=>a(null),e.viewportTimeoutMs);i.unref?.();let s={maxWidth:e.maxViewportWidth,maxBytes:e.maxViewportBytes,createCanvas:e.createCanvas,loadRenderer:e.loadRenderer,readCanvas:e.readCanvas};$t().then(({captureViewport:c})=>c(n,s,t)).then(a,()=>a(null)).finally(()=>clearTimeout(i))})}async function ut(e,t,n=null){if(!t.enabled)return null;let r=await Jt(t,n);return r||zt(e,t)}function zt(e,t){return new Promise(n=>{let r=!1,o=i=>{r||(r=!0,n(i))},a=setTimeout(()=>o(null),t.timeoutMs);a.unref?.(),Promise.resolve().then(()=>lt(e,t)).then(o,()=>o(null)).finally(()=>clearTimeout(a))})}async function me(e,t,n,r=null){let o;try{o=await ut(t,n,r)}catch{o=null}return o?{...e,screenshot:o}:e}var Zt={consoleErrors:[],failedRequests:[],featureFlags:{}},Qt=()=>({...Zt});function Pe(e){let t=e.parentOrigin===void 0?null:Z(e.parentOrigin),n=window,r=n.document,o=Me(e.screenshot,r),a=!1,i=null,s=0,c=null,p=!1,g=e.transport??(t===null?null:Ie(t,n));if(g===null)throw new Error("[annotation] the SDK needs a `transport` or a `parentOrigin`; with neither there is nowhere for a capture to go and every one of them would be lost in silence.");let f=Ne(g,e.onEgressError),u=d=>{let m=d.getBoundingClientRect();return{x:m.x,y:m.y,w:m.width,h:m.height}},b=d=>ke(d,{boundingBox:u(d)}),A=d=>{if(d.componentName&&d.source){let m=d.source.file.split("/").pop()??d.source.file;return`${d.componentName} \xB7 ${m}:${d.source.line}`}return d.source?`${d.source.file}:${d.source.line}`:d.componentName??null},T=d=>{!a||p||s||(s=n.requestAnimationFrame(()=>{s=0;let m=r.elementFromPoint(d.clientX,d.clientY);if(!m||i&&i.contains(m)||e.ignoreElement?.(m)||m===c)return;c=m;let y=b(m);i?.show(y.boundingBox,A(y)),f({type:"annotate:hover",target:y})}))},w=(d,m)=>({schemaVersion:1,capturedAt:new Date().toISOString(),build:e.build,page:{url:n.location.href,route:e.getRoute(),viewport:{w:n.innerWidth,h:n.innerHeight,dpr:n.devicePixelRatio},userAgent:n.navigator.userAgent},target:b(d),state:{consoleErrors:m.consoleErrors,failedRequests:m.failedRequests,featureFlags:m.featureFlags},comment:""}),P=d=>{let m={type:"annotate:capture",payload:d},y=()=>{f(m).then(k=>e.onCaptureResult?.(k,y))};y()},C=d=>{if(!a)return;let m=d.target;if(!(m instanceof Element)||e.ignoreElement?.(m)||(d.preventDefault(),d.stopPropagation(),p))return;let y=w(m,e.getState()),k=e.collectComment;if(!k){if(!o.enabled){P(y);return}me(y,m,o,e.ignoreElement??null).then(_=>P(_),()=>P(y));return}let H={x:d.clientX,y:d.clientY},B=o.enabled?me(y,m,o,e.ignoreElement??null).then(_=>_,()=>y):Promise.resolve(y),$=()=>{p=!0;let _=null,W=k({target:y.target,point:H}).then(S=>S,S=>(_={error:S},null));Promise.all([B,W]).then(([S,G])=>{if(p=!1,_!==null){e.onCaptureResult?.({status:"failed",error:_.error},$);return}G!==null&&P(G===""?S:{...S,comment:G})})};$()},F=d=>{!a||p||d.key!=="Escape"||(f({type:"annotate:cancel"}),I())};function V(){a||(a=!0,i??(i=_e(r)),r.addEventListener("mousemove",T,!0),r.addEventListener("click",C,!0),r.addEventListener("keydown",F,!0))}function I(){a&&(a=!1,c=null,s&&(n.cancelAnimationFrame(s),s=0),r.removeEventListener("mousemove",T,!0),r.removeEventListener("click",C,!0),r.removeEventListener("keydown",F,!0),i?.hide())}let v=d=>{if(d.origin===t&&xe(d.data))switch(d.data.type){case"annotate:enable":V();break;case"annotate:disable":I();break;case"annotate:ping":f({type:"annotate:ready",sdkVersion:"1",build:e.build});break;default:{let m=d.data;Be("frame",m);break}}};return t!==null&&n.addEventListener("message",v),f({type:"annotate:ready",sdkVersion:"1",build:e.build}),{enable:V,disable:I,isEnabled:()=>a,destroy(){I(),t!==null&&n.removeEventListener("message",v),i?.destroy(),i=null}}}var U="ai.annotation.capture",D="ai.annotation.read",K="ai.annotation.run",en="ai.annotation.attempt",tn="__weatherboardAnnotationAttemptV1",nn="ai-annotation-startup-status";function ct(e,t,n){if(e!==null)try{delete e[tn]}catch{}if(t!==null)try{t.removeItem(en)}catch{}n?.getElementById?.(nn)?.remove()}var ge="ai.annotation.open",dt=600*1e3;var Y="ai_annotation_tokens",Le=300;function Q(e){if(!e)return null;let t=e.split(".");if(t[0]!=="v3"||t.length!==9&&t.length!==10)return null;let n=t[t.length-2];if(!n||!/^\d+$/.test(n))return null;let r=Number(n);return Number.isSafeInteger(r)?r:null}function he(e,t,n=Math.floor(Date.now()/1e3)){let r=Q(e);if(r===null||r-n<=Le)return!0;if(t!==null){let o=Q(t);if(o===null||o-n<=Le)return!0}return!1}function pt(e){let t=e.split(";").map(n=>n.trim()).find(n=>n.startsWith(`${Y}=`));return t?h(()=>{let n=JSON.parse(decodeURIComponent(t.slice(Y.length+1)));if(!n||typeof n!="object")return null;let r=n;return typeof r.captureToken!="string"||r.readToken!==null&&typeof r.readToken!="string"||r.runId!==null&&typeof r.runId!="string"?null:{captureToken:r.captureToken,readToken:r.readToken,runId:r.runId}},null):null}var ft=[...ue,ie,le,se];function h(e,t){try{return e()}catch{return t}}function rn(e){return h(()=>e?.sessionStorage??null,null)}function on(e={}){let t=e.doc??document,n=t.defaultView??null,r=e.storage===void 0?rn(n):e.storage,o=e.url??t.URL,a=h(()=>new URL(o),null),i=null,s=null,c=null;if(a!==null&&(i=a.searchParams.get(ie)||null,s=a.searchParams.get(le)||null,c=a.searchParams.get(se)||null,ft.some(b=>a.searchParams.has(b)))){for(let A of ft)a.searchParams.delete(A);let b=e.history??n?.history;h(()=>{b?.replaceState(n?.history?.state??null,"",a.toString())},void 0)}let p=()=>{h(()=>{t.cookie=`${Y}=; Max-Age=0; Secure; SameSite=Lax; Path=/`},void 0);for(let u of ce)h(()=>{t.cookie=Oe(u)},void 0);r&&(h(()=>r.removeItem(U),void 0),h(()=>r.removeItem(D),void 0),h(()=>r.removeItem(K),void 0)),ct(n,r,t)},g=Se(h(()=>t.cookie,""));if(!g)return pt(h(()=>t.cookie,""))&&h(()=>{t.cookie=`${Y}=; Max-Age=0; Secure; SameSite=Lax; Path=/`},void 0),{armed:!1,captureToken:null,readToken:null,runId:null,disarm:p};r&&(i!==null?h(()=>r.setItem(U,i),void 0):i=h(()=>r.getItem(U),null),s!==null?h(()=>r.setItem(D,s),void 0):s=h(()=>r.getItem(D),null),c!==null?h(()=>r.setItem(K,c),void 0):c=h(()=>r.getItem(K),null));let f=h(()=>t.cookie,"");if(i===null){let u=pt(f);u&&!he(u.captureToken,u.readToken)&&(i=u.captureToken,s??(s=u.readToken),c??(c=u.runId),r&&(h(()=>r.setItem(U,i),void 0),s&&h(()=>r.setItem(D,s),void 0),c&&h(()=>r.setItem(K,c),void 0)))}if(i!==null){let u=Q(i),b=s===null?null:Q(s),A=Math.floor(Date.now()/1e3),T=Math.min(u??0,s===null?1/0:b??0);if(T>A){let w=encodeURIComponent(JSON.stringify({captureToken:i,readToken:s,runId:c}));h(()=>{t.cookie=`${Y}=${w}; Max-Age=${T-A}; Secure; SameSite=Lax; Path=/`},void 0)}}return{armed:g,captureToken:i,readToken:s,runId:c,disarm:p}}var an=["preview","staging","development"];function Ee(e){return an.includes(e.env)}var mt="Mod+Shift+Period";function be(e,t){let n=t.split("+"),r=n.pop();if(!r||e.repeat||n.some(c=>!["Mod","Meta","Ctrl","Shift","Alt"].includes(c)))return!1;let o=n.includes("Mod"),a=n.includes("Meta"),i=n.includes("Ctrl");return(o?e.metaKey!==e.ctrlKey&&!a&&!i:e.metaKey===a&&e.ctrlKey===i)&&e.shiftKey===n.includes("Shift")&&e.altKey===n.includes("Alt")&&(e.code===r||e.key.toLowerCase()===r.toLowerCase()||r==="Period"&&e.key===".")}var ht={region:"Annotation",expand:"Open the annotation toolbar",collapse:"Close the annotation toolbar",start:"Start annotating",stop:"Stop annotating",done:"Done",comment:"What is wrong here?",placeholder:"The heading wraps onto three lines on mobile\u2026",send:"Send",cancel:"Cancel",sent:"Sent",issue:"View issue",failed:"That did not send",retry:"Retry"},Et="ai-annotation-toolbar",sn="2147483001",bt=288,gt=190,X=12,ln=`
|
|
2
2
|
:host{
|
|
3
3
|
--ai-bg:#fff;
|
|
4
4
|
--ai-fg:#18181b;
|
|
@@ -18,7 +18,7 @@ var Re=e=>{throw TypeError(e)};var _e=(e,t,n)=>t.has(e)||Re("Cannot "+n);var L=(
|
|
|
18
18
|
--ai-radius-control:6px;
|
|
19
19
|
--ai-radius-card:8px;
|
|
20
20
|
--ai-radius-pill:999px;
|
|
21
|
-
all:initial;position:fixed;right:16px;bottom:16px;z-index:${
|
|
21
|
+
all:initial;position:fixed;right:16px;bottom:16px;z-index:${sn};
|
|
22
22
|
font:13px/1.45 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
|
|
23
23
|
color-scheme:light}
|
|
24
24
|
*,*::before,*::after{box-sizing:border-box}
|
|
@@ -41,7 +41,7 @@ button:focus-visible{outline:2px solid var(--ai-accent);outline-offset:2px}
|
|
|
41
41
|
padding:var(--ai-space-2)}
|
|
42
42
|
.toggle[aria-pressed="true"]{background:var(--ai-accent);border-color:var(--ai-accent);
|
|
43
43
|
color:var(--ai-invert-fg)}
|
|
44
|
-
.composer{position:fixed;width:${
|
|
44
|
+
.composer{position:fixed;width:${bt}px;background:var(--ai-bg);color:var(--ai-fg);
|
|
45
45
|
border:1px solid var(--ai-line);border-radius:var(--ai-radius-card);
|
|
46
46
|
padding:var(--ai-space-4);display:flex;flex-direction:column;gap:var(--ai-space-3)}
|
|
47
47
|
.where{margin:0;font:11px/16px ui-monospace,SFMono-Regular,Menlo,monospace;
|
|
@@ -61,5 +61,5 @@ textarea:focus-visible{outline:2px solid var(--ai-accent);outline-offset:1px}
|
|
|
61
61
|
.toast a{color:var(--ai-invert-fg)}
|
|
62
62
|
.toast button{background:transparent;border-color:var(--ai-invert-line);
|
|
63
63
|
color:var(--ai-invert-fg)}
|
|
64
|
-
`;function h(e,t,n){let r=e.createElement(t);if(n)for(let o of Object.keys(n))r.setAttribute(o,n[o]??"");return r}function et(e={}){let t={...Je,...e.labels},n=e.doc??document,r=e.win??window;if(e.armed===!1)return{owns:()=>!1,attach:()=>{},collectComment:()=>Promise.resolve(""),showResult:()=>{},isExpanded:()=>!1,destroy:()=>{}};let o=h(n,"div",{id:Ze}),a=o.attachShadow({mode:"open"}),s=h(n,"style");s.textContent=Nt,a.appendChild(s);let c=h(n,"style");a.appendChild(c);let f=h(n,"div",{id:"ai-annotation-bar",class:"bar",role:"region","aria-label":t.region}),m=h(n,"div",{class:"panel",id:"ai-annotation-panel",hidden:""}),g=h(n,"button",{type:"button",id:"ai-annotation-toggle",class:"toggle","aria-pressed":"false"});g.textContent=t.start;let p=h(n,"button",{type:"button",id:"ai-annotation-done"});p.textContent=t.done,m.appendChild(g),m.appendChild(p);let u=h(n,"button",{type:"button",id:"ai-annotation-pill",class:"pill","aria-expanded":"false","aria-controls":"ai-annotation-panel","aria-label":t.expand}),A=h(n,"span",{class:"dot","aria-hidden":"true"}),T=h(n,"span");T.textContent=t.region,u.appendChild(A),u.appendChild(T),f.appendChild(u),f.appendChild(m),a.appendChild(f);let x=h(n,"div",{id:"ai-annotation-composer",class:"composer",role:"dialog","aria-modal":"false","aria-labelledby":"ai-annotation-comment",hidden:""}),R=h(n,"p",{class:"where"}),N=h(n,"label",{id:"ai-annotation-comment",for:"ai-annotation-input"});N.textContent=t.comment;let _=h(n,"textarea",{id:"ai-annotation-input",placeholder:t.placeholder,rows:"3"}),P=h(n,"button",{type:"button",id:"ai-annotation-cancel"});P.textContent=t.cancel;let F=h(n,"button",{type:"button",id:"ai-annotation-send",class:"primary"});F.textContent=t.send;let k=h(n,"div",{class:"row"});k.appendChild(P),k.appendChild(F),x.appendChild(R),x.appendChild(N),x.appendChild(_),x.appendChild(k),a.appendChild(x);let S=h(n,"div",{id:"ai-annotation-toast",class:"toast",role:"status",hidden:""}),l=h(n,"span"),d=h(n,"a",{id:"ai-annotation-issue",target:"_blank",rel:"noopener noreferrer",hidden:""}),b=h(n,"button",{type:"button",id:"ai-annotation-retry",hidden:""});b.textContent=t.retry,S.appendChild(l),S.appendChild(d),S.appendChild(b),a.appendChild(S),n.body.appendChild(o);let O=null,H=!1,K=null,I=null,C=null,W=()=>{},y=(i,E)=>{E?i.removeAttribute("hidden"):i.setAttribute("hidden","")},U=i=>{H=i,y(m,i),u.setAttribute("aria-expanded",String(i)),u.setAttribute("aria-label",i?t.collapse:t.expand)},ie=i=>{g.setAttribute("aria-pressed",String(i)),g.textContent=i?t.stop:t.start,f.setAttribute("class",i?"bar on":"bar"),i?O?.enable():O?.disable()};u.addEventListener("click",()=>U(!H)),g.addEventListener("click",()=>{ie(O?.isEnabled()!==!0)});let Oe=()=>{C!==null&&clearTimeout(C),$(null),o.remove()};p.addEventListener("click",()=>{ie(!1),U(!1),e.onDone?.(),Oe()});let $=i=>{let E=K;K=null,y(x,!1),E&&E(i),I instanceof HTMLElement&&I.focus(),I=null};P.addEventListener("click",()=>$(null)),F.addEventListener("click",()=>$(_.value)),x.addEventListener("keydown",i=>{if(i.key==="Escape"){i.stopPropagation(),$(null);return}i.key==="Enter"&&(i.metaKey||i.ctrlKey)&&(i.preventDefault(),$(_.value))});let at=i=>new Promise(E=>{K=E,_.value="",R.textContent=it(i),st(i),y(S,!1),y(x,!0),I=n.activeElement,_.focus()});function it(i){let{source:E,componentName:w}=i.target;return E?`${E.file}:${E.line}`:w??""}function st(i){let E=i.target.boundingBox,w=E.y+E.h+D,B=w+ze<=r.innerHeight?w:Math.max(D,E.y-ze-D),se=Math.min(Math.max(D,E.x),Math.max(D,r.innerWidth-Qe-D));c.textContent=`.composer{left:${Math.round(se)}px;top:${Math.round(B)}px}`}let lt=(i,E)=>{C!==null&&clearTimeout(C);let w=i.status==="sent",B=i.status==="sent"?ee(i.receipt.issueUrl):void 0;S.setAttribute("class",w?"toast":"toast bad"),S.setAttribute("role",w?"status":"alert");let se=w?void 0:ye(i.error);l.textContent=w?t.sent:se??t.failed,y(d,w&&B!==void 0),B!==void 0&&(d.setAttribute("href",B),d.textContent=t.issue),y(b,!w),y(S,!0),w&&(C=setTimeout(()=>y(S,!1),6e3)),W=E};return b.addEventListener("click",()=>{y(S,!1),W()}),{owns:i=>i instanceof Node&&(i===o||o.contains(i)),attach:i=>{O=i,ie(i.isEnabled())},collectComment:at,showResult:lt,isExpanded:()=>H,destroy:Oe}}function It(e){let t=e.toolbar?.armed;if(e.arming&&t!==void 0)throw new Error("[annotation] pass `arming` OR `toolbar.armed`, not both; two answers to whether this page may offer an annotation UI is how one of them stops being checked.");let n=(e.arming?e.arming.armed:t)!==!1&&Se(e.build),r=et({...e.toolbar,armed:n,onDone:()=>{e.arming?.disarm(),o.destroy(),e.toolbar?.onDone?.()}}),o=ve({...e,collectComment:r.collectComment,onCaptureResult:r.showResult,ignoreElement:r.owns});return r.attach(o),{sdk:o,toolbar:r,destroy(){r.destroy(),o.destroy()}}}var Lt=20;var M,G,X=class{constructor(t=20){le(this,M,[]);le(this,G);ke(this,G,Math.max(1,t))}push(t){L(this,M).push(t),L(this,M).length>L(this,G)&&L(this,M).shift()}toArray(){return[...L(this,M)]}get size(){return L(this,M).length}};M=new WeakMap,G=new WeakMap;function tt(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="object")try{return JSON.stringify(e)??String(e)}catch{try{return`[${Object.getPrototypeOf(e)?.constructor?.name??"object"}]`}catch{return"[object]"}}try{return String(e)}catch{return"[unrenderable]"}}var nt=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;function rt(e){return nt(e.map(tt).join(" "),500)}function Ce(e){for(let t of e)if(t instanceof Error&&typeof t.stack=="string")return nt(t.stack,2e3)}function we(e){return e===0||e<200||e>=300}var ot=()=>({limit:20,getFeatureFlags:()=>({}),now:()=>new Date().toISOString()});function Pt(e,t=ot()){let n=new X(t.limit),r=new X(t.limit),o=(p,u)=>{n.push({level:p,message:rt(u),...Ce(u)?{stack:Ce(u)}:{},at:t.now()})},a=e.console.error,s=e.console.warn;e.console.error=function(...u){try{o("error",u)}catch{}return a.apply(e.console,u)},e.console.warn=function(...u){try{o("warn",u)}catch{}return s.apply(e.console,u)};let c=e.fetch,f=(p,u)=>{let A=typeof p=="string"?p:p instanceof URL?p.href:p?.url??String(p),T=u?.method??p?.method??"GET";return{url:A,method:T.toUpperCase()}};typeof c=="function"&&(e.fetch=async function(u,A){try{let T=await c.call(e,u,A);if(we(T.status)){let{url:x,method:R}=f(u,A);r.push({url:x,method:R,status:T.status,at:t.now()})}return T}catch(T){let{url:x,method:R}=f(u,A);throw r.push({url:x,method:R,status:0,at:t.now()}),T}});let m=e.XMLHttpRequest,g=m?.prototype?.open;return typeof g=="function"&&(m.prototype.open=function(u,A,...T){return this.__aiAnnotateMethod=u.toUpperCase(),this.__aiAnnotateUrl=String(A),this.addEventListener("loadend",()=>{try{we(this.status)&&r.push({url:this.__aiAnnotateUrl??"",method:this.__aiAnnotateMethod??"GET",status:this.status,at:t.now()})}catch{}}),g.apply(this,[u,A,...T])}),{getState(){return{consoleErrors:n.toArray(),failedRequests:r.toArray(),featureFlags:t.getFeatureFlags()}},destroy(){e.console.error=a,e.console.warn=s,typeof c=="function"&&(e.fetch=c),typeof g=="function"&&(m.prototype.open=g)}}}export{de as ANNOTATION_ARMED_COOKIE,Q as ANNOTATION_ARMED_COOKIES,Ne as ANNOTATION_ARMED_VALUE,Me as ANNOTATION_TOKEN_PARAM,Z as ANNOTATION_TOKEN_PARAMS,Y as CAPTURE_TOKEN_PARAM,re as CAPTURE_TOKEN_STORAGE_KEY,Je as DEFAULT_LABELS,Lt as DEFAULT_LIMIT,qe as HTTP_TRANSPORT_TIMEOUT_MS,Le as LEGACY_ANNOTATION_ARMED_COOKIE,Ie as LEGACY_ANNOTATION_TOKEN_PARAM,Fe as MAX_CHAIN,bt as MAX_SCREENSHOT_BYTES,Et as MAX_SCREENSHOT_EDGE,ge as MAX_TEXT,ce as NAME_ATTR,Pe as OVERLAY_ID,J as READ_TOKEN_PARAM,ae as READ_TOKEN_STORAGE_KEY,z as REVIEW_RUN_PARAM,oe as REVIEW_RUN_STORAGE_KEY,X as RingBuffer,yt as SCREENSHOT_TIMEOUT_MS,j as SDK_VERSION,V as SRC_ATTR,Ze as TOOLBAR_ID,dt as armedCookie,Be as assertConcreteEndpoint,q as assertConcreteOrigin,ne as attachScreenshot,Ve as captureScreenshot,je as captureScreenshotSync,pe as clearedCookie,Ue as collectSourceChain,ve as createAnnotationSdk,et as createAnnotationToolbar,xe as createEgress,me as createOverlay,ot as defaultStateCollectorOptions,tt as describeArg,He as domPath,Ot as emptyAnnotationState,De as findAnnotatedAncestor,Xe as findCaptureSource,Ce as firstStack,We as fitWithin,rt as formatConsoleArgs,ht as httpTransport,Pt as installStateCollector,Ge as intrinsicSize,Se as isAnnotatableBuild,fe as isAnnotationArmed,we as isFailedStatus,te as isMediaElement,ue as isParentMessage,It as mountAnnotation,he as parseSourceRef,Ae as postMessageTransport,pt as readAnnotationToken,_t as readArming,ye as refusalReason,Te as resolveScreenshotOptions,be as resolveTarget,ee as safeIssueUrl,Ee as safeRefusalReason,ct as selectionOf,Ke as summariseText};
|
|
64
|
+
`;function E(e,t,n){let r=e.createElement(t);if(n)for(let o of Object.keys(n))r.setAttribute(o,n[o]??"");return r}function At(e={}){let t={...ht,...e.labels},n=e.doc??document,r=e.win??window;if(e.armed===!1)return{owns:()=>!1,attach:()=>{},collectComment:()=>Promise.resolve(""),showResult:()=>{},isExpanded:()=>!1,setVisible:()=>{},isVisible:()=>!1,destroy:()=>{}};let o=E(n,"div",{id:Et}),a=o.attachShadow({mode:"open"}),i=E(n,"style");i.textContent=ln,a.appendChild(i);let s=E(n,"style");a.appendChild(s);let c=E(n,"div",{id:"ai-annotation-bar",class:"bar",role:"region","aria-label":t.region}),p=E(n,"div",{class:"panel",id:"ai-annotation-panel",hidden:""}),g=E(n,"button",{type:"button",id:"ai-annotation-toggle",class:"toggle","aria-pressed":"false"});g.textContent=t.start;let f=E(n,"button",{type:"button",id:"ai-annotation-done"});f.textContent=t.done,p.appendChild(g),p.appendChild(f);let u=E(n,"button",{type:"button",id:"ai-annotation-pill",class:"pill","aria-expanded":"false","aria-controls":"ai-annotation-panel","aria-label":t.expand}),b=E(n,"span",{class:"dot","aria-hidden":"true"}),A=E(n,"span");A.textContent=t.region,u.appendChild(b),u.appendChild(A),c.appendChild(u),c.appendChild(p),a.appendChild(c);let T=E(n,"div",{id:"ai-annotation-composer",class:"composer",role:"dialog","aria-modal":"false","aria-labelledby":"ai-annotation-comment",hidden:""}),w=E(n,"p",{class:"where"}),P=E(n,"label",{id:"ai-annotation-comment",for:"ai-annotation-input"});P.textContent=t.comment;let C=E(n,"textarea",{id:"ai-annotation-input",placeholder:t.placeholder,rows:"3"}),F=E(n,"button",{type:"button",id:"ai-annotation-cancel"});F.textContent=t.cancel;let V=E(n,"button",{type:"button",id:"ai-annotation-send",class:"primary"});V.textContent=t.send;let I=E(n,"div",{class:"row"});I.appendChild(F),I.appendChild(V),T.appendChild(w),T.appendChild(P),T.appendChild(C),T.appendChild(I),a.appendChild(T);let v=E(n,"div",{id:"ai-annotation-toast",class:"toast",role:"status",hidden:""}),d=E(n,"span"),m=E(n,"a",{id:"ai-annotation-progress",target:"_blank",rel:"noopener noreferrer",hidden:""});m.textContent="View progress";let y=E(n,"a",{id:"ai-annotation-recovery",target:"_blank",rel:"noopener noreferrer",hidden:""});y.textContent="Open saved capture";let k=E(n,"a",{id:"ai-annotation-issue",target:"_blank",rel:"noopener noreferrer",hidden:""});k.textContent=t.issue;let H=E(n,"button",{type:"button",id:"ai-annotation-retry",hidden:""});H.textContent=t.retry,v.appendChild(d),v.appendChild(m),v.appendChild(y),v.appendChild(k),v.appendChild(H),a.appendChild(v),e.dormant||n.body.appendChild(o);let B=null,$=!1,_=null,W=null,S=null,G=()=>{},R=(l,x)=>{x?l.removeAttribute("hidden"):l.setAttribute("hidden","")},ne=l=>{$=l,R(p,l),u.setAttribute("aria-expanded",String(l)),u.setAttribute("aria-label",l?t.collapse:t.expand)},re=l=>{g.setAttribute("aria-pressed",String(l)),g.textContent=l?t.stop:t.start,c.setAttribute("class",l?"bar on":"bar"),l?B?.enable():B?.disable()};u.addEventListener("click",()=>ne(!$)),g.addEventListener("click",()=>{re(B?.isEnabled()!==!0)});let Ke=()=>{S!==null&&clearTimeout(S),q(null),o.remove()};f.addEventListener("click",()=>{re(!1),ne(!1),e.onDone?.(),Ke()});let q=l=>{let x=_;_=null,R(T,!1),x&&x(l),W instanceof HTMLElement&&W.focus(),W=null};F.addEventListener("click",()=>q(null)),V.addEventListener("click",()=>q(C.value)),T.addEventListener("keydown",l=>{if(l.key==="Escape"){l.stopPropagation(),q(null);return}l.key==="Enter"&&(l.metaKey||l.ctrlKey)&&(l.preventDefault(),q(C.value))});let Ot=l=>new Promise(x=>{_=x,C.value="",w.textContent=St(l),_t(l),R(v,!1),R(T,!0),W=n.activeElement,C.focus()});function St(l){let{source:x,componentName:O}=l.target;return x?`${x.file}:${x.line}`:O??""}function _t(l){let x=l.target.boundingBox,O=x.y+x.h+X,j=O+gt<=r.innerHeight?O:Math.max(X,x.y-gt-X),J=Math.min(Math.max(X,x.x),Math.max(X,r.innerWidth-bt-X));s.textContent=`.composer{left:${Math.round(J)}px;top:${Math.round(j)}px}`}let Rt=(l,x)=>{S!==null&&clearTimeout(S),o.parentElement!==n.body&&n.body.appendChild(o);let O=l.status==="sent",j=l.status==="sent"?N(l.receipt.issueUrl):void 0,J=l.status==="sent"?N(l.receipt.progressUrl):void 0;v.setAttribute("class",O?"toast":"toast bad"),v.setAttribute("role",O?"status":"alert");let wt=O?void 0:Ce(l.error),z=l.status==="sent"?l.receipt.saved:void 0;d.textContent=z?`${z.message} Capture ID: ${z.feedbackId}`:O?t.sent:wt??t.failed;let Ae=N(z?.recoveryUrl);R(m,O&&J!==void 0),R(y,O&&Ae!==void 0),R(k,O&&j!==void 0),J&&m.setAttribute("href",J),Ae&&y.setAttribute("href",Ae),j&&k.setAttribute("href",j),R(H,!O),R(v,!0),O&&!z&&(S=setTimeout(()=>R(v,!1),6e3)),G=x};return H.addEventListener("click",()=>{R(v,!1),G()}),{owns:l=>l instanceof Node&&(l===o||o.contains(l)),attach:l=>{B=l,re(l.isEnabled())},collectComment:Ot,showResult:Rt,isExpanded:()=>$,setVisible:l=>{l?(o.parentElement!==n.body&&n.body.appendChild(o),ne(!0)):(re(!1),ne(!1),o.remove())},isVisible:()=>o.parentElement===n.body,destroy:Ke}}function un(e){let t=e.hotkey??null,n=e.toolbar?.doc??document,r=()=>{try{let f=(n.defaultView??window).sessionStorage,u=Number(f.getItem(ge));return f.removeItem(ge),u>0&&Date.now()-u<dt}catch{return!1}},o=!0,a=e.toolbar?.armed;if(e.arming&&a!==void 0)throw new Error("[annotation] pass `arming` OR `toolbar.armed`, not both; two answers to whether this page may offer an annotation UI is how one of them stops being checked.");let i=(e.arming?e.arming.armed:a)!==!1&&Ee(e.build),s=At({...e.toolbar,armed:i,dormant:t!==null,onDone:()=>{o=!1,t&&n.removeEventListener("keydown",p,!0),e.arming?.disarm(),c.destroy(),e.toolbar?.onDone?.()}}),c=Pe({...e,collectComment:s.collectComment,onCaptureResult:s.showResult,ignoreElement:s.owns});s.attach(c);let p=f=>{!o||!t||!be(f,t)||!Ee(e.build)||g()||(f.preventDefault(),s.setVisible(!s.isVisible()))},g=()=>!!e.arming&&(!e.arming.armed||he(e.arming.captureToken,e.arming.readToken));return t&&(n.addEventListener("keydown",p,!0),i&&!g()&&r()&&s.setVisible(!0)),{sdk:c,toolbar:s,destroy(){o=!1,t&&n.removeEventListener("keydown",p,!0),s.destroy(),c.destroy()}}}var cn=20;var M,te,ee=class{constructor(t=20){ye(this,M,[]);ye(this,te);He(this,te,Math.max(1,t))}push(t){L(this,M).push(t),L(this,M).length>L(this,te)&&L(this,M).shift()}toArray(){return[...L(this,M)]}get size(){return L(this,M).length}};M=new WeakMap,te=new WeakMap;function yt(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="object")try{return JSON.stringify(e)??String(e)}catch{try{return`[${Object.getPrototypeOf(e)?.constructor?.name??"object"}]`}catch{return"[object]"}}try{return String(e)}catch{return"[unrenderable]"}}var Tt=(e,t)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e;function xt(e){return Tt(e.map(yt).join(" "),500)}function Ue(e){for(let t of e)if(t instanceof Error&&typeof t.stack=="string")return Tt(t.stack,2e3)}function De(e){return e===0||e<200||e>=300}var vt=()=>({limit:20,getFeatureFlags:()=>({}),now:()=>new Date().toISOString()});function dn(e,t=vt()){let n=new ee(t.limit),r=new ee(t.limit),o=(f,u)=>{n.push({level:f,message:xt(u),...Ue(u)?{stack:Ue(u)}:{},at:t.now()})},a=e.console.error,i=e.console.warn;e.console.error=function(...u){try{o("error",u)}catch{}return a.apply(e.console,u)},e.console.warn=function(...u){try{o("warn",u)}catch{}return i.apply(e.console,u)};let s=e.fetch,c=(f,u)=>{let b=typeof f=="string"?f:f instanceof URL?f.href:f?.url??String(f),A=u?.method??f?.method??"GET";return{url:b,method:A.toUpperCase()}};typeof s=="function"&&(e.fetch=async function(u,b){try{let A=await s.call(e,u,b);if(De(A.status)){let{url:T,method:w}=c(u,b);r.push({url:T,method:w,status:A.status,at:t.now()})}return A}catch(A){let{url:T,method:w}=c(u,b);throw r.push({url:T,method:w,status:0,at:t.now()}),A}});let p=e.XMLHttpRequest,g=p?.prototype?.open;return typeof g=="function"&&(p.prototype.open=function(u,b,...A){return this.__aiAnnotateMethod=u.toUpperCase(),this.__aiAnnotateUrl=String(b),this.addEventListener("loadend",()=>{try{De(this.status)&&r.push({url:this.__aiAnnotateUrl??"",method:this.__aiAnnotateMethod??"GET",status:this.status,at:t.now()})}catch{}}),g.apply(this,[u,b,...A])}),{getState(){return{consoleErrors:n.toArray(),failedRequests:r.toArray(),featureFlags:t.getFeatureFlags()}},destroy(){e.console.error=a,e.console.warn=i,typeof s=="function"&&(e.fetch=s),typeof g=="function"&&(p.prototype.open=g)}}}export{ve as ANNOTATION_ARMED_COOKIE,ce as ANNOTATION_ARMED_COOKIES,We as ANNOTATION_ARMED_VALUE,kt as ANNOTATION_MODE_HEADER,ge as ANNOTATION_OPEN_INTENT_STORAGE_KEY,Y as ANNOTATION_TOKENS_COOKIE,$e as ANNOTATION_TOKEN_PARAM,ue as ANNOTATION_TOKEN_PARAMS,ie as CAPTURE_TOKEN_PARAM,U as CAPTURE_TOKEN_STORAGE_KEY,mt as DEFAULT_HOTKEY,ht as DEFAULT_LABELS,cn as DEFAULT_LIMIT,Ct as FIRST_PARTY_ANNOTATION_MODE,tt as HTTP_TRANSPORT_TIMEOUT_MS,Ye as LEGACY_ANNOTATION_ARMED_COOKIE,Ge as LEGACY_ANNOTATION_TOKEN_PARAM,qe as MAX_CHAIN,rt as MAX_SCREENSHOT_BYTES,fe as MAX_SCREENSHOT_EDGE,Re as MAX_TEXT,Bt as MAX_VIEWPORT_DATA_URL_LENGTH,Ht as MAX_VIEWPORT_IMAGE_BYTES,Vt as MAX_VIEWPORT_WIDTH,Te as NAME_ATTR,Xe as OVERLAY_ID,le as READ_TOKEN_PARAM,D as READ_TOKEN_STORAGE_KEY,Le as REARM_BEFORE_EXPIRY_S,se as REVIEW_RUN_PARAM,K as REVIEW_RUN_STORAGE_KEY,ee as RingBuffer,ot as SCREENSHOT_TIMEOUT_MS,oe as SDK_VERSION,ae as SRC_ATTR,Et as TOOLBAR_ID,nt as VIEWPORT_TIMEOUT_MS,Pt as armedCookie,et as assertConcreteEndpoint,Z as assertConcreteOrigin,me as attachScreenshot,ut as captureScreenshot,lt as captureScreenshotSync,Oe as clearedCookie,je as collectSourceChain,Pe as createAnnotationSdk,At as createAnnotationToolbar,Ne as createEgress,_e as createOverlay,vt as defaultStateCollectorOptions,yt as describeArg,ze as domPath,Qt as emptyAnnotationState,Je as findAnnotatedAncestor,at as findCaptureSource,Ue as firstStack,st as fitWithin,xt as formatConsoleArgs,Ft as httpTransport,dn as installStateCollector,it as intrinsicSize,Ee as isAnnotatableBuild,Se as isAnnotationArmed,De as isFailedStatus,pe as isMediaElement,xe as isParentMessage,be as matchesHotkey,un as mountAnnotation,he as needsArming,we as parseSourceRef,Ie as postMessageTransport,Lt as readAnnotationToken,on as readArming,Ce as refusalReason,Me as resolveScreenshotOptions,ke as resolveTarget,N as safeIssueUrl,de as safeRefusalReason,It as selectionOf,Ze as summariseText,Q as tokenExpiry};
|
|
65
65
|
//# sourceMappingURL=index.mjs.map
|