deictic 0.8.0 → 0.9.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 +73 -18
- package/README.md +1 -1
- package/dist/annotations/client.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/index.d.ts +13 -13
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +11 -7
- package/dist/client/index.js.map +1 -1
- package/dist/react/client.d.ts +19 -0
- package/dist/react/client.d.ts.map +1 -0
- package/dist/react/client.js +504 -0
- package/dist/react/client.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +1 -0
- package/dist/recommended/index.d.ts +15 -7
- package/dist/recommended/index.d.ts.map +1 -1
- package/dist/recommended/index.js +1 -1
- package/dist/recordings/client.d.ts.map +1 -1
- package/dist/recordings/client.js +48 -5
- package/dist/recordings/client.js.map +1 -1
- package/dist/screenshots/client.d.ts +9 -1
- package/dist/screenshots/client.d.ts.map +1 -1
- package/dist/screenshots/rrweb.d.ts +0 -6
- package/dist/screenshots/rrweb.d.ts.map +1 -1
- package/dist/screenshots/rrweb.js +53 -10
- package/dist/screenshots/rrweb.js.map +1 -1
- package/dist/shared/board.js +1 -1
- package/dist/shared/canvas.js +30 -0
- package/dist/shared/canvas.js.map +1 -0
- package/dist/shared/client.js +44 -2
- package/dist/shared/client.js.map +1 -1
- package/dist/shared/dom.js +7 -1
- package/dist/shared/dom.js.map +1 -1
- package/dist/shared/drawer.js +1 -1
- package/dist/shared/endpoints.js +1 -1
- package/dist/shared/find.js +6 -1
- package/dist/shared/find.js.map +1 -1
- package/dist/shared/frame.js +5 -2
- package/dist/shared/frame.js.map +1 -1
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index10.d.ts +70 -0
- package/dist/shared/index10.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +11 -0
- package/dist/shared/index3.d.ts.map +1 -1
- package/dist/shared/index7.d.ts +92 -312
- package/dist/shared/index7.d.ts.map +1 -1
- package/dist/shared/index8.d.ts +324 -47
- package/dist/shared/index8.d.ts.map +1 -1
- package/dist/shared/index9.d.ts +45 -63
- package/dist/shared/index9.d.ts.map +1 -1
- package/dist/shared/init.js +15 -11
- package/dist/shared/init.js.map +1 -1
- package/dist/shared/marks.js +7 -1
- package/dist/shared/marks.js.map +1 -1
- package/dist/shared/package.js +3 -1
- package/dist/shared/packages.js +1 -1
- package/dist/shared/playwright.js +59 -3
- package/dist/shared/playwright.js.map +1 -1
- package/dist/shared/react.js +25 -0
- package/dist/shared/react.js.map +1 -0
- package/dist/shared/recommended.js +6 -3
- package/dist/shared/recommended.js.map +1 -1
- package/dist/shared/recording.js +80 -3
- package/dist/shared/recording.js.map +1 -1
- package/dist/shared/recordings.js +30 -2
- package/dist/shared/recordings.js.map +1 -1
- package/dist/shared/screenshots.js.map +1 -1
- package/dist/shared/src.js.map +1 -1
- package/dist/shared/task.js +1 -0
- package/dist/shared/task.js.map +1 -1
- package/dist/shared/tasks.js +11 -0
- 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.js +45 -19
- package/dist/tasks/client.js.map +1 -1
- package/dist/tasks/index.d.ts +1 -1
- package/dist/voice/client.d.ts +1 -1
- package/dist/voice/client.js +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/package.json +25 -1
- package/src/cli/bun.ts +2 -2
- package/src/cli/find.ts +5 -1
- package/src/cli/frame.ts +6 -3
- package/src/cli/init.ts +14 -9
- package/src/cli/recording.ts +90 -4
- package/src/cli/task.ts +4 -0
- package/src/cli.ts +13 -6
- package/src/client/dom.ts +14 -0
- package/src/client/index.ts +21 -14
- package/src/index.ts +6 -0
- package/src/plugins/react/client.ts +162 -0
- package/src/plugins/react/index.ts +130 -0
- package/src/plugins/react/renders.ts +219 -0
- package/src/plugins/react/serialize.ts +139 -0
- package/src/plugins/react/timeline.ts +143 -0
- package/src/plugins/recommended/index.ts +17 -5
- package/src/plugins/recordings/client.ts +64 -4
- package/src/plugins/recordings/marks.ts +7 -0
- package/src/plugins/recordings/replay.ts +30 -2
- package/src/plugins/screenshots/canvas.ts +27 -0
- package/src/plugins/screenshots/client.ts +42 -2
- package/src/plugins/screenshots/index.ts +11 -0
- package/src/plugins/screenshots/playwright.ts +90 -4
- package/src/plugins/screenshots/rrweb.ts +57 -9
- package/src/plugins/screenshots/states.ts +26 -0
- package/src/plugins/tasks/client.ts +41 -6
- package/src/plugins/tasks/composer.ts +24 -7
- package/src/plugins/tasks/index.ts +16 -2
package/dist/tasks/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["made","STYLE","made","STYLE"],"sources":["../../src/plugins/tasks/composer.ts","../../src/plugins/tasks/store.ts","../../src/plugins/tasks/which.ts","../../src/plugins/tasks/drawer.ts","../../src/plugins/tasks/pins.ts","../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The composer: a field as a chat has, shared by the Task tab (a new task) and a task's thread in the drawer (a\n * reply). What's attached is chips over the words, and under them the buttons that attach, each an icon named by its\n * tooltip, and the arrow that sends. Enter sends, and Shift+Enter starts a new line.\n *\n * Two buttons are on or off. With the screenshots plugin, a shot of the page goes as it's sent, the elements\n * outlined in it (or the spot circled): nothing else says which of two rows alike was meant. And, for a task, the\n * element's HTML as it rendered, as a file. The rest make something: Draw takes a shot and opens it to draw on, in the\n * annotations plugin's editor; Record is the caller's (the Task tab leaves the popup to record the page); Voice\n * records the mic here, its time and waveform beside it.\n *\n * A task's elements are chips too: the one the popup is on to begin with, and any other the element button's next\n * press on the page picks. A reply has none.\n *\n * A picture pasted in, or dropped on it, is a screenshot of its own, in the tray, to draw on as one drawn here is.\n *\n * What they make, and what the tool panel's tools made since (the tray), is this one's to attach. Each is a chip,\n * which opens it; removing one takes it out of the tray. Once it's sent, they're gone from the tray, and the page's\n * marks with them.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { place, targetOf, toolButton } from '#src/client/dom.ts';\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport type { ClientContext, LightboxItem, Point, Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Marks, Op } from './index.ts';\n\n/** Scoped to the composer: the drawer and the Task tab share the overlay's root, and a field of theirs is their own. */\nexport const COMPOSER_STYLE = `\n/* One box for what's attached, the words and the buttons, lit as a field is while it's typed in. */\n.composer { border: 1px solid var(--deictic-line); border-radius: 12px; background: rgb(0 0 0 / 0.35); }\n.composer:focus-within, .composer.dropping { border-color: var(--deictic-accent); box-shadow: 0 0 0 1px var(--deictic-accent); }\n.composer textarea { display: block; box-sizing: border-box; width: 100%; min-height: 0; padding: 10px 12px 4px; border: 0; resize: none; background: none; font: 13px/1.45 system-ui, sans-serif; }\n.composer textarea:focus { outline: none; }\n.composer .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 8px 8px 0; font-size: 12px; }\n.composer .attach { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }\n.composer .attach button.icon { width: 28px; height: 28px; border-radius: 8px; }\n.composer .attach button.icon svg { width: 16px; height: 16px; }\n.composer .attach button[aria-pressed='true'] { color: var(--deictic-accent); background: rgb(18 179 88 / 0.14); }\n.composer .attach .gap { width: 1px; height: 16px; margin: 0 4px; background: var(--deictic-line); }\n.composer .attach .mic[aria-pressed='true'], .composer .attach .mic[aria-pressed='true']:hover { color: #fff; background: #ef4444; }\n.composer .hearing { display: inline-flex; align-items: center; gap: 6px; padding-left: 4px; font: 12px ui-monospace, monospace; color: var(--deictic-muted); }\n.composer .hearing canvas { width: 56px; height: 18px; }\n.composer .doing { margin-left: auto; padding-right: 6px; font-size: 12px; color: var(--deictic-muted); }\n.composer .attach button.send { border-radius: 50%; color: var(--deictic-on-accent); }\n.composer .attach button.send:hover:not(:disabled) { color: var(--deictic-on-accent); background: var(--deictic-accent); filter: brightness(1.1); }\n.composer [hidden] { display: none; }\n/* Every chip one height, and a picture's thumbnail one size whatever its shape or whether it has loaded yet: nothing\n moves as one is attached, or as its picture comes. */\n.chip { box-sizing: border-box; display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { height: 100%; border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 2px; }\n.chip img { display: block; width: 36px; height: 24px; object-fit: cover; border-radius: 4px; background: var(--deictic-line); }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .play.drawn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n/* An element the task is about: named as the caption names it, in the overlay's own green. */\n.chip.about .open { padding: 0 4px 0 8px; font: 12px ui-monospace, monospace; color: var(--deictic-accent); }\n.chip.about .open span { color: var(--deictic-muted); }\n.compose .shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.compose .shot-problem:empty { display: none; }\n.compose .shot-note { margin-top: 4px; font-size: 12px; color: var(--deictic-muted); }\n.compose .shot-note:empty { display: none; }\n`;\n\nexport const PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n/** The composer's buttons, each its strokes on a 24-pixel grid. */\nconst CAMERA = '<path d=\"M4 8h3l2-3h6l2 3h3v11H4z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>';\nconst CODE = '<path d=\"M8 7l-5 5 5 5M16 7l5 5-5 5M13.5 5l-3 14\"/>';\nexport const PEN = '<path d=\"M4 20l1-4L16 5a2.1 2.1 0 0 1 3 3L8 19z\"/>';\nconst RECORD = '<circle cx=\"12\" cy=\"12\" r=\"8\"/><circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\"/>';\nconst MIC = '<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>';\nconst SEND = '<path d=\"M12 19V5M6 11l6-6 6 6\"/>';\nconst TARGET = '<circle cx=\"12\" cy=\"12\" r=\"7\"/><path d=\"M12 2v4M12 18v4M2 12h4M18 12h4\"/>';\n/** How tall the field grows with what's typed, in pixels, before it scrolls. */\nconst GROWN = 200;\n\n/** The overlay's own green, as its ring on the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n/** How far around a spot its circle is drawn in a shot, in CSS pixels. */\nconst SPOT = 16;\n\n/** The tray's kinds a composer attaches. */\nconst KINDS = ['screenshots', 'recordings', 'voice'];\n\nexport function element<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n props: Partial<HTMLElementTagNameMap[K]> = {},\n): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\nexport const atOf = ({ loc }: Target) => `${loc.file}:${loc.line}:${loc.column}`;\n\nexport const clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nexport const messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Marks | undefined {\n const list = marks?.list() ?? [];\n return list.length === 0 ? undefined : marksOf(list);\n}\n\n/**\n * A shot as the tray has it: the window's, from the tool panel, or one that was drawn on here. That one's PNG has the\n * marks in it, and it keeps what it was made of, to draw on it again: the shot as taken, the marks, and the element it\n * was taken of (`file:line:column`), as only a task about that element can say where the element is in it.\n */\ntype Pictured = Shot & { drawn?: { shot: Shot; marks: Annotation[]; about: string } };\n\n/** A shot as it's attached, and where it is, for the page to hear of; what's sent goes without that. */\nexport type Sent = NonNullable<Op['screenshots']>[number] & { url: string };\n\n/** What a task says of an element that only the page with it on knows. */\nexport interface Seen extends Pick<Op, 'point' | 'pointed' | 'count' | 'which' | 'chain'> {\n /** The element's HTML, as it would be attached. */\n html: string;\n}\n\n/**\n * An element the task is about, a chip in the composer: its place, the element where this page has it, and what\n * the page said of it as the panel left for a recording, for a page that no longer has it. `own` is the popup's.\n */\nexport interface About {\n target: Target;\n own: boolean;\n el?: Element;\n seen?: Seen;\n}\n\nexport const onPage = (a: About | undefined): Element | undefined => (a?.el?.isConnected === true ? a.el : undefined);\n\n/** What's sent: the words, and all that's attached, as the composer has it. */\nexport interface Gathered {\n text: string;\n /** The elements attached, in order: none for a reply, or for a task about the page. */\n about: About[];\n /** Whether the elements' HTML goes too. */\n html: boolean;\n screenshots?: Sent[];\n recordings: Recording[];\n voices: Clip[];\n /** What's drawn on the page, where something is. */\n annotations?: Marks;\n}\n\n/** What's attached, as a task's op or a reply sends it: each shot, each recording with where it replays, each voice note, the marks. */\nexport function attachedOf({\n screenshots,\n recordings,\n voices,\n annotations,\n}: Gathered): Pick<Op, 'screenshots' | 'recordings' | 'voice' | 'annotations'> {\n return {\n ...(screenshots === undefined ? {} : { screenshots: screenshots.map(({ url: _, ...shot }) => shot) }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...(annotations === undefined ? {} : { annotations }),\n };\n}\n\n/** What's typed and asked for, to keep while the composer is away and give back to one made again. */\nexport interface Draft {\n text: string;\n /** Whether a shot was asked for, or asked not to be, where either was. */\n shot?: boolean;\n html: boolean;\n about: About[];\n}\n\nexport interface ComposerOptions {\n placeholder: string;\n /** What the arrow does, as its tooltip says: `Add task`, `Reply`. */\n sendLabel: string;\n /**\n * The elements attached to begin with, and again once it's sent: a task's. With them come their chips, the element\n * button and HTML snapshot; a reply has none of them.\n */\n about?: () => About[];\n /** Whether the HTML snapshot button is there, for a task with elements: the tasks plugin's `html` option. */\n html?: boolean;\n /** The spot in the popup's own element, circled in a shot of it. */\n at?: Point;\n /** Whether a shot is taken as it's sent, while nothing else is attached and none was asked for or not: a task's. */\n shoot?: boolean;\n /** Whether this page has what's shot and drawn on: not for a task back from a recording on a page without it. */\n here?: boolean;\n /** Whether it's over the page, in the overlay's root: a press on the page picks an element, and attached ones are outlined. */\n over: boolean;\n /** What Record does, where it's there at all: the Task tab leaves the popup to record the page. */\n record?: () => void;\n /** Sends it; answers whether it's taken, which empties the composer. A refusal thrown is said under it. */\n submit: (gathered: Gathered) => Promise<boolean>;\n /** Hears a change to what leaving would lose: what's typed, or a take going. */\n changed?: () => void;\n}\n\nexport interface Composer {\n /** The composer, and under it what went wrong and what was done. */\n el: HTMLElement;\n /** The arrow: what an unsaved change keeps a popup open with. */\n send: HTMLButtonElement;\n problem: HTMLElement;\n note: HTMLElement;\n /** Whether leaving now loses something: words typed, or a take going. */\n pending: () => boolean;\n draft: () => Draft;\n restore: (draft: Partial<Draft>) => void;\n /** Ends a take going, keeping its clip in the tray. */\n stopTake: () => Promise<void>;\n focus: () => void;\n /** Lets it go: a take going is kept, in the tray. */\n destroy: () => void;\n}\n\n/**\n * A shot's PNG with what the task is about outlined in it: dashes around each box, with nothing between them, and a\n * circle around `spot`. The shot may have more pixels than its size in CSS ones, which the boxes are in.\n */\nasync function outlined(png: string, size: Shot['size'], boxes: Shot['box'][], spot?: Point): Promise<Blob> {\n const image = new Image();\n image.src = png;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n for (const box of boxes) ctx.strokeRect((box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k);\n if (spot !== undefined) {\n ctx.beginPath();\n ctx.arc(spot.x * k, spot.y * k, SPOT * k, 0, 2 * Math.PI);\n ctx.stroke();\n }\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n}\n\n/** A picture as a PNG, and its size: the screenshots plugin keeps PNGs, and a pasted one may be a JPEG or a GIF. */\nasync function pngOf(picture: Blob): Promise<{ png: Blob; width: number; height: number }> {\n const url = URL.createObjectURL(picture);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const { naturalWidth: width, naturalHeight: height } = image;\n if (picture.type === 'image/png') return { png: picture, width, height };\n const canvas = element('canvas', { width, height });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const png = await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the picture drew nothing')) : done(blob)), 'image/png'),\n );\n return { png, width, height };\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n\nexport function composerIn(context: ClientContext, options: ComposerOptions): Composer {\n const shots = context.use('screenshots');\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n const { tray } = context;\n const here = options.here ?? true;\n const withElements = options.about !== undefined;\n\n // What it's about, in the order attached.\n let about: About[] = options.about?.() ?? [];\n\n // A shot as it goes: said (on, or off), or else, where it's wanted at all, only while nothing else is attached.\n let wanted: boolean | undefined;\n const shooting = () => shots !== undefined && here && (wanted ?? (options.shoot === true && attachedCount() === 0));\n let withHtml = true;\n\n const text = element('textarea', { placeholder: options.placeholder, rows: 1 });\n const chipsEl = element('div', { className: 'chips' });\n const camera = toolButton(CAMERA, `Attach a screenshot, taken as it's sent`, undefined, () => {\n wanted = !shooting();\n showChips();\n });\n camera.hidden = shots === undefined || !here;\n const code = toolButton(CODE, 'Attach an HTML snapshot: the element as the page has it now, as a file', undefined, () => {\n withHtml = !withHtml;\n showChips();\n });\n code.hidden = !withElements || options.html === false;\n const picker = toolButton(TARGET, 'Attach another element: press it on the page', undefined, () => void pick());\n picker.setAttribute('aria-pressed', 'false');\n // Not where there's no page under it to press on.\n picker.hidden = !withElements || !options.over;\n const pen = toolButton(PEN, 'Draw on a screenshot', undefined, () => void draw());\n pen.hidden = shots === undefined || notes === undefined || !here;\n const record = toolButton(RECORD, 'Record the page', undefined, () => {\n if (!sending) options.record?.();\n });\n record.hidden = recorder === undefined || options.record === undefined;\n const mic = toolButton(MIC, 'Record your voice', undefined, () => void (take === undefined ? speakOn() : speakOff()));\n mic.classList.add('mic');\n mic.hidden = voice === undefined;\n // Between what's on or off and what makes something, where there's some of both.\n const gap = element('span', {\n className: 'gap',\n hidden: (camera.hidden && code.hidden) || (picker.hidden && pen.hidden && record.hidden && mic.hidden),\n });\n // The time and the mic's live waveform while a take goes, so it's plain it hears.\n const time = element('span');\n const wave = element('canvas');\n const hearing = element('span', { className: 'hearing', hidden: true });\n hearing.append(time, wave);\n // What the arrow waits on, while it does: a shot being taken.\n const doing = element('span', { className: 'doing' });\n const send = toolButton(SEND, options.sendLabel, 'Enter', () => void sendIt());\n send.classList.add('send', 'primary');\n const attach = element('div', { className: 'attach' });\n attach.append(camera, code, gap, picker, pen, record, mic, hearing, doing, send);\n const box = element('div', { className: 'composer' });\n box.append(chipsEl, text, attach);\n const problem = element('div', { className: 'shot-problem' });\n const note = element('div', { className: 'shot-note' });\n const el = element('div', { className: 'compose' });\n el.append(box, problem, note);\n // As tall as what's typed, to a point.\n const grow = () => {\n text.style.height = 'auto';\n text.style.height = `${Math.min(text.scrollHeight, GROWN)}px`;\n };\n\n // What the tool panel's tools made and nothing has taken: this one's to attach, as each plugin said it.\n const inTray = <T>(plugin: string) => tray.list(plugin).map((item) => item.value as T);\n const taken = () => ({\n pictures: inTray<Pictured>('screenshots'),\n recordings: inTray<Recording>('recordings'),\n voices: inTray<Clip>('voice'),\n });\n const attachedCount = () => KINDS.reduce((n, plugin) => n + tray.list(plugin).length, 0);\n // It goes with words, or with something attached that says it; not while it's going.\n let sending = false;\n let take: Take | undefined;\n const able = () => (send.disabled = sending || (text.value.trim() === '' && attachedCount() === 0 && take === undefined));\n const changed = () => options.changed?.();\n\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: it }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const it = element('span', { className: 'chip' });\n it.append(opener, remover);\n return it;\n };\n const numbered = (name: string, i: number, of: number) => (of === 1 ? name : `${name} ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => {\n const { pictures, recordings, voices } = taken();\n return [\n ...pictures.map((s, i) => ({\n kind: 'image' as const,\n url: s.url,\n title: numbered('Screenshot', i, pictures.length),\n ...(s.drawn === undefined\n ? {}\n : {\n actions: [\n s.drawn.marks.length === 0\n ? { label: 'Draw on it', title: 'Draw boxes, arrows and notes on it', run: () => void draw(s) }\n : { label: 'Change marks', title: 'Draw on it again', run: () => void draw(s) },\n ],\n }),\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${numbered('Recording', i, recordings.length)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({\n kind: 'audio' as const,\n url: v.url,\n title: `${numbered('Voice', i, voices.length)} · ${clock(v.duration)}`,\n })),\n ];\n };\n /** Takes one out of the tray. A shot that was the last thing attached leaves none asked for: taking it out said so. */\n const drop = (plugin: string, id: string) => () => {\n tray.remove(plugin, id);\n if (plugin === 'screenshots' && attachedCount() === 0) wanted = false;\n showChips();\n };\n /** An element the task is about: named as the caption names it, with its place for a tip. Its chip shows it, and its × leaves it out. */\n const aboutChip = (a: About) => {\n const it = onPage(a);\n const { file, line } = a.target.loc;\n const { component, sole, tag } = it === undefined ? { component: undefined, sole: false, tag: a.target.tag } : named(it);\n const opener = element('button', { type: 'button', className: 'open', title: `${file}:${line}` });\n opener.append(`<${component ?? tag}>`, ...(component === undefined || sole ? [] : [element('span', { textContent: ` <${tag}>` })]));\n opener.addEventListener('click', () => it?.scrollIntoView({ block: 'nearest', behavior: 'smooth' }));\n const name = it === undefined ? `<${tag}>` : tell(named(it));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: `Leave ${name} out` });\n remover.addEventListener('click', () => {\n about = about.filter((x) => x !== a);\n showChips();\n });\n const chipEl = element('span', { className: 'chip about' });\n chipEl.append(opener, remover);\n return chipEl;\n };\n /** What's drawn on the page, which goes with it: its chip draws more, and its × clears it. */\n const marksChip = (marked: number) => {\n const opener = element('button', { type: 'button', className: 'open', title: 'Draw more on the page' });\n const icon = element('span', { className: 'play drawn', innerHTML: `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">${PEN}</svg>` });\n opener.append(icon, `${marked} mark${marked === 1 ? '' : 's'}`);\n opener.addEventListener('click', () => notes?.draw());\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: 'Clear the marks' });\n remover.addEventListener('click', () => notes?.clear());\n const it = element('span', { className: 'chip' });\n it.append(opener, remover);\n return it;\n };\n const showChips = () => {\n const { pictures, recordings, voices } = taken();\n const marked = notes?.list().length ?? 0;\n camera.setAttribute('aria-pressed', String(shooting()));\n code.setAttribute('aria-pressed', String(withHtml));\n chipsEl.hidden = about.length === 0 && attachedCount() === 0 && marked === 0;\n chipsEl.replaceChildren(\n ...about.map(aboutChip),\n ...pictures.map((s, i) => {\n const name = numbered('Screenshot', i, pictures.length);\n const thumb = element('img', { src: s.url, alt: '' });\n return chip([thumb, name], `Open ${name.toLowerCase()}`, i, `Remove ${name.toLowerCase()}`, drop('screenshots', s.id));\n }),\n ...recordings.map((r, i) => {\n const name = numbered('Recording', i, recordings.length);\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${name} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${name.toLowerCase()} back`,\n pictures.length + i,\n `Remove ${name.toLowerCase()}`,\n drop('recordings', r.id),\n );\n }),\n ...voices.map((v, i) => {\n const name = numbered('Voice', i, voices.length);\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${name} ${clock(v.duration)}`],\n `Play ${name.toLowerCase()}`,\n pictures.length + recordings.length + i,\n `Remove ${name.toLowerCase()}`,\n drop('voice', v.id),\n );\n }),\n ...(marked === 0 ? [] : [marksChip(marked)]),\n );\n able();\n };\n // As the tray changes: a shot taken from the panel while this is open is a chip at once. The marks too.\n const unsubscribe = [tray.subscribe(showChips), notes?.subscribe(showChips)];\n\n // The element button: the next press on the page attaches the marked element under it.\n let picking = false;\n const pick = async () => {\n if (picking) return;\n picking = true;\n picker.setAttribute('aria-pressed', 'true');\n const spot = await context.tools.pick();\n picking = false;\n picker.setAttribute('aria-pressed', 'false');\n const target = spot === undefined ? undefined : targetOf(spot.element);\n if (spot === undefined || target === undefined) return;\n // Only what the press was on: the element nearest to a press on none isn't what was meant.\n const r = spot.element.getBoundingClientRect();\n if (spot.at.x < 0 || spot.at.y < 0 || spot.at.x > r.width || spot.at.y > r.height) return;\n if (about.some((a) => a.el === spot.element)) return;\n about = [...about, { target, own: false, el: spot.element }];\n showChips();\n };\n // Each attached element on the page, outlined where it is, but the popup's own: that one has the light.\n const outlines = withElements && options.over ? element('div') : undefined;\n if (outlines !== undefined) context.root.append(outlines);\n let following = 0;\n const follow = () => {\n following = requestAnimationFrame(follow);\n if (outlines === undefined) return;\n const others = about.flatMap((a) => (a.own || onPage(a) === undefined ? [] : [onPage(a)!]));\n while (outlines.childElementCount > others.length) outlines.lastElementChild!.remove();\n while (outlines.childElementCount < others.length) outlines.append(element('div', { className: 'task-about' }));\n for (const [i, it] of others.entries()) place(outlines.children[i] as HTMLElement, it.getBoundingClientRect());\n };\n if (outlines !== undefined) follow();\n\n // Draw: a shot is taken and opened to draw on, or a chip's opened again. Saved, the PNG of both is kept as a\n // shot of its own, in the tray, so it's a chip as any other is.\n const firstAt = () => (about[0] === undefined ? '' : atOf(about[0].target));\n const aborts = new AbortController();\n let drawing = false;\n const draw = async (old?: Pictured) => {\n if (shots === undefined || notes === undefined || drawing || sending) return;\n drawing = true;\n problem.textContent = '';\n try {\n if (old === undefined) doing.textContent = 'Capturing…';\n const shot = old?.drawn?.shot ?? (await shots.capture(onPage(about[0]) ?? document.documentElement));\n doing.textContent = '';\n const picture: Picture = { url: shot.url, ...shot.size };\n const marks = await notes.edit(picture, old?.drawn?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n doing.textContent = 'Saving…';\n const kept = await shots.upload(await notes.flatten(picture, marks), shot);\n if (old !== undefined) tray.remove('screenshots', old.id);\n const pictured: Pictured = { ...kept, drawn: { shot, marks, about: old?.drawn?.about ?? firstAt() } };\n tray.add('screenshots', kept.id, pictured);\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n doing.textContent = '';\n drawing = false;\n // Back to the words: the editor gave the focus to the button that opened it.\n text.focus();\n }\n };\n\n /**\n * Pictures pasted in or dropped on it: each kept as a shot of its own (a PNG, as the screenshots plugin keeps them)\n * and put in the tray, so it's a chip as any other is, to draw on. Anything else is said, not attached.\n */\n const paste = async (files: File[]) => {\n const pictures = files.filter((file) => file.type.startsWith('image/'));\n const others = files.length - pictures.length;\n problem.textContent = '';\n if (pictures.length > 0 && shots === undefined)\n problem.textContent = 'Attaching a picture needs the screenshots plugin: add it to deictic';\n else if (others > 0)\n problem.textContent = `Only pictures can be attached here: ${others === 1 ? 'that file was' : `${others} files were`} left out`;\n if (shots === undefined || pictures.length === 0) return;\n doing.textContent = 'Attaching…';\n try {\n for (const picture of pictures) {\n const { png, width, height } = await pngOf(picture);\n const size = { width, height };\n const kept = await shots.upload(png, { box: { x: 0, y: 0, ...size }, size });\n // Drawn on with no marks yet: its lightbox offers to draw on it, as one drawn here does.\n const pictured: Pictured = { ...kept, drawn: { shot: kept, marks: [], about: '' } };\n tray.add('screenshots', kept.id, pictured);\n }\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n doing.textContent = '';\n }\n };\n box.addEventListener('paste', (e) => {\n const files = [...(e.clipboardData?.files ?? [])];\n if (files.length === 0) return;\n // A picture isn't text: nothing goes in the field for it.\n e.preventDefault();\n void paste(files);\n });\n box.addEventListener('dragover', (e) => {\n if (!e.dataTransfer?.types.includes('Files')) return;\n e.preventDefault();\n box.classList.add('dropping');\n });\n box.addEventListener('dragleave', () => box.classList.remove('dropping'));\n box.addEventListener('drop', (e) => {\n box.classList.remove('dropping');\n const files = [...(e.dataTransfer?.files ?? [])];\n if (files.length === 0) return;\n e.preventDefault();\n void paste(files);\n });\n\n // The mic, here: its button starts a take, and stops it, and it's a chip.\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n mic.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n mic.disabled = false;\n }\n const { started, stream } = take;\n stopWave = liveWaveform(wave, stream, { played: '#ef4444', rest: '#52525b' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n tick();\n ticking = setInterval(tick, 250);\n hearing.hidden = false;\n mic.setAttribute('aria-pressed', 'true');\n mic.title = 'Stop, and attach it';\n able();\n changed();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n hearing.hidden = true;\n mic.setAttribute('aria-pressed', 'false');\n mic.title = 'Record your voice';\n try {\n const clip = await ending.stop();\n tray.add('voice', clip.id, clip);\n } catch (e) {\n problem.textContent = messageOf(e);\n }\n able();\n changed();\n };\n\n /**\n * The shots to attach: one taken now, where that's on, and those in the tray, each the window as it was taken.\n * Only the first has the elements outlined in it, and its spot circled (or is as it was taken, where that can't be\n * drawn), so it's first: nothing else in a shot says what it's about.\n */\n const screenshotsOf = async (): Promise<Sent[] | undefined> => {\n if (shots === undefined) return undefined;\n // One drawn on says its notes, and where the element is in it, where it's the first one it was taken of.\n const kept: Sent[] = taken().pictures.map(({ id, url, drawn }) => ({\n id,\n url,\n ...(drawn !== undefined && drawn.about !== '' && drawn.about === firstAt() ? { box: drawn.shot.box } : {}),\n ...(drawn === undefined || drawn.marks.length === 0 ? {} : { marks: marksOf(drawn.marks) }),\n }));\n if (!shooting()) return kept.length === 0 ? undefined : kept;\n doing.textContent = 'Capturing…';\n // Of the first element, which the shot then says the place of; of the page, with none on it.\n const first = onPage(about[0]);\n const of = first ?? document.documentElement;\n const now = await shots.capture(of);\n const where = first === undefined ? {} : { box: now.box };\n // The others as the page has them, moved by as much as the shot has the first off where the page has it.\n const live = of.getBoundingClientRect();\n const boxes = about.flatMap((a) => {\n const it = onPage(a);\n if (it === undefined) return [];\n if (it === first) return a.own && options.at !== undefined ? [] : [now.box];\n const r = it.getBoundingClientRect();\n return [{ x: r.left + now.box.x - live.left, y: r.top + now.box.y - live.top, width: r.width, height: r.height }];\n });\n const spot = first !== undefined && about[0]?.own === true ? options.at : undefined;\n const circled = spot === undefined ? undefined : { x: now.box.x + spot.x, y: now.box.y + spot.y };\n if (boxes.length === 0 && circled === undefined) return [{ id: now.id, url: now.url }, ...kept];\n try {\n const { id, url } = await shots.upload(await outlined(now.url, now.size, boxes, circled), now);\n return [{ id, url, ...where, outlined: true }, ...kept];\n } catch {\n return [{ id: now.id, url: now.url, ...where }, ...kept];\n }\n };\n\n const sendIt = async () => {\n if (sending) return;\n sending = true;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (text.value.trim() === '' && attachedCount() === 0) {\n sending = false;\n able();\n return;\n }\n able();\n problem.textContent = '';\n note.textContent = '';\n let screenshots: Sent[] | undefined;\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the field, which stays as it is: turn the screenshot off to send without.\n problem.textContent = messageOf(e);\n doing.textContent = '';\n sending = false;\n able();\n return;\n }\n doing.textContent = '';\n const { recordings, voices } = taken();\n const annotations = annotationsOf(notes);\n let done = false;\n try {\n done = await options.submit({\n text: text.value,\n about,\n html: withHtml,\n ...(screenshots === undefined ? {} : { screenshots }),\n recordings,\n voices,\n ...(annotations === undefined ? {} : { annotations }),\n });\n } catch (e) {\n problem.textContent = messageOf(e);\n }\n if (done) {\n text.value = '';\n grow();\n // It has them now: what was made for it, and what was drawn on the page for it.\n for (const plugin of KINDS) tray.remove(plugin);\n notes?.clear();\n wanted = undefined;\n about = options.about?.() ?? [];\n showChips();\n changed();\n }\n sending = false;\n able();\n };\n\n text.addEventListener('input', () => {\n grow();\n able();\n changed();\n });\n // Enter sends, as a chat's field does; Shift+Enter is a new line. Not while an IME is composing a word.\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || e.shiftKey || e.isComposing) return;\n e.preventDefault();\n void sendIt();\n });\n showChips();\n requestAnimationFrame(grow);\n\n return {\n el,\n send,\n problem,\n note,\n pending: () => text.value.trim() !== '' || take !== undefined,\n draft: () => ({ text: text.value, ...(wanted === undefined ? {} : { shot: wanted }), html: withHtml, about }),\n restore: (draft) => {\n if (draft.text !== undefined) text.value = draft.text;\n if (draft.shot !== undefined) wanted = draft.shot;\n if (draft.html !== undefined) withHtml = draft.html;\n if (draft.about !== undefined) about = draft.about;\n showChips();\n grow();\n },\n stopTake: speakOff,\n focus: () => text.focus(),\n destroy: () => {\n for (const stop of unsubscribe) stop?.();\n aborts.abort();\n cancelAnimationFrame(following);\n outlines?.remove();\n // A take it closes on is kept, in the tray: the next one's.\n void speakOff();\n },\n };\n}\n","/**\n * The channel's tasks as the page has them: read once for the pins and the drawer both, and again when one of\n * them changes a task. And which of them have something unread: a reply since the task was last opened here, or an\n * end no one has looked at. What's been read is the browser's to keep, as a board keeps it for no one.\n */\nimport type { ClientContext } from '#src/index.ts';\n\nimport type { Listed } from './index.ts';\n\n/** How long the tasks read last are shown as they are, in ms: the keys are held again and again, and each is no reason to ask the board. */\nconst FRESH = 4000;\n/** Where what's been read is kept: each task's ID, and how its thread stood when it was last opened. */\nconst SEEN = 'deictic:tasks:seen';\n/** Where the finished tasks put away are kept: each one's ID, and how its thread stood then. */\nconst ARCHIVED = 'deictic:tasks:archived';\n/** The states of a finished task, as a board names them: nothing more happens to it. */\nexport const OVER = new Set(['completed', 'failed']);\n/** The states whose coming is news in itself, whoever said nothing as it came. */\nconst NEWS = new Set(['blocked', 'completed', 'failed']);\n\nexport interface Store {\n /** The tasks as read last: those still to do, oldest first, then the latest finished. */\n tasks: () => Listed[];\n /** The channel, and its page on the board where there's one to link to: nothing before the first read. */\n channel: () => { name: string; link?: string } | undefined;\n /** Reads them again, unless they were a moment ago: `again` whatever, after a change made here. */\n load: (again?: boolean) => void;\n /** Hears each read; answers what stops it. */\n subscribe: (listener: () => void) => () => void;\n /** Whether a task has something no one has read here. */\n unread: (task: Listed) => boolean;\n /** The reply that was its newest when it was last read here, where it had one. */\n read: (task: Listed) => string | undefined;\n /** Says a task is read, as its thread stands. */\n seen: (task: Listed) => void;\n /** Whether a finished task was put away here, and nothing has happened to it since. */\n archived: (task: Listed) => boolean;\n /** Puts finished tasks away, read: out of the drawer until something happens to one. */\n archive: (tasks: Listed[]) => void;\n}\n\n/** How a task's thread stands: its newest reply, and its state where that's news. */\nconst markOf = (task: Listed) => `${task.last ?? ''}|${NEWS.has(task.state) ? task.state : ''}`;\n\n/** What's kept under `key` (what's been read, what's put away), or nothing where this browser has kept none yet. */\nfunction kept(key = SEEN): Record<string, string> | undefined {\n try {\n const seen: unknown = JSON.parse(localStorage.getItem(key) ?? 'null');\n return typeof seen === 'object' && seen !== null ? (seen as Record<string, string>) : undefined;\n } catch {\n // Storage can be off, or hold something else: nothing's been kept, then.\n return undefined;\n }\n}\n\nconst made = new WeakMap<ShadowRoot, Store>();\n\n/** The tasks of the overlay `context` is of: one store, whoever asks. */\nexport function storeOf(context: ClientContext): Store {\n const known = made.get(context.root);\n if (known !== undefined) return known;\n\n let tasks: Listed[] = [];\n let channel: { name: string; link?: string } | undefined;\n let read = 0;\n let asked = 0;\n let seen = kept();\n const listeners = new Set<() => void>();\n const tell = () => {\n for (const listener of listeners) listener();\n };\n let away = kept(ARCHIVED) ?? {};\n const keep = (key = SEEN, value: unknown = seen) => {\n try {\n localStorage.setItem(key, JSON.stringify(value));\n } catch {\n // Not kept past the page, then.\n }\n };\n\n const store: Store = {\n tasks: () => tasks,\n channel: () => channel,\n load: (again = false) => {\n if (!again && Date.now() - read < FRESH) return;\n const ask = ++asked;\n read = Date.now();\n void context\n .request('page')\n .then(async (res) => {\n if (!res.ok || ask !== asked) return;\n const answer = (await res.json()) as { channel?: string; link?: string; tasks: Listed[] };\n ({ tasks } = answer);\n // The first read in this browser: what the channel has by now is old news, and only what comes after is unread.\n if (seen === undefined) {\n seen = Object.fromEntries(tasks.map((task) => [task.id, markOf(task)]));\n keep();\n }\n if (answer.channel !== undefined) channel = { name: answer.channel, ...(answer.link === undefined ? {} : { link: answer.link }) };\n tell();\n })\n // As they were, then: whatever opens a task says why the board can't be reached.\n .catch(() => {});\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n unread: (task) => seen !== undefined && markOf(task) !== '|' && seen[task.id] !== markOf(task),\n read: (task) => seen?.[task.id]?.split('|', 1)[0] || undefined,\n seen: (task) => {\n if (seen?.[task.id] === markOf(task)) return;\n // Another tab may have read others since: theirs are kept too.\n seen = { ...seen, ...kept(), [task.id]: markOf(task) };\n keep();\n tell();\n },\n archived: (task) => OVER.has(task.state) && away[task.id] === markOf(task),\n archive: (finished) => {\n const marks = Object.fromEntries(finished.filter((task) => OVER.has(task.state)).map((task) => [task.id, markOf(task)]));\n // Only what the board still lists: the rest have gone from it, and needn't be kept.\n const listed = new Set(tasks.map((task) => task.id));\n away = Object.fromEntries(Object.entries({ ...away, ...kept(ARCHIVED), ...marks }).filter(([id]) => listed.has(id)));\n keep(ARCHIVED, away);\n seen = { ...seen, ...kept(), ...marks };\n keep();\n tell();\n },\n };\n made.set(context.root, store);\n return store;\n}\n","/**\n * Which element a task is about, where one place in the source renders several (a list's items, a `map`): the mark\n * alone finds the first of them, so a task keeps its place among them and its text, and is found again by those.\n */\nimport { ATTRIBUTE } from '#src/client/dom.ts';\n\nimport type { Task, Which } from './index.ts';\n\n/** As much of an element's text as tells it from its siblings, and as a label holds. */\nconst SAID = 120;\n\nconst textOf = (el: Element) => (el.textContent ?? '').replace(/\\s+/g, ' ').trim().slice(0, SAID);\n\n/** Which of `alike` (the elements with its mark, in the page's order) `el` is; its text as `said` has it, which may be masked. */\nexport function whichOf(el: Element, alike: Element[], said: Element = el): Which {\n const text = textOf(said);\n return { nth: alike.indexOf(el) + 1, ...(text === '' ? {} : { text }) };\n}\n\n/**\n * The element a task is about on this page: the only one with its mark, or the one of several with its text, else the\n * one at its place among them. None where it was one of more than the page has now and its text is on none of them.\n */\nexport function elementOf(task: Pick<Task, 'which'> & { place?: string }): Element | null {\n if (task.place === undefined) return null;\n const alike = [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(task.place)}\"]`)];\n const { which } = task;\n if (which === undefined || alike.length <= 1) return alike[0] ?? null;\n const at = alike[which.nth - 1];\n const said = which.text === undefined ? [] : alike.filter((el) => textOf(el) === which.text);\n // Text that's on several (`Learn more`) is told apart by the place among them, where that's one of them.\n if (said.length > 0) return at !== undefined && said.includes(at) ? at : said[0]!;\n return at ?? null;\n}\n","/**\n * The tasks' section of the drawer: the channel's tasks still to do, each with its state, and the latest finished\n * folded under them, those put away (archived) left out. One with something unread (a reply since it was last opened\n * here, or an end no one looked at) says so, and a row the pointer is on lights its element on the page. A task opens\n * in the drawer: its words, to change while no one has it, what it has attached, its thread, read as it's opened and\n * again every few seconds, a composer to answer in (as the Task tab's, with what a reply can attach), and Delete,\n * which cancels it on the board.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { place } from '#src/client/dom.ts';\nimport type { ClientContext, LightboxItem } from '#src/index.ts';\n\nimport { attachedOf, type Composer, COMPOSER_STYLE, composerIn, element, messageOf, PLAY } from './composer.ts';\nimport type { Answer, Attached, Listed, Thread } from './index.ts';\nimport { OVER, storeOf } from './store.ts';\nimport { elementOf } from './which.ts';\n\nconst STYLE = `\n.tasks-drawer h3 .unread { padding: 0 6px; border-radius: 8px; font-weight: 700; letter-spacing: 0; color: var(--deictic-on-accent); background: var(--deictic-accent); }\n.tasks-drawer h3 a { margin-left: auto; font-weight: 400; letter-spacing: 0; text-transform: none; color: inherit; }\n.tasks-drawer h3 a:hover { color: var(--deictic-fg); }\n.task-row { display: grid; grid-template: 'state title mark' auto 'state meta mark' auto / auto minmax(0, 1fr) auto; gap: 1px 8px; align-items: center;\n width: 100%; padding: 6px 8px; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 8px; text-align: left; font-size: 12px; background: rgb(255 255 255 / 0.04); }\n.task-row:hover { border-color: rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.06); }\n.task-row .title { grid-area: title; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.task-row .meta { grid-area: meta; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--deictic-muted); }\n.task-row.unread .title { font-weight: 600; }\n/* What's unread is a dot of the overlay's own green, where a read one has nothing. */\n.task-row .mark { grid-area: mark; width: 7px; height: 7px; border-radius: 50%; }\n.task-row.unread .mark { background: var(--deictic-accent); box-shadow: 0 0 8px var(--deictic-accent); }\n/* The state is a dot, as a board's is: a ring while no one has it, filled once someone does or it's finished. */\n.task-state { grid-area: state; flex: none; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.task-state.waiting { border-style: dotted; }\n.task-state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.task-state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.task-state.completed { border-color: #4ade80; background: #4ade80; }\n.task-state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks-drawer details { margin-top: 6px; }\n.tasks-drawer summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.tasks-drawer summary:hover { color: var(--deictic-fg); }\n.tasks-drawer details .drawer-rows { margin-top: 6px; }\n.tasks-drawer .put-away { justify-self: end; }\n.tasks-drawer .act, .task-view .act { padding: 1px 6px; border: 0; font-size: 12px; color: var(--deictic-muted); }\n.tasks-drawer .act:hover, .task-view .act:hover { color: var(--deictic-fg); }\n.task-view { display: flex; flex-direction: column; gap: 8px; min-height: 0; font-size: 12px; }\n.task-view .stands { display: flex; align-items: center; gap: 6px; color: var(--deictic-muted); }\n.task-view .stands .says { flex: 1; }\n.task-view .stands a { color: inherit; }\n.task-view .stands a:hover { color: var(--deictic-fg); }\n.task-view .act.sure { color: var(--deictic-problem); }\n.task-view .where { align-self: start; max-width: 100%; padding: 0; border: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px ui-monospace, monospace; color: var(--deictic-accent); }\n.task-view .where span { color: var(--deictic-muted); }\n.task-view .words { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }\n.task-view .said { padding: 4px 8px; border-left: 2px solid var(--deictic-line); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--deictic-muted); }\n.task-view .editing textarea { display: block; box-sizing: border-box; width: 100%; min-height: 56px; resize: vertical; font: 13px/1.45 system-ui, sans-serif; }\n.task-view .buttons { display: flex; justify-content: end; gap: 6px; margin-top: 6px; }\n/* What a task or a reply has attached: a chip each, which opens all of them in the lightbox. */\n.task-files { display: flex; flex-wrap: wrap; gap: 4px; }\n.task-files:empty { display: none; }\n/* One height, and a thumbnail one size, as the composer's chips: nothing moves as the pictures load. */\n.task-files button { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 6px 0 2px; border: 1px solid var(--deictic-line); border-radius: 6px; font-size: 11px; }\n.task-files button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.task-files img { flex: none; display: block; width: 30px; height: 20px; object-fit: cover; border-radius: 4px; background: var(--deictic-line); }\n.task-files .play { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; background: var(--deictic-line); }\n.task-files .play svg { width: 10px; height: 10px; }\n.task-thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 8px 0 0; border-top: 1px solid rgb(255 255 255 / 0.08); list-style: none; }\n.task-thread:empty { display: none; }\n.task-thread li { display: grid; gap: 4px; padding: 6px 8px; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 8px; background: rgb(255 255 255 / 0.04); }\n.task-thread li.new { border-color: color-mix(in srgb, var(--deictic-accent) 55%, transparent); }\n.task-thread .by { display: flex; gap: 6px; align-items: baseline; font-size: 11px; color: var(--deictic-muted); }\n.task-thread .by b { font-weight: 600; color: var(--deictic-fg); }\n.task-thread .by i { margin-left: auto; font-style: normal; }\n.task-thread .text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }\n.task-view .problem { color: var(--deictic-problem); }\n.task-view .problem:empty { display: none; }\n/* On the page, around an element a task is about: the open task's, and each one attached in the Task tab. */\n.task-about { position: fixed; z-index: 2147483646; box-sizing: border-box; pointer-events: none; border: 1.5px dashed var(--deictic-accent); border-radius: 6px; }\n.task-about[hidden] { display: none; }\n${COMPOSER_STYLE}`;\n\n/** How often an open task's thread is read again, in ms: an agent answers while it's looked at. */\nconst AGAIN = 5000;\n/** How long Delete waits to be pressed again, in ms, before it's only Delete once more. */\nconst SURE = 3000;\n/** Where what's typed in a reply is kept while its task isn't open: for the tab, over page loads. */\nconst DRAFTS = 'deictic:tasks:drafts';\nconst FILE =\n '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><path d=\"M6 3h8l4 4v14H6zM14 3v4h4\"/></svg>';\n\n/** `now`, `5m`, `2h`, `3d`: how long ago, as short as a thread's margin. */\nfunction ago(at: string): string {\n const minutes = Math.round((Date.now() - Date.parse(at)) / 60_000);\n if (!(minutes >= 1)) return 'now';\n if (minutes < 60) return `${minutes}m`;\n return minutes < 60 * 24 ? `${Math.round(minutes / 60)}h` : `${Math.round(minutes / (60 * 24))}d`;\n}\n\n/** What's typed in each task's reply, by its ID. */\nfunction drafts(): Record<string, string> {\n try {\n const kept: unknown = JSON.parse(sessionStorage.getItem(DRAFTS) ?? '{}');\n return typeof kept === 'object' && kept !== null ? (kept as Record<string, string>) : {};\n } catch {\n // Storage can be off: nothing's kept, then.\n return {};\n }\n}\n\nfunction keepDraft(id: string, text: string): void {\n const { [id]: _, ...rest } = drafts();\n try {\n sessionStorage.setItem(DRAFTS, JSON.stringify(text.trim() === '' ? rest : { ...rest, [id]: text }));\n } catch {\n // Not kept past the page, then.\n }\n}\n\n/** A board's file as a person names it: what it is, not what deictic called it. */\nfunction nameOf(file: Attached, i: number, all: Attached[]): string {\n const alike = all.filter((other) => kindOf(other) === kindOf(file));\n const n = alike.length === 1 ? '' : ` ${alike.indexOf(file) + 1}`;\n const kind = kindOf(file);\n if (kind === 'image') return `Screenshot${n}`;\n if (kind === 'recording') return `Recording${n}`;\n if (kind === 'audio') return `Voice note${n}`;\n if (/^element(\\.\\d+)?\\.html$/.test(file.name)) return `HTML${n}`;\n return file.name || `File ${i + 1}`;\n}\n\nconst kindOf = ({ type, name }: Attached) =>\n type.startsWith('image/') ? 'image' : name.startsWith('recording-') ? 'recording' : type.startsWith('audio/') ? 'audio' : 'file';\n\nexport interface TasksDrawer {\n /** Opens a task in the drawer, or several to pick from: a pin's. */\n open: (tasks: Listed[]) => void;\n}\n\nconst made = new WeakMap<ShadowRoot, TasksDrawer>();\n\n/** The tasks' section in the drawer of the overlay `context` is of: added the first time it's asked for. */\nexport function drawerOf(context: ClientContext): TasksDrawer {\n const known = made.get(context.root);\n if (known !== undefined) return known;\n\n const store = storeOf(context);\n const section = element('section', { className: 'tasks-drawer', hidden: true });\n const heading = element('h3');\n const rows = element('div', { className: 'drawer-rows' });\n const finished = element('details');\n const finishedCount = element('summary');\n const finishedRows = element('div', { className: 'drawer-rows' });\n const putAway = element('button', {\n type: 'button',\n className: 'act put-away',\n textContent: 'Archive all',\n title: 'Put the finished tasks away: one comes back when something happens to it',\n });\n putAway.addEventListener('click', () => store.archive(store.tasks().filter((task) => OVER.has(task.state))));\n finishedRows.append(putAway);\n finished.append(finishedCount, finishedRows);\n section.append(element('style', { textContent: STYLE }), heading, rows, finished);\n\n /** What a task is about, as the caption says an element: by its component where the page has it, else its tag. */\n const about = (task: Listed) => {\n if (task.problem !== undefined) return task.problem === 'setup' ? \"deictic's setup\" : 'a bug in deictic';\n if (task.place === undefined) return 'the page';\n const el = elementOf(task);\n if (el !== null) return tell(named(el));\n // Not on this page: its tag as the task saw it, and the page it was on where that's another.\n const on = task.page === undefined || task.page === location.pathname ? '' : ` on ${task.page}`;\n return `${task.tag === undefined ? 'an element' : `<${task.tag}>`}${on}`;\n };\n /** Lights a task's element on the page while the pointer is on what stands for it here. */\n const lights = (on: HTMLElement, task: () => Listed) => {\n on.addEventListener('pointerenter', () => context.light(elementOf(task()) ?? undefined));\n on.addEventListener('pointerleave', () => context.light());\n };\n const rowOf = (task: Listed) => {\n const row = element('button', { type: 'button', className: `task-row${store.unread(task) ? ' unread' : ''}` });\n const says = task.by === undefined ? task.state : `${task.state} by ${task.by}`;\n const replies = task.replies === 0 ? '' : ` · ${task.replies} ${task.replies === 1 ? 'reply' : 'replies'}`;\n row.append(\n element('span', { className: `task-state ${task.state}`, ariaHidden: 'true' }),\n element('span', { className: 'title', textContent: task.title }),\n element('span', { className: 'meta', textContent: `${says} · ${about(task)}${replies}` }),\n element('span', { className: 'mark', ...(store.unread(task) ? { title: 'Unread' } : {}) }),\n );\n lights(row, () => task);\n row.addEventListener('click', () => {\n context.light();\n view(task);\n });\n return row;\n };\n const draw = () => {\n const tasks = store.tasks().filter((task) => !store.archived(task));\n const live = tasks.filter((task) => !OVER.has(task.state));\n const ended = tasks.filter((task) => OVER.has(task.state));\n section.hidden = tasks.length === 0;\n const unread = tasks.filter(store.unread).length;\n // For the drawer folded away: what's still to do, and what's unread.\n section.dataset.count = String(live.length);\n section.dataset.unread = String(unread);\n const channel = store.channel();\n heading.replaceChildren(\n 'Tasks',\n ...(unread === 0 ? [] : [element('span', { className: 'unread', textContent: String(unread), title: `${unread} unread` })]),\n ...(channel?.link === undefined\n ? []\n : [\n element('a', {\n href: channel.link,\n target: '_blank',\n rel: 'noreferrer',\n textContent: `#${channel.name}`,\n title: 'Open the channel on the board',\n }),\n ]),\n );\n rows.replaceChildren(...live.map(rowOf));\n finished.hidden = ended.length === 0;\n const news = ended.filter(store.unread).length;\n finishedCount.textContent = `${ended.length} finished${news === 0 ? '' : `, ${news} unread`}`;\n finishedRows.replaceChildren(...ended.map(rowOf), putAway);\n };\n store.subscribe(draw);\n context.drawer.add(section, { first: true });\n\n const ask = async <T>(route: string, body?: unknown): Promise<T> => {\n const res = await context.request(\n route,\n body === undefined ? undefined : { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) },\n );\n const answer = (await res.json()) as T & { problem?: string };\n if (!res.ok) throw new Error(answer.problem ?? `the dev server answered ${res.status}`);\n return answer;\n };\n\n /** A message's files as chips, each opening them all in the lightbox at itself. */\n const filesOf = (task: string, files: Attached[]): HTMLElement => {\n const list = element('div', { className: 'task-files' });\n const urlOf = (file: Attached) =>\n file.url ?? `${context.base}__deictic/plugins/tasks/file/${encodeURIComponent(task)}/${encodeURIComponent(file.id)}`;\n // What the lightbox shows of each: a picture, a sound, a recording's replay, or a file as text.\n const items: LightboxItem[] = files.map((file, i) => {\n const title = nameOf(file, i, files);\n const kind = kindOf(file);\n if (kind === 'image') return { kind: 'image', url: urlOf(file), title };\n if (kind === 'audio') return { kind: 'audio', url: urlOf(file), title };\n const replay = kind === 'recording' ? file.replay : undefined;\n const url = replay === undefined ? urlOf(file) : `${replay}${replay.includes('?') ? '&' : '?'}embed`;\n const open = replay ?? urlOf(file);\n return {\n kind: 'page',\n url,\n title,\n actions: [{ label: 'New tab', title: 'Open it in a tab of its own', run: () => void window.open(open, '_blank', 'noopener') }],\n };\n });\n list.append(\n ...files.map((file, i) => {\n const name = nameOf(file, i, files);\n // `Open screenshot 2`, but `Open HTML`.\n const said = /^[A-Z]{2}/.test(name) ? name : `${name[0]!.toLowerCase()}${name.slice(1)}`;\n const chip = element('button', { type: 'button', title: `Open ${said}` });\n const kind = kindOf(file);\n const icon =\n kind === 'image'\n ? element('img', { src: urlOf(file), alt: '', loading: 'lazy' })\n : element('span', { className: 'play', innerHTML: kind === 'file' ? FILE : PLAY });\n chip.append(icon, element('span', { textContent: name }));\n chip.addEventListener('click', () => context.lightbox(items, { at: i, from: chip }));\n return chip;\n }),\n );\n return list;\n };\n\n /** A task, open in the drawer: its words, what's attached, its thread, and what changes them. */\n function view(first: Listed): void {\n let task = first;\n let editing = false;\n // The reply that was its newest when it was last read: those after it are new, this once.\n const readTo = store.read(first);\n const fresh = store.unread(first);\n // What was answered from here: never new to who wrote it.\n const mine = new Set<string>();\n const recorder = context.use('recordings');\n\n const el = element('div', { className: 'task-view' });\n const stands = element('div', { className: 'stands' });\n const where = element('button', { type: 'button', className: 'where' });\n const words = element('div');\n const files = element('div');\n const said = element('div', { className: 'said' });\n const thread = element('ol', { className: 'task-thread' });\n const problem = element('div', { className: 'problem' });\n // The task's element, lit on the page while the pointer is on its name, as its row's is.\n lights(where, () => task);\n\n const composer: Composer = composerIn(context, {\n placeholder: 'Reply…',\n sendLabel: 'Reply',\n over: true,\n // What's typed is kept, the drawer closes, and the page is recorded: stopped, the recording is in the tray,\n // and the task opened again has it and the words.\n record: () => {\n if (recorder === undefined) return;\n if (recorder.recording()) {\n composer.problem.textContent = \"A recording is going already: stop it in the tool panel, and it's attached here\";\n return;\n }\n close();\n void recorder.record();\n },\n submit: async (gathered) => {\n const answer: Answer = { text: gathered.text, ...attachedOf(gathered) };\n const after = await ask<Thread>(`reply/${encodeURIComponent(task.id)}`, answer);\n const last = after.replies.at(-1);\n if (last !== undefined) mine.add(last.id);\n shown(after);\n keepDraft(task.id, '');\n store.load(true);\n return true;\n },\n });\n composer.restore({ text: drafts()[first.id] ?? '' });\n el.append(stands, where, words, files, said, thread, composer.el, problem);\n\n // The element it's about, outlined on the page while it's open, and shown by a press on its name.\n const outline = element('div', { className: 'task-about', hidden: true });\n context.root.append(outline);\n let following = requestAnimationFrame(function follow() {\n following = requestAnimationFrame(follow);\n const it = elementOf(task);\n outline.hidden = it === null;\n if (it !== null) place(outline, it.getBoundingClientRect());\n });\n where.addEventListener('click', () => elementOf(task)?.scrollIntoView({ block: 'center', behavior: 'smooth' }));\n\n const failed = (e: unknown) => (problem.textContent = messageOf(e));\n let removing: ReturnType<typeof setTimeout> | undefined;\n const drawTask = () => {\n const state = element('span', { className: `task-state ${task.state}`, ariaHidden: 'true' });\n const says = element('span', { className: 'says', textContent: task.by === undefined ? task.state : `${task.state} by ${task.by}` });\n const to =\n task.link === undefined\n ? []\n : [\n element('a', {\n href: task.link,\n target: '_blank',\n rel: 'noreferrer',\n textContent: 'on the board',\n title: 'Open the task on the board',\n }),\n ];\n const edit = element('button', { type: 'button', className: 'act', textContent: 'Edit', title: 'Change its words' });\n edit.addEventListener('click', () => {\n editing = true;\n drawWords();\n });\n // Twice, as nothing brings a task back: a board never reopens one it canceled.\n const remove = element('button', { type: 'button', className: 'act', textContent: 'Delete', title: 'Cancel it on the board' });\n remove.addEventListener('click', () => {\n if (!remove.classList.contains('sure')) {\n remove.classList.add('sure');\n remove.textContent = 'Delete?';\n removing = setTimeout(() => {\n remove.classList.remove('sure');\n remove.textContent = 'Delete';\n }, SURE);\n return;\n }\n remove.disabled = true;\n ask(`remove/${encodeURIComponent(task.id)}`, {}).then(() => {\n store.load(true);\n close();\n }, failed);\n });\n // A finished one is put away from here, as the list puts them all away.\n const archive = element('button', {\n type: 'button',\n className: 'act',\n textContent: 'Archive',\n title: 'Put it away: it comes back when something happens to it',\n });\n archive.addEventListener('click', () => {\n store.archive([task]);\n close();\n });\n // Edit and Delete only for one no one has claimed, as on the board.\n stands.replaceChildren(state, says, ...to, ...(task.open ? [edit, remove] : []), ...(OVER.has(task.state) ? [archive] : []));\n const at = task.place?.replace(/:\\d+$/, '');\n where.replaceChildren(about(task), ...(at === undefined ? [] : [element('span', { textContent: ` ${at}` })]));\n where.disabled = elementOf(task) === null;\n where.title = task.place === undefined ? 'No element was attached' : where.disabled ? 'Not on this page now' : 'Show it on the page';\n said.hidden = task.said === undefined;\n said.textContent = task.said ?? '';\n };\n const drawWords = () => {\n if (!editing) {\n words.className = 'words';\n words.replaceChildren(task.text);\n return;\n }\n const text = element('textarea', { value: task.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'buttons' });\n buttons.append(leave, save);\n const done = () => {\n editing = false;\n drawWords();\n };\n const keep = () => {\n if (text.value.trim() === '') return;\n if (text.value.trim() === task.text) return done();\n save.disabled = true;\n ask<Thread>(`edit/${encodeURIComponent(task.id)}`, { text: text.value }).then(\n (answer) => {\n editing = false;\n shown(answer);\n store.load(true);\n },\n (e: unknown) => {\n save.disabled = false;\n failed(e);\n },\n );\n };\n text.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n // The words' alone: the task stays open.\n e.stopPropagation();\n done();\n }\n // Enter saves, as the composer sends; Shift+Enter is a new line.\n if (e.key !== 'Enter' || e.shiftKey || e.isComposing) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n words.className = 'editing';\n words.replaceChildren(text, buttons);\n text.focus();\n };\n // What the thread was drawn from, so reading it again redraws only what changed: pictures don't blink.\n let drawn = '';\n /** The task and its thread as just read: drawn, and read by whoever is looking. */\n const shown = (answer: Thread) => {\n task = answer.task;\n problem.textContent = '';\n drawTask();\n if (!editing) drawWords();\n const now = JSON.stringify([answer.files.map((f) => f.id), answer.replies.map((r) => [r.id, r.text, r.files.length]), [...mine]]);\n if (now !== drawn) {\n drawn = now;\n files.replaceChildren(filesOf(task.id, answer.files));\n const from = readTo === undefined ? -1 : answer.replies.findIndex((r) => r.id === readTo);\n // At its end only if it has grown: reading up the thread isn't pulled back down.\n const grew = answer.replies.length !== thread.childElementCount;\n thread.replaceChildren(\n ...answer.replies.map((r, i) => {\n const item = element('li', { className: fresh && i > from && !mine.has(r.id) ? 'new' : '' });\n const by = element('div', { className: 'by' });\n by.append(\n element('b', { textContent: r.by }),\n ...(r.kind === 'person' ? [] : ['agent']),\n element('i', { textContent: ago(r.at), title: new Date(r.at).toLocaleString() }),\n );\n item.append(by, element('div', { className: 'text', textContent: r.text }), filesOf(task.id, r.files));\n return item;\n }),\n );\n if (grew) thread.lastElementChild?.scrollIntoView({ block: 'nearest' });\n }\n store.seen(task);\n };\n const load = () => ask<Thread>(`thread/${encodeURIComponent(task.id)}`).then(shown, failed);\n\n drawTask();\n drawWords();\n void load();\n const again = setInterval(() => void load(), AGAIN);\n const close = context.drawer.show(el, {\n title: `#${task.id}`,\n closed: () => {\n keepDraft(task.id, composer.draft().text);\n composer.destroy();\n context.light();\n clearInterval(again);\n clearTimeout(removing);\n cancelAnimationFrame(following);\n outline.remove();\n },\n });\n }\n\n /** Several tasks of one place, to pick from. */\n const pick = (tasks: Listed[]) => {\n const el = element('div', { className: 'drawer-rows' });\n el.append(...tasks.map(rowOf));\n context.drawer.show(el, { title: `${tasks.length} tasks on ${about(tasks[0]!)}`, closed: () => context.light() });\n };\n\n const drawer: TasksDrawer = {\n open: (tasks) => {\n if (tasks.length === 1) view(tasks[0]!);\n else if (tasks.length > 1) pick(tasks);\n },\n };\n made.set(context.root, drawer);\n return drawer;\n}\n","/**\n * The page's tasks, each pinned where its element is: what's shown of them on the page itself, beside the Task\n * tab's list of one element's. A pin is the element's outline, faint, and a badge on its corner with how many\n * tasks are still to do there, in the colour of the furthest along, and a dot where one has something unread. They\n * show while a shortcut's keys are held and while the Task tab is open: a pin under the pointer reads its tasks, and\n * a click opens them in the drawer.\n *\n * In a layer of the overlay's root, which the tab's own styles don't reach once it's closed: so its styles are its own.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { div, place, reduced, sameAs } from '#src/client/dom.ts';\nimport type { ClientContext, Point } from '#src/index.ts';\n\nimport { drawerOf } from './drawer.ts';\nimport type { Placed } from './index.ts';\nimport { OVER, storeOf } from './store.ts';\nimport { elementOf } from './which.ts';\n\nconst STYLE = `\n/* No box of its own, which its pins would stack in: each is under the popup, and the one pointed at over it, with its card. */\n.pins { display: contents; font: 12px/1.4 system-ui, sans-serif; color: var(--deictic-fg); }\n.pin { --pin: var(--deictic-accent); position: fixed; z-index: 2147483646; box-sizing: border-box; pointer-events: none; border: 1px solid color-mix(in srgb, var(--pin) 45%, transparent); border-radius: 6px; transition: border-color 0.15s, box-shadow 0.15s; }\n.pin.claimed { --pin: #60a5fa; }\n.pin.blocked { --pin: #fbbf24; }\n.pin[hidden] { display: none; }\n.pin.spot, .pin.spot:has(.pin-badge:hover, .pin-badge:focus-visible) { border: 0; box-shadow: none; }\n.pin:has(.pin-badge:hover, .pin-badge:focus-visible) { z-index: 2147483647; border-color: var(--pin); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 18%, transparent), 0 0 28px color-mix(in srgb, var(--pin) 45%, transparent); }\n/* A drop, its point on the element's corner. */\n.pin-badge {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 22px;\n height: 22px;\n padding: 0 6px;\n border: 0;\n border-radius: 11px 11px 11px 3px;\n font: 700 12px/22px system-ui, sans-serif;\n font-variant-numeric: tabular-nums;\n color: #09090b;\n background: var(--pin);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 22%, transparent), 0 0 18px color-mix(in srgb, var(--pin) 60%, transparent), 0 4px 12px rgb(0 0 0 / 0.4);\n pointer-events: auto;\n cursor: pointer;\n}\n.pin-badge:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }\n/* Something unread there: a dot on the badge's corner. */\n.pin.unread .pin-badge::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border: 2px solid #09090b; border-radius: 50%; background: #fff; }\n.pin-card {\n position: absolute;\n left: 0;\n top: calc(100% + 8px);\n display: none;\n flex-direction: column;\n gap: 4px;\n width: max-content;\n max-width: 300px;\n padding: 8px 10px;\n border: 1px solid rgb(255 255 255 / 0.12);\n border-radius: 10px;\n font: 12px/1.4 system-ui, sans-serif;\n text-align: left;\n color: var(--deictic-fg);\n background: rgb(24 24 27 / 0.9);\n backdrop-filter: blur(16px) saturate(1.6);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);\n cursor: pointer;\n}\n.pin.left .pin-card { left: auto; right: 0; }\n.pin.up .pin-card { top: auto; bottom: calc(100% + 8px); }\n.pin-badge:hover .pin-card, .pin-badge:focus-visible .pin-card { display: flex; }\n.pin-where { font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.pin-where b { color: var(--pin); }\n.pin-task { display: flex; gap: 6px; align-items: baseline; min-width: 0; }\n.pin-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.pin-task i { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.pin-task i.claimed { border-color: #60a5fa; background: #60a5fa; }\n.pin-task i.blocked { border-color: #fbbf24; background: #fbbf24; }\n.pin-task i.waiting { border-style: dotted; }\n.pin-task em { flex: none; font-style: normal; color: var(--deictic-muted); }\n.pin-more { color: var(--deictic-muted); }\n@media (prefers-reduced-motion: no-preference) {\n .pin { animation: deictic-pin-area 0.3s ease-out backwards; }\n .pin-badge { animation: deictic-pin 0.34s cubic-bezier(0.2, 0.9, 0.25, 1.4) backwards; animation-delay: inherit; transform-origin: 0 100%; }\n}\n@keyframes deictic-pin-area {\n from { opacity: 0; }\n}\n@keyframes deictic-pin {\n from { opacity: 0; scale: 0.2; }\n}\n`;\n\n/** How long the pins outlast what showed them, in ms: the popup opens a moment after the pointing that led to it ends. */\nconst LINGER = 200;\n/** A badge's size, and how far out of the element's corner it sits, in pixels. */\nconst BADGE = 22;\nconst OUT = 10;\nconst EDGE = 4;\n/** The tasks a pin's card names, before it only counts them. */\nconst NAMED = 4;\n/** The states by how far along, the furthest first: a pin is the colour of its furthest. */\nconst ALONG = ['blocked', 'claimed', 'ready', 'waiting'];\n\nexport interface Pins {\n /** Shows them: every place's, to read under the pointer and open with a click. Answers what takes them away. */\n glance: () => () => void;\n}\n\ninterface Pin {\n place: string;\n /** The spot in the element it's on, for a task about one: the pin is there, and has no outline. */\n at?: Point;\n el: Element;\n box: HTMLElement;\n badge: HTMLButtonElement;\n count: HTMLElement;\n card: HTMLElement;\n /** The tasks its badge counts, as last drawn: what a click opens. */\n tasks: Placed[];\n}\n\nconst made = new WeakMap<ShadowRoot, Pins>();\n\n/** The pins of the overlay `context` is of: one set, whoever shows it. */\nexport function pinsIn(context: ClientContext): Pins {\n const kept = made.get(context.root);\n if (kept !== undefined) return kept;\n\n const store = storeOf(context);\n let glances = 0;\n let layer: HTMLElement | undefined;\n let frame = 0;\n let leaving: ReturnType<typeof setTimeout> | undefined;\n const pins = new Map<string, Pin>();\n let frames = 0;\n\n const pinOf = (at: string, el: Element, spot: Point | undefined): Pin => {\n const box = div('pin');\n const badge = Object.assign(document.createElement('button'), { type: 'button', className: 'pin-badge' });\n const count = document.createElement('span');\n const card = Object.assign(document.createElement('span'), { className: 'pin-card' });\n badge.append(count, card);\n box.append(badge);\n // One after another, as they come: where motion is reduced there's no animation to delay.\n if (!reduced()) box.style.animationDelay = `${Math.min(pins.size, 12) * 30}ms`;\n const pin: Pin = { place: at, ...(spot === undefined ? {} : { at: spot }), el, box, badge, count, card, tasks: [] };\n // In the drawer, where a task is read and changed: the popup is for a new one.\n badge.addEventListener('click', () => drawerOf(context).open(pin.tasks));\n return pin;\n };\n\n /** A pin as its tasks are now: how many, the colour of the furthest along, and its card. */\n const fill = (pin: Pin, list: Placed[]) => {\n const state = ALONG.find((s) => list.some((t) => t.state === s)) ?? 'ready';\n pin.tasks = list;\n pin.box.className = `pin ${state}${pin.at === undefined ? '' : ' spot'}${list.some(store.unread) ? ' unread' : ''}`;\n pin.count.textContent = String(list.length);\n const [, file = '', line = ''] = /^(.*):(\\d+):\\d+$/.exec(pin.place) ?? [];\n const tag = tell(named(pin.el));\n pin.badge.setAttribute('aria-label', `${list.length} ${list.length === 1 ? 'task' : 'tasks'} on ${tag}, line ${line}: open`);\n const where = Object.assign(document.createElement('span'), { className: 'pin-where' });\n where.append(Object.assign(document.createElement('b'), { textContent: tag }), ` ${file.split('/').at(-1)}:${line}`);\n const rows = list.slice(0, NAMED).map((t) => {\n const row = Object.assign(document.createElement('span'), { className: 'pin-task' });\n const dot = Object.assign(document.createElement('i'), { className: t.state });\n const by = t.by === undefined ? [] : [Object.assign(document.createElement('em'), { textContent: t.by })];\n row.append(dot, Object.assign(document.createElement('span'), { textContent: t.title }), ...by);\n return row;\n });\n const rest = list.length - rows.length;\n const more = rest === 0 ? [] : [Object.assign(document.createElement('span'), { className: 'pin-more', textContent: `+${rest} more` })];\n pin.card.replaceChildren(where, ...rows, ...more);\n };\n\n /** The pins as the tasks read last have them: one per place with an element on the page, for those still to do. */\n const draw = () => {\n if (layer === undefined) return;\n const tasks = store.tasks().filter((t): t is Placed => t.place !== undefined && !OVER.has(t.state));\n // One for an element's tasks, and one of its own for each spot a task is about.\n // And one for each of several elements from one place, as the page has them now.\n const keyOf = (t: Placed) => {\n const el = elementOf(t);\n const of = el === null ? t.place : `${t.place}#${sameAs(el).indexOf(el)}`;\n return t.point === undefined ? of : `${of}@${t.point.x},${t.point.y}`;\n };\n const byPlace = new Map<string, Placed[]>();\n for (const t of tasks) byPlace.set(keyOf(t), [...(byPlace.get(keyOf(t)) ?? []), t]);\n for (const [at, pin] of pins) {\n if (byPlace.has(at)) continue;\n pin.box.remove();\n pins.delete(at);\n }\n for (const [at, list] of byPlace) {\n let pin = pins.get(at);\n if (pin === undefined) {\n const [first] = list as [Placed, ...Placed[]];\n const { place: where, point } = first;\n const el = elementOf(first);\n if (el === null) continue;\n pin = pinOf(where, el, point);\n pins.set(at, pin);\n layer.append(pin.box);\n }\n fill(pin, list);\n }\n follow();\n };\n\n /** Each pin over its element as the page has it now: read each frame, as nothing tells of an element moving. */\n const follow = () => {\n const width = document.documentElement.clientWidth;\n const height = document.documentElement.clientHeight;\n // An element rendered again is another: looked for now and then, not every frame.\n const look = frames++ % 20 === 0;\n for (const pin of pins.values()) {\n if (!pin.el.isConnected && look && pin.tasks[0] !== undefined) pin.el = elementOf(pin.tasks[0]) ?? pin.el;\n const whole = pin.el.getBoundingClientRect();\n // A spot's is a box of no size at the spot: nothing to outline, and the badge's point is on it.\n const r = pin.at === undefined ? whole : new DOMRect(whole.left + pin.at.x, whole.top + pin.at.y, 0, 0);\n const seen =\n pin.el.isConnected && whole.width > 0 && whole.height > 0 && r.bottom > 0 && r.top < height && r.right > 0 && r.left < width;\n pin.box.hidden = !seen;\n if (!seen) continue;\n place(pin.box, r);\n // On the top right corner, or the badge's point on the spot, and in the window where that isn't.\n const out = pin.at === undefined ? OUT : 0;\n const x = Math.max(EDGE, Math.min(r.right - out, width - EDGE - pin.badge.offsetWidth));\n const y = Math.max(EDGE, Math.min(r.top - BADGE + out, height - EDGE - BADGE));\n // From the box's padding edge, which is inside its border, where it has one.\n const edge = pin.at === undefined ? 1 : 0;\n Object.assign(pin.badge.style, { left: `${x - r.left - edge}px`, top: `${y - r.top - edge}px` });\n // Its card opens toward the middle of the window.\n pin.box.classList.toggle('left', x > width / 2);\n pin.box.classList.toggle('up', y > height / 2);\n }\n };\n\n store.subscribe(draw);\n\n const sync = () => {\n clearTimeout(leaving);\n if (glances === 0) {\n leaving = setTimeout(() => {\n cancelAnimationFrame(frame);\n layer?.remove();\n layer = undefined;\n pins.clear();\n }, LINGER);\n return;\n }\n if (layer === undefined) {\n layer = div('pins');\n layer.append(Object.assign(document.createElement('style'), { textContent: STYLE }));\n frame = requestAnimationFrame(function each() {\n frame = requestAnimationFrame(each);\n follow();\n });\n }\n // After a popup that opened since: at the same height, the later is the upper, and a pin's card is over it.\n context.root.append(layer);\n draw();\n store.load();\n };\n\n const shown: Pins = {\n glance: () => {\n glances++;\n sync();\n return () => {\n glances--;\n sync();\n };\n },\n };\n made.set(context.root, shown);\n return shown;\n}\n","/**\n * The Task tab: a composer to add a task about the element with (`composer.ts`). The tasks there already are the\n * drawer's to list and open (`drawer.ts`), and the pins' to show on the page. Beside the channel it says who watches\n * it (`Model.watching`), or that no agent does.\n * Enter or the arrow sends it with the page's URL, the viewport and the element as it rendered, which the source\n * can't tell: the chain of source it rendered through, its HTML (a file attached), and where the annotations plugin\n * is loaded, what's marked on the page. Record leaves the popup (`away`) to record the page, and comes back with\n * what was typed when it's stopped, wherever the page is by then.\n *\n * Its tool in the panel adds a task about a spot: picked, the next press on the page opens this tab on that point,\n * in the marked element under it or the nearest to it.\n */\nimport { componentOf, fiberOf, ownerOf } from '#src/client/component.ts';\nimport { sameAs, toolButton } from '#src/client/dom.ts';\nimport { defineClientPlugin, type Target } from '#src/index.ts';\n\nimport { type About, atOf, attachedOf, COMPOSER_STYLE, composerIn, type Draft, element, onPage, type Seen } from './composer.ts';\nimport { drawerOf } from './drawer.ts';\nimport type { Model, Op, TaskAdded } from './index.ts';\nimport { pinsIn } from './pins.ts';\nimport { storeOf } from './store.ts';\nimport { whichOf } from './which.ts';\n\nconst STYLE = `\n.compose { flex: none; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n/* Cut short: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n${COMPOSER_STYLE}`;\n\nconst TOOL_STYLE = `\n.task-tool button { position: relative; }\n.task-tool .count {\n position: absolute;\n top: -5px;\n right: -5px;\n box-sizing: border-box;\n min-width: 15px;\n height: 15px;\n padding: 0 4px;\n border-radius: 8px;\n font: 700 10px/15px system-ui, sans-serif;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.task-tool button[aria-pressed='true'] .count { color: var(--deictic-fg); background: #09090b; }\n`;\n/** A note with a plus: a task to add. */\nconst TASK = '<path d=\"M4 5h16v11H9l-5 4zM12 8v5M9.5 10.5h5\"/>';\n\n/** What the panel keeps while it's away recording: what's typed and asked for. What's attached is the tray's. */\ninterface Kept {\n text: string;\n /** Whether a shot was asked for, or asked not to be, where either was. */\n shot?: boolean;\n html: boolean;\n /** The page as the panel left, and its elements as that page had them: for a task added where the page has moved on. */\n page: string;\n viewport: Op['viewport'];\n about: { target: Target; own: boolean; seen: Seen }[];\n}\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own: who uses it, and who uses that. Further out is the app's shell. */\nconst CHAIN = 3;\n\n/**\n * The source `el` rendered through, after its own place, nearest first: a shared component's own line is the same\n * wherever it's used, and the change is most often in what uses it, or in what uses that.\n *\n * With React in development, those are the components that wrote it, each the one whose JSX has the one before:\n * `Field (src/Field.tsx:20)`, its line the nearest element around `el` that the component wrote, or the name alone\n * for one with no element of its own around it (it wraps what it uses only in other components), which the marks\n * can't show at all. A layout component the element was only passed through isn't among them.\n *\n * Without (another framework, a production build) it's read off the marks around it, each a `file:line`: the\n * nearest element each next file wrote.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n const wrote = ownerOf(fiberOf(el));\n if (wrote !== undefined) {\n for (let owner = ownerOf(wrote); owner !== undefined && found.length < CHAIN; owner = ownerOf(owner)) {\n const name = componentOf(owner);\n let place: string | undefined;\n for (let at = parentOf(el); at !== undefined && place === undefined; at = parentOf(at)) {\n const by = ownerOf(fiberOf(at));\n // A component's fiber is one of two, by turns: an element may name either.\n if (by === undefined || (by !== owner && by !== owner.alternate)) continue;\n place = at.getAttribute('data-deictic')?.replace(/:\\d+$/, '');\n }\n if (name !== undefined) found.push(place === undefined ? name : `${name} (${place})`);\n else if (place !== undefined) found.push(place);\n }\n if (found.length > 0) return found;\n }\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target, shots: string[]): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks: (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0),\n },\n screenshots: shots,\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Op>({\n name: 'tasks',\n label: 'Task',\n // Its tool in the tool panel, after the others': what takes what they made. Picked, the next press on the page\n // opens the tab on that spot.\n setup: (context) => {\n const { tools, tray } = context;\n // The tasks there already, in the drawer.\n drawerOf(context);\n const group = element('div', { className: 'tool-group task-tool' });\n let picking = false;\n const button = toolButton(TASK, 'Task', 'T', () => {\n if (picking) return;\n picking = true;\n button.setAttribute('aria-pressed', 'true');\n void tools.pick().then((spot) => {\n picking = false;\n button.setAttribute('aria-pressed', 'false');\n if (spot !== undefined) context.open('tasks', spot.element, spot.at);\n });\n });\n button.setAttribute('aria-pressed', 'false');\n // How much is in the tray, for the task to take.\n const count = element('span', { className: 'count' });\n const counted = () => {\n const held = tray.list().length;\n count.textContent = String(held);\n count.hidden = held === 0;\n };\n tray.subscribe(counted);\n counted();\n button.append(count);\n group.append(element('style', { textContent: TOOL_STYLE }), button);\n // After the other tools that capture the page, as it takes what they made.\n tools.add(group, { section: 'capture', last: true });\n },\n // What the page before this left the tab for: a recording, where it carries on here.\n resume: ({ use }) => use('recordings')?.going(),\n // The page's tasks, where they are, while it's pointed on.\n pointing: (context) => pinsIn(context).glance(),\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint);\n // The page's tasks, pinned where they are, while the tab is open too: not for a popup a page shows in place,\n // which is in a root of its own.\n const over = panel.getRootNode() === context.root;\n const unpin = over ? pinsIn(context).glance() : undefined;\n\n const shots = context.use('screenshots');\n const recorder = context.use('recordings');\n const back = context.resumed;\n // The server half's `html` option, which takes the button away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\n const own = (): About[] => [{ target: context.target, own: true, el: context.element }];\n\n /**\n * What the page says of an element: read now, while the page has it, and as the panel left it where the page\n * has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const seenOf = (a: About): Seen | undefined => {\n const el = onPage(a);\n if (el === undefined) return a.seen;\n const chain = chainOf(el, a.target.loc.file);\n const { pointed, at } = context;\n const masked = shots?.masked(el) ?? el;\n const alike = sameAs(el);\n return {\n // What was pointed at, and the spot, are the popup's own element's.\n ...(a.own && at !== undefined ? { point: at } : {}),\n ...(a.own && pointed !== undefined ? { pointed: { path: pathTo(pointed, el), html: pointed.outerHTML.slice(0, 4000) } } : {}),\n count: alike.length,\n ...(alike.length > 1 ? { which: whichOf(el, alike, masked) } : {}),\n ...(chain.length === 0 ? {} : { chain }),\n html: masked.outerHTML.slice(0, HTML),\n };\n };\n /** The page the task is about: this one, or the one the panel left where none of its elements is on this one. */\n const wherever = (about: About[]): Pick<Kept, 'page' | 'viewport'> => {\n if (back !== undefined && about.length > 0 && !about.some((a) => onPage(a) !== undefined)) {\n const { page, viewport } = back.state as Kept;\n return { page, viewport };\n }\n return { page: location.href, viewport: { width: innerWidth, height: innerHeight } };\n };\n\n // Record: the popup goes, the page is recorded, and it comes back with what's typed and the recording attached.\n const leave = async () => {\n if (recorder === undefined) return;\n composer.problem.textContent = '';\n if (recorder.recording()) {\n composer.problem.textContent = \"A recording is going already: stop it in the tool panel, and it's attached here\";\n return;\n }\n // A take going on is kept first, as a chip, to come back to with the rest.\n await composer.stopTake();\n const { text, shot, html, about } = composer.draft();\n const kept: Kept = {\n text,\n ...(shot === undefined ? {} : { shot }),\n html,\n ...wherever(about),\n about: about.flatMap(({ target, own: mine, ...a }) => {\n const seen = seenOf({ target, own: mine, ...a });\n return seen === undefined ? [] : [{ target, own: mine, seen }];\n }),\n };\n context.away(kept, () => recorder.record());\n };\n\n const composer = composerIn(context, {\n placeholder: 'What should change here?',\n sendLabel: 'Add task',\n about: own,\n html: sendsHtml,\n ...(context.at === undefined ? {} : { at: context.at }),\n shoot: true,\n // Back from a recording on a page without the element: nothing of it to shoot or draw on here.\n here: context.element.isConnected,\n over,\n record: () => void leave(),\n changed: () => mark(),\n submit: async (gathered) => {\n const { text, about, html: withHtml, screenshots } = gathered;\n // The first element is the task's place; the rest are named beside it; with none, it's the page's.\n const [first, ...rest] = about;\n const { html, ...said } = (first === undefined ? undefined : seenOf(first)) ?? { html: undefined, count: 0 };\n const htmlOf = (of: string | undefined) => (sendsHtml && withHtml && of !== undefined ? { html: of } : {});\n const op: Op = {\n text,\n ...wherever(about),\n ...said,\n ...(first === undefined ? { detached: true } : {}),\n ...htmlOf(html),\n ...(rest.length === 0 ? {} : { also: rest.map((a) => ({ at: atOf(a.target), tag: a.target.tag, ...htmlOf(seenOf(a)?.html) })) }),\n ...attachedOf(gathered),\n };\n // Sent on its first element, which may not be the popup's.\n const on = first?.target ?? context.target;\n let model: Model;\n try {\n model = await context.apply(op, on);\n } catch {\n // The panel's status says why; what was typed and attached stays, to send again.\n return false;\n }\n // In the drawer and on its pin at once: the tab lists none.\n storeOf(context).load(true);\n announce(\n model,\n op,\n on,\n (screenshots ?? []).map((shot) => shot.url),\n );\n const added = model.tasks.at(-1);\n composer.note.textContent =\n first === undefined\n ? 'Added, about the page: it is in the drawer'\n : `Added${added === undefined ? '' : ` #${added.id}`}: it is in the drawer`;\n if (added?.dropped !== undefined) {\n // Open, to say so: the task went without something that was attached.\n composer.problem.textContent = `Sent without ${added.dropped}: it wasn't kept any more`;\n return true;\n }\n // Its pin and the drawer have it now. Once the composer has emptied (the tray, the page's marks), which it does as this answers.\n setTimeout(context.close);\n return true;\n },\n });\n panel.append(style, composer.el);\n composer.el.append(row);\n\n /** Tells the popup what leaving now would lose: the words of a new task, or a take. What's attached is the tray's, and stays. */\n const mark = () => context.unsaved(composer.pending() ? composer.send : undefined);\n /** Where a task goes, and whether it's taken up: the channel, and who watches it, or that no one does, where that's known. */\n const render = ({ channel, link, watching }: Model) => {\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n if (watching === undefined) return;\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n };\n\n // Back from recording: what was typed and asked for, and why there's no recording, where there's none.\n if (back !== undefined) {\n const kept = back.state as Kept;\n // Each element where this page has it, and as the page that had it said it where not.\n const about = kept.about.map(({ target, own: mine, seen }) => {\n const el = mine ? context.element : (document.querySelector(`[data-deictic=\"${CSS.escape(atOf(target))}\"]`) ?? undefined);\n return { target, own: mine, seen, ...(el === undefined ? {} : { el }) };\n });\n const draft: Draft = { text: kept.text, html: kept.html, about, ...(kept.shot === undefined ? {} : { shot: kept.shot }) };\n composer.restore(draft);\n if (back.problem !== undefined) composer.problem.textContent = back.problem;\n }\n\n render(context.model);\n composer.focus();\n return () => {\n unpin?.();\n composer.destroy();\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuC9B,MAAa,OAAO;;AAEpB,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAa,MAAM;AACnB,MAAM,SAAS;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,SAAS;;AAEf,MAAM,QAAQ;;AAGd,MAAM,UAAU;;AAEhB,MAAM,OAAO;;AAEb,MAAM,OAAO;;AAGb,MAAM,QAAQ;CAAC;CAAe;CAAc;AAAO;AAEnD,SAAgB,QACd,KACA,QAA2C,CAAC,GAClB;CAC1B,OAAO,OAAO,OAAO,SAAS,cAAc,GAAG,GAAG,KAAK;AACzD;AAEA,MAAa,QAAQ,EAAE,UAAkB,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI;AAExE,MAAa,SAAS,OAAe;CACnC,MAAM,IAAI,KAAK,MAAM,KAAK,GAA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AW,IAAI,MAAM,GAAG,4BACnH,qDAAqD,QAAQ;GACnE,CAAC;GACD,KAAK,OAAO,OAAO,GAAG;EACxB;EAGA,IAAI,SAAS,KAAA,GAAW;GACtB,MAAM,OAAO,KAAK;GAElB,MAAM,QAAQ,KAAK,MAAM,KAAK,EAAE,QAAQ,KAAK,MAAM,WAAW;IAC5D,MAAM,KAAK,OAAO,QAAQ,UAAW,SAAS,cAAc,kBAAkB,IAAI,OAAO,KAAK,MAAM,CAAC,EAAE,GAAG,KAAK,KAAA;IAC/G,OAAO;KAAE;KAAQ,KAAK;KAAM;KAAM,GAAI,OAAO,KAAA,IAAY,CAAC,IAAI,EAAE,GAAG;IAAG;GACxE,CAAC;GACD,MAAM,QAAe;IAAE,MAAM,KAAK;IAAM,MAAM,KAAK;IAAM;IAAO,GAAI,KAAK,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK;GAAG;GACxH,SAAS,QAAQ,KAAK;GACtB,IAAI,KAAK,YAAY,KAAA,GAAW,SAAS,QAAQ,cAAc,KAAK;EACtE;EAEA,OAAO,QAAQ,KAAK;EACpB,SAAS,MAAM;EACf,aAAa;GACX,QAAQ;GACR,SAAS,QAAQ;EACnB;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["made","STYLE","made","STYLE"],"sources":["../../src/plugins/tasks/composer.ts","../../src/plugins/tasks/store.ts","../../src/plugins/tasks/which.ts","../../src/plugins/tasks/drawer.ts","../../src/plugins/tasks/pins.ts","../../src/plugins/tasks/client.ts"],"sourcesContent":["/**\n * The composer: a field as a chat has, shared by the Task tab (a new task) and a task's thread in the drawer (a\n * reply). What's attached is chips over the words, and under them the buttons that attach, each an icon named by its\n * tooltip, and the arrow that sends. Enter sends, and Shift+Enter starts a new line.\n *\n * Two buttons are on or off. With the screenshots plugin, a shot of the page goes as it's sent, the elements\n * outlined in it (or the spot circled): nothing else says which of two rows alike was meant. And, for a task, the\n * element's HTML as it rendered, as a file. The rest make something: Draw takes a shot and opens it to draw on, in the\n * annotations plugin's editor; Record is the caller's (the Task tab leaves the popup to record the page); Voice\n * records the mic here, its time and waveform beside it.\n *\n * A task's elements are chips too: the one the popup is on to begin with, and any other the element button's next\n * press on the page picks. A reply has none.\n *\n * A picture pasted in, or dropped on it, is a screenshot of its own, in the tray, to draw on as one drawn here is.\n *\n * What they make, and what the tool panel's tools made since (the tray), is this one's to attach. Each is a chip,\n * which opens it; removing one takes it out of the tray. Once it's sent, they're gone from the tray, and the page's\n * marks with them.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { place, targetOf, toolButton } from '#src/client/dom.ts';\nimport { liveWaveform } from '#src/client/waveform.ts';\nimport type { ClientContext, LightboxItem, Point, Target } from '#src/index.ts';\n\n// For `use()`'s types: the plugins may not be loaded, and nothing of them runs here.\nimport type { Annotation, Annotations, Picture } from '#src/plugins/annotations/index.ts';\nimport type { Recording } from '#src/plugins/recordings/index.ts';\nimport type { Capture, Shot } from '#src/plugins/screenshots/index.ts';\nimport type { Clip, Take } from '#src/plugins/voice/index.ts';\n\nimport type { Marks, Op } from './index.ts';\n\n/** Scoped to the composer: the drawer and the Task tab share the overlay's root, and a field of theirs is their own. */\nexport const COMPOSER_STYLE = `\n/* One box for what's attached, the words and the buttons, lit as a field is while it's typed in. */\n.composer { border: 1px solid var(--deictic-line); border-radius: 12px; background: rgb(0 0 0 / 0.35); }\n.composer:focus-within, .composer.dropping { border-color: var(--deictic-accent); box-shadow: 0 0 0 1px var(--deictic-accent); }\n.composer textarea { display: block; box-sizing: border-box; width: 100%; min-height: 0; padding: 10px 12px 4px; border: 0; resize: none; background: none; font: 13px/1.45 system-ui, sans-serif; }\n.composer textarea:focus { outline: none; }\n.composer .chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; padding: 8px 8px 0; font-size: 12px; }\n.composer .attach { display: flex; align-items: center; gap: 2px; padding: 4px 6px 6px; }\n.composer .attach button.icon { width: 28px; height: 28px; border-radius: 8px; }\n.composer .attach button.icon svg { width: 16px; height: 16px; }\n.composer .attach button[aria-pressed='true'] { color: var(--deictic-accent); background: rgb(18 179 88 / 0.14); }\n.composer .attach .gap { width: 1px; height: 16px; margin: 0 4px; background: var(--deictic-line); }\n.composer .attach .mic[aria-pressed='true'], .composer .attach .mic[aria-pressed='true']:hover { color: #fff; background: #ef4444; }\n.composer .hearing { display: inline-flex; align-items: center; gap: 6px; padding-left: 4px; font: 12px ui-monospace, monospace; color: var(--deictic-muted); }\n.composer .hearing canvas { width: 56px; height: 18px; }\n.composer .doing { margin-left: auto; padding-right: 6px; font-size: 12px; color: var(--deictic-muted); }\n.composer .attach button.send { border-radius: 50%; color: var(--deictic-on-accent); }\n.composer .attach button.send:hover:not(:disabled) { color: var(--deictic-on-accent); background: var(--deictic-accent); filter: brightness(1.1); }\n.composer [hidden] { display: none; }\n/* Every chip one height, and a picture's thumbnail one size whatever its shape or whether it has loaded yet: nothing\n moves as one is attached, or as its picture comes. */\n.chip { box-sizing: border-box; display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--deictic-line); border-radius: 6px; }\n.chip button { height: 100%; border: 0; }\n.chip .open { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 2px; }\n.chip img { display: block; width: 36px; height: 24px; object-fit: cover; border-radius: 4px; background: var(--deictic-line); }\n.chip .play { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; background: var(--deictic-line); }\n.chip .play svg { width: 12px; height: 12px; }\n.chip .play.drawn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }\n.chip .remove { padding: 0 6px; color: var(--deictic-muted); }\n.chip .remove:hover { color: var(--deictic-fg); }\n/* An element the task is about: named as the caption names it, in the overlay's own green. */\n.chip.about .open { padding: 0 4px 0 8px; font: 12px ui-monospace, monospace; color: var(--deictic-accent); }\n.chip.about .open span { color: var(--deictic-muted); }\n.compose .shot-problem { margin-top: 4px; font-size: 12px; color: var(--deictic-problem); }\n.compose .shot-problem:empty { display: none; }\n.compose .shot-note { margin-top: 4px; font-size: 12px; color: var(--deictic-muted); }\n.compose .shot-note:empty { display: none; }\n`;\n\nexport const PLAY = '<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M7 4v16l13-8z\" fill=\"currentColor\"/></svg>';\n/** The composer's buttons, each its strokes on a 24-pixel grid. */\nconst CAMERA = '<path d=\"M4 8h3l2-3h6l2 3h3v11H4z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>';\nconst CODE = '<path d=\"M8 7l-5 5 5 5M16 7l5 5-5 5M13.5 5l-3 14\"/>';\nexport const PEN = '<path d=\"M4 20l1-4L16 5a2.1 2.1 0 0 1 3 3L8 19z\"/>';\nconst RECORD = '<circle cx=\"12\" cy=\"12\" r=\"8\"/><circle cx=\"12\" cy=\"12\" r=\"3\" fill=\"currentColor\"/>';\nconst MIC = '<rect x=\"9\" y=\"3\" width=\"6\" height=\"11\" rx=\"3\"/><path d=\"M5 11a7 7 0 0 0 14 0M12 18v3\"/>';\nconst SEND = '<path d=\"M12 19V5M6 11l6-6 6 6\"/>';\nconst TARGET = '<circle cx=\"12\" cy=\"12\" r=\"7\"/><path d=\"M12 2v4M12 18v4M2 12h4M18 12h4\"/>';\n/** How tall the field grows with what's typed, in pixels, before it scrolls. */\nconst GROWN = 200;\n\n/** The overlay's own green, as its ring on the element while the popup is open. */\nconst OUTLINE = '#12b358';\n/** CSS pixels between the element and its outline, so the dashes are on nothing of the element's. */\nconst ROOM = 3;\n/** How far around a spot its circle is drawn in a shot, in CSS pixels. */\nconst SPOT = 16;\n\n/** The tray's kinds a composer attaches. */\nconst KINDS = ['screenshots', 'recordings', 'voice'];\n\nexport function element<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n props: Partial<HTMLElementTagNameMap[K]> = {},\n): HTMLElementTagNameMap[K] {\n return Object.assign(document.createElement(tag), props);\n}\n\nexport const atOf = ({ loc }: Target) => `${loc.file}:${loc.line}:${loc.column}`;\n\nexport const clock = (ms: number) => {\n const s = Math.round(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;\n};\n\nexport const messageOf = (e: unknown) => (e instanceof Error ? e.message : String(e));\n\n/** Marks as a task tells of them: how many, and what the notes say. */\nfunction marksOf(list: readonly Annotation[]): Marks {\n return { count: list.length, notes: list.flatMap(({ shape }) => (shape.kind === 'note' ? [shape.text] : [])) };\n}\n\n/** The page's annotations, where there are any. */\nfunction annotationsOf(marks: Annotations | undefined): Marks | undefined {\n const list = marks?.list() ?? [];\n return list.length === 0 ? undefined : marksOf(list);\n}\n\n/**\n * A shot as the tray has it: the window's, from the tool panel, or one that was drawn on here. That one's PNG has the\n * marks in it, and it keeps what it was made of, to draw on it again: the shot as taken, the marks, and the element it\n * was taken of (`file:line:column`), as only a task about that element can say where the element is in it.\n */\ntype Pictured = Shot & { drawn?: { shot: Shot; marks: Annotation[]; about: string } };\n\n/** A shot as it's attached, and where it is, for the page to hear of; what's sent goes without that. */\nexport type Sent = NonNullable<Op['screenshots']>[number] & { url: string };\n\n/** What a task says of an element that only the page with it on knows. */\nexport interface Seen extends Pick<Op, 'point' | 'pointed' | 'count' | 'which' | 'chain'> {\n /** The element's HTML, as it would be attached. */\n html: string;\n /** What React's DevTools would show of it, `react.json`, where the react plugin is loaded and React wrote it. */\n react?: string;\n}\n\n/**\n * An element the task is about, a chip in the composer: its place, the element where this page has it, and what\n * the page said of it as the panel left for a recording, for a page that no longer has it. `own` is the popup's.\n */\nexport interface About {\n target: Target;\n own: boolean;\n el?: Element;\n seen?: Seen;\n}\n\nexport const onPage = (a: About | undefined): Element | undefined => (a?.el?.isConnected === true ? a.el : undefined);\n\n/** What's sent: the words, and all that's attached, as the composer has it. */\nexport interface Gathered {\n text: string;\n /** The elements attached, in order: none for a reply, or for a task about the page. */\n about: About[];\n /** Whether the elements' HTML goes too. */\n html: boolean;\n screenshots?: Sent[];\n recordings: Recording[];\n voices: Clip[];\n /** What's drawn on the page, where something is. */\n annotations?: Marks;\n}\n\n/** What's attached, as a task's op or a reply sends it: each shot, each recording with where it replays, each voice note, the marks. */\nexport function attachedOf({\n screenshots,\n recordings,\n voices,\n annotations,\n}: Gathered): Pick<Op, 'screenshots' | 'recordings' | 'voice' | 'annotations'> {\n return {\n ...(screenshots === undefined ? {} : { screenshots: screenshots.map(({ url: _, ...shot }) => shot) }),\n ...(recordings.length === 0\n ? {}\n : {\n recordings: recordings.map(({ id, duration, url, voice: clips }) => ({\n id,\n duration,\n replay: new URL(url, location.href).href,\n ...(clips === undefined ? {} : { voice: clips.map((c) => c.id) }),\n })),\n }),\n ...(voices.length === 0 ? {} : { voice: voices.map(({ id, duration }) => ({ id, duration })) }),\n ...(annotations === undefined ? {} : { annotations }),\n };\n}\n\n/** What's typed and asked for, to keep while the composer is away and give back to one made again. */\nexport interface Draft {\n text: string;\n /** Whether a shot was asked for, or asked not to be, where either was. */\n shot?: boolean;\n html: boolean;\n about: About[];\n}\n\nexport interface ComposerOptions {\n placeholder: string;\n /** What the arrow does, as its tooltip says: `Add task`, `Reply`. */\n sendLabel: string;\n /**\n * The elements attached to begin with, and again once it's sent: a task's. With them come their chips, the element\n * button and HTML snapshot; a reply has none of them.\n */\n about?: () => About[];\n /** Whether the HTML snapshot button is there, for a task with elements: the tasks plugin's `html` option. */\n html?: boolean;\n /** The spot in the popup's own element, circled in a shot of it. */\n at?: Point;\n /** Whether a shot is taken as it's sent, while nothing else is attached and none was asked for or not: a task's. */\n shoot?: boolean;\n /**\n * The popup's own element as the press that opened it froze the page (`screenshots.frozen`): what a shot of it is,\n * rather than the page as it is when it's sent, by which time a tooltip or a menu may have closed.\n */\n frozen?: Promise<Shot>;\n /** Whether this page has what's shot and drawn on: not for a task back from a recording on a page without it. */\n here?: boolean;\n /** Whether it's over the page, in the overlay's root: a press on the page picks an element, and attached ones are outlined. */\n over: boolean;\n /** What Record does, where it's there at all: the Task tab leaves the popup to record the page. */\n record?: () => void;\n /** Sends it; answers whether it's taken, which empties the composer. A refusal thrown is said under it. */\n submit: (gathered: Gathered) => Promise<boolean>;\n /** Hears a change to what leaving would lose: what's typed, or a take going. */\n changed?: () => void;\n}\n\nexport interface Composer {\n /** The composer, and under it what went wrong and what was done. */\n el: HTMLElement;\n /** The arrow: what an unsaved change keeps a popup open with. */\n send: HTMLButtonElement;\n problem: HTMLElement;\n note: HTMLElement;\n /** Whether leaving now loses something: words typed, or a take going. */\n pending: () => boolean;\n draft: () => Draft;\n restore: (draft: Partial<Draft>) => void;\n /** Ends a take going, keeping its clip in the tray. */\n stopTake: () => Promise<void>;\n focus: () => void;\n /** Lets it go: a take going is kept, in the tray. */\n destroy: () => void;\n}\n\n/**\n * A shot's PNG with what the task is about outlined in it: dashes around each box, with nothing between them, and a\n * circle around `spot`. The shot may have more pixels than its size in CSS ones, which the boxes are in.\n */\nasync function outlined(png: string, size: Shot['size'], boxes: Shot['box'][], spot?: Point): Promise<Blob> {\n const image = new Image();\n image.src = png;\n await image.decode();\n const canvas = element('canvas', { width: image.naturalWidth, height: image.naturalHeight });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const k = image.naturalWidth / size.width;\n ctx.lineWidth = 2 * k;\n ctx.strokeStyle = OUTLINE;\n ctx.setLineDash([6 * k, 4 * k]);\n for (const box of boxes) ctx.strokeRect((box.x - ROOM) * k, (box.y - ROOM) * k, (box.width + 2 * ROOM) * k, (box.height + 2 * ROOM) * k);\n if (spot !== undefined) {\n ctx.beginPath();\n ctx.arc(spot.x * k, spot.y * k, SPOT * k, 0, 2 * Math.PI);\n ctx.stroke();\n }\n return await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the screenshot drew nothing')) : done(blob)), 'image/png'),\n );\n}\n\n/** A picture as a PNG, and its size: the screenshots plugin keeps PNGs, and a pasted one may be a JPEG or a GIF. */\nasync function pngOf(picture: Blob): Promise<{ png: Blob; width: number; height: number }> {\n const url = URL.createObjectURL(picture);\n try {\n const image = new Image();\n image.src = url;\n await image.decode();\n const { naturalWidth: width, naturalHeight: height } = image;\n if (picture.type === 'image/png') return { png: picture, width, height };\n const canvas = element('canvas', { width, height });\n const ctx = canvas.getContext('2d');\n if (ctx === null) throw new Error(\"tasks: this browser won't draw to a canvas\");\n ctx.drawImage(image, 0, 0);\n const png = await new Promise<Blob>((done, fail) =>\n canvas.toBlob((blob) => (blob === null ? fail(new Error('tasks: the picture drew nothing')) : done(blob)), 'image/png'),\n );\n return { png, width, height };\n } finally {\n URL.revokeObjectURL(url);\n }\n}\n\nexport function composerIn(context: ClientContext, options: ComposerOptions): Composer {\n const shots = context.use('screenshots');\n const notes = context.use('annotations');\n const recorder = context.use('recordings');\n const voice = context.use('voice');\n const { tray } = context;\n const here = options.here ?? true;\n const withElements = options.about !== undefined;\n\n // What it's about, in the order attached.\n let about: About[] = options.about?.() ?? [];\n\n // A shot as it goes: said (on, or off), or else, where it's wanted at all, only while nothing else is attached.\n let wanted: boolean | undefined;\n const shooting = () => shots !== undefined && here && (wanted ?? (options.shoot === true && attachedCount() === 0));\n let withHtml = true;\n\n const text = element('textarea', { placeholder: options.placeholder, rows: 1 });\n const chipsEl = element('div', { className: 'chips' });\n /** A shot of `of`: as the press froze it, where it's the popup's own element still first, else as the page is now. */\n const shotOf = (s: Capture, of: Element) => {\n const frozen = about[0]?.own === true && onPage(about[0]) === of ? options.frozen : undefined;\n return frozen === undefined ? s.capture(of) : frozen.catch(() => s.capture(of));\n };\n const camera = toolButton(\n CAMERA,\n options.frozen === undefined ? `Attach a screenshot, taken as it's sent` : 'Attach a screenshot of the page as it was when you pressed',\n undefined,\n () => {\n wanted = !shooting();\n showChips();\n },\n );\n camera.hidden = shots === undefined || !here;\n const code = toolButton(CODE, 'Attach an HTML snapshot: the element as the page has it now, as a file', undefined, () => {\n withHtml = !withHtml;\n showChips();\n });\n code.hidden = !withElements || options.html === false;\n const picker = toolButton(TARGET, 'Attach another element: press it on the page', undefined, () => void pick());\n picker.setAttribute('aria-pressed', 'false');\n // Not where there's no page under it to press on.\n picker.hidden = !withElements || !options.over;\n const pen = toolButton(PEN, 'Draw on a screenshot', undefined, () => void draw());\n pen.hidden = shots === undefined || notes === undefined || !here;\n const record = toolButton(RECORD, 'Record the page', undefined, () => {\n if (!sending) options.record?.();\n });\n record.hidden = recorder === undefined || options.record === undefined;\n const mic = toolButton(MIC, 'Record your voice', undefined, () => void (take === undefined ? speakOn() : speakOff()));\n mic.classList.add('mic');\n mic.hidden = voice === undefined;\n // Between what's on or off and what makes something, where there's some of both.\n const gap = element('span', {\n className: 'gap',\n hidden: (camera.hidden && code.hidden) || (picker.hidden && pen.hidden && record.hidden && mic.hidden),\n });\n // The time and the mic's live waveform while a take goes, so it's plain it hears.\n const time = element('span');\n const wave = element('canvas');\n const hearing = element('span', { className: 'hearing', hidden: true });\n hearing.append(time, wave);\n // What the arrow waits on, while it does: a shot being taken.\n const doing = element('span', { className: 'doing' });\n const send = toolButton(SEND, options.sendLabel, 'Enter', () => void sendIt());\n send.classList.add('send', 'primary');\n const attach = element('div', { className: 'attach' });\n attach.append(camera, code, gap, picker, pen, record, mic, hearing, doing, send);\n const box = element('div', { className: 'composer' });\n box.append(chipsEl, text, attach);\n const problem = element('div', { className: 'shot-problem' });\n const note = element('div', { className: 'shot-note' });\n const el = element('div', { className: 'compose' });\n el.append(box, problem, note);\n // As tall as what's typed, to a point.\n const grow = () => {\n text.style.height = 'auto';\n text.style.height = `${Math.min(text.scrollHeight, GROWN)}px`;\n };\n\n // What the tool panel's tools made and nothing has taken: this one's to attach, as each plugin said it.\n const inTray = <T>(plugin: string) => tray.list(plugin).map((item) => item.value as T);\n const taken = () => ({\n pictures: inTray<Pictured>('screenshots'),\n recordings: inTray<Recording>('recordings'),\n voices: inTray<Clip>('voice'),\n });\n const attachedCount = () => KINDS.reduce((n, plugin) => n + tray.list(plugin).length, 0);\n // It goes with words, or with something attached that says it; not while it's going.\n let sending = false;\n let take: Take | undefined;\n const able = () => (send.disabled = sending || (text.value.trim() === '' && attachedCount() === 0 && take === undefined));\n const changed = () => options.changed?.();\n\n const chip = (content: (string | Node)[], title: string, at: number, remove: string, drop: () => void) => {\n const opener = element('button', { type: 'button', className: 'open', title });\n opener.append(...content);\n // Every attachment in one lightbox, opened at this one, growing out of its chip.\n opener.addEventListener('click', () => context.lightbox(viewed(), { at, from: it }));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: remove });\n remover.addEventListener('click', drop);\n const it = element('span', { className: 'chip' });\n it.append(opener, remover);\n return it;\n };\n const numbered = (name: string, i: number, of: number) => (of === 1 ? name : `${name} ${i + 1}`);\n /** What's attached, as the lightbox shows it, in the chips' order. */\n const viewed = (): LightboxItem[] => {\n const { pictures, recordings, voices } = taken();\n return [\n ...pictures.map((s, i) => ({\n kind: 'image' as const,\n url: s.url,\n title: numbered('Screenshot', i, pictures.length),\n ...(s.drawn === undefined\n ? {}\n : {\n actions: [\n s.drawn.marks.length === 0\n ? { label: 'Draw on it', title: 'Draw boxes, arrows and notes on it', run: () => void draw(s) }\n : { label: 'Change marks', title: 'Draw on it again', run: () => void draw(s) },\n ],\n }),\n })),\n ...recordings.map((r, i) => ({\n kind: 'page' as const,\n // The replay filling the frame, without a header of its own: the lightbox names it.\n url: `${r.url}${r.url.includes('?') ? '&' : '?'}embed`,\n title: `${numbered('Recording', i, recordings.length)} · ${clock(r.duration)}`,\n actions: [\n { label: 'New tab', title: 'Play it back in a tab of its own', run: () => void window.open(r.url, '_blank', 'noopener') },\n ],\n })),\n ...voices.map((v, i) => ({\n kind: 'audio' as const,\n url: v.url,\n title: `${numbered('Voice', i, voices.length)} · ${clock(v.duration)}`,\n })),\n ];\n };\n /** Takes one out of the tray. A shot that was the last thing attached leaves none asked for: taking it out said so. */\n const drop = (plugin: string, id: string) => () => {\n tray.remove(plugin, id);\n if (plugin === 'screenshots' && attachedCount() === 0) wanted = false;\n showChips();\n };\n /** An element the task is about: named as the caption names it, with its place for a tip. Its chip shows it, and its × leaves it out. */\n const aboutChip = (a: About) => {\n const it = onPage(a);\n const { file, line } = a.target.loc;\n const { component, sole, tag } = it === undefined ? { component: undefined, sole: false, tag: a.target.tag } : named(it);\n const opener = element('button', { type: 'button', className: 'open', title: `${file}:${line}` });\n opener.append(`<${component ?? tag}>`, ...(component === undefined || sole ? [] : [element('span', { textContent: ` <${tag}>` })]));\n opener.addEventListener('click', () => it?.scrollIntoView({ block: 'nearest', behavior: 'smooth' }));\n const name = it === undefined ? `<${tag}>` : tell(named(it));\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: `Leave ${name} out` });\n remover.addEventListener('click', () => {\n about = about.filter((x) => x !== a);\n showChips();\n });\n const chipEl = element('span', { className: 'chip about' });\n chipEl.append(opener, remover);\n return chipEl;\n };\n /** What's drawn on the page, which goes with it: its chip draws more, and its × clears it. */\n const marksChip = (marked: number) => {\n const opener = element('button', { type: 'button', className: 'open', title: 'Draw more on the page' });\n const icon = element('span', { className: 'play drawn', innerHTML: `<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">${PEN}</svg>` });\n opener.append(icon, `${marked} mark${marked === 1 ? '' : 's'}`);\n opener.addEventListener('click', () => notes?.draw());\n const remover = element('button', { type: 'button', className: 'remove', textContent: '×', title: 'Clear the marks' });\n remover.addEventListener('click', () => notes?.clear());\n const it = element('span', { className: 'chip' });\n it.append(opener, remover);\n return it;\n };\n const showChips = () => {\n const { pictures, recordings, voices } = taken();\n const marked = notes?.list().length ?? 0;\n camera.setAttribute('aria-pressed', String(shooting()));\n code.setAttribute('aria-pressed', String(withHtml));\n chipsEl.hidden = about.length === 0 && attachedCount() === 0 && marked === 0;\n chipsEl.replaceChildren(\n ...about.map(aboutChip),\n ...pictures.map((s, i) => {\n const name = numbered('Screenshot', i, pictures.length);\n const thumb = element('img', { src: s.url, alt: '' });\n return chip([thumb, name], `Open ${name.toLowerCase()}`, i, `Remove ${name.toLowerCase()}`, drop('screenshots', s.id));\n }),\n ...recordings.map((r, i) => {\n const name = numbered('Recording', i, recordings.length);\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${name} ${clock(r.duration)}${r.voice === undefined ? '' : ' · voice'}`],\n `Play ${name.toLowerCase()} back`,\n pictures.length + i,\n `Remove ${name.toLowerCase()}`,\n drop('recordings', r.id),\n );\n }),\n ...voices.map((v, i) => {\n const name = numbered('Voice', i, voices.length);\n const play = element('span', { className: 'play', innerHTML: PLAY });\n return chip(\n [play, `${name} ${clock(v.duration)}`],\n `Play ${name.toLowerCase()}`,\n pictures.length + recordings.length + i,\n `Remove ${name.toLowerCase()}`,\n drop('voice', v.id),\n );\n }),\n ...(marked === 0 ? [] : [marksChip(marked)]),\n );\n able();\n };\n // As the tray changes: a shot taken from the panel while this is open is a chip at once. The marks too.\n const unsubscribe = [tray.subscribe(showChips), notes?.subscribe(showChips)];\n\n // The element button: the next press on the page attaches the marked element under it.\n let picking = false;\n const pick = async () => {\n if (picking) return;\n picking = true;\n picker.setAttribute('aria-pressed', 'true');\n const spot = await context.tools.pick();\n picking = false;\n picker.setAttribute('aria-pressed', 'false');\n const target = spot === undefined ? undefined : targetOf(spot.element);\n if (spot === undefined || target === undefined) return;\n // Only what the press was on: the element nearest to a press on none isn't what was meant.\n const r = spot.element.getBoundingClientRect();\n if (spot.at.x < 0 || spot.at.y < 0 || spot.at.x > r.width || spot.at.y > r.height) return;\n if (about.some((a) => a.el === spot.element)) return;\n about = [...about, { target, own: false, el: spot.element }];\n showChips();\n };\n // Each attached element on the page, outlined where it is, but the popup's own: that one has the light.\n const outlines = withElements && options.over ? element('div') : undefined;\n if (outlines !== undefined) context.root.append(outlines);\n let following = 0;\n const follow = () => {\n following = requestAnimationFrame(follow);\n if (outlines === undefined) return;\n const others = about.flatMap((a) => (a.own || onPage(a) === undefined ? [] : [onPage(a)!]));\n while (outlines.childElementCount > others.length) outlines.lastElementChild!.remove();\n while (outlines.childElementCount < others.length) outlines.append(element('div', { className: 'task-about' }));\n for (const [i, it] of others.entries()) place(outlines.children[i] as HTMLElement, it.getBoundingClientRect());\n };\n if (outlines !== undefined) follow();\n\n // Draw: a shot is taken and opened to draw on, or a chip's opened again. Saved, the PNG of both is kept as a\n // shot of its own, in the tray, so it's a chip as any other is.\n const firstAt = () => (about[0] === undefined ? '' : atOf(about[0].target));\n const aborts = new AbortController();\n let drawing = false;\n const draw = async (old?: Pictured) => {\n if (shots === undefined || notes === undefined || drawing || sending) return;\n drawing = true;\n problem.textContent = '';\n try {\n if (old === undefined) doing.textContent = 'Capturing…';\n const shot = old?.drawn?.shot ?? (await shotOf(shots, onPage(about[0]) ?? document.documentElement));\n doing.textContent = '';\n const picture: Picture = { url: shot.url, ...shot.size };\n const marks = await notes.edit(picture, old?.drawn?.marks ?? [], { signal: aborts.signal });\n if (marks === undefined) return;\n doing.textContent = 'Saving…';\n const kept = await shots.upload(await notes.flatten(picture, marks), shot);\n if (old !== undefined) tray.remove('screenshots', old.id);\n const pictured: Pictured = { ...kept, drawn: { shot, marks, about: old?.drawn?.about ?? firstAt() } };\n tray.add('screenshots', kept.id, pictured);\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n doing.textContent = '';\n drawing = false;\n // Back to the words: the editor gave the focus to the button that opened it.\n text.focus();\n }\n };\n\n /**\n * Pictures pasted in or dropped on it: each kept as a shot of its own (a PNG, as the screenshots plugin keeps them)\n * and put in the tray, so it's a chip as any other is, to draw on. Anything else is said, not attached.\n */\n const paste = async (files: File[]) => {\n const pictures = files.filter((file) => file.type.startsWith('image/'));\n const others = files.length - pictures.length;\n problem.textContent = '';\n if (pictures.length > 0 && shots === undefined)\n problem.textContent = 'Attaching a picture needs the screenshots plugin: add it to deictic';\n else if (others > 0)\n problem.textContent = `Only pictures can be attached here: ${others === 1 ? 'that file was' : `${others} files were`} left out`;\n if (shots === undefined || pictures.length === 0) return;\n doing.textContent = 'Attaching…';\n try {\n for (const picture of pictures) {\n const { png, width, height } = await pngOf(picture);\n const size = { width, height };\n const kept = await shots.upload(png, { box: { x: 0, y: 0, ...size }, size });\n // Drawn on with no marks yet: its lightbox offers to draw on it, as one drawn here does.\n const pictured: Pictured = { ...kept, drawn: { shot: kept, marks: [], about: '' } };\n tray.add('screenshots', kept.id, pictured);\n }\n } catch (e) {\n problem.textContent = messageOf(e);\n } finally {\n doing.textContent = '';\n }\n };\n box.addEventListener('paste', (e) => {\n const files = [...(e.clipboardData?.files ?? [])];\n if (files.length === 0) return;\n // A picture isn't text: nothing goes in the field for it.\n e.preventDefault();\n void paste(files);\n });\n box.addEventListener('dragover', (e) => {\n if (!e.dataTransfer?.types.includes('Files')) return;\n e.preventDefault();\n box.classList.add('dropping');\n });\n box.addEventListener('dragleave', () => box.classList.remove('dropping'));\n box.addEventListener('drop', (e) => {\n box.classList.remove('dropping');\n const files = [...(e.dataTransfer?.files ?? [])];\n if (files.length === 0) return;\n e.preventDefault();\n void paste(files);\n });\n\n // The mic, here: its button starts a take, and stops it, and it's a chip.\n let ticking: ReturnType<typeof setInterval> | undefined;\n let stopWave: (() => void) | undefined;\n const speakOn = async () => {\n if (voice === undefined) return;\n problem.textContent = '';\n mic.disabled = true;\n try {\n take = await voice.start();\n } catch (e) {\n problem.textContent = messageOf(e);\n return;\n } finally {\n mic.disabled = false;\n }\n const { started, stream } = take;\n stopWave = liveWaveform(wave, stream, { played: '#ef4444', rest: '#52525b' });\n const tick = () => (time.textContent = clock(Date.now() - started));\n tick();\n ticking = setInterval(tick, 250);\n hearing.hidden = false;\n mic.setAttribute('aria-pressed', 'true');\n mic.title = 'Stop, and attach it';\n able();\n changed();\n };\n const speakOff = async () => {\n const ending = take;\n if (ending === undefined) return;\n take = undefined;\n clearInterval(ticking);\n stopWave?.();\n stopWave = undefined;\n hearing.hidden = true;\n mic.setAttribute('aria-pressed', 'false');\n mic.title = 'Record your voice';\n try {\n const clip = await ending.stop();\n tray.add('voice', clip.id, clip);\n } catch (e) {\n problem.textContent = messageOf(e);\n }\n able();\n changed();\n };\n\n /**\n * The shots to attach: one taken now, where that's on, and those in the tray, each the window as it was taken.\n * Only the first has the elements outlined in it, and its spot circled (or is as it was taken, where that can't be\n * drawn), so it's first: nothing else in a shot says what it's about.\n */\n const screenshotsOf = async (): Promise<Sent[] | undefined> => {\n if (shots === undefined) return undefined;\n // One drawn on says its notes, and where the element is in it, where it's the first one it was taken of.\n const kept: Sent[] = taken().pictures.map(({ id, url, drawn }) => ({\n id,\n url,\n ...(drawn !== undefined && drawn.about !== '' && drawn.about === firstAt() ? { box: drawn.shot.box } : {}),\n ...(drawn === undefined || drawn.marks.length === 0 ? {} : { marks: marksOf(drawn.marks) }),\n }));\n if (!shooting()) return kept.length === 0 ? undefined : kept;\n doing.textContent = 'Capturing…';\n // Of the first element, which the shot then says the place of; of the page, with none on it.\n const first = onPage(about[0]);\n const of = first ?? document.documentElement;\n const now = await shotOf(shots, of);\n const where = first === undefined ? {} : { box: now.box };\n // The others as the page has them, moved by as much as the shot has the first off where the page has it.\n const live = of.getBoundingClientRect();\n const boxes = about.flatMap((a) => {\n const it = onPage(a);\n if (it === undefined) return [];\n if (it === first) return a.own && options.at !== undefined ? [] : [now.box];\n const r = it.getBoundingClientRect();\n return [{ x: r.left + now.box.x - live.left, y: r.top + now.box.y - live.top, width: r.width, height: r.height }];\n });\n const spot = first !== undefined && about[0]?.own === true ? options.at : undefined;\n const circled = spot === undefined ? undefined : { x: now.box.x + spot.x, y: now.box.y + spot.y };\n if (boxes.length === 0 && circled === undefined) return [{ id: now.id, url: now.url }, ...kept];\n try {\n const { id, url } = await shots.upload(await outlined(now.url, now.size, boxes, circled), now);\n return [{ id, url, ...where, outlined: true }, ...kept];\n } catch {\n return [{ id: now.id, url: now.url, ...where }, ...kept];\n }\n };\n\n const sendIt = async () => {\n if (sending) return;\n sending = true;\n // A take still going is kept first: it may be all there is to send.\n await speakOff();\n if (text.value.trim() === '' && attachedCount() === 0) {\n sending = false;\n able();\n return;\n }\n able();\n problem.textContent = '';\n note.textContent = '';\n let screenshots: Sent[] | undefined;\n try {\n screenshots = await screenshotsOf();\n } catch (e) {\n // Said under the field, which stays as it is: turn the screenshot off to send without.\n problem.textContent = messageOf(e);\n doing.textContent = '';\n sending = false;\n able();\n return;\n }\n doing.textContent = '';\n const { recordings, voices } = taken();\n const annotations = annotationsOf(notes);\n let done = false;\n try {\n done = await options.submit({\n text: text.value,\n about,\n html: withHtml,\n ...(screenshots === undefined ? {} : { screenshots }),\n recordings,\n voices,\n ...(annotations === undefined ? {} : { annotations }),\n });\n } catch (e) {\n problem.textContent = messageOf(e);\n }\n if (done) {\n text.value = '';\n grow();\n // It has them now: what was made for it, and what was drawn on the page for it.\n for (const plugin of KINDS) tray.remove(plugin);\n notes?.clear();\n wanted = undefined;\n about = options.about?.() ?? [];\n showChips();\n changed();\n }\n sending = false;\n able();\n };\n\n text.addEventListener('input', () => {\n grow();\n able();\n changed();\n });\n // Enter sends, as a chat's field does; Shift+Enter is a new line. Not while an IME is composing a word.\n text.addEventListener('keydown', (e) => {\n if (e.key !== 'Enter' || e.shiftKey || e.isComposing) return;\n e.preventDefault();\n void sendIt();\n });\n showChips();\n requestAnimationFrame(grow);\n\n return {\n el,\n send,\n problem,\n note,\n pending: () => text.value.trim() !== '' || take !== undefined,\n draft: () => ({ text: text.value, ...(wanted === undefined ? {} : { shot: wanted }), html: withHtml, about }),\n restore: (draft) => {\n if (draft.text !== undefined) text.value = draft.text;\n if (draft.shot !== undefined) wanted = draft.shot;\n if (draft.html !== undefined) withHtml = draft.html;\n if (draft.about !== undefined) about = draft.about;\n showChips();\n grow();\n },\n stopTake: speakOff,\n focus: () => text.focus(),\n destroy: () => {\n for (const stop of unsubscribe) stop?.();\n aborts.abort();\n cancelAnimationFrame(following);\n outlines?.remove();\n // A take it closes on is kept, in the tray: the next one's.\n void speakOff();\n },\n };\n}\n","/**\n * The channel's tasks as the page has them: read once for the pins and the drawer both, and again when one of\n * them changes a task. And which of them have something unread: a reply since the task was last opened here, or an\n * end no one has looked at. What's been read is the browser's to keep, as a board keeps it for no one.\n */\nimport type { ClientContext } from '#src/index.ts';\n\nimport type { Listed } from './index.ts';\n\n/** How long the tasks read last are shown as they are, in ms: the keys are held again and again, and each is no reason to ask the board. */\nconst FRESH = 4000;\n/** Where what's been read is kept: each task's ID, and how its thread stood when it was last opened. */\nconst SEEN = 'deictic:tasks:seen';\n/** Where the finished tasks put away are kept: each one's ID, and how its thread stood then. */\nconst ARCHIVED = 'deictic:tasks:archived';\n/** The states of a finished task, as a board names them: nothing more happens to it. */\nexport const OVER = new Set(['completed', 'failed']);\n/** The states whose coming is news in itself, whoever said nothing as it came. */\nconst NEWS = new Set(['blocked', 'completed', 'failed']);\n\nexport interface Store {\n /** The tasks as read last: those still to do, oldest first, then the latest finished. */\n tasks: () => Listed[];\n /** The channel, and its page on the board where there's one to link to: nothing before the first read. */\n channel: () => { name: string; link?: string } | undefined;\n /** Reads them again, unless they were a moment ago: `again` whatever, after a change made here. */\n load: (again?: boolean) => void;\n /** Hears each read; answers what stops it. */\n subscribe: (listener: () => void) => () => void;\n /** Whether a task has something no one has read here. */\n unread: (task: Listed) => boolean;\n /** The reply that was its newest when it was last read here, where it had one. */\n read: (task: Listed) => string | undefined;\n /** Says a task is read, as its thread stands. */\n seen: (task: Listed) => void;\n /** Whether a finished task was put away here, and nothing has happened to it since. */\n archived: (task: Listed) => boolean;\n /** Puts finished tasks away, read: out of the drawer until something happens to one. */\n archive: (tasks: Listed[]) => void;\n}\n\n/** How a task's thread stands: its newest reply, and its state where that's news. */\nconst markOf = (task: Listed) => `${task.last ?? ''}|${NEWS.has(task.state) ? task.state : ''}`;\n\n/** What's kept under `key` (what's been read, what's put away), or nothing where this browser has kept none yet. */\nfunction kept(key = SEEN): Record<string, string> | undefined {\n try {\n const seen: unknown = JSON.parse(localStorage.getItem(key) ?? 'null');\n return typeof seen === 'object' && seen !== null ? (seen as Record<string, string>) : undefined;\n } catch {\n // Storage can be off, or hold something else: nothing's been kept, then.\n return undefined;\n }\n}\n\nconst made = new WeakMap<ShadowRoot, Store>();\n\n/** The tasks of the overlay `context` is of: one store, whoever asks. */\nexport function storeOf(context: ClientContext): Store {\n const known = made.get(context.root);\n if (known !== undefined) return known;\n\n let tasks: Listed[] = [];\n let channel: { name: string; link?: string } | undefined;\n let read = 0;\n let asked = 0;\n let seen = kept();\n const listeners = new Set<() => void>();\n const tell = () => {\n for (const listener of listeners) listener();\n };\n let away = kept(ARCHIVED) ?? {};\n const keep = (key = SEEN, value: unknown = seen) => {\n try {\n localStorage.setItem(key, JSON.stringify(value));\n } catch {\n // Not kept past the page, then.\n }\n };\n\n const store: Store = {\n tasks: () => tasks,\n channel: () => channel,\n load: (again = false) => {\n if (!again && Date.now() - read < FRESH) return;\n const ask = ++asked;\n read = Date.now();\n void context\n .request('page')\n .then(async (res) => {\n if (!res.ok || ask !== asked) return;\n const answer = (await res.json()) as { channel?: string; link?: string; tasks: Listed[] };\n ({ tasks } = answer);\n // The first read in this browser: what the channel has by now is old news, and only what comes after is unread.\n if (seen === undefined) {\n seen = Object.fromEntries(tasks.map((task) => [task.id, markOf(task)]));\n keep();\n }\n if (answer.channel !== undefined) channel = { name: answer.channel, ...(answer.link === undefined ? {} : { link: answer.link }) };\n tell();\n })\n // As they were, then: whatever opens a task says why the board can't be reached.\n .catch(() => {});\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n unread: (task) => seen !== undefined && markOf(task) !== '|' && seen[task.id] !== markOf(task),\n read: (task) => seen?.[task.id]?.split('|', 1)[0] || undefined,\n seen: (task) => {\n if (seen?.[task.id] === markOf(task)) return;\n // Another tab may have read others since: theirs are kept too.\n seen = { ...seen, ...kept(), [task.id]: markOf(task) };\n keep();\n tell();\n },\n archived: (task) => OVER.has(task.state) && away[task.id] === markOf(task),\n archive: (finished) => {\n const marks = Object.fromEntries(finished.filter((task) => OVER.has(task.state)).map((task) => [task.id, markOf(task)]));\n // Only what the board still lists: the rest have gone from it, and needn't be kept.\n const listed = new Set(tasks.map((task) => task.id));\n away = Object.fromEntries(Object.entries({ ...away, ...kept(ARCHIVED), ...marks }).filter(([id]) => listed.has(id)));\n keep(ARCHIVED, away);\n seen = { ...seen, ...kept(), ...marks };\n keep();\n tell();\n },\n };\n made.set(context.root, store);\n return store;\n}\n","/**\n * Which element a task is about, where one place in the source renders several (a list's items, a `map`): the mark\n * alone finds the first of them, so a task keeps its place among them and its text, and is found again by those.\n */\nimport { ATTRIBUTE } from '#src/client/dom.ts';\n\nimport type { Task, Which } from './index.ts';\n\n/** As much of an element's text as tells it from its siblings, and as a label holds. */\nconst SAID = 120;\n\nconst textOf = (el: Element) => (el.textContent ?? '').replace(/\\s+/g, ' ').trim().slice(0, SAID);\n\n/** Which of `alike` (the elements with its mark, in the page's order) `el` is; its text as `said` has it, which may be masked. */\nexport function whichOf(el: Element, alike: Element[], said: Element = el): Which {\n const text = textOf(said);\n return { nth: alike.indexOf(el) + 1, ...(text === '' ? {} : { text }) };\n}\n\n/**\n * The element a task is about on this page: the only one with its mark, or the one of several with its text, else the\n * one at its place among them. None where it was one of more than the page has now and its text is on none of them.\n */\nexport function elementOf(task: Pick<Task, 'which'> & { place?: string }): Element | null {\n if (task.place === undefined) return null;\n const alike = [...document.querySelectorAll(`[${ATTRIBUTE}=\"${CSS.escape(task.place)}\"]`)];\n const { which } = task;\n if (which === undefined || alike.length <= 1) return alike[0] ?? null;\n const at = alike[which.nth - 1];\n const said = which.text === undefined ? [] : alike.filter((el) => textOf(el) === which.text);\n // Text that's on several (`Learn more`) is told apart by the place among them, where that's one of them.\n if (said.length > 0) return at !== undefined && said.includes(at) ? at : said[0]!;\n return at ?? null;\n}\n","/**\n * The tasks' section of the drawer: the channel's tasks still to do, each with its state, and the latest finished\n * folded under them, those put away (archived) left out. One with something unread (a reply since it was last opened\n * here, or an end no one looked at) says so, and a row the pointer is on lights its element on the page. A task opens\n * in the drawer: its words, to change while no one has it, what it has attached, its thread, read as it's opened and\n * again every few seconds, a composer to answer in (as the Task tab's, with what a reply can attach), and Delete,\n * which cancels it on the board.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { place } from '#src/client/dom.ts';\nimport type { ClientContext, LightboxItem } from '#src/index.ts';\n\nimport { attachedOf, type Composer, COMPOSER_STYLE, composerIn, element, messageOf, PLAY } from './composer.ts';\nimport type { Answer, Attached, Listed, Thread } from './index.ts';\nimport { OVER, storeOf } from './store.ts';\nimport { elementOf } from './which.ts';\n\nconst STYLE = `\n.tasks-drawer h3 .unread { padding: 0 6px; border-radius: 8px; font-weight: 700; letter-spacing: 0; color: var(--deictic-on-accent); background: var(--deictic-accent); }\n.tasks-drawer h3 a { margin-left: auto; font-weight: 400; letter-spacing: 0; text-transform: none; color: inherit; }\n.tasks-drawer h3 a:hover { color: var(--deictic-fg); }\n.task-row { display: grid; grid-template: 'state title mark' auto 'state meta mark' auto / auto minmax(0, 1fr) auto; gap: 1px 8px; align-items: center;\n width: 100%; padding: 6px 8px; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 8px; text-align: left; font-size: 12px; background: rgb(255 255 255 / 0.04); }\n.task-row:hover { border-color: rgb(255 255 255 / 0.16); background: rgb(255 255 255 / 0.06); }\n.task-row .title { grid-area: title; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.task-row .meta { grid-area: meta; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--deictic-muted); }\n.task-row.unread .title { font-weight: 600; }\n/* What's unread is a dot of the overlay's own green, where a read one has nothing. */\n.task-row .mark { grid-area: mark; width: 7px; height: 7px; border-radius: 50%; }\n.task-row.unread .mark { background: var(--deictic-accent); box-shadow: 0 0 8px var(--deictic-accent); }\n/* The state is a dot, as a board's is: a ring while no one has it, filled once someone does or it's finished. */\n.task-state { grid-area: state; flex: none; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.task-state.waiting { border-style: dotted; }\n.task-state.claimed { border-color: #60a5fa; background: #60a5fa; }\n.task-state.blocked { border-color: #fbbf24; background: #fbbf24; }\n.task-state.completed { border-color: #4ade80; background: #4ade80; }\n.task-state.failed { border-color: var(--deictic-problem); background: var(--deictic-problem); }\n.tasks-drawer details { margin-top: 6px; }\n.tasks-drawer summary { cursor: pointer; font-size: 12px; color: var(--deictic-muted); }\n.tasks-drawer summary:hover { color: var(--deictic-fg); }\n.tasks-drawer details .drawer-rows { margin-top: 6px; }\n.tasks-drawer .put-away { justify-self: end; }\n.tasks-drawer .act, .task-view .act { padding: 1px 6px; border: 0; font-size: 12px; color: var(--deictic-muted); }\n.tasks-drawer .act:hover, .task-view .act:hover { color: var(--deictic-fg); }\n.task-view { display: flex; flex-direction: column; gap: 8px; min-height: 0; font-size: 12px; }\n.task-view .stands { display: flex; align-items: center; gap: 6px; color: var(--deictic-muted); }\n.task-view .stands .says { flex: 1; }\n.task-view .stands a { color: inherit; }\n.task-view .stands a:hover { color: var(--deictic-fg); }\n.task-view .act.sure { color: var(--deictic-problem); }\n.task-view .where { align-self: start; max-width: 100%; padding: 0; border: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px ui-monospace, monospace; color: var(--deictic-accent); }\n.task-view .where span { color: var(--deictic-muted); }\n.task-view .words { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }\n.task-view .said { padding: 4px 8px; border-left: 2px solid var(--deictic-line); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--deictic-muted); }\n.task-view .editing textarea { display: block; box-sizing: border-box; width: 100%; min-height: 56px; resize: vertical; font: 13px/1.45 system-ui, sans-serif; }\n.task-view .buttons { display: flex; justify-content: end; gap: 6px; margin-top: 6px; }\n/* What a task or a reply has attached: a chip each, which opens all of them in the lightbox. */\n.task-files { display: flex; flex-wrap: wrap; gap: 4px; }\n.task-files:empty { display: none; }\n/* One height, and a thumbnail one size, as the composer's chips: nothing moves as the pictures load. */\n.task-files button { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 6px 0 2px; border: 1px solid var(--deictic-line); border-radius: 6px; font-size: 11px; }\n.task-files button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.task-files img { flex: none; display: block; width: 30px; height: 20px; object-fit: cover; border-radius: 4px; background: var(--deictic-line); }\n.task-files .play { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; background: var(--deictic-line); }\n.task-files .play svg { width: 10px; height: 10px; }\n.task-thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 8px 0 0; border-top: 1px solid rgb(255 255 255 / 0.08); list-style: none; }\n.task-thread:empty { display: none; }\n.task-thread li { display: grid; gap: 4px; padding: 6px 8px; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 8px; background: rgb(255 255 255 / 0.04); }\n.task-thread li.new { border-color: color-mix(in srgb, var(--deictic-accent) 55%, transparent); }\n.task-thread .by { display: flex; gap: 6px; align-items: baseline; font-size: 11px; color: var(--deictic-muted); }\n.task-thread .by b { font-weight: 600; color: var(--deictic-fg); }\n.task-thread .by i { margin-left: auto; font-style: normal; }\n.task-thread .text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }\n.task-view .problem { color: var(--deictic-problem); }\n.task-view .problem:empty { display: none; }\n/* On the page, around an element a task is about: the open task's, and each one attached in the Task tab. */\n.task-about { position: fixed; z-index: 2147483646; box-sizing: border-box; pointer-events: none; border: 1.5px dashed var(--deictic-accent); border-radius: 6px; }\n.task-about[hidden] { display: none; }\n${COMPOSER_STYLE}`;\n\n/** How often an open task's thread is read again, in ms: an agent answers while it's looked at. */\nconst AGAIN = 5000;\n/** How long Delete waits to be pressed again, in ms, before it's only Delete once more. */\nconst SURE = 3000;\n/** Where what's typed in a reply is kept while its task isn't open: for the tab, over page loads. */\nconst DRAFTS = 'deictic:tasks:drafts';\nconst FILE =\n '<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" aria-hidden=\"true\"><path d=\"M6 3h8l4 4v14H6zM14 3v4h4\"/></svg>';\n\n/** `now`, `5m`, `2h`, `3d`: how long ago, as short as a thread's margin. */\nfunction ago(at: string): string {\n const minutes = Math.round((Date.now() - Date.parse(at)) / 60_000);\n if (!(minutes >= 1)) return 'now';\n if (minutes < 60) return `${minutes}m`;\n return minutes < 60 * 24 ? `${Math.round(minutes / 60)}h` : `${Math.round(minutes / (60 * 24))}d`;\n}\n\n/** What's typed in each task's reply, by its ID. */\nfunction drafts(): Record<string, string> {\n try {\n const kept: unknown = JSON.parse(sessionStorage.getItem(DRAFTS) ?? '{}');\n return typeof kept === 'object' && kept !== null ? (kept as Record<string, string>) : {};\n } catch {\n // Storage can be off: nothing's kept, then.\n return {};\n }\n}\n\nfunction keepDraft(id: string, text: string): void {\n const { [id]: _, ...rest } = drafts();\n try {\n sessionStorage.setItem(DRAFTS, JSON.stringify(text.trim() === '' ? rest : { ...rest, [id]: text }));\n } catch {\n // Not kept past the page, then.\n }\n}\n\n/** A board's file as a person names it: what it is, not what deictic called it. */\nfunction nameOf(file: Attached, i: number, all: Attached[]): string {\n const alike = all.filter((other) => kindOf(other) === kindOf(file));\n const n = alike.length === 1 ? '' : ` ${alike.indexOf(file) + 1}`;\n const kind = kindOf(file);\n if (kind === 'image') return `Screenshot${n}`;\n if (kind === 'recording') return `Recording${n}`;\n if (kind === 'audio') return `Voice note${n}`;\n if (/^element(\\.\\d+)?\\.html$/.test(file.name)) return `HTML${n}`;\n return file.name || `File ${i + 1}`;\n}\n\nconst kindOf = ({ type, name }: Attached) =>\n type.startsWith('image/') ? 'image' : name.startsWith('recording-') ? 'recording' : type.startsWith('audio/') ? 'audio' : 'file';\n\nexport interface TasksDrawer {\n /** Opens a task in the drawer, or several to pick from: a pin's. */\n open: (tasks: Listed[]) => void;\n}\n\nconst made = new WeakMap<ShadowRoot, TasksDrawer>();\n\n/** The tasks' section in the drawer of the overlay `context` is of: added the first time it's asked for. */\nexport function drawerOf(context: ClientContext): TasksDrawer {\n const known = made.get(context.root);\n if (known !== undefined) return known;\n\n const store = storeOf(context);\n const section = element('section', { className: 'tasks-drawer', hidden: true });\n const heading = element('h3');\n const rows = element('div', { className: 'drawer-rows' });\n const finished = element('details');\n const finishedCount = element('summary');\n const finishedRows = element('div', { className: 'drawer-rows' });\n const putAway = element('button', {\n type: 'button',\n className: 'act put-away',\n textContent: 'Archive all',\n title: 'Put the finished tasks away: one comes back when something happens to it',\n });\n putAway.addEventListener('click', () => store.archive(store.tasks().filter((task) => OVER.has(task.state))));\n finishedRows.append(putAway);\n finished.append(finishedCount, finishedRows);\n section.append(element('style', { textContent: STYLE }), heading, rows, finished);\n\n /** What a task is about, as the caption says an element: by its component where the page has it, else its tag. */\n const about = (task: Listed) => {\n if (task.problem !== undefined) return task.problem === 'setup' ? \"deictic's setup\" : 'a bug in deictic';\n if (task.place === undefined) return 'the page';\n const el = elementOf(task);\n if (el !== null) return tell(named(el));\n // Not on this page: its tag as the task saw it, and the page it was on where that's another.\n const on = task.page === undefined || task.page === location.pathname ? '' : ` on ${task.page}`;\n return `${task.tag === undefined ? 'an element' : `<${task.tag}>`}${on}`;\n };\n /** Lights a task's element on the page while the pointer is on what stands for it here. */\n const lights = (on: HTMLElement, task: () => Listed) => {\n on.addEventListener('pointerenter', () => context.light(elementOf(task()) ?? undefined));\n on.addEventListener('pointerleave', () => context.light());\n };\n const rowOf = (task: Listed) => {\n const row = element('button', { type: 'button', className: `task-row${store.unread(task) ? ' unread' : ''}` });\n const says = task.by === undefined ? task.state : `${task.state} by ${task.by}`;\n const replies = task.replies === 0 ? '' : ` · ${task.replies} ${task.replies === 1 ? 'reply' : 'replies'}`;\n row.append(\n element('span', { className: `task-state ${task.state}`, ariaHidden: 'true' }),\n element('span', { className: 'title', textContent: task.title }),\n element('span', { className: 'meta', textContent: `${says} · ${about(task)}${replies}` }),\n element('span', { className: 'mark', ...(store.unread(task) ? { title: 'Unread' } : {}) }),\n );\n lights(row, () => task);\n row.addEventListener('click', () => {\n context.light();\n view(task);\n });\n return row;\n };\n const draw = () => {\n const tasks = store.tasks().filter((task) => !store.archived(task));\n const live = tasks.filter((task) => !OVER.has(task.state));\n const ended = tasks.filter((task) => OVER.has(task.state));\n section.hidden = tasks.length === 0;\n const unread = tasks.filter(store.unread).length;\n // For the drawer folded away: what's still to do, and what's unread.\n section.dataset.count = String(live.length);\n section.dataset.unread = String(unread);\n const channel = store.channel();\n heading.replaceChildren(\n 'Tasks',\n ...(unread === 0 ? [] : [element('span', { className: 'unread', textContent: String(unread), title: `${unread} unread` })]),\n ...(channel?.link === undefined\n ? []\n : [\n element('a', {\n href: channel.link,\n target: '_blank',\n rel: 'noreferrer',\n textContent: `#${channel.name}`,\n title: 'Open the channel on the board',\n }),\n ]),\n );\n rows.replaceChildren(...live.map(rowOf));\n finished.hidden = ended.length === 0;\n const news = ended.filter(store.unread).length;\n finishedCount.textContent = `${ended.length} finished${news === 0 ? '' : `, ${news} unread`}`;\n finishedRows.replaceChildren(...ended.map(rowOf), putAway);\n };\n store.subscribe(draw);\n context.drawer.add(section, { first: true });\n\n const ask = async <T>(route: string, body?: unknown): Promise<T> => {\n const res = await context.request(\n route,\n body === undefined ? undefined : { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) },\n );\n const answer = (await res.json()) as T & { problem?: string };\n if (!res.ok) throw new Error(answer.problem ?? `the dev server answered ${res.status}`);\n return answer;\n };\n\n /** A message's files as chips, each opening them all in the lightbox at itself. */\n const filesOf = (task: string, files: Attached[]): HTMLElement => {\n const list = element('div', { className: 'task-files' });\n const urlOf = (file: Attached) =>\n file.url ?? `${context.base}__deictic/plugins/tasks/file/${encodeURIComponent(task)}/${encodeURIComponent(file.id)}`;\n // What the lightbox shows of each: a picture, a sound, a recording's replay, or a file as text.\n const items: LightboxItem[] = files.map((file, i) => {\n const title = nameOf(file, i, files);\n const kind = kindOf(file);\n if (kind === 'image') return { kind: 'image', url: urlOf(file), title };\n if (kind === 'audio') return { kind: 'audio', url: urlOf(file), title };\n const replay = kind === 'recording' ? file.replay : undefined;\n const url = replay === undefined ? urlOf(file) : `${replay}${replay.includes('?') ? '&' : '?'}embed`;\n const open = replay ?? urlOf(file);\n return {\n kind: 'page',\n url,\n title,\n actions: [{ label: 'New tab', title: 'Open it in a tab of its own', run: () => void window.open(open, '_blank', 'noopener') }],\n };\n });\n list.append(\n ...files.map((file, i) => {\n const name = nameOf(file, i, files);\n // `Open screenshot 2`, but `Open HTML`.\n const said = /^[A-Z]{2}/.test(name) ? name : `${name[0]!.toLowerCase()}${name.slice(1)}`;\n const chip = element('button', { type: 'button', title: `Open ${said}` });\n const kind = kindOf(file);\n const icon =\n kind === 'image'\n ? element('img', { src: urlOf(file), alt: '', loading: 'lazy' })\n : element('span', { className: 'play', innerHTML: kind === 'file' ? FILE : PLAY });\n chip.append(icon, element('span', { textContent: name }));\n chip.addEventListener('click', () => context.lightbox(items, { at: i, from: chip }));\n return chip;\n }),\n );\n return list;\n };\n\n /** A task, open in the drawer: its words, what's attached, its thread, and what changes them. */\n function view(first: Listed): void {\n let task = first;\n let editing = false;\n // The reply that was its newest when it was last read: those after it are new, this once.\n const readTo = store.read(first);\n const fresh = store.unread(first);\n // What was answered from here: never new to who wrote it.\n const mine = new Set<string>();\n const recorder = context.use('recordings');\n\n const el = element('div', { className: 'task-view' });\n const stands = element('div', { className: 'stands' });\n const where = element('button', { type: 'button', className: 'where' });\n const words = element('div');\n const files = element('div');\n const said = element('div', { className: 'said' });\n const thread = element('ol', { className: 'task-thread' });\n const problem = element('div', { className: 'problem' });\n // The task's element, lit on the page while the pointer is on its name, as its row's is.\n lights(where, () => task);\n\n const composer: Composer = composerIn(context, {\n placeholder: 'Reply…',\n sendLabel: 'Reply',\n over: true,\n // What's typed is kept, the drawer closes, and the page is recorded: stopped, the recording is in the tray,\n // and the task opened again has it and the words.\n record: () => {\n if (recorder === undefined) return;\n if (recorder.recording()) {\n composer.problem.textContent = \"A recording is going already: stop it in the tool panel, and it's attached here\";\n return;\n }\n close();\n void recorder.record();\n },\n submit: async (gathered) => {\n const answer: Answer = { text: gathered.text, ...attachedOf(gathered) };\n const after = await ask<Thread>(`reply/${encodeURIComponent(task.id)}`, answer);\n const last = after.replies.at(-1);\n if (last !== undefined) mine.add(last.id);\n shown(after);\n keepDraft(task.id, '');\n store.load(true);\n return true;\n },\n });\n composer.restore({ text: drafts()[first.id] ?? '' });\n el.append(stands, where, words, files, said, thread, composer.el, problem);\n\n // The element it's about, outlined on the page while it's open, and shown by a press on its name.\n const outline = element('div', { className: 'task-about', hidden: true });\n context.root.append(outline);\n let following = requestAnimationFrame(function follow() {\n following = requestAnimationFrame(follow);\n const it = elementOf(task);\n outline.hidden = it === null;\n if (it !== null) place(outline, it.getBoundingClientRect());\n });\n where.addEventListener('click', () => elementOf(task)?.scrollIntoView({ block: 'center', behavior: 'smooth' }));\n\n const failed = (e: unknown) => (problem.textContent = messageOf(e));\n let removing: ReturnType<typeof setTimeout> | undefined;\n const drawTask = () => {\n const state = element('span', { className: `task-state ${task.state}`, ariaHidden: 'true' });\n const says = element('span', { className: 'says', textContent: task.by === undefined ? task.state : `${task.state} by ${task.by}` });\n const to =\n task.link === undefined\n ? []\n : [\n element('a', {\n href: task.link,\n target: '_blank',\n rel: 'noreferrer',\n textContent: 'on the board',\n title: 'Open the task on the board',\n }),\n ];\n const edit = element('button', { type: 'button', className: 'act', textContent: 'Edit', title: 'Change its words' });\n edit.addEventListener('click', () => {\n editing = true;\n drawWords();\n });\n // Twice, as nothing brings a task back: a board never reopens one it canceled.\n const remove = element('button', { type: 'button', className: 'act', textContent: 'Delete', title: 'Cancel it on the board' });\n remove.addEventListener('click', () => {\n if (!remove.classList.contains('sure')) {\n remove.classList.add('sure');\n remove.textContent = 'Delete?';\n removing = setTimeout(() => {\n remove.classList.remove('sure');\n remove.textContent = 'Delete';\n }, SURE);\n return;\n }\n remove.disabled = true;\n ask(`remove/${encodeURIComponent(task.id)}`, {}).then(() => {\n store.load(true);\n close();\n }, failed);\n });\n // A finished one is put away from here, as the list puts them all away.\n const archive = element('button', {\n type: 'button',\n className: 'act',\n textContent: 'Archive',\n title: 'Put it away: it comes back when something happens to it',\n });\n archive.addEventListener('click', () => {\n store.archive([task]);\n close();\n });\n // Edit and Delete only for one no one has claimed, as on the board.\n stands.replaceChildren(state, says, ...to, ...(task.open ? [edit, remove] : []), ...(OVER.has(task.state) ? [archive] : []));\n const at = task.place?.replace(/:\\d+$/, '');\n where.replaceChildren(about(task), ...(at === undefined ? [] : [element('span', { textContent: ` ${at}` })]));\n where.disabled = elementOf(task) === null;\n where.title = task.place === undefined ? 'No element was attached' : where.disabled ? 'Not on this page now' : 'Show it on the page';\n said.hidden = task.said === undefined;\n said.textContent = task.said ?? '';\n };\n const drawWords = () => {\n if (!editing) {\n words.className = 'words';\n words.replaceChildren(task.text);\n return;\n }\n const text = element('textarea', { value: task.text });\n const save = element('button', { type: 'button', className: 'primary', textContent: 'Save' });\n const leave = element('button', { type: 'button', textContent: 'Cancel' });\n const buttons = element('div', { className: 'buttons' });\n buttons.append(leave, save);\n const done = () => {\n editing = false;\n drawWords();\n };\n const keep = () => {\n if (text.value.trim() === '') return;\n if (text.value.trim() === task.text) return done();\n save.disabled = true;\n ask<Thread>(`edit/${encodeURIComponent(task.id)}`, { text: text.value }).then(\n (answer) => {\n editing = false;\n shown(answer);\n store.load(true);\n },\n (e: unknown) => {\n save.disabled = false;\n failed(e);\n },\n );\n };\n text.addEventListener('keydown', (e) => {\n if (e.key === 'Escape') {\n // The words' alone: the task stays open.\n e.stopPropagation();\n done();\n }\n // Enter saves, as the composer sends; Shift+Enter is a new line.\n if (e.key !== 'Enter' || e.shiftKey || e.isComposing) return;\n e.preventDefault();\n keep();\n });\n save.addEventListener('click', keep);\n leave.addEventListener('click', done);\n words.className = 'editing';\n words.replaceChildren(text, buttons);\n text.focus();\n };\n // What the thread was drawn from, so reading it again redraws only what changed: pictures don't blink.\n let drawn = '';\n /** The task and its thread as just read: drawn, and read by whoever is looking. */\n const shown = (answer: Thread) => {\n task = answer.task;\n problem.textContent = '';\n drawTask();\n if (!editing) drawWords();\n const now = JSON.stringify([answer.files.map((f) => f.id), answer.replies.map((r) => [r.id, r.text, r.files.length]), [...mine]]);\n if (now !== drawn) {\n drawn = now;\n files.replaceChildren(filesOf(task.id, answer.files));\n const from = readTo === undefined ? -1 : answer.replies.findIndex((r) => r.id === readTo);\n // At its end only if it has grown: reading up the thread isn't pulled back down.\n const grew = answer.replies.length !== thread.childElementCount;\n thread.replaceChildren(\n ...answer.replies.map((r, i) => {\n const item = element('li', { className: fresh && i > from && !mine.has(r.id) ? 'new' : '' });\n const by = element('div', { className: 'by' });\n by.append(\n element('b', { textContent: r.by }),\n ...(r.kind === 'person' ? [] : ['agent']),\n element('i', { textContent: ago(r.at), title: new Date(r.at).toLocaleString() }),\n );\n item.append(by, element('div', { className: 'text', textContent: r.text }), filesOf(task.id, r.files));\n return item;\n }),\n );\n if (grew) thread.lastElementChild?.scrollIntoView({ block: 'nearest' });\n }\n store.seen(task);\n };\n const load = () => ask<Thread>(`thread/${encodeURIComponent(task.id)}`).then(shown, failed);\n\n drawTask();\n drawWords();\n void load();\n const again = setInterval(() => void load(), AGAIN);\n const close = context.drawer.show(el, {\n title: `#${task.id}`,\n closed: () => {\n keepDraft(task.id, composer.draft().text);\n composer.destroy();\n context.light();\n clearInterval(again);\n clearTimeout(removing);\n cancelAnimationFrame(following);\n outline.remove();\n },\n });\n }\n\n /** Several tasks of one place, to pick from. */\n const pick = (tasks: Listed[]) => {\n const el = element('div', { className: 'drawer-rows' });\n el.append(...tasks.map(rowOf));\n context.drawer.show(el, { title: `${tasks.length} tasks on ${about(tasks[0]!)}`, closed: () => context.light() });\n };\n\n const drawer: TasksDrawer = {\n open: (tasks) => {\n if (tasks.length === 1) view(tasks[0]!);\n else if (tasks.length > 1) pick(tasks);\n },\n };\n made.set(context.root, drawer);\n return drawer;\n}\n","/**\n * The page's tasks, each pinned where its element is: what's shown of them on the page itself, beside the Task\n * tab's list of one element's. A pin is the element's outline, faint, and a badge on its corner with how many\n * tasks are still to do there, in the colour of the furthest along, and a dot where one has something unread. They\n * show while a shortcut's keys are held and while the Task tab is open: a pin under the pointer reads its tasks, and\n * a click opens them in the drawer.\n *\n * In a layer of the overlay's root, which the tab's own styles don't reach once it's closed: so its styles are its own.\n */\nimport { named, tell } from '#src/client/component.ts';\nimport { div, place, reduced, sameAs } from '#src/client/dom.ts';\nimport type { ClientContext, Point } from '#src/index.ts';\n\nimport { drawerOf } from './drawer.ts';\nimport type { Placed } from './index.ts';\nimport { OVER, storeOf } from './store.ts';\nimport { elementOf } from './which.ts';\n\nconst STYLE = `\n/* No box of its own, which its pins would stack in: each is under the popup, and the one pointed at over it, with its card. */\n.pins { display: contents; font: 12px/1.4 system-ui, sans-serif; color: var(--deictic-fg); }\n.pin { --pin: var(--deictic-accent); position: fixed; z-index: 2147483646; box-sizing: border-box; pointer-events: none; border: 1px solid color-mix(in srgb, var(--pin) 45%, transparent); border-radius: 6px; transition: border-color 0.15s, box-shadow 0.15s; }\n.pin.claimed { --pin: #60a5fa; }\n.pin.blocked { --pin: #fbbf24; }\n.pin[hidden] { display: none; }\n.pin.spot, .pin.spot:has(.pin-badge:hover, .pin-badge:focus-visible) { border: 0; box-shadow: none; }\n.pin:has(.pin-badge:hover, .pin-badge:focus-visible) { z-index: 2147483647; border-color: var(--pin); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 18%, transparent), 0 0 28px color-mix(in srgb, var(--pin) 45%, transparent); }\n/* A drop, its point on the element's corner. */\n.pin-badge {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 22px;\n height: 22px;\n padding: 0 6px;\n border: 0;\n border-radius: 11px 11px 11px 3px;\n font: 700 12px/22px system-ui, sans-serif;\n font-variant-numeric: tabular-nums;\n color: #09090b;\n background: var(--pin);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 22%, transparent), 0 0 18px color-mix(in srgb, var(--pin) 60%, transparent), 0 4px 12px rgb(0 0 0 / 0.4);\n pointer-events: auto;\n cursor: pointer;\n}\n.pin-badge:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }\n/* Something unread there: a dot on the badge's corner. */\n.pin.unread .pin-badge::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border: 2px solid #09090b; border-radius: 50%; background: #fff; }\n.pin-card {\n position: absolute;\n left: 0;\n top: calc(100% + 8px);\n display: none;\n flex-direction: column;\n gap: 4px;\n width: max-content;\n max-width: 300px;\n padding: 8px 10px;\n border: 1px solid rgb(255 255 255 / 0.12);\n border-radius: 10px;\n font: 12px/1.4 system-ui, sans-serif;\n text-align: left;\n color: var(--deictic-fg);\n background: rgb(24 24 27 / 0.9);\n backdrop-filter: blur(16px) saturate(1.6);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.45);\n cursor: pointer;\n}\n.pin.left .pin-card { left: auto; right: 0; }\n.pin.up .pin-card { top: auto; bottom: calc(100% + 8px); }\n.pin-badge:hover .pin-card, .pin-badge:focus-visible .pin-card { display: flex; }\n.pin-where { font: 11px ui-monospace, monospace; color: var(--deictic-muted); }\n.pin-where b { color: var(--pin); }\n.pin-task { display: flex; gap: 6px; align-items: baseline; min-width: 0; }\n.pin-task span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.pin-task i { flex: none; align-self: center; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.pin-task i.claimed { border-color: #60a5fa; background: #60a5fa; }\n.pin-task i.blocked { border-color: #fbbf24; background: #fbbf24; }\n.pin-task i.waiting { border-style: dotted; }\n.pin-task em { flex: none; font-style: normal; color: var(--deictic-muted); }\n.pin-more { color: var(--deictic-muted); }\n@media (prefers-reduced-motion: no-preference) {\n .pin { animation: deictic-pin-area 0.3s ease-out backwards; }\n .pin-badge { animation: deictic-pin 0.34s cubic-bezier(0.2, 0.9, 0.25, 1.4) backwards; animation-delay: inherit; transform-origin: 0 100%; }\n}\n@keyframes deictic-pin-area {\n from { opacity: 0; }\n}\n@keyframes deictic-pin {\n from { opacity: 0; scale: 0.2; }\n}\n`;\n\n/** How long the pins outlast what showed them, in ms: the popup opens a moment after the pointing that led to it ends. */\nconst LINGER = 200;\n/** A badge's size, and how far out of the element's corner it sits, in pixels. */\nconst BADGE = 22;\nconst OUT = 10;\nconst EDGE = 4;\n/** The tasks a pin's card names, before it only counts them. */\nconst NAMED = 4;\n/** The states by how far along, the furthest first: a pin is the colour of its furthest. */\nconst ALONG = ['blocked', 'claimed', 'ready', 'waiting'];\n\nexport interface Pins {\n /** Shows them: every place's, to read under the pointer and open with a click. Answers what takes them away. */\n glance: () => () => void;\n}\n\ninterface Pin {\n place: string;\n /** The spot in the element it's on, for a task about one: the pin is there, and has no outline. */\n at?: Point;\n el: Element;\n box: HTMLElement;\n badge: HTMLButtonElement;\n count: HTMLElement;\n card: HTMLElement;\n /** The tasks its badge counts, as last drawn: what a click opens. */\n tasks: Placed[];\n}\n\nconst made = new WeakMap<ShadowRoot, Pins>();\n\n/** The pins of the overlay `context` is of: one set, whoever shows it. */\nexport function pinsIn(context: ClientContext): Pins {\n const kept = made.get(context.root);\n if (kept !== undefined) return kept;\n\n const store = storeOf(context);\n let glances = 0;\n let layer: HTMLElement | undefined;\n let frame = 0;\n let leaving: ReturnType<typeof setTimeout> | undefined;\n const pins = new Map<string, Pin>();\n let frames = 0;\n\n const pinOf = (at: string, el: Element, spot: Point | undefined): Pin => {\n const box = div('pin');\n const badge = Object.assign(document.createElement('button'), { type: 'button', className: 'pin-badge' });\n const count = document.createElement('span');\n const card = Object.assign(document.createElement('span'), { className: 'pin-card' });\n badge.append(count, card);\n box.append(badge);\n // One after another, as they come: where motion is reduced there's no animation to delay.\n if (!reduced()) box.style.animationDelay = `${Math.min(pins.size, 12) * 30}ms`;\n const pin: Pin = { place: at, ...(spot === undefined ? {} : { at: spot }), el, box, badge, count, card, tasks: [] };\n // In the drawer, where a task is read and changed: the popup is for a new one.\n badge.addEventListener('click', () => drawerOf(context).open(pin.tasks));\n return pin;\n };\n\n /** A pin as its tasks are now: how many, the colour of the furthest along, and its card. */\n const fill = (pin: Pin, list: Placed[]) => {\n const state = ALONG.find((s) => list.some((t) => t.state === s)) ?? 'ready';\n pin.tasks = list;\n pin.box.className = `pin ${state}${pin.at === undefined ? '' : ' spot'}${list.some(store.unread) ? ' unread' : ''}`;\n pin.count.textContent = String(list.length);\n const [, file = '', line = ''] = /^(.*):(\\d+):\\d+$/.exec(pin.place) ?? [];\n const tag = tell(named(pin.el));\n pin.badge.setAttribute('aria-label', `${list.length} ${list.length === 1 ? 'task' : 'tasks'} on ${tag}, line ${line}: open`);\n const where = Object.assign(document.createElement('span'), { className: 'pin-where' });\n where.append(Object.assign(document.createElement('b'), { textContent: tag }), ` ${file.split('/').at(-1)}:${line}`);\n const rows = list.slice(0, NAMED).map((t) => {\n const row = Object.assign(document.createElement('span'), { className: 'pin-task' });\n const dot = Object.assign(document.createElement('i'), { className: t.state });\n const by = t.by === undefined ? [] : [Object.assign(document.createElement('em'), { textContent: t.by })];\n row.append(dot, Object.assign(document.createElement('span'), { textContent: t.title }), ...by);\n return row;\n });\n const rest = list.length - rows.length;\n const more = rest === 0 ? [] : [Object.assign(document.createElement('span'), { className: 'pin-more', textContent: `+${rest} more` })];\n pin.card.replaceChildren(where, ...rows, ...more);\n };\n\n /** The pins as the tasks read last have them: one per place with an element on the page, for those still to do. */\n const draw = () => {\n if (layer === undefined) return;\n const tasks = store.tasks().filter((t): t is Placed => t.place !== undefined && !OVER.has(t.state));\n // One for an element's tasks, and one of its own for each spot a task is about.\n // And one for each of several elements from one place, as the page has them now.\n const keyOf = (t: Placed) => {\n const el = elementOf(t);\n const of = el === null ? t.place : `${t.place}#${sameAs(el).indexOf(el)}`;\n return t.point === undefined ? of : `${of}@${t.point.x},${t.point.y}`;\n };\n const byPlace = new Map<string, Placed[]>();\n for (const t of tasks) byPlace.set(keyOf(t), [...(byPlace.get(keyOf(t)) ?? []), t]);\n for (const [at, pin] of pins) {\n if (byPlace.has(at)) continue;\n pin.box.remove();\n pins.delete(at);\n }\n for (const [at, list] of byPlace) {\n let pin = pins.get(at);\n if (pin === undefined) {\n const [first] = list as [Placed, ...Placed[]];\n const { place: where, point } = first;\n const el = elementOf(first);\n if (el === null) continue;\n pin = pinOf(where, el, point);\n pins.set(at, pin);\n layer.append(pin.box);\n }\n fill(pin, list);\n }\n follow();\n };\n\n /** Each pin over its element as the page has it now: read each frame, as nothing tells of an element moving. */\n const follow = () => {\n const width = document.documentElement.clientWidth;\n const height = document.documentElement.clientHeight;\n // An element rendered again is another: looked for now and then, not every frame.\n const look = frames++ % 20 === 0;\n for (const pin of pins.values()) {\n if (!pin.el.isConnected && look && pin.tasks[0] !== undefined) pin.el = elementOf(pin.tasks[0]) ?? pin.el;\n const whole = pin.el.getBoundingClientRect();\n // A spot's is a box of no size at the spot: nothing to outline, and the badge's point is on it.\n const r = pin.at === undefined ? whole : new DOMRect(whole.left + pin.at.x, whole.top + pin.at.y, 0, 0);\n const seen =\n pin.el.isConnected && whole.width > 0 && whole.height > 0 && r.bottom > 0 && r.top < height && r.right > 0 && r.left < width;\n pin.box.hidden = !seen;\n if (!seen) continue;\n place(pin.box, r);\n // On the top right corner, or the badge's point on the spot, and in the window where that isn't.\n const out = pin.at === undefined ? OUT : 0;\n const x = Math.max(EDGE, Math.min(r.right - out, width - EDGE - pin.badge.offsetWidth));\n const y = Math.max(EDGE, Math.min(r.top - BADGE + out, height - EDGE - BADGE));\n // From the box's padding edge, which is inside its border, where it has one.\n const edge = pin.at === undefined ? 1 : 0;\n Object.assign(pin.badge.style, { left: `${x - r.left - edge}px`, top: `${y - r.top - edge}px` });\n // Its card opens toward the middle of the window.\n pin.box.classList.toggle('left', x > width / 2);\n pin.box.classList.toggle('up', y > height / 2);\n }\n };\n\n store.subscribe(draw);\n\n const sync = () => {\n clearTimeout(leaving);\n if (glances === 0) {\n leaving = setTimeout(() => {\n cancelAnimationFrame(frame);\n layer?.remove();\n layer = undefined;\n pins.clear();\n }, LINGER);\n return;\n }\n if (layer === undefined) {\n layer = div('pins');\n layer.append(Object.assign(document.createElement('style'), { textContent: STYLE }));\n frame = requestAnimationFrame(function each() {\n frame = requestAnimationFrame(each);\n follow();\n });\n }\n // After a popup that opened since: at the same height, the later is the upper, and a pin's card is over it.\n context.root.append(layer);\n draw();\n store.load();\n };\n\n const shown: Pins = {\n glance: () => {\n glances++;\n sync();\n return () => {\n glances--;\n sync();\n };\n },\n };\n made.set(context.root, shown);\n return shown;\n}\n","/**\n * The Task tab: a composer to add a task about the element with (`composer.ts`). The tasks there already are the\n * drawer's to list and open (`drawer.ts`), and the pins' to show on the page. Beside the channel it says who watches\n * it (`Model.watching`), or that no agent does.\n * Enter or the arrow sends it with the page's URL, the viewport and the element as it rendered, which the source\n * can't tell: the chain of source it rendered through, its HTML (a file attached), and where the annotations plugin\n * is loaded, what's marked on the page. Record leaves the popup (`away`) to record the page, and comes back with\n * what was typed when it's stopped, wherever the page is by then.\n *\n * Its tool in the panel adds a task about a spot: picked, the next press on the page opens this tab on that point,\n * in the marked element under it or the nearest to it.\n */\nimport { componentOf, fiberOf, ownerOf } from '#src/client/component.ts';\nimport { sameAs, toolButton } from '#src/client/dom.ts';\nimport { defineClientPlugin, type Target } from '#src/index.ts';\n\nimport { type About, atOf, attachedOf, COMPOSER_STYLE, composerIn, type Draft, element, onPage, type Seen } from './composer.ts';\nimport { drawerOf } from './drawer.ts';\nimport type { Model, Op, TaskAdded } from './index.ts';\nimport { pinsIn } from './pins.ts';\nimport { storeOf } from './store.ts';\nimport { whichOf } from './which.ts';\n\nconst STYLE = `\n.compose { flex: none; }\n.row { display: flex; gap: 6px; margin-top: 8px; justify-content: space-between; align-items: center; }\n/* Cut short: a channel's name and its watchers' may be long. */\n.hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--deictic-muted); font-size: 12px; }\n/* A dot as a task's state is: a ring while no one watches, green while someone does. */\n.watch::before { content: ''; display: inline-block; box-sizing: border-box; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; border: 1.5px solid var(--deictic-muted); }\n.watch.on::before { border-color: #4ade80; background: #4ade80; }\n.hint a { color: inherit; }\n.hint a:hover { color: var(--deictic-fg); }\n${COMPOSER_STYLE}`;\n\nconst TOOL_STYLE = `\n.task-tool button { position: relative; }\n.task-tool .count {\n position: absolute;\n top: -5px;\n right: -5px;\n box-sizing: border-box;\n min-width: 15px;\n height: 15px;\n padding: 0 4px;\n border-radius: 8px;\n font: 700 10px/15px system-ui, sans-serif;\n color: var(--deictic-on-accent);\n background: var(--deictic-accent);\n}\n.task-tool button[aria-pressed='true'] .count { color: var(--deictic-fg); background: #09090b; }\n`;\n/** A note with a plus: a task to add. */\nconst TASK = '<path d=\"M4 5h16v11H9l-5 4zM12 8v5M9.5 10.5h5\"/>';\n\n/** What the panel keeps while it's away recording: what's typed and asked for. What's attached is the tray's. */\ninterface Kept {\n text: string;\n /** Whether a shot was asked for, or asked not to be, where either was. */\n shot?: boolean;\n html: boolean;\n /** The page as the panel left, and its elements as that page had them: for a task added where the page has moved on. */\n page: string;\n viewport: Op['viewport'];\n about: { target: Target; own: boolean; seen: Seen }[];\n}\n\n/**\n * `#shadow-root > div.panel > div.head > button.tab:nth-of-type(2)`: where `inner` is inside `outer`, through\n * shadow roots, by tag, classes and, among siblings alike, place, for whoever finds it in the code.\n */\nfunction pathTo(inner: Element, outer: Element): string {\n const steps: string[] = [];\n for (let at: Element | undefined = inner; at !== undefined && at !== outer;) {\n const nameOf = (el: Element) => `${el.localName}${[...el.classList].map((c) => `.${c}`).join('')}`;\n const name = nameOf(at);\n const siblings = at.parentElement === null ? [] : [...at.parentElement.children];\n // Its place only where a sibling reads the same.\n const same = siblings.filter((c) => nameOf(c) === name).length > 1;\n const alike = siblings.filter((c) => c.localName === at!.localName);\n steps.unshift(same ? `${name}:nth-of-type(${alike.indexOf(at) + 1})` : name);\n if (at.parentElement !== null) {\n at = at.parentElement;\n } else {\n const root = at.getRootNode();\n if (!(root instanceof ShadowRoot)) break;\n steps.unshift('#shadow-root');\n at = root.host;\n }\n }\n return steps.join(' > ');\n}\n\nconst parentOf = (el: Element): Element | undefined => {\n if (el.parentElement !== null) return el.parentElement;\n const root = el.getRootNode();\n return root instanceof ShadowRoot ? root.host : undefined;\n};\n\n/** How many places a chain names after the element's own: who uses it, and who uses that. Further out is the app's shell. */\nconst CHAIN = 3;\n\n/**\n * The source `el` rendered through, after its own place, nearest first: a shared component's own line is the same\n * wherever it's used, and the change is most often in what uses it, or in what uses that.\n *\n * With React in development, those are the components that wrote it, each the one whose JSX has the one before:\n * `Field (src/Field.tsx:20)`, its line the nearest element around `el` that the component wrote, or the name alone\n * for one with no element of its own around it (it wraps what it uses only in other components), which the marks\n * can't show at all. A layout component the element was only passed through isn't among them.\n *\n * Without (another framework, a production build) it's read off the marks around it, each a `file:line`: the\n * nearest element each next file wrote.\n */\nfunction chainOf(el: Element, file: string): NonNullable<Op['chain']> {\n const found: NonNullable<Op['chain']> = [];\n const wrote = ownerOf(fiberOf(el));\n if (wrote !== undefined) {\n for (let owner = ownerOf(wrote); owner !== undefined && found.length < CHAIN; owner = ownerOf(owner)) {\n const name = componentOf(owner);\n let place: string | undefined;\n for (let at = parentOf(el); at !== undefined && place === undefined; at = parentOf(at)) {\n const by = ownerOf(fiberOf(at));\n // A component's fiber is one of two, by turns: an element may name either.\n if (by === undefined || (by !== owner && by !== owner.alternate)) continue;\n place = at.getAttribute('data-deictic')?.replace(/:\\d+$/, '');\n }\n if (name !== undefined) found.push(place === undefined ? name : `${name} (${place})`);\n else if (place !== undefined) found.push(place);\n }\n if (found.length > 0) return found;\n }\n let last = file;\n for (let at = parentOf(el); at !== undefined && found.length < CHAIN; at = parentOf(at)) {\n const mark = at.getAttribute('data-deictic');\n if (mark === null) continue;\n const from = mark.replace(/:\\d+:\\d+$/, '');\n if (from === last) continue;\n last = from;\n found.push(mark.replace(/:\\d+$/, ''));\n }\n return found;\n}\n\n/** What's sent of the element's HTML at most, in characters: the server attaches it as a file. */\nconst HTML = 100_000;\n\n/** The event the page hears of each added task by, on `window`: its `detail` is a `TaskAdded`. */\nexport const TASK_ADDED = 'deictic:task';\n\n/** Tells the page of a task just added: the newest of the element's tasks, as the board answered them. */\nfunction announce(model: Model, op: Op, target: Target, shots: string[]): void {\n const task = model.tasks.at(-1);\n if (task === undefined) return;\n const detail: TaskAdded = {\n id: task.id,\n title: task.title,\n state: task.state,\n channel: model.channel,\n target,\n page: op.page,\n attached: {\n screenshots: op.screenshots?.length ?? 0,\n recordings: op.recordings?.length ?? 0,\n voice: op.voice?.length ?? 0,\n marks: (op.annotations?.count ?? 0) + (op.screenshots ?? []).reduce((n, shot) => n + (shot.marks?.count ?? 0), 0),\n },\n screenshots: shots,\n };\n window.dispatchEvent(new CustomEvent(TASK_ADDED, { detail }));\n}\n\nexport default defineClientPlugin<Model, Op>({\n name: 'tasks',\n label: 'Task',\n // Its tool in the tool panel, after the others': what takes what they made. Picked, the next press on the page\n // opens the tab on that spot.\n setup: (context) => {\n const { tools, tray } = context;\n // The tasks there already, in the drawer.\n drawerOf(context);\n const group = element('div', { className: 'tool-group task-tool' });\n let picking = false;\n const button = toolButton(TASK, 'Task', 'T', () => {\n if (picking) return;\n picking = true;\n button.setAttribute('aria-pressed', 'true');\n void tools.pick().then((spot) => {\n picking = false;\n button.setAttribute('aria-pressed', 'false');\n if (spot !== undefined) context.open('tasks', spot.element, spot.at);\n });\n });\n button.setAttribute('aria-pressed', 'false');\n // How much is in the tray, for the task to take.\n const count = element('span', { className: 'count' });\n const counted = () => {\n const held = tray.list().length;\n count.textContent = String(held);\n count.hidden = held === 0;\n };\n tray.subscribe(counted);\n counted();\n button.append(count);\n group.append(element('style', { textContent: TOOL_STYLE }), button);\n // After the other tools that capture the page, as it takes what they made.\n tools.add(group, { section: 'capture', last: true });\n },\n // What the page before this left the tab for: a recording, where it carries on here.\n resume: ({ use }) => use('recordings')?.going(),\n // The page's tasks, where they are, while it's pointed on.\n pointing: (context) => pinsIn(context).glance(),\n mount: (panel, context) => {\n const style = element('style', { textContent: STYLE });\n const hint = element('span', { className: 'hint' });\n const row = element('div', { className: 'row' });\n row.append(hint);\n // The page's tasks, pinned where they are, while the tab is open too: not for a popup a page shows in place,\n // which is in a root of its own.\n const over = panel.getRootNode() === context.root;\n const unpin = over ? pinsIn(context).glance() : undefined;\n\n const shots = context.use('screenshots');\n // The page as the press that opened the popup froze it, rendered meanwhile: a shot taken as it's sent may have\n // missed a tooltip or a menu, which the popup's own pointer and focus close.\n const frozen = shots?.frozen(context.element);\n const recorder = context.use('recordings');\n const back = context.resumed;\n // The server half's `html` option, which takes the button away; a page half with no options (a `standalone` server's) has it.\n const sendsHtml = (context.options as { html?: boolean } | undefined)?.html !== false;\n const own = (): About[] => [{ target: context.target, own: true, el: context.element }];\n const inspector = context.use('react');\n /**\n * What React's DevTools would show of an element, where the react plugin is loaded: read now, while the page has\n * it, or as the panel left it. A read that fails leaves it out, not the task.\n */\n const reactOf = async (a: About): Promise<string | undefined> => {\n const el = onPage(a);\n if (el === undefined) return a.seen?.react;\n return inspector?.snapshot(el).catch((e: unknown) => {\n console.warn('deictic: the task goes without react.json', e);\n return undefined;\n });\n };\n\n /**\n * What the page says of an element: read now, while the page has it, and as the panel left it where the page\n * has moved on without it (a recording that went on to another), which is the page the task is about.\n */\n const seenOf = (a: About): Seen | undefined => {\n const el = onPage(a);\n if (el === undefined) return a.seen;\n const chain = chainOf(el, a.target.loc.file);\n const { pointed, at } = context;\n const masked = shots?.masked(el) ?? el;\n const alike = sameAs(el);\n return {\n // What was pointed at, and the spot, are the popup's own element's.\n ...(a.own && at !== undefined ? { point: at } : {}),\n ...(a.own && pointed !== undefined ? { pointed: { path: pathTo(pointed, el), html: pointed.outerHTML.slice(0, 4000) } } : {}),\n count: alike.length,\n ...(alike.length > 1 ? { which: whichOf(el, alike, masked) } : {}),\n ...(chain.length === 0 ? {} : { chain }),\n html: masked.outerHTML.slice(0, HTML),\n };\n };\n /** The page the task is about: this one, or the one the panel left where none of its elements is on this one. */\n const wherever = (about: About[]): Pick<Kept, 'page' | 'viewport'> => {\n if (back !== undefined && about.length > 0 && !about.some((a) => onPage(a) !== undefined)) {\n const { page, viewport } = back.state as Kept;\n return { page, viewport };\n }\n return { page: location.href, viewport: { width: innerWidth, height: innerHeight } };\n };\n\n // Record: the popup goes, the page is recorded, and it comes back with what's typed and the recording attached.\n const leave = async () => {\n if (recorder === undefined) return;\n composer.problem.textContent = '';\n if (recorder.recording()) {\n composer.problem.textContent = \"A recording is going already: stop it in the tool panel, and it's attached here\";\n return;\n }\n // A take going on is kept first, as a chip, to come back to with the rest.\n await composer.stopTake();\n const { text, shot, html, about } = composer.draft();\n const kept: Kept = {\n text,\n ...(shot === undefined ? {} : { shot }),\n html,\n ...wherever(about),\n about: (\n await Promise.all(\n about.map(async (a) => {\n const seen = seenOf(a);\n if (seen === undefined) return [];\n const react = sendsHtml && html ? await reactOf(a) : undefined;\n return [{ target: a.target, own: a.own, seen: { ...seen, ...(react === undefined ? {} : { react }) } }];\n }),\n )\n ).flat(),\n };\n context.away(kept, () => recorder.record());\n };\n\n const composer = composerIn(context, {\n placeholder: 'What should change here?',\n sendLabel: 'Add task',\n about: own,\n html: sendsHtml,\n ...(context.at === undefined ? {} : { at: context.at }),\n shoot: true,\n ...(frozen === undefined ? {} : { frozen }),\n // Back from a recording on a page without the element: nothing of it to shoot or draw on here.\n here: context.element.isConnected,\n over,\n record: () => void leave(),\n changed: () => mark(),\n submit: async (gathered) => {\n const { text, about, html: withHtml, screenshots } = gathered;\n // The first element is the task's place; the rest are named beside it; with none, it's the page's.\n const [first, ...rest] = about;\n const { html, react: _, ...said } = (first === undefined ? undefined : seenOf(first)) ?? { html: undefined, count: 0 };\n const htmlOf = (of: string | undefined) => (sendsHtml && withHtml && of !== undefined ? { html: of } : {});\n // Its components' props and state go with its HTML, as what the page had.\n const reactWith = async (a: About) => {\n const react = sendsHtml && withHtml ? await reactOf(a) : undefined;\n return react === undefined ? {} : { react };\n };\n const op: Op = {\n text,\n ...wherever(about),\n ...said,\n ...(first === undefined ? { detached: true } : {}),\n ...htmlOf(html),\n ...(first === undefined ? {} : await reactWith(first)),\n ...(rest.length === 0\n ? {}\n : {\n also: await Promise.all(\n rest.map(async (a) => ({ at: atOf(a.target), tag: a.target.tag, ...htmlOf(seenOf(a)?.html), ...(await reactWith(a)) })),\n ),\n }),\n ...attachedOf(gathered),\n };\n // Sent on its first element, which may not be the popup's.\n const on = first?.target ?? context.target;\n let model: Model;\n try {\n model = await context.apply(op, on);\n } catch {\n // The panel's status says why; what was typed and attached stays, to send again.\n return false;\n }\n // In the drawer and on its pin at once: the tab lists none.\n storeOf(context).load(true);\n announce(\n model,\n op,\n on,\n (screenshots ?? []).map((shot) => shot.url),\n );\n const added = model.tasks.at(-1);\n composer.note.textContent =\n first === undefined\n ? 'Added, about the page: it is in the drawer'\n : `Added${added === undefined ? '' : ` #${added.id}`}: it is in the drawer`;\n if (added?.dropped !== undefined) {\n // Open, to say so: the task went without something that was attached.\n composer.problem.textContent = `Sent without ${added.dropped}: it wasn't kept any more`;\n return true;\n }\n // Its pin and the drawer have it now. Once the composer has emptied (the tray, the page's marks), which it does as this answers.\n setTimeout(context.close);\n return true;\n },\n });\n panel.append(style, composer.el);\n composer.el.append(row);\n\n /** Tells the popup what leaving now would lose: the words of a new task, or a take. What's attached is the tray's, and stays. */\n const mark = () => context.unsaved(composer.pending() ? composer.send : undefined);\n /** Where a task goes, and whether it's taken up: the channel, and who watches it, or that no one does, where that's known. */\n const render = ({ channel, link, watching }: Model) => {\n const name =\n link === undefined\n ? element('span')\n : element('a', { href: link, target: '_blank', rel: 'noreferrer', title: 'Open the channel on the board' });\n name.textContent = `#${channel}`;\n hint.replaceChildren('to ', name);\n if (watching === undefined) return;\n const names = new Intl.ListFormat('en', { type: 'conjunction' }).format(watching);\n const on = watching.length > 0;\n const who = element('span', {\n className: on ? 'watch on' : 'watch',\n textContent: on ? `${names} watching` : 'no agent watching',\n title: on\n ? `${names} ${watching.length === 1 ? 'is' : 'are'} watching #${channel}, and take${watching.length === 1 ? 's' : ''} each task as it's added`\n : `A task waits on the board until an agent watches #${channel}: ask yours to watch deictic's tasks`,\n });\n hint.append(' · ', who);\n };\n\n // Back from recording: what was typed and asked for, and why there's no recording, where there's none.\n if (back !== undefined) {\n const kept = back.state as Kept;\n // Each element where this page has it, and as the page that had it said it where not.\n const about = kept.about.map(({ target, own: mine, seen }) => {\n const el = mine ? context.element : (document.querySelector(`[data-deictic=\"${CSS.escape(atOf(target))}\"]`) ?? undefined);\n return { target, own: mine, seen, ...(el === undefined ? {} : { el }) };\n });\n const draft: Draft = { text: kept.text, html: kept.html, about, ...(kept.shot === undefined ? {} : { shot: kept.shot }) };\n composer.restore(draft);\n if (back.problem !== undefined) composer.problem.textContent = back.problem;\n }\n\n render(context.model);\n composer.focus();\n return () => {\n unpin?.();\n composer.destroy();\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuC9B,MAAa,OAAO;;AAEpB,MAAM,SAAS;AACf,MAAM,OAAO;AACb,MAAa,MAAM;AACnB,MAAM,SAAS;AACf,MAAM,MAAM;AACZ,MAAM,OAAO;AACb,MAAM,SAAS;;AAEf,MAAM,QAAQ;;AAGd,MAAM,UAAU;;AAEhB,MAAM,OAAO;;AAEb,MAAM,OAAO;;AAGb,MAAM,QAAQ;CAAC;CAAe;CAAc;AAAO;AAEnD,SAAgB,QACd,KACA,QAA2C,CAAC,GAClB;CAC1B,OAAO,OAAO,OAAO,SAAS,cAAc,GAAG,GAAG,KAAK;AACzD;AAEA,MAAa,QAAQ,EAAE,UAAkB,GAAG,IAAI,KAAK,GA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