deictic 0.2.0 → 0.3.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/API.md +303 -0
- package/README.md +56 -127
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +117 -7
- package/dist/client/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logs/client.d.ts +4 -0
- package/dist/logs/client.d.ts.map +1 -0
- package/dist/logs/client.js +16 -0
- package/dist/logs/client.js.map +1 -0
- package/dist/logs/index.d.ts +18 -0
- package/dist/logs/index.d.ts.map +1 -0
- package/dist/logs/index.js +21 -0
- package/dist/logs/index.js.map +1 -0
- package/dist/network/client.d.ts +4 -0
- package/dist/network/client.d.ts.map +1 -0
- package/dist/network/client.js +29 -0
- package/dist/network/client.js.map +1 -0
- package/dist/network/index.d.ts +2 -0
- package/dist/network/index.js +39 -0
- package/dist/network/index.js.map +1 -0
- package/dist/recommended/index.d.ts +13 -3
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +8 -1
- package/dist/recommended/index.js.map +1 -1
- package/dist/recordings/client.d.ts +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +175 -46
- package/dist/recordings/client.js.map +1 -1
- package/dist/recordings/index.d.ts +2 -2
- package/dist/screenshots/client.d.ts +6 -0
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/client.js +34 -2
- package/dist/screenshots/client.js.map +1 -1
- package/dist/screenshots/dom.d.ts.map +1 -1
- package/dist/screenshots/dom.js +1 -28
- package/dist/screenshots/dom.js.map +1 -1
- package/dist/screenshots/index.js.map +1 -1
- package/dist/screenshots/rrweb.d.ts +1 -1
- package/dist/screenshots/rrweb.js +5 -1
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/index.d.ts +14 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index2.d.ts +2 -0
- package/dist/shared/index2.d.ts.map +1 -1
- package/dist/shared/index3.d.ts +29 -3
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index4.d.ts +52 -172
- package/dist/shared/index4.d.ts.map +1 -1
- package/dist/shared/index5.d.ts +208 -58
- package/dist/shared/index5.d.ts.map +1 -1
- package/dist/shared/index6.d.ts +70 -0
- package/dist/shared/index6.d.ts.map +1 -0
- package/dist/shared/marks.js +6 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/mask.js +107 -0
- package/dist/shared/mask.js.map +1 -0
- package/dist/shared/playwright.js +19 -4
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/recordings.js +219 -28
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/tasks.js +145 -34
- package/dist/shared/tasks.js.map +1 -1
- package/dist/tailwind/client.d.ts +1 -1
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tasks/client.d.ts +1 -1
- package/dist/tasks/client.d.ts.map +1 -1
- package/dist/tasks/client.js +271 -56
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +2 -2
- package/dist/voice/client.d.ts.map +1 -1
- package/dist/voice/client.js +35 -14
- package/dist/voice/client.js.map +1 -1
- package/dist/voice/index.d.ts +6 -1
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +12 -2
- package/dist/voice/index.js.map +1 -1
- package/package.json +41 -2
- package/skills/deictic/SKILL.md +20 -14
- package/skills/deictic/references/install.md +18 -11
- package/skills/deictic/references/recordings.md +29 -0
- package/skills/deictic/references/tasks.md +49 -21
- package/skills/deictic/references/watch.md +38 -11
- package/skills/deictic/scripts/lib.mjs +69 -3
- package/skills/deictic/scripts/recording.mjs +84 -4
- package/skills/deictic/scripts/task.mjs +36 -7
- package/skills/deictic/scripts/vb.mjs +12 -0
- package/skills/deictic/scripts/watch.mjs +74 -10
- package/src/client/away.ts +105 -0
- package/src/client/index.ts +40 -9
- package/src/client/style.ts +1 -0
- package/src/index.ts +14 -2
- package/src/plugins/logs/client.ts +18 -0
- package/src/plugins/logs/index.ts +55 -0
- package/src/plugins/network/client.ts +30 -0
- package/src/plugins/network/index.ts +69 -0
- package/src/plugins/network/mask.ts +133 -0
- package/src/plugins/recommended/index.ts +14 -1
- package/src/plugins/recordings/client.ts +219 -40
- package/src/plugins/recordings/index.ts +108 -23
- package/src/plugins/recordings/marks.ts +6 -0
- package/src/plugins/recordings/replay.ts +127 -4
- package/src/plugins/screenshots/client.ts +35 -0
- package/src/plugins/screenshots/dom.ts +1 -32
- package/src/plugins/screenshots/index.ts +2 -0
- package/src/plugins/screenshots/playwright.ts +15 -4
- package/src/plugins/screenshots/rrweb.ts +2 -1
- package/src/plugins/tasks/client.ts +273 -41
- package/src/plugins/tasks/index.ts +155 -39
- package/src/plugins/tasks/watchers.ts +36 -0
- package/src/plugins/voice/client.ts +33 -11
- package/src/plugins/voice/index.ts +21 -4
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,80 @@
|
|
|
1
1
|
import { r as gestureOf } from "../shared/shortcut.js";
|
|
2
2
|
import { n as liveWaveform, r as peaksOf, t as drawBars } from "../shared/waveform.js";
|
|
3
|
+
// src/client/away.ts
|
|
4
|
+
const KEY = "deictic:away";
|
|
5
|
+
const STORE = "away";
|
|
6
|
+
/** How long one nobody came back to is kept, in milliseconds: its tab was closed. */
|
|
7
|
+
const STALE = 864e5;
|
|
8
|
+
/** One at a time, in the order asked: a `drop` right after a `keep` must not run before it. */
|
|
9
|
+
let last = Promise.resolve();
|
|
10
|
+
function store(mode, work) {
|
|
11
|
+
const next = last.catch(() => {}).then(() => new Promise((done, fail) => {
|
|
12
|
+
const opening = indexedDB.open("deictic", 1);
|
|
13
|
+
opening.addEventListener("upgradeneeded", () => opening.result.createObjectStore(STORE));
|
|
14
|
+
opening.addEventListener("error", () => fail(opening.error));
|
|
15
|
+
opening.addEventListener("success", () => {
|
|
16
|
+
const db = opening.result;
|
|
17
|
+
const transaction = db.transaction(STORE, mode);
|
|
18
|
+
transaction.addEventListener("complete", () => db.close());
|
|
19
|
+
transaction.addEventListener("abort", () => db.close());
|
|
20
|
+
try {
|
|
21
|
+
const request = work(transaction.objectStore(STORE));
|
|
22
|
+
request.addEventListener("error", () => fail(request.error));
|
|
23
|
+
request.addEventListener("success", () => done(request.result));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
fail(e);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
last = next;
|
|
30
|
+
return next;
|
|
31
|
+
}
|
|
32
|
+
const keyOf = () => {
|
|
33
|
+
try {
|
|
34
|
+
return sessionStorage.getItem(KEY) ?? void 0;
|
|
35
|
+
} catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/** Keeps it for the tab's next page. A state that can't be copied (it holds a function, an element) isn't kept, and a page load loses it. */
|
|
40
|
+
function keepAway(away) {
|
|
41
|
+
try {
|
|
42
|
+
const key = keyOf() ?? crypto.randomUUID();
|
|
43
|
+
sessionStorage.setItem(KEY, key);
|
|
44
|
+
store("readwrite", (s) => {
|
|
45
|
+
const walk = s.openCursor();
|
|
46
|
+
walk.addEventListener("success", () => {
|
|
47
|
+
const cursor = walk.result;
|
|
48
|
+
if (cursor === null) return;
|
|
49
|
+
if (Date.now() - cursor.value.at > STALE) cursor.delete();
|
|
50
|
+
cursor.continue();
|
|
51
|
+
});
|
|
52
|
+
return s.put({
|
|
53
|
+
...away,
|
|
54
|
+
at: Date.now()
|
|
55
|
+
}, key);
|
|
56
|
+
}).catch(() => {});
|
|
57
|
+
} catch {}
|
|
58
|
+
}
|
|
59
|
+
/** What the page before this left, if it left anything. */
|
|
60
|
+
async function keptAway() {
|
|
61
|
+
const key = keyOf();
|
|
62
|
+
if (key === void 0) return void 0;
|
|
63
|
+
try {
|
|
64
|
+
return await store("readonly", (s) => s.get(key));
|
|
65
|
+
} catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** It's come back, or there's nothing to come back for. */
|
|
70
|
+
function dropAway() {
|
|
71
|
+
const key = keyOf();
|
|
72
|
+
if (key === void 0) return;
|
|
73
|
+
try {
|
|
74
|
+
sessionStorage.removeItem(KEY);
|
|
75
|
+
} catch {}
|
|
76
|
+
store("readwrite", (s) => s.delete(key)).catch(() => {});
|
|
77
|
+
}
|
|
3
78
|
// src/client/lightbox.ts
|
|
4
79
|
const EASE = "cubic-bezier(0.2, 0.8, 0.2, 1)";
|
|
5
80
|
const PLAY = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>";
|
|
@@ -369,6 +444,7 @@ const STYLE = `
|
|
|
369
444
|
.bar .where svg { flex: none; }
|
|
370
445
|
.bar .where:hover, .bar .where:focus-visible { color: var(--deictic-fg); }
|
|
371
446
|
.bar .where:hover span { text-decoration: underline; }
|
|
447
|
+
.bar .absent { flex: none; margin-right: 6px; font-size: 12px; color: var(--deictic-muted); }
|
|
372
448
|
.lightbox {
|
|
373
449
|
position: fixed;
|
|
374
450
|
inset: 0;
|
|
@@ -891,13 +967,31 @@ function start({ base, shortcut: own, plugins: given, server }) {
|
|
|
891
967
|
onClose: () => panel = void 0,
|
|
892
968
|
...resumed === void 0 ? {} : { resumed },
|
|
893
969
|
reopen: (again, element, kept) => {
|
|
894
|
-
const found = element.isConnected ? element : sameAs(element)[0];
|
|
895
|
-
|
|
896
|
-
if (found === void 0 || at === void 0) return console.warn("deictic: the element is no longer on the page, so the popup stays closed");
|
|
897
|
-
openTab(again, found, at, kept, pointed?.isConnected === true && found === element ? pointed : void 0);
|
|
970
|
+
const found = element.isConnected ? element : sameAs(element)[0] ?? element;
|
|
971
|
+
openTab(again, found, targetOf(found) ?? target, kept, pointed?.isConnected === true && found === element ? pointed : void 0);
|
|
898
972
|
}
|
|
899
973
|
});
|
|
900
974
|
};
|
|
975
|
+
keptAway().then((away) => {
|
|
976
|
+
if (away === void 0) return;
|
|
977
|
+
const tab = tabs.find((t) => t.plugin.name === away.tab);
|
|
978
|
+
const task = tab?.plugin.resume?.(contextOf(away.tab));
|
|
979
|
+
if (tab === void 0 || task === void 0) return dropAway();
|
|
980
|
+
const back = (resumed) => {
|
|
981
|
+
dropAway();
|
|
982
|
+
const { loc, tag } = away.target;
|
|
983
|
+
const absent = document.createElement(tag);
|
|
984
|
+
absent.setAttribute(ATTRIBUTE, `${loc.file}:${loc.line}:${loc.column}`);
|
|
985
|
+
openTab(tab, sameAs(absent).find((el) => el.localName === tag) ?? absent, away.target, resumed);
|
|
986
|
+
};
|
|
987
|
+
task.then((result) => back({
|
|
988
|
+
state: away.state,
|
|
989
|
+
result
|
|
990
|
+
}), (e) => back({
|
|
991
|
+
state: away.state,
|
|
992
|
+
problem: messageOf(e)
|
|
993
|
+
}));
|
|
994
|
+
});
|
|
901
995
|
function openAt(name, given) {
|
|
902
996
|
const tab = tabs.find((t) => t.plugin.name === name);
|
|
903
997
|
const el = given.isConnected ? given : sameAs(given)[0] ?? void 0;
|
|
@@ -953,6 +1047,10 @@ function openPanel({ base, send, root, contextOf, tabs, tab: first, remember, el
|
|
|
953
1047
|
close.classList.add("close");
|
|
954
1048
|
head.append(...buttons.map((b) => b.el), close);
|
|
955
1049
|
bar.append(where, undo, redo);
|
|
1050
|
+
if (!element.isConnected) where.after(Object.assign(document.createElement("span"), {
|
|
1051
|
+
className: "absent",
|
|
1052
|
+
textContent: "not on this page"
|
|
1053
|
+
}));
|
|
956
1054
|
const body = div("body");
|
|
957
1055
|
body.setAttribute("role", "tabpanel");
|
|
958
1056
|
const status = div("status");
|
|
@@ -1078,10 +1176,19 @@ function openPanel({ base, send, root, contextOf, tabs, tab: first, remember, el
|
|
|
1078
1176
|
away: (state, task) => {
|
|
1079
1177
|
const tab = current;
|
|
1080
1178
|
done(true);
|
|
1081
|
-
|
|
1179
|
+
if (!pinned) keepAway({
|
|
1180
|
+
tab: tab.plugin.name,
|
|
1181
|
+
target,
|
|
1182
|
+
state
|
|
1183
|
+
});
|
|
1184
|
+
const back = (resumed) => {
|
|
1185
|
+
if (!pinned) dropAway();
|
|
1186
|
+
reopen(tab, element, resumed);
|
|
1187
|
+
};
|
|
1188
|
+
task().then((result) => back({
|
|
1082
1189
|
state,
|
|
1083
1190
|
result
|
|
1084
|
-
}), (e) =>
|
|
1191
|
+
}), (e) => back({
|
|
1085
1192
|
state,
|
|
1086
1193
|
problem: messageOf(e)
|
|
1087
1194
|
}));
|
|
@@ -1200,7 +1307,10 @@ function keepInView(panel, body, handle, element) {
|
|
|
1200
1307
|
let frame = 0;
|
|
1201
1308
|
let timer;
|
|
1202
1309
|
let r = element.getBoundingClientRect();
|
|
1203
|
-
let moved
|
|
1310
|
+
let moved = element.isConnected ? void 0 : {
|
|
1311
|
+
left: (document.documentElement.clientWidth - panel.offsetWidth) / 2,
|
|
1312
|
+
top: document.documentElement.clientHeight / 5
|
|
1313
|
+
};
|
|
1204
1314
|
const fit = () => {
|
|
1205
1315
|
cancelAnimationFrame(frame);
|
|
1206
1316
|
clearTimeout(timer);
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["div","button"],"sources":["../../src/client/lightbox.ts","../../src/client/style.ts","../../src/client/tooltip.ts","../../src/client/index.ts"],"sourcesContent":["/**\n * The lightbox: what a panel has attached (a capture, a recording's replay, a voice clip), big, over everything,\n * one at a time, ← and → between them. It grows out of the element that opened it and shrinks back into it, or\n * fades where motion is reduced. A sound plays in a player of its own: play, its waveform with what's played\n * lit (click or drag it to seek), and the time. It's a modal (`data-deictic-modal`): Esc closes it, not the popup.\n */\nimport type { LightboxItem, LightboxOptions } from '#src/index.ts';\n\nimport { type Colors, drawBars, peaksOf } from './waveform.ts';\n\nconst EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\nconst PAUSE = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M6 4h4v16H6zM14 4h4v16h-4z\" fill=\"currentColor\"/></svg>';\n\nconst reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst clock = (s: number) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, '0')}`;\n\n/**\n * Opens it in `root`. `pinned` draws it where `root` is in the page instead, with no backdrop, motion or keys, and\n * actions that don't close it: for a page of deictic's own states (`lightboxIn`).\n */\nexport function openLightbox(\n root: ShadowRoot,\n items: LightboxItem[],\n { at = 0, from, pinned = false }: LightboxOptions & { pinned?: boolean } = {},\n): { close: () => void } {\n const box = div(pinned ? 'lightbox pinned' : 'lightbox');\n if (!pinned) {\n box.dataset.deicticModal = '';\n box.setAttribute('role', 'dialog');\n box.setAttribute('aria-modal', 'true');\n }\n const backdrop = div('lb-backdrop');\n const stage = div('lb-stage');\n const head = div('lb-head');\n const title = div('lb-title');\n const count = div('lb-count');\n const actions = div('lb-actions');\n const close = button('×', 'Close (Esc)', 'lb-close');\n head.append(title, count, actions, close);\n const body = div('lb-body');\n stage.append(head, body);\n const prev = button('‹', 'Previous (←)', 'lb-prev');\n const next = button('›', 'Next (→)', 'lb-next');\n box.append(backdrop, stage, ...(items.length > 1 ? [prev, next] : []));\n root.append(box);\n\n let index = Math.min(Math.max(0, at), items.length - 1);\n let leave: (() => void) | undefined;\n let closing = false;\n\n const show = (i: number, animate: boolean) => {\n leave?.();\n leave = undefined;\n index = (i + items.length) % items.length;\n const item = items[index]!;\n box.setAttribute('aria-label', item.title);\n title.textContent = item.title;\n count.textContent = items.length > 1 ? `${index + 1} / ${items.length}` : '';\n actions.replaceChildren(\n ...(item.actions ?? []).map((a) => {\n const b = button(a.label, a.title ?? '', '');\n b.addEventListener('click', () => {\n if (!pinned) done();\n a.run();\n });\n return b;\n }),\n );\n // A sound plays as it opens, but not on a page that only shows the lightbox.\n const content = contentOf(item, !pinned);\n body.replaceChildren(content.element);\n leave = content.leave;\n if (animate && !reduced()) body.animate({ opacity: [0, 1] }, { duration: 160, easing: 'ease-out' });\n };\n\n /** The transform that puts the stage where `from` is: what it grows from and shrinks back to. */\n const fromRect = () => {\n if (from === undefined || !from.isConnected) return undefined;\n const f = from.getBoundingClientRect();\n const s = stage.getBoundingClientRect();\n if (f.width === 0 || s.width === 0) return undefined;\n return `translate(${f.left - s.left}px, ${f.top - s.top}px) scale(${f.width / s.width}, ${f.height / s.height})`;\n };\n\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') done();\n else if (e.key === 'ArrowLeft' && items.length > 1) show(index - 1, true);\n else if (e.key === 'ArrowRight' && items.length > 1) show(index + 1, true);\n else return;\n // The popup, under it, waits for its own Esc.\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n if (!pinned) addEventListener('keydown', onKey, true);\n\n function done() {\n if (closing) return;\n closing = true;\n removeEventListener('keydown', onKey, true);\n leave?.();\n if (pinned) return box.remove();\n const gone = () => {\n box.remove();\n if (from instanceof HTMLElement && from.isConnected) from.focus({ preventScroll: true });\n };\n if (reduced()) return gone();\n const to = fromRect();\n backdrop.animate({ opacity: [1, 0] }, { duration: 200, easing: 'ease-in', fill: 'forwards' });\n stage\n .animate(\n to === undefined\n ? { opacity: [1, 0], transform: ['none', 'scale(0.96)'] }\n : { transform: ['none', to], opacity: [1, 1, 0], offset: [0, 0.8, 1] },\n { duration: 220, easing: EASE, fill: 'forwards' },\n )\n .finished.then(gone, gone);\n }\n\n backdrop.addEventListener('click', done);\n close.addEventListener('click', done);\n prev.addEventListener('click', () => show(index - 1, true));\n next.addEventListener('click', () => show(index + 1, true));\n\n show(index, false);\n if (pinned) {\n close.hidden = true;\n return { close: done };\n }\n close.focus({ preventScroll: true });\n if (reduced()) {\n box.animate({ opacity: [0, 1] }, { duration: 150 });\n } else {\n backdrop.animate({ opacity: [0, 1] }, { duration: 240, easing: 'ease-out' });\n const grow = fromRect();\n stage.animate(\n grow === undefined\n ? { opacity: [0, 1], transform: ['scale(0.96)', 'none'] }\n : { transform: [grow, 'none'], opacity: [0, 1, 1], offset: [0, 0.2, 1] },\n { duration: 280, easing: EASE },\n );\n }\n return { close: done };\n}\n\n/** An item, drawn: what goes in the body, and what to stop when it's left (a sound playing). */\nfunction contentOf(item: LightboxItem, autoplay: boolean): { element: HTMLElement; leave?: () => void } {\n switch (item.kind) {\n case 'image': {\n const img = Object.assign(document.createElement('img'), { src: item.url, alt: item.title, className: 'lb-image', draggable: false });\n return { element: img };\n }\n case 'page': {\n const frame = Object.assign(document.createElement('iframe'), { src: item.url, title: item.title, className: 'lb-page' });\n frame.allow = 'autoplay; fullscreen';\n return { element: frame };\n }\n case 'audio':\n return player(item.url, autoplay);\n }\n}\n\n/** A sound: play and pause, its waveform with what's played lit, and the time. With `autoplay`, it starts playing. */\nfunction player(url: string, autoplay: boolean): { element: HTMLElement; leave: () => void } {\n const el = div('lb-audio');\n const play = button('', 'Play (Space)', 'lb-play');\n const wave = Object.assign(document.createElement('canvas'), { className: 'lb-wave' });\n wave.setAttribute('role', 'slider');\n wave.setAttribute('aria-label', 'Where in the clip');\n wave.tabIndex = 0;\n const time = div('lb-time');\n el.append(play, wave, time);\n const audio = new Audio(url);\n const colors: Colors = { played: '#3ddc7c', rest: '#52525b' };\n // Flat until the clip's read: the bars rise when its peaks are in.\n let peaks: number[] = Array<number>(120).fill(0.05);\n let frame = 0;\n // MediaRecorder's webm says no length until it's played through; reading the peaks gives it sooner.\n let length = 0;\n const lengthOf = () => (Number.isFinite(audio.duration) && audio.duration > 0 ? audio.duration : length);\n const draw = () => {\n const total = lengthOf();\n drawBars(wave, peaks, total > 0 ? audio.currentTime / total : 0, colors);\n time.textContent = `${clock(audio.currentTime)} / ${total > 0 ? clock(total) : '–:––'}`;\n wave.setAttribute('aria-valuenow', String(Math.round(audio.currentTime)));\n };\n const loop = () => {\n draw();\n frame = audio.paused ? 0 : requestAnimationFrame(loop);\n };\n const state = () => {\n play.innerHTML = audio.paused ? PLAY : PAUSE;\n play.title = audio.paused ? 'Play (Space)' : 'Pause (Space)';\n if (!audio.paused && frame === 0) frame = requestAnimationFrame(loop);\n draw();\n };\n audio.addEventListener('play', state);\n audio.addEventListener('pause', state);\n audio.addEventListener('ended', state);\n audio.addEventListener('loadedmetadata', draw);\n const toggle = () => void (audio.paused ? audio.play().catch(() => {}) : audio.pause());\n play.addEventListener('click', toggle);\n const seek = (e: PointerEvent) => {\n const r = wave.getBoundingClientRect();\n const total = lengthOf();\n if (total > 0) audio.currentTime = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * total;\n draw();\n };\n wave.addEventListener('pointerdown', (e) => {\n wave.setPointerCapture(e.pointerId);\n seek(e);\n });\n wave.addEventListener('pointermove', (e) => {\n if (wave.hasPointerCapture(e.pointerId)) seek(e);\n });\n el.addEventListener('keydown', (e) => {\n if (e.key !== ' ') return;\n e.preventDefault();\n toggle();\n });\n void peaksOf(url, 120).then(\n (read) => {\n peaks = read.peaks;\n length = read.duration;\n draw();\n },\n // Undecodable here: the player still plays it, over flat bars.\n () => {},\n );\n state();\n if (autoplay) void audio.play().catch(() => state());\n // The canvas has its size once it's in the page.\n requestAnimationFrame(draw);\n return {\n element: el,\n leave: () => {\n audio.pause();\n cancelAnimationFrame(frame);\n },\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\nfunction button(text: string, title: string, className: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n el.className = className;\n return el;\n}\n","/**\n * The overlay's styles, in its shadow root. Panels style their bodies with the same custom\n * properties, so a plugin's panel looks like the rest without styles of its own for the basics.\n */\nexport const STYLE = `\n:host {\n --deictic-accent: #12b358;\n --deictic-on-accent: #04130b;\n --deictic-bg: #18181b;\n --deictic-fg: #f4f4f5;\n --deictic-muted: #a1a1aa;\n --deictic-line: #3f3f46;\n --deictic-problem: #f87171;\n all: initial;\n /* Inherited by everything in the root: a thumb and no track, on whatever the panel's background is. */\n scrollbar-color: var(--deictic-line) transparent;\n}\n/* The host takes no room in the page: everything in it is fixed, so nothing of deictic's moves or scrolls it. */\n:host(deictic-overlay) { display: contents; }\n.box {\n position: fixed;\n display: none;\n z-index: 2147483646;\n pointer-events: none;\n box-sizing: border-box;\n outline: 2px solid var(--deictic-accent);\n background: rgb(18 179 88 / 0.1);\n}\n.box.shown { display: block; }\n.box.inner { outline: 1px dashed var(--deictic-accent); background: none; }\n/* The element the popup is open on: dashed and off it a little, with no fill, so what's tried on it shows as it is. */\n.box.on { outline: 1px dashed var(--deictic-accent); border-radius: 4px; background: none; }\n.label {\n position: absolute;\n left: -2px;\n bottom: 100%;\n padding: 1px 6px;\n font: 12px/1.5 ui-monospace, monospace;\n white-space: nowrap;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.label.below { top: 100%; bottom: auto; }\n.panel {\n position: fixed;\n z-index: 2147483647;\n width: min(360px, calc(100vw - 16px));\n max-height: 60vh;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n border: 1px solid var(--deictic-line);\n border-radius: 8px;\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: var(--deictic-bg);\n}\n.panel.pinned { position: relative; z-index: auto; max-height: none; }\n@media (prefers-reduced-motion: no-preference) {\n .panel:not(.pinned) { animation: deictic-in 0.12s ease-out; }\n}\n@keyframes deictic-in {\n from { opacity: 0; translate: 0 4px; }\n}\n.head {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n padding: 4px 8px 0;\n}\n/* Over the page the head is what the popup is dragged by; no touch scrolling starts there. */\n.panel:not(.pinned) .head { cursor: grab; touch-action: none; user-select: none; }\n.panel.dragging .head, .panel.dragging .head button { cursor: grabbing; }\n.head .tab {\n border: 0;\n border-bottom: 2px solid transparent;\n border-radius: 0;\n padding: 4px 8px;\n font-weight: 600;\n color: var(--deictic-muted);\n}\n.head .tab:hover { color: var(--deictic-fg); }\n.head .tab[aria-selected='true'] { color: var(--deictic-fg); border-bottom-color: var(--deictic-accent); }\n.head .close { margin: 0 0 3px auto; }\n.bar {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 4px 8px;\n border-top: 1px solid var(--deictic-line);\n border-bottom: 1px solid var(--deictic-line);\n}\n.bar .where {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n margin-right: auto;\n font: 12px ui-monospace, monospace;\n color: var(--deictic-muted);\n text-decoration: none;\n}\n.bar .where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.bar .where svg { flex: none; }\n.bar .where:hover, .bar .where:focus-visible { color: var(--deictic-fg); }\n.bar .where:hover span { text-decoration: underline; }\n.lightbox {\n position: fixed;\n inset: 0;\n z-index: 2147483647;\n display: flex;\n align-items: center;\n justify-content: center;\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n}\n.lb-backdrop { position: absolute; inset: 0; background: rgb(9 9 11 / 0.72); backdrop-filter: blur(2px); }\n.lb-stage {\n position: relative;\n display: flex;\n flex-direction: column;\n max-width: 92vw;\n max-height: 90vh;\n border: 1px solid var(--deictic-line);\n border-radius: 10px;\n background: var(--deictic-bg);\n box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);\n transform-origin: 0 0;\n overflow: hidden;\n}\n.lb-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--deictic-line); }\n.lb-title { font-weight: 600; }\n.lb-count { color: var(--deictic-muted); font-size: 12px; font-variant-numeric: tabular-nums; }\n.lb-actions { display: flex; gap: 6px; margin-left: auto; }\n.lb-body { display: flex; justify-content: center; min-height: 0; background: #09090b; }\n.lb-image { display: block; max-width: 92vw; max-height: calc(90vh - 48px); object-fit: contain; }\n.lb-page { display: block; width: min(1280px, 92vw); height: min(860px, calc(90vh - 48px)); border: 0; background: #18181b; }\n.lb-audio { display: flex; align-items: center; gap: 12px; width: min(640px, 86vw); padding: 20px 16px; }\n.lb-play {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.lb-play svg { width: 16px; height: 16px; }\n.lb-wave { flex: 1; min-width: 0; height: 56px; cursor: pointer; border-radius: 4px; }\n.lb-wave:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 2px; }\n.lb-time { flex: none; min-width: 9ch; text-align: right; font: 12px ui-monospace, monospace; color: var(--deictic-muted); }\n.lb-prev, .lb-next {\n position: absolute;\n top: 50%;\n translate: 0 -50%;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 1px solid var(--deictic-line);\n border-radius: 50%;\n font-size: 22px;\n line-height: 1;\n background: var(--deictic-bg);\n}\n.lb-prev { left: 16px; }\n.lb-next { right: 16px; }\n.lightbox.pinned { position: relative; inset: auto; z-index: auto; display: block; padding: 0 64px; }\n.lightbox.pinned .lb-stage { max-width: 100%; max-height: none; }\n.lightbox.pinned .lb-page { width: 100%; height: 420px; }\n.lightbox.pinned .lb-image { max-width: 100%; max-height: 420px; }\n.lightbox.pinned .lb-backdrop { display: none; }\n.lightbox.pinned .lb-audio { width: 100%; box-sizing: border-box; }\n.lightbox.pinned .lb-close { display: none; }\n.tip {\n position: fixed;\n left: 0;\n top: 0;\n z-index: 2147483647;\n max-width: 280px;\n padding: 3px 6px;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n font: 12px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: #09090b;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);\n pointer-events: none;\n visibility: hidden;\n opacity: 0;\n transition: opacity 0.12s;\n}\n.tip.shown { visibility: visible; opacity: 1; }\nbutton {\n font: inherit;\n color: inherit;\n background: transparent;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 1px 7px;\n cursor: pointer;\n}\nbutton:hover { border-color: var(--deictic-muted); }\nbutton:disabled { opacity: 0.5; cursor: default; }\nbutton:disabled:hover { border-color: var(--deictic-line); }\n/* One ring for whatever the keyboard lands on, in place of each browser's own. */\nbutton:focus-visible, a:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 1px; }\nbutton.icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n padding: 0;\n border: 0;\n color: var(--deictic-muted);\n}\nbutton.icon svg { width: 14px; height: 14px; }\nbutton.icon:hover:not(:disabled) { color: var(--deictic-fg); background: rgb(255 255 255 / 0.08); }\nbutton.primary { background: var(--deictic-accent); border-color: var(--deictic-accent); color: var(--deictic-on-accent); }\ninput, textarea {\n box-sizing: border-box;\n width: 100%;\n font: 12px ui-monospace, monospace;\n color: inherit;\n background: #09090b;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 4px 6px;\n}\ninput:focus, textarea:focus { outline: 1px solid var(--deictic-accent); }\ncode { font: 12px ui-monospace, monospace; }\n/* Border-box, as the popup holds the body's height by its whole box while a tab reads. */\n.body { box-sizing: border-box; padding: 8px; overflow: auto; }\n.status { padding: 0 8px 6px; font-size: 12px; color: var(--deictic-muted); }\n.status:empty { display: none; }\n.status.problem { color: var(--deictic-problem); }\n`;\n","/**\n * One tooltip for everything deictic draws in a shadow root: whatever has a `title` (or `data-tip`) shows it\n * in a box of ours, soon after the pointer rests or focus lands, instead of the browser's, which comes late\n * and looks like nothing else here. Plugins only set `title`, as they would anywhere; the first hover moves\n * it to `data-tip`, so the browser's own stays away, and gives a textless control the title as its name.\n * The box is fixed in the root, so no panel's scrolling clips it.\n */\nconst DELAY = 300;\n\nexport function tooltips(root: ShadowRoot): void {\n const tip = document.createElement('div');\n tip.className = 'tip';\n tip.setAttribute('role', 'tooltip');\n root.append(tip);\n let timer = 0;\n let over: Element | undefined;\n\n const hide = () => {\n clearTimeout(timer);\n over = undefined;\n tip.classList.remove('shown');\n };\n const show = (el: Element) => {\n const text = el.getAttribute('data-tip');\n if (text === null || text === '' || !el.isConnected) return hide();\n tip.textContent = text;\n // Last in the root, over a modal or toolbar added since at the same z-index.\n if (tip !== root.lastElementChild) root.append(tip);\n tip.classList.add('shown');\n // Centred below it, kept on screen; above it where there's no room below.\n const r = el.getBoundingClientRect();\n const t = tip.getBoundingClientRect();\n const left = Math.max(8, Math.min(r.left + r.width / 2 - t.width / 2, innerWidth - t.width - 8));\n const top = r.bottom + 6 + t.height > innerHeight - 8 ? r.top - 6 - t.height : r.bottom + 6;\n Object.assign(tip.style, { left: `${left}px`, top: `${top}px` });\n };\n /** The element with a tip around where the event happened, its `title` taken over the first time. */\n const tipped = (e: Event) => {\n for (const node of e.composedPath()) {\n if (!(node instanceof Element)) continue;\n if (node === tip) return undefined;\n // A frame's title is its name for assistive tech, not a tip; what's in it has tips of its own.\n if (node.localName === 'iframe') return undefined;\n const title = node.getAttribute('title');\n if (title !== null) {\n node.removeAttribute('title');\n if (title === '') continue;\n node.setAttribute('data-tip', title);\n // A control with no text of its own (an icon, ×, ↶) is known by its tip; one with text keeps its name.\n if (!node.hasAttribute('aria-label') && (node.textContent ?? '').trim().length <= 1) node.setAttribute('aria-label', title);\n else node.setAttribute('aria-description', title);\n }\n if (node.hasAttribute('data-tip')) return node;\n }\n return undefined;\n };\n const enter = (e: Event) => {\n const el = tipped(e);\n if (el === over) return;\n hide();\n if (el === undefined) return;\n over = el;\n timer = window.setTimeout(() => show(el), e.type === 'focusin' ? 0 : DELAY);\n };\n root.addEventListener('pointerover', enter);\n root.addEventListener('focusin', (e) => {\n // Focus from the keyboard only: a click focuses too, and its tip is the pointer's.\n if ((e.target as Element).matches(':focus-visible')) enter(e);\n });\n root.addEventListener('pointerout', (e) => {\n const to = (e as PointerEvent).relatedTarget;\n if (over !== undefined && !(to instanceof Node && over.contains(to))) hide();\n });\n root.addEventListener('focusout', hide);\n // A press acts, and what it changes (a mic turned on) may change the tip: the next hover shows the new one.\n root.addEventListener('pointerdown', hide);\n addEventListener('scroll', hide, { capture: true, passive: true });\n}\n","/**\n * `deictic/client`: the overlay the page loads in dev. Hold a shortcut's keys (Alt, deictic's own,\n * by default) and point: the element under the pointer that the source marked (`tools/locate.ts`) is\n * outlined, with its tag, its place and how many elements share it. Press the shortcut's button to open\n * the popup there: a tab for each plugin with a panel, at the one used last, or at a plugin's own where\n * its shortcut was pressed.\n *\n * Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A\n * panel's undo and redo are its tab's on its element: the latest change that plugin made there.\n */\nimport type { ClientContext, ClientPlugin, LightboxItem, PanelContext, Resumed, Standalone, Target } from '#src/index.ts';\nimport { gestureOf, type Shortcut } from '#src/shortcut.ts';\n\nimport { openLightbox } from './lightbox.ts';\nimport { STYLE } from './style.ts';\nimport { tooltips } from './tooltip.ts';\n\n// For a plugin's page half that records the mic, or shows a clip: the waveforms the lightbox draws.\nexport { drawBars, liveWaveform, peaksOf, type Colors } from './waveform.ts';\n\nexport interface StartOptions {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's own shortcut, checked: it opens the popup at the tab used last. None where it's turned off. */\n shortcut?: Required<Shortcut>;\n /** Each plugin with a half in the page, and its own shortcut as the bundler's plugin checked it, where it has one. */\n plugins: { plugin: ClientPlugin; shortcut?: Required<Shortcut>; options?: unknown }[];\n /** What answers the requests where there's no dev server to: a `standalone` build's. */\n server?: Standalone;\n}\n\n/** A request to the endpoints, by its URL: to the dev server, or to what stands in for it. */\ntype Send = (url: string, init?: RequestInit) => Promise<Response>;\n\ntype Mount = (panel: HTMLElement, context: PanelContext<unknown, unknown>) => (() => void) | void;\n\n/** A plugin with a panel: a tab in the popup. */\ninterface Tab {\n plugin: ClientPlugin;\n mount: Mount;\n}\n\nconst ATTRIBUTE = 'data-deictic';\n/** An arrow pointing up and out: the link leaves the page for the editor. */\nconst OUT = icon('M7 17 17 7M8 7h9v9', 2.25);\n// Drawn, as the arrows and the cross of a system's font differ in size and weight from one to the next.\nconst UNDO = icon('M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11');\nconst REDO = icon('m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13');\nconst CLOSE = icon('M18 6 6 18M6 6l12 12');\n/** Where the tab used last is kept, for deictic's own shortcut to open it again. */\nconst LAST = 'deictic:tab';\n/** How long a read may take, in milliseconds, before the popup says it's reading. */\nconst SLOW = 200;\nconst STARTED = Symbol.for('deictic');\n\nexport function targetOf(el: Element): Target | undefined {\n const at = el.getAttribute(ATTRIBUTE);\n const match = at === null ? null : /^(.*):(\\d+):(\\d+)$/.exec(at);\n if (match === null) return undefined;\n return { loc: { file: match[1]!, line: Number(match[2]), column: Number(match[3]) }, tag: el.localName };\n}\n\nconst sameAs = (el: Element) => [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(el.getAttribute(ATTRIBUTE) ?? '')}\"]`)];\n\n/** The nearest marked element around `el`, out through shadow roots to their hosts. */\nfunction markedAround(el: Element): Element | undefined {\n for (let at: Element | undefined = el; at !== undefined;) {\n const marked = at.closest(`[${ATTRIBUTE}]`);\n if (marked !== null) return marked;\n const root = at.getRootNode();\n at = root instanceof ShadowRoot ? root.host : undefined;\n }\n return undefined;\n}\n\n/** `div.panel > button.tab`: the element as a selector, the deepest classes only, for a person to tell it by. */\nfunction icon(path: string, width = 2): string {\n return `<svg viewBox=\"0 0 24 24\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"${width}\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"${path}\"/></svg>`;\n}\n\nconst nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n\n/** What the overlay keeps once started, for `popupIn` to show the popup with. */\ninterface Started {\n base: string;\n send: Send;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** Opens the popup over the page on an element, at a tab or the one used last: `openPopup`. */\n open: (element: Element, tab?: string) => boolean;\n}\n\nlet started: Started | undefined;\n\n/**\n * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as\n * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.\n */\nexport const POPUP_OPENED = 'deictic:open';\nexport const POPUP_CLOSED = 'deictic:close';\n\nexport interface PopupOpened {\n /** The element it's open on. */\n element: Element;\n /** The plugin whose tab it opened at. */\n tab: string;\n}\n\n/**\n * Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the\n * tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.\n * Answers whether it opened: not where no plugin has a tab, or `element` has no mark. The overlay must have started.\n */\nexport function openPopup(element: Element, { tab }: { tab?: string } = {}): boolean {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to open');\n return started.open(element, tab);\n}\n\n/**\n * Shows the popup in `container`, open at a tab (`tab`, a plugin's name, or the first) on `element`, where\n * the page puts it rather than over the page: a page of the popup's states, to point at and fix, as deictic's\n * own site does. It's the real popup, its tabs and plugins working. Closing it, or a tab's `away`, opens it\n * again in place. It draws in `container`'s shadow root, made if there isn't one. Answers what removes it.\n * The overlay must have started (the dev server's client module starts it), and `element` be marked.\n */\nexport function popupIn(container: Element, { tab: name, element }: { tab?: string; element: Element }): () => void {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to show');\n const target = targetOf(element);\n if (target === undefined) throw new Error(`deictic: ${nameOf(element)} has no ${ATTRIBUTE} mark to open the popup on`);\n const { base, send, contextOf, tabs } = started;\n // A tab shown here isn't one a person chose: the popup over the page keeps opening at theirs.\n const remember = () => {};\n const tab = tabs.find((t) => t.plugin.name === name) ?? tabs[0];\n if (tab === undefined) throw new Error('deictic: no plugin has a tab to show');\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n let panel: { close: () => void } | undefined;\n let gone = false;\n const open = (at: Tab, resumed?: Resumed) => {\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: at,\n remember,\n element,\n target,\n pinned: true,\n onClose: (shown, leaving) => {\n panel = undefined;\n // Closed by its own × or Esc: open again, as the page is there to show it. Leaving for `away` comes back by `reopen`.\n if (!gone && !leaving) open(shown);\n },\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, _, kept) => open(again, kept),\n });\n };\n open(tab);\n return () => {\n gone = true;\n panel?.close();\n style.remove();\n };\n}\n\n/**\n * Shows the lightbox in `container`, at `at`, where the page puts it rather than over everything: as `popupIn`\n * does the popup, for a page of deictic's own states. Its items step with its arrows; there's no backdrop, close\n * or keys, and an item's actions run without closing it. Answers what removes it.\n */\nexport function lightboxIn(container: Element, items: LightboxItem[], { at }: { at?: number } = {}): () => void {\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n const { close } = openLightbox(root, items, { ...(at === undefined ? {} : { at }), pinned: true });\n return () => {\n close();\n style.remove();\n };\n}\n\n/** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */\nexport function start({ base, shortcut: own, plugins: given, server }: StartOptions): void {\n const page = globalThis as { [STARTED]?: true };\n if (page[STARTED] === true) return;\n page[STARTED] = true;\n\n const host = document.createElement('deictic-overlay');\n const root = host.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = STYLE;\n const box = div('box');\n const label = div('label');\n box.append(label);\n // What's under the pointer, outlined inside the marked element around it when they differ.\n const inner = div('box inner');\n root.append(style, box, inner);\n tooltips(root);\n // What's typed in the popup is the popup's: the page hears a key from in here as one on the host, not in a field,\n // so its own shortcuts (a \"/\" to search, a \"j\" to step) would run on a task's words. Ours listen while capturing.\n for (const type of ['keydown', 'keypress', 'keyup'] as const) host.addEventListener(type, (e) => e.stopPropagation());\n document.documentElement.append(host);\n\n // Each plugin's API, set up before any panel opens. `use` reads it when asked, so a setup may keep\n // `use` for later, not call it: the plugin it asks for may not be set up yet.\n const apis = new Map<string, unknown>();\n const send: Send =\n server === undefined ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));\n const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));\n const contextOf = (name: string): ClientContext => ({\n base,\n root,\n options: optionsOf.get(name),\n use: (other) => apis.get(other) as never,\n request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),\n open: (plugin, element) => openAt(plugin, element),\n lightbox: (items, options) => openLightbox(root, items, options),\n });\n for (const { plugin } of given) {\n if (plugin.setup === undefined) continue;\n try {\n apis.set(plugin.name, plugin.setup(contextOf(plugin.name)));\n } catch (e) {\n // One plugin's failure is no reason to take the others down with it.\n console.error(`deictic: ${plugin.name} failed to set up`, e);\n }\n }\n const tabs: Tab[] = given.flatMap(({ plugin }) => (plugin.mount === undefined ? [] : [{ plugin, mount: plugin.mount }]));\n started = {\n base,\n send,\n contextOf,\n tabs,\n // Not over a popup holding something unsaved: the press that asked shook its button (`openPanel`).\n open: (element, tab) => tabs.length > 0 && panel?.unsaved() !== true && openAt(tab ?? last().plugin.name, element),\n };\n const last = () => {\n let name: string | null = null;\n try {\n name = localStorage.getItem(LAST);\n } catch {\n // Storage can be off: the first tab, then.\n }\n return tabs.find((t) => t.plugin.name === name) ?? tabs[0]!;\n };\n const remember = (tab: Tab) => {\n try {\n localStorage.setItem(LAST, tab.plugin.name);\n } catch {\n // Not kept, then: the next open starts at the first tab.\n }\n };\n // What opens the popup, and at which tab: deictic's own shortcut at the one used last, each\n // plugin's at its own.\n const plugins = [\n ...(own === undefined || tabs.length === 0 ? [] : [{ shortcut: own, gesture: gestureOf(own), tab: last }]),\n ...given.flatMap(({ plugin, shortcut }) => {\n if (shortcut === undefined) return [];\n const tab = tabs.find((t) => t.plugin === plugin);\n if (tab !== undefined) return [{ shortcut, gesture: gestureOf(shortcut), tab: () => tab }];\n console.error(`deictic: ${plugin.name} has a shortcut, but its page half has no \\`mount\\` to draw a tab with`);\n return [];\n }),\n ];\n\n let pointer: { x: number; y: number } | undefined;\n let frame = 0;\n let panel: { close: () => void; unsaved: () => boolean } | undefined;\n\n /** The plugins whose keys are held: several, where they share keys and differ by button. */\n const heldBy = (e: MouseEvent | KeyboardEvent) => plugins.filter((p) => p.gesture.held(e));\n /** The plugin a press opens. */\n const pressedBy = (e: MouseEvent) => plugins.find((p) => p.gesture.held(e) && e.button === p.gesture.button);\n /**\n * The marked element at a point, and what's under the pointer inside it where that differs: down through\n * open shadow roots but the overlay's own, as a page showing the popup (`popupIn`) has it in one.\n */\n const hitAt = (x: number, y: number) => {\n let under = document.elementFromPoint(x, y) ?? undefined;\n while (under !== undefined && under !== host && under.shadowRoot !== null) {\n const inside = under.shadowRoot.elementFromPoint(x, y);\n if (inside === null || inside === under) break;\n under = inside;\n }\n const el = under === undefined || under === host ? undefined : markedAround(under);\n return el === undefined ? undefined : { el, pointed: under === el ? undefined : under };\n };\n const hide = () => {\n box.classList.remove('shown');\n inner.classList.remove('shown');\n };\n const show = (held: typeof plugins) => {\n frame = 0;\n const hit = pointer === undefined ? undefined : hitAt(pointer.x, pointer.y);\n const el = hit?.el;\n const target = el === undefined ? undefined : targetOf(el);\n if (el === undefined || target === undefined) return hide();\n place(box, el.getBoundingClientRect());\n if (hit?.pointed === undefined) {\n inner.classList.remove('shown');\n } else {\n place(inner, hit.pointed.getBoundingClientRect());\n inner.classList.add('shown');\n }\n const count = sameAs(el).length;\n // The button, where it isn't the left: what the keys alone don't tell apart.\n const names = held.map(({ tab, shortcut }) => {\n const { plugin } = tab();\n const name = plugin.label ?? plugin.name;\n return shortcut.button === 'left' ? name : `${name} (${shortcut.button})`;\n });\n const within = hit?.pointed === undefined ? '' : ` › ${nameOf(hit.pointed)}`;\n label.textContent = `${names.join(' / ')} · <${target.tag}> ${target.loc.file}:${target.loc.line}${count > 1 ? ` · ×${count}` : ''}${within}`;\n label.classList.toggle('below', el.getBoundingClientRect().top < 24);\n box.classList.add('shown');\n };\n const update = (e: MouseEvent | KeyboardEvent) => {\n const held = heldBy(e);\n if (held.length === 0) return hide();\n if (frame === 0) frame = requestAnimationFrame(() => show(held));\n };\n\n window.addEventListener(\n 'mousemove',\n (e) => {\n pointer = { x: e.clientX, y: e.clientY };\n update(e);\n },\n { capture: true, passive: true },\n );\n window.addEventListener('keydown', update, true);\n window.addEventListener('keyup', update, true);\n window.addEventListener('blur', hide);\n let press = {};\n let opened: object | undefined;\n // Alt-click on a link would otherwise download it, and on a field focus it.\n window.addEventListener(\n 'mousedown',\n (e) => {\n press = {};\n if (e.composedPath().includes(host)) return;\n if (pressedBy(e) !== undefined && hitAt(e.clientX, e.clientY) !== undefined) e.preventDefault();\n },\n true,\n );\n // A press ends in `click`, `auxclick` or `contextmenu` by its button, and a right one in two of\n // them, in an order that varies by platform; on macOS Control-click is a left `contextmenu`. Each\n // is kept from the page, and the first opens the panel.\n const pressed = (e: MouseEvent) => {\n if (e.composedPath().includes(host)) return;\n const found = pressedBy(e);\n const hit = found === undefined ? undefined : hitAt(e.clientX, e.clientY);\n const target = hit === undefined ? undefined : targetOf(hit.el);\n if (found === undefined || hit === undefined || target === undefined) return;\n e.preventDefault();\n e.stopPropagation();\n if (opened === press) return;\n opened = press;\n // Still open after this press's pointerdown, outside it: it holds something unsaved, and shook its button.\n if (panel?.unsaved() === true) return;\n openTab(found.tab(), hit.el, target, undefined, hit.pointed);\n };\n const openTab = (tab: Tab, el: Element, target: Target, resumed?: Resumed, pointed?: Element) => {\n hide();\n panel?.close();\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab,\n remember,\n element: el,\n ...(pointed === undefined ? {} : { pointed }),\n target,\n onClose: () => (panel = undefined),\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, element, kept) => {\n const found = element.isConnected ? element : sameAs(element)[0];\n const at = found === undefined ? undefined : targetOf(found);\n // Gone from the page while away: there's nothing to come back to.\n if (found === undefined || at === undefined)\n return console.warn('deictic: the element is no longer on the page, so the popup stays closed');\n openTab(again, found, at, kept, pointed?.isConnected === true && found === element ? pointed : undefined);\n },\n });\n };\n function openAt(name: string, given: Element): boolean {\n const tab = tabs.find((t) => t.plugin.name === name);\n const el = given.isConnected ? given : (sameAs(given)[0] ?? undefined);\n const target = el === undefined ? undefined : targetOf(el);\n if (tab === undefined || el === undefined || target === undefined) return false;\n openTab(tab, el, target);\n return true;\n }\n for (const type of ['click', 'auxclick', 'contextmenu'] as const) window.addEventListener(type, pressed, true);\n}\n\ninterface PanelOptions {\n base: string;\n send: Send;\n root: ShadowRoot;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** The tab it opens at. */\n tab: Tab;\n /** Keeps the tab shown, for deictic's own shortcut to open at next. */\n remember: (tab: Tab) => void;\n element: Element;\n /** What was under the pointer inside `element`, where that differs. */\n pointed?: Element;\n target: Target;\n /** Shown where the page put it (`popupIn`), not over the page beside the element; Esc leaves it alone. */\n pinned?: boolean;\n /** Called as it closes: the tab it showed, and whether it's leaving for a tab's `away`, to come back by `reopen`. */\n onClose: (shown: Tab, leaving: boolean) => void;\n /** What the first tab's mount gets, coming back from `away`. */\n resumed?: Resumed;\n /** Opens the popup again, at a tab on an element, coming back from `away`. */\n reopen: (tab: Tab, element: Element, resumed: Resumed) => void;\n}\n\nfunction openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: first,\n remember,\n element,\n pointed,\n target,\n pinned = false,\n onClose,\n resumed: coming,\n reopen,\n}: PanelOptions): { close: () => void; unsaved: () => boolean } {\n // Given to the first tab's first mount only: another tab, or a remount after an undo, starts afresh.\n let resumed = coming;\n const panel = div('panel');\n // The tabs, then the element's place and undo and redo, which are the shown tab's on this element.\n const head = div('head');\n head.setAttribute('role', 'tablist');\n const bar = div('bar');\n const where = document.createElement('a');\n where.className = 'where';\n const file = document.createElement('span');\n file.textContent = `${target.loc.file}:${target.loc.line}`;\n // An arrow out, as it leaves the page for the editor; its title is the overlay's tooltip (`tooltip.ts`).\n where.append(file);\n where.insertAdjacentHTML('beforeend', OUT);\n where.title = 'Open in editor';\n where.setAttribute('aria-label', `Open ${file.textContent} in the editor`);\n // The element's place, as a request's query names it.\n const at = { file: target.loc.file, line: String(target.loc.line), column: String(target.loc.column) };\n where.href = `${base}__deictic/open?${new URLSearchParams(at)}`;\n where.addEventListener('click', (e) => {\n e.preventDefault();\n void send(where.href);\n });\n // Off until the tab's history is read: there's nothing to take back on most elements.\n const undo = iconButton(UNDO, 'Undo', 'Nothing to undo');\n const redo = iconButton(REDO, 'Redo', 'Nothing to redo');\n undo.disabled = redo.disabled = true;\n const close = iconButton(CLOSE, 'Close', pinned ? 'Close' : 'Close (Esc)');\n const buttons = tabs.map((tab) => {\n const el = button(tab.plugin.label ?? tab.plugin.name, '');\n el.className = 'tab';\n el.setAttribute('role', 'tab');\n el.addEventListener('click', () => show(tab));\n return { tab, el };\n });\n close.classList.add('close');\n head.append(...buttons.map((b) => b.el), close);\n bar.append(where, undo, redo);\n const body = div('body');\n body.setAttribute('role', 'tabpanel');\n const status = div('status');\n panel.append(head, bar, body, status);\n root.append(panel);\n if (pinned) panel.classList.add('pinned');\n const release = pinned ? undefined : keepInView(panel, body, head, element);\n const unmark = pinned ? undefined : outline(root, element);\n if (!pinned) window.dispatchEvent(new CustomEvent<PopupOpened>(POPUP_OPENED, { detail: { element, tab: first.plugin.name } }));\n\n let cleanup: (() => void) | void;\n // The button that keeps what the shown tab would lose, while there's something: `unsaved`, from the panel.\n let holding: HTMLElement | undefined;\n const say = (text: string, problem = false) => {\n status.textContent = text;\n status.classList.toggle('problem', problem);\n };\n const post = async <T>(route: string, body?: unknown): Promise<T> => {\n const res = await send(`${base}__deictic/${route}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body ?? {}),\n });\n const json = (await res.json()) as T & { problem?: string };\n if (!res.ok) throw new Error(json.problem ?? res.statusText);\n return json;\n };\n const unmount = () => {\n cleanup?.();\n cleanup = undefined;\n holding = undefined;\n body.replaceChildren();\n };\n // The change undone may be this tab's from before the panel opened: the panel reads its model again.\n const step = (route: 'undo' | 'redo') =>\n post<{ change: { label: string } }>(route, { plugin: current.plugin.name, target })\n .then(\n async ({ change }) => {\n await load();\n say(`${route === 'undo' ? 'Undid' : 'Redid'} ${change.label}`);\n },\n (e: unknown) => say(messageOf(e), true),\n )\n .finally(() => void steps());\n // Undo and redo as the tab's history on this element stands: off with nothing to take back or do again, else\n // saying what they would. Read as a tab shows, after each change made here, and as the pointer comes back, for a\n // change made elsewhere. One a later read overtook (another tab's) sets nothing.\n let asked = 0;\n const steps = async () => {\n const ask = ++asked;\n let history: { done: { label: string }[]; undone: { label: string }[] };\n try {\n const res = await send(`${base}__deictic/history?${new URLSearchParams({ plugin: current.plugin.name, ...at })}`);\n if (!res.ok || ask !== asked) return;\n history = (await res.json()) as typeof history;\n } catch {\n return;\n }\n const last = history.done.at(-1);\n const next = history.undone.at(-1);\n undo.disabled = last === undefined;\n undo.title = last === undefined ? 'Nothing to undo' : `Undo ${last.label}`;\n redo.disabled = next === undefined;\n redo.title = next === undefined ? 'Nothing to redo' : `Redo ${next.label}`;\n };\n panel.addEventListener('pointerenter', () => void steps());\n\n const done = (leaving = false) => {\n unmount();\n release?.();\n unmark?.();\n panel.remove();\n window.removeEventListener('keydown', onKey, true);\n window.removeEventListener('pointerdown', onOutside, true);\n if (!pinned) window.dispatchEvent(new CustomEvent(POPUP_CLOSED));\n onClose(current, leaving);\n };\n const onKey = (e: KeyboardEvent) => {\n // A plugin's modal over the popup (one marked `data-deictic-modal`) takes Esc for itself.\n if (e.key !== 'Escape' || root.querySelector('[data-deictic-modal]') !== null) return;\n // Esc is the popup's while it's open: a dialog of the page's that it's open in stays open.\n e.preventDefault();\n e.stopPropagation();\n done();\n };\n // A press on the page closes the popup, as it would a menu, unless that loses something: then the button that\n // keeps it shakes. Anything in the overlay is the popup's own: a modal, the lightbox, the surface marks are drawn on.\n const onOutside = (e: PointerEvent) => {\n if (e.composedPath().includes(root.host)) return;\n if (holding === undefined) return done();\n shake(holding);\n };\n if (!pinned) {\n window.addEventListener('keydown', onKey, true);\n window.addEventListener('pointerdown', onOutside, true);\n }\n undo.addEventListener('click', () => void step('undo'));\n redo.addEventListener('click', () => void step('redo'));\n close.addEventListener('click', () => done());\n\n let current = first;\n // A read that a later one overtook (another tab, or the same after an undo) mounts nothing.\n let reads = 0;\n const load = async () => {\n const { plugin, mount } = current;\n const read = ++reads;\n // The body keeps its height while it's empty, and \"Reading…\" waits for a read that takes long: one answered\n // at once, as most are, would otherwise fold the popup and open it again in a blink.\n body.style.minHeight = `${body.offsetHeight}px`;\n unmount();\n say('');\n const slow = setTimeout(() => read === reads && say('Reading…'), SLOW);\n let model: unknown;\n try {\n ({ model } = await post<{ model: unknown }>('read', { plugin: plugin.name, target }));\n } catch (e) {\n if (read !== reads) return;\n body.style.minHeight = '';\n say(messageOf(e), true);\n return;\n } finally {\n clearTimeout(slow);\n }\n if (read !== reads) return;\n body.style.minHeight = '';\n say('');\n const back = current === first ? resumed : undefined;\n resumed = undefined;\n cleanup = mount(body, {\n ...contextOf(plugin.name),\n ...(back === undefined ? {} : { resumed: back }),\n away: (state, task) => {\n const tab = current;\n done(true);\n void task().then(\n (result) => reopen(tab, element, { state, result }),\n (e: unknown) => reopen(tab, element, { state, problem: messageOf(e) }),\n );\n },\n element,\n ...(pointed === undefined ? {} : { pointed }),\n elements: sameAs(element),\n target,\n model,\n apply: async (op) => {\n say('Writing…');\n try {\n const result = await post<{ model: unknown }>('apply', { plugin: plugin.name, target, op });\n say('');\n void steps();\n return result.model;\n } catch (e) {\n say(messageOf(e), true);\n throw e;\n }\n },\n close: () => done(),\n unsaved: (action) => {\n if (read === reads) holding = action;\n },\n });\n };\n const show = (tab: Tab) => {\n current = tab;\n for (const b of buttons) b.el.setAttribute('aria-selected', String(b.tab === tab));\n remember(tab);\n void steps();\n void load();\n };\n show(first);\n return { close: done, unsaved: () => holding !== undefined };\n}\n\n/** Shakes a panel's button, in view: what a press outside does where closing would lose something. A blink where motion is reduced. */\nfunction shake(el: HTMLElement): void {\n el.scrollIntoView({ block: 'nearest' });\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return void el.animate({ opacity: [1, 0.3, 1, 0.3, 1] }, 400);\n el.animate({ translate: ['0', '-5px', '5px', '-4px', '4px', '-2px', '0'] }, { duration: 360, easing: 'ease-out' });\n}\n\n/** Puts an outline over `r`. */\nfunction place(el: HTMLElement, r: DOMRect): void {\n Object.assign(el.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });\n}\n\n/** How far from the element the popup's outline is drawn, in pixels. */\nconst ROOM = 4;\n\n/**\n * Outlines the element the popup is open on, for as long as it is: which one it's about, where several look alike\n * or the popup covers it. Dashed, with no fill and a little room around the element, so nothing of it is drawn on:\n * a border, a ring or a colour tried on it shows as it is. Read each frame, as the element moves with the page's\n * scrolling, its layout and what a panel previews on it. Answers what removes it.\n */\nfunction outline(root: ShadowRoot, element: Element): () => void {\n const box = div('box on');\n root.append(box);\n let frame = 0;\n let was = '';\n const follow = () => {\n frame = requestAnimationFrame(follow);\n const r = element.getBoundingClientRect();\n const now = element.isConnected ? `${r.left},${r.top},${r.width},${r.height}` : '';\n if (now === was) return;\n was = now;\n box.classList.toggle('shown', now !== '');\n place(box, new DOMRect(r.left - ROOM, r.top - ROOM, r.width + 2 * ROOM, r.height + 2 * ROOM));\n };\n follow();\n return () => {\n cancelAnimationFrame(frame);\n box.remove();\n };\n}\n\nconst MARGIN = 8;\n// Under this much room on either side, the panel overlaps the element rather than shrink to a sliver beside it.\nconst LEAST = 160;\n\n/** How far a press on the head moves, in pixels, before it's a drag: a click there leaves the popup following. */\nconst SLACK = 3;\n\n/**\n * Keeps a panel beside `element` and inside the viewport, as its tabs fill it, the window resizes and the element\n * moves with the page: below, or above where it fits better, its height capped to the room there, so the body\n * scrolls rather than the panel leaving the window. Dragged by `handle`, it stays where it's put, in the window,\n * and follows the element no more. Fixed, so it never changes the page's own scrolling. Answers a release.\n */\nfunction keepInView(panel: HTMLElement, body: HTMLElement, handle: HTMLElement, element: Element): () => void {\n let frame = 0;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Where the element was last seen: one gone from the page leaves the popup where it was.\n let r = element.getBoundingClientRect();\n let moved: { left: number; top: number } | undefined;\n const fit = () => {\n cancelAnimationFrame(frame);\n clearTimeout(timer);\n frame = 0;\n timer = undefined;\n // The viewport without the page's scrollbars.\n const width = document.documentElement.clientWidth;\n const height = document.documentElement.clientHeight;\n // What the panel would take with no cap: its frame, and all of its body.\n const wanted = panel.offsetHeight - body.clientHeight + body.scrollHeight;\n if (moved !== undefined) {\n const room = Math.max(0, height - 2 * MARGIN);\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(moved.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${Math.max(MARGIN, Math.min(moved.top, height - MARGIN - Math.min(wanted, room)))}px`,\n maxHeight: `${room}px`,\n });\n return;\n }\n const top = Math.min(Math.max(r.top, 0), height);\n const bottom = Math.min(Math.max(r.bottom, 0), height);\n const below = height - bottom - 2 * MARGIN;\n const above = top - 2 * MARGIN;\n const cap = Math.max(0, Math.min(height * 0.6, height - 2 * MARGIN));\n let at: number;\n let room: number;\n if (Math.max(below, above) < LEAST) {\n room = height - 2 * MARGIN;\n at = Math.min(Math.max(bottom + MARGIN, MARGIN), height - MARGIN - Math.min(wanted, room));\n } else if (wanted <= below || below >= above) {\n room = Math.min(below, cap);\n at = bottom + MARGIN;\n } else {\n room = Math.min(above, cap);\n at = top - MARGIN - Math.min(wanted, room);\n }\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(r.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${at}px`,\n bottom: '',\n maxHeight: `${room}px`,\n });\n };\n // Not in the observers' callbacks, where a change of size is a \"ResizeObserver loop\" error on the page. The next\n // frame, or a moment later where there's none: a hidden tab draws no frames, and its popup still fits when shown.\n const later = () => {\n frame ||= requestAnimationFrame(fit);\n timer ??= setTimeout(fit, 50);\n };\n fit();\n // Read each frame, as nothing tells of an element moving: the page scrolls, its layout shifts, a panel previews.\n let watching = requestAnimationFrame(function watch() {\n if (moved !== undefined) return;\n watching = requestAnimationFrame(watch);\n if (!element.isConnected) return;\n const now = element.getBoundingClientRect();\n if (now.left === r.left && now.top === r.top && now.width === r.width && now.height === r.height) return;\n r = now;\n fit();\n });\n // A drag starts on the head itself, not on a tab or the close in it.\n let from: { x: number; y: number; left: number; top: number } | undefined;\n const down = (e: PointerEvent) => {\n if (e.button !== 0 || (e.target as Element).closest('button') !== null) return;\n // Kept from the browser: no text selected along the way, and the field being typed in keeps its focus.\n e.preventDefault();\n const at = panel.getBoundingClientRect();\n from = { x: e.clientX, y: e.clientY, left: at.left, top: at.top };\n handle.setPointerCapture(e.pointerId);\n };\n const move = (e: PointerEvent) => {\n if (from === undefined) return;\n const x = e.clientX - from.x;\n const y = e.clientY - from.y;\n if (moved === undefined && Math.hypot(x, y) < SLACK) return;\n moved = { left: from.left + x, top: from.top + y };\n panel.classList.add('dragging');\n fit();\n };\n const up = () => {\n from = undefined;\n panel.classList.remove('dragging');\n };\n handle.addEventListener('pointerdown', down);\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', up);\n handle.addEventListener('pointercancel', up);\n // A tab's content arrives after the panel opens, and changes as it's used, as does the status line. Both, as a\n // resize observer reports only while the page renders: a hidden tab's popup would keep its first place.\n const resized = new ResizeObserver(later);\n resized.observe(panel);\n const changed = new MutationObserver(later);\n changed.observe(panel, { childList: true, subtree: true, characterData: true });\n window.addEventListener('resize', later);\n return () => {\n cancelAnimationFrame(frame);\n cancelAnimationFrame(watching);\n clearTimeout(timer);\n resized.disconnect();\n changed.disconnect();\n window.removeEventListener('resize', later);\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\n/** A button that is a drawing: named for what it does, as its title, the tooltip, changes with what it would do. */\nfunction iconButton(svg: string, name: string, title: string): HTMLButtonElement {\n const el = button('', title);\n el.className = 'icon';\n el.innerHTML = svg;\n el.setAttribute('aria-label', name);\n return el;\n}\n\nfunction button(text: string, title: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n return el;\n}\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n"],"mappings":";;;AAUA,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,QAAQ;AAEd,MAAM,gBAAgB,WAAW,kCAAkC,CAAC,CAAC;AACrE,MAAM,SAAS,MAAc,GAAG,KAAK,MAAM,IAAI,EAAE,EAAE,GAAG,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;;;;;AAMhG,SAAgB,aACd,MACA,OACA,EAAE,KAAK,GAAG,MAAM,SAAS,UAAkD,CAAC,GACrD;CACvB,MAAM,MAAMA,MAAI,SAAS,oBAAoB,UAAU;CACvD,IAAI,CAAC,QAAQ;EACX,IAAI,QAAQ,eAAe;EAC3B,IAAI,aAAa,QAAQ,QAAQ;EACjC,IAAI,aAAa,cAAc,MAAM;CACvC;CACA,MAAM,WAAWA,MAAI,aAAa;CAClC,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,OAAOA,MAAI,SAAS;CAC1B,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,QAAQA,MAAI,UAAU;CAC5B,MAAM,UAAUA,MAAI,YAAY;CAChC,MAAM,QAAQC,SAAO,KAAK,eAAe,UAAU;CACnD,KAAK,OAAO,OAAO,OAAO,SAAS,KAAK;CACxC,MAAM,OAAOD,MAAI,SAAS;CAC1B,MAAM,OAAO,MAAM,IAAI;CACvB,MAAM,OAAOC,SAAO,KAAK,gBAAgB,SAAS;CAClD,MAAM,OAAOA,SAAO,KAAK,YAAY,SAAS;CAC9C,IAAI,OAAO,UAAU,OAAO,GAAI,MAAM,SAAS,IAAI,CAA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/client/lightbox.ts","../../src/client/style.ts","../../src/client/tooltip.ts","../../src/client/index.ts"],"sourcesContent":["/**\n * A panel's `away`, kept past a page load: the tab, the element's place and the state it left, for the\n * next page to come back with when what it left for carries on there (a recording does).\n *\n * The state may hold what JSON can't (a drawn screenshot is a `Blob`), so it's in IndexedDB, which is the\n * origin's: the tab's session storage holds the key, so each tab comes back to its own.\n */\nimport type { Target } from '#src/index.ts';\n\n/** What the next page needs to come back: which tab, on what, with what. */\nexport interface Away {\n tab: string;\n target: Target;\n state: unknown;\n}\n\nconst KEY = 'deictic:away';\nconst STORE = 'away';\n/** How long one nobody came back to is kept, in milliseconds: its tab was closed. */\nconst STALE = 24 * 60 * 60 * 1000;\n\n/** One at a time, in the order asked: a `drop` right after a `keep` must not run before it. */\nlet last: Promise<unknown> = Promise.resolve();\n\nfunction store<T>(mode: IDBTransactionMode, work: (store: IDBObjectStore) => IDBRequest<T>): Promise<T> {\n const next = last\n .catch(() => {})\n .then(\n () =>\n new Promise<T>((done, fail) => {\n const opening = indexedDB.open('deictic', 1);\n opening.addEventListener('upgradeneeded', () => opening.result.createObjectStore(STORE));\n opening.addEventListener('error', () => fail(opening.error));\n opening.addEventListener('success', () => {\n const db = opening.result;\n const transaction = db.transaction(STORE, mode);\n transaction.addEventListener('complete', () => db.close());\n transaction.addEventListener('abort', () => db.close());\n try {\n const request = work(transaction.objectStore(STORE));\n request.addEventListener('error', () => fail(request.error));\n request.addEventListener('success', () => done(request.result));\n } catch (e) {\n // What can't be copied throws as it's put, here, where nothing would hear it.\n fail(e);\n }\n });\n }),\n );\n last = next;\n return next;\n}\n\nconst keyOf = (): string | undefined => {\n try {\n return sessionStorage.getItem(KEY) ?? undefined;\n } catch {\n // Storage can be off: nothing is kept past the page, then.\n return undefined;\n }\n};\n\n/** Keeps it for the tab's next page. A state that can't be copied (it holds a function, an element) isn't kept, and a page load loses it. */\nexport function keepAway(away: Away): void {\n try {\n const key = keyOf() ?? crypto.randomUUID();\n sessionStorage.setItem(KEY, key);\n void store('readwrite', (s) => {\n // Those of tabs long closed go as a new one comes.\n const walk = s.openCursor();\n walk.addEventListener('success', () => {\n const cursor = walk.result;\n if (cursor === null) return;\n if (Date.now() - (cursor.value as { at: number }).at > STALE) cursor.delete();\n cursor.continue();\n });\n return s.put({ ...away, at: Date.now() }, key);\n }).catch(() => {});\n } catch {\n // Not kept, then.\n }\n}\n\n/** What the page before this left, if it left anything. */\nexport async function keptAway(): Promise<Away | undefined> {\n const key = keyOf();\n if (key === undefined) return undefined;\n try {\n return await store<Away | undefined>('readonly', (s) => s.get(key));\n } catch {\n return undefined;\n }\n}\n\n/** It's come back, or there's nothing to come back for. */\nexport function dropAway(): void {\n const key = keyOf();\n if (key === undefined) return;\n try {\n sessionStorage.removeItem(KEY);\n } catch {\n // It was readable, so this doesn't happen; and a stale one is dropped by the page that finds it.\n }\n void store('readwrite', (s) => s.delete(key)).catch(() => {});\n}\n","/**\n * The lightbox: what a panel has attached (a capture, a recording's replay, a voice clip), big, over everything,\n * one at a time, ← and → between them. It grows out of the element that opened it and shrinks back into it, or\n * fades where motion is reduced. A sound plays in a player of its own: play, its waveform with what's played\n * lit (click or drag it to seek), and the time. It's a modal (`data-deictic-modal`): Esc closes it, not the popup.\n */\nimport type { LightboxItem, LightboxOptions } from '#src/index.ts';\n\nimport { type Colors, drawBars, peaksOf } from './waveform.ts';\n\nconst EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';\nconst PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\nconst PAUSE = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M6 4h4v16H6zM14 4h4v16h-4z\" fill=\"currentColor\"/></svg>';\n\nconst reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst clock = (s: number) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, '0')}`;\n\n/**\n * Opens it in `root`. `pinned` draws it where `root` is in the page instead, with no backdrop, motion or keys, and\n * actions that don't close it: for a page of deictic's own states (`lightboxIn`).\n */\nexport function openLightbox(\n root: ShadowRoot,\n items: LightboxItem[],\n { at = 0, from, pinned = false }: LightboxOptions & { pinned?: boolean } = {},\n): { close: () => void } {\n const box = div(pinned ? 'lightbox pinned' : 'lightbox');\n if (!pinned) {\n box.dataset.deicticModal = '';\n box.setAttribute('role', 'dialog');\n box.setAttribute('aria-modal', 'true');\n }\n const backdrop = div('lb-backdrop');\n const stage = div('lb-stage');\n const head = div('lb-head');\n const title = div('lb-title');\n const count = div('lb-count');\n const actions = div('lb-actions');\n const close = button('×', 'Close (Esc)', 'lb-close');\n head.append(title, count, actions, close);\n const body = div('lb-body');\n stage.append(head, body);\n const prev = button('‹', 'Previous (←)', 'lb-prev');\n const next = button('›', 'Next (→)', 'lb-next');\n box.append(backdrop, stage, ...(items.length > 1 ? [prev, next] : []));\n root.append(box);\n\n let index = Math.min(Math.max(0, at), items.length - 1);\n let leave: (() => void) | undefined;\n let closing = false;\n\n const show = (i: number, animate: boolean) => {\n leave?.();\n leave = undefined;\n index = (i + items.length) % items.length;\n const item = items[index]!;\n box.setAttribute('aria-label', item.title);\n title.textContent = item.title;\n count.textContent = items.length > 1 ? `${index + 1} / ${items.length}` : '';\n actions.replaceChildren(\n ...(item.actions ?? []).map((a) => {\n const b = button(a.label, a.title ?? '', '');\n b.addEventListener('click', () => {\n if (!pinned) done();\n a.run();\n });\n return b;\n }),\n );\n // A sound plays as it opens, but not on a page that only shows the lightbox.\n const content = contentOf(item, !pinned);\n body.replaceChildren(content.element);\n leave = content.leave;\n if (animate && !reduced()) body.animate({ opacity: [0, 1] }, { duration: 160, easing: 'ease-out' });\n };\n\n /** The transform that puts the stage where `from` is: what it grows from and shrinks back to. */\n const fromRect = () => {\n if (from === undefined || !from.isConnected) return undefined;\n const f = from.getBoundingClientRect();\n const s = stage.getBoundingClientRect();\n if (f.width === 0 || s.width === 0) return undefined;\n return `translate(${f.left - s.left}px, ${f.top - s.top}px) scale(${f.width / s.width}, ${f.height / s.height})`;\n };\n\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') done();\n else if (e.key === 'ArrowLeft' && items.length > 1) show(index - 1, true);\n else if (e.key === 'ArrowRight' && items.length > 1) show(index + 1, true);\n else return;\n // The popup, under it, waits for its own Esc.\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n if (!pinned) addEventListener('keydown', onKey, true);\n\n function done() {\n if (closing) return;\n closing = true;\n removeEventListener('keydown', onKey, true);\n leave?.();\n if (pinned) return box.remove();\n const gone = () => {\n box.remove();\n if (from instanceof HTMLElement && from.isConnected) from.focus({ preventScroll: true });\n };\n if (reduced()) return gone();\n const to = fromRect();\n backdrop.animate({ opacity: [1, 0] }, { duration: 200, easing: 'ease-in', fill: 'forwards' });\n stage\n .animate(\n to === undefined\n ? { opacity: [1, 0], transform: ['none', 'scale(0.96)'] }\n : { transform: ['none', to], opacity: [1, 1, 0], offset: [0, 0.8, 1] },\n { duration: 220, easing: EASE, fill: 'forwards' },\n )\n .finished.then(gone, gone);\n }\n\n backdrop.addEventListener('click', done);\n close.addEventListener('click', done);\n prev.addEventListener('click', () => show(index - 1, true));\n next.addEventListener('click', () => show(index + 1, true));\n\n show(index, false);\n if (pinned) {\n close.hidden = true;\n return { close: done };\n }\n close.focus({ preventScroll: true });\n if (reduced()) {\n box.animate({ opacity: [0, 1] }, { duration: 150 });\n } else {\n backdrop.animate({ opacity: [0, 1] }, { duration: 240, easing: 'ease-out' });\n const grow = fromRect();\n stage.animate(\n grow === undefined\n ? { opacity: [0, 1], transform: ['scale(0.96)', 'none'] }\n : { transform: [grow, 'none'], opacity: [0, 1, 1], offset: [0, 0.2, 1] },\n { duration: 280, easing: EASE },\n );\n }\n return { close: done };\n}\n\n/** An item, drawn: what goes in the body, and what to stop when it's left (a sound playing). */\nfunction contentOf(item: LightboxItem, autoplay: boolean): { element: HTMLElement; leave?: () => void } {\n switch (item.kind) {\n case 'image': {\n const img = Object.assign(document.createElement('img'), { src: item.url, alt: item.title, className: 'lb-image', draggable: false });\n return { element: img };\n }\n case 'page': {\n const frame = Object.assign(document.createElement('iframe'), { src: item.url, title: item.title, className: 'lb-page' });\n frame.allow = 'autoplay; fullscreen';\n return { element: frame };\n }\n case 'audio':\n return player(item.url, autoplay);\n }\n}\n\n/** A sound: play and pause, its waveform with what's played lit, and the time. With `autoplay`, it starts playing. */\nfunction player(url: string, autoplay: boolean): { element: HTMLElement; leave: () => void } {\n const el = div('lb-audio');\n const play = button('', 'Play (Space)', 'lb-play');\n const wave = Object.assign(document.createElement('canvas'), { className: 'lb-wave' });\n wave.setAttribute('role', 'slider');\n wave.setAttribute('aria-label', 'Where in the clip');\n wave.tabIndex = 0;\n const time = div('lb-time');\n el.append(play, wave, time);\n const audio = new Audio(url);\n const colors: Colors = { played: '#3ddc7c', rest: '#52525b' };\n // Flat until the clip's read: the bars rise when its peaks are in.\n let peaks: number[] = Array<number>(120).fill(0.05);\n let frame = 0;\n // MediaRecorder's webm says no length until it's played through; reading the peaks gives it sooner.\n let length = 0;\n const lengthOf = () => (Number.isFinite(audio.duration) && audio.duration > 0 ? audio.duration : length);\n const draw = () => {\n const total = lengthOf();\n drawBars(wave, peaks, total > 0 ? audio.currentTime / total : 0, colors);\n time.textContent = `${clock(audio.currentTime)} / ${total > 0 ? clock(total) : '–:––'}`;\n wave.setAttribute('aria-valuenow', String(Math.round(audio.currentTime)));\n };\n const loop = () => {\n draw();\n frame = audio.paused ? 0 : requestAnimationFrame(loop);\n };\n const state = () => {\n play.innerHTML = audio.paused ? PLAY : PAUSE;\n play.title = audio.paused ? 'Play (Space)' : 'Pause (Space)';\n if (!audio.paused && frame === 0) frame = requestAnimationFrame(loop);\n draw();\n };\n audio.addEventListener('play', state);\n audio.addEventListener('pause', state);\n audio.addEventListener('ended', state);\n audio.addEventListener('loadedmetadata', draw);\n const toggle = () => void (audio.paused ? audio.play().catch(() => {}) : audio.pause());\n play.addEventListener('click', toggle);\n const seek = (e: PointerEvent) => {\n const r = wave.getBoundingClientRect();\n const total = lengthOf();\n if (total > 0) audio.currentTime = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * total;\n draw();\n };\n wave.addEventListener('pointerdown', (e) => {\n wave.setPointerCapture(e.pointerId);\n seek(e);\n });\n wave.addEventListener('pointermove', (e) => {\n if (wave.hasPointerCapture(e.pointerId)) seek(e);\n });\n el.addEventListener('keydown', (e) => {\n if (e.key !== ' ') return;\n e.preventDefault();\n toggle();\n });\n void peaksOf(url, 120).then(\n (read) => {\n peaks = read.peaks;\n length = read.duration;\n draw();\n },\n // Undecodable here: the player still plays it, over flat bars.\n () => {},\n );\n state();\n if (autoplay) void audio.play().catch(() => state());\n // The canvas has its size once it's in the page.\n requestAnimationFrame(draw);\n return {\n element: el,\n leave: () => {\n audio.pause();\n cancelAnimationFrame(frame);\n },\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\nfunction button(text: string, title: string, className: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n el.className = className;\n return el;\n}\n","/**\n * The overlay's styles, in its shadow root. Panels style their bodies with the same custom\n * properties, so a plugin's panel looks like the rest without styles of its own for the basics.\n */\nexport const STYLE = `\n:host {\n --deictic-accent: #12b358;\n --deictic-on-accent: #04130b;\n --deictic-bg: #18181b;\n --deictic-fg: #f4f4f5;\n --deictic-muted: #a1a1aa;\n --deictic-line: #3f3f46;\n --deictic-problem: #f87171;\n all: initial;\n /* Inherited by everything in the root: a thumb and no track, on whatever the panel's background is. */\n scrollbar-color: var(--deictic-line) transparent;\n}\n/* The host takes no room in the page: everything in it is fixed, so nothing of deictic's moves or scrolls it. */\n:host(deictic-overlay) { display: contents; }\n.box {\n position: fixed;\n display: none;\n z-index: 2147483646;\n pointer-events: none;\n box-sizing: border-box;\n outline: 2px solid var(--deictic-accent);\n background: rgb(18 179 88 / 0.1);\n}\n.box.shown { display: block; }\n.box.inner { outline: 1px dashed var(--deictic-accent); background: none; }\n/* The element the popup is open on: dashed and off it a little, with no fill, so what's tried on it shows as it is. */\n.box.on { outline: 1px dashed var(--deictic-accent); border-radius: 4px; background: none; }\n.label {\n position: absolute;\n left: -2px;\n bottom: 100%;\n padding: 1px 6px;\n font: 12px/1.5 ui-monospace, monospace;\n white-space: nowrap;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.label.below { top: 100%; bottom: auto; }\n.panel {\n position: fixed;\n z-index: 2147483647;\n width: min(360px, calc(100vw - 16px));\n max-height: 60vh;\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n border: 1px solid var(--deictic-line);\n border-radius: 8px;\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.35);\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: var(--deictic-bg);\n}\n.panel.pinned { position: relative; z-index: auto; max-height: none; }\n@media (prefers-reduced-motion: no-preference) {\n .panel:not(.pinned) { animation: deictic-in 0.12s ease-out; }\n}\n@keyframes deictic-in {\n from { opacity: 0; translate: 0 4px; }\n}\n.head {\n display: flex;\n align-items: flex-end;\n gap: 2px;\n padding: 4px 8px 0;\n}\n/* Over the page the head is what the popup is dragged by; no touch scrolling starts there. */\n.panel:not(.pinned) .head { cursor: grab; touch-action: none; user-select: none; }\n.panel.dragging .head, .panel.dragging .head button { cursor: grabbing; }\n.head .tab {\n border: 0;\n border-bottom: 2px solid transparent;\n border-radius: 0;\n padding: 4px 8px;\n font-weight: 600;\n color: var(--deictic-muted);\n}\n.head .tab:hover { color: var(--deictic-fg); }\n.head .tab[aria-selected='true'] { color: var(--deictic-fg); border-bottom-color: var(--deictic-accent); }\n.head .close { margin: 0 0 3px auto; }\n.bar {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 4px 8px;\n border-top: 1px solid var(--deictic-line);\n border-bottom: 1px solid var(--deictic-line);\n}\n.bar .where {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n margin-right: auto;\n font: 12px ui-monospace, monospace;\n color: var(--deictic-muted);\n text-decoration: none;\n}\n.bar .where span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.bar .where svg { flex: none; }\n.bar .where:hover, .bar .where:focus-visible { color: var(--deictic-fg); }\n.bar .where:hover span { text-decoration: underline; }\n.bar .absent { flex: none; margin-right: 6px; font-size: 12px; color: var(--deictic-muted); }\n.lightbox {\n position: fixed;\n inset: 0;\n z-index: 2147483647;\n display: flex;\n align-items: center;\n justify-content: center;\n font: 13px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n}\n.lb-backdrop { position: absolute; inset: 0; background: rgb(9 9 11 / 0.72); backdrop-filter: blur(2px); }\n.lb-stage {\n position: relative;\n display: flex;\n flex-direction: column;\n max-width: 92vw;\n max-height: 90vh;\n border: 1px solid var(--deictic-line);\n border-radius: 10px;\n background: var(--deictic-bg);\n box-shadow: 0 24px 64px rgb(0 0 0 / 0.5);\n transform-origin: 0 0;\n overflow: hidden;\n}\n.lb-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--deictic-line); }\n.lb-title { font-weight: 600; }\n.lb-count { color: var(--deictic-muted); font-size: 12px; font-variant-numeric: tabular-nums; }\n.lb-actions { display: flex; gap: 6px; margin-left: auto; }\n.lb-body { display: flex; justify-content: center; min-height: 0; background: #09090b; }\n.lb-image { display: block; max-width: 92vw; max-height: calc(90vh - 48px); object-fit: contain; }\n.lb-page { display: block; width: min(1280px, 92vw); height: min(860px, calc(90vh - 48px)); border: 0; background: #18181b; }\n.lb-audio { display: flex; align-items: center; gap: 12px; width: min(640px, 86vw); padding: 20px 16px; }\n.lb-play {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 0;\n border-radius: 50%;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.lb-play svg { width: 16px; height: 16px; }\n.lb-wave { flex: 1; min-width: 0; height: 56px; cursor: pointer; border-radius: 4px; }\n.lb-wave:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 2px; }\n.lb-time { flex: none; min-width: 9ch; text-align: right; font: 12px ui-monospace, monospace; color: var(--deictic-muted); }\n.lb-prev, .lb-next {\n position: absolute;\n top: 50%;\n translate: 0 -50%;\n width: 40px;\n height: 40px;\n padding: 0;\n border: 1px solid var(--deictic-line);\n border-radius: 50%;\n font-size: 22px;\n line-height: 1;\n background: var(--deictic-bg);\n}\n.lb-prev { left: 16px; }\n.lb-next { right: 16px; }\n.lightbox.pinned { position: relative; inset: auto; z-index: auto; display: block; padding: 0 64px; }\n.lightbox.pinned .lb-stage { max-width: 100%; max-height: none; }\n.lightbox.pinned .lb-page { width: 100%; height: 420px; }\n.lightbox.pinned .lb-image { max-width: 100%; max-height: 420px; }\n.lightbox.pinned .lb-backdrop { display: none; }\n.lightbox.pinned .lb-audio { width: 100%; box-sizing: border-box; }\n.lightbox.pinned .lb-close { display: none; }\n.tip {\n position: fixed;\n left: 0;\n top: 0;\n z-index: 2147483647;\n max-width: 280px;\n padding: 3px 6px;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n font: 12px/1.4 system-ui, sans-serif;\n color: var(--deictic-fg);\n background: #09090b;\n box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);\n pointer-events: none;\n visibility: hidden;\n opacity: 0;\n transition: opacity 0.12s;\n}\n.tip.shown { visibility: visible; opacity: 1; }\nbutton {\n font: inherit;\n color: inherit;\n background: transparent;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 1px 7px;\n cursor: pointer;\n}\nbutton:hover { border-color: var(--deictic-muted); }\nbutton:disabled { opacity: 0.5; cursor: default; }\nbutton:disabled:hover { border-color: var(--deictic-line); }\n/* One ring for whatever the keyboard lands on, in place of each browser's own. */\nbutton:focus-visible, a:focus-visible { outline: 1px solid var(--deictic-accent); outline-offset: 1px; }\nbutton.icon {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 22px;\n height: 22px;\n padding: 0;\n border: 0;\n color: var(--deictic-muted);\n}\nbutton.icon svg { width: 14px; height: 14px; }\nbutton.icon:hover:not(:disabled) { color: var(--deictic-fg); background: rgb(255 255 255 / 0.08); }\nbutton.primary { background: var(--deictic-accent); border-color: var(--deictic-accent); color: var(--deictic-on-accent); }\ninput, textarea {\n box-sizing: border-box;\n width: 100%;\n font: 12px ui-monospace, monospace;\n color: inherit;\n background: #09090b;\n border: 1px solid var(--deictic-line);\n border-radius: 4px;\n padding: 4px 6px;\n}\ninput:focus, textarea:focus { outline: 1px solid var(--deictic-accent); }\ncode { font: 12px ui-monospace, monospace; }\n/* Border-box, as the popup holds the body's height by its whole box while a tab reads. */\n.body { box-sizing: border-box; padding: 8px; overflow: auto; }\n.status { padding: 0 8px 6px; font-size: 12px; color: var(--deictic-muted); }\n.status:empty { display: none; }\n.status.problem { color: var(--deictic-problem); }\n`;\n","/**\n * One tooltip for everything deictic draws in a shadow root: whatever has a `title` (or `data-tip`) shows it\n * in a box of ours, soon after the pointer rests or focus lands, instead of the browser's, which comes late\n * and looks like nothing else here. Plugins only set `title`, as they would anywhere; the first hover moves\n * it to `data-tip`, so the browser's own stays away, and gives a textless control the title as its name.\n * The box is fixed in the root, so no panel's scrolling clips it.\n */\nconst DELAY = 300;\n\nexport function tooltips(root: ShadowRoot): void {\n const tip = document.createElement('div');\n tip.className = 'tip';\n tip.setAttribute('role', 'tooltip');\n root.append(tip);\n let timer = 0;\n let over: Element | undefined;\n\n const hide = () => {\n clearTimeout(timer);\n over = undefined;\n tip.classList.remove('shown');\n };\n const show = (el: Element) => {\n const text = el.getAttribute('data-tip');\n if (text === null || text === '' || !el.isConnected) return hide();\n tip.textContent = text;\n // Last in the root, over a modal or toolbar added since at the same z-index.\n if (tip !== root.lastElementChild) root.append(tip);\n tip.classList.add('shown');\n // Centred below it, kept on screen; above it where there's no room below.\n const r = el.getBoundingClientRect();\n const t = tip.getBoundingClientRect();\n const left = Math.max(8, Math.min(r.left + r.width / 2 - t.width / 2, innerWidth - t.width - 8));\n const top = r.bottom + 6 + t.height > innerHeight - 8 ? r.top - 6 - t.height : r.bottom + 6;\n Object.assign(tip.style, { left: `${left}px`, top: `${top}px` });\n };\n /** The element with a tip around where the event happened, its `title` taken over the first time. */\n const tipped = (e: Event) => {\n for (const node of e.composedPath()) {\n if (!(node instanceof Element)) continue;\n if (node === tip) return undefined;\n // A frame's title is its name for assistive tech, not a tip; what's in it has tips of its own.\n if (node.localName === 'iframe') return undefined;\n const title = node.getAttribute('title');\n if (title !== null) {\n node.removeAttribute('title');\n if (title === '') continue;\n node.setAttribute('data-tip', title);\n // A control with no text of its own (an icon, ×, ↶) is known by its tip; one with text keeps its name.\n if (!node.hasAttribute('aria-label') && (node.textContent ?? '').trim().length <= 1) node.setAttribute('aria-label', title);\n else node.setAttribute('aria-description', title);\n }\n if (node.hasAttribute('data-tip')) return node;\n }\n return undefined;\n };\n const enter = (e: Event) => {\n const el = tipped(e);\n if (el === over) return;\n hide();\n if (el === undefined) return;\n over = el;\n timer = window.setTimeout(() => show(el), e.type === 'focusin' ? 0 : DELAY);\n };\n root.addEventListener('pointerover', enter);\n root.addEventListener('focusin', (e) => {\n // Focus from the keyboard only: a click focuses too, and its tip is the pointer's.\n if ((e.target as Element).matches(':focus-visible')) enter(e);\n });\n root.addEventListener('pointerout', (e) => {\n const to = (e as PointerEvent).relatedTarget;\n if (over !== undefined && !(to instanceof Node && over.contains(to))) hide();\n });\n root.addEventListener('focusout', hide);\n // A press acts, and what it changes (a mic turned on) may change the tip: the next hover shows the new one.\n root.addEventListener('pointerdown', hide);\n addEventListener('scroll', hide, { capture: true, passive: true });\n}\n","/**\n * `deictic/client`: the overlay the page loads in dev. Hold a shortcut's keys (Alt, deictic's own,\n * by default) and point: the element under the pointer that the source marked (`tools/locate.ts`) is\n * outlined, with its tag, its place and how many elements share it. Press the shortcut's button to open\n * the popup there: a tab for each plugin with a panel, at the one used last, or at a plugin's own where\n * its shortcut was pressed.\n *\n * Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A\n * panel's undo and redo are its tab's on its element: the latest change that plugin made there.\n */\nimport type { ClientContext, ClientPlugin, LightboxItem, PanelContext, Resumed, Standalone, Target } from '#src/index.ts';\nimport { gestureOf, type Shortcut } from '#src/shortcut.ts';\n\nimport { dropAway, keepAway, keptAway } from './away.ts';\nimport { openLightbox } from './lightbox.ts';\nimport { STYLE } from './style.ts';\nimport { tooltips } from './tooltip.ts';\n\n// For a plugin's page half that records the mic, or shows a clip: the waveforms the lightbox draws.\nexport { drawBars, liveWaveform, peaksOf, type Colors } from './waveform.ts';\n\nexport interface StartOptions {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's own shortcut, checked: it opens the popup at the tab used last. None where it's turned off. */\n shortcut?: Required<Shortcut>;\n /** Each plugin with a half in the page, and its own shortcut as the bundler's plugin checked it, where it has one. */\n plugins: { plugin: ClientPlugin; shortcut?: Required<Shortcut>; options?: unknown }[];\n /** What answers the requests where there's no dev server to: a `standalone` build's. */\n server?: Standalone;\n}\n\n/** A request to the endpoints, by its URL: to the dev server, or to what stands in for it. */\ntype Send = (url: string, init?: RequestInit) => Promise<Response>;\n\ntype Mount = (panel: HTMLElement, context: PanelContext<unknown, unknown>) => (() => void) | void;\n\n/** A plugin with a panel: a tab in the popup. */\ninterface Tab {\n plugin: ClientPlugin;\n mount: Mount;\n}\n\nconst ATTRIBUTE = 'data-deictic';\n/** An arrow pointing up and out: the link leaves the page for the editor. */\nconst OUT = icon('M7 17 17 7M8 7h9v9', 2.25);\n// Drawn, as the arrows and the cross of a system's font differ in size and weight from one to the next.\nconst UNDO = icon('M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11');\nconst REDO = icon('m15 14 5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13');\nconst CLOSE = icon('M18 6 6 18M6 6l12 12');\n/** Where the tab used last is kept, for deictic's own shortcut to open it again. */\nconst LAST = 'deictic:tab';\n/** How long a read may take, in milliseconds, before the popup says it's reading. */\nconst SLOW = 200;\nconst STARTED = Symbol.for('deictic');\n\nexport function targetOf(el: Element): Target | undefined {\n const at = el.getAttribute(ATTRIBUTE);\n const match = at === null ? null : /^(.*):(\\d+):(\\d+)$/.exec(at);\n if (match === null) return undefined;\n return { loc: { file: match[1]!, line: Number(match[2]), column: Number(match[3]) }, tag: el.localName };\n}\n\nconst sameAs = (el: Element) => [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(el.getAttribute(ATTRIBUTE) ?? '')}\"]`)];\n\n/** The nearest marked element around `el`, out through shadow roots to their hosts. */\nfunction markedAround(el: Element): Element | undefined {\n for (let at: Element | undefined = el; at !== undefined;) {\n const marked = at.closest(`[${ATTRIBUTE}]`);\n if (marked !== null) return marked;\n const root = at.getRootNode();\n at = root instanceof ShadowRoot ? root.host : undefined;\n }\n return undefined;\n}\n\n/** `div.panel > button.tab`: the element as a selector, the deepest classes only, for a person to tell it by. */\nfunction icon(path: string, width = 2): string {\n return `<svg viewBox=\"0 0 24 24\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"${width}\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"${path}\"/></svg>`;\n}\n\nconst nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n\n/** What the overlay keeps once started, for `popupIn` to show the popup with. */\ninterface Started {\n base: string;\n send: Send;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** Opens the popup over the page on an element, at a tab or the one used last: `openPopup`. */\n open: (element: Element, tab?: string) => boolean;\n}\n\nlet started: Started | undefined;\n\n/**\n * What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as\n * it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.\n */\nexport const POPUP_OPENED = 'deictic:open';\nexport const POPUP_CLOSED = 'deictic:close';\n\nexport interface PopupOpened {\n /** The element it's open on. */\n element: Element;\n /** The plugin whose tab it opened at. */\n tab: string;\n}\n\n/**\n * Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the\n * tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.\n * Answers whether it opened: not where no plugin has a tab, or `element` has no mark. The overlay must have started.\n */\nexport function openPopup(element: Element, { tab }: { tab?: string } = {}): boolean {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to open');\n return started.open(element, tab);\n}\n\n/**\n * Shows the popup in `container`, open at a tab (`tab`, a plugin's name, or the first) on `element`, where\n * the page puts it rather than over the page: a page of the popup's states, to point at and fix, as deictic's\n * own site does. It's the real popup, its tabs and plugins working. Closing it, or a tab's `away`, opens it\n * again in place. It draws in `container`'s shadow root, made if there isn't one. Answers what removes it.\n * The overlay must have started (the dev server's client module starts it), and `element` be marked.\n */\nexport function popupIn(container: Element, { tab: name, element }: { tab?: string; element: Element }): () => void {\n if (started === undefined) throw new Error('deictic: the overlay has not started, so there is no popup to show');\n const target = targetOf(element);\n if (target === undefined) throw new Error(`deictic: ${nameOf(element)} has no ${ATTRIBUTE} mark to open the popup on`);\n const { base, send, contextOf, tabs } = started;\n // A tab shown here isn't one a person chose: the popup over the page keeps opening at theirs.\n const remember = () => {};\n const tab = tabs.find((t) => t.plugin.name === name) ?? tabs[0];\n if (tab === undefined) throw new Error('deictic: no plugin has a tab to show');\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n let panel: { close: () => void } | undefined;\n let gone = false;\n const open = (at: Tab, resumed?: Resumed) => {\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: at,\n remember,\n element,\n target,\n pinned: true,\n onClose: (shown, leaving) => {\n panel = undefined;\n // Closed by its own × or Esc: open again, as the page is there to show it. Leaving for `away` comes back by `reopen`.\n if (!gone && !leaving) open(shown);\n },\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, _, kept) => open(again, kept),\n });\n };\n open(tab);\n return () => {\n gone = true;\n panel?.close();\n style.remove();\n };\n}\n\n/**\n * Shows the lightbox in `container`, at `at`, where the page puts it rather than over everything: as `popupIn`\n * does the popup, for a page of deictic's own states. Its items step with its arrows; there's no backdrop, close\n * or keys, and an item's actions run without closing it. Answers what removes it.\n */\nexport function lightboxIn(container: Element, items: LightboxItem[], { at }: { at?: number } = {}): () => void {\n const root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = `${STYLE}:host { display: block; }`;\n root.replaceChildren(style);\n tooltips(root);\n const { close } = openLightbox(root, items, { ...(at === undefined ? {} : { at }), pinned: true });\n return () => {\n close();\n style.remove();\n };\n}\n\n/** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */\nexport function start({ base, shortcut: own, plugins: given, server }: StartOptions): void {\n const page = globalThis as { [STARTED]?: true };\n if (page[STARTED] === true) return;\n page[STARTED] = true;\n\n const host = document.createElement('deictic-overlay');\n const root = host.attachShadow({ mode: 'open' });\n const style = document.createElement('style');\n style.textContent = STYLE;\n const box = div('box');\n const label = div('label');\n box.append(label);\n // What's under the pointer, outlined inside the marked element around it when they differ.\n const inner = div('box inner');\n root.append(style, box, inner);\n tooltips(root);\n // What's typed in the popup is the popup's: the page hears a key from in here as one on the host, not in a field,\n // so its own shortcuts (a \"/\" to search, a \"j\" to step) would run on a task's words. Ours listen while capturing.\n for (const type of ['keydown', 'keypress', 'keyup'] as const) host.addEventListener(type, (e) => e.stopPropagation());\n document.documentElement.append(host);\n\n // Each plugin's API, set up before any panel opens. `use` reads it when asked, so a setup may keep\n // `use` for later, not call it: the plugin it asks for may not be set up yet.\n const apis = new Map<string, unknown>();\n const send: Send =\n server === undefined ? (url, init) => fetch(url, init) : async (url, init) => server(new Request(new URL(url, location.href), init));\n const optionsOf = new Map(given.map(({ plugin, options }) => [plugin.name, options]));\n const contextOf = (name: string): ClientContext => ({\n base,\n root,\n options: optionsOf.get(name),\n use: (other) => apis.get(other) as never,\n request: (route, init) => send(`${base}__deictic/plugins/${name}/${route}`, init),\n open: (plugin, element) => openAt(plugin, element),\n lightbox: (items, options) => openLightbox(root, items, options),\n });\n for (const { plugin } of given) {\n if (plugin.setup === undefined) continue;\n try {\n apis.set(plugin.name, plugin.setup(contextOf(plugin.name)));\n } catch (e) {\n // One plugin's failure is no reason to take the others down with it.\n console.error(`deictic: ${plugin.name} failed to set up`, e);\n }\n }\n const tabs: Tab[] = given.flatMap(({ plugin }) => (plugin.mount === undefined ? [] : [{ plugin, mount: plugin.mount }]));\n started = {\n base,\n send,\n contextOf,\n tabs,\n // Not over a popup holding something unsaved: the press that asked shook its button (`openPanel`).\n open: (element, tab) => tabs.length > 0 && panel?.unsaved() !== true && openAt(tab ?? last().plugin.name, element),\n };\n const last = () => {\n let name: string | null = null;\n try {\n name = localStorage.getItem(LAST);\n } catch {\n // Storage can be off: the first tab, then.\n }\n return tabs.find((t) => t.plugin.name === name) ?? tabs[0]!;\n };\n const remember = (tab: Tab) => {\n try {\n localStorage.setItem(LAST, tab.plugin.name);\n } catch {\n // Not kept, then: the next open starts at the first tab.\n }\n };\n // What opens the popup, and at which tab: deictic's own shortcut at the one used last, each\n // plugin's at its own.\n const plugins = [\n ...(own === undefined || tabs.length === 0 ? [] : [{ shortcut: own, gesture: gestureOf(own), tab: last }]),\n ...given.flatMap(({ plugin, shortcut }) => {\n if (shortcut === undefined) return [];\n const tab = tabs.find((t) => t.plugin === plugin);\n if (tab !== undefined) return [{ shortcut, gesture: gestureOf(shortcut), tab: () => tab }];\n console.error(`deictic: ${plugin.name} has a shortcut, but its page half has no \\`mount\\` to draw a tab with`);\n return [];\n }),\n ];\n\n let pointer: { x: number; y: number } | undefined;\n let frame = 0;\n let panel: { close: () => void; unsaved: () => boolean } | undefined;\n\n /** The plugins whose keys are held: several, where they share keys and differ by button. */\n const heldBy = (e: MouseEvent | KeyboardEvent) => plugins.filter((p) => p.gesture.held(e));\n /** The plugin a press opens. */\n const pressedBy = (e: MouseEvent) => plugins.find((p) => p.gesture.held(e) && e.button === p.gesture.button);\n /**\n * The marked element at a point, and what's under the pointer inside it where that differs: down through\n * open shadow roots but the overlay's own, as a page showing the popup (`popupIn`) has it in one.\n */\n const hitAt = (x: number, y: number) => {\n let under = document.elementFromPoint(x, y) ?? undefined;\n while (under !== undefined && under !== host && under.shadowRoot !== null) {\n const inside = under.shadowRoot.elementFromPoint(x, y);\n if (inside === null || inside === under) break;\n under = inside;\n }\n const el = under === undefined || under === host ? undefined : markedAround(under);\n return el === undefined ? undefined : { el, pointed: under === el ? undefined : under };\n };\n const hide = () => {\n box.classList.remove('shown');\n inner.classList.remove('shown');\n };\n const show = (held: typeof plugins) => {\n frame = 0;\n const hit = pointer === undefined ? undefined : hitAt(pointer.x, pointer.y);\n const el = hit?.el;\n const target = el === undefined ? undefined : targetOf(el);\n if (el === undefined || target === undefined) return hide();\n place(box, el.getBoundingClientRect());\n if (hit?.pointed === undefined) {\n inner.classList.remove('shown');\n } else {\n place(inner, hit.pointed.getBoundingClientRect());\n inner.classList.add('shown');\n }\n const count = sameAs(el).length;\n // The button, where it isn't the left: what the keys alone don't tell apart.\n const names = held.map(({ tab, shortcut }) => {\n const { plugin } = tab();\n const name = plugin.label ?? plugin.name;\n return shortcut.button === 'left' ? name : `${name} (${shortcut.button})`;\n });\n const within = hit?.pointed === undefined ? '' : ` › ${nameOf(hit.pointed)}`;\n label.textContent = `${names.join(' / ')} · <${target.tag}> ${target.loc.file}:${target.loc.line}${count > 1 ? ` · ×${count}` : ''}${within}`;\n label.classList.toggle('below', el.getBoundingClientRect().top < 24);\n box.classList.add('shown');\n };\n const update = (e: MouseEvent | KeyboardEvent) => {\n const held = heldBy(e);\n if (held.length === 0) return hide();\n if (frame === 0) frame = requestAnimationFrame(() => show(held));\n };\n\n window.addEventListener(\n 'mousemove',\n (e) => {\n pointer = { x: e.clientX, y: e.clientY };\n update(e);\n },\n { capture: true, passive: true },\n );\n window.addEventListener('keydown', update, true);\n window.addEventListener('keyup', update, true);\n window.addEventListener('blur', hide);\n let press = {};\n let opened: object | undefined;\n // Alt-click on a link would otherwise download it, and on a field focus it.\n window.addEventListener(\n 'mousedown',\n (e) => {\n press = {};\n if (e.composedPath().includes(host)) return;\n if (pressedBy(e) !== undefined && hitAt(e.clientX, e.clientY) !== undefined) e.preventDefault();\n },\n true,\n );\n // A press ends in `click`, `auxclick` or `contextmenu` by its button, and a right one in two of\n // them, in an order that varies by platform; on macOS Control-click is a left `contextmenu`. Each\n // is kept from the page, and the first opens the panel.\n const pressed = (e: MouseEvent) => {\n if (e.composedPath().includes(host)) return;\n const found = pressedBy(e);\n const hit = found === undefined ? undefined : hitAt(e.clientX, e.clientY);\n const target = hit === undefined ? undefined : targetOf(hit.el);\n if (found === undefined || hit === undefined || target === undefined) return;\n e.preventDefault();\n e.stopPropagation();\n if (opened === press) return;\n opened = press;\n // Still open after this press's pointerdown, outside it: it holds something unsaved, and shook its button.\n if (panel?.unsaved() === true) return;\n openTab(found.tab(), hit.el, target, undefined, hit.pointed);\n };\n const openTab = (tab: Tab, el: Element, target: Target, resumed?: Resumed, pointed?: Element) => {\n hide();\n panel?.close();\n panel = openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab,\n remember,\n element: el,\n ...(pointed === undefined ? {} : { pointed }),\n target,\n onClose: () => (panel = undefined),\n ...(resumed === undefined ? {} : { resumed }),\n reopen: (again, element, kept) => {\n // Rendered again while away, or gone from the page, which moved on: the popup comes back all the same, on\n // the element as it was left, since what it kept (a recording) is about it wherever the page is now.\n const found = element.isConnected ? element : (sameAs(element)[0] ?? element);\n openTab(again, found, targetOf(found) ?? target, kept, pointed?.isConnected === true && found === element ? pointed : undefined);\n },\n });\n };\n // What the page before this left a panel for (`away`), where that carries on here: the popup comes back when\n // it's done, on the element where this page has it, and on a stand-in for it where it doesn't.\n void keptAway().then((away) => {\n if (away === undefined) return;\n const tab = tabs.find((t) => t.plugin.name === away.tab);\n const task = tab?.plugin.resume?.(contextOf(away.tab));\n if (tab === undefined || task === undefined) return dropAway();\n const back = (resumed: Resumed) => {\n dropAway();\n const { loc, tag } = away.target;\n const absent = document.createElement(tag);\n absent.setAttribute(ATTRIBUTE, `${loc.file}:${loc.line}:${loc.column}`);\n openTab(tab, sameAs(absent).find((el) => el.localName === tag) ?? absent, away.target, resumed);\n };\n task.then(\n (result) => back({ state: away.state, result }),\n (e: unknown) => back({ state: away.state, problem: messageOf(e) }),\n );\n });\n function openAt(name: string, given: Element): boolean {\n const tab = tabs.find((t) => t.plugin.name === name);\n const el = given.isConnected ? given : (sameAs(given)[0] ?? undefined);\n const target = el === undefined ? undefined : targetOf(el);\n if (tab === undefined || el === undefined || target === undefined) return false;\n openTab(tab, el, target);\n return true;\n }\n for (const type of ['click', 'auxclick', 'contextmenu'] as const) window.addEventListener(type, pressed, true);\n}\n\ninterface PanelOptions {\n base: string;\n send: Send;\n root: ShadowRoot;\n contextOf: (name: string) => ClientContext;\n tabs: Tab[];\n /** The tab it opens at. */\n tab: Tab;\n /** Keeps the tab shown, for deictic's own shortcut to open at next. */\n remember: (tab: Tab) => void;\n element: Element;\n /** What was under the pointer inside `element`, where that differs. */\n pointed?: Element;\n target: Target;\n /** Shown where the page put it (`popupIn`), not over the page beside the element; Esc leaves it alone. */\n pinned?: boolean;\n /** Called as it closes: the tab it showed, and whether it's leaving for a tab's `away`, to come back by `reopen`. */\n onClose: (shown: Tab, leaving: boolean) => void;\n /** What the first tab's mount gets, coming back from `away`. */\n resumed?: Resumed;\n /** Opens the popup again, at a tab on an element, coming back from `away`. */\n reopen: (tab: Tab, element: Element, resumed: Resumed) => void;\n}\n\nfunction openPanel({\n base,\n send,\n root,\n contextOf,\n tabs,\n tab: first,\n remember,\n element,\n pointed,\n target,\n pinned = false,\n onClose,\n resumed: coming,\n reopen,\n}: PanelOptions): { close: () => void; unsaved: () => boolean } {\n // Given to the first tab's first mount only: another tab, or a remount after an undo, starts afresh.\n let resumed = coming;\n const panel = div('panel');\n // The tabs, then the element's place and undo and redo, which are the shown tab's on this element.\n const head = div('head');\n head.setAttribute('role', 'tablist');\n const bar = div('bar');\n const where = document.createElement('a');\n where.className = 'where';\n const file = document.createElement('span');\n file.textContent = `${target.loc.file}:${target.loc.line}`;\n // An arrow out, as it leaves the page for the editor; its title is the overlay's tooltip (`tooltip.ts`).\n where.append(file);\n where.insertAdjacentHTML('beforeend', OUT);\n where.title = 'Open in editor';\n where.setAttribute('aria-label', `Open ${file.textContent} in the editor`);\n // The element's place, as a request's query names it.\n const at = { file: target.loc.file, line: String(target.loc.line), column: String(target.loc.column) };\n where.href = `${base}__deictic/open?${new URLSearchParams(at)}`;\n where.addEventListener('click', (e) => {\n e.preventDefault();\n void send(where.href);\n });\n // Off until the tab's history is read: there's nothing to take back on most elements.\n const undo = iconButton(UNDO, 'Undo', 'Nothing to undo');\n const redo = iconButton(REDO, 'Redo', 'Nothing to redo');\n undo.disabled = redo.disabled = true;\n const close = iconButton(CLOSE, 'Close', pinned ? 'Close' : 'Close (Esc)');\n const buttons = tabs.map((tab) => {\n const el = button(tab.plugin.label ?? tab.plugin.name, '');\n el.className = 'tab';\n el.setAttribute('role', 'tab');\n el.addEventListener('click', () => show(tab));\n return { tab, el };\n });\n close.classList.add('close');\n head.append(...buttons.map((b) => b.el), close);\n bar.append(where, undo, redo);\n // Back from `away` on a page that doesn't have the element: said, as nothing on it is outlined.\n if (!element.isConnected)\n where.after(Object.assign(document.createElement('span'), { className: 'absent', textContent: 'not on this page' }));\n const body = div('body');\n body.setAttribute('role', 'tabpanel');\n const status = div('status');\n panel.append(head, bar, body, status);\n root.append(panel);\n if (pinned) panel.classList.add('pinned');\n const release = pinned ? undefined : keepInView(panel, body, head, element);\n const unmark = pinned ? undefined : outline(root, element);\n if (!pinned) window.dispatchEvent(new CustomEvent<PopupOpened>(POPUP_OPENED, { detail: { element, tab: first.plugin.name } }));\n\n let cleanup: (() => void) | void;\n // The button that keeps what the shown tab would lose, while there's something: `unsaved`, from the panel.\n let holding: HTMLElement | undefined;\n const say = (text: string, problem = false) => {\n status.textContent = text;\n status.classList.toggle('problem', problem);\n };\n const post = async <T>(route: string, body?: unknown): Promise<T> => {\n const res = await send(`${base}__deictic/${route}`, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body ?? {}),\n });\n const json = (await res.json()) as T & { problem?: string };\n if (!res.ok) throw new Error(json.problem ?? res.statusText);\n return json;\n };\n const unmount = () => {\n cleanup?.();\n cleanup = undefined;\n holding = undefined;\n body.replaceChildren();\n };\n // The change undone may be this tab's from before the panel opened: the panel reads its model again.\n const step = (route: 'undo' | 'redo') =>\n post<{ change: { label: string } }>(route, { plugin: current.plugin.name, target })\n .then(\n async ({ change }) => {\n await load();\n say(`${route === 'undo' ? 'Undid' : 'Redid'} ${change.label}`);\n },\n (e: unknown) => say(messageOf(e), true),\n )\n .finally(() => void steps());\n // Undo and redo as the tab's history on this element stands: off with nothing to take back or do again, else\n // saying what they would. Read as a tab shows, after each change made here, and as the pointer comes back, for a\n // change made elsewhere. One a later read overtook (another tab's) sets nothing.\n let asked = 0;\n const steps = async () => {\n const ask = ++asked;\n let history: { done: { label: string }[]; undone: { label: string }[] };\n try {\n const res = await send(`${base}__deictic/history?${new URLSearchParams({ plugin: current.plugin.name, ...at })}`);\n if (!res.ok || ask !== asked) return;\n history = (await res.json()) as typeof history;\n } catch {\n return;\n }\n const last = history.done.at(-1);\n const next = history.undone.at(-1);\n undo.disabled = last === undefined;\n undo.title = last === undefined ? 'Nothing to undo' : `Undo ${last.label}`;\n redo.disabled = next === undefined;\n redo.title = next === undefined ? 'Nothing to redo' : `Redo ${next.label}`;\n };\n panel.addEventListener('pointerenter', () => void steps());\n\n const done = (leaving = false) => {\n unmount();\n release?.();\n unmark?.();\n panel.remove();\n window.removeEventListener('keydown', onKey, true);\n window.removeEventListener('pointerdown', onOutside, true);\n if (!pinned) window.dispatchEvent(new CustomEvent(POPUP_CLOSED));\n onClose(current, leaving);\n };\n const onKey = (e: KeyboardEvent) => {\n // A plugin's modal over the popup (one marked `data-deictic-modal`) takes Esc for itself.\n if (e.key !== 'Escape' || root.querySelector('[data-deictic-modal]') !== null) return;\n // Esc is the popup's while it's open: a dialog of the page's that it's open in stays open.\n e.preventDefault();\n e.stopPropagation();\n done();\n };\n // A press on the page closes the popup, as it would a menu, unless that loses something: then the button that\n // keeps it shakes. Anything in the overlay is the popup's own: a modal, the lightbox, the surface marks are drawn on.\n const onOutside = (e: PointerEvent) => {\n if (e.composedPath().includes(root.host)) return;\n if (holding === undefined) return done();\n shake(holding);\n };\n if (!pinned) {\n window.addEventListener('keydown', onKey, true);\n window.addEventListener('pointerdown', onOutside, true);\n }\n undo.addEventListener('click', () => void step('undo'));\n redo.addEventListener('click', () => void step('redo'));\n close.addEventListener('click', () => done());\n\n let current = first;\n // A read that a later one overtook (another tab, or the same after an undo) mounts nothing.\n let reads = 0;\n const load = async () => {\n const { plugin, mount } = current;\n const read = ++reads;\n // The body keeps its height while it's empty, and \"Reading…\" waits for a read that takes long: one answered\n // at once, as most are, would otherwise fold the popup and open it again in a blink.\n body.style.minHeight = `${body.offsetHeight}px`;\n unmount();\n say('');\n const slow = setTimeout(() => read === reads && say('Reading…'), SLOW);\n let model: unknown;\n try {\n ({ model } = await post<{ model: unknown }>('read', { plugin: plugin.name, target }));\n } catch (e) {\n if (read !== reads) return;\n body.style.minHeight = '';\n say(messageOf(e), true);\n return;\n } finally {\n clearTimeout(slow);\n }\n if (read !== reads) return;\n body.style.minHeight = '';\n say('');\n const back = current === first ? resumed : undefined;\n resumed = undefined;\n cleanup = mount(body, {\n ...contextOf(plugin.name),\n ...(back === undefined ? {} : { resumed: back }),\n away: (state, task) => {\n const tab = current;\n done(true);\n // For the tab's next page too, should this one go before the task is done. Not one a page pinned: that's the page's own.\n if (!pinned) keepAway({ tab: tab.plugin.name, target, state });\n const back = (resumed: Resumed) => {\n if (!pinned) dropAway();\n reopen(tab, element, resumed);\n };\n void task().then(\n (result) => back({ state, result }),\n (e: unknown) => back({ state, problem: messageOf(e) }),\n );\n },\n element,\n ...(pointed === undefined ? {} : { pointed }),\n elements: sameAs(element),\n target,\n model,\n apply: async (op) => {\n say('Writing…');\n try {\n const result = await post<{ model: unknown }>('apply', { plugin: plugin.name, target, op });\n say('');\n void steps();\n return result.model;\n } catch (e) {\n say(messageOf(e), true);\n throw e;\n }\n },\n close: () => done(),\n unsaved: (action) => {\n if (read === reads) holding = action;\n },\n });\n };\n const show = (tab: Tab) => {\n current = tab;\n for (const b of buttons) b.el.setAttribute('aria-selected', String(b.tab === tab));\n remember(tab);\n void steps();\n void load();\n };\n show(first);\n return { close: done, unsaved: () => holding !== undefined };\n}\n\n/** Shakes a panel's button, in view: what a press outside does where closing would lose something. A blink where motion is reduced. */\nfunction shake(el: HTMLElement): void {\n el.scrollIntoView({ block: 'nearest' });\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return void el.animate({ opacity: [1, 0.3, 1, 0.3, 1] }, 400);\n el.animate({ translate: ['0', '-5px', '5px', '-4px', '4px', '-2px', '0'] }, { duration: 360, easing: 'ease-out' });\n}\n\n/** Puts an outline over `r`. */\nfunction place(el: HTMLElement, r: DOMRect): void {\n Object.assign(el.style, { left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px` });\n}\n\n/** How far from the element the popup's outline is drawn, in pixels. */\nconst ROOM = 4;\n\n/**\n * Outlines the element the popup is open on, for as long as it is: which one it's about, where several look alike\n * or the popup covers it. Dashed, with no fill and a little room around the element, so nothing of it is drawn on:\n * a border, a ring or a colour tried on it shows as it is. Read each frame, as the element moves with the page's\n * scrolling, its layout and what a panel previews on it. Answers what removes it.\n */\nfunction outline(root: ShadowRoot, element: Element): () => void {\n const box = div('box on');\n root.append(box);\n let frame = 0;\n let was = '';\n const follow = () => {\n frame = requestAnimationFrame(follow);\n const r = element.getBoundingClientRect();\n const now = element.isConnected ? `${r.left},${r.top},${r.width},${r.height}` : '';\n if (now === was) return;\n was = now;\n box.classList.toggle('shown', now !== '');\n place(box, new DOMRect(r.left - ROOM, r.top - ROOM, r.width + 2 * ROOM, r.height + 2 * ROOM));\n };\n follow();\n return () => {\n cancelAnimationFrame(frame);\n box.remove();\n };\n}\n\nconst MARGIN = 8;\n// Under this much room on either side, the panel overlaps the element rather than shrink to a sliver beside it.\nconst LEAST = 160;\n\n/** How far a press on the head moves, in pixels, before it's a drag: a click there leaves the popup following. */\nconst SLACK = 3;\n\n/**\n * Keeps a panel beside `element` and inside the viewport, as its tabs fill it, the window resizes and the element\n * moves with the page: below, or above where it fits better, its height capped to the room there, so the body\n * scrolls rather than the panel leaving the window. Dragged by `handle`, it stays where it's put, in the window,\n * and follows the element no more. Fixed, so it never changes the page's own scrolling. Answers a release.\n */\nfunction keepInView(panel: HTMLElement, body: HTMLElement, handle: HTMLElement, element: Element): () => void {\n let frame = 0;\n let timer: ReturnType<typeof setTimeout> | undefined;\n // Where the element was last seen: one gone from the page leaves the popup where it was.\n let r = element.getBoundingClientRect();\n // An element that's not on the page (back from `away`, on another) has no place to be beside: as if dragged to the\n // middle, toward the top.\n let moved: { left: number; top: number } | undefined = element.isConnected\n ? undefined\n : { left: (document.documentElement.clientWidth - panel.offsetWidth) / 2, top: document.documentElement.clientHeight / 5 };\n const fit = () => {\n cancelAnimationFrame(frame);\n clearTimeout(timer);\n frame = 0;\n timer = undefined;\n // The viewport without the page's scrollbars.\n const width = document.documentElement.clientWidth;\n const height = document.documentElement.clientHeight;\n // What the panel would take with no cap: its frame, and all of its body.\n const wanted = panel.offsetHeight - body.clientHeight + body.scrollHeight;\n if (moved !== undefined) {\n const room = Math.max(0, height - 2 * MARGIN);\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(moved.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${Math.max(MARGIN, Math.min(moved.top, height - MARGIN - Math.min(wanted, room)))}px`,\n maxHeight: `${room}px`,\n });\n return;\n }\n const top = Math.min(Math.max(r.top, 0), height);\n const bottom = Math.min(Math.max(r.bottom, 0), height);\n const below = height - bottom - 2 * MARGIN;\n const above = top - 2 * MARGIN;\n const cap = Math.max(0, Math.min(height * 0.6, height - 2 * MARGIN));\n let at: number;\n let room: number;\n if (Math.max(below, above) < LEAST) {\n room = height - 2 * MARGIN;\n at = Math.min(Math.max(bottom + MARGIN, MARGIN), height - MARGIN - Math.min(wanted, room));\n } else if (wanted <= below || below >= above) {\n room = Math.min(below, cap);\n at = bottom + MARGIN;\n } else {\n room = Math.min(above, cap);\n at = top - MARGIN - Math.min(wanted, room);\n }\n Object.assign(panel.style, {\n left: `${Math.max(MARGIN, Math.min(r.left, width - MARGIN - panel.offsetWidth))}px`,\n top: `${at}px`,\n bottom: '',\n maxHeight: `${room}px`,\n });\n };\n // Not in the observers' callbacks, where a change of size is a \"ResizeObserver loop\" error on the page. The next\n // frame, or a moment later where there's none: a hidden tab draws no frames, and its popup still fits when shown.\n const later = () => {\n frame ||= requestAnimationFrame(fit);\n timer ??= setTimeout(fit, 50);\n };\n fit();\n // Read each frame, as nothing tells of an element moving: the page scrolls, its layout shifts, a panel previews.\n let watching = requestAnimationFrame(function watch() {\n if (moved !== undefined) return;\n watching = requestAnimationFrame(watch);\n if (!element.isConnected) return;\n const now = element.getBoundingClientRect();\n if (now.left === r.left && now.top === r.top && now.width === r.width && now.height === r.height) return;\n r = now;\n fit();\n });\n // A drag starts on the head itself, not on a tab or the close in it.\n let from: { x: number; y: number; left: number; top: number } | undefined;\n const down = (e: PointerEvent) => {\n if (e.button !== 0 || (e.target as Element).closest('button') !== null) return;\n // Kept from the browser: no text selected along the way, and the field being typed in keeps its focus.\n e.preventDefault();\n const at = panel.getBoundingClientRect();\n from = { x: e.clientX, y: e.clientY, left: at.left, top: at.top };\n handle.setPointerCapture(e.pointerId);\n };\n const move = (e: PointerEvent) => {\n if (from === undefined) return;\n const x = e.clientX - from.x;\n const y = e.clientY - from.y;\n if (moved === undefined && Math.hypot(x, y) < SLACK) return;\n moved = { left: from.left + x, top: from.top + y };\n panel.classList.add('dragging');\n fit();\n };\n const up = () => {\n from = undefined;\n panel.classList.remove('dragging');\n };\n handle.addEventListener('pointerdown', down);\n handle.addEventListener('pointermove', move);\n handle.addEventListener('pointerup', up);\n handle.addEventListener('pointercancel', up);\n // A tab's content arrives after the panel opens, and changes as it's used, as does the status line. Both, as a\n // resize observer reports only while the page renders: a hidden tab's popup would keep its first place.\n const resized = new ResizeObserver(later);\n resized.observe(panel);\n const changed = new MutationObserver(later);\n changed.observe(panel, { childList: true, subtree: true, characterData: true });\n window.addEventListener('resize', later);\n return () => {\n cancelAnimationFrame(frame);\n cancelAnimationFrame(watching);\n clearTimeout(timer);\n resized.disconnect();\n changed.disconnect();\n window.removeEventListener('resize', later);\n };\n}\n\nfunction div(className: string): HTMLDivElement {\n const el = document.createElement('div');\n el.className = className;\n return el;\n}\n\n/** A button that is a drawing: named for what it does, as its title, the tooltip, changes with what it would do. */\nfunction iconButton(svg: string, name: string, title: string): HTMLButtonElement {\n const el = button('', title);\n el.className = 'icon';\n el.innerHTML = svg;\n el.setAttribute('aria-label', name);\n return el;\n}\n\nfunction button(text: string, title: string): HTMLButtonElement {\n const el = document.createElement('button');\n el.type = 'button';\n el.textContent = text;\n el.title = title;\n return el;\n}\n\nconst messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n"],"mappings":";;;AAgBA,MAAM,MAAM;AACZ,MAAM,QAAQ;;AAEd,MAAM,QAAQ;;AAGd,IAAI,OAAyB,QAAQ,QAAQ;AAE7C,SAAS,MAAS,MAA0B,MAA4D;CACtG,MAAM,OAAO,KACV,YAAY,CAAC,CAAC,CAAC,CACf,WAEG,IAAI,SAAY,MAAM,SAAS;EAC7B,MAAM,UAAU,UAAU,KAAK,WAAW,CAAC;EAC3C,QAAQ,iBAAiB,uBAAuB,QAAQ,OAAO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