Skip to content

A local video studio for your coding agent. Describe a video in one sentence: your agent directs, your machine renders. Claude Code, Codex, Cursor, Devin and more. No API keys, no uploads.

showtime 0.4.3 (release candidate)

Favio Vázquez618bec6d2f45
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 18728ba..a991257 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -5,14 +5,14 @@
},
"metadata": {
"description": "showtime: a local video studio for your coding agent",
- "version": "0.4.2"
+ "version": "0.4.3"
},
"plugins": [
{
"name": "showtime",
"source": "./",
"description": "A local video studio for your coding agent. Describe a video. Your agent directs. Your machine renders. Motion graphics, voice-over, music, footage editing, captions and platform-ready exports, with no cloud AI services or API keys.",
- "version": "0.4.2",
+ "version": "0.4.3",
"author": {
"name": "Favio Vazquez"
},
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index a578e38..3a45c14 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "showtime",
- "version": "0.4.2",
+ "version": "0.4.3",
"description": "A local video studio for your coding agent. Describe a video. Your agent directs. Your machine renders. Motion graphics rendered frame-exactly, voice-over, music and sound design, footage editing from transcripts, captions and platform-ready exports. Everything runs on your machine.",
"author": {
"name": "Favio Vazquez"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 86aa6b7..6f44e83 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,120 @@ All notable changes to showtime. Each entry says what changed and why, so this f
`skills/showtime/lib/st/__init__.py` and `python3 scripts/check_release.py` keeps the plugin manifests, the registry files and
`setup/package.json` in sync with it.
+## 0.4.3 (2026-10-13)
+
+- **Recap and repro pick their music per video, and generated videos are quieter on the cuts.** Both used to get
+ the same bed and the same swoosh, click and error sounds every time. Now the bed is a catalog track picked from the
+ session or test, off the music of the last films (downloaded once from its creator's site and cached; nothing is
+ sent), or, offline with no cache, a composed style; the click and error sounds come from the subtle synth families.
+ A rerun of the same job keeps its bed, and `--music <style|catalog-id|none>` pins it. A catalog track's credit,
+ share text and Content ID note are printed and returned in `--json`, and repro puts the credit into `repro.md`; if
+ the download fails, a composed bed takes its place unless the track was pinned. Recap, repro, `release-video` and
+ `pr-video` no longer put a sound on every cut (`--cut-sounds` adds a soft swoosh, 18 dB under the bed); repro
+ keeps its click on a click and its failure tone. The bed under narration ducks 10 dB (was 12). The transition
+ sounds are softer everywhere: whoosh, swoosh-in and swoosh-out rise over 100-200 ms or more and are low-passed near
+ 3 kHz (swoosh-in 0.6 s, swoosh-out 0.7 s by default), and synth hits are cached under a synth version, so a
+ machine that rendered before gets the new sounds. Test: `test_bed.py`.
+- **Every render worker captures from a page set up like the first one.** Under load, a worker whose page opened
+ while one of its modules got no reply could render bare frames: in one nightly render, two of three workers drew
+ none of the looks. A page's setup (each component ready or not, each look on WebGL or its fallback, its failed
+ requests) is now compared with the first page's once it is ready; a page that differs is opened again, and when
+ the first page was the broken one the render stops with an error instead of shipping its frames. The soundtrack
+ page fails the same way when it misses the score, so a dropped module no longer ships a silent video. Failed
+ requests are listed in the render log. Test: `test_looks.py` (`test_07b_a_page_that_opened_short_is_opened_again`).
+- **New: `showtime recap` turns a Claude Code session into a 30-60 s narrated film of what the agent did.** It reads
+ one transcript (`--latest`, a `.jsonl` path or a session id; a sub-agent's own transcript works too, and a session's
+ recap covers that transcript only, not its sub-agents) and shows a title made from the facts ("42 min · 6 files
+ edited · red to green"), the numbers (active time, turns, tool calls, files), a living timeline of the files read
+ and edited and the commands and tests run, where the edits landed, the tests red to green, the diff and the outcome.
+ For pull request descriptions, standups and "what my agent did overnight" posts. Transcripts hold everything
+ (memory, keys printed by mistake, private paths, other projects), so the film is built from an allow-list of facts:
+ repository-relative paths of files inside the repository, program names from a fixed list with the program's own
+ subcommand (anything else counts as "other"; never a script or module path), test counts, commits whose printed hash
+ is in the repository's history and their git diff stats, and timestamps. Free text (the request, a sub-agent's
+ description) is only offered in `script.md` as a commented suggestion, never kept in `facts.json` or the project;
+ editing `script.md` is the only way to change what is on screen, and any line the user writes there goes through the
+ same strict rule. A hard filter then drops any line that still looks like a key, an absolute path, a URL, a host or
+ an e-mail address, or that holds an invisible format character (every line is judged NFKC-folded). Filters can miss
+ things, so a call that writes `script.md` (every line that will be shown or spoken) stops there, `--yes` included,
+ and the film is rendered only by a later call, from `script.md` as the user left it: narrated with `showtime voice`
+ and captioned, in a light paper look (`--no-voice`, `--aspect 9:16`, `--preview`). Its files go to
+ `showtime-out/recap-<session>` unless `--out` is given; that default is refused where git would track it. Guide:
+ `references/workflows/recap.md`.
+- **Living diagrams: `showtime new diagram` and the `/_st/diagram.js` runtime.** A system explained over time as an
+ isometric figure: parts arrive in the order that explains them, pipes and links join them by port name, flows,
+ packets, state changes and pulses move through them, labels land when their part matters, and the camera and a
+ focus veil choose what to look at. One engine, two themes: light (paper, the default) and dark (night schematic),
+ picked with `--theme` (the page's `data-theme`, `"theme"` and `"background"` in showtime.json). A parts library
+ covers machines (plate, wall cutaway, unit, compressor, tank, valve, cassette) and abstract systems (`node` with
+ person, school, bank, firm, server, terminal, hub, core, gate, files, lamp and tool icons; `stack`, `store`,
+ `queue`). Depth comes from a sort on the parts' boxes plus a port rule (a pipe on a back face is behind its
+ part), labels from a layout pass that scores candidate places at every camera pose and reports a collision where
+ the label lands, and any text that never shows fully inside the text safe zone, as `diagram:` warnings in
+ `showtime check`. Text is check-friendly by construction: persistent nodes, fades of at most 0.2 s, floor text
+ raised to the readable minimum, and text that fades out before the camera carries it off the frame. Beat times
+ live in a `CUE` table, so `--duration` and `showtime retime` move them; narrated films land beats on `VO` words.
+ The template starts as a heat pump; `--example market` (a matching market) and `--example enter` (a coding
+ agent's loop) start from the other scenes at their own length. The poster is a still at the end, never baked into
+ frame 0 (`"render": {"poster_bake": "off"}`). Guide: `references/workflows/diagram.md` (`showtime guide
+ diagram`). Test: `test_diagram.py`.
+- **New: a living diagram is also a live figure people poke: `showtime export html <project> --interactive`.** The
+ same scene, as one offline file (`<slug>-figure.html`, `--target artifact` for an HTML artifact): no play button
+ and no timeline. The board is built and moving from the first frame; hovering or tabbing to a part lights it and
+ its own pipes and links (the film's focus veil) and a card says what it is and its value; each step is an
+ experiment that runs on the board; knobs (a rule's strength, a promise's horizon) run the step again and the
+ levels, stacks and tags answer at once, with the numbers under the figure. Untouched, an idle tour of the same
+ live actions plays and stops at any touch. Keys, deep links to a state (`#step=cost&rule=3&part=infl`), reduced
+ motion (still; input works), a pause when hidden or off screen, a phone layout (words leave the drawing for the
+ panel), the scene's title in the page and its link preview. A scene declares what is live in `SCENE.interactive`
+ (steps, knobs, readouts, parts, a tour); the engine underneath is `Diagram.live` (`set`, `fire`, `focus`, `tone`,
+ `show`, `hit`), keys written at the moment the viewer acts, so every frame is still a pure function of the clock,
+ and films draw as before (apart from the two fixes below). A live-first scene films its own tour
+ (`interactive.film = 'tour'`). New theme `--theme white` (white ground, neutral greys, colour only where it means
+ something). `showtime check` walks `figure.html` at rest: every step x each knob value (every option; a range in
+ full up to 25 values, else 9 across it) x each hovered part, and the scene's keys, and reports cut or overlapping
+ text, broken readouts, links that open another state, and what the scene's `agree` finds (`figure_*`). The export
+ runs none of the project's code (it reads the scene's title as text) and writes the packed fonts' licences into
+ the file. Examples: `--example econ-lab` (households, firms and a central bank; every number from the
+ set-the-rate toy's results) and `--example enter` (the coding agent's loop: you answer the permission check). The
+ file carries every word and number of the scene, so publishing it shares all of that. Two engine fixes that show
+ in films too: a stack now shrinks when its count goes down, and flow dashes over a link of their own colour now
+ show. Guide: `references/workflows/diagram.md` § Interactive, `references/html-export.md` § Live figure. Test:
+ `test_interactive.py`.
+- **Diagram footers fade only the floor under them.** The fade under the footer lines (`page.footL`/`footR`) is now
+ a feathered SVG mask on the floor layer alone, so a tag, a part or floor text that sits next to a footer keeps its
+ full colour, and each hole follows its footer's `reveal`: a footer revealed later does not cut the floor before it
+ shows. An empty footer paints nothing. Test: `test_diagram.py` (in both themes).
+- **The site and the repository share one link-preview image.**
+- **Site: "How showtime is built" at `harness/`.** The crew's operating manual, public edition: who does what, on
+ which model and machine, and how a task becomes a merged PR or a film, in its own design inside the site's header
+ and footer (every page's footer links it). Its loops, posters and the 0.4.3 film are small files in
+ `examples/_harness/`; the page's body is `site/content/harness.html`, whose first line sets the address of the
+ article it links to.
+- **New: `showtime repro` turns a failing Playwright test into a short narrated video for a bug report.** From a
+ `trace.zip`, or the test command after `--` (run with tracing on failure), it shows each step on the trace's own
+ screenshots with a cursor and the target boxed, then the failing step slowed down with expected and received, the
+ error and the console errors, and writes `repro.md` to paste into the issue. It writes `script.md` and stops;
+ `--yes` renders it. Typed values are never shown or spoken (their fields are covered); paths are shortened to
+ the file name, URLs lose their query strings, and secrets are masked. Guide: `references/workflows/repro.md`. Test: `test_repro.py`.
+- **Docs and site for 0.4.3: the new features, with three demos and a live figure on the site.** The README has a
+ "New in 0.4.3" section (living diagrams and live figures, recap, repro, the render fix, music per video and quiet
+ cuts, the harness page), the new commands in its quick list and `diagram`, `recap` and `repro` in the command
+ table; What's new has a 0.4.3 section; three task guides for people (`docs/guides/session-recap.md`,
+ `bug-report-video.md`, `living-diagram.md`; the README now says fourteen); the glossary has "live figure" and
+ "living diagram"; the docs map and its pictures count seventeen workflows. Three demos join the gallery
+ (35 videos): `examples/_diagram` (the Enter loop film from `--example enter`, its live figure and the econ-lab
+ live figure), `examples/_recap` (the test session in `tests/fixtures/recap`, with its `script.md` and
+ `facts.json`) and `examples/_repro` (the fixture trace in `tests/fixtures/repro`, with `repro.md`), each with a
+ README loop and still, on the Explainers and Code and data shelves and in "New in 0.4". `site/build.py`: a card's
+ `Live figures:` links are its HTML, linked as "Live figure" and left out of the HTML videos list; the example page
+ embeds the first one in a room as wide as the page, so it keeps its desktop layout (the figure stacks under
+ 820 px), and 1120 px tall on a phone, where the board, the step and the steps fit without scrolling inside it;
+ inline code in prose wraps (a long fixture path widened phone pages to 456-480 px); the footer credits "With
+ These Hands" for the recap demo. The harness page says "new in 0.4.3" for living diagrams. Tests:
+ `test_site_build.py` (`test_live_figures_are_the_cards_html_not_its_videos`; 13 cards badged "New in 0.4"),
+ `test_site_search.py` (13 badges, five demos).
+
## 0.4.2 (2026-10-10)
- **On Windows, `audio mix` runs writing into one folder at once no longer fail with "permission denied".**
diff --git a/README.md b/README.md
index be01942..50d2d23 100644
--- a/README.md
+++ b/README.md
@@ -106,20 +106,20 @@ languages or what leaves your machine: the [FAQ](docs/faq.md). Something went wr
> quality (the default) has a critic review every finished video; lean skips the critic unless the video is going
> to be published. Say **"no crew"** to keep the whole job in one session.
-**What's new in 0.4.2** (the list is [below](#new-in-042), and [What's new](docs/whats-new.md) has a short
-paragraph for each group):
-
-- **A film in chapters, with one soundtrack.** `showtime render --chapters` plans the pieces and `--join` joins them
- with a soundtrack built once, so there are none of the loudness steps that joining separately mastered sections gave.
-- **Two render failures under load, fixed.** A browser window resized late no longer ruins a lane, and a frame that
- never comes is drawn again (render) or ends the check with an error, instead of stalling.
-- **More browsers without a GPU.** On an 8-thread machine without a GPU, `--workers auto` now picks 6 browsers
- instead of 3.
-- **Narration that fits, and more local voices.** `voice script --fit S --estimate` says up front whether the
- narration can fit, and extra local voice engines load by name.
-- **Help when something goes wrong.** A first-video guide, a troubleshooting page by symptom and a glossary
- ([your first video](docs/guides/first-video.md), [troubleshooting](docs/troubleshooting.md),
- [glossary](docs/glossary.md)).
+**What's new in 0.4.3** (the list is [below](#new-in-043), and [What's new](docs/whats-new.md) has a short
+paragraph for each):
+
+- **Living diagrams.** `showtime new diagram` explains a system over time as an isometric figure that builds
+ itself: parts arrive in the order that explains them, and flows, packets and labels move through them.
+- **Live figures.** `showtime export html <project> --interactive` turns the same scene into one offline page
+ people poke: hover a part, pick a step, turn a knob, and the numbers answer
+ ([try one](https://github.com/FavioVazquez/showtime-examples/blob/main/examples/_diagram/README.md)).
+- **A recap of your agent's session.** `showtime recap --latest` turns a Claude Code session into a 30-60 s
+ narrated film of what the agent did, built only from allow-listed facts, never the transcript's text.
+- **A failing test as a bug-report video.** `showtime repro` turns a Playwright trace into a narrated film of the
+ steps and the failure, with a Markdown summary for the issue; typed values are never shown.
+- **Steadier renders, quieter cuts.** Every render worker now captures from a page set up like the first one; recap
+ and repro pick their music per session or test, and generated videos no longer put a sound on every cut.
On the [behaviour scoreboard](#behaviour-scoreboard), 14 one-sentence requests were run 3 times each (42 runs). The
same model did the right thing 35 times with showtime and 25 times without. The cases check that it starts on
@@ -335,8 +335,8 @@ setup:
is the same server from npm ([@faviovazquez/showtime-mcp](https://www.npmjs.com/package/@faviovazquez/showtime-mcp),
also listed in the [MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.FavioVazquez/showtime)
as `io.github.FavioVazquez/showtime` and on [Smithery](https://smithery.ai/servers/favio-vazquezp/showtime)), and
-[`showtime-0.4.2.mcpb`](https://github.com/FavioVazquez/showtime/releases/download/v0.4.2/showtime-0.4.2.mcpb) from
-the v0.4.2 release opens in Claude Desktop with a double click. Setup still runs once on your machine: the
+[`showtime-0.4.3.mcpb`](https://github.com/FavioVazquez/showtime/releases/download/v0.4.3/showtime-0.4.3.mcpb) from
+the v0.4.3 release opens in Claude Desktop with a double click. Setup still runs once on your machine: the
models and tools never travel inside a package. Long tools answer with a task id after about 20 seconds when a
client stops calls early; the `status` tool reports progress and the result. Besides the tools that mirror the commands,
`guide` reads a reference by the piece and `receipt` writes a job's receipt (tokens and cost are "not reported by this
@@ -358,7 +358,7 @@ command line: `adopt`, `footage cutout`, `edit cards`, `edit moments`, `edit cli
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/readme/marquee-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="assets/readme/marquee-light.svg">
- <img alt="Now showing: 32 videos, every frame rendered by showtime." src="assets/readme/marquee-light.svg" width="100%">
+ <img alt="Now showing: 35 videos, every frame rendered by showtime." src="assets/readme/marquee-light.svg" width="100%">
</picture>
</p>
@@ -481,6 +481,14 @@ changed. Click a preview to open the example. Each one has a card with its promp
<td width="50%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/29-pr-video-showtime"><img src="assets/readme/gallery/29-pr-video-showtime.webp" width="400" alt="68 files changed, +1138 -159: a file tree with green and red bars, from showtime&#x27;s pull request #7."></a></td>
<td width="50%" valign="top"><b><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/29-pr-video-showtime">A pull request becomes a video</a></b> · 40 s, one command<br><sub><code>showtime pr-video 7</code> on showtime's own pull request: the PR's title and words, the files it changed with their +/- counts, a real hunk and its URL, secrets masked, a copy under GitHub's 10 MB attachment limit and the Markdown to paste.</sub></td>
</tr>
+<tr>
+<td width="50%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap"><img src="assets/readme/gallery/_recap.webp" width="400" alt="Red to green, from a Claude Code session: one red test run, then two green ones, and 12/12 test files passed."></a></td>
+<td width="50%" valign="top"><b><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap">A recap of an agent's session</a></b> · 37 s, narrated<br><sub><code>showtime recap</code> on showtime's test session: 17 minutes of an agent fixing a parser test as the numbers, a minute-by-minute timeline, the edit, the tests red to green and the commit, built from allow-listed facts only.</sub></td>
+</tr>
+<tr>
+<td width="50%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro"><img src="assets/readme/gallery/_repro.webp" width="400" alt="A failing Playwright step: the page says Welcome back, Ada; expected &quot;Welcome, Ada!&quot;, received &quot;Welcome back, Ada&quot;, and the console error."></a></td>
+<td width="50%" valign="top"><b><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro">A failing test as a bug-report video</a></b> · 34 s, narrated<br><sub><code>showtime repro</code> on a Playwright trace: each step on the trace's screenshots, the failure slowed down with expected and received, the typed values covered, and <code>repro.md</code> for the issue.</sub></td>
+</tr>
</table>
Two more kinds of developer video have a workflow but no example in this gallery yet: a **repo explainer** (what the
@@ -498,10 +506,11 @@ it (with gh, or from GitHub's API for a public one) and renders a video under 10
> The **HTML videos** are single files you can open in any browser, offline: the same frames as the
> MP4, a player with chapters, keyboard shortcuts, links to a moment or to a part that loops, questions
> that pause the video until the viewer answers, and no network requests. Make one from any project with
-> `showtime export html`. On GitHub, download the file to play it.
+> `showtime export html`. On GitHub, download the file to play it. A living diagram also exports as a live figure
+> (`--interactive`): no player, a board people hover, step through and tune, in one offline file.
<details>
-<summary><b>The 32 prompts behind the examples</b>: copy one into your agent</summary>
+<summary><b>The 35 prompts behind the examples</b>: copy one into your agent</summary>
| # | Prompt |
|---|---|
@@ -537,6 +546,9 @@ it (with gh, or from GitHub's API for a public one) and renders a video under 10
| [32](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/32-twelve-looks) | Show one project in each of the twelve look signatures: a contact sheet of all twelve, and a 24-second loop that changes look every 2 seconds. |
| [_looks](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_looks) | Show the seven WebGL looks in one short page, one scene each, rendered without a GPU. |
| [_blur](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_blur) | Show the shutter blur on four snaps: a whip, a slam, a scale punch, and the same whip without and with it. |
+| [_diagram](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_diagram) | Show what happens when you press Enter in a coding agent, as a diagram that builds itself, and a live version people can poke. |
+| [_recap](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap) | Make a short video of what my agent did in this Claude Code session. |
+| [_repro](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro) | Turn this failing Playwright test into a video I can attach to the bug report. |
</details>
@@ -806,7 +818,8 @@ video until the viewer answers ([guide](skills/showtime/references/html-export.m
Also: 30 motion components (seven of them WebGL looks), 26 transitions (15 CSS, 11 WebGL) and 6 themes, 12 look signatures that new
dom, launch, short and data projects start in (a palette, a type pair and a motion feel, picked away from your
-recent videos; `showtime signature`), a showreel template for a dense 15-second reel, website capture
+recent videos; `showtime signature`), a showreel template for a dense 15-second reel, living diagrams (a system as an isometric figure that builds itself,
+also exported as a live figure people poke), website capture
(screenshots, copy, brand colours and fonts), scripted app recordings with smooth auto-zoom, cursor and keycaps, PDF import, CSV and JSON to charts, a brand kit, posters baked into frame
0, exports for YouTube, X, LinkedIn, Reels, TikTok, Shorts and square feeds, README loops (animated WebP
and GIF, like the previews on this page), credits written automatically when an asset needs
@@ -820,7 +833,7 @@ Claude Design export (`showtime adopt`), and a receipt for every job.
| Group | Commands |
|---|---|
-| Make | `new` (templates: data, dom, film, launch, series, short, showreel, tutorial, manim), `adopt`, `release-video`, `pr-video`, `retime`, `data`, `preview`, `render`, `export`, `check`, `snap`, `look`, `score`, `motion`, `code`, `server`, `manim` |
+| Make | `new` (templates: data, diagram, dom, film, launch, series, short, showreel, tutorial, manim), `adopt`, `release-video`, `pr-video`, `recap`, `repro`, `retime`, `data`, `preview`, `render`, `export`, `check`, `snap`, `look`, `score`, `motion`, `code`, `server`, `manim` |
| Audio | `audio compose`, `sfx`, `lib`, `beats`, `fit`, `mix`, `meter`, `master` |
| Voice | `voice say`, `voice script` (narration with word timings, fitted to a length) |
| Footage | `transcribe`, `pack`, `edit` (`cut`, `check`, `render`, `view`, `cards`, `moments`, `clips`), `captions`, `footage` (`scenes`, `reframe`, `cutout`, `denoise`, `stabilize`, `grade` and more), `autozoom` |
@@ -848,6 +861,10 @@ showtime adopt my-page/ # a page that already has seek(t) g
showtime adopt design-html.zip # a Claude Design animation's HTML export to a 1080p video, its fonts local
showtime release-video notes.md -o my-video # release notes to a ready-to-render project, no agent needed
showtime pr-video 123 # a pull request to a video under 10 MB for its description
+showtime recap --latest # this folder's newest Claude Code session as a short film: script.md first, then --yes
+showtime repro -- npx playwright test tests/login.spec.ts # a failing test as a bug-report video: script.md first, then --yes
+showtime new diagram how-it-works --example enter # a living diagram: a system that builds and explains itself
+showtime export html how-it-works --interactive # the same scene as a live figure people poke, one offline file
showtime review open my-job # a local page to leave notes on frames or stretches of the finished video
showtime edit cards suggest edit/transcripts/talk.json # moments in a talking head for cards (name tag, quote, list)
showtime footage cutout talk.mp4 # the speaker cut out on the CPU: a video with alpha, a matte, a sheet
@@ -899,6 +916,69 @@ detectors on it, so a near-black scene or a barely visible change is reported be
<img alt="" src="assets/readme/divider-light.svg" width="100%">
</picture>
+## New in 0.4.3
+
+[What's new](docs/whats-new.md) has a short paragraph for each.
+
+<table>
+<tr>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_diagram"><img src="assets/readme/gallery/_diagram.webp" width="260" alt="The Enter loop at work: your machine with the terminal, Claude Code, Bash and a permission check, a request flying up to a glass cube labelled cloud."></a><br><b>Living diagrams and live figures</b></td>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap"><img src="assets/readme/gallery/_recap.webp" width="260" alt="Red to green, from a Claude Code session: one red test run, then two green ones, and 12/12 test files passed."></a><br><b>A recap of your agent's session</b></td>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro"><img src="assets/readme/gallery/_repro.webp" width="260" alt="A failing Playwright step: the page says Welcome back, Ada; expected &quot;Welcome, Ada!&quot;, received &quot;Welcome back, Ada&quot;, and the console error."></a><br><b>A failing test as a video</b></td>
+</tr>
+</table>
+
+**Explain a system**
+
+- **Living diagrams.** `showtime new diagram` draws a system as an isometric figure that builds itself over time:
+ parts arrive in the order that explains them, pipes and links join them, flows, packets and state changes move
+ through them, labels land when their part matters, and the camera chooses what to look at. Light, dark or white;
+ `--example enter` (a coding agent's loop), `--example market` and `--example econ-lab` start from finished scenes.
+ `showtime check` reports a label that collides or never shows whole
+ ([diagram](skills/showtime/references/workflows/diagram.md), issue #51).
+- **Live figures.** `showtime export html <project> --interactive` writes the same scene as one offline file,
+ `<slug>-figure.html`: no play button, the board is live from the first frame. Hover a part to light it and read
+ its value, pick a step to run it as an experiment on the board, turn a knob and the levels and numbers answer at
+ once; untouched, a short tour plays. Keys, deep links to a state (`#step=cost&rule=3`), reduced motion, a phone
+ layout and no network requests. `showtime check` walks every step, knob value and hovered part for cut or
+ overlapping text and broken readouts ([html-export § Live figure](skills/showtime/references/html-export.md#live-figure),
+ [the demo, live on the site](https://faviovazquez.github.io/showtime/examples/_diagram.html)).
+
+**From your agent's work**
+
+- **`showtime recap`.** A Claude Code session becomes a 30-60 s narrated film of what the agent did: the time, turns
+ and tool calls, a timeline of the files it read and edited and the commands and tests it ran, the tests red to
+ green and the diff from git. It reads the session log on your machine through an allow-list of facts
+ (repository-relative paths, program names from a fixed list, test counts, git stats), never the transcript's own
+ text; a filter drops anything that still looks like a key, a path, a URL or an e-mail address, and nothing renders
+ until you have read `script.md` ([recap](skills/showtime/references/workflows/recap.md)).
+- **`showtime repro`.** A failing Playwright test (its `trace.zip`, or the test command) becomes a narrated
+ bug-report video: each step on the trace's screenshots with a cursor and the target boxed, then the failure slowed
+ down with expected and received, plus `repro.md` to paste into the issue. Typed values are never shown or spoken
+ (their fields are covered); paths are shortened to the file name, URLs lose their query strings, and secrets are
+ masked ([repro](skills/showtime/references/workflows/repro.md)).
+
+**Render, sound and the site**
+
+- **Every render worker captures from a page set up like the first one.** Under load, a worker whose page opened
+ while one of its modules got no reply could render bare frames. Each page's setup is now compared with the first
+ page's, and a page that differs is opened again; if the first page was the broken one, the render stops with an
+ error instead of shipping its frames (issue #52).
+- **Music per video, and quiet cuts.** Recap and repro pick their bed from the music catalog (or a composed style
+ offline) per session or test, so two films do not sound the same; a rerun keeps its bed, `--music` pins one, and a
+ CC BY track's credit is written for you. A catalog track is downloaded once from its creator's site and cached;
+ nothing is sent, and `--music <style>` or `SHOWTIME_OFFLINE=1` keeps the whole film local. Recap, repro,
+ `release-video` and `pr-video` no longer put a sound on every cut (`--cut-sounds` adds a soft swoosh back), and the
+ transition sounds are softer everywhere.
+- **How showtime is built.** A new page on the site, [how showtime is built](https://faviovazquez.github.io/showtime/harness/),
+ is the crew's operating manual: who does what, and how a task becomes a merged pull request or a film (issue #53).
+ The site and the repository share one link-preview image (issue #54).
+
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="assets/readme/divider-dark.svg">
+ <img alt="" src="assets/readme/divider-light.svg" width="100%">
+</picture>
+
## New in 0.4.2
[What's new](docs/whats-new.md) has a short paragraph for each group of them.
@@ -1459,15 +1539,15 @@ language, a CPU limit) and the render progress monitor.
<p align="center"><picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/readme/diagrams/docs-map-dark.svg">
- <img alt="The documentation map: fourteen workflows (launch video, explainer, tutorial, social short, data story, footage edit, trailer, slideshow, changelog video, music video, voice-over only, localize, repo explainer, paper explainer), then five acts and a finale of guides, from onboarding to qa and review." src="assets/readme/diagrams/docs-map-light.svg" width="100%">
+ <img alt="The documentation map: seventeen workflows (launch video, explainer, tutorial, social short, data story, footage edit, trailer, slideshow, changelog video, music video, voice-over only, localize, repo explainer, paper explainer, repro, diagram, recap), then five acts and a finale of guides, from onboarding to qa and review." src="assets/readme/diagrams/docs-map-light.svg" width="100%">
</picture></p>
-For people: [ten task guides](docs/guides/README.md) (what to say to your agent, what it runs, what you get, how
+For people: [fourteen task guides](docs/guides/README.md) (what to say to your agent, what it runs, what you get, how
long it takes), [What's new](docs/whats-new.md) (each release in one sentence a feature) and the [FAQ](docs/faq.md)
(GPUs, cost, agents, privacy, licences, disk, time, platforms, languages).
The [documentation map](docs/README.md) is the way in: every guide, grouped by what you are making, from
-workflows (launch, explainer, tutorial, social, data, footage, trailer) to story and craft, sound and
+workflows (launch, explainer, tutorial, social, data, footage, trailer, diagram, recap, repro) to story and craft, sound and
voice, rendering, and QA. The glossary is in [CONTEXT.md](CONTEXT.md), and what showtime deliberately
does not do, and why, is in [.out-of-scope/](.out-of-scope/README.md).
diff --git a/assets/readme/diagrams/docs-map-dark.svg b/assets/readme/diagrams/docs-map-dark.svg
index 16d4be2..eb4b67b 100644
--- a/assets/readme/diagrams/docs-map-dark.svg
+++ b/assets/readme/diagrams/docs-map-dark.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 770" width="1600" height="770" role="img" aria-labelledby="t d"><title id="t">The documentation map</title><desc id="d">Every showtime guide in running order: Choose your path : launch-video, explainer, tutorial, social-short, data-story, footage-edit, trailer, slideshow, changelog-video, music-video, voiceover-only, localize, repo-explainer, paper-explainer; Act I Before the curtain: agents, onboarding, modes, studio, boards, crew, looking, GitHub Action, harness-notes, mcp, diagnosing; Act II Story and craft: story, tones, pacing, motion-craft, typography, color, brand-kit, reference, platforms; Act III Building the picture: render, stage-api, components, transitions, adopt, film-api, series, manim, html-export, debugging-renders; Act IV Sound and voice: audio, music, synth-score, sound-design, voice; Act V Footage, capture and assets: editing, captions, footage-tools, capture, tutorial-recording, assets; Finale Proof it is done: qa, review, receipt</desc><style>@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i7-A" d="M49 0 558 -1490H958L1480 0H1141L902 -719Q859 -858 814 -1024Q770 -1189 721 -1385H788Q740 -1188 698 -1022Q657 -855 616 -719L386 0ZM367 -346V-585H1162V-346Z"/><path id="i7-C" d="M786 20Q588 20 432 -70Q275 -160 184 -331Q94 -502 94 -744Q94 -987 185 -1158Q276 -1330 433 -1420Q590 -1510 786 -1510Q913 -1510 1022 -1474Q1132 -1439 1217 -1371Q1302 -1303 1356 -1204Q1410 -1106 1427 -980H1118Q1108 -1042 1080 -1090Q1051 -1137 1008 -1170Q966 -1204 911 -1222Q856 -1239 792 -1239Q676 -1239 588 -1181Q501 -1123 452 -1012Q404 -902 404 -744Q404 -583 453 -473Q502 -363 589 -307Q676 -251 791 -251Q855 -251 910 -268Q964 -286 1008 -320Q1051 -353 1080 -401Q1108 -449 1119 -510H1428Q1416 -406 1366 -311Q1317 -216 1235 -141Q1153 -66 1040 -23Q927 20 786 20Z"/><path id="i7-E" d="M135 0V-1490H1132V-1237H440V-877H1080V-628H440V-253H1134V0Z"/><path id="i7-F" d="M135 0V-1490H1115V-1237H440V-821H1049V-572H440V0Z"/><path id="i7-H" d="M135 0V-1490H440V-888H1089V-1490H1395V0H1089V-635H440V0Z"/><path id="i7-I" d="M440 -1490V0H135V-1490Z"/><path id="i7-K" d="M360 -337V-615Q406 -698 450 -768Q494 -838 547 -908Q600 -979 668 -1062L1033 -1490H1406L777 -762L752 -771ZM135 0V-1490H440V-1083L435 -703L440 -554V0ZM1061 0 619 -672 812 -900 1422 0Z"/><path id="i7-L" d="M135 0V-1490H440V-253H1083V0Z"/><path id="i7-N" d="M135 0V-1490H475L946 -736Q982 -678 1019 -610Q1056 -542 1094 -459Q1133 -376 1171 -272H1140Q1133 -355 1128 -449Q1122 -543 1118 -629Q1114 -715 1114 -775V-1490H1426V0H1085L657 -684Q610 -761 570 -834Q530 -906 486 -994Q443 -1081 383 -1203H422Q428 -1095 434 -996Q440 -897 444 -816Q447 -736 447 -685V0Z"/><path id="i7-O" d="M789 20Q592 20 434 -70Q277 -160 186 -331Q94 -502 94 -744Q94 -987 186 -1158Q277 -1330 434 -1420Q592 -1510 789 -1510Q987 -1510 1144 -1420Q1301 -1330 1392 -1158Q1484 -987 1484 -744Q1484 -502 1392 -331Q1301 -160 1144 -70Q987 20 789 20ZM789 -251Q905 -251 992 -308Q1078 -364 1126 -474Q1174 -585 1174 -744Q1174 -905 1126 -1016Q1078 -1126 992 -1182Q905 -1239 789 -1239Q674 -1239 587 -1182Q500 -1125 452 -1014Q404 -904 404 -744Q404 -585 452 -475Q500 -365 587 -308Q674 -251 789 -251Z"/><path id="i7-P" d="M135 0V-1490H716Q886 -1490 1005 -1426Q1124 -1361 1186 -1248Q1249 -1134 1249 -987Q1249 -839 1186 -726Q1122 -614 1002 -550Q881 -487 709 -487H335V-733H660Q754 -733 814 -766Q875 -798 904 -855Q934 -912 934 -987Q934 -1062 904 -1118Q875 -1175 814 -1206Q753 -1238 659 -1238H440V0Z"/><path id="i7-R" d="M135 0V-1490H716Q886 -1490 1005 -1430Q1124 -1370 1186 -1261Q1249 -1152 1249 -1005Q1249 -858 1186 -752Q1122 -645 1002 -588Q881 -532 709 -532H315V-779H660Q754 -779 814 -804Q874 -830 904 -880Q934 -931 934 -1005Q934 -1081 904 -1132Q874 -1184 814 -1211Q753 -1238 659 -1238H440V0ZM964 0 601 -678H932L1302 0Z"/><path id="i7-S" d="M681 22Q502 22 370 -33Q237 -88 163 -196Q89 -304 85 -462H382Q388 -387 427 -336Q466 -286 531 -261Q596 -236 678 -236Q760 -236 820 -260Q881 -283 915 -326Q949 -369 949 -426Q949 -477 918 -512Q888 -546 831 -571Q774 -596 692 -615L528 -656Q339 -702 232 -800Q125 -899 125 -1061Q125 -1196 198 -1297Q270 -1398 396 -1454Q523 -1510 685 -1510Q850 -1510 973 -1454Q1096 -1397 1165 -1296Q1234 -1196 1236 -1065H941Q933 -1155 864 -1204Q796 -1253 682 -1253Q605 -1253 550 -1231Q495 -1209 466 -1170Q438 -1131 438 -1081Q438 -1026 471 -990Q504 -953 559 -930Q614 -908 676 -893L811 -860Q905 -839 986 -803Q1067 -767 1128 -714Q1189 -662 1222 -590Q1256 -518 1256 -424Q1256 -289 1188 -188Q1120 -88 991 -33Q862 22 681 22Z"/><path id="i7-T" d="M75 -1237V-1490H1292V-1237H837V0H531V-1237Z"/><path id="i7-U" d="M749 21Q565 21 426 -48Q288 -116 212 -238Q135 -360 135 -523V-1490H440V-548Q440 -461 478 -394Q517 -326 586 -288Q656 -249 749 -249Q843 -249 912 -288Q982 -326 1020 -394Q1059 -461 1059 -548V-1490H1365V-523Q1365 -360 1288 -238Q1211 -116 1072 -48Q934 21 749 21Z"/><path id="i7-V" d="M571 0 49 -1490H388L626 -771Q669 -635 713 -472Q757 -308 806 -114H740Q788 -310 830 -472Q872 -635 913 -771L1143 -1490H1480L970 0Z"/><path id="i7-W" d="M449 0 49 -1490H382L555 -757Q576 -665 594 -560Q611 -456 628 -350Q645 -245 661 -148H607Q625 -245 643 -350Q661 -456 680 -560Q699 -665 722 -757L904 -1490H1221L1402 -757Q1425 -665 1444 -560Q1463 -456 1482 -350Q1500 -245 1518 -148H1462Q1479 -245 1496 -350Q1512 -456 1530 -560Q1549 -665 1569 -757L1742 -1490H2076L1675 0H1327L1129 -762Q1097 -889 1074 -1037Q1052 -1185 1024 -1342H1100Q1069 -1189 1050 -1043Q1030 -897 995 -762L798 0Z"/><path id="i7-Y" d="M601 0V-560L49 -1490H406L658 -1026Q697 -956 727 -887Q757 -818 789 -722H722Q753 -819 782 -888Q811 -957 848 -1026L1092 -1490H1448L905 -560V0Z"/><path id="i7-four" d="M101 -265V-506L724 -1490H931V-1154H808L409 -523V-511H1293V-265ZM814 0V-338L820 -446V-1490H1107V0Z"/><path id="i7-one" d="M749 -1490V0H444V-1221H434L93 -979V-1259L422 -1490Z"/><path id="i7-periodcentered" d="M342 -535Q269 -535 219 -584Q169 -634 169 -707Q169 -780 219 -830Q269 -879 342 -879Q415 -879 465 -830Q515 -780 515 -707Q515 -634 465 -584Q415 -535 342 -535Z"/><path id="m5-A" d="M43 0 229 -730H371L557 0H448L404 -185H197L153 0ZM217 -274H383L333 -485Q320 -541 311 -582Q303 -624 300 -639Q297 -624 289 -583Q281 -541 267 -486Z"/><path id="m5-G" d="M304 10Q236 10 185 -16Q135 -41 107 -90Q80 -138 80 -203V-527Q80 -593 107 -641Q135 -689 185 -714Q236 -740 304 -740Q372 -740 422 -714Q472 -688 500 -640Q527 -593 527 -527H419Q419 -584 389 -614Q359 -644 304 -644Q249 -644 218 -614Q188 -584 188 -528V-203Q188 -147 218 -116Q249 -85 304 -85Q359 -85 389 -116Q419 -147 419 -203V-285H283V-380H527V-203Q527 -138 500 -90Q472 -42 422 -16Q372 10 304 10Z"/><path id="m5-H" d="M85 0V-730H193V-428H407V-730H515V0H407V-328H193V0Z"/><path id="m5-a" d="M245 10Q159 10 110 -35Q60 -79 60 -156Q60 -234 112 -279Q165 -323 257 -323H410V-374Q410 -419 382 -444Q354 -469 303 -469Q258 -469 228 -450Q198 -430 193 -398H87Q96 -472 155 -516Q215 -560 306 -560Q404 -560 461 -510Q518 -461 518 -376V0H413V-101H395L413 -121Q413 -61 367 -25Q321 10 245 10ZM277 -73Q335 -73 373 -102Q410 -132 410 -178V-250H259Q217 -250 193 -227Q168 -204 168 -164Q168 -122 197 -97Q226 -73 277 -73Z"/><path id="m5-b" d="M339 10Q271 10 231 -27Q191 -65 191 -130L214 -105H191V0H84V-730H192V-573L189 -445H214L191 -420Q191 -485 231 -522Q272 -560 339 -560Q422 -560 472 -504Q522 -448 522 -352V-197Q522 -102 472 -46Q422 10 339 10ZM302 -84Q355 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q355 -466 302 -466Q251 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q251 -84 302 -84Z"/><path id="m5-c" d="M304 10Q236 10 184 -16Q133 -41 105 -90Q78 -138 78 -203V-347Q78 -413 105 -461Q133 -509 184 -534Q236 -560 304 -560Q403 -560 463 -508Q523 -456 526 -366H418Q415 -413 385 -439Q355 -465 304 -465Q249 -465 217 -435Q185 -404 185 -348V-203Q185 -147 217 -116Q249 -85 304 -85Q355 -85 385 -111Q415 -137 418 -184H526Q523 -94 463 -42Q403 10 304 10Z"/><path id="m5-d" d="M261 10Q178 10 128 -46Q78 -102 78 -197V-352Q78 -448 128 -504Q178 -560 261 -560Q329 -560 369 -522Q409 -485 409 -420L386 -445H411L408 -573V-730H516V0H409V-105H386L409 -130Q409 -65 369 -27Q329 10 261 10ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 215 -436Q185 -405 185 -347V-203Q185 -145 215 -114Q245 -84 298 -84Z"/><path id="m5-e" d="M300 10Q233 10 183 -16Q132 -43 105 -91Q78 -139 78 -203V-347Q78 -412 105 -459Q132 -507 183 -534Q233 -560 300 -560Q368 -560 418 -534Q468 -507 495 -459Q522 -412 522 -347V-249H182V-203Q182 -142 213 -110Q243 -78 301 -78Q348 -78 377 -94Q406 -111 413 -143H520Q508 -73 448 -32Q388 10 300 10ZM418 -314V-348Q418 -408 388 -441Q358 -474 300 -474Q243 -474 212 -441Q182 -408 182 -347V-322L426 -323Z"/><path id="m5-f" d="M213 0V-394H57V-492H213V-581Q213 -650 257 -690Q301 -730 377 -730H538V-634H379Q351 -634 336 -620Q320 -606 320 -580V-492H538V-394H320V0Z"/><path id="m5-g" d="M156 180V87H325Q367 87 388 67Q408 47 408 8V-47L410 -149H387L409 -169Q409 -106 370 -70Q330 -34 263 -34Q178 -34 129 -90Q80 -146 80 -241V-353Q80 -448 129 -504Q178 -560 263 -560Q330 -560 370 -524Q409 -487 409 -424L387 -445H409L408 -550H515V10Q515 89 465 134Q415 180 326 180ZM298 -127Q349 -127 379 -159Q408 -190 408 -246V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-246Q188 -189 216 -158Q245 -127 298 -127Z"/><path id="m5-h" d="M84 0V-730H192V-550L191 -445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -438Q352 -468 302 -468Q251 -468 222 -436Q192 -405 192 -347V0Z"/><path id="m5-hyphen" d="M140 -281V-379H460V-281Z"/><path id="m5-i" d="M81 0V-98H274V-452H106V-550H379V-98H556V0ZM316 -645Q281 -645 260 -664Q240 -682 240 -713Q240 -745 260 -763Q281 -782 316 -782Q352 -782 373 -763Q393 -745 393 -713Q393 -682 373 -664Q352 -645 316 -645Z"/><path id="m5-k" d="M87 0V-730H195V-329H292L438 -550H560L385 -286L563 0H439L292 -236H195V0Z"/><path id="m5-l" d="M379 0Q328 0 290 -21Q252 -41 230 -79Q209 -117 209 -167V-632H29V-730H317V-167Q317 -135 335 -116Q353 -98 384 -98H554V0Z"/><path id="m5-m" d="M59 0V-550H149V-480H169L154 -459Q154 -505 179 -533Q204 -560 246 -560Q291 -560 315 -525Q340 -490 340 -429L316 -480H354L338 -459Q338 -505 363 -533Q389 -560 432 -560Q483 -560 512 -521Q541 -483 541 -419V0H445V-416Q445 -447 432 -464Q418 -481 393 -481Q368 -481 355 -464Q341 -448 341 -417V0H260V-416Q260 -448 246 -464Q232 -481 206 -481Q181 -481 168 -464Q156 -448 156 -417V0Z"/><path id="m5-n" d="M84 0V-550H191V-445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -437Q352 -466 302 -466Q251 -466 222 -436Q192 -405 192 -347V0Z"/><path id="m5-o" d="M300 9Q232 9 182 -17Q132 -43 105 -91Q78 -139 78 -204V-346Q78 -412 105 -459Q132 -507 182 -533Q232 -559 300 -559Q368 -559 418 -533Q468 -507 495 -459Q522 -412 522 -346V-204Q522 -139 495 -91Q468 -43 418 -17Q368 9 300 9ZM300 -86Q355 -86 385 -117Q415 -147 415 -204V-346Q415 -404 385 -434Q355 -464 300 -464Q246 -464 216 -434Q185 -404 185 -346V-204Q185 -147 216 -117Q246 -86 300 -86Z"/><path id="m5-p" d="M84 180V-550H191V-445H214L191 -420Q191 -485 231 -523Q272 -560 340 -560Q423 -560 473 -504Q522 -449 522 -353V-198Q522 -134 500 -88Q477 -41 437 -15Q396 10 340 10Q273 10 232 -28Q191 -65 191 -130L214 -105H189L192 23V180ZM303 -84Q356 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q356 -466 303 -466Q252 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q252 -84 303 -84Z"/><path id="m5-q" d="M408 180V23L411 -105H386L409 -130Q409 -65 369 -28Q329 10 261 10Q178 10 129 -46Q80 -102 80 -198V-353Q80 -449 129 -504Q178 -560 261 -560Q329 -560 369 -523Q409 -485 409 -420L386 -445H409V-550H516V180ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-203Q188 -145 216 -114Q245 -84 298 -84Z"/><path id="m5-r" d="M102 0V-550H206V-445H232L199 -380Q199 -469 238 -515Q277 -560 354 -560Q442 -560 494 -505Q545 -451 545 -356V-319H434V-347Q434 -406 404 -438Q375 -469 322 -469Q269 -469 240 -437Q210 -405 210 -347V0Z"/><path id="m5-s" d="M281 9Q222 9 177 -10Q133 -29 107 -63Q82 -96 78 -142H186Q190 -115 215 -99Q240 -82 281 -82H324Q373 -82 398 -102Q423 -122 423 -155Q423 -187 400 -205Q378 -224 334 -230L263 -241Q175 -255 134 -291Q92 -328 92 -400Q92 -476 141 -517Q191 -559 288 -559H326Q412 -559 463 -520Q515 -480 522 -414H414Q410 -438 387 -453Q365 -468 326 -468H288Q241 -468 220 -450Q198 -433 198 -399Q198 -369 217 -354Q236 -339 276 -333L349 -321Q442 -308 485 -269Q529 -231 529 -158Q529 -79 478 -35Q426 9 324 9Z"/><path id="m5-t" d="M360 0Q285 0 243 -41Q201 -82 201 -155V-452H49V-550H201V-705H309V-550H524V-452H309V-155Q309 -98 364 -98H514V0Z"/><path id="m5-u" d="M299 10Q200 10 141 -48Q82 -105 82 -204V-550H190V-204Q190 -147 219 -116Q248 -84 299 -84Q351 -84 380 -116Q410 -147 410 -204V-550H518V-204Q518 -105 458 -47Q399 10 299 10Z"/><path id="m5-v" d="M229 0 47 -550H157L270 -198Q281 -167 289 -136Q298 -104 302 -86Q307 -104 316 -136Q324 -167 333 -198L444 -550H553L371 0Z"/><path id="m5-w" d="M113 0 28 -550H119L170 -187Q174 -162 177 -131Q181 -101 183 -81Q185 -101 190 -131Q194 -161 198 -187L255 -550H346L402 -187Q406 -161 410 -131Q415 -100 417 -80Q419 -101 424 -131Q428 -162 432 -187L484 -550H572L484 0H370L316 -359Q312 -387 307 -418Q302 -450 300 -469Q297 -450 293 -418Q288 -387 284 -359L228 0Z"/><path id="m5-x" d="M43 0 236 -284 55 -550H179L276 -398Q283 -386 290 -372Q297 -359 301 -350Q304 -359 311 -372Q318 -386 325 -398L422 -550H546L365 -283L557 0H433L326 -165Q319 -177 312 -192Q305 -207 301 -216Q297 -207 289 -192Q282 -177 274 -165L166 0Z"/><path id="m5-y" d="M172 180 251 -32 46 -550H165L280 -240Q287 -220 294 -192Q301 -164 306 -146Q310 -164 317 -192Q324 -220 331 -240L439 -550H554L286 180Z"/><path id="m8-a" d="M229 10Q146 10 98 -35Q49 -80 49 -157Q49 -240 106 -284Q164 -329 272 -329H386V-370Q386 -402 364 -421Q341 -440 303 -440Q268 -440 245 -424Q222 -408 217 -380H72Q81 -463 144 -512Q208 -560 308 -560Q413 -560 474 -508Q536 -457 536 -370V0H391V-90H367L392 -125Q392 -63 347 -26Q303 10 229 10ZM285 -100Q329 -100 358 -124Q386 -147 386 -185V-244H275Q241 -244 220 -224Q199 -205 199 -173Q199 -139 222 -120Q245 -100 285 -100Z"/><path id="m8-c" d="M303 10Q230 10 175 -18Q120 -45 90 -94Q60 -144 60 -210V-340Q60 -407 90 -456Q120 -505 175 -532Q230 -560 303 -560Q412 -560 477 -505Q542 -450 546 -355H396Q393 -390 368 -410Q344 -430 303 -430Q258 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q258 -120 303 -120Q344 -120 368 -140Q393 -159 396 -195H546Q542 -100 477 -45Q412 10 303 10Z"/><path id="m8-d" d="M243 10Q160 10 110 -48Q60 -106 60 -205V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -580V-730H534V0H389V-105H354L389 -140Q389 -69 350 -30Q311 10 243 10ZM297 -120Q338 -120 361 -144Q384 -167 384 -210V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-210Q210 -167 232 -144Q255 -120 297 -120Z"/><path id="m8-e" d="M301 10Q228 10 174 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 174 -532Q228 -560 301 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-240H203V-210Q203 -158 228 -132Q253 -105 303 -105Q338 -105 360 -117Q381 -129 388 -150H535Q517 -78 454 -34Q390 10 301 10ZM397 -317V-342Q397 -393 374 -420Q350 -447 301 -447Q252 -447 228 -419Q203 -391 203 -340V-325L407 -327Z"/><path id="m8-f" d="M195 0V-350H49V-485H195V-560Q195 -637 248 -684Q300 -730 385 -730H546V-600H390Q370 -600 358 -588Q345 -575 345 -555V-485H546V-350H345V0Z"/><path id="m8-g" d="M145 180V60H300Q342 60 364 39Q387 18 387 -19V-40L389 -145H354L389 -180Q389 -109 350 -70Q311 -30 243 -30Q160 -30 110 -88Q60 -146 60 -245V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -550H534V-14Q534 76 472 128Q411 180 305 180ZM297 -160Q338 -160 361 -184Q384 -207 384 -250V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-250Q210 -207 232 -184Q255 -160 297 -160Z"/><path id="m8-h" d="M66 0V-730H216V-550L211 -445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-hyphen" d="M140 -260V-400H460V-260Z"/><path id="m8-i" d="M70 0V-136H260V-415H95V-550H400V-136H560V0ZM320 -637Q279 -637 254 -658Q230 -679 230 -715Q230 -751 254 -772Q279 -793 320 -793Q361 -793 386 -772Q410 -751 410 -715Q410 -679 386 -658Q361 -637 320 -637Z"/><path id="m8-l" d="M390 0Q332 0 288 -24Q244 -49 220 -93Q195 -137 195 -195V-595H25V-730H345V-195Q345 -168 362 -152Q378 -135 405 -135H565V0Z"/><path id="m8-m" d="M42 0V-550H160V-470H184L165 -456Q165 -503 192 -532Q219 -560 259 -560Q302 -560 326 -523Q350 -486 350 -425L332 -470H360L351 -456Q351 -503 377 -532Q403 -560 447 -560Q497 -560 528 -522Q559 -485 559 -420V0H430V-410Q430 -433 420 -446Q410 -458 391 -458Q372 -458 362 -446Q352 -433 352 -410V0H249V-410Q249 -433 239 -446Q229 -458 210 -458Q191 -458 181 -446Q171 -433 171 -410V0Z"/><path id="m8-n" d="M66 0V-550H211V-445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-o" d="M300 10Q227 10 173 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 173 -532Q227 -560 300 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-210Q540 -144 510 -94Q481 -45 428 -18Q374 10 300 10ZM300 -120Q344 -120 367 -144Q390 -167 390 -210V-340Q390 -384 367 -407Q344 -430 300 -430Q257 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q257 -120 300 -120Z"/><path id="m8-p" d="M66 180V-550H211V-445H246L211 -410Q211 -481 250 -520Q289 -560 357 -560Q440 -560 490 -502Q540 -443 540 -345V-205Q540 -140 518 -92Q495 -43 454 -16Q413 10 357 10Q289 10 250 -30Q211 -69 211 -140L246 -105H211L216 30V180ZM303 -120Q345 -120 368 -144Q390 -167 390 -210V-340Q390 -384 368 -407Q345 -430 303 -430Q262 -430 239 -406Q216 -383 216 -340V-210Q216 -167 239 -144Q262 -120 303 -120Z"/><path id="m8-r" d="M82 0V-550H222V-445H260L217 -381Q217 -470 258 -515Q299 -560 378 -560Q469 -560 520 -505Q570 -450 570 -350V-305H410V-340Q410 -385 386 -410Q361 -435 320 -435Q277 -435 254 -410Q232 -385 232 -340V0Z"/><path id="m8-s" d="M277 10Q209 10 158 -12Q107 -33 78 -71Q50 -109 50 -160H200Q200 -136 222 -122Q243 -107 277 -107H321Q362 -107 384 -122Q405 -137 405 -164Q405 -189 386 -202Q367 -216 327 -221L263 -229Q160 -242 113 -279Q66 -316 66 -392Q66 -472 121 -516Q176 -560 282 -560H320Q421 -560 481 -516Q541 -472 541 -398H391Q391 -418 372 -430Q352 -443 320 -443H282Q245 -443 228 -430Q211 -418 211 -393Q211 -370 226 -358Q242 -346 276 -341L345 -332Q449 -319 500 -280Q550 -241 550 -164Q550 -80 492 -35Q434 10 321 10Z"/><path id="m8-t" d="M360 0Q276 0 228 -48Q180 -96 180 -180V-415H35V-550H180V-705H330V-550H535V-415H330V-180Q330 -135 375 -135H525V0Z"/><path id="m8-u" d="M300 10Q189 10 126 -50Q64 -110 64 -214V-550H214V-215Q214 -169 236 -144Q258 -120 300 -120Q341 -120 364 -144Q386 -169 386 -215V-550H536V-214Q536 -109 473 -50Q410 10 300 10Z"/><path id="m8-v" d="M207 0 27 -550H182L274 -241Q282 -213 290 -180Q298 -147 302 -127Q307 -147 314 -180Q322 -213 329 -240L420 -550H573L395 0Z"/><path id="m8-w" d="M90 0 10 -550H130L170 -250Q175 -217 178 -175Q182 -133 184 -106Q187 -133 192 -174Q198 -216 203 -250L249 -550H353L397 -250Q402 -216 408 -174Q413 -132 416 -105Q418 -133 422 -176Q427 -218 431 -250L473 -550H590L509 0H359L318 -310Q314 -338 309 -377Q304 -416 301 -442Q297 -416 292 -377Q287 -338 283 -310L241 0Z"/><path id="m8-x" d="M26 0 216 -285 39 -550H206L274 -440Q282 -427 289 -411Q296 -395 300 -385Q304 -395 312 -411Q319 -427 326 -440L394 -550H561L385 -285L574 0H407L327 -130Q319 -144 312 -160Q304 -175 300 -185Q296 -175 289 -160Q282 -144 274 -130L193 0Z"/><path id="m8-y" d="M157 180 232 -27 26 -550H189L272 -310Q281 -283 290 -244Q300 -206 305 -182Q310 -206 320 -244Q329 -283 338 -310L418 -550H574L314 180Z"/><path id="m8-z" d="M70 0V-130L342 -420H80V-550H519V-420L247 -130H530V0Z"/><path id="f9-a" d="M544 -93V-107L526 -90V-820Q526 -856 508 -877Q489 -898 462 -898Q428 -898 408 -877Q388 -856 388 -820V-714Q388 -647 337 -596Q286 -546 204 -546Q149 -546 114 -577Q78 -608 78 -672Q78 -727 126 -784Q174 -840 270 -878Q365 -916 507 -916Q699 -916 794 -842Q890 -768 890 -628V-134Q890 -110 900 -98Q911 -86 926 -86Q941 -86 956 -98Q970 -109 974 -140Q975 -145 976 -146Q978 -148 980 -148Q983 -148 984 -146Q986 -145 986 -140Q986 -117 962 -79Q939 -41 884 -10Q830 20 736 20Q632 20 588 -14Q544 -47 544 -93ZM22 -200Q22 -321 122 -390Q223 -458 460 -458Q505 -458 530 -448Q556 -439 578 -422L568 -414Q544 -428 523 -433Q502 -438 474 -438Q430 -438 404 -392Q378 -346 378 -250Q378 -160 405 -120Q432 -80 474 -80Q497 -80 521 -96Q545 -113 559 -138L573 -130Q533 -57 456 -18Q378 20 288 20Q173 20 98 -42Q22 -104 22 -200Z"/><path id="f9-b" d="M442 -1496V-49L118 14Q112 15 106 16Q99 18 94 18Q88 18 84 14Q80 11 80 6V-1366Q80 -1374 76 -1378Q72 -1382 63 -1382H24Q17 -1382 14 -1384Q12 -1387 12 -1391Q12 -1395 15 -1397Q18 -1399 22 -1400L401 -1505Q413 -1508 418 -1509Q422 -1510 428 -1510Q435 -1510 438 -1506Q442 -1502 442 -1496ZM420 -744 404 -762Q461 -840 526 -878Q592 -916 680 -916Q796 -916 882 -864Q967 -813 1014 -716Q1060 -618 1060 -479Q1060 -329 1004 -216Q949 -104 851 -42Q753 20 626 20Q534 20 482 -8Q430 -35 398 -96L424 -108Q440 -66 466 -46Q493 -26 532 -26Q580 -26 616 -60Q652 -95 672 -187Q692 -279 692 -449Q692 -599 676 -686Q660 -772 631 -809Q602 -846 562 -846Q522 -846 486 -821Q449 -796 420 -744Z"/><path id="f9-c" d="M881 -652Q881 -577 838 -532Q796 -488 719 -488Q641 -488 597 -534Q553 -581 553 -670V-770Q553 -830 533 -861Q513 -892 480 -892Q445 -892 419 -858Q393 -823 380 -756Q366 -690 366 -594Q366 -466 400 -378Q433 -290 492 -245Q552 -200 630 -200Q719 -200 779 -232Q839 -263 855 -334Q856 -339 858 -341Q861 -343 864 -342Q867 -341 868 -338Q870 -335 869 -330Q852 -220 796 -142Q740 -64 652 -22Q563 20 447 20Q324 20 228 -30Q132 -79 77 -178Q22 -276 22 -422Q22 -567 84 -678Q146 -789 254 -852Q363 -916 504 -916Q630 -916 714 -882Q797 -847 839 -788Q881 -728 881 -652Z"/><path id="f9-comma" d="M288 0Q174 0 117 -52Q60 -104 60 -197Q60 -282 119 -338Q178 -395 269 -395Q352 -395 416 -330Q480 -266 480 -138Q480 -35 460 47Q439 129 398 192Q357 254 294 298Q232 341 149 368Q142 370 136 366Q130 363 130 358Q130 351 134 348Q138 344 147 341Q246 305 302 254Q357 204 380 150Q402 96 402 52Q402 28 394 14Q386 0 359 0Z"/><path id="f9-d" d="M653 -99V-105V-1366Q653 -1374 649 -1378Q645 -1382 636 -1382H597Q590 -1382 588 -1384Q585 -1387 585 -1391Q585 -1395 588 -1397Q591 -1399 595 -1400L974 -1505Q986 -1508 990 -1509Q995 -1510 1001 -1510Q1008 -1510 1012 -1506Q1015 -1502 1015 -1496V-64Q1015 -48 1020 -38Q1026 -29 1039 -26L1077 -17Q1084 -16 1086 -14Q1089 -11 1089 -8Q1089 -4 1086 -2Q1084 0 1079 0H677Q665 0 659 -6Q653 -12 653 -22ZM35 -417Q35 -568 90 -680Q146 -792 244 -854Q342 -916 469 -916Q561 -916 613 -888Q665 -861 697 -800L671 -788Q655 -830 628 -850Q602 -870 563 -870Q515 -870 479 -836Q443 -801 423 -710Q403 -618 403 -447Q403 -298 419 -211Q435 -124 464 -87Q493 -50 533 -50Q574 -50 610 -75Q646 -100 675 -152L691 -134Q634 -56 568 -18Q503 20 415 20Q299 20 214 -32Q128 -83 82 -181Q35 -279 35 -417Z"/><path id="f9-e" d="M928 -496Q928 -486 922 -479Q915 -472 900 -472H274V-496H552Q570 -496 570 -518Q570 -719 534 -806Q497 -894 458 -894Q431 -894 408 -866Q385 -837 370 -767Q356 -697 356 -574Q356 -367 439 -272Q522 -178 660 -178Q771 -178 840 -234Q910 -289 910 -382Q910 -387 912 -388Q915 -390 916 -390Q919 -390 922 -388Q924 -386 924 -380Q924 -266 866 -176Q809 -85 710 -32Q611 20 486 20Q350 20 245 -38Q140 -96 80 -199Q20 -302 20 -436Q20 -586 79 -694Q138 -801 246 -858Q355 -916 502 -916Q633 -916 728 -861Q824 -806 876 -711Q928 -616 928 -496Z"/><path id="f9-f" d="M486 -66Q486 -54 492 -46Q497 -39 510 -36L610 -18Q616 -17 620 -15Q624 -13 624 -8Q624 0 614 0H42Q39 0 36 -2Q34 -3 34 -6Q34 -9 36 -11Q38 -13 44 -14L114 -32Q125 -35 130 -41Q134 -47 134 -56V-832Q134 -838 131 -844Q128 -849 122 -850L24 -880Q20 -882 18 -884Q16 -885 16 -888Q16 -891 19 -894Q22 -896 26 -896H150L134 -884V-888Q134 -911 120 -935Q106 -959 88 -987Q70 -1015 56 -1051Q42 -1087 42 -1134Q42 -1277 125 -1354Q208 -1430 356 -1430Q453 -1430 515 -1398Q577 -1366 606 -1312Q636 -1259 636 -1194Q636 -1112 595 -1073Q554 -1034 488 -1034Q421 -1034 376 -1080Q332 -1127 332 -1202V-1342Q332 -1377 322 -1392Q311 -1406 286 -1406Q246 -1406 224 -1376Q202 -1347 202 -1288Q202 -1223 230 -1170Q259 -1118 301 -1075Q343 -1032 385 -996Q427 -961 456 -930Q484 -899 484 -870V-864L468 -896H618Q626 -896 629 -894Q632 -893 632 -888Q632 -879 622 -874Q613 -870 598 -870H486Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-l" d="M472 -1496V-64Q472 -48 478 -38Q483 -29 496 -26L534 -17Q541 -16 544 -14Q546 -11 546 -8Q546 -4 544 -2Q541 0 536 0H46Q42 0 39 -2Q36 -4 36 -8Q36 -11 38 -14Q41 -16 48 -17L86 -26Q100 -29 105 -38Q110 -48 110 -64V-1366Q110 -1374 106 -1378Q102 -1382 93 -1382H54Q47 -1382 44 -1384Q42 -1387 42 -1391Q42 -1395 45 -1397Q48 -1399 52 -1400L431 -1505Q443 -1508 448 -1509Q452 -1510 458 -1510Q465 -1510 468 -1506Q472 -1502 472 -1496Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-p" d="M452 -906V-798V-787V402Q452 418 458 428Q463 437 476 440L514 449Q521 450 524 452Q526 455 526 458Q526 462 524 464Q521 466 516 466H26Q22 466 19 464Q16 462 16 458Q16 455 18 452Q21 450 28 449L66 440Q80 437 85 428Q90 418 90 402V-776Q90 -784 86 -788Q82 -792 73 -792H34Q27 -792 24 -794Q22 -797 22 -801Q22 -805 25 -807Q28 -809 32 -810L411 -915Q423 -918 428 -919Q432 -920 438 -920Q445 -920 448 -916Q452 -912 452 -906ZM430 -744 414 -762Q471 -840 536 -878Q602 -916 690 -916Q806 -916 892 -864Q977 -813 1024 -716Q1070 -618 1070 -479Q1070 -329 1014 -216Q959 -104 861 -42Q763 20 636 20Q544 20 492 -8Q440 -35 408 -96L434 -108Q450 -66 476 -46Q503 -26 542 -26Q590 -26 626 -60Q662 -95 682 -187Q702 -279 702 -449Q702 -599 686 -686Q670 -772 641 -809Q612 -846 572 -846Q532 -846 496 -821Q459 -796 430 -744Z"/><path id="f9-r" d="M448 -540Q448 -664 488 -748Q527 -831 589 -874Q651 -916 718 -916Q800 -916 843 -862Q886 -808 886 -698Q886 -590 835 -538Q784 -486 707 -486Q636 -486 604 -524Q572 -563 568 -636L566 -674Q565 -696 557 -710Q549 -724 528 -724Q509 -724 494 -704Q480 -684 472 -641Q464 -598 464 -530ZM464 -894V-586V-74Q464 -61 471 -50Q478 -39 490 -36L588 -16Q594 -15 596 -13Q598 -11 598 -8Q598 -4 595 -2Q592 0 586 0H40Q34 0 31 -2Q28 -5 28 -8Q28 -11 32 -14Q36 -17 42 -18L78 -26Q92 -29 97 -38Q102 -46 102 -58V-782Q102 -791 98 -796Q95 -802 86 -802H42Q38 -802 35 -804Q32 -807 32 -810Q32 -813 35 -816Q38 -819 44 -820L424 -906Q433 -908 438 -909Q444 -910 450 -910Q458 -910 461 -905Q464 -900 464 -894Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-t" d="M80 -858 6 -878Q-1 -880 -4 -882Q-6 -885 -6 -888Q-6 -891 -4 -894Q-1 -896 2 -896H82Q85 -896 88 -897Q92 -898 98 -902L390 -1108Q398 -1114 407 -1118Q416 -1122 422 -1122Q430 -1122 435 -1116Q440 -1111 440 -1100V-290Q440 -201 472 -158Q504 -114 558 -114Q576 -114 592 -120Q609 -126 623 -140Q637 -154 648 -178Q659 -202 666 -238Q668 -246 674 -246Q680 -246 678 -238Q663 -151 630 -94Q596 -37 538 -8Q481 20 394 20Q246 20 169 -48Q92 -116 92 -258V-840Q92 -849 90 -853Q88 -857 80 -858ZM336 -870 348 -896H674Q679 -896 682 -894Q684 -893 684 -888Q684 -881 676 -876Q668 -870 654 -870Z"/><path id="f9-u" d="M665 -22V-170V-177V-772Q665 -780 661 -784Q657 -788 648 -788H609Q602 -788 600 -790Q597 -793 597 -797Q597 -801 600 -803Q603 -805 607 -806L986 -911Q997 -914 1002 -915Q1007 -916 1013 -916Q1020 -916 1024 -912Q1027 -908 1027 -902V-64Q1027 -48 1032 -38Q1038 -29 1051 -26L1089 -17Q1096 -16 1098 -14Q1101 -11 1101 -8Q1101 -4 1098 -2Q1096 0 1091 0H689Q677 0 671 -6Q665 -12 665 -22ZM90 -218V-772Q90 -780 86 -784Q82 -788 73 -788H34Q27 -788 24 -790Q22 -793 22 -797Q22 -801 25 -803Q28 -805 32 -806L411 -911Q423 -914 428 -915Q432 -916 438 -916Q445 -916 448 -912Q452 -908 452 -902V-256Q452 -195 476 -166Q499 -138 546 -138Q576 -138 606 -150Q637 -162 662 -184L700 -217L714 -202L674 -167Q562 -70 468 -25Q373 20 299 20Q206 20 148 -36Q90 -92 90 -218Z"/><path id="f9-v" d="M566 0H408Q399 0 393 -4Q387 -7 384 -16L74 -840Q69 -854 62 -861Q56 -868 46 -870L8 -879Q1 -881 -2 -883Q-4 -885 -4 -888Q-4 -893 -1 -894Q2 -896 6 -896H557Q567 -896 567 -888Q567 -885 564 -883Q562 -881 555 -879L507 -870Q462 -862 452 -850Q443 -838 451 -816L659 -245L587 -92L811 -770Q825 -811 810 -837Q794 -863 758 -870L710 -879Q703 -881 700 -883Q698 -885 698 -888Q698 -893 701 -894Q704 -896 708 -896H954Q959 -896 962 -894Q964 -893 964 -888Q964 -885 962 -883Q959 -881 952 -879L927 -873Q893 -865 872 -842Q852 -820 834 -764L588 -14Q586 -7 580 -4Q574 0 566 0Z"/><path id="f9-y" d="M692 -316 517 143 146 -708Q116 -778 86 -824Q57 -870 24 -877Q10 -880 7 -882Q4 -885 4 -888Q4 -893 7 -894Q10 -896 14 -896H564Q569 -896 572 -894Q574 -893 574 -888Q574 -884 572 -882Q569 -881 562 -879L514 -870Q489 -866 484 -842Q478 -818 497 -774ZM523 105 575 -33 592 -78 845 -763Q863 -813 851 -834Q839 -855 803 -865L755 -879Q748 -881 746 -883Q743 -885 743 -888Q743 -893 746 -894Q749 -896 753 -896H997Q1002 -896 1004 -894Q1007 -893 1007 -888Q1007 -885 1004 -883Q1002 -881 995 -879Q934 -866 908 -842Q881 -817 861 -762L532 126Q485 254 455 334Q425 415 384 452Q343 490 259 490Q160 490 99 428Q38 366 38 281Q38 210 75 172Q112 134 165 134Q212 134 244 162Q275 191 296 249L315 301Q328 335 345 367Q362 399 389 399Q408 399 426 362Q444 325 467 258Q490 192 523 105Z"/></defs><rect x="1" y="1" width="1598" height="768" rx="26" fill="#15100E" stroke="#3A2A24" stroke-width="2"/><g transform="translate(40.0 54.0) scale(0.00781)" fill="#E9B949"><use href="#i7-C" x="0"/><use href="#i7-H" x="1843"/><use href="#i7-O" x="3700"/><use href="#i7-O" x="5606"/><use href="#i7-S" x="7512"/><use href="#i7-E" x="9180"/><use href="#i7-Y" x="11565"/><use href="#i7-O" x="13301"/><use href="#i7-U" x="15207"/><use href="#i7-R" x="17034"/><use href="#i7-P" x="19519"/><use href="#i7-A" x="21004"/><use href="#i7-T" x="22679"/><use href="#i7-H" x="24373"/><use href="#i7-periodcentered" x="27044"/><use href="#i7-one" x="28868"/><use href="#i7-four" x="30079"/><use href="#i7-W" x="32604"/><use href="#i7-O" x="35007"/><use href="#i7-R" x="36912"/><use href="#i7-K" x="38585"/><use href="#i7-F" x="40386"/><use href="#i7-L" x="41915"/><use href="#i7-O" x="43343"/><use href="#i7-W" x="45199"/><use href="#i7-S" x="47639"/></g><rect x="40" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(57.0 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-l" x="0"/><use href="#m8-a" x="600"/><use href="#m8-u" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-h" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-v" x="4200"/><use href="#m8-i" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-e" x="6000"/><use href="#m8-o" x="6600"/></g><rect x="222.8" y="74" width="136.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(239.8 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-e" x="0"/><use href="#m8-x" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-l" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-n" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/></g><rect x="371.4" y="74" width="125.2" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(388.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-t" x="0"/><use href="#m8-u" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-a" x="3600"/><use href="#m8-l" x="4200"/></g><rect x="508.6" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(525.6 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-s" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-l" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-s" x="4200"/><use href="#m8-h" x="4800"/><use href="#m8-o" x="5400"/><use href="#m8-r" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="691.4" y="74" width="148" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(708.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-d" x="0"/><use href="#m8-a" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-t" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-y" x="5400"/></g><rect x="851.4" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(868.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-f" x="0"/><use href="#m8-o" x="600"/><use href="#m8-o" x="1200"/><use href="#m8-t" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-g" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-hyphen" x="4200"/><use href="#m8-e" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="1034.2" y="74" width="113.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1051.2 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-t" x="0"/><use href="#m8-r" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-r" x="3600"/></g><rect x="1160" y="74" width="136.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1177.0 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-s" x="0"/><use href="#m8-l" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-d" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-h" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-w" x="4800"/></g><rect x="1308.6" y="74" width="205" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1325.6 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-c" x="0"/><use href="#m8-h" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-g" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-l" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-g" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-v" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-d" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-o" x="8400"/></g><rect x="40" y="126" width="159.4" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(57.0 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-m" x="0"/><use href="#m8-u" x="600"/><use href="#m8-s" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-i" x="4200"/><use href="#m8-d" x="4800"/><use href="#m8-e" x="5400"/><use href="#m8-o" x="6000"/></g><rect x="211.4" y="126" width="193.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(228.4 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-v" x="0"/><use href="#m8-o" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-c" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-o" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-o" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-l" x="7200"/><use href="#m8-y" x="7800"/></g><rect x="417" y="126" width="125.2" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(434.0 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-l" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-z" x="3600"/><use href="#m8-e" x="4200"/></g><rect x="554.2" y="126" width="193.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(571.2 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-x" x="3600"/><use href="#m8-p" x="4200"/><use href="#m8-l" x="4800"/><use href="#m8-a" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-e" x="7200"/><use href="#m8-r" x="7800"/></g><rect x="759.8" y="126" width="205" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(776.8 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-p" x="0"/><use href="#m8-a" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-e" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-x" x="4200"/><use href="#m8-p" x="4800"/><use href="#m8-l" x="5400"/><use href="#m8-a" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-n" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-r" x="8400"/></g><rect x="40" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(60.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/></g><g transform="translate(60.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-b" x="0"/><use href="#f9-e" x="1095"/><use href="#f9-f" x="2051"/><use href="#f9-o" x="2687"/><use href="#f9-r" x="3735"/><use href="#f9-e" x="4631"/><use href="#f9-t" x="5887"/><use href="#f9-h" x="6575"/><use href="#f9-e" x="7694"/><use href="#f9-c" x="8950"/><use href="#f9-u" x="9857"/><use href="#f9-r" x="10984"/><use href="#f9-t" x="11880"/><use href="#f9-a" x="12568"/><use href="#f9-i" x="13568"/><use href="#f9-n" x="14120"/></g><circle cx="64" cy="345" r="4" fill="#E9B949"/><g transform="translate(76.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-g" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="379" r="4" fill="#E9B949"/><g transform="translate(76.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-o" x="0"/><use href="#m5-n" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><circle cx="64" cy="413" r="4" fill="#E9B949"/><g transform="translate(76.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="64" cy="447" r="4" fill="#E9B949"/><g transform="translate(76.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/></g><circle cx="64" cy="481" r="4" fill="#E9B949"/><g transform="translate(76.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-b" x="0"/><use href="#m5-o" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="515" r="4" fill="#E9B949"/><g transform="translate(76.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-r" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-w" x="1800"/></g><circle cx="64" cy="549" r="4" fill="#E9B949"/><g transform="translate(76.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-l" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-k" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="64" cy="583" r="4" fill="#E9B949"/><g transform="translate(76.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-G" x="0"/><use href="#m5-i" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-H" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-b" x="3000"/><use href="#m5-A" x="4200"/><use href="#m5-c" x="4800"/><use href="#m5-t" x="5400"/><use href="#m5-i" x="6000"/><use href="#m5-o" x="6600"/><use href="#m5-n" x="7200"/></g><circle cx="64" cy="617" r="4" fill="#E9B949"/><g transform="translate(76.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-h" x="0"/><use href="#m5-a" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-t" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="64" cy="651" r="4" fill="#E9B949"/><g transform="translate(76.0 657.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-c" x="600"/><use href="#m5-p" x="1200"/></g><circle cx="64" cy="685" r="4" fill="#E9B949"/><g transform="translate(76.0 691.0) scale(0.01700)" fill="#B6A795"><use href="#m5-d" x="0"/><use href="#m5-i" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><rect x="296" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(316.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/></g><g transform="translate(316.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-s" x="0"/><use href="#f9-t" x="842"/><use href="#f9-o" x="1505"/><use href="#f9-r" x="2553"/><use href="#f9-y" x="3424"/><use href="#f9-a" x="4718"/><use href="#f9-n" x="5718"/><use href="#f9-d" x="6842"/><use href="#f9-c" x="8237"/><use href="#f9-r" x="9144"/><use href="#f9-a" x="10040"/><use href="#f9-f" x="11040"/><use href="#f9-t" x="11676"/></g><circle cx="320" cy="345" r="4" fill="#E9B949"/><g transform="translate(332.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-y" x="2400"/></g><circle cx="320" cy="379" r="4" fill="#E9B949"/><g transform="translate(332.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-o" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="320" cy="413" r="4" fill="#E9B949"/><g transform="translate(332.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-p" x="0"/><use href="#m5-a" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-g" x="3000"/></g><circle cx="320" cy="447" r="4" fill="#E9B949"/><g transform="translate(332.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-hyphen" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-r" x="4800"/><use href="#m5-a" x="5400"/><use href="#m5-f" x="6000"/><use href="#m5-t" x="6600"/></g><circle cx="320" cy="481" r="4" fill="#E9B949"/><g transform="translate(332.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-y" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-h" x="4800"/><use href="#m5-y" x="5400"/></g><circle cx="320" cy="515" r="4" fill="#E9B949"/><g transform="translate(332.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/></g><circle cx="320" cy="549" r="4" fill="#E9B949"/><g transform="translate(332.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-b" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-k" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-t" x="4800"/></g><circle cx="320" cy="583" r="4" fill="#E9B949"/><g transform="translate(332.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-f" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-e" x="4800"/></g><circle cx="320" cy="617" r="4" fill="#E9B949"/><g transform="translate(332.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-p" x="0"/><use href="#m5-l" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-f" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-r" x="3600"/><use href="#m5-m" x="4200"/><use href="#m5-s" x="4800"/></g><rect x="552" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(572.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/><use href="#i7-I" x="7926"/></g><g transform="translate(572.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-b" x="0"/><use href="#f9-u" x="1095"/><use href="#f9-i" x="2222"/><use href="#f9-l" x="2774"/><use href="#f9-d" x="3346"/><use href="#f9-i" x="4441"/><use href="#f9-n" x="4993"/><use href="#f9-g" x="6117"/><use href="#f9-t" x="7489"/><use href="#f9-h" x="8177"/><use href="#f9-e" x="9296"/></g><g transform="translate(572.0 306.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-p" x="0"/><use href="#f9-i" x="1105"/><use href="#f9-c" x="1657"/><use href="#f9-t" x="2564"/><use href="#f9-u" x="3252"/><use href="#f9-r" x="4379"/><use href="#f9-e" x="5275"/></g><circle cx="576" cy="345" r="4" fill="#E9B949"/><g transform="translate(588.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-r" x="3000"/></g><circle cx="576" cy="379" r="4" fill="#E9B949"/><g transform="translate(588.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-i" x="4800"/></g><circle cx="576" cy="413" r="4" fill="#E9B949"/><g transform="translate(588.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-s" x="5400"/></g><circle cx="576" cy="447" r="4" fill="#E9B949"/><g transform="translate(588.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-s" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-t" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-n" x="5400"/><use href="#m5-s" x="6000"/></g><circle cx="576" cy="481" r="4" fill="#E9B949"/><g transform="translate(588.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-d" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-t" x="2400"/></g><circle cx="576" cy="515" r="4" fill="#E9B949"/><g transform="translate(588.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-f" x="0"/><use href="#m5-i" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-m" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-a" x="3000"/><use href="#m5-p" x="3600"/><use href="#m5-i" x="4200"/></g><circle cx="576" cy="549" r="4" fill="#E9B949"/><g transform="translate(588.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-e" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="576" cy="583" r="4" fill="#E9B949"/><g transform="translate(588.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-a" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-m" x="2400"/></g><circle cx="576" cy="617" r="4" fill="#E9B949"/><g transform="translate(588.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-h" x="0"/><use href="#m5-t" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-l" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-x" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-t" x="6000"/></g><circle cx="576" cy="651" r="4" fill="#E9B949"/><g transform="translate(588.0 657.0) scale(0.01700)" fill="#B6A795"><use href="#m5-d" x="0"/><use href="#m5-e" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-u" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-i" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-g" x="4800"/><use href="#m5-hyphen" x="5400"/><use href="#m5-r" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-n" x="7200"/><use href="#m5-d" x="7800"/><use href="#m5-e" x="8400"/><use href="#m5-r" x="9000"/><use href="#m5-s" x="9600"/></g><rect x="808" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(828.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-V" x="7023"/></g><g transform="translate(828.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-s" x="0"/><use href="#f9-o" x="842"/><use href="#f9-u" x="1890"/><use href="#f9-n" x="3017"/><use href="#f9-d" x="4141"/><use href="#f9-a" x="5536"/><use href="#f9-n" x="6536"/><use href="#f9-d" x="7660"/><use href="#f9-v" x="9055"/><use href="#f9-o" x="9941"/><use href="#f9-i" x="10989"/><use href="#f9-c" x="11541"/><use href="#f9-e" x="12448"/></g><circle cx="832" cy="345" r="4" fill="#E9B949"/><g transform="translate(844.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-u" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/></g><circle cx="832" cy="379" r="4" fill="#E9B949"/><g transform="translate(844.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-u" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-c" x="2400"/></g><circle cx="832" cy="413" r="4" fill="#E9B949"/><g transform="translate(844.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-y" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-h" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/></g><circle cx="832" cy="447" r="4" fill="#E9B949"/><g transform="translate(844.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-o" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-e" x="4200"/><use href="#m5-s" x="4800"/><use href="#m5-i" x="5400"/><use href="#m5-g" x="6000"/><use href="#m5-n" x="6600"/></g><circle cx="832" cy="481" r="4" fill="#E9B949"/><g transform="translate(844.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-v" x="0"/><use href="#m5-o" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-c" x="1800"/><use href="#m5-e" x="2400"/></g><rect x="1064" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1084.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-V" x="6121"/></g><g transform="translate(1084.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-f" x="0"/><use href="#f9-o" x="636"/><use href="#f9-o" x="1684"/><use href="#f9-t" x="2732"/><use href="#f9-a" x="3420"/><use href="#f9-g" x="4420"/><use href="#f9-e" x="5492"/><use href="#f9-comma" x="6448"/><use href="#f9-c" x="7278"/><use href="#f9-a" x="8185"/><use href="#f9-p" x="9185"/><use href="#f9-t" x="10290"/><use href="#f9-u" x="10978"/><use href="#f9-r" x="12105"/><use href="#f9-e" x="13001"/></g><g transform="translate(1084.0 306.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-a" x="0"/><use href="#f9-n" x="1000"/><use href="#f9-d" x="2124"/><use href="#f9-a" x="3519"/><use href="#f9-s" x="4519"/><use href="#f9-s" x="5361"/><use href="#f9-e" x="6203"/><use href="#f9-t" x="7159"/><use href="#f9-s" x="7847"/></g><circle cx="1088" cy="345" r="4" fill="#E9B949"/><g transform="translate(1100.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-e" x="0"/><use href="#m5-d" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="1088" cy="379" r="4" fill="#E9B949"/><g transform="translate(1100.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-s" x="4200"/></g><circle cx="1088" cy="413" r="4" fill="#E9B949"/><g transform="translate(1100.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-f" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-o" x="6000"/><use href="#m5-l" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="1088" cy="447" r="4" fill="#E9B949"/><g transform="translate(1100.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-e" x="3600"/></g><circle cx="1088" cy="481" r="4" fill="#E9B949"/><g transform="translate(1100.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-u" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-l" x="4200"/><use href="#m5-hyphen" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/><use href="#m5-c" x="6600"/><use href="#m5-o" x="7200"/><use href="#m5-r" x="7800"/><use href="#m5-d" x="8400"/><use href="#m5-i" x="9000"/><use href="#m5-n" x="9600"/><use href="#m5-g" x="10200"/></g><circle cx="1088" cy="515" r="4" fill="#E9B949"/><g transform="translate(1100.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-s" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><rect x="1320" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1340.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-F" x="0"/><use href="#i7-I" x="1530"/><use href="#i7-N" x="2432"/><use href="#i7-A" x="4321"/><use href="#i7-L" x="6178"/><use href="#i7-E" x="7663"/></g><g transform="translate(1340.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-p" x="0"/><use href="#f9-r" x="1105"/><use href="#f9-o" x="2001"/><use href="#f9-o" x="3049"/><use href="#f9-f" x="4097"/><use href="#f9-i" x="5033"/><use href="#f9-t" x="5585"/><use href="#f9-i" x="6573"/><use href="#f9-s" x="7125"/><use href="#f9-d" x="8267"/><use href="#f9-o" x="9362"/><use href="#f9-n" x="10410"/><use href="#f9-e" x="11534"/></g><circle cx="1344" cy="345" r="4" fill="#E9B949"/><g transform="translate(1356.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-q" x="0"/><use href="#m5-a" x="600"/></g><circle cx="1344" cy="379" r="4" fill="#E9B949"/><g transform="translate(1356.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-v" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-w" x="3000"/></g><circle cx="1344" cy="413" r="4" fill="#E9B949"/><g transform="translate(1356.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-p" x="3000"/><use href="#m5-t" x="3600"/></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 770" width="1600" height="770" role="img" aria-labelledby="t d"><title id="t">The documentation map</title><desc id="d">Every showtime guide in running order: Choose your path : launch-video, explainer, tutorial, social-short, data-story, footage-edit, trailer, slideshow, changelog-video, music-video, voiceover-only, localize, repo-explainer, paper-explainer, repro, diagram, recap; Act I Before the curtain: agents, onboarding, modes, studio, boards, crew, looking, GitHub Action, harness-notes, mcp, diagnosing; Act II Story and craft: story, tones, pacing, motion-craft, typography, color, brand-kit, reference, platforms; Act III Building the picture: render, stage-api, components, transitions, adopt, film-api, series, manim, html-export, debugging-renders; Act IV Sound and voice: audio, music, synth-score, sound-design, voice; Act V Footage, capture and assets: editing, captions, footage-tools, capture, tutorial-recording, assets; Finale Proof it is done: qa, review, receipt</desc><style>@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i7-A" d="M49 0 558 -1490H958L1480 0H1141L902 -719Q859 -858 814 -1024Q770 -1189 721 -1385H788Q740 -1188 698 -1022Q657 -855 616 -719L386 0ZM367 -346V-585H1162V-346Z"/><path id="i7-C" d="M786 20Q588 20 432 -70Q275 -160 184 -331Q94 -502 94 -744Q94 -987 185 -1158Q276 -1330 433 -1420Q590 -1510 786 -1510Q913 -1510 1022 -1474Q1132 -1439 1217 -1371Q1302 -1303 1356 -1204Q1410 -1106 1427 -980H1118Q1108 -1042 1080 -1090Q1051 -1137 1008 -1170Q966 -1204 911 -1222Q856 -1239 792 -1239Q676 -1239 588 -1181Q501 -1123 452 -1012Q404 -902 404 -744Q404 -583 453 -473Q502 -363 589 -307Q676 -251 791 -251Q855 -251 910 -268Q964 -286 1008 -320Q1051 -353 1080 -401Q1108 -449 1119 -510H1428Q1416 -406 1366 -311Q1317 -216 1235 -141Q1153 -66 1040 -23Q927 20 786 20Z"/><path id="i7-E" d="M135 0V-1490H1132V-1237H440V-877H1080V-628H440V-253H1134V0Z"/><path id="i7-F" d="M135 0V-1490H1115V-1237H440V-821H1049V-572H440V0Z"/><path id="i7-H" d="M135 0V-1490H440V-888H1089V-1490H1395V0H1089V-635H440V0Z"/><path id="i7-I" d="M440 -1490V0H135V-1490Z"/><path id="i7-K" d="M360 -337V-615Q406 -698 450 -768Q494 -838 547 -908Q600 -979 668 -1062L1033 -1490H1406L777 -762L752 -771ZM135 0V-1490H440V-1083L435 -703L440 -554V0ZM1061 0 619 -672 812 -900 1422 0Z"/><path id="i7-L" d="M135 0V-1490H440V-253H1083V0Z"/><path id="i7-N" d="M135 0V-1490H475L946 -736Q982 -678 1019 -610Q1056 -542 1094 -459Q1133 -376 1171 -272H1140Q1133 -355 1128 -449Q1122 -543 1118 -629Q1114 -715 1114 -775V-1490H1426V0H1085L657 -684Q610 -761 570 -834Q530 -906 486 -994Q443 -1081 383 -1203H422Q428 -1095 434 -996Q440 -897 444 -816Q447 -736 447 -685V0Z"/><path id="i7-O" d="M789 20Q592 20 434 -70Q277 -160 186 -331Q94 -502 94 -744Q94 -987 186 -1158Q277 -1330 434 -1420Q592 -1510 789 -1510Q987 -1510 1144 -1420Q1301 -1330 1392 -1158Q1484 -987 1484 -744Q1484 -502 1392 -331Q1301 -160 1144 -70Q987 20 789 20ZM789 -251Q905 -251 992 -308Q1078 -364 1126 -474Q1174 -585 1174 -744Q1174 -905 1126 -1016Q1078 -1126 992 -1182Q905 -1239 789 -1239Q674 -1239 587 -1182Q500 -1125 452 -1014Q404 -904 404 -744Q404 -585 452 -475Q500 -365 587 -308Q674 -251 789 -251Z"/><path id="i7-P" d="M135 0V-1490H716Q886 -1490 1005 -1426Q1124 -1361 1186 -1248Q1249 -1134 1249 -987Q1249 -839 1186 -726Q1122 -614 1002 -550Q881 -487 709 -487H335V-733H660Q754 -733 814 -766Q875 -798 904 -855Q934 -912 934 -987Q934 -1062 904 -1118Q875 -1175 814 -1206Q753 -1238 659 -1238H440V0Z"/><path id="i7-R" d="M135 0V-1490H716Q886 -1490 1005 -1430Q1124 -1370 1186 -1261Q1249 -1152 1249 -1005Q1249 -858 1186 -752Q1122 -645 1002 -588Q881 -532 709 -532H315V-779H660Q754 -779 814 -804Q874 -830 904 -880Q934 -931 934 -1005Q934 -1081 904 -1132Q874 -1184 814 -1211Q753 -1238 659 -1238H440V0ZM964 0 601 -678H932L1302 0Z"/><path id="i7-S" d="M681 22Q502 22 370 -33Q237 -88 163 -196Q89 -304 85 -462H382Q388 -387 427 -336Q466 -286 531 -261Q596 -236 678 -236Q760 -236 820 -260Q881 -283 915 -326Q949 -369 949 -426Q949 -477 918 -512Q888 -546 831 -571Q774 -596 692 -615L528 -656Q339 -702 232 -800Q125 -899 125 -1061Q125 -1196 198 -1297Q270 -1398 396 -1454Q523 -1510 685 -1510Q850 -1510 973 -1454Q1096 -1397 1165 -1296Q1234 -1196 1236 -1065H941Q933 -1155 864 -1204Q796 -1253 682 -1253Q605 -1253 550 -1231Q495 -1209 466 -1170Q438 -1131 438 -1081Q438 -1026 471 -990Q504 -953 559 -930Q614 -908 676 -893L811 -860Q905 -839 986 -803Q1067 -767 1128 -714Q1189 -662 1222 -590Q1256 -518 1256 -424Q1256 -289 1188 -188Q1120 -88 991 -33Q862 22 681 22Z"/><path id="i7-T" d="M75 -1237V-1490H1292V-1237H837V0H531V-1237Z"/><path id="i7-U" d="M749 21Q565 21 426 -48Q288 -116 212 -238Q135 -360 135 -523V-1490H440V-548Q440 -461 478 -394Q517 -326 586 -288Q656 -249 749 -249Q843 -249 912 -288Q982 -326 1020 -394Q1059 -461 1059 -548V-1490H1365V-523Q1365 -360 1288 -238Q1211 -116 1072 -48Q934 21 749 21Z"/><path id="i7-V" d="M571 0 49 -1490H388L626 -771Q669 -635 713 -472Q757 -308 806 -114H740Q788 -310 830 -472Q872 -635 913 -771L1143 -1490H1480L970 0Z"/><path id="i7-W" d="M449 0 49 -1490H382L555 -757Q576 -665 594 -560Q611 -456 628 -350Q645 -245 661 -148H607Q625 -245 643 -350Q661 -456 680 -560Q699 -665 722 -757L904 -1490H1221L1402 -757Q1425 -665 1444 -560Q1463 -456 1482 -350Q1500 -245 1518 -148H1462Q1479 -245 1496 -350Q1512 -456 1530 -560Q1549 -665 1569 -757L1742 -1490H2076L1675 0H1327L1129 -762Q1097 -889 1074 -1037Q1052 -1185 1024 -1342H1100Q1069 -1189 1050 -1043Q1030 -897 995 -762L798 0Z"/><path id="i7-Y" d="M601 0V-560L49 -1490H406L658 -1026Q697 -956 727 -887Q757 -818 789 -722H722Q753 -819 782 -888Q811 -957 848 -1026L1092 -1490H1448L905 -560V0Z"/><path id="i7-four" d="M101 -265V-506L724 -1490H931V-1154H808L409 -523V-511H1293V-265ZM814 0V-338L820 -446V-1490H1107V0Z"/><path id="i7-one" d="M749 -1490V0H444V-1221H434L93 -979V-1259L422 -1490Z"/><path id="i7-periodcentered" d="M342 -535Q269 -535 219 -584Q169 -634 169 -707Q169 -780 219 -830Q269 -879 342 -879Q415 -879 465 -830Q515 -780 515 -707Q515 -634 465 -584Q415 -535 342 -535Z"/><path id="m5-A" d="M43 0 229 -730H371L557 0H448L404 -185H197L153 0ZM217 -274H383L333 -485Q320 -541 311 -582Q303 -624 300 -639Q297 -624 289 -583Q281 -541 267 -486Z"/><path id="m5-G" d="M304 10Q236 10 185 -16Q135 -41 107 -90Q80 -138 80 -203V-527Q80 -593 107 -641Q135 -689 185 -714Q236 -740 304 -740Q372 -740 422 -714Q472 -688 500 -640Q527 -593 527 -527H419Q419 -584 389 -614Q359 -644 304 -644Q249 -644 218 -614Q188 -584 188 -528V-203Q188 -147 218 -116Q249 -85 304 -85Q359 -85 389 -116Q419 -147 419 -203V-285H283V-380H527V-203Q527 -138 500 -90Q472 -42 422 -16Q372 10 304 10Z"/><path id="m5-H" d="M85 0V-730H193V-428H407V-730H515V0H407V-328H193V0Z"/><path id="m5-a" d="M245 10Q159 10 110 -35Q60 -79 60 -156Q60 -234 112 -279Q165 -323 257 -323H410V-374Q410 -419 382 -444Q354 -469 303 -469Q258 -469 228 -450Q198 -430 193 -398H87Q96 -472 155 -516Q215 -560 306 -560Q404 -560 461 -510Q518 -461 518 -376V0H413V-101H395L413 -121Q413 -61 367 -25Q321 10 245 10ZM277 -73Q335 -73 373 -102Q410 -132 410 -178V-250H259Q217 -250 193 -227Q168 -204 168 -164Q168 -122 197 -97Q226 -73 277 -73Z"/><path id="m5-b" d="M339 10Q271 10 231 -27Q191 -65 191 -130L214 -105H191V0H84V-730H192V-573L189 -445H214L191 -420Q191 -485 231 -522Q272 -560 339 -560Q422 -560 472 -504Q522 -448 522 -352V-197Q522 -102 472 -46Q422 10 339 10ZM302 -84Q355 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q355 -466 302 -466Q251 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q251 -84 302 -84Z"/><path id="m5-c" d="M304 10Q236 10 184 -16Q133 -41 105 -90Q78 -138 78 -203V-347Q78 -413 105 -461Q133 -509 184 -534Q236 -560 304 -560Q403 -560 463 -508Q523 -456 526 -366H418Q415 -413 385 -439Q355 -465 304 -465Q249 -465 217 -435Q185 -404 185 -348V-203Q185 -147 217 -116Q249 -85 304 -85Q355 -85 385 -111Q415 -137 418 -184H526Q523 -94 463 -42Q403 10 304 10Z"/><path id="m5-d" d="M261 10Q178 10 128 -46Q78 -102 78 -197V-352Q78 -448 128 -504Q178 -560 261 -560Q329 -560 369 -522Q409 -485 409 -420L386 -445H411L408 -573V-730H516V0H409V-105H386L409 -130Q409 -65 369 -27Q329 10 261 10ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 215 -436Q185 -405 185 -347V-203Q185 -145 215 -114Q245 -84 298 -84Z"/><path id="m5-e" d="M300 10Q233 10 183 -16Q132 -43 105 -91Q78 -139 78 -203V-347Q78 -412 105 -459Q132 -507 183 -534Q233 -560 300 -560Q368 -560 418 -534Q468 -507 495 -459Q522 -412 522 -347V-249H182V-203Q182 -142 213 -110Q243 -78 301 -78Q348 -78 377 -94Q406 -111 413 -143H520Q508 -73 448 -32Q388 10 300 10ZM418 -314V-348Q418 -408 388 -441Q358 -474 300 -474Q243 -474 212 -441Q182 -408 182 -347V-322L426 -323Z"/><path id="m5-f" d="M213 0V-394H57V-492H213V-581Q213 -650 257 -690Q301 -730 377 -730H538V-634H379Q351 -634 336 -620Q320 -606 320 -580V-492H538V-394H320V0Z"/><path id="m5-g" d="M156 180V87H325Q367 87 388 67Q408 47 408 8V-47L410 -149H387L409 -169Q409 -106 370 -70Q330 -34 263 -34Q178 -34 129 -90Q80 -146 80 -241V-353Q80 -448 129 -504Q178 -560 263 -560Q330 -560 370 -524Q409 -487 409 -424L387 -445H409L408 -550H515V10Q515 89 465 134Q415 180 326 180ZM298 -127Q349 -127 379 -159Q408 -190 408 -246V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-246Q188 -189 216 -158Q245 -127 298 -127Z"/><path id="m5-h" d="M84 0V-730H192V-550L191 -445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -438Q352 -468 302 -468Q251 -468 222 -436Q192 -405 192 -347V0Z"/><path id="m5-hyphen" d="M140 -281V-379H460V-281Z"/><path id="m5-i" d="M81 0V-98H274V-452H106V-550H379V-98H556V0ZM316 -645Q281 -645 260 -664Q240 -682 240 -713Q240 -745 260 -763Q281 -782 316 -782Q352 -782 373 -763Q393 -745 393 -713Q393 -682 373 -664Q352 -645 316 -645Z"/><path id="m5-k" d="M87 0V-730H195V-329H292L438 -550H560L385 -286L563 0H439L292 -236H195V0Z"/><path id="m5-l" d="M379 0Q328 0 290 -21Q252 -41 230 -79Q209 -117 209 -167V-632H29V-730H317V-167Q317 -135 335 -116Q353 -98 384 -98H554V0Z"/><path id="m5-m" d="M59 0V-550H149V-480H169L154 -459Q154 -505 179 -533Q204 -560 246 -560Q291 -560 315 -525Q340 -490 340 -429L316 -480H354L338 -459Q338 -505 363 -533Q389 -560 432 -560Q483 -560 512 -521Q541 -483 541 -419V0H445V-416Q445 -447 432 -464Q418 -481 393 -481Q368 -481 355 -464Q341 -448 341 -417V0H260V-416Q260 -448 246 -464Q232 -481 206 -481Q181 -481 168 -464Q156 -448 156 -417V0Z"/><path id="m5-n" d="M84 0V-550H191V-445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -437Q352 -466 302 -466Q251 -466 222 -436Q192 -405 192 -347V0Z"/><path id="m5-o" d="M300 9Q232 9 182 -17Q132 -43 105 -91Q78 -139 78 -204V-346Q78 -412 105 -459Q132 -507 182 -533Q232 -559 300 -559Q368 -559 418 -533Q468 -507 495 -459Q522 -412 522 -346V-204Q522 -139 495 -91Q468 -43 418 -17Q368 9 300 9ZM300 -86Q355 -86 385 -117Q415 -147 415 -204V-346Q415 -404 385 -434Q355 -464 300 -464Q246 -464 216 -434Q185 -404 185 -346V-204Q185 -147 216 -117Q246 -86 300 -86Z"/><path id="m5-p" d="M84 180V-550H191V-445H214L191 -420Q191 -485 231 -523Q272 -560 340 -560Q423 -560 473 -504Q522 -449 522 -353V-198Q522 -134 500 -88Q477 -41 437 -15Q396 10 340 10Q273 10 232 -28Q191 -65 191 -130L214 -105H189L192 23V180ZM303 -84Q356 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q356 -466 303 -466Q252 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q252 -84 303 -84Z"/><path id="m5-q" d="M408 180V23L411 -105H386L409 -130Q409 -65 369 -28Q329 10 261 10Q178 10 129 -46Q80 -102 80 -198V-353Q80 -449 129 -504Q178 -560 261 -560Q329 -560 369 -523Q409 -485 409 -420L386 -445H409V-550H516V180ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-203Q188 -145 216 -114Q245 -84 298 -84Z"/><path id="m5-r" d="M102 0V-550H206V-445H232L199 -380Q199 -469 238 -515Q277 -560 354 -560Q442 -560 494 -505Q545 -451 545 -356V-319H434V-347Q434 -406 404 -438Q375 -469 322 -469Q269 -469 240 -437Q210 -405 210 -347V0Z"/><path id="m5-s" d="M281 9Q222 9 177 -10Q133 -29 107 -63Q82 -96 78 -142H186Q190 -115 215 -99Q240 -82 281 -82H324Q373 -82 398 -102Q423 -122 423 -155Q423 -187 400 -205Q378 -224 334 -230L263 -241Q175 -255 134 -291Q92 -328 92 -400Q92 -476 141 -517Q191 -559 288 -559H326Q412 -559 463 -520Q515 -480 522 -414H414Q410 -438 387 -453Q365 -468 326 -468H288Q241 -468 220 -450Q198 -433 198 -399Q198 -369 217 -354Q236 -339 276 -333L349 -321Q442 -308 485 -269Q529 -231 529 -158Q529 -79 478 -35Q426 9 324 9Z"/><path id="m5-t" d="M360 0Q285 0 243 -41Q201 -82 201 -155V-452H49V-550H201V-705H309V-550H524V-452H309V-155Q309 -98 364 -98H514V0Z"/><path id="m5-u" d="M299 10Q200 10 141 -48Q82 -105 82 -204V-550H190V-204Q190 -147 219 -116Q248 -84 299 -84Q351 -84 380 -116Q410 -147 410 -204V-550H518V-204Q518 -105 458 -47Q399 10 299 10Z"/><path id="m5-v" d="M229 0 47 -550H157L270 -198Q281 -167 289 -136Q298 -104 302 -86Q307 -104 316 -136Q324 -167 333 -198L444 -550H553L371 0Z"/><path id="m5-w" d="M113 0 28 -550H119L170 -187Q174 -162 177 -131Q181 -101 183 -81Q185 -101 190 -131Q194 -161 198 -187L255 -550H346L402 -187Q406 -161 410 -131Q415 -100 417 -80Q419 -101 424 -131Q428 -162 432 -187L484 -550H572L484 0H370L316 -359Q312 -387 307 -418Q302 -450 300 -469Q297 -450 293 -418Q288 -387 284 -359L228 0Z"/><path id="m5-x" d="M43 0 236 -284 55 -550H179L276 -398Q283 -386 290 -372Q297 -359 301 -350Q304 -359 311 -372Q318 -386 325 -398L422 -550H546L365 -283L557 0H433L326 -165Q319 -177 312 -192Q305 -207 301 -216Q297 -207 289 -192Q282 -177 274 -165L166 0Z"/><path id="m5-y" d="M172 180 251 -32 46 -550H165L280 -240Q287 -220 294 -192Q301 -164 306 -146Q310 -164 317 -192Q324 -220 331 -240L439 -550H554L286 180Z"/><path id="m8-a" d="M229 10Q146 10 98 -35Q49 -80 49 -157Q49 -240 106 -284Q164 -329 272 -329H386V-370Q386 -402 364 -421Q341 -440 303 -440Q268 -440 245 -424Q222 -408 217 -380H72Q81 -463 144 -512Q208 -560 308 -560Q413 -560 474 -508Q536 -457 536 -370V0H391V-90H367L392 -125Q392 -63 347 -26Q303 10 229 10ZM285 -100Q329 -100 358 -124Q386 -147 386 -185V-244H275Q241 -244 220 -224Q199 -205 199 -173Q199 -139 222 -120Q245 -100 285 -100Z"/><path id="m8-c" d="M303 10Q230 10 175 -18Q120 -45 90 -94Q60 -144 60 -210V-340Q60 -407 90 -456Q120 -505 175 -532Q230 -560 303 -560Q412 -560 477 -505Q542 -450 546 -355H396Q393 -390 368 -410Q344 -430 303 -430Q258 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q258 -120 303 -120Q344 -120 368 -140Q393 -159 396 -195H546Q542 -100 477 -45Q412 10 303 10Z"/><path id="m8-d" d="M243 10Q160 10 110 -48Q60 -106 60 -205V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -580V-730H534V0H389V-105H354L389 -140Q389 -69 350 -30Q311 10 243 10ZM297 -120Q338 -120 361 -144Q384 -167 384 -210V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-210Q210 -167 232 -144Q255 -120 297 -120Z"/><path id="m8-e" d="M301 10Q228 10 174 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 174 -532Q228 -560 301 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-240H203V-210Q203 -158 228 -132Q253 -105 303 -105Q338 -105 360 -117Q381 -129 388 -150H535Q517 -78 454 -34Q390 10 301 10ZM397 -317V-342Q397 -393 374 -420Q350 -447 301 -447Q252 -447 228 -419Q203 -391 203 -340V-325L407 -327Z"/><path id="m8-f" d="M195 0V-350H49V-485H195V-560Q195 -637 248 -684Q300 -730 385 -730H546V-600H390Q370 -600 358 -588Q345 -575 345 -555V-485H546V-350H345V0Z"/><path id="m8-g" d="M145 180V60H300Q342 60 364 39Q387 18 387 -19V-40L389 -145H354L389 -180Q389 -109 350 -70Q311 -30 243 -30Q160 -30 110 -88Q60 -146 60 -245V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -550H534V-14Q534 76 472 128Q411 180 305 180ZM297 -160Q338 -160 361 -184Q384 -207 384 -250V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-250Q210 -207 232 -184Q255 -160 297 -160Z"/><path id="m8-h" d="M66 0V-730H216V-550L211 -445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-hyphen" d="M140 -260V-400H460V-260Z"/><path id="m8-i" d="M70 0V-136H260V-415H95V-550H400V-136H560V0ZM320 -637Q279 -637 254 -658Q230 -679 230 -715Q230 -751 254 -772Q279 -793 320 -793Q361 -793 386 -772Q410 -751 410 -715Q410 -679 386 -658Q361 -637 320 -637Z"/><path id="m8-l" d="M390 0Q332 0 288 -24Q244 -49 220 -93Q195 -137 195 -195V-595H25V-730H345V-195Q345 -168 362 -152Q378 -135 405 -135H565V0Z"/><path id="m8-m" d="M42 0V-550H160V-470H184L165 -456Q165 -503 192 -532Q219 -560 259 -560Q302 -560 326 -523Q350 -486 350 -425L332 -470H360L351 -456Q351 -503 377 -532Q403 -560 447 -560Q497 -560 528 -522Q559 -485 559 -420V0H430V-410Q430 -433 420 -446Q410 -458 391 -458Q372 -458 362 -446Q352 -433 352 -410V0H249V-410Q249 -433 239 -446Q229 -458 210 -458Q191 -458 181 -446Q171 -433 171 -410V0Z"/><path id="m8-n" d="M66 0V-550H211V-445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-o" d="M300 10Q227 10 173 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 173 -532Q227 -560 300 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-210Q540 -144 510 -94Q481 -45 428 -18Q374 10 300 10ZM300 -120Q344 -120 367 -144Q390 -167 390 -210V-340Q390 -384 367 -407Q344 -430 300 -430Q257 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q257 -120 300 -120Z"/><path id="m8-p" d="M66 180V-550H211V-445H246L211 -410Q211 -481 250 -520Q289 -560 357 -560Q440 -560 490 -502Q540 -443 540 -345V-205Q540 -140 518 -92Q495 -43 454 -16Q413 10 357 10Q289 10 250 -30Q211 -69 211 -140L246 -105H211L216 30V180ZM303 -120Q345 -120 368 -144Q390 -167 390 -210V-340Q390 -384 368 -407Q345 -430 303 -430Q262 -430 239 -406Q216 -383 216 -340V-210Q216 -167 239 -144Q262 -120 303 -120Z"/><path id="m8-r" d="M82 0V-550H222V-445H260L217 -381Q217 -470 258 -515Q299 -560 378 -560Q469 -560 520 -505Q570 -450 570 -350V-305H410V-340Q410 -385 386 -410Q361 -435 320 -435Q277 -435 254 -410Q232 -385 232 -340V0Z"/><path id="m8-s" d="M277 10Q209 10 158 -12Q107 -33 78 -71Q50 -109 50 -160H200Q200 -136 222 -122Q243 -107 277 -107H321Q362 -107 384 -122Q405 -137 405 -164Q405 -189 386 -202Q367 -216 327 -221L263 -229Q160 -242 113 -279Q66 -316 66 -392Q66 -472 121 -516Q176 -560 282 -560H320Q421 -560 481 -516Q541 -472 541 -398H391Q391 -418 372 -430Q352 -443 320 -443H282Q245 -443 228 -430Q211 -418 211 -393Q211 -370 226 -358Q242 -346 276 -341L345 -332Q449 -319 500 -280Q550 -241 550 -164Q550 -80 492 -35Q434 10 321 10Z"/><path id="m8-t" d="M360 0Q276 0 228 -48Q180 -96 180 -180V-415H35V-550H180V-705H330V-550H535V-415H330V-180Q330 -135 375 -135H525V0Z"/><path id="m8-u" d="M300 10Q189 10 126 -50Q64 -110 64 -214V-550H214V-215Q214 -169 236 -144Q258 -120 300 -120Q341 -120 364 -144Q386 -169 386 -215V-550H536V-214Q536 -109 473 -50Q410 10 300 10Z"/><path id="m8-v" d="M207 0 27 -550H182L274 -241Q282 -213 290 -180Q298 -147 302 -127Q307 -147 314 -180Q322 -213 329 -240L420 -550H573L395 0Z"/><path id="m8-w" d="M90 0 10 -550H130L170 -250Q175 -217 178 -175Q182 -133 184 -106Q187 -133 192 -174Q198 -216 203 -250L249 -550H353L397 -250Q402 -216 408 -174Q413 -132 416 -105Q418 -133 422 -176Q427 -218 431 -250L473 -550H590L509 0H359L318 -310Q314 -338 309 -377Q304 -416 301 -442Q297 -416 292 -377Q287 -338 283 -310L241 0Z"/><path id="m8-x" d="M26 0 216 -285 39 -550H206L274 -440Q282 -427 289 -411Q296 -395 300 -385Q304 -395 312 -411Q319 -427 326 -440L394 -550H561L385 -285L574 0H407L327 -130Q319 -144 312 -160Q304 -175 300 -185Q296 -175 289 -160Q282 -144 274 -130L193 0Z"/><path id="m8-y" d="M157 180 232 -27 26 -550H189L272 -310Q281 -283 290 -244Q300 -206 305 -182Q310 -206 320 -244Q329 -283 338 -310L418 -550H574L314 180Z"/><path id="m8-z" d="M70 0V-130L342 -420H80V-550H519V-420L247 -130H530V0Z"/><path id="f9-a" d="M544 -93V-107L526 -90V-820Q526 -856 508 -877Q489 -898 462 -898Q428 -898 408 -877Q388 -856 388 -820V-714Q388 -647 337 -596Q286 -546 204 -546Q149 -546 114 -577Q78 -608 78 -672Q78 -727 126 -784Q174 -840 270 -878Q365 -916 507 -916Q699 -916 794 -842Q890 -768 890 -628V-134Q890 -110 900 -98Q911 -86 926 -86Q941 -86 956 -98Q970 -109 974 -140Q975 -145 976 -146Q978 -148 980 -148Q983 -148 984 -146Q986 -145 986 -140Q986 -117 962 -79Q939 -41 884 -10Q830 20 736 20Q632 20 588 -14Q544 -47 544 -93ZM22 -200Q22 -321 122 -390Q223 -458 460 -458Q505 -458 530 -448Q556 -439 578 -422L568 -414Q544 -428 523 -433Q502 -438 474 -438Q430 -438 404 -392Q378 -346 378 -250Q378 -160 405 -120Q432 -80 474 -80Q497 -80 521 -96Q545 -113 559 -138L573 -130Q533 -57 456 -18Q378 20 288 20Q173 20 98 -42Q22 -104 22 -200Z"/><path id="f9-b" d="M442 -1496V-49L118 14Q112 15 106 16Q99 18 94 18Q88 18 84 14Q80 11 80 6V-1366Q80 -1374 76 -1378Q72 -1382 63 -1382H24Q17 -1382 14 -1384Q12 -1387 12 -1391Q12 -1395 15 -1397Q18 -1399 22 -1400L401 -1505Q413 -1508 418 -1509Q422 -1510 428 -1510Q435 -1510 438 -1506Q442 -1502 442 -1496ZM420 -744 404 -762Q461 -840 526 -878Q592 -916 680 -916Q796 -916 882 -864Q967 -813 1014 -716Q1060 -618 1060 -479Q1060 -329 1004 -216Q949 -104 851 -42Q753 20 626 20Q534 20 482 -8Q430 -35 398 -96L424 -108Q440 -66 466 -46Q493 -26 532 -26Q580 -26 616 -60Q652 -95 672 -187Q692 -279 692 -449Q692 -599 676 -686Q660 -772 631 -809Q602 -846 562 -846Q522 -846 486 -821Q449 -796 420 -744Z"/><path id="f9-c" d="M881 -652Q881 -577 838 -532Q796 -488 719 -488Q641 -488 597 -534Q553 -581 553 -670V-770Q553 -830 533 -861Q513 -892 480 -892Q445 -892 419 -858Q393 -823 380 -756Q366 -690 366 -594Q366 -466 400 -378Q433 -290 492 -245Q552 -200 630 -200Q719 -200 779 -232Q839 -263 855 -334Q856 -339 858 -341Q861 -343 864 -342Q867 -341 868 -338Q870 -335 869 -330Q852 -220 796 -142Q740 -64 652 -22Q563 20 447 20Q324 20 228 -30Q132 -79 77 -178Q22 -276 22 -422Q22 -567 84 -678Q146 -789 254 -852Q363 -916 504 -916Q630 -916 714 -882Q797 -847 839 -788Q881 -728 881 -652Z"/><path id="f9-comma" d="M288 0Q174 0 117 -52Q60 -104 60 -197Q60 -282 119 -338Q178 -395 269 -395Q352 -395 416 -330Q480 -266 480 -138Q480 -35 460 47Q439 129 398 192Q357 254 294 298Q232 341 149 368Q142 370 136 366Q130 363 130 358Q130 351 134 348Q138 344 147 341Q246 305 302 254Q357 204 380 150Q402 96 402 52Q402 28 394 14Q386 0 359 0Z"/><path id="f9-d" d="M653 -99V-105V-1366Q653 -1374 649 -1378Q645 -1382 636 -1382H597Q590 -1382 588 -1384Q585 -1387 585 -1391Q585 -1395 588 -1397Q591 -1399 595 -1400L974 -1505Q986 -1508 990 -1509Q995 -1510 1001 -1510Q1008 -1510 1012 -1506Q1015 -1502 1015 -1496V-64Q1015 -48 1020 -38Q1026 -29 1039 -26L1077 -17Q1084 -16 1086 -14Q1089 -11 1089 -8Q1089 -4 1086 -2Q1084 0 1079 0H677Q665 0 659 -6Q653 -12 653 -22ZM35 -417Q35 -568 90 -680Q146 -792 244 -854Q342 -916 469 -916Q561 -916 613 -888Q665 -861 697 -800L671 -788Q655 -830 628 -850Q602 -870 563 -870Q515 -870 479 -836Q443 -801 423 -710Q403 -618 403 -447Q403 -298 419 -211Q435 -124 464 -87Q493 -50 533 -50Q574 -50 610 -75Q646 -100 675 -152L691 -134Q634 -56 568 -18Q503 20 415 20Q299 20 214 -32Q128 -83 82 -181Q35 -279 35 -417Z"/><path id="f9-e" d="M928 -496Q928 -486 922 -479Q915 -472 900 -472H274V-496H552Q570 -496 570 -518Q570 -719 534 -806Q497 -894 458 -894Q431 -894 408 -866Q385 -837 370 -767Q356 -697 356 -574Q356 -367 439 -272Q522 -178 660 -178Q771 -178 840 -234Q910 -289 910 -382Q910 -387 912 -388Q915 -390 916 -390Q919 -390 922 -388Q924 -386 924 -380Q924 -266 866 -176Q809 -85 710 -32Q611 20 486 20Q350 20 245 -38Q140 -96 80 -199Q20 -302 20 -436Q20 -586 79 -694Q138 -801 246 -858Q355 -916 502 -916Q633 -916 728 -861Q824 -806 876 -711Q928 -616 928 -496Z"/><path id="f9-f" d="M486 -66Q486 -54 492 -46Q497 -39 510 -36L610 -18Q616 -17 620 -15Q624 -13 624 -8Q624 0 614 0H42Q39 0 36 -2Q34 -3 34 -6Q34 -9 36 -11Q38 -13 44 -14L114 -32Q125 -35 130 -41Q134 -47 134 -56V-832Q134 -838 131 -844Q128 -849 122 -850L24 -880Q20 -882 18 -884Q16 -885 16 -888Q16 -891 19 -894Q22 -896 26 -896H150L134 -884V-888Q134 -911 120 -935Q106 -959 88 -987Q70 -1015 56 -1051Q42 -1087 42 -1134Q42 -1277 125 -1354Q208 -1430 356 -1430Q453 -1430 515 -1398Q577 -1366 606 -1312Q636 -1259 636 -1194Q636 -1112 595 -1073Q554 -1034 488 -1034Q421 -1034 376 -1080Q332 -1127 332 -1202V-1342Q332 -1377 322 -1392Q311 -1406 286 -1406Q246 -1406 224 -1376Q202 -1347 202 -1288Q202 -1223 230 -1170Q259 -1118 301 -1075Q343 -1032 385 -996Q427 -961 456 -930Q484 -899 484 -870V-864L468 -896H618Q626 -896 629 -894Q632 -893 632 -888Q632 -879 622 -874Q613 -870 598 -870H486Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-l" d="M472 -1496V-64Q472 -48 478 -38Q483 -29 496 -26L534 -17Q541 -16 544 -14Q546 -11 546 -8Q546 -4 544 -2Q541 0 536 0H46Q42 0 39 -2Q36 -4 36 -8Q36 -11 38 -14Q41 -16 48 -17L86 -26Q100 -29 105 -38Q110 -48 110 -64V-1366Q110 -1374 106 -1378Q102 -1382 93 -1382H54Q47 -1382 44 -1384Q42 -1387 42 -1391Q42 -1395 45 -1397Q48 -1399 52 -1400L431 -1505Q443 -1508 448 -1509Q452 -1510 458 -1510Q465 -1510 468 -1506Q472 -1502 472 -1496Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-p" d="M452 -906V-798V-787V402Q452 418 458 428Q463 437 476 440L514 449Q521 450 524 452Q526 455 526 458Q526 462 524 464Q521 466 516 466H26Q22 466 19 464Q16 462 16 458Q16 455 18 452Q21 450 28 449L66 440Q80 437 85 428Q90 418 90 402V-776Q90 -784 86 -788Q82 -792 73 -792H34Q27 -792 24 -794Q22 -797 22 -801Q22 -805 25 -807Q28 -809 32 -810L411 -915Q423 -918 428 -919Q432 -920 438 -920Q445 -920 448 -916Q452 -912 452 -906ZM430 -744 414 -762Q471 -840 536 -878Q602 -916 690 -916Q806 -916 892 -864Q977 -813 1024 -716Q1070 -618 1070 -479Q1070 -329 1014 -216Q959 -104 861 -42Q763 20 636 20Q544 20 492 -8Q440 -35 408 -96L434 -108Q450 -66 476 -46Q503 -26 542 -26Q590 -26 626 -60Q662 -95 682 -187Q702 -279 702 -449Q702 -599 686 -686Q670 -772 641 -809Q612 -846 572 -846Q532 -846 496 -821Q459 -796 430 -744Z"/><path id="f9-r" d="M448 -540Q448 -664 488 -748Q527 -831 589 -874Q651 -916 718 -916Q800 -916 843 -862Q886 -808 886 -698Q886 -590 835 -538Q784 -486 707 -486Q636 -486 604 -524Q572 -563 568 -636L566 -674Q565 -696 557 -710Q549 -724 528 -724Q509 -724 494 -704Q480 -684 472 -641Q464 -598 464 -530ZM464 -894V-586V-74Q464 -61 471 -50Q478 -39 490 -36L588 -16Q594 -15 596 -13Q598 -11 598 -8Q598 -4 595 -2Q592 0 586 0H40Q34 0 31 -2Q28 -5 28 -8Q28 -11 32 -14Q36 -17 42 -18L78 -26Q92 -29 97 -38Q102 -46 102 -58V-782Q102 -791 98 -796Q95 -802 86 -802H42Q38 -802 35 -804Q32 -807 32 -810Q32 -813 35 -816Q38 -819 44 -820L424 -906Q433 -908 438 -909Q444 -910 450 -910Q458 -910 461 -905Q464 -900 464 -894Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-t" d="M80 -858 6 -878Q-1 -880 -4 -882Q-6 -885 -6 -888Q-6 -891 -4 -894Q-1 -896 2 -896H82Q85 -896 88 -897Q92 -898 98 -902L390 -1108Q398 -1114 407 -1118Q416 -1122 422 -1122Q430 -1122 435 -1116Q440 -1111 440 -1100V-290Q440 -201 472 -158Q504 -114 558 -114Q576 -114 592 -120Q609 -126 623 -140Q637 -154 648 -178Q659 -202 666 -238Q668 -246 674 -246Q680 -246 678 -238Q663 -151 630 -94Q596 -37 538 -8Q481 20 394 20Q246 20 169 -48Q92 -116 92 -258V-840Q92 -849 90 -853Q88 -857 80 -858ZM336 -870 348 -896H674Q679 -896 682 -894Q684 -893 684 -888Q684 -881 676 -876Q668 -870 654 -870Z"/><path id="f9-u" d="M665 -22V-170V-177V-772Q665 -780 661 -784Q657 -788 648 -788H609Q602 -788 600 -790Q597 -793 597 -797Q597 -801 600 -803Q603 -805 607 -806L986 -911Q997 -914 1002 -915Q1007 -916 1013 -916Q1020 -916 1024 -912Q1027 -908 1027 -902V-64Q1027 -48 1032 -38Q1038 -29 1051 -26L1089 -17Q1096 -16 1098 -14Q1101 -11 1101 -8Q1101 -4 1098 -2Q1096 0 1091 0H689Q677 0 671 -6Q665 -12 665 -22ZM90 -218V-772Q90 -780 86 -784Q82 -788 73 -788H34Q27 -788 24 -790Q22 -793 22 -797Q22 -801 25 -803Q28 -805 32 -806L411 -911Q423 -914 428 -915Q432 -916 438 -916Q445 -916 448 -912Q452 -908 452 -902V-256Q452 -195 476 -166Q499 -138 546 -138Q576 -138 606 -150Q637 -162 662 -184L700 -217L714 -202L674 -167Q562 -70 468 -25Q373 20 299 20Q206 20 148 -36Q90 -92 90 -218Z"/><path id="f9-v" d="M566 0H408Q399 0 393 -4Q387 -7 384 -16L74 -840Q69 -854 62 -861Q56 -868 46 -870L8 -879Q1 -881 -2 -883Q-4 -885 -4 -888Q-4 -893 -1 -894Q2 -896 6 -896H557Q567 -896 567 -888Q567 -885 564 -883Q562 -881 555 -879L507 -870Q462 -862 452 -850Q443 -838 451 -816L659 -245L587 -92L811 -770Q825 -811 810 -837Q794 -863 758 -870L710 -879Q703 -881 700 -883Q698 -885 698 -888Q698 -893 701 -894Q704 -896 708 -896H954Q959 -896 962 -894Q964 -893 964 -888Q964 -885 962 -883Q959 -881 952 -879L927 -873Q893 -865 872 -842Q852 -820 834 -764L588 -14Q586 -7 580 -4Q574 0 566 0Z"/><path id="f9-y" d="M692 -316 517 143 146 -708Q116 -778 86 -824Q57 -870 24 -877Q10 -880 7 -882Q4 -885 4 -888Q4 -893 7 -894Q10 -896 14 -896H564Q569 -896 572 -894Q574 -893 574 -888Q574 -884 572 -882Q569 -881 562 -879L514 -870Q489 -866 484 -842Q478 -818 497 -774ZM523 105 575 -33 592 -78 845 -763Q863 -813 851 -834Q839 -855 803 -865L755 -879Q748 -881 746 -883Q743 -885 743 -888Q743 -893 746 -894Q749 -896 753 -896H997Q1002 -896 1004 -894Q1007 -893 1007 -888Q1007 -885 1004 -883Q1002 -881 995 -879Q934 -866 908 -842Q881 -817 861 -762L532 126Q485 254 455 334Q425 415 384 452Q343 490 259 490Q160 490 99 428Q38 366 38 281Q38 210 75 172Q112 134 165 134Q212 134 244 162Q275 191 296 249L315 301Q328 335 345 367Q362 399 389 399Q408 399 426 362Q444 325 467 258Q490 192 523 105Z"/></defs><rect x="1" y="1" width="1598" height="768" rx="26" fill="#15100E" stroke="#3A2A24" stroke-width="2"/><g transform="translate(40.0 54.0) scale(0.00781)" fill="#E9B949"><use href="#i7-C" x="0"/><use href="#i7-H" x="1843"/><use href="#i7-O" x="3700"/><use href="#i7-O" x="5606"/><use href="#i7-S" x="7512"/><use href="#i7-E" x="9180"/><use href="#i7-Y" x="11565"/><use href="#i7-O" x="13301"/><use href="#i7-U" x="15207"/><use href="#i7-R" x="17034"/><use href="#i7-P" x="19519"/><use href="#i7-A" x="21004"/><use href="#i7-T" x="22679"/><use href="#i7-H" x="24373"/><use href="#i7-periodcentered" x="27044"/><use href="#i7-S" x="28868"/><use href="#i7-E" x="30536"/><use href="#i7-V" x="32107"/><use href="#i7-E" x="33878"/><use href="#i7-N" x="35449"/><use href="#i7-T" x="37338"/><use href="#i7-E" x="39032"/><use href="#i7-E" x="40603"/><use href="#i7-N" x="42174"/><use href="#i7-W" x="44877"/><use href="#i7-O" x="47280"/><use href="#i7-R" x="49185"/><use href="#i7-K" x="50858"/><use href="#i7-F" x="52659"/><use href="#i7-L" x="54188"/><use href="#i7-O" x="55616"/><use href="#i7-W" x="57472"/><use href="#i7-S" x="59912"/></g><rect x="40" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(57.0 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-l" x="0"/><use href="#m8-a" x="600"/><use href="#m8-u" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-h" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-v" x="4200"/><use href="#m8-i" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-e" x="6000"/><use href="#m8-o" x="6600"/></g><rect x="222.8" y="74" width="136.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(239.8 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-e" x="0"/><use href="#m8-x" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-l" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-n" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/></g><rect x="371.4" y="74" width="125.2" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(388.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-t" x="0"/><use href="#m8-u" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-a" x="3600"/><use href="#m8-l" x="4200"/></g><rect x="508.6" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(525.6 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-s" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-l" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-s" x="4200"/><use href="#m8-h" x="4800"/><use href="#m8-o" x="5400"/><use href="#m8-r" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="691.4" y="74" width="148" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(708.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-d" x="0"/><use href="#m8-a" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-t" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-y" x="5400"/></g><rect x="851.4" y="74" width="170.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(868.4 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-f" x="0"/><use href="#m8-o" x="600"/><use href="#m8-o" x="1200"/><use href="#m8-t" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-g" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-hyphen" x="4200"/><use href="#m8-e" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="1034.2" y="74" width="113.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1051.2 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-t" x="0"/><use href="#m8-r" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-r" x="3600"/></g><rect x="1160" y="74" width="136.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1177.0 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-s" x="0"/><use href="#m8-l" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-d" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-h" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-w" x="4800"/></g><rect x="1308.6" y="74" width="205" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1325.6 101.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-c" x="0"/><use href="#m8-h" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-g" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-l" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-g" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-v" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-d" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-o" x="8400"/></g><rect x="40" y="126" width="159.4" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(57.0 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-m" x="0"/><use href="#m8-u" x="600"/><use href="#m8-s" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-i" x="4200"/><use href="#m8-d" x="4800"/><use href="#m8-e" x="5400"/><use href="#m8-o" x="6000"/></g><rect x="211.4" y="126" width="193.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(228.4 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-v" x="0"/><use href="#m8-o" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-c" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-o" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-o" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-l" x="7200"/><use href="#m8-y" x="7800"/></g><rect x="417" y="126" width="125.2" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(434.0 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-l" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-z" x="3600"/><use href="#m8-e" x="4200"/></g><rect x="554.2" y="126" width="193.6" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(571.2 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-x" x="3600"/><use href="#m8-p" x="4200"/><use href="#m8-l" x="4800"/><use href="#m8-a" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-e" x="7200"/><use href="#m8-r" x="7800"/></g><rect x="759.8" y="126" width="205" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(776.8 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-p" x="0"/><use href="#m8-a" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-e" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-x" x="4200"/><use href="#m8-p" x="4800"/><use href="#m8-l" x="5400"/><use href="#m8-a" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-n" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-r" x="8400"/></g><rect x="976.8" y="126" width="91" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(993.8 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-r" x="1800"/><use href="#m8-o" x="2400"/></g><rect x="1079.8" y="126" width="113.8" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1096.8 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-d" x="0"/><use href="#m8-i" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-g" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-a" x="3000"/><use href="#m8-m" x="3600"/></g><rect x="1205.6" y="126" width="91.0" height="40" rx="20" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1222.6 153.0) scale(0.01900)" fill="#F5EBDC"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-p" x="2400"/></g><rect x="40" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(60.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/></g><g transform="translate(60.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-b" x="0"/><use href="#f9-e" x="1095"/><use href="#f9-f" x="2051"/><use href="#f9-o" x="2687"/><use href="#f9-r" x="3735"/><use href="#f9-e" x="4631"/><use href="#f9-t" x="5887"/><use href="#f9-h" x="6575"/><use href="#f9-e" x="7694"/><use href="#f9-c" x="8950"/><use href="#f9-u" x="9857"/><use href="#f9-r" x="10984"/><use href="#f9-t" x="11880"/><use href="#f9-a" x="12568"/><use href="#f9-i" x="13568"/><use href="#f9-n" x="14120"/></g><circle cx="64" cy="345" r="4" fill="#E9B949"/><g transform="translate(76.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-g" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="379" r="4" fill="#E9B949"/><g transform="translate(76.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-o" x="0"/><use href="#m5-n" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><circle cx="64" cy="413" r="4" fill="#E9B949"/><g transform="translate(76.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="64" cy="447" r="4" fill="#E9B949"/><g transform="translate(76.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/></g><circle cx="64" cy="481" r="4" fill="#E9B949"/><g transform="translate(76.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-b" x="0"/><use href="#m5-o" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="515" r="4" fill="#E9B949"/><g transform="translate(76.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-r" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-w" x="1800"/></g><circle cx="64" cy="549" r="4" fill="#E9B949"/><g transform="translate(76.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-l" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-k" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="64" cy="583" r="4" fill="#E9B949"/><g transform="translate(76.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-G" x="0"/><use href="#m5-i" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-H" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-b" x="3000"/><use href="#m5-A" x="4200"/><use href="#m5-c" x="4800"/><use href="#m5-t" x="5400"/><use href="#m5-i" x="6000"/><use href="#m5-o" x="6600"/><use href="#m5-n" x="7200"/></g><circle cx="64" cy="617" r="4" fill="#E9B949"/><g transform="translate(76.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-h" x="0"/><use href="#m5-a" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-t" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="64" cy="651" r="4" fill="#E9B949"/><g transform="translate(76.0 657.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-c" x="600"/><use href="#m5-p" x="1200"/></g><circle cx="64" cy="685" r="4" fill="#E9B949"/><g transform="translate(76.0 691.0) scale(0.01700)" fill="#B6A795"><use href="#m5-d" x="0"/><use href="#m5-i" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><rect x="296" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(316.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/></g><g transform="translate(316.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-s" x="0"/><use href="#f9-t" x="842"/><use href="#f9-o" x="1505"/><use href="#f9-r" x="2553"/><use href="#f9-y" x="3424"/><use href="#f9-a" x="4718"/><use href="#f9-n" x="5718"/><use href="#f9-d" x="6842"/><use href="#f9-c" x="8237"/><use href="#f9-r" x="9144"/><use href="#f9-a" x="10040"/><use href="#f9-f" x="11040"/><use href="#f9-t" x="11676"/></g><circle cx="320" cy="345" r="4" fill="#E9B949"/><g transform="translate(332.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-y" x="2400"/></g><circle cx="320" cy="379" r="4" fill="#E9B949"/><g transform="translate(332.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-o" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="320" cy="413" r="4" fill="#E9B949"/><g transform="translate(332.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-p" x="0"/><use href="#m5-a" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-g" x="3000"/></g><circle cx="320" cy="447" r="4" fill="#E9B949"/><g transform="translate(332.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-hyphen" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-r" x="4800"/><use href="#m5-a" x="5400"/><use href="#m5-f" x="6000"/><use href="#m5-t" x="6600"/></g><circle cx="320" cy="481" r="4" fill="#E9B949"/><g transform="translate(332.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-y" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-h" x="4800"/><use href="#m5-y" x="5400"/></g><circle cx="320" cy="515" r="4" fill="#E9B949"/><g transform="translate(332.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/></g><circle cx="320" cy="549" r="4" fill="#E9B949"/><g transform="translate(332.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-b" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-k" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-t" x="4800"/></g><circle cx="320" cy="583" r="4" fill="#E9B949"/><g transform="translate(332.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-f" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-e" x="4800"/></g><circle cx="320" cy="617" r="4" fill="#E9B949"/><g transform="translate(332.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-p" x="0"/><use href="#m5-l" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-f" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-r" x="3600"/><use href="#m5-m" x="4200"/><use href="#m5-s" x="4800"/></g><rect x="552" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(572.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/><use href="#i7-I" x="7926"/></g><g transform="translate(572.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-b" x="0"/><use href="#f9-u" x="1095"/><use href="#f9-i" x="2222"/><use href="#f9-l" x="2774"/><use href="#f9-d" x="3346"/><use href="#f9-i" x="4441"/><use href="#f9-n" x="4993"/><use href="#f9-g" x="6117"/><use href="#f9-t" x="7489"/><use href="#f9-h" x="8177"/><use href="#f9-e" x="9296"/></g><g transform="translate(572.0 306.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-p" x="0"/><use href="#f9-i" x="1105"/><use href="#f9-c" x="1657"/><use href="#f9-t" x="2564"/><use href="#f9-u" x="3252"/><use href="#f9-r" x="4379"/><use href="#f9-e" x="5275"/></g><circle cx="576" cy="345" r="4" fill="#E9B949"/><g transform="translate(588.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-r" x="3000"/></g><circle cx="576" cy="379" r="4" fill="#E9B949"/><g transform="translate(588.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-i" x="4800"/></g><circle cx="576" cy="413" r="4" fill="#E9B949"/><g transform="translate(588.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-s" x="5400"/></g><circle cx="576" cy="447" r="4" fill="#E9B949"/><g transform="translate(588.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-s" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-t" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-n" x="5400"/><use href="#m5-s" x="6000"/></g><circle cx="576" cy="481" r="4" fill="#E9B949"/><g transform="translate(588.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-d" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-t" x="2400"/></g><circle cx="576" cy="515" r="4" fill="#E9B949"/><g transform="translate(588.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-f" x="0"/><use href="#m5-i" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-m" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-a" x="3000"/><use href="#m5-p" x="3600"/><use href="#m5-i" x="4200"/></g><circle cx="576" cy="549" r="4" fill="#E9B949"/><g transform="translate(588.0 555.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-e" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="576" cy="583" r="4" fill="#E9B949"/><g transform="translate(588.0 589.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-a" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-m" x="2400"/></g><circle cx="576" cy="617" r="4" fill="#E9B949"/><g transform="translate(588.0 623.0) scale(0.01700)" fill="#B6A795"><use href="#m5-h" x="0"/><use href="#m5-t" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-l" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-x" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-t" x="6000"/></g><circle cx="576" cy="651" r="4" fill="#E9B949"/><g transform="translate(588.0 657.0) scale(0.01700)" fill="#B6A795"><use href="#m5-d" x="0"/><use href="#m5-e" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-u" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-i" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-g" x="4800"/><use href="#m5-hyphen" x="5400"/><use href="#m5-r" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-n" x="7200"/><use href="#m5-d" x="7800"/><use href="#m5-e" x="8400"/><use href="#m5-r" x="9000"/><use href="#m5-s" x="9600"/></g><rect x="808" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(828.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-V" x="7023"/></g><g transform="translate(828.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-s" x="0"/><use href="#f9-o" x="842"/><use href="#f9-u" x="1890"/><use href="#f9-n" x="3017"/><use href="#f9-d" x="4141"/><use href="#f9-a" x="5536"/><use href="#f9-n" x="6536"/><use href="#f9-d" x="7660"/><use href="#f9-v" x="9055"/><use href="#f9-o" x="9941"/><use href="#f9-i" x="10989"/><use href="#f9-c" x="11541"/><use href="#f9-e" x="12448"/></g><circle cx="832" cy="345" r="4" fill="#E9B949"/><g transform="translate(844.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-u" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/></g><circle cx="832" cy="379" r="4" fill="#E9B949"/><g transform="translate(844.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-m" x="0"/><use href="#m5-u" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-c" x="2400"/></g><circle cx="832" cy="413" r="4" fill="#E9B949"/><g transform="translate(844.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-y" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-h" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/></g><circle cx="832" cy="447" r="4" fill="#E9B949"/><g transform="translate(844.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-s" x="0"/><use href="#m5-o" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-e" x="4200"/><use href="#m5-s" x="4800"/><use href="#m5-i" x="5400"/><use href="#m5-g" x="6000"/><use href="#m5-n" x="6600"/></g><circle cx="832" cy="481" r="4" fill="#E9B949"/><g transform="translate(844.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-v" x="0"/><use href="#m5-o" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-c" x="1800"/><use href="#m5-e" x="2400"/></g><rect x="1064" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1084.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-V" x="6121"/></g><g transform="translate(1084.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-f" x="0"/><use href="#f9-o" x="636"/><use href="#f9-o" x="1684"/><use href="#f9-t" x="2732"/><use href="#f9-a" x="3420"/><use href="#f9-g" x="4420"/><use href="#f9-e" x="5492"/><use href="#f9-comma" x="6448"/><use href="#f9-c" x="7278"/><use href="#f9-a" x="8185"/><use href="#f9-p" x="9185"/><use href="#f9-t" x="10290"/><use href="#f9-u" x="10978"/><use href="#f9-r" x="12105"/><use href="#f9-e" x="13001"/></g><g transform="translate(1084.0 306.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-a" x="0"/><use href="#f9-n" x="1000"/><use href="#f9-d" x="2124"/><use href="#f9-a" x="3519"/><use href="#f9-s" x="4519"/><use href="#f9-s" x="5361"/><use href="#f9-e" x="6203"/><use href="#f9-t" x="7159"/><use href="#f9-s" x="7847"/></g><circle cx="1088" cy="345" r="4" fill="#E9B949"/><g transform="translate(1100.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-e" x="0"/><use href="#m5-d" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="1088" cy="379" r="4" fill="#E9B949"/><g transform="translate(1100.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-s" x="4200"/></g><circle cx="1088" cy="413" r="4" fill="#E9B949"/><g transform="translate(1100.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-f" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-o" x="6000"/><use href="#m5-l" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="1088" cy="447" r="4" fill="#E9B949"/><g transform="translate(1100.0 453.0) scale(0.01700)" fill="#B6A795"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-e" x="3600"/></g><circle cx="1088" cy="481" r="4" fill="#E9B949"/><g transform="translate(1100.0 487.0) scale(0.01700)" fill="#B6A795"><use href="#m5-t" x="0"/><use href="#m5-u" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-l" x="4200"/><use href="#m5-hyphen" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/><use href="#m5-c" x="6600"/><use href="#m5-o" x="7200"/><use href="#m5-r" x="7800"/><use href="#m5-d" x="8400"/><use href="#m5-i" x="9000"/><use href="#m5-n" x="9600"/><use href="#m5-g" x="10200"/></g><circle cx="1088" cy="515" r="4" fill="#E9B949"/><g transform="translate(1100.0 521.0) scale(0.01700)" fill="#B6A795"><use href="#m5-a" x="0"/><use href="#m5-s" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><rect x="1320" y="206" width="240" height="524" rx="16" fill="#231916" stroke="#4A3730" stroke-width="1.5"/><g transform="translate(1340.0 242.0) scale(0.00732)" fill="#E9B949"><use href="#i7-F" x="0"/><use href="#i7-I" x="1530"/><use href="#i7-N" x="2432"/><use href="#i7-A" x="4321"/><use href="#i7-L" x="6178"/><use href="#i7-E" x="7663"/></g><g transform="translate(1340.0 278.0) scale(0.01250)" fill="#F5EBDC"><use href="#f9-p" x="0"/><use href="#f9-r" x="1105"/><use href="#f9-o" x="2001"/><use href="#f9-o" x="3049"/><use href="#f9-f" x="4097"/><use href="#f9-i" x="5033"/><use href="#f9-t" x="5585"/><use href="#f9-i" x="6573"/><use href="#f9-s" x="7125"/><use href="#f9-d" x="8267"/><use href="#f9-o" x="9362"/><use href="#f9-n" x="10410"/><use href="#f9-e" x="11534"/></g><circle cx="1344" cy="345" r="4" fill="#E9B949"/><g transform="translate(1356.0 351.0) scale(0.01700)" fill="#B6A795"><use href="#m5-q" x="0"/><use href="#m5-a" x="600"/></g><circle cx="1344" cy="379" r="4" fill="#E9B949"/><g transform="translate(1356.0 385.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-v" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-w" x="3000"/></g><circle cx="1344" cy="413" r="4" fill="#E9B949"/><g transform="translate(1356.0 419.0) scale(0.01700)" fill="#B6A795"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-p" x="3000"/><use href="#m5-t" x="3600"/></g></svg>
\ No newline at end of file
diff --git a/assets/readme/diagrams/docs-map-light.svg b/assets/readme/diagrams/docs-map-light.svg
index e7fa0d5..9715c47 100644
--- a/assets/readme/diagrams/docs-map-light.svg
+++ b/assets/readme/diagrams/docs-map-light.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 770" width="1600" height="770" role="img" aria-labelledby="t d"><title id="t">The documentation map</title><desc id="d">Every showtime guide in running order: Choose your path : launch-video, explainer, tutorial, social-short, data-story, footage-edit, trailer, slideshow, changelog-video, music-video, voiceover-only, localize, repo-explainer, paper-explainer; Act I Before the curtain: agents, onboarding, modes, studio, boards, crew, looking, GitHub Action, harness-notes, mcp, diagnosing; Act II Story and craft: story, tones, pacing, motion-craft, typography, color, brand-kit, reference, platforms; Act III Building the picture: render, stage-api, components, transitions, adopt, film-api, series, manim, html-export, debugging-renders; Act IV Sound and voice: audio, music, synth-score, sound-design, voice; Act V Footage, capture and assets: editing, captions, footage-tools, capture, tutorial-recording, assets; Finale Proof it is done: qa, review, receipt</desc><style>@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i7-A" d="M49 0 558 -1490H958L1480 0H1141L902 -719Q859 -858 814 -1024Q770 -1189 721 -1385H788Q740 -1188 698 -1022Q657 -855 616 -719L386 0ZM367 -346V-585H1162V-346Z"/><path id="i7-C" d="M786 20Q588 20 432 -70Q275 -160 184 -331Q94 -502 94 -744Q94 -987 185 -1158Q276 -1330 433 -1420Q590 -1510 786 -1510Q913 -1510 1022 -1474Q1132 -1439 1217 -1371Q1302 -1303 1356 -1204Q1410 -1106 1427 -980H1118Q1108 -1042 1080 -1090Q1051 -1137 1008 -1170Q966 -1204 911 -1222Q856 -1239 792 -1239Q676 -1239 588 -1181Q501 -1123 452 -1012Q404 -902 404 -744Q404 -583 453 -473Q502 -363 589 -307Q676 -251 791 -251Q855 -251 910 -268Q964 -286 1008 -320Q1051 -353 1080 -401Q1108 -449 1119 -510H1428Q1416 -406 1366 -311Q1317 -216 1235 -141Q1153 -66 1040 -23Q927 20 786 20Z"/><path id="i7-E" d="M135 0V-1490H1132V-1237H440V-877H1080V-628H440V-253H1134V0Z"/><path id="i7-F" d="M135 0V-1490H1115V-1237H440V-821H1049V-572H440V0Z"/><path id="i7-H" d="M135 0V-1490H440V-888H1089V-1490H1395V0H1089V-635H440V0Z"/><path id="i7-I" d="M440 -1490V0H135V-1490Z"/><path id="i7-K" d="M360 -337V-615Q406 -698 450 -768Q494 -838 547 -908Q600 -979 668 -1062L1033 -1490H1406L777 -762L752 -771ZM135 0V-1490H440V-1083L435 -703L440 -554V0ZM1061 0 619 -672 812 -900 1422 0Z"/><path id="i7-L" d="M135 0V-1490H440V-253H1083V0Z"/><path id="i7-N" d="M135 0V-1490H475L946 -736Q982 -678 1019 -610Q1056 -542 1094 -459Q1133 -376 1171 -272H1140Q1133 -355 1128 -449Q1122 -543 1118 -629Q1114 -715 1114 -775V-1490H1426V0H1085L657 -684Q610 -761 570 -834Q530 -906 486 -994Q443 -1081 383 -1203H422Q428 -1095 434 -996Q440 -897 444 -816Q447 -736 447 -685V0Z"/><path id="i7-O" d="M789 20Q592 20 434 -70Q277 -160 186 -331Q94 -502 94 -744Q94 -987 186 -1158Q277 -1330 434 -1420Q592 -1510 789 -1510Q987 -1510 1144 -1420Q1301 -1330 1392 -1158Q1484 -987 1484 -744Q1484 -502 1392 -331Q1301 -160 1144 -70Q987 20 789 20ZM789 -251Q905 -251 992 -308Q1078 -364 1126 -474Q1174 -585 1174 -744Q1174 -905 1126 -1016Q1078 -1126 992 -1182Q905 -1239 789 -1239Q674 -1239 587 -1182Q500 -1125 452 -1014Q404 -904 404 -744Q404 -585 452 -475Q500 -365 587 -308Q674 -251 789 -251Z"/><path id="i7-P" d="M135 0V-1490H716Q886 -1490 1005 -1426Q1124 -1361 1186 -1248Q1249 -1134 1249 -987Q1249 -839 1186 -726Q1122 -614 1002 -550Q881 -487 709 -487H335V-733H660Q754 -733 814 -766Q875 -798 904 -855Q934 -912 934 -987Q934 -1062 904 -1118Q875 -1175 814 -1206Q753 -1238 659 -1238H440V0Z"/><path id="i7-R" d="M135 0V-1490H716Q886 -1490 1005 -1430Q1124 -1370 1186 -1261Q1249 -1152 1249 -1005Q1249 -858 1186 -752Q1122 -645 1002 -588Q881 -532 709 -532H315V-779H660Q754 -779 814 -804Q874 -830 904 -880Q934 -931 934 -1005Q934 -1081 904 -1132Q874 -1184 814 -1211Q753 -1238 659 -1238H440V0ZM964 0 601 -678H932L1302 0Z"/><path id="i7-S" d="M681 22Q502 22 370 -33Q237 -88 163 -196Q89 -304 85 -462H382Q388 -387 427 -336Q466 -286 531 -261Q596 -236 678 -236Q760 -236 820 -260Q881 -283 915 -326Q949 -369 949 -426Q949 -477 918 -512Q888 -546 831 -571Q774 -596 692 -615L528 -656Q339 -702 232 -800Q125 -899 125 -1061Q125 -1196 198 -1297Q270 -1398 396 -1454Q523 -1510 685 -1510Q850 -1510 973 -1454Q1096 -1397 1165 -1296Q1234 -1196 1236 -1065H941Q933 -1155 864 -1204Q796 -1253 682 -1253Q605 -1253 550 -1231Q495 -1209 466 -1170Q438 -1131 438 -1081Q438 -1026 471 -990Q504 -953 559 -930Q614 -908 676 -893L811 -860Q905 -839 986 -803Q1067 -767 1128 -714Q1189 -662 1222 -590Q1256 -518 1256 -424Q1256 -289 1188 -188Q1120 -88 991 -33Q862 22 681 22Z"/><path id="i7-T" d="M75 -1237V-1490H1292V-1237H837V0H531V-1237Z"/><path id="i7-U" d="M749 21Q565 21 426 -48Q288 -116 212 -238Q135 -360 135 -523V-1490H440V-548Q440 -461 478 -394Q517 -326 586 -288Q656 -249 749 -249Q843 -249 912 -288Q982 -326 1020 -394Q1059 -461 1059 -548V-1490H1365V-523Q1365 -360 1288 -238Q1211 -116 1072 -48Q934 21 749 21Z"/><path id="i7-V" d="M571 0 49 -1490H388L626 -771Q669 -635 713 -472Q757 -308 806 -114H740Q788 -310 830 -472Q872 -635 913 -771L1143 -1490H1480L970 0Z"/><path id="i7-W" d="M449 0 49 -1490H382L555 -757Q576 -665 594 -560Q611 -456 628 -350Q645 -245 661 -148H607Q625 -245 643 -350Q661 -456 680 -560Q699 -665 722 -757L904 -1490H1221L1402 -757Q1425 -665 1444 -560Q1463 -456 1482 -350Q1500 -245 1518 -148H1462Q1479 -245 1496 -350Q1512 -456 1530 -560Q1549 -665 1569 -757L1742 -1490H2076L1675 0H1327L1129 -762Q1097 -889 1074 -1037Q1052 -1185 1024 -1342H1100Q1069 -1189 1050 -1043Q1030 -897 995 -762L798 0Z"/><path id="i7-Y" d="M601 0V-560L49 -1490H406L658 -1026Q697 -956 727 -887Q757 -818 789 -722H722Q753 -819 782 -888Q811 -957 848 -1026L1092 -1490H1448L905 -560V0Z"/><path id="i7-four" d="M101 -265V-506L724 -1490H931V-1154H808L409 -523V-511H1293V-265ZM814 0V-338L820 -446V-1490H1107V0Z"/><path id="i7-one" d="M749 -1490V0H444V-1221H434L93 -979V-1259L422 -1490Z"/><path id="i7-periodcentered" d="M342 -535Q269 -535 219 -584Q169 -634 169 -707Q169 -780 219 -830Q269 -879 342 -879Q415 -879 465 -830Q515 -780 515 -707Q515 -634 465 -584Q415 -535 342 -535Z"/><path id="m5-A" d="M43 0 229 -730H371L557 0H448L404 -185H197L153 0ZM217 -274H383L333 -485Q320 -541 311 -582Q303 -624 300 -639Q297 -624 289 -583Q281 -541 267 -486Z"/><path id="m5-G" d="M304 10Q236 10 185 -16Q135 -41 107 -90Q80 -138 80 -203V-527Q80 -593 107 -641Q135 -689 185 -714Q236 -740 304 -740Q372 -740 422 -714Q472 -688 500 -640Q527 -593 527 -527H419Q419 -584 389 -614Q359 -644 304 -644Q249 -644 218 -614Q188 -584 188 -528V-203Q188 -147 218 -116Q249 -85 304 -85Q359 -85 389 -116Q419 -147 419 -203V-285H283V-380H527V-203Q527 -138 500 -90Q472 -42 422 -16Q372 10 304 10Z"/><path id="m5-H" d="M85 0V-730H193V-428H407V-730H515V0H407V-328H193V0Z"/><path id="m5-a" d="M245 10Q159 10 110 -35Q60 -79 60 -156Q60 -234 112 -279Q165 -323 257 -323H410V-374Q410 -419 382 -444Q354 -469 303 -469Q258 -469 228 -450Q198 -430 193 -398H87Q96 -472 155 -516Q215 -560 306 -560Q404 -560 461 -510Q518 -461 518 -376V0H413V-101H395L413 -121Q413 -61 367 -25Q321 10 245 10ZM277 -73Q335 -73 373 -102Q410 -132 410 -178V-250H259Q217 -250 193 -227Q168 -204 168 -164Q168 -122 197 -97Q226 -73 277 -73Z"/><path id="m5-b" d="M339 10Q271 10 231 -27Q191 -65 191 -130L214 -105H191V0H84V-730H192V-573L189 -445H214L191 -420Q191 -485 231 -522Q272 -560 339 -560Q422 -560 472 -504Q522 -448 522 -352V-197Q522 -102 472 -46Q422 10 339 10ZM302 -84Q355 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q355 -466 302 -466Q251 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q251 -84 302 -84Z"/><path id="m5-c" d="M304 10Q236 10 184 -16Q133 -41 105 -90Q78 -138 78 -203V-347Q78 -413 105 -461Q133 -509 184 -534Q236 -560 304 -560Q403 -560 463 -508Q523 -456 526 -366H418Q415 -413 385 -439Q355 -465 304 -465Q249 -465 217 -435Q185 -404 185 -348V-203Q185 -147 217 -116Q249 -85 304 -85Q355 -85 385 -111Q415 -137 418 -184H526Q523 -94 463 -42Q403 10 304 10Z"/><path id="m5-d" d="M261 10Q178 10 128 -46Q78 -102 78 -197V-352Q78 -448 128 -504Q178 -560 261 -560Q329 -560 369 -522Q409 -485 409 -420L386 -445H411L408 -573V-730H516V0H409V-105H386L409 -130Q409 -65 369 -27Q329 10 261 10ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 215 -436Q185 -405 185 -347V-203Q185 -145 215 -114Q245 -84 298 -84Z"/><path id="m5-e" d="M300 10Q233 10 183 -16Q132 -43 105 -91Q78 -139 78 -203V-347Q78 -412 105 -459Q132 -507 183 -534Q233 -560 300 -560Q368 -560 418 -534Q468 -507 495 -459Q522 -412 522 -347V-249H182V-203Q182 -142 213 -110Q243 -78 301 -78Q348 -78 377 -94Q406 -111 413 -143H520Q508 -73 448 -32Q388 10 300 10ZM418 -314V-348Q418 -408 388 -441Q358 -474 300 -474Q243 -474 212 -441Q182 -408 182 -347V-322L426 -323Z"/><path id="m5-f" d="M213 0V-394H57V-492H213V-581Q213 -650 257 -690Q301 -730 377 -730H538V-634H379Q351 -634 336 -620Q320 -606 320 -580V-492H538V-394H320V0Z"/><path id="m5-g" d="M156 180V87H325Q367 87 388 67Q408 47 408 8V-47L410 -149H387L409 -169Q409 -106 370 -70Q330 -34 263 -34Q178 -34 129 -90Q80 -146 80 -241V-353Q80 -448 129 -504Q178 -560 263 -560Q330 -560 370 -524Q409 -487 409 -424L387 -445H409L408 -550H515V10Q515 89 465 134Q415 180 326 180ZM298 -127Q349 -127 379 -159Q408 -190 408 -246V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-246Q188 -189 216 -158Q245 -127 298 -127Z"/><path id="m5-h" d="M84 0V-730H192V-550L191 -445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -438Q352 -468 302 -468Q251 -468 222 -436Q192 -405 192 -347V0Z"/><path id="m5-hyphen" d="M140 -281V-379H460V-281Z"/><path id="m5-i" d="M81 0V-98H274V-452H106V-550H379V-98H556V0ZM316 -645Q281 -645 260 -664Q240 -682 240 -713Q240 -745 260 -763Q281 -782 316 -782Q352 -782 373 -763Q393 -745 393 -713Q393 -682 373 -664Q352 -645 316 -645Z"/><path id="m5-k" d="M87 0V-730H195V-329H292L438 -550H560L385 -286L563 0H439L292 -236H195V0Z"/><path id="m5-l" d="M379 0Q328 0 290 -21Q252 -41 230 -79Q209 -117 209 -167V-632H29V-730H317V-167Q317 -135 335 -116Q353 -98 384 -98H554V0Z"/><path id="m5-m" d="M59 0V-550H149V-480H169L154 -459Q154 -505 179 -533Q204 -560 246 -560Q291 -560 315 -525Q340 -490 340 -429L316 -480H354L338 -459Q338 -505 363 -533Q389 -560 432 -560Q483 -560 512 -521Q541 -483 541 -419V0H445V-416Q445 -447 432 -464Q418 -481 393 -481Q368 -481 355 -464Q341 -448 341 -417V0H260V-416Q260 -448 246 -464Q232 -481 206 -481Q181 -481 168 -464Q156 -448 156 -417V0Z"/><path id="m5-n" d="M84 0V-550H191V-445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -437Q352 -466 302 -466Q251 -466 222 -436Q192 -405 192 -347V0Z"/><path id="m5-o" d="M300 9Q232 9 182 -17Q132 -43 105 -91Q78 -139 78 -204V-346Q78 -412 105 -459Q132 -507 182 -533Q232 -559 300 -559Q368 -559 418 -533Q468 -507 495 -459Q522 -412 522 -346V-204Q522 -139 495 -91Q468 -43 418 -17Q368 9 300 9ZM300 -86Q355 -86 385 -117Q415 -147 415 -204V-346Q415 -404 385 -434Q355 -464 300 -464Q246 -464 216 -434Q185 -404 185 -346V-204Q185 -147 216 -117Q246 -86 300 -86Z"/><path id="m5-p" d="M84 180V-550H191V-445H214L191 -420Q191 -485 231 -523Q272 -560 340 -560Q423 -560 473 -504Q522 -449 522 -353V-198Q522 -134 500 -88Q477 -41 437 -15Q396 10 340 10Q273 10 232 -28Q191 -65 191 -130L214 -105H189L192 23V180ZM303 -84Q356 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q356 -466 303 -466Q252 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q252 -84 303 -84Z"/><path id="m5-q" d="M408 180V23L411 -105H386L409 -130Q409 -65 369 -28Q329 10 261 10Q178 10 129 -46Q80 -102 80 -198V-353Q80 -449 129 -504Q178 -560 261 -560Q329 -560 369 -523Q409 -485 409 -420L386 -445H409V-550H516V180ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-203Q188 -145 216 -114Q245 -84 298 -84Z"/><path id="m5-r" d="M102 0V-550H206V-445H232L199 -380Q199 -469 238 -515Q277 -560 354 -560Q442 -560 494 -505Q545 -451 545 -356V-319H434V-347Q434 -406 404 -438Q375 -469 322 -469Q269 -469 240 -437Q210 -405 210 -347V0Z"/><path id="m5-s" d="M281 9Q222 9 177 -10Q133 -29 107 -63Q82 -96 78 -142H186Q190 -115 215 -99Q240 -82 281 -82H324Q373 -82 398 -102Q423 -122 423 -155Q423 -187 400 -205Q378 -224 334 -230L263 -241Q175 -255 134 -291Q92 -328 92 -400Q92 -476 141 -517Q191 -559 288 -559H326Q412 -559 463 -520Q515 -480 522 -414H414Q410 -438 387 -453Q365 -468 326 -468H288Q241 -468 220 -450Q198 -433 198 -399Q198 -369 217 -354Q236 -339 276 -333L349 -321Q442 -308 485 -269Q529 -231 529 -158Q529 -79 478 -35Q426 9 324 9Z"/><path id="m5-t" d="M360 0Q285 0 243 -41Q201 -82 201 -155V-452H49V-550H201V-705H309V-550H524V-452H309V-155Q309 -98 364 -98H514V0Z"/><path id="m5-u" d="M299 10Q200 10 141 -48Q82 -105 82 -204V-550H190V-204Q190 -147 219 -116Q248 -84 299 -84Q351 -84 380 -116Q410 -147 410 -204V-550H518V-204Q518 -105 458 -47Q399 10 299 10Z"/><path id="m5-v" d="M229 0 47 -550H157L270 -198Q281 -167 289 -136Q298 -104 302 -86Q307 -104 316 -136Q324 -167 333 -198L444 -550H553L371 0Z"/><path id="m5-w" d="M113 0 28 -550H119L170 -187Q174 -162 177 -131Q181 -101 183 -81Q185 -101 190 -131Q194 -161 198 -187L255 -550H346L402 -187Q406 -161 410 -131Q415 -100 417 -80Q419 -101 424 -131Q428 -162 432 -187L484 -550H572L484 0H370L316 -359Q312 -387 307 -418Q302 -450 300 -469Q297 -450 293 -418Q288 -387 284 -359L228 0Z"/><path id="m5-x" d="M43 0 236 -284 55 -550H179L276 -398Q283 -386 290 -372Q297 -359 301 -350Q304 -359 311 -372Q318 -386 325 -398L422 -550H546L365 -283L557 0H433L326 -165Q319 -177 312 -192Q305 -207 301 -216Q297 -207 289 -192Q282 -177 274 -165L166 0Z"/><path id="m5-y" d="M172 180 251 -32 46 -550H165L280 -240Q287 -220 294 -192Q301 -164 306 -146Q310 -164 317 -192Q324 -220 331 -240L439 -550H554L286 180Z"/><path id="m8-a" d="M229 10Q146 10 98 -35Q49 -80 49 -157Q49 -240 106 -284Q164 -329 272 -329H386V-370Q386 -402 364 -421Q341 -440 303 -440Q268 -440 245 -424Q222 -408 217 -380H72Q81 -463 144 -512Q208 -560 308 -560Q413 -560 474 -508Q536 -457 536 -370V0H391V-90H367L392 -125Q392 -63 347 -26Q303 10 229 10ZM285 -100Q329 -100 358 -124Q386 -147 386 -185V-244H275Q241 -244 220 -224Q199 -205 199 -173Q199 -139 222 -120Q245 -100 285 -100Z"/><path id="m8-c" d="M303 10Q230 10 175 -18Q120 -45 90 -94Q60 -144 60 -210V-340Q60 -407 90 -456Q120 -505 175 -532Q230 -560 303 -560Q412 -560 477 -505Q542 -450 546 -355H396Q393 -390 368 -410Q344 -430 303 -430Q258 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q258 -120 303 -120Q344 -120 368 -140Q393 -159 396 -195H546Q542 -100 477 -45Q412 10 303 10Z"/><path id="m8-d" d="M243 10Q160 10 110 -48Q60 -106 60 -205V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -580V-730H534V0H389V-105H354L389 -140Q389 -69 350 -30Q311 10 243 10ZM297 -120Q338 -120 361 -144Q384 -167 384 -210V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-210Q210 -167 232 -144Q255 -120 297 -120Z"/><path id="m8-e" d="M301 10Q228 10 174 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 174 -532Q228 -560 301 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-240H203V-210Q203 -158 228 -132Q253 -105 303 -105Q338 -105 360 -117Q381 -129 388 -150H535Q517 -78 454 -34Q390 10 301 10ZM397 -317V-342Q397 -393 374 -420Q350 -447 301 -447Q252 -447 228 -419Q203 -391 203 -340V-325L407 -327Z"/><path id="m8-f" d="M195 0V-350H49V-485H195V-560Q195 -637 248 -684Q300 -730 385 -730H546V-600H390Q370 -600 358 -588Q345 -575 345 -555V-485H546V-350H345V0Z"/><path id="m8-g" d="M145 180V60H300Q342 60 364 39Q387 18 387 -19V-40L389 -145H354L389 -180Q389 -109 350 -70Q311 -30 243 -30Q160 -30 110 -88Q60 -146 60 -245V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -550H534V-14Q534 76 472 128Q411 180 305 180ZM297 -160Q338 -160 361 -184Q384 -207 384 -250V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-250Q210 -207 232 -184Q255 -160 297 -160Z"/><path id="m8-h" d="M66 0V-730H216V-550L211 -445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-hyphen" d="M140 -260V-400H460V-260Z"/><path id="m8-i" d="M70 0V-136H260V-415H95V-550H400V-136H560V0ZM320 -637Q279 -637 254 -658Q230 -679 230 -715Q230 -751 254 -772Q279 -793 320 -793Q361 -793 386 -772Q410 -751 410 -715Q410 -679 386 -658Q361 -637 320 -637Z"/><path id="m8-l" d="M390 0Q332 0 288 -24Q244 -49 220 -93Q195 -137 195 -195V-595H25V-730H345V-195Q345 -168 362 -152Q378 -135 405 -135H565V0Z"/><path id="m8-m" d="M42 0V-550H160V-470H184L165 -456Q165 -503 192 -532Q219 -560 259 -560Q302 -560 326 -523Q350 -486 350 -425L332 -470H360L351 -456Q351 -503 377 -532Q403 -560 447 -560Q497 -560 528 -522Q559 -485 559 -420V0H430V-410Q430 -433 420 -446Q410 -458 391 -458Q372 -458 362 -446Q352 -433 352 -410V0H249V-410Q249 -433 239 -446Q229 -458 210 -458Q191 -458 181 -446Q171 -433 171 -410V0Z"/><path id="m8-n" d="M66 0V-550H211V-445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-o" d="M300 10Q227 10 173 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 173 -532Q227 -560 300 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-210Q540 -144 510 -94Q481 -45 428 -18Q374 10 300 10ZM300 -120Q344 -120 367 -144Q390 -167 390 -210V-340Q390 -384 367 -407Q344 -430 300 -430Q257 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q257 -120 300 -120Z"/><path id="m8-p" d="M66 180V-550H211V-445H246L211 -410Q211 -481 250 -520Q289 -560 357 -560Q440 -560 490 -502Q540 -443 540 -345V-205Q540 -140 518 -92Q495 -43 454 -16Q413 10 357 10Q289 10 250 -30Q211 -69 211 -140L246 -105H211L216 30V180ZM303 -120Q345 -120 368 -144Q390 -167 390 -210V-340Q390 -384 368 -407Q345 -430 303 -430Q262 -430 239 -406Q216 -383 216 -340V-210Q216 -167 239 -144Q262 -120 303 -120Z"/><path id="m8-r" d="M82 0V-550H222V-445H260L217 -381Q217 -470 258 -515Q299 -560 378 -560Q469 -560 520 -505Q570 -450 570 -350V-305H410V-340Q410 -385 386 -410Q361 -435 320 -435Q277 -435 254 -410Q232 -385 232 -340V0Z"/><path id="m8-s" d="M277 10Q209 10 158 -12Q107 -33 78 -71Q50 -109 50 -160H200Q200 -136 222 -122Q243 -107 277 -107H321Q362 -107 384 -122Q405 -137 405 -164Q405 -189 386 -202Q367 -216 327 -221L263 -229Q160 -242 113 -279Q66 -316 66 -392Q66 -472 121 -516Q176 -560 282 -560H320Q421 -560 481 -516Q541 -472 541 -398H391Q391 -418 372 -430Q352 -443 320 -443H282Q245 -443 228 -430Q211 -418 211 -393Q211 -370 226 -358Q242 -346 276 -341L345 -332Q449 -319 500 -280Q550 -241 550 -164Q550 -80 492 -35Q434 10 321 10Z"/><path id="m8-t" d="M360 0Q276 0 228 -48Q180 -96 180 -180V-415H35V-550H180V-705H330V-550H535V-415H330V-180Q330 -135 375 -135H525V0Z"/><path id="m8-u" d="M300 10Q189 10 126 -50Q64 -110 64 -214V-550H214V-215Q214 -169 236 -144Q258 -120 300 -120Q341 -120 364 -144Q386 -169 386 -215V-550H536V-214Q536 -109 473 -50Q410 10 300 10Z"/><path id="m8-v" d="M207 0 27 -550H182L274 -241Q282 -213 290 -180Q298 -147 302 -127Q307 -147 314 -180Q322 -213 329 -240L420 -550H573L395 0Z"/><path id="m8-w" d="M90 0 10 -550H130L170 -250Q175 -217 178 -175Q182 -133 184 -106Q187 -133 192 -174Q198 -216 203 -250L249 -550H353L397 -250Q402 -216 408 -174Q413 -132 416 -105Q418 -133 422 -176Q427 -218 431 -250L473 -550H590L509 0H359L318 -310Q314 -338 309 -377Q304 -416 301 -442Q297 -416 292 -377Q287 -338 283 -310L241 0Z"/><path id="m8-x" d="M26 0 216 -285 39 -550H206L274 -440Q282 -427 289 -411Q296 -395 300 -385Q304 -395 312 -411Q319 -427 326 -440L394 -550H561L385 -285L574 0H407L327 -130Q319 -144 312 -160Q304 -175 300 -185Q296 -175 289 -160Q282 -144 274 -130L193 0Z"/><path id="m8-y" d="M157 180 232 -27 26 -550H189L272 -310Q281 -283 290 -244Q300 -206 305 -182Q310 -206 320 -244Q329 -283 338 -310L418 -550H574L314 180Z"/><path id="m8-z" d="M70 0V-130L342 -420H80V-550H519V-420L247 -130H530V0Z"/><path id="f9-a" d="M544 -93V-107L526 -90V-820Q526 -856 508 -877Q489 -898 462 -898Q428 -898 408 -877Q388 -856 388 -820V-714Q388 -647 337 -596Q286 -546 204 -546Q149 -546 114 -577Q78 -608 78 -672Q78 -727 126 -784Q174 -840 270 -878Q365 -916 507 -916Q699 -916 794 -842Q890 -768 890 -628V-134Q890 -110 900 -98Q911 -86 926 -86Q941 -86 956 -98Q970 -109 974 -140Q975 -145 976 -146Q978 -148 980 -148Q983 -148 984 -146Q986 -145 986 -140Q986 -117 962 -79Q939 -41 884 -10Q830 20 736 20Q632 20 588 -14Q544 -47 544 -93ZM22 -200Q22 -321 122 -390Q223 -458 460 -458Q505 -458 530 -448Q556 -439 578 -422L568 -414Q544 -428 523 -433Q502 -438 474 -438Q430 -438 404 -392Q378 -346 378 -250Q378 -160 405 -120Q432 -80 474 -80Q497 -80 521 -96Q545 -113 559 -138L573 -130Q533 -57 456 -18Q378 20 288 20Q173 20 98 -42Q22 -104 22 -200Z"/><path id="f9-b" d="M442 -1496V-49L118 14Q112 15 106 16Q99 18 94 18Q88 18 84 14Q80 11 80 6V-1366Q80 -1374 76 -1378Q72 -1382 63 -1382H24Q17 -1382 14 -1384Q12 -1387 12 -1391Q12 -1395 15 -1397Q18 -1399 22 -1400L401 -1505Q413 -1508 418 -1509Q422 -1510 428 -1510Q435 -1510 438 -1506Q442 -1502 442 -1496ZM420 -744 404 -762Q461 -840 526 -878Q592 -916 680 -916Q796 -916 882 -864Q967 -813 1014 -716Q1060 -618 1060 -479Q1060 -329 1004 -216Q949 -104 851 -42Q753 20 626 20Q534 20 482 -8Q430 -35 398 -96L424 -108Q440 -66 466 -46Q493 -26 532 -26Q580 -26 616 -60Q652 -95 672 -187Q692 -279 692 -449Q692 -599 676 -686Q660 -772 631 -809Q602 -846 562 -846Q522 -846 486 -821Q449 -796 420 -744Z"/><path id="f9-c" d="M881 -652Q881 -577 838 -532Q796 -488 719 -488Q641 -488 597 -534Q553 -581 553 -670V-770Q553 -830 533 -861Q513 -892 480 -892Q445 -892 419 -858Q393 -823 380 -756Q366 -690 366 -594Q366 -466 400 -378Q433 -290 492 -245Q552 -200 630 -200Q719 -200 779 -232Q839 -263 855 -334Q856 -339 858 -341Q861 -343 864 -342Q867 -341 868 -338Q870 -335 869 -330Q852 -220 796 -142Q740 -64 652 -22Q563 20 447 20Q324 20 228 -30Q132 -79 77 -178Q22 -276 22 -422Q22 -567 84 -678Q146 -789 254 -852Q363 -916 504 -916Q630 -916 714 -882Q797 -847 839 -788Q881 -728 881 -652Z"/><path id="f9-comma" d="M288 0Q174 0 117 -52Q60 -104 60 -197Q60 -282 119 -338Q178 -395 269 -395Q352 -395 416 -330Q480 -266 480 -138Q480 -35 460 47Q439 129 398 192Q357 254 294 298Q232 341 149 368Q142 370 136 366Q130 363 130 358Q130 351 134 348Q138 344 147 341Q246 305 302 254Q357 204 380 150Q402 96 402 52Q402 28 394 14Q386 0 359 0Z"/><path id="f9-d" d="M653 -99V-105V-1366Q653 -1374 649 -1378Q645 -1382 636 -1382H597Q590 -1382 588 -1384Q585 -1387 585 -1391Q585 -1395 588 -1397Q591 -1399 595 -1400L974 -1505Q986 -1508 990 -1509Q995 -1510 1001 -1510Q1008 -1510 1012 -1506Q1015 -1502 1015 -1496V-64Q1015 -48 1020 -38Q1026 -29 1039 -26L1077 -17Q1084 -16 1086 -14Q1089 -11 1089 -8Q1089 -4 1086 -2Q1084 0 1079 0H677Q665 0 659 -6Q653 -12 653 -22ZM35 -417Q35 -568 90 -680Q146 -792 244 -854Q342 -916 469 -916Q561 -916 613 -888Q665 -861 697 -800L671 -788Q655 -830 628 -850Q602 -870 563 -870Q515 -870 479 -836Q443 -801 423 -710Q403 -618 403 -447Q403 -298 419 -211Q435 -124 464 -87Q493 -50 533 -50Q574 -50 610 -75Q646 -100 675 -152L691 -134Q634 -56 568 -18Q503 20 415 20Q299 20 214 -32Q128 -83 82 -181Q35 -279 35 -417Z"/><path id="f9-e" d="M928 -496Q928 -486 922 -479Q915 -472 900 -472H274V-496H552Q570 -496 570 -518Q570 -719 534 -806Q497 -894 458 -894Q431 -894 408 -866Q385 -837 370 -767Q356 -697 356 -574Q356 -367 439 -272Q522 -178 660 -178Q771 -178 840 -234Q910 -289 910 -382Q910 -387 912 -388Q915 -390 916 -390Q919 -390 922 -388Q924 -386 924 -380Q924 -266 866 -176Q809 -85 710 -32Q611 20 486 20Q350 20 245 -38Q140 -96 80 -199Q20 -302 20 -436Q20 -586 79 -694Q138 -801 246 -858Q355 -916 502 -916Q633 -916 728 -861Q824 -806 876 -711Q928 -616 928 -496Z"/><path id="f9-f" d="M486 -66Q486 -54 492 -46Q497 -39 510 -36L610 -18Q616 -17 620 -15Q624 -13 624 -8Q624 0 614 0H42Q39 0 36 -2Q34 -3 34 -6Q34 -9 36 -11Q38 -13 44 -14L114 -32Q125 -35 130 -41Q134 -47 134 -56V-832Q134 -838 131 -844Q128 -849 122 -850L24 -880Q20 -882 18 -884Q16 -885 16 -888Q16 -891 19 -894Q22 -896 26 -896H150L134 -884V-888Q134 -911 120 -935Q106 -959 88 -987Q70 -1015 56 -1051Q42 -1087 42 -1134Q42 -1277 125 -1354Q208 -1430 356 -1430Q453 -1430 515 -1398Q577 -1366 606 -1312Q636 -1259 636 -1194Q636 -1112 595 -1073Q554 -1034 488 -1034Q421 -1034 376 -1080Q332 -1127 332 -1202V-1342Q332 -1377 322 -1392Q311 -1406 286 -1406Q246 -1406 224 -1376Q202 -1347 202 -1288Q202 -1223 230 -1170Q259 -1118 301 -1075Q343 -1032 385 -996Q427 -961 456 -930Q484 -899 484 -870V-864L468 -896H618Q626 -896 629 -894Q632 -893 632 -888Q632 -879 622 -874Q613 -870 598 -870H486Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-l" d="M472 -1496V-64Q472 -48 478 -38Q483 -29 496 -26L534 -17Q541 -16 544 -14Q546 -11 546 -8Q546 -4 544 -2Q541 0 536 0H46Q42 0 39 -2Q36 -4 36 -8Q36 -11 38 -14Q41 -16 48 -17L86 -26Q100 -29 105 -38Q110 -48 110 -64V-1366Q110 -1374 106 -1378Q102 -1382 93 -1382H54Q47 -1382 44 -1384Q42 -1387 42 -1391Q42 -1395 45 -1397Q48 -1399 52 -1400L431 -1505Q443 -1508 448 -1509Q452 -1510 458 -1510Q465 -1510 468 -1506Q472 -1502 472 -1496Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-p" d="M452 -906V-798V-787V402Q452 418 458 428Q463 437 476 440L514 449Q521 450 524 452Q526 455 526 458Q526 462 524 464Q521 466 516 466H26Q22 466 19 464Q16 462 16 458Q16 455 18 452Q21 450 28 449L66 440Q80 437 85 428Q90 418 90 402V-776Q90 -784 86 -788Q82 -792 73 -792H34Q27 -792 24 -794Q22 -797 22 -801Q22 -805 25 -807Q28 -809 32 -810L411 -915Q423 -918 428 -919Q432 -920 438 -920Q445 -920 448 -916Q452 -912 452 -906ZM430 -744 414 -762Q471 -840 536 -878Q602 -916 690 -916Q806 -916 892 -864Q977 -813 1024 -716Q1070 -618 1070 -479Q1070 -329 1014 -216Q959 -104 861 -42Q763 20 636 20Q544 20 492 -8Q440 -35 408 -96L434 -108Q450 -66 476 -46Q503 -26 542 -26Q590 -26 626 -60Q662 -95 682 -187Q702 -279 702 -449Q702 -599 686 -686Q670 -772 641 -809Q612 -846 572 -846Q532 -846 496 -821Q459 -796 430 -744Z"/><path id="f9-r" d="M448 -540Q448 -664 488 -748Q527 -831 589 -874Q651 -916 718 -916Q800 -916 843 -862Q886 -808 886 -698Q886 -590 835 -538Q784 -486 707 -486Q636 -486 604 -524Q572 -563 568 -636L566 -674Q565 -696 557 -710Q549 -724 528 -724Q509 -724 494 -704Q480 -684 472 -641Q464 -598 464 -530ZM464 -894V-586V-74Q464 -61 471 -50Q478 -39 490 -36L588 -16Q594 -15 596 -13Q598 -11 598 -8Q598 -4 595 -2Q592 0 586 0H40Q34 0 31 -2Q28 -5 28 -8Q28 -11 32 -14Q36 -17 42 -18L78 -26Q92 -29 97 -38Q102 -46 102 -58V-782Q102 -791 98 -796Q95 -802 86 -802H42Q38 -802 35 -804Q32 -807 32 -810Q32 -813 35 -816Q38 -819 44 -820L424 -906Q433 -908 438 -909Q444 -910 450 -910Q458 -910 461 -905Q464 -900 464 -894Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-t" d="M80 -858 6 -878Q-1 -880 -4 -882Q-6 -885 -6 -888Q-6 -891 -4 -894Q-1 -896 2 -896H82Q85 -896 88 -897Q92 -898 98 -902L390 -1108Q398 -1114 407 -1118Q416 -1122 422 -1122Q430 -1122 435 -1116Q440 -1111 440 -1100V-290Q440 -201 472 -158Q504 -114 558 -114Q576 -114 592 -120Q609 -126 623 -140Q637 -154 648 -178Q659 -202 666 -238Q668 -246 674 -246Q680 -246 678 -238Q663 -151 630 -94Q596 -37 538 -8Q481 20 394 20Q246 20 169 -48Q92 -116 92 -258V-840Q92 -849 90 -853Q88 -857 80 -858ZM336 -870 348 -896H674Q679 -896 682 -894Q684 -893 684 -888Q684 -881 676 -876Q668 -870 654 -870Z"/><path id="f9-u" d="M665 -22V-170V-177V-772Q665 -780 661 -784Q657 -788 648 -788H609Q602 -788 600 -790Q597 -793 597 -797Q597 -801 600 -803Q603 -805 607 -806L986 -911Q997 -914 1002 -915Q1007 -916 1013 -916Q1020 -916 1024 -912Q1027 -908 1027 -902V-64Q1027 -48 1032 -38Q1038 -29 1051 -26L1089 -17Q1096 -16 1098 -14Q1101 -11 1101 -8Q1101 -4 1098 -2Q1096 0 1091 0H689Q677 0 671 -6Q665 -12 665 -22ZM90 -218V-772Q90 -780 86 -784Q82 -788 73 -788H34Q27 -788 24 -790Q22 -793 22 -797Q22 -801 25 -803Q28 -805 32 -806L411 -911Q423 -914 428 -915Q432 -916 438 -916Q445 -916 448 -912Q452 -908 452 -902V-256Q452 -195 476 -166Q499 -138 546 -138Q576 -138 606 -150Q637 -162 662 -184L700 -217L714 -202L674 -167Q562 -70 468 -25Q373 20 299 20Q206 20 148 -36Q90 -92 90 -218Z"/><path id="f9-v" d="M566 0H408Q399 0 393 -4Q387 -7 384 -16L74 -840Q69 -854 62 -861Q56 -868 46 -870L8 -879Q1 -881 -2 -883Q-4 -885 -4 -888Q-4 -893 -1 -894Q2 -896 6 -896H557Q567 -896 567 -888Q567 -885 564 -883Q562 -881 555 -879L507 -870Q462 -862 452 -850Q443 -838 451 -816L659 -245L587 -92L811 -770Q825 -811 810 -837Q794 -863 758 -870L710 -879Q703 -881 700 -883Q698 -885 698 -888Q698 -893 701 -894Q704 -896 708 -896H954Q959 -896 962 -894Q964 -893 964 -888Q964 -885 962 -883Q959 -881 952 -879L927 -873Q893 -865 872 -842Q852 -820 834 -764L588 -14Q586 -7 580 -4Q574 0 566 0Z"/><path id="f9-y" d="M692 -316 517 143 146 -708Q116 -778 86 -824Q57 -870 24 -877Q10 -880 7 -882Q4 -885 4 -888Q4 -893 7 -894Q10 -896 14 -896H564Q569 -896 572 -894Q574 -893 574 -888Q574 -884 572 -882Q569 -881 562 -879L514 -870Q489 -866 484 -842Q478 -818 497 -774ZM523 105 575 -33 592 -78 845 -763Q863 -813 851 -834Q839 -855 803 -865L755 -879Q748 -881 746 -883Q743 -885 743 -888Q743 -893 746 -894Q749 -896 753 -896H997Q1002 -896 1004 -894Q1007 -893 1007 -888Q1007 -885 1004 -883Q1002 -881 995 -879Q934 -866 908 -842Q881 -817 861 -762L532 126Q485 254 455 334Q425 415 384 452Q343 490 259 490Q160 490 99 428Q38 366 38 281Q38 210 75 172Q112 134 165 134Q212 134 244 162Q275 191 296 249L315 301Q328 335 345 367Q362 399 389 399Q408 399 426 362Q444 325 467 258Q490 192 523 105Z"/></defs><rect x="1" y="1" width="1598" height="768" rx="26" fill="#FBF6EE" stroke="#E6D8C4" stroke-width="2"/><g transform="translate(40.0 54.0) scale(0.00781)" fill="#B3121F"><use href="#i7-C" x="0"/><use href="#i7-H" x="1843"/><use href="#i7-O" x="3700"/><use href="#i7-O" x="5606"/><use href="#i7-S" x="7512"/><use href="#i7-E" x="9180"/><use href="#i7-Y" x="11565"/><use href="#i7-O" x="13301"/><use href="#i7-U" x="15207"/><use href="#i7-R" x="17034"/><use href="#i7-P" x="19519"/><use href="#i7-A" x="21004"/><use href="#i7-T" x="22679"/><use href="#i7-H" x="24373"/><use href="#i7-periodcentered" x="27044"/><use href="#i7-one" x="28868"/><use href="#i7-four" x="30079"/><use href="#i7-W" x="32604"/><use href="#i7-O" x="35007"/><use href="#i7-R" x="36912"/><use href="#i7-K" x="38585"/><use href="#i7-F" x="40386"/><use href="#i7-L" x="41915"/><use href="#i7-O" x="43343"/><use href="#i7-W" x="45199"/><use href="#i7-S" x="47639"/></g><rect x="40" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(57.0 101.0) scale(0.01900)" fill="#241915"><use href="#m8-l" x="0"/><use href="#m8-a" x="600"/><use href="#m8-u" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-h" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-v" x="4200"/><use href="#m8-i" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-e" x="6000"/><use href="#m8-o" x="6600"/></g><rect x="222.8" y="74" width="136.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(239.8 101.0) scale(0.01900)" fill="#241915"><use href="#m8-e" x="0"/><use href="#m8-x" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-l" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-n" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/></g><rect x="371.4" y="74" width="125.2" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(388.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-t" x="0"/><use href="#m8-u" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-a" x="3600"/><use href="#m8-l" x="4200"/></g><rect x="508.6" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(525.6 101.0) scale(0.01900)" fill="#241915"><use href="#m8-s" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-l" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-s" x="4200"/><use href="#m8-h" x="4800"/><use href="#m8-o" x="5400"/><use href="#m8-r" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="691.4" y="74" width="148" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(708.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-d" x="0"/><use href="#m8-a" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-t" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-y" x="5400"/></g><rect x="851.4" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(868.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-f" x="0"/><use href="#m8-o" x="600"/><use href="#m8-o" x="1200"/><use href="#m8-t" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-g" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-hyphen" x="4200"/><use href="#m8-e" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="1034.2" y="74" width="113.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1051.2 101.0) scale(0.01900)" fill="#241915"><use href="#m8-t" x="0"/><use href="#m8-r" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-r" x="3600"/></g><rect x="1160" y="74" width="136.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1177.0 101.0) scale(0.01900)" fill="#241915"><use href="#m8-s" x="0"/><use href="#m8-l" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-d" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-h" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-w" x="4800"/></g><rect x="1308.6" y="74" width="205" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1325.6 101.0) scale(0.01900)" fill="#241915"><use href="#m8-c" x="0"/><use href="#m8-h" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-g" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-l" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-g" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-v" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-d" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-o" x="8400"/></g><rect x="40" y="126" width="159.4" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(57.0 153.0) scale(0.01900)" fill="#241915"><use href="#m8-m" x="0"/><use href="#m8-u" x="600"/><use href="#m8-s" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-i" x="4200"/><use href="#m8-d" x="4800"/><use href="#m8-e" x="5400"/><use href="#m8-o" x="6000"/></g><rect x="211.4" y="126" width="193.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(228.4 153.0) scale(0.01900)" fill="#241915"><use href="#m8-v" x="0"/><use href="#m8-o" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-c" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-o" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-o" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-l" x="7200"/><use href="#m8-y" x="7800"/></g><rect x="417" y="126" width="125.2" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(434.0 153.0) scale(0.01900)" fill="#241915"><use href="#m8-l" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-z" x="3600"/><use href="#m8-e" x="4200"/></g><rect x="554.2" y="126" width="193.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(571.2 153.0) scale(0.01900)" fill="#241915"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-x" x="3600"/><use href="#m8-p" x="4200"/><use href="#m8-l" x="4800"/><use href="#m8-a" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-e" x="7200"/><use href="#m8-r" x="7800"/></g><rect x="759.8" y="126" width="205" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(776.8 153.0) scale(0.01900)" fill="#241915"><use href="#m8-p" x="0"/><use href="#m8-a" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-e" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-x" x="4200"/><use href="#m8-p" x="4800"/><use href="#m8-l" x="5400"/><use href="#m8-a" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-n" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-r" x="8400"/></g><rect x="40" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(60.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/></g><g transform="translate(60.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-b" x="0"/><use href="#f9-e" x="1095"/><use href="#f9-f" x="2051"/><use href="#f9-o" x="2687"/><use href="#f9-r" x="3735"/><use href="#f9-e" x="4631"/><use href="#f9-t" x="5887"/><use href="#f9-h" x="6575"/><use href="#f9-e" x="7694"/><use href="#f9-c" x="8950"/><use href="#f9-u" x="9857"/><use href="#f9-r" x="10984"/><use href="#f9-t" x="11880"/><use href="#f9-a" x="12568"/><use href="#f9-i" x="13568"/><use href="#f9-n" x="14120"/></g><circle cx="64" cy="345" r="4" fill="#B3121F"/><g transform="translate(76.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-g" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="379" r="4" fill="#B3121F"/><g transform="translate(76.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-o" x="0"/><use href="#m5-n" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><circle cx="64" cy="413" r="4" fill="#B3121F"/><g transform="translate(76.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="64" cy="447" r="4" fill="#B3121F"/><g transform="translate(76.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/></g><circle cx="64" cy="481" r="4" fill="#B3121F"/><g transform="translate(76.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-b" x="0"/><use href="#m5-o" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="515" r="4" fill="#B3121F"/><g transform="translate(76.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-r" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-w" x="1800"/></g><circle cx="64" cy="549" r="4" fill="#B3121F"/><g transform="translate(76.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-l" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-k" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="64" cy="583" r="4" fill="#B3121F"/><g transform="translate(76.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-G" x="0"/><use href="#m5-i" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-H" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-b" x="3000"/><use href="#m5-A" x="4200"/><use href="#m5-c" x="4800"/><use href="#m5-t" x="5400"/><use href="#m5-i" x="6000"/><use href="#m5-o" x="6600"/><use href="#m5-n" x="7200"/></g><circle cx="64" cy="617" r="4" fill="#B3121F"/><g transform="translate(76.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-h" x="0"/><use href="#m5-a" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-t" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="64" cy="651" r="4" fill="#B3121F"/><g transform="translate(76.0 657.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-c" x="600"/><use href="#m5-p" x="1200"/></g><circle cx="64" cy="685" r="4" fill="#B3121F"/><g transform="translate(76.0 691.0) scale(0.01700)" fill="#6A574B"><use href="#m5-d" x="0"/><use href="#m5-i" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><rect x="296" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(316.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/></g><g transform="translate(316.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-s" x="0"/><use href="#f9-t" x="842"/><use href="#f9-o" x="1505"/><use href="#f9-r" x="2553"/><use href="#f9-y" x="3424"/><use href="#f9-a" x="4718"/><use href="#f9-n" x="5718"/><use href="#f9-d" x="6842"/><use href="#f9-c" x="8237"/><use href="#f9-r" x="9144"/><use href="#f9-a" x="10040"/><use href="#f9-f" x="11040"/><use href="#f9-t" x="11676"/></g><circle cx="320" cy="345" r="4" fill="#B3121F"/><g transform="translate(332.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-y" x="2400"/></g><circle cx="320" cy="379" r="4" fill="#B3121F"/><g transform="translate(332.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-o" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="320" cy="413" r="4" fill="#B3121F"/><g transform="translate(332.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-p" x="0"/><use href="#m5-a" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-g" x="3000"/></g><circle cx="320" cy="447" r="4" fill="#B3121F"/><g transform="translate(332.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-hyphen" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-r" x="4800"/><use href="#m5-a" x="5400"/><use href="#m5-f" x="6000"/><use href="#m5-t" x="6600"/></g><circle cx="320" cy="481" r="4" fill="#B3121F"/><g transform="translate(332.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-y" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-h" x="4800"/><use href="#m5-y" x="5400"/></g><circle cx="320" cy="515" r="4" fill="#B3121F"/><g transform="translate(332.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/></g><circle cx="320" cy="549" r="4" fill="#B3121F"/><g transform="translate(332.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-b" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-k" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-t" x="4800"/></g><circle cx="320" cy="583" r="4" fill="#B3121F"/><g transform="translate(332.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-f" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-e" x="4800"/></g><circle cx="320" cy="617" r="4" fill="#B3121F"/><g transform="translate(332.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-p" x="0"/><use href="#m5-l" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-f" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-r" x="3600"/><use href="#m5-m" x="4200"/><use href="#m5-s" x="4800"/></g><rect x="552" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(572.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/><use href="#i7-I" x="7926"/></g><g transform="translate(572.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-b" x="0"/><use href="#f9-u" x="1095"/><use href="#f9-i" x="2222"/><use href="#f9-l" x="2774"/><use href="#f9-d" x="3346"/><use href="#f9-i" x="4441"/><use href="#f9-n" x="4993"/><use href="#f9-g" x="6117"/><use href="#f9-t" x="7489"/><use href="#f9-h" x="8177"/><use href="#f9-e" x="9296"/></g><g transform="translate(572.0 306.0) scale(0.01250)" fill="#241915"><use href="#f9-p" x="0"/><use href="#f9-i" x="1105"/><use href="#f9-c" x="1657"/><use href="#f9-t" x="2564"/><use href="#f9-u" x="3252"/><use href="#f9-r" x="4379"/><use href="#f9-e" x="5275"/></g><circle cx="576" cy="345" r="4" fill="#B3121F"/><g transform="translate(588.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-r" x="3000"/></g><circle cx="576" cy="379" r="4" fill="#B3121F"/><g transform="translate(588.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-i" x="4800"/></g><circle cx="576" cy="413" r="4" fill="#B3121F"/><g transform="translate(588.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-s" x="5400"/></g><circle cx="576" cy="447" r="4" fill="#B3121F"/><g transform="translate(588.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-s" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-t" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-n" x="5400"/><use href="#m5-s" x="6000"/></g><circle cx="576" cy="481" r="4" fill="#B3121F"/><g transform="translate(588.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-d" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-t" x="2400"/></g><circle cx="576" cy="515" r="4" fill="#B3121F"/><g transform="translate(588.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-f" x="0"/><use href="#m5-i" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-m" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-a" x="3000"/><use href="#m5-p" x="3600"/><use href="#m5-i" x="4200"/></g><circle cx="576" cy="549" r="4" fill="#B3121F"/><g transform="translate(588.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-e" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="576" cy="583" r="4" fill="#B3121F"/><g transform="translate(588.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-a" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-m" x="2400"/></g><circle cx="576" cy="617" r="4" fill="#B3121F"/><g transform="translate(588.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-h" x="0"/><use href="#m5-t" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-l" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-x" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-t" x="6000"/></g><circle cx="576" cy="651" r="4" fill="#B3121F"/><g transform="translate(588.0 657.0) scale(0.01700)" fill="#6A574B"><use href="#m5-d" x="0"/><use href="#m5-e" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-u" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-i" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-g" x="4800"/><use href="#m5-hyphen" x="5400"/><use href="#m5-r" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-n" x="7200"/><use href="#m5-d" x="7800"/><use href="#m5-e" x="8400"/><use href="#m5-r" x="9000"/><use href="#m5-s" x="9600"/></g><rect x="808" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(828.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-V" x="7023"/></g><g transform="translate(828.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-s" x="0"/><use href="#f9-o" x="842"/><use href="#f9-u" x="1890"/><use href="#f9-n" x="3017"/><use href="#f9-d" x="4141"/><use href="#f9-a" x="5536"/><use href="#f9-n" x="6536"/><use href="#f9-d" x="7660"/><use href="#f9-v" x="9055"/><use href="#f9-o" x="9941"/><use href="#f9-i" x="10989"/><use href="#f9-c" x="11541"/><use href="#f9-e" x="12448"/></g><circle cx="832" cy="345" r="4" fill="#B3121F"/><g transform="translate(844.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-u" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/></g><circle cx="832" cy="379" r="4" fill="#B3121F"/><g transform="translate(844.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-u" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-c" x="2400"/></g><circle cx="832" cy="413" r="4" fill="#B3121F"/><g transform="translate(844.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-y" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-h" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/></g><circle cx="832" cy="447" r="4" fill="#B3121F"/><g transform="translate(844.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-o" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-e" x="4200"/><use href="#m5-s" x="4800"/><use href="#m5-i" x="5400"/><use href="#m5-g" x="6000"/><use href="#m5-n" x="6600"/></g><circle cx="832" cy="481" r="4" fill="#B3121F"/><g transform="translate(844.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-v" x="0"/><use href="#m5-o" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-c" x="1800"/><use href="#m5-e" x="2400"/></g><rect x="1064" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1084.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-V" x="6121"/></g><g transform="translate(1084.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-f" x="0"/><use href="#f9-o" x="636"/><use href="#f9-o" x="1684"/><use href="#f9-t" x="2732"/><use href="#f9-a" x="3420"/><use href="#f9-g" x="4420"/><use href="#f9-e" x="5492"/><use href="#f9-comma" x="6448"/><use href="#f9-c" x="7278"/><use href="#f9-a" x="8185"/><use href="#f9-p" x="9185"/><use href="#f9-t" x="10290"/><use href="#f9-u" x="10978"/><use href="#f9-r" x="12105"/><use href="#f9-e" x="13001"/></g><g transform="translate(1084.0 306.0) scale(0.01250)" fill="#241915"><use href="#f9-a" x="0"/><use href="#f9-n" x="1000"/><use href="#f9-d" x="2124"/><use href="#f9-a" x="3519"/><use href="#f9-s" x="4519"/><use href="#f9-s" x="5361"/><use href="#f9-e" x="6203"/><use href="#f9-t" x="7159"/><use href="#f9-s" x="7847"/></g><circle cx="1088" cy="345" r="4" fill="#B3121F"/><g transform="translate(1100.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-e" x="0"/><use href="#m5-d" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="1088" cy="379" r="4" fill="#B3121F"/><g transform="translate(1100.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-s" x="4200"/></g><circle cx="1088" cy="413" r="4" fill="#B3121F"/><g transform="translate(1100.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-f" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-o" x="6000"/><use href="#m5-l" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="1088" cy="447" r="4" fill="#B3121F"/><g transform="translate(1100.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-e" x="3600"/></g><circle cx="1088" cy="481" r="4" fill="#B3121F"/><g transform="translate(1100.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-u" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-l" x="4200"/><use href="#m5-hyphen" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/><use href="#m5-c" x="6600"/><use href="#m5-o" x="7200"/><use href="#m5-r" x="7800"/><use href="#m5-d" x="8400"/><use href="#m5-i" x="9000"/><use href="#m5-n" x="9600"/><use href="#m5-g" x="10200"/></g><circle cx="1088" cy="515" r="4" fill="#B3121F"/><g transform="translate(1100.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-s" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><rect x="1320" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1340.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-F" x="0"/><use href="#i7-I" x="1530"/><use href="#i7-N" x="2432"/><use href="#i7-A" x="4321"/><use href="#i7-L" x="6178"/><use href="#i7-E" x="7663"/></g><g transform="translate(1340.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-p" x="0"/><use href="#f9-r" x="1105"/><use href="#f9-o" x="2001"/><use href="#f9-o" x="3049"/><use href="#f9-f" x="4097"/><use href="#f9-i" x="5033"/><use href="#f9-t" x="5585"/><use href="#f9-i" x="6573"/><use href="#f9-s" x="7125"/><use href="#f9-d" x="8267"/><use href="#f9-o" x="9362"/><use href="#f9-n" x="10410"/><use href="#f9-e" x="11534"/></g><circle cx="1344" cy="345" r="4" fill="#B3121F"/><g transform="translate(1356.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-q" x="0"/><use href="#m5-a" x="600"/></g><circle cx="1344" cy="379" r="4" fill="#B3121F"/><g transform="translate(1356.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-v" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-w" x="3000"/></g><circle cx="1344" cy="413" r="4" fill="#B3121F"/><g transform="translate(1356.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-p" x="3000"/><use href="#m5-t" x="3600"/></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 770" width="1600" height="770" role="img" aria-labelledby="t d"><title id="t">The documentation map</title><desc id="d">Every showtime guide in running order: Choose your path : launch-video, explainer, tutorial, social-short, data-story, footage-edit, trailer, slideshow, changelog-video, music-video, voiceover-only, localize, repo-explainer, paper-explainer, repro, diagram, recap; Act I Before the curtain: agents, onboarding, modes, studio, boards, crew, looking, GitHub Action, harness-notes, mcp, diagnosing; Act II Story and craft: story, tones, pacing, motion-craft, typography, color, brand-kit, reference, platforms; Act III Building the picture: render, stage-api, components, transitions, adopt, film-api, series, manim, html-export, debugging-renders; Act IV Sound and voice: audio, music, synth-score, sound-design, voice; Act V Footage, capture and assets: editing, captions, footage-tools, capture, tutorial-recording, assets; Finale Proof it is done: qa, review, receipt</desc><style>@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i7-A" d="M49 0 558 -1490H958L1480 0H1141L902 -719Q859 -858 814 -1024Q770 -1189 721 -1385H788Q740 -1188 698 -1022Q657 -855 616 -719L386 0ZM367 -346V-585H1162V-346Z"/><path id="i7-C" d="M786 20Q588 20 432 -70Q275 -160 184 -331Q94 -502 94 -744Q94 -987 185 -1158Q276 -1330 433 -1420Q590 -1510 786 -1510Q913 -1510 1022 -1474Q1132 -1439 1217 -1371Q1302 -1303 1356 -1204Q1410 -1106 1427 -980H1118Q1108 -1042 1080 -1090Q1051 -1137 1008 -1170Q966 -1204 911 -1222Q856 -1239 792 -1239Q676 -1239 588 -1181Q501 -1123 452 -1012Q404 -902 404 -744Q404 -583 453 -473Q502 -363 589 -307Q676 -251 791 -251Q855 -251 910 -268Q964 -286 1008 -320Q1051 -353 1080 -401Q1108 -449 1119 -510H1428Q1416 -406 1366 -311Q1317 -216 1235 -141Q1153 -66 1040 -23Q927 20 786 20Z"/><path id="i7-E" d="M135 0V-1490H1132V-1237H440V-877H1080V-628H440V-253H1134V0Z"/><path id="i7-F" d="M135 0V-1490H1115V-1237H440V-821H1049V-572H440V0Z"/><path id="i7-H" d="M135 0V-1490H440V-888H1089V-1490H1395V0H1089V-635H440V0Z"/><path id="i7-I" d="M440 -1490V0H135V-1490Z"/><path id="i7-K" d="M360 -337V-615Q406 -698 450 -768Q494 -838 547 -908Q600 -979 668 -1062L1033 -1490H1406L777 -762L752 -771ZM135 0V-1490H440V-1083L435 -703L440 -554V0ZM1061 0 619 -672 812 -900 1422 0Z"/><path id="i7-L" d="M135 0V-1490H440V-253H1083V0Z"/><path id="i7-N" d="M135 0V-1490H475L946 -736Q982 -678 1019 -610Q1056 -542 1094 -459Q1133 -376 1171 -272H1140Q1133 -355 1128 -449Q1122 -543 1118 -629Q1114 -715 1114 -775V-1490H1426V0H1085L657 -684Q610 -761 570 -834Q530 -906 486 -994Q443 -1081 383 -1203H422Q428 -1095 434 -996Q440 -897 444 -816Q447 -736 447 -685V0Z"/><path id="i7-O" d="M789 20Q592 20 434 -70Q277 -160 186 -331Q94 -502 94 -744Q94 -987 186 -1158Q277 -1330 434 -1420Q592 -1510 789 -1510Q987 -1510 1144 -1420Q1301 -1330 1392 -1158Q1484 -987 1484 -744Q1484 -502 1392 -331Q1301 -160 1144 -70Q987 20 789 20ZM789 -251Q905 -251 992 -308Q1078 -364 1126 -474Q1174 -585 1174 -744Q1174 -905 1126 -1016Q1078 -1126 992 -1182Q905 -1239 789 -1239Q674 -1239 587 -1182Q500 -1125 452 -1014Q404 -904 404 -744Q404 -585 452 -475Q500 -365 587 -308Q674 -251 789 -251Z"/><path id="i7-P" d="M135 0V-1490H716Q886 -1490 1005 -1426Q1124 -1361 1186 -1248Q1249 -1134 1249 -987Q1249 -839 1186 -726Q1122 -614 1002 -550Q881 -487 709 -487H335V-733H660Q754 -733 814 -766Q875 -798 904 -855Q934 -912 934 -987Q934 -1062 904 -1118Q875 -1175 814 -1206Q753 -1238 659 -1238H440V0Z"/><path id="i7-R" d="M135 0V-1490H716Q886 -1490 1005 -1430Q1124 -1370 1186 -1261Q1249 -1152 1249 -1005Q1249 -858 1186 -752Q1122 -645 1002 -588Q881 -532 709 -532H315V-779H660Q754 -779 814 -804Q874 -830 904 -880Q934 -931 934 -1005Q934 -1081 904 -1132Q874 -1184 814 -1211Q753 -1238 659 -1238H440V0ZM964 0 601 -678H932L1302 0Z"/><path id="i7-S" d="M681 22Q502 22 370 -33Q237 -88 163 -196Q89 -304 85 -462H382Q388 -387 427 -336Q466 -286 531 -261Q596 -236 678 -236Q760 -236 820 -260Q881 -283 915 -326Q949 -369 949 -426Q949 -477 918 -512Q888 -546 831 -571Q774 -596 692 -615L528 -656Q339 -702 232 -800Q125 -899 125 -1061Q125 -1196 198 -1297Q270 -1398 396 -1454Q523 -1510 685 -1510Q850 -1510 973 -1454Q1096 -1397 1165 -1296Q1234 -1196 1236 -1065H941Q933 -1155 864 -1204Q796 -1253 682 -1253Q605 -1253 550 -1231Q495 -1209 466 -1170Q438 -1131 438 -1081Q438 -1026 471 -990Q504 -953 559 -930Q614 -908 676 -893L811 -860Q905 -839 986 -803Q1067 -767 1128 -714Q1189 -662 1222 -590Q1256 -518 1256 -424Q1256 -289 1188 -188Q1120 -88 991 -33Q862 22 681 22Z"/><path id="i7-T" d="M75 -1237V-1490H1292V-1237H837V0H531V-1237Z"/><path id="i7-U" d="M749 21Q565 21 426 -48Q288 -116 212 -238Q135 -360 135 -523V-1490H440V-548Q440 -461 478 -394Q517 -326 586 -288Q656 -249 749 -249Q843 -249 912 -288Q982 -326 1020 -394Q1059 -461 1059 -548V-1490H1365V-523Q1365 -360 1288 -238Q1211 -116 1072 -48Q934 21 749 21Z"/><path id="i7-V" d="M571 0 49 -1490H388L626 -771Q669 -635 713 -472Q757 -308 806 -114H740Q788 -310 830 -472Q872 -635 913 -771L1143 -1490H1480L970 0Z"/><path id="i7-W" d="M449 0 49 -1490H382L555 -757Q576 -665 594 -560Q611 -456 628 -350Q645 -245 661 -148H607Q625 -245 643 -350Q661 -456 680 -560Q699 -665 722 -757L904 -1490H1221L1402 -757Q1425 -665 1444 -560Q1463 -456 1482 -350Q1500 -245 1518 -148H1462Q1479 -245 1496 -350Q1512 -456 1530 -560Q1549 -665 1569 -757L1742 -1490H2076L1675 0H1327L1129 -762Q1097 -889 1074 -1037Q1052 -1185 1024 -1342H1100Q1069 -1189 1050 -1043Q1030 -897 995 -762L798 0Z"/><path id="i7-Y" d="M601 0V-560L49 -1490H406L658 -1026Q697 -956 727 -887Q757 -818 789 -722H722Q753 -819 782 -888Q811 -957 848 -1026L1092 -1490H1448L905 -560V0Z"/><path id="i7-four" d="M101 -265V-506L724 -1490H931V-1154H808L409 -523V-511H1293V-265ZM814 0V-338L820 -446V-1490H1107V0Z"/><path id="i7-one" d="M749 -1490V0H444V-1221H434L93 -979V-1259L422 -1490Z"/><path id="i7-periodcentered" d="M342 -535Q269 -535 219 -584Q169 -634 169 -707Q169 -780 219 -830Q269 -879 342 -879Q415 -879 465 -830Q515 -780 515 -707Q515 -634 465 -584Q415 -535 342 -535Z"/><path id="m5-A" d="M43 0 229 -730H371L557 0H448L404 -185H197L153 0ZM217 -274H383L333 -485Q320 -541 311 -582Q303 -624 300 -639Q297 -624 289 -583Q281 -541 267 -486Z"/><path id="m5-G" d="M304 10Q236 10 185 -16Q135 -41 107 -90Q80 -138 80 -203V-527Q80 -593 107 -641Q135 -689 185 -714Q236 -740 304 -740Q372 -740 422 -714Q472 -688 500 -640Q527 -593 527 -527H419Q419 -584 389 -614Q359 -644 304 -644Q249 -644 218 -614Q188 -584 188 -528V-203Q188 -147 218 -116Q249 -85 304 -85Q359 -85 389 -116Q419 -147 419 -203V-285H283V-380H527V-203Q527 -138 500 -90Q472 -42 422 -16Q372 10 304 10Z"/><path id="m5-H" d="M85 0V-730H193V-428H407V-730H515V0H407V-328H193V0Z"/><path id="m5-a" d="M245 10Q159 10 110 -35Q60 -79 60 -156Q60 -234 112 -279Q165 -323 257 -323H410V-374Q410 -419 382 -444Q354 -469 303 -469Q258 -469 228 -450Q198 -430 193 -398H87Q96 -472 155 -516Q215 -560 306 -560Q404 -560 461 -510Q518 -461 518 -376V0H413V-101H395L413 -121Q413 -61 367 -25Q321 10 245 10ZM277 -73Q335 -73 373 -102Q410 -132 410 -178V-250H259Q217 -250 193 -227Q168 -204 168 -164Q168 -122 197 -97Q226 -73 277 -73Z"/><path id="m5-b" d="M339 10Q271 10 231 -27Q191 -65 191 -130L214 -105H191V0H84V-730H192V-573L189 -445H214L191 -420Q191 -485 231 -522Q272 -560 339 -560Q422 -560 472 -504Q522 -448 522 -352V-197Q522 -102 472 -46Q422 10 339 10ZM302 -84Q355 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q355 -466 302 -466Q251 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q251 -84 302 -84Z"/><path id="m5-c" d="M304 10Q236 10 184 -16Q133 -41 105 -90Q78 -138 78 -203V-347Q78 -413 105 -461Q133 -509 184 -534Q236 -560 304 -560Q403 -560 463 -508Q523 -456 526 -366H418Q415 -413 385 -439Q355 -465 304 -465Q249 -465 217 -435Q185 -404 185 -348V-203Q185 -147 217 -116Q249 -85 304 -85Q355 -85 385 -111Q415 -137 418 -184H526Q523 -94 463 -42Q403 10 304 10Z"/><path id="m5-d" d="M261 10Q178 10 128 -46Q78 -102 78 -197V-352Q78 -448 128 -504Q178 -560 261 -560Q329 -560 369 -522Q409 -485 409 -420L386 -445H411L408 -573V-730H516V0H409V-105H386L409 -130Q409 -65 369 -27Q329 10 261 10ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 215 -436Q185 -405 185 -347V-203Q185 -145 215 -114Q245 -84 298 -84Z"/><path id="m5-e" d="M300 10Q233 10 183 -16Q132 -43 105 -91Q78 -139 78 -203V-347Q78 -412 105 -459Q132 -507 183 -534Q233 -560 300 -560Q368 -560 418 -534Q468 -507 495 -459Q522 -412 522 -347V-249H182V-203Q182 -142 213 -110Q243 -78 301 -78Q348 -78 377 -94Q406 -111 413 -143H520Q508 -73 448 -32Q388 10 300 10ZM418 -314V-348Q418 -408 388 -441Q358 -474 300 -474Q243 -474 212 -441Q182 -408 182 -347V-322L426 -323Z"/><path id="m5-f" d="M213 0V-394H57V-492H213V-581Q213 -650 257 -690Q301 -730 377 -730H538V-634H379Q351 -634 336 -620Q320 -606 320 -580V-492H538V-394H320V0Z"/><path id="m5-g" d="M156 180V87H325Q367 87 388 67Q408 47 408 8V-47L410 -149H387L409 -169Q409 -106 370 -70Q330 -34 263 -34Q178 -34 129 -90Q80 -146 80 -241V-353Q80 -448 129 -504Q178 -560 263 -560Q330 -560 370 -524Q409 -487 409 -424L387 -445H409L408 -550H515V10Q515 89 465 134Q415 180 326 180ZM298 -127Q349 -127 379 -159Q408 -190 408 -246V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-246Q188 -189 216 -158Q245 -127 298 -127Z"/><path id="m5-h" d="M84 0V-730H192V-550L191 -445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -438Q352 -468 302 -468Q251 -468 222 -436Q192 -405 192 -347V0Z"/><path id="m5-hyphen" d="M140 -281V-379H460V-281Z"/><path id="m5-i" d="M81 0V-98H274V-452H106V-550H379V-98H556V0ZM316 -645Q281 -645 260 -664Q240 -682 240 -713Q240 -745 260 -763Q281 -782 316 -782Q352 -782 373 -763Q393 -745 393 -713Q393 -682 373 -664Q352 -645 316 -645Z"/><path id="m5-k" d="M87 0V-730H195V-329H292L438 -550H560L385 -286L563 0H439L292 -236H195V0Z"/><path id="m5-l" d="M379 0Q328 0 290 -21Q252 -41 230 -79Q209 -117 209 -167V-632H29V-730H317V-167Q317 -135 335 -116Q353 -98 384 -98H554V0Z"/><path id="m5-m" d="M59 0V-550H149V-480H169L154 -459Q154 -505 179 -533Q204 -560 246 -560Q291 -560 315 -525Q340 -490 340 -429L316 -480H354L338 -459Q338 -505 363 -533Q389 -560 432 -560Q483 -560 512 -521Q541 -483 541 -419V0H445V-416Q445 -447 432 -464Q418 -481 393 -481Q368 -481 355 -464Q341 -448 341 -417V0H260V-416Q260 -448 246 -464Q232 -481 206 -481Q181 -481 168 -464Q156 -448 156 -417V0Z"/><path id="m5-n" d="M84 0V-550H191V-445H217L191 -420Q191 -486 230 -523Q269 -560 338 -560Q420 -560 469 -508Q518 -455 518 -366V0H410V-354Q410 -408 381 -437Q352 -466 302 -466Q251 -466 222 -436Q192 -405 192 -347V0Z"/><path id="m5-o" d="M300 9Q232 9 182 -17Q132 -43 105 -91Q78 -139 78 -204V-346Q78 -412 105 -459Q132 -507 182 -533Q232 -559 300 -559Q368 -559 418 -533Q468 -507 495 -459Q522 -412 522 -346V-204Q522 -139 495 -91Q468 -43 418 -17Q368 9 300 9ZM300 -86Q355 -86 385 -117Q415 -147 415 -204V-346Q415 -404 385 -434Q355 -464 300 -464Q246 -464 216 -434Q185 -404 185 -346V-204Q185 -147 216 -117Q246 -86 300 -86Z"/><path id="m5-p" d="M84 180V-550H191V-445H214L191 -420Q191 -485 231 -523Q272 -560 340 -560Q423 -560 473 -504Q522 -449 522 -353V-198Q522 -134 500 -88Q477 -41 437 -15Q396 10 340 10Q273 10 232 -28Q191 -65 191 -130L214 -105H189L192 23V180ZM303 -84Q356 -84 385 -114Q415 -145 415 -203V-347Q415 -405 385 -436Q356 -466 303 -466Q252 -466 222 -435Q192 -403 192 -347V-203Q192 -147 222 -115Q252 -84 303 -84Z"/><path id="m5-q" d="M408 180V23L411 -105H386L409 -130Q409 -65 369 -28Q329 10 261 10Q178 10 129 -46Q80 -102 80 -198V-353Q80 -449 129 -504Q178 -560 261 -560Q329 -560 369 -523Q409 -485 409 -420L386 -445H409V-550H516V180ZM298 -84Q349 -84 379 -115Q408 -147 408 -203V-347Q408 -403 379 -435Q349 -466 298 -466Q245 -466 216 -436Q188 -405 188 -347V-203Q188 -145 216 -114Q245 -84 298 -84Z"/><path id="m5-r" d="M102 0V-550H206V-445H232L199 -380Q199 -469 238 -515Q277 -560 354 -560Q442 -560 494 -505Q545 -451 545 -356V-319H434V-347Q434 -406 404 -438Q375 -469 322 -469Q269 -469 240 -437Q210 -405 210 -347V0Z"/><path id="m5-s" d="M281 9Q222 9 177 -10Q133 -29 107 -63Q82 -96 78 -142H186Q190 -115 215 -99Q240 -82 281 -82H324Q373 -82 398 -102Q423 -122 423 -155Q423 -187 400 -205Q378 -224 334 -230L263 -241Q175 -255 134 -291Q92 -328 92 -400Q92 -476 141 -517Q191 -559 288 -559H326Q412 -559 463 -520Q515 -480 522 -414H414Q410 -438 387 -453Q365 -468 326 -468H288Q241 -468 220 -450Q198 -433 198 -399Q198 -369 217 -354Q236 -339 276 -333L349 -321Q442 -308 485 -269Q529 -231 529 -158Q529 -79 478 -35Q426 9 324 9Z"/><path id="m5-t" d="M360 0Q285 0 243 -41Q201 -82 201 -155V-452H49V-550H201V-705H309V-550H524V-452H309V-155Q309 -98 364 -98H514V0Z"/><path id="m5-u" d="M299 10Q200 10 141 -48Q82 -105 82 -204V-550H190V-204Q190 -147 219 -116Q248 -84 299 -84Q351 -84 380 -116Q410 -147 410 -204V-550H518V-204Q518 -105 458 -47Q399 10 299 10Z"/><path id="m5-v" d="M229 0 47 -550H157L270 -198Q281 -167 289 -136Q298 -104 302 -86Q307 -104 316 -136Q324 -167 333 -198L444 -550H553L371 0Z"/><path id="m5-w" d="M113 0 28 -550H119L170 -187Q174 -162 177 -131Q181 -101 183 -81Q185 -101 190 -131Q194 -161 198 -187L255 -550H346L402 -187Q406 -161 410 -131Q415 -100 417 -80Q419 -101 424 -131Q428 -162 432 -187L484 -550H572L484 0H370L316 -359Q312 -387 307 -418Q302 -450 300 -469Q297 -450 293 -418Q288 -387 284 -359L228 0Z"/><path id="m5-x" d="M43 0 236 -284 55 -550H179L276 -398Q283 -386 290 -372Q297 -359 301 -350Q304 -359 311 -372Q318 -386 325 -398L422 -550H546L365 -283L557 0H433L326 -165Q319 -177 312 -192Q305 -207 301 -216Q297 -207 289 -192Q282 -177 274 -165L166 0Z"/><path id="m5-y" d="M172 180 251 -32 46 -550H165L280 -240Q287 -220 294 -192Q301 -164 306 -146Q310 -164 317 -192Q324 -220 331 -240L439 -550H554L286 180Z"/><path id="m8-a" d="M229 10Q146 10 98 -35Q49 -80 49 -157Q49 -240 106 -284Q164 -329 272 -329H386V-370Q386 -402 364 -421Q341 -440 303 -440Q268 -440 245 -424Q222 -408 217 -380H72Q81 -463 144 -512Q208 -560 308 -560Q413 -560 474 -508Q536 -457 536 -370V0H391V-90H367L392 -125Q392 -63 347 -26Q303 10 229 10ZM285 -100Q329 -100 358 -124Q386 -147 386 -185V-244H275Q241 -244 220 -224Q199 -205 199 -173Q199 -139 222 -120Q245 -100 285 -100Z"/><path id="m8-c" d="M303 10Q230 10 175 -18Q120 -45 90 -94Q60 -144 60 -210V-340Q60 -407 90 -456Q120 -505 175 -532Q230 -560 303 -560Q412 -560 477 -505Q542 -450 546 -355H396Q393 -390 368 -410Q344 -430 303 -430Q258 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q258 -120 303 -120Q344 -120 368 -140Q393 -159 396 -195H546Q542 -100 477 -45Q412 10 303 10Z"/><path id="m8-d" d="M243 10Q160 10 110 -48Q60 -106 60 -205V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -580V-730H534V0H389V-105H354L389 -140Q389 -69 350 -30Q311 10 243 10ZM297 -120Q338 -120 361 -144Q384 -167 384 -210V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-210Q210 -167 232 -144Q255 -120 297 -120Z"/><path id="m8-e" d="M301 10Q228 10 174 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 174 -532Q228 -560 301 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-240H203V-210Q203 -158 228 -132Q253 -105 303 -105Q338 -105 360 -117Q381 -129 388 -150H535Q517 -78 454 -34Q390 10 301 10ZM397 -317V-342Q397 -393 374 -420Q350 -447 301 -447Q252 -447 228 -419Q203 -391 203 -340V-325L407 -327Z"/><path id="m8-f" d="M195 0V-350H49V-485H195V-560Q195 -637 248 -684Q300 -730 385 -730H546V-600H390Q370 -600 358 -588Q345 -575 345 -555V-485H546V-350H345V0Z"/><path id="m8-g" d="M145 180V60H300Q342 60 364 39Q387 18 387 -19V-40L389 -145H354L389 -180Q389 -109 350 -70Q311 -30 243 -30Q160 -30 110 -88Q60 -146 60 -245V-345Q60 -443 110 -502Q160 -560 243 -560Q311 -560 350 -520Q389 -481 389 -410L354 -445H389L384 -550H534V-14Q534 76 472 128Q411 180 305 180ZM297 -160Q338 -160 361 -184Q384 -207 384 -250V-340Q384 -383 361 -406Q338 -430 297 -430Q255 -430 232 -406Q210 -383 210 -340V-250Q210 -207 232 -184Q255 -160 297 -160Z"/><path id="m8-h" d="M66 0V-730H216V-550L211 -445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-hyphen" d="M140 -260V-400H460V-260Z"/><path id="m8-i" d="M70 0V-136H260V-415H95V-550H400V-136H560V0ZM320 -637Q279 -637 254 -658Q230 -679 230 -715Q230 -751 254 -772Q279 -793 320 -793Q361 -793 386 -772Q410 -751 410 -715Q410 -679 386 -658Q361 -637 320 -637Z"/><path id="m8-l" d="M390 0Q332 0 288 -24Q244 -49 220 -93Q195 -137 195 -195V-595H25V-730H345V-195Q345 -168 362 -152Q378 -135 405 -135H565V0Z"/><path id="m8-m" d="M42 0V-550H160V-470H184L165 -456Q165 -503 192 -532Q219 -560 259 -560Q302 -560 326 -523Q350 -486 350 -425L332 -470H360L351 -456Q351 -503 377 -532Q403 -560 447 -560Q497 -560 528 -522Q559 -485 559 -420V0H430V-410Q430 -433 420 -446Q410 -458 391 -458Q372 -458 362 -446Q352 -433 352 -410V0H249V-410Q249 -433 239 -446Q229 -458 210 -458Q191 -458 181 -446Q171 -433 171 -410V0Z"/><path id="m8-n" d="M66 0V-550H211V-445H255L211 -410Q211 -480 251 -520Q291 -560 359 -560Q439 -560 488 -504Q536 -448 536 -355V0H386V-340Q386 -383 364 -406Q341 -430 300 -430Q260 -430 238 -406Q216 -383 216 -340V0Z"/><path id="m8-o" d="M300 10Q227 10 173 -18Q119 -45 90 -94Q60 -144 60 -210V-340Q60 -406 90 -456Q119 -505 173 -532Q227 -560 300 -560Q374 -560 428 -532Q481 -505 510 -456Q540 -406 540 -340V-210Q540 -144 510 -94Q481 -45 428 -18Q374 10 300 10ZM300 -120Q344 -120 367 -144Q390 -167 390 -210V-340Q390 -384 367 -407Q344 -430 300 -430Q257 -430 234 -407Q210 -384 210 -340V-210Q210 -167 234 -144Q257 -120 300 -120Z"/><path id="m8-p" d="M66 180V-550H211V-445H246L211 -410Q211 -481 250 -520Q289 -560 357 -560Q440 -560 490 -502Q540 -443 540 -345V-205Q540 -140 518 -92Q495 -43 454 -16Q413 10 357 10Q289 10 250 -30Q211 -69 211 -140L246 -105H211L216 30V180ZM303 -120Q345 -120 368 -144Q390 -167 390 -210V-340Q390 -384 368 -407Q345 -430 303 -430Q262 -430 239 -406Q216 -383 216 -340V-210Q216 -167 239 -144Q262 -120 303 -120Z"/><path id="m8-r" d="M82 0V-550H222V-445H260L217 -381Q217 -470 258 -515Q299 -560 378 -560Q469 -560 520 -505Q570 -450 570 -350V-305H410V-340Q410 -385 386 -410Q361 -435 320 -435Q277 -435 254 -410Q232 -385 232 -340V0Z"/><path id="m8-s" d="M277 10Q209 10 158 -12Q107 -33 78 -71Q50 -109 50 -160H200Q200 -136 222 -122Q243 -107 277 -107H321Q362 -107 384 -122Q405 -137 405 -164Q405 -189 386 -202Q367 -216 327 -221L263 -229Q160 -242 113 -279Q66 -316 66 -392Q66 -472 121 -516Q176 -560 282 -560H320Q421 -560 481 -516Q541 -472 541 -398H391Q391 -418 372 -430Q352 -443 320 -443H282Q245 -443 228 -430Q211 -418 211 -393Q211 -370 226 -358Q242 -346 276 -341L345 -332Q449 -319 500 -280Q550 -241 550 -164Q550 -80 492 -35Q434 10 321 10Z"/><path id="m8-t" d="M360 0Q276 0 228 -48Q180 -96 180 -180V-415H35V-550H180V-705H330V-550H535V-415H330V-180Q330 -135 375 -135H525V0Z"/><path id="m8-u" d="M300 10Q189 10 126 -50Q64 -110 64 -214V-550H214V-215Q214 -169 236 -144Q258 -120 300 -120Q341 -120 364 -144Q386 -169 386 -215V-550H536V-214Q536 -109 473 -50Q410 10 300 10Z"/><path id="m8-v" d="M207 0 27 -550H182L274 -241Q282 -213 290 -180Q298 -147 302 -127Q307 -147 314 -180Q322 -213 329 -240L420 -550H573L395 0Z"/><path id="m8-w" d="M90 0 10 -550H130L170 -250Q175 -217 178 -175Q182 -133 184 -106Q187 -133 192 -174Q198 -216 203 -250L249 -550H353L397 -250Q402 -216 408 -174Q413 -132 416 -105Q418 -133 422 -176Q427 -218 431 -250L473 -550H590L509 0H359L318 -310Q314 -338 309 -377Q304 -416 301 -442Q297 -416 292 -377Q287 -338 283 -310L241 0Z"/><path id="m8-x" d="M26 0 216 -285 39 -550H206L274 -440Q282 -427 289 -411Q296 -395 300 -385Q304 -395 312 -411Q319 -427 326 -440L394 -550H561L385 -285L574 0H407L327 -130Q319 -144 312 -160Q304 -175 300 -185Q296 -175 289 -160Q282 -144 274 -130L193 0Z"/><path id="m8-y" d="M157 180 232 -27 26 -550H189L272 -310Q281 -283 290 -244Q300 -206 305 -182Q310 -206 320 -244Q329 -283 338 -310L418 -550H574L314 180Z"/><path id="m8-z" d="M70 0V-130L342 -420H80V-550H519V-420L247 -130H530V0Z"/><path id="f9-a" d="M544 -93V-107L526 -90V-820Q526 -856 508 -877Q489 -898 462 -898Q428 -898 408 -877Q388 -856 388 -820V-714Q388 -647 337 -596Q286 -546 204 -546Q149 -546 114 -577Q78 -608 78 -672Q78 -727 126 -784Q174 -840 270 -878Q365 -916 507 -916Q699 -916 794 -842Q890 -768 890 -628V-134Q890 -110 900 -98Q911 -86 926 -86Q941 -86 956 -98Q970 -109 974 -140Q975 -145 976 -146Q978 -148 980 -148Q983 -148 984 -146Q986 -145 986 -140Q986 -117 962 -79Q939 -41 884 -10Q830 20 736 20Q632 20 588 -14Q544 -47 544 -93ZM22 -200Q22 -321 122 -390Q223 -458 460 -458Q505 -458 530 -448Q556 -439 578 -422L568 -414Q544 -428 523 -433Q502 -438 474 -438Q430 -438 404 -392Q378 -346 378 -250Q378 -160 405 -120Q432 -80 474 -80Q497 -80 521 -96Q545 -113 559 -138L573 -130Q533 -57 456 -18Q378 20 288 20Q173 20 98 -42Q22 -104 22 -200Z"/><path id="f9-b" d="M442 -1496V-49L118 14Q112 15 106 16Q99 18 94 18Q88 18 84 14Q80 11 80 6V-1366Q80 -1374 76 -1378Q72 -1382 63 -1382H24Q17 -1382 14 -1384Q12 -1387 12 -1391Q12 -1395 15 -1397Q18 -1399 22 -1400L401 -1505Q413 -1508 418 -1509Q422 -1510 428 -1510Q435 -1510 438 -1506Q442 -1502 442 -1496ZM420 -744 404 -762Q461 -840 526 -878Q592 -916 680 -916Q796 -916 882 -864Q967 -813 1014 -716Q1060 -618 1060 -479Q1060 -329 1004 -216Q949 -104 851 -42Q753 20 626 20Q534 20 482 -8Q430 -35 398 -96L424 -108Q440 -66 466 -46Q493 -26 532 -26Q580 -26 616 -60Q652 -95 672 -187Q692 -279 692 -449Q692 -599 676 -686Q660 -772 631 -809Q602 -846 562 -846Q522 -846 486 -821Q449 -796 420 -744Z"/><path id="f9-c" d="M881 -652Q881 -577 838 -532Q796 -488 719 -488Q641 -488 597 -534Q553 -581 553 -670V-770Q553 -830 533 -861Q513 -892 480 -892Q445 -892 419 -858Q393 -823 380 -756Q366 -690 366 -594Q366 -466 400 -378Q433 -290 492 -245Q552 -200 630 -200Q719 -200 779 -232Q839 -263 855 -334Q856 -339 858 -341Q861 -343 864 -342Q867 -341 868 -338Q870 -335 869 -330Q852 -220 796 -142Q740 -64 652 -22Q563 20 447 20Q324 20 228 -30Q132 -79 77 -178Q22 -276 22 -422Q22 -567 84 -678Q146 -789 254 -852Q363 -916 504 -916Q630 -916 714 -882Q797 -847 839 -788Q881 -728 881 -652Z"/><path id="f9-comma" d="M288 0Q174 0 117 -52Q60 -104 60 -197Q60 -282 119 -338Q178 -395 269 -395Q352 -395 416 -330Q480 -266 480 -138Q480 -35 460 47Q439 129 398 192Q357 254 294 298Q232 341 149 368Q142 370 136 366Q130 363 130 358Q130 351 134 348Q138 344 147 341Q246 305 302 254Q357 204 380 150Q402 96 402 52Q402 28 394 14Q386 0 359 0Z"/><path id="f9-d" d="M653 -99V-105V-1366Q653 -1374 649 -1378Q645 -1382 636 -1382H597Q590 -1382 588 -1384Q585 -1387 585 -1391Q585 -1395 588 -1397Q591 -1399 595 -1400L974 -1505Q986 -1508 990 -1509Q995 -1510 1001 -1510Q1008 -1510 1012 -1506Q1015 -1502 1015 -1496V-64Q1015 -48 1020 -38Q1026 -29 1039 -26L1077 -17Q1084 -16 1086 -14Q1089 -11 1089 -8Q1089 -4 1086 -2Q1084 0 1079 0H677Q665 0 659 -6Q653 -12 653 -22ZM35 -417Q35 -568 90 -680Q146 -792 244 -854Q342 -916 469 -916Q561 -916 613 -888Q665 -861 697 -800L671 -788Q655 -830 628 -850Q602 -870 563 -870Q515 -870 479 -836Q443 -801 423 -710Q403 -618 403 -447Q403 -298 419 -211Q435 -124 464 -87Q493 -50 533 -50Q574 -50 610 -75Q646 -100 675 -152L691 -134Q634 -56 568 -18Q503 20 415 20Q299 20 214 -32Q128 -83 82 -181Q35 -279 35 -417Z"/><path id="f9-e" d="M928 -496Q928 -486 922 -479Q915 -472 900 -472H274V-496H552Q570 -496 570 -518Q570 -719 534 -806Q497 -894 458 -894Q431 -894 408 -866Q385 -837 370 -767Q356 -697 356 -574Q356 -367 439 -272Q522 -178 660 -178Q771 -178 840 -234Q910 -289 910 -382Q910 -387 912 -388Q915 -390 916 -390Q919 -390 922 -388Q924 -386 924 -380Q924 -266 866 -176Q809 -85 710 -32Q611 20 486 20Q350 20 245 -38Q140 -96 80 -199Q20 -302 20 -436Q20 -586 79 -694Q138 -801 246 -858Q355 -916 502 -916Q633 -916 728 -861Q824 -806 876 -711Q928 -616 928 -496Z"/><path id="f9-f" d="M486 -66Q486 -54 492 -46Q497 -39 510 -36L610 -18Q616 -17 620 -15Q624 -13 624 -8Q624 0 614 0H42Q39 0 36 -2Q34 -3 34 -6Q34 -9 36 -11Q38 -13 44 -14L114 -32Q125 -35 130 -41Q134 -47 134 -56V-832Q134 -838 131 -844Q128 -849 122 -850L24 -880Q20 -882 18 -884Q16 -885 16 -888Q16 -891 19 -894Q22 -896 26 -896H150L134 -884V-888Q134 -911 120 -935Q106 -959 88 -987Q70 -1015 56 -1051Q42 -1087 42 -1134Q42 -1277 125 -1354Q208 -1430 356 -1430Q453 -1430 515 -1398Q577 -1366 606 -1312Q636 -1259 636 -1194Q636 -1112 595 -1073Q554 -1034 488 -1034Q421 -1034 376 -1080Q332 -1127 332 -1202V-1342Q332 -1377 322 -1392Q311 -1406 286 -1406Q246 -1406 224 -1376Q202 -1347 202 -1288Q202 -1223 230 -1170Q259 -1118 301 -1075Q343 -1032 385 -996Q427 -961 456 -930Q484 -899 484 -870V-864L468 -896H618Q626 -896 629 -894Q632 -893 632 -888Q632 -879 622 -874Q613 -870 598 -870H486Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-l" d="M472 -1496V-64Q472 -48 478 -38Q483 -29 496 -26L534 -17Q541 -16 544 -14Q546 -11 546 -8Q546 -4 544 -2Q541 0 536 0H46Q42 0 39 -2Q36 -4 36 -8Q36 -11 38 -14Q41 -16 48 -17L86 -26Q100 -29 105 -38Q110 -48 110 -64V-1366Q110 -1374 106 -1378Q102 -1382 93 -1382H54Q47 -1382 44 -1384Q42 -1387 42 -1391Q42 -1395 45 -1397Q48 -1399 52 -1400L431 -1505Q443 -1508 448 -1509Q452 -1510 458 -1510Q465 -1510 468 -1506Q472 -1502 472 -1496Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-p" d="M452 -906V-798V-787V402Q452 418 458 428Q463 437 476 440L514 449Q521 450 524 452Q526 455 526 458Q526 462 524 464Q521 466 516 466H26Q22 466 19 464Q16 462 16 458Q16 455 18 452Q21 450 28 449L66 440Q80 437 85 428Q90 418 90 402V-776Q90 -784 86 -788Q82 -792 73 -792H34Q27 -792 24 -794Q22 -797 22 -801Q22 -805 25 -807Q28 -809 32 -810L411 -915Q423 -918 428 -919Q432 -920 438 -920Q445 -920 448 -916Q452 -912 452 -906ZM430 -744 414 -762Q471 -840 536 -878Q602 -916 690 -916Q806 -916 892 -864Q977 -813 1024 -716Q1070 -618 1070 -479Q1070 -329 1014 -216Q959 -104 861 -42Q763 20 636 20Q544 20 492 -8Q440 -35 408 -96L434 -108Q450 -66 476 -46Q503 -26 542 -26Q590 -26 626 -60Q662 -95 682 -187Q702 -279 702 -449Q702 -599 686 -686Q670 -772 641 -809Q612 -846 572 -846Q532 -846 496 -821Q459 -796 430 -744Z"/><path id="f9-r" d="M448 -540Q448 -664 488 -748Q527 -831 589 -874Q651 -916 718 -916Q800 -916 843 -862Q886 -808 886 -698Q886 -590 835 -538Q784 -486 707 -486Q636 -486 604 -524Q572 -563 568 -636L566 -674Q565 -696 557 -710Q549 -724 528 -724Q509 -724 494 -704Q480 -684 472 -641Q464 -598 464 -530ZM464 -894V-586V-74Q464 -61 471 -50Q478 -39 490 -36L588 -16Q594 -15 596 -13Q598 -11 598 -8Q598 -4 595 -2Q592 0 586 0H40Q34 0 31 -2Q28 -5 28 -8Q28 -11 32 -14Q36 -17 42 -18L78 -26Q92 -29 97 -38Q102 -46 102 -58V-782Q102 -791 98 -796Q95 -802 86 -802H42Q38 -802 35 -804Q32 -807 32 -810Q32 -813 35 -816Q38 -819 44 -820L424 -906Q433 -908 438 -909Q444 -910 450 -910Q458 -910 461 -905Q464 -900 464 -894Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-t" d="M80 -858 6 -878Q-1 -880 -4 -882Q-6 -885 -6 -888Q-6 -891 -4 -894Q-1 -896 2 -896H82Q85 -896 88 -897Q92 -898 98 -902L390 -1108Q398 -1114 407 -1118Q416 -1122 422 -1122Q430 -1122 435 -1116Q440 -1111 440 -1100V-290Q440 -201 472 -158Q504 -114 558 -114Q576 -114 592 -120Q609 -126 623 -140Q637 -154 648 -178Q659 -202 666 -238Q668 -246 674 -246Q680 -246 678 -238Q663 -151 630 -94Q596 -37 538 -8Q481 20 394 20Q246 20 169 -48Q92 -116 92 -258V-840Q92 -849 90 -853Q88 -857 80 -858ZM336 -870 348 -896H674Q679 -896 682 -894Q684 -893 684 -888Q684 -881 676 -876Q668 -870 654 -870Z"/><path id="f9-u" d="M665 -22V-170V-177V-772Q665 -780 661 -784Q657 -788 648 -788H609Q602 -788 600 -790Q597 -793 597 -797Q597 -801 600 -803Q603 -805 607 -806L986 -911Q997 -914 1002 -915Q1007 -916 1013 -916Q1020 -916 1024 -912Q1027 -908 1027 -902V-64Q1027 -48 1032 -38Q1038 -29 1051 -26L1089 -17Q1096 -16 1098 -14Q1101 -11 1101 -8Q1101 -4 1098 -2Q1096 0 1091 0H689Q677 0 671 -6Q665 -12 665 -22ZM90 -218V-772Q90 -780 86 -784Q82 -788 73 -788H34Q27 -788 24 -790Q22 -793 22 -797Q22 -801 25 -803Q28 -805 32 -806L411 -911Q423 -914 428 -915Q432 -916 438 -916Q445 -916 448 -912Q452 -908 452 -902V-256Q452 -195 476 -166Q499 -138 546 -138Q576 -138 606 -150Q637 -162 662 -184L700 -217L714 -202L674 -167Q562 -70 468 -25Q373 20 299 20Q206 20 148 -36Q90 -92 90 -218Z"/><path id="f9-v" d="M566 0H408Q399 0 393 -4Q387 -7 384 -16L74 -840Q69 -854 62 -861Q56 -868 46 -870L8 -879Q1 -881 -2 -883Q-4 -885 -4 -888Q-4 -893 -1 -894Q2 -896 6 -896H557Q567 -896 567 -888Q567 -885 564 -883Q562 -881 555 -879L507 -870Q462 -862 452 -850Q443 -838 451 -816L659 -245L587 -92L811 -770Q825 -811 810 -837Q794 -863 758 -870L710 -879Q703 -881 700 -883Q698 -885 698 -888Q698 -893 701 -894Q704 -896 708 -896H954Q959 -896 962 -894Q964 -893 964 -888Q964 -885 962 -883Q959 -881 952 -879L927 -873Q893 -865 872 -842Q852 -820 834 -764L588 -14Q586 -7 580 -4Q574 0 566 0Z"/><path id="f9-y" d="M692 -316 517 143 146 -708Q116 -778 86 -824Q57 -870 24 -877Q10 -880 7 -882Q4 -885 4 -888Q4 -893 7 -894Q10 -896 14 -896H564Q569 -896 572 -894Q574 -893 574 -888Q574 -884 572 -882Q569 -881 562 -879L514 -870Q489 -866 484 -842Q478 -818 497 -774ZM523 105 575 -33 592 -78 845 -763Q863 -813 851 -834Q839 -855 803 -865L755 -879Q748 -881 746 -883Q743 -885 743 -888Q743 -893 746 -894Q749 -896 753 -896H997Q1002 -896 1004 -894Q1007 -893 1007 -888Q1007 -885 1004 -883Q1002 -881 995 -879Q934 -866 908 -842Q881 -817 861 -762L532 126Q485 254 455 334Q425 415 384 452Q343 490 259 490Q160 490 99 428Q38 366 38 281Q38 210 75 172Q112 134 165 134Q212 134 244 162Q275 191 296 249L315 301Q328 335 345 367Q362 399 389 399Q408 399 426 362Q444 325 467 258Q490 192 523 105Z"/></defs><rect x="1" y="1" width="1598" height="768" rx="26" fill="#FBF6EE" stroke="#E6D8C4" stroke-width="2"/><g transform="translate(40.0 54.0) scale(0.00781)" fill="#B3121F"><use href="#i7-C" x="0"/><use href="#i7-H" x="1843"/><use href="#i7-O" x="3700"/><use href="#i7-O" x="5606"/><use href="#i7-S" x="7512"/><use href="#i7-E" x="9180"/><use href="#i7-Y" x="11565"/><use href="#i7-O" x="13301"/><use href="#i7-U" x="15207"/><use href="#i7-R" x="17034"/><use href="#i7-P" x="19519"/><use href="#i7-A" x="21004"/><use href="#i7-T" x="22679"/><use href="#i7-H" x="24373"/><use href="#i7-periodcentered" x="27044"/><use href="#i7-S" x="28868"/><use href="#i7-E" x="30536"/><use href="#i7-V" x="32107"/><use href="#i7-E" x="33878"/><use href="#i7-N" x="35449"/><use href="#i7-T" x="37338"/><use href="#i7-E" x="39032"/><use href="#i7-E" x="40603"/><use href="#i7-N" x="42174"/><use href="#i7-W" x="44877"/><use href="#i7-O" x="47280"/><use href="#i7-R" x="49185"/><use href="#i7-K" x="50858"/><use href="#i7-F" x="52659"/><use href="#i7-L" x="54188"/><use href="#i7-O" x="55616"/><use href="#i7-W" x="57472"/><use href="#i7-S" x="59912"/></g><rect x="40" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(57.0 101.0) scale(0.01900)" fill="#241915"><use href="#m8-l" x="0"/><use href="#m8-a" x="600"/><use href="#m8-u" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-h" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-v" x="4200"/><use href="#m8-i" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-e" x="6000"/><use href="#m8-o" x="6600"/></g><rect x="222.8" y="74" width="136.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(239.8 101.0) scale(0.01900)" fill="#241915"><use href="#m8-e" x="0"/><use href="#m8-x" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-l" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-n" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/></g><rect x="371.4" y="74" width="125.2" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(388.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-t" x="0"/><use href="#m8-u" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-a" x="3600"/><use href="#m8-l" x="4200"/></g><rect x="508.6" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(525.6 101.0) scale(0.01900)" fill="#241915"><use href="#m8-s" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-l" x="3000"/><use href="#m8-hyphen" x="3600"/><use href="#m8-s" x="4200"/><use href="#m8-h" x="4800"/><use href="#m8-o" x="5400"/><use href="#m8-r" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="691.4" y="74" width="148" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(708.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-d" x="0"/><use href="#m8-a" x="600"/><use href="#m8-t" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-t" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-y" x="5400"/></g><rect x="851.4" y="74" width="170.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(868.4 101.0) scale(0.01900)" fill="#241915"><use href="#m8-f" x="0"/><use href="#m8-o" x="600"/><use href="#m8-o" x="1200"/><use href="#m8-t" x="1800"/><use href="#m8-a" x="2400"/><use href="#m8-g" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-hyphen" x="4200"/><use href="#m8-e" x="4800"/><use href="#m8-d" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-t" x="6600"/></g><rect x="1034.2" y="74" width="113.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1051.2 101.0) scale(0.01900)" fill="#241915"><use href="#m8-t" x="0"/><use href="#m8-r" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-r" x="3600"/></g><rect x="1160" y="74" width="136.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1177.0 101.0) scale(0.01900)" fill="#241915"><use href="#m8-s" x="0"/><use href="#m8-l" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-d" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-s" x="3000"/><use href="#m8-h" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-w" x="4800"/></g><rect x="1308.6" y="74" width="205" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1325.6 101.0) scale(0.01900)" fill="#241915"><use href="#m8-c" x="0"/><use href="#m8-h" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-n" x="1800"/><use href="#m8-g" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-l" x="3600"/><use href="#m8-o" x="4200"/><use href="#m8-g" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-v" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-d" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-o" x="8400"/></g><rect x="40" y="126" width="159.4" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(57.0 153.0) scale(0.01900)" fill="#241915"><use href="#m8-m" x="0"/><use href="#m8-u" x="600"/><use href="#m8-s" x="1200"/><use href="#m8-i" x="1800"/><use href="#m8-c" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-i" x="4200"/><use href="#m8-d" x="4800"/><use href="#m8-e" x="5400"/><use href="#m8-o" x="6000"/></g><rect x="211.4" y="126" width="193.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(228.4 153.0) scale(0.01900)" fill="#241915"><use href="#m8-v" x="0"/><use href="#m8-o" x="600"/><use href="#m8-i" x="1200"/><use href="#m8-c" x="1800"/><use href="#m8-e" x="2400"/><use href="#m8-o" x="3000"/><use href="#m8-v" x="3600"/><use href="#m8-e" x="4200"/><use href="#m8-r" x="4800"/><use href="#m8-hyphen" x="5400"/><use href="#m8-o" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-l" x="7200"/><use href="#m8-y" x="7800"/></g><rect x="417" y="126" width="125.2" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(434.0 153.0) scale(0.01900)" fill="#241915"><use href="#m8-l" x="0"/><use href="#m8-o" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-l" x="2400"/><use href="#m8-i" x="3000"/><use href="#m8-z" x="3600"/><use href="#m8-e" x="4200"/></g><rect x="554.2" y="126" width="193.6" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(571.2 153.0) scale(0.01900)" fill="#241915"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-o" x="1800"/><use href="#m8-hyphen" x="2400"/><use href="#m8-e" x="3000"/><use href="#m8-x" x="3600"/><use href="#m8-p" x="4200"/><use href="#m8-l" x="4800"/><use href="#m8-a" x="5400"/><use href="#m8-i" x="6000"/><use href="#m8-n" x="6600"/><use href="#m8-e" x="7200"/><use href="#m8-r" x="7800"/></g><rect x="759.8" y="126" width="205" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(776.8 153.0) scale(0.01900)" fill="#241915"><use href="#m8-p" x="0"/><use href="#m8-a" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-e" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-hyphen" x="3000"/><use href="#m8-e" x="3600"/><use href="#m8-x" x="4200"/><use href="#m8-p" x="4800"/><use href="#m8-l" x="5400"/><use href="#m8-a" x="6000"/><use href="#m8-i" x="6600"/><use href="#m8-n" x="7200"/><use href="#m8-e" x="7800"/><use href="#m8-r" x="8400"/></g><rect x="976.8" y="126" width="91" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(993.8 153.0) scale(0.01900)" fill="#241915"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-p" x="1200"/><use href="#m8-r" x="1800"/><use href="#m8-o" x="2400"/></g><rect x="1079.8" y="126" width="113.8" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1096.8 153.0) scale(0.01900)" fill="#241915"><use href="#m8-d" x="0"/><use href="#m8-i" x="600"/><use href="#m8-a" x="1200"/><use href="#m8-g" x="1800"/><use href="#m8-r" x="2400"/><use href="#m8-a" x="3000"/><use href="#m8-m" x="3600"/></g><rect x="1205.6" y="126" width="91.0" height="40" rx="20" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1222.6 153.0) scale(0.01900)" fill="#241915"><use href="#m8-r" x="0"/><use href="#m8-e" x="600"/><use href="#m8-c" x="1200"/><use href="#m8-a" x="1800"/><use href="#m8-p" x="2400"/></g><rect x="40" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(60.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/></g><g transform="translate(60.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-b" x="0"/><use href="#f9-e" x="1095"/><use href="#f9-f" x="2051"/><use href="#f9-o" x="2687"/><use href="#f9-r" x="3735"/><use href="#f9-e" x="4631"/><use href="#f9-t" x="5887"/><use href="#f9-h" x="6575"/><use href="#f9-e" x="7694"/><use href="#f9-c" x="8950"/><use href="#f9-u" x="9857"/><use href="#f9-r" x="10984"/><use href="#f9-t" x="11880"/><use href="#f9-a" x="12568"/><use href="#f9-i" x="13568"/><use href="#f9-n" x="14120"/></g><circle cx="64" cy="345" r="4" fill="#B3121F"/><g transform="translate(76.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-g" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="379" r="4" fill="#B3121F"/><g transform="translate(76.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-o" x="0"/><use href="#m5-n" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><circle cx="64" cy="413" r="4" fill="#B3121F"/><g transform="translate(76.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="64" cy="447" r="4" fill="#B3121F"/><g transform="translate(76.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/></g><circle cx="64" cy="481" r="4" fill="#B3121F"/><g transform="translate(76.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-b" x="0"/><use href="#m5-o" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="64" cy="515" r="4" fill="#B3121F"/><g transform="translate(76.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-r" x="600"/><use href="#m5-e" x="1200"/><use href="#m5-w" x="1800"/></g><circle cx="64" cy="549" r="4" fill="#B3121F"/><g transform="translate(76.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-l" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-k" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="64" cy="583" r="4" fill="#B3121F"/><g transform="translate(76.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-G" x="0"/><use href="#m5-i" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-H" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-b" x="3000"/><use href="#m5-A" x="4200"/><use href="#m5-c" x="4800"/><use href="#m5-t" x="5400"/><use href="#m5-i" x="6000"/><use href="#m5-o" x="6600"/><use href="#m5-n" x="7200"/></g><circle cx="64" cy="617" r="4" fill="#B3121F"/><g transform="translate(76.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-h" x="0"/><use href="#m5-a" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-t" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="64" cy="651" r="4" fill="#B3121F"/><g transform="translate(76.0 657.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-c" x="600"/><use href="#m5-p" x="1200"/></g><circle cx="64" cy="685" r="4" fill="#B3121F"/><g transform="translate(76.0 691.0) scale(0.01700)" fill="#6A574B"><use href="#m5-d" x="0"/><use href="#m5-i" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-n" x="4800"/><use href="#m5-g" x="5400"/></g><rect x="296" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(316.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/></g><g transform="translate(316.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-s" x="0"/><use href="#f9-t" x="842"/><use href="#f9-o" x="1505"/><use href="#f9-r" x="2553"/><use href="#f9-y" x="3424"/><use href="#f9-a" x="4718"/><use href="#f9-n" x="5718"/><use href="#f9-d" x="6842"/><use href="#f9-c" x="8237"/><use href="#f9-r" x="9144"/><use href="#f9-a" x="10040"/><use href="#f9-f" x="11040"/><use href="#f9-t" x="11676"/></g><circle cx="320" cy="345" r="4" fill="#B3121F"/><g transform="translate(332.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-r" x="1800"/><use href="#m5-y" x="2400"/></g><circle cx="320" cy="379" r="4" fill="#B3121F"/><g transform="translate(332.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-o" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-s" x="2400"/></g><circle cx="320" cy="413" r="4" fill="#B3121F"/><g transform="translate(332.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-p" x="0"/><use href="#m5-a" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-n" x="2400"/><use href="#m5-g" x="3000"/></g><circle cx="320" cy="447" r="4" fill="#B3121F"/><g transform="translate(332.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-o" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-hyphen" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-r" x="4800"/><use href="#m5-a" x="5400"/><use href="#m5-f" x="6000"/><use href="#m5-t" x="6600"/></g><circle cx="320" cy="481" r="4" fill="#B3121F"/><g transform="translate(332.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-y" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-h" x="4800"/><use href="#m5-y" x="5400"/></g><circle cx="320" cy="515" r="4" fill="#B3121F"/><g transform="translate(332.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/></g><circle cx="320" cy="549" r="4" fill="#B3121F"/><g transform="translate(332.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-b" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-k" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-t" x="4800"/></g><circle cx="320" cy="583" r="4" fill="#B3121F"/><g transform="translate(332.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-f" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-e" x="4800"/></g><circle cx="320" cy="617" r="4" fill="#B3121F"/><g transform="translate(332.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-p" x="0"/><use href="#m5-l" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-f" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-r" x="3600"/><use href="#m5-m" x="4200"/><use href="#m5-s" x="4800"/></g><rect x="552" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(572.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-I" x="7023"/><use href="#i7-I" x="7926"/></g><g transform="translate(572.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-b" x="0"/><use href="#f9-u" x="1095"/><use href="#f9-i" x="2222"/><use href="#f9-l" x="2774"/><use href="#f9-d" x="3346"/><use href="#f9-i" x="4441"/><use href="#f9-n" x="4993"/><use href="#f9-g" x="6117"/><use href="#f9-t" x="7489"/><use href="#f9-h" x="8177"/><use href="#f9-e" x="9296"/></g><g transform="translate(572.0 306.0) scale(0.01250)" fill="#241915"><use href="#f9-p" x="0"/><use href="#f9-i" x="1105"/><use href="#f9-c" x="1657"/><use href="#f9-t" x="2564"/><use href="#f9-u" x="3252"/><use href="#f9-r" x="4379"/><use href="#f9-e" x="5275"/></g><circle cx="576" cy="345" r="4" fill="#B3121F"/><g transform="translate(588.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-d" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-r" x="3000"/></g><circle cx="576" cy="379" r="4" fill="#B3121F"/><g transform="translate(588.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-t" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-g" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-i" x="4800"/></g><circle cx="576" cy="413" r="4" fill="#B3121F"/><g transform="translate(588.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-o" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-o" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-s" x="5400"/></g><circle cx="576" cy="447" r="4" fill="#B3121F"/><g transform="translate(588.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-r" x="600"/><use href="#m5-a" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-s" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-t" x="3600"/><use href="#m5-i" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-n" x="5400"/><use href="#m5-s" x="6000"/></g><circle cx="576" cy="481" r="4" fill="#B3121F"/><g transform="translate(588.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-d" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-p" x="1800"/><use href="#m5-t" x="2400"/></g><circle cx="576" cy="515" r="4" fill="#B3121F"/><g transform="translate(588.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-f" x="0"/><use href="#m5-i" x="600"/><use href="#m5-l" x="1200"/><use href="#m5-m" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-a" x="3000"/><use href="#m5-p" x="3600"/><use href="#m5-i" x="4200"/></g><circle cx="576" cy="549" r="4" fill="#B3121F"/><g transform="translate(588.0 555.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-e" x="600"/><use href="#m5-r" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-s" x="3000"/></g><circle cx="576" cy="583" r="4" fill="#B3121F"/><g transform="translate(588.0 589.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-a" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-m" x="2400"/></g><circle cx="576" cy="617" r="4" fill="#B3121F"/><g transform="translate(588.0 623.0) scale(0.01700)" fill="#6A574B"><use href="#m5-h" x="0"/><use href="#m5-t" x="600"/><use href="#m5-m" x="1200"/><use href="#m5-l" x="1800"/><use href="#m5-hyphen" x="2400"/><use href="#m5-e" x="3000"/><use href="#m5-x" x="3600"/><use href="#m5-p" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-t" x="6000"/></g><circle cx="576" cy="651" r="4" fill="#B3121F"/><g transform="translate(588.0 657.0) scale(0.01700)" fill="#6A574B"><use href="#m5-d" x="0"/><use href="#m5-e" x="600"/><use href="#m5-b" x="1200"/><use href="#m5-u" x="1800"/><use href="#m5-g" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-i" x="3600"/><use href="#m5-n" x="4200"/><use href="#m5-g" x="4800"/><use href="#m5-hyphen" x="5400"/><use href="#m5-r" x="6000"/><use href="#m5-e" x="6600"/><use href="#m5-n" x="7200"/><use href="#m5-d" x="7800"/><use href="#m5-e" x="8400"/><use href="#m5-r" x="9000"/><use href="#m5-s" x="9600"/></g><rect x="808" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(828.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-I" x="6121"/><use href="#i7-V" x="7023"/></g><g transform="translate(828.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-s" x="0"/><use href="#f9-o" x="842"/><use href="#f9-u" x="1890"/><use href="#f9-n" x="3017"/><use href="#f9-d" x="4141"/><use href="#f9-a" x="5536"/><use href="#f9-n" x="6536"/><use href="#f9-d" x="7660"/><use href="#f9-v" x="9055"/><use href="#f9-o" x="9941"/><use href="#f9-i" x="10989"/><use href="#f9-c" x="11541"/><use href="#f9-e" x="12448"/></g><circle cx="832" cy="345" r="4" fill="#B3121F"/><g transform="translate(844.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-u" x="600"/><use href="#m5-d" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-o" x="2400"/></g><circle cx="832" cy="379" r="4" fill="#B3121F"/><g transform="translate(844.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-m" x="0"/><use href="#m5-u" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-c" x="2400"/></g><circle cx="832" cy="413" r="4" fill="#B3121F"/><g transform="translate(844.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-y" x="600"/><use href="#m5-n" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-h" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-s" x="3600"/><use href="#m5-c" x="4200"/><use href="#m5-o" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/></g><circle cx="832" cy="447" r="4" fill="#B3121F"/><g transform="translate(844.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-s" x="0"/><use href="#m5-o" x="600"/><use href="#m5-u" x="1200"/><use href="#m5-n" x="1800"/><use href="#m5-d" x="2400"/><use href="#m5-hyphen" x="3000"/><use href="#m5-d" x="3600"/><use href="#m5-e" x="4200"/><use href="#m5-s" x="4800"/><use href="#m5-i" x="5400"/><use href="#m5-g" x="6000"/><use href="#m5-n" x="6600"/></g><circle cx="832" cy="481" r="4" fill="#B3121F"/><g transform="translate(844.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-v" x="0"/><use href="#m5-o" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-c" x="1800"/><use href="#m5-e" x="2400"/></g><rect x="1064" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1084.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-A" x="0"/><use href="#i7-C" x="1771"/><use href="#i7-T" x="3613"/><use href="#i7-V" x="6121"/></g><g transform="translate(1084.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-f" x="0"/><use href="#f9-o" x="636"/><use href="#f9-o" x="1684"/><use href="#f9-t" x="2732"/><use href="#f9-a" x="3420"/><use href="#f9-g" x="4420"/><use href="#f9-e" x="5492"/><use href="#f9-comma" x="6448"/><use href="#f9-c" x="7278"/><use href="#f9-a" x="8185"/><use href="#f9-p" x="9185"/><use href="#f9-t" x="10290"/><use href="#f9-u" x="10978"/><use href="#f9-r" x="12105"/><use href="#f9-e" x="13001"/></g><g transform="translate(1084.0 306.0) scale(0.01250)" fill="#241915"><use href="#f9-a" x="0"/><use href="#f9-n" x="1000"/><use href="#f9-d" x="2124"/><use href="#f9-a" x="3519"/><use href="#f9-s" x="4519"/><use href="#f9-s" x="5361"/><use href="#f9-e" x="6203"/><use href="#f9-t" x="7159"/><use href="#f9-s" x="7847"/></g><circle cx="1088" cy="345" r="4" fill="#B3121F"/><g transform="translate(1100.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-e" x="0"/><use href="#m5-d" x="600"/><use href="#m5-i" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-n" x="3000"/><use href="#m5-g" x="3600"/></g><circle cx="1088" cy="379" r="4" fill="#B3121F"/><g transform="translate(1100.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-o" x="3000"/><use href="#m5-n" x="3600"/><use href="#m5-s" x="4200"/></g><circle cx="1088" cy="413" r="4" fill="#B3121F"/><g transform="translate(1100.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-f" x="0"/><use href="#m5-o" x="600"/><use href="#m5-o" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-a" x="2400"/><use href="#m5-g" x="3000"/><use href="#m5-e" x="3600"/><use href="#m5-hyphen" x="4200"/><use href="#m5-t" x="4800"/><use href="#m5-o" x="5400"/><use href="#m5-o" x="6000"/><use href="#m5-l" x="6600"/><use href="#m5-s" x="7200"/></g><circle cx="1088" cy="447" r="4" fill="#B3121F"/><g transform="translate(1100.0 453.0) scale(0.01700)" fill="#6A574B"><use href="#m5-c" x="0"/><use href="#m5-a" x="600"/><use href="#m5-p" x="1200"/><use href="#m5-t" x="1800"/><use href="#m5-u" x="2400"/><use href="#m5-r" x="3000"/><use href="#m5-e" x="3600"/></g><circle cx="1088" cy="481" r="4" fill="#B3121F"/><g transform="translate(1100.0 487.0) scale(0.01700)" fill="#6A574B"><use href="#m5-t" x="0"/><use href="#m5-u" x="600"/><use href="#m5-t" x="1200"/><use href="#m5-o" x="1800"/><use href="#m5-r" x="2400"/><use href="#m5-i" x="3000"/><use href="#m5-a" x="3600"/><use href="#m5-l" x="4200"/><use href="#m5-hyphen" x="4800"/><use href="#m5-r" x="5400"/><use href="#m5-e" x="6000"/><use href="#m5-c" x="6600"/><use href="#m5-o" x="7200"/><use href="#m5-r" x="7800"/><use href="#m5-d" x="8400"/><use href="#m5-i" x="9000"/><use href="#m5-n" x="9600"/><use href="#m5-g" x="10200"/></g><circle cx="1088" cy="515" r="4" fill="#B3121F"/><g transform="translate(1100.0 521.0) scale(0.01700)" fill="#6A574B"><use href="#m5-a" x="0"/><use href="#m5-s" x="600"/><use href="#m5-s" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-t" x="2400"/><use href="#m5-s" x="3000"/></g><rect x="1320" y="206" width="240" height="524" rx="16" fill="#FFFFFF" stroke="#D8C6AE" stroke-width="1.5"/><g transform="translate(1340.0 242.0) scale(0.00732)" fill="#B3121F"><use href="#i7-F" x="0"/><use href="#i7-I" x="1530"/><use href="#i7-N" x="2432"/><use href="#i7-A" x="4321"/><use href="#i7-L" x="6178"/><use href="#i7-E" x="7663"/></g><g transform="translate(1340.0 278.0) scale(0.01250)" fill="#241915"><use href="#f9-p" x="0"/><use href="#f9-r" x="1105"/><use href="#f9-o" x="2001"/><use href="#f9-o" x="3049"/><use href="#f9-f" x="4097"/><use href="#f9-i" x="5033"/><use href="#f9-t" x="5585"/><use href="#f9-i" x="6573"/><use href="#f9-s" x="7125"/><use href="#f9-d" x="8267"/><use href="#f9-o" x="9362"/><use href="#f9-n" x="10410"/><use href="#f9-e" x="11534"/></g><circle cx="1344" cy="345" r="4" fill="#B3121F"/><g transform="translate(1356.0 351.0) scale(0.01700)" fill="#6A574B"><use href="#m5-q" x="0"/><use href="#m5-a" x="600"/></g><circle cx="1344" cy="379" r="4" fill="#B3121F"/><g transform="translate(1356.0 385.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-v" x="1200"/><use href="#m5-i" x="1800"/><use href="#m5-e" x="2400"/><use href="#m5-w" x="3000"/></g><circle cx="1344" cy="413" r="4" fill="#B3121F"/><g transform="translate(1356.0 419.0) scale(0.01700)" fill="#6A574B"><use href="#m5-r" x="0"/><use href="#m5-e" x="600"/><use href="#m5-c" x="1200"/><use href="#m5-e" x="1800"/><use href="#m5-i" x="2400"/><use href="#m5-p" x="3000"/><use href="#m5-t" x="3600"/></g></svg>
\ No newline at end of file
diff --git a/assets/readme/gallery/_diagram.webp b/assets/readme/gallery/_diagram.webp
new file mode 100644
index 0000000..c29da33
Binary files /dev/null and b/assets/readme/gallery/_diagram.webp differ
diff --git a/assets/readme/gallery/_recap.webp b/assets/readme/gallery/_recap.webp
new file mode 100644
index 0000000..2034b2f
Binary files /dev/null and b/assets/readme/gallery/_recap.webp differ
diff --git a/assets/readme/gallery/_repro.webp b/assets/readme/gallery/_repro.webp
new file mode 100644
index 0000000..0a7e5a1
Binary files /dev/null and b/assets/readme/gallery/_repro.webp differ
diff --git a/assets/readme/gallery/stills/_diagram.jpg b/assets/readme/gallery/stills/_diagram.jpg
new file mode 100644
index 0000000..d73b160
Binary files /dev/null and b/assets/readme/gallery/stills/_diagram.jpg differ
diff --git a/assets/readme/gallery/stills/_recap.jpg b/assets/readme/gallery/stills/_recap.jpg
new file mode 100644
index 0000000..3b62740
Binary files /dev/null and b/assets/readme/gallery/stills/_recap.jpg differ
diff --git a/assets/readme/gallery/stills/_repro.jpg b/assets/readme/gallery/stills/_repro.jpg
new file mode 100644
index 0000000..13d651e
Binary files /dev/null and b/assets/readme/gallery/stills/_repro.jpg differ
diff --git a/assets/readme/marquee-dark.svg b/assets/readme/marquee-dark.svg
index 47b8da1..644d931 100644
--- a/assets/readme/marquee-dark.svg
+++ b/assets/readme/marquee-dark.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 250" width="1600" height="250" role="img" aria-labelledby="t d"><title id="t">now showing</title><desc id="d">A theatre marquee with chasing lights. Now showing: 32 videos, every frame rendered by showtime.</desc><style>.b0,.b1,.b2{animation:chase 1.2s linear infinite}.b1{animation-delay:-.4s}.b2{animation-delay:-.8s}@keyframes chase{0%,100%{opacity:1}33%{opacity:.25}66%{opacity:.45}}.sign{animation:on 1.6s .2s both}@keyframes on{0%{opacity:.2}30%{opacity:.9}38%{opacity:.4}55%,100%{opacity:1}}@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i6-A" d="M50 0 570 -1490H909L1441 0H1148L883 -774Q844 -894 802 -1046Q760 -1197 709 -1390H765Q715 -1195 674 -1042Q634 -890 598 -774L342 0ZM353 -369V-584H1138V-369Z"/><path id="i6-B" d="M150 0V-1490H720Q881 -1490 988 -1439Q1095 -1388 1148 -1301Q1201 -1214 1201 -1103Q1201 -1012 1166 -948Q1131 -883 1072 -843Q1014 -803 941 -786V-771Q1020 -767 1093 -723Q1166 -679 1212 -599Q1259 -519 1259 -406Q1259 -290 1203 -198Q1147 -106 1034 -53Q922 0 751 0ZM417 -223H709Q857 -223 922 -280Q988 -337 988 -426Q988 -493 955 -546Q922 -600 862 -631Q801 -662 718 -662H417ZM417 -855H686Q757 -855 813 -881Q869 -907 902 -955Q934 -1003 934 -1069Q934 -1156 873 -1212Q812 -1268 692 -1268H417Z"/><path id="i6-D" d="M654 0H277V-231H641Q797 -231 902 -288Q1006 -346 1059 -460Q1112 -575 1112 -747Q1112 -917 1059 -1031Q1006 -1145 904 -1202Q801 -1259 648 -1259H269V-1490H664Q886 -1490 1045 -1401Q1204 -1312 1290 -1145Q1375 -978 1375 -747Q1375 -514 1290 -346Q1204 -179 1042 -90Q881 0 654 0ZM417 -1490V0H150V-1490Z"/><path id="i6-E" d="M150 0V-1490H1118V-1265H417V-863H1066V-641H417V-225H1122V0Z"/><path id="i6-F" d="M150 0V-1490H1104V-1265H417V-818H1037V-596H417V0Z"/><path id="i6-H" d="M150 0V-1490H417V-874H1110V-1490H1377V0H1110V-649H417V0Z"/><path id="i6-I" d="M417 -1490V0H150V-1490Z"/><path id="i6-L" d="M150 0V-1490H417V-225H1075V0Z"/><path id="i6-M" d="M150 0V-1490H552L835 -721Q850 -678 868 -610Q887 -543 906 -465Q926 -387 944 -312Q961 -238 973 -181H919Q931 -237 948 -310Q966 -384 986 -462Q1005 -541 1024 -609Q1042 -677 1056 -721L1336 -1490H1739V0H1473V-752Q1473 -800 1474 -868Q1475 -936 1477 -1014Q1479 -1092 1481 -1172Q1483 -1251 1483 -1323H1502Q1482 -1244 1458 -1162Q1435 -1079 1412 -1002Q1389 -924 1368 -859Q1348 -794 1333 -752L1058 0H831L552 -752Q537 -794 516 -858Q496 -921 472 -998Q449 -1075 426 -1158Q402 -1242 379 -1323H401Q402 -1256 404 -1178Q406 -1099 408 -1020Q409 -941 410 -872Q412 -802 412 -752V0Z"/><path id="i6-N" d="M150 0V-1490H452L967 -669Q999 -618 1035 -554Q1071 -489 1110 -410Q1149 -330 1187 -233H1157Q1150 -317 1144 -406Q1139 -494 1136 -574Q1134 -653 1134 -708V-1490H1405V0H1102L637 -739Q593 -810 554 -879Q515 -948 470 -1035Q425 -1122 361 -1245H399Q405 -1136 410 -1038Q415 -941 418 -864Q422 -787 422 -740V0Z"/><path id="i6-O" d="M788 20Q592 20 437 -71Q282 -162 192 -333Q103 -504 103 -744Q103 -985 192 -1156Q282 -1328 437 -1419Q592 -1510 788 -1510Q983 -1510 1138 -1419Q1292 -1328 1382 -1156Q1471 -985 1471 -744Q1471 -504 1382 -332Q1292 -161 1138 -70Q983 20 788 20ZM788 -219Q909 -219 1002 -280Q1096 -340 1149 -458Q1202 -575 1202 -744Q1202 -915 1149 -1032Q1096 -1150 1002 -1210Q909 -1271 788 -1271Q666 -1271 572 -1210Q478 -1149 424 -1032Q371 -914 371 -744Q371 -575 424 -458Q478 -341 572 -280Q666 -219 788 -219Z"/><path id="i6-P" d="M150 0V-1490H707Q878 -1490 995 -1426Q1112 -1362 1172 -1250Q1232 -1139 1232 -997Q1232 -854 1172 -743Q1111 -632 993 -568Q875 -504 703 -504H334V-724H668Q769 -724 834 -759Q898 -794 928 -856Q959 -918 959 -997Q959 -1076 928 -1137Q898 -1198 833 -1232Q768 -1266 666 -1266H417V0Z"/><path id="i6-R" d="M150 0V-1490H707Q878 -1490 995 -1430Q1112 -1370 1172 -1262Q1232 -1155 1232 -1013Q1232 -871 1172 -766Q1111 -661 993 -604Q875 -547 703 -547H305V-768H668Q769 -768 833 -796Q897 -825 928 -880Q959 -935 959 -1013Q959 -1093 928 -1150Q897 -1206 832 -1236Q768 -1266 666 -1266H417V0ZM988 0 626 -676H918L1287 0Z"/><path id="i6-S" d="M673 23Q500 23 372 -31Q245 -85 173 -188Q101 -291 95 -438H358Q365 -360 407 -308Q449 -256 518 -230Q587 -205 671 -205Q759 -205 826 -232Q894 -259 932 -308Q970 -356 970 -420Q970 -478 936 -516Q903 -554 842 -580Q782 -607 701 -627L532 -671Q345 -719 240 -816Q136 -913 136 -1071Q136 -1203 207 -1302Q278 -1401 401 -1456Q524 -1510 680 -1510Q839 -1510 959 -1455Q1079 -1400 1146 -1303Q1214 -1206 1217 -1082H958Q948 -1178 872 -1230Q797 -1283 676 -1283Q592 -1283 532 -1258Q471 -1232 438 -1188Q406 -1144 406 -1087Q406 -1025 444 -985Q483 -945 542 -921Q600 -897 660 -882L799 -846Q882 -826 960 -793Q1038 -760 1100 -710Q1163 -659 1200 -587Q1237 -515 1237 -418Q1237 -287 1170 -188Q1103 -88 977 -32Q851 23 673 23Z"/><path id="i6-T" d="M83 -1265V-1490H1269V-1265H810V0H543V-1265Z"/><path id="i6-V" d="M581 0 50 -1490H343L607 -716Q644 -600 687 -448Q730 -297 780 -106H724Q774 -300 816 -450Q857 -600 893 -716L1149 -1490H1441L919 0Z"/><path id="i6-W" d="M452 0 50 -1490H337L531 -697Q551 -611 568 -516Q586 -421 602 -325Q619 -229 634 -137H591Q608 -229 625 -325Q642 -421 661 -516Q680 -611 701 -697L903 -1490H1186L1387 -697Q1409 -611 1428 -516Q1446 -421 1464 -325Q1481 -229 1499 -137H1453Q1469 -229 1486 -325Q1502 -421 1520 -516Q1538 -611 1558 -697L1751 -1490H2039L1636 0H1330L1113 -823Q1083 -938 1060 -1073Q1038 -1208 1012 -1359H1076Q1048 -1213 1028 -1080Q1008 -948 975 -823L758 0Z"/><path id="i6-X" d="M53 0 657 -861V-660L96 -1490H405L586 -1218Q632 -1148 662 -1094Q692 -1040 717 -990Q742 -939 772 -880H707Q738 -939 763 -989Q788 -1039 818 -1094Q849 -1148 896 -1218L1080 -1490H1382L827 -673V-867L1421 0H1107L881 -334Q840 -397 814 -441Q787 -485 765 -526Q743 -567 714 -621H760Q732 -569 710 -528Q688 -487 661 -442Q634 -397 590 -334L360 0Z"/><path id="i6-Y" d="M600 0V-577L50 -1490H362L628 -1020Q670 -946 703 -876Q736 -806 771 -705H701Q735 -807 768 -878Q800 -949 840 -1020L1101 -1490H1411L867 -577V0Z"/><path id="i6-periodcentered" d="M326 -547Q259 -547 212 -593Q166 -639 166 -707Q166 -774 212 -820Q259 -866 326 -866Q394 -866 440 -820Q487 -774 487 -707Q487 -639 440 -593Q394 -547 326 -547Z"/><path id="i6-two" d="M134 0V-192L651 -701Q724 -776 774 -834Q823 -892 848 -946Q874 -1001 874 -1065Q874 -1135 842 -1186Q809 -1237 754 -1264Q698 -1292 627 -1292Q552 -1292 496 -1262Q441 -1232 411 -1176Q381 -1121 381 -1044H126Q126 -1185 190 -1290Q255 -1395 368 -1452Q482 -1510 630 -1510Q779 -1510 892 -1454Q1005 -1398 1068 -1300Q1131 -1203 1131 -1078Q1131 -995 1100 -916Q1069 -837 989 -738Q909 -638 763 -498L504 -234V-223H1153V0Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-w" d="M528 0H375Q366 0 360 -4Q354 -7 351 -16L72 -840Q68 -853 62 -860Q55 -867 44 -870L6 -879Q-1 -881 -4 -883Q-6 -885 -6 -888Q-6 -893 -3 -894Q0 -896 4 -896H538Q543 -896 546 -894Q548 -893 548 -888Q548 -885 546 -883Q543 -881 536 -879L488 -870Q466 -866 461 -852Q456 -837 463 -816L629 -304L550 -92L756 -770L779 -764L550 -14Q548 -7 542 -4Q536 0 528 0ZM1132 0H979Q970 0 964 -4Q958 -7 955 -16L683 -840Q677 -859 671 -866Q665 -873 658 -874L637 -879Q630 -881 628 -883Q625 -885 625 -888Q625 -896 635 -896H1169Q1179 -896 1179 -888Q1179 -885 1176 -883Q1174 -881 1167 -879L1116 -867Q1080 -859 1073 -849Q1066 -839 1073 -816L1234 -302L1153 -92L1357 -770Q1369 -809 1356 -836Q1343 -863 1310 -870L1272 -879Q1265 -881 1262 -883Q1260 -885 1260 -888Q1260 -893 1263 -894Q1266 -896 1270 -896H1488Q1493 -896 1496 -894Q1498 -893 1498 -888Q1498 -885 1496 -883Q1493 -881 1486 -879L1463 -870Q1438 -860 1415 -832Q1392 -804 1380 -764L1154 -14Q1152 -7 1146 -4Q1140 0 1132 0Z"/><filter id="bg" x="-200%" y="-200%" width="500%" height="500%"><feGaussianBlur stdDeviation="4"/></filter><filter id="tg" x="-10%" y="-40%" width="120%" height="180%"><feGaussianBlur stdDeviation="10"/></filter></defs><rect x="4" y="4" width="1592" height="242" rx="26" fill="#B3121F"/><rect x="30" y="30" width="1540" height="190" rx="14" fill="#231916"/><g class="b0"><circle cx="17" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="55" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="20" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="58" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="134" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="172" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="248" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="286" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="362" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="400" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="476" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="514" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="590" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="628" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="704" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="742" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="818" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="856" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="932" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="970" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1046" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1084" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1160" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1198" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1274" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1312" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1388" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1426" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1502" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1540" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="55" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1583" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="131" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="207" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1540" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1502" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1426" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1388" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1312" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1274" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1198" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1160" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1084" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1046" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="970" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="932" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="856" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="818" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="742" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="704" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="628" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="590" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="514" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="476" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="400" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="362" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="286" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="248" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="172" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="134" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="58" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="20" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="207" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="17" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="17" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="131" r="5" fill="#FFF1C7"/></g><g class="sign"><g transform="translate(550.1 142.0) scale(0.04600)" fill="#E9B949" opacity=".45" filter="url(#tg)"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(550.1 142.0) scale(0.04600)" fill="#F5EBDC"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(429.8 192.0) scale(0.00977)" fill="#E9B949"><use href="#i6-two" x="0"/><use href="#i6-two" x="1645"/><use href="#i6-E" x="4174"/><use href="#i6-X" x="5783"/><use href="#i6-A" x="7625"/><use href="#i6-M" x="9484"/><use href="#i6-P" x="11741"/><use href="#i6-L" x="13431"/><use href="#i6-E" x="14958"/><use href="#i6-S" x="16566"/><use href="#i6-periodcentered" x="20036"/><use href="#i6-E" x="22827"/><use href="#i6-V" x="24436"/><use href="#i6-E" x="26295"/><use href="#i6-R" x="27903"/><use href="#i6-Y" x="29552"/><use href="#i6-F" x="32266"/><use href="#i6-R" x="33839"/><use href="#i6-A" x="35543"/><use href="#i6-M" x="37402"/><use href="#i6-E" x="39660"/><use href="#i6-R" x="42153"/><use href="#i6-E" x="43858"/><use href="#i6-N" x="45466"/><use href="#i6-D" x="47390"/><use href="#i6-E" x="49237"/><use href="#i6-R" x="50846"/><use href="#i6-E" x="52551"/><use href="#i6-D" x="54159"/><use href="#i6-B" x="56892"/><use href="#i6-Y" x="58610"/><use href="#i6-S" x="61325"/><use href="#i6-H" x="63025"/><use href="#i6-O" x="64921"/><use href="#i6-W" x="66831"/><use href="#i6-T" x="69288"/><use href="#i6-I" x="71009"/><use href="#i6-M" x="71944"/><use href="#i6-E" x="74202"/></g></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 250" width="1600" height="250" role="img" aria-labelledby="t d"><title id="t">now showing</title><desc id="d">A theatre marquee with chasing lights. Now showing: 35 videos, every frame rendered by showtime.</desc><style>.b0,.b1,.b2{animation:chase 1.2s linear infinite}.b1{animation-delay:-.4s}.b2{animation-delay:-.8s}@keyframes chase{0%,100%{opacity:1}33%{opacity:.25}66%{opacity:.45}}.sign{animation:on 1.6s .2s both}@keyframes on{0%{opacity:.2}30%{opacity:.9}38%{opacity:.4}55%,100%{opacity:1}}@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i6-A" d="M50 0 570 -1490H909L1441 0H1148L883 -774Q844 -894 802 -1046Q760 -1197 709 -1390H765Q715 -1195 674 -1042Q634 -890 598 -774L342 0ZM353 -369V-584H1138V-369Z"/><path id="i6-B" d="M150 0V-1490H720Q881 -1490 988 -1439Q1095 -1388 1148 -1301Q1201 -1214 1201 -1103Q1201 -1012 1166 -948Q1131 -883 1072 -843Q1014 -803 941 -786V-771Q1020 -767 1093 -723Q1166 -679 1212 -599Q1259 -519 1259 -406Q1259 -290 1203 -198Q1147 -106 1034 -53Q922 0 751 0ZM417 -223H709Q857 -223 922 -280Q988 -337 988 -426Q988 -493 955 -546Q922 -600 862 -631Q801 -662 718 -662H417ZM417 -855H686Q757 -855 813 -881Q869 -907 902 -955Q934 -1003 934 -1069Q934 -1156 873 -1212Q812 -1268 692 -1268H417Z"/><path id="i6-D" d="M654 0H277V-231H641Q797 -231 902 -288Q1006 -346 1059 -460Q1112 -575 1112 -747Q1112 -917 1059 -1031Q1006 -1145 904 -1202Q801 -1259 648 -1259H269V-1490H664Q886 -1490 1045 -1401Q1204 -1312 1290 -1145Q1375 -978 1375 -747Q1375 -514 1290 -346Q1204 -179 1042 -90Q881 0 654 0ZM417 -1490V0H150V-1490Z"/><path id="i6-E" d="M150 0V-1490H1118V-1265H417V-863H1066V-641H417V-225H1122V0Z"/><path id="i6-F" d="M150 0V-1490H1104V-1265H417V-818H1037V-596H417V0Z"/><path id="i6-H" d="M150 0V-1490H417V-874H1110V-1490H1377V0H1110V-649H417V0Z"/><path id="i6-I" d="M417 -1490V0H150V-1490Z"/><path id="i6-L" d="M150 0V-1490H417V-225H1075V0Z"/><path id="i6-M" d="M150 0V-1490H552L835 -721Q850 -678 868 -610Q887 -543 906 -465Q926 -387 944 -312Q961 -238 973 -181H919Q931 -237 948 -310Q966 -384 986 -462Q1005 -541 1024 -609Q1042 -677 1056 -721L1336 -1490H1739V0H1473V-752Q1473 -800 1474 -868Q1475 -936 1477 -1014Q1479 -1092 1481 -1172Q1483 -1251 1483 -1323H1502Q1482 -1244 1458 -1162Q1435 -1079 1412 -1002Q1389 -924 1368 -859Q1348 -794 1333 -752L1058 0H831L552 -752Q537 -794 516 -858Q496 -921 472 -998Q449 -1075 426 -1158Q402 -1242 379 -1323H401Q402 -1256 404 -1178Q406 -1099 408 -1020Q409 -941 410 -872Q412 -802 412 -752V0Z"/><path id="i6-N" d="M150 0V-1490H452L967 -669Q999 -618 1035 -554Q1071 -489 1110 -410Q1149 -330 1187 -233H1157Q1150 -317 1144 -406Q1139 -494 1136 -574Q1134 -653 1134 -708V-1490H1405V0H1102L637 -739Q593 -810 554 -879Q515 -948 470 -1035Q425 -1122 361 -1245H399Q405 -1136 410 -1038Q415 -941 418 -864Q422 -787 422 -740V0Z"/><path id="i6-O" d="M788 20Q592 20 437 -71Q282 -162 192 -333Q103 -504 103 -744Q103 -985 192 -1156Q282 -1328 437 -1419Q592 -1510 788 -1510Q983 -1510 1138 -1419Q1292 -1328 1382 -1156Q1471 -985 1471 -744Q1471 -504 1382 -332Q1292 -161 1138 -70Q983 20 788 20ZM788 -219Q909 -219 1002 -280Q1096 -340 1149 -458Q1202 -575 1202 -744Q1202 -915 1149 -1032Q1096 -1150 1002 -1210Q909 -1271 788 -1271Q666 -1271 572 -1210Q478 -1149 424 -1032Q371 -914 371 -744Q371 -575 424 -458Q478 -341 572 -280Q666 -219 788 -219Z"/><path id="i6-P" d="M150 0V-1490H707Q878 -1490 995 -1426Q1112 -1362 1172 -1250Q1232 -1139 1232 -997Q1232 -854 1172 -743Q1111 -632 993 -568Q875 -504 703 -504H334V-724H668Q769 -724 834 -759Q898 -794 928 -856Q959 -918 959 -997Q959 -1076 928 -1137Q898 -1198 833 -1232Q768 -1266 666 -1266H417V0Z"/><path id="i6-R" d="M150 0V-1490H707Q878 -1490 995 -1430Q1112 -1370 1172 -1262Q1232 -1155 1232 -1013Q1232 -871 1172 -766Q1111 -661 993 -604Q875 -547 703 -547H305V-768H668Q769 -768 833 -796Q897 -825 928 -880Q959 -935 959 -1013Q959 -1093 928 -1150Q897 -1206 832 -1236Q768 -1266 666 -1266H417V0ZM988 0 626 -676H918L1287 0Z"/><path id="i6-S" d="M673 23Q500 23 372 -31Q245 -85 173 -188Q101 -291 95 -438H358Q365 -360 407 -308Q449 -256 518 -230Q587 -205 671 -205Q759 -205 826 -232Q894 -259 932 -308Q970 -356 970 -420Q970 -478 936 -516Q903 -554 842 -580Q782 -607 701 -627L532 -671Q345 -719 240 -816Q136 -913 136 -1071Q136 -1203 207 -1302Q278 -1401 401 -1456Q524 -1510 680 -1510Q839 -1510 959 -1455Q1079 -1400 1146 -1303Q1214 -1206 1217 -1082H958Q948 -1178 872 -1230Q797 -1283 676 -1283Q592 -1283 532 -1258Q471 -1232 438 -1188Q406 -1144 406 -1087Q406 -1025 444 -985Q483 -945 542 -921Q600 -897 660 -882L799 -846Q882 -826 960 -793Q1038 -760 1100 -710Q1163 -659 1200 -587Q1237 -515 1237 -418Q1237 -287 1170 -188Q1103 -88 977 -32Q851 23 673 23Z"/><path id="i6-T" d="M83 -1265V-1490H1269V-1265H810V0H543V-1265Z"/><path id="i6-V" d="M581 0 50 -1490H343L607 -716Q644 -600 687 -448Q730 -297 780 -106H724Q774 -300 816 -450Q857 -600 893 -716L1149 -1490H1441L919 0Z"/><path id="i6-W" d="M452 0 50 -1490H337L531 -697Q551 -611 568 -516Q586 -421 602 -325Q619 -229 634 -137H591Q608 -229 625 -325Q642 -421 661 -516Q680 -611 701 -697L903 -1490H1186L1387 -697Q1409 -611 1428 -516Q1446 -421 1464 -325Q1481 -229 1499 -137H1453Q1469 -229 1486 -325Q1502 -421 1520 -516Q1538 -611 1558 -697L1751 -1490H2039L1636 0H1330L1113 -823Q1083 -938 1060 -1073Q1038 -1208 1012 -1359H1076Q1048 -1213 1028 -1080Q1008 -948 975 -823L758 0Z"/><path id="i6-X" d="M53 0 657 -861V-660L96 -1490H405L586 -1218Q632 -1148 662 -1094Q692 -1040 717 -990Q742 -939 772 -880H707Q738 -939 763 -989Q788 -1039 818 -1094Q849 -1148 896 -1218L1080 -1490H1382L827 -673V-867L1421 0H1107L881 -334Q840 -397 814 -441Q787 -485 765 -526Q743 -567 714 -621H760Q732 -569 710 -528Q688 -487 661 -442Q634 -397 590 -334L360 0Z"/><path id="i6-Y" d="M600 0V-577L50 -1490H362L628 -1020Q670 -946 703 -876Q736 -806 771 -705H701Q735 -807 768 -878Q800 -949 840 -1020L1101 -1490H1411L867 -577V0Z"/><path id="i6-periodcentered" d="M326 -547Q259 -547 212 -593Q166 -639 166 -707Q166 -774 212 -820Q259 -866 326 -866Q394 -866 440 -820Q487 -774 487 -707Q487 -639 440 -593Q394 -547 326 -547Z"/><path id="i6-two" d="M134 0V-192L651 -701Q724 -776 774 -834Q823 -892 848 -946Q874 -1001 874 -1065Q874 -1135 842 -1186Q809 -1237 754 -1264Q698 -1292 627 -1292Q552 -1292 496 -1262Q441 -1232 411 -1176Q381 -1121 381 -1044H126Q126 -1185 190 -1290Q255 -1395 368 -1452Q482 -1510 630 -1510Q779 -1510 892 -1454Q1005 -1398 1068 -1300Q1131 -1203 1131 -1078Q1131 -995 1100 -916Q1069 -837 989 -738Q909 -638 763 -498L504 -234V-223H1153V0Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-w" d="M528 0H375Q366 0 360 -4Q354 -7 351 -16L72 -840Q68 -853 62 -860Q55 -867 44 -870L6 -879Q-1 -881 -4 -883Q-6 -885 -6 -888Q-6 -893 -3 -894Q0 -896 4 -896H538Q543 -896 546 -894Q548 -893 548 -888Q548 -885 546 -883Q543 -881 536 -879L488 -870Q466 -866 461 -852Q456 -837 463 -816L629 -304L550 -92L756 -770L779 -764L550 -14Q548 -7 542 -4Q536 0 528 0ZM1132 0H979Q970 0 964 -4Q958 -7 955 -16L683 -840Q677 -859 671 -866Q665 -873 658 -874L637 -879Q630 -881 628 -883Q625 -885 625 -888Q625 -896 635 -896H1169Q1179 -896 1179 -888Q1179 -885 1176 -883Q1174 -881 1167 -879L1116 -867Q1080 -859 1073 -849Q1066 -839 1073 -816L1234 -302L1153 -92L1357 -770Q1369 -809 1356 -836Q1343 -863 1310 -870L1272 -879Q1265 -881 1262 -883Q1260 -885 1260 -888Q1260 -893 1263 -894Q1266 -896 1270 -896H1488Q1493 -896 1496 -894Q1498 -893 1498 -888Q1498 -885 1496 -883Q1493 -881 1486 -879L1463 -870Q1438 -860 1415 -832Q1392 -804 1380 -764L1154 -14Q1152 -7 1146 -4Q1140 0 1132 0Z"/><filter id="bg" x="-200%" y="-200%" width="500%" height="500%"><feGaussianBlur stdDeviation="4"/></filter><filter id="tg" x="-10%" y="-40%" width="120%" height="180%"><feGaussianBlur stdDeviation="10"/></filter></defs><rect x="4" y="4" width="1592" height="242" rx="26" fill="#B3121F"/><rect x="30" y="30" width="1540" height="190" rx="14" fill="#231916"/><g class="b0"><circle cx="17" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="55" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="20" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="58" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="134" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="172" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="248" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="286" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="362" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="400" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="476" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="514" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="590" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="628" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="704" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="742" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="818" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="856" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="932" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="970" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1046" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1084" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1160" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1198" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1274" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1312" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1388" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1426" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1502" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1540" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="55" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1583" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="131" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="207" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1540" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1502" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1426" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1388" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1312" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1274" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1198" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1160" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1084" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1046" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="970" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="932" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="856" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="818" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="742" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="704" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="628" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="590" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="514" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="476" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="400" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="362" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="286" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="248" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="172" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="134" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="58" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="20" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="207" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="17" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="17" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="131" r="5" fill="#FFF1C7"/></g><g class="sign"><g transform="translate(550.1 142.0) scale(0.04600)" fill="#E9B949" opacity=".45" filter="url(#tg)"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(550.1 142.0) scale(0.04600)" fill="#F5EBDC"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(429.8 192.0) scale(0.00977)" fill="#E9B949"><use href="#i6-two" x="0"/><use href="#i6-two" x="1645"/><use href="#i6-E" x="4174"/><use href="#i6-X" x="5783"/><use href="#i6-A" x="7625"/><use href="#i6-M" x="9484"/><use href="#i6-P" x="11741"/><use href="#i6-L" x="13431"/><use href="#i6-E" x="14958"/><use href="#i6-S" x="16566"/><use href="#i6-periodcentered" x="20036"/><use href="#i6-E" x="22827"/><use href="#i6-V" x="24436"/><use href="#i6-E" x="26295"/><use href="#i6-R" x="27903"/><use href="#i6-Y" x="29552"/><use href="#i6-F" x="32266"/><use href="#i6-R" x="33839"/><use href="#i6-A" x="35543"/><use href="#i6-M" x="37402"/><use href="#i6-E" x="39660"/><use href="#i6-R" x="42153"/><use href="#i6-E" x="43858"/><use href="#i6-N" x="45466"/><use href="#i6-D" x="47390"/><use href="#i6-E" x="49237"/><use href="#i6-R" x="50846"/><use href="#i6-E" x="52551"/><use href="#i6-D" x="54159"/><use href="#i6-B" x="56892"/><use href="#i6-Y" x="58610"/><use href="#i6-S" x="61325"/><use href="#i6-H" x="63025"/><use href="#i6-O" x="64921"/><use href="#i6-W" x="66831"/><use href="#i6-T" x="69288"/><use href="#i6-I" x="71009"/><use href="#i6-M" x="71944"/><use href="#i6-E" x="74202"/></g></g></svg>
\ No newline at end of file
diff --git a/assets/readme/marquee-light.svg b/assets/readme/marquee-light.svg
index f8d94d6..0389db2 100644
--- a/assets/readme/marquee-light.svg
+++ b/assets/readme/marquee-light.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 250" width="1600" height="250" role="img" aria-labelledby="t d"><title id="t">now showing</title><desc id="d">A theatre marquee with chasing lights. Now showing: 32 videos, every frame rendered by showtime.</desc><style>.b0,.b1,.b2{animation:chase 1.2s linear infinite}.b1{animation-delay:-.4s}.b2{animation-delay:-.8s}@keyframes chase{0%,100%{opacity:1}33%{opacity:.25}66%{opacity:.45}}.sign{animation:on 1.6s .2s both}@keyframes on{0%{opacity:.2}30%{opacity:.9}38%{opacity:.4}55%,100%{opacity:1}}@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i6-A" d="M50 0 570 -1490H909L1441 0H1148L883 -774Q844 -894 802 -1046Q760 -1197 709 -1390H765Q715 -1195 674 -1042Q634 -890 598 -774L342 0ZM353 -369V-584H1138V-369Z"/><path id="i6-B" d="M150 0V-1490H720Q881 -1490 988 -1439Q1095 -1388 1148 -1301Q1201 -1214 1201 -1103Q1201 -1012 1166 -948Q1131 -883 1072 -843Q1014 -803 941 -786V-771Q1020 -767 1093 -723Q1166 -679 1212 -599Q1259 -519 1259 -406Q1259 -290 1203 -198Q1147 -106 1034 -53Q922 0 751 0ZM417 -223H709Q857 -223 922 -280Q988 -337 988 -426Q988 -493 955 -546Q922 -600 862 -631Q801 -662 718 -662H417ZM417 -855H686Q757 -855 813 -881Q869 -907 902 -955Q934 -1003 934 -1069Q934 -1156 873 -1212Q812 -1268 692 -1268H417Z"/><path id="i6-D" d="M654 0H277V-231H641Q797 -231 902 -288Q1006 -346 1059 -460Q1112 -575 1112 -747Q1112 -917 1059 -1031Q1006 -1145 904 -1202Q801 -1259 648 -1259H269V-1490H664Q886 -1490 1045 -1401Q1204 -1312 1290 -1145Q1375 -978 1375 -747Q1375 -514 1290 -346Q1204 -179 1042 -90Q881 0 654 0ZM417 -1490V0H150V-1490Z"/><path id="i6-E" d="M150 0V-1490H1118V-1265H417V-863H1066V-641H417V-225H1122V0Z"/><path id="i6-F" d="M150 0V-1490H1104V-1265H417V-818H1037V-596H417V0Z"/><path id="i6-H" d="M150 0V-1490H417V-874H1110V-1490H1377V0H1110V-649H417V0Z"/><path id="i6-I" d="M417 -1490V0H150V-1490Z"/><path id="i6-L" d="M150 0V-1490H417V-225H1075V0Z"/><path id="i6-M" d="M150 0V-1490H552L835 -721Q850 -678 868 -610Q887 -543 906 -465Q926 -387 944 -312Q961 -238 973 -181H919Q931 -237 948 -310Q966 -384 986 -462Q1005 -541 1024 -609Q1042 -677 1056 -721L1336 -1490H1739V0H1473V-752Q1473 -800 1474 -868Q1475 -936 1477 -1014Q1479 -1092 1481 -1172Q1483 -1251 1483 -1323H1502Q1482 -1244 1458 -1162Q1435 -1079 1412 -1002Q1389 -924 1368 -859Q1348 -794 1333 -752L1058 0H831L552 -752Q537 -794 516 -858Q496 -921 472 -998Q449 -1075 426 -1158Q402 -1242 379 -1323H401Q402 -1256 404 -1178Q406 -1099 408 -1020Q409 -941 410 -872Q412 -802 412 -752V0Z"/><path id="i6-N" d="M150 0V-1490H452L967 -669Q999 -618 1035 -554Q1071 -489 1110 -410Q1149 -330 1187 -233H1157Q1150 -317 1144 -406Q1139 -494 1136 -574Q1134 -653 1134 -708V-1490H1405V0H1102L637 -739Q593 -810 554 -879Q515 -948 470 -1035Q425 -1122 361 -1245H399Q405 -1136 410 -1038Q415 -941 418 -864Q422 -787 422 -740V0Z"/><path id="i6-O" d="M788 20Q592 20 437 -71Q282 -162 192 -333Q103 -504 103 -744Q103 -985 192 -1156Q282 -1328 437 -1419Q592 -1510 788 -1510Q983 -1510 1138 -1419Q1292 -1328 1382 -1156Q1471 -985 1471 -744Q1471 -504 1382 -332Q1292 -161 1138 -70Q983 20 788 20ZM788 -219Q909 -219 1002 -280Q1096 -340 1149 -458Q1202 -575 1202 -744Q1202 -915 1149 -1032Q1096 -1150 1002 -1210Q909 -1271 788 -1271Q666 -1271 572 -1210Q478 -1149 424 -1032Q371 -914 371 -744Q371 -575 424 -458Q478 -341 572 -280Q666 -219 788 -219Z"/><path id="i6-P" d="M150 0V-1490H707Q878 -1490 995 -1426Q1112 -1362 1172 -1250Q1232 -1139 1232 -997Q1232 -854 1172 -743Q1111 -632 993 -568Q875 -504 703 -504H334V-724H668Q769 -724 834 -759Q898 -794 928 -856Q959 -918 959 -997Q959 -1076 928 -1137Q898 -1198 833 -1232Q768 -1266 666 -1266H417V0Z"/><path id="i6-R" d="M150 0V-1490H707Q878 -1490 995 -1430Q1112 -1370 1172 -1262Q1232 -1155 1232 -1013Q1232 -871 1172 -766Q1111 -661 993 -604Q875 -547 703 -547H305V-768H668Q769 -768 833 -796Q897 -825 928 -880Q959 -935 959 -1013Q959 -1093 928 -1150Q897 -1206 832 -1236Q768 -1266 666 -1266H417V0ZM988 0 626 -676H918L1287 0Z"/><path id="i6-S" d="M673 23Q500 23 372 -31Q245 -85 173 -188Q101 -291 95 -438H358Q365 -360 407 -308Q449 -256 518 -230Q587 -205 671 -205Q759 -205 826 -232Q894 -259 932 -308Q970 -356 970 -420Q970 -478 936 -516Q903 -554 842 -580Q782 -607 701 -627L532 -671Q345 -719 240 -816Q136 -913 136 -1071Q136 -1203 207 -1302Q278 -1401 401 -1456Q524 -1510 680 -1510Q839 -1510 959 -1455Q1079 -1400 1146 -1303Q1214 -1206 1217 -1082H958Q948 -1178 872 -1230Q797 -1283 676 -1283Q592 -1283 532 -1258Q471 -1232 438 -1188Q406 -1144 406 -1087Q406 -1025 444 -985Q483 -945 542 -921Q600 -897 660 -882L799 -846Q882 -826 960 -793Q1038 -760 1100 -710Q1163 -659 1200 -587Q1237 -515 1237 -418Q1237 -287 1170 -188Q1103 -88 977 -32Q851 23 673 23Z"/><path id="i6-T" d="M83 -1265V-1490H1269V-1265H810V0H543V-1265Z"/><path id="i6-V" d="M581 0 50 -1490H343L607 -716Q644 -600 687 -448Q730 -297 780 -106H724Q774 -300 816 -450Q857 -600 893 -716L1149 -1490H1441L919 0Z"/><path id="i6-W" d="M452 0 50 -1490H337L531 -697Q551 -611 568 -516Q586 -421 602 -325Q619 -229 634 -137H591Q608 -229 625 -325Q642 -421 661 -516Q680 -611 701 -697L903 -1490H1186L1387 -697Q1409 -611 1428 -516Q1446 -421 1464 -325Q1481 -229 1499 -137H1453Q1469 -229 1486 -325Q1502 -421 1520 -516Q1538 -611 1558 -697L1751 -1490H2039L1636 0H1330L1113 -823Q1083 -938 1060 -1073Q1038 -1208 1012 -1359H1076Q1048 -1213 1028 -1080Q1008 -948 975 -823L758 0Z"/><path id="i6-X" d="M53 0 657 -861V-660L96 -1490H405L586 -1218Q632 -1148 662 -1094Q692 -1040 717 -990Q742 -939 772 -880H707Q738 -939 763 -989Q788 -1039 818 -1094Q849 -1148 896 -1218L1080 -1490H1382L827 -673V-867L1421 0H1107L881 -334Q840 -397 814 -441Q787 -485 765 -526Q743 -567 714 -621H760Q732 -569 710 -528Q688 -487 661 -442Q634 -397 590 -334L360 0Z"/><path id="i6-Y" d="M600 0V-577L50 -1490H362L628 -1020Q670 -946 703 -876Q736 -806 771 -705H701Q735 -807 768 -878Q800 -949 840 -1020L1101 -1490H1411L867 -577V0Z"/><path id="i6-periodcentered" d="M326 -547Q259 -547 212 -593Q166 -639 166 -707Q166 -774 212 -820Q259 -866 326 -866Q394 -866 440 -820Q487 -774 487 -707Q487 -639 440 -593Q394 -547 326 -547Z"/><path id="i6-two" d="M134 0V-192L651 -701Q724 -776 774 -834Q823 -892 848 -946Q874 -1001 874 -1065Q874 -1135 842 -1186Q809 -1237 754 -1264Q698 -1292 627 -1292Q552 -1292 496 -1262Q441 -1232 411 -1176Q381 -1121 381 -1044H126Q126 -1185 190 -1290Q255 -1395 368 -1452Q482 -1510 630 -1510Q779 -1510 892 -1454Q1005 -1398 1068 -1300Q1131 -1203 1131 -1078Q1131 -995 1100 -916Q1069 -837 989 -738Q909 -638 763 -498L504 -234V-223H1153V0Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-w" d="M528 0H375Q366 0 360 -4Q354 -7 351 -16L72 -840Q68 -853 62 -860Q55 -867 44 -870L6 -879Q-1 -881 -4 -883Q-6 -885 -6 -888Q-6 -893 -3 -894Q0 -896 4 -896H538Q543 -896 546 -894Q548 -893 548 -888Q548 -885 546 -883Q543 -881 536 -879L488 -870Q466 -866 461 -852Q456 -837 463 -816L629 -304L550 -92L756 -770L779 -764L550 -14Q548 -7 542 -4Q536 0 528 0ZM1132 0H979Q970 0 964 -4Q958 -7 955 -16L683 -840Q677 -859 671 -866Q665 -873 658 -874L637 -879Q630 -881 628 -883Q625 -885 625 -888Q625 -896 635 -896H1169Q1179 -896 1179 -888Q1179 -885 1176 -883Q1174 -881 1167 -879L1116 -867Q1080 -859 1073 -849Q1066 -839 1073 -816L1234 -302L1153 -92L1357 -770Q1369 -809 1356 -836Q1343 -863 1310 -870L1272 -879Q1265 -881 1262 -883Q1260 -885 1260 -888Q1260 -893 1263 -894Q1266 -896 1270 -896H1488Q1493 -896 1496 -894Q1498 -893 1498 -888Q1498 -885 1496 -883Q1493 -881 1486 -879L1463 -870Q1438 -860 1415 -832Q1392 -804 1380 -764L1154 -14Q1152 -7 1146 -4Q1140 0 1132 0Z"/><filter id="bg" x="-200%" y="-200%" width="500%" height="500%"><feGaussianBlur stdDeviation="4"/></filter><filter id="tg" x="-10%" y="-40%" width="120%" height="180%"><feGaussianBlur stdDeviation="10"/></filter></defs><rect x="4" y="4" width="1592" height="242" rx="26" fill="#6E0B16"/><rect x="30" y="30" width="1540" height="190" rx="14" fill="#B3121F"/><g class="b0"><circle cx="17" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="55" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="20" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="58" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="134" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="172" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="248" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="286" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="362" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="400" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="476" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="514" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="590" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="628" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="704" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="742" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="818" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="856" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="932" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="970" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1046" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1084" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1160" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1198" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1274" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1312" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1388" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1426" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1502" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1540" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="55" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1583" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="131" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="207" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1540" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1502" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1426" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1388" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1312" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1274" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1198" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1160" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1084" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1046" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="970" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="932" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="856" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="818" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="742" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="704" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="628" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="590" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="514" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="476" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="400" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="362" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="286" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="248" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="172" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="134" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="58" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="20" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="207" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="17" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="17" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="131" r="5" fill="#FFF1C7"/></g><g class="sign"><g transform="translate(550.1 142.0) scale(0.04600)" fill="#E9B949" opacity=".45" filter="url(#tg)"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(550.1 142.0) scale(0.04600)" fill="#F5EBDC"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(429.8 192.0) scale(0.00977)" fill="#FFE3A0"><use href="#i6-two" x="0"/><use href="#i6-two" x="1645"/><use href="#i6-E" x="4174"/><use href="#i6-X" x="5783"/><use href="#i6-A" x="7625"/><use href="#i6-M" x="9484"/><use href="#i6-P" x="11741"/><use href="#i6-L" x="13431"/><use href="#i6-E" x="14958"/><use href="#i6-S" x="16566"/><use href="#i6-periodcentered" x="20036"/><use href="#i6-E" x="22827"/><use href="#i6-V" x="24436"/><use href="#i6-E" x="26295"/><use href="#i6-R" x="27903"/><use href="#i6-Y" x="29552"/><use href="#i6-F" x="32266"/><use href="#i6-R" x="33839"/><use href="#i6-A" x="35543"/><use href="#i6-M" x="37402"/><use href="#i6-E" x="39660"/><use href="#i6-R" x="42153"/><use href="#i6-E" x="43858"/><use href="#i6-N" x="45466"/><use href="#i6-D" x="47390"/><use href="#i6-E" x="49237"/><use href="#i6-R" x="50846"/><use href="#i6-E" x="52551"/><use href="#i6-D" x="54159"/><use href="#i6-B" x="56892"/><use href="#i6-Y" x="58610"/><use href="#i6-S" x="61325"/><use href="#i6-H" x="63025"/><use href="#i6-O" x="64921"/><use href="#i6-W" x="66831"/><use href="#i6-T" x="69288"/><use href="#i6-I" x="71009"/><use href="#i6-M" x="71944"/><use href="#i6-E" x="74202"/></g></g></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 250" width="1600" height="250" role="img" aria-labelledby="t d"><title id="t">now showing</title><desc id="d">A theatre marquee with chasing lights. Now showing: 35 videos, every frame rendered by showtime.</desc><style>.b0,.b1,.b2{animation:chase 1.2s linear infinite}.b1{animation-delay:-.4s}.b2{animation-delay:-.8s}@keyframes chase{0%,100%{opacity:1}33%{opacity:.25}66%{opacity:.45}}.sign{animation:on 1.6s .2s both}@keyframes on{0%{opacity:.2}30%{opacity:.9}38%{opacity:.4}55%,100%{opacity:1}}@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}</style><defs><path id="i6-A" d="M50 0 570 -1490H909L1441 0H1148L883 -774Q844 -894 802 -1046Q760 -1197 709 -1390H765Q715 -1195 674 -1042Q634 -890 598 -774L342 0ZM353 -369V-584H1138V-369Z"/><path id="i6-B" d="M150 0V-1490H720Q881 -1490 988 -1439Q1095 -1388 1148 -1301Q1201 -1214 1201 -1103Q1201 -1012 1166 -948Q1131 -883 1072 -843Q1014 -803 941 -786V-771Q1020 -767 1093 -723Q1166 -679 1212 -599Q1259 -519 1259 -406Q1259 -290 1203 -198Q1147 -106 1034 -53Q922 0 751 0ZM417 -223H709Q857 -223 922 -280Q988 -337 988 -426Q988 -493 955 -546Q922 -600 862 -631Q801 -662 718 -662H417ZM417 -855H686Q757 -855 813 -881Q869 -907 902 -955Q934 -1003 934 -1069Q934 -1156 873 -1212Q812 -1268 692 -1268H417Z"/><path id="i6-D" d="M654 0H277V-231H641Q797 -231 902 -288Q1006 -346 1059 -460Q1112 -575 1112 -747Q1112 -917 1059 -1031Q1006 -1145 904 -1202Q801 -1259 648 -1259H269V-1490H664Q886 -1490 1045 -1401Q1204 -1312 1290 -1145Q1375 -978 1375 -747Q1375 -514 1290 -346Q1204 -179 1042 -90Q881 0 654 0ZM417 -1490V0H150V-1490Z"/><path id="i6-E" d="M150 0V-1490H1118V-1265H417V-863H1066V-641H417V-225H1122V0Z"/><path id="i6-F" d="M150 0V-1490H1104V-1265H417V-818H1037V-596H417V0Z"/><path id="i6-H" d="M150 0V-1490H417V-874H1110V-1490H1377V0H1110V-649H417V0Z"/><path id="i6-I" d="M417 -1490V0H150V-1490Z"/><path id="i6-L" d="M150 0V-1490H417V-225H1075V0Z"/><path id="i6-M" d="M150 0V-1490H552L835 -721Q850 -678 868 -610Q887 -543 906 -465Q926 -387 944 -312Q961 -238 973 -181H919Q931 -237 948 -310Q966 -384 986 -462Q1005 -541 1024 -609Q1042 -677 1056 -721L1336 -1490H1739V0H1473V-752Q1473 -800 1474 -868Q1475 -936 1477 -1014Q1479 -1092 1481 -1172Q1483 -1251 1483 -1323H1502Q1482 -1244 1458 -1162Q1435 -1079 1412 -1002Q1389 -924 1368 -859Q1348 -794 1333 -752L1058 0H831L552 -752Q537 -794 516 -858Q496 -921 472 -998Q449 -1075 426 -1158Q402 -1242 379 -1323H401Q402 -1256 404 -1178Q406 -1099 408 -1020Q409 -941 410 -872Q412 -802 412 -752V0Z"/><path id="i6-N" d="M150 0V-1490H452L967 -669Q999 -618 1035 -554Q1071 -489 1110 -410Q1149 -330 1187 -233H1157Q1150 -317 1144 -406Q1139 -494 1136 -574Q1134 -653 1134 -708V-1490H1405V0H1102L637 -739Q593 -810 554 -879Q515 -948 470 -1035Q425 -1122 361 -1245H399Q405 -1136 410 -1038Q415 -941 418 -864Q422 -787 422 -740V0Z"/><path id="i6-O" d="M788 20Q592 20 437 -71Q282 -162 192 -333Q103 -504 103 -744Q103 -985 192 -1156Q282 -1328 437 -1419Q592 -1510 788 -1510Q983 -1510 1138 -1419Q1292 -1328 1382 -1156Q1471 -985 1471 -744Q1471 -504 1382 -332Q1292 -161 1138 -70Q983 20 788 20ZM788 -219Q909 -219 1002 -280Q1096 -340 1149 -458Q1202 -575 1202 -744Q1202 -915 1149 -1032Q1096 -1150 1002 -1210Q909 -1271 788 -1271Q666 -1271 572 -1210Q478 -1149 424 -1032Q371 -914 371 -744Q371 -575 424 -458Q478 -341 572 -280Q666 -219 788 -219Z"/><path id="i6-P" d="M150 0V-1490H707Q878 -1490 995 -1426Q1112 -1362 1172 -1250Q1232 -1139 1232 -997Q1232 -854 1172 -743Q1111 -632 993 -568Q875 -504 703 -504H334V-724H668Q769 -724 834 -759Q898 -794 928 -856Q959 -918 959 -997Q959 -1076 928 -1137Q898 -1198 833 -1232Q768 -1266 666 -1266H417V0Z"/><path id="i6-R" d="M150 0V-1490H707Q878 -1490 995 -1430Q1112 -1370 1172 -1262Q1232 -1155 1232 -1013Q1232 -871 1172 -766Q1111 -661 993 -604Q875 -547 703 -547H305V-768H668Q769 -768 833 -796Q897 -825 928 -880Q959 -935 959 -1013Q959 -1093 928 -1150Q897 -1206 832 -1236Q768 -1266 666 -1266H417V0ZM988 0 626 -676H918L1287 0Z"/><path id="i6-S" d="M673 23Q500 23 372 -31Q245 -85 173 -188Q101 -291 95 -438H358Q365 -360 407 -308Q449 -256 518 -230Q587 -205 671 -205Q759 -205 826 -232Q894 -259 932 -308Q970 -356 970 -420Q970 -478 936 -516Q903 -554 842 -580Q782 -607 701 -627L532 -671Q345 -719 240 -816Q136 -913 136 -1071Q136 -1203 207 -1302Q278 -1401 401 -1456Q524 -1510 680 -1510Q839 -1510 959 -1455Q1079 -1400 1146 -1303Q1214 -1206 1217 -1082H958Q948 -1178 872 -1230Q797 -1283 676 -1283Q592 -1283 532 -1258Q471 -1232 438 -1188Q406 -1144 406 -1087Q406 -1025 444 -985Q483 -945 542 -921Q600 -897 660 -882L799 -846Q882 -826 960 -793Q1038 -760 1100 -710Q1163 -659 1200 -587Q1237 -515 1237 -418Q1237 -287 1170 -188Q1103 -88 977 -32Q851 23 673 23Z"/><path id="i6-T" d="M83 -1265V-1490H1269V-1265H810V0H543V-1265Z"/><path id="i6-V" d="M581 0 50 -1490H343L607 -716Q644 -600 687 -448Q730 -297 780 -106H724Q774 -300 816 -450Q857 -600 893 -716L1149 -1490H1441L919 0Z"/><path id="i6-W" d="M452 0 50 -1490H337L531 -697Q551 -611 568 -516Q586 -421 602 -325Q619 -229 634 -137H591Q608 -229 625 -325Q642 -421 661 -516Q680 -611 701 -697L903 -1490H1186L1387 -697Q1409 -611 1428 -516Q1446 -421 1464 -325Q1481 -229 1499 -137H1453Q1469 -229 1486 -325Q1502 -421 1520 -516Q1538 -611 1558 -697L1751 -1490H2039L1636 0H1330L1113 -823Q1083 -938 1060 -1073Q1038 -1208 1012 -1359H1076Q1048 -1213 1028 -1080Q1008 -948 975 -823L758 0Z"/><path id="i6-X" d="M53 0 657 -861V-660L96 -1490H405L586 -1218Q632 -1148 662 -1094Q692 -1040 717 -990Q742 -939 772 -880H707Q738 -939 763 -989Q788 -1039 818 -1094Q849 -1148 896 -1218L1080 -1490H1382L827 -673V-867L1421 0H1107L881 -334Q840 -397 814 -441Q787 -485 765 -526Q743 -567 714 -621H760Q732 -569 710 -528Q688 -487 661 -442Q634 -397 590 -334L360 0Z"/><path id="i6-Y" d="M600 0V-577L50 -1490H362L628 -1020Q670 -946 703 -876Q736 -806 771 -705H701Q735 -807 768 -878Q800 -949 840 -1020L1101 -1490H1411L867 -577V0Z"/><path id="i6-periodcentered" d="M326 -547Q259 -547 212 -593Q166 -639 166 -707Q166 -774 212 -820Q259 -866 326 -866Q394 -866 440 -820Q487 -774 487 -707Q487 -639 440 -593Q394 -547 326 -547Z"/><path id="i6-two" d="M134 0V-192L651 -701Q724 -776 774 -834Q823 -892 848 -946Q874 -1001 874 -1065Q874 -1135 842 -1186Q809 -1237 754 -1264Q698 -1292 627 -1292Q552 -1292 496 -1262Q441 -1232 411 -1176Q381 -1121 381 -1044H126Q126 -1185 190 -1290Q255 -1395 368 -1452Q482 -1510 630 -1510Q779 -1510 892 -1454Q1005 -1398 1068 -1300Q1131 -1203 1131 -1078Q1131 -995 1100 -916Q1069 -837 989 -738Q909 -638 763 -498L504 -234V-223H1153V0Z"/><path id="f9-g" d="M637 -98Q543 -109 494 -120Q445 -132 427 -146Q409 -160 409 -180Q409 -200 420 -212Q431 -224 441 -224L439 -230Q325 -222 257 -194Q189 -167 159 -124Q129 -81 129 -26Q129 34 162 70Q195 105 268 126Q341 147 461 164Q577 180 641 202Q705 223 730 254Q755 285 755 328Q755 377 732 407Q708 437 660 450Q613 464 541 464Q408 464 336 386Q265 308 265 178Q265 158 269 142Q273 126 277 120V110Q138 123 78 162Q17 202 17 286Q17 347 68 393Q118 439 231 464Q344 490 531 490Q777 490 910 400Q1043 310 1043 166Q1043 87 1008 35Q972 -17 884 -48Q795 -80 637 -98ZM659 -870 679 -878Q693 -925 713 -948Q733 -972 764 -972Q792 -972 812 -952Q833 -931 853 -904Q873 -877 898 -856Q923 -836 960 -836Q1022 -836 1056 -872Q1089 -909 1089 -974Q1089 -1048 1048 -1094Q1007 -1140 924 -1140Q827 -1140 766 -1072Q704 -1004 667 -894ZM987 -574Q987 -662 934 -740Q882 -818 780 -867Q679 -916 533 -916Q382 -916 272 -867Q162 -818 102 -734Q43 -651 43 -546Q43 -457 102 -382Q160 -306 268 -260Q377 -214 527 -214Q659 -214 763 -262Q867 -310 927 -392Q987 -473 987 -574ZM465 -890Q506 -896 548 -816Q590 -737 612 -582Q634 -425 616 -338Q597 -250 555 -244Q527 -240 498 -274Q469 -309 446 -380Q422 -450 407 -554Q393 -657 396 -731Q400 -805 418 -846Q436 -886 465 -890Z"/><path id="f9-h" d="M462 -1496V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-1366Q100 -1374 96 -1378Q92 -1382 83 -1382H44Q37 -1382 34 -1384Q32 -1387 32 -1391Q32 -1395 35 -1397Q38 -1399 42 -1400L421 -1505Q433 -1508 438 -1509Q442 -1510 448 -1510Q455 -1510 458 -1506Q462 -1502 462 -1496ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-i" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q531 -16 534 -14Q536 -11 536 -8Q536 -4 534 -2Q531 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM277 -977Q186 -977 129 -1035Q72 -1093 72 -1177Q72 -1261 129 -1319Q186 -1377 277 -1377Q369 -1377 428 -1319Q486 -1261 486 -1177Q486 -1093 428 -1035Q369 -977 277 -977Z"/><path id="f9-n" d="M462 -906V-64Q462 -48 468 -38Q473 -29 486 -26L524 -17Q536 -14 536 -8Q536 0 526 0H36Q32 0 29 -2Q26 -4 26 -8Q26 -11 28 -14Q31 -16 38 -17L76 -26Q90 -29 95 -38Q100 -48 100 -64V-776Q100 -784 96 -788Q92 -792 83 -792H44Q37 -792 34 -794Q32 -797 32 -801Q32 -805 35 -807Q38 -809 42 -810L421 -915Q433 -918 438 -919Q442 -920 448 -920Q455 -920 458 -916Q462 -912 462 -906ZM432 -679 418 -694 458 -729Q563 -821 646 -868Q729 -916 794 -916Q883 -916 932 -866Q982 -815 994 -702L1062 -64Q1064 -48 1068 -38Q1073 -29 1086 -26L1124 -17Q1131 -16 1134 -14Q1136 -11 1136 -8Q1136 -4 1134 -2Q1131 0 1126 0H627Q617 0 617 -8Q617 -14 629 -17L667 -26Q681 -29 687 -38Q693 -48 691 -64L638 -664Q634 -713 618 -736Q602 -758 566 -758Q541 -758 518 -746Q494 -733 470 -712Z"/><path id="f9-o" d="M532 -916Q675 -916 784 -856Q894 -796 956 -690Q1018 -583 1018 -444Q1018 -308 954 -204Q889 -99 776 -40Q663 20 516 20Q373 20 264 -39Q154 -98 92 -202Q30 -307 30 -444Q30 -580 96 -686Q161 -793 274 -854Q388 -916 532 -916ZM589 0Q625 -5 642 -56Q660 -107 659 -208Q658 -309 636 -462Q614 -615 588 -712Q561 -810 530 -854Q499 -899 462 -893Q427 -887 410 -836Q392 -785 394 -685Q396 -585 417 -432Q439 -279 465 -182Q491 -84 522 -40Q553 5 589 0Z"/><path id="f9-s" d="M432 -8Q486 -8 516 -34Q546 -61 546 -104Q546 -137 530 -164Q515 -192 476 -216Q437 -241 368 -264Q236 -309 162 -362Q88 -415 58 -480Q28 -545 28 -626Q28 -767 123 -842Q218 -916 378 -916Q441 -916 482 -904Q522 -893 544 -882Q565 -870 572 -870Q584 -870 618 -882Q652 -893 686 -904Q719 -916 730 -916Q735 -916 740 -914Q745 -911 746 -902L788 -584Q790 -574 788 -568Q787 -562 784 -560Q781 -559 778 -560Q775 -562 772 -566Q696 -692 634 -763Q573 -834 516 -863Q458 -892 394 -892Q337 -892 308 -863Q280 -834 280 -786Q280 -749 298 -718Q316 -688 362 -662Q409 -636 496 -612Q611 -579 678 -530Q746 -480 775 -418Q804 -355 804 -282Q804 -188 758 -120Q711 -53 634 -16Q557 20 464 20Q408 20 367 6Q326 -8 302 -22Q277 -36 272 -36Q264 -36 232 -24Q201 -11 168 2Q135 14 124 14Q117 14 110 8Q104 1 102 -14L68 -276Q67 -290 68 -296Q70 -301 74 -304Q76 -306 79 -304Q82 -301 86 -296Q184 -143 266 -76Q348 -8 432 -8Z"/><path id="f9-w" d="M528 0H375Q366 0 360 -4Q354 -7 351 -16L72 -840Q68 -853 62 -860Q55 -867 44 -870L6 -879Q-1 -881 -4 -883Q-6 -885 -6 -888Q-6 -893 -3 -894Q0 -896 4 -896H538Q543 -896 546 -894Q548 -893 548 -888Q548 -885 546 -883Q543 -881 536 -879L488 -870Q466 -866 461 -852Q456 -837 463 -816L629 -304L550 -92L756 -770L779 -764L550 -14Q548 -7 542 -4Q536 0 528 0ZM1132 0H979Q970 0 964 -4Q958 -7 955 -16L683 -840Q677 -859 671 -866Q665 -873 658 -874L637 -879Q630 -881 628 -883Q625 -885 625 -888Q625 -896 635 -896H1169Q1179 -896 1179 -888Q1179 -885 1176 -883Q1174 -881 1167 -879L1116 -867Q1080 -859 1073 -849Q1066 -839 1073 -816L1234 -302L1153 -92L1357 -770Q1369 -809 1356 -836Q1343 -863 1310 -870L1272 -879Q1265 -881 1262 -883Q1260 -885 1260 -888Q1260 -893 1263 -894Q1266 -896 1270 -896H1488Q1493 -896 1496 -894Q1498 -893 1498 -888Q1498 -885 1496 -883Q1493 -881 1486 -879L1463 -870Q1438 -860 1415 -832Q1392 -804 1380 -764L1154 -14Q1152 -7 1146 -4Q1140 0 1132 0Z"/><filter id="bg" x="-200%" y="-200%" width="500%" height="500%"><feGaussianBlur stdDeviation="4"/></filter><filter id="tg" x="-10%" y="-40%" width="120%" height="180%"><feGaussianBlur stdDeviation="10"/></filter></defs><rect x="4" y="4" width="1592" height="242" rx="26" fill="#6E0B16"/><rect x="30" y="30" width="1540" height="190" rx="14" fill="#B3121F"/><g class="b0"><circle cx="17" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="55" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="20" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="58" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="134" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="172" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="248" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="286" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="362" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="400" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="476" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="514" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="590" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="628" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="704" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="742" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="818" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="856" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="932" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="970" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1046" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1084" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1160" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1198" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1274" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1312" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1388" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1426" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1502" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="17" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1540" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="17" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="17" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="17" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="55" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="55" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="93" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="93" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1583" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="131" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1583" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1583" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1583" cy="207" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1578" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1578" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1540" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1540" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1502" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1502" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1464" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1464" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1426" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1426" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1388" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1388" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1350" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1350" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1312" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1312" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1274" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1274" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1236" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1236" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1198" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1198" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1160" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1160" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1122" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1122" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="1084" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1084" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="1046" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1046" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="1008" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="1008" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="970" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="970" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="932" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="932" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="894" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="894" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="856" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="856" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="818" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="818" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="780" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="780" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="742" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="742" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="704" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="704" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="666" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="666" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="628" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="628" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="590" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="590" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="552" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="552" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="514" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="514" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="476" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="476" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="438" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="438" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="400" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="400" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="362" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="362" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="324" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="324" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="286" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="286" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="248" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="248" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="210" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="210" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="172" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="172" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="134" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="134" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="96" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="96" cy="233" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="58" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="58" cy="233" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="20" cy="233" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="20" cy="233" r="5" fill="#FFF1C7"/></g><g class="b1"><circle cx="17" cy="207" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="207" r="5" fill="#FFF1C7"/></g><g class="b2"><circle cx="17" cy="169" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="169" r="5" fill="#FFF1C7"/></g><g class="b0"><circle cx="17" cy="131" r="8" fill="#E9B949" opacity=".7" filter="url(#bg)"/><circle cx="17" cy="131" r="5" fill="#FFF1C7"/></g><g class="sign"><g transform="translate(550.1 142.0) scale(0.04600)" fill="#E9B949" opacity=".45" filter="url(#tg)"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(550.1 142.0) scale(0.04600)" fill="#F5EBDC"><use href="#f9-n" x="0"/><use href="#f9-o" x="1104"/><use href="#f9-w" x="2082"/><use href="#f9-s" x="3821"/><use href="#f9-h" x="4643"/><use href="#f9-o" x="5742"/><use href="#f9-w" x="6720"/><use href="#f9-i" x="8179"/><use href="#f9-n" x="8711"/><use href="#f9-g" x="9815"/></g><g transform="translate(429.8 192.0) scale(0.00977)" fill="#FFE3A0"><use href="#i6-two" x="0"/><use href="#i6-two" x="1645"/><use href="#i6-E" x="4174"/><use href="#i6-X" x="5783"/><use href="#i6-A" x="7625"/><use href="#i6-M" x="9484"/><use href="#i6-P" x="11741"/><use href="#i6-L" x="13431"/><use href="#i6-E" x="14958"/><use href="#i6-S" x="16566"/><use href="#i6-periodcentered" x="20036"/><use href="#i6-E" x="22827"/><use href="#i6-V" x="24436"/><use href="#i6-E" x="26295"/><use href="#i6-R" x="27903"/><use href="#i6-Y" x="29552"/><use href="#i6-F" x="32266"/><use href="#i6-R" x="33839"/><use href="#i6-A" x="35543"/><use href="#i6-M" x="37402"/><use href="#i6-E" x="39660"/><use href="#i6-R" x="42153"/><use href="#i6-E" x="43858"/><use href="#i6-N" x="45466"/><use href="#i6-D" x="47390"/><use href="#i6-E" x="49237"/><use href="#i6-R" x="50846"/><use href="#i6-E" x="52551"/><use href="#i6-D" x="54159"/><use href="#i6-B" x="56892"/><use href="#i6-Y" x="58610"/><use href="#i6-S" x="61325"/><use href="#i6-H" x="63025"/><use href="#i6-O" x="64921"/><use href="#i6-W" x="66831"/><use href="#i6-T" x="69288"/><use href="#i6-I" x="71009"/><use href="#i6-M" x="71944"/><use href="#i6-E" x="74202"/></g></g></svg>
\ No newline at end of file
diff --git a/assets/readme/whats-new/live-figure.webp b/assets/readme/whats-new/live-figure.webp
new file mode 100644
index 0000000..7ac56de
Binary files /dev/null and b/assets/readme/whats-new/live-figure.webp differ
diff --git a/docs/README.md b/docs/README.md
index 010e568..e59d8b6 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -54,7 +54,7 @@ Written for people rather than for your agent:
<p align="center"><picture>
<source media="(prefers-color-scheme: dark)" srcset="../assets/readme/diagrams/docs-map-dark.svg">
- <img alt="The documentation map: fourteen workflows, then five acts and a finale of guides, from onboarding to qa and review." src="../assets/readme/diagrams/docs-map-light.svg" width="100%">
+ <img alt="The documentation map: seventeen workflows, then five acts and a finale of guides, from onboarding to qa and review." src="../assets/readme/diagrams/docs-map-light.svg" width="100%">
</picture></p>
## Choose your path
@@ -87,6 +87,11 @@ What are you making? Each card opens the workflow guide your agent follows; the
<td width="33%" valign="top"><a href="../skills/showtime/references/workflows/repo-explainer.md"><picture><source media="(prefers-color-scheme: dark)" srcset="../assets/readme/icons/html-dark.svg"><img src="../assets/readme/icons/html-light.svg" width="56" alt=""></picture></a><br><sub>A codebase explained, traced through real code</sub><br><b><a href="../skills/showtime/references/workflows/repo-explainer.md">repo-explainer</a></b><br><sub>see it done: no example yet</sub></td>
<td width="33%" valign="top"><a href="../skills/showtime/references/workflows/paper-explainer.md"><picture><source media="(prefers-color-scheme: dark)" srcset="../assets/readme/icons/manim-dark.svg"><img src="../assets/readme/icons/manim-light.svg" width="56" alt=""></picture></a><br><sub>A paper or technical PDF explained</sub><br><b><a href="../skills/showtime/references/workflows/paper-explainer.md">paper-explainer</a></b><br><sub>see it done: no example yet</sub></td>
</tr>
+<tr>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_diagram"><img src="../assets/readme/gallery/_diagram.webp" width="100%" alt="A preview of the living diagram demo"></a><br><sub>How a system works, as a figure that builds itself or one people poke</sub><br><b><a href="../skills/showtime/references/workflows/diagram.md">diagram</a></b><br><sub>see it done: <a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_diagram">the demo</a> · a live figure: <code>export html --interactive</code></sub></td>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap"><img src="../assets/readme/gallery/_recap.webp" width="100%" alt="A preview of the recap demo"></a><br><sub>What your coding agent did in a session</sub><br><b><a href="../skills/showtime/references/workflows/recap.md">recap</a></b><br><sub>see it done: <a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap">the demo</a></sub></td>
+<td width="33%" valign="top"><a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro"><img src="../assets/readme/gallery/_repro.webp" width="100%" alt="A preview of the repro demo"></a><br><sub>A failing browser test, for a bug report</sub><br><b><a href="../skills/showtime/references/workflows/repro.md">repro</a></b><br><sub>see it done: <a href="https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro">the demo</a></sub></td>
+</tr>
</table>
## Act I · Before the curtain
@@ -131,7 +136,7 @@ What are you making? Each card opens the workflow guide your agent follows; the
| [film-api](../skills/showtime/references/film-api.md) | drawing a canvas film or tutorial with `Film` |
| [series](../skills/showtime/references/series.md) | several episodes that share one look, sound and pacing |
| [manim](../skills/showtime/references/manim.md) | equations, proofs, graphs and grid transforms with Manim |
-| [html-export](../skills/showtime/references/html-export.md) | a single-file interactive HTML video: player, chapters, keys, deep links, range links that loop a part, questions that pause and ask the viewer; link previews and GitHub Pages (`--share-url`, `--folder`) |
+| [html-export](../skills/showtime/references/html-export.md) | a single-file interactive HTML video: player, chapters, keys, deep links, range links that loop a part, questions that pause and ask the viewer; link previews and GitHub Pages (`--share-url`, `--folder`); a living diagram as a live figure (`--interactive`) |
| [debugging-renders](../skills/showtime/references/debugging-renders.md) | a render fails, flickers, shows black or frozen frames, or differs from the preview |
## Act IV · Sound and voice
diff --git a/docs/agents.md b/docs/agents.md
index c456395..e3e0693 100644
--- a/docs/agents.md
+++ b/docs/agents.md
@@ -317,7 +317,7 @@ Any client that starts local (stdio) servers can use showtime's MCP server on it
([@faviovazquez/showtime-mcp](https://www.npmjs.com/package/@faviovazquez/showtime-mcp), also in the MCP Registry as
`io.github.FavioVazquez/showtime`),
`{"command": "npx", "args": ["-y", "@faviovazquez/showtime-mcp"]}` (see
-[`packages/npm/README.md`](../packages/npm/README.md)), and [`showtime-0.4.2.mcpb`](https://github.com/FavioVazquez/showtime/releases/download/v0.4.2/showtime-0.4.2.mcpb) from the v0.4.2 release, which
+[`packages/npm/README.md`](../packages/npm/README.md)), and [`showtime-0.4.3.mcpb`](https://github.com/FavioVazquez/showtime/releases/download/v0.4.3/showtime-0.4.3.mcpb) from the v0.4.3 release, which
Claude Desktop opens with a double click. Setup still runs once on your machine, because the models and tools
never travel inside a package. Long tools answer with a task id after about
20 s when a client stops calls early; the `status` tool reports progress and the result.
diff --git a/docs/examples/showtime-release-video.yml b/docs/examples/showtime-release-video.yml
index a223548..ef5c782 100644
--- a/docs/examples/showtime-release-video.yml
+++ b/docs/examples/showtime-release-video.yml
@@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v7
- id: video
- uses: FavioVazquez/showtime/.github/actions/[email protected]
+ uses: FavioVazquez/showtime/.github/actions/[email protected]
with:
mode: release
# a published release: its tag, name and description come from the event; by hand: these
@@ -69,7 +69,7 @@ jobs:
# runs-on: ubuntu-24.04
# timeout-minutes: 30
# steps:
-# - uses: FavioVazquez/showtime/.github/actions/[email protected]
+# - uses: FavioVazquez/showtime/.github/actions/[email protected]
# with:
# upload: artifact
#
@@ -78,7 +78,7 @@ jobs:
# showtime.json), rendered on every push to main that changes it:
#
# - uses: actions/checkout@v7
-# - uses: FavioVazquez/showtime/.github/actions/[email protected]
+# - uses: FavioVazquez/showtime/.github/actions/[email protected]
# with:
# mode: project
# project: videos/launch
@@ -91,7 +91,7 @@ jobs:
#
# - uses: actions/checkout@v7
# - run: npm install -g @your-agent/cli
-# - uses: FavioVazquez/showtime/.github/actions/[email protected]
+# - uses: FavioVazquez/showtime/.github/actions/[email protected]
# env:
# YOUR_AGENT_API_KEY: ${{ secrets.YOUR_AGENT_API_KEY }}
# with:
diff --git a/docs/github-action.md b/docs/github-action.md
index 1448174..7de158c 100644
--- a/docs/github-action.md
+++ b/docs/github-action.md
@@ -5,7 +5,7 @@ and no agent. It installs showtime on the runner, turns the notes into a project
`showtime qa` on the finished file, exports a single-file HTML video, and uploads the result.
```yaml
-- uses: FavioVazquez/showtime/.github/actions/[email protected]
+- uses: FavioVazquez/showtime/.github/actions/[email protected]
```
The complete workflow to copy is [`examples/showtime-release-video.yml`](examples/showtime-release-video.yml).
diff --git a/docs/glossary.md b/docs/glossary.md
index b1dd430..4b573b0 100644
--- a/docs/glossary.md
+++ b/docs/glossary.md
@@ -122,6 +122,18 @@ the stage, what was verified and what was only assumed, the open questions and t
writes it at every stage; `showtime status`, qa and a resumed session read it. An agent that opens the folder later
starts there.
+## live figure
+
+A [living diagram](#living-diagram) as one offline page people poke instead of watch: no player, the board is live
+from the first frame. Hover a part, pick a step, turn a knob, and the numbers under it answer. `showtime export html
+<project> --interactive` makes one. See [html-export § Live figure](../skills/showtime/references/html-export.md#live-figure).
+
+## living diagram
+
+A system explained over time as an isometric figure: parts arrive in the order that explains them, flows and
+labels move through them, the camera chooses what to look at. `showtime new diagram` starts one. See
+[diagram](../skills/showtime/references/workflows/diagram.md).
+
## look
`showtime look <project|video|job>` makes one small composite image (1280 px) of a video's key frames, and a brief
diff --git a/docs/guides/README.md b/docs/guides/README.md
index 19a49e5..b5b0505 100644
--- a/docs/guides/README.md
+++ b/docs/guides/README.md
@@ -13,6 +13,9 @@ look at. The references in `skills/showtime/references/` are written for your ag
| [Make a launch video from your repo](launch-video-from-repo.md) | a launch or promo in your product's own colours, type, words and screens |
| [Make a video in another language](localised-video.md) | the same video re-voiced, re-timed and captioned in Spanish, French or another language |
| [Make a video of a pull request](pr-video.md) | a short video for a PR's description in one command, and the GitHub Action |
+| [Make a short film of what your agent did](session-recap.md) | a 30-60 s recap of a Claude Code session for a PR, a standup or a post, from allow-listed facts only |
+| [Turn a failing test into a bug-report video](bug-report-video.md) | a failing Playwright test as a narrated video and a summary to paste into the issue |
+| [Make a living diagram, and a live figure](living-diagram.md) | how something works, as a figure that builds itself, and a live figure people hover, step through and tune |
| [Make an explainer that stops and asks](explainer-that-asks.md) | questions the web version stops on, links to a moment or a stretch, link previews |
| [Go all out: a showreel](go-all-out.md) | a hype reel with flash words, a shutter blur on snaps, and WebGL looks |
| [Leave notes on a video and get them fixed](notes-and-fixes.md) | point at a frame or a stretch, get each note fixed and answered, the critic's findings |
diff --git a/docs/guides/bug-report-video.md b/docs/guides/bug-report-video.md
new file mode 100644
index 0000000..0113691
--- /dev/null
+++ b/docs/guides/bug-report-video.md
@@ -0,0 +1,74 @@
+# Turn a failing test into a bug-report video
+
+A browser test failed and you want the issue to show it: what the test did, step by step, and where it broke.
+`showtime repro` turns the test's Playwright trace into a short narrated video, plus a Markdown summary to paste
+into the issue. Typed values are never shown.
+
+## Say this
+
+> "Make a video of this failing Playwright test for the bug report."
+
+Or run it yourself:
+
+```bash
+# from a trace: writes script.md and stops
+showtime repro test-results/login-signs-in/trace.zip
+# or run the test and film its failing trace
+showtime repro -- npx playwright test tests/login.spec.ts
+# after you read script.md: renders it
+showtime repro --yes showtime-out/repro-<timestamp>
+```
+
+## What happens
+
+1. With a trace, it reads it. With a command after `--`, it runs the test with `--trace retain-on-failure` added
+ (or `--tracing retain-on-failure` for `pytest`), in a temporary output folder, and takes the failing trace.
+2. It writes `script.md` (every caption, spoken line and on-screen text), `report.json` and the trace's
+ screenshots into the job folder, and stops.
+3. You read `script.md` and change or delete lines.
+4. The same command with `--yes` (or `showtime repro --yes <job>`) filters every line again, narrates with a local
+ voice, renders `repro.mp4`, runs `showtime qa`, and writes `repro.md`.
+
+## What you get
+
+- `repro.mp4` (16:9, 1080p): a title card (the test, its file and line, FAILED), one scene per step on the trace's
+ screenshots with a cursor and the target boxed, then the failing step slowed down with the source line, expected
+ and received, the error and the page's console errors, and an end card with the re-run command.
+- `repro.md`: the steps, the failure, the console errors and the re-run commands, with a line to drag the video onto
+ in a GitHub issue or pull request.
+- `repro.srt`, `repro.poster.jpg`, `steps.json` (the parsed timeline) and `project/`.
+
+## What it hides
+
+- Values typed into fields are never shown or spoken: their fields are covered on the screenshots, and the
+ captions say how many characters went in.
+- Paths on your machine are shortened to the file name and URLs lose their query strings; auth headers,
+ `NAME=value` secrets and e-mail addresses are masked in every line; `--redact <regex>` masks more (account ids, customer names, internal hostnames).
+- Screenshots are otherwise shown as they were captured. Run the test with a test account, and watch the film
+ before you post it.
+
+## How long it takes
+
+Tried for this guide on the test trace in `skills/showtime/tests/fixtures/repro/` (six steps, failing at the
+last), on a 6-core Intel Mac: the `--yes` call took 2 min 30 s for a 34 s film.
+
+## Phrases that change it
+
+- "No voice" sets `--no-voice` (captions only); "another voice" sets `--voice <name>`.
+- "Smaller" sets `--size 720p`; "a quick draft" sets `--yes --preview`.
+- "A swoosh on the cuts" sets `--cut-sounds` (off by default; the click on a click and the failure tone stay).
+- "No music" sets `--music none`. By default the bed is picked per test from showtime's music catalog (downloaded
+ once from its creator's site; nothing is sent, and its credit goes into `repro.md`); a style or
+ `SHOWTIME_OFFLINE=1` keeps it fully local.
+
+## Limits
+
+- It films a Playwright trace. A runner it does not recognize runs as it is: pass its trace instead.
+- A trace from the library alone (pytest) has no step titles or file and line, but still every action, its target,
+ screenshots and the error.
+- It shows what the trace holds. It does not find the cause of the bug.
+
+## The example
+
+[The repro demo](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_repro) is the fixture test "signs in and greets the user" as a 34 s film, with its
+`repro.md` and `script.md`. Your agent's guide: [repro.md](../../skills/showtime/references/workflows/repro.md).
diff --git a/docs/guides/living-diagram.md b/docs/guides/living-diagram.md
new file mode 100644
index 0000000..bd7ac32
--- /dev/null
+++ b/docs/guides/living-diagram.md
@@ -0,0 +1,59 @@
+# Make a living diagram, and a live figure
+
+Some things are easier to see than to read: a heat pump, a market, a coding agent's loop. A living diagram draws
+the system as an isometric figure and explains it over time: parts arrive in the order that explains them, pipes
+and links join them, flows and packets move through them, labels land when their part matters, and the camera
+chooses what to look at. The same scene also exports as a live figure: one offline page people hover, step
+through and tune.
+
+## Say this
+
+> "Make a 25-second diagram of how a heat pump moves heat, light theme, with a voice."
+
+> "Now make it a live figure I can put on our docs page."
+
+## What happens
+
+1. `showtime new diagram <job>/project` starts from a working heat-pump scene. `--example enter` (a coding agent's
+ loop), `--example market` (a matching market) or `--example econ-lab` (households, firms and a central bank)
+ start from the other finished scenes; `--theme dark` or `--theme white` changes the look.
+2. Your agent writes the system into `scene.js`: the parts and their ports, the pipes and links, what flows, the
+ labels, the camera, and a table of beat times, so `showtime retime` can move them later.
+3. `showtime check` reports a label that collides with another or never shows whole, and text too small for a phone.
+4. For a narrated film, the beats land on the voice's words; `showtime render` makes the video.
+5. For the live figure, the scene declares what is live (steps, knobs, readouts, the parts to hover) and
+ `showtime export html <project> --interactive` writes `<slug>-figure.html`. `showtime check` walks every step,
+ each knob value and each hovered part of it first.
+
+## What you get
+
+- A film: a 16:9 video at 1920x1080, 15-25 s by default.
+- A live figure: one HTML file that opens offline and makes no network requests. No play button: the board is
+ live from the first frame. Hover a part to light it and read what it is, pick a step to run it on the board,
+ turn a knob and the numbers answer; untouched, a short tour plays. Keys, links to a state
+ (`#step=cost&rule=3`), reduced motion and a phone layout come with it. `--target artifact` makes a version for an
+ HTML artifact.
+
+## How long it takes
+
+Tried for this guide on `--example enter` as it ships (27 s, a composed bed, no voice), on a 6-core Intel Mac:
+`showtime check` took 28 s and the 720p render 47 s of capture (3 workers). The live figure is a separate,
+short export of the same project; its time was not measured.
+
+## Phrases that change it
+
+- "Dark" or "a night schematic" sets `--theme dark`; "plain white" sets `--theme white`.
+- "Longer" or "30 seconds" sets `--duration`; the beats scale with it.
+- "Let people change X" adds a knob to the live figure; "show the numbers" adds readouts under it.
+
+## Limits
+
+- Pick 4-8 parts; more crowds a 1920x1080 frame.
+- Every on-screen claim needs a source, or the figure says "Illustrative sample".
+- The live figure carries every word and number of the scene, so sharing the file shares all of that.
+
+## The example
+
+[The living diagram demo](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_diagram) is the Enter loop as a film and two live figures; one of them
+is live on [its page on the site](https://faviovazquez.github.io/showtime/examples/_diagram.html). Your agent's
+guide: [diagram.md](../../skills/showtime/references/workflows/diagram.md).
diff --git a/docs/guides/session-recap.md b/docs/guides/session-recap.md
new file mode 100644
index 0000000..6ccdc7d
--- /dev/null
+++ b/docs/guides/session-recap.md
@@ -0,0 +1,78 @@
+# Make a short film of what your agent did
+
+Your coding agent worked for an hour: it read files, edited some, ran the tests until they passed, and committed.
+A 30-60 s film of that is quicker to share than the log, in a pull request description, a standup or a post about
+what your agent did overnight. `showtime recap` makes one from the session log on your machine, without reading
+the conversation's text into the film.
+
+## Say this
+
+> "Make a recap video of this session."
+
+Or run it yourself, in the folder the session worked in:
+
+```bash
+showtime recap --latest # writes script.md and stops
+showtime recap --latest --yes # after you read script.md: renders it
+```
+
+`--latest` is this folder's newest Claude Code session; inside Claude Code that is the session you are in. A
+`.jsonl` path or a session id works too.
+
+## What happens
+
+1. It reads one transcript (`~/.claude/projects/<project>/<session>.jsonl`) through an allow-list: times, turn and
+ tool counts, paths of files inside the repository, program names from a fixed list (`git`, `npm`, `pytest` and
+ the like; anything else counts as "other"), test counts read from the end of each test run, and the commits the
+ session made, with their diff stats from git.
+2. It writes `script.md` (every line that will be shown or spoken) and `facts.json`, prints a one-line summary
+ such as `17 min, 14 turns, 12 tool calls, 1 repo file, 1 edited, 3 test runs (red to green)`, and stops. Even
+ with `--yes`, a call that writes `script.md` never renders.
+3. You read `script.md`. Change a line or delete it; the request you typed is there only as a commented `# show`
+ suggestion, and reaches the film only if you uncomment it.
+4. The same command with `--yes` checks every line again, narrates with a local voice, renders `recap.mp4`, and
+ runs `showtime qa`.
+
+Assistant text, tool output, memory, absolute paths, URLs and the environment are never on the list. A hard filter
+also drops any line that still looks like a key, a path, a URL, a host or an e-mail address, in the lines you
+write too. It is there to keep private text that slips in by accident out of the film; it does not stop you from
+disguising your own text on purpose, which is why nothing renders until you have read `script.md`.
+
+## What you get
+
+- `recap.mp4`: 16:9 at 1920x1080 (or `--aspect 9:16`), narrated and captioned, in a light paper look: the title
+ from the facts ("42 min · 6 files edited · red to green"), the numbers, a minute-by-minute timeline, where the
+ edits landed, the tests red to green, the diff and an end card.
+- `script.md` and `facts.json`: what the film was made from.
+- `recap.credits.txt` when the music needs a credit, and a `project/` you can edit and render again.
+
+Files go to `showtime-out/recap-<session>` unless you pass `--out`, which is refused where git would track it.
+
+## How long it takes
+
+Tried for this guide on the test session in `skills/showtime/tests/fixtures/recap/` (17 minutes of work, pointed
+at a small temporary repository), on a 6-core Intel Mac: the `--yes` call took 1 min 36 s for a 37 s film, 1 min
+06 s of it the render.
+
+## Phrases that change it
+
+- "Vertical" sets `--aspect 9:16`.
+- "No voice" sets `--no-voice` (no narration and no captions; each scene holds long enough to read).
+- "A quick draft" sets `--preview`.
+- "The whole branch, not just this session's commits" sets `--since <ref>` for the diff.
+- "Quiet ambient music" or "no music" sets `--music ambient-pad` or `--music none`. By default the bed is picked per session from
+ showtime's music catalog (downloaded once from its creator's site; nothing is sent), so two recaps do not sound
+ the same, and a rerun keeps its bed. `SHOWTIME_OFFLINE=1` keeps it fully local.
+
+## Limits
+
+- One transcript per film: a session's recap does not include its sub-agents' transcripts; recap those separately.
+- Commits made with `git commit -q` print no hash, so they are not counted; `--since <ref>` gives the change instead.
+- Tests run in the background or with their output cut show as grey dots, uncounted.
+- Filters can miss things. Read `script.md`, and watch the film before you post it.
+
+## The example
+
+[The recap demo](https://github.com/FavioVazquez/showtime-examples/tree/main/examples/_recap) is the test session as a 37 s film, with its `script.md`, its
+`facts.json` and a list of what reached the film and what did not. Your agent's guide:
+[recap.md](../../skills/showtime/references/workflows/recap.md).
diff --git a/docs/whats-new.md b/docs/whats-new.md
index ab071dc..1a5cd30 100644
--- a/docs/whats-new.md
+++ b/docs/whats-new.md
@@ -3,6 +3,59 @@
What each release changes for you, newest first, one sentence a feature. The
[changelog](../CHANGELOG.md) has every change and the reason for it.
+## 0.4.3
+
+### Living diagrams: a system that explains itself
+
+![The Enter loop at work: your machine with the terminal, Claude Code, Bash and a permission check, a request flying up to a glass cube labelled cloud.](../assets/readme/gallery/_diagram.webp)
+
+`showtime new diagram` draws how something works as an isometric figure that builds over time: parts arrive in the
+order that explains them, flows, packets and state changes move through them, labels land when their part matters,
+and the camera chooses what to look at, in a light, dark or white theme. `--example enter` (a coding agent's loop),
+`--example market` and `--example econ-lab` start from finished scenes
+([guide](guides/living-diagram.md), [diagram](../skills/showtime/references/workflows/diagram.md), [the demo](https://github.com/FavioVazquez/showtime-examples/blob/main/examples/_diagram/README.md)).
+
+### Live figures people poke
+
+![The economics live figure: households, firms and a central bank on a board; the cost-shock step runs, the rule's strength turns from 1.5 to 3, and the readouts change from inflation +1.28 to +0.84.](../assets/readme/whats-new/live-figure.webp)
+
+`showtime export html <project> --interactive` writes the same scene as one offline page with no player: hover a part
+to light it and read its value, pick a step to run it on the board, turn a knob and the numbers answer at once.
+Keys, deep links to a state, reduced motion and a phone layout come with it, and `showtime check` walks every state
+before you share it ([html-export § Live figure](../skills/showtime/references/html-export.md#live-figure),
+[try one](https://faviovazquez.github.io/showtime/examples/_diagram.html)).
+
+### A recap of your agent's session
+
+![Red to green, from a Claude Code session: one red test run, then two green ones, and 12/12 test files passed.](../assets/readme/gallery/_recap.webp)
+
+`showtime recap --latest` turns a Claude Code session into a 30-60 s narrated film of what the agent did, made from
+the session log on your machine through an allow-list of facts (repository-relative paths, program names, test
+counts, git stats), never the transcript's own text; nothing renders until you have read `script.md`
+([guide](guides/session-recap.md), [recap](../skills/showtime/references/workflows/recap.md), [the demo](https://github.com/FavioVazquez/showtime-examples/blob/main/examples/_recap/README.md)).
+
+### A failing test as a bug-report video
+
+![A failing Playwright step: the page says Welcome back, Ada; expected "Welcome, Ada!", received "Welcome back, Ada", and the console error.](../assets/readme/gallery/_repro.webp)
+
+`showtime repro` turns a failing Playwright test into a narrated video of its steps and the failure, slowed down,
+with `repro.md` to paste into the issue; typed values are never shown or spoken
+([guide](guides/bug-report-video.md), [repro](../skills/showtime/references/workflows/repro.md), [the demo](https://github.com/FavioVazquez/showtime-examples/blob/main/examples/_repro/README.md)).
+
+### Steadier renders and quieter sound
+
+Every render worker now captures from a page set up like the first one, so a busy machine no longer ships bare
+frames from a worker whose page opened short ([render](../skills/showtime/references/render.md)). Recap and repro
+pick their music per session or test (a rerun keeps it, `--music` pins it; a catalog track is downloaded once from its
+creator's site, nothing is sent, and `SHOWTIME_OFFLINE=1` keeps it all local), and generated videos no longer put a
+sound on every cut (`--cut-sounds` adds a soft swoosh back); the transition sounds are softer everywhere.
+
+### How showtime is built
+
+A new page on the site, [how showtime is built](https://faviovazquez.github.io/showtime/harness/), is the crew's
+operating manual: who does what, and how a task becomes a merged pull request or a film. The site and the repository
+now share one link-preview image.
+
## 0.4.2
### Render a film in chapters, with one soundtrack
diff --git a/gemini-extension.json b/gemini-extension.json
index ca03335..7b8ac08 100644
--- a/gemini-extension.json
+++ b/gemini-extension.json
@@ -1,6 +1,6 @@
{
"name": "showtime",
- "version": "0.4.2",
+ "version": "0.4.3",
"description": "A local video studio for your coding agent. Describe a video. Your agent directs. Your machine renders. Motion graphics, voice-over, music, footage editing, captions and platform-ready exports, with no cloud AI services or API keys.",
"mcpServers": {
"showtime": {
diff --git a/packages/npm/package.json b/packages/npm/package.json
index 96e4d07..3d20edb 100644
--- a/packages/npm/package.json
+++ b/packages/npm/package.json
@@ -1,6 +1,6 @@
{
"name": "@faviovazquez/showtime-mcp",
- "version": "0.4.2",
+ "version": "0.4.3",
"mcpName": "io.github.FavioVazquez/showtime",
"description": "A local video studio for your coding agent: showtime's MCP server and command line. Describe a video. Your agent directs. Your machine renders.",
"license": "MIT",
diff --git a/plugin.json b/plugin.json
index 8e91bfe..aa5d000 100644
--- a/plugin.json
+++ b/plugin.json
@@ -1,7 +1,7 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "showtime",
- "version": "0.4.2",
+ "version": "0.4.3",
"description": "A local video studio for your coding agent. Describe a video. Your agent directs. Your machine renders. Motion graphics, voice-over, music, footage editing, captions and platform-ready exports, with no cloud AI services or API keys.",
"author": {
"name": "Favio Vazquez",
diff --git a/server.json b/server.json
index fa346b4..f3f5071 100644
--- a/server.json
+++ b/server.json
@@ -3,7 +3,7 @@
"name": "io.github.FavioVazquez/showtime",
"title": "showtime",
"description": "Local video studio for your coding agent: scenes, voice, music and captions, on your machine.",
- "version": "0.4.2",
+ "version": "0.4.3",
"websiteUrl": "https://faviovazquez.github.io/showtime/",
"repository": {
"url": "https://github.com/FavioVazquez/showtime",
@@ -26,7 +26,7 @@
"registryType": "npm",
"registryBaseUrl": "https://registry.npmjs.org",
"identifier": "@faviovazquez/showtime-mcp",
- "version": "0.4.2",
+ "version": "0.4.3",
"runtimeHint": "npx",
"transport": {
"type": "stdio"
diff --git a/site/build.py b/site/build.py
index 860c4e1..686da96 100644
--- a/site/build.py
+++ b/site/build.py
@@ -583,7 +583,7 @@ def shell(site: Site, page: str, title: str, body: str, active: str = "", desc:
<footer class="site"><div class="wrap">
<span><span class="word">showtime</span>&nbsp; {version}, MIT licensed. A local video studio for your coding agent.</span>
<nav aria-label="Footer"><a href="{gallery}">Examples</a><a href="{crew}">Crew</a><a href="{docs}">Docs</a><a href="{harness}">How it\u2019s built</a>{exrepo}</nav>
-<span>No trackers, no cookies. Fonts are served from this site. Film music by Scott Buckley, CC BY 4.0: \u201cSupernova\u201d (the showreel), {launch_music}\u201cArtemis\u201d (the crew film).</span>
+<span>No trackers, no cookies. Fonts are served from this site. Film music by Scott Buckley, CC BY 4.0: \u201cSupernova\u201d (the showreel), \u201cArtemis\u201d (the crew film), \u201cWith These Hands\u201d ({hands}).</span>
</div></footer>
<script src="{js}"></script>
</body>
@@ -595,7 +595,7 @@ def shell(site: Site, page: str, title: str, body: str, active: str = "", desc:
version=esc(VERSION), docs=r("docs/index.html"), gallery=r("gallery.html"), crew=r("crew.html"),
harness=r(HARNESS_PAGE), og_w=og_size[0], og_h=og_size[1], head=("\n" + head) if head else "",
js=r("static/app.js"), font=r("static/fonts/inter.woff2"),
- launch_music="\u201cWith These Hands\u201d (the launch film), " if CONFIG.get("gallery_film") else "",
+ hands="the launch film and the recap demo" if CONFIG.get("gallery_film") else "the recap demo",
exrepo=('<a href="https://github.com/%s">%s</a>' % (esc(EXAMPLES_REPO), esc(EXAMPLES_REPO.split("/")[-1]))) if EXAMPLES_REPO else "")
@@ -647,7 +647,9 @@ def parse_examples() -> Tuple[List[Tuple[str, str]], List[dict]]:
prompt = html.unescape(re.search(r"<i>“(.*?)”</i>", block, re.S).group(1))
what = html.unescape(re.search(r"WHAT IT SHOWS</sub><br>(.*?)</p>", block, re.S).group(1))
line = re.search(r"<p>▶ (.*?)<br>", block, re.S).group(1)
- watch_part, _, html_part = line.partition("HTML video:")
+ # after "HTML video:" (or "Live figures:", a diagram's --interactive exports) come the HTML files
+ split = re.search(r"HTML video:|Live figures?:", line)
+ watch_part, html_part = (line[:split.start()], line[split.end():]) if split else (line, "")
watch = re.findall(r'href="([^"]+)"', watch_part)
hv = re.findall(r'href="([^"]+)"', html_part)
tags = [cur]
@@ -735,7 +737,7 @@ def card(site: Site, page: str, e: dict, show_what: bool = True, name: str = "",
for h in e["html"]:
hl, _ = site.media(ex_path(h), folder)
if hl:
- links.append('<a href="%s">HTML video</a>' % rel(page, hl))
+ links.append('<a href="%s">%s</a>' % (rel(page, hl), "Live figure" if h.endswith("-figure.html") else "HTML video"))
break
badge = '<span class="badge">%s</span>' % esc(NEW_NAME) if e["num"] in NEW_IDS else ""
return ('<article class="film" data-tags="%s" data-ex="%s"><div class="frame"%s><img class="still" src="%s" alt="%s" loading="lazy" decoding="async">%s%s</div>'
@@ -828,7 +830,7 @@ def build_gallery(site: Site, exs) -> None:
for e in exs:
for h in e["html"]:
hl, _ = site.media(ex_path(h), e["folder"])
- if hl:
+ if hl and not h.endswith("-figure.html"): # a live figure is no video: its card and page link it
htmls.append('<li><a href="%s">%s</a><span>%s</span></li>' % (rel(page, hl), esc(e["title"]), esc(h.split("/")[-1])))
if e["num"] == "02" and not live:
live = ('<div class="htmlvid"><iframe src="%s" title="HTML video: %s" loading="lazy" allow="fullscreen"></iframe></div>'
@@ -905,10 +907,19 @@ def build_example_pages(site: Site, exs) -> None:
% (esc(fb), still, esc(e["alt"]), ICON_PLAY, esc(name)))
else:
players.append('<p class="note"><code>%s</code> is a release asset and is not included in this build.</p>' % esc(name))
- embeds = []
+ embeds, wide = [], [] # wide: a live figure, as wide as the page so it keeps its desktop layout (820 px and up)
for h in e["html"]:
hl, hfb = site.media(ex_path(h), folder)
name = h.split("/")[-1]
+ if hl and name.endswith("-figure.html"):
+ # a live figure (export html --interactive): no player, a board people hover, step through and tune
+ wide.append('<section class="figure-room"><div class="prose" style="max-width:var(--read);margin:0 auto"><h2 id="live-figure" style="margin-top:0">The live figure</h2><p><code>%s</code> is one offline file, '
+ 'live right here: hover or tab to a part, pick a step, turn a knob. Arrow keys and 1-9 move between '
+ 'the steps, <kbd>R</kbd> runs one again and <kbd>L</kbd> copies a link to what you see. '
+ '<a href="%s">Open it on its own</a>.</p></div>'
+ '<div class="htmlvid figure"><iframe src="%s" title="Live figure: %s" loading="lazy"></iframe></div></section>'
+ % (esc(name), rel(page, hl), rel(page, hl), esc(e["title"])))
+ break
if hl:
folder_export = name == "index.html" and (src_path(ex_path(h)).parent / "assets" / "vfs.js").is_file()
what = ("<code>%s/</code> is the folder export (<code>index.html</code> and <code>assets/</code>)" % esc(h.split("/")[-2])
@@ -925,10 +936,11 @@ def build_example_pages(site: Site, exs) -> None:
more = ""
if site.repo:
more = '<p class="edit"><a href="%s">The project files on GitHub</a></p>' % esc(site.gh("examples/" + folder, True))
- body = head + '<div class="wrap"><article class="prose" style="max-width:var(--read);margin:64px auto 120px">%s%s%s%s</article></div>' % (
- "".join(embeds), body_html, more, pager_html(page, (seq[n - 1], seq[n + 1])))
+ body = head + ('<div class="wrap">%s</div>' % "".join(wide) if wide else "") + (
+ '<div class="wrap"><article class="prose" style="max-width:var(--read);margin:64px auto 120px">%s%s%s%s</article></div>' % (
+ "".join(embeds), body_html, more, pager_html(page, (seq[n - 1], seq[n + 1]))))
write(site, page, shell(site, page, example_name(e), body, "gallery", what_sentence(e)))
- site.h2_expect[page] = ("examples/%s/README.md" % folder, md_h2_count(text) + len(embeds))
+ site.h2_expect[page] = ("examples/%s/README.md" % folder, md_h2_count(text) + len(embeds) + len(wide))
site.search.append(search_entry(site, example_name(e), page, text, heads,
lead=e["prompt"] + "\n" + e["what"]))
@@ -1555,6 +1567,14 @@ pause and ask, and range links like <code>#t=10-20</code>. <a href="gallery.html
A hearing pass flags music over the voice, long silences, level jumps at cuts and sound cut off at the end.</p></div>
<div><h3>Notes on the finished video</h3><p><code>showtime review open</code> plays the render on a local page. Click a spot on the
frame and type a note; your agent reads it, fixes and replies. <a href="docs/review.html#6-notes-on-the-finished-video">How it works</a>.</p></div>
+<div><h3>Systems that explain themselves</h3><p><code>showtime new diagram</code> draws how something works as a figure that
+builds over time: parts arrive in order, flows and labels move through them. <a href="docs/workflows/diagram.html">The guide</a>.</p></div>
+<div><h3>Figures people poke</h3><p>The same diagram exports as one offline page with no player: hover a part, pick a step, turn
+a knob and the numbers answer. <a href="examples/_diagram.html#live-figure">Try one live</a>.</p></div>
+<div><h3>A film of your agent's session</h3><p><code>showtime recap</code> turns a Claude Code session into a short film of what
+the agent did, from allow-listed facts only. <a href="examples/_recap.html">See one</a>.</p></div>
+<div><h3>A failing test, as a video</h3><p><code>showtime repro</code> turns a failing Playwright test into a narrated
+bug-report video and a summary for the issue. <a href="examples/_repro.html">See one</a>.</p></div>
{new}</div>
<p class="more"><a class="link-arrow" href="docs/index.html">Read the docs <span>→</span></a></p>
</div></section>
diff --git a/site/content/gallery.json b/site/content/gallery.json
index c10e0b9..ae1b049 100644
--- a/site/content/gallery.json
+++ b/site/content/gallery.json
@@ -15,9 +15,9 @@
"groups": [
{"id": "explainers", "name": "Explainers",
"line": "Narrated explainers from a topic, a Wikipedia article, a PDF or a prize announcement; some stop and ask the viewer.",
- "examples": ["25", "26", "02", "13", "22", "14", "03"],
+ "examples": ["25", "26", "02", "13", "22", "14", "03", "diagram"],
"guides": [["explainer", "docs/workflows/explainer.html"], ["localize", "docs/workflows/localize.html"],
- ["paper-explainer", "docs/workflows/paper-explainer.html"]]},
+ ["paper-explainer", "docs/workflows/paper-explainer.html"], ["diagram", "docs/workflows/diagram.html"]]},
{"id": "footage", "name": "Your footage",
"line": "Real recordings, edited: cards over a talking head, a long panel cut into clips, an interview tightened, a podcast as an audiogram.",
"examples": ["23", "24", "06", "16"],
@@ -28,9 +28,10 @@
"guides": [["launch-video", "docs/workflows/launch-video.html"], ["tutorial", "docs/workflows/tutorial.html"],
["components", "docs/components.html"]]},
{"id": "code", "name": "Code and data",
- "line": "Charts that move, and videos made from a release or a pull request.",
- "examples": ["29", "07", "12", "15"],
- "guides": [["data-story", "docs/workflows/data-story.html"], ["changelog-video", "docs/workflows/changelog-video.html"]]},
+ "line": "Charts that move, and videos made from a release, a pull request, an agent's session or a failing test.",
+ "examples": ["29", "recap", "repro", "07", "12", "15"],
+ "guides": [["data-story", "docs/workflows/data-story.html"], ["changelog-video", "docs/workflows/changelog-video.html"],
+ ["recap", "docs/workflows/recap.html"], ["repro", "docs/workflows/repro.html"]]},
{"id": "social", "name": "Social and trailers",
"line": "Vertical shorts, montages cut on the beat, trailers and a travel slideshow.",
"examples": ["05", "08", "09", "18", "19"],
@@ -46,8 +47,8 @@
"id": "new",
"name": "New in 0.4",
"_name": "The badge on the cards, the last tab and the landing's tile: all of 0.4.x.",
- "examples": ["23", "24", "25", "26", "28", "29", "30", "32", "looks", "blur"],
- "landing": ["23", "24", "25", "28", "looks"]
+ "examples": ["23", "24", "25", "26", "28", "29", "30", "32", "looks", "blur", "diagram", "recap", "repro"],
+ "landing": ["diagram", "recap", "repro", "23", "25"]
},
"_see_it_done": "Example ids under a docs page's lede (\"See it done: ...\"), by page. Seeded from the docs map's Choose your path cards; voice from the proposal.",
"see_it_done": {
@@ -62,6 +63,9 @@
"docs/workflows/changelog-video.html": ["15", "29"],
"docs/workflows/localize.html": ["03", "13", "14"],
"docs/components.html": ["20"],
- "docs/voice.html": ["02", "13", "26"]
+ "docs/voice.html": ["02", "13", "26"],
+ "docs/workflows/diagram.html": ["diagram"],
+ "docs/workflows/recap.html": ["recap"],
+ "docs/workflows/repro.html": ["repro"]
}
}
diff --git a/site/content/harness.html b/site/content/harness.html
index fbe8a84..8a6c4d6 100644
--- a/site/content/harness.html
+++ b/site/content/harness.html
@@ -368,7 +368,7 @@
<section class="sec" id="drawn" aria-labelledby="h-drawn">
<div class="sec-head">
<div><div class="sec-no">12 · The harness, drawn</div><h2 id="h-drawn">Seven loops, one per idea</h2></div>
- <p>Each loop shows one part of this manual in twelve seconds. They were made with showtime’s living diagrams, the feature coming in 0.4.3: the scene is drawn as a function of time, so every frame renders the same way twice.</p>
+ <p>Each loop shows one part of this manual in twelve seconds. They were made with showtime’s living diagrams, new in 0.4.3: the scene is drawn as a function of time, so every frame renders the same way twice.</p>
</div>
<div class="loops">
<figure class="loop"><video src="media/1-the-crew.mp4" poster="media/1-the-crew.jpg" width="960" height="540" muted loop playsinline preload="none" aria-label="The crew: one person, a director and six agents: Haiku, Sonnet, Opus, Fable, Jev and Devin"></video><figcaption><b>Fig. 1 · The crew</b>One person, a director and six agents (Haiku, Sonnet, Opus, Fable, Jev and Devin), each picked for its job; the showtime plugin’s ten crew roles are not drawn. Favio decides what goes out.</figcaption></figure>
@@ -474,7 +474,7 @@ done</code></pre>
<section class="sec" id="next" aria-labelledby="h-next">
<div class="sec-head">
- <div><div class="sec-no">14 · Next</div><h2 id="h-next">Coming in 0.4.3: living diagrams</h2></div>
+ <div><div class="sec-no">14 · Next</div><h2 id="h-next">New in 0.4.3: living diagrams</h2></div>
</div>
<div class="next">
<video src="media/enter-light.mp4" poster="media/enter-light.jpg" width="1280" height="720" controls playsinline preload="none" aria-label="What happens when you press Enter in Claude Code, 27 seconds"><track kind="captions" src="media/enter-light.vtt" srclang="en" label="English"></video>
diff --git a/site/content/previews.json b/site/content/previews.json
index bdd10c5..5a875a0 100644
--- a/site/content/previews.json
+++ b/site/content/previews.json
@@ -128,6 +128,18 @@
"_blur": {
"from": 3.5,
"dur": 4.0
+ },
+ "_diagram": {
+ "from": 10.5,
+ "dur": 4.0
+ },
+ "_recap": {
+ "from": 25.7,
+ "dur": 4.0
+ },
+ "_repro": {
+ "from": 24.5,
+ "dur": 4.0
}
}
}
diff --git a/site/static/style.css b/site/static/style.css
index 51879d8..54a3e6e 100644
--- a/site/static/style.css
+++ b/site/static/style.css
@@ -195,6 +195,13 @@ p{margin:0}
@media (max-width:720px){.htmllist{grid-template-columns:1fr}}
.htmlvid{border-radius:12px;overflow:hidden;background:var(--screen);aspect-ratio:16/9;position:relative}
.htmlvid iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
+/* a long path in inline code wraps on a phone instead of widening the page */
+.prose :not(pre)>code{overflow-wrap:anywhere}
+.figure-room{margin:64px auto 0}
+.figure-room .htmlvid.figure{margin-top:24px}
+/* a live figure keeps its desktop layout from 820 px wide; under that it stacks, so the frame is tall enough for the board and its steps */
+.htmlvid.figure{aspect-ratio:auto;height:min(820px,calc(100vh - 120px));min-height:640px;background:#fff;border:1px solid var(--line)}
+@media (max-width:860px){.htmlvid.figure{height:1120px;min-height:0}}
/* docs: a reading room */
.docs{display:grid;grid-template-columns:232px minmax(0,var(--read)) 196px;gap:64px;max-width:1360px;margin:0 auto;padding:40px 24px 120px;justify-content:center}
diff --git a/skills/showtime/SKILL.md b/skills/showtime/SKILL.md
index 67eeaa1..74c9990 100644
--- a/skills/showtime/SKILL.md
+++ b/skills/showtime/SKILL.md
@@ -21,13 +21,13 @@ use its latest file.
## Modes
- **Asking: quick (default).** Open with one line of assumptions ("Quick mode: 20 s, 16:9, upbeat; no
- voice-over; full review, say 'lean' for a draft pass.") and start without waiting for a reply. Ask
+ voice-over; full review, say 'lean' for a draft pass.") and start without waiting. Ask
(1-2 questions, each with a recommended answer) only when the request is ambiguous: nothing to work
from, or two readings that make different videos. Wait for a yes only before a destructive step
(dropping recorded content, touching their files) or an expensive one (a large install, a render
over ~10 min).
- **Asking: studio (opt-in)** when the user says studio, brainstorm, show me options or concepts first,
- storyboard it first, or wants control. Offer it once, in the opening line, for high-stakes work
+ storyboard it first, or wants control. Offer it once for high-stakes work
with an open direction; follow `references/studio.md`.
- **Review: quality (default) or lean.** Quality reviews every finished video. Lean
(`--mode lean`) only when the user says lean, cheap, quick/rough draft or don't review: critic
@@ -45,28 +45,26 @@ Log each stage boundary in the ledger (`SHOWTIME.md`, `job.json`):
named; qa checks it) checks setup. NOT READY: `showtime setup --estimate`, give size
and time, then `showtime setup`; skipping it is the user's call, never a bare-ffmpeg
stand-in (`references/onboarding.md`). *Done when:* it says ready.
-1. **Understand.** Inspect the inputs (repo, URL, footage, brief) before asking; with no path
- given, look in the working folder (one candidate: use it). Launch/promo:
+1. **Understand.** Inspect the inputs (repo, URL, footage, brief) before asking; with no path,
+ look in the working folder (one candidate: use it). Launch/promo:
`showtime brand capture <repo|url> --job <job>` first; else a kit only if the look must match.
*Done when:* you can write the one-sentence contract (`references/story.md`) and SHOWTIME.md
lists the assumptions.
-2. **Plan.** Story, tone, structure, voice script, storyboard with a duration per scene.
+2. **Plan.** Story, tone, structure, voice script, storyboard with scene durations.
Voice-led: `voice script <script> --fit <seconds> --estimate`, then without `--estimate`; its `timeline.json`
sets the scene lengths (`showtime retime <project> --from-voice <project>/voice/timeline.json`).
*Done when:* durations sum to the target and every claim traces to a source.
-3. **First look.** Project: `showtime new <template> <job>/project --duration <len>` (the
- timeline scales; later: `showtime retime`), then `showtime check <project>` and
- `showtime look <project>`. Footage (EDL, edit decision list: `<job>/edit/edl.json`):
- `showtime edit render <job> --preview`, then `showtime edit view <job>`. Fix what the images show. Quick
- mode: show the user and keep going; studio: the animatic is the gate.
- *Done when:* check reports 0 errors and every WARN is read (footage: `edit check` passes and you
- read every view PNG).
+3. **First look.** Project: `showtime new <template> <job>/project --duration <len>` (later:
+ `showtime retime`), then `showtime check <project>` and
+ `showtime look <project>`. Footage (EDL: `<job>/edit/edl.json`):
+ `showtime edit render <job> --preview`, then `showtime edit view <job>`. Fix what the images show. Quick: show the user and keep going; studio: the animatic is the gate.
+ *Done when:* check reports 0 errors and every WARN is read (footage: `edit check` passes, every
+ view PNG read).
4. **Build.** Project: compose the hook complete at t=0 (`"poster": 0`), then
- `showtime render <project> --job <job>` (`final.mp4`, `poster.jpg`; a later poster is baked into
- frame 0 only when it matches the opening).
+ `showtime render <project> --job <job>` (`final.mp4`, `poster.jpg`; a later poster is baked in only when it matches the opening).
Footage: `showtime edit render <job> -o <job>/final.mp4`; poster via
- `showtime deliver poster <job> --at <t> --bake` (it becomes the latest final). Say the time for
- anything over 30 s.
+ `showtime deliver poster <job> --at <t> --bake` (it becomes the latest final). Say the time if
+ over 30 s.
*Done when:* the render finished cleanly.
5. **Verify.** `showtime qa <job>` in the same turn, then `showtime look <job>`, then the critic
round qa names (`showtime review-pack`, `references/review.md`).
@@ -88,7 +86,8 @@ Log each stage boundary in the ledger (`SHOWTIME.md`, `job.json`):
| a launch or promo from a repo, URL or site folder | `launch-video` |
| a Claude Design export: `showtime adopt <zip>` | `adopt` |
| an explainer or how-it-works film | `explainer` |
-| one that stops and asks the viewer: showtime.json `"questions"`; cold open, roadmap, tie-back | `explainer`, `html-export` |
+| a system shown building and flowing, or explored by hand (`new diagram`, `--interactive`) | `diagram` |
+| one that stops and asks the viewer: showtime.json `"questions"` | `explainer`, `html-export` |
| another skill's storyboard table: `showtime new dom <dir> --from-storyboard <file>` | `explainer` |
| a repo or codebase explained | `repo-explainer` |
| a paper or PDF explained | `paper-explainer` |
@@ -98,6 +97,8 @@ Log each stage boundary in the ledger (`SHOWTIME.md`, `job.json`):
| their footage cut, captioned, reframed, cleaned (even a reel), or a talking head with cards | `footage-edit` |
| picture cut to a song | `music-video` |
| a PR (`showtime pr-video <N>`), release or changelog | `changelog-video` |
+| an agent session as a film (`showtime recap <transcript>`) | `recap` |
+| a failing browser test as a bug-report video (`showtime repro`) | `repro` |
| a trailer, teaser | `trailer` |
| a showreel, hype reel, "go all out" | `tones` |
| photos, screenshots with music | `slideshow` |
diff --git a/skills/showtime/lib/st/__init__.py b/skills/showtime/lib/st/__init__.py
index 9af96e8..89090b8 100644
--- a/skills/showtime/lib/st/__init__.py
+++ b/skills/showtime/lib/st/__init__.py
@@ -7,7 +7,7 @@ inside the showtime virtualenv (~/.showtime/venv, Python 3.12).
"""
import os
-__version__ = "0.4.2"
+__version__ = "0.4.3"
# onnxruntime (Kokoro, alignment, stem separation, rembg) ships Microsoft's telemetry client on Linux
# and starts it at import; this turns it off for every process that imports st, and for its children.
diff --git a/skills/showtime/lib/st/audio/mix.py b/skills/showtime/lib/st/audio/mix.py
index 29fc8b7..107747a 100644
--- a/skills/showtime/lib/st/audio/mix.py
+++ b/skills/showtime/lib/st/audio/mix.py
@@ -128,6 +128,11 @@ def _cache_dir() -> Path:
return d
+def sfx_cache_key(spec: Dict[str, Any]) -> str:
+ """Cache name of a rendered synth hit: its parameters and the synth version (sfx.SYNTH_VERSION)."""
+ return "sfx-" + _hash(dict(spec, v=sfx.SYNTH_VERSION))
+
+
def _hash(obj: Any) -> str:
return hashlib.sha256(json.dumps(obj, sort_keys=True, default=str).encode("utf-8")).hexdigest()[:16]
@@ -331,7 +336,7 @@ def _click_track(times: List[float]) -> np.ndarray:
"""One synthesized key click per time (six seeded variants, slight level variation)."""
variants = []
for sd in range(1, 7):
- key = "sfx-" + _hash({"t": "keyclick", "dur": None, "intensity": 0.6, "seed": sd, "key": "C"})
+ key = sfx_cache_key({"t": "keyclick", "dur": None, "intensity": 0.6, "seed": sd, "key": "C"})
cp = _cache_dir() / (key + ".wav")
if not cp.is_file():
with cache_lock(cp):
@@ -472,7 +477,7 @@ def load_source(tr: dict, idx: int, bases: List[Path], mix_dur: float) -> Source
raise ShowtimeError("track %d: synth needs a 'type' (see `showtime audio sfx-types`)" % idx)
params = {"dur": spec.get("dur"), "intensity": float(spec.get("intensity", 0.7)),
"seed": int(spec.get("seed", 0)), "key": str(spec.get("key", "C"))}
- key = "sfx-" + _hash({"t": spec["type"], **params})
+ key = sfx_cache_key({"t": spec["type"], **params})
cp = _cache_dir() / (key + ".wav")
cj = _cache_dir() / (key + ".json")
if not (cp.is_file() and cj.is_file()):
diff --git a/skills/showtime/lib/st/audio/sfx.py b/skills/showtime/lib/st/audio/sfx.py
index 647a063..3eef925 100644
--- a/skills/showtime/lib/st/audio/sfx.py
+++ b/skills/showtime/lib/st/audio/sfx.py
@@ -45,6 +45,10 @@ class Spec:
self.dur_range, self.tonal, self.doc, self.tags = dur_range, tonal, doc, tags
+# Bump when a synth's sound changes: mix.py keys its cache of rendered hits (~/.showtime/cache/audio) on it, so a
+# changed synth is re-rendered instead of an old hit being reused.
+SYNTH_VERSION = 2
+
REGISTRY: Dict[str, Spec] = {}
@@ -69,14 +73,14 @@ def whoosh(dur, intensity, seed, key, direction=1.0):
N = n(dur)
peak = 0.5 + 0.15 * (r.random() - 0.5)
b = bell_curve(N, peak, 1.6, 1.2)
- lo, hi = 220 + 150 * r.random(), 1800 + 3000 * intensity
+ lo, hi = 220 + 150 * r.random(), 1100 + 1500 * intensity # soft: the sweep stays in the low mids
fc = lo * (hi / lo) ** b
- src = 0.65 * noise(N, "pink", r) + 0.35 * noise(N, "white", r)
- body = svf(src, fc, 1.1 + 1.2 * intensity, "bp")
- air = svf(noise(N, "white", r), np.minimum(fc * 2.2, 16000), 0.9, "bp") * 0.3
- x = (body + air) * b ** 1.3
+ src = 0.8 * noise(N, "pink", r) + 0.2 * noise(N, "white", r)
+ body = svf(src, fc, 0.8 + 0.6 * intensity, "bp")
+ air = svf(noise(N, "white", r), np.minimum(fc * 2.0, 4000), 0.7, "bp") * 0.08
+ x = svf((body + air) * b ** 1.3, 3200, 0.707, "lp") # no hiss above ~3 kHz
st = pan(x, direction * np.tanh(4 * (np.linspace(0, 1, N) - peak)) * 0.85)
- return _rev(widen(fade(st, 0.01, 0.02), 9, 0.4), 0.8, 0.12), {}
+ return _rev(widen(fade(st, 0.12, 0.08), 9, 0.4), 0.8, 0.12, bright=3500), {}
@sfx("peak", "transition", 1.8, (0.6, 6), tags=["whoosh", "heavy", "cinematic", "transition", "low"])
@@ -94,29 +98,31 @@ def whoosh_heavy(dur, intensity, seed, key):
return _rev(widen(fade(st, 0.02, 0.03), 14, 0.5), 1.6, 0.18, 3000), {}
-@sfx("end", "transition", 0.45, (0.1, 3), tags=["swoosh", "whoosh-in", "transition", "rise"])
+@sfx("end", "transition", 0.6, (0.1, 3), tags=["swoosh", "whoosh-in", "transition", "rise"])
def swoosh_in(dur, intensity, seed, key):
- """Short fast rising swoosh that lands on its last sample."""
+ """Soft rising swoosh that swells into the cut and eases out on its last 70 ms (no hard stop, no hiss)."""
r = rng(seed)
N = n(dur)
tt = np.linspace(0, 1, N)
- e = tt ** 2.5
- fc = 400 * (6000 * (0.6 + 0.4 * intensity) / 400) ** (tt ** 1.5)
- x = svf(noise(N, "white", r) * 0.6 + noise(N, "pink", r) * 0.4, fc, 1.6, "bp") * e
- return fade(pan(x, -0.6 + 1.2 * tt), 0.005, 0.004), {"hit": dur}
+ e = tt ** 2.0
+ fc = 300 * (2400 * (0.6 + 0.4 * intensity) / 300) ** (tt ** 1.5)
+ x = svf(noise(N, "pink", r) * 0.85 + noise(N, "white", r) * 0.15, fc, 0.9, "bp") * e
+ x = svf(x, 3200, 0.707, "lp")
+ return fade(pan(x, -0.5 + 1.0 * tt), 0.1, 0.07), {"hit": dur}
-@sfx("onset", "transition", 0.6, (0.15, 3), tags=["swoosh", "whoosh-out", "transition", "exit"])
+@sfx("onset", "transition", 0.7, (0.15, 3), tags=["swoosh", "whoosh-out", "transition", "exit"])
def swoosh_out(dur, intensity, seed, key):
- """Short falling swoosh that starts on the hit (exits, dismissals)."""
+ """Soft falling swoosh that eases in over ~200 ms from the hit (exits, dismissals)."""
r = rng(seed)
N = n(dur)
tt = np.linspace(0, 1, N)
- k = min(N, n(0.01))
- e = np.concatenate([np.linspace(0, 1, k), (1 - tt[k:]) ** 2.2])[:N]
- fc = 6000 * (300 / 6000) ** (tt ** 0.7)
- x = svf(noise(N, "white", r), fc, 1.5, "bp") * e
- return _rev(pan(x, 0.6 - 1.2 * tt), 0.6, 0.1), {}
+ k = min(N, n(0.2))
+ e = np.concatenate([0.5 - 0.5 * np.cos(np.linspace(0, np.pi, k)), (1 - tt[k:]) ** 2.2])[:N]
+ fc = 2600 * (260 / 2600) ** (tt ** 0.7)
+ x = svf(noise(N, "pink", r) * 0.85 + noise(N, "white", r) * 0.15, fc, 0.9, "bp") * e
+ x = svf(x, 3200, 0.707, "lp")
+ return _rev(pan(x, 0.5 - 1.0 * tt), 0.6, 0.1, bright=3500), {}
@sfx("end", "transition", 3.0, (0.5, 16), tonal=True, tags=["riser", "build", "tension", "transition", "uplifter"])
diff --git a/skills/showtime/lib/st/bed.py b/skills/showtime/lib/st/bed.py
new file mode 100644
index 0000000..081d9f6
--- /dev/null
+++ b/skills/showtime/lib/st/bed.py
@@ -0,0 +1,319 @@
+"""The sound of a generated film (recap, repro): a bed and a few effects that differ from film to film.
+
+Both commands used to write the same bed (minimal-pulse, seed 11) and the same swoosh, click and error
+tone every time. Here each film derives its sound from a stable hash of what it is about (the session,
+the test), so the same input sounds the same on every rerun and different inputs sound different:
+
+- the bed is a produced catalog track (picked through music.search, so the rotation away from the last
+ 8 finished jobs applies) when one is cached, or can be fetched now; otherwise a composed bed in a
+ style chosen from a short list for the kind, moved off the styles of the last few jobs. A job keeps its
+ pick: a rerun reuses the bed already in the project's mix.json, else the one the look history recorded
+ for the project, and the job itself never counts as "recent";
+- the cut, click and error effects are chosen per film from the synth families that stay subtle.
+
+`--music <style|catalog-id|none>` pins the bed. Stdlib plus st.audio (imported when a choice is made).
+"""
+from __future__ import annotations
+
+import hashlib
+import json
+import re
+from pathlib import Path
+from typing import Any, Dict, List, Optional
+
+from .common import ShowtimeError, log
+
+# composed styles that fit each kind (references/music.md section 2): calm for a recap; calm or tense for a
+# repro (a failing test), never a groove
+STYLES = {
+ "recap": ("minimal-pulse", "underscore", "lofi-chill", "ambient-pad", "piano-emotional"),
+ "repro": ("minimal-pulse", "underscore", "dark-tension", "ambient-pad", "lofi-chill"),
+}
+# the catalog query per kind: a restrained, vocal-free track (music.py presets)
+CATALOG = {
+ "recap": {"use": "story", "energy": (0.1, 0.5)},
+ "repro": {"use": "tech", "energy": (0.15, 0.45)},
+}
+STYLE_JOBS = 3 # a composed style used by one of this many latest jobs is skipped when others remain
+CANDIDATES = 8
+
+# effect families (all subtle: ui and transition categories only)
+CUT = ("swoosh-in", "swoosh-out") # soft transitions only (the hard whoosh stays out of generated films)
+DUCK_DEPTH_DB = 10.0 # the bed under narration dips 10 dB (the mixer's default is 12): voice stays ~17 dB over it
+CUT_GAIN_DB = -18.0 # about 18 dB under the bed: felt on the cut, never heard as an effect
+CLICK = ("click", "tick", "pop", "toggle")
+ERROR = ("error", "power-down")
+KEYS = ("C", "D", "E", "F", "G", "A")
+
+
+def stable(*parts: Any) -> int:
+ """A 32-bit number from the parts: the same input gives the same number on every machine and run."""
+ return int(hashlib.sha1("|".join(str(p) for p in parts).encode("utf-8")).hexdigest()[:8], 16)
+
+
+def synth(key: str, role: str, salt: Any = 0, intensity: float = 0.4, tone: Optional[str] = None) -> Dict[str, Any]:
+ """The synth spec of one effect: the family is this film's choice for the role, the seed the event's, the key
+ (used by the tonal ones) the bed's when it is composed."""
+ fams = {"cut": CUT, "click": CLICK, "error": ERROR}[role]
+ typ = fams[stable(key, role, "family") % len(fams)]
+ return {"type": typ, "intensity": round(intensity, 2), "seed": stable(key, role, salt) % 100000,
+ "key": tone or KEYS[stable(key, role, "key") % len(KEYS)]}
+
+
+def _project_key(project: Optional[Path]) -> Optional[str]:
+ return str(Path(project).resolve()) if project else None
+
+
+def _recent_styles(project: Optional[Path]) -> List[str]:
+ """Composed styles of the last jobs, leaving out this project's own job; none when rotation is off."""
+ from .audio import music
+ if music.rotation_off():
+ return []
+ try:
+ rows = music.recent_music(_project_key(project), n=STYLE_JOBS)
+ except (ShowtimeError, OSError, ValueError):
+ return []
+ return [s for r in rows for s in r["composed"]]
+
+
+def pick_style(kind: str, key: str, project: Optional[Path] = None) -> str:
+ """A composed style for the kind: the film's own choice, off the styles of the last few jobs."""
+ from .audio import compose
+ names = [compose.resolve_style(s) for s in STYLES[kind]]
+ recent = _recent_styles(project)
+ pool = [s for s in names if s not in recent] or names
+ return pool[stable(key, kind, "style") % len(pool)]
+
+
+def _previous(project: Optional[Path]) -> Optional[Dict[str, Any]]:
+ """The bed this project already has: {"catalog": id} or {"compose": {style, seed, key}}. First the bed in the
+ project's own audio/mix.json (a rerun of the same job), then the music the look history recorded for it
+ (music._pinned does the same for a catalog query)."""
+ if not project:
+ return None
+ from .audio import compose, music
+ mix = Path(project) / "audio" / "mix.json"
+ tracks: List[Dict[str, Any]] = []
+ try:
+ tracks = [t for t in json.loads(mix.read_text(encoding="utf-8")).get("tracks", []) if t.get("id") == "bed"]
+ except (OSError, ValueError, AttributeError):
+ pass
+ cands: List[Dict[str, Any]] = []
+ for t in tracks:
+ if isinstance(t.get("catalog"), str):
+ cands.append({"catalog": t["catalog"]})
+ elif isinstance(t.get("compose"), dict):
+ cands.append({"compose": t["compose"]})
+ key = _project_key(project)
+ try:
+ from .variety import history
+ if history.enabled()[0]:
+ for lk in reversed(history.load()):
+ if not (music._same(lk.get("project"), key) or music._same(lk.get("job_path"), key)):
+ continue
+ for m in lk.get("music") or []:
+ ref = str(m.get("ref") or "")
+ if ref.startswith("catalog:"):
+ cands.append({"catalog": ref[len("catalog:"):]})
+ elif ref.startswith("compose:") and m.get("seed") is not None:
+ cands.append({"compose": {k: m[k] for k in ("style", "seed", "key") if m.get(k) is not None}})
+ break
+ except (ShowtimeError, OSError, ValueError):
+ pass
+ for c in cands:
+ if "catalog" in c:
+ try:
+ t = music.get(c["catalog"])
+ except ShowtimeError:
+ continue
+ if t.get("status", "active") == "active" and t["id"] not in music.vetoed_ids():
+ return {"catalog": t["id"]}
+ else:
+ try:
+ comp = c["compose"]
+ compose.resolve_style(comp["style"])
+ int(comp["seed"])
+ return {"compose": {"style": compose.resolve_style(comp["style"]), "seed": int(comp["seed"]),
+ "key": comp.get("key") or compose.auto_key(comp["style"], int(comp["seed"]))}}
+ except (ShowtimeError, KeyError, ValueError, TypeError):
+ continue
+ return None
+
+
+def _catalog_track(kind: str, key: str, dur: float, fetch: bool, project: Optional[Path]) -> Optional[Dict[str, Any]]:
+ """A catalog track for the film: a cached one first, else (fetch) the film's own pick, to be downloaded
+ before the render; None if neither."""
+ from .assets import net
+ from .audio import music
+ q = CATALOG[kind]
+ try:
+ rows = music.search(use=q["use"], energy=q["energy"], vocals="none", dur=dur or None,
+ limit=CANDIDATES, key=_project_key(project) or key)
+ except ShowtimeError:
+ return None
+ cands = [r["track"] for r in rows]
+ if not cands:
+ return None
+ i = stable(key, kind, "track") % len(cands)
+ order = cands[i:] + cands[:i]
+ for t in order:
+ if music.is_cached(t):
+ return t
+ return order[0] if fetch and not net.offline() else None
+
+
+def _compose(style: str, key: str, kind: str, sections: str, seed: Optional[int] = None,
+ tone: Optional[str] = None) -> Dict[str, Any]:
+ from .audio import compose
+ seed = stable(key, kind, "seed") % 9000 + 1 if seed is None else int(seed)
+ return {"style": style, "sections": sections, "seed": seed, "key": tone or compose.auto_key(style, seed)}
+
+
+def _composed(kind, key, sections, track, c, **extra) -> Dict[str, Any]:
+ return dict({"how": "compose", "kind": kind, "label": "composed %s (seed %d, key %s)" % (c["style"], c["seed"], c["key"]),
+ "style": c["style"], "key": c["key"], "track": track({"compose": c}), "fallback": None}, **extra)
+
+
+def choose(kind: str, key: str, dur: float, sections: str, *, pin: Optional[str] = None, gain_db: float = -3.0,
+ duck: Optional[Dict[str, Any]] = None, fetch: bool = False,
+ project: Optional[Path] = None) -> Dict[str, Any]:
+ """The bed of a film: {"how": catalog|compose|none, "kind", "label", "track" (the mix.json track or None),
+ "fallback" (a composed track to use if a catalog track cannot be fetched), "style" or "id"}.
+
+ `key` is what the film is about (it only seeds the pick); `project` is its folder (the rotation key, and where
+ a rerun finds the bed it already has); `pin` is --music; `fetch` lets a catalog track that is not cached
+ count (it is downloaded before the render, see ensure())."""
+ from .audio import compose, music
+
+ def track(src: Dict[str, Any]) -> Dict[str, Any]:
+ tr: Dict[str, Any] = {"id": "bed", "kind": "music"}
+ tr.update(src)
+ tr.update({"gain_db": gain_db, "fade_out": 1.2})
+ if duck:
+ tr["duck"] = dict(duck)
+ return tr
+
+ if pin is not None and str(pin).strip().lower() in ("none", "off", "no"):
+ return {"how": "none", "kind": kind, "label": "no music", "track": None, "fallback": None}
+ if pin:
+ try:
+ style = compose.resolve_style(pin)
+ except ShowtimeError:
+ style = None
+ if style is None:
+ try:
+ t = music.get(str(pin).strip())
+ except ShowtimeError:
+ raise ShowtimeError("--music %r is not a style, a catalog track or none" % pin,
+ hint="showtime audio styles, showtime audio music pick --for story, or none")
+ return _catalog_choice(t, track, kind, key, sections, project, pinned=True)
+ return _composed(kind, key, sections, track, _compose(style, key, kind, sections), pinned=True)
+ prev = _previous(project)
+ if prev and "catalog" in prev:
+ return _catalog_choice(music.get(prev["catalog"]), track, kind, key, sections, project)
+ if prev:
+ c = prev["compose"]
+ return _composed(kind, key, sections, track, _compose(c["style"], key, kind, sections, c["seed"], c["key"]))
+ t = _catalog_track(kind, key, dur, fetch, project)
+ if t is not None:
+ return _catalog_choice(t, track, kind, key, sections, project)
+ return _composed(kind, key, sections, track, _compose(pick_style(kind, key, project), key, kind, sections))
+
+
+def _catalog_choice(t, track, kind, key, sections, project, pinned: bool = False) -> Dict[str, Any]:
+ from .audio import music
+ src: Dict[str, Any] = {"catalog": t["id"], "fit": True}
+ if float(t.get("quiet_intro_s") or 0) >= 6:
+ src["offset"] = "highlight"
+ fb = track({"compose": _compose(pick_style(kind, key, project), key, kind, sections)})
+ return {"how": "catalog", "kind": kind, "pinned": pinned,
+ "label": "%s by %s (catalog %s)" % (t["title"], t["artist"], t["id"]),
+ "id": t["id"], "track": track(src), "fallback": fb, "credit": music.credit_item(t)}
+
+
+def comment(choice: Dict[str, Any], sounds: bool = True) -> str:
+ """The mix.json _comment: what made the bed, and what stayed on this machine. `sounds`: the mix has effects."""
+ kind = choice.get("kind") or "film"
+ fx = " and soft sounds made on this machine" if sounds else ""
+ if choice.get("how") == "catalog":
+ return ("Generated by showtime %s: a produced catalog track (downloaded once from its creator's site and cached; "
+ "nothing is sent)%s. `--music <style>` or SHOWTIME_OFFLINE=1 keeps it fully local." % (kind, fx))
+ if choice.get("how") == "none":
+ return "Generated by showtime %s: %s." % (kind, "soft sounds made on this machine, no music (--music none)"
+ if sounds else "no music (--music none), no sounds")
+ return "Generated by showtime %s: a composed bed%s, all made on this machine." % (kind, fx)
+
+
+def scene_sections(project: Path) -> str:
+ """music sections ("0:intro,4:verse,9:outro") from the scenes of the project's page as it is now (after a
+ retime), or "" when they cannot be read."""
+ try:
+ html = (Path(project) / "index.html").read_text(encoding="utf-8")
+ except OSError:
+ return ""
+ durs = [float(m) for m in re.findall(r'<section[^>]*class="scene"[^>]*data-dur="([\d.]+)"', html)]
+ if not durs:
+ return ""
+ starts, t = [], 0.0
+ for d in durs:
+ starts.append(round(t, 2))
+ t += d
+ names = ["intro"] + ["verse"] * max(0, len(starts) - 2) + ["outro"]
+ return ",".join("%g:%s" % (a, b) for a, b in zip(starts, names))
+
+
+PLACEMENT = ("duck", "start", "gain_db", "fade_out", "gain_points")
+
+
+def ensure(mix_path: Path, choice: Dict[str, Any]) -> None:
+ """Before a render: a catalog bed is downloaded now (announced, checksummed). If that fails (no network, a blocked
+ host, a cache that cannot be written) the bed in mix.json becomes the composed fallback, keeping the current
+ bed's placement (duck, start, gain, fade, gain points) and sections from the scenes as they are now, so the
+ render never stops on it. A track the person pinned with --music is not swapped: it fails."""
+ if choice.get("how") != "catalog":
+ return
+ from .audio import music
+ try:
+ music.fetch(choice["id"], purpose="the soundtrack")
+ return
+ except (ShowtimeError, OSError) as e:
+ if choice.get("pinned"):
+ raise ShowtimeError("--music %s could not be fetched: %s" % (choice["id"], e),
+ hint="try again online, or pin a style: --music minimal-pulse")
+ log("music: %s is not available (%s); using a composed bed instead" % (choice["id"], e))
+ mp = Path(mix_path)
+ mix = json.loads(mp.read_text(encoding="utf-8"))
+ cur = next((t for t in mix["tracks"] if t.get("id") == "bed"), {})
+ fb = dict(choice["fallback"])
+ fb.update({k: cur[k] for k in PLACEMENT if k in cur})
+ secs = scene_sections(mp.parent.parent)
+ if secs:
+ fb["compose"] = dict(fb["compose"], sections=secs)
+ mix["tracks"] = [fb if t.get("id") == "bed" else t for t in mix["tracks"]]
+ c = fb["compose"]
+ choice.update(how="compose", style=c["style"], key=c["key"], track=fb, credit=None,
+ label="composed %s (seed %d, key %s; the catalog track could not be fetched)" % (
+ c["style"], c["seed"], c["key"]))
+ mix["_comment"] = comment(choice, any(t.get("kind") == "sfx" for t in mix["tracks"]))
+ mp.write_text(json.dumps(mix, indent=2) + "\n", encoding="utf-8")
+
+
+def credit_report(video: Path, choice: Dict[str, Any]) -> Dict[str, Any]:
+ """What a catalog bed owes the person, after the render: {"credits": file, "share": file, "notes": [...],
+ "attribution": line or None}. Empty for a composed bed."""
+ out: Dict[str, Any] = {"credits": None, "share": None, "notes": [], "attribution": None}
+ item = choice.get("credit")
+ if choice.get("how") != "catalog" or not item:
+ return out
+ from .audio import credits as credmod
+ video = Path(video)
+ for name in (video.stem + ".credits.txt", "credits.txt"):
+ if (video.parent / name).is_file():
+ out["credits"] = str(video.parent / name)
+ break
+ if (video.parent / "share.txt").is_file():
+ out["share"] = str(video.parent / "share.txt")
+ out["notes"] = credmod.content_id_notes([item])
+ if item.get("attribution_required") and item.get("attribution"):
+ out["attribution"] = item["attribution"]
+ return out
diff --git a/skills/showtime/lib/st/cli_core.py b/skills/showtime/lib/st/cli_core.py
index aa60a71..3ebbec6 100644
--- a/skills/showtime/lib/st/cli_core.py
+++ b/skills/showtime/lib/st/cli_core.py
@@ -123,6 +123,56 @@ def _parse_size(text: str) -> Any:
return int(m.group(1)), int(m.group(2))
+def _read_text(p: Path) -> str:
+ try:
+ return p.read_text(encoding="utf-8", errors="replace")
+ except OSError:
+ return ""
+
+
+# the diagram template's themes (runtime/diagram.css, Diagram.themes): showtime.json background per theme
+DIAGRAM_THEMES = {"light": "#F4F3EF", "dark": "#0A0F19", "white": "#FFFFFF"}
+_DATA_THEME_RE = re.compile(r'(<html\b[^>]*\bdata-theme=")([\w-]+)(")')
+
+
+def _set_diagram_theme(dst: Path, cfg: Dict[str, Any], theme: str, background: bool = True) -> None:
+ """Put a living diagram in one theme: the pages' <html data-theme> (the film's index.html and the live figure's
+ figure.html), showtime.json "theme" and (unless the user gave one) the background."""
+ for page in (dst / "index.html", dst / "figure.html"):
+ if page.is_file():
+ text = page.read_text(encoding="utf-8")
+ new = _DATA_THEME_RE.sub(lambda m: m.group(1) + theme + m.group(3), text, count=1)
+ if new != text:
+ page.write_text(new, encoding="utf-8")
+ cfg["theme"] = theme
+ if background:
+ cfg["background"] = DIAGRAM_THEMES[theme]
+
+
+_CUE_DURATION_RE = re.compile(r"\b(?:var|let|const)\s+CUE\s*=\s*\{[^}]*?^\s*duration:\s*([0-9.]+)", re.S | re.M)
+
+
+def _diagram_examples(src: Path) -> List[str]:
+ d = src / "examples"
+ return sorted(p.stem for p in d.glob("*.js")) if d.is_dir() else []
+
+
+def _apply_diagram_example(src: Path, dst: Path, cfg: Dict[str, Any], name: str) -> None:
+ """Make one of the diagram template's examples the project's scene, at the example's own length (CUE.duration),
+ with the poster near its end: a later --duration or retime then scales from the right base."""
+ text = (src / "examples" / (name + ".js")).read_text(encoding="utf-8")
+ (dst / "scene.js").write_text(text, encoding="utf-8")
+ # the project takes the example's own title (its page title, *accent* marks dropped) instead of the template's
+ t = re.search(r"\bpage:\s*\{.*?\btitle:\s*'([^']+)'", text, re.S)
+ if t and cfg.get("title") in (None, "", "Living Diagram"):
+ cfg["title"] = t.group(1).replace("*", "").strip()
+ m = _CUE_DURATION_RE.search(text)
+ if m:
+ dur = float(m.group(1))
+ cfg["duration"] = int(dur) if dur.is_integer() else dur
+ cfg["poster"] = round(max(0.0, dur - 0.8), 2)
+
+
def register_new(sub: argparse._SubParsersAction) -> None:
p = sub.add_parser("new", help=COMMANDS["new"], description=(
"Copy SKILL/templates/<template> into <dir> and fill in showtime.json.\n"
@@ -154,6 +204,8 @@ def register_new(sub: argparse._SubParsersAction) -> None:
" showtime new short my-reel --duration 15\n"
" showtime new dom teaser --size 1280x720 --duration 8\n"
" showtime new film explainer --title \"How it works\"\n"
+ " showtime new diagram how-it-works --theme dark -d 20 # a living diagram, night schematic\n"
+ " showtime new diagram agent-loop --example enter # start from an example scene at its own length\n"
" showtime new dom promo --look tidewater # this look signature (or --look template)\n"
" showtime new data ~/charts/signups --job signups-data # a project outside the job folder\n"
" showtime new dom explainer --from-storyboard storyboard.md # one scene per shot of a storyboard table\n"
@@ -195,6 +247,14 @@ def register_new(sub: argparse._SubParsersAction) -> None:
help="look signature for a page template (dom, launch, short, data): auto (the default: picked "
"away from this machine's recent looks), template (the template's own look) or an id from "
"`showtime signature`; a brand kit or a job's style reference wins over auto")
+ p.add_argument("--theme", choices=sorted(DIAGRAM_THEMES),
+ help="diagram template: light (paper, the default), dark (night schematic) or white (white, colour only "
+ "where it means something; the live figure's look); sets showtime.json "
+ "\"theme\" and the page's data-theme, and \"background\" unless --background is given")
+ p.add_argument("--example", metavar="NAME",
+ help="diagram template: start from one of its examples (enter, market, econ-lab) instead of the heat pump: "
+ "it becomes scene.js and the video takes the example's length (CUE.duration), so --duration "
+ "and a later retime scale from it")
p.add_argument("--look-seed", metavar="SEED",
help="seed for the automatic pick (default: the folder name); the same seed and history give the same look")
p.add_argument("--json", action="store_true", help="print the created project as JSON")
@@ -302,6 +362,18 @@ def cmd_new(args: argparse.Namespace) -> int:
"showtime is running: `showtime doctor` says which)" % (", ".join(names) or "(none installed)"))
if not args.dir:
raise ShowtimeError("missing destination folder", hint="showtime new %s my-video" % args.template)
+ tpl_cfg = read_json(Path(names[args.template]["path"]) / "showtime.json", {}) or {}
+ is_diagram = "theme" in tpl_cfg and bool(_DATA_THEME_RE.search(_read_text(Path(names[args.template]["path"]) / "index.html")))
+ if getattr(args, "theme", None) and not is_diagram:
+ raise ShowtimeError("--theme is for the diagram template", why="'%s' keeps its own look" % args.template,
+ hint="showtime new diagram %s --theme %s (page templates: --look)" % (args.dir, args.theme))
+ if getattr(args, "example", None):
+ avail = _diagram_examples(Path(names[args.template]["path"]))
+ if not avail:
+ raise ShowtimeError("--example is for the diagram template", why="'%s' has no examples folder" % args.template,
+ hint="showtime new diagram %s --example enter" % args.dir)
+ if args.example not in avail:
+ raise ShowtimeError("unknown example %r" % args.example, hint="examples of %s: %s" % (args.template, ", ".join(avail)))
if args.duration is not None and not (0 < args.duration <= 3600):
raise ShowtimeError("--duration must be between 0 and 3600 seconds (got %g)" % args.duration)
job_dir: Optional[Path] = None
@@ -350,6 +422,10 @@ def cmd_new(args: argparse.Namespace) -> int:
for dim in ("width", "height"):
if int(cfg[dim]) % 2:
raise ShowtimeError("%s must be even for H.264 (got %s)" % (dim, cfg[dim]))
+ if getattr(args, "example", None) and board is None:
+ _apply_diagram_example(src, dst, cfg, args.example)
+ if getattr(args, "theme", None):
+ _set_diagram_theme(dst, cfg, args.theme, background=getattr(args, "background", None) is None)
tone_note = _tone_for_new(args, cfg, job_dir, dst)
write_json(cfg_path, cfg)
sb_files: List[str] = []
@@ -458,7 +534,13 @@ def _load_storyboard(args: argparse.Namespace, src: Path) -> Dict[str, Any]:
"""The storyboard plan for `new --from-storyboard`, checked before anything is written."""
from . import storyboard as sbmod
page = src / "index.html"
- if not page.is_file() or re.search(r"Film\.start\s*\(", page.read_text(encoding="utf-8", errors="replace")):
+ page_text = page.read_text(encoding="utf-8", errors="replace") if page.is_file() else ""
+ if "/_st/diagram.js" in page_text:
+ raise ShowtimeError("--from-storyboard writes DOM scenes; 'diagram' draws one scene spec",
+ why="a living diagram is one figure that builds over time, not a scene per shot",
+ hint="showtime new diagram %s, then write its scene.js from the storyboard's beats "
+ "(references/workflows/diagram.md)" % (args.dir or "my-video"))
+ if not page.is_file() or re.search(r"Film\.start\s*\(", page_text):
raise ShowtimeError("--from-storyboard writes DOM scenes; '%s' is a canvas template" % args.template,
why="a canvas film keeps its timing in a cue table that the voice cannot retime",
hint="showtime new dom %s --from-storyboard %s (short for 9:16; draw a shot on a "
diff --git a/skills/showtime/lib/st/cli_recap.py b/skills/showtime/lib/st/cli_recap.py
new file mode 100644
index 0000000..f96a963
--- /dev/null
+++ b/skills/showtime/lib/st/cli_recap.py
@@ -0,0 +1,301 @@
+"""`showtime recap`: a Claude Code session -> a short narrated film of what the agent did."""
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import subprocess
+import sys
+from pathlib import Path
+
+from .common import ShowtimeError, print_json
+
+COMMANDS = {
+ "recap": "A Claude Code session -> a short narrated film of what the agent did (allow-listed facts only)",
+}
+
+_F = argparse.RawDescriptionHelpFormatter
+
+
+def register(sub: argparse._SubParsersAction) -> None:
+ p = sub.add_parser("recap", help=COMMANDS["recap"], formatter_class=_F, description=(
+ "Turn a Claude Code session into a 30-60 s narrated film of what the agent did: a title from the\n"
+ "facts, the numbers (time, turns, tool calls, files), a timeline of the files it read and edited and the\n"
+ "commands and tests it ran, where the edits landed, the tests red to green, and the diff from git.\n\n"
+ "Privacy is an allow-list of facts: a title made from them, tool names and counts, repository-relative\n"
+ "paths of files inside the repository, program names from a fixed list with their own subcommand\n"
+ "(`git commit`, `npm test`; anything else is \"other\"), test counts, git diff stats and timestamps.\n"
+ "Free text (the request, a sub-agent's description) is only offered in script.md as a # suggestion;\n"
+ "editing script.md is the only way to change what is on screen. Assistant text, tool output, memory,\n"
+ "paths, URLs and the environment are not on the list.\n"
+ "A hard filter then drops any line that looks like a key or token, an absolute path, a URL, a host or\n"
+ "an e-mail address, and nothing is rendered before you have read script.md: filters can miss things.\n\n"
+ "<out> is showtime-out/recap-<session> unless --out is given. First run: writes <out>/script.md (every line that will be shown or spoken) and <out>/facts.json,\n"
+ "and stops. Read and edit script.md, then run the same command with --yes: it builds <out>/project,\n"
+ "narrates it (showtime voice, captions burned in), checks, renders <out>/recap.mp4 and runs qa.\n"
+ "Everything runs on this machine and nothing is uploaded; the music may be a catalog track downloaded once\n"
+ "from its creator's site (nothing is sent; --music <style> or SHOWTIME_OFFLINE=1 keeps it fully local)."),
+ epilog=("Examples:\n"
+ " showtime recap --latest # this folder's newest session: script.md first\n"
+ " showtime recap --latest --yes # after reading script.md: render it\n"
+ " showtime recap ~/.claude/projects/<project>/<session>.jsonl --repo . --out ~/recaps/parser\n"
+ " showtime recap <session-id> --since main --yes --no-voice --preview # script.md read already\n"
+ " showtime recap --latest --yes --aspect 9:16 --out ~/recaps/parser-vertical\n\n"
+ "A recap covers one transcript: a session's sub-agents have their own (recap them separately). Run\n"
+ "inside Claude Code, --latest picks the session in progress."))
+ p.add_argument("session", nargs="?", help="a session transcript (.jsonl), or a session id")
+ p.add_argument("--latest", action="store_true", help="the newest session of the current folder")
+ p.add_argument("--repo", metavar="DIR", help="the repository the session worked in (default: its working folder)")
+ p.add_argument("--since", metavar="REF", help="diff stats from git diff REF (default: the session's own commits)")
+ p.add_argument("--out", help="output folder (default: showtime-out/recap-<session> under $SHOWTIME_OUT or the "
+ "current folder; refused inside a git repository where git would track it)")
+ p.add_argument("--yes", action="store_true",
+ help="build and render from an existing script.md (a call that writes script.md never renders)")
+ p.add_argument("--fresh", action="store_true", help="rewrite script.md from the session (drops your edits; "
+ "nothing is rendered in that call)")
+ p.add_argument("--no-voice", action="store_true", help="no narration (and no captions); scenes hold for reading")
+ p.add_argument("--voice", default="af_heart", help="narration voice (default af_heart)")
+ p.add_argument("--aspect", default="16:9", choices=["16:9", "9:16"])
+ p.add_argument("--cut-sounds", action="store_true",
+ help="a soft swoosh on each scene cut (off by default: a film has no sound on its cuts)")
+ p.add_argument("--music", metavar="STYLE|ID|none",
+ help="pin the music: a composed style (showtime audio styles), a catalog track id, or none "
+ "(default: chosen from the session, off what the last films used)")
+ p.add_argument("--no-render", action="store_true", help="with --yes: write the project only")
+ p.add_argument("--preview", action="store_true", help="fast draft render (<=720p)")
+ p.add_argument("--json", action="store_true", help="print the result as JSON")
+ p.set_defaults(func=cmd_recap)
+
+
+def _launcher() -> Path:
+ return Path(__file__).resolve().parent / "launcher.py"
+
+
+def _st(args: list, *, quiet: bool, capture: bool = False) -> subprocess.CompletedProcess:
+ sys.stdout.flush()
+ return subprocess.run([sys.executable, str(_launcher())] + [str(a) for a in args],
+ stdout=subprocess.PIPE if capture else (subprocess.DEVNULL if quiet else sys.stderr),
+ stderr=subprocess.DEVNULL if quiet and not capture else None,
+ encoding="utf-8", errors="replace")
+
+
+def cmd_recap(args: argparse.Namespace) -> int:
+ from . import recap as rc
+ say = (lambda *a: None) if args.json else (lambda *a: print(*a, file=sys.stderr))
+ if args.session:
+ path = rc.find_session(args.session)
+ elif args.latest:
+ path = rc.latest_session(Path.cwd())
+ else:
+ raise ShowtimeError("no session given", hint="showtime recap --latest, or showtime recap <session.jsonl>")
+ ses = rc.parse_session(path)
+ top, roots = rc.repo_roots(ses, args.repo)
+ facts = rc.collect(ses, top, roots, since=args.since)
+ suggestions = rc.suggestions_for(ses) # free text: written to script.md as comments, nowhere else
+ del ses # nothing of the raw session goes further than this line
+ out = Path(args.out) if args.out else _default_out(facts["ref"])
+ out.mkdir(parents=True, exist_ok=True)
+ script = out / "script.md"
+ fresh_lines = rc.script_lines(facts)
+ kept_edits = False
+ if script.is_file() and not args.fresh:
+ ref, lines = rc.read_script(script.read_text(encoding="utf-8", errors="replace"))
+ if ref != facts["ref"]:
+ raise ShowtimeError("%s was written for another session" % script,
+ hint="pass another --out, or --fresh to rewrite it for this session")
+ kept_edits = True
+ else:
+ lines = fresh_lines
+ # every line the person wrote (any key whose text recap did not write, or a key recap never writes): the
+ # strict request rule as well as the hard filter; a refused line falls back to recap's own, else goes
+ refused = []
+ for key in list(lines):
+ ln = lines[key]
+ mine = rc.own_line(key, ln["text"], fresh_lines, facts)
+ if mine == "own":
+ continue
+ if mine == "stale": # recap's line with an old 6+ digit count: today's, silently
+ lines[key] = dict(fresh_lines[key])
+ continue
+ if rc.free_text_refused(ln["text"]):
+ refused.append(key)
+ if key in fresh_lines:
+ lines[key] = dict(fresh_lines[key])
+ else:
+ del lines[key]
+ lines, dropped = rc.hard_filter(lines)
+ for key in refused:
+ say("refused %s from script.md: it names a path, host, address, key, a value-like word or a long number "
+ "(the request rule); %s" % (key, "recap's own line is used instead" if key in lines else "left out"))
+ if "hook.title" not in lines: # a title is needed: the facts' own
+ lines["hook.title"] = {"scene": "hook", "kind": "show", "text": rc.facts_title(facts)}
+ lines.move_to_end("hook.title", last=False)
+ if not kept_edits:
+ script.write_text(rc.write_script(lines, facts["ref"], suggestions), encoding="utf-8")
+ (out / "facts.json").write_text(json.dumps(facts, indent=2) + "\n", encoding="utf-8")
+ res = {"script": str(script), "facts": str(out / "facts.json"), "summary": rc.summary(facts),
+ "dropped": dict(dropped), "refused": refused, "lines": len(lines),
+ "kept_script": kept_edits} # True: an existing script.md was read as it is (edited or not)
+ say("recap of %s: %s" % (Path(path).name, res["summary"]))
+ if dropped:
+ say("hard filter: dropped %s" % ", ".join("%d line%s (%s)" % (n, "" if n == 1 else "s", why)
+ for why, n in dropped.items()))
+ if not args.yes or not kept_edits:
+ # a script written in this call is never rendered in it: the person reads it first (also with --yes)
+ res["next"] = "read %s, edit it if you like, then run the same command with --yes" % script
+ res["rendered"] = False
+ if args.json:
+ print_json(res)
+ else:
+ print(script)
+ say("%s %s: every line the film will show or speak. Read it, then rerun with --yes (edit or delete "
+ "lines first if you like).%s" % ("kept your" if kept_edits else "wrote", script,
+ " Nothing was rendered: this call wrote the script." if args.yes
+ else ""))
+ return 0
+ say("using %s as you left it" % script)
+
+ scenes = [s for s in rc.scenes_for(facts) if s == "end" or any(ln["scene"] == s for ln in lines.values())]
+ project = out / "project"
+ if project.exists() and any(project.iterdir()) and not (project / "recap.json").is_file():
+ raise ShowtimeError("%s exists and was not written by recap" % project, hint="pass another --out")
+ project.mkdir(parents=True, exist_ok=True)
+ voice = not args.no_voice and any(ln["kind"] == "say" for ln in lines.values())
+ slots = None
+ if voice:
+ slots = _narrate(rc, facts, lines, scenes, project, args, say)
+ durs = rc.durations(facts, lines, scenes, slots)
+ files = rc.project_files(facts, lines, scenes, durs, aspect=args.aspect, captions=bool(voice), music=args.music,
+ fetch=True, project=project, cut_sounds=args.cut_sounds)
+ rc.write_project(project, files)
+ if voice:
+ cp = _st(["retime", project, "--from-voice", project / "voice" / "timeline.json", "--pad", rc.PAD],
+ quiet=args.json)
+ if cp.returncode != 0:
+ raise ShowtimeError("showtime retime --from-voice failed on %s" % project,
+ hint="run it yourself to see why, or rerun recap with --no-voice")
+ job = _job(out, project)
+ cfg = json.loads((project / "showtime.json").read_text(encoding="utf-8"))
+ res.update({"project": str(project), "duration": cfg.get("duration"), "scenes": scenes, "voice": bool(voice),
+ "music": files["bed"]["label"],
+ "job": str(job)})
+ say("wrote %s: %d scenes, %.1f s%s" % (project, len(scenes), float(cfg.get("duration") or 0),
+ ", narrated" if voice else ""))
+ if args.no_render:
+ if files["bed"]["how"] == "catalog":
+ res["music_note"] = ("the music is fetched when you render (showtime audio music fetch %s now to have it "
+ "cached)" % files["bed"]["id"])
+ if args.json:
+ print_json(res)
+ else:
+ if res.get("music_note"):
+ say("music: %s" % res["music_note"])
+ print(project)
+ return 0
+ from .cli_release import _render_pr
+ from . import bed
+ bed.ensure(project / "audio" / "mix.json", files["bed"])
+ res["music"] = files["bed"]["label"]
+ say("music: %s" % files["bed"]["label"])
+ stem = "recap-9x16" if args.aspect == "9:16" else "recap"
+ video = _render_pr(project, out / (stem + ".mp4"), preview=args.preview, quiet=args.json)
+ from .job import ledger
+ kind = "preview" if args.preview else "final"
+ ledger.note(job, outputs=["%s=%s" % (kind, video)], event="recap: %s is the latest %s" % (video.name, kind))
+ cp = _st(["qa", video, "--project", project, "--json"], quiet=True, capture=True)
+ try:
+ q = json.loads(cp.stdout[cp.stdout.index("{"):])
+ verdict = q.get("verdict") or ("FAIL" if cp.returncode else "PASS")
+ res["qa"] = {"verdict": verdict, "findings": [
+ {"severity": f.get("severity"), "rule": f.get("rule"), "t": f.get("t"), "message": f.get("message")}
+ for f in (q.get("findings") or []) if f.get("severity") in ("WARN", "FAIL")][:12]}
+ except (ValueError, AttributeError):
+ res["qa"] = {"verdict": "FAIL" if cp.returncode else "?"}
+ res["video"] = str(video)
+ owed = bed.credit_report(video, files["bed"])
+ if owed["credits"]:
+ res.update({"credits": owed["credits"], "share": owed["share"], "credit_notes": owed["notes"]})
+ from .pr_video import remove_work
+ remove_work(video) # the render's work folder (stems, absolute local paths), once qa ran
+ if args.json:
+ print_json(res)
+ return 0 if cp.returncode == 0 else 1
+ print(video)
+ if owed["credits"]:
+ say("credits %s (the music needs its credit where you post the video)" % owed["credits"])
+ for n in owed["notes"]:
+ say("note: " + n)
+ say("qa %s%s" % (res["qa"]["verdict"], ": " + "; ".join("%s %s" % (f["severity"], f["rule"]) for f in
+ res["qa"].get("findings") or []) if res["qa"].get("findings") else ""))
+ return 0 if cp.returncode == 0 else 1
+
+
+def _narrate(rc, facts, lines, scenes, project: Path, args, say) -> dict:
+ """voice/narration.md -> showtime voice script; then, when a scene needs longer than its line, the same
+ script again with a pause after that line (only the timeline changes: the lines come from the cache).
+ Returns {scene: slot seconds}."""
+ vdir = project / "voice"
+ vdir.mkdir(parents=True, exist_ok=True)
+ md = vdir / "narration.md"
+ pauses: dict = {}
+ for attempt in range(2):
+ md.write_text(rc.narration_md(lines, scenes, voice=args.voice, pauses=pauses), encoding="utf-8")
+ cp = _st(["voice", "script", md, "-o", vdir], quiet=True, capture=True)
+ tl_path = vdir / "timeline.json"
+ if cp.returncode != 0 or not tl_path.is_file():
+ raise ShowtimeError("the narration could not be made (showtime voice script failed)",
+ hint="run `showtime doctor` (the voice needs `showtime setup`), or rerun with --no-voice")
+ tl = json.loads(tl_path.read_text(encoding="utf-8"))
+ speech = {ln["id"]: float(ln.get("duration") or (ln["end"] - ln["start"])) for ln in tl.get("lines", [])}
+ slots = {ln["id"]: float(ln["slot"].get("duration") or 0) for ln in tl.get("lines", [])}
+ more = rc.extra_pauses(facts, lines, scenes, speech)
+ if attempt == 0 and any(abs(more.get(s, 0) - pauses.get(s, 0)) > 0.05 for s in set(more) | set(pauses)):
+ pauses = more
+ continue
+ break
+ say("narration: %d lines, %.1f s (%s)" % (len(slots), float(tl.get("duration") or 0), args.voice))
+ return slots
+
+
+def _default_out(ref: str) -> Path:
+ """showtime-out/recap-<ref> (stable per session, so the --yes call finds the script the first call wrote),
+ under $SHOWTIME_OUT or the current folder. Refused when git would track it: recap's files hold the session's
+ facts and should never be committed by accident."""
+ base = Path(os.environ.get("SHOWTIME_OUT") or Path.cwd())
+ root = base if base.name == "showtime-out" else base / "showtime-out"
+ out = root / ("recap-" + ref)
+ probe = (out / "script.md").absolute()
+ near = out.absolute() # git runs from the nearest folder that exists (SHOWTIME_OUT may not yet)
+ while not near.is_dir() and near.parent != near:
+ near = near.parent
+ try:
+ cp = subprocess.run(["git", "-C", str(near), "rev-parse", "--is-inside-work-tree"], stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL, encoding="utf-8", timeout=30)
+ in_repo = cp.returncode == 0 and cp.stdout.strip() == "true"
+ ignored = in_repo and subprocess.run(["git", "-C", str(near), "check-ignore", "-q", "--no-index",
+ str(probe)],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
+ timeout=30).returncode == 0
+ except (OSError, subprocess.TimeoutExpired):
+ in_repo, ignored = False, False
+ if in_repo and not ignored:
+ raise ShowtimeError("the default output folder %s is inside a git repository that would track it" % out,
+ why="recap's files hold the session's facts; they should never be committed by accident",
+ hint="pass --out <a folder outside the repository>, set SHOWTIME_OUT, or add "
+ "showtime-out/ to the repository's .gitignore")
+ return out
+
+
+def _job(out: Path, project: Path) -> Path:
+ """The output folder is recap's own job (so `showtime qa <out>` and the receipt find the video, and the
+ render never logs into a job above it)."""
+ from .job import ledger
+ o = out.resolve()
+ if ledger.enclosing_job(o) == o:
+ return o
+ data = ledger.new_data(o.name or "recap", "quick", "showtime recap: a short film of what an agent did in a "
+ "session", o, project.resolve())
+ data["pointers"]["project"] = str(project.resolve())
+ data["history"][-1]["event"] = "job created by showtime recap"
+ ledger.save(o, data)
+ return o
diff --git a/skills/showtime/lib/st/cli_release.py b/skills/showtime/lib/st/cli_release.py
index 5af222b..3228500 100644
--- a/skills/showtime/lib/st/cli_release.py
+++ b/skills/showtime/lib/st/cli_release.py
@@ -47,6 +47,8 @@ def register(sub: argparse._SubParsersAction) -> None:
p.add_argument("--url", help="URL for the end card (the release page)")
p.add_argument("--aspect", default="16:9", choices=["16:9", "9:16", "1:1", "4:5"])
p.add_argument("--max-items", type=int, default=7, help="lines shown in all (default 7; the rest are counted)")
+ p.add_argument("--cut-sounds", action="store_true",
+ help="a soft swoosh on each scene cut (off by default: a film has no sound on its cuts)")
p.add_argument("--force", action="store_true", help="write into a non-empty folder")
p.add_argument("--json", action="store_true", help="print the result as JSON")
p.set_defaults(func=cmd_release_video)
@@ -89,6 +91,8 @@ def register(sub: argparse._SubParsersAction) -> None:
p.add_argument("--preview", action="store_true", help="fast draft render (<=720p)")
p.add_argument("--keep-work", action="store_true",
help="keep the render's pr-<N>.work folder (audio stems, the intermediate video) after the export")
+ p.add_argument("--cut-sounds", action="store_true",
+ help="a soft swoosh on each scene cut (off by default: a film has no sound on its cuts)")
p.add_argument("--force", action="store_true", help="write into a non-empty project folder")
p.add_argument("--json", action="store_true", help="print the result as JSON")
p.set_defaults(func=cmd_pr_video)
@@ -125,7 +129,8 @@ def cmd_release_video(args: argparse.Namespace) -> int:
p = rv.plan(notes, name=name, version=version, kind=args.kind, max_items=max(1, args.max_items))
try:
res = rv.write_project(Path(args.out), notes, p, install=args.install or "", url=args.url or notes["compare"] or "",
- date=args.date or notes["date"], aspect=args.aspect, force=args.force)
+ date=args.date or notes["date"], aspect=args.aspect, force=args.force,
+ cut_sounds=args.cut_sounds)
except FileExistsError:
raise ShowtimeError("%s is not empty" % args.out, hint="pick a new folder, or pass --force to write into it")
if args.json:
@@ -337,7 +342,8 @@ def cmd_pr_video(args: argparse.Namespace) -> int:
if branch and branch != "HEAD" else "pr")
out, beside = _pr_out(args.out, stem)
try:
- res = pv.write_project(out / "project", p, meta, masked=masked, notes=notes, force=args.force)
+ res = pv.write_project(out / "project", p, meta, masked=masked, notes=notes, force=args.force,
+ cut_sounds=args.cut_sounds)
except FileExistsError:
raise ShowtimeError("%s is not empty" % (out / "project"),
hint="pick another --out, or pass --force to write into it")
diff --git a/skills/showtime/lib/st/cli_repro.py b/skills/showtime/lib/st/cli_repro.py
new file mode 100644
index 0000000..f53fecb
--- /dev/null
+++ b/skills/showtime/lib/st/cli_repro.py
@@ -0,0 +1,465 @@
+"""`showtime repro`: a failing browser test (a Playwright trace, or the command that runs it) -> a short narrated
+video for a bug report or a pull request, with steps.json, captions and a repro.md to paste. The first call writes
+the film's script (script.md) and stops; the person reads it, then `--yes` renders it."""
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import os
+import shlex
+import shutil
+import subprocess
+import sys
+import tempfile
+import time
+from pathlib import Path
+from typing import Optional
+
+from .common import ShowtimeError, print_json
+
+COMMANDS = {
+ "repro": "A failing browser test (a Playwright trace or the test command) -> a short narrated video for a bug report",
+}
+
+_F = argparse.RawDescriptionHelpFormatter
+SCREENSHOTS = "screenshots are shown as captured; --redact does not touch pixels"
+
+
+def register(sub: argparse._SubParsersAction) -> None:
+ p = sub.add_parser("repro", help=COMMANDS["repro"], formatter_class=_F, description=(
+ "A bug report you can watch: turn a failing Playwright test into a short narrated video (10-40 s) of\n"
+ "what it did, step by step on the real page, and exactly where and how it failed.\n\n"
+ "Input: a Playwright trace (the trace.zip `npx playwright test --trace on` or `pytest --tracing on`\n"
+ "writes), or the test command after `--`: showtime turns tracing on for failing tests (--trace\n"
+ "retain-on-failure / --tracing retain-on-failure, with --output in a temporary folder, unless you gave\n"
+ "them), runs it (stopped after --timeout seconds) and films the first failing test's trace.\n\n"
+ "Two calls. The first writes <job>/script.md (every caption, spoken line and on-screen text, and the\n"
+ "masked steps) and stops: nothing is rendered. Read it, edit or delete lines, then run the same command\n"
+ "again with --yes (or `showtime repro --yes <job>`): every line goes through the filters again, then\n"
+ "the film is narrated, rendered and checked (check, render, qa).\n\n"
+ "The film: a title card (test name, file:line, FAILED); each action on its screenshot from the trace\n"
+ "with a cursor and click ripple at the target box, a step counter and a one-line caption; the failing\n"
+ "step slowed down (its source line, expected and received side by side, the error, console errors);\n"
+ "an end card with the command that re-runs it. Long tests keep the first step and the steps before\n"
+ "the failure; the passing steps between them become one \"+ N passing steps\" scene. Narrated by\n"
+ "showtime's local voice (--no-voice: captions only). The music may be a catalog track downloaded once from\n"
+ "its creator's site (nothing is sent; its credit goes into repro.md; --music <style> or SHOWTIME_OFFLINE=1\n"
+ "keeps it fully local).\n\n"
+ "Writes into a job folder (showtime-out/repro-<timestamp>/, or --out): script.md and report.json\n"
+ "(first call); repro.mp4 (16:9, 1080p), repro.srt, repro.poster.jpg, steps.json, repro.md and project/\n"
+ "(--yes). The raw trace is not kept (--keep-trace keeps the run's traces in <job>/work, unfiltered).\n\n"
+ "Privacy: what was typed is never shown or spoken, in any field (\"Type 12 characters into the 'Email'\n"
+ "field\"), and the field is covered in the screenshots from then on; --show-typed shows what was typed\n"
+ "into fields that are not secret (filtered). URLs lose their query string and fragment; paths on the\n"
+ "machine show as their last part; auth headers, NAME=value secrets, e-mail addresses (--show-emails\n"
+ "keeps them) and key-shaped strings are masked; --redact REGEX (repeatable) masks more. Network data\n"
+ "is never shown. Screenshots are shown as captured (--redact does not touch pixels): run the test\n"
+ "with a test account, and watch the film before you post it."),
+ epilog=("Examples:\n"
+ " showtime repro test-results/login-signs-in-chromium/trace.zip # writes script.md, stops\n"
+ " showtime repro test-results/login-signs-in-chromium/trace.zip --yes # after reading it\n"
+ " showtime repro -- npx playwright test tests/login.spec.ts\n"
+ " showtime repro -- pytest tests/test_login.py\n"
+ " showtime repro --yes showtime-out/repro-20261012-101500 --no-voice --preview\n"
+ " showtime repro trace.zip --redact 'acct-[0-9]+' --redact 'staging\\.acme\\.test'\n"
+ " showtime repro --yes --out bug-1234 --no-render # the project, steps.json, repro.md"))
+ p.add_argument("input", nargs="*", metavar="TRACE | JOB | -- COMMAND",
+ help="a trace.zip, the test command after -- (run with tracing on), or with --yes a job folder")
+ p.add_argument("--yes", action="store_true",
+ help="render from the job's script.md as you left it (a call that writes script.md never renders)")
+ p.add_argument("--out", help="job folder (default: showtime-out/repro-<timestamp>/)")
+ p.add_argument("--redact", action="append", default=[], metavar="REGEX",
+ help="mask text matching this regular expression everywhere it would show (repeatable; also "
+ "applied again with --yes)")
+ p.add_argument("--show-typed", action="store_true",
+ help="show what was typed into fields that are not secret (filtered; never spoken)")
+ p.add_argument("--show-emails", action="store_true", help="do not mask e-mail addresses")
+ p.add_argument("--keep-trace", action="store_true",
+ help="keep the run's raw traces in <job>/work/test-results (unfiltered: they hold what was typed)")
+ p.add_argument("--timeout", type=float, default=1800.0, metavar="SECONDS",
+ help="stop the test command after this long (default 1800)")
+ p.add_argument("--no-voice", action="store_true", help="no narration: captions (repro.srt) only")
+ p.add_argument("--voice", metavar="NAME", help="narration voice (default af_heart; showtime voice list)")
+ p.add_argument("--cut-sounds", action="store_true",
+ help="a soft swoosh on each scene cut (off by default: a film has no sound on its cuts)")
+ p.add_argument("--music", metavar="STYLE|ID|none",
+ help="pin the music: a composed style (showtime audio styles), a catalog track id, or none "
+ "(default: chosen from the test, off what the last films used)")
+ p.add_argument("--size", choices=["1080p", "720p"], default="1080p", help="frame size, 16:9 (default 1080p)")
+ p.add_argument("--preview", action="store_true", help="fast draft render (<=720p)")
+ p.add_argument("--no-render", action="store_true", help="with --yes: write the project, steps.json, repro.srt "
+ "and repro.md only")
+ p.add_argument("--keep-work", action="store_true", help="keep the render's work folders (audio stems, check report)")
+ p.add_argument("--json", action="store_true", help="print the result as JSON")
+ p.set_defaults(func=cmd_repro)
+
+
+def _is_command(args: list, argv: Optional[list] = None) -> bool:
+ """A command when `--` was given (argparse drops it) or there is more than one word; else a trace or a job."""
+ argv = sys.argv[1:] if argv is None else argv
+ return "--" in argv or len(args) > 1
+
+
+def _command_line(redact) -> str:
+ """The command line for job.json, with --redact patterns hidden (a pattern can be the secret itself) and
+ the rest redacted."""
+ argv, out, hide = sys.argv[1:], [], False
+ for a in argv:
+ if hide:
+ out.append("<pattern>")
+ hide = False
+ elif a == "--redact":
+ out.append(a)
+ hide = True
+ elif a.startswith("--redact="):
+ out.append("--redact=<pattern>")
+ else:
+ out.append(redact(a))
+ return " ".join(out)[:300]
+
+
+def _job(out_arg, goal: str, redact) -> "tuple[Path, bool]":
+ """The job folder, made once there is something to put in it: --out (a new or empty folder, or a job
+ folder without a repro yet), else a fresh showtime-out/repro-<timestamp>/ (beside the job the current
+ folder is inside, never in it). Returns (the folder, whether this call made it)."""
+ from .job import ledger
+ made = True
+ if out_arg:
+ out = Path(out_arg)
+ if out.exists() and ledger.enclosing_job(out) == out.resolve():
+ if (out / "report.json").exists() or (out / "project").exists():
+ raise ShowtimeError("%s already holds a repro" % out, hint="pick a new --out folder, or add --yes "
+ "to render its script.md")
+ return out, False
+ if out.exists() and any(out.iterdir()):
+ raise ShowtimeError("%s is not empty" % out, hint="pick a new --out folder (renders never overwrite)")
+ out.mkdir(parents=True, exist_ok=True)
+ d, data = out, ledger.new_data("repro", "quick", goal, out.resolve(), None)
+ data["history"][-1]["event"] = "job created by showtime repro"
+ else:
+ here = ledger.enclosing_job(Path.cwd())
+ d, data = ledger.init("repro", goal=goal, base=here.parent if here is not None else None)
+ data["command"] = _command_line(redact)
+ ledger.save(d, data)
+ return d, made
+
+
+def _input_key(inputs: list, is_cmd: bool) -> str:
+ """What the --yes call matches a job by: the trace's content, or the command and the folder it ran in
+ (only the hash is stored)."""
+ h = hashlib.sha1()
+ if is_cmd:
+ h.update(("cmd\0%s\0%s" % (os.getcwd(), "\0".join(inputs))).encode("utf-8", "replace"))
+ else:
+ with open(inputs[0], "rb") as f:
+ for chunk in iter(lambda: f.read(1 << 20), b""):
+ h.update(chunk)
+ return h.hexdigest()
+
+
+def _review_job(args, is_cmd: bool) -> Optional[Path]:
+ """With --yes: the job whose script.md to render (--out, a job folder given, or the newest repro job made
+ from the same trace or command); None when there is none yet (this call writes the script)."""
+ from .job import ledger
+ if args.out:
+ o = Path(args.out)
+ return o if (o / "report.json").is_file() else None
+ if not is_cmd and len(args.input) == 1 and Path(args.input[0]).is_dir():
+ o = Path(args.input[0])
+ if not (o / "report.json").is_file():
+ raise ShowtimeError("%s is not a job showtime repro wrote (no report.json)" % o,
+ hint="pass the trace.zip or the test command first: that call writes script.md")
+ return o
+ if not is_cmd:
+ from . import repro as rp
+ rp.open_trace(Path(args.input[0])).close()
+ key = _input_key(args.input, is_cmd)
+ for j in ledger.list_jobs():
+ try:
+ if json.loads((j / "report.json").read_text(encoding="utf-8")).get("key") == key:
+ return j
+ except (OSError, ValueError):
+ continue
+ return None
+
+
+def _shown_path(p: Path) -> str:
+ """A trace's path as the end card shows it: relative to the current folder when inside it, else its name."""
+ try:
+ rel = os.path.relpath(str(p.resolve()), os.getcwd())
+ except ValueError: # another drive on Windows
+ rel = p.name
+ if rel.startswith(".."):
+ rel = p.name
+ return '"%s"' % rel if " " in rel else rel
+
+
+def _default_voice(name) -> str:
+ if name:
+ return name
+ env = os.environ.get("SHOWTIME_VOICE") or ""
+ return env if env[:1] in ("a", "b") else "af_heart" # the narration is English
+
+
+def _voice(proj: Path, lines: dict, voice: str, quiet: bool) -> dict:
+ """`showtime voice script` on one line per scene -> {scene id: {"dur", "file", "speech": (a, b)}}."""
+ vdir = proj / "voice"
+ vdir.mkdir(parents=True, exist_ok=True)
+ md = "---\nvoice: %s\ngap: 0.3\ntail: 0.3\n---\n" % voice + "".join(
+ "## %s\n%s\n\n" % (sid, text.replace("\n", " ")) for sid, text in lines.items())
+ (vdir / "narration.md").write_text(md, encoding="utf-8")
+ launcher = Path(__file__).resolve().parent / "launcher.py"
+ sys.stdout.flush()
+ cp = subprocess.run([sys.executable, str(launcher), "voice", "script", str(vdir / "narration.md"), "-o", str(vdir),
+ "--no-readback"], stdout=subprocess.DEVNULL if quiet else sys.stderr, stderr=subprocess.PIPE,
+ encoding="utf-8", errors="replace")
+ if cp.returncode != 0 or not (vdir / "timeline.json").is_file():
+ last = [x for x in (cp.stderr or "").splitlines() if x.strip()]
+ raise ShowtimeError("the narration could not be made%s" % (": " + last[-1].strip()[:200] if last else ""),
+ why="showtime voice script failed on the narration (project/voice/narration.md)",
+ hint="showtime doctor checks the voice (showtime setup installs it), or pass --no-voice "
+ "for captions only")
+ tl = json.loads((vdir / "timeline.json").read_text(encoding="utf-8"))
+ out = {}
+ for ln in tl.get("lines") or []:
+ a, b = float(ln.get("start", 0)), float(ln.get("end", 0))
+ out[ln["id"]] = {"dur": float(ln.get("duration", b - a)), "file": "voice/" + ln["file"],
+ "speech": (float(ln.get("speech_start", a)) - a, float(ln.get("speech_end", b)) - a)}
+ return out
+
+
+def cmd_repro(args: argparse.Namespace) -> int:
+ from . import repro as rp
+ if not args.input and not (args.yes and args.out):
+ raise ShowtimeError("no trace or test command given",
+ hint="showtime repro test-results/<test>/trace.zip, or showtime repro -- npx playwright test")
+ say = (lambda *a: None) if args.json else (lambda *a: print(*a, file=sys.stderr))
+ redact = rp.Redactor(args.redact, show_emails=args.show_emails)
+ is_cmd = bool(args.input) and _is_command(args.input)
+ if args.yes:
+ job = _review_job(args, is_cmd)
+ if job is not None:
+ return _render(job, args, redact, say)
+ return _write_script(args, is_cmd, redact, say)
+
+
+def _write_script(args, is_cmd: bool, redact, say) -> int:
+ """The first call: parse the trace (running the command first), make the job, keep the screenshots the film
+ can use, write report.json and script.md, and stop. Nothing is left behind when it fails, and the raw
+ traces of a run are deleted (unless --keep-trace)."""
+ from . import repro as rp
+ tmp = None
+ run = None
+ cmd = list(args.input) if is_cmd else None
+ try:
+ if cmd is not None:
+ tmp = Path(tempfile.mkdtemp(prefix="showtime-repro-"))
+ say("running %s (tracing on for failing tests)" % redact(" ".join(cmd)))
+ run = rp.run_and_find(cmd, tmp / "test-results", timeout=args.timeout)
+ if not run["trace"]:
+ if run["traces"]:
+ raise ShowtimeError("no test failed (%d trace%s written, exit code %d), so there is nothing to "
+ "report" % (len(run["traces"]), "" if len(run["traces"]) == 1 else "s",
+ run["rc"]),
+ hint="run the test that fails, or pass its trace: showtime repro <trace.zip>")
+ if run["runner"] and run["rc"] == 0:
+ raise ShowtimeError("no test failed (exit code 0): tracing was on for failing tests, and no trace "
+ "was written", hint="run the test that fails, or pass its trace.zip")
+ raise ShowtimeError("the command wrote no trace.zip (exit code %d)" % run["rc"],
+ why="showtime adds --trace retain-on-failure (playwright test) or --tracing "
+ "retain-on-failure (pytest) when it recognizes the runner%s, and looks only "
+ "where it told the runner to write" % ("" if run["runner"] else
+ "; it did not recognize this one"),
+ hint="run it as `npx playwright test ...` or `pytest ...`, or turn tracing on "
+ "yourself and pass the trace.zip")
+ trace = Path(run["trace"])
+ if len(run["failing"]) > 1:
+ say("note: %d tests failed; filming the first" % len(run["failing"]))
+ else:
+ trace = Path(args.input[0])
+ if trace.is_dir():
+ raise ShowtimeError("%s is a folder" % trace.name,
+ hint="pass a trace.zip, a test command after --, or with --yes a repro job folder")
+ rp.open_trace(trace).close() # a clear error before anything is made
+ rep = rp.parse(trace, redact, label=trace.parent.name, show_typed=args.show_typed)
+ if rep["failure"] is None:
+ raise ShowtimeError("the trace records no failure: every step passed",
+ hint="showtime repro films a failing test; pass the trace of one that failed")
+ rerun = rp.rerun_command(rep, cmd, redact)
+ key = _input_key(args.input, is_cmd)
+ goal = "showtime repro: %s" % (" ".join(cmd) if cmd else args.input[0])[:200]
+ job, made = _job(args.out, redact(goal), redact)
+ try:
+ rp.keep_shots(trace, rep, job / "shots")
+ in_tmp = tmp is not None and _inside(trace, tmp)
+ viewer = ""
+ if args.keep_trace and tmp is not None:
+ kept = job / "work" / "test-results"
+ shutil.copytree(str(tmp / "test-results"), str(kept))
+ if in_tmp:
+ viewer = _shown_path(kept / trace.relative_to(tmp / "test-results"))
+ elif not in_tmp:
+ viewer = _shown_path(trace)
+ viewer = redact(rp.viewer_command(rep, viewer)) if viewer else ""
+ data = {"generator": "showtime repro", "schema": 1, "key": key, "report": rep, "rerun": rerun,
+ "viewer": viewer}
+ (job / "report.json").write_text(json.dumps(data, indent=1, ensure_ascii=False) + "\n", encoding="utf-8")
+ script = job / "script.md"
+ script.write_text(rp.write_script(rep, rerun, viewer), encoding="utf-8")
+ except BaseException:
+ if made:
+ shutil.rmtree(str(job), ignore_errors=True)
+ else:
+ for name in ("shots", "work/test-results", "report.json", "script.md"):
+ q = job / name
+ shutil.rmtree(str(q), ignore_errors=True) if q.is_dir() else q.unlink() if q.exists() else None
+ raise
+ finally:
+ if tmp is not None:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+ again = "showtime repro --yes %s" % shlex.quote(str(job))
+ res = {"job": str(job), "script": str(script), "rendered": False, "steps": len(rep["steps"]),
+ "failed_step": rep["failure"].get("step"), "test": rep["test"], "masked_values": rep["privacy"]["masked_values"],
+ "next": "read %s, then rerun with --yes (%s)" % (script, again),
+ "privacy": dict(rep["privacy"], screenshots="as captured", raw_trace="kept" if args.keep_trace and tmp
+ else "deleted" if tmp else "not copied"),
+ "run": {"rc": run["rc"], "runner": run["runner"], "failing": len(run["failing"])} if run else None}
+ if args.json:
+ print_json(res)
+ return 0
+ say("%d steps, fails at step %s; %d typed value%s hidden; %s" % (
+ len(rep["steps"]), rep["failure"].get("step") or "?", rep["privacy"]["masked_values"],
+ "" if rep["privacy"]["masked_values"] == 1 else "s", SCREENSHOTS))
+ if args.keep_trace and tmp is not None:
+ say("kept the run's raw traces in %s: they are not filtered (they hold what was typed)" % (job / "work"))
+ say("wrote %s: every line the film will show or speak. Nothing was rendered." % script)
+ print("read %s, then rerun with --yes: %s" % (script, again))
+ return 0
+
+
+def _inside(p: Path, folder: Path) -> bool:
+ try:
+ p.resolve().relative_to(folder.resolve())
+ return True
+ except ValueError:
+ return False
+
+
+def _render(job: Path, args, redact, say) -> int:
+ """The --yes call: the report as script.md leaves it (every line filtered again), then narration, the
+ project, steps.json, repro.srt and repro.md, then check, render and qa."""
+ from . import repro as rp
+ from .cli_release import _render_pr
+ from .job import ledger
+ t_start = time.time()
+ script = job / "script.md"
+ if not script.is_file():
+ raise ShowtimeError("%s has no script.md" % job, hint="run showtime repro without --yes first: it writes it")
+ data = json.loads((job / "report.json").read_text(encoding="utf-8"))
+ rep, rerun, viewer = rp.apply_script(data["report"], data.get("rerun") or "", data.get("viewer") or "",
+ rp.read_script(script.read_text(encoding="utf-8", errors="replace")), redact)
+ say("using %s as you left it; %s" % (script, SCREENSHOTS))
+ proj = job / "project"
+
+ def make_plan(speech=None):
+ p = rp.plan(rep, rerun=rerun, speech=speech)
+ p["viewer"] = viewer
+ return p
+ p = make_plan()
+ lines = rp.narration(rep, p)
+ voice, spans, tracks = {}, None, []
+ if not args.no_voice and lines:
+ name = _default_voice(args.voice)
+ say("narrating %d lines with %s" % (len(lines), name))
+ for _ in range(3): # the voice can change the plan (a longer line, a skip)
+ voice = _voice(proj, lines, name, args.json)
+ p = make_plan({k: v["dur"] for k, v in voice.items()})
+ again = rp.narration(rep, p)
+ if again == lines:
+ break
+ lines = again
+ spans, tracks = {}, []
+ for sc in p["scenes"]:
+ v = voice.get(sc["id"])
+ if v:
+ at = round(sc["start"] + rp.VOICE_PAD, 3)
+ tracks.append({"id": "vo-%s" % sc["id"], "kind": "voice", "file": v["file"], "start": at})
+ spans[sc["id"]] = (at + v["speech"][0], at + v["speech"][1])
+ res = rp.write_project(proj, rep, p, job, size=args.size, voice_tracks=tracks, force=True,
+ music=args.music, fetch=True, cut_sounds=args.cut_sounds)
+ steps = rp.steps_json(rep, p)
+ (job / "steps.json").write_text(json.dumps(steps, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
+ srt = rp.build_srt(p, lines, spans)
+ out = {"job": str(job), "project": res["project"], "duration": p["duration"], "scenes": len(p["scenes"]),
+ "steps": len(rep["steps"]), "shown_steps": p["shown_steps"], "skipped_steps": len(p["skipped_steps"]),
+ "failed_step": (rep["failure"] or {}).get("step"), "test": rep["test"], "steps_json": str(job / "steps.json"),
+ "voice": None if args.no_voice else _default_voice(args.voice),
+ "masked_values": rep["privacy"]["masked_values"], "rendered": not args.no_render,
+ "privacy": dict(rep["privacy"], screenshots="as captured")}
+ say("wrote %s: %d scenes, %.1f s; %d of %d steps shown%s, fails at step %s" % (
+ proj, len(p["scenes"]), p["duration"], p["shown_steps"], len(rep["steps"]),
+ " (%d passing summed up)" % len(p["skipped_steps"]) if p["skipped_steps"] else "",
+ (rep["failure"] or {}).get("step") or "?"))
+ from . import bed
+
+ def credit_line() -> str:
+ item = res["bed"].get("credit") or {}
+ return (item.get("attribution") or "") if item.get("attribution_required") else ""
+ out["music"] = res["bed"]["label"]
+ md_path = job / "repro.md"
+ if args.no_render:
+ (job / "repro.srt").write_text(srt, encoding="utf-8")
+ md_path.write_text(rp.markdown(rep, p, "repro.mp4", credit_line()), encoding="utf-8")
+ out.update({"srt": str(job / "repro.srt"), "markdown": str(md_path)})
+ if res["bed"]["how"] == "catalog":
+ out["music_note"] = ("the music is fetched when you render (showtime audio music fetch %s now to have it "
+ "cached); %s" % (res["bed"]["id"], "its credit is in repro.md" if credit_line() else
+ "no credit is required"))
+ if args.json:
+ print_json(out)
+ else:
+ if out.get("music_note"):
+ say("music: %s" % out["music_note"])
+ print("next: showtime check %s && showtime render %s -o %s" % (proj, proj, job / "repro.mp4"))
+ return 0
+ bed.ensure(proj / "audio" / "mix.json", res["bed"])
+ out["music"] = res["bed"]["label"]
+ video = _render_pr(proj, job / "repro.mp4", preview=args.preview, quiet=args.json)
+ kind = "preview" if args.preview else "final"
+ ledger.note(job, outputs=["%s=%s" % (kind, video)], event="repro: %s is the latest %s" % (video.name, kind))
+ srt_path = video.with_suffix(".srt")
+ srt_path.write_text(srt, encoding="utf-8")
+ md_path.write_text(rp.markdown(rep, p, video.name, credit_line()), encoding="utf-8")
+ owed = bed.credit_report(video, res["bed"])
+ if owed["credits"]:
+ out.update({"credits": owed["credits"], "share": owed["share"], "credit_notes": owed["notes"]})
+ poster = video.with_name(video.stem + ".poster.jpg")
+ if not poster.is_file():
+ from .deliver.poster import extract_frame
+ extract_frame(video, float(res["poster_at"]), poster)
+ from .qa import video as qa
+ verdict = qa.run(video, project=str(proj), quiet=True, sheet=False)
+ if not args.keep_work:
+ from .pr_video import remove_work
+ remove_work(video)
+ shutil.rmtree(str(proj / "work"), ignore_errors=True) # check's report (paths on this machine)
+ elapsed = round(time.time() - t_start, 1)
+ out.update({"video": str(video), "srt": str(srt_path), "poster": str(poster), "markdown": str(md_path),
+ "qa": {"verdict": verdict["verdict"], "summary": verdict.get("summary"),
+ "findings": [{"rule": f.get("rule"), "level": f.get("severity"), "message": f.get("message")}
+ for f in verdict.get("findings", []) if f.get("severity") in ("FAIL", "WARN")]},
+ "seconds": elapsed})
+ if args.json:
+ print_json(out)
+ else:
+ print("video %s (%.1f s)" % (video, p["duration"]))
+ print("steps %s" % (job / "steps.json"))
+ print("report %s (paste into the issue, then drag %s onto its comment line)" % (md_path, video.name))
+ if owed["credits"]:
+ print("credits %s (the music needs its credit in the post: it is in repro.md)" % owed["credits"])
+ for n in owed["notes"]:
+ say("note: " + n)
+ print("qa %s%s" % (verdict["verdict"], "".join("\n %s %s" % (f["level"], f["message"]) for f in out["qa"]["findings"][:6])))
+ say("watch %s before you post it: %s" % (video.name, SCREENSHOTS))
+ return 1 if verdict["verdict"] == "FAIL" else 0
diff --git a/skills/showtime/lib/st/launcher.py b/skills/showtime/lib/st/launcher.py
index cc824aa..c0e0a10 100644
--- a/skills/showtime/lib/st/launcher.py
+++ b/skills/showtime/lib/st/launcher.py
@@ -61,7 +61,7 @@ STDLIB_CLI = ("paths", "new", "retime", "data", "install", "guide", "config")
GROUPS = [
("make", "Make a video from an HTML/canvas project",
["new", "retime", "data", "adopt", "preview", "render", "export", "check", "look", "snap", "score", "motion", "code",
- "server", "manim", "release-video", "pr-video"],
+ "server", "manim", "release-video", "pr-video", "recap", "repro"],
["showtime new dom my-launch --aspect 16:9",
"showtime retime my-launch -d 20 # or --from-voice voice/timeline.json",
"showtime preview my-launch",
@@ -405,6 +405,9 @@ def build_env(home: Path) -> dict:
env.setdefault("PYTHONUTF8", "1")
env.setdefault("PYTHONIOENCODING", "utf-8")
env.update(node_proxy_env(env))
+ # what this added that the user's environment did not have (`showtime repro` runs the user's tests without it)
+ env.setdefault("SHOWTIME_ADDED_ENV", ",".join(sorted(k for k in env if k not in os.environ
+ and not k.startswith("SHOWTIME_"))))
return env
diff --git a/skills/showtime/lib/st/pr_video.py b/skills/showtime/lib/st/pr_video.py
index 415e574..07469f8 100644
--- a/skills/showtime/lib/st/pr_video.py
+++ b/skills/showtime/lib/st/pr_video.py
@@ -950,7 +950,8 @@ def build_page(p: Dict[str, Any]) -> str:
def write_project(out: Path, p: Dict[str, Any], meta: Dict[str, Any], *, masked: Sequence[Dict[str, Any]] = (),
- notes: Sequence[str] = (), fps: int = 30, force: bool = False) -> Dict[str, Any]:
+ notes: Sequence[str] = (), fps: int = 30, force: bool = False,
+ cut_sounds: bool = False) -> Dict[str, Any]:
"""index.html, showtime.json, audio/mix.json and pr.json (what the video was made from, secrets masked)."""
title = " ".join(x for x in (p["name"], p["version"]) if x) or p["title"]
cfg = rv.project_config(p, title=title, aspect=p.get("aspect", "16:9"), fps=fps)
@@ -958,9 +959,9 @@ def write_project(out: Path, p: Dict[str, Any], meta: Dict[str, Any], *, masked:
# flat text and code: CRF 22 looks the same as the default 16 at a third of the size, so the GitHub copy is a
# quality encode well under 10 MB instead of a file padded to the cap
cfg["render"] = {"crf": 22}
- mix = rv.build_mix(p)
- mix["_comment"] = ("Generated by showtime pr-video: a composed bed on the scene starts and a soft swoosh on each "
- "cut; everything is made on this machine.")
+ mix = rv.build_mix(p, cut_sounds=cut_sounds)
+ mix["_comment"] = ("Generated by showtime pr-video: a composed bed on the scene starts%s; everything is made on "
+ "this machine." % (" and a soft swoosh on each cut" if cut_sounds else ""))
src = {"generator": "showtime pr-video",
"pr": {k: v for k, v in meta.items() if k != "files"},
"plan": {k: v for k, v in p.items() if k != "scenes"},
diff --git a/skills/showtime/lib/st/recap.py b/skills/showtime/lib/st/recap.py
new file mode 100644
index 0000000..c65f004
--- /dev/null
+++ b/skills/showtime/lib/st/recap.py
@@ -0,0 +1,2201 @@
+"""A Claude Code session -> a short narrated film of what the agent did (`showtime recap`).
+
+Claude Code keeps every session as JSONL under ~/.claude/projects/<project>/<session>.jsonl (sub-agents under
+<session>/subagents/). A transcript holds everything: assistant text, tool output, memory, system reminders,
+keys printed by mistake, other projects. So recap reads it through an ALLOW-LIST and keeps only:
+
+- a title and hook made from the facts; the request and a sub-agent's description only as commented
+ suggestions in script.md (strictly cleaned; never kept in the facts), film text only if uncommented;
+- tool NAMES and counts; file paths RELATIVE to the repository, for files inside it only;
+- commands as a program name from ALLOWED_PROGRAMS (else "other") with the program's own subcommand
+ (`git commit`, `npm test`); never a script or module path, never any other argument;
+- test runs as counts (passed / failed) read from their output; commits whose printed hash is in this repository's
+ history, and their diff stats from git; durations and timestamps.
+
+Nothing else (assistant text, tool output, reminders, URLs, absolute paths, environment) is on the list: tool
+output is read only to count test results and to find the commits made. A HARD FILTER then drops any line that
+still looks like a key or token (vendor prefixes, long hex or key-like runs, a key name with its value), an
+absolute path, a URL, a host or an e-mail address, before script.md is written and again when it is read back
+(the user may edit it). Filters can miss things, so nothing is rendered until the person has read script.md.
+
+Everything the film shows or speaks is in <out>/script.md, one keyed line each, written before anything is
+rendered. Stdlib only.
+"""
+from __future__ import annotations
+
+import datetime as _dt
+import hashlib
+import json
+import os
+import re
+import shlex
+import unicodedata
+import subprocess
+from collections import Counter, OrderedDict
+from pathlib import Path
+from typing import Any, Dict, Iterator, List, Optional, Sequence, Tuple
+
+from . import bed
+from . import pr_video as pv
+from . import release_video as rv
+from .common import ShowtimeError
+
+# ---------------------------------------------------------------------------
+# finding a transcript
+# ---------------------------------------------------------------------------
+
+
+def claude_dir() -> Path:
+ """Claude Code's config folder (CLAUDE_CONFIG_DIR, else ~/.claude)."""
+ return Path(os.environ.get("CLAUDE_CONFIG_DIR") or (Path.home() / ".claude"))
+
+
+def project_slug(path: Path) -> str:
+ """The folder name Claude Code gives a working directory under projects/ (every non-alphanumeric -> '-')."""
+ return re.sub(r"[^A-Za-z0-9]", "-", str(path))
+
+
+def latest_session(cwd: Path) -> Path:
+ """The newest top-level session transcript of this folder (or of the nearest parent that has one)."""
+ base = claude_dir() / "projects"
+ here = Path(cwd).resolve()
+ for d in [here] + list(here.parents):
+ folder = base / project_slug(d)
+ if folder.is_dir():
+ found = sorted(folder.glob("*.jsonl"), key=lambda p: p.stat().st_mtime, reverse=True)
+ found = [f for f in found if is_transcript(f)]
+ if found:
+ return found[0]
+ raise ShowtimeError("no Claude Code session found for %s" % here.name,
+ why="looked for transcripts under %s/projects/<this folder>/" % "~/.claude",
+ hint="pass the transcript: showtime recap <session.jsonl> (or a session id)")
+
+
+def is_transcript(path: Path, probe: int = 200) -> bool:
+ """Whether a file is a Claude Code transcript: a .jsonl whose first lines include a user or assistant event
+ with a message and the session's ids (Claude Code writes sessionId and uuid on every event)."""
+ path = Path(path)
+ if path.suffix.lower() != ".jsonl" or not path.is_file():
+ return False
+ try:
+ with open(path, encoding="utf-8", errors="replace") as fh:
+ for i, line in enumerate(fh):
+ if i >= probe:
+ break
+ try:
+ d = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(d, dict) and d.get("type") in ("user", "assistant") and \
+ isinstance(d.get("message"), dict) and (d.get("sessionId") or d.get("uuid")):
+ return True
+ except OSError:
+ return False
+ return False
+
+
+def find_session(ref: str) -> Path:
+ """A transcript path, or a session id (or an agent id) looked up under ~/.claude/projects. Anything that is
+ not a Claude Code transcript is refused."""
+ p = Path(ref).expanduser()
+ if p.is_file():
+ if not is_transcript(p):
+ raise ShowtimeError("%s is not a Claude Code session transcript" % p.name,
+ why="recap reads only .jsonl transcripts with Claude Code's user/assistant events",
+ hint="pass a file from ~/.claude/projects/<project>/, a session id, or --latest")
+ return p
+ if re.fullmatch(r"[A-Za-z0-9-]{6,64}", ref or ""):
+ base = claude_dir() / "projects"
+ hits = list(base.glob("*/%s.jsonl" % ref)) + list(base.glob("*/*/subagents/%s.jsonl" % ref)) + \
+ list(base.glob("*/*/subagents/agent-%s.jsonl" % ref))
+ hits = [h for h in hits if is_transcript(h)]
+ if hits:
+ return hits[0]
+ raise ShowtimeError("session transcript not found: %s" % (p.name or ref),
+ hint="pass a .jsonl file from ~/.claude/projects/<project>/, a session id, or --latest")
+
+
+# ---------------------------------------------------------------------------
+# reading: tolerant of unknown event types, versions and broken lines
+# ---------------------------------------------------------------------------
+
+
+def iter_events(path: Path) -> Iterator[Dict[str, Any]]:
+ with open(path, encoding="utf-8", errors="replace") as fh:
+ for line in fh:
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ d = json.loads(line)
+ except ValueError:
+ continue
+ if isinstance(d, dict):
+ yield d
+
+
+def parse_ts(s: Any) -> Optional[float]:
+ if isinstance(s, (int, float)):
+ return float(s) / (1000.0 if s > 1e11 else 1.0)
+ if not isinstance(s, str) or not s:
+ return None
+ try:
+ return _dt.datetime.fromisoformat(s.replace("Z", "+00:00")).timestamp()
+ except ValueError:
+ return None
+
+
+def _blocks(content: Any) -> List[Dict[str, Any]]:
+ if isinstance(content, str):
+ return [{"type": "text", "text": content}]
+ if isinstance(content, list):
+ return [b for b in content if isinstance(b, dict)]
+ return []
+
+
+def _result_text(block: Dict[str, Any]) -> str:
+ c = block.get("content")
+ if isinstance(c, str):
+ return c
+ return "\n".join(str(b.get("text") or "") for b in _blocks(c) if b.get("type") == "text")
+
+
+RESULT_KEEP = 64 * 1024 # the end of a command's output is where runners print their counts
+REQUEST_KEEP = 8 * 1024 # the request's head: everything recap offers from it is in its first sentences
+REQUEST_SCAN = 512 * 1024 # how much of the first message is searched for tagged blocks before the cut
+COMMAND_KEEP = 64 * 1024 # a command line longer than this is cut before it is tokenised
+_NOT_A_REQUEST = re.compile(r"^\s*(<command-|<local-command|<bash-|<task-notification|Caveat:|\[Request interrupted)")
+
+
+def parse_session(path: Path) -> Dict[str, Any]:
+ """The raw material recap may use, kept in memory only (never written): timestamps, working folders, the
+ first request, tool calls with their inputs, and tool results (read only to count tests and commits)."""
+ path = Path(path)
+ ses: Dict[str, Any] = {"path": str(path), "start": None, "end": None, "cwds": Counter(), "request": "",
+ "description": "", "turns": set(), "uses": [], "results": {}, "events": 0,
+ "kind": "session", "times": []}
+ run_ids = set() # tool results are kept only for commands (tests, commits), cut short
+ meta = path.with_name(path.name[:-len(".jsonl")] + ".meta.json") if path.name.endswith(".jsonl") else None
+ if meta is not None and meta.is_file():
+ try:
+ m = json.loads(meta.read_text(encoding="utf-8"))
+ ses["description"] = str(m.get("description") or "") if isinstance(m, dict) else ""
+ except (OSError, ValueError):
+ pass
+ if path.parent.name == "subagents":
+ ses["kind"] = "sub-agent"
+ for d in iter_events(path):
+ ses["events"] += 1
+ ts = parse_ts(d.get("timestamp"))
+ if ts is not None:
+ ses["start"] = ts if ses["start"] is None else min(ses["start"], ts)
+ ses["end"] = ts if ses["end"] is None else max(ses["end"], ts)
+ ses["times"].append(ts)
+ cwd = d.get("cwd") if isinstance(d.get("cwd"), str) else ""
+ if cwd:
+ ses["cwds"][cwd] += 1
+ if d.get("isSidechain") and ses["kind"] == "session" and path.parent.name == "subagents":
+ ses["kind"] = "sub-agent"
+ msg = d.get("message") if isinstance(d.get("message"), dict) else {}
+ typ = d.get("type")
+ if typ == "user":
+ texts = []
+ for b in _blocks(msg.get("content")):
+ if b.get("type") == "tool_result" and b.get("tool_use_id"):
+ if b["tool_use_id"] in run_ids:
+ ses["results"][b["tool_use_id"]] = {"ts": ts, "text": _result_text(b)[-RESULT_KEEP:],
+ "error": bool(b.get("is_error"))}
+ elif b["tool_use_id"]:
+ ses["results"][b["tool_use_id"]] = {"ts": ts, "text": "", "error": bool(b.get("is_error"))}
+ elif b.get("type") == "text":
+ t = str(b.get("text") or "")
+ if t.strip() and not _NOT_A_REQUEST.match(t):
+ texts.append(t)
+ # text blocks that are wrappers (they start with a block-style tag) go whole; then tagged blocks
+ # (however long); then the cut: only the request's first sentences are offered
+ texts = [x for x in texts if not _WRAPPER_BLOCK.match(x)]
+ joined = _strip_tags("\n\n".join(texts))[:REQUEST_KEEP] if texts and not ses["request"] else ""
+ if joined.strip() and not d.get("isMeta") and not d.get("isCompactSummary") and \
+ not d.get("isVisibleInTranscriptOnly"):
+ ses["request"] = joined
+ elif typ == "assistant":
+ mid = msg.get("id") or d.get("requestId") or d.get("uuid")
+ if mid:
+ ses["turns"].add(mid)
+ for b in _blocks(msg.get("content")):
+ if b.get("type") in ("tool_use", "server_tool_use") and b.get("name"):
+ ses["uses"].append({"ts": ts, "id": b.get("id") or "", "name": str(b["name"]), "cwd": cwd,
+ "input": b.get("input") if isinstance(b.get("input"), dict) else {}})
+ if str(b["name"]) in RUN_TOOLS and b.get("id"):
+ run_ids.add(b["id"])
+ if not ses["events"]:
+ raise ShowtimeError("%s has no readable events" % path.name,
+ hint="pass a Claude Code session transcript (.jsonl, one JSON event per line)")
+ return ses
+
+
+# ---------------------------------------------------------------------------
+# the repository: which absolute paths are "inside", and their relative names
+# ---------------------------------------------------------------------------
+
+
+def _git(args: Sequence[str], cwd: Optional[str] = None, timeout: int = 60) -> Tuple[int, str]:
+ try:
+ cp = subprocess.run(["git"] + list(args), cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+ encoding="utf-8", errors="replace", timeout=timeout)
+ except (OSError, subprocess.TimeoutExpired):
+ return 1, ""
+ return cp.returncode, cp.stdout
+
+
+def git_toplevel(path: str) -> Optional[str]:
+ if not path or not os.path.isdir(path):
+ return None
+ rc, out = _git(["rev-parse", "--show-toplevel"], cwd=path)
+ return _norm(out.strip()) if rc == 0 and out.strip() else None
+
+
+def _common_dir(top: str) -> str:
+ rc, out = _git(["rev-parse", "--path-format=absolute", "--git-common-dir"], cwd=top)
+ return _norm(out.strip()) if rc == 0 else ""
+
+
+def _norm(p: str) -> str:
+ p = (p or "").replace("\\", "/")
+ if re.match(r"^[A-Za-z]:/", p):
+ p = p[0].lower() + p[1:]
+ return os.path.normpath(p).replace("\\", "/") if p else p
+
+
+_WORKTREE = re.compile(r"^(.*?/(?:\.claude/worktrees|\.worktrees|worktrees)/[^/]+)(?:/|$)")
+
+
+def repo_roots(ses: Dict[str, Any], repo: Optional[str] = None) -> Tuple[str, List[str]]:
+ """(the repository's top folder, every root a session path may sit under). The roots are the repository,
+ and the session's own working trees when they belong to it (a git worktree of the same repository, or a
+ worktree folder inside it that has since been removed)."""
+ if repo:
+ top = git_toplevel(os.path.abspath(os.path.expanduser(repo)))
+ if not top:
+ raise ShowtimeError("--repo %s is not a git repository" % Path(repo).name,
+ hint="pass the folder of the repository the session worked in")
+ else:
+ cwd = ses["cwds"].most_common(1)[0][0] if ses["cwds"] else ""
+ top = git_toplevel(cwd)
+ if not top:
+ raise ShowtimeError("the session's working folder is not a git repository here (or no longer exists)",
+ why="recap shows only files inside one repository, as paths relative to it",
+ hint="pass --repo <the repository folder>")
+ roots = [top]
+ common = _common_dir(top)
+ for cwd in ses["cwds"]:
+ c = _real(cwd)
+ if os.path.isdir(c):
+ t = git_toplevel(c)
+ if t and t not in roots and common and _common_dir(t) == common:
+ roots.append(t)
+ elif c.startswith(top + "/"):
+ m = _WORKTREE.match(c) # a worktree under the repository that has since been removed
+ if m and m.group(1) not in roots:
+ roots.append(m.group(1))
+ roots.sort(key=len, reverse=True)
+ return top, roots
+
+
+def _real(p: str) -> str:
+ """The path with symlinked folders resolved (/tmp -> /private/tmp), as git reports its folders."""
+ p = _norm(p)
+ if p.startswith("/") and os.name != "nt":
+ try:
+ return _norm(os.path.realpath(p))
+ except (OSError, ValueError):
+ return p
+ return p
+
+
+def inside(p: str, roots: Sequence[str]) -> bool:
+ """Whether an absolute folder or file lies inside one of the roots (symlinks resolved)."""
+ if not p:
+ return False
+ for q in {_norm(p), _real(p)}:
+ if any(q == r or q.startswith(r + "/") for r in roots):
+ return True
+ return False
+
+
+def rel_path(p: Any, roots: Sequence[str], cwd: str = "") -> Optional[str]:
+ """The path relative to the repository when it is inside one of `roots`, else None. Secret files (.env,
+ keys) and the .git folder count as outside."""
+ if not isinstance(p, str) or not p.strip():
+ return None
+ p = p.strip().replace("\\", "/")
+ if p.startswith("~"):
+ return None
+ if not (p.startswith("/") or re.match(r"^[A-Za-z]:/", p)):
+ if not cwd:
+ return None
+ p = cwd.replace("\\", "/").rstrip("/") + "/" + p
+ for q in dict.fromkeys([_norm(p), _real(p)]):
+ for r in roots:
+ if q.startswith(r + "/"):
+ rel = q[len(r) + 1:]
+ rel = re.sub(r"^(?:\.claude/worktrees|\.worktrees)/[^/]+/", "", rel)
+ return rel if _repo_file_ok(rel) and rel != ".git" else None
+ return None
+
+
+_SAFE_REL = re.compile(r"^[\w.@+-]+(?:/[\w.@+ -]+)*$")
+
+
+def _repo_file_ok(rel: str) -> bool:
+ return bool(rel) and not rel.startswith(("../", ".git/")) and not pv.is_secret_file(rel) and bool(_SAFE_REL.match(rel))
+
+# ---------------------------------------------------------------------------
+# commands: program + subcommand, nothing else
+# ---------------------------------------------------------------------------
+
+# a program's own subcommands (never an alias, plugin, extension or target the user named)
+_W = lambda s: set(s.split()) # noqa: E731
+KNOWN_SUBCOMMANDS: Dict[str, set] = {
+ "git": _W("add am apply archive bisect blame branch bundle checkout cherry-pick clean clone commit config describe "
+ "diff fetch format-patch gc grep init log ls-files ls-remote ls-tree merge merge-base mv notes pull push "
+ "range-diff rebase reflog remote reset restore rev-list rev-parse revert rm shortlog show show-ref stash "
+ "status submodule switch tag worktree cat-file hash-object update-index for-each-ref name-rev"),
+ "gh": _W("api auth browse cache codespace extension gist issue label pr release repo ruleset run search secret "
+ "status variable workflow"),
+ "npm": _W("ci install i uninstall update test run exec init pack publish version ls audit outdated start build "
+ "link prune rebuild view"),
+ "pnpm": _W("install i add remove update test run exec dlx build start"),
+ "yarn": _W("install add remove upgrade test run exec dlx build start"),
+ "bun": _W("install add remove update test run x build"),
+ "pip": _W("install uninstall list show freeze download wheel check"),
+ "pip3": _W("install uninstall list show freeze download wheel check"),
+ "uv": _W("pip run sync lock add remove venv tool python init build"),
+ "poetry": _W("install add remove update lock run build publish show check init"),
+ "cargo": _W("build check test run bench clean doc fmt clippy add remove update install publish nextest tree"),
+ "go": _W("build test run vet fmt get install mod generate clean list tool version env work"),
+ "docker": _W("build run exec ps images pull push compose logs stop start rm rmi inspect tag network volume"),
+ "brew": _W("install uninstall upgrade update list info search doctor"),
+ "dotnet": _W("build test run restore publish new add clean pack"),
+ "deno": _W("run test fmt lint check compile task cache"),
+ "conda": _W("install create activate list env update remove"),
+ "rustup": _W("update install default toolchain component target show"),
+ "swift": _W("build test run package"),
+ "kubectl": _W("get describe apply delete logs exec rollout create edit scale port-forward"),
+ "helm": _W("install upgrade uninstall list template lint repo dependency"),
+ "terraform": _W("init plan apply destroy validate fmt output state"),
+}
+# programs whose next word is the user's own (a make target, a rake task): only generic ones show
+USER_TARGETS = {"make", "rake", "mix", "gradle", "mvn", "bundle", "just", "task"}
+GENERIC_TARGETS = _W("test tests check build lint install clean all run exec format fmt dev release compile package "
+ "verify deps setup docs serve start")
+INTERPRETERS = {"python", "python3", "node", "bash", "sh", "zsh", "ruby", "perl", "php", "tsx", "ts-node", "deno"}
+WRAPPERS = {"sudo", "time", "nice", "nohup", "env", "command", "exec", "caffeinate", "xargs"}
+NOT_COUNTED = {"cd", "export", "set", "unset", "source", ".", "true", "false", ":", "pushd", "popd", "wait", "local",
+ "declare", "trap", "shopt", "alias", "then", "else", "fi", "do", "done", "esac", "if", "for", "while",
+ "case", "in", "{", "}", "(", ")", "!", "function", "return", "break", "continue"}
+_PROGRAM = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$")
+_SUBCMD = re.compile(r"^[a-z][a-z0-9-]{0,24}$")
+_HEREDOC = re.compile(r"(?<!<)<<-?(?!<)\s*(['\"]?)([A-Za-z_]\w*)\1")
+_SEPARATORS = {"&&", "||", ";", "|", "&", ";;", "|&", "(", ")"}
+
+
+def _showtime_commands() -> set:
+ """showtime's own commands (read from the cli modules without importing them), for `showtime <command>`."""
+ out = {"setup", "doctor", "version", "mcp", "help"}
+ try:
+ from .cli import discover, read_commands
+ for _name, path in discover():
+ out |= set(read_commands(path))
+ scripts = Path(__file__).resolve().parents[2] / "scripts" # the node commands (render, check, ...)
+ out |= {f.stem for f in scripts.glob("*.mjs") if not f.name.startswith("_")}
+ except Exception: # noqa: BLE001 - a label is never worth a crash
+ pass
+ return out
+
+
+def _strip_heredocs(cmd: str) -> str:
+ """Drop heredoc bodies (inline scripts): they are data for the program, not commands."""
+ out: List[str] = []
+ lines = cmd.replace("\r\n", "\n").split("\n")
+ i = 0
+ while i < len(lines):
+ line = lines[i]
+ m = _HEREDOC.search(line)
+ out.append(line[:m.start()] if m else line)
+ i += 1
+ if m:
+ end = m.group(2)
+ while i < len(lines) and lines[i].strip() != end:
+ i += 1
+ i += 1
+ return "\n".join(out)
+
+
+def _segments(cmd: str) -> List[List[str]]:
+ text = _strip_heredocs((cmd or "")[:COMMAND_KEEP])
+ # backslashes are kept (Windows paths), so a drive-letter folder is still recognisable as one
+ text = text.replace("\\", "/")
+ try:
+ lex = shlex.shlex(text.replace("\n", " ; "), posix=True, punctuation_chars=True)
+ lex.whitespace_split = True
+ toks = list(lex)
+ except ValueError:
+ toks = []
+ for part in re.split(r"&&|\|\||[;|\n&]", text):
+ toks += part.split() + [";"]
+ segs: List[List[str]] = [[]]
+ skip = False
+ for t in toks:
+ if skip:
+ skip = False
+ continue
+ if t in _SEPARATORS:
+ if segs[-1]:
+ segs.append([])
+ continue
+ if t and set(t) <= set("&|;()<>"): # a redirection: drop it and its target (2>/dev/null)
+ if segs[-1] and segs[-1][-1].isdigit():
+ segs[-1].pop()
+ skip = not t.endswith("&") or t == ">&"
+ continue
+ segs[-1].append(t)
+ return [s for s in segs if s]
+
+
+def _strip_wrappers(toks: List[str]) -> List[str]:
+ while toks and (re.match(r"^[A-Za-z_]\w*=", toks[0]) or toks[0] in WRAPPERS or toks[0] == "timeout"):
+ if toks[0] == "timeout":
+ toks = toks[1:]
+ while toks and (toks[0].startswith("-") or re.match(r"^\d+(\.\d+)?[smhd]?$", toks[0])):
+ toks = toks[1:]
+ continue
+ if toks[0] in ("sudo", "env", "nice"): # their own options (sudo -u user, env -i, nice -n 10)
+ rest = toks[1:]
+ while rest and rest[0].startswith("-"):
+ rest = rest[2:] if rest[0] in ("-u", "-g", "-n", "-C", "-S") and len(rest) > 1 else rest[1:]
+ toks = rest
+ continue
+ toks = toks[1:]
+ return toks
+
+
+# Programs whose names may be shown: the only place this list lives. Anything else counts as "other" (a client's
+# CLI on PATH, a script of the user's own, a PowerShell function): a program's name can be private too.
+COMMON_TOOLS = _W("ls cat grep egrep fgrep rg ag sed awk find fd curl wget jq yq ffmpeg ffprobe head tail wc sort uniq "
+ "cut tr tee xargs diff cmp echo printf mkdir rmdir rm cp mv ln touch chmod chown du df tar zip unzip "
+ "gzip gunzip which file stat basename dirname realpath readlink date sleep ps kill pkill pgrep top "
+ "ssh scp rsync open less more vim vi nano code tmux screen sqlite3 psql mysql redis-cli openssl "
+ "cmake ninja gcc g++ clang clang++ rustc javac java tsc eslint prettier ruff black mypy flake8 isort "
+ "pylint pyright hatch pdm pipenv rye pwsh powershell fish apt apt-get dnf yum pacman node npx pnpx "
+ "bunx gradlew ant sbt lein clj elixir erl ghc stack cabal zig nim crystal lua luajit julia R Rscript "
+ "xcodebuild xcrun swiftc adb emulator flutter dart kotlinc magick convert identify sox whisper "
+ "pandoc latexmk pdflatex dot gs exiftool watch timeout nc dig host ping traceroute lsof killall "
+ "base64 sha256sum shasum md5 md5sum xxd hexdump strings nm otool ldd")
+RUNNER_MODULES = _W("pytest unittest pip venv doctest coverage tox nox build twine") # python -m <these> only
+ALLOWED_PROGRAMS = (set(KNOWN_SUBCOMMANDS) | INTERPRETERS | USER_TARGETS | COMMON_TOOLS | {"showtime"} |
+ {"pytest", "py.test", "jest", "vitest", "mocha", "rspec", "tox", "nox", "phpunit", "ctest", "ava",
+ "tap"})
+OTHER = "other"
+
+
+def _program(tok: str) -> str:
+ prog = tok.replace("\\", "/").rsplit("/", 1)[-1]
+ prog = re.sub(r"^(python3?)\.\d+$", r"\1", prog)
+ return re.sub(r"\.(exe|cmd|bat)$", "", prog, flags=re.I)
+
+
+def command_labels(cmd: str, *, cwd: str = "", roots: Sequence[str] = ()) -> List[str]:
+ """`cd x && FOO=1 python3 tests/run_all.py -k y | tail -3` -> ['python3', 'tail'].
+
+ A program's name only when it is on ALLOWED_PROGRAMS (by its file name: ~/.venv/bin/python3.12 is python3),
+ a subcommand the program itself defines (`git commit`; never an alias, plugin or extension; a make target only
+ when generic), and `-m <module>` only for the runner modules (python -m pytest). Never a script or module path
+ of the user's own, whatever folder the command runs in; every other program counts as "other"."""
+ labels: List[str] = []
+ st_cmds = None
+ for seg in _segments(cmd):
+ toks = _strip_wrappers(_strip_builtins(list(seg)))
+ if not toks or toks[0] in FOLDER_CHANGERS:
+ continue
+ prog = _program(toks[0])
+ if prog in NOT_COUNTED:
+ continue
+ if prog not in ALLOWED_PROGRAMS or not _PROGRAM.match(prog):
+ labels.append(OTHER)
+ continue
+ rest = toks[1:]
+ label = prog
+ if prog in KNOWN_SUBCOMMANDS or prog == "showtime":
+ while rest and prog == "git" and rest[0] in ("-C", "-c", "--git-dir", "--work-tree") and len(rest) > 1:
+ rest = rest[2:]
+ while rest and rest[0] in ("--no-pager", "--paginate", "-P"):
+ rest = rest[1:]
+ if prog == "showtime" and st_cmds is None:
+ st_cmds = _showtime_commands()
+ known = st_cmds if prog == "showtime" else KNOWN_SUBCOMMANDS[prog]
+ if rest and _SUBCMD.match(rest[0]) and rest[0] in known:
+ label = "%s %s" % (prog, rest[0])
+ elif prog in USER_TARGETS:
+ if rest and rest[0] in GENERIC_TARGETS:
+ label = "%s %s" % (prog, rest[0])
+ elif prog in ("python", "python3"):
+ args = [a for a in rest if a != "-u" and not re.match(r"^-[BIOEsSuWX]+$", a)]
+ if len(args) >= 2 and args[0] == "-m" and args[1] in RUNNER_MODULES:
+ label = "%s -m %s" % (prog, args[1])
+ labels.append(label)
+ return labels
+
+
+# folder changes: not programs, never shown or counted
+FOLDER_CHANGERS = {"cd", "pushd", "popd", "chdir", "Set-Location", "Push-Location", "Pop-Location", "sl", "z", "zoxide",
+ "j", "autojump"}
+
+
+def _strip_builtins(toks: List[str]) -> List[str]:
+ while toks and toks[0] in ("command", "builtin", "{", "}", "then", "do", "else", "!", "exec", "noglob"):
+ toks = toks[1:]
+ return toks
+
+
+# ---------------------------------------------------------------------------
+# tests: which commands ran tests, and their counts
+# ---------------------------------------------------------------------------
+
+RUNNERS = {"pytest", "py.test", "jest", "vitest", "mocha", "rspec", "tox", "nox", "phpunit", "ctest", "ava", "tap"}
+_NOT_A_RUN = {"--version", "-V", "--help", "-h", "--collect-only", "--co", "--list", "--listTests"}
+_LAUNCHERS = {"npx", "bunx", "pnpx"} # npx <tool> ...
+_RUN_VIA = {("uv", "run"), ("poetry", "run"), ("bundle", "exec"), ("pnpm", "exec"), ("yarn", "dlx"), ("pnpm", "dlx"),
+ ("hatch", "run"), ("pdm", "run"), ("pipenv", "run"), ("rye", "run")}
+_SSH_OPTS_WITH_ARG = set("bcDEeFIiJLlmOopQRSWw")
+
+
+def _is_test_segment(toks: List[str], depth: int = 0) -> bool:
+ """A test runner in the program position (after wrappers and launchers such as npx or uv run)."""
+ toks = _strip_wrappers(list(toks))
+ if not toks or depth > 4:
+ return False
+ prog = toks[0].rsplit("/", 1)[-1]
+ prog = re.sub(r"^(python3?)\.\d+$", r"\1", prog)
+ rest = toks[1:]
+ if any(a in _NOT_A_RUN for a in rest):
+ return False
+ if prog in _LAUNCHERS:
+ while rest and rest[0].startswith("-"):
+ rest = rest[1:]
+ return _is_test_segment(rest, depth + 1)
+ if rest and (prog, rest[0]) in _RUN_VIA:
+ return _is_test_segment(rest[1:], depth + 1)
+ if prog == "docker" and len(rest) >= 3 and rest[0] == "exec":
+ i = 1
+ while i < len(rest) and rest[i].startswith("-"):
+ i += 1
+ return _is_test_segment(rest[i + 1:], depth + 1)
+ if prog in RUNNERS:
+ return True
+ if prog in ("python", "python3"):
+ args = [a for a in rest if not re.match(r"^-[BIOEsSuWX]+$", a)]
+ if len(args) >= 2 and args[0] == "-m":
+ return args[1] in ("pytest", "unittest")
+ return bool(args) and bool(re.search(r"(^|/)(run_all\.py|test_[\w-]+\.py|[\w-]+_test\.py)$", args[0]))
+ if prog == "node":
+ return "--test" in rest or bool(rest and re.search(r"(^|/)(test_[\w-]+|[\w-]+\.test)\.(js|mjs|cjs)$", rest[0]))
+ if prog in ("npm", "pnpm", "yarn", "bun"):
+ return bool(rest) and (rest[0] in ("test", "t") or (rest[0] == "run" and len(rest) > 1 and
+ rest[1].split(":")[0] == "test"))
+ if prog in ("go", "deno", "dotnet", "swift", "mix") or prog in ("mvn", "gradle", "gradlew"):
+ return bool(rest) and rest[0] == "test"
+ if prog == "cargo":
+ return bool(rest) and rest[0] in ("test", "nextest")
+ if prog == "make":
+ return bool(rest) and rest[0] in ("test", "tests", "check")
+ return False
+
+
+def _runner_texts(cmd: str, depth: int = 0) -> Iterator[List[str]]:
+ """The command's segments, with the remote command of ssh and the script of bash -c opened."""
+ for seg in _segments(cmd):
+ toks = _strip_wrappers(list(seg))
+ if not toks:
+ continue
+ prog = toks[0].rsplit("/", 1)[-1]
+ if depth < 3 and prog == "ssh":
+ rest, i = toks[1:], 0
+ while i < len(rest) and rest[i].startswith("-"):
+ i += 2 if (len(rest[i]) == 2 and rest[i][1] in _SSH_OPTS_WITH_ARG) else 1
+ for x in _runner_texts(" ".join(rest[i + 1:]), depth + 1):
+ yield x
+ continue
+ if depth < 3 and prog in ("bash", "sh", "zsh") and "-c" in toks[1:-1]:
+ for x in _runner_texts(toks[toks.index("-c") + 1], depth + 1):
+ yield x
+ continue
+ yield toks
+
+
+def is_test_command(cmd: str) -> bool:
+ return any(_is_test_segment(t) for t in _runner_texts(cmd or ""))
+
+
+def test_counts(text: str) -> Optional[Dict[str, Any]]:
+ """Counts from a test runner's output: {passed, failed, unit} (summed when one output holds several
+ runs), or None when it shows none."""
+ text = text or ""
+ passed = failed = 0
+ unit = ""
+ for m in re.finditer(r"\b(\d+)/(\d+) test files passed\b", text): # showtime's run_all.py
+ p, n = int(m.group(1)), int(m.group(2))
+ passed, failed, unit = passed + p, failed + max(0, n - p), "test files"
+ if not unit:
+ for m in re.finditer(r"^Ran (\d+) tests? in [\d.]+s\s*\n+\s*(OK|FAILED)\b(?:\s*\(([^)]*)\))?", text, re.M):
+ n = int(m.group(1))
+ f = sum(int(x) for x in re.findall(r"(?:failures|errors)=(\d+)", m.group(3) or ""))
+ s = sum(int(x) for x in re.findall(r"skipped=(\d+)", m.group(3) or ""))
+ passed, failed, unit = passed + max(0, n - f - s), failed + f, "tests"
+ if not unit:
+ for m in re.finditer(r"^=+ ([^\n]{0,400}?\b(?:passed|failed|error|errors)\b[^\n]{0,400}?) in [\d.]+s",
+ text, re.M): # pytest
+ s = m.group(1)
+ passed += sum(int(x) for x in re.findall(r"(\d+) passed", s))
+ failed += sum(int(x) for x in re.findall(r"(\d+) (?:failed|errors?)\b", s))
+ unit = "tests"
+ if not unit:
+ for m in re.finditer(r"^Tests:[ \t]+([^\n]{0,400}?)(\d+) total", text, re.M): # jest / vitest
+ passed += sum(int(x) for x in re.findall(r"(\d+) passed", m.group(1)))
+ failed += sum(int(x) for x in re.findall(r"(\d+) failed", m.group(1)))
+ unit = "tests"
+ if not unit:
+ for m in re.finditer(r"test result: (?:ok|FAILED)\. (\d+) passed; (\d+) failed", text): # cargo
+ passed, failed, unit = passed + int(m.group(1)), failed + int(m.group(2)), "tests"
+ if not unit:
+ ps = re.findall(r"^(?:#|ℹ)\s*pass (\d+)", text, re.M) # node --test
+ fs = re.findall(r"^(?:#|ℹ)\s*fail (\d+)", text, re.M)
+ if ps or fs:
+ passed, failed, unit = sum(map(int, ps)), sum(map(int, fs)), "tests"
+ if not unit:
+ oks = len(re.findall(r"^ok\s+\S+", text, re.M)) # go test
+ fails = len(re.findall(r"^FAIL\s+\S+", text, re.M))
+ if oks or fails:
+ passed, failed, unit = oks, fails, "packages"
+ if not unit:
+ for m in re.finditer(r"\bpass(?:ed)?[ :=]+(\d+)[,;]?\s+fail(?:ed|ures?)?[ :=]+(\d+)", text, re.I):
+ passed, failed, unit = passed + int(m.group(1)), failed + int(m.group(2)), "runs"
+ if not unit:
+ oks = len(re.findall(r"^OK\b", text, re.M)) # unittest, its counts cut off
+ bad = re.findall(r"^FAILED \(([^)]*)\)", text, re.M)
+ if oks or bad:
+ return {"passed": None, "failed": None, "unit": "", "status": "fail" if bad else "ok"}
+ return None
+ return {"passed": passed, "failed": failed, "unit": unit}
+
+
+_COMMIT_SHA = re.compile(r"^\[[^\]\n]*?\s([0-9a-f]{7,40})\]", re.M)
+
+# ---------------------------------------------------------------------------
+# the hard filter: after the allow-list, on every line shown, spoken or written
+# ---------------------------------------------------------------------------
+
+_ABS_PATH = re.compile(
+ r"(?:^|[\s\"'`=(\[{<,:;])(?:/[^\s/\"'`]+/|/(?:Users|home|private|var|tmp|etc|opt|usr|Volumes|mnt|root|srv|"
+ r"Library|System|Applications|proc|dev|bin|sbin|nix|snap|workspace|workspaces|app|data)\b)"
+ r"|(?:^|[^\w])~[/\\]|\b[A-Za-z]:[\\/]|\\\\[\w.$-]+\\|%[A-Z]+%[\\/]|\$(?:HOME|TMPDIR|USERPROFILE)\b", re.I)
+# every pattern below is bounded (no unlimited run before a fixed character), so a 60 KB token costs linear time
+_URL = re.compile(r"(?<![\w+.-])[A-Za-z][\w+.-]{0,30}://|\bwww\.[\w-]{1,63}\.\w", re.I)
+_EMAIL = re.compile(r"(?<![\w.+-])[\w.+-]{1,64}@[\w-]{1,63}(?:\.[\w-]{1,63}){1,8}\b")
+MAX_TOKEN = 120 # a single unbroken run longer than this is never film text: dropped without more matching
+# prefixed key shapes (each vendor's documented prefix), whatever the rest of the line looks like
+_PREFIXED = re.compile(
+ r"(?<![A-Za-z0-9])(?:"
+ r"[sr]k_(?:live|test)_[A-Za-z0-9]{8,}|pk_(?:live|test)_[A-Za-z0-9]{8,}|sk-(?:[A-Za-z0-9]+-)*[A-Za-z0-9_-]{16,}|"
+ r"gh[pousr]_[A-Za-z0-9]{16,}|github_pat_[A-Za-z0-9_]{16,}|xox[abposr]-[A-Za-z0-9-]{8,}|xapp-[A-Za-z0-9-]{8,}|"
+ r"glpat-[A-Za-z0-9_-]{10,}|AIza[0-9A-Za-z_-]{20,}|(?:AKIA|ASIA)[0-9A-Z]{12,}|npm_[A-Za-z0-9]{20,}|"
+ r"hf_[A-Za-z0-9]{20,}|SG\.[A-Za-z0-9_-]{16,}|shp(?:at|ss|ca|pa)_[A-Fa-f0-9]{16,}|dop_v1_[a-f0-9]{16,}|"
+ r"ya29\.[A-Za-z0-9_-]{16,}|eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}|pypi-[A-Za-z0-9_-]{16,}|"
+ r"sq0[a-z]{3}-[A-Za-z0-9_-]{16,}|AC[a-f0-9]{32}|whsec_[A-Za-z0-9]{16,}|rk_[A-Za-z0-9]{16,})")
+_HEX_RUN = re.compile(r"(?<![0-9A-Fa-f])[0-9A-Fa-f]{20,}(?![0-9A-Fa-f])")
+_KEY_RUN = re.compile(r"[A-Za-z0-9+/=_-]{30,}")
+_KEY_WORD = (r"(?:api[ _-]?keys?|access[ _-]?keys?|secret(?:[ _-]?keys?)?|secrets|tokens?|passw(?:or)?ds?|passwd|pwd|"
+ r"pass ?phrase|credentials?|creds|auth(?:[ _-]?key)?|private[ _-]?key|client[ _-]?secret|bearer|"
+ r"session[ _-]?(?:id|key)|cookie|otp|pin)")
+_KEY_VALUE = re.compile(r"(?i)\b%s\s*[:=]\s*[\"']?\S{6,}" % _KEY_WORD)
+_BEARER = re.compile(r"(?i)\bbearer\s+\S{12,}")
+_IP = re.compile(r"(?<![\w.])(?:\d{1,3}\.){3}\d{1,3}(?![\w.])|(?<![\w:])(?=[0-9A-Fa-f:]*[0-9A-Fa-f])[0-9A-Fa-f]{0,4}(?::[0-9A-Fa-f]{0,4}){2,7}(?![\w:])")
+_HOST_TLDS = ("com|net|org|io|dev|app|ai|co|cloud|internal|local|lan|corp|intranet|home|private|xyz|tech|site|"
+ "online|info|biz|me|tv|us|uk|ca|de|fr|es|mx|br|in|jp|cn|ru|nl|se|ch|au|eu")
+_HOST = re.compile(r"(?i)(?<![\w./@-])[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*"
+ r"\.(?:%s)(?![\w-])" % _HOST_TLDS)
+_HOME_USER = re.compile(r"(?:^|[^\w])~[A-Za-z_][\w.-]*")
+_ROOT_PATH = re.compile(r"(?:^|[\s\"'`=(\[{<,:;])/[A-Za-z_][\w.-]{2,}(?![\w/])")
+
+
+def _key_like(s: str) -> bool:
+ """A 30+ character run of key characters with letters and digits that does not read as a path or a name:
+ a piece of only lower-case letters (a folder, a word) makes it a path."""
+ if not (re.search(r"\d", s) and re.search(r"[A-Za-z]", s)):
+ return False
+ pieces = [x for x in re.split(r"[/_-]", s) if x]
+ return not any(re.fullmatch(r"[a-z]{3,}", x) for x in pieces)
+
+
+_BIDI = set("\u061c\u200e\u200f\u202a\u202b\u202c\u202d\u202e\u2066\u2067\u2068\u2069")
+# slash lookalikes NFKC does not fold (division slash, fraction slash, big solidus, set minus ...)
+_SLASHES = str.maketrans({"\u2215": "/", "\u2044": "/", "\u29f8": "/", "\u27cb": "/", "\u2571": "/",
+ "\u2216": "\\", "\u29f9": "\\", "\u27cd": "\\", "\u2572": "\\"})
+
+
+_EMOJI_MODS = set("\ufe0e\ufe0f") | {chr(c) for c in range(0x1F3FB, 0x1F400)}
+
+
+def _pictograph(c: str) -> bool:
+ return unicodedata.category(c) in ("So", "Sk") or 0x1F000 <= ord(c) <= 0x1FAFF
+
+
+def _hidden_chars(s: str) -> bool:
+ """A format (Cf) or bidi control character: invisible, and it splits a number or a key past every rule. A
+ zero-width joiner between two pictographs (an emoji sequence such as a technologist or a flag) is fine."""
+ if s.isascii():
+ return False
+ for i, c in enumerate(s):
+ if c in _BIDI:
+ return True
+ if unicodedata.category(c) != "Cf":
+ continue
+ if c == "\u200d":
+ a = i - 1
+ while a >= 0 and s[a] in _EMOJI_MODS:
+ a -= 1
+ if a >= 0 and i + 1 < len(s) and _pictograph(s[a]) and _pictograph(s[i + 1]):
+ continue
+ return True
+ return False
+
+
+# invisible or blank characters that are not format characters: a combining grapheme joiner, Hangul fillers, the
+# Braille blank, Khmer inherent vowels, Mongolian selectors, variation selectors
+_IGNORABLE = set("\u034f\u115f\u1160\u3164\uffa0\u2800\u17b4\u17b5\u180b\u180c\u180d\u180e\u180f\u200d") | \
+ {chr(c) for c in range(0xFE00, 0xFE10)} | {chr(c) for c in range(0xE0100, 0xE01F0)}
+
+
+def _folded(s: str) -> str:
+ """The copy every rule judges (the kept text is never rewritten): NFKC (full-width, circled and superscript
+ digits, homoglyph punctuation), slash lookalikes as slashes, and without combining marks, unassigned,
+ private-use and surrogate code points or other invisibles, so a number spread with them reads whole."""
+ if (s or "").isascii():
+ return s or "" # nothing to fold (the common case, and fast)
+ t = unicodedata.normalize("NFKC", s).translate(_SLASHES)
+ return "".join(c for c in t if c not in _IGNORABLE and unicodedata.category(c) not in ("Mn", "Me", "Cn", "Co", "Cs"))
+
+
+def unsafe_reason(line: str) -> Optional[str]:
+ """Why a line must not reach the film or a file ('hidden character', 'key', 'absolute path', 'URL', 'e-mail',
+ 'host'), or None. The line is judged NFKC-folded; one with a format or bidi control character is refused."""
+ if _hidden_chars(line or ""):
+ return "hidden character"
+ s = _folded(line)
+ if any(len(w) > MAX_TOKEN for w in s.split()):
+ return "key" # a long unbroken run: never film text, and never matched further
+ if _PREFIXED.search(s):
+ return "key"
+ if pv.mask_line(s)[1] or _HEX_RUN.search(s) or _KEY_VALUE.search(s) or _BEARER.search(s) or \
+ any(_key_like(m.group(0)) for m in _KEY_RUN.finditer(s)):
+ return "key"
+ if _URL.search(s):
+ return "URL"
+ if _ABS_PATH.search(s) or _HOME_USER.search(s) or _ROOT_PATH.search(s):
+ return "absolute path"
+ if _EMAIL.search(s):
+ return "e-mail"
+ if _IP.search(s) or _HOST.search(s) or re.search(r"[\w.-]@[\w-]", s):
+ return "host"
+ return None
+
+
+def hard_filter(lines: "OrderedDict[str, Dict[str, Any]]") -> Tuple["OrderedDict[str, Dict[str, Any]]", Counter]:
+ kept: "OrderedDict[str, Dict[str, Any]]" = OrderedDict()
+ dropped: Counter = Counter()
+ for k, ln in lines.items():
+ why = unsafe_reason(ln["text"])
+ if why:
+ dropped[why] += 1
+ else:
+ kept[k] = ln
+ return kept, dropped
+
+
+# ---------------------------------------------------------------------------
+# allow-list: the session -> facts (the only data recap keeps)
+# ---------------------------------------------------------------------------
+
+
+_WRAPPER_BLOCK = re.compile(r"\s*<[A-Za-z][\w]*[-_][\w-]*\b")
+_OPEN_TAG = re.compile(r"<([A-Za-z][\w-]*)\b[^<>\n]{0,200}>")
+_CLOSE_TAG = re.compile(r"</([A-Za-z][\w-]*)\s*>")
+
+
+KNOWN_WRAPPERS = {"system-reminder", "user-prompt-submit-hook", "command-name", "command-message", "command-args",
+ "local-command-stdout", "local-command-stderr", "bash-input", "bash-stdout", "bash-stderr",
+ "task-notification"}
+
+
+def _starts_line(text: str, at: int) -> bool:
+ """Whether only whitespace sits between the line's start (or the text's) and `at`. It walks back over that
+ whitespace only, so many tags cost linear time in all."""
+ i = at - 1
+ while i >= 0 and text[i] in " \t\r\u00a0\u2007\u202f\u3000":
+ i -= 1
+ return i < 0 or text[i] in "\n\u2028\u2029"
+
+
+def _strip_tags(text: str) -> str:
+ """Tagged blocks (system reminders, IDE selections, command wrappers) out, whole, however long, then stray tags.
+ Linear: every closing tag is indexed once, and each opening tag looks up the next closing tag of its name. A
+ block-style tag (a name with - or _) that is never closed ends the text there: what follows it is the block's
+ body, not the request."""
+ import bisect
+ text = (text or "")[:REQUEST_SCAN]
+ closes: Dict[str, List[Tuple[int, int]]] = {}
+ for m in _CLOSE_TAG.finditer(text):
+ closes.setdefault(m.group(1), []).append((m.start(), m.end()))
+ starts = {k: [a for a, _b in v] for k, v in closes.items()}
+ out: List[str] = []
+ pos = 0
+ for m in _OPEN_TAG.finditer(text):
+ if m.start() < pos:
+ continue
+ name = m.group(1)
+ lst = starts.get(name) or []
+ i = bisect.bisect_left(lst, m.end())
+ if i < len(lst):
+ out.append(text[pos:m.start()])
+ out.append(" ")
+ pos = closes[name][i][1]
+ elif name in KNOWN_WRAPPERS or name.startswith("ide_") or (("-" in name or "_" in name) and
+ _starts_line(text, m.start())):
+ out.append(text[pos:m.start()]) # a wrapper (a known one anywhere, else at a line start): its
+ pos = len(text) # body runs to the end
+ break
+ out.append(text[pos:])
+ return re.sub(r"</?[A-Za-z][^<>\n]{0,200}>", " ", "".join(out))
+
+
+_FILE_EXTS = _W("py pyi js mjs cjs ts tsx jsx md mdx json yml yaml toml ini cfg sh bash zsh rs go rb java kt swift c h cc "
+ "cpp hpp cs php css scss html htm txt csv lock xml sql ipynb vue svelte mp4 png jpg jpeg svg gif wav")
+_KNOWN_DOTTED = _W("node.js next.js vue.js nuxt.js three.js d3.js chart.js express.js react.js asp.net vb.net .net "
+ "e.g. i.e. etc. vs.")
+_KNOWN_SLASHED = _W("ci/cd and/or i/o a/b ui/ux tcp/ip w/o n/a input/output read/write client/server true/false "
+ "yes/no on/off pros/cons")
+_VERSIONS = r"v?\d+(?:\.\d+)*[a-z]?(?:/v?\d+(?:\.\d+)*[a-z]?)*"
+_GROUPED_KEY = re.compile(r"(?:[A-Za-z0-9]{4,}-){2,}[A-Za-z0-9]{4,}")
+_VALUE_LIKE = re.compile(r"^(?=.*\d)(?=.*[A-Za-z])[A-Za-z0-9+/=_.-]{8,}$")
+_REQUEST_KEY_WORDS = _KEY_WORD[:-1] + r"|pass ?codes?|pass ?keys?|license ?keys?|pat|pats|api|apikey)"
+
+
+def _private_word(w: str, nxt: str) -> bool:
+ """Strict rules for one word of the request (a suggestion in script.md, never film text unless chosen)."""
+ if len(w) > 200:
+ return True # never matched further: long words are never request text
+ bare = w.strip("\"'`,.;:!?()[]{}<>")
+ low = bare.lower()
+ if re.fullmatch(_REQUEST_KEY_WORDS, low) and nxt:
+ return True # a key's name with anything after it (within the sentence)
+ if len(w) >= 6 and re.search(r"[A-Za-z]", w) and re.search(r"\d", w) and \
+ not re.fullmatch(_VERSIONS, low) and not ("." in low and low.rsplit(".", 1)[-1] in _FILE_EXTS):
+ return True # letters mixed with digits, whatever punctuation is around them
+ if re.search(r"\w:\S", w):
+ return True # user:pass, scheme:value, key:value
+ if re.search(r"(?i)%s\s*[:=]" % _REQUEST_KEY_WORDS, w):
+ return True
+ if _GROUPED_KEY.search(bare) or (_VALUE_LIKE.match(bare) and not re.fullmatch(_VERSIONS, low)
+ and not (("." in low) and low.rsplit(".", 1)[-1] in _FILE_EXTS)):
+ return True # a value-like word: digits mixed with letters
+ if "/" in bare or "\\" in bare:
+ if low not in _KNOWN_SLASHED and not re.fullmatch(_VERSIONS, low):
+ return True
+ if "@" in bare and not re.fullmatch(r"@[A-Za-z_]\w*", bare):
+ return True
+ if bare.startswith("~") and not re.match(r"~\d", bare):
+ return True
+ if "." in bare.strip(".") and low not in _KNOWN_DOTTED:
+ last = low.rstrip(".").rsplit(".", 1)[-1]
+ if re.fullmatch(r"[a-z]{2,}", last) and last not in _FILE_EXTS:
+ return True # a host on any top-level domain (a file name keeps its extension)
+ return bool(unsafe_reason(w) or unsafe_reason(" " + w))
+
+
+# any separators, of any length (+ | – · _ -- ...), and a 1-digit lead group; a match starts only where a digit run
+# starts, so long runs of digits or separators stay linear
+_DIGIT_GROUPS = re.compile(r"(?<!\d)\d+(?:[\W_]+\d{2,}){2,}")
+
+
+_NAME_KEYS = re.compile(r"(?:file|callout)\.\d+|files\.say")
+
+
+def own_line(key: str, text: str, fresh: Dict[str, Any], facts: Dict[str, Any]) -> Optional[str]:
+ """Whether a script.md line is recap's own, by comparison with what recap writes from the CURRENT facts (never
+ erasing parts of the line and judging the rest, never trusting a file on disk):
+ - "own": it is the line recap writes now; or, outside the lines that name a file, the same line with other
+ counts (every standalone run of 1-5 digits, 12,345 included, read as #); or a file row or callout equal to
+ one of the session's EDITED files exactly; or a files line whose file name is exactly one recap would speak
+ for an edited file, with only the counts around that name compared by shape; or a "Most used" line made only
+ of allow-listed labels with a count. A file's name is never shape-compared;
+ - "stale": recap's line with a longer count in place of the current one: replaced by the current line,
+ without a refusal;
+ - None: the person's own line, judged by the strict rule on its original text."""
+ cur = fresh[key]["text"] if key in fresh else None
+ if cur is not None and cur == text:
+ return "own"
+ names = bool(_NAME_KEYS.fullmatch(key))
+ if cur is not None and not names and _shape(cur) == _shape(text):
+ return "own"
+ edited = [f for f in facts.get("files") or [] if isinstance(f, dict) and f.get("edited")]
+ one = lambda x: re.sub(r"\s+", " ", str(x or "")).strip() # noqa: E731 (script.md lines are read this way)
+ text1 = one(text)
+ if re.fullmatch(r"file\.\d+", key) and text1 in {one(f.get("path")) for f in edited}:
+ return "own"
+ if re.fullmatch(r"callout\.\d+", key) and text1 in {one(str(f.get("path", "")).rsplit("/", 1)[-1]) for f in edited}:
+ return "own"
+ if key == "files.say":
+ per = (facts.get("diff") or {}).get("per_file") or {}
+ for f in edited:
+ for p in (per, {}): # with git's line counts, and without (a commit since)
+ say, name = files_say_parts(f, p, len(edited))
+ say, name = one(say), one(name)
+ if text1.count(name) == 1 and say.count(name) == 1:
+ a, b = text1.split(name), say.split(name)
+ if _shape(a[0]) == _shape(b[0]) and _shape(a[1]) == _shape(b[1]):
+ return "own"
+ if key == "timeline.commands":
+ body = re.sub(r"^Most used:\s*", "", text)
+ parts = [x.strip() for x in body.split("\u00b7") if x.strip()]
+ found = [re.fullmatch(r"(.+?) %s" % _COUNT, x) for x in parts]
+ labels = [m.group(1) for m in found if m]
+ if parts and len(parts) <= MOST_USED_PARTS and len(labels) == len(parts) and \
+ len(set(labels)) == len(labels) and all(_allowed_label(x) for x in labels):
+ return "own"
+ if cur is not None and not names and _shape(cur, big=True) == _shape(text, big=True):
+ return "stale"
+ return None
+
+
+_COUNT = r"\u00d7[1-9][0-9]{0,4}(?![0-9])"
+MOST_USED_PARTS = 4
+# a stale count: 1-5 digits in all, grouping included (12,345 yes; 123,456 no). Bounded, so linear on long runs
+_SMALL_NUMBER = re.compile(r"(?<![0-9A-Za-z,])(?:[0-9]{1,2},[0-9]{3}|[0-9]{1,5})(?![0-9A-Za-z,])")
+_ANY_NUMBER = re.compile(r"(?<![0-9A-Za-z])[0-9][0-9,]*(?![0-9A-Za-z])")
+
+
+def _shape(text: str, big: bool = False) -> str:
+ """The text with its standalone counts as # (1-5 digits in all, 12,345 included; any length when `big`) and
+ plural words made singular, so a stale count compares equal and nothing else does. Never called on a file name
+ (own_line compares those exactly). Linear: the patterns are bounded."""
+ t = (_ANY_NUMBER if big else _SMALL_NUMBER).sub("#", text or "")
+ return re.sub(r"\b(line|edit|file|commit|run|turn|call|command|test|path)s\b", r"\1", t)
+
+
+def _allowed_label(label: str) -> bool:
+ words = label.split()
+ if not words or words[0] not in ALLOWED_PROGRAMS:
+ return False
+ if len(words) == 1:
+ return True
+ if len(words) == 2:
+ prog, sub = words
+ return sub in KNOWN_SUBCOMMANDS.get(prog, set()) or (prog in USER_TARGETS and sub in GENERIC_TARGETS) or \
+ (prog == "showtime" and sub in _showtime_commands())
+ return len(words) == 3 and words[0] in ("python", "python3") and words[1] == "-m" and words[2] in RUNNER_MODULES
+
+
+MAX_LINE = 2000 # characters: a script.md line longer than this is refused outright
+
+
+def free_text_refused(text: str) -> bool:
+ """Whether a line the person wrote (any line of script.md that recap did not write, or an uncommented
+ suggestion) fails the strict request rule or the hard filter."""
+ if len(text or "") > MAX_LINE:
+ return True # a line this long is never film text (and costs nothing to judge)
+ if unsafe_reason(text):
+ return True
+ folded = _folded(text)
+ if _digit_chain(folded): # the whole line: a number split across sentences is still one
+ return True
+ sents = pv._sentences(re.sub(r"\s+", " ", folded).strip()) or [text]
+ return any(_clean_words(x) is None for x in sents)
+
+
+_CHAIN_TOKENS = re.compile(r"v?\d+(?:\.\d+)+|\d+|[^\W\d_]+|\s+|[^\w\s]")
+CHAIN_DIGITS = 9 # an SSN has 9 digits, a phone 10, a card 16
+
+
+def _digit_chain(text: str) -> bool:
+ """Digit groups that together make a long number (S1, S2), in one linear pass:
+ - a chain of groups with only punctuation or 1-4 letter words between them that holds 9+ digits in all
+ ("SSN 123 and 45 and 6789", "4111 x 1111 x 1111 x 1111", "4 1 1 1 ... 1");
+ - two groups with only whitespace between when one has 4+ digits ("4111 1111", "55512 34567").
+ A word of 5+ letters or a version (3.11, v1.2.3) ends a chain. Trade-off: "between 2024 and 2026", "From
+ 2024-2026", "1920×1080", "Node 18, 20 and 22" and "Python 3.11, 3.12 and 3.13" pass."""
+ total = 0 # digits in the current chain
+ last = 0 # length of the chain's last group (0: no chain)
+ gap = "" # what sits since the last group: "" nothing, "space" only whitespace, "other"
+ for m in _CHAIN_TOKENS.finditer(text):
+ t = m.group(0)
+ if t.isdigit():
+ if last and gap == "space" and (last >= 4 or len(t) >= 4):
+ return True
+ total = (total if last else 0) + len(t)
+ if total >= CHAIN_DIGITS:
+ return True
+ last, gap = len(t), ""
+ elif t.isspace():
+ if gap == "":
+ gap = "space"
+ elif t[0].isdigit() or t[0] in "vV" and len(t) > 1 and t[1].isdigit() or (t.isalpha() and len(t) > 4):
+ total, last, gap = 0, 0, "" # a version or a long word ends the chain
+ else:
+ gap = "other" # punctuation or a 1-4 letter word bridges it
+ return False
+
+
+def _clean_words(sent: str) -> Optional[str]:
+ """The sentence as it is, or None when any word in it is private (_private_word): a key word with any of the
+ next three words after it, three or more digit groups (a card or account number, an address)."""
+ judged = _folded(sent)
+ if _hidden_chars(sent) or _DIGIT_GROUPS.search(judged) or re.search(r"\d{6,}", judged) or \
+ _digit_chain(judged):
+ return None # digit groups or a long number (an account, a ticket, a card)
+ jtoks = judged.split()
+ for i, w in enumerate(jtoks):
+ if _private_word(w, " ".join(jtoks[i + 1:i + 4])):
+ return None
+ toks = sent.split()
+ out = re.sub(r"\s+([,.;:!?])", r"\1", " ".join(toks)).strip(" ,;:-")
+ return out or None
+
+
+def clean_request(text: str, limit: int = 150) -> str:
+ """The request's first sentences, with tagged blocks (reminders, commands), code and asides in brackets
+ taken out, and every sentence that names a path, a host, an address, a URL or a key left out whole."""
+ t = _strip_tags(text)[:REQUEST_KEEP]
+ t = re.sub(r"```.*?(```|$)", " ", t, flags=re.S)
+ paras = [p.strip() for p in re.split(r"\n\s*\n", t) if p.strip()]
+ para = ""
+ for p in paras:
+ p = re.sub(r"^\s*(#+|[-*>]|\d+[.)])\s+", "", p, flags=re.M)
+ if len(re.findall(r"[A-Za-z]{2,}", p)) >= 3:
+ para = p
+ break
+ for _ in range(3):
+ para = re.sub(r"\s*\([^()]*\)", "", para)
+ para = re.sub(r"\s*\[[^\[\]]*\]", "", para)
+ sents: List[str] = []
+ for sent in pv._sentences(re.sub(r"\s+", " ", para).strip()):
+ clean = _clean_words(sent)
+ if clean is None or _digit_chain(_folded(" ".join(sents + [clean]))):
+ break # something private (also a number split across sentences) ends
+ sents.append(clean) # the suggestion; a later sentence is never promoted in its place
+ out = ""
+ for s in sents:
+ if out and len(out) + 1 + len(s) > limit:
+ break
+ out = (out + " " + s).strip()
+ out = rv.shorten(out, limit) if len(out) > limit else out
+ return out if not unsafe_reason(out) else ""
+
+
+BUILTIN_TOOLS = _W("Read Write Edit MultiEdit NotebookEdit NotebookRead Bash BashOutput KillShell KillBash PowerShell "
+ "Glob Grep LS WebFetch WebSearch Task Agent TodoWrite TodoRead ExitPlanMode EnterPlanMode ToolSearch "
+ "Monitor Skill SlashCommand AskUserQuestion TaskStop TaskOutput SendMessage EnterWorktree "
+ "ExitWorktree ListMcpResources ReadMcpResource advisor")
+
+
+def tool_display(name: str) -> str:
+ """A tool's name: Claude Code's own tools by name, any MCP tool as 'MCP tool', anything else 'other' (a tool's
+ or an MCP server's name can be private too)."""
+ if name.startswith("mcp__"):
+ return "MCP tool"
+ return name if name in BUILTIN_TOOLS else OTHER
+
+
+READ_TOOLS = {"Read", "NotebookRead", "View"}
+EDIT_TOOLS = {"Edit", "Write", "MultiEdit", "NotebookEdit", "Create", "Update"}
+SEARCH_TOOLS = {"Grep", "Glob", "LS", "Search", "WebSearch", "WebFetch", "ToolSearch"}
+RUN_TOOLS = {"Bash", "PowerShell", "Shell", "BashOutput", "Monitor"}
+
+
+def _numstat(out: str, acc: Dict[str, List[int]]) -> None:
+ for line in out.splitlines():
+ m = re.match(r"^(\d+|-)\t(\d+|-)\t(.+)$", line)
+ if not m:
+ continue
+ path = m.group(3)
+ if " => " in path:
+ path = re.sub(r"\{[^{}]* => ([^{}]*)\}", r"\1", path)
+ path = path.split(" => ")[-1]
+ path = path.replace("//", "/")
+ a = acc.setdefault(path, [0, 0])
+ a[0] += int(m.group(1)) if m.group(1).isdigit() else 0
+ a[1] += int(m.group(2)) if m.group(2).isdigit() else 0
+
+
+def verified_commits(top: str, shas: Sequence[str]) -> List[str]:
+ """The commit hashes (as printed by `git commit`) that exist in THIS repository and are part of its history
+ (an ancestor of HEAD, or on any branch or tag). A hash that does not resolve here is not counted: a commit
+ made in another repository, however the command reached it, never counts as the session's."""
+ out = []
+ for sha in dict.fromkeys(shas):
+ if not re.fullmatch(r"[0-9a-f]{7,40}", sha or ""):
+ continue
+ if _git(["cat-file", "-e", sha + "^{commit}"], cwd=top)[0] != 0:
+ continue
+ rc, full = _git(["rev-parse", "--verify", "--quiet", sha + "^{commit}"], cwd=top)
+ full = full.strip()
+ if rc != 0 or not full:
+ continue
+ if _git(["merge-base", "--is-ancestor", full, "HEAD"], cwd=top)[0] == 0 or \
+ _git(["branch", "--all", "--contains", full], cwd=top)[1].strip() or \
+ _git(["tag", "--contains", full], cwd=top)[1].strip():
+ if full not in out:
+ out.append(full)
+ return out
+
+
+def diff_stats(top: str, *, since: Optional[str], commits: Sequence[str], edited: Sequence[str]) -> Dict[str, Any]:
+ """{files, additions, deletions, source, per_file}: from --since (git diff <ref>, the working tree
+ included), else the session's own verified commits (verified_commits). None when git has no record."""
+ acc: Dict[str, List[int]] = {}
+ source = "none"
+ if since:
+ rc, _out = _git(["rev-parse", "--verify", "--quiet", "--end-of-options", since + "^{commit}"], cwd=top)
+ if rc != 0 or since.startswith("-"):
+ raise ShowtimeError("--since %s is not a commit of the repository" % since,
+ hint="--since takes a commit, branch or tag of that repository")
+ rc, out = _git(["diff", "--numstat", "--no-renames", since, "--"], cwd=top)
+ if rc != 0:
+ raise ShowtimeError("git diff %s failed in the repository" % since,
+ hint="--since takes a commit, branch or tag of that repository")
+ _numstat(out, acc)
+ source = "since"
+ else:
+ for sha in commits:
+ rc, out = _git(["show", "--numstat", "--no-renames", "--format=", sha], cwd=top)
+ if rc == 0:
+ _numstat(out, acc)
+ source = "commits" if commits else source
+ per = {p: v for p, v in acc.items() if _repo_file_ok(p)}
+ return {"files": len(per), "additions": sum(v[0] for v in per.values()),
+ "deletions": sum(v[1] for v in per.values()), "source": source if per else "none",
+ "per_file": {p: v for p, v in per.items() if p in set(edited)}}
+
+
+def collect(ses: Dict[str, Any], top: str, roots: Sequence[str], *, since: Optional[str] = None,
+ use_git: bool = True) -> Dict[str, Any]:
+ """The allow-listed facts of a session. This dict is all recap keeps; it is written as facts.json."""
+ t0 = ses["start"] or 0.0
+ t1 = ses["end"] or t0
+ files: "OrderedDict[str, Dict[str, Any]]" = OrderedDict()
+ outside = set()
+ tools: Counter = Counter()
+ commands: Counter = Counter()
+ timeline: List[Dict[str, Any]] = []
+ tests: List[Dict[str, Any]] = []
+ shas: List[str] = []
+ n_cmds = 0
+ main_cwd = _norm(ses["cwds"].most_common(1)[0][0]) if ses["cwds"] else ""
+ for u in ses["uses"]:
+ name, inp = u["name"], u["input"]
+ res = ses["results"].get(u["id"]) or {}
+ t = round(max(0.0, (u["ts"] or t0) - t0), 1)
+ tools[tool_display(name)] += 1
+ kind = "other"
+ if name in READ_TOOLS or name in EDIT_TOOLS:
+ kind = "read" if name in READ_TOOLS else "edit"
+ rel = rel_path(inp.get("file_path") or inp.get("notebook_path") or inp.get("path"), roots,
+ u.get("cwd") or main_cwd)
+ if kind == "edit" and res.get("error"):
+ kind = "other" # an edit that did not apply
+ if rel is None:
+ p = inp.get("file_path") or inp.get("notebook_path") or inp.get("path")
+ if isinstance(p, str) and p:
+ outside.add(hashlib.sha1(p.encode("utf-8", "replace")).hexdigest())
+ elif kind in ("read", "edit"):
+ f = files.setdefault(rel, {"path": rel, "read": 0, "edited": 0, "first": t, "first_edit": None})
+ f[kind if kind == "read" else "edited"] += 1
+ if kind == "edit" and f["first_edit"] is None:
+ f["first_edit"] = t
+ elif name in SEARCH_TOOLS:
+ kind = "read"
+ elif name in RUN_TOOLS and name != "Monitor":
+ cmd = inp.get("command") if isinstance(inp.get("command"), str) else ""
+ labels = command_labels(cmd)
+ n_cmds += 1
+ for lab in labels:
+ commands[lab] += 1
+ kind = "run"
+ if cmd and is_test_command(cmd):
+ kind = "test"
+ c = test_counts(res.get("text") or "")
+ ok = None
+ if c is not None and c.get("status"):
+ ok = c.pop("status") == "ok" and not res.get("error")
+ elif c is not None:
+ ok = c["failed"] == 0 and not res.get("error")
+ elif res:
+ ok = False if res.get("error") else None
+ tests.append(dict(c or {"passed": None, "failed": None, "unit": ""}, t=t, ok=ok))
+ if "git commit" in labels and res: # a failing later step (a rejected push) does not undo it
+ shas += _COMMIT_SHA.findall(res.get("text") or "") # verified against the repository below
+ timeline.append({"t": t, "k": kind})
+ edited = [f["path"] for f in files.values() if f["edited"]]
+ mine = verified_commits(top, shas) if use_git else []
+ commits = len(mine) # only hashes git knows in this repository's history
+ if use_git:
+ diff = diff_stats(top, since=since, commits=mine, edited=edited)
+ else:
+ diff = {"files": 0, "additions": 0, "deletions": 0, "source": "none", "per_file": {}}
+ start_local = _dt.datetime.fromtimestamp(t0) if t0 else None
+ ref = hashlib.sha1(("%s|%s" % (Path(ses["path"]).name, t0)).encode()).hexdigest()[:10]
+ facts = {
+ "generator": "showtime recap", "version": 1, "ref": ref, "kind": ses["kind"],
+ "date": start_local.strftime("%Y-%m-%d") if start_local else "",
+ "started": _dt.datetime.fromtimestamp(t0, _dt.timezone.utc).isoformat() if t0 else "",
+ "ended": _dt.datetime.fromtimestamp(t1, _dt.timezone.utc).isoformat() if t1 else "",
+ "duration": active_seconds(ses.get("times") or []), "span": round(max(0.0, t1 - t0), 1),
+ "turns": len(ses["turns"]), "tool_calls": len(ses["uses"]),
+ "tools": [[k, v] for k, v in tools.most_common()],
+ "files": list(files.values()), "files_outside": len(outside),
+ "commands": [[k, v] for k, v in commands.most_common(12)], "commands_total": n_cmds,
+ "tests": tests, "commits": commits, "diff": diff, "timeline": timeline,
+ }
+ return scrub_facts(facts)
+
+
+IDLE_GAP = 600.0 # a pause longer than this (a session left open overnight) is not counted as work
+
+
+def active_seconds(times: Sequence[float]) -> float:
+ """The session's active time: the gaps between consecutive events, leaving out any gap of IDLE_GAP or more."""
+ ts = sorted(times)
+ return round(sum(b - a for a, b in zip(ts, ts[1:]) if b - a < IDLE_GAP), 1)
+
+
+def scrub_facts(facts: Dict[str, Any]) -> Dict[str, Any]:
+ """The hard filter on the facts themselves (they are written to facts.json)."""
+ facts["files"] = [f for f in facts["files"] if not unsafe_reason(f["path"])]
+ facts["commands"] = [c for c in facts["commands"] if not unsafe_reason(c[0])]
+ facts["tools"] = [c for c in facts["tools"] if not unsafe_reason(c[0])]
+ d = facts.get("diff") or {}
+ d["per_file"] = {p: v for p, v in (d.get("per_file") or {}).items() if not unsafe_reason(p)}
+ return facts
+
+
+# ---------------------------------------------------------------------------
+# the script: every line shown (show) or spoken (say), keyed
+# ---------------------------------------------------------------------------
+
+
+def fmt_duration(s: float) -> str:
+ s = max(0.0, float(s or 0))
+ if s < 90:
+ return "%d s" % round(s)
+ m = int(round(s / 60.0))
+ if m < 90:
+ return "%d min" % m
+ h, m = divmod(m, 60)
+ return "%d h %02d min" % (h, m) if m else "%d h" % h
+
+
+def say_duration(s: float) -> str:
+ s = max(0.0, float(s or 0))
+ if s < 90:
+ return "%d seconds" % round(s)
+ m = int(round(s / 60.0))
+ if m < 90:
+ return "%d minutes" % m
+ h, m = divmod(m, 60)
+ return ("%d hours" % h if h > 1 else "an hour") + (" and %d minutes" % m if m else "")
+
+
+def _plural(n: int, word: str, many: str = "") -> str:
+ return "%s %s" % ("{:,}".format(n), word if n == 1 else (many or word + "s"))
+
+
+def _human_date(iso_day: str) -> str:
+ try:
+ d = _dt.date.fromisoformat(iso_day)
+ except ValueError:
+ return ""
+ return "%d %s %d" % (d.day, d.strftime("%b"), d.year)
+
+
+def _speakable(text: str) -> str:
+ """A title for the voice: code spans lose their backticks, snake_case reads as words."""
+ t = re.sub(r"`([^`]*)`", r"\1", text or "")
+ t = re.sub(r"^\s*v?\d+(?:\.\d+)+\s*:\s*", "", t) # a leading "0.4.0:" release tag
+ t = t[:1].upper() + t[1:]
+ t = re.sub(r"(?<=[A-Za-z])_(?=[A-Za-z])", " ", t)
+ return t.strip().rstrip(".")
+
+
+def scenes_for(facts: Dict[str, Any]) -> List[str]:
+ sc = ["hook", "numbers", "timeline"]
+ if any(f["edited"] for f in facts["files"]):
+ sc.append("files")
+ if facts["tests"]:
+ sc.append("tests")
+ if facts["diff"]["files"] or facts["commits"]:
+ sc.append("diff")
+ return sc + ["end"]
+
+
+MAX_FILE_ROWS = 5
+MAX_CALLOUTS = 4
+
+
+def test_story(tests: List[Dict[str, Any]]) -> Dict[str, Any]:
+ known = [x for x in tests if x["ok"] is not None]
+ last = next((x for x in reversed(tests) if x.get("unit")), None)
+ first_red = next((i for i, x in enumerate(known) if x["ok"] is False), None)
+ green_after = first_red is not None and any(x["ok"] for x in known[first_red + 1:])
+ return {"runs": len(tests), "red": sum(1 for x in known if x["ok"] is False),
+ "green": sum(1 for x in known if x["ok"]), "last": last,
+ "red_to_green": bool(green_after and known and known[-1]["ok"]),
+ "ends_red": bool(known and known[-1]["ok"] is False)}
+
+
+def files_say_parts(big: Optional[Dict[str, Any]], per: Dict[str, Any], n_edited: int) -> Tuple[str, str]:
+ """(the files scene's line about the file with the most change, the file name as it sits in that line). recap
+ knows where the name sits, so a comparison can match the name exactly and read counts only around it."""
+ base = re.sub(r"\.[A-Za-z0-9]+$", "", big["path"].rsplit("/", 1)[-1]) if big else ""
+ name = _speakable(base)
+ name = (base[:1] + name[1:]) if base[:1].islower() else name # a file name keeps its own case
+ kind = ", a test file" if big and pv.is_test(big["path"]) else ""
+ if big and big["path"] in per and n_edited > 1:
+ return "Most of the change is in %s%s: %s added." % (name, kind, _plural(per[big["path"]][0], "line")), name
+ if big and n_edited > 1:
+ fname = big["path"].rsplit("/", 1)[-1] # spoken: the stem's words, then its extension
+ stem, dot, ext = fname.rpartition(".")
+ spoken = (_speakable(stem) if stem else fname) + ("." + ext if stem and dot else "")
+ spoken = (stem[:1] + spoken[1:]) if stem[:1].islower() else spoken
+ return "Most edits went into %s%s: %d of them." % (spoken, kind, big["edited"]), spoken
+ return "Every edit went into %s%s." % (name or "one file", kind), name or "one file"
+
+
+def files_say(big: Optional[Dict[str, Any]], per: Dict[str, Any], n_edited: int) -> str:
+ """The files scene's line about the file with the most change (one of the edited files)."""
+ return files_say_parts(big, per, n_edited)[0]
+
+
+def _outcome(facts: Dict[str, Any]) -> str:
+ st = test_story(facts["tests"]) if facts["tests"] else None
+ if st and st["red_to_green"]:
+ return "red to green"
+ if st and st["ends_red"]:
+ return "still red"
+ if st and st["last"]:
+ return "tests green"
+ if facts["commits"]:
+ return _plural(facts["commits"], "commit")
+ return ""
+
+
+def facts_title(facts: Dict[str, Any]) -> str:
+ """The film's title from the facts alone: '42 min · 6 files · red to green'."""
+ edited = sum(1 for f in facts["files"] if f["edited"])
+ files = _plural(edited, "file") + " edited" if edited else _plural(len(facts["files"]), "file") + " read"
+ return " · ".join(x for x in (fmt_duration(facts["duration"]), files, _outcome(facts)) if x)
+
+
+def hook_sentence(facts: Dict[str, Any]) -> str:
+ """The hook's narration from the facts alone."""
+ who = "a sub-agent" if facts["kind"] == "sub-agent" else "an agent"
+ edited = sum(1 for f in facts["files"] if f["edited"])
+ did = "edited %s" % _plural(edited, "file") if edited else "read %s" % _plural(len(facts["files"]), "file")
+ out = _outcome(facts)
+ tail = {"red to green": " and took the tests from red to green", "still red": ", and the tests were still red",
+ "tests green": " and kept the tests green"}.get(out, "")
+ return "In %s, %s %s%s." % (say_duration(facts["duration"]), who, did, tail)
+
+
+def script_lines(facts: Dict[str, Any]) -> "OrderedDict[str, Dict[str, Any]]":
+ """Every line of the film, keyed: {key: {scene, kind: show|say, text}}. The page and the narration are built
+ from these lines only (read back from script.md after the user's edits)."""
+ L: "OrderedDict[str, Dict[str, Any]]" = OrderedDict()
+
+ def add(scene: str, kind: str, key: str, text: str) -> None:
+ text = re.sub(r"\s+", " ", text or "").strip()
+ if text:
+ L[key] = {"scene": scene, "kind": kind, "text": text}
+
+ title = facts_title(facts)
+ dur = facts["duration"]
+ files = facts["files"]
+ edited = [f for f in files if f["edited"]]
+ read_only = [f for f in files if f["read"] and not f["edited"]]
+ n_tests = len(facts["tests"])
+ who = "sub-agent" if facts["kind"] == "sub-agent" else "agent"
+ scenes = scenes_for(facts)
+
+ # hook
+ day = _human_date(facts["date"])
+ add("hook", "show", "hook.kicker", "Recap · Claude Code %s%s" % ("sub-agent" if who == "sub-agent" else "session",
+ " · " + day if day else ""))
+ add("hook", "show", "hook.title", title) # from the facts only; the request is a commented suggestion
+ add("hook", "show", "hook.meta", " · ".join([_plural(facts["turns"], "turn"), _plural(facts["tool_calls"], "tool call"),
+ _plural(facts["commands_total"], "command")]))
+ add("hook", "say", "hook.say", hook_sentence(facts))
+
+ # numbers
+ stats = [("time", fmt_duration(dur), "of work"), ("turns", "{:,}".format(facts["turns"]), "turns"),
+ ("calls", "{:,}".format(facts["tool_calls"]), "tool calls"),
+ ("files", "{:,}".format(len(files)), "repo files touched")]
+ if n_tests:
+ stats.append(("tests", "{:,}".format(n_tests), "test runs"))
+ add("numbers", "show", "numbers.kicker", "The session in numbers")
+ for k, v, lab in stats:
+ add("numbers", "show", "stat.%s.value" % k, v)
+ add("numbers", "show", "stat.%s.label" % k, lab)
+ add("numbers", "say", "numbers.say", "%s and %s, across %s in the repository." % (
+ _plural(facts["turns"], "turn"), _plural(facts["tool_calls"], "tool call"), _plural(len(files), "file")))
+
+ # timeline
+ kinds = Counter(e["k"] for e in facts["timeline"])
+ add("timeline", "show", "timeline.kicker", "Minute by minute")
+ for k, lab in (("read", "Read"), ("edit", "Edit"), ("run", "Run"), ("test", "Test")):
+ if kinds.get(k) or k in ("read", "edit", "run"):
+ add("timeline", "show", "lane.%s" % k, "%s %d" % (lab, kinds.get(k, 0)))
+ add("timeline", "show", "axis.start", "0")
+ add("timeline", "show", "axis.end", fmt_duration(facts.get("span") or dur))
+ for i, f in enumerate(sorted(edited, key=lambda f: f["first_edit"] or 0)[:MAX_CALLOUTS]):
+ add("timeline", "show", "callout.%d" % (i + 1), f["path"].rsplit("/", 1)[-1])
+ top = [c for c in facts["commands"] if c[0] not in ("echo", "sleep", "printf", OTHER)][:4]
+ if top:
+ # a command line can run several programs, so these are the programs most used, not a share of the runs
+ add("timeline", "show", "timeline.commands", "Most used: " + " · ".join("%s ×%d" % (c, n) for c, n in top))
+ runs = kinds.get("run", 0) # the lanes' own counts, so the voice and the screen agree
+ parts = []
+ if read_only:
+ parts.append("read %s" % (_plural(len(read_only), "other file") if edited else _plural(len(read_only), "file")))
+ if edited:
+ parts.append("edited %s" % _plural(len(edited), "file"))
+ parts.append("ran %s" % _plural(runs, "command") + (" and %s" % _plural(n_tests, "test run") if n_tests else ""))
+ if len(parts) > 1 and " and " not in parts[-1]:
+ say = "It " + ", ".join(parts[:-1]) + " and " + parts[-1] + "."
+ else:
+ say = "It " + ", ".join(parts) + "."
+ add("timeline", "say", "timeline.say", say)
+
+ # files
+ if "files" in scenes:
+ per = facts["diff"].get("per_file") or {}
+ add("files", "show", "files.kicker", "Where the edits landed")
+ add("files", "show", "files.head", _plural(len(edited), "file") + " edited")
+ rows = sorted(edited, key=lambda f: (-(sum(per.get(f["path"], [0, 0])) or f["edited"]), f["path"]))
+ for i, f in enumerate(rows[:MAX_FILE_ROWS]):
+ add("files", "show", "file.%d" % (i + 1), f["path"])
+ if f["path"] in per:
+ a, d = per[f["path"]]
+ add("files", "show", "file.%d.stat" % (i + 1), "+%d −%d" % (a, d))
+ else:
+ add("files", "show", "file.%d.stat" % (i + 1), "edited %d×" % f["edited"])
+ if len(rows) > MAX_FILE_ROWS:
+ add("files", "show", "files.more", "+ %d more" % (len(rows) - MAX_FILE_ROWS))
+ # new information, not the count again: where most of the change is
+ say = files_say(rows[0] if rows else None, per, len(edited))
+ add("files", "say", "files.say", say)
+
+ # tests
+ if "tests" in scenes:
+ st = test_story(facts["tests"])
+ last = st["last"]
+ add("tests", "show", "tests.kicker", "%s, in order" % _plural(st["runs"], "test run"))
+ add("tests", "show", "tests.head", "Red to green" if st["red_to_green"] else
+ ("Still red" if st["ends_red"] else "Tests"))
+ if last:
+ total = (last["passed"] or 0) + (last["failed"] or 0)
+ add("tests", "show", "tests.value", "%d/%d" % (last["passed"] or 0, total))
+ add("tests", "show", "tests.label", "%s passed, last run with a count" % last["unit"])
+ if st["red"]:
+ add("tests", "show", "tests.note", "%s failed before the last one" % _plural(st["red"], "run")
+ if not st["ends_red"] else "%s failed" % _plural(st["red"], "run"))
+ known = [x["ok"] for x in facts["tests"]]
+ legend = ["red failed"] * (False in known) + ["green passed"] * (True in known) + \
+ ["grey not counted"] * (None in known)
+ if len(legend) > 1:
+ add("tests", "show", "tests.legend", " · ".join(legend))
+ if st["red_to_green"] and last:
+ say = "The tests went red %s, then green: %d of %d %s passed." % (
+ "once" if st["red"] == 1 else "%d times" % st["red"], last["passed"] or 0, total, last["unit"])
+ elif st["ends_red"] and last:
+ say = "The last test run still failed: %d of %d %s." % (last["failed"] or 0, total, last["unit"])
+ elif last:
+ say = "Every counted test run passed: %d of %d %s on the last one." % (last["passed"] or 0, total,
+ last["unit"])
+ else:
+ say = "It ran the tests %s." % ("once" if st["runs"] == 1 else "%d times" % st["runs"])
+ add("tests", "say", "tests.say", say)
+
+ # diff
+ if "diff" in scenes:
+ d = facts["diff"]
+ add("diff", "show", "diff.kicker", "The change, from git")
+ if d["files"]:
+ add("diff", "show", "diff.adds", "+{:,}".format(d["additions"]))
+ add("diff", "show", "diff.dels", "−{:,}".format(d["deletions"]))
+ if facts["commits"] and d["files"] != len(edited):
+ detail = "%s in %s · %d edited in this session" % (_plural(d["files"], "file"),
+ _plural(facts["commits"], "commit"), len(edited))
+ else:
+ detail = " · ".join(x for x in (_plural(d["files"], "file"), _plural(facts["commits"], "commit")
+ if facts["commits"] else "") if x)
+ add("diff", "show", "diff.detail", detail)
+ say = ("%s: " % (_plural(facts["commits"], "commit").replace("1 commit", "One commit")
+ if facts["commits"] else "In all")) + \
+ "%s lines added, %s removed." % ("{:,}".format(d["additions"]), "{:,}".format(d["deletions"]))
+ add("diff", "say", "diff.say", say[0].upper() + say[1:])
+ else:
+ add("diff", "show", "diff.detail", _plural(facts["commits"], "commit"))
+ add("diff", "say", "diff.say", "It made %s." % _plural(facts["commits"], "commit"))
+
+ # end
+ add("end", "show", "end.kicker", "showtime recap")
+ # the outcome, from the facts only (the cause of a fix is in the assistant's text, which recap never reads)
+ st = test_story(facts["tests"]) if facts["tests"] else None
+ last = st["last"] if st else None
+ commits = (" · " + _plural(facts["commits"], "commit")) if facts["commits"] else ""
+ if st and last and not st["ends_red"] and (st["red_to_green"] or st["red"] == 0):
+ total = (last["passed"] or 0) + (last["failed"] or 0)
+ add("end", "show", "end.outcome", "Ended green: %d/%d %s passed%s" % (last["passed"] or 0, total, last["unit"],
+ commits))
+ add("end", "say", "end.say", "It ended green%s." % (", in %s" % _plural(facts["commits"], "commit")
+ if facts["commits"] else ""))
+ elif st and last and st["ends_red"]:
+ add("end", "show", "end.outcome", "Ended red: %d of %d %s failed%s" % (
+ last["failed"] or 0, (last["passed"] or 0) + (last["failed"] or 0), last["unit"], commits))
+ add("end", "show", "end.note", "Made on this machine from the session log · nothing uploaded")
+ return L
+
+
+SCRIPT_HEAD = """# Recap script
+
+<!-- recap of session {ref} -->
+Every line below is shown on screen (show) or spoken (say); the film is built from these lines only, and
+lines starting with # are not used. The lines come from an allow-list of facts (counts, file paths inside the
+repository, program names, test counts, git stats); free text from the session is only offered as a # suggestion.
+Edit the text after a label, or delete a line to leave it out, then run the same command again with --yes.
+Lines that look like keys, tokens, absolute paths, URLs, hosts or e-mail addresses are dropped, also after your
+edits. Filters can miss things: read every line before you render.
+"""
+
+
+def write_script(lines: "OrderedDict[str, Dict[str, Any]]", ref: str,
+ suggestions: Sequence[Tuple[str, str]] = ()) -> str:
+ """script.md: the keyed lines by scene; after the hook's title, free-text suggestions as comments (used only
+ when the person uncomments one, and then through the hard filter like every line)."""
+ out = [SCRIPT_HEAD.format(ref=ref)]
+ scene = None
+ for key, ln in lines.items():
+ if ln["scene"] != scene:
+ scene = ln["scene"]
+ out.append("\n## %s\n" % scene)
+ out.append("%s %s: %s" % (ln["kind"], key, ln["text"]))
+ if key == "hook.title":
+ for what, text in suggestions:
+ if text and not unsafe_reason(text):
+ as_title = what.endswith("description")
+ out.append("# from %s; uncomment to %s:" % (what, "use it as the title (it replaces the line above)"
+ if as_title else "show it under the title"))
+ out.append("# show %s: %s" % ("hook.title" if as_title else "hook.request", text))
+ return "\n".join(out) + "\n"
+
+
+def suggestions_for(ses: Dict[str, Any]) -> List[Tuple[str, str]]:
+ """Free text offered in script.md as commented suggestions (strictly cleaned); never kept in facts.json or the
+ project: script.md is the only file they appear in."""
+ out = []
+ title = clean_request(ses.get("description") or "", limit=70)
+ if title:
+ out.append(("the sub-agent's description", title))
+ request = clean_request(ses.get("request") or "")
+ if request:
+ out.append(("your first message", request))
+ return out
+
+
+_LINE = re.compile(r"^(show|say)\s+([a-z][\w.-]*)\s*:\s?(.*)$")
+
+
+def read_script(text: str) -> Tuple[str, "OrderedDict[str, Dict[str, Any]]"]:
+ """(ref, lines) from a script.md, edits included; unknown lines are ignored."""
+ m = re.search(r"<!-- recap of session ([0-9a-f]{6,40}) -->", text or "")
+ lines: "OrderedDict[str, Dict[str, Any]]" = OrderedDict()
+ scene = ""
+ for raw in (text or "").splitlines():
+ h = re.match(r"^##\s+([a-z]+)\s*$", raw.strip())
+ if h:
+ scene = h.group(1)
+ continue
+ mm = _LINE.match(raw.strip())
+ if mm and scene:
+ t = re.sub(r"\s+", " ", mm.group(3)).strip()
+ if t:
+ lines[mm.group(2)] = {"scene": scene, "kind": mm.group(1), "text": t}
+ return (m.group(1) if m else ""), lines
+
+
+# ---------------------------------------------------------------------------
+# timing and the page
+# ---------------------------------------------------------------------------
+
+PAD = 0.3 # picture before a scene's first spoken word (retime --from-voice uses the same)
+END_HOLD = 3.4
+
+
+def visual_need(scene: str, facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]") -> float:
+ """Seconds a scene needs on screen for its pictures and text, without a voice."""
+ if scene == "hook": # the title is spoken; the request line is read
+ req = lines["hook.request"]["text"] if "hook.request" in lines else ""
+ return max(3.6, 0.8 + (pv.read_time(req) if req else 1.5))
+ if scene == "numbers":
+ return max(4.2, 0.4 + 0.18 * 5 + 2.6)
+ if scene == "timeline":
+ return 7.5
+ if scene == "files":
+ n = sum(1 for k in lines if k.startswith("file.") and not k.endswith(".stat"))
+ return max(4.0, 0.5 + 0.15 * n + 0.4 * n + 1.5)
+ if scene == "tests":
+ return max(4.5, 0.5 + min(40, len(facts["tests"])) * 0.06 + 3.0)
+ if scene == "diff":
+ return 3.8
+ return END_HOLD
+
+
+def durations(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]", scenes: Sequence[str],
+ slots: Optional[Dict[str, float]] = None) -> Dict[str, float]:
+ """Each scene's length: with a voice, PAD + its line's slot (the slot holds the pause after it); a scene
+ without a line (the end card) holds END_HOLD. Without a voice, what its pictures and text need."""
+ out = {}
+ for s in scenes:
+ if slots and s in slots:
+ out[s] = round(PAD + slots[s], 2)
+ elif slots:
+ out[s] = END_HOLD if s == "end" else round(visual_need(s, facts, lines), 2)
+ else:
+ say = next((ln["text"] for ln in lines.values() if ln["scene"] == s and ln["kind"] == "say"), "")
+ out[s] = round(max(visual_need(s, facts, lines), (len(say.split()) / 2.6 + 0.8) if say else 0), 2)
+ return out
+
+
+def extra_pauses(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]", scenes: Sequence[str],
+ speech: Dict[str, float]) -> Dict[str, float]:
+ """Seconds of silence to add after a scene's line so its pictures have time (the narration sets the
+ lengths, so a scene that needs longer than its line gets a pause)."""
+ out = {}
+ for s in scenes:
+ if s in speech:
+ need = visual_need(s, facts, lines) - (PAD + speech[s])
+ if need > 0.05:
+ out[s] = round(need, 2)
+ return out
+
+
+def narration_md(lines: "OrderedDict[str, Dict[str, Any]]", scenes: Sequence[str], *, voice: str = "af_heart",
+ pauses: Optional[Dict[str, float]] = None, speed: float = 1.0) -> str:
+ out = ["---", "voice: %s" % voice, "gap: 0.45", "---", "",
+ "<!-- written by showtime recap from script.md: one line per scene -->", ""]
+ for s in scenes:
+ say = next((ln["text"] for ln in lines.values() if ln["scene"] == s and ln["kind"] == "say"), "")
+ if not say:
+ continue
+ opts = []
+ if pauses and pauses.get(s):
+ opts.append("pause_after=%.2f" % (0.45 + pauses[s]))
+ if speed != 1.0:
+ opts.append("speed=%.2f" % speed)
+ out.append("## %s%s" % (s, " {%s}" % " ".join(opts) if opts else ""))
+ out.append(say.replace("`", ""))
+ out.append("")
+ return "\n".join(out)
+
+
+GROUND, INK, INK2, HAIR, ACCENT, ACCENT_TEXT, GREEN = ("#F4F3EF", "#1E2024", "#4A4C50", "#B9B6AE", "#B8431D",
+ "#A23A17", "#2A6E45")
+
+CSS = r"""
+ :root {
+ --bg: #F4F3EF; --fg: #1E2024; --muted: #4A4C50; --hair: #B9B6AE; --accent: #B8431D; --accent-text: #A23A17;
+ --good: #2A6E45; --surface: #FBFAF7; --line: rgb(30 32 36 / 0.14);
+ --font-display: 'Instrument Serif', Georgia, serif; --font-sans: 'Geist', 'Inter', sans-serif;
+ --font-mono: 'Geist Mono', 'JetBrains Mono', monospace; --font-body: var(--font-sans);
+ --cap-font: 'Geist', sans-serif; --cap-weight: 600; --cap-case: none; --cap-ink: #1E2024; --cap-outline: #F4F3EF;
+ --cap-accent: #A23A17; --cap-active-ink: #F4F3EF; --cap-plate: rgb(244 243 239 / 0.94);
+ --scene-bg: transparent; color-scheme: light;
+ }
+ html, body { background: var(--bg); }
+ .stage { background: var(--bg); }
+ .scene { --x: 6.2cqw; --mid: 47cqh; --k: 2.6cqh; --title: 12.4cqh; --dek: 3.9cqh; --meta: 3cqh; --stat: 14.5cqh;
+ --lab: 2.7cqh; --lane: 3cqh; --tag: 2.7cqh; --row: 3.7cqh; --head: 9.4cqh; --big: 24cqh; padding: 0; }
+ .paper { position: absolute; inset: 0; pointer-events: none; }
+ .paper .frame { position: absolute; inset: 4cqh; border: max(1px, 0.14cqh) solid var(--hair); border-radius: 0.4cqh; }
+ .paper .grid { position: absolute; inset: 4cqh; opacity: 0.55;
+ background-image: linear-gradient(to right, rgb(185 182 174 / 0.2) 1px, transparent 1px),
+ linear-gradient(to bottom, rgb(185 182 174 / 0.2) 1px, transparent 1px);
+ background-size: 6cqh 6cqh; }
+ .cam { position: absolute; inset: 0; }
+ .kicker { position: absolute; left: var(--x); top: 9cqh; margin: 0; font: 500 var(--k)/1.2 var(--font-mono);
+ letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
+ .kicker b { color: var(--accent-text); font-weight: 500; }
+ .aside { position: absolute; right: var(--x); top: 9cqh; margin: 0; font: 500 var(--k)/1.2 var(--font-mono);
+ letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
+ .mid { position: absolute; left: var(--x); right: var(--x); top: var(--mid); translate: 0 -50%; }
+ @keyframes rise { from { opacity: 0; transform: translateY(0.5em); } to { opacity: 1; transform: none; } }
+ @keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
+ @keyframes pop { 0% { opacity: 0; transform: scale(0.2); } 70% { opacity: 1; transform: scale(1.25); } 100% { opacity: 1; transform: scale(1); } }
+ @keyframes tick { from { opacity: 0; transform: scaleY(0); } to { opacity: 1; transform: scaleY(1); } }
+ @keyframes sweep { from { left: 0%; } to { left: 100%; } }
+ .r { opacity: 0; animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) var(--at, 0s) both; }
+
+ /* hook: complete at frame 0 (the poster); a playhead runs over the session's strip */
+ .hook { display: flex; flex-direction: column; gap: 3.2cqh; right: 10cqw; }
+ .hook .title { margin: 0; font: 400 var(--title)/0.98 var(--font-display); letter-spacing: -0.012em; color: var(--fg);
+ max-width: 14em; text-wrap: balance; overflow-wrap: anywhere; }
+ .hook .title code, .end .title code { font-family: var(--font-display); font-style: italic; color: var(--accent-text); }
+ .hook .dek { margin: 0; font: 400 var(--dek)/1.34 var(--font-sans); color: var(--muted); max-width: 34em; text-wrap: pretty; }
+ .hook .meta { margin: 0.6cqh 0 0; font: 500 var(--meta)/1.2 var(--font-mono); letter-spacing: 0.04em; color: var(--fg); }
+ .strip { position: absolute; left: var(--x); right: var(--x); top: 75cqh; height: 3.2cqh;
+ border-top: max(1px, 0.12cqh) solid var(--hair); }
+ .strip i { position: absolute; top: 0.6cqh; width: max(2px, 0.16cqw); height: 2.2cqh; background: var(--hair); }
+ .strip i.e { background: var(--accent); height: 2.6cqh; } .strip i.t { background: var(--good); }
+ .strip span { position: absolute; top: 3.6cqh; font: 500 var(--tag)/1 var(--font-mono); color: var(--muted); }
+ .strip .s0 { left: 0; } .strip .s1 { right: 0; }
+ .strip b { position: absolute; top: -1.2cqh; bottom: -0.6cqh; left: 0; width: max(2px, 0.16cqw); background: var(--accent);
+ animation: sweep var(--sweep) linear var(--at) both; }
+
+ /* numbers */
+ .stats { display: flex; flex-wrap: wrap; column-gap: 4.2cqw; row-gap: 5cqh; }
+ .stat { border-top: max(1px, 0.14cqh) solid var(--hair); padding-top: 2.6cqh; min-width: 9cqw; }
+ .stat .v { display: block; font: 400 var(--stat)/0.95 var(--font-display); color: var(--fg); letter-spacing: -0.02em;
+ white-space: nowrap; }
+ .stat .l { display: block; margin-top: 1.8cqh; font: 500 var(--lab)/1.25 var(--font-mono); letter-spacing: 0.08em;
+ text-transform: uppercase; color: var(--muted); white-space: nowrap; }
+ .stat:first-child .v { color: var(--accent-text); font-style: italic; }
+
+ /* timeline: lanes, ticks, a playhead */
+ .tl { position: absolute; left: var(--x); right: var(--x); top: 17cqh; height: 60cqh; --label: 15cqw; --lead: 16.3cqh; }
+ .tl .co { position: absolute; left: var(--label); right: 0; top: 0; height: 12cqh; }
+ .tl .co span { position: absolute; bottom: calc(var(--tier) * 5.2cqh); white-space: nowrap; font: 500 var(--tag)/1 var(--font-mono);
+ color: var(--accent-text); padding: 0 0 0.3cqh 0.9cqw; border-left: max(2px, 0.18cqh) solid var(--accent);
+ opacity: 0; animation: rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) var(--at) both; }
+ .tl .co span::after { content: ""; position: absolute; left: calc(-1 * max(2px, 0.18cqh)); top: 100%;
+ height: calc(var(--lead) + var(--tier) * 5.2cqh); border-left: max(1px, 0.12cqh) dashed var(--accent); opacity: 0.55; }
+ .tl .lanes { position: absolute; left: 0; right: 0; top: 15cqh; bottom: 8cqh; display: flex; flex-direction: column;
+ justify-content: space-between; }
+ .tl .lane { position: relative; height: 6cqh; }
+ .tl .lane .name { position: absolute; left: 0; top: 50%; translate: 0 -50%; font: 500 var(--lane)/1 var(--font-mono);
+ letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
+ .tl .lane .name b { color: var(--fg); font-weight: 600; margin-left: 0.5em; }
+ .tl .track { position: absolute; left: var(--label); right: 0; top: 50%; height: 0; border-top: max(1px, 0.12cqh) solid var(--hair); }
+ .tl .tk { position: absolute; top: -2.3cqh; width: max(2px, 0.2cqw); height: 4.6cqh; margin-left: -0.1cqw;
+ background: var(--fg); opacity: 0; transform-origin: 50% 100%; animation: tick 0.2s ease-out var(--at) both; }
+ .tl .edit .tk { background: var(--accent); width: max(3px, 0.3cqw); }
+ .tl .test .tk { top: -1.3cqh; width: 2.6cqh; height: 2.6cqh; margin-left: -1.3cqh; border-radius: 50%;
+ background: var(--hair); animation-name: pop; animation-duration: 0.35s; }
+ .tl .test .tk.ok { background: var(--good); } .tl .test .tk.bad { background: var(--accent); }
+ .tl .ph { position: absolute; left: var(--label); right: 0; top: 13cqh; bottom: 6cqh; pointer-events: none; }
+ .tl .ph i { position: absolute; top: 0; bottom: 0; left: 0; width: max(2px, 0.16cqw); background: var(--accent);
+ animation: sweep var(--sweep) linear var(--at) both; }
+ .tl .axis { position: absolute; left: var(--label); right: 0; bottom: 0; display: flex; justify-content: space-between;
+ font: 500 var(--tag)/1 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; }
+
+ /* files */
+ .files .head, .tests .head { margin: 0 0 3.6cqh; font: 400 var(--head)/1 var(--font-display); color: var(--fg); letter-spacing: -0.015em; }
+ .files ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.7cqh; }
+ .files li { display: flex; align-items: baseline; gap: 2cqw; border-bottom: max(1px, 0.12cqh) solid var(--line);
+ padding-bottom: 1.5cqh; font: 500 var(--row)/1.2 var(--font-mono); }
+ .files .p { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+ .files .p b { color: var(--fg); font-weight: 600; }
+ .files .p i { font-style: normal; }
+ .files .s { margin-left: auto; white-space: nowrap; color: var(--muted); }
+ .files .s .a { color: var(--good); } .files .s .d { color: var(--accent-text); }
+ .files .more { margin: 2cqh 0 0; font: 500 var(--tag)/1 var(--font-mono); color: var(--muted); }
+
+ /* tests */
+ .dots { display: flex; flex-wrap: wrap; gap: 1.8cqh; margin: 0 0 4.6cqh; max-width: 86cqw; }
+ .dots i { display: block; width: 4.6cqh; height: 4.6cqh; border-radius: 50%; background: var(--hair); opacity: 0;
+ animation: dotin 0.5s cubic-bezier(0.22, 1, 0.36, 1) var(--at) both; }
+ @keyframes dotin { from { opacity: 0; transform: scale(0.55); } to { opacity: 1; transform: none; } }
+ .dots i.ok { background: var(--good); } .dots i.bad { background: var(--accent); }
+ .tests .res { display: flex; align-items: baseline; gap: 2.6cqw; }
+ .tests .v { font: 400 var(--big)/0.86 var(--font-display); color: var(--good); letter-spacing: -0.02em; white-space: nowrap; }
+ .tests .v.bad { color: var(--accent-text); }
+ .tests .l { font: 500 var(--lab)/1.35 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); max-width: 16em; }
+ .tests .note { margin: 3cqh 0 0; font: 400 var(--dek)/1.3 var(--font-sans); color: var(--muted); }
+ .tests .legend { margin: 1.6cqh 0 0; font: 500 var(--tag)/1.3 var(--font-mono); color: var(--muted); display: flex;
+ flex-wrap: wrap; column-gap: 2.4cqw; row-gap: 0.6cqh; }
+ .tests .legend i { display: inline-block; width: 1.6cqh; height: 1.6cqh; border-radius: 50%; margin-right: 0.6em;
+ background: var(--hair); vertical-align: -0.1em; }
+ .tests .legend i.ok { background: var(--good); } .tests .legend i.bad { background: var(--accent); }
+
+ /* diff */
+ .diff { display: flex; flex-direction: column; gap: 3.4cqh; }
+ .diff .nums { display: flex; gap: 6cqw; align-items: baseline; }
+ .diff .a, .diff .d { font: 400 calc(var(--big) * 1.25)/0.86 var(--font-display); letter-spacing: -0.02em; white-space: nowrap; }
+ .diff .a { color: var(--good); } .diff .d { color: var(--accent-text); }
+ .diff .detail { margin: 0; font: 500 var(--row)/1.2 var(--font-mono); color: var(--fg); letter-spacing: 0.02em; }
+ .diff .bar { height: 1.6cqh; display: flex; width: 64cqw; max-width: 100%; border-radius: 0.8cqh; overflow: hidden; }
+ .diff .bar i { display: block; height: 100%; transform-origin: left; animation: draw 0.9s cubic-bezier(0.16, 1, 0.3, 1) var(--at) both; }
+ .diff .bar .ga { background: var(--good); } .diff .bar .gd { background: var(--accent); }
+
+ /* end */
+ .end { display: flex; flex-direction: column; gap: 3.2cqh; right: 10cqw; }
+ .end .title { margin: 0; font: 400 calc(var(--title) * 0.86)/1 var(--font-display); color: var(--fg); max-width: 15em; text-wrap: balance; }
+ .end .outcome { margin: 0; font: 500 var(--row)/1.3 var(--font-mono); color: var(--good); letter-spacing: 0.02em; }
+ .end .note { margin: 0; font: 500 var(--tag)/1.3 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; }
+
+ /* tall frames (--aspect 9:16): captions hang from 62 % of the height and the platform's buttons cover the
+ right edge, so the content sits above the captions and left of the buttons, in phone-sized type */
+ @container (max-aspect-ratio: 3/4) {
+ .scene { --x: 8cqw; --mid: 37.4cqh; --k: 4.1cqw; --title: 11cqw; --dek: 4.7cqw; --meta: 4.2cqw; --stat: 10.5cqw;
+ --lab: 4.1cqw; --lane: 4.1cqw; --tag: 4.1cqw; --row: 4.1cqw; --head: 10cqw; --big: 22cqw; }
+ .paper .frame, .paper .grid { inset: 2.2cqh 3.6cqw; }
+ .kicker { top: 12.8cqh; right: 16cqw; white-space: normal; letter-spacing: 0.06em; }
+ .mid, .hook, .end { right: 16cqw; }
+ .aside { left: var(--x); right: 16cqw; top: 16.6cqh; white-space: normal; letter-spacing: 0; }
+ .strip { top: 56cqh; right: 16cqw; }
+ .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 6cqw; row-gap: 3cqh; }
+ .stat { min-width: 0; padding-top: 1.6cqh; }
+ .stat .l { white-space: normal; }
+ .tl { top: 23cqh; height: 34cqh; right: 16cqw; --label: 24cqw; }
+ .tl .co { display: none; }
+ .tl .lanes { top: 2cqh; bottom: 5cqh; }
+ .tl .ph { top: 1cqh; bottom: 4cqh; }
+ .files .p i { display: none; }
+ .tests { top: 21cqh; translate: 0 0; } /* anchored under the kicker: the dots and legend make it tall */
+ .tests .head { margin-bottom: 2.4cqh; }
+ .dots { max-width: none; gap: 2.2cqw; margin-bottom: 2.6cqh; }
+ .dots i { width: 6cqw; height: 6cqw; }
+ .tests .res { --big: 17cqw; gap: 3cqw; }
+ .diff .nums { flex-direction: column; gap: 1cqh; }
+ .diff .bar { width: 100%; }
+ }
+"""
+
+
+def _e(s: str) -> str:
+ return rv._e(s)
+
+
+def _title_html(s: str) -> str:
+ return rv._inline(s)
+
+
+def _path_html(path: str) -> str:
+ d, _, name = path.rpartition("/")
+ return "%s<b>%s</b>" % ("<i>%s</i>" % _e(d + "/") if d else "", _e(name))
+
+
+def _lane_html(text: str) -> str:
+ m = re.match(r"^(.*?)\s+([\d,]+)$", text)
+ return "%s<b>%s</b>" % (_e(m.group(1)), _e(m.group(2))) if m else _e(text)
+
+
+def _callout_tiers(items: List[Tuple[float, str]], width_cqw: float = 72.6) -> List[Tuple[float, int]]:
+ """(x in %, tier) per callout: two tiers, labels pushed right (and clamped) so none overlap."""
+ ends = [-1.0, -1.0]
+ out = []
+ for x, text in items:
+ w = (len(text) * 0.95 + 1.8) / width_cqw * 100.0 # a label's width, in % of the track
+ x = min(x, max(0.0, 100.0 - w))
+ tier = 0 if x >= ends[0] else (1 if x >= ends[1] else (0 if ends[0] <= ends[1] else 1))
+ x = max(x, ends[tier])
+ x = min(x, max(0.0, 100.0 - w))
+ ends[tier] = x + w + 0.8
+ out.append((round(x, 2), tier))
+ return out
+
+
+def build_page(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]", scenes: Sequence[str],
+ durs: Dict[str, float], *, captions: bool = False, aspect: str = "16:9") -> str:
+ T = lambda k: lines[k]["text"] if k in lines else "" # noqa: E731
+ tall = aspect == "9:16"
+ out: List[str] = []
+ prev = ""
+ dur_total = max(1.0, facts.get("span") or facts["duration"] or 1.0) # positions: wall-clock
+ for sid in scenes:
+ d = durs[sid]
+ start = "0" if not prev else "#" + prev
+ trans = "" if not prev else ' data-transition="dip 0.5"'
+ push = [{"at": 0, "zoom": 1}, {"at": 0.15, "dur": round(max(1.0, d - 0.3), 2), "zoom": 1.025 if tall else 1.035,
+ "focus": [50, 36] if tall else [42, 46], "to": "stay", "ease": "linear"}]
+ out.append(' <section class="scene" id="%s" data-start="%s" data-dur="%.2f"%s>\n <div class="cam" '
+ 'data-st="camera" data-path=\'%s\'>' % (sid, start, d, trans, json.dumps(push)))
+ if sid == "hook":
+ if T("hook.kicker"):
+ out.append(' <p class="kicker">%s</p>' % _kicker_html(T("hook.kicker")))
+ out.append(' <div class="mid hook">')
+ if T("hook.title"):
+ out.append(' <h1 class="title">%s</h1>' % _title_html(T("hook.title")))
+ if T("hook.request"):
+ out.append(' <p class="dek">%s</p>' % _e(T("hook.request")))
+ if T("hook.meta"):
+ out.append(' <p class="meta">%s</p>' % _e(T("hook.meta")))
+ out.append(" </div>")
+ out.append(_strip_html(facts, d, lines))
+ elif sid == "numbers":
+ if T("numbers.kicker"):
+ out.append(' <p class="kicker r" style="--at:0.1s">%s</p>' % _e(T("numbers.kicker")))
+ keys = [k[5:-6] for k in lines if k.startswith("stat.") and k.endswith(".value")]
+ out.append(' <div class="mid stats">')
+ for i, k in enumerate(keys):
+ out.append(' <div class="stat r" style="--at:%.2fs"><span class="v">%s</span><span class="l">%s'
+ '</span></div>' % (0.25 + 0.18 * i, _e(T("stat.%s.value" % k)), _e(T("stat.%s.label" % k))))
+ out.append(" </div>")
+ elif sid == "timeline":
+ out.append(_timeline_html(facts, lines, d, dur_total))
+ elif sid == "files":
+ if T("files.kicker"):
+ out.append(' <p class="kicker r" style="--at:0.1s">%s</p>' % _e(T("files.kicker")))
+ out.append(' <div class="mid files">')
+ if T("files.head"):
+ out.append(' <h2 class="head r" style="--at:0.2s">%s</h2>' % _e(T("files.head")))
+ out.append(" <ul>")
+ i = 0
+ for k in lines:
+ if re.fullmatch(r"file\.\d+", k):
+ stat = T(k + ".stat")
+ m = re.match(r"^\+([\d,]+)\s+[−-]([\d,]+)$", stat)
+ stat_html = ('<span class="a">+%s</span> <span class="d">−%s</span>' % (m.group(1), m.group(2))
+ if m else _e(stat))
+ out.append(' <li class="r" style="--at:%.2fs"><span class="p">%s</span><span class="s">%s'
+ '</span></li>' % (0.45 + 0.15 * i, _path_html(T(k)), stat_html))
+ i += 1
+ out.append(" </ul>")
+ if T("files.more"):
+ out.append(' <p class="more r" style="--at:%.2fs">%s</p>' % (0.45 + 0.15 * i, _e(T("files.more"))))
+ out.append(" </div>")
+ elif sid == "tests":
+ out.append(_tests_html(facts, lines))
+ elif sid == "diff":
+ if T("diff.kicker"):
+ out.append(' <p class="kicker r" style="--at:0.1s">%s</p>' % _e(T("diff.kicker")))
+ out.append(' <div class="mid diff">')
+ if T("diff.adds") or T("diff.dels"):
+ out.append(' <div class="nums r" style="--at:0.25s"><span class="a">%s</span><span class="d">%s</span>'
+ '</div>' % (_e(T("diff.adds")), _e(T("diff.dels"))))
+ a, dl = facts["diff"]["additions"], facts["diff"]["deletions"]
+ tot = max(1, a + dl)
+ out.append(' <div class="bar"><i class="ga" style="width:%.1f%%;--at:0.6s"></i><i class="gd" '
+ 'style="width:%.1f%%;--at:0.9s"></i></div>' % (100.0 * a / tot, 100.0 * dl / tot))
+ if T("diff.detail"):
+ out.append(' <p class="detail r" style="--at:0.7s">%s</p>' % _e(T("diff.detail")))
+ out.append(" </div>")
+ else:
+ if T("end.kicker"):
+ out.append(' <p class="kicker r" style="--at:0.1s"><b>%s</b></p>' % _e(T("end.kicker")))
+ out.append(' <div class="mid end">')
+ if T("hook.title"):
+ out.append(' <h2 class="title r" style="--at:0.25s">%s</h2>' % _title_html(T("hook.title")))
+ if T("end.outcome"):
+ out.append(' <p class="outcome r" style="--at:0.5s">%s</p>' % _e(T("end.outcome")))
+ if T("end.note"):
+ out.append(' <p class="note r" style="--at:0.8s">%s</p>' % _e(T("end.note")))
+ out.append(" </div>")
+ out.append(" </div>\n </section>")
+ prev = sid
+ cap = ('\n <div data-st="caption-karaoke" data-src="voice/captions.words.json" data-style="clean-pop" '
+ 'data-at="0"></div>' if captions else "")
+ title = T("hook.title") or "Session recap"
+ return ("<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>%s</title>\n"
+ "<script src=\"/_st/stage.js\"></script>\n<link rel=\"stylesheet\" href=\"/_st/themes/base.css\">\n"
+ "<link rel=\"stylesheet\" href=\"/_st/themes/fonts/geist.css\">\n"
+ "<link rel=\"stylesheet\" href=\"/_st/themes/fonts/geist-mono.css\">\n"
+ "<link rel=\"stylesheet\" href=\"/_st/themes/fonts/instrument-serif.css\">\n"
+ "<script type=\"module\" src=\"/_st/components/index.js\"></script>\n<!-- Written by `showtime recap` "
+ "from script.md: every word on screen is a line of that script (the session's allow-listed facts). "
+ "Edit script.md and rerun recap rather than this page. -->\n<style>%s</style>\n</head>\n<body>\n"
+ "<div class=\"stage\">\n <div class=\"paper\" data-st-decor><div class=\"grid\"></div><div class=\"frame\">"
+ "</div></div>\n%s%s\n</div>\n</body>\n</html>\n" % (_e(title), CSS, "\n".join(out), cap))
+
+
+def _kicker_html(text: str) -> str:
+ parts = text.split(" · ", 1)
+ return "<b>%s</b>%s" % (_e(parts[0]), (" &nbsp;·&nbsp; " + _e(parts[1])) if len(parts) > 1 else "")
+
+
+def _timeline_html(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]", d: float, dur_total: float) -> str:
+ T = lambda k: lines[k]["text"] if k in lines else "" # noqa: E731
+ sweep_at = 0.5
+ sweep = max(2.0, d - sweep_at - 1.2)
+ at = lambda t: sweep_at + sweep * min(1.0, max(0.0, t / dur_total)) # noqa: E731
+ o = []
+ if T("timeline.kicker"):
+ o.append(' <p class="kicker r" style="--at:0.1s">%s</p>' % _e(T("timeline.kicker")))
+ o.append(' <div class="tl">')
+ # edited files as callouts above the lanes, at their first edit
+ edited = sorted([f for f in facts["files"] if f["edited"]], key=lambda f: f["first_edit"] or 0)
+ items = []
+ for i, f in enumerate(edited[:MAX_CALLOUTS]):
+ k = "callout.%d" % (i + 1)
+ if T(k):
+ items.append(((f["first_edit"] or 0) / dur_total * 100.0, T(k), f["first_edit"] or 0))
+ if items:
+ o.append(' <div class="co">')
+ for (x, tier), (_x, text, t) in zip(_callout_tiers([(x, s) for x, s, _t in items]), items):
+ o.append(' <span style="left:%.2f%%;--tier:%d;--at:%.2fs">%s</span>' % (x, tier, at(t) + 0.1, _e(text)))
+ o.append(" </div>")
+ o.append(' <div class="lanes">')
+ events = facts["timeline"]
+ for k in ("read", "edit", "run", "test"):
+ key = "lane.%s" % k
+ if key not in lines:
+ continue
+ o.append(' <div class="lane %s"><span class="name">%s</span><div class="track">' % (k, _lane_html(T(key))))
+ if k == "test":
+ for x in facts["tests"][:120]:
+ cls = " ok" if x["ok"] else (" bad" if x["ok"] is False else "")
+ o.append(' <i class="tk%s" style="left:%.2f%%;--at:%.2fs"></i>' % (
+ cls, 100.0 * min(1.0, x["t"] / dur_total), at(x["t"])))
+ else:
+ ts = [e["t"] for e in events if e["k"] == k]
+ # at most ~140 ticks a lane: nearby events merge into one
+ step = dur_total / 140.0
+ seen = set()
+ for t in ts:
+ b = int(t / step) if step > 0 else 0
+ if b in seen:
+ continue
+ seen.add(b)
+ o.append(' <i class="tk" style="left:%.2f%%;--at:%.2fs"></i>' % (
+ 100.0 * min(1.0, t / dur_total), at(t)))
+ o.append(" </div></div>")
+ o.append(" </div>")
+ o.append(' <div class="ph"><i style="--at:%.2fs;--sweep:%.2fs"></i></div>' % (sweep_at, sweep))
+ if T("axis.start") or T("axis.end"):
+ o.append(' <div class="axis r" style="--at:0.3s"><span>%s</span><span>%s</span></div>' % (
+ _e(T("axis.start")), _e(T("axis.end"))))
+ o.append(" </div>")
+ if T("timeline.commands"):
+ o.append(' <p class="aside r" style="--at:0.4s">%s</p>' % _e(T("timeline.commands")))
+ return "\n".join(o)
+
+
+def _legend_html(text: str) -> str:
+ """'red failed · green passed · grey not counted' with a dot of the colour before each part."""
+ out = []
+ for part in text.split(" · "):
+ w = part.split(" ", 1)[0].lower()
+ cls = {"red": "bad", "green": "ok", "grey": "", "gray": ""}.get(w)
+ out.append(('<span><i class="%s"></i>%s</span>' % (cls, _e(part))) if cls is not None else _e(part))
+ return " ".join(out)
+
+
+def _strip_html(facts: Dict[str, Any], d: float, lines: Optional["OrderedDict[str, Dict[str, Any]]"] = None) -> str:
+ """The hook's strip: the whole session as ticks (complete at frame 0), a playhead running over it."""
+ dur_total = max(1.0, facts.get("span") or facts["duration"] or 1.0) # positions: wall-clock
+ step = dur_total / 160.0
+ seen = set()
+ ticks = []
+ for e in facts["timeline"]:
+ if e["k"] not in ("read", "edit", "run", "test"):
+ continue
+ b = (int(e["t"] / step), e["k"] == "edit")
+ if b in seen:
+ continue
+ seen.add(b)
+ ticks.append('<i%s style="left:%.2f%%"></i>' % ({"edit": ' class="e"', "test": ' class="t"'}.get(e["k"], ""),
+ 100.0 * min(1.0, e["t"] / dur_total)))
+ axis = ""
+ if lines and ("axis.start" in lines or "axis.end" in lines):
+ axis = '<span class="s0">%s</span><span class="s1">%s</span>' % (
+ _e(lines["axis.start"]["text"] if "axis.start" in lines else ""),
+ _e(lines["axis.end"]["text"] if "axis.end" in lines else ""))
+ return (' <div class="strip">%s<b style="--at:0.3s;--sweep:%.2fs"></b>%s</div>'
+ % ("".join(ticks), max(1.0, d - 0.8), axis))
+
+
+DOTS_AT = 0.95 # after the cut's dip and the heading's rise: nothing starts while the scene settles
+
+
+def _tests_html(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]") -> str:
+ T = lambda k: lines[k]["text"] if k in lines else "" # noqa: E731
+ o = []
+ if T("tests.kicker"):
+ o.append(' <p class="kicker r" style="--at:0.1s">%s</p>' % _e(T("tests.kicker")))
+ o.append(' <div class="mid tests">')
+ if T("tests.head"):
+ o.append(' <h2 class="head r" style="--at:0.2s">%s</h2>' % _e(T("tests.head")))
+ runs = facts["tests"][-40:]
+ o.append(' <div class="dots">%s</div>' % "".join(
+ '<i class="%s" style="--at:%.2fs"></i>' % ("ok" if x["ok"] else ("bad" if x["ok"] is False else ""),
+ DOTS_AT + 0.07 * i)
+ for i, x in enumerate(runs)))
+ t_res = DOTS_AT + 0.07 * len(runs) + 0.2
+ st = test_story(facts["tests"])
+ if T("tests.value") or T("tests.label"):
+ o.append(' <div class="res r" style="--at:%.2fs"><span class="v%s">%s</span><span class="l">%s</span></div>'
+ % (t_res, " bad" if st["ends_red"] else "", _e(T("tests.value")), _e(T("tests.label"))))
+ if T("tests.note"):
+ o.append(' <p class="note r" style="--at:%.2fs">%s</p>' % (t_res + 0.4, _e(T("tests.note"))))
+ if T("tests.legend"):
+ o.append(' <p class="legend r" style="--at:%.2fs">%s</p>' % (t_res + 0.6, _legend_html(T("tests.legend"))))
+ o.append(" </div>")
+ return "\n".join(o)
+
+
+SIZES = {"16:9": (1920, 1080), "9:16": (1080, 1920)}
+
+
+def project_files(facts: Dict[str, Any], lines: "OrderedDict[str, Dict[str, Any]]", scenes: Sequence[str],
+ durs: Dict[str, float], *, aspect: str = "16:9", captions: bool = False,
+ fps: int = 30, music: Optional[str] = None, fetch: bool = False,
+ project: Optional[Path] = None, cut_sounds: bool = False) -> Dict[str, Any]:
+ """{index.html, showtime.json, audio/mix.json, recap.json} contents for a project. The bed and the effects
+ come from the session (st.bed: the same session sounds the same, another one does not); `music` pins the bed."""
+ w, h = SIZES[aspect]
+ total = round(sum(durs[s] for s in scenes), 2)
+ title = lines["hook.title"]["text"] if "hook.title" in lines else "Session recap"
+ p = {"scenes": [{"id": s, "dur": durs[s]} for s in scenes], "kind": "recap"}
+ starts, t = [], 0.0
+ for s_ in scenes:
+ starts.append(round(t, 2))
+ t += durs[s_]
+ names = ["intro"] + ["verse"] * max(0, len(starts) - 2) + ["outro"]
+ key = str(facts.get("ref") or title)
+ choice = bed.choose("recap", key, total, ",".join("%g:%s" % (a, b) for a, b in zip(starts, names)), pin=music,
+ gain_db=-2, fetch=fetch, project=project,
+ duck={"under": "voice", "depth_db": bed.DUCK_DEPTH_DB} if captions else None)
+ tracks: List[Dict[str, Any]] = [choice["track"]] if choice["track"] else []
+ for a in starts[1:] if cut_sounds else (): # opt-in (--cut-sounds): a soft swoosh as the picture visibly changes
+ tracks.append({"kind": "sfx", "synth": bed.synth(key, "cut", int(a), 0.35, choice.get("key")), "at": round(a + 0.15, 2),
+ "align": "hit", "gain_db": bed.CUT_GAIN_DB})
+ mix = {"_comment": bed.comment(choice, bool(len(starts) > 1 and cut_sounds)),
+ "sample_rate": 48000, "tracks": tracks, "master": {"lufs": -14, "true_peak": -1}}
+ cfg = {"title": title, "width": w, "height": h, "fps": fps, "duration": total, "background": GROUND,
+ "poster": 0, "audio": "audio/mix.json", "subtitle": "What the agent did, from the session log.",
+ "kicker": "Recap", "startTitle": False, "render": {"crf": 22},
+ "expect": {"duration": total, "audio": True}}
+ src = {"generator": "showtime recap", "note": "the allow-listed facts this film was made from (no transcript "
+ "text, no tool output, no absolute paths)", "facts": facts,
+ "scenes": [{"id": s, "dur": durs[s]} for s in scenes]}
+ return {"index.html": build_page(facts, lines, scenes, durs, captions=captions, aspect=aspect),
+ "showtime.json": json.dumps(cfg, indent=2) + "\n", "audio/mix.json": json.dumps(mix, indent=2) + "\n",
+ "recap.json": json.dumps(src, indent=2) + "\n", "duration": total, "bed": choice}
+
+
+def write_project(out: Path, files: Dict[str, Any]) -> None:
+ out = Path(out)
+ (out / "audio").mkdir(parents=True, exist_ok=True)
+ for name in ("index.html", "showtime.json", "audio/mix.json", "recap.json"):
+ (out / name).write_text(files[name], encoding="utf-8")
+
+
+def summary(facts: Dict[str, Any]) -> str:
+ st = test_story(facts["tests"]) if facts["tests"] else None
+ parts = [fmt_duration(facts["duration"]), _plural(facts["turns"], "turn"), _plural(facts["tool_calls"], "tool call"),
+ _plural(len(facts["files"]), "repo file"), "%d edited" % sum(1 for f in facts["files"] if f["edited"])]
+ if st:
+ parts.append(_plural(st["runs"], "test run") + (" (red to green)" if st["red_to_green"] else ""))
+ if facts["diff"]["files"]:
+ parts.append("+%d -%d in %s" % (facts["diff"]["additions"], facts["diff"]["deletions"],
+ _plural(facts["diff"]["files"], "file")))
+ if facts["files_outside"]:
+ parts.append("%s outside the repo left out" % _plural(facts["files_outside"], "path"))
+ return ", ".join(parts)
diff --git a/skills/showtime/lib/st/release_video.py b/skills/showtime/lib/st/release_video.py
index 2ae3c44..ad1df08 100644
--- a/skills/showtime/lib/st/release_video.py
+++ b/skills/showtime/lib/st/release_video.py
@@ -533,7 +533,7 @@ def build_page(p: Dict[str, Any], notes: Dict[str, Any], *, install: str = "", u
% (_e("%s %s" % (name, ver_disp)).strip(), CSS, body))
-def build_mix(p: Dict[str, Any], seed: int = 7) -> Dict[str, Any]:
+def build_mix(p: Dict[str, Any], seed: int = 7, cut_sounds: bool = False) -> Dict[str, Any]:
starts: List[float] = []
t = 0.0
for sc in p["scenes"]:
@@ -544,11 +544,11 @@ def build_mix(p: Dict[str, Any], seed: int = 7) -> Dict[str, Any]:
tracks: List[Dict[str, Any]] = [
{"id": "bed", "kind": "music", "compose": {"style": "minimal-pulse", "sections": sections, "seed": seed},
"gain_db": -2, "fade_out": 1.2}]
- for s in starts[1:]:
+ for s in starts[1:] if cut_sounds else (): # opt-in (--cut-sounds): no sound on an ordinary cut
tracks.append({"kind": "sfx", "synth": {"type": "swoosh-in", "intensity": 0.35, "seed": seed + int(s)},
"at": s, "align": "hit", "gain_db": -9})
- return {"_comment": "Generated by showtime release-video: a composed bed on the scene starts and a soft swoosh "
- "on each cut; everything is made on this machine.",
+ return {"_comment": "Generated by showtime release-video: a composed bed on the scene starts%s; everything is made "
+ "on this machine." % (" and a soft swoosh on each cut" if cut_sounds else ""),
"sample_rate": 48000, "tracks": tracks, "master": {"lufs": -14, "true_peak": -1}}
@@ -587,13 +587,14 @@ def write_files(out: Path, *, page: str, cfg: Dict[str, Any], mix: Dict[str, Any
def write_project(out: Path, notes: Dict[str, Any], p: Dict[str, Any], *, install: str = "", url: str = "",
- date: str = "", aspect: str = "16:9", fps: int = 30, force: bool = False) -> Dict[str, Any]:
+ date: str = "", aspect: str = "16:9", fps: int = 30, force: bool = False,
+ cut_sounds: bool = False) -> Dict[str, Any]:
ver = p["version"]
title = ("%s %s" % (p["name"], ver if ver.startswith(("v", "#")) or not ver else "v" + ver)).strip()
cfg = project_config(p, title=title, aspect=aspect, fps=fps)
src = {"generator": "showtime release-video", "notes": notes, "plan": {k: v for k, v in p.items() if k != "scenes"},
"scenes": [{"id": s["id"], "dur": s["dur"]} for s in p["scenes"]], "install": install, "url": url}
- write_files(out, page=build_page(p, notes, install=install, url=url, date=date), cfg=cfg, mix=build_mix(p),
+ write_files(out, page=build_page(p, notes, install=install, url=url, date=date), cfg=cfg, mix=build_mix(p, cut_sounds=cut_sounds),
source_name="release.json", source=src, force=force)
return {"project": str(out), "duration": cfg["duration"], "scenes": len(p["scenes"]), "shown": p["shown"],
"total": p["total"], "more": p["more"], "authors": notes.get("authors", []), "title": title}
diff --git a/skills/showtime/lib/st/repro.py b/skills/showtime/lib/st/repro.py
new file mode 100644
index 0000000..321a3cd
--- /dev/null
+++ b/skills/showtime/lib/st/repro.py
@@ -0,0 +1,2254 @@
+"""A failing browser test -> a short narrated video for a bug report or a pull request (`showtime repro`).
+
+Reads a Playwright trace (the trace.zip `npx playwright test --trace on` or `pytest --tracing on` writes) and
+writes a project in the release-video look: a title card (test name, file:line, FAILED), each action on the
+screenshot the trace holds for it (a cursor and a click ripple at the action's target box, a step counter, a
+one-line caption), the failing step slowed down (the assertion's source line, expected and received side by
+side, the error, console errors) and an end card with the command that re-runs it. Long tests keep their first
+step and the steps just before the failure; the passing steps in between become one "+ N passing steps" scene.
+
+Privacy: values typed into password fields, or fields whose name, label, id, placeholder or autocomplete says
+password, secret, token, key or OTP, are masked; URLs lose their query string and fragment; home folders show
+as ~; secret-looking strings (the pr-video masks) and every `--redact` pattern are masked in every text the
+film, the captions, steps.json and repro.md show. Network requests, headers, cookies and bodies are never read.
+Screenshots are shown as they were captured.
+
+Stdlib only (the voice, the render and qa are separate steps the CLI runs after writing the project).
+"""
+from __future__ import annotations
+
+import hashlib
+import io
+import json
+import os
+import re
+import shlex
+import shutil
+import subprocess
+import sys
+import time
+import zipfile
+from pathlib import Path
+from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
+
+from . import bed
+from . import pr_video as pv
+from . import release_video as rv
+from .common import ShowtimeError
+
+MASK = pv.MASK
+MIN_SECONDS, MAX_SECONDS = 10.0, 40.0 # the title, the failure and the end card alone hold more than 10 s
+LEAD, ENTER, OUT = pv.LEAD, pv.ENTER, pv.OUT
+VOICE_PAD = 0.3 # picture before a scene's narration starts (retime --from-voice's default)
+VOICE_TAIL = 0.4 # picture after it ends
+
+# ---------------------------------------------------------------------------
+# redaction
+# ---------------------------------------------------------------------------
+
+# a field is secret when its name, label, id, placeholder, test id or autocomplete says so
+SENSITIVE = re.compile(r"passw|passcode|passphrase|secret|token|(?:^|[^a-z])otp|one.?time|api.?key|private.?key|"
+ r"(?:^|[^a-z])keys?(?:$|[^a-z])", re.I)
+SENSITIVE_CAMEL = re.compile(r"[a-z0-9](?:Key|Keys|Otp|OTP)(?![a-z])")
+SECRET_AUTOCOMPLETE = ("current-password", "new-password", "one-time-code")
+_URL = re.compile(r"\b(?:https?|wss?|file|ftp)://[^\s\"'<>`)\]]+")
+# a bare path token (/login?next=...): matched whole, then cut at its first ? or # in Python (no backtracking)
+_PATH_TOKEN = re.compile(r"(?<![\w:/])/[^\s\"'<>`)\]]*")
+# a path on this machine (a home folder, a temp or system folder, a drive): shown as its last part only
+_ABS_PATH = re.compile(r"(?<![\w.:/~\\-])(?:/(?:Users|home|root|private|var|tmp|opt|usr|Volumes|mnt|srv|etc|Library|"
+ r"System|nix|snap|builds|workspace)(?=/)|~(?=/)|[A-Za-z]:[\\/])[^\s\"'<>`|*?]*")
+# secrets in free text (console lines, errors): auth headers, NAME=value / NAME: value, e-mail addresses
+_AUTH = re.compile(r"(?i)\b(bearer|basic|token|bot)(\s+)([A-Za-z0-9._~+/=-]{12,})")
+_KV = re.compile(r"(?i)(\b[\w-]{0,20}?(?:(?:access|refresh|id|auth|bearer|csrf|xsrf|session)[_-]?token|token|"
+ r"api[_ -]?key|apikey|secret|password|passwd|pwd|session(?:[_-]?id)?|sessid|sid|"
+ r"auth(?:orization)?|cookie|set-cookie|jwt|private[_-]?key)s?[\"']?\s*[=:]\s*[\"']?)"
+ r"([^\s&\"',;)\]}>]{3,})")
+_EMAIL = re.compile(r"(?<![\w.%+-])[A-Za-z0-9._%+-]{1,64}@([A-Za-z0-9-]{1,63}(?:\.[A-Za-z0-9-]{1,63}){1,8})\b")
+_USERINFO = re.compile(r"(?<![\w.%+-])[\w.%+-]{1,64}:[^\s@/:]{1,128}@(?=[\w-])") # user:password@host
+_TYPED_CALL = re.compile(r"\b(fill|type|pressSequentially|insertText)\((?:\"[^\"\n]{0,2000}\"|'[^'\n]{0,2000}')")
+MAX_TEXT = 2000 # any text is cut to this before a pattern runs (more than any shown text)
+MAX_WORD = 200 # a longer run without a space is cut before the shared secret masks run
+
+
+def _bare(path: str) -> str:
+ parts = [p for p in re.split(r"[\\/]", path) if p]
+ return parts[-1] if parts else ""
+
+
+def _drop_query(m: "re.Match[str]") -> str:
+ t = m.group(0)
+ cut = [i for i in (t.find("?"), t.find("#")) if i >= 0]
+ return t[:min(cut)] if cut and re.fullmatch(r"(?:/[\w.~%@+-]*)+", t[:min(cut)]) else t
+
+
+def is_sensitive(*texts: Optional[str]) -> bool:
+ return any(t and (SENSITIVE.search(t) or SENSITIVE_CAMEL.search(t)) for t in texts)
+
+
+def display_url(url: str) -> str:
+ """What the film shows of a URL: no query string, no fragment, no credentials; a file URL shows its last two
+ path parts (the rest is the machine's folders)."""
+ u = (url or "").split("#", 1)[0].split("?", 1)[0]
+ m = re.match(r"^([a-z][\w+.-]*)://(.*)$", u, re.I)
+ if not m:
+ return u
+ scheme, rest = m.group(1).lower(), m.group(2)
+ if scheme == "file":
+ parts = [p for p in rest.split("/") if p]
+ return "/".join(parts[-2:]) if parts else "file"
+ rest = re.sub(r"^[^/@]*@", "", rest) # user:password@host
+ return (rest if scheme in ("http", "https") else "%s://%s" % (scheme, rest)).rstrip("/") or rest
+
+
+class Redactor:
+ """The hard filter every shown or spoken text goes through: typed values (added as they are found), every
+ --redact pattern, query strings and fragments of URLs, paths on the machine (shown as their last part),
+ auth headers and NAME=value secrets, e-mail addresses (unless show_emails), and secret-looking strings."""
+
+ def __init__(self, patterns: Sequence[str] = (), *, show_emails: bool = False) -> None:
+ self.show_emails = show_emails
+ self.patterns = []
+ for p in patterns or ():
+ try:
+ self.patterns.append(re.compile(p))
+ except re.error as e:
+ raise ShowtimeError("--redact %r is not a valid regular expression: %s" % (p, e),
+ hint="escape special characters, e.g. --redact 'acct-[0-9]+' or --redact 'a\\.b'")
+ self.secrets: List[str] = []
+
+ def add_secret(self, value: Optional[str]) -> None:
+ v = (value or "").strip()
+ if len(v) >= 3 and v not in self.secrets:
+ self.secrets.append(v)
+ self.secrets.sort(key=len, reverse=True)
+
+ def __call__(self, text: Optional[str]) -> str:
+ t = str(text or "")
+ if len(t) > MAX_TEXT:
+ t = t[:MAX_TEXT] + "\u2026"
+ for s in self.secrets:
+ t = t.replace(s, MASK)
+ for rx in self.patterns:
+ t = rx.sub(MASK, t)
+ t = _URL.sub(lambda m: display_url(m.group(0)) if m.group(0).lower().startswith("file:")
+ else re.sub(r"(?<=://)[^/@\s]*@", "", m.group(0).split("#", 1)[0].split("?", 1)[0]), t)
+ t = _USERINFO.sub(MASK + "@", t)
+ t = _PATH_TOKEN.sub(_drop_query, t)
+ t = _ABS_PATH.sub(lambda m: _bare(m.group(0)), t)
+ t = _TYPED_CALL.sub(lambda m: '%s("%s"' % (m.group(1), MASK), t)
+ t = _AUTH.sub(lambda m: m.group(1) + m.group(2) + MASK
+ if m.group(1).lower() != "token" or re.search(r"\d", m.group(3)) else m.group(0), t)
+ t = _KV.sub(lambda m: m.group(1) + MASK, t)
+ if not self.show_emails:
+ t = _EMAIL.sub(lambda m: MASK + "@" + m.group(1), t)
+ t = re.sub(r"\S{%d,}" % (MAX_WORD + 1), lambda m: m.group(0)[:MAX_WORD] + "\u2026", t)
+ return "\n".join(pv.mask_line(x)[0] for x in t.split("\n"))
+
+
+# ---------------------------------------------------------------------------
+# reading a trace
+# ---------------------------------------------------------------------------
+
+_ANSI = re.compile(r"\x1b\[([0-9;]*)m")
+
+
+def strip_ansi(s: str) -> str:
+ return _ANSI.sub("", s or "")
+
+
+def ansi_segments(s: str) -> List[List[Any]]:
+ """Text with ANSI codes -> [[text, marked]]: `marked` where Playwright shows a difference (inverse video)."""
+ out: List[List[Any]] = []
+ inv = False
+ pos = 0
+ for m in _ANSI.finditer(s or ""):
+ if m.start() > pos:
+ out.append([s[pos:m.start()], inv])
+ codes = m.group(1).split(";")
+ if "7" in codes:
+ inv = True
+ if "27" in codes or "0" in codes or codes == [""]:
+ inv = False
+ pos = m.end()
+ if pos < len(s or ""):
+ out.append([s[pos:], inv])
+ merged: List[List[Any]] = []
+ for t, f in out:
+ if merged and merged[-1][1] == f:
+ merged[-1][0] += t
+ elif t:
+ merged.append([t, f])
+ return merged
+
+
+MAX_MEMBERS = 20000 # zip members in a trace
+MAX_TOTAL = 1024 ** 3 # uncompressed bytes of the event files
+MAX_EVENTS = 500000 # events kept
+MAX_LINE = 4 * 1024 ** 2 # one event line kept whole; a longer one (a DOM snapshot) is skipped
+MAX_ATTACHMENT = 1024 ** 2 # attachments read for the test's name and location
+MAX_SOURCE = 2 * 1024 ** 2 # a source file the trace carries
+MAX_SHOT = 20 * 1024 ** 2 # a screenshot
+_SNAP_HEAD = re.compile(r'"(callId|frameUrl|frameId|phase|snapshotName)"\s*:\s*"((?:[^"\\]|\\.){0,4000})"')
+MAX_DOM_ENTRIES = 1000000 # field summaries kept for the DOM snapshots (then the rest are unknown)
+
+
+def _too_big(what: str) -> ShowtimeError:
+ return ShowtimeError("the trace is too large to read safely (%s)" % what,
+ hint="film one test: run it alone with --trace on (pytest: --tracing on) and pass its trace.zip")
+
+
+def _scroll(v: Any) -> int:
+ try:
+ return int(float(v or 0))
+ except (TypeError, ValueError):
+ return 0
+
+
+def _field_key(tag: str, attrs: Dict[str, Any]) -> Optional[Tuple[str, str, str]]:
+ """A form field by its tag, id and name (None when it has neither: it cannot be followed)."""
+ ce = attrs.get("contenteditable")
+ if tag in ("INPUT", "TEXTAREA", "SELECT") or (ce is not None and str(ce).lower() != "false"):
+ fid, name = str(attrs.get("id") or ""), str(attrs.get("name") or "")
+ if fid or name:
+ return (tag, fid, name)
+ return None
+
+
+def _join(a: Tuple[Any, Any, bool], b: Tuple[Any, Any, bool]) -> Tuple[Any, Any, bool]:
+ """Two fields with the same key: their scroll only when it agrees, empty only when both are."""
+ return (a[0] if a[0] == b[0] else None, a[1] if a[1] == b[1] else None, a[2] and b[2])
+
+
+class DomIndex:
+ """Which form fields each DOM snapshot holds, never what is in them: per field (tag, id, name), whether it
+ is empty and how far the boxes around it are scrolled, and which field the call acted on. A snapshot keeps
+ unchanged parts as references to nodes of an earlier snapshot of the same frame, so a summary is kept for
+ every node with a field inside (only those). A snapshot that cannot be read (a line too long, a reference
+ that cannot be followed, the cap reached) is unknown."""
+
+ def __init__(self) -> None:
+ self.frames: Dict[Tuple[str, str], List[Optional[Dict[int, Dict[Any, Any]]]]] = {}
+ self.calls: Dict[str, List[Dict[str, Any]]] = {}
+ self.entries = 0
+
+ def add(self, member: str, snap: Dict[str, Any], readable: bool = True) -> None:
+ frame = (member, str(snap.get("frameId") or ""))
+ lst = self.frames.setdefault(frame, [])
+ got = self._summary(snap.get("html"), lst) if readable and self.entries < MAX_DOM_ENTRIES else None
+ lst.append(got[0] if got else None)
+ if snap.get("callId"):
+ phase = snap.get("phase") or str(snap.get("snapshotName") or "").split("@", 1)[0]
+ self.calls.setdefault(str(snap["callId"]), []).append({
+ "phase": phase, "frame": frame, "main": snap.get("isMainFrame", True) is not False,
+ "fields": got[1] if got else None, "target": got[2] if got else None})
+
+ def _summary(self, html: Any, lst: List[Optional[Dict[int, Dict[Any, Any]]]]) -> Optional[Tuple[Any, Any, Any]]:
+ """(the summaries of its nodes by post-order index, the root's {field: (scroll top, scroll left,
+ empty)}, the key of the element marked as the call's target), walked without recursion."""
+ def ref_of(c: List[Any]) -> Optional[Dict[Any, Any]]:
+ ref = c[0]
+ if len(ref) < 2 or not all(isinstance(x, int) for x in ref[:2]) or ref[0] <= 0 or ref[0] > len(lst) \
+ or lst[len(lst) - ref[0]] is None:
+ raise LookupError
+ return lst[len(lst) - ref[0]].get(ref[1])
+ if isinstance(html, list) and html and isinstance(html[0], list): # the whole page unchanged
+ try:
+ return {}, ref_of(html) or {}, None
+ except LookupError:
+ return None
+ if not isinstance(html, list) or not html or not isinstance(html[0], str):
+ return None
+ nodes: Dict[int, Dict[Any, Any]] = {}
+ count, target, root = 0, None, None
+ stack: List[List[Any]] = [[html, 2, None, False]] # node, next child, fields below, owned
+
+ def into(top: List[Any], m: Optional[Dict[Any, Any]]) -> None:
+ if not m:
+ return
+ if top[2] is None:
+ top[2], top[3] = m, False # shared until something changes it
+ return
+ if not top[3]:
+ top[2], top[3] = dict(top[2]), True
+ for k, v in m.items():
+ top[2][k] = _join(top[2][k], v) if k in top[2] else v
+ while stack:
+ top = stack[-1]
+ n = top[0]
+ if top[1] < len(n):
+ c = n[top[1]]
+ top[1] += 1
+ if isinstance(c, str):
+ count += 1
+ elif isinstance(c, list) and c and isinstance(c[0], str):
+ stack.append([c, 2, None, False])
+ elif isinstance(c, list) and c and isinstance(c[0], list): # [[snapshots back, node index]]
+ try:
+ into(top, ref_of(c))
+ except LookupError:
+ return None
+ continue
+ stack.pop()
+ tag = n[0].upper()
+ attrs = n[1] if len(n) > 1 and isinstance(n[1], dict) else {}
+ acc, owned = top[2], top[3]
+ st, sl = _scroll(attrs.get("__playwright_scroll_top_")), _scroll(attrs.get("__playwright_scroll_left_"))
+ if acc and (st or sl):
+ acc = {k: (None if v[0] is None else v[0] + st, None if v[1] is None else v[1] + sl, v[2])
+ for k, v in acc.items()}
+ owned = True
+ key = _field_key(tag, attrs)
+ if key:
+ acc, owned = (dict(acc or {}), True) if not owned else (acc, owned)
+ v = (0, 0, tag in ("INPUT", "TEXTAREA") and not attrs.get("__playwright_value_"))
+ acc[key] = _join(acc[key], v) if key in acc else v
+ if "__playwright_target__" in attrs:
+ target = key or ("?", "", "")
+ if acc:
+ nodes[count] = acc
+ if owned:
+ self.entries += len(acc)
+ count += 1
+ if stack:
+ into(stack[-1], acc)
+ else:
+ root = acc or {}
+ return nodes, root, target
+
+
+def _jsonl(z: zipfile.ZipFile, name: str, stop: Optional[Any] = None,
+ dom: Optional[DomIndex] = None) -> Iterable[Dict[str, Any]]:
+ """The events of one .trace member, streamed: a line longer than MAX_LINE is not kept (a frame snapshot of
+ a big page keeps only its callId and frameUrl), so memory stays bounded. A DOM snapshot is summed up into
+ `dom` (which fields it holds), then dropped."""
+ with z.open(name) as raw:
+ f = io.TextIOWrapper(raw, encoding="utf-8", errors="replace")
+ while True:
+ line = f.readline(MAX_LINE)
+ if not line:
+ return
+ if not line.endswith("\n") and len(line) >= MAX_LINE:
+ head = line[:65536]
+ while True: # the rest of the long line, not kept
+ more = f.readline(MAX_LINE)
+ if not more or more.endswith("\n"):
+ break
+ if '"frame-snapshot"' in head[:200]:
+ got: Dict[str, str] = {}
+ for k, v in _SNAP_HEAD.findall(head):
+ got.setdefault(k, v)
+ if dom is not None:
+ dom.add(name, got, readable=False)
+ if got.get("callId"):
+ yield {"type": "frame-snapshot", "snapshot": {"callId": got["callId"],
+ "frameUrl": got.get("frameUrl", "")}}
+ continue
+ line = line.strip()
+ if not line:
+ continue
+ try:
+ e = json.loads(line)
+ except ValueError:
+ continue
+ if not isinstance(e, dict):
+ continue
+ if e.get("type") == "frame-snapshot": # only what the parser uses: never the DOM
+ snap = e.get("snapshot") or {}
+ if dom is not None and isinstance(snap, dict):
+ dom.add(name, snap)
+ e = {"type": "frame-snapshot", "snapshot": {k: snap.get(k) for k in ("callId", "frameUrl", "isMainFrame")}}
+ yield e
+ if stop is not None and stop(e):
+ return
+
+
+def _members(z: zipfile.ZipFile) -> List[zipfile.ZipInfo]:
+ infos = z.infolist()
+ if len(infos) > MAX_MEMBERS:
+ raise _too_big("%d files inside, more than %d" % (len(infos), MAX_MEMBERS))
+ total = sum(i.file_size for i in infos if i.filename.endswith((".trace", ".stacks")))
+ if total > MAX_TOTAL:
+ raise _too_big("%.1f GB of events" % (total / 1024 ** 3))
+ return infos
+
+
+def open_trace(path: Path) -> zipfile.ZipFile:
+ path = Path(path)
+ if not path.is_file():
+ raise ShowtimeError("trace not found: %s" % path,
+ hint="pass the trace.zip a test run wrote (test-results/<test>/trace.zip), or a command: "
+ "showtime repro -- npx playwright test")
+ try:
+ z = zipfile.ZipFile(str(path))
+ except zipfile.BadZipFile:
+ raise ShowtimeError("%s is not a zip file, so it is not a Playwright trace" % path.name,
+ hint="pass the trace.zip from test-results/ (written with --trace on, or pytest --tracing on)")
+ if not any(n.endswith(".trace") for n in z.namelist()):
+ z.close()
+ raise ShowtimeError("%s holds no Playwright trace (no .trace file inside)" % path.name,
+ hint="pass the trace.zip from test-results/ (written with --trace on, or pytest --tracing on)")
+ return z
+
+
+def read_raw(z: zipfile.ZipFile) -> Dict[str, Any]:
+ """The events of a trace: the test runner's (test.trace) and the library's (N-trace.trace), the stacks and
+ the error-context attachment, and what the DOM snapshots say about the form fields (`dom`)."""
+ infos = _members(z)
+ names = [i.filename for i in infos]
+ test: List[Dict[str, Any]] = []
+ lib: List[Dict[str, Any]] = []
+ stacks: Dict[int, Tuple[str, int]] = {}
+ dom = DomIndex()
+ for info in sorted(infos, key=lambda i: i.filename):
+ n = info.filename
+ base = n.rsplit("/", 1)[-1]
+ if base.endswith(".trace"):
+ into = test if base == "test.trace" else lib
+ for e in _jsonl(z, n, dom=None if into is test else dom):
+ into.append(e)
+ if len(test) + len(lib) > MAX_EVENTS: # counted as they are read
+ raise _too_big("more than %d events" % MAX_EVENTS)
+ elif base.endswith(".stacks"):
+ if info.file_size > 64 * 1024 ** 2:
+ continue
+ try:
+ d = json.loads(z.read(n).decode("utf-8"))
+ files = d.get("files") or []
+ for cid, frames in d.get("stacks") or []:
+ if frames:
+ fi, line = frames[0][0], frames[0][1]
+ stacks[int(cid)] = (files[fi] if 0 <= fi < len(files) else "", int(line))
+ except (ValueError, KeyError, IndexError, TypeError):
+ pass
+ context = ""
+ for info in infos: # the error-context markdown: small text, its head is enough
+ if info.filename.startswith("attachments/") and 0 < info.file_size <= MAX_ATTACHMENT:
+ with z.open(info) as f:
+ head = f.read(65536)
+ if b"\x00" in head:
+ continue
+ text = head.decode("utf-8", "replace")
+ if "# Test info" in text:
+ context = text
+ break
+ return {"test": test, "lib": lib, "stacks": stacks, "context": context, "names": names,
+ "sizes": {i.filename: i.file_size for i in infos}, "dom": dom}
+
+
+def _attrs(tag: str) -> Dict[str, str]:
+ return {k.lower(): v for k, v in re.findall(r"([\w:-]+)=\"([^\"]*)\"", tag or "")}
+
+
+def _num(x: Any, default: float = 0.0) -> float:
+ try:
+ return float(x)
+ except (TypeError, ValueError):
+ return default
+
+
+_ROLE_NOUN = {"textbox": "field", "searchbox": "search field", "combobox": "dropdown", "img": "image",
+ "menuitem": "menu item", "spinbutton": "number field", "listbox": "list", "gridcell": "cell",
+ "columnheader": "column header", "rowheader": "row header"}
+
+
+def human_locator(api: str) -> str:
+ """`getByRole('button', { name: 'Sign in' })` -> "the 'Sign in' button" (the last link of a chain)."""
+ s = (api or "").strip()
+ s = re.sub(r"\.(first|last)\(\)$|\.nth\(\d+\)$", "", s)
+ parts = re.findall(r"(?:^|\.)((?:getBy\w+|locator|frameLocator)\((?:[^()]|\([^()]*\))*\))", s)
+ last = parts[-1] if parts else s
+ m = re.match(r"(getBy\w+|locator|frameLocator)\((.*)\)$", last, re.S)
+ if not m:
+ return rv.shorten(s, 60) if s else ""
+ fn, args = m.group(1), m.group(2)
+ strs = re.findall(r"'((?:[^'\\]|\\.)*)'|\"((?:[^\"\\]|\\.)*)\"|/((?:[^/\\]|\\.)+)/[a-z]*", args)
+ first = next((a or b or c for a, b, c in strs), "") if strs else ""
+ if fn == "getByRole":
+ noun = _ROLE_NOUN.get(first, first or "element")
+ name = re.search(r"name:\s*(?:'((?:[^'\\]|\\.)*)'|\"((?:[^\"\\]|\\.)*)\"|/((?:[^/\\]|\\.)+)/)", args)
+ level = re.search(r"level:\s*(\d)", args)
+ if name:
+ return "the '%s' %s" % (name.group(1) or name.group(2) or name.group(3), noun)
+ if level:
+ return "the level-%s %s" % (level.group(1), noun)
+ return "the %s" % noun
+ if fn in ("getByLabel", "getByPlaceholder"):
+ return "the '%s' field" % first
+ if fn == "getByText":
+ return "the text '%s'" % first
+ if fn == "getByAltText":
+ return "the '%s' image" % first
+ if fn == "getByTitle":
+ return "'%s'" % first
+ if fn == "getByTestId":
+ return "test id '%s'" % first
+ return first or last
+
+
+def _selector_api(sel: str) -> str:
+ """A library selector (internal:role=button[name="Sign in"i]) -> the locator API form, for traces without
+ the runner's step titles."""
+ s = sel or ""
+ m = re.match(r'^internal:role=(\w+)(.*)$', s)
+ if m:
+ name = re.search(r'\[name="((?:[^"\\]|\\.)*)"[is]?\]', m.group(2))
+ level = re.search(r"\[level=(\d)\]", m.group(2))
+ opts = ("{ name: '%s' }" % name.group(1)) if name else ("{ level: %s }" % level.group(1)) if level else ""
+ return "getByRole('%s'%s)" % (m.group(1), ", " + opts if opts else "")
+ for prefix, fn in (("label=", "getByLabel"), ("text=", "getByText"), (r"attr=\[placeholder=", "getByPlaceholder"),
+ (r"attr=\[alt=", "getByAltText"), (r"attr=\[title=", "getByTitle")):
+ m = re.match(r'^internal:%s"((?:[^"\\]|\\.)*)"' % prefix, s)
+ if m:
+ return "%s('%s')" % (fn, m.group(1))
+ m = re.match(r'^internal:testid=\[[\w-]+="((?:[^"\\]|\\.)*)"', s)
+ if m:
+ return "getByTestId('%s')" % m.group(1)
+ return "locator('%s')" % s if s else ""
+
+
+_METHOD_KIND = {"goto": "goto", "reload": "reload", "goBack": "back", "goForward": "forward", "click": "click",
+ "dblclick": "dblclick", "tap": "click", "fill": "fill", "clear": "fill", "press": "press",
+ "type": "type", "pressSequentially": "type", "check": "check", "uncheck": "uncheck",
+ "setChecked": "check", "selectOption": "select", "hover": "hover", "setInputFiles": "upload",
+ "expect": "expect", "waitForSelector": "wait", "waitForURL": "wait", "waitForLoadState": "wait",
+ "waitForTimeout": "wait", "waitForFunction": "wait", "focus": "focus", "dragTo": "drag",
+ "screenshot": "screenshot", "keyboardType": "type", "keyboardInsertText": "type", "insertText": "type",
+ "keyboardPress": "press", "keyboardDown": "press", "keyboardUp": "press"}
+_TITLE_KIND = [(r"^Navigate|^Go to|^Goto", "goto"), (r"^Reload", "reload"), (r"^Double click", "dblclick"),
+ (r"^Click|^Tap", "click"), (r"^Fill|^Clear", "fill"), (r"^Press sequentially|^Type|^Insert", "type"),
+ (r"^Press", "press"), (r"^Uncheck", "uncheck"), (r"^Check|^Set checked", "check"),
+ (r"^Select", "select"), (r"^Hover", "hover"), (r"^Set input files|^Upload", "upload"),
+ (r"^Expect|^expect", "expect"), (r"^Wait", "wait"), (r"^Focus", "focus"), (r"^Drag", "drag")]
+POINTER_KINDS = ("click", "dblclick", "hover", "check", "uncheck", "drag")
+VALUE_KINDS = ("fill", "type", "press", "select", "upload")
+TYPED_KINDS = ("fill", "type") # what was typed is never shown or spoken (only how many characters)
+_KEY_NAME = re.compile(r"(?:(?:Control|Shift|Alt|Meta|ControlOrMeta)\+)*(?:[A-Z][A-Za-z0-9]+|F\d{1,2})")
+_STAYS = re.compile(r"(?:Shift\+)?(?:.|Backspace|Delete|ArrowLeft|ArrowRight|Home|End|Space)", re.S) # keeps focus
+MAX_CONSOLE = 20 # console lines kept (each cut to 300 characters)
+SKIP_LIB = {"waitForEventInfo", "setDefaultTimeoutNoReply", "setDefaultNavigationTimeoutNoReply", "close",
+ "newPage", "newContext", "tracingStart", "tracingStop", "tracingStartChunk", "tracingStopChunk",
+ "addInitScript", "exposeBinding", "setExtraHTTPHeaders", "route", "unroute", "storageState",
+ "cookies", "addCookies", "grantPermissions", "harStart", "harExport"}
+
+
+def _kind(method: str, title: str) -> str:
+ if method in _METHOD_KIND:
+ return _METHOD_KIND[method]
+ for rx, k in _TITLE_KIND:
+ if re.search(rx, title or ""):
+ return k
+ return "action"
+
+
+def _words(matcher: str) -> str:
+ """toHaveText -> 'to have text'; not.toBeVisible -> 'not to be visible'."""
+ m = (matcher or "").replace("expect.", "")
+ neg = m.startswith("not.")
+ m = m[4:] if neg else m
+ w = re.sub(r"(?<!^)([A-Z])", r" \1", m).lower().strip()
+ w = w.replace("u r l", "URL")
+ return ("not " if neg else "") + w
+
+
+def _expected_of(params: Dict[str, Any], lib_params: Dict[str, Any]) -> Optional[str]:
+ if params.get("expected") is not None:
+ e = params["expected"]
+ return e if isinstance(e, str) else json.dumps(e)
+ et = lib_params.get("expectedText")
+ if isinstance(et, list) and et:
+ x = et[0]
+ if x.get("string") is not None:
+ return x["string"]
+ if x.get("regexSource") is not None:
+ return "/%s/%s" % (x["regexSource"], x.get("regexFlags") or "")
+ if lib_params.get("expectedNumber") is not None:
+ return str(lib_params["expectedNumber"])
+ return None
+
+
+def parse(path: Path, redact: Optional[Redactor] = None, *, label: str = "", show_typed: bool = False) -> Dict[str, Any]:
+ """trace.zip -> {test, steps, failure, console, viewport, ...}, every shown text redacted. Screenshots are
+ named by their zip member (`shot`); keep_shots copies them out. Typed values are never shown (`show_typed`:
+ the values typed into fields that are not secret are, filtered); their fields are covered on screen."""
+ redact = redact or Redactor()
+ z = open_trace(path)
+ try:
+ raw = read_raw(z)
+ srcs = {n.rsplit("/", 1)[-1].split(".", 1)[0]: n for n in raw["names"]
+ if n.startswith("src/") and raw["sizes"].get(n, 0) <= MAX_SOURCE}
+ src_text = {}
+ for h, n in list(srcs.items())[:200]:
+ try:
+ src_text[h] = z.read(n).decode("utf-8", "replace").splitlines()
+ except KeyError:
+ pass
+ finally:
+ z.close()
+ lib_ctx = [e for e in raw["lib"] if e.get("type") == "context-options"]
+ test_ctx = next((e for e in raw["test"] if e.get("type") == "context-options"), None)
+ browser = next((e.get("browserName") for e in lib_ctx if e.get("browserName")), "") or ""
+ version = next((e.get("playwrightVersion") for e in lib_ctx + ([test_ctx] if test_ctx else [])
+ if e.get("playwrightVersion")), "")
+ sdk = next((e.get("sdkLanguage") for e in lib_ctx + ([test_ctx] if test_ctx else []) if e.get("sdkLanguage")), "")
+ viewport = next(((e.get("options") or {}).get("viewport") for e in lib_ctx
+ if (e.get("options") or {}).get("viewport")), None)
+ ctx_title = next((e.get("title") for e in lib_ctx if e.get("title")), "")
+ wall = next((e.get("wallTime") for e in ([test_ctx] if test_ctx else []) + lib_ctx if e.get("wallTime")), None)
+
+ # the library's calls: params, logs, the input box and point, errors
+ calls: Dict[str, Dict[str, Any]] = {}
+ frames: List[Dict[str, Any]] = []
+ console: List[Dict[str, Any]] = []
+ page_url: Dict[str, str] = {} # callId -> the main frame's URL in its last DOM snapshot
+ for e in raw["lib"]:
+ t = e.get("type")
+ if t == "frame-snapshot":
+ snap = e.get("snapshot") or {}
+ if snap.get("callId") and snap.get("isMainFrame", True) and snap.get("frameUrl"):
+ page_url[snap["callId"]] = snap["frameUrl"]
+ elif t == "before":
+ calls[e["callId"]] = {"id": e["callId"], "class": e.get("class", ""), "method": e.get("method", ""),
+ "params": e.get("params") or {}, "start": _num(e.get("startTime")),
+ "end": None, "step": e.get("stepId"), "title": e.get("title") or "",
+ "logs": [], "box": None, "point": None, "error": None, "page": e.get("pageId")}
+ elif t == "after" and e.get("callId") in calls:
+ c = calls[e["callId"]]
+ c["end"] = _num(e.get("endTime"), c["start"])
+ if e.get("error"):
+ c["error"] = e["error"]
+ elif t == "input" and e.get("callId") in calls:
+ calls[e["callId"]]["box"] = e.get("box") or calls[e["callId"]]["box"]
+ calls[e["callId"]]["point"] = e.get("point") or calls[e["callId"]]["point"]
+ elif t == "log" and e.get("callId") in calls:
+ calls[e["callId"]]["logs"].append(str(e.get("message") or ""))
+ elif t == "screencast-frame" and e.get("file"):
+ frames.append({"t": _num(e.get("timestamp")), "file": e["file"], "page": e.get("pageId"),
+ "w": e.get("width"), "h": e.get("height")})
+ elif t == "console" and e.get("messageType") == "error":
+ console.append({"t": _num(e.get("time")), "text": str(e.get("text") or "")})
+ elif t == "event" and e.get("method") == "pageError":
+ err = (e.get("params") or {}).get("error") or {}
+ err = err.get("error", err) if isinstance(err, dict) else {}
+ msg = err.get("message") or (err.get("value") if isinstance(err.get("value"), str) else "") or "page error"
+ console.append({"t": _num(e.get("time")), "text": "Uncaught " + str(msg)})
+ frames.sort(key=lambda f: f["t"])
+ if not viewport and frames:
+ viewport = {"width": frames[0]["w"] or 1280, "height": frames[0]["h"] or 720}
+ viewport = viewport or {"width": 1280, "height": 720}
+ by_step: Dict[str, Dict[str, Any]] = {}
+ for c in sorted(calls.values(), key=lambda c: c["start"]):
+ if c["step"] and c["step"] not in by_step:
+ by_step[c["step"]] = c
+
+ # the steps: the runner's (titles, locators, stacks) when the trace has them, else the library's calls
+ steps: List[Dict[str, Any]] = []
+ test_error = None
+ if raw["test"]:
+ before = {e["stepId"]: e for e in raw["test"] if e.get("type") == "before" and e.get("stepId")}
+ after = {e["callId"]: e for e in raw["test"] if e.get("type") == "after" and e.get("callId")}
+ test_error = next((e for e in raw["test"] if e.get("type") == "error"), None)
+
+ def hidden(e: Dict[str, Any]) -> bool:
+ seen = 0
+ p = e.get("parentId")
+ while p and seen < 50:
+ pe = before.get(p)
+ if pe is None:
+ break
+ if pe.get("method") in ("hook", "fixture", "pw:api", "expect"):
+ return True
+ p = pe.get("parentId")
+ seen += 1
+ return False
+ for e in sorted(before.values(), key=lambda e: _num(e.get("startTime"))):
+ if e.get("method") not in ("pw:api", "expect") or hidden(e):
+ continue
+ a = after.get(e["stepId"], {})
+ c = by_step.get(e["stepId"]) or {}
+ st = (e.get("stack") or [{}])[0]
+ steps.append({"title": e.get("title") or "", "api": e.get("subtitle") or (e.get("params") or {}).get("locator") or "",
+ "params": e.get("params") or {}, "lib": c, "method": c.get("method", ""),
+ "start": _num(c.get("start"), _num(e.get("startTime"))),
+ "end": _num(c.get("end"), _num(a.get("endTime"), _num(e.get("startTime")))),
+ "file": st.get("file") or "", "line": st.get("line"),
+ "error": a.get("error") or None})
+ else:
+ for c in sorted(calls.values(), key=lambda c: c["start"]):
+ if c["class"] not in ("Frame", "Page", "ElementHandle", "Locator") or c["method"] in SKIP_LIB:
+ continue
+ cid = int(re.sub(r"\D", "", c["id"]) or 0)
+ f, line = raw["stacks"].get(cid, ("", None))
+ api = next((m[len("waiting for "):] for m in c["logs"] if m.startswith("waiting for ")), "") \
+ or _selector_api(c["params"].get("selector", ""))
+ steps.append({"title": c["title"], "api": api, "params": {}, "lib": c, "method": c["method"],
+ "start": c["start"], "end": c["end"] if c["end"] is not None else c["start"],
+ "file": f, "line": line, "error": c["error"]})
+ if not steps:
+ raise ShowtimeError("the trace has no test steps to show",
+ why="no page action or assertion was recorded (the test may have failed before it "
+ "opened a page)",
+ hint="check that the run used --trace on (pytest: --tracing on) and that the test opens "
+ "a page; the trace viewer shows what it holds: npx playwright show-trace <trace.zip>")
+
+ # test name and location
+ name, loc_file, loc_line = "", "", None
+ m = re.search(r"^- Name:\s*(.+)$", raw["context"], re.M)
+ if m:
+ name = m.group(1).split(" >> ", 1)[-1].strip().replace(" >> ", " \u203a ")
+ m = re.search(r"^- Location:\s*(.+?):(\d+)(?::\d+)?\s*$", raw["context"], re.M)
+ if m:
+ loc_file, loc_line = m.group(1).strip(), int(m.group(2))
+ if ctx_title and (not name or not loc_file):
+ parts = [p.strip() for p in ctx_title.split("\u203a")]
+ fm = re.match(r"^(.+?):(\d+)$", parts[0])
+ if fm and len(parts) > 1:
+ loc_file, loc_line = loc_file or fm.group(1), loc_line or int(fm.group(2))
+ name = name or " \u203a ".join(parts[1:])
+ else:
+ name = name or ctx_title
+ first_file = next((s["file"] for s in steps if s["file"]), "")
+ if not loc_file and first_file:
+ loc_file = os.path.basename(first_file)
+ name = name or label or "Playwright test"
+
+ def rel(f: str) -> str:
+ if not f:
+ return ""
+ fs = f.replace("\\", "/")
+ if loc_file and (fs == loc_file or fs.endswith("/" + loc_file.replace("\\", "/"))):
+ return loc_file
+ return os.path.basename(fs)
+
+ # typed values first, so they are masked everywhere after (a typed value is never shown or spoken).
+ # page.keyboard.type / insertText / press have no target: they type into the focused field, which is known
+ # only right after a step that focused a field it names (a click, a fill, a focus); a Tab or another key, a
+ # mouse click, a navigation or any step that could move the focus makes it unknown, and unknown is secret.
+ focus: Optional[bool] = None # the focused field is secret (True/False), or not known (None)
+ focus_at: Optional[int] = None # the step that focused it
+ for i, s in enumerate(steps):
+ c = s["lib"] or {}
+ kind = _kind(s["method"], s["title"])
+ s["kind"] = kind
+ resolved = next((mm for mm in reversed(c.get("logs") or []) if "locator resolved to" in mm), "")
+ tag = re.search(r"<\w+[^>]*>", resolved)
+ at = _attrs(tag.group(0)) if tag else {}
+ s["tag_key"] = _field_key(tag.group(0)[1:].split()[0].rstrip("/>").upper(), at) if tag else None
+ has_target = bool(s["api"] or (c.get("params") or {}).get("selector") or tag)
+ target_secret = bool(
+ at.get("type", "").lower() == "password" or at.get("autocomplete", "").lower() in SECRET_AUTOCOMPLETE
+ or is_sensitive(s["api"], (c.get("params") or {}).get("selector"), at.get("name"), at.get("id"),
+ at.get("aria-label"), at.get("placeholder"), at.get("data-testid"), at.get("autocomplete")))
+ value = s["params"].get("value")
+ if value is None:
+ value = (c.get("params") or {}).get("value")
+ if value is None and kind in ("press", "type"):
+ value = (c.get("params") or {}).get("key") or (c.get("params") or {}).get("text")
+ if value is None:
+ tm = re.match(r'^\w[\w ]*?"(.*)"$', s["title"])
+ value = tm.group(1) if tm else None
+ if isinstance(value, list):
+ value = ", ".join(str(v) for v in value)
+ s["value"] = None if value is None else str(value)
+ s["field_at"] = i if has_target else focus_at # the step whose target this one typed into
+ s["secret"] = bool(kind in VALUE_KINDS and (target_secret if has_target else focus is not False))
+ moves = s["value"] is not None and bool(re.search(r"[\t\n\r]", s["value"])) # a Tab or Enter typed
+ if has_target and kind in ("click", "dblclick", "check", "uncheck", "focus", "fill", "type", "select") \
+ and not moves:
+ focus, focus_at = target_secret, i
+ elif kind in ("expect", "wait", "screenshot", "hover"):
+ pass # these never move the focus
+ elif kind in ("type", "press") and not has_target and s["value"] is not None and not moves and \
+ (kind == "type" or _STAYS.fullmatch(s["value"])):
+ pass # characters typed into the same field
+ else:
+ focus, focus_at = None, None
+ s["key_name"] = bool(kind == "press" and s["value"] and _KEY_NAME.fullmatch(s["value"]))
+ s["shown"] = bool(show_typed and kind in TYPED_KINDS and not s["secret"])
+ if kind in TYPED_KINDS and not s["shown"] or s["secret"] and kind != "press" or \
+ kind == "press" and s["value"] and not s["key_name"]:
+ redact.add_secret(s["value"])
+ hidden_values = sum(1 for s in steps if s["value"] and (s["kind"] in TYPED_KINDS and not s["shown"] or s["secret"]
+ or s["kind"] == "press" and not s["key_name"]))
+
+ t0 = min(s["start"] for s in steps)
+ out_steps: List[Dict[str, Any]] = []
+ prev_url = ""
+ vw, vh = float(viewport.get("width") or 1280), float(viewport.get("height") or 720)
+ for i, s in enumerate(steps):
+ c = s["lib"] or {}
+ lp = c.get("params") or {}
+ kind = s["kind"]
+ api = "" if kind in ("goto", "reload", "back", "forward") else \
+ (s["api"] or (lp.get("selector") and _selector_api(lp["selector"])) or "")
+ who = human_locator(api) if api else ""
+ value = s["value"]
+ if kind in TYPED_KINDS:
+ shown_value = redact(value) if s["shown"] and value is not None else None
+ elif kind == "press":
+ shown_value = value if s["key_name"] else None
+ elif kind == "upload":
+ shown_value = None
+ else:
+ shown_value = MASK if s["secret"] else (redact(value) if value is not None else None)
+ url = lp.get("url") or s["params"].get("url") or ""
+ seen = page_url.get(c.get("id") or "")
+ if seen and seen != "about:blank":
+ prev_url = seen
+ elif kind == "goto" and url:
+ prev_url = url
+ matcher = ""
+ if kind == "expect":
+ mm = re.search(r'"([\w.]+)"', s["title"])
+ matcher = mm.group(1) if mm else (lp.get("expression") or "").replace("to.have.", "toHave")
+ if lp.get("isNot") and not matcher.startswith("not."):
+ matcher = "not." + matcher
+ expected = _expected_of(s["params"], lp) if kind == "expect" else None
+ cap = caption(kind, who, shown_value, display_url(url), matcher, redact(expected) if expected is not None else None,
+ re.sub(r"\"[^\"]*\"|'[^']*'", "\u201c\u2026\u201d", s["title"]), s["method"],
+ typed=len(value or "") if kind in TYPED_KINDS and not s["shown"] else None)
+ box = c.get("box")
+ point = c.get("point")
+ pct = None
+ if box:
+ pct = {"x": round(100 * _num(box.get("x")) / vw, 2), "y": round(100 * _num(box.get("y")) / vh, 2),
+ "w": round(100 * _num(box.get("width")) / vw, 2), "h": round(100 * _num(box.get("height")) / vh, 2)}
+ ppt = None
+ if point:
+ ppt = {"x": round(100 * _num(point.get("x")) / vw, 2), "y": round(100 * _num(point.get("y")) / vh, 2)}
+ elif pct and kind in POINTER_KINDS + VALUE_KINDS:
+ ppt = {"x": round(pct["x"] + pct["w"] / 2, 2), "y": round(pct["y"] + pct["h"] / 2, 2)}
+ nxt = steps[i + 1] if i + 1 < len(steps) else None
+ if kind in POINTER_KINDS and not s["error"]:
+ shot = _frame_at(frames, s["start"] + 10) # where the click lands
+ elif kind in ("goto", "reload", "back", "forward") and nxt:
+ shot = _frame_after(frames, s["end"], nxt["end"]) or _frame_at(frames, s["end"] + 20)
+ else: # what the step left on the page: a frame from after it (screencasts lag)
+ until = nxt["end"] if nxt else float("inf")
+ shot = _frame_after(frames, s["end"] + 100, until) or _frame_after(frames, s["end"], until) or \
+ _frame_at(frames, nxt["start"] if nxt else s["end"] + 50)
+ out_steps.append({
+ "n": i + 1, "kind": kind, "caption": redact(cap), "locator": redact(api), "target": redact(who),
+ "value": shown_value, "typed_chars": len(value or "") if kind in TYPED_KINDS else None,
+ "masked": bool(kind in TYPED_KINDS and not s["shown"] or s["secret"]),
+ "secret_field": s["secret"], "field_known": s["field_at"] is not None, "url": redact(display_url(prev_url)),
+ "file": redact(rel(s["file"])), "line": s["line"],
+ "start": round((s["start"] - t0) / 1000.0, 3), "duration_ms": int(round(max(0.0, s["end"] - s["start"]))),
+ "status": "passed", "box": pct, "point": ppt, "shot": shot,
+ "matcher": matcher, "expected": redact(expected) if expected is not None else None})
+
+ place_covers(steps, out_steps, raw["dom"], {f["file"]: f["t"] for f in frames}, vw, vh)
+
+ # the failure: the step whose error failed the test (an earlier error the test caught is not it)
+ errored = [i for i, s in enumerate(steps) if s["error"]]
+ fail_i = None
+ if errored and test_error is not None:
+ head = _first_line(test_error.get("message"))
+ same = [i for i in errored if head and _first_line((steps[i]["error"] or {}).get("message")) == head]
+ # one error event: the test ended on the last step that raised it (a retry loop catches the earlier
+ # ones); several (expect.soft): the first one is the failure
+ n_errors = sum(1 for e in raw["test"] if e.get("type") == "error")
+ fail_i = (same[-1] if n_errors == 1 else same[0]) if same else None
+ if fail_i is None and test_error.get("stack"):
+ fr = test_error["stack"][0] or {}
+ fail_i = next((i for i in errored if steps[i]["file"] and steps[i]["file"] == fr.get("file")
+ and steps[i]["line"] == fr.get("line")), None)
+ if fail_i is None:
+ fail_i = errored[-1]
+ elif errored and not raw["test"]:
+ fail_i = errored[-1]
+ for i in errored:
+ if i == fail_i:
+ out_steps[i]["status"] = "failed"
+ else:
+ out_steps[i]["caught"] = True # an error the test caught: it went on
+ err = steps[fail_i]["error"] if fail_i is not None else None
+ raw_msg = (err or {}).get("message") or ""
+ if test_error and (not raw_msg or fail_i is None):
+ raw_msg = test_error.get("message") or raw_msg
+ if fail_i is None and not raw_msg:
+ failure = None
+ else:
+ failure = _failure(raw_msg, steps[fail_i] if fail_i is not None else None, redact)
+ failure["step"] = fail_i + 1 if fail_i is not None else None
+ st = steps[fail_i] if fail_i is not None else None
+ if test_error and test_error.get("stack") and (st is None or not st["file"]):
+ fr = test_error["stack"][0]
+ failure["file"], failure["line"], abs_f = rel(fr.get("file", "")), fr.get("line"), fr.get("file", "")
+ else:
+ failure["file"], failure["line"], abs_f = (rel(st["file"]), st["line"], st["file"]) if st else ("", None, "")
+ failure["file"] = redact(failure["file"])
+ failure["source"] = _source_line(src_text, abs_f, failure["line"], redact)
+ if fail_i is None:
+ failure["shot"] = _frame_at(frames, steps[-1]["end"] + 60000)
+ failure["covers"] = list(out_steps[-1]["covers"]) if out_steps else []
+ end_t = steps[fail_i]["end"] if fail_i is not None else max(s["end"] for s in steps)
+ shown_console = [c for c in console if c["t"] <= end_t + 100 and c["text"].strip()]
+ cons = [{"at": round((c["t"] - t0) / 1000.0, 3), "text": redact(rv.shorten(" ".join(c["text"].split()), 300))}
+ for c in shown_console[:MAX_CONSOLE]]
+ dur = round((max(s["end"] for s in steps) - t0) / 1000.0, 2)
+ return {"test": {"title": redact(name), "file": redact(loc_file), "line": loc_line,
+ "location": redact("%s:%s" % (loc_file, loc_line) if loc_line else loc_file)},
+ "status": "failed" if failure else "passed", "browser": browser, "playwright": version,
+ "language": sdk or "javascript", "started": wall, "duration_s": dur, "viewport": {"width": int(vw), "height": int(vh)},
+ "steps": out_steps, "failure": failure, "console": cons,
+ "console_more": max(0, len(shown_console) - len(cons)),
+ "privacy": {"masked_values": hidden_values, "redact_patterns": len(redact.patterns),
+ "screenshots": "as captured"}}
+
+
+def _overlap(a: Dict[str, float], b: Optional[Dict[str, float]]) -> bool:
+ return bool(b) and min(a["x"] + a["w"], b["x"] + b["w"]) > max(a["x"], b["x"]) and \
+ min(a["y"] + a["h"], b["y"] + b["h"]) > max(a["y"], b["y"])
+
+
+def place_covers(steps: List[Dict[str, Any]], out: List[Dict[str, Any]], dom: DomIndex, shot_t: Dict[str, float],
+ vw: float, vh: float) -> None:
+ """o["covers"]: the boxes of the fields a value was typed into, on each step's screenshot. A cover follows
+ its field through the trace's DOM snapshots: shown while the field (its tag, id and name, in its frame) is
+ on the page and not empty, moved by the scroll of the boxes around it, and re-anchored to a later step's
+ box when that step acts on the same field. A move the scroll alone may not explain keeps a second cover at
+ the old place too (a fixed header does not scroll), unless it would hide the step's own target. When the
+ snapshots cannot tell, the cover stays where the field was until the page changes."""
+ def cid(j: int) -> str:
+ return str((steps[j]["lib"] or {}).get("id") or "")
+
+ def entries(j: int, frame: Any, *, phases: Sequence[str] = ()) -> List[Dict[str, Any]]:
+ es = [e for e in dom.calls.get(cid(j), []) if frame is None or e["frame"] == frame]
+ return [e for e in es if e["phase"] in phases] or es if phases else es
+
+ def target_of(j: int) -> Tuple[Any, Any]:
+ for e in entries(j, None, phases=("action", "after", "before")):
+ if e["target"] and e["target"][0] != "?":
+ return e["target"], e["frame"]
+ return None, None
+
+ def scroll_at(j: int, key: Any, frame: Any, phases: Sequence[str]) -> Optional[Tuple[int, int]]:
+ if frame is None:
+ return None
+ for e in entries(j, frame, phases=phases):
+ v = (e["fields"] or {}).get(key)
+ if v is not None and e["main"] and v[0] is not None and v[1] is not None:
+ return v[0], v[1]
+ return None
+
+ def state(c: Dict[str, Any], j: int) -> str:
+ es = entries(j, c["frame"])
+ if j + 1 < len(steps) and shot_t.get(out[j]["shot"] or "", -1) > steps[j + 1]["start"]:
+ es += entries(j + 1, c["frame"], phases=("before",)) # the shot is from the next step
+ if not es or any(e["fields"] is None for e in es):
+ return "unknown"
+ vals = [e["fields"].get(c["key"]) for e in es]
+ return "present" if any(v is not None and not v[2] for v in vals) else \
+ "empty" if any(v is not None for v in vals) else "absent"
+
+ covers: List[Dict[str, Any]] = []
+ own: Dict[int, Dict[str, float]] = {}
+ prev_url = None
+ for j, o in enumerate(out):
+ kind = o["kind"]
+ nav = kind in ("goto", "reload") or (prev_url is not None and o["url"] != prev_url
+ and kind not in ("back", "forward"))
+ prev_url = o["url"]
+ tkey, tframe = target_of(j) if steps[j].get("field_at") == j else (None, None)
+ shown: List[Tuple[Dict[str, float], int]] = []
+ for c in covers:
+ if not c["alive"]:
+ continue
+ if tkey is not None and tkey == c["key"] and tframe == c["frame"] and o["box"]:
+ c["box"], c["ref"] = o["box"], scroll_at(j, c["key"], c["frame"], ("action", "before", "after"))
+ shown.append((c["box"], c["n"])) # the same field, acted on again
+ continue
+ st = state(c, j) if c["seen"] else "unknown"
+ if st == "unknown":
+ if nav:
+ c["alive"] = False # a new page; the snapshots cannot tell
+ else:
+ shown.append((c["box"], c["n"]))
+ continue
+ if st != "present":
+ continue # gone or emptied (it may come back)
+ cur = scroll_at(j, c["key"], c["frame"], ("before",) if kind in POINTER_KINDS else ("after", "action"))
+ b = c["box"]
+ if c["ref"] is not None and cur is not None and cur != c["ref"]:
+ moved = dict(b, x=round(b["x"] - 100 * (cur[1] - c["ref"][1]) / vw, 2),
+ y=round(b["y"] - 100 * (cur[0] - c["ref"][0]) / vh, 2))
+ if _overlap(moved, {"x": 0, "y": 0, "w": 100, "h": 100}):
+ shown.append((moved, c["n"]))
+ if not _overlap(b, o["box"]):
+ shown.append((b, c["n"]))
+ else:
+ shown.append((b, c["n"]))
+ if o["masked"] and kind in TYPED_KINDS + ("press",):
+ a = steps[j].get("field_at")
+ box = out[a]["box"] if a is not None else None
+ if box:
+ key, frame = target_of(a)
+ seen = key is not None
+ if key is None and steps[a].get("tag_key"):
+ key = steps[a]["tag_key"]
+ seen = any(e["fields"] is not None and key in e["fields"] for e in entries(a, None) + entries(j, None))
+ rec = {"n": o["n"], "key": key, "frame": frame, "box": box, "seen": seen, "alive": True,
+ "ref": scroll_at(a, key, frame, ("action", "after", "before"))}
+ covers = [c for c in covers if not (key is not None and c["key"] == key and c["frame"] == frame
+ or c["box"] == box)] + [rec]
+ shown = [x for x in shown if x[0] != box] + [(box, o["n"])]
+ own[j] = box
+ else:
+ o["uncovered"] = True # the field it typed into is not known
+ o["covers"] = []
+ for b, n in shown:
+ if not any(_same(b, x) for x in o["covers"]):
+ o["covers"].append(dict(b, step=n))
+ for j, o in enumerate(out): # a shot taken while the next step typed shows what it typed
+ if j + 1 in own and shot_t.get(o["shot"] or "", -1) > steps[j + 1]["start"] and \
+ not any(_same(own[j + 1], x) for x in o["covers"]):
+ o["covers"].append(dict(own[j + 1], step=out[j + 1]["n"]))
+
+
+def _same(a: Dict[str, float], b: Dict[str, float]) -> bool:
+ return all(a.get(k) == b.get(k) for k in ("x", "y", "w", "h"))
+
+
+def _first_line(msg: Optional[str]) -> str:
+ return next((x.strip() for x in strip_ansi(msg or "").split("\n") if x.strip()), "")
+
+
+def _frame_at(frames: List[Dict[str, Any]], t: float) -> Optional[str]:
+ """The last screenshot taken by `t` (else the first one)."""
+ if not frames:
+ return None
+ best = frames[0]
+ for f in frames:
+ if f["t"] > t:
+ break
+ best = f
+ return best["file"]
+
+
+def _frame_after(frames: List[Dict[str, Any]], t: float, until: float) -> Optional[str]:
+ """The first screenshot after `t` and by `until` (a page that just loaded), or None."""
+ return next((f["file"] for f in frames if t < f["t"] <= until), None)
+
+
+def caption(kind: str, who: str, value: Optional[str], url: str, matcher: str, expected: Optional[str],
+ title: str = "", method: str = "", typed: Optional[int] = None) -> str:
+ """One line for a step: "Click the 'Sign in' button", "Type 16 characters into the 'Email' field" (`typed`:
+ how many characters were typed, never what)."""
+ q = (lambda v: "\u201c%s\u201d" % v if v != MASK else MASK)
+ if kind in ("fill", "type") and typed is not None:
+ if not typed:
+ return "Clear" + ((" " + who) if who else " the field")
+ return "Type %d character%s into %s" % (typed, "" if typed == 1 else "s", who or "the page")
+ tgt = (" " + who) if who else ""
+ if kind == "goto":
+ return "Open %s" % (url or "the page")
+ if kind == "reload":
+ return "Reload the page"
+ if kind in ("back", "forward"):
+ return "Go %s" % kind
+ if kind in ("click", "dblclick"):
+ return ("Double-click" if kind == "dblclick" else "Click") + (tgt or " the page")
+ if kind == "fill":
+ return ("Fill%s with %s" % (tgt, q(value))) if value else ("Clear" + tgt)
+ if kind == "type":
+ return "Type %s into%s" % (q(value or ""), tgt or " the page")
+ if kind == "press":
+ return "Press %s%s" % (value if value and value != MASK else "a key", (" in" + tgt) if who else "")
+ if kind in ("check", "uncheck"):
+ return kind.capitalize() + (tgt or " the box")
+ if kind == "select":
+ return "Select %s in%s" % (q(value or ""), tgt or " the list")
+ if kind == "hover":
+ return "Hover over" + (tgt or " the page")
+ if kind == "upload":
+ return "Upload a file to" + (tgt or " the page")
+ if kind == "expect":
+ what = _words(matcher) if matcher else "to pass"
+ subj = who or "the page"
+ if re.search(r"toHaveURL|toHaveTitle", matcher or ""):
+ what = what.replace("to have ", "to have the ")
+ return ("Expect %s %s %s" % (subj, what, q(expected))).strip() if expected not in (None, "") else \
+ "Expect %s %s" % (subj, what)
+ if kind == "wait":
+ return "Wait for" + (tgt or " the page")
+ if kind == "focus":
+ return "Focus" + (tgt or " the page")
+ if kind == "drag":
+ return "Drag" + (tgt or " an element")
+ return (title or method or "Step").strip() + ((" \u00b7 " + who) if who else "")
+
+
+_EXP = re.compile(r"^(Expected|Received)(?: (string|pattern|substring|value|number|length|count|text))?\s*:\s?(.*)$")
+
+
+def _failure(raw_msg: str, step: Optional[Dict[str, Any]], redact: Redactor) -> Dict[str, Any]:
+ """The error -> {headline, expected, received (with the parts Playwright marks as different), details,
+ call_log}, redacted."""
+ lines = raw_msg.split("\n")
+ plain = [strip_ansi(x) for x in lines]
+ head = next((x.strip() for x in plain if x.strip()), "") or "the test failed"
+ head = re.sub(r"^(?:Error|TimeoutError|AssertionError|ExpectError):\s*", "", head)
+ out: Dict[str, Any] = {"headline": "", "expected": None, "received": None, "details": [], "call_log": ""}
+ in_log = False
+ log: List[str] = []
+ for r, p in zip(lines[1:], plain[1:]):
+ if p.strip().lower().startswith("call log"):
+ in_log = True
+ continue
+ if in_log:
+ if p.strip():
+ log.append(p.strip().lstrip("- ").strip())
+ continue
+ m = _EXP.match(p.strip())
+ if m:
+ key = m.group(1).lower()
+ val_raw = r.split(":", 1)[1][1:] if ":" in r else ""
+ val_plain = redact(m.group(3).strip())
+ segs = ansi_segments(val_raw.strip())
+ if "".join(t for t, _f in segs).strip() != val_plain:
+ segs = [[val_plain, False]] # something was masked: no diff marks
+ out[key] = {"text": val_plain, "parts": segs, "kind": m.group(2) or ""}
+ elif p.strip() and not p.strip().startswith(("at ", "Locator:")) and len(out["details"]) < 3:
+ out["details"].append(redact(rv.shorten(re.sub(r"\s+", " ", p.strip()), 140)))
+ lc = (step or {}).get("lib") or {}
+ if out["received"] is None and step is not None and step.get("kind") == "expect":
+ got = next((re.search(r'unexpected value "(.*)"', x) for x in reversed(lc.get("logs") or [])
+ if "unexpected value" in x), None)
+ if got:
+ out["received"] = {"text": redact(got.group(1)), "parts": [[redact(got.group(1)), False]], "kind": ""}
+ if out["expected"] is None and step is not None and step.get("kind") == "expect":
+ e = _expected_of(step.get("params") or {}, lc.get("params") or {})
+ if e is not None:
+ out["expected"] = {"text": redact(e), "parts": [[redact(e), False]], "kind": ""}
+ if head.lower() in ("expect failed", "") and step is not None:
+ mm = re.search(r'"([\w.]+)"', step.get("title") or "")
+ head = "expect%s failed" % ("(...)." + mm.group(1) + "()" if mm else "")
+ if not log and lc.get("logs"):
+ log = [x.strip() for x in lc["logs"] if x.strip()]
+ out["headline"] = redact(rv.shorten(head, 120))
+ uniq = [x for i, x in enumerate(log) if x not in log[:i]]
+ out["call_log"] = redact(rv.shorten(uniq[-1], 120)) if uniq else ""
+ return out
+
+
+def _source_line(src: Dict[str, List[str]], abs_file: str, line: Optional[int], redact: Redactor) -> Optional[Dict[str, Any]]:
+ """The failing line of the test's source (the trace carries the file), dedented and redacted."""
+ if not line:
+ return None
+ lines = src.get(hashlib.sha1((abs_file or "").encode("utf-8")).hexdigest())
+ if lines is None and len(src) == 1:
+ lines = next(iter(src.values()))
+ if not lines or not (1 <= int(line) <= len(lines)):
+ return None
+ return {"line": int(line), "text": redact(rv.shorten(lines[int(line) - 1].strip(), 180))}
+
+
+def has_failure(path: Path) -> Tuple[bool, Optional[float], str]:
+ """(the test failed, its wall-clock start, its test title), reading only until the answer is known: with
+ the test runner's events, its `error` event (an error a test caught is no failure); else a library call's
+ error."""
+ try:
+ z = open_trace(path)
+ except ShowtimeError:
+ return False, None, ""
+ try:
+ infos = _members(z)
+ names = sorted(i.filename for i in infos if i.filename.endswith(".trace"))
+ runner = [n for n in names if n.rsplit("/", 1)[-1] == "test.trace"]
+ wall, title, err = None, "", False
+ for n in runner or names:
+ for e in _jsonl(z, n, stop=lambda e: e.get("type") == "error" or (not runner and e.get("type") == "after"
+ and bool(e.get("error")))):
+ if e.get("type") == "context-options":
+ wall = wall or e.get("wallTime")
+ title = title or e.get("title") or ""
+ if e.get("type") == "error" or (not runner and e.get("type") == "after" and e.get("error")):
+ err = True
+ if err:
+ break
+ finally:
+ z.close()
+ return err, wall, title or path.parent.name
+
+
+# ---------------------------------------------------------------------------
+# running a command with tracing on
+# ---------------------------------------------------------------------------
+
+def runner_of(cmd: Sequence[str]) -> str:
+ """'playwright' for `npx playwright test ...` (and pnpm/yarn/bunx/node cli.js), 'pytest' for pytest, else ''."""
+ toks = [os.path.basename(t).lower() for t in cmd]
+ for i, t in enumerate(toks):
+ if re.match(r"^playwright(\.cmd|\.exe)?$|^cli\.js$", t) and "test" in toks[i + 1:i + 3]:
+ return "playwright"
+ if re.match(r"^(py\.?test|pytest)(\.exe)?$", t) or (t == "-m" and toks[i + 1:i + 2] == ["pytest"]):
+ return "pytest"
+ return ""
+
+
+def _flag_value(cmd: Sequence[str], flag: str) -> Optional[str]:
+ for i, a in enumerate(cmd):
+ if a == flag and i + 1 < len(cmd):
+ return cmd[i + 1]
+ if a.startswith(flag + "="):
+ return a.split("=", 1)[1]
+ return None
+
+
+def tracing_command(cmd: Sequence[str], out_dir: Path) -> Tuple[List[str], str]:
+ """(the command with tracing on for failing tests and its output in out_dir, the runner). Flags the user
+ gave win."""
+ cmd = list(cmd)
+ kind = runner_of(cmd)
+ has = lambda flag: any(a == flag or a.startswith(flag + "=") for a in cmd) # noqa: E731
+ if kind == "playwright":
+ if not has("--trace"):
+ cmd += ["--trace", "retain-on-failure"]
+ if not has("--output"):
+ cmd += ["--output", str(out_dir)]
+ elif kind == "pytest":
+ if not has("--tracing"):
+ cmd += ["--tracing", "retain-on-failure"]
+ if not has("--output"):
+ cmd += ["--output", str(out_dir)]
+ return cmd, kind
+
+
+PRUNE = {"node_modules", ".git", ".venv", "venv", "__pycache__", ".hg", ".svn"}
+
+
+def find_traces(roots: Iterable[Path], since: float, max_depth: int = 6) -> List[Path]:
+ """trace.zip files written since `since` under the folders the runner was told to write into (never the
+ whole working tree): at most `max_depth` levels down, skipping node_modules, .git and virtualenvs."""
+ out: List[Path] = []
+ for r in roots:
+ r = Path(r)
+ if not r.is_dir():
+ continue
+ base = len(r.parts)
+ for dirpath, dirnames, filenames in os.walk(str(r)):
+ depth = len(Path(dirpath).parts) - base
+ dirnames[:] = [d for d in dirnames if d not in PRUNE and depth < max_depth]
+ if "trace.zip" in filenames:
+ p = Path(dirpath) / "trace.zip"
+ try:
+ if p.stat().st_mtime >= since - 1:
+ out.append(p)
+ except OSError:
+ continue
+ return sorted(set(out))
+
+
+# what the launcher sets for showtime's own tools, by name and the value it gives (home: SHOWTIME_HOME)
+_OURS = (("IMAGEIO_FFMPEG_EXE", ("bin", "ffmpeg")), ("SUPERTONIC_CACHE_DIR", ("models", "supertonic3")),
+ ("U2NET_HOME", ("models", "u2net")), ("PLAYWRIGHT_BROWSERS_PATH", ("browsers",)),
+ ("HF_HOME", ("models", "hf")))
+
+
+def user_env(env: Optional[Dict[str, str]] = None) -> Dict[str, str]:
+ """The environment the user's own test command runs in: PATH as the user has it, without what the launcher
+ adds for showtime's own tools (its lib on PYTHONPATH, its node_modules on NODE_PATH, its browsers, its model
+ caches and ffmpeg, its settings, the variables it set that the user had not), so `pytest` and
+ `npx playwright` are the project's own, with the project's browsers."""
+ e = dict(os.environ if env is None else env)
+ if e.get("SHOWTIME_USER_PATH") is not None:
+ e["PATH"] = e["SHOWTIME_USER_PATH"]
+ norm = lambda x: os.path.normcase(os.path.normpath(x)) # noqa: E731
+ lib = str(Path(__file__).resolve().parent.parent)
+ for var, ours in (("PYTHONPATH", lib), ("NODE_PATH", e.get("SHOWTIME_NODE_MODULES") or "")):
+ keep = [x for x in (e.get(var) or "").split(os.pathsep) if x and not (ours and norm(x) == norm(ours))]
+ if keep:
+ e[var] = os.pathsep.join(keep)
+ else:
+ e.pop(var, None)
+ home = e.get("SHOWTIME_HOME")
+ if home:
+ for var, parts in _OURS:
+ v, ours = e.get(var), os.path.join(home, *parts)
+ if v and (v == ours or var == "IMAGEIO_FFMPEG_EXE" and v.startswith(ours)):
+ e.pop(var)
+ for var in (e.get("SHOWTIME_ADDED_ENV") or "").split(","): # set by the launcher, not by the user
+ if var and var not in ("PATH", "PYTHONPATH", "NODE_PATH") and var not in dict(_OURS):
+ e.pop(var, None)
+ if e.get("SHOWTIME_USER_HF_HOME"):
+ e["HF_HOME"] = e["SHOWTIME_USER_HF_HOME"]
+ for var in [k for k in e if k.startswith("SHOWTIME_")]:
+ del e[var]
+ return e
+
+
+DEFAULT_TIMEOUT = 1800.0 # seconds the user's test command may run
+
+
+def run_and_find(cmd: Sequence[str], out_dir: Path, *, cwd: Optional[Path] = None,
+ timeout: float = DEFAULT_TIMEOUT) -> Dict[str, Any]:
+ """Run the test command with tracing on; return {rc, command, runner, trace, failing, traces}. Traces are
+ looked for only where the runner was told to write (out_dir, or the --output the user gave). The runner's
+ output goes to stderr (stdout stays the command's own result). Its stdin is empty, and Playwright's html
+ reporter is told not to serve its report (it would wait for Ctrl+C in a terminal), unless the user said."""
+ out_dir.mkdir(parents=True, exist_ok=True)
+ full, kind = tracing_command(cmd, out_dir)
+ cwd = Path(cwd or os.getcwd())
+ env = user_env()
+ if not env.get("PLAYWRIGHT_HTML_OPEN") and not env.get("PW_TEST_HTML_REPORT_OPEN"):
+ env["PLAYWRIGHT_HTML_OPEN"] = "never"
+ exe = shutil.which(full[0], path=env.get("PATH")) or full[0]
+ start = time.time()
+ posix = os.name != "nt"
+ try:
+ proc = subprocess.Popen([exe] + full[1:], cwd=str(cwd), env=env, stdin=subprocess.DEVNULL, stdout=sys.stderr,
+ stderr=sys.stderr, start_new_session=posix)
+ except OSError as e:
+ raise ShowtimeError("could not run %s: %s" % (full[0], e.strerror or e),
+ hint="check the command (it runs without a shell, from the current folder); e.g. "
+ "showtime repro -- npx playwright test tests/login.spec.ts")
+ try:
+ rc = proc.wait(timeout=timeout)
+ except subprocess.TimeoutExpired:
+ _kill_tree(proc, posix)
+ raise ShowtimeError("the test command ran longer than %d s and was stopped" % timeout,
+ hint="run one test (a watch or UI mode never ends), or give it more time: --timeout SECONDS")
+ except KeyboardInterrupt:
+ _kill_tree(proc, posix)
+ raise
+ user_out = _flag_value(full, "--output") if kind else None
+ roots = [out_dir] + ([cwd / user_out] if user_out and (cwd / user_out).resolve() != out_dir.resolve() else [])
+ traces = find_traces(roots, start)
+ found = []
+ for p in traces:
+ err, wall, title = has_failure(p)
+ if err:
+ found.append((wall or p.stat().st_mtime * 1000, p, title))
+ found.sort(key=lambda x: x[0])
+ return {"rc": rc, "command": full, "runner": kind, "traces": [str(p) for p in traces],
+ "failing": [{"trace": str(p), "title": t} for _w, p, t in found],
+ "trace": str(found[0][1]) if found else None}
+
+
+def _kill_tree(proc: "subprocess.Popen[Any]", posix: bool) -> None:
+ try:
+ if posix:
+ os.killpg(proc.pid, 9)
+ else:
+ subprocess.run(["taskkill", "/F", "/T", "/PID", str(proc.pid)], stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL)
+ except (OSError, subprocess.SubprocessError):
+ proc.kill()
+ try:
+ proc.wait(timeout=10)
+ except subprocess.TimeoutExpired:
+ pass
+
+
+def rerun_command(rep: Dict[str, Any], cmd: Optional[Sequence[str]], redact: Redactor) -> str:
+ """What the end card says to run: the command given, else `npx playwright test <file>:<line>` for a test
+ runner's trace (a library-only trace, such as pytest's, does not say how its test is selected)."""
+ if cmd:
+ return redact(" ".join(shlex.quote(c) for c in cmd))
+ loc = rep["test"]["location"]
+ if rep.get("language", "javascript") == "javascript" and rep["test"].get("line") and loc:
+ return "npx playwright test %s" % loc
+ return ""
+
+
+def viewer_command(rep: Dict[str, Any], trace_name: str = "trace.zip") -> str:
+ return ("playwright show-trace %s" if rep.get("language") == "python" else "npx playwright show-trace %s") % trace_name
+
+
+# ---------------------------------------------------------------------------
+# planning the film
+# ---------------------------------------------------------------------------
+
+def read_time(text: str) -> float:
+ return pv.read_time(text)
+
+
+def _step_texts(s: Dict[str, Any]) -> List[str]:
+ return [s["caption"], s["locator"], s["url"], "%s:%s" % (s["file"], s["line"]) if s["file"] else ""]
+
+
+def step_dur(s: Dict[str, Any]) -> float:
+ need = max(read_time(t) for t in _step_texts(s) if t)
+ extra = 0.5 if s["kind"] in POINTER_KINDS else 0.0 # the cursor travels before the click
+ return round(min(4.2, max(2.2, LEAD + ENTER + extra + need + OUT)), 2)
+
+
+def fail_dur(rep: Dict[str, Any]) -> float:
+ f = rep["failure"] or {}
+ beats = fail_beats(rep)
+ last = max(beats.values()) if beats else 1.0
+ texts = [f.get("headline", ""), (f.get("expected") or {}).get("text", "") + " " + (f.get("received") or {}).get("text", "")]
+ texts += [c["text"] for c in rep["console"][:2]]
+ need = last + ENTER + max(read_time(t) for t in texts if t.strip()) if any(t.strip() for t in texts) else last + 2
+ return round(min(12.0, max(6.5, need + OUT)), 2)
+
+
+def fail_beats(rep: Dict[str, Any]) -> Dict[str, float]:
+ """When each part of the failure scene arrives (a beat about every second, so it never reads as a hold)."""
+ f = rep["failure"] or {}
+ at = 0.25
+ out = {"caption": at}
+ at += 0.9
+ if f.get("source"):
+ out["source"] = at
+ at += 1.0
+ if f.get("expected") or f.get("received"):
+ out["vs"] = at
+ at += 1.3
+ out["error"] = at
+ at += 1.0
+ if rep["console"]:
+ out["console"] = at
+ return out
+
+
+def title_meta(rep: Dict[str, Any]) -> str:
+ n = len(rep["steps"])
+ f = rep["failure"]
+ return " \u00b7 ".join(x for x in ("Playwright %s" % rep["playwright"] if rep["playwright"] else "Playwright",
+ rep["browser"], "%d step%s" % (n, "" if n == 1 else "s"),
+ ("fails at step %d" % f["step"]) if f and f.get("step") else "") if x)
+
+
+def title_dur(rep: Dict[str, Any]) -> float:
+ need = max(read_time(rep["test"]["title"]), 0.5 + read_time(title_meta(rep))) # the meta line rises at 0.5 s
+ return round(max(3.0, LEAD + ENTER + need + 0.3 + OUT), 2)
+
+
+def end_dur(rerun: str) -> float:
+ return round(max(3.2, LEAD + ENTER + read_time(rerun or "") + OUT), 2)
+
+
+def plan(rep: Dict[str, Any], *, rerun: str = "", max_seconds: float = MAX_SECONDS,
+ speech: Optional[Dict[str, float]] = None) -> Dict[str, Any]:
+ """Scenes and their lengths: the title, the steps (compressed to fit max_seconds: the first step, then the
+ steps just before the failure; the ones between become one "+ N passing steps" scene), the failure and the
+ end card. With `speech` ({scene id: seconds of narration}) a scene is at least as long as its line."""
+ steps = rep["steps"]
+ fail_n = (rep["failure"] or {}).get("step")
+ passing = [s for s in steps if s["status"] == "passed" and (fail_n is None or s["n"] < fail_n)]
+ shown_fail = [s for s in steps if fail_n is not None and s["n"] == fail_n]
+
+ def spoken(sid: str, d: float) -> float:
+ if speech and sid in speech:
+ return round(max(d, VOICE_PAD + speech[sid] + VOICE_TAIL), 2)
+ return d
+ fixed = spoken("title", title_dur(rep)) + spoken("fail", fail_dur(rep) if rep["failure"] else 0) + \
+ spoken("end", end_dur(rerun))
+ durs = {s["n"]: spoken("step%d" % s["n"], step_dur(s)) for s in passing}
+ budget = max_seconds - fixed
+ keep = [s["n"] for s in passing]
+ skipped: List[int] = []
+ if sum(durs.values()) > budget and len(passing) > 2:
+ skip_d = spoken("skip", 2.6)
+ head = [passing[0]["n"]]
+ tail: List[int] = []
+ room = budget - durs[head[0]] - skip_d
+ for s in reversed(passing[1:]):
+ if durs[s["n"]] <= room:
+ tail.insert(0, s["n"])
+ room -= durs[s["n"]]
+ else:
+ break
+ skipped = [s["n"] for s in passing if s["n"] not in head + tail]
+ keep = head + tail
+ if len(skipped) == 1: # one step is cheaper shown than summed up
+ keep, skipped = sorted(keep + skipped), []
+ scenes: List[Dict[str, Any]] = [{"id": "title", "kind": "title", "dur": spoken("title", title_dur(rep))}]
+ for s in passing:
+ if s["n"] in keep:
+ scenes.append({"id": "step%d" % s["n"], "kind": "step", "dur": durs[s["n"]], "step": s["n"]})
+ elif skipped and s["n"] == skipped[0]:
+ scenes.append({"id": "skip", "kind": "skip", "dur": spoken("skip", 2.6), "skipped": list(skipped)})
+ if shown_fail or rep["failure"]:
+ scenes.append({"id": "fail", "kind": "fail", "dur": spoken("fail", fail_dur(rep)), "step": fail_n})
+ scenes.append({"id": "end", "kind": "end", "dur": spoken("end", end_dur(rerun))})
+ t = 0.0
+ for sc in scenes:
+ sc["start"] = round(t, 2)
+ t += sc["dur"]
+ return {"scenes": scenes, "duration": round(t, 2), "shown_steps": len(keep) + (1 if shown_fail else 0),
+ "skipped_steps": skipped, "total_steps": len(steps), "rerun": rerun}
+
+
+def _say(text: str) -> str:
+ """A caption made speakable: quotes and the mask dots go, code-ish words stay as written."""
+ t = re.sub(re.escape(MASK) + r"@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*", "a hidden email address", text)
+ t = t.replace(MASK, "a hidden value").replace("\u201c", "").replace("\u201d", "")
+ t = re.sub(r"'([^']+)'", r"\1", t)
+ return re.sub(r"\s+", " ", t).strip()
+
+
+def step_line(s: Dict[str, Any]) -> str:
+ """A step's spoken line: never a typed value (a fill, a typed text, a chosen option or an unnamed key is
+ said without it)."""
+ tgt = s.get("target") or ""
+ k = s["kind"]
+ if k in TYPED_KINDS:
+ line = ("Clear %s" % (tgt or "the field")) if s.get("typed_chars") == 0 else "Type into %s" % (tgt or "the page")
+ elif k == "select":
+ line = "Choose an option in %s" % (tgt or "the list")
+ elif k == "press":
+ line = "Press %s" % (s["value"] if s.get("value") and s["value"] != MASK else "a key")
+ elif k == "upload":
+ line = "Upload a file"
+ elif k == "goto":
+ line = "Open the page"
+ else:
+ line = s["caption"]
+ return _say(line).rstrip(".") + "."
+
+
+def title_line(rep: Dict[str, Any]) -> str:
+ f = rep["failure"]
+ name = _say(rep["test"]["title"]).rstrip(".")
+ return "%s. %s" % (name[:1].upper() + name[1:], "This test fails at step %d." % f["step"] if f and f.get("step")
+ else "This test fails." if f else "This test passes.")
+
+
+def fail_line(rep: Dict[str, Any]) -> str:
+ f = rep["failure"] or {}
+ s = next((x for x in rep["steps"] if x["n"] == f.get("step")), None)
+ exp, got = (f.get("expected") or {}).get("text"), (f.get("received") or {}).get("text")
+ line = "Step %d fails. " % f["step"] if f.get("step") else "Here it fails. "
+ if s and s["kind"] == "expect" and exp is not None and got is not None and len(exp) + len(got) < 90:
+ line += "It expected %s, but got %s." % (_say(exp), _say(got))
+ else:
+ line += _say(f.get("headline") or "the test failed").rstrip(".") + "."
+ n = len(rep["console"]) + int(rep.get("console_more") or 0)
+ if n:
+ line += " The console logged %s." % ("an error" if n == 1 else "%d errors" % n)
+ return line
+
+
+SKIP_LINE = "Then {n} more steps pass."
+
+
+def end_line(rerun: str) -> str:
+ return "Run the command on screen to see it fail." if rerun else "Open the trace to see every step."
+
+
+def narration(rep: Dict[str, Any], p: Dict[str, Any]) -> Dict[str, str]:
+ """{scene id: line}. Values typed into fields are never spoken. The lines of script.md (rep["say"]) win:
+ an empty one leaves its scene silent."""
+ out: Dict[str, str] = {}
+ steps = {s["n"]: s for s in rep["steps"]}
+ say = rep.get("say") or {}
+ for sc in p["scenes"]:
+ sid = sc["id"]
+ if sid == "title":
+ line = title_line(rep)
+ elif sc["kind"] == "step":
+ line = step_line(steps[sc["step"]])
+ elif sid == "skip":
+ line = SKIP_LINE
+ elif sid == "fail" and rep["failure"]:
+ line = fail_line(rep)
+ elif sid == "end":
+ line = end_line(p.get("rerun") or "")
+ else:
+ continue
+ line = say.get(sid, line)
+ if line:
+ out[sid] = line.replace("{n}", str(len(sc.get("skipped") or [])))
+ return out
+
+
+# ---------------------------------------------------------------------------
+# captions (repro.srt)
+# ---------------------------------------------------------------------------
+
+def _wrap(text: str, width: int = 42) -> List[str]:
+ words, lines, cur = text.split(), [], ""
+ for w in words:
+ if cur and len(cur) + 1 + len(w) > width:
+ lines.append(cur)
+ cur = w
+ else:
+ cur = (cur + " " + w).strip()
+ if cur:
+ lines.append(cur)
+ return lines
+
+
+def _cue_chunks(text: str, width: int = 42) -> List[str]:
+ """Text -> cues of at most two lines of `width` characters, split at sentences, then at words."""
+ lines = _wrap(text, width)
+ if len(lines) <= 2:
+ return ["\n".join(lines)]
+ out: List[str] = []
+ for sent in re.split(r"(?<=[.!?])\s+", text.strip()):
+ ls = _wrap(sent, width)
+ out += ["\n".join(ls[i:i + 2]) for i in range(0, len(ls), 2)]
+ return out
+
+
+def srt_time(t: float) -> str:
+ ms = int(round(max(0.0, t) * 1000))
+ return "%02d:%02d:%02d,%03d" % (ms // 3600000, ms // 60000 % 60, ms // 1000 % 60, ms % 1000)
+
+
+def build_srt(p: Dict[str, Any], lines: Dict[str, str], spans: Optional[Dict[str, Tuple[float, float]]] = None) -> str:
+ """One cue (or a few) per scene: the narration while it is spoken (`spans`: {scene id: (start, end)} in the
+ video), else across the scene."""
+ from .captions_rules import MAX_CPS
+ cues: List[Tuple[float, float, str]] = []
+ for sc in p["scenes"]:
+ text = lines.get(sc["id"])
+ if not text:
+ continue
+ a, b = (spans or {}).get(sc["id"], (sc["start"] + LEAD, sc["start"] + sc["dur"] - OUT))
+ b = max(b, min(sc["start"] + sc["dur"] - 0.05, a + len(text) / MAX_CPS + 0.05))
+ parts = _cue_chunks(text)
+ total = sum(len(x) for x in parts) or 1
+ t = a
+ for x in parts:
+ d = (b - a) * len(x) / total
+ cues.append((t, t + d, x))
+ t += d
+ return "".join("%d\n%s --> %s\n%s\n\n" % (i + 1, srt_time(a), srt_time(b), x) for i, (a, b, x) in enumerate(cues))
+
+
+# ---------------------------------------------------------------------------
+# the page
+# ---------------------------------------------------------------------------
+
+CSS = rv.CSS + r"""
+ .scene { --fail: #ff6b6b; --ok: #6fdc8c; --s-cap: 4.4cqh; --s-mono: 2.5cqh; --s-small: 2.4cqh; --s-kind: 2.4cqh; }
+ .topbar { position: absolute; left: 5.5cqw; right: 5.5cqw; top: 5.6cqh; display: flex; align-items: center; gap: 2cqw; }
+ .topbar .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .counter { font: 600 2.8cqh/1 var(--font-mono); color: var(--fg); display: flex; align-items: center; gap: 1.2cqw; }
+ .counter em { font-style: normal; color: var(--muted); font-weight: 500; }
+ .pips { display: flex; gap: 0.5cqw; }
+ .pips i { display: block; width: 1.3cqh; height: 1.3cqh; border-radius: 50%; background: var(--line); }
+ .pips i.ok { background: color-mix(in oklab, var(--ok) 70%, transparent); }
+ .pips i.now { background: var(--accent); box-shadow: 0 0 0 0.35cqh color-mix(in oklab, var(--accent) 35%, transparent); }
+ .pips i.bad { background: var(--fail); }
+
+ /* the browser window around a screenshot */
+ .win { position: absolute; border-radius: 1.2cqh; overflow: hidden; background: #1b1f27;
+ box-shadow: 0 2.4cqh 6cqh rgb(0 0 0 / 0.45), 0 0 0 max(1px, 0.12cqh) var(--line); }
+ .win .bar { height: 4.6cqh; display: flex; align-items: center; gap: 1cqw; padding: 0 1.2cqw; background: #232833; }
+ .win .bar .d { display: flex; gap: 0.5cqw; }
+ .win .bar .d i { width: 1.2cqh; height: 1.2cqh; border-radius: 50%; background: #3a4150; display: block; }
+ .win .bar .u { flex: 1; min-width: 0; font: 500 2.4cqh/1 var(--font-mono); color: var(--muted); background: #161a21;
+ border-radius: 0.8cqh; padding: 0.9cqh 1.2cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .win .bar .u.typed { animation: reveal 0.7s steps(24, end) var(--at, 0.2s) both; }
+ @keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
+ .shot { position: relative; }
+ .shot { overflow: hidden; }
+ .shot img { display: block; width: 100%; height: 100%; object-fit: fill; }
+ .zoom { position: absolute; inset: 0; animation: zoomin 0.9s cubic-bezier(0.45, 0, 0.2, 1) 0.1s both; }
+ @keyframes zoomin { from { transform: none; } to { transform: scale(var(--z)); } }
+ .shot .none { position: absolute; inset: 0; display: grid; place-items: center; font: 500 2.4cqh/1.3 var(--font-mono);
+ color: var(--muted); background: #12151b; }
+ .box { position: absolute; border: max(2px, 0.3cqh) solid var(--accent); border-radius: 0.6cqh;
+ box-shadow: 0 0 0 0.6cqh color-mix(in oklab, var(--accent) 22%, transparent);
+ animation: boxin 0.45s cubic-bezier(0.16, 1, 0.3, 1) var(--at, 0.3s) both; }
+ .box.bad { border-color: var(--fail); box-shadow: 0 0 0 0.6cqh color-mix(in oklab, var(--fail) 25%, transparent); }
+ @keyframes boxin { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }
+ .cursor { position: absolute; width: 3.4cqh; height: 3.4cqh; left: var(--x); top: var(--y); margin: -0.3cqh 0 0 -0.5cqh;
+ animation: travel 0.6s cubic-bezier(0.45, 0, 0.2, 1) 0.15s both; filter: drop-shadow(0 0.3cqh 0.5cqh rgb(0 0 0 / 0.5)); }
+ @keyframes travel { from { left: var(--x0); top: var(--y0); } to { left: var(--x); top: var(--y); } }
+ .ripple { position: absolute; width: 7cqh; height: 7cqh; margin: -3.5cqh 0 0 -3.5cqh; border-radius: 50%;
+ border: max(2px, 0.35cqh) solid var(--accent); opacity: 0; animation: ripple 0.7s ease-out var(--at, 0.8s) both; }
+ @keyframes ripple { 0% { opacity: 0.95; transform: scale(0.15); } 100% { opacity: 0; transform: scale(1.5); } }
+ .cover { position: absolute; background: #2b303b; border-radius: 0.5cqh; display: grid; place-items: center;
+ box-shadow: 0 0 0 max(1px, 0.12cqh) #454c5a; overflow: hidden; }
+ .cover::after { content: "hidden"; font: 600 1.5cqh/1 var(--font-mono); letter-spacing: 0.14em; color: #9aa3b2;
+ text-transform: uppercase; }
+ .t .cover::after { content: none; }
+ .t { position: relative; }
+ .caret { position: absolute; width: max(2px, 0.25cqh); background: var(--accent); animation: blink 0.5s steps(1) 0.4s 6 both; }
+ @keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } }
+
+ /* the side column of a step */
+ .side { position: absolute; right: 5.5cqw; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 2.2cqh; }
+ .side > * { margin: 0; opacity: 0; animation: rise 0.45s cubic-bezier(0.16, 1, 0.3, 1) var(--at) both; }
+ .kind { font: 600 var(--s-kind)/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
+ .kind.ok::after { content: " \2713"; color: var(--ok); }
+ .kind.bad { color: var(--fail); }
+ .cap { font: 600 var(--s-cap)/1.18 var(--font-display); letter-spacing: -0.015em; color: var(--fg); overflow-wrap: anywhere; }
+ .loc { font: 500 var(--s-mono)/1.35 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
+ .where { font: 500 var(--s-small)/1.3 var(--font-mono); color: var(--muted); opacity: 0.85; }
+
+ /* title */
+ .tcard { position: absolute; left: 8cqw; right: 8cqw; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 2.6cqh; }
+ .tcard .pill { align-self: flex-start; font: 700 3.4cqh/1 var(--font-mono); letter-spacing: 0.14em; color: #1a0d0d;
+ background: var(--fail); border-radius: 0.8cqh; padding: 1cqh 1.4cqw; }
+ .tcard .tname { font: 700 9cqh/1.04 var(--font-display); letter-spacing: -0.03em; color: var(--fg); margin: 0; overflow-wrap: anywhere; }
+ .tcard .tloc { font: 600 4.4cqh/1 var(--font-mono); color: var(--accent); margin: 0; }
+ .tcard .tmeta { font: 500 3cqh/1.3 var(--font-mono); color: var(--muted); margin: 0;
+ animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both; }
+
+ /* passing steps summed up */
+ .skip { position: absolute; left: 8cqw; right: 8cqw; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 3cqh; }
+ .skip .head { font: 650 7cqh/1.04 var(--font-display); letter-spacing: -0.03em; color: var(--fg); margin: 0; }
+ .skip .head em { font-style: normal; color: var(--ok); }
+ .thumbs { display: flex; gap: 1.2cqw; }
+ .thumbs .t { width: 13cqw; aspect-ratio: var(--ar); border-radius: 0.8cqh; overflow: hidden; background: #12151b;
+ box-shadow: 0 0 0 max(1px, 0.12cqh) var(--line); opacity: 0; animation: rise 0.4s ease var(--at) both; }
+ .thumbs .t img { width: 100%; height: 100%; display: block; object-fit: fill; }
+ .skip .range { font: 500 2.8cqh/1.3 var(--font-mono); color: var(--muted); margin: 0; animation: rise 0.5s ease 0.6s both; }
+
+ /* the failure */
+ .fside { position: absolute; left: 50cqw; right: 5.5cqw; top: 13cqh; bottom: 6cqh; display: flex; flex-direction: column;
+ justify-content: center; gap: 2.2cqh; }
+ .fside > * { margin: 0; opacity: 0; animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) var(--at) both; }
+ .fside .cap { font-size: 3.7cqh; }
+ .src { font: 500 2.4cqh/1.45 var(--font-mono); color: var(--fg); background: var(--surface); border-radius: 0.8cqh;
+ padding: 1.2cqh 1.2cqw; white-space: pre-wrap; overflow-wrap: anywhere;
+ box-shadow: inset 0.5cqh 0 0 var(--fail), 0 0 0 max(1px, 0.12cqh) var(--line);
+ background-image: linear-gradient(color-mix(in oklab, var(--fail) 16%, transparent), color-mix(in oklab, var(--fail) 16%, transparent)); }
+ .src .n { color: var(--muted); margin-right: 1.2em; }
+ .vs { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2cqw; }
+ .vs > div { background: var(--surface); border-radius: 0.8cqh; padding: 1.4cqh 1.2cqw; box-shadow: 0 0 0 max(1px, 0.12cqh) var(--line); }
+ .vs .k { font: 600 2.4cqh/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 1.2cqh; }
+ .vs .exp .k { color: var(--ok); } .vs .rec .k { color: var(--fail); }
+ .vs .v { font: 600 3.3cqh/1.25 var(--font-mono); color: var(--fg); margin: 0; overflow-wrap: anywhere; }
+ .vs .exp mark { background: color-mix(in oklab, var(--ok) 35%, transparent); color: var(--fg); border-radius: 0.3em; }
+ .vs .rec mark { background: color-mix(in oklab, var(--fail) 40%, transparent); color: var(--fg); border-radius: 0.3em; }
+ .ferr { font: 500 2.5cqh/1.4 var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
+ .ferr b { color: var(--fail); font-weight: 600; }
+ .cons { font: 500 2.4cqh/1.4 var(--font-mono); color: var(--fg); overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 0.6cqh; }
+ .cons b { color: #ffb86b; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
+ .win.failwin { box-shadow: 0 2.4cqh 6cqh rgb(0 0 0 / 0.45), 0 0 0 max(2px, 0.3cqh) var(--fail); }
+
+ /* end card */
+ .end .label { margin: 0; }
+ .end .viewer { font: 500 2.8cqh/1.3 var(--font-mono); color: var(--muted); margin: 0; }
+"""
+
+ARROW = ('<svg viewBox="0 0 24 24" width="100%" height="100%"><path d="M4 2 L4 19 L8.6 14.8 L11.6 21.4 L14.4 20.2 '
+ 'L11.5 13.7 L17.6 13.4 Z" fill="#fff" stroke="#111" stroke-width="1.4" stroke-linejoin="round"/></svg>')
+
+
+def _e(s: Any) -> str:
+ return rv._e("" if s is None else str(s))
+
+
+def _fit(ar: float, max_w: float, max_h: float, bar: float = 4.6) -> Tuple[float, float]:
+ """(width in cqw, screenshot height in cqh) of a window of aspect `ar` that fits max_w cqw x max_h cqh (bar
+ included), on a 16:9 frame."""
+ w = max_w
+ h = w * 16.0 / 9.0 / ar # cqw -> cqh on a 16:9 frame
+ if h + bar > max_h:
+ h = max_h - bar
+ w = h * ar * 9.0 / 16.0
+ return round(w, 2), round(h, 2)
+
+
+def _zoom(box: Optional[Dict[str, float]], point: Optional[Dict[str, float]]) -> Optional[Dict[str, float]]:
+ """How far to push in on a step's target: its box about 45 % of the window wide, at most 1.6x."""
+ if not box or box["w"] <= 0:
+ return None
+ pt = point or {"x": box["x"] + box["w"] / 2, "y": box["y"] + box["h"] / 2}
+ z = round(min(1.6, max(1.0, 45.0 / box["w"])), 2)
+ return {"x": pt["x"], "y": pt["y"], "z": z} if z > 1.05 else None
+
+
+def _window(shot: Optional[str], url: str, ar: float, *, left: float, top: float, max_w: float, max_h: float,
+ inner: str = "", cls: str = "", typed: bool = False, zoom: Optional[Dict[str, float]] = None) -> str:
+ w, h = _fit(ar, max_w, max_h)
+ img = '<img src="%s" alt="">' % _e(shot) if shot else '<div class="none">no screenshot in the trace</div>'
+ if zoom:
+ img = '<div class="zoom" style="transform-origin:%.2f%% %.2f%%;--z:%.2f">%s%s</div>' % (
+ zoom["x"], zoom["y"], zoom["z"], img, inner)
+ inner = ""
+ return (' <div class="win%s" style="left:%.2fcqw;top:%.2fcqh;width:%.2fcqw">\n'
+ ' <div class="bar"><span class="d"><i></i><i></i><i></i></span><span class="u%s">%s</span></div>\n'
+ ' <div class="shot" style="height:%.2fcqh">%s%s</div>\n </div>'
+ % (" " + cls if cls else "", left, top, w, " typed" if typed else "", _e(url or "about:blank"), h, img, inner))
+
+
+def _covers(boxes: Optional[Sequence[Dict[str, float]]]) -> str:
+ """Opaque chips over the fields a value was typed into (the screenshot would show it)."""
+ return "".join('<div class="cover" style="left:%.2f%%;top:%.2f%%;width:%.2f%%;height:%.2f%%"></div>'
+ % (b["x"], b["y"], b["w"], b["h"]) for b in boxes or ())
+
+
+def _pips(rep: Dict[str, Any], now: Optional[int]) -> str:
+ steps = rep["steps"]
+ if len(steps) > 24:
+ return ""
+ out = []
+ for s in steps:
+ c = "bad" if s["status"] == "failed" and (now is None or s["n"] <= now) else \
+ "now" if s["n"] == now else "ok" if now is not None and s["n"] < now else ""
+ out.append('<i class="%s"></i>' % c if c else "<i></i>")
+ return '<span class="pips">%s</span>' % "".join(out)
+
+
+def _marks(parts: Sequence[Sequence[Any]]) -> str:
+ return "".join("<mark>%s</mark>" % _e(t) if f else _e(t) for t, f in parts)
+
+
+def build_page(rep: Dict[str, Any], p: Dict[str, Any], shots: Dict[str, str]) -> str:
+ """The film. `shots` maps a trace screenshot to its file in the project (shots/NN.jpeg)."""
+ steps = {s["n"]: s for s in rep["steps"]}
+ vp = rep["viewport"]
+ ar = float(vp["width"]) / float(vp["height"] or 1)
+ title = rep["test"]["title"]
+ total = len(rep["steps"])
+ head = rep["test"]["location"] or title
+ out: List[str] = []
+ prev = ""
+ last_point = {"x": 50.0, "y": 92.0}
+ for sc in p["scenes"]:
+ sid = sc["id"]
+ start = "0" if not prev else "#" + prev
+ trans = "" if not prev else ' data-transition="dip %.1f"' % (2 * OUT)
+ push = [{"at": 0, "zoom": 1}, {"at": 0.15, "dur": round(max(1.0, sc["dur"] - 0.3), 2), "zoom": 1.04,
+ "focus": [50, 50], "to": "stay", "ease": "linear"}]
+ out.append(' <section class="scene" id="%s" data-start="%s" data-dur="%.2f"%s>\n <div class="cam" '
+ 'data-st="camera" data-path=\'%s\'>' % (sid, start, sc["dur"], trans, json.dumps(push)))
+ top = ' <div class="topbar"><p class="label">Repro <b>&middot;</b> %s</p><div class="counter">%s%s</div></div>'
+ if sid == "title":
+ meta = title_meta(rep)
+ out.append(' <div class="tcard">\n <span class="pill">%s</span>\n <h1 class="tname">%s</h1>'
+ % ("FAILED" if rep["failure"] else "PASSED", _e(title)))
+ if rep["test"]["location"]:
+ out.append(' <p class="tloc">%s</p>' % _e(rep["test"]["location"]))
+ out.append(' <p class="tmeta">%s</p>\n </div>' % _e(meta))
+ elif sc["kind"] == "step":
+ s = steps[sc["step"]]
+ out.append(top % (_e(head), '<span><b>%d</b> <em>/ %d</em></span>' % (s["n"], total), _pips(rep, s["n"])))
+ inner = [_covers(s.get("covers"))]
+ travel = s["kind"] in POINTER_KINDS
+ if s["box"]:
+ b = s["box"]
+ inner.append('<div class="box" style="left:%.2f%%;top:%.2f%%;width:%.2f%%;height:%.2f%%;--at:%.2fs"></div>'
+ % (b["x"], b["y"], b["w"], b["h"], 0.75 if travel else 0.3))
+ if s["kind"] in ("fill", "type"):
+ inner.append('<div class="caret" style="left:%.2f%%;top:%.2f%%;height:%.2f%%"></div>'
+ % (b["x"] + 1.2, b["y"] + b["h"] * 0.22, b["h"] * 0.56))
+ if s["point"] and travel:
+ pt = s["point"]
+ inner.append('<div class="ripple" style="left:%.2f%%;top:%.2f%%;--at:0.75s"></div>' % (pt["x"], pt["y"]))
+ inner.append('<div class="cursor" style="--x0:%.2f%%;--y0:%.2f%%;--x:%.2f%%;--y:%.2f%%">%s</div>'
+ % (last_point["x"], last_point["y"], pt["x"], pt["y"], ARROW))
+ last_point = dict(pt)
+ out.append(_window(shots.get(s["shot"] or ""), s["url"], ar, left=5.5, top=14, max_w=57, max_h=80,
+ inner="".join(inner), typed=s["kind"] == "goto", zoom=_zoom(s["box"], s["point"])))
+ kind_cls = " ok" if s["kind"] == "expect" else ""
+ out.append(' <div class="side" style="left:%.2fcqw">' % (5.5 + _fit(ar, 57, 80)[0] + 3))
+ out.append(' <p class="kind%s" style="--at:0.15s">%s</p>' % (kind_cls, _e(s["kind"])))
+ out.append(' <p class="cap" style="--at:0.25s">%s</p>' % _e(s["caption"]))
+ if s["locator"]:
+ out.append(' <p class="loc" style="--at:0.4s">%s</p>' % _e(s["locator"]))
+ where = " \u00b7 ".join(x for x in ("%s:%s" % (s["file"], s["line"]) if s["file"] else "",
+ "%d ms" % s["duration_ms"]) if x)
+ out.append(' <p class="where" style="--at:0.5s">%s</p>\n </div>' % _e(where))
+ elif sid == "skip":
+ sk = [steps[n] for n in sc["skipped"]]
+ out.append(top % (_e(head), '<span><b>%d&ndash;%d</b> <em>/ %d</em></span>' % (sk[0]["n"], sk[-1]["n"], total),
+ _pips(rep, sk[-1]["n"])))
+ out.append(' <div class="skip">\n <h2 class="head"><em>+ %d</em> passing steps</h2>\n'
+ ' <div class="thumbs" style="--ar:%.4f">' % (len(sk), ar))
+ pick = sk if len(sk) <= 6 else [sk[int(round(i * (len(sk) - 1) / 5.0))] for i in range(6)]
+ for i, s in enumerate(pick):
+ src = shots.get(s["shot"] or "")
+ out.append(' <div class="t" style="--at:%.2fs">%s</div>'
+ % (0.2 + 0.08 * i, ('<img src="%s" alt="">' % _e(src) + _covers(s.get("covers"))) if src else ""))
+ out.append(' </div>\n <p class="range">steps %d to %d: %s</p>\n </div>'
+ % (sk[0]["n"], sk[-1]["n"], _e(", ".join(sorted({x["kind"] for x in sk})))))
+ elif sid == "fail":
+ f = rep["failure"]
+ s = steps.get(f.get("step") or -1)
+ beats = fail_beats(rep)
+ n = f.get("step")
+ out.append(top % (_e(head), ('<span><b>%d</b> <em>/ %d</em></span>' % (n, total)) if n else "",
+ _pips(rep, n)))
+ inner = _covers((s or {}).get("covers") if s else f.get("covers"))
+ if s and s["box"]:
+ b = s["box"]
+ inner += ('<div class="box bad" style="left:%.2f%%;top:%.2f%%;width:%.2f%%;height:%.2f%%;--at:0.4s"></div>'
+ % (b["x"], b["y"], b["w"], b["h"]))
+ shot = shots.get((s or {}).get("shot") or f.get("shot") or "")
+ out.append(_window(shot, (s or {}).get("url", ""), ar, left=5.5, top=14, max_w=41, max_h=80, inner=inner,
+ cls="failwin", zoom=_zoom((s or {}).get("box"), (s or {}).get("point"))))
+ out.append(' <div class="fside">')
+ where = " \u00b7 ".join(x for x in ("step %d" % n if n else "", "%s:%s" % (f["file"], f["line"]) if f.get("file") else "") if x)
+ out.append(' <p class="kind bad" style="--at:0.1s">Failed%s</p>' % (" \u00b7 " + _e(where) if where else ""))
+ out.append(' <p class="cap" style="--at:%.2fs">%s</p>' % (beats["caption"], _e(s["caption"] if s else f["headline"])))
+ if f.get("source"):
+ out.append(' <p class="src" style="--at:%.2fs"><span class="n">%d</span>%s</p>'
+ % (beats["source"], f["source"]["line"], _e(f["source"]["text"])))
+ if "vs" in beats:
+ exp, got = f.get("expected") or {"parts": [["\u2014", False]]}, f.get("received") or {"parts": [["\u2014", False]]}
+ out.append(' <div class="vs" style="--at:%.2fs"><div class="exp"><p class="k">Expected</p><p class="v">%s</p>'
+ '</div><div class="rec"><p class="k">Received</p><p class="v">%s</p></div></div>'
+ % (beats["vs"], _marks(exp["parts"]), _marks(got["parts"])))
+ err = " \u00b7 ".join(x for x in [f["headline"]] + f.get("details", [])[:1] if x)
+ out.append(' <p class="ferr" style="--at:%.2fs"><b>Error</b> %s</p>' % (beats["error"], _e(err)))
+ if rep["console"]:
+ items = "".join("<span>%s</span>" % _e(rv.shorten(c["text"], 90)) for c in rep["console"][:2])
+ more = len(rep["console"]) - 2
+ out.append(' <p class="cons" style="--at:%.2fs"><b>Console error%s</b>%s%s</p>'
+ % (beats["console"], "s" if len(rep["console"]) > 1 else "", items,
+ "<span>+ %d more</span>" % more if more > 0 else ""))
+ out.append(" </div>")
+ else:
+ out.append(' <div class="end">\n <p class="label" style="--i:0">%s</p>'
+ % ("Re-run" if p["rerun"] else "Open the trace"))
+ i = 1
+ if p["rerun"]:
+ out.append(' <div class="cta" data-st="fit" style="--i:1"><span class="ps">$ </span>%s</div>' % _e(p["rerun"]))
+ i += 1
+ if p.get("viewer"):
+ out.append(' <p class="viewer" style="--i:%d">%s%s</p>' % (
+ i, "Trace: " if p["rerun"] else "$ ", _e(p["viewer"])))
+ i += 1
+ out.append(' <p class="thanks" style="--i:%d">%s</p>\n </div>'
+ % (i, _e(" \u00b7 ".join(x for x in (title, rep["test"]["location"]) if x))))
+ out.append(" </div>\n </section>")
+ prev = sid
+ return ("<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>%s</title>\n"
+ "<script src=\"/_st/stage.js\"></script>\n<link rel=\"stylesheet\" href=\"/_st/themes/neutral.css\">\n"
+ "<script type=\"module\" src=\"/_st/components/index.js\"></script>\n<!-- Written by `showtime repro` from a "
+ "Playwright trace and the script.md you read: typed values, query strings, paths and --redact matches "
+ "are masked; the screenshots are the trace's own (typed fields covered). Edit freely. -->\n"
+ "<style>%s</style>\n</head>\n<body>\n<div class=\"stage\">\n <div class=\"world\" data-st-decor><div class=\"key\">"
+ "</div><div class=\"vig\"></div></div>\n%s\n</div>\n</body>\n</html>\n" % (_e("Repro: " + title), CSS, "\n".join(out)))
+
+
+def bed_for(p: Dict[str, Any], rep: Dict[str, Any], voice_tracks: Sequence[Dict[str, Any]] = (),
+ music: Optional[str] = None, fetch: bool = False, project: Optional[Path] = None) -> Dict[str, Any]:
+ """This film's bed (st.bed): chosen from the test, so a rerun sounds the same and another test does not."""
+ starts = [sc["start"] for sc in p["scenes"]]
+ names = ["intro"] + ["verse"] * max(0, len(starts) - 2) + ["outro"]
+ t = rep["test"]
+ return bed.choose("repro", "%s|%s" % (t.get("title") or "", t.get("file") or ""), float(p.get("duration") or 0),
+ ",".join("%g:%s" % (s, n) for s, n in zip(starts, names)), pin=music,
+ project=project, gain_db=-6 if voice_tracks else -3,
+ duck={"under": "voice", "depth_db": bed.DUCK_DEPTH_DB, "carve": 0.4} if voice_tracks else None, fetch=fetch)
+
+
+def build_mix(p: Dict[str, Any], rep: Dict[str, Any], voice_tracks: Sequence[Dict[str, Any]] = (),
+ choice: Optional[Dict[str, Any]] = None, cut_sounds: bool = False) -> Dict[str, Any]:
+ """A quiet bed (ducked under the voice), a click on each click, a soft error tone on the failure (sounds that
+ mark what happens on screen; a soft swoosh on each cut only with cut_sounds); the bed and the sounds differ
+ from test to test."""
+ steps = {s["n"]: s for s in rep["steps"]}
+ t = rep["test"]
+ key = "%s|%s" % (t.get("title") or "", t.get("file") or "")
+ choice = choice or bed_for(p, rep, voice_tracks)
+ tracks: List[Dict[str, Any]] = [choice["track"]] if choice["track"] else []
+ tone = choice.get("key") # a composed bed's key: tonal effects stay in it
+ cut_duck = {"duck": {"under": "voice", "depth_db": 6}} if voice_tracks else {}
+ for sc in p["scenes"][1:]:
+ if cut_sounds:
+ tracks.append({"kind": "sfx", "synth": bed.synth(key, "cut", int(sc["start"]), 0.25, tone),
+ "at": sc["start"], "align": "hit", "gain_db": bed.CUT_GAIN_DB, **cut_duck})
+ s = steps.get(sc.get("step") or -1)
+ if sc["kind"] == "step" and s and s["kind"] in ("click", "dblclick", "check", "uncheck") and s["point"]:
+ tracks.append({"kind": "sfx", "synth": bed.synth(key, "click", s["n"], 0.5, tone),
+ "at": round(sc["start"] + 0.75, 2), "align": "hit", "gain_db": -10})
+ if sc["id"] == "fail":
+ tracks.append({"kind": "sfx", "synth": bed.synth(key, "error", 9, 0.35, tone),
+ "at": round(sc["start"] + 0.3, 2), "align": "hit", "gain_db": -12})
+ tracks += list(voice_tracks)
+ return {"_comment": bed.comment(choice, any(t.get("kind") == "sfx" for t in tracks)),
+ "sample_rate": 48000, "tracks": tracks, "master": {"lufs": -14, "true_peak": -1}}
+
+
+SIZES = {"1080p": (1920, 1080), "720p": (1280, 720)}
+
+
+def keep_shots(trace: Path, rep: Dict[str, Any], dest: Path) -> int:
+ """Copy every screenshot the report points at out of the trace into dest (NN.<ext>) and point the report at
+ them (`shots/NN.<ext>`), so the film can be made after the raw trace is gone."""
+ names: List[str] = []
+ for s in rep["steps"]:
+ if s.get("shot") and s["shot"] not in names:
+ names.append(s["shot"])
+ f = rep["failure"]
+ if f and f.get("shot") and f["shot"] not in names:
+ names.append(f["shot"])
+ got: Dict[str, str] = {}
+ dest.mkdir(parents=True, exist_ok=True)
+ with zipfile.ZipFile(str(trace)) as z:
+ sizes = {i.filename: i.file_size for i in z.infolist()}
+ for member in names:
+ if member not in sizes or sizes[member] > MAX_SHOT:
+ continue
+ ext = os.path.splitext(member)[1].lower()
+ ext = ext if ext in (".jpeg", ".jpg", ".png", ".webp") else ".jpeg"
+ dst = "%02d%s" % (len(got) + 1, ext)
+ with z.open(member) as src, open(str(dest / dst), "wb") as out:
+ shutil.copyfileobj(src, out)
+ got[member] = "shots/" + dst
+ for s in rep["steps"]:
+ s["shot"] = got.get(s.get("shot") or "")
+ if f:
+ f["shot"] = got.get(f.get("shot") or "")
+ return len(got)
+
+
+def write_project(out: Path, rep: Dict[str, Any], p: Dict[str, Any], job: Path, *, size: str = "1080p",
+ voice_tracks: Sequence[Dict[str, Any]] = (), force: bool = False, music: Optional[str] = None,
+ fetch: bool = False, cut_sounds: bool = False) -> Dict[str, Any]:
+ """index.html, showtime.json, audio/mix.json, shots/ (the screenshots the film uses, from the job's shots/)
+ and repro.json (what steps.json holds: no path on the machine)."""
+ out = Path(out)
+ if out.exists() and any(x for x in out.iterdir() if x.name != "voice") and not force:
+ raise FileExistsError(str(out))
+ used: List[str] = []
+ steps = {s["n"]: s for s in rep["steps"]}
+ for sc in p["scenes"]:
+ for n in [sc.get("step")] + list(sc.get("skipped") or []):
+ s = steps.get(n or -1)
+ if s and s["shot"] and s["shot"] not in used:
+ used.append(s["shot"])
+ if rep["failure"] and rep["failure"].get("shot") and rep["failure"]["shot"] not in used:
+ used.append(rep["failure"]["shot"])
+ shots: Dict[str, str] = {}
+ (out / "shots").mkdir(parents=True, exist_ok=True)
+ for name in used:
+ src = Path(job) / name
+ if src.is_file():
+ shutil.copyfile(str(src), str(out / name))
+ shots[name] = name
+ w, h = SIZES.get(size, SIZES["1080p"])
+ fail = next((sc for sc in p["scenes"] if sc["id"] == "fail"), None)
+ poster_t = round(fail["start"] + fail["dur"] - 1.0, 2) if fail else 0
+ cfg = {"title": "Repro: %s" % rep["test"]["title"], "width": w, "height": h, "fps": 30, "duration": p["duration"],
+ "background": "#0e1013", "poster": poster_t, "audio": "audio/mix.json",
+ "subtitle": "A failing browser test, step by step.", "kicker": "Repro", "startTitle": False,
+ "render": {"crf": 22, "poster_bake": "off"},
+ "expect": {"duration": p["duration"], "audio": True, "must_show": ["FAILED" if rep["failure"] else "PASSED"]}}
+ choice = bed_for(p, rep, voice_tracks, music, fetch, out)
+ rv.write_files(out, page=build_page(rep, p, shots), cfg=cfg, mix=build_mix(p, rep, voice_tracks, choice, cut_sounds),
+ source_name="repro.json", source=steps_json(rep, p), force=True)
+ return {"project": str(out), "duration": p["duration"], "scenes": len(p["scenes"]), "shots": len(shots),
+ "poster_at": poster_t, "bed": choice}
+
+
+def steps_json(rep: Dict[str, Any], p: Dict[str, Any]) -> Dict[str, Any]:
+ """steps.json: the parsed timeline (redacted) and where each step is in the film."""
+ at = {}
+ for sc in p["scenes"]:
+ for n in [sc.get("step")] + list(sc.get("skipped") or []):
+ if n:
+ at[n] = {"scene": sc["id"], "at": sc["start"], "dur": sc["dur"]}
+ steps = []
+ for s in rep["steps"]:
+ d = {k: v for k, v in s.items() if k not in ("shot",)}
+ d["film"] = at.get(s["n"])
+ steps.append(d)
+ fail = dict(rep["failure"]) if rep["failure"] else None
+ if fail:
+ fail.pop("shot", None)
+ return {"generator": "showtime repro", "test": rep["test"], "status": rep["status"], "browser": rep["browser"],
+ "playwright": rep["playwright"], "language": rep["language"], "duration_s": rep["duration_s"],
+ "viewport": rep["viewport"], "steps": steps, "failure": fail, "console": rep["console"],
+ "console_more": rep.get("console_more", 0), "rerun": p.get("rerun") or "", "privacy": rep["privacy"],
+ "film": {"duration": p["duration"], "scenes": [{k: sc[k] for k in ("id", "start", "dur")} for sc in p["scenes"]],
+ "skipped_steps": p["skipped_steps"]}}
+
+
+def markdown(rep: Dict[str, Any], p: Dict[str, Any], video_name: str = "repro.mp4", music_credit: str = "") -> str:
+ """repro.md: the steps, the failure and how to re-run, to paste into an issue or a PR."""
+ f = rep["failure"]
+ t = rep["test"]
+ lines = ["### Repro: %s (%s)" % (t["title"], "FAILED" if f else "PASSED"), ""]
+ meta = " \u00b7 ".join(x for x in ("`%s`" % t["location"] if t["location"] else "", rep["browser"],
+ "Playwright %s" % rep["playwright"] if rep["playwright"] else "") if x)
+ if meta:
+ lines += [meta, ""]
+ lines += ["<!-- drag %s onto this line: GitHub uploads it and puts the video player here -->" % video_name, "",
+ "**Steps**", ""]
+ for s in rep["steps"]:
+ where = " (`%s:%s`)" % (s["file"], s["line"]) if s["file"] and s["line"] else ""
+ text = s["caption"].replace("`", "'")
+ lines.append("%d. %s%s%s%s" % (s["n"], "**FAILED:** " if s["status"] == "failed" else "", text, where,
+ " (an error the test caught)" if s.get("caught") else ""))
+ if f:
+ lines += ["", "**Failure**", "", "```"]
+ lines.append(f["headline"])
+ if f.get("expected"):
+ lines.append("Expected: %s" % f["expected"]["text"])
+ if f.get("received"):
+ lines.append("Received: %s" % f["received"]["text"])
+ for d in f.get("details") or []:
+ lines.append(d)
+ if f.get("call_log"):
+ lines.append("Last log: %s" % f["call_log"])
+ lines.append("```")
+ if f.get("source"):
+ lines += ["", "At `%s:%s`:" % (f["file"], f["source"]["line"]), "", "```", f["source"]["text"], "```"]
+ if rep["console"]:
+ lines += ["", "**Console errors**", ""] + ["- %s" % c["text"].replace("\n", " ") for c in rep["console"][:10]]
+ run = [x for x in (p.get("rerun"), p.get("viewer")) if x]
+ if run:
+ lines += ["", "**Re-run**", "", "```"] + run + ["```"]
+ if music_credit:
+ lines += ["", "Music: %s" % music_credit.strip()]
+ lines += ["", "<sub>Made with `showtime repro`: typed values are never shown; paths, query strings, secret-looking "
+ "text, e-mail addresses and --redact matches are masked. Screenshots are shown as they were captured "
+ "(typed fields covered); --redact does not touch pixels.</sub>", ""]
+ return "\n".join(lines)
+
+
+# ---------------------------------------------------------------------------
+# the review gate: script.md
+# ---------------------------------------------------------------------------
+
+SCRIPT_HEAD = """# showtime repro: the film's script
+
+Every line the film will show or speak, from the trace, after the filters. Edit the text after a label, or
+delete a line to leave it out, then run the same command again with --yes (or: showtime repro --yes <job>).
+Every line goes through the filters again then. Filters can miss things: read every line before you render.
+Screenshots are shown as captured (fields a value was typed into are covered); --redact does not touch
+pixels. Watch the film before you post it.
+"""
+
+_SCRIPT_LINE = re.compile(r"^(show|say)\s+([a-z][\w.-]*)\s*:\s?(.*)$")
+
+
+def _where(file: str, line: Any) -> str:
+ return "%s:%s" % (file, line) if file and line else (file or "")
+
+
+def script_fields(rep: Dict[str, Any], rerun: str, viewer: str) -> List[Tuple[str, str, str, str]]:
+ """[(section, show|say, key, text)]: every text the film, the captions, steps.json and repro.md use."""
+ t, f = rep["test"], rep["failure"]
+ out = [("title", "show", "test.title", t["title"]), ("title", "show", "test.location", t["location"]),
+ ("title", "say", "title", title_line(rep))]
+ for s in rep["steps"]:
+ sec = "step %d" % s["n"]
+ out += [(sec, "show", "step%d.caption" % s["n"], s["caption"]),
+ (sec, "show", "step%d.locator" % s["n"], s["locator"]),
+ (sec, "show", "step%d.url" % s["n"], s["url"]),
+ (sec, "show", "step%d.where" % s["n"], _where(s["file"], s["line"]))]
+ if s.get("expected") is not None:
+ out.append((sec, "show", "step%d.expected" % s["n"], s["expected"]))
+ if s.get("value") is not None:
+ out.append((sec, "show", "step%d.value" % s["n"], s["value"]))
+ if s.get("matcher"):
+ out.append((sec, "show", "step%d.matcher" % s["n"], s["matcher"]))
+ out.append((sec, "say", "step%d" % s["n"], step_line(s)))
+ out.append(("passing steps summed up (when the film is long)", "say", "skip", SKIP_LINE))
+ if f:
+ out += [("failure", "show", "fail.headline", f["headline"])]
+ for k in ("expected", "received"):
+ if f.get(k):
+ out.append(("failure", "show", "fail.%s" % k, f[k]["text"]))
+ out += [("failure", "show", "fail.detail%d" % (i + 1), d) for i, d in enumerate(f.get("details") or [])]
+ if f.get("call_log"):
+ out.append(("failure", "show", "fail.call_log", f["call_log"]))
+ if f.get("source"):
+ out.append(("failure", "show", "fail.source", f["source"]["text"]))
+ out.append(("failure", "show", "fail.where", _where(f.get("file") or "", f.get("line"))))
+ out += [("failure", "show", "console%d" % (i + 1), c["text"]) for i, c in enumerate(rep["console"])]
+ if f:
+ out.append(("failure", "say", "fail", fail_line(rep)))
+ out += [("end", "show", "end.rerun", rerun), ("end", "show", "end.viewer", viewer),
+ ("end", "say", "end", end_line(rerun))]
+ return [x for x in out if x[3] or x[1] == "say"]
+
+
+def write_script(rep: Dict[str, Any], rerun: str, viewer: str) -> str:
+ """script.md: the keyed lines by section, then what was masked (comments)."""
+ out = [SCRIPT_HEAD]
+ sec = None
+ for section, kind, key, text in script_fields(rep, rerun, viewer):
+ if section != sec:
+ sec = section
+ out.append("\n## %s\n" % section)
+ if section == "title":
+ out.append("# also shown: FAILED, %s" % title_meta(rep))
+ out.append("%s %s: %s" % (kind, key, " ".join(str(text).split())))
+ masked = [s for s in rep["steps"] if s.get("masked") or s.get("covers") and s["kind"] in TYPED_KINDS]
+ out.append("\n## masked\n")
+ if not masked and not rep["privacy"].get("redact_patterns"):
+ out.append("# nothing was typed into a field")
+ for s in masked:
+ on = [o["n"] for o in rep["steps"] if any(c.get("step") == s["n"] for c in o.get("covers") or [])]
+ if s.get("field_known") is False:
+ what = " (typed into a field showtime cannot name, so it counts as secret)"
+ else:
+ what = " (a secret field)" if s.get("secret_field") else ""
+ out.append("# step %d: %s%s; the value is not shown or spoken; %s" % (
+ s["n"], s["caption"], what, "its field is covered on screen in steps %s" % _ranges(on) if on else
+ "it is NOT covered on screen (the field is not known): check the screenshots"))
+ if masked:
+ out.append("# a cover follows its field through the trace's page snapshots (shown while the field holds text, "
+ "moved with the scroll); a fixed or animated field can still slip out from under it")
+ if rep["privacy"].get("redact_patterns"):
+ out.append("# %d --redact pattern%s applied" % (rep["privacy"]["redact_patterns"],
+ "" if rep["privacy"]["redact_patterns"] == 1 else "s"))
+ out.append("# screenshots are shown as captured; --redact does not touch pixels")
+ return "\n".join(out) + "\n"
+
+
+def _ranges(ns: Sequence[int]) -> str:
+ """[2, 3, 4, 7] -> "2-4, 7"."""
+ out: List[str] = []
+ for n in sorted(set(ns)):
+ if out and int(out[-1].split("-")[-1]) == n - 1:
+ out[-1] = "%s-%d" % (out[-1].split("-")[0], n)
+ else:
+ out.append(str(n))
+ return ", ".join(out)
+
+
+def read_script(text: str) -> Dict[str, Tuple[str, str]]:
+ """{key: (show|say, text)} from a script.md, edits included; unknown lines are ignored."""
+ out: Dict[str, Tuple[str, str]] = {}
+ for raw in (text or "").splitlines():
+ m = _SCRIPT_LINE.match(raw.strip())
+ if m:
+ out[m.group(2)] = (m.group(1), " ".join(m.group(3).split()))
+ return out
+
+
+def apply_script(rep: Dict[str, Any], rerun: str, viewer: str, lines: Dict[str, Tuple[str, str]],
+ redact: "Redactor") -> Tuple[Dict[str, Any], str, str]:
+ """The report as script.md leaves it: each listed text replaced by its line (a deleted line: empty), every
+ text derived from one rebuilt from it (a step's target from its locator, the test's file and line from its
+ location), and every text, edited or not, through the hard filter again."""
+ rep = json.loads(json.dumps(rep))
+ got = lambda key: redact(lines[key][1]) if key in lines else "" # noqa: E731
+ t, f = rep["test"], rep["failure"]
+ t["title"], t["location"] = got("test.title"), got("test.location")
+ t["file"], t["line"] = _split_where(t["location"])
+ for k in ("browser", "playwright", "language"):
+ rep[k] = redact(rep.get(k))
+ for s in rep["steps"]:
+ n = s["n"]
+ was = redact(s["locator"])
+ s["caption"], s["locator"], s["url"] = got("step%d.caption" % n), got("step%d.locator" % n), got("step%d.url" % n)
+ s["target"] = redact(s.get("target")) if s["locator"] == was else redact(human_locator(s["locator"]))
+ wf, wl = _split_where(got("step%d.where" % n))
+ s["file"], s["line"] = wf, wl
+ if s.get("expected") is not None:
+ s["expected"] = got("step%d.expected" % n)
+ s["value"] = (got("step%d.value" % n) or None) if s.get("value") is not None else None
+ s["matcher"] = got("step%d.matcher" % n) if s.get("matcher") else ""
+ if f:
+ f["headline"] = got("fail.headline")
+ for k in ("expected", "received"):
+ if f.get(k):
+ new = got("fail.%s" % k)
+ if new != f[k]["text"] or redact(f[k]["text"]) != f[k]["text"] or \
+ "".join(str(x[0]) for x in f[k].get("parts") or []) != new:
+ f[k] = {"text": new, "parts": [[new, False]], "kind": f[k].get("kind", "")}
+ f["details"] = [x for x in (got("fail.detail%d" % (i + 1)) for i in range(len(f.get("details") or []))) if x]
+ f["call_log"] = got("fail.call_log")
+ if f.get("source"):
+ f["source"]["text"] = got("fail.source")
+ if not f["source"]["text"]:
+ f["source"] = None
+ f["file"], f["line"] = _split_where(got("fail.where"))
+ rep["console"] = [dict(c, text=got("console%d" % (i + 1))) for i, c in enumerate(rep["console"])]
+ rep["console"] = [c for c in rep["console"] if c["text"]]
+ rep["say"] = {key: redact(text) for key, (kind, text) in lines.items() if kind == "say"}
+ for sid in ["title", "skip", "end"] + ["step%d" % s["n"] for s in rep["steps"]] + (["fail"] if f else []):
+ rep["say"].setdefault(sid, "") # a deleted spoken line leaves its scene silent
+ return rep, got("end.rerun"), got("end.viewer")
+
+
+def _split_where(text: str) -> Tuple[str, Optional[int]]:
+ m = re.match(r"^(.*?):(\d+)$", text or "")
+ return (m.group(1), int(m.group(2))) if m else (text or "", None)
diff --git a/skills/showtime/references/html-export.md b/skills/showtime/references/html-export.md
index f436458..c968888 100644
--- a/skills/showtime/references/html-export.md
+++ b/skills/showtime/references/html-export.md
@@ -12,6 +12,7 @@ showtime export html <project> --folder -o site/ # index.html + assets/ for we
showtime export html <project> --target artifact -o launch.html # to publish as an HTML artifact
showtime export html <job> # a job: its project/ folder, written into the job folder
showtime export html <job> --folder out # a job as a folder: ./out/index.html + assets/
+showtime export html <diagram> --interactive # a living diagram's live figure: -> <slug>-figure.html
```
## Essentials
@@ -43,6 +44,8 @@ showtime export html <job> --folder out # a job as a folder: ./out/in
(Shift + drag on the scrubber picks one, `c` copies its link) (§ What you get)
- Videos that ask: showtime.json `"questions"` (`at` = seconds or a narration line id) stop the player at each
one; it goes on from the end of the MP4's pause and think beat; `socratic.json` is written beside it (§ Questions)
+- A living diagram also exports as a live figure people poke: `--interactive` (`--target artifact` for an artifact)
+ writes `<slug>-figure.html`, no player and no timeline (§ Live figure)
- A video report (charts, numbers) is a data story first: build and pace it with `workflows/data-story.md` (a
change about every 2 s, holds as long as reading needs, callouts that name their year), then export it
- Use the MP4 for footage-led videos and slow-to-draw pages: playing is drawing. Sound always needs a click;
@@ -51,14 +54,15 @@ showtime export html <job> --folder out # a job as a folder: ./out/in
<!-- section lines: kept current by scripts/check_release.py -->
| Section | Lines |
|---|---|
-| What you get | 63-129 |
-| MP4 or HTML? | 131-141 |
-| Audio modes (--audio): How the live score streams (and why seeking is exact) | 143-174 |
-| Size budget | 176-199 |
-| Sharing and hosting | 201-250 |
-| Questions | 252-295 |
-| Options | 297-327 |
-| Limitations | 329-363 |
+| What you get | 67-133 |
+| MP4 or HTML? | 135-145 |
+| Audio modes (--audio): How the live score streams (and why seeking is exact) | 147-178 |
+| Size budget | 180-203 |
+| Sharing and hosting | 205-254 |
+| Questions | 256-299 |
+| Options | 301-332 |
+| Live figure | 334-346 |
+| Limitations | 348-382 |
## What you get
@@ -300,6 +304,7 @@ controls; on a phone held upright it sits under the picture, so the paused frame
|---|---|---|
| `-o FILE` / `--job JOB` | new job folder | never overwrites (`-2`, `-3` ...); `-o` an existing folder (or `dir/`) writes `<dir>/<title>.html`; `--job J -o embed.html` writes that name inside the job folder |
| `--folder` | off | `-o` is then a folder |
+| `--interactive` | off | a living diagram's live figure (§ Live figure): one file, `<slug>-figure.html` |
| `--controls full\|minimal\|none` | full | minimal: play, scrubber, mute, fullscreen |
| `--autoplay-muted` | off | starts muted as soon as it loads, with a "Tap for sound" button |
| `--loop` | off | the viewer can toggle it |
@@ -326,6 +331,20 @@ with steps (a tutorial, a demo) one chapter per step.
A tutorial series (`showtime new series`) exports all at once: `showtime series export <series> -o
site/` writes every episode and the opener as single files plus an `index.html` listing them.
+## Live figure
+
+`showtime export html <project> --interactive` packs a living diagram's `figure.html` (the template's when the
+project has none) into one file named `<slug>-figure.html`: the scene, `/_st/diagram.js`, `figure-film.js`,
+`figure.js` and `figure.css` inlined, fonts as data: URLs (faces for scripts no word uses dropped), no player. The
+board is live from the first frame: the viewer hovers parts, picks steps and turns knobs; an idle tour plays until
+touched; `#step=<id>&<knob>=<value>&part=<id>` opens a state. The page's `<title>`, `og:title` and `og:description`
+are the scene's (`interactive.title` and `sub`, else the film page's title block) while the project is still named
+after the template (read as text from scene.js: the export runs none of the project's code; `--title` sets it). Like
+every export it makes no network request, and it carries every word and number of the scene: publishing it shares
+all of that. A comment at its top names the packed fonts and their licence (SIL Open Font License) and the project's
+credits. `--target artifact`, `-o`, `--job`, `--max-mb` and `--minify` apply;
+`--folder` does not. What a scene declares and what `showtime check` walks: `workflows/diagram.md` § Interactive.
+
## Limitations
- **Sound needs a click** in every browser; `--autoplay-muted` starts the picture muted instead (a
diff --git a/skills/showtime/references/index.md b/skills/showtime/references/index.md
index f0fddd3..f47e0e5 100644
--- a/skills/showtime/references/index.md
+++ b/skills/showtime/references/index.md
@@ -17,9 +17,12 @@ for that step) with a table of its sections; read only what the current step nee
| `references/workflows/tutorial.md` | a tutorial, walkthrough or product demo (recorded app or drawn) |
| `references/workflows/social-short.md` | a reel, TikTok, Short, vertical cut-down or audiogram |
| `references/workflows/data-story.md` | numbers or charts animated into a story |
+| `references/workflows/diagram.md` | how a system works as a living diagram: parts, flows, states and labels that build over time (light, dark or white); the same scene as a live figure people poke (`export html --interactive`) |
| `references/workflows/footage-edit.md` | recorded footage cut, captioned, reframed, cleaned or graded; a long recording's best moments as short clips |
| `references/workflows/music-video.md` | picture cut or animated to a song |
| `references/workflows/changelog-video.md` | a pull request, release or changelog turned into a video (unattended, in CI: `showtime release-video`; a PR video for its description: `showtime pr-video`) |
+| `references/workflows/recap.md` | a coding agent's session turned into a short film of what it did (`showtime recap`: allow-listed facts only, script.md read first) |
+| `references/workflows/repro.md` | a failing browser test (a Playwright trace, or the test command) as a short narrated video for a bug report or PR: `showtime repro` |
| `references/workflows/trailer.md` | a teaser or trailer |
| `references/workflows/slideshow.md` | photos or screenshots set to music |
| `references/workflows/voiceover-only.md` | narration added to an existing video |
@@ -66,7 +69,7 @@ for that step) with a table of its sections; read only what the current step nee
| `references/transitions.md` | choosing scene handoffs (CSS and WebGL) |
| `references/film-api.md` | drawing a canvas film or tutorial with `Film` |
| `references/series.md` | a tutorial series: several episodes for one product sharing one kit (`showtime series`) |
-| `references/html-export.md` | sharing a project as a single-file interactive HTML video (`showtime export html`); a video that stops and asks the viewer (showtime.json `questions`); links to a moment or a looping part (`#t=10-20`) |
+| `references/html-export.md` | sharing a project as a single-file interactive HTML video (`showtime export html`); a video that stops and asks the viewer (showtime.json `questions`); links to a moment or a looping part (`#t=10-20`); a living diagram's live figure (`--interactive`) |
| `references/manim.md` | equations, proofs, graphs, grid transforms: math and diagram animation with Manim |
| `references/synth-score.md` | writing music or sound design in code with `Synth` |
| `references/debugging-renders.md` | a render fails, flickers, shows black or frozen frames, or differs from the preview |
diff --git a/skills/showtime/references/workflows/diagram.md b/skills/showtime/references/workflows/diagram.md
new file mode 100644
index 0000000..7273509
--- /dev/null
+++ b/skills/showtime/references/workflows/diagram.md
@@ -0,0 +1,228 @@
+# Workflow: living diagram (a system explained over time)
+
+Read this when the user wants how something works shown as a figure that builds and moves: a machine, a
+process, a pipeline, an architecture, a market, an organ, any system of parts and flows ("show how a heat pump
+works", "explain what happens when you press Enter", "animate this mechanism"). The build is the `diagram`
+template: one isometric scene spec drawn by `/_st/diagram.js` as a pure function of time, in a light (paper)
+or dark (night schematic) theme. For numbers that change use `data-story.md`; for math use `manim.md`.
+
+## Essentials
+
+- Defaults: 15-25 s, 16:9 at 1920x1080, light theme (`--theme dark` for the night schematic, `--theme white` for
+ white with colour only where it means something), a voice
+ that names each part as it matters, a quiet bed ducked under it; every invented number marked
+ "Illustrative sample" on screen (§ Defaults)
+- One line to a spec: list the parts, how they connect, what flows and in which order things happen;
+ parts arrive in the order that explains them (§ Steps, § Scene spec)
+- `showtime new diagram <job>/project --duration <s> [--theme light|dark] [--example enter|market]`; edit `scene.js` (CUE beat times,
+ `window.SCENE`), the page words in `index.html` or the scene's `page` block (§ Steps)
+- Pieces: `part:` from the library (machine parts, `node` icons, `stack`, `store`, `queue`), pipes and links
+ joined by port name, flows, packets (`tokens`), states and pulses, labels, tags, camera, focus (§ Scene spec)
+- Narrated: write `narration.md`, `showtime voice script ... --fit <s> --estimate`, then without it;
+ `showtime voice cues ... --offset <voice start>`; load `voice/cues.js` before `scene.js` and land beats on
+ words (§ Steps)
+- `showtime check`: 0 errors and every WARN read; a `diagram:` warning names a label that collides (move
+ the part, give the label an `elbow`, or shorten it) (§ Labels and layout)
+- Poster: a separate still at the "all built, camera at rest" time (`"poster"`), never baked into frame 0:
+ keep `"render": {"poster_bake": "off"}` (§ Pitfalls)
+- Render, `showtime qa <job>`, `showtime review-pack <job>` and the critic round (§ Steps)
+- A figure people poke: `showtime export html <project> --interactive [--target artifact]` writes
+ `<slug>-figure.html`, one offline file: the board is live from the first frame (hover a part, pick a step, turn a
+ knob). The scene says what is interactive in `interactive` (steps, knobs, readouts, a tour); `--example
+ econ-lab` and `--example enter` show both kinds (§ Interactive)
+
+<!-- section lines: kept current by scripts/check_release.py -->
+| Section | Lines |
+|---|---|
+| Inputs | 47-51 |
+| Defaults | 53-59 |
+| Steps | 61-88 |
+| Scene spec | 90-132 |
+| Labels and layout | 134-151 |
+| Themes | 153-158 |
+| Interactive | 160-204 |
+| Pitfalls | 206-223 |
+| Read next | 225-228 |
+
+## Inputs
+
+- The subject and its source: docs, a paper, a datasheet, the user's own words. Every on-screen claim traces to it.
+- What the viewer must understand at the end, in one sentence (the dek line).
+- Helpful: the theme (light or dark), length, whether there is a voice, a brand kit.
+
+## Defaults
+
+15-25 s, 16:9 at 1920x1080, 30 fps, the light theme (paper, near-white solids, one hairline weight, two
+accents); the dark theme when the user asks for dark or night. A voice (`af_heart` or `am_michael`) naming
+each part as it lights up, 2.5-3 words per second; a quiet `minimal-pulse` or `underscore` bed ducked under
+it. Labels name a part and say what it does in under 40 characters; numbers are sourced or marked
+"Illustrative sample". State the theme and the voice as assumptions.
+
+## Steps
+
+1. **Job.** `showtime job init <topic>-diagram --request "..."`; note `<job>`.
+2. **Understand the system.** From the source, write down the parts, the connections, what flows between
+ them and the order of events. Pick 4-8 parts; more crowds a 1920x1080 frame. Write the one sentence the
+ viewer keeps; it becomes the dek.
+3. **Project.** `showtime new diagram <job>/project --duration <s>` (`--theme dark` for the night look). It
+ starts with a working heat-pump scene; `--example market` (a matching market of nodes and envelopes) or
+ `--example enter` (a coding agent's loop across your machine and the cloud) starts from another scene at
+ that scene's own length, so `--duration` and a later `showtime retime` scale from the right base. Each
+ example carries its own title block in `page`. Copying a file from `examples/` over `scene.js` by hand
+ keeps the template's length: set `"duration"` in `showtime.json` to the copy's `CUE.duration` first.
+4. **Spec.** Edit `scene.js` (§ Scene spec): the CUE table first (one beat time per line, so `showtime retime`
+ moves them), then the items, flows, tokens, states, labels, tags, camera.
+5. **Voice (narrated films).** One `## <id>` line per beat in `narration.md`;
+ `showtime voice script <job>/project/narration.md -o <job>/project/voice --fit <s> --estimate`, cut words
+ until it fits, then the same command without `--estimate`. Then
+ `showtime voice cues <job>/project/voice/timeline.json -o <job>/project/voice/cues.js --offset 0.4`,
+ add `<script src="voice/cues.js"></script>` before `scene.js` in `index.html`, and set beats from
+ `VO.words.<line>[i][1]` (see `templates/diagram/examples/enter.js`). Put the voice in `audio/mix.json` at `"start": 0.4` with
+ the bed ducked under it, and `"audio": "audio/mix.json"` in `showtime.json`.
+6. **First look.** `showtime check <job>/project` (0 errors, read every WARN), then
+ `showtime snap <job>/project --at <t>` at each beat and `showtime look <job>/project`. Fix what you see:
+ crowded tags, a leader across the figure, a part hidden behind another.
+ *Done when:* check reports 0 errors and no `diagram:` warning.
+7. **Render and verify.** `"poster"` at the all-built moment, `"render": {"poster_bake": "off"}`;
+ `showtime render <job>/project --job <job>`, `showtime qa <job>` (quote LUFS and true peak),
+ `showtime review-pack <job>` and the critic round (`references/review.md`).
+
+## Scene spec
+
+`window.SCENE` in `scene.js`. World units are isometric: x runs to the lower right, y to the lower left,
+z up; times are seconds; `world: {scale, origin}` maps them to the 1920x1080 page.
+
+- **items**: everything in the world.
+ - Parts: `{id, part, at, size, build, lift, ports}`. Machine parts `plate` (the ground; any z for a raised
+ platform, `faces: 'coolFaces'`, `glass: true` for another material), `floor`, `wall` (cut, hatched), `box`, `slab`, `unit`, `compressor`,
+ `tank`, `valve`, `cassette`. System pieces: `node` (`icon`: person, school, building, house, bank, firm,
+ server, terminal, hub, core, gate, files, lamp, tool; `seats: n`, `seatSide`, `scale`, `glass: true` for a glass
+ shell around a lit core), `stack` (cells that grow on
+ `count: [[t, n], ...]`), `store` (a tray whose `fill` is keyed in t), `queue` (slots).
+ - `build` is when a part arrives (it drops `lift` units and fades in over 0.6 s); the build order is the
+ explanation order.
+ - Ports: every part has named attach points (`top`, `bottom`, `x+`, `x-`, `y+`, `y-`, a node's `center`,
+ `seat1`...); add your own with `ports: {name: {at: [dx, dy, dz], face}}` relative to `at`.
+ - Pipes `{kind: 'pipe', from: 'part.port', to: 'part.port', route: 'xy', tone, build: [t, dur]}` route
+ along the axes in `route` order with rounded bends and collars; links `{kind: 'link', ...}` are thin
+ straight lines (`dash`, `w`, `arc`); floor links sit under the parts.
+ - `{kind: 'air', ...}` wavy streams; `{kind: 'floortext', at, text, at0, dir}` mono caps in the floor plane.
+ - Shapes for anything else: `shapes: [{kind: 'box' | 'cyl' | 'ball' | 'face' | 'line' | 'fins' | 'fan' |
+ 'hatch' | 'ghost' | 'bloom' | 'ring' ...}]` (`glass: true` on a box).
+ - Depth: parts, pipes and links are sorted once at mount from their boxes plus the port rule. Settle a wrong
+ order with `behind: [ids]` / `front: [ids]` on an item, or `order` (a number, lower first among equals);
+ `depth: 'list'` on the scene draws in list order. A cycle is reported. `explode` and `lift` offsets do not
+ re-sort, so keep exploded parts from passing each other.
+- **flows**: `[{at, speed, spacing, path: [{pipe}, {gap: px}, ...]}]` dashes (light) or glowing beads (dark)
+ over pipes and hidden gaps; they take the pipe's tone.
+- **tokens**: discrete packets, `{id, tone, r, shape: 'chip' | 'envelope', size: [w, d, h], moves: [{at, dur,
+ along: 'link', reverse, off: [dx, dy, dz]} | {at, dur, to: 'part.port' | [x, y, z], from, hop, off}], tones:
+ [{at, tone}], until}` (a puck without `shape`); the last move that started wins, so any t is closed form.
+- **states**: `{target, at, tone}` changes a part's or pipe's tone; `{..., pulse: true, dur}` lights it up and
+ lets it fall back. Tones: `cold`, `hot`, `warm`, `ok`, `mute`.
+- **labels**: `{for: part, at, title, sub}` placed by the layout pass; `elbow: [dx, dy]` and `side` override;
+ `until` (it leaves) and `back` (it returns, e.g. for the end).
+- **tags**: pills on a part, pipe (`f`), point or packet: `{for | pipe | anchor | token, text, at, until, off,
+ align, size}` or `keys: [[t, text, tone], ...]` for a value that changes (each value is its own persistent
+ text). Typed: `type: [t0, t1]` reveals it left to right with a caret, `typeFrom: n` characters already there,
+ `caretUntil`; `press: t` (with `pressTone`) presses it like a key.
+- **focus**: `[{part, with: [...], at, until}]` veils the rest; **camera**: keys `{at, dur, zoom, focus: part |
+ [x, y, z] | [sx, sy], to}` run in order; **explode**: `{at, dur, back, offsets: {id: [dx, dy, dz]}}`.
+- **steps** (`.ld-steps` beat lines), **reveal** (`{sel, at}` page elements), **page** (kicker, title with
+ `*accent*`, dek, footers).
+
+## Labels and layout
+
+Each label tries candidate elbows around its anchor and scores them at every camera pose it is shown in:
+parts it would cover (veiled parts count less), pipes, floor text, tags, the page's title block and footers,
+other labels, leaders crossing parts or other leaders, the safe zone, and a preference for pointing outward.
+A label still colliding at the pose where it lands is reported as `[showtime] diagram: label "X" collides:
+...`, which `showtime check` lists as a warning: move the part, give the label an `elbow`, or shorten its text.
+A leader drawn across a part is reported the same way, as `leader across part X`, with two exemptions: the
+label's own part, and a part whose outline already holds the anchor (a unit hung on a wall), both count only past
+the leader's halfway point, because any leader leaving them crosses their first stretch.
+At later camera poses it is placed to avoid collisions but not reported: there it fades out instead (below).
+Any label, tag or floor text that never shows fully inside the text safe zone (cut by the frame, or in the
+bottom 8 % under phone controls) is reported too: `"X" never shows fully inside the text safe zone`.
+`Diagram.report` in the page holds the depth order and each label's placement.
+
+Text stays check-friendly by construction: labels, tags, floor text and steps are persistent nodes, text fades
+take at most 0.2 s, floor text is raised to 25 px on screen, and any text fades out before the camera carries
+it off the frame.
+
+## Themes
+
+`<html data-theme="light|dark">` (set by `--theme`) picks the tokens in `Diagram.themes` and the page styles
+in `/_st/diagram.css`. Light: warm paper, near-white solids, ink hairlines, dashed flows, solid pills,
+Instrument Serif title. Dark: night ground, steel line work, glowing beads, outlined pills, Space Grotesk.
+The same spec renders in both; check and render each theme you ship.
+
+## Interactive
+
+The same scene is also a live figure: `figure.html` in the project (`<html data-st-live>`, preview it with
+`showtime preview <project> --page figure.html`) and `showtime export html <project> --interactive` for one offline
+file, `<slug>-figure.html` (`--target artifact` for an HTML artifact, `-o` to name it). No play button and no
+timeline: the board is built and moving from the first frame; the viewer hovers or tabs to a part (the focus veil
+lights it and its own pipes and links; a card says what it is and its value), picks a step (an experiment that runs
+on the board), turns a knob (the step runs again: levels, stacks and tags answer at once). Untouched, a tour of the
+same live actions plays; any input stops it, and it comes back after 20 s. Keys (arrows, 1-9, R, Esc, L), deep links
+(`#step=cost&rule=3&part=infl`), reduced motion (still; input works), a pause when hidden or off screen, and a phone
+layout (the words leave the drawing for the panel) come with it. The file makes no network request (a
+Content-Security-Policy blocks it); it embeds the runtime, the scene and every word and number in it, so sharing or
+publishing the file shares all of that.
+
+`SCENE.interactive` says what is live; everything else comes from the scene:
+
+- `title`, `sub`, `source` (a line under the readouts), `parts: [{id, name, sub}]` (the hover cards and the parts
+ list, in tab order; default: the labelled parts), `crop: {desk, phone}` (the stage area shown), `camera` (the live
+ page's own framing), `start` (the live clock starts at this film time: a film-first scene starts after its build).
+- `steps: [{id, kicker, text, knob, narr, run(fx, again)}]` and `reset(fx)` (the resting board, before every step).
+ `text` and `narr` may be functions of the knobs' values. `run` writes through `fx`, at the step's moment plus each
+ call's `{delay}`: `level(store, 0..1)`, `count(stack, n)`, `say(tag, text, tone)` and `hide(tag)` (a tag by its
+ `id`), `pulse(part, tone)`, `tone(part, tone | null)`, `show(part, on)`, `send(token, moves, {stay})` (moves as in
+ `tokens`, times relative to the call), `park(token)`, `focus(part)`, `every(ms, fn, name)`. `again` is true when
+ only a knob moved: retarget without a new shock. Give each call for one target in time order.
+- `knobs: {name: {label, hint, options: [[value, words]] | min, max, step, format(v), default}}`; a step names its
+ knob. `readouts(state, stepId) -> {rows: [{part, k, v, u, tone}], note}`: the numbers under the figure (the hovered
+ part's row is marked; `tone` colours it). Every number shown comes from the scene's data, never typed into words.
+- `keys: {a: {label, step, when(state), run(fx, state, stepId)}}` for answers the scene asks for (the Enter example:
+ Allow (A), Deny (D)); with a `label` it is also a button on that step while `when` holds (phones have no keys), and
+ `agree(state, stepId, {board, step, readouts}) -> [contradictions]`: what the board's tags, the step's words and the
+ readouts must agree on (the walk reports each one). Keep a knob for a setting and the state for an answer.
+- `tour: [[action, ms]]`: `{step}`, `{knob: [name, value]}`, `{hover: part | null}` or `fn(fx, state)`.
+- `film: 'tour'` makes `index.html` film the tour on the film's clock (a live-first scene, like econ-lab): set
+ `CUE.duration` to the tour's length. Without it the film is the scene's own timeline (like enter).
+
+The engine underneath is `Diagram.live(spec, {live: {now}})`: `set`, `fire`, `focus`, `tone`, `show`, `hit` write
+keys at a moment, so any time is still drawn as a pure function of the clock. `--theme white` is the live figure's
+look; `--theme` sets both pages. `showtime check` walks the live figure too, at rest: every step x each knob value
+(every option; every value of a range of up to 25, else 9 across it) x each hovered part, and each of the scene's
+keys pressed from each step and value. It reports text cut by the figure's frame (`figure_text_cut`), texts that
+overlap (`figure_text_overlap`, naming the state), a readout showing NaN or Infinity, a link that, followed, opens
+another state or two steps sharing an id (`figure_link`), what `agree` says (`figure_story`), a step that throws,
+sideways scroll or text under 12 px on a phone. Not walked: the moments while a step plays (a tag that shows for 2 s
+on its way), the tour's own function actions.
+
+## Pitfalls
+
+- A poster baked into frame 0 flashes the finished diagram before the build: keep `poster_bake` off.
+- Anything on the floor layer (plates, floors, floor links, rings, ghosts) fades out under a footer line while that
+ footer is on screen (an SVG mask on the floor layer); a part, packet or tag the camera carries under a footer draws
+ behind its text. Keep camera moves from parking parts under the footers. The holes are measured once, when the
+ diagram mounts: set the footer text in `page`, not from a script later.
+- Times typed into the spec instead of CUE: `showtime retime` cannot move them.
+- Tags placed by hand can sit on floor text or each other; check reports `text_overlap`: move one by its
+ `off`.
+- Too many parts: past about 8 the labels have nowhere to go. Split into two figures or drop a part.
+- Text on a beat shorter than its reading time (a tag value that changes too fast): `short_text`. Hold each
+ value at least 1 s.
+- A link ending inside a part draws over it: end it on a front face port (`x+`, `y+`, `top`) or let the
+ port rule put it behind (`x-`, `y-`, `bottom`).
+- Invented numbers without "Illustrative sample" on screen (`story.md` §6).
+- A live tag and a part share an id (a tag naming the part): `say` sets the tag, `level`/`count` the part. A string
+ is always a tag's text, a number always a level or a count.
+
+## Read next
+
+`references/voice.md` (fit, cues), `references/audio.md` (mix, ducking), `references/stage-api.md` (the time
+contract), `references/review.md` (the critic round), `references/html-export.md` (sharing; `--interactive`).
diff --git a/skills/showtime/references/workflows/recap.md b/skills/showtime/references/workflows/recap.md
new file mode 100644
index 0000000..6daa737
--- /dev/null
+++ b/skills/showtime/references/workflows/recap.md
@@ -0,0 +1,145 @@
+# Workflow: session recap (what an agent did, as a short film)
+
+Read this when the user wants a video of what a coding agent did in a session: a recap for a pull
+request description, a standup, a "what my agent did overnight" post ("make a video of this Claude
+Code session", "recap my last session"). The command `showtime recap` reads a Claude Code transcript through an
+allow-list and turns the facts into a 30-60 s narrated film; everything runs on this machine and nothing is uploaded (the bed may be a catalog
+track downloaded once from its creator's site: nothing is sent; `--music <style>` or `SHOWTIME_OFFLINE=1` keeps it fully local).
+
+## Essentials
+
+- Route: `showtime recap --latest` (this folder's newest session) or `showtime recap <session.jsonl>`;
+ it writes `<out>/script.md` and stops (also with `--yes`). Show the user script.md; only after they
+ have read it run the same command with `--yes` (§ Steps)
+- Never hand-write a recap from a transcript: transcripts hold keys, memory, private paths and other
+ projects. The command keeps only allow-listed facts (§ What reaches the film)
+- Edits go in script.md (change or delete lines), never in the generated page; the hard filter drops
+ keys, absolute paths, URLs, hosts and e-mail addresses again on `--yes` (§ What reaches the film)
+- Diff stats: the session's own commits by default; `--since <ref>` for a branch's whole change;
+ `--repo <dir>` when the session ran in a worktree that is gone (§ Inputs)
+- `--no-voice` for a silent cut, `--aspect 9:16` for a vertical one, `--preview` for a fast draft;
+ the command checks, renders and runs `showtime qa` itself (§ Steps)
+
+<!-- section lines: kept current by scripts/check_release.py -->
+| Section | Lines |
+|---|---|
+| Inputs | 33-41 |
+| What reaches the film | 43-79 |
+| The film | 81-91 |
+| Steps | 93-107 |
+| Pitfalls | 109-140 |
+| Read next | 142-145 |
+
+## Inputs
+
+- One Claude Code transcript: `~/.claude/projects/<project>/<session>.jsonl` (sub-agents under
+ `<session>/subagents/agent-<id>.jsonl`, their short description beside them), a session id, or
+ `--latest` (run inside Claude Code, that is the session in progress). `CLAUDE_CONFIG_DIR` moves the
+ folder. A session's recap covers its own transcript, not its sub-agents': recap those separately.
+- The repository the session worked in: its working folder by default, `--repo <dir>` otherwise (a
+ worktree under `.claude/worktrees/` that has been removed still maps to the repository's paths).
+- Diff stats: `--since <ref>` (`git diff <ref>`, working tree included), else the commits the session made.
+
+## What reaches the film
+
+Only this allow-list (every line of the film is in script.md; tool names and counts are kept in
+facts.json only):
+
+- the title and the hook from the facts alone ("42 min · 6 files edited · red to green", the date, the
+ counts); no free text from the session is film text by default;
+- tool names (Claude Code's own; any MCP tool is "MCP tool", anything else "other") and counts; file
+ paths relative to the repository, for files inside it (secret files such
+ as `.env` and the `.git` folder count as outside);
+- commands as a program name from a fixed list (git, npm, python, pytest, grep, curl ... ; anything
+ else, a client's CLI or a script of the user's own, counts as "other"), with the program's own
+ subcommand (`git commit`, never an alias, plugin or extension), a make or rake target only when
+ generic, and `python -m` only for a runner (`pytest`, `unittest`, `pip`); never a script or module path;
+- test runs (a runner in the program position: not an install, a lint or a `--version`) as counts read
+ from the end of their output (pytest, unittest, jest, cargo, go, node, run_all); git diff stats;
+ commits whose hash, as `git commit` printed it, is in this repository's history; active time (pauses
+ of 10 min or more left out).
+
+The request (the first user message, never a compaction summary) and a sub-agent's description are
+offered in script.md only as `# show ...` suggestions, cleaned strictly (a sentence naming a path, host,
+address, key, value-like word or digit groups ends the suggestion). They reach the film only if the
+user uncomments one; any line of script.md that recap did not write (a title, a caption, a narration
+line, a label) goes through the same strict rule and the hard filter, and the command names each line
+it refused (recap's own line is used instead, or the line is left out when recap writes none). Which
+lines are recap's own is decided by comparing shapes with what recap writes from the current facts,
+never by trusting a file on disk: the line recap writes now, the same line with older counts (a count
+standing alone, up to 5 digits in all, 12,345 included; never inside a file name), a file row or callout
+that is exactly a file the session edited, a files line that names one exactly, or a "Most used" line
+made only of allow-listed programs with a count. So rerunning while the session grows keeps your
+script.md as you left it, on every call; anything else you wrote is checked as written. The suggestions
+are never kept in facts.json or the project.
+
+Assistant text, thinking, tool output, memory, attachments, absolute paths, URLs and the environment
+are not on the list, and tool output is read only to count tests and commits. A hard filter then drops
+any line that looks like a key, a path, a URL, a host or an e-mail address. Filters can miss things:
+that is why nothing renders until the user has read script.md.
+
+## The film
+
+30-60 s, 16:9 (or `--aspect 9:16`), a light paper look (warm paper, ink, one rust accent): hook (a
+title from the facts, the date, the counts), the numbers, a living timeline (read, edit, run and test lanes filling as a playhead
+sweeps the session, edited files called out where they were first edited, the top commands), where the
+edits landed (+/- per file from git), the tests red to green (one dot per run), the diff, an end card.
+Narration with `showtime voice` (default `af_heart`) and burned captions; scenes are as long as their
+line, and a scene with more to read gets a pause after it. The bed comes from the session (no sound on the cuts; `--cut-sounds` adds a soft swoosh)
+(a catalog track, fetched once and cached, else a composed style; the same session sounds the same, another
+one does not); `--music <style|catalog-id|none>` pins the bed. A CC BY track writes `recap.credits.txt` next to
+the video (the command prints it and any Content ID note): keep that credit where you post it.
+
+## Steps
+
+1. **Script.** `showtime recap --latest` (or a transcript path) prints a one-line summary and writes
+ `<out>/script.md` and `<out>/facts.json`; `<out>` is `showtime-out/recap-<session>` unless `--out`
+ is given (refused where git would track it). Nothing is rendered yet.
+2. **Read it with the user.** Every `show` line is on screen, every `say` line is spoken. Change a line
+ or delete it; keep the keys (`show hook.title:`). To use the request as the title or under it,
+ uncomment its `# show` line. Editing script.md is the only way to change what is on screen.
+ *Done when:* the user has read script.md.
+3. **Render.** The same command with `--yes`: it narrates (`voice/narration.md`), writes
+ `<out>/project`, runs `showtime retime --from-voice`, `showtime check`, renders `<out>/recap.mp4`
+ and runs `showtime qa` (PASS or WARN). `--preview` for a draft first, `--no-render` to stop at the
+ project. `--fresh` rewrites script.md from the session (dropping edits).
+4. **Look.** `showtime look <out>` (one composite of the scenes) before sharing; for a pull request,
+ `showtime deliver exports <out>/recap.mp4 --targets github` makes a copy under 10 MB.
+
+## Pitfalls
+
+- Rendering before the user read script.md: a call that writes script.md never renders, `--yes` or not.
+- A session in a removed worktree with no `--repo`: the command says so; pass the repository.
+- Parallel agents committing to one repository: without `--since`, only the commits whose hashes the
+ session's `git commit` printed count. `git commit -q` prints none, so such a commit is not counted;
+ `--since <ref>` gives the change instead.
+- Tests run in the background or with their output cut: they show as grey dots, uncounted.
+- What the text guard is for: it keeps private text that slips in by accident, in the forms people write it,
+ out of the film. That covers pasted keys and tokens, card, phone and ID numbers, paths, e-mail addresses, IPs and
+ copy-paste artefacts. It does not stop you from disguising your own text on purpose: you wrote script.md, and you
+ read it before anything renders.
+- What it refuses in a line you write:
+ - keys and tokens (vendor prefixes, a key name with its value, long hex or key-like runs), absolute paths,
+ URLs, hosts, IPs and e-mail addresses;
+ - a long number: 6+ digits in a row; three or more digit groups, whatever separates them; a chain of groups
+ across punctuation or words of 1-4 letters holding 9+ digits in all (`SSN 123 and 45 and 6789`,
+ `4 1 1 1 ...`); and two groups side by side when one has 4+ digits (`4111 1111`);
+ - a line holding an invisible format or bidi character (a zero-width space, a soft hyphen). Every line is
+ judged NFKC-folded, without combining marks or invisible fillers. A zero-width joiner inside an emoji is fine.
+- Over-refusal on purpose: `Closes #12 #34 #56` (three groups) and a line over 2000 characters. These pass:
+ `between 2024 and 2026`, `From 2024-2026`, `1920×1080`, `Node 18, 20 and 22`, `Python 3.11, 3.12 and 3.13`.
+- A suggestion is only as clean as its rules: a nested block inside the request's own text, or an unknown
+ tag in the middle of a line, can leave some of that text in the `# show` comment. Read it before you
+ uncomment it.
+- Known residual, and why you read script.md first:
+ - Deliberate disguise passes: a number split by 5+ letter words (`4111 digit 1111 ...`), or digits written
+ out as words.
+ - An edited file whose own name is private (`data/4111111111111111.csv`) is shown and spoken in recap's own
+ rows, callouts and files line, and it is kept in facts.json, because the session did edit it.
+ - Counts carry digits by design: up to 5 per count, so up to 15 in a line with three counts. A "Most used"
+ line holds at most 4 programs, each named once, with counts of 1-99999.
+
+## Read next
+
+`references/workflows/changelog-video.md` (a PR video from the diff), `references/voice.md`,
+`references/captions.md`.
diff --git a/skills/showtime/references/workflows/repro.md b/skills/showtime/references/workflows/repro.md
new file mode 100644
index 0000000..8de0262
--- /dev/null
+++ b/skills/showtime/references/workflows/repro.md
@@ -0,0 +1,186 @@
+# Workflow: a failing browser test as a video (repro)
+
+Read this when a browser test fails and the user wants to show it: a bug report or a pull request that
+should carry what the test did and where it broke ("make a video of this failing Playwright test", "turn
+trace.zip into something I can attach to the issue"). A bug report you can watch: the test's own steps on
+the screenshots the trace holds, then the failure slowed down.
+
+## Essentials
+
+- Two calls: `showtime repro <trace.zip>` (or `showtime repro -- npx playwright test <spec>`, also
+ `-- pytest <file>`) writes `<job>/script.md` and stops; read it, then the same command with `--yes`
+ renders it, every line filtered again (§ Steps)
+- The `--yes` call writes `repro.mp4` (16:9, 1080p), `repro.srt`, `repro.poster.jpg`, `steps.json`,
+ `repro.md` (to paste into the issue) and `project/`; check, render and qa run inside it (§ Steps)
+- The film: title card (test, file:line, FAILED), one scene per step with a cursor, click ripple and box on
+ the target, the failing step slowed down (source line, expected and received, error, console errors), an
+ end card with the re-run command; planned for 10-40 s, long tests sum up their middle steps (§ The film)
+- Narrated by `showtime voice` (`af_heart` unless `--voice`); `--no-voice` leaves captions only (§ The film)
+- Privacy: typed values never shown or spoken (their fields covered on screen), paths, query strings, auth
+ headers, `NAME=value` secrets and e-mails masked, `--redact <regex>` everywhere text shows; screenshots
+ are shown as captured, so use a test account and watch the film before posting it (§ Privacy)
+- Fast draft: `--yes --preview`; project and reports only: `--yes --no-render` (§ Options)
+- Never describe a failure you have not read: quote `repro.md` or `steps.json`, not a guess (§ Pitfalls)
+
+<!-- section lines: kept current by scripts/check_release.py -->
+| Section | Lines |
+|---|---|
+| Inputs | 36-45 |
+| Steps | 47-76 |
+| The film | 78-104 |
+| Privacy | 106-149 |
+| Options | 151-167 |
+| Pitfalls | 169-181 |
+| Read next | 183-186 |
+
+## Inputs
+
+- A Playwright trace: the `trace.zip` that `npx playwright test --trace on` (or `retain-on-failure`) and
+ `pytest --tracing on` write under `test-results/<test>/`. Traces from the test runner carry step titles,
+ locators and the test's file:line; traces from the library alone (pytest) still give every action, its
+ target box, screenshots and the error.
+- Or the command that runs the tests, after `--` (a single script too: `-- ./e2e.sh`). It runs without a
+ shell, from the current folder.
+- Helpful: patterns to hide beyond the defaults (account ids, customer names, internal hostnames) for
+ `--redact`.
+
+## Steps
+
+1. **Write the script.** `showtime repro test-results/<test>/trace.zip`, or `showtime repro -- npx
+ playwright test tests/login.spec.ts`. With a command, it adds `--trace retain-on-failure` (`playwright
+ test`, also through `pnpm exec`, `yarn` or `node .../cli.js test`) or `--tracing retain-on-failure`
+ (`pytest`, `python -m pytest`), and `--output` in a temporary folder, unless the command already sets
+ them. It runs in your environment (your PATH, without what showtime sets for its own tools) with an
+ empty stdin and `PLAYWRIGHT_HTML_OPEN=never` unless you set it (so the html reporter does not serve its
+ report and wait for Ctrl+C), stops it after `--timeout` seconds (default 1800), and films the failing
+ trace that started first (it says when several failed). Traces are looked for only where the runner
+ was told to write (that folder, or your own `--output`), never across the working tree. A runner it
+ does not recognize runs as it is: pass its trace instead.
+2. **Read `<job>/script.md`.** The job folder is made only once a failing trace was parsed (a failed run
+ leaves nothing behind): `showtime-out/repro-<timestamp>/` (beside the job the current folder is in,
+ never inside it), or `--out <folder>`. It holds `script.md` (every caption, spoken line and on-screen
+ text, keyed by scene, then the masked steps), `report.json` (the filtered timeline) and `shots/` (the
+ trace's screenshots). The run's raw traces are deleted (`--keep-trace` keeps them in `<job>/work/`,
+ unfiltered). Nothing is rendered in this call. Edit the text after a label, or delete a line to leave
+ it out (a deleted spoken line leaves its scene silent).
+3. **Render it.** The same command again with `--yes` (it finds the newest job made from the same trace
+ or command), or `showtime repro --yes <job>`. Every line goes through the filters again (add
+ `--redact` here too), then it narrates, writes `<job>/project` (a DOM project: `index.html`,
+ `showtime.json`, `audio/mix.json`, the screenshots it uses, `repro.json`), runs `showtime check` (it
+ stops on errors), `showtime render -o <job>/repro.mp4` and `showtime qa`, and prints the verdict (exit
+ code 1 on a qa FAIL).
+4. **Read the result, then watch it.** `repro.md` has the steps, the failure (expected, received, the last
+ log line, the source line), the console errors and the re-run command, with a comment line to drag
+ `repro.mp4` onto in an issue or PR. `steps.json` is the parsed timeline: each step's kind, caption,
+ locator, file:line, duration, status, target box, and where it sits in the film. Quote these; do not
+ paraphrase the error. Watch `repro.mp4` in full before you post it: screenshots are not filtered.
+
+## The film
+
+- **Title card:** FAILED, the test's name, its file:line, then the Playwright version, browser, step count
+ and the failing step.
+- **Steps:** each action on its screenshot from the trace, in a browser frame showing the page's address,
+ with a step counter and, up to 24 steps, a row of dots (passed, current, failed). Clicks, checks and hovers
+ show the frame before the action with a cursor travelling to the point and a ripple; fills and presses show
+ the first frame taken after the step ended; the target's box is drawn when the trace records it, and the screenshot zooms in toward
+ it (up to 1.6x). Beside it: the kind,
+ a one-line caption ("Click the 'Sign in' button", "Type 16 characters into the 'Email' field"), the
+ locator and file:line with the step's duration. A step after an error the test caught is no failure: the
+ failing step is the one whose error ended the test.
+- **The failure:** the screenshot at the moment it failed, framed in red, then about one beat a second: the
+ caption, the failing source line (the trace carries the test file), expected and received side by side
+ with the characters Playwright marks as different highlighted, the error's first line, and up to two
+ console errors (`console.error` and uncaught page errors up to the failure).
+- **End card:** the re-run command (the command you gave, else `npx playwright test <file>:<line>` for a test
+ runner's trace; a library-only trace such as pytest's gets none) and the trace viewer command.
+- **Length:** each step holds for its reading time (17 characters or 3 words a second; 2.2-4.2 s), the failure
+ 6.5-12 s, and the film is planned to stay within 40 s: a longer test keeps its first step and the steps just
+ before the failure, and the passing steps between them become one "+ N passing steps" scene with up to six
+ of their screenshots. Narration can lengthen a scene past these holds.
+- **Sound:** narration from `showtime voice script` (one line per scene, read-back off), each line 0.3 s into
+ its scene, a scene lengthened to fit its line; typed values are never spoken (fills, typed text,
+ chosen options and unnamed keys are said without them). A quiet composed bed ducked
+ under the voice, a click sound on clicks and checks, and a soft tone on the failure. `repro.srt` carries
+ the same lines (two lines of at most 42 characters, at most 20 characters a second where the scene allows).
+
+## Privacy
+
+Traces can hold secrets. The filters run on every text the film, `repro.srt`, `steps.json`, `repro.md`,
+`script.md`, `report.json` and the project show, in the first call and again on `--yes`:
+
+- What was typed is never shown or spoken, in any field and through any API (`fill`, `type`,
+ `pressSequentially`, `keyboard.type`, `insertText`, a key that is not a named key): the caption says
+ "Type 12 characters into the 'Email' field". The values themselves are masked wherever else they appear
+ (the source line, the call log, an expected value). `--show-typed` shows what was typed into fields that
+ are not secret (filtered, never spoken); a field is secret when it is `type="password"`, its
+ `autocomplete` is current-password, new-password or one-time-code, or its locator, name, id, label,
+ placeholder or test id says password, secret, token, key or OTP. Text typed with `page.keyboard` goes
+ into the focused field: right after a click, fill or focus on a field, that field; after a Tab or another
+ key, a mouse click, a navigation or any step that may have moved the focus, a field showtime cannot name,
+ which counts as secret (and cannot be covered: `script.md` says so).
+- The field a value was typed into is covered on the screenshots, from that step on, while the trace's
+ DOM snapshots show it on the page and holding text: the cover goes when the field is emptied, removed or
+ replaced by another page, moves with the scroll of the page and of the boxes around the field, and moves
+ to a later step's box when that step acts on the same field. When the page scrolled, a second cover also
+ stays where the field was (unless it would hide the step's own target), since a fixed header does not
+ scroll. A field the snapshots cannot follow (no id or name, a snapshot too large to read, none at all,
+ as in a library-only trace) keeps its cover where it was until the page changes. Layout shifts and
+ animations are not followed: watch the film.
+- URLs lose their query string, fragment and `user:password@`; `file://` URLs show their last two path
+ parts; paths on the machine (home, temp and system folders, drives) show only their last part, so no
+ absolute or home path is written to the job's outputs or project.
+- Console lines and error text: `Authorization: Bearer ...`/`Basic ...`, `token X`, `NAME=value` and
+ `NAME: value` for token, secret, password, passwd, api key, auth, session and cookie names, and e-mail
+ addresses (`••••••@corp.example`; `--show-emails` keeps them) are masked, as are the key and token
+ shapes `showtime pr-video` masks. Each console line is cut to 300 characters, and at most 20 are kept.
+ Expected and received values stay, filtered.
+- `--redact <regex>` (repeatable) masks every match in captions, step text, the error, console lines, the
+ source line, the re-run command, the narration and every file above. The patterns are not written to
+ `job.json`.
+- Network requests, headers, cookies and bodies are never shown (`trace.network` is never opened). DOM
+ snapshots are read only to tell which fields are on the page and whether they are empty; nothing of
+ them is kept or shown.
+- Edits to `script.md` reach every output: what is not a line of its own is rebuilt from one (a step's
+ target from its locator, the test's file from its location), and every text is filtered again.
+- **Screenshots are shown as they were captured** (typed fields covered): whatever else the page displayed
+ is in the video, and `--redact` does not touch pixels. Run the test with a test account, read
+ `script.md`, and watch `repro.mp4` before you post it. Every call prints this.
+- Not filtered: `job.json`, `SHOWTIME.md` and the render's own reports under `<job>/work/` record this
+ machine's tool paths (local bookkeeping, never posted), and `--keep-trace` keeps raw traces.
+
+## Options
+
+- `--yes`: render the job's `script.md` as you left it (a call that writes the script never renders).
+- `--out <folder>`: the job folder (new or empty; with `--yes`, the job to render).
+- `--redact <regex>`, `--show-typed` (first call), `--show-emails`, `--keep-trace`: see § Privacy.
+- `--timeout <seconds>`: stop the test command after this long (default 1800).
+- `--no-voice`: captions only; `--voice <name>`: another voice (`showtime voice list`).
+- `--cut-sounds`: a soft swoosh on each scene cut (off by default; the click on a click and the failure tone stay).
+- `--music <style|catalog-id|none>`: pin the bed (default: chosen from the test, off the last films' music; a catalog
+ track is downloaded once from its creator's site, nothing is sent, and its credit goes into `repro.md`; a style or
+ `SHOWTIME_OFFLINE=1` keeps it fully local).
+- `--size 720p`: a 1280x720 frame instead of 1920x1080; `--preview`: a fast draft render (720p at most).
+- `--no-render` (with `--yes`): the project, `steps.json`, `repro.srt` and `repro.md` only; it prints the
+ check and render commands.
+- `--keep-work`: keep the render's `repro.work/` (audio stems) and `project/work/` (check's report), removed
+ after qa otherwise.
+- `--json`: the result as JSON on stdout (the test run's own output goes to stderr).
+
+## Pitfalls
+
+- A trace without screenshots (`screenshots: false` in the trace options) shows "no screenshot in the trace"
+ in place of each page; turn screenshots on.
+- An assertion has no target box in the trace, so the failing `expect` is shown by its source line and the
+ expected and received values, not by a box on the page.
+- The test passed: `showtime repro` stops with "the trace records no failure" (with a command: "no test
+ failed"); it films failing tests.
+- A command that wrote no trace.zip (another runner, tracing off in its config): turn tracing on yourself and
+ pass the trace.
+- Console lines are cut to 90 characters on screen; `steps.json` and `repro.md` keep up to 300.
+- A huge trace (more than 20,000 files or 1 GB of events) is refused: run the one failing test alone.
+- The film shows what the trace recorded; a claim about the cause belongs in the report text, from the code.
+
+## Read next
+
+`references/workflows/changelog-video.md` (a video for the PR that fixes it: `showtime pr-video`),
+`references/qa.md`, `references/voice.md`, `references/captions.md`.
diff --git a/skills/showtime/runtime/diagram.css b/skills/showtime/runtime/diagram.css
new file mode 100644
index 0000000..754b711
--- /dev/null
+++ b/skills/showtime/runtime/diagram.css
@@ -0,0 +1,53 @@
+/* showtime living diagrams: the page around the figure (frame, title block, corner metadata, footer, steps),
+ in two themes. <html data-theme="light"> (paper, the default) or data-theme="dark" (night schematic).
+ Fonts are linked by the page (light: Geist, Geist Mono, Instrument Serif; dark: IBM Plex Sans, IBM Plex
+ Mono, Space Grotesk). Text sizes keep the check's 25 px floor; every readable colour is >= 4.5:1. */
+:root {
+ --ld-ground: #F4F3EF; --ld-ink: #1E2024; --ld-ink-2: #4A4C50; --ld-hair: #B9B6AE; --ld-accent: #B8431D;
+ --ld-title-font: 'Instrument Serif', serif; --ld-title-weight: 400; --ld-title-size: 76px; --ld-title-track: -0.01em;
+ --ld-title-style: italic; --ld-sans: 'Geist', sans-serif; --ld-mono: 'Geist Mono', monospace;
+ --ld-backdrop: var(--ld-ground);
+}
+:root[data-theme="white"] {
+ --ld-ground: #FFFFFF; --ld-ink: #111827; --ld-ink-2: #4B5563; --ld-hair: #E5E7EB; --ld-accent: #2563EB;
+ --ld-title-font: 'Inter', sans-serif; --ld-title-weight: 650; --ld-title-size: 64px; --ld-title-track: -0.02em;
+ --ld-title-style: normal; --ld-sans: 'Inter', sans-serif; --ld-mono: 'JetBrains Mono', monospace;
+ --ld-backdrop: #FFFFFF;
+}
+:root[data-theme="dark"] {
+ --ld-ground: #0A0F19; --ld-ink: #EEF2F8; --ld-ink-2: #A9B6C8; --ld-hair: #23314A; --ld-accent: #FFB04A;
+ --ld-title-font: 'Space Grotesk', sans-serif; --ld-title-weight: 600; --ld-title-size: 64px; --ld-title-track: -0.025em;
+ --ld-title-style: normal; --ld-sans: 'IBM Plex Sans', sans-serif; --ld-mono: 'IBM Plex Mono', monospace;
+ --ld-backdrop: radial-gradient(1200px 760px at 62% 58%, #111A2A 0%, #0C1320 55%, #0A0F19 100%);
+}
+html, body { margin: 0; background: var(--ld-ground); }
+.ld-stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; overflow: hidden; background: var(--ld-backdrop); }
+#ld { position: absolute; inset: 0; }
+.ld-frame { position: absolute; inset: 44px; border: 1.5px solid var(--ld-hair); border-radius: 4px; pointer-events: none; }
+.ld-tick { display: none; position: absolute; width: 18px; height: 18px; border-color: #5D7396; border-style: solid; }
+:root[data-theme="dark"] .ld-tick { display: block; }
+.ld-tick.a { left: 38px; top: 38px; border-width: 2px 0 0 2px; } .ld-tick.b { right: 38px; top: 38px; border-width: 2px 2px 0 0; }
+.ld-tick.c { left: 38px; bottom: 38px; border-width: 0 0 2px 2px; } .ld-tick.d { right: 38px; bottom: 38px; border-width: 0 2px 2px 0; }
+.ld-meta { position: absolute; font-family: var(--ld-mono); font-weight: 500; font-size: 25px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ld-ink-2); white-space: nowrap; }
+:root[data-theme="dark"] .ld-meta { letter-spacing: 0.1em; }
+.ld-kicker { left: 112px; top: 100px; } .ld-kicker b { font-weight: 500; color: var(--ld-ink-2); }
+:root[data-theme="dark"] .ld-kicker b { color: var(--ld-accent); }
+.ld-figno { right: 112px; top: 100px; }
+.ld-title { position: absolute; left: 108px; top: 138px; margin: 0; font-family: var(--ld-title-font); font-weight: var(--ld-title-weight);
+ font-size: var(--ld-title-size); line-height: 1.02; letter-spacing: var(--ld-title-track); color: var(--ld-ink); white-space: nowrap; }
+:root[data-theme="dark"] .ld-title { top: 146px; }
+.ld-title em { font-style: var(--ld-title-style); color: var(--ld-accent); }
+.ld-dek { position: absolute; left: 112px; top: 236px; width: 560px; font-family: var(--ld-sans); font-size: 27px; line-height: 1.32; color: var(--ld-ink-2); }
+.ld-foot { bottom: 90px; } /* the runtime fades plates (only) out under each footer line: an SVG mask on the floor layer */
+.ld-foot:empty { display: none; }
+.ld-foot.l { left: 112px; }
+.ld-foot.r { right: 112px; text-transform: none; letter-spacing: 0.04em; color: var(--ld-ink); }
+.ld-foot .k { color: var(--ld-ink-2); }
+/* steps: one line per beat (Diagram fills .ld-steps from the scene's steps) */
+.ld-steps { position: absolute; left: 112px; top: 330px; width: 520px; height: 150px; }
+.ld-step { position: absolute; left: 0; top: 0; width: 100%; visibility: hidden; opacity: 0; }
+.ld-step-k { display: block; font-family: var(--ld-mono); font-weight: 500; font-size: 25px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ld-accent); margin-bottom: 8px; }
+:root:not([data-theme="dark"]) .ld-step-k { color: #A23A17; }
+:root[data-theme="white"] .ld-step-k { color: #1D4ED8; }
+:root[data-theme="white"] .ld-frame { border-width: 1px; border-radius: 14px; }
+.ld-step-t { display: block; font-family: var(--ld-sans); font-weight: 500; font-size: 31px; line-height: 1.28; color: var(--ld-ink); }
diff --git a/skills/showtime/runtime/diagram.js b/skills/showtime/runtime/diagram.js
new file mode 100644
index 0000000..bed62f3
--- /dev/null
+++ b/skills/showtime/runtime/diagram.js
@@ -0,0 +1,1593 @@
+/* showtime living diagrams: an isometric (or flat) system drawn as a pure function of time.
+ *
+ * Classic script, one global: `Diagram` (alias `LD`). Load after /_st/stage.js:
+ *
+ * <html data-theme="light"> light (paper, the default) or dark (night schematic)
+ * <link rel="stylesheet" href="/_st/diagram.css">
+ * <script src="/_st/stage.js"></script>
+ * <script src="/_st/diagram.js"></script>
+ * ... <div class="ld-stage"><div id="ld"></div> ...page chrome... </div>
+ * <script src="scene.js"></script> window.SCENE = { world, items, flows, labels, ... }
+ * <script>Diagram.mount(SCENE);</script>
+ *
+ * One SVG at 1920x1080 design px. World = isometric units (x to the lower right, y to the lower left,
+ * z up). The world group is redrawn from t on every seek; every text (labels, tags, floor text) is a
+ * persistent node created at mount and only moved or faded, so `showtime check` reads it as one text.
+ * No CSS transitions, no timers, no state carried between frames; randomness only through ST.rand.
+ * Full reference: references/workflows/diagram.md (spec) and DESIGN notes in the template README.
+ */
+(function (root) {
+ 'use strict';
+ var C = Math.cos(Math.PI / 6);
+ var W = 1920, H = 1080;
+ var TEXT_FADE = 0.2; // every text fades in or out over at most this (a mid-fade frame fails contrast)
+ var MIN_TEXT_PX = 25; // the check's readable minimum at 1080p (2.2 % of the frame height, rounded up)
+ var clamp = function (x, a, b) { return Math.min(b, Math.max(a, x)); };
+ var lerp = function (a, b, p) { return a + (b - a) * p; };
+ var E = {
+ linear: function (p) { return p; },
+ outCubic: function (p) { return 1 - Math.pow(1 - p, 3); },
+ outQuint: function (p) { return 1 - Math.pow(1 - p, 5); },
+ inOutCubic: function (p) { return p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2; },
+ inOutSine: function (p) { return -(Math.cos(Math.PI * p) - 1) / 2; },
+ outBack: function (p) { var c1 = 1.4, c3 = c1 + 1; return 1 + c3 * Math.pow(p - 1, 3) + c1 * Math.pow(p - 1, 2); },
+ };
+ function seg(t, a, d, e) { var p = d > 0 ? clamp((t - a) / d, 0, 1) : (t >= a ? 1 : 0); return e ? e(p) : p; }
+ function f1(n) { return String(Math.round(n * 10) / 10); }
+ function f3(n) { return String(Math.round(n * 1000) / 1000); }
+ function hexRgb(h) { var v = parseInt(h.slice(1), 16); return [(v >> 16) & 255, (v >> 8) & 255, v & 255]; }
+ function mixHex(a, b, p) {
+ if (p <= 0) return a; if (p >= 1) return b;
+ var pa = hexRgb(a), pb = hexRgb(b);
+ var ch = function (i) { return Math.round(lerp(pa[i], pb[i], p)); };
+ return '#' + ((1 << 24) + (ch(0) << 16) + (ch(1) << 8) + ch(2)).toString(16).slice(1);
+ }
+ function esc(s) { return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); }
+ function warn(msg) { if (root.console) console.warn('[showtime] diagram: ' + msg); }
+
+ /* ------------------------------------------------------------------ themes
+ A theme is tokens plus a few drawing switches (flow: dashes or glowing beads; tags: solid or outlined
+ pills; tokens: pucks or beads). The same scene renders in both. */
+ var THEMES = {
+ light: {
+ name: 'light', ground: '#F4F3EF',
+ lw: 1.6, ink: '#2A2C30', detail: '#9C998F', hatch: '#B0ACA2', grid: '#E9E7E1', floorInk: '#46443F',
+ faces: { top: '#FFFFFF', left: '#F2F1ED', right: '#E4E2DC', recess: '#ECEBE6', deep: '#E1DFD8', blade: '#FAFAF8' },
+ plateFaces: { top: '#FBFAF7', left: '#ECEAE4', right: '#E0DED7' },
+ coolFaces: { top: '#EEF3F9', left: '#DFE6EF', right: '#D3DBE6' },
+ glass: { top: '#E6F0FC', left: '#D6E5F7', right: '#C7D9F0' }, glassLine: '#3F6FAE', glassOpacity: 0.78, glassGlow: false,
+ padFaces: { top: '#F4F3EF', left: '#E6E4DE', right: '#DAD8D1' },
+ wallFaces: { top: '#F7F6F2', left: '#EAE8E2', right: '#F0EFEA' },
+ floorFaces: { top: '#F6EFE4', left: '#E8E0D2', right: '#DDD4C5' }, plank: '#E6DCCB', ghost: '#9C998F',
+ roofFaces: { top: '#EFEDE7', left: '#E7E4DC', right: '#DCD9D0' },
+ cylStops: '<stop offset="0" stop-color="#FFFFFF"/><stop offset="0.45" stop-color="#F3F2EE"/><stop offset="1" stop-color="#DCDAD3"/>',
+ domeStops: '<stop offset="0" stop-color="#FFFFFF"/><stop offset="1" stop-color="#E2E0D9"/>',
+ shadow: 'rgba(70,60,40,0.16)', shadowBlur: 8,
+ pipe: { body: '#FFFFFF', sheen: 'rgba(255,255,255,0.75)', collar: '#F7F6F2' },
+ tones: {
+ cold: { tint: '#D3E3F6', flow: '#1F66C2', air: '#5B8FD0', tag: '#1F66C2', tagInk: '#FFFFFF', face: '#E4EEFA' },
+ hot: { tint: '#F8D5C6', flow: '#C8441C', air: '#D9764F', tag: '#BE3F19', tagInk: '#FFFFFF', face: '#FBE6DC' },
+ warm: { tint: '#F6E6D2', flow: '#C9822B', air: '#D9764F', tag: '#94540F', tagInk: '#FFFFFF', face: '#FAF0E2' },
+ mute: { tint: '#E6E4DE', flow: '#8C897F', air: '#9C998F', tag: '#5F5C55', tagInk: '#FFFFFF', face: '#EFEEEA' },
+ ok: { tint: '#D5EBDD', flow: '#2E8A55', air: '#4FA06F', tag: '#23744A', tagInk: '#FFFFFF', face: '#E6F3EA' },
+ },
+ flowStyle: 'dash', tagStyle: 'solid', tokenStyle: 'puck', airOpacity: 0.85,
+ leader: '#2A2C30', leaderW: 1.6, dotFill: '#FFFFFF',
+ labelPlate: '#F4F3EF', labelPlateOpacity: 0.86, labelInk: '#1E2024', subInk: '#4A4C50',
+ font: { label: 'Geist', sub: 'Geist', mono: 'Geist Mono' },
+ size: { label: 31, sub: 25, tag: 25 }, weight: { label: 600 }, track: { label: '-0.01em' },
+ dimTo: 0.42, veil: '#F4F3EF', bloom: '#EDB08A', bloomOpacity: 0.32,
+ },
+ dark: {
+ name: 'dark', ground: '#0A0F19',
+ lw: 1.5, ink: '#9FB4CF', detail: '#4E6585', hatch: '#3B4F6E', grid: '#152238', floorInk: '#A8B8CE',
+ faces: { top: '#18253B', left: '#121C2E', right: '#0D1523', recess: '#0B121E', deep: '#09101A', blade: '#22324D' },
+ plateFaces: { top: '#0F1828', left: '#0C1421', right: '#0A111C' },
+ coolFaces: { top: '#11203A', left: '#0D192D', right: '#0A1424' },
+ glass: { top: '#10345A', left: '#0C2848', right: '#091E38' }, glassLine: '#5CD3FF', glassOpacity: 0.62, glassGlow: true,
+ padFaces: { top: '#152034', left: '#0F1828', right: '#0B1220' },
+ wallFaces: { top: '#162236', left: '#101A2A', right: '#131E31' },
+ floorFaces: { top: '#17151A', left: '#120F13', right: '#0E0C10' }, plank: '#262027', ghost: '#4E6585',
+ roofFaces: { top: '#1C2A42', left: '#142035', right: '#0F182A' },
+ cylStops: '<stop offset="0" stop-color="#22324D"/><stop offset="0.45" stop-color="#16233A"/><stop offset="1" stop-color="#0C1422"/>',
+ domeStops: '<stop offset="0" stop-color="#2B3E5E"/><stop offset="1" stop-color="#111B2C"/>',
+ shadow: 'rgba(0,0,0,0.55)', shadowBlur: 10,
+ pipe: { body: '#121C2D', sheen: null, collar: '#1A2740' },
+ tones: {
+ cold: { tint: '#0F3149', flow: '#5CD3FF', air: '#3FA9E0', tag: '#0A0F19', tagInk: '#7FDCFF', face: '#13283F' },
+ hot: { tint: '#3D1A12', flow: '#FF6A3D', air: '#FF8A4C', tag: '#0A0F19', tagInk: '#FF8F66', face: '#2E1A1A' },
+ warm: { tint: '#33240F', flow: '#FFB04A', air: '#FFB04A', tag: '#0A0F19', tagInk: '#FFC271', face: '#2A2216' },
+ mute: { tint: '#1A2436', flow: '#7D8FA8', air: '#5A6E8C', tag: '#0A0F19', tagInk: '#A9B6C8', face: '#172133' },
+ ok: { tint: '#0F3324', flow: '#4ADE8A', air: '#3FBF75', tag: '#0A0F19', tagInk: '#6EEBA3', face: '#122B22' },
+ },
+ flowStyle: 'bead', tagStyle: 'outline', tokenStyle: 'bead', airOpacity: 0.9,
+ leader: '#8FA6C4', leaderW: 1.5, dotFill: '#0A0F19',
+ labelPlate: '#0A0F19', labelPlateOpacity: 0.62, labelInk: '#EEF2F8', subInk: '#A9B6C8',
+ font: { label: 'IBM Plex Sans', sub: 'IBM Plex Sans', mono: 'IBM Plex Mono' },
+ size: { label: 31, sub: 25, tag: 25 }, weight: { label: 600 }, track: { label: '0' },
+ dimTo: 0.38, veil: '#0B111C', bloom: '#FF8A3D', bloomOpacity: 0.5,
+ },
+ };
+ // white: a white ground and neutral greys for everything structural; colour only where it means something
+ // (cold = blue: what flows, what is selected; hot = warm orange: a rise, an alert). Inter and JetBrains Mono.
+ THEMES.white = {
+ name: 'white', ground: '#FFFFFF',
+ lw: 1.5, ink: '#1F2328', detail: '#A3A9B1', hatch: '#C3C8CF', grid: '#F0F2F5', floorInk: '#4B5563',
+ faces: { top: '#FFFFFF', left: '#F4F5F7', right: '#E7E9ED', recess: '#EEF0F3', deep: '#E5E7EB', blade: '#FAFBFC' },
+ plateFaces: { top: '#FCFCFD', left: '#EEF0F3', right: '#E3E6EA' },
+ coolFaces: { top: '#F1F5FE', left: '#E3EAF9', right: '#D7E0F4' },
+ glass: { top: '#EEF4FF', left: '#E0EAFB', right: '#D3E0F7' }, glassLine: '#2563EB', glassOpacity: 0.78, glassGlow: false,
+ padFaces: { top: '#F6F7F9', left: '#E9EBEF', right: '#DDE0E5' },
+ wallFaces: { top: '#F8F9FA', left: '#ECEEF1', right: '#F2F3F5' },
+ floorFaces: { top: '#F8F9FA', left: '#ECEEF1', right: '#E2E5E9' }, plank: '#E5E7EB', ghost: '#A3A9B1',
+ roofFaces: { top: '#F3F4F6', left: '#E9EBEE', right: '#DEE1E6' },
+ cylStops: '<stop offset="0" stop-color="#FFFFFF"/><stop offset="0.45" stop-color="#F3F4F6"/><stop offset="1" stop-color="#DADDE2"/>',
+ domeStops: '<stop offset="0" stop-color="#FFFFFF"/><stop offset="1" stop-color="#E3E5E9"/>',
+ shadow: 'rgba(15,23,42,0.10)', shadowBlur: 10,
+ pipe: { body: '#FFFFFF', sheen: 'rgba(255,255,255,0.8)', collar: '#F6F7F9' },
+ tones: {
+ cold: { tint: '#DCE7FD', flow: '#2563EB', air: '#5B8DEF', tag: '#2563EB', tagInk: '#FFFFFF', face: '#EAF1FE' },
+ hot: { tint: '#FDDCCB', flow: '#D9480F', air: '#E8703A', tag: '#C2410C', tagInk: '#FFFFFF', face: '#FEEDE4' },
+ warm: { tint: '#FDE7C8', flow: '#C2710C', air: '#D98B2B', tag: '#9A5A08', tagInk: '#FFFFFF', face: '#FEF3E2' },
+ mute: { tint: '#ECEEF1', flow: '#9AA1AB', air: '#AEB4BC', tag: '#F1F3F5', tagInk: '#374151', face: '#F3F4F6' },
+ ok: { tint: '#D7F0E0', flow: '#15803D', air: '#3A9A5E', tag: '#15803D', tagInk: '#FFFFFF', face: '#E8F6EE' },
+ },
+ flowStyle: 'dash', tagStyle: 'solid', tokenStyle: 'puck', airOpacity: 0.85,
+ leader: '#6B7280', leaderW: 1.4, dotFill: '#FFFFFF',
+ labelPlate: '#FFFFFF', labelPlateOpacity: 0.92, labelInk: '#111827', subInk: '#4B5563',
+ font: { label: 'Inter', sub: 'Inter', mono: 'JetBrains Mono' },
+ size: { label: 32, sub: 26, tag: 27 }, weight: { label: 600 }, track: { label: '-0.01em' },
+ dimTo: 0.38, veil: '#FFFFFF', bloom: '#93B4F5', bloomOpacity: 0.25,
+ };
+ THEMES.paper = THEMES.light; THEMES.night = THEMES.dark;
+ function toneOf(L, name) { return L.tones[name] || L.tones[{ a: 'cold', b: 'hot', c: 'warm', no: 'hot', yes: 'ok', green: 'ok' }[name]] || L.tones.mute; }
+
+ /* ------------------------------------------------------------------ the parts library
+ Each entry turns {at, size, ...} into shapes (drawn in order), a world bbox, an anchor (where a label
+ points), a footprint (the contact shadow) and named ports (where pipes and links attach). Ports are
+ {at:[x,y,z], face:'x+'|'x-'|'y+'|'y-'|'top'|'bottom'}: a pipe on a back face (x-, y-, bottom) is drawn
+ behind its part, on a front face (x+, y+, top) in front of it. */
+ function boxPorts(x0, y0, z0, w, d, h) {
+ var cx = x0 + w / 2, cy = y0 + d / 2, cz = z0 + h / 2;
+ return {
+ top: { at: [cx, cy, z0 + h], face: 'top' }, bottom: { at: [cx, cy, z0], face: 'bottom' },
+ 'x+': { at: [x0 + w, cy, cz], face: 'x+' }, 'x-': { at: [x0, cy, cz], face: 'x-' },
+ 'y+': { at: [cx, y0 + d, cz], face: 'y+' }, 'y-': { at: [cx, y0, cz], face: 'y-' },
+ };
+ }
+ var LIB = {
+ box: function (o) {
+ var a = o.at, s = o.size || [10, 10, 10];
+ return { shapes: [{ kind: 'box', at: a, size: s, bevel: o.bevel == null ? 0.6 : o.bevel, tone: o.faces }],
+ bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + s[2]]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + s[2]],
+ footprint: [a[0], a[1], s[0], s[1]], ports: boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]) };
+ },
+ slab: function (o) { return LIB.box(Object.assign({ bevel: 0, faces: 'padFaces' }, o, { size: o.size || [12, 12, 1.2] })); },
+ plate: function (o) {
+ var a = o.at || [-2, -2, -2.4], s = o.size || [100, 64, 2.4];
+ return { layer: 'floor', shapes: [{ kind: 'plate', at: a, size: s, grid: o.grid == null ? 6 : o.grid, ruler: o.ruler !== false && !o.glass, faces: o.faces, glass: o.glass }],
+ bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + s[2]]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, 0] };
+ },
+ floor: function (o) { // a raised floor area (indoor), planks optional
+ var a = o.at, s = o.size;
+ var sh = [{ kind: 'box', at: a, size: [s[0], s[1], s[2] || 0.35], tone: o.faces || 'floorFaces' }];
+ if (o.planks !== false) sh.push({ kind: 'planks', at: [a[0], a[1], a[2] + (s[2] || 0.35)], size: s, step: o.planks || 3.2 });
+ return { layer: 'floor', shapes: sh, bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + (s[2] || 0.35)]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2]] };
+ },
+ wall: function (o) { // a cut wall: hatched section on top (+ the end face), the removed part as a dashed ghost
+ var a = o.at, s = o.size, sh = [{ kind: 'box', at: a, size: s, tone: 'wallFaces' }, { kind: 'hatch', at: a, size: s, endFace: o.endFace !== false }];
+ return { shapes: sh, bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + s[2]]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + s[2]],
+ footprint: [a[0], a[1], s[0], s[1]], ports: boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]) };
+ },
+ unit: function (o) { // an outdoor unit: fan on the y+ face, coil fins on the x+ face, a grille on top, bolts
+ var a = o.at, s = o.size || [24, 18, 24], x0 = a[0], y0 = a[1], z0 = a[2], w = s[0], d = s[1], h = s[2];
+ var R = Math.min(w, h) * 0.34, sh = [{ kind: 'box', at: a, size: s, bevel: 1.1 }];
+ sh.push({ kind: 'fins', face: 'x+', plane: x0 + w, c: [y0 + d * 0.61, z0 + h * 0.56], u0: -d * 0.26, u1: d * 0.26, v0: -h * 0.29, v1: h * 0.31, step: 0.42 });
+ sh.push({ kind: 'fan', face: 'y+', plane: y0 + d, c: [x0 + w / 2, z0 + h * 0.52], R: R, spin: o.spin });
+ for (var i = 0; i < 4; i++) sh.push({ kind: 'line', pts: [[x0 + 3 + i * 2.2, y0 + 3, z0 + h], [x0 + 3 + i * 2.2, y0 + d - 3, z0 + h]], lw: 0.5 });
+ [[x0 + 1.3, z0 + 1.5], [x0 + w - 1.3, z0 + 1.5], [x0 + 1.3, z0 + h - 1.5], [x0 + w - 1.3, z0 + h - 1.5]].forEach(function (b) { sh.push({ kind: 'bolt', at: [b[0], y0 + d, b[1]] }); });
+ var P = boxPorts(x0, y0, z0, w, d, h);
+ P.out = { at: [x0 + w, y0 + 3, z0 + h * 0.48], face: 'x+' }; P.in = { at: [x0 + w, y0 + d - 4, z0 + h * 0.19], face: 'x+' };
+ return { shapes: sh, bbox: [a, [x0 + w, y0 + d, z0 + h]], anchor: [x0 + 0.5, y0 + d, z0 + h * 0.62], footprint: [x0, y0, w, d], ports: P };
+ },
+ compressor: function (o) { // a pad, a domed shell with bands, a terminal box
+ var a = o.at, r = o.r || 4.6, h = o.h || 13.5, cx = a[0], cy = a[1], z0 = a[2], pad = r * 1.2;
+ var sh = [{ kind: 'box', at: [cx - pad, cy - pad, z0], size: [pad * 2, pad * 2, 1.4], tone: 'padFaces' },
+ { kind: 'cyl', at: [cx, cy, z0 + 1.4], r: r, h: h, dome: r * 0.65, bands: [h * 0.24, h * 0.78] },
+ { kind: 'box', at: [cx + r * 0.57, cy + r * 0.57, z0 + h * 0.4], size: [r * 0.57, r * 0.57, r * 0.7], bevel: 0.4 }];
+ var top = z0 + 1.4 + h + r * 0.65;
+ return { shapes: sh, bbox: [[cx - pad, cy - pad, z0], [cx + pad, cy + pad, top]], anchor: [cx, cy, top - 0.4], footprint: [cx - pad, cy - pad, pad * 2, pad * 2],
+ ports: { top: { at: [cx, cy, top - 0.8], face: 'top' }, 'y+': { at: [cx, cy + r, z0 + 1.4 + h * 0.75], face: 'y+' }, 'x+': { at: [cx + r, cy, z0 + 1.4 + h * 0.75], face: 'x+' },
+ 'x-': { at: [cx - r, cy, z0 + 1.4 + h * 0.75], face: 'x-' }, in: { at: [cx, cy + r, z0 + 1.4 + h * 0.75], face: 'y+' }, out: { at: [cx, cy, top - 0.8], face: 'top' } } };
+ },
+ tank: function (o) { // a vertical vessel
+ var a = o.at, r = o.r || 4, h = o.h || 12;
+ return { shapes: [{ kind: 'cyl', at: a, r: r, h: h, dome: o.dome == null ? r * 0.5 : o.dome, bands: o.bands || [h * 0.2, h * 0.8], cap: o.cap }],
+ bbox: [[a[0] - r, a[1] - r, a[2]], [a[0] + r, a[1] + r, a[2] + h + (o.dome == null ? r * 0.5 : o.dome)]], anchor: [a[0], a[1], a[2] + h],
+ footprint: [a[0] - r, a[1] - r, r * 2, r * 2], ports: { top: { at: [a[0], a[1], a[2] + h], face: 'top' }, 'x+': { at: [a[0] + r, a[1], a[2] + h / 2], face: 'x+' },
+ 'y+': { at: [a[0], a[1] + r, a[2] + h / 2], face: 'y+' }, 'x-': { at: [a[0] - r, a[1], a[2] + h / 2], face: 'x-' }, 'y-': { at: [a[0], a[1] - r, a[2] + h / 2], face: 'y-' } } };
+ },
+ valve: function (o) { // a small body with a bonnet
+ var a = o.at, s = o.size || [3.6, 3.4, 4.2];
+ return { shapes: [{ kind: 'box', at: a, size: s, bevel: 0.5 }, { kind: 'cyl', at: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + s[2]], r: 1.1, h: 2.4, cap: 0.5 }],
+ bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + s[2] + 2.4]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + s[2] + 2.4],
+ footprint: [a[0], a[1], s[0], s[1]], ports: boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]) };
+ },
+ cassette: function (o) { // a wall-mounted indoor unit: grille slot on its x+ face
+ var a = o.at, s = o.size || [4.4, 18, 7], x1 = a[0] + s[0];
+ var sh = [{ kind: 'box', at: a, size: s, bevel: 0.6 },
+ { kind: 'face', pts: [[x1, a[1] + 1.2, a[2] + 0.8], [x1, a[1] + s[1] - 1.2, a[2] + 0.8], [x1, a[1] + s[1] - 1.2, a[2] + 2.8], [x1, a[1] + 1.2, a[2] + 2.8]], tone: 'recess', lw: 0.6, stroke: 'detail' },
+ { kind: 'line', pts: [[x1, a[1] + 1.2, a[2] + 1.8], [x1, a[1] + s[1] - 1.2, a[2] + 1.8]], lw: 0.45 },
+ { kind: 'line', pts: [[x1, a[1] + 2, a[2] + 5.4], [x1, a[1] + 5.5, a[2] + 5.4]], lw: 0.6 }];
+ return { shapes: sh, bbox: [a, [x1, a[1] + s[1], a[2] + s[2]]], anchor: [x1, a[1] + s[1] * 0.25, a[2] + s[2]], ports: boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]) };
+ },
+ /* abstract system pieces: the same line, faces and shadow, for entities that are not machines */
+ node: function (o) { // an entity on a round pedestal: icon person | building | school | bank | firm | server | house
+ var a = o.at, r = o.r || 4.2, ph = o.pedestal == null ? 1.2 : o.pedestal, cx = a[0], cy = a[1], z0 = a[2] || 0;
+ var sh = o.glass ? [{ kind: 'box', at: [cx - r * 0.8, cy - r * 0.8, z0], size: [r * 1.6, r * 1.6, ph], glass: true }] : [{ kind: 'cyl', at: [cx, cy, z0], r: r, h: ph, flat: true }], top = z0 + ph, icon = o.icon || 'person', ih;
+ var k = o.scale || 1;
+ if (icon === 'person') {
+ sh.push({ kind: 'cyl', at: [cx, cy, top], r: 1.55 * k, h: 3.6 * k, dome: 0.9 * k });
+ sh.push({ kind: 'ball', at: [cx, cy, top + 3.6 * k + 0.9 * k + 1.5 * k], r: 1.45 * k });
+ ih = 3.6 * k + 0.9 * k + 3.0 * k;
+ } else if (icon === 'terminal') { // a screen on a stand: the prompt lines on its y+ face
+ var tw = 7.2 * k, th = 5 * k, td = 1.2 * k, tx0 = cx - tw / 2, ty0 = cy - td / 2, tz = top + 1.1 * k;
+ sh.push({ kind: 'box', at: [cx - 0.5 * k, cy - 0.5 * k, top], size: [1 * k, 1 * k, 1.1 * k], bevel: 0 });
+ sh.push({ kind: 'box', at: [tx0, ty0, tz], size: [tw, td, th], bevel: 0 });
+ sh.push({ kind: 'face', pts: [[tx0 + 0.5 * k, ty0 + td, tz + 0.5 * k], [tx0 + tw - 0.5 * k, ty0 + td, tz + 0.5 * k], [tx0 + tw - 0.5 * k, ty0 + td, tz + th - 0.5 * k], [tx0 + 0.5 * k, ty0 + td, tz + th - 0.5 * k]], tone: 'deep', lw: 0.7 });
+ [0.72, 0.5, 0.28].forEach(function (f, i) { sh.push({ kind: 'line', pts: [[tx0 + 1.1 * k, ty0 + td, tz + th * f], [tx0 + (i === 2 ? 2.4 : 4.6 - i * 0.9) * k, ty0 + td, tz + th * f]], lw: 1.1, stroke: 'ink' }); });
+ ih = 1.1 * k + th;
+ } else if (icon === 'hub') { // a program: a block with a recessed top and four port nubs
+ var hw = 6.4 * k, hh = 3.2 * k, hx = cx - hw / 2, hy = cy - hw / 2;
+ sh.push({ kind: 'box', at: [hx, hy, top], size: [hw, hw, hh], bevel: 0.7 * k });
+ sh.push({ kind: 'box', at: [cx - 1.4 * k, cy - 1.4 * k, top + hh], size: [2.8 * k, 2.8 * k, 0.9 * k], bevel: 0.3 });
+ ih = hh + 0.9 * k;
+ } else if (icon === 'core' && o.glass) { // a model in its own material: a glowing core inside a glass shell
+ var gw2 = 7.6 * k, gz = 6.4 * k, ic = 3.2 * k;
+ sh.push({ kind: 'box', at: [cx - ic / 2, cy - ic / 2, top + 0.6 * k], size: [ic, ic, ic], bevel: 0.3, lamp: true, tone: 'padFaces' });
+ sh.push({ kind: 'box', at: [cx - gw2 / 2, cy - gw2 / 2, top], size: [gw2, gw2, gz], glass: true });
+ ih = gz;
+ } else if (icon === 'core') { // an engine or a model: a cube with a raised core and edge lines
+ var cw = 7.6 * k, cz = 6.2 * k, ccx = cx - cw / 2, ccy = cy - cw / 2;
+ sh.push({ kind: 'box', at: [ccx, ccy, top], size: [cw, cw, cz], bevel: 0.9 * k });
+ for (var q = 1; q < 4; q++) sh.push({ kind: 'line', pts: [[ccx + cw, ccy + cw * q / 4, top + 0.8 * k], [ccx + cw, ccy + cw * q / 4, top + cz - 0.8 * k]], lw: 0.6 },
+ { kind: 'line', pts: [[ccx + cw * q / 4, ccy + cw, top + 0.8 * k], [ccx + cw * q / 4, ccy + cw, top + cz - 0.8 * k]], lw: 0.6 });
+ sh.push({ kind: 'cyl', at: [cx, cy, top + cz], r: 1.8 * k, h: 1.2 * k, cap: 0.55 });
+ ih = cz + 1.2 * k;
+ } else if (icon === 'gate') { // a checkpoint: two posts and a bar across them
+ var gw = 3.2 * k, gh = 4.6 * k;
+ sh.push({ kind: 'box', at: [cx - 0.6 * k, cy - gw - 0.6 * k, top], size: [1.2 * k, 1.2 * k, gh], bevel: 0 });
+ sh.push({ kind: 'box', at: [cx - 0.6 * k, cy + gw - 0.6 * k, top], size: [1.2 * k, 1.2 * k, gh], bevel: 0 });
+ sh.push({ kind: 'box', at: [cx - 0.35 * k, cy - gw, top + gh * 0.62], size: [0.7 * k, gw * 2, 0.9 * k], bevel: 0, tone: 'padFaces' });
+ sh.push({ kind: 'ball', at: [cx, cy - gw, top + gh + 0.8 * k], r: 0.8 * k, lamp: true });
+ ih = gh + 1.6 * k;
+ } else if (icon === 'files') { // a folder of documents: three sheets, fanned
+ for (var f = 0; f < 3; f++) sh.push({ kind: 'box', at: [cx - 2.6 * k + f * 0.7 * k, cy - 3.2 * k + f * 0.5 * k, top + f * 0.9 * k], size: [4.6 * k, 5.8 * k, 0.6 * k], bevel: 0 });
+ for (var fl = 0; fl < 3; fl++) sh.push({ kind: 'line', pts: [[cx - 1.2 * k, cy - 2 * k + fl * 1.2 * k, top + 2.4 * k], [cx + 1.6 * k, cy - 2 * k + fl * 1.2 * k, top + 2.4 * k]], lw: 0.7 });
+ ih = 2.4 * k;
+ } else if (icon === 'lamp') { // a status light on a small housing (the state tints the light)
+ sh.push({ kind: 'box', at: [cx - 2.4 * k, cy - 2.4 * k, top], size: [4.8 * k, 4.8 * k, 2.4 * k], bevel: 0.4 });
+ sh.push({ kind: 'ball', at: [cx, cy, top + 2.4 * k + 1.6 * k], r: 1.6 * k, lamp: true });
+ ih = 2.4 * k + 3.2 * k;
+ } else if (icon === 'tool') { // a small instrument block
+ sh.push({ kind: 'box', at: [cx - 1.9 * k, cy - 1.9 * k, top], size: [3.8 * k, 3.8 * k, 2.6 * k], bevel: 0.4 });
+ ih = 2.6 * k;
+ } else if (icon === 'server') {
+ for (var i = 0; i < 3; i++) sh.push({ kind: 'box', at: [cx - 2.4 * k, cy - 2.4 * k, top + i * 2.1 * k], size: [4.8 * k, 4.8 * k, 1.9 * k], bevel: 0.25 },
+ { kind: 'line', pts: [[cx + 2.4 * k, cy - 1.6 * k, top + i * 2.1 * k + 0.95 * k], [cx + 2.4 * k, cy + 0.4 * k, top + i * 2.1 * k + 0.95 * k]], lw: 0.8 });
+ ih = 6.3 * k;
+ } else {
+ var bw = 6.4 * k, bd = 5 * k, bh = icon === 'firm' ? 3.6 * k : 4.2 * k, x0 = cx - bw / 2, y0 = cy - bd / 2;
+ sh.push({ kind: 'box', at: [x0, y0, top], size: [bw, bd, bh], bevel: 0 });
+ if (icon === 'bank') {
+ for (var c = 0; c < 4; c++) sh.push({ kind: 'line', pts: [[x0 + 0.9 * k + c * 1.55 * k, y0 + bd, top + 0.3], [x0 + 0.9 * k + c * 1.55 * k, y0 + bd, top + bh - 0.6 * k]], lw: 0.9 });
+ sh.push({ kind: 'gable', at: [x0, y0, top + bh], size: [bw, bd, 1.8 * k], ridge: 'x' });
+ ih = bh + 1.8 * k;
+ } else if (icon === 'firm') {
+ sh.push({ kind: 'saw', at: [x0, y0, top + bh], size: [bw, bd, 1.6 * k], n: 3 });
+ sh.push({ kind: 'cyl', at: [x0 + bw * 0.78, y0 + bd * 0.25, top + bh], r: 0.6 * k, h: 3.4 * k });
+ ih = bh + 3.4 * k;
+ } else { // building, school, house: a gable roof (school: a door and a flag mast)
+ sh.push({ kind: 'gable', at: [x0, y0, top + bh], size: [bw, bd, 2.6 * k], ridge: 'x' });
+ sh.push({ kind: 'face', pts: [[x0 + bw * 0.42, y0 + bd, top], [x0 + bw * 0.58, y0 + bd, top], [x0 + bw * 0.58, y0 + bd, top + bh * 0.55], [x0 + bw * 0.42, y0 + bd, top + bh * 0.55]], tone: 'recess', lw: 0.7 });
+ if (icon === 'school') sh.push({ kind: 'line', pts: [[x0 + bw * 0.5, y0 + bd * 0.5, top + bh + 2.6 * k], [x0 + bw * 0.5, y0 + bd * 0.5, top + bh + 5 * k]], lw: 0.9, stroke: 'ink' },
+ { kind: 'face', pts: [[x0 + bw * 0.5, y0 + bd * 0.5, top + bh + 5 * k], [x0 + bw * 0.5 + 1.8 * k, y0 + bd * 0.5, top + bh + 4.4 * k], [x0 + bw * 0.5, y0 + bd * 0.5, top + bh + 3.8 * k]], tone: 'flag', lw: 0.7 });
+ ih = bh + (icon === 'school' ? 5 * k : 2.6 * k);
+ }
+ }
+ var seats = [], ports = { top: { at: [cx, cy, top + ih], face: 'top' }, center: { at: [cx, cy, top], face: 'top' },
+ 'x+': { at: [cx + r, cy, z0 + ph / 2], face: 'x+' }, 'x-': { at: [cx - r, cy, z0 + ph / 2], face: 'x-' },
+ 'y+': { at: [cx, cy + r, z0 + ph / 2], face: 'y+' }, 'y-': { at: [cx, cy - r, z0 + ph / 2], face: 'y-' } };
+ var sw = o.seatSize || 2.8;
+ if (o.seats) { // capacity: seat tiles in a row beside the node (seatSide y+ or x+), each a slot tokens rest in
+ var n = o.seats, gap = 0.9, row = n * sw + (n - 1) * gap, alongX = (o.seatSide || 'y+') === 'y+';
+ for (var j = 0; j < n; j++) {
+ var sa = alongX ? [cx - row / 2 + j * (sw + gap), cy + r + 1.4, z0] : [cx + r + 1.4, cy - row / 2 + j * (sw + gap), z0];
+ sh.push({ kind: 'box', at: sa, size: [sw, sw, 0.5], tone: 'padFaces', bevel: 0 });
+ seats.push([sa[0] + sw / 2, sa[1] + sw / 2, z0 + 0.5]);
+ ports['seat' + (j + 1)] = { at: seats[j], face: 'top' };
+ }
+ }
+ var ext = o.seats ? r + 1.4 + sw : r, sx2 = o.seats && o.seatSide === 'x+' ? ext : r, sy2 = o.seats && o.seatSide !== 'x+' ? ext : r;
+ return { shapes: sh, bbox: [[cx - r, cy - r, z0], [cx + sx2, cy + sy2, top + ih]], anchor: [cx, cy, top + ih], footprint: [cx - r, cy - r, r * 2, r * 2], ports: ports, seats: seats };
+ },
+ store: function (o) { // a pool or reservoir: an open tray whose level is keyed in time (fill: [[t, 0..1], ...])
+ var a = o.at, s = o.size || [12, 8, 3];
+ return { shapes: [{ kind: 'tray', at: a, size: s, fill: o.fill, tone: o.tone || 'cold' }],
+ bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + s[2]]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + s[2]],
+ footprint: [a[0], a[1], s[0], s[1]], ports: boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]) };
+ },
+ stack: function (o) { // a store that grows: cells stacked up, count keyed in time ([[t, n], ...])
+ var a = o.at, s = o.size || [8, 8], ch = o.cell || 1.1, gap = o.gap == null ? 0.35 : o.gap, n = o.max || 8, cells = [], ports = {};
+ for (var i = 0; i < n; i++) { var z = a[2] + i * (ch + gap); cells.push({ kind: 'cell', at: [a[0], a[1], z], size: [s[0], s[1], ch], i: i, count: o.count, tone: o.tone }); ports['cell' + (i + 1)] = { at: [a[0] + s[0] / 2, a[1] + s[1] / 2, z + ch], face: 'top' }; }
+ var hgt = n * (ch + gap);
+ Object.assign(ports, boxPorts(a[0], a[1], a[2], s[0], s[1], hgt));
+ return { shapes: [{ kind: 'box', at: [a[0] - 0.8, a[1] - 0.8, a[2] - 0.5], size: [s[0] + 1.6, s[1] + 1.6, 0.5], tone: 'padFaces', bevel: 0 }].concat(cells),
+ bbox: [[a[0] - 0.8, a[1] - 0.8, a[2] - 0.5], [a[0] + s[0] + 0.8, a[1] + s[1] + 0.8, a[2] + hgt]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + hgt * 0.5],
+ footprint: [a[0] - 0.8, a[1] - 0.8, s[0] + 1.6, s[1] + 1.6], ports: ports };
+ },
+ queue: function (o) { // a line of n slots along x (or y): tokens wait in them
+ var a = o.at, n = o.n || 5, sw = o.slot || 2.8, gap = o.gap == null ? 0.8 : o.gap, along = o.along || 'x', sh = [], slots = [], ports = {};
+ for (var i = 0; i < n; i++) {
+ var off = i * (sw + gap), at = along === 'x' ? [a[0] + off, a[1], a[2]] : [a[0], a[1] + off, a[2]];
+ sh.push({ kind: 'box', at: at, size: [sw, sw, 0.6], tone: 'padFaces', bevel: 0 });
+ slots.push([at[0] + sw / 2, at[1] + sw / 2, at[2] + 0.6]); ports['slot' + (i + 1)] = { at: slots[i], face: 'top' };
+ }
+ var len = n * sw + (n - 1) * gap, s = along === 'x' ? [len, sw, 0.6] : [sw, len, 0.6];
+ Object.assign(ports, boxPorts(a[0], a[1], a[2], s[0], s[1], s[2]));
+ return { shapes: sh, bbox: [a, [a[0] + s[0], a[1] + s[1], a[2] + 0.6]], anchor: [a[0] + s[0] / 2, a[1] + s[1] / 2, a[2] + 0.6], ports: ports, seats: slots, footprint: [a[0], a[1], s[0], s[1]] };
+ },
+ };
+
+ /* ------------------------------------------------------------------ helpers on boxes and screen shapes */
+ function hull(pts) { // monotone chain
+ var p = pts.slice().sort(function (a, b) { return a[0] - b[0] || a[1] - b[1]; });
+ if (p.length < 3) return p;
+ var cross = function (o, a, b) { return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]); };
+ var lo = [], up = [], i;
+ for (i = 0; i < p.length; i++) { while (lo.length >= 2 && cross(lo[lo.length - 2], lo[lo.length - 1], p[i]) <= 0) lo.pop(); lo.push(p[i]); }
+ for (i = p.length - 1; i >= 0; i--) { while (up.length >= 2 && cross(up[up.length - 2], up[up.length - 1], p[i]) <= 0) up.pop(); up.push(p[i]); }
+ up.pop(); lo.pop(); return lo.concat(up);
+ }
+ function inPoly(x, y, poly) {
+ var inside = false;
+ for (var i = 0, j = poly.length - 1; i < poly.length; j = i++) {
+ var xi = poly[i][0], yi = poly[i][1], xj = poly[j][0], yj = poly[j][1];
+ if (((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi)) inside = !inside;
+ }
+ return inside;
+ }
+ function rectOverlap(a, b) { // fraction of a covered by b ({x,y,w,h})
+ var w = Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x), h = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);
+ return w > 0 && h > 0 ? (w * h) / (a.w * a.h) : 0;
+ }
+ function segHitsRect(p, q, r) { // sampled: enough for a leader against a label plate
+ for (var i = 1; i < 12; i++) { var x = lerp(p[0], q[0], i / 12), y = lerp(p[1], q[1], i / 12); if (x > r.x && x < r.x + r.w && y > r.y && y < r.y + r.h) return true; }
+ return false;
+ }
+
+ /* ------------------------------------------------------------------ validation */
+ function validate(spec) {
+ var errs = [], ids = {};
+ if (!spec || typeof spec !== 'object') return ['the scene is not an object (window.SCENE = {...})'];
+ if (!spec.world || !Array.isArray(spec.world.origin) || !(spec.world.scale > 0)) errs.push('world needs {scale: > 0, origin: [x, y]}');
+ (spec.items || []).forEach(function (it, i) {
+ var where = 'items[' + i + ']' + (it && it.id ? ' "' + it.id + '"' : '');
+ if (!it || typeof it !== 'object') { errs.push(where + ' is not an object'); return; }
+ if (it.id) { if (ids[it.id]) errs.push(where + ': duplicate id'); ids[it.id] = it; }
+ if (it.part && !LIB[it.part]) errs.push(where + ': unknown part "' + it.part + '" (known: ' + Object.keys(LIB).join(', ') + ')');
+ if (it.part && !Array.isArray(it.at)) errs.push(where + ': a part needs at: [x, y, z]');
+ if ((it.kind === 'pipe' || it.kind === 'link') && !it.path && !(it.from && it.to)) errs.push(where + ': a ' + it.kind + ' needs path: [[x,y,z], ...] or from/to ports');
+ if (!it.part && !it.kind && !it.shapes) errs.push(where + ': needs part, kind or shapes');
+ });
+ var portOk = function (ref, where) {
+ if (Array.isArray(ref)) return;
+ var m = String(ref).split('.'), it = ids[m[0]];
+ if (!it) errs.push(where + ': unknown part "' + m[0] + '"');
+ };
+ (spec.items || []).forEach(function (it, i) {
+ if (it && (it.kind === 'pipe' || it.kind === 'link') && it.from) { portOk(it.from, 'items[' + i + '].from'); portOk(it.to, 'items[' + i + '].to'); }
+ });
+ flowsOf(spec).forEach(function (f, i) {
+ (f.path || []).forEach(function (e) { if (e.pipe && !(ids[e.pipe] && (ids[e.pipe].kind === 'pipe' || ids[e.pipe].kind === 'link'))) errs.push('flows[' + i + ']: unknown pipe "' + e.pipe + '"'); });
+ if (!(f.at >= 0) && f.at !== 0) errs.push('flows[' + i + ']: at must be a time in seconds');
+ });
+ (spec.labels || []).forEach(function (lb, i) {
+ if (!lb.anchor && !(lb.for && ids[lb.for])) errs.push('labels[' + i + ']' + (lb.title ? ' "' + lb.title + '"' : '') + ': needs anchor: [x,y,z] or for: a part id' + (lb.for ? ' ("' + lb.for + '" is not one)' : ''));
+ if (typeof lb.at !== 'number') errs.push('labels[' + i + ']: at must be a number of seconds');
+ });
+ (spec.tags || []).forEach(function (tg, i) {
+ if (tg.pipe && !ids[tg.pipe]) errs.push('tags[' + i + ']: unknown pipe "' + tg.pipe + '"');
+ if (tg.for && !ids[tg.for]) errs.push('tags[' + i + ']: unknown part "' + tg.for + '"');
+ if (!tg.pipe && !tg.for && !tg.anchor && !tg.token) errs.push('tags[' + i + ']: needs pipe, for, anchor or token');
+ });
+ focusesOf(spec).forEach(function (fc, i) { if (!ids[fc.part]) errs.push('focus[' + i + ']: unknown part "' + fc.part + '"'); });
+ (spec.camera || []).forEach(function (k, i) { if (typeof k.focus === 'string' && !ids[k.focus]) errs.push('camera[' + i + ']: unknown part "' + k.focus + '"'); });
+ (spec.tokens || []).forEach(function (tk, i) {
+ (tk.moves || []).forEach(function (mv, j) { if (mv.along && !ids[mv.along]) errs.push('tokens[' + i + '].moves[' + j + ']: unknown link "' + mv.along + '"'); });
+ });
+ return errs;
+ }
+ function flowsOf(spec) {
+ if (spec.flows) return spec.flows;
+ return spec.flow ? [Object.assign({ id: 'flow' }, spec.flow, { path: spec.flow.path || spec.flow.loop })] : [];
+ }
+ function focusesOf(spec) { return !spec.focus ? [] : Array.isArray(spec.focus) ? spec.focus : [spec.focus]; }
+
+ /* ------------------------------------------------------------------ mount */
+ function mount(spec, opts) {
+ opts = opts || {};
+ // live mode (Diagram.live): the page runs its own clock and writes keys at the moment the viewer acts (set, fire,
+ // focus); everything is still drawn as a pure function of that clock. A film mount never takes these paths.
+ var LIVE = opts.live ? (opts.live === true ? {} : opts.live) : null;
+ var liveLevels = {};
+ var themeName = opts.theme || spec.theme || (document.documentElement.getAttribute('data-theme')) || 'light';
+ var L = Object.assign({}, THEMES[themeName] || THEMES.light, opts.look || {});
+ if (!THEMES[themeName]) warn('unknown theme "' + themeName + '" (light or dark): using light');
+ var problems = validate(spec);
+ problems.forEach(warn);
+ if (!spec.world || !Array.isArray(spec.world.origin) || !(spec.world.scale > 0)) return null;
+ var S = spec.world.scale, O = spec.world.origin;
+ var P = function (x, y, z) { return [O[0] + (x - y) * C * S, O[1] + (x + y) * 0.5 * S - (z || 0) * S]; };
+ var V = function (dx, dy, dz) { return [(dx - dy) * C * S, (dx + dy) * 0.5 * S - (dz || 0) * S]; }; // a world offset on screen
+ var pts = function (a) { return a.map(function (p) { return f1(p[0]) + ',' + f1(p[1]); }).join(' '); };
+ var dpath = function (a) { return 'M' + a.map(function (p) { return f1(p[0]) + ' ' + f1(p[1]); }).join('L'); };
+ var clip = (spec.clip || [45, 45, 1830, 990]).map(function (v) { return Number(v) || 0; });
+ // labels stay inside [x0, y0, x1, y1]; never looser than the text-safe zone the renderer fades text out of
+ var safe = (function (a) { return [Math.max(a[0], 64), Math.max(a[1], 58), Math.min(a[2], 1856), Math.min(a[3], 990)]; })(spec.safe || [100, 92, 1820, 990]);
+
+ /* ---- the page's words from the scene (spec.page), so one scene file carries its own title block ---- */
+ if (spec.page) {
+ var put = function (sel, text, html) { var e = document.querySelector(sel); if (!e || text == null) return; if (html) e.innerHTML = html; else e.textContent = text; };
+ var pg = spec.page, k = pg.kicker != null ? String(pg.kicker).split(' · ') : null;
+ if (k) put('.ld-kicker', pg.kicker, k.length > 1 ? '<b>' + esc(k[0]) + '</b> &nbsp;·&nbsp; ' + esc(k.slice(1).join(' · ')) : null);
+ put('.ld-figno', pg.figno);
+ if (pg.title != null) put('.ld-title', pg.title, esc(pg.title).replace(/\*([^*]+)\*/g, '<em>$1</em>'));
+ put('.ld-dek', pg.dek);
+ put('.ld-foot.l', pg.footL);
+ var sh = document.querySelector('.ld-steps');
+ if (sh && pg.steps) { // where the beat lines sit: {at: [x, y], width} in design px (default under the dek)
+ if (pg.steps.at) { sh.style.left = pg.steps.at[0] + 'px'; sh.style.top = pg.steps.at[1] + 'px'; }
+ if (pg.steps.width) sh.style.width = pg.steps.width + 'px';
+ }
+ if (pg.footR != null) { var fr = String(pg.footR).split(' · '); put('.ld-foot.r', pg.footR, fr.length > 1 ? '<span class="k">' + esc(fr[0]) + ' ·</span> ' + esc(fr.slice(1).join(' · ')) : null); }
+ }
+
+ /* ---- items: expand library parts, index by id ---- */
+ var items = [], byId = {};
+ (spec.items || []).forEach(function (raw, i) {
+ if (!raw || (raw.part && !LIB[raw.part])) return;
+ var it = Object.assign({}, raw);
+ it._i = i;
+ if (LIVE && it.id && (it.part === 'store' || it.part === 'stack')) { // live: its own keys, which set() rewrites
+ var key = it.part === 'store' ? 'fill' : 'count', v0 = it[key];
+ it[key] = Array.isArray(v0) ? v0.map(function (k) { return k.slice(); }) : [[-1e9, typeof v0 === 'number' ? v0 : 0]];
+ liveLevels[it.id] = { keys: it[key], stack: it.part === 'stack' };
+ }
+ if (it.part) {
+ var g = LIB[it.part](it);
+ it.shapes = (g.shapes || []).concat(it.shapes || []);
+ it.bbox = it.bbox || g.bbox; it.anchor = it.anchor || g.anchor; it.footprint = it.footprint === false ? null : (it.footprint || g.footprint);
+ var rel = {};
+ Object.keys(it.ports || {}).forEach(function (k) { // custom ports: relative to at
+ var pv = it.ports[k], at = Array.isArray(pv) ? pv : pv.at;
+ rel[k] = { at: [it.at[0] + at[0], it.at[1] + at[1], (it.at[2] || 0) + at[2]], face: (pv && pv.face) || 'top' };
+ });
+ it.ports = Object.assign({}, g.ports || {}, rel);
+ it.seats = g.seats || [];
+ it.layer = it.layer || g.layer;
+ }
+ if (!it.kind) it.kind = 'solid';
+ if (it.kind === 'solid' && !it.bbox) it.bbox = shapesBBox(it.shapes || []);
+ items.push(it);
+ if (it.id) byId[it.id] = it;
+ });
+ function shapesBBox(shapes) {
+ var lo = [Infinity, Infinity, Infinity], hi = [-Infinity, -Infinity, -Infinity];
+ var add = function (p) { for (var k = 0; k < 3; k++) { lo[k] = Math.min(lo[k], p[k] || 0); hi[k] = Math.max(hi[k], p[k] || 0); } };
+ shapes.forEach(function (s) {
+ if (s.kind === 'box' || s.kind === 'plate' || s.kind === 'tray' || s.kind === 'gable' || s.kind === 'saw') { add(s.at); add([s.at[0] + s.size[0], s.at[1] + s.size[1], s.at[2] + (s.size[2] || 0)]); }
+ else if (s.kind === 'cyl' || s.kind === 'ball') { var r = s.r; add([s.at[0] - r, s.at[1] - r, s.at[2] - (s.kind === 'ball' ? r : 0)]); add([s.at[0] + r, s.at[1] + r, s.at[2] + (s.h || r) + (s.dome || 0)]); }
+ else if (s.pts) s.pts.forEach(add);
+ else if (s.at) add(s.at);
+ });
+ return isFinite(lo[0]) ? [lo, hi] : null;
+ }
+ function portOf(ref) { // 'part.port' | 'part' (its anchor) | [x,y,z] -> {at, face, part}
+ if (Array.isArray(ref)) return { at: ref, face: null, part: null };
+ var m = String(ref).split('.'), it = byId[m[0]];
+ if (!it) return { at: [0, 0, 0], face: null, part: null };
+ var name = m.slice(1).join('.');
+ if (!name) return { at: it.anchor || [0, 0, 0], face: null, part: it };
+ var p = it.ports && it.ports[name];
+ if (!p) { warn('part "' + m[0] + '" has no port "' + name + '" (ports: ' + Object.keys(it.ports || {}).join(', ') + ')'); return { at: it.anchor || [0, 0, 0], face: null, part: it }; }
+ return { at: p.at, face: p.face, part: it };
+ }
+ var NORMAL = { 'x+': [1, 0, 0], 'x-': [-1, 0, 0], 'y+': [0, 1, 0], 'y-': [0, -1, 0], top: [0, 0, 1], bottom: [0, 0, -1] };
+ function manhattan(a, b, order) { // from a to b moving one axis at a time, in `order` ('xyz', 'zx', ...)
+ var out = [], cur = a.slice();
+ (order || 'xyz').split('').forEach(function (ax) {
+ var k = { x: 0, y: 1, z: 2 }[ax]; if (k == null || Math.abs(cur[k] - b[k]) < 1e-6) return;
+ cur = cur.slice(); cur[k] = b[k]; out.push(cur);
+ });
+ if (!out.length || out[out.length - 1].some(function (v, k) { return Math.abs(v - b[k]) > 1e-6; })) out.push(b.slice());
+ return out;
+ }
+ /* ---- pipes and links: rounded 3D polylines, routed between ports ---- */
+ var pipes = {};
+ items.forEach(function (it) {
+ if (it.kind !== 'pipe' && it.kind !== 'link') return;
+ var path = it.path, fromP = null, toP = null;
+ if (!path) {
+ fromP = portOf(it.from); toP = portOf(it.to);
+ var stub = it.stub == null ? (it.kind === 'link' ? 0 : 1.6) : it.stub;
+ var a = fromP.at.slice(), b = toP.at.slice(), path3 = [a];
+ var na = fromP.face && NORMAL[fromP.face], nb = toP.face && NORMAL[toP.face];
+ var a1 = na && stub ? a.map(function (v, k) { return v + na[k] * stub; }) : a;
+ var b1 = nb && stub ? b.map(function (v, k) { return v + nb[k] * stub; }) : b;
+ if (a1 !== a) path3.push(a1);
+ var mids = [a1].concat((it.via || []).map(function (v) { return Array.isArray(v) ? v : portOf(v).at; })).concat([b1]);
+ for (var i = 1; i < mids.length; i++) path3 = path3.concat(it.kind === 'link' && !it.route ? [mids[i]] : manhattan(mids[i - 1], mids[i], it.route));
+ if (b1 !== b) path3.push(b);
+ path = path3.filter(function (p, k) { return k === 0 || Math.hypot(p[0] - path3[k - 1][0], p[1] - path3[k - 1][1], p[2] - path3[k - 1][2]) > 1e-6; });
+ it.path = path;
+ if (it.ends == null && it.kind === 'pipe') it.ends = ['start', 'end'];
+ }
+ if (it.arc && path.length === 2) { // a link that arcs over the floor: a raised quadratic curve
+ var p0 = path[0], p1 = path[1], mid = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2, (p0[2] + p1[2]) / 2 + it.arc], q = [];
+ for (var j = 0; j <= 24; j++) { var u = j / 24; q.push([0, 1, 2].map(function (k) { return (1 - u) * (1 - u) * p0[k] + 2 * (1 - u) * u * mid[k] + u * u * p1[k]; })); }
+ path = q;
+ }
+ var r3 = it.arc ? path : roundPath(path, it.bend == null ? 2.4 : it.bend), scr = r3.map(function (p) { return P(p[0], p[1], p[2]); }), cum = measure(scr);
+ pipes[it.id] = { it: it, p3: r3, scr: scr, cum: cum, len: cum[cum.length - 1], from: fromP, to: toP };
+ var w = (it.w || (it.kind === 'link' ? 4 : 11)) / S / 2;
+ var lo = [Infinity, Infinity, Infinity], hi = [-Infinity, -Infinity, -Infinity];
+ path.forEach(function (p) { for (var k = 0; k < 3; k++) { lo[k] = Math.min(lo[k], p[k] - w); hi[k] = Math.max(hi[k], p[k] + w); } });
+ it.bbox = [lo, hi];
+ if (it.kind === 'link' && !it.layer && Math.max(Math.abs(lo[2]), Math.abs(hi[2])) < 1.2 && !it.arc) it.layer = 'floor';
+ });
+ function roundPath(p3, r) {
+ var out = [p3[0]];
+ for (var i = 1; i < p3.length - 1; i++) {
+ var a = p3[i - 1], b = p3[i], c = p3[i + 1];
+ var v1 = b.map(function (x, k) { return x - a[k]; }), v2 = c.map(function (x, k) { return x - b[k]; });
+ var l1 = Math.hypot(v1[0], v1[1], v1[2]), l2 = Math.hypot(v2[0], v2[1], v2[2]), rr = Math.min(r, l1 / 2, l2 / 2);
+ var s0 = b.map(function (x, k) { return x - (v1[k] / l1) * rr; }), s1 = b.map(function (x, k) { return x + (v2[k] / l2) * rr; });
+ for (var j = 0; j <= 8; j++) { var q = j / 8; out.push(s0.map(function (x, k) { return (1 - q) * (1 - q) * x + 2 * (1 - q) * q * b[k] + q * q * s1[k]; })); }
+ }
+ out.push(p3[p3.length - 1]);
+ return out;
+ }
+ function measure(scr) { var cum = [0]; for (var i = 1; i < scr.length; i++) cum.push(cum[i - 1] + Math.hypot(scr[i][0] - scr[i - 1][0], scr[i][1] - scr[i - 1][1])); return cum; }
+ function atLen(pp, s) { // point + tangent at arc length s (screen px)
+ var c = pp.cum, i = 1; while (i < c.length - 1 && c[i] < s) i++;
+ var q = clamp((s - c[i - 1]) / (c[i] - c[i - 1] || 1), 0, 1), a = pp.scr[i - 1], b = pp.scr[i];
+ return { x: lerp(a[0], b[0], q), y: lerp(a[1], b[1], q), ang: Math.atan2(b[1] - a[1], b[0] - a[0]), w3: pp.p3[i - 1].map(function (v, k) { return lerp(v, pp.p3[i][k], q); }) };
+ }
+ function trimmed(pp, s0, s1) { var out = [], a = atLen(pp, s0); out.push([a.x, a.y]); for (var i = 0; i < pp.scr.length; i++) if (pp.cum[i] > s0 && pp.cum[i] < s1) out.push(pp.scr[i]); var e = atLen(pp, s1); out.push([e.x, e.y]); return out; }
+
+ /* ---- flows: one arc length over pipes and the bodies (gaps) between them ---- */
+ var flows = flowsOf(spec).map(function (f) {
+ var segs = [], len = 0;
+ (f.path || []).forEach(function (e) { var l = e.pipe ? (pipes[e.pipe] ? pipes[e.pipe].len : 0) : (e.gap || 0); segs.push(Object.assign({}, e, { s0: len, len: l })); len += l; });
+ return Object.assign({ speed: 150, spacing: 34, dash: 14, loop: true }, f, { segs: segs, len: len });
+ });
+ var flowOn = {}; // pipe id -> [{flow, seg}]
+ flows.forEach(function (f) { f.segs.forEach(function (s) { if (s.pipe) (flowOn[s.pipe] = flowOn[s.pipe] || []).push({ f: f, s: s }); }); });
+
+ /* ---- tones over time: a pipe or part starts neutral and takes its tone when its flow starts; states change it ---- */
+ var states = (spec.states || []).slice().sort(function (a, b) { return a.at - b.at; });
+ function toneAt(id, t, base, start) { // -> {from, to, p}: lerp target names
+ var cur = null, prev = null, p = 1;
+ if (start != null) { cur = base; prev = null; p = seg(t, start, 0.6, E.inOutSine); }
+ states.forEach(function (st) {
+ if (st.target !== id || t < st.at) return;
+ prev = cur; cur = st.tone; p = seg(t, st.at, st.dur == null ? 0.6 : st.dur, E.inOutSine);
+ });
+ return { from: prev, to: cur, p: p };
+ }
+ var pulses = states.filter(function (st) { return st.pulse; });
+ states = states.filter(function (st) { return !st.pulse; });
+ function pulseAt(id, t) { // -> {c, p}: the strongest pulse on this item now
+ var best = null;
+ pulses.forEach(function (st) {
+ if (st.target !== id || t < st.at) return;
+ var d = st.dur == null ? 0.6 : st.dur, p = Math.sin(Math.PI * seg(t, st.at, d));
+ if (p > 0 && (!best || p > best.p)) best = { c: toneOf(L, st.tone || 'cold').flow, p: p * (st.amount == null ? 0.3 : st.amount) };
+ });
+ return best;
+ }
+ function tintOf(tn, key, neutral) {
+ var a = tn.from ? toneOf(L, tn.from)[key] : neutral, b = tn.to ? toneOf(L, tn.to)[key] : neutral;
+ return mixHex(a, b, tn.p);
+ }
+
+ /* ---- focus windows and the text fade they drive ---- */
+ var focuses = focusesOf(spec).map(function (fc) { return Object.assign({ dur: 0.7, out: 0.7, until: Infinity, with: [] }, fc); });
+ function focusAt(t) { // the strongest window now: {amount, fc}
+ var best = { amount: 0, fc: null };
+ focuses.forEach(function (fc) {
+ var a = seg(t, fc.at, fc.dur, E.inOutSine) * (1 - seg(t, fc.until, fc.out, E.inOutSine));
+ if (a > best.amount) best = { amount: a, fc: fc };
+ });
+ return best;
+ }
+ function inFocus(fc, id) { return !!fc && (fc.part === id || fc.with.indexOf(id) >= 0); }
+ function textHide(t, ids, always) { // how hidden a non-focus text is: 0.2 s ramps at focus in and out
+ if (always) return 0;
+ var h = 0;
+ focuses.forEach(function (fc) {
+ if (ids.some(function (id) { return inFocus(fc, id); })) return;
+ var a = seg(t, fc.at, TEXT_FADE) * (1 - seg(t, fc.until + fc.out * 0.6, TEXT_FADE));
+ h = Math.max(h, a);
+ });
+ return h;
+ }
+
+ /* ---- explode: part offsets keyed in t ---- */
+ var explodes = (spec.explode ? (Array.isArray(spec.explode) ? spec.explode : [spec.explode]) : []).map(function (x) { return Object.assign({ dur: 1 }, x); });
+ function offsetOf(id, t) {
+ var o = [0, 0, 0];
+ explodes.forEach(function (x) {
+ var v = x.offsets && x.offsets[id]; if (!v) return;
+ var p = seg(t, x.at, x.dur, E.inOutCubic) * (x.back != null ? 1 - seg(t, x.back, x.dur, E.inOutCubic) : 1);
+ for (var k = 0; k < 3; k++) o[k] += (v[k] || 0) * p;
+ });
+ return o;
+ }
+
+ /* ---- depth: a topological sort of the solids and pipes ---- */
+ var BACK = { 'x-': 1, 'y-': 1, bottom: 1 }, cycleMsg = null;
+ function sortDepth() {
+ var list = items.filter(function (it) { return it.layer !== 'floor' && it.layer !== 'front' && it.kind !== 'floortext' && it.kind !== 'air'; });
+ var n = list.length, idx = new Map(), edges = list.map(function () { return []; }), indeg = list.map(function () { return 0; }), eps = 0.05;
+ list.forEach(function (it, i) { idx.set(it, i); });
+ var addEdge = function (a, b) { if (a === b || a == null || b == null) return; if (edges[a].indexOf(b) >= 0) return; edges[a].push(b); indeg[b]++; };
+ var behind = function (A, B) { // A entirely on the far side of B along some axis (the viewer is at +x +y +z)
+ if (!A.bbox || !B.bbox) return false;
+ for (var k = 0; k < 3; k++) if (A.bbox[1][k] <= B.bbox[0][k] + eps) return true;
+ return false;
+ };
+ for (var i = 0; i < n; i++) for (var j = 0; j < n; j++) {
+ if (i === j) continue;
+ var A = list[i], B = list[j];
+ if (behind(A, B) && !behind(B, A)) addEdge(i, j);
+ }
+ list.forEach(function (it, i) { // pipes on a part's back face go behind it, on a front face in front of it
+ var pp = pipes[it.id]; if (!pp) return;
+ [pp.from, pp.to].forEach(function (end) {
+ if (!end || !end.part || !idx.has(end.part)) return;
+ var j = idx.get(end.part);
+ if (BACK[end.face]) { removeEdge(j, i); addEdge(i, j); } else if (end.face) { removeEdge(i, j); addEdge(j, i); }
+ });
+ });
+ list.forEach(function (it, i) { // explicit escape hatches
+ (it.behind || []).forEach(function (id) { if (byId[id] && idx.has(byId[id])) { removeEdge(idx.get(byId[id]), i); addEdge(i, idx.get(byId[id])); } });
+ (it.front || []).forEach(function (id) { if (byId[id] && idx.has(byId[id])) { removeEdge(i, idx.get(byId[id])); addEdge(idx.get(byId[id]), i); } });
+ });
+ function removeEdge(a, b) { var k = edges[a].indexOf(b); if (k >= 0) { edges[a].splice(k, 1); indeg[b]--; } }
+ var key = function (it) { var b = it.bbox; return b ? (b[0][0] + b[1][0] + b[0][1] + b[1][1]) / 2 + (b[0][2] + b[1][2]) / 4 : 0; };
+ var out = [], done = list.map(function () { return false; }), cycles = 0;
+ while (out.length < n) {
+ var pick = -1;
+ for (var a = 0; a < n; a++) if (!done[a] && indeg[a] === 0 && (pick < 0 || (list[a].order || 0) < (list[pick].order || 0) || ((list[a].order || 0) === (list[pick].order || 0) && key(list[a]) < key(list[pick]) - 1e-9))) pick = a;
+ if (pick < 0) { // a cycle: break it at the farthest remaining item
+ cycles++;
+ for (var b2 = 0; b2 < n; b2++) if (!done[b2] && (pick < 0 || key(list[b2]) < key(list[pick]))) pick = b2;
+ }
+ done[pick] = true; out.push(list[pick]);
+ edges[pick].forEach(function (b) { indeg[b]--; });
+ }
+ if (cycles) { cycleMsg = 'depth order has ' + cycles + ' cycle(s) (overlapping parts); give an item behind: [ids] or front: [ids] to settle it'; warn(cycleMsg); }
+ return out;
+ }
+ var sorted = spec.depth === 'list' ? items.filter(function (it) { return it.layer !== 'floor' && it.layer !== 'front' && it.kind !== 'floortext' && it.kind !== 'air'; }) : sortDepth();
+ var floorItems = items.filter(function (it) { return it.layer === 'floor' && it.kind !== 'floortext'; });
+ var frontItems = items.filter(function (it) { return (it.layer === 'front' || it.kind === 'air') && it.kind !== 'floortext'; });
+
+ /* ---------- drawing (all return SVG strings in zoom-1 screen px) ---------- */
+ function poly(a, fill, lw, stroke, extra) {
+ return '<polygon points="' + pts(a) + '" fill="' + fill + '" stroke="' + (stroke || L.ink) + '" stroke-width="' + f3(lw) + '" stroke-linejoin="round" ' + (extra || '') + '/>';
+ }
+ function line(a, lw, stroke, extra) {
+ return '<path d="' + dpath(a) + '" fill="none" stroke="' + stroke + '" stroke-width="' + f3(lw) + '" stroke-linecap="round" stroke-linejoin="round" ' + (extra || '') + '/>';
+ }
+ function faceTone(name) { return (name && L[name]) || L.faces; }
+ function glassBox(b, lw, tint) { // a different material: translucent faces, the hidden edges show through
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], x1 = x0 + b.size[0], y1 = y0 + b.size[1], z1 = z0 + b.size[2], G = L.glass, gl = L.glassLine, op = 'fill-opacity="' + L.glassOpacity + '"';
+ var m = function (c) { return tint ? mixHex(c, tint.c, tint.p * 0.6) : c; }, s = '';
+ s += line([P(x0, y0, z0), P(x1, y0, z0)], lw * 0.7, gl, 'stroke-opacity="0.45"') + line([P(x0, y0, z0), P(x0, y1, z0)], lw * 0.7, gl, 'stroke-opacity="0.45"') + line([P(x0, y0, z0), P(x0, y0, z1)], lw * 0.7, gl, 'stroke-opacity="0.45"');
+ var f = poly([P(x1, y0, z0), P(x1, y1, z0), P(x1, y1, z1), P(x1, y0, z1)], m(G.right), lw, gl, op);
+ f += poly([P(x0, y1, z0), P(x1, y1, z0), P(x1, y1, z1), P(x0, y1, z1)], m(G.left), lw, gl, op);
+ f += poly([P(x0, y0, z1), P(x1, y0, z1), P(x1, y1, z1), P(x0, y1, z1)], m(G.top), lw, gl, op);
+ return s + (L.glassGlow ? '<g filter="url(#ld-glowsoft)">' + f + '</g>' : f);
+ }
+ function box(b, lw, tone, tint) {
+ if (b.glass) return glassBox(b, lw, tint);
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], w = b.size[0], d = b.size[1], h = b.size[2], x1 = x0 + w, y1 = y0 + d, z1 = z0 + h;
+ var T = faceTone(tone), m = function (c) { return tint ? mixHex(c, tint.c, tint.p) : c; }, s = '';
+ s += poly([P(x1, y0, z0), P(x1, y1, z0), P(x1, y1, z1), P(x1, y0, z1)], m(T.right), lw);
+ s += poly([P(x0, y1, z0), P(x1, y1, z0), P(x1, y1, z1), P(x0, y1, z1)], m(T.left), lw);
+ s += poly([P(x0, y0, z1), P(x1, y0, z1), P(x1, y1, z1), P(x0, y1, z1)], m(T.top), lw);
+ if (b.bevel) { var k = b.bevel; s += poly([P(x0 + k, y0 + k, z1), P(x1 - k, y0 + k, z1), P(x1 - k, y1 - k, z1), P(x0 + k, y1 - k, z1)], 'none', lw * 0.6, L.detail); }
+ return s;
+ }
+ function cyl(c, lw, tint) {
+ var cx = c.at[0], cy = c.at[1], z0 = c.at[2], r = c.r, h = c.h, rx = 1.2247 * r * S, ry = 0.7071 * r * S;
+ var B = P(cx, cy, z0), T = P(cx, cy, z0 + h);
+ var body = c.flat ? (tint ? mixHex(L.padFaces.left, tint.c, tint.p) : L.padFaces.left) : 'url(#ld-cyl)';
+ var s = '<path d="M' + f1(T[0] - rx) + ' ' + f1(T[1]) + 'L' + f1(B[0] - rx) + ' ' + f1(B[1]) + 'A' + f1(rx) + ' ' + f1(ry) + ' 0 0 0 ' + f1(B[0] + rx) + ' ' + f1(B[1]) + 'L' + f1(T[0] + rx) + ' ' + f1(T[1]) + 'Z" fill="' + body + '" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '" stroke-linejoin="round"/>';
+ (c.bands || []).forEach(function (bz) { var Q = P(cx, cy, z0 + bz); s += '<path d="M' + f1(Q[0] - rx) + ' ' + f1(Q[1]) + 'A' + f1(rx) + ' ' + f1(ry) + ' 0 0 0 ' + f1(Q[0] + rx) + ' ' + f1(Q[1]) + '" fill="none" stroke="' + L.detail + '" stroke-width="' + f3(lw * 0.6) + '"/>'; });
+ if (c.dome) {
+ var dh = c.dome * S;
+ s += '<path d="M' + f1(T[0] - rx) + ' ' + f1(T[1]) + 'A' + f1(rx) + ' ' + f1(dh + ry * 0.2) + ' 0 0 1 ' + f1(T[0] + rx) + ' ' + f1(T[1]) + 'A' + f1(rx) + ' ' + f1(ry) + ' 0 0 1 ' + f1(T[0] - rx) + ' ' + f1(T[1]) + 'Z" fill="url(#ld-dome)" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '" stroke-linejoin="round"/>';
+ s += '<path d="M' + f1(T[0] - rx) + ' ' + f1(T[1]) + 'A' + f1(rx) + ' ' + f1(ry) + ' 0 0 0 ' + f1(T[0] + rx) + ' ' + f1(T[1]) + '" fill="none" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '"/>';
+ } else {
+ var top = tint ? mixHex(c.flat ? L.padFaces.top : L.faces.top, tint.c, tint.p) : (c.flat ? L.padFaces.top : L.faces.top);
+ s += '<ellipse cx="' + f1(T[0]) + '" cy="' + f1(T[1]) + '" rx="' + f1(rx) + '" ry="' + f1(ry) + '" fill="' + top + '" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '"/>';
+ if (c.cap) s += '<ellipse cx="' + f1(T[0]) + '" cy="' + f1(T[1]) + '" rx="' + f1(rx * c.cap) + '" ry="' + f1(ry * c.cap) + '" fill="none" stroke="' + L.detail + '" stroke-width="' + f3(lw * 0.6) + '"/>';
+ }
+ return s;
+ }
+ function ball(b, lw, tint) {
+ var q = P(b.at[0], b.at[1], b.at[2]), lit = b.lamp && tint, fill = lit ? (tint.p >= 0.999 ? tint.c : mixHex(L.faces.top, tint.c, tint.p)) : 'url(#ld-dome)';
+ var glow = lit && L.tokenStyle === 'bead' ? ' filter="url(#ld-glow)"' : '';
+ return '<circle cx="' + f1(q[0]) + '" cy="' + f1(q[1]) + '" r="' + f1(b.r * S * 1.12) + '" fill="' + fill + '" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '"' + glow + '/>';
+ }
+ function gable(b, lw) { // a pitched roof, ridge along x: back slope, front slope, gable end
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], w = b.size[0], d = b.size[1], h = b.size[2], ym = y0 + d / 2, o = 0.35, R = L.roofFaces, s = '';
+ s += poly([P(x0 - o, y0 - o, z0 - o * 0.6), P(x1(), y0 - o, z0 - o * 0.6), P(x1(), ym, z0 + h), P(x0 - o, ym, z0 + h)], R.top, lw);
+ s += poly([P(x0 - o, y0 + d + o, z0 - o * 0.6), P(x1(), y0 + d + o, z0 - o * 0.6), P(x1(), ym, z0 + h), P(x0 - o, ym, z0 + h)], R.left, lw);
+ s += poly([P(x0 + w, y0, z0), P(x0 + w, y0 + d, z0), P(x0 + w, ym, z0 + h)], R.right, lw);
+ function x1() { return x0 + w + o; }
+ return s;
+ }
+ function saw(b, lw) { // a sawtooth (factory) roof along x
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], w = b.size[0], d = b.size[1], h = b.size[2], n = b.n || 3, s = '';
+ for (var i = 0; i < n; i++) {
+ var a = x0 + (w / n) * i, c = a + w / n;
+ s += poly([P(a, y0, z0), P(a, y0 + d, z0), P(c, y0 + d, z0 + h), P(c, y0, z0 + h)], L.roofFaces.top, lw);
+ s += poly([P(c, y0, z0 + h), P(c, y0 + d, z0 + h), P(c, y0 + d, z0), P(c, y0, z0)], L.roofFaces.right, lw);
+ s += poly([P(a, y0 + d, z0), P(c, y0 + d, z0 + h), P(c, y0 + d, z0)], L.roofFaces.left, lw);
+ }
+ return s;
+ }
+ function tray(b, t, lw) { // an open store: walls, the inner floor, a level of its tone
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], w = b.size[0], d = b.size[1], h = b.size[2], k = 0.7, s = box(b, lw, 'padFaces');
+ s += poly([P(x0 + k, y0 + k, z0 + h), P(x0 + w - k, y0 + k, z0 + h), P(x0 + w - k, y0 + d - k, z0 + h), P(x0 + k, y0 + d - k, z0 + h)], L.faces.deep, lw * 0.7);
+ var lv = keyed(b.fill, t, 0);
+ if (lv > 0.001) {
+ var tn = toneOf(L, b.tone), zl = z0 + h - 0.05, y1 = y0 + d - k, x1 = x0 + w - k, zz = z0 + 0.4 + (h - 0.6) * lv;
+ s += poly([P(x0 + k, y1, zl), P(x1, y1, zl), P(x1, y1, zz), P(x0 + k, y1, zz)], mixHex(tn.tint, L.ground, 0.15), lw * 0.5, tn.flow, 'stroke-opacity="0.6"');
+ s += poly([P(x0 + k, y0 + k, zz), P(x1, y0 + k, zz), P(x1, y1, zz), P(x0 + k, y1, zz)], tn.tint, lw * 0.6, tn.flow);
+ }
+ return s;
+ }
+ function keyed(keys, t, dflt) { // [[t, v], ...] -> v at t, eased between keys
+ if (!keys || !keys.length) return dflt;
+ if (typeof keys === 'number') return keys;
+ if (t <= keys[0][0]) return keys[0][1];
+ for (var i = 1; i < keys.length; i++) if (t < keys[i][0]) return lerp(keys[i - 1][1], keys[i][1], E.inOutSine((t - keys[i - 1][0]) / (keys[i][0] - keys[i - 1][0])));
+ return keys[keys.length - 1][1];
+ }
+ function faceP(f, u, v) { return f.face === 'y+' ? P(f.c[0] + u, f.plane, f.c[1] + v) : P(f.plane, f.c[0] - u, f.c[1] + v); }
+ function ring(f, R, n) { var a = []; n = n || 56; for (var i = 0; i <= n; i++) { var th = (i / n) * Math.PI * 2; a.push(faceP(f, R * Math.cos(th), R * Math.sin(th))); } return a; }
+ function fan(f, t, lw) {
+ var s = poly(ring(f, f.R + 0.9), L.faces.recess, lw);
+ s += poly(ring(f, f.R), L.faces.deep, lw * 0.6, L.detail);
+ var spin = typeof f.spin === 'function' ? f.spin(t) : (f.spin && f.spin.at != null ? -Math.pow(seg(t, f.spin.at, 1.6), 2) * 4.4 - Math.max(0, t - f.spin.at - 1.6) * (f.spin.rate || 5.5) : 0);
+ for (var k = 0; k < 5; k++) {
+ var a0 = spin + (k / 5) * Math.PI * 2, bl = [], i, th, rr;
+ for (i = 0; i <= 10; i++) { th = a0 + i * 0.075; rr = lerp(f.R * 0.22, f.R * 0.92, i / 10); bl.push(faceP(f, rr * Math.cos(th), rr * Math.sin(th))); }
+ for (i = 10; i >= 0; i--) { th = a0 + 0.52 + i * 0.03; rr = lerp(f.R * 0.22, f.R * 0.88, i / 10); bl.push(faceP(f, rr * Math.cos(th), rr * Math.sin(th))); }
+ s += poly(bl, L.faces.blade, lw * 0.6, L.detail);
+ }
+ s += poly(ring(f, f.R * 0.2, 28), L.faces.top, lw * 0.7);
+ for (var g = 1; g <= 3; g++) s += '<path d="' + dpath(ring(f, f.R * g / 3.15)) + '" fill="none" stroke="' + L.ink + '" stroke-opacity="0.55" stroke-width="' + f3(lw * 0.5) + '"/>';
+ s += line([faceP(f, -f.R, 0), faceP(f, f.R, 0)], lw * 0.5, L.ink, 'stroke-opacity="0.55"');
+ s += line([faceP(f, 0, -f.R), faceP(f, 0, f.R)], lw * 0.5, L.ink, 'stroke-opacity="0.55"');
+ return s;
+ }
+ function fins(f, lw) {
+ var s = '';
+ for (var u = f.u0; u <= f.u1 + 1e-6; u += f.step) s += line([faceP(f, u, f.v0), faceP(f, u, f.v1)], lw * 0.45, L.detail);
+ s += poly([faceP(f, f.u0 - 0.6, f.v0 - 0.6), faceP(f, f.u1 + 0.6, f.v0 - 0.6), faceP(f, f.u1 + 0.6, f.v1 + 0.6), faceP(f, f.u0 - 0.6, f.v1 + 0.6)], 'none', lw * 0.7);
+ return s;
+ }
+ function hatch(b, lw) {
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], w = b.size[0], d = b.size[1], h = b.size[2], z1 = z0 + h, s = '', y, z;
+ for (y = y0 + 0.6; y < y0 + d - w; y += 1.1) s += line([P(x0, y, z1), P(x0 + w, y + w, z1)], lw * 0.45, L.hatch);
+ if (b.endFace) for (z = 0.6; z < h - w; z += 1.1) s += line([P(x0, y0 + d, z0 + z), P(x0 + w, y0 + d, z0 + z + w)], lw * 0.45, L.hatch);
+ return s;
+ }
+ function ghost(b, lw) {
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], x1 = x0 + b.size[0], y1 = y0 + b.size[1], z1 = z0 + b.size[2], da = 'stroke-dasharray="7 6"', s = '';
+ s += line([P(x0, y0, z1), P(x1, y0, z1), P(x1, y1, z1), P(x0, y1, z1), P(x0, y0, z1)], lw * 0.7, L.ghost, da);
+ s += line([P(x1, y1, z0), P(x1, y1, z1)], lw * 0.7, L.ghost, da) + line([P(x0, y1, z0), P(x0, y1, z1)], lw * 0.7, L.ghost, da);
+ s += line([P(x0, y1, z0), P(x1, y1, z0), P(x1, y0, z0)], lw * 0.7, L.ghost, da);
+ return s;
+ }
+ function planks(b, lw) { var s = '', x0 = b.at[0], y0 = b.at[1], z = b.at[2]; for (var y = y0 + b.step; y < y0 + b.size[1] - 0.1; y += b.step) s += line([P(x0, y, z), P(x0 + b.size[0], y, z)], lw * 0.4, L.plank); return s; }
+ function plate(b, lw) {
+ var s = box(b.glass ? b : b, lw, b.faces || 'plateFaces'), x0 = b.at[0], y0 = b.at[1], x1 = x0 + b.size[0], y1 = y0 + b.size[1], z = b.at[2] + b.size[2], x, y, i;
+ if (b.grid) {
+ var gc = b.glass ? L.glassLine : L.grid, ga = b.glass ? 'stroke-opacity="0.22"' : '';
+ for (x = x0 + b.grid; x < x1 - 0.1; x += b.grid) s += line([P(x, y0 + 0.01, z), P(x, y1, z)], lw * 0.4, gc, ga);
+ for (y = y0 + b.grid; y < y1 - 0.1; y += b.grid) s += line([P(x0, y, z), P(x1, y, z)], lw * 0.4, gc, ga);
+ }
+ if (b.ruler) for (x = x0 + 2, i = 1; x < x1 - 1; x += 2, i++) s += line([P(x, y1, b.at[2] + b.size[2] * 0.83), P(x, y1, b.at[2] + b.size[2] * (i % 5 === 0 ? 0.2 : 0.5))], lw * 0.45, L.detail);
+ return s;
+ }
+ function ringShape(sh, t, lw) { // a state ring on the floor around a node (matched, active, chosen)
+ var a = seg(t, sh.from, sh.dur || 0.5, E.outCubic) * (sh.until != null ? 1 - seg(t, sh.until, 0.4) : 1); if (a <= 0) return '';
+ var q = P(sh.at[0], sh.at[1], sh.at[2] || 0), r = sh.r * (0.85 + 0.15 * a), tn = toneOf(L, sh.tone || 'warm');
+ return '<ellipse cx="' + f1(q[0]) + '" cy="' + f1(q[1]) + '" rx="' + f1(1.2247 * r * S) + '" ry="' + f1(0.7071 * r * S) + '" fill="' + tn.tint + '" fill-opacity="' + f3(0.55 * a) + '" stroke="' + tn.flow + '" stroke-width="' + f3(lw * 1.6) + '" stroke-opacity="' + f3(a) + '"/>';
+ }
+ function shapeSVG(sh, t, lw, tint) {
+ switch (sh.kind) {
+ case 'box': return box(sh, lw, sh.tone, tint);
+ case 'cyl': return cyl(sh, lw, tint);
+ case 'ball': return ball(sh, lw, tint);
+ case 'gable': return gable(sh, lw);
+ case 'saw': return saw(sh, lw);
+ case 'tray': return tray(sh, t, lw);
+ case 'fan': return fan(sh, t, lw);
+ case 'fins': return fins(sh, lw);
+ case 'hatch': return hatch(sh, lw);
+ case 'plate': return plate(sh, lw);
+ case 'ghost': return ghost(sh, lw);
+ case 'ring': return ringShape(sh, t, lw);
+ case 'cell': { // one cell of a stack: shown once the keyed count reaches it, dropping in over 0.35 s
+ // the count is a step function of t: a cell shows while the latest key at or before t is above it, and it
+ // drops in from the key that started that run (a count that goes down takes cells away; it comes back
+ // with the next key above it)
+ var when = null, ks = sh.count || [];
+ for (var ci = 0; ci < ks.length && ks[ci][0] <= t; ci++) { if (ks[ci][1] > sh.i) { if (when == null) when = ks[ci][0]; } else when = null; }
+ if (when == null) return '';
+ var pc = seg(t, when + sh.i * 0.05, 0.35, E.outCubic), dz = (1 - pc) * 2.5 * S, tnc = toneOf(L, sh.tone || 'cold');
+ var fresh = 1 - seg(t, when + 0.35, 0.8);
+ return '<g transform="translate(0 ' + f1(-dz) + ')" opacity="' + f3(clamp(pc * 1.6, 0, 1)) + '">' + box(sh, lw, null, { c: tnc.flow, p: 0.12 + 0.35 * fresh }) + '</g>';
+ }
+ case 'bloom': {
+ var a = seg(t, sh.from, sh.dur, E.inOutSine) * (L.bloomOpacity || 0.3); if (a <= 0) return '';
+ var q = P(sh.at[0], sh.at[1], sh.at[2]), r = sh.r * (0.7 + 0.3 * a / (L.bloomOpacity || 0.3));
+ return '<ellipse cx="' + f1(q[0]) + '" cy="' + f1(q[1]) + '" rx="' + f1(1.2247 * r * S) + '" ry="' + f1(0.7071 * r * S) + '" fill="url(#ld-bloom)" opacity="' + f3(a) + '"/>';
+ }
+ case 'planks': return planks(sh, lw);
+ case 'face': return poly(sh.pts.map(function (p) { return P(p[0], p[1], p[2]); }), sh.tone === 'flag' ? toneOf(L, 'hot').flow : (L.faces[sh.tone || 'top'] || L.faces.top), lw * (sh.lw || 1), sh.stroke ? (L[sh.stroke] || 'none') : L.ink);
+ case 'line': return line(sh.pts.map(function (p) { return P(p[0], p[1], p[2]); }), lw * (sh.lw || 0.6), L[sh.stroke || 'detail']);
+ case 'bolt': { var b = P(sh.at[0], sh.at[1], sh.at[2]); return '<circle cx="' + f1(b[0]) + '" cy="' + f1(b[1]) + '" r="2.6" fill="' + L.faces.top + '" stroke="' + L.detail + '" stroke-width="' + f3(lw * 0.6) + '"/>'; }
+ default: return '';
+ }
+ }
+ function shadowSVG(fp, p, z) { // on the ground the part stands on (z: its base)
+ var x0 = fp[0], y0 = fp[1], w = fp[2], d = fp[3], k = 1.4; z = z || 0;
+ var a = [P(x0 + k, y0 + k, z), P(x0 + w + k * 2, y0 + k, z), P(x0 + w + k * 2, y0 + d + k * 2, z), P(x0 + k, y0 + d + k * 2, z)];
+ return '<polygon points="' + pts(a) + '" fill="' + L.shadow + '" opacity="' + f3(p) + '" filter="url(#ld-soft)"/>';
+ }
+
+ function pipeSVG(pp, t, lw) {
+ var it = pp.it, bd = it.build || [0, 0.4], b = Array.isArray(bd) ? seg(t, bd[0], bd[1], E.inOutSine) : seg(t, bd, 0.4, E.inOutSine);
+ if (b <= 0) return '';
+ var isLink = it.kind === 'link', w = it.w || (isLink ? 4 : 11);
+ var start = it.tintAt != null ? it.tintAt : (flowOn[it.id] ? Math.min.apply(null, flowOn[it.id].map(function (x) { return x.f.at; })) : null);
+ var tn = toneAt(it.id, t, it.tone || it.temp || null, (it.tone || it.temp) ? start : null);
+ var a = trimmed(pp, 0, pp.len * b), d = dpath(a), s = '', collars = '';
+ if (isLink) {
+ var lc = tn.to ? tintOf(tn, 'flow', L.detail) : (L[it.stroke] || L.detail);
+ var dash = it.dash ? ' stroke-dasharray="' + String(it.dash).replace(/[^0-9., ]/g, '') + '"' : '';
+ s += '<path d="' + d + '" fill="none" stroke="' + lc + '" stroke-width="' + f3(w * (tn.to ? lerp(1, 1.5, tn.p) : 1)) + '" stroke-linecap="round" stroke-linejoin="round"' + dash + (it.opacity != null ? ' opacity="' + f3(Number(it.opacity) || 0) + '"' : '') + '/>';
+ } else {
+ var tint = tintOf(tn, 'tint', L.pipe.body);
+ s += '<path d="' + d + '" fill="none" stroke="' + L.ink + '" stroke-width="' + f3(w + 2 * lw) + '" stroke-linecap="round" stroke-linejoin="round"/>';
+ s += '<path d="' + d + '" fill="none" stroke="' + tint + '" stroke-width="' + w + '" stroke-linecap="round" stroke-linejoin="round"/>';
+ (it.ends || []).forEach(function (e) {
+ if (e === 'end' && b < 1) return;
+ var s0 = e === 'start' ? 0 : pp.len - 9, q0 = atLen(pp, s0), q1 = atLen(pp, s0 + 9), cd = 'M' + f1(q0.x) + ' ' + f1(q0.y) + 'L' + f1(q1.x) + ' ' + f1(q1.y);
+ collars += '<path d="' + cd + '" stroke="' + L.ink + '" stroke-width="' + f3(w + 7 + 2 * lw) + '" fill="none"/><path d="' + cd + '" stroke="' + (L.pipe.collar || L.faces.top) + '" stroke-width="' + f3(w + 7) + '" fill="none"/>';
+ });
+ if (L.pipe.sheen) s += '<path d="' + d + '" fill="none" stroke="' + L.pipe.sheen + '" stroke-width="' + f1(w * 0.22) + '" stroke-linecap="round" stroke-linejoin="round" transform="translate(0 ' + f1(-w * 0.2) + ')"/>';
+ }
+ (flowOn[it.id] || []).forEach(function (on) { s += particles(on.f, on.s, pp, t, b, w, tn, isLink ? lc : null); });
+ return s + collars;
+ }
+ function particles(F, sg, pp, t, b, w, tn, line) {
+ var fo = seg(t, F.at, 0.5) * (F.until != null ? 1 - seg(t, F.until, 0.5) : 1); if (fo <= 0) return '';
+ var col = sg.tone ? toneOf(L, sg.tone).flow : tintOf(tn, 'flow', L.detail), out = '', n = Math.max(1, Math.floor(F.len / F.spacing)), bead = L.flowStyle === 'bead';
+ // dashes the colour of the link under them would not show: they become gaps that travel along it
+ if (line && !bead && String(col).toLowerCase() === String(line).toLowerCase()) col = (L.pipe && L.pipe.body) || L.ground;
+ var tf = (t - F.at) * F.speed + F.speed * 20; // phase from the flow's own start (so retiming it keeps the look)
+ for (var k = 0; k < n; k++) {
+ var s = (((k * F.spacing + tf) % F.len) + F.len) % F.len - sg.s0;
+ if (s < 0 || s > pp.len * b) continue;
+ var q = atLen(pp, s), edge = Math.min(1, s / 18, (pp.len - s) / 18), deg = (q.ang * 180) / Math.PI, lp = F.dash, hw = Math.max(2, w * 0.21);
+ out += '<rect x="' + f1(-lp / 2) + '" y="' + f1(-hw) + '" width="' + lp + '" height="' + f1(hw * 2) + '" rx="' + f1(hw) + '" transform="translate(' + f1(q.x) + ' ' + f1(q.y) + ') rotate(' + f1(deg) + ')" fill="' + col + '" opacity="' + f3(Math.max(0, edge)) + '"/>';
+ }
+ return '<g opacity="' + f3(fo) + '"' + (bead ? ' filter="url(#ld-glow)"' : '') + '>' + out + '</g>';
+ }
+ function airSVG(it, t, lw) {
+ var o = seg(t, it.at, 0.6) * (it.until != null ? 1 - seg(t, it.until, 0.5) : 1); if (o <= 0) return '';
+ var tn = toneOf(L, it.tone || it.temp), s = '';
+ it.lines.forEach(function (ln, i) {
+ var a = [];
+ for (var k = 0; k <= 30; k++) { var q = k / 30, p = ln.map(function (v) { return lerp(v[0], v[1], q); }), wob = Math.sin(q * Math.PI * 2 * (it.waves || 1) + i * 1.7) * (it.amp || 0.5); a.push(P(p[0] + wob * it.wob[0], p[1] + wob * it.wob[1], p[2])); }
+ var off = -(t * it.speed + i * 23) % 52;
+ s += line(a, lw * 1.25, tn.air, 'stroke-dasharray="' + (it.dash || '30 22') + '" stroke-dashoffset="' + f1(off) + '"');
+ var e = a[a.length - 1], pr = a[a.length - 3], ang = Math.atan2(e[1] - pr[1], e[0] - pr[0]), hl = 11;
+ s += line([[e[0] - hl * Math.cos(ang - 0.5), e[1] - hl * Math.sin(ang - 0.5)], e, [e[0] - hl * Math.cos(ang + 0.5), e[1] - hl * Math.sin(ang + 0.5)]], lw * 1.2, tn.air);
+ });
+ return '<g opacity="' + f3(o * (L.airOpacity || 1)) + '">' + s + '</g>';
+ }
+
+ /* ---------- tokens: discrete things moving between nodes (offers, money, goods, signals) ---------- */
+ var tokens = (spec.tokens || []).map(function (tk, i) { return Object.assign({ id: 'tok' + i, tone: 'cold', r: 1.3 }, tk); });
+ var tokById = {}; tokens.forEach(function (tk) { tokById[tk.id] = tk; });
+ function tokenAt(tk, t) { // -> {pos:[x,y,z], tone, o} or null (closed form: the last move that started wins)
+ if (tk.routes) { // live: the route that started last at or before t
+ var rt = null; for (var ri = 0; ri < tk.routes.length && tk.routes[ri].start <= t; ri++) rt = tk.routes[ri];
+ if (!rt || !rt.moves.length) return null;
+ tk = { moves: rt.moves, until: rt.until, tone: tk.tone, tones: tk.tones, from: tk.from };
+ }
+ var moves = tk.moves || [], pos = tk.from ? (Array.isArray(tk.from) ? tk.from : portOf(tk.from).at) : null, show = tk.at != null ? tk.at : (moves[0] ? moves[0].at : 0);
+ if (t < show) return null;
+ for (var i = 0; i < moves.length; i++) {
+ var mv = moves[i]; if (t < mv.at) break;
+ var p = seg(t, mv.at, mv.dur || 0.8, E.inOutCubic);
+ if (mv.along) {
+ var pp = pipes[mv.along]; if (!pp) continue;
+ var f = mv.reverse ? 1 - p * (mv.span == null ? 1 : mv.span) : p * (mv.span == null ? 1 : mv.span);
+ if (mv.bounce) f = (mv.reverse ? 1 : 0) + (mv.reverse ? -1 : 1) * mv.bounce * Math.sin(Math.PI * p);
+ var q = atLen(pp, clamp(f, 0, 1) * pp.len); pos = addOff(q.w3, mv.off);
+ } else if (mv.to) {
+ var dst = addOff(Array.isArray(mv.to) ? mv.to : portOf(mv.to).at, mv.off), src = mv.from ? portOf(mv.from).at : (prevEnd(tk, i) || dst), lift = mv.hop || 0;
+ pos = [0, 1, 2].map(function (k) { return lerp(src[k], dst[k], p); }); pos[2] += Math.sin(Math.PI * p) * lift;
+ }
+ }
+ var tone = tk.tone;
+ (tk.tones || []).forEach(function (x) { if (t >= x.at) tone = x.tone; });
+ var o = seg(t, show, 0.25) * (tk.until != null ? 1 - seg(t, tk.until, 0.3) : 1);
+ return pos && o > 0 ? { pos: pos, tone: tone, o: o } : null;
+ }
+ function addOff(p, o) { return o ? [p[0] + (o[0] || 0), p[1] + (o[1] || 0), p[2] + (o[2] || 0)] : p; }
+ function prevEnd(tk, i) {
+ for (var j = i - 1; j >= 0; j--) {
+ var mv = tk.moves[j];
+ if (mv.to) return addOff(Array.isArray(mv.to) ? mv.to : portOf(mv.to).at, mv.off);
+ if (mv.along) { var pp = pipes[mv.along]; if (pp) return addOff(pp.p3[mv.reverse ? 0 : pp.p3.length - 1], mv.off); }
+ }
+ return tk.from ? (Array.isArray(tk.from) ? tk.from : portOf(tk.from).at) : null;
+ }
+ function tokenSVG(tk, st, lw) {
+ var tn = toneOf(L, st.tone), r = tk.r, q = P(st.pos[0], st.pos[1], st.pos[2]), s = '';
+ if (tk.shape === 'chip' || tk.shape === 'envelope') {
+ var sz = tk.size || [3.2, 2.2, 0.55], b = { at: [st.pos[0] - sz[0] / 2, st.pos[1] - sz[1] / 2, st.pos[2]], size: sz };
+ var faces = { top: mixHex(tn.flow, L.name === 'dark' ? '#000000' : '#FFFFFF', L.name === 'dark' ? 0.15 : 0.55), left: mixHex(tn.flow, '#000000', 0.08), right: mixHex(tn.flow, '#000000', 0.22) };
+ var x0 = b.at[0], y0 = b.at[1], z0 = b.at[2], x1 = x0 + sz[0], y1 = y0 + sz[1], z1 = z0 + sz[2];
+ s += poly([P(x1, y0, z0), P(x1, y1, z0), P(x1, y1, z1), P(x1, y0, z1)], faces.right, lw);
+ s += poly([P(x0, y1, z0), P(x1, y1, z0), P(x1, y1, z1), P(x0, y1, z1)], faces.left, lw);
+ s += poly([P(x0, y0, z1), P(x1, y0, z1), P(x1, y1, z1), P(x0, y1, z1)], faces.top, lw);
+ if (tk.shape === 'envelope') s += line([P(x0, y0, z1), P((x0 + x1) / 2, (y0 + y1) / 2, z1), P(x0, y1, z1)], lw * 0.8, L.ink);
+ else s += line([P(x0 + sz[0] * 0.25, (y0 + y1) / 2, z1), P(x1 - sz[0] * 0.25, (y0 + y1) / 2, z1)], lw * 0.8, tn.flow);
+ return '<g opacity="' + f3(st.o) + '"' + (L.tokenStyle === 'bead' ? ' filter="url(#ld-glowsoft)"' : '') + '>' + s + '</g>';
+ }
+ if (L.tokenStyle === 'bead') {
+ s += '<g filter="url(#ld-glow)"><ellipse cx="' + f1(q[0]) + '" cy="' + f1(q[1] - 2) + '" rx="' + f1(1.2247 * r * S) + '" ry="' + f1(0.7071 * r * S) + '" fill="' + tn.flow + '"/></g>';
+ } else { // a puck: side band, top ellipse, ink outline
+ var rx = 1.2247 * r * S, ry = 0.7071 * r * S, h = 0.7 * S, top = q[1] - h;
+ s += '<path d="M' + f1(q[0] - rx) + ' ' + f1(top) + 'L' + f1(q[0] - rx) + ' ' + f1(q[1]) + 'A' + f1(rx) + ' ' + f1(ry) + ' 0 0 0 ' + f1(q[0] + rx) + ' ' + f1(q[1]) + 'L' + f1(q[0] + rx) + ' ' + f1(top) + 'Z" fill="' + tn.flow + '" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '"/>';
+ s += '<ellipse cx="' + f1(q[0]) + '" cy="' + f1(top) + '" rx="' + f1(rx) + '" ry="' + f1(ry) + '" fill="' + mixHex(tn.flow, '#FFFFFF', 0.35) + '" stroke="' + L.ink + '" stroke-width="' + f3(lw) + '"/>';
+ }
+ return '<g opacity="' + f3(st.o) + '">' + s + '</g>';
+ }
+
+ /* ---------- camera ---------- */
+ function focusPoint(fc) {
+ if (Array.isArray(fc)) return fc.length === 3 ? P(fc[0], fc[1], fc[2]) : fc;
+ var p = byId[fc]; return p && p.anchor ? P(p.anchor[0], p.anchor[1], p.anchor[2]) : [W / 2, H / 2];
+ }
+ function camera(t) {
+ var z = 1, fx = W / 2, fy = H / 2, tx = W / 2, ty = H / 2, moving = false;
+ (spec.camera || []).forEach(function (k) {
+ var p = seg(t, k.at, k.dur || 1.2, E.inOutCubic); if (p <= 0) return;
+ if (p < 1) moving = true;
+ var fp = k.focus != null ? focusPoint(k.focus) : [W / 2, H / 2], to = k.to || [W / 2, H / 2];
+ z = Math.exp(lerp(Math.log(z), Math.log(k.zoom || 1), p)); fx = lerp(fx, fp[0], p); fy = lerp(fy, fp[1], p); tx = lerp(tx, to[0], p); ty = lerp(ty, to[1], p);
+ });
+ var ex = tx - fx * z, ey = ty - fy * z;
+ if (!moving) { ex = Math.round(ex); ey = Math.round(ey); } // at rest: whole pixels, no shimmer
+ return { z: z, ex: ex, ey: ey, map: function (q) { return [ex + q[0] * z, ey + q[1] * z]; } };
+ }
+ var zMin = (spec.camera || []).reduce(function (m, k) { return Math.min(m, k.zoom || 1); }, 1);
+
+ /* ---------- DOM ---------- */
+ var host = typeof opts.host === 'string' || spec.host ? document.querySelector(opts.host || spec.host) : (opts.host || document.querySelector('#ld'));
+ if (!host) { warn('no host element (#ld) on the page'); return null; }
+ var stage = host.closest('.ld-stage') || host.parentElement;
+ var NS = 'http://www.w3.org/2000/svg';
+ host.innerHTML = '<svg xmlns="' + NS + '" width="' + W + '" height="' + H + '" viewBox="0 0 ' + W + ' ' + H + '">' +
+ '<defs>' +
+ '<linearGradient id="ld-cyl" x1="0" x2="1" y1="0" y2="0">' + L.cylStops + '</linearGradient>' +
+ '<radialGradient id="ld-dome" cx="0.38" cy="0.35" r="0.85">' + L.domeStops + '</radialGradient>' +
+ '<filter id="ld-soft" x="-20%" y="-40%" width="140%" height="180%"><feGaussianBlur stdDeviation="' + (L.shadowBlur || 9) + '"/></filter>' +
+ '<filter id="ld-glow" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="5" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>' +
+ '<filter id="ld-glowsoft" x="-10%" y="-10%" width="120%" height="120%"><feGaussianBlur stdDeviation="3" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>' +
+ '<clipPath id="ld-clip"><rect x="' + clip[0] + '" y="' + clip[1] + '" width="' + clip[2] + '" height="' + clip[3] + '" rx="4"/></clipPath>' +
+ '<linearGradient id="ld-band-t" x1="0" x2="0" y1="0" y2="1"><stop offset="0" stop-color="' + L.veil + '" stop-opacity="1"/><stop offset="0.62" stop-color="' + L.veil + '" stop-opacity="0.9"/><stop offset="1" stop-color="' + L.veil + '" stop-opacity="0"/></linearGradient>' +
+ '<linearGradient id="ld-band-b" x1="0" x2="0" y1="1" y2="0"><stop offset="0" stop-color="' + L.veil + '" stop-opacity="1"/><stop offset="0.5" stop-color="' + L.veil + '" stop-opacity="0.92"/><stop offset="1" stop-color="' + L.veil + '" stop-opacity="0"/></linearGradient>' +
+ '<radialGradient id="ld-bloom"><stop offset="0" stop-color="' + L.bloom + '" stop-opacity="1"/><stop offset="0.55" stop-color="' + L.bloom + '" stop-opacity="0.45"/><stop offset="1" stop-color="' + L.bloom + '" stop-opacity="0"/></radialGradient>' +
+ // the footers' mask: plates and floors (only) fade out under the page's footer lines, so a plate edge never cuts
+ // their text; parts, packets, tags and text are never masked (filled in at mount from the footers' boxes)
+ '<filter id="ld-feather" filterUnits="userSpaceOnUse" x="0" y="0" width="' + W + '" height="' + H + '"><feGaussianBlur stdDeviation="7"/></filter>' +
+ '<mask id="ld-footmask" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" x="0" y="0" width="' + W + '" height="' + H + '">' +
+ '<rect x="0" y="0" width="' + W + '" height="' + H + '" fill="#fff"/><g id="ld-footholes" filter="url(#ld-feather)"></g></mask>' +
+ '</defs><g clip-path="url(#ld-clip)"><g id="ld-floormask"><g id="ld-floorcam"><g id="ld-floor"></g></g></g>' +
+ '<g id="ld-world"><g id="ld-wtext"></g><g id="ld-draw"></g></g></g><g id="ld-bands"></g><g id="ld-over"></g></svg>';
+ var gWorld = host.querySelector('#ld-world'), gFloor = host.querySelector('#ld-floor'), gDraw = host.querySelector('#ld-draw');
+ var gFloorCam = host.querySelector('#ld-floorcam'), gFloorMask = host.querySelector('#ld-floormask'), gHoles = host.querySelector('#ld-footholes');
+ var gWText = host.querySelector('#ld-wtext'), gBands = host.querySelector('#ld-bands'), gOver = host.querySelector('#ld-over');
+ var mk = function (tag, attrs, parent) { var e = document.createElementNS(NS, tag); for (var k in attrs) e.setAttribute(k, attrs[k]); parent.appendChild(e); return e; };
+
+ // floor text: persistent nodes set in the floor plane, at least the readable minimum on screen
+ var floorMin = Math.ceil(MIN_TEXT_PX / (0.7071 * Math.max(0.2, zMin)));
+ var floorTexts = items.filter(function (it) { return it.kind === 'floortext'; }).map(function (it) {
+ var size = it.size || 36;
+ if (size < floorMin) { warn('floor text "' + it.text + '" raised from ' + size + ' to ' + floorMin + ' (it shows at ' + Math.round(size * 0.7071 * zMin) + ' px; readable text needs ' + MIN_TEXT_PX + ')'); size = floorMin; }
+ var p = P(it.at[0], it.at[1], it.at[2] || 0), m = it.dir === 'y' ? [C, -0.5, C, 0.5] : [C, 0.5, -C, 0.5];
+ var e = mk('text', { transform: 'matrix(' + m.map(f3).join(' ') + ' ' + f1(p[0]) + ' ' + f1(p[1]) + ')', 'font-family': L.font.mono, 'font-size': size, 'font-weight': 500, 'letter-spacing': 2.5, fill: L.floorInk, opacity: 0, visibility: 'hidden' }, gWText);
+ e.textContent = it.text;
+ return { it: it, el: e, m: m, size: size, len: it.text.length * size * 0.62 };
+ });
+
+ // labels and tags: built once, measured once after fonts load, placed by the layout pass
+ var labels = (spec.labels || []).filter(function (lb) { return lb.anchor || byId[lb.for]; }).map(function (lb, i) {
+ var g = mk('g', { 'data-ld-label': lb.id || lb.for || String(i) }, gOver);
+ var plate = mk('rect', { rx: 6, fill: L.labelPlate, opacity: 0 }, g);
+ var lead = mk('path', { fill: 'none', stroke: L.leader, 'stroke-width': L.leaderW, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }, g);
+ var dot = mk('circle', { r: 5, fill: L.dotFill, stroke: L.leader, 'stroke-width': L.leaderW }, g);
+ var tt = mk('text', { 'font-family': L.font.label, 'font-size': L.size.label, 'font-weight': L.weight.label, fill: L.labelInk, 'letter-spacing': L.track.label }, g);
+ tt.textContent = lb.title;
+ var sub = mk('text', { 'font-family': L.font.sub, 'font-size': L.size.sub, 'font-weight': 450, fill: L.subInk }, g);
+ sub.textContent = lb.sub || '';
+ return { lb: lb, g: g, plate: plate, lead: lead, dot: dot, tt: tt, sub: sub, w: 0, ids: [lb.for].concat(lb.with || []).filter(Boolean) };
+ });
+ var tags = (spec.tags || []).map(function (tg, i) {
+ var g = mk('g', { 'data-ld-tag': tg.id || String(i) }, gOver), tn = toneOf(L, tg.tone || tg.temp);
+ var outline = L.tagStyle === 'outline';
+ var r = mk('rect', { rx: 19, fill: tn.tag, stroke: outline ? tn.tagInk : 'none', 'stroke-width': 2 }, g);
+ var keys = tg.keys || [[tg.at, tg.text]], fs = Math.max(L.size.tag, tg.size || 0), clip = null, caret = null;
+ if (tg.type) { var cp = mk('clipPath', { id: 'ld-type-' + i }, g); clip = mk('rect', { x: 0, y: 0, width: 0, height: 0 }, cp); }
+ var tx = keys.map(function (k) { // one persistent text per value: a value change is a new reading, never a rebuilt node
+ var e = mk('text', { 'font-family': L.font.mono, 'font-size': fs, 'font-weight': 600, fill: (k[2] ? toneOf(L, k[2]) : tn).tagInk, 'text-anchor': tg.type ? 'start' : 'middle', opacity: 0 }, g);
+ if (tg.type) e.setAttribute('clip-path', 'url(#ld-type-' + i + ')');
+ e.textContent = k[1]; return e;
+ });
+ if (tg.type) caret = mk('rect', { fill: tn.tagInk, opacity: 0 }, g);
+ return { tg: tg, g: g, r: r, tx: tx, keys: keys, ws: [], fs: fs, h: Math.max(38, Math.round(fs * 1.55)), clip: clip, caret: caret, ids: [tg.for || tg.pipe].filter(Boolean) };
+ });
+ var lay = { done: false };
+ var report = { theme: L.name, order: sorted.map(function (it) { return it.id || ('#' + it._i); }), labels: [], warnings: problems.concat(cycleMsg ? [cycleMsg] : []) };
+
+ var ready = (async function () {
+ try { await document.fonts.ready; } catch (e) { /* fonts optional in a bare test page */ }
+ fitStage();
+ labels.forEach(function (l) { l.w = Math.max(l.tt.getComputedTextLength(), l.sub.getComputedTextLength()); });
+ tags.forEach(function (g) { g.ws = g.tx.map(function (e) { return e.getComputedTextLength(); }); });
+ floorTexts.forEach(function (ft) { try { ft.len = ft.el.getComputedTextLength(); } catch (e) { /* keep the estimate */ } });
+ footerMask();
+ layout();
+ audit();
+ lay.done = true;
+ })();
+ if (root.ST && ST.waitFor) ST.waitFor(ready, 'living diagram: fonts and label layout');
+
+ function fitStage() { // the design is 1920x1080: scale the stage to the page size
+ if (!stage || !stage.style) return;
+ var dk = document.querySelector('.ld-dek'), st = document.querySelector('.ld-steps');
+ if (dk && st && !(spec.page && spec.page.steps && spec.page.steps.at) && String(dk.textContent || '').trim()) {
+ var bottom = dk.offsetTop + dk.offsetHeight + 30;
+ if (st.offsetTop < bottom) st.style.top = bottom + 'px';
+ }
+ var k = (root.innerWidth || W) / W;
+ if (Math.abs(k - 1) > 1e-3) { stage.style.transformOrigin = '0 0'; stage.style.transform = 'scale(' + k + ')'; }
+ lay.k = k;
+ }
+
+ /* ---------- the label layout pass: candidates around each anchor, scored on what they cover ---------- */
+ function figure(pose) { // the floor pieces (plate, floors) as screen hulls: labels prefer the empty page
+ return floorItems.filter(function (it) { return it.bbox && it.kind !== 'link'; }).map(function (it) {
+ var lo = it.bbox[0], hi = it.bbox[1], c = [];
+ for (var a = 0; a < 8; a++) c.push(pose.cam.map(P((a & 1 ? hi : lo)[0], (a & 2 ? hi : lo)[1], (a & 4 ? hi : lo)[2])));
+ return { poly: hull(c) };
+ });
+ }
+ function segsCross(p1, p2, p3, p4) {
+ var d = function (a, b, c) { return (c[0] - a[0]) * (b[1] - a[1]) - (c[1] - a[1]) * (b[0] - a[0]); };
+ var d1 = d(p3, p4, p1), d2 = d(p3, p4, p2), d3 = d(p1, p2, p3), d4 = d(p1, p2, p4);
+ return ((d1 > 0) !== (d2 > 0)) && ((d3 > 0) !== (d4 > 0));
+ }
+ function avoidRects() {
+ var sel = spec.avoid || '.ld-avoid, [data-ld-avoid], .ld-title, .ld-dek, .ld-kicker, .ld-figno, .ld-foot, .ld-steps';
+ var k = lay.k || 1, out = [];
+ var base = stage && stage.getBoundingClientRect ? stage.getBoundingClientRect() : { left: 0, top: 0 };
+ document.querySelectorAll(sel).forEach(function (el) {
+ var r = el.getBoundingClientRect(); if (!r.width || !r.height || !String(el.textContent || '').trim()) return;
+ var name = el.className && typeof el.className === 'string' ? el.className.split(' ')[0] : el.tagName.toLowerCase();
+ if (el.classList.contains('ld-steps')) { // the step line area: the box its widest step takes
+ r = { left: r.left, top: r.top, width: Math.max(r.width, 10), height: Math.max(r.height, 10) };
+ }
+ out.push({ x: (r.left - base.left) / k - 8, y: (r.top - base.top) / k - 8, w: r.width / k + 16, h: r.height / k + 16, name: name });
+ });
+ return out;
+ }
+ function partHulls(cam, t) {
+ return sorted.concat(floorItems.filter(function (it) { return it.kind !== 'link' && it.part && it.part !== 'plate' && it.part !== 'floor'; })).filter(function (it) {
+ return it.bbox && it.kind !== 'pipe' && it.kind !== 'link' && (it.build == null || it.build <= t);
+ }).map(function (it) {
+ var lo = it.bbox[0], hi = it.bbox[1], off = offsetOf(it.id, t), c = [];
+ for (var a = 0; a < 8; a++) c.push(cam.map(P((a & 1 ? hi : lo)[0] + off[0], (a & 2 ? hi : lo)[1] + off[1], (a & 4 ? hi : lo)[2] + off[2])));
+ return { id: it.id || ('#' + it._i), poly: hull(c) };
+ });
+ }
+ function pipeLines(cam, t) {
+ return Object.keys(pipes).filter(function (id) { var b = pipes[id].it.build; return (Array.isArray(b) ? b[0] : b || 0) <= t; }).map(function (id) {
+ return { id: id, pts: pipes[id].scr.filter(function (p, i) { return i % 3 === 0; }).map(cam.map) };
+ });
+ }
+ function anchorOf(lb, t) {
+ var a = lb.anchor || byId[lb.for].anchor, off = lb.for ? offsetOf(lb.for, t) : [0, 0, 0];
+ return P(a[0] + off[0], a[1] + off[1], a[2] + off[2]);
+ }
+ function labelGeom(l, a, el, side) { // anchor (screen), elbow offset, side -> leader points and the plate rect
+ var dir = side === 'left' ? -1 : 1, e = [a[0] + el[0], a[1] + el[1]], sh = [e[0] + dir * 28, e[1]], tx = sh[0] + dir * 12;
+ var x = dir < 0 ? tx - l.w - 14 : tx - 14, y = sh[1] - L.size.label - 10;
+ return { dir: dir, e: e, sh: sh, tx: tx, rect: { x: x, y: y, w: l.w + 28, h: L.size.label + L.size.sub + 34 } };
+ }
+ function labelWindow(lb, t) { // shown from at to until, and again from back (a label returns for the end)
+ var a = lb.until != null ? 1 - seg(t, lb.until, TEXT_FADE) : 1;
+ return lb.back != null && t >= lb.back ? Math.max(a, seg(t, lb.back, TEXT_FADE)) : a;
+ }
+ function poses(l) { // camera poses at which this label is on screen and at rest
+ var lb = l.lb, times = [lb.at + 0.8];
+ if (lb.back != null) times.push(lb.back + 0.6);
+ (spec.camera || []).forEach(function (k) { var te = k.at + (k.dur || 1.2) + 0.05; if (te > lb.at) times.push(te); });
+ return times.filter(function (t) { return t >= lb.at && labelWindow(lb, t) > 0.5 && textHide(t, l.ids, lb.focus) < 0.5; })
+ .map(function (t) { return { t: t, cam: camera(t) }; });
+ }
+ function layout() {
+ var avoid = avoidRects(), placed = [], cx = W / 2, cy = H / 2;
+ // the scene's centre of mass on screen at rest: labels prefer to sit outward from it
+ var hs = partHulls(camera(0), Infinity); if (hs.length) { var sx = 0, sy = 0, n = 0; hs.forEach(function (h) { h.poly.forEach(function (p) { sx += p[0]; sy += p[1]; n++; }); }); cx = sx / n; cy = sy / n; }
+ var order = labels.slice().sort(function (a, b) { return (a.lb.elbow ? 0 : 1) - (b.lb.elbow ? 0 : 1) || a.lb.at - b.lb.at; });
+ var DX = [40, 70, 110, 160, 220, 290], DY = [-230, -170, -120, -80, -45, 45, 80, 120, 170, 230];
+ order.forEach(function (l) {
+ var lb = l.lb, ps = poses(l); if (!ps.length) ps = [{ t: lb.at + 0.8, cam: camera(lb.at + 0.8) }];
+ var cands = [];
+ if (lb.elbow) cands.push({ el: lb.elbow, side: lb.side || (lb.elbow[0] < 0 ? 'left' : 'right'), fixed: true });
+ else DX.forEach(function (dx) { DY.forEach(function (dy) { [-1, 1].forEach(function (sg) { cands.push({ el: [sg * dx, dy], side: sg < 0 ? 'left' : 'right' }); }); }); });
+ var best = null, alts = [], debug = !!spec.debugLayout;
+ cands.forEach(function (cd) {
+ var cost = 0, hits = {};
+ ps.forEach(function (pose, pi) {
+ // the first pose (the label as it lands) counts in full; later camera poses less: a label the camera
+ // carries off the frame fades out there (onScreen), and parts under a focus veil may be covered
+ var main = pi === 0, w = main ? 1 : 0.4, hit = function (k, v) { if (main || k.indexOf('label') === 0) hits[k] = Math.max(hits[k] || 0, v); };
+ var fa = focusAt(pose.t), veiled = function (id) { return fa.amount > 0.5 && !inFocus(fa.fc, id); };
+ var a = pose.cam.map(anchorOf(lb, pose.t)), gm = labelGeom(l, a, cd.el, cd.side), r = gm.rect;
+ var hulls = partHulls(pose.cam, pose.t), lines = pipeLines(pose.cam, pose.t), NX = 14, NY = 5, tot = NX * NY;
+ var covered = function (poly) { var c = 0; for (var i = 0; i < NX; i++) for (var j = 0; j < NY; j++) if (inPoly(r.x + (i + 0.5) * r.w / NX, r.y + (j + 0.5) * r.h / NY, poly)) c++; return c / tot; };
+ hulls.forEach(function (h) { var c = covered(h.poly); if (c) { cost += w * c * (veiled(h.id) ? 1200 : 5000); if (!veiled(h.id)) hit('part ' + h.id, c); } });
+ figure(pose).forEach(function (h) { cost += w * covered(h.poly) * 1400; });
+ floorTexts.forEach(function (ft) { if (pose.t < (ft.it.at0 || 0) || fa.amount > 0.5) return; var o = rectOverlap(r, floorRect(ft, pose.t)); if (o > 0) { cost += w * (12000 + o * 20000); hit('floor text ' + ft.it.text, o); } });
+ lines.forEach(function (ln) { if (veiled(ln.id)) return; var c = 0; ln.pts.forEach(function (p) { if (p[0] > r.x && p[0] < r.x + r.w && p[1] > r.y && p[1] < r.y + r.h) c++; }); if (c) { cost += w * (900 + c * 60); hit('pipe ' + ln.id, 1); } });
+ tags.forEach(function (g) { var tt = Math.max(pose.t, g.keys[0][0] + 0.01), tr = (lb.until == null || tt < lb.until) ? tagRect(g, pose.cam, tt) : null; if (!tr) return; var o = rectOverlap(r, tr); if (o > 0) { cost += 12000 + o * 20000; hit('tag ' + g.keys[0][1], o); } });
+ avoid.forEach(function (av) { var o = rectOverlap(r, av); if (o > 0) { cost += w * (20000 + o * 20000); hit('page ' + av.name, o); } });
+ placed.forEach(function (pl) {
+ if (!samePose(pl, pose) && Math.abs(pl.t - pose.t) > 0.01) return;
+ if (pl.lb && labelWindow(pl.lb, pose.t) < 0.5) return;
+ var o = rectOverlap(r, pl.rect); if (o > 0) { cost += 15000 + o * 20000; hit('label ' + pl.title, o); }
+ if (segHitsRect(gm.e, a, pl.rect) || segHitsRect(gm.e, gm.sh, pl.rect) || segHitsRect(pl.e, pl.a, r)) cost += 4000;
+ if (segsCross(a, gm.e, pl.a, pl.e) || segsCross(gm.e, gm.sh, pl.a, pl.e) || segsCross(a, gm.e, pl.e, pl.sh)) cost += 6000;
+ });
+ var out = Math.max(0, safe[0] - r.x) + Math.max(0, r.x + r.w - safe[2]) + Math.max(0, safe[1] - r.y) + Math.max(0, r.y + r.h - safe[3]);
+ if (out > 0) { cost += main ? 8000 + out * 60 : 1500 + out * 8; hit('outside', out); }
+ hulls.forEach(function (h) { // a leader across a part (its own too, past the first stretch) reads as clutter
+ // a part whose silhouette already holds the anchor (a unit mounted on a wall) is treated like the
+ // label's own part: a leader leaving it is expected, a long run across it (past halfway) is not
+ if (veiled(h.id)) return; var own = h.id === lb.for || inPoly(a[0], a[1], h.poly), c = 0;
+ for (var i = own ? 5 : 1; i < 10; i++) if (inPoly(lerp(a[0], gm.e[0], i / 10), lerp(a[1], gm.e[1], i / 10), h.poly)) c++;
+ if (inPoly(gm.sh[0], gm.sh[1], h.poly)) c += 3;
+ cost += w * c * 160;
+ if (c >= 2) hit('leader across part ' + h.id, Math.min(1, c / 10)); // reported where the label lands
+ });
+ // labels radiate outward from the figure's centre
+ var dx = r.x + r.w / 2 - a[0], dy = r.y + r.h / 2 - a[1], ox = a[0] - cx, oy = a[1] - cy, dl = Math.hypot(dx, dy) || 1, ol = Math.hypot(ox, oy) || 1;
+ cost += w * 900 * (1 - (dx * ox + dy * oy) / (dl * ol)) / 2;
+ });
+ cost += (Math.abs(cd.el[0]) + Math.abs(cd.el[1])) * (spec.leaderCost || 4);
+ if (lb.side && lb.side !== cd.side) cost += 600;
+ if (cd.fixed) cost -= 1e6; // an explicit elbow wins; it is still audited below
+ if (debug) alts.push({ el: cd.el, side: cd.side, cost: Math.round(cost), hits: hits, poses: ps.map(function (x) { return x.t; }) });
+ if (!best || cost < best.cost) best = { cd: cd, cost: cost, hits: hits };
+ });
+ l.el = best.cd.el; l.side = best.cd.side;
+ ps.forEach(function (pose) { var a = pose.cam.map(anchorOf(lb, pose.t)), gm = labelGeom(l, a, l.el, l.side); placed.push({ t: pose.t, cam: pose.cam, rect: gm.rect, e: gm.e, sh: gm.sh, a: a, title: lb.title, lb: lb }); });
+ var hits = best.hits, bad = Object.keys(hits).filter(function (k) { return k.indexOf('pipe') !== 0 && (k.indexOf('part') !== 0 || hits[k] > 0.04); });
+ report.labels.push({ id: lb.id || lb.for, title: lb.title, side: l.side, elbow: l.el, auto: !lb.elbow, hits: hits, cost: Math.round(best.cost),
+ alts: debug ? alts.sort(function (x, y) { return x.cost - y.cost; }) : undefined });
+ if (bad.length) {
+ var msg = 'label "' + lb.title + '" collides: ' + bad.map(function (k) { return k + (typeof hits[k] === 'number' && hits[k] <= 1 && k !== 'outside' ? ' (' + Math.round(hits[k] * 100) + '%)' : ''); }).join(', ') + '; move it (elbow/side), move the part, or shorten the text';
+ report.warnings.push(msg); warn(msg);
+ }
+ });
+ }
+ function tagRect(g, cam, t) { // where a tag sits at rest at t (null while hidden)
+ var tg = g.tg;
+ if (t < g.keys[0][0] || textHide(t, g.ids, tg.focus) > 0.5 || (tg.until != null && t > tg.until)) return null;
+ return tagRectRaw(g, cam, t);
+ }
+ function tagAnchor(g, cam, t) { // the tag's anchor on screen at t (null: nothing to pin it to now)
+ var tg = g.tg;
+ if (tg.token) { var st = tokById[tg.token] && tokenAt(tokById[tg.token], t); return st ? cam.map(P(st.pos[0], st.pos[1], st.pos[2])) : null; }
+ if (tg.pipe) { var pp = pipes[tg.pipe], q = atLen(pp, pp.len * (tg.f == null ? 0.5 : tg.f)); return cam.map([q.x, q.y]); }
+ var w3 = tg.anchor || byId[tg.for].anchor, off = tg.for ? offsetOf(tg.for, t) : [0, 0, 0];
+ return cam.map(P(w3[0] + off[0], w3[1] + off[1], w3[2] + off[2]));
+ }
+ function tagRectRaw(g, cam, t) {
+ var tg = g.tg, a;
+ var lv0 = g.log ? liveTagAt(g, t) : null, wmax = lv0 ? (g.ws[lv0.i] || 0) : Math.max.apply(null, g.ws.concat([0]));
+ if (tg.token) { a = tagAnchor(g, cam, t); if (!a) return null; var o3 = tg.off || [0, -36], w3 = wmax + 30; return { x: a[0] + o3[0] - w3 / 2 - 6, y: a[1] + o3[1] - g.h / 2 - 6, w: w3 + 12, h: g.h + 12 }; }
+ if (tg.pipe) { var pp = pipes[tg.pipe], q = atLen(pp, pp.len * (tg.f == null ? 0.5 : tg.f)); a = cam.map([q.x, q.y]); }
+ else { var w3 = tg.anchor || byId[tg.for].anchor, off = tg.for ? offsetOf(tg.for, t) : [0, 0, 0]; a = cam.map(P(w3[0] + off[0], w3[1] + off[1], w3[2] + off[2])); }
+ var off2 = tg.off || [0, -36], w = wmax + 30, sh = tg.align === 'right' ? -w / 2 : tg.align === 'left' ? w / 2 : 0;
+ return { x: a[0] + off2[0] + sh - w / 2 - 6, y: a[1] + off2[1] - g.h / 2 - 6, w: w + 12, h: g.h + 12 };
+ }
+ var TEXT_SAFE = [64, 58, 1856, 990]; // text keeps clear of the frame edges (the check: 3 %; the bottom 8 % is under phone player controls)
+ function inside(r, box) { return r && r.x >= box[0] && r.y >= box[1] && r.x + r.w <= box[2] && r.y + r.h <= box[3]; }
+ function onScreen(rectAt, t, box) { // min of the share of samples on screen in [t-0.2, t] and in [t, t+0.2]
+ var back = 0, fwd = 0, n = 4;
+ for (var k = 0; k <= n; k++) {
+ if (inside(rectAt(t - TEXT_FADE * k / n), box)) back++;
+ if (inside(rectAt(t + TEXT_FADE * k / n), box)) fwd++;
+ }
+ return Math.min(back, fwd) / (n + 1);
+ }
+ function floorRect(ft, t) { // the floor text's screen box under the camera at t
+ var cam = camera(t), it = ft.it, p = P(it.at[0], it.at[1], it.at[2] || 0), m = ft.m, len = ft.len, sz = ft.size, x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
+ [[0, -sz * 0.78], [len, -sz * 0.78], [len, sz * 0.22], [0, sz * 0.22]].forEach(function (c) {
+ var q = cam.map([p[0] + m[0] * c[0] + m[2] * c[1], p[1] + m[1] * c[0] + m[3] * c[1]]);
+ x0 = Math.min(x0, q[0]); y0 = Math.min(y0, q[1]); x1 = Math.max(x1, q[0]); y1 = Math.max(y1, q[1]);
+ });
+ return { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
+ }
+ var footHoles = []; // [{el, rect}]: each hole stays paired with its footer, so it follows the footer's reveal
+ function footerMask() { // a feathered hole in the floor layer under each footer line that has text
+ var k = lay.k || 1, base = stage && stage.getBoundingClientRect ? stage.getBoundingClientRect() : { left: 0, top: 0 };
+ report.footerMask = []; footHoles = []; gHoles.innerHTML = '';
+ document.querySelectorAll('.ld-foot').forEach(function (el) {
+ if (!String(el.textContent || '').trim()) return;
+ var r = el.getBoundingClientRect(); if (!r.width || !r.height) return;
+ var x = (r.left - base.left) / k - 10, y = (r.top - base.top) / k - 8, w = r.width / k + 20, h = r.height / k + 16;
+ report.footerMask.push([Math.round(x), Math.round(y), Math.round(w), Math.round(h)]);
+ footHoles.push({ el: el, rect: mk('rect', { x: f1(x), y: f1(y), width: f1(w), height: f1(h), rx: 6, fill: '#000' }, gHoles) });
+ });
+ }
+ function footerHoles() { // each hole as strong as its footer is visible now (a footer revealed later is not cut yet)
+ var any = false;
+ footHoles.forEach(function (fh) {
+ var st = fh.el.style, o = st.visibility === 'hidden' ? 0 : (st.opacity === '' ? 1 : parseFloat(st.opacity) || 0);
+ fh.rect.setAttribute('opacity', f3(o));
+ if (o > 0) any = true;
+ });
+ if (any) gFloorMask.setAttribute('mask', 'url(#ld-footmask)'); else gFloorMask.removeAttribute('mask');
+ }
+ function audit() { // every text must be fully on screen at some moment of its window, or it is reported
+ var never = function (from, to, rectAt) {
+ var seen = false, any = false;
+ for (var u = from; u <= to + 1e-6 && !seen; u += 0.25) { var r = rectAt(u); if (!r) continue; any = true; if (inside(r, TEXT_SAFE)) seen = true; }
+ return any && !seen;
+ };
+ var say = function (text, from, widest) {
+ var msg = '"' + text + '" never shows fully inside the text safe zone (from ' + (Math.round(from * 10) / 10) + ' s): it would be cut by the frame or sit under phone controls in the bottom 8 %; move it' +
+ (widest && widest !== text ? ' (its widest value, "' + widest + '", sets the size it is checked at: shorten that one, or give it more room)' : '');
+ report.warnings.push(msg); warn(msg);
+ };
+ var END = 40;
+ labels.forEach(function (l) {
+ var lb = l.lb, ok = function (u) { return labelWindow(lb, u) > 0.5 && textHide(u, l.ids, lb.focus) < 0.5 ? labelGeom(l, camera(u).map(anchorOf(lb, u)), l.el, l.side).rect : null; };
+ var to = lb.back != null ? lb.back + END : (lb.until != null ? lb.until : lb.at + END);
+ if (never(lb.at + 0.3, to, ok)) say(lb.title, lb.at);
+ });
+ tags.forEach(function (g) {
+ var tg = g.tg, t0 = g.keys[0][0];
+ var ok = function (u) { return u >= t0 && (tg.until == null || u < tg.until) && textHide(u, g.ids, tg.focus) < 0.5 ? tagRectRaw(g, camera(u), u) : null; };
+ var wi = g.ws.indexOf(Math.max.apply(null, g.ws.concat([0])));
+ if (never(Math.max(t0, 0) + 0.3, tg.until != null ? tg.until : t0 + END, ok)) say(g.keys[0][1], t0, g.keys.length > 1 && wi >= 0 ? g.keys[wi][1] : null);
+ });
+ floorTexts.forEach(function (ft) {
+ var it = ft.it, t0 = it.at0 != null ? it.at0 : (it.show || 0);
+ var ok = function (u) { return textHide(u, [], false) < 0.5 ? floorRect(ft, u) : null; };
+ if (never(t0 + 0.3, it.until != null ? it.until : t0 + END, ok)) say(it.text, t0);
+ });
+ }
+ function samePose(a, b) { return a.cam && b.cam && Math.abs(a.cam.z - b.cam.z) < 1e-3 && Math.abs(a.cam.ex - b.cam.ex) < 0.5 && Math.abs(a.cam.ey - b.cam.ey) < 0.5; }
+
+ /* ---------- render(t): the world as a pure function of t ---------- */
+ function render(t) {
+ var cam = camera(t), lw = L.lw / cam.z, fa = focusAt(t), F = fa.fc;
+ var camT = 'translate(' + f1(cam.ex) + ' ' + f1(cam.ey) + ') scale(' + (Math.round(cam.z * 10000) / 10000) + ')';
+ gWorld.setAttribute('transform', camT); gFloorCam.setAttribute('transform', camT);
+ var shadows = '';
+ var drawItem = function (it) {
+ if (it.kind === 'pipe' || it.kind === 'link') return pipes[it.id] ? pipeSVG(pipes[it.id], t, lw) : '';
+ if (it.kind === 'air') return airSVG(it, t, lw);
+ var p = it.build == null ? 1 : seg(t, it.build, it.dur || 0.6, E.outCubic);
+ if (p <= 0) return '';
+ var shown = it.vis ? visAt(it.vis, t) : 1; if (shown <= 0) return ''; // live: shown or hidden (show())
+ var lift = (1 - p) * (it.lift == null ? 9 : it.lift), off = offsetOf(it.id, t), v = V(off[0], off[1], off[2] + lift), op = clamp(p * 1.8, 0, 1) * shown;
+ if (it.footprint && it.shadow !== false) shadows += '<g transform="translate(' + f1(V(off[0], off[1], 0)[0]) + ' ' + f1(V(off[0], off[1], 0)[1]) + ')">' + shadowSVG(it.footprint, p, it.bbox ? it.bbox[0][2] : 0) + '</g>';
+ var fkey = it.icon === 'lamp' || it.icon === 'gate' || (it.icon === 'core' && it.glass) ? 'flow' : 'face';
+ var tn = it.id ? toneAt(it.id, t, null, null) : null, tint = tn && tn.to ? { c: toneOf(L, tn.to)[fkey], p: tn.p } : null;
+ if (tint && tn.from) tint = { c: mixHex(toneOf(L, tn.from)[fkey], toneOf(L, tn.to)[fkey], tn.p), p: 1 };
+ var pl = it.id ? pulseAt(it.id, t) : null;
+ if (pl) tint = tint ? { c: mixHex(tint.c, pl.c, pl.p), p: Math.max(tint.p, pl.p) } : pl;
+ var lampOnly = it.icon === 'lamp' || it.icon === 'gate' || (it.icon === 'core' && it.glass);
+ return '<g transform="translate(' + f1(v[0]) + ' ' + f1(v[1]) + ')" opacity="' + f3(op) + '">' + (it.shapes || []).map(function (sh) { return shapeSVG(sh, t, lw, lampOnly && !sh.lamp ? null : tint); }).join('') + '</g>';
+ };
+ gFloor.innerHTML = floorItems.map(drawItem).join('');
+ var body = sorted.map(drawItem).join('') + frontItems.map(drawItem).join('');
+ var toks = '';
+ tokens.forEach(function (tk) { var st = tokenAt(tk, t); if (st) toks += tokenSVG(tk, st, lw); });
+ var top = '';
+ if (fa.amount > 0) { // focus: veil the world in the ground colour, then lift the focus part and its own pipes above it
+ var keep = shadows;
+ top = '<rect x="-4000" y="-4000" width="10000" height="10000" fill="' + L.veil + '" opacity="' + f3((1 - (L.dimTo || 0.45)) * fa.amount) + '"/>';
+ items.forEach(function (it) { if (it.id && inFocus(F, it.id)) top += drawItem(it); });
+ shadows = keep;
+ }
+ gDraw.innerHTML = shadows + body + toks + top;
+ var B = spec.bands, bo = f3(fa.amount);
+ gBands.innerHTML = fa.amount > 0 && B ? '<rect x="45" y="45" width="1830" height="' + B[0] + '" fill="url(#ld-band-t)" opacity="' + bo + '"/><rect x="45" y="' + (1035 - B[1]) + '" width="1830" height="' + B[1] + '" fill="url(#ld-band-b)" opacity="' + bo + '"/>' : '';
+
+ floorTexts.forEach(function (ft) {
+ var it = ft.it, o = seg(t, it.at0 != null ? it.at0 : (it.show || 0), TEXT_FADE) * (it.until != null ? 1 - seg(t, it.until, TEXT_FADE) : 1) * (1 - textHide(t, [], false));
+ if (o > 0 && lay.done) o *= onScreen(function (u) { return floorRect(ft, u); }, t, TEXT_SAFE);
+ ft.el.setAttribute('opacity', f3(o)); ft.el.setAttribute('visibility', o > 0 ? 'visible' : 'hidden');
+ });
+ if (!lay.done) return;
+ labels.forEach(function (l) {
+ var lb = l.lb, a = cam.map(anchorOf(lb, t));
+ var pin = seg(t, lb.at, 0.38, E.inOutCubic), tin = seg(t, lb.at + 0.22, TEXT_FADE), rise = (1 - seg(t, lb.at + 0.22, 0.45, E.outCubic)) * 10;
+ var o = (1 - textHide(t, l.ids, lb.focus)) * labelWindow(lb, t);
+ if (o > 0 && pin > 0) o *= onScreen(function (u) { var c = camera(u); return labelGeom(l, c.map(anchorOf(lb, u)), l.el, l.side).rect; }, t, TEXT_SAFE);
+ l.g.setAttribute('opacity', f3(o));
+ // hidden or not, every attribute is set from t, so the DOM is the same whatever frame came before
+ l.g.setAttribute('visibility', pin <= 0 || o <= 0 ? 'hidden' : 'visible');
+ var gm = labelGeom(l, a, l.el, l.side), L1 = Math.hypot(gm.e[0] - a[0], gm.e[1] - a[1]), want = (L1 + 28) * pin;
+ var d = 'M' + f1(a[0]) + ' ' + f1(a[1]);
+ if (want <= L1) { var q = want / (L1 || 1); d += 'L' + f1(lerp(a[0], gm.e[0], q)) + ' ' + f1(lerp(a[1], gm.e[1], q)); }
+ else d += 'L' + f1(gm.e[0]) + ' ' + f1(gm.e[1]) + 'L' + f1(gm.e[0] + gm.dir * (want - L1)) + ' ' + f1(gm.e[1]);
+ l.lead.setAttribute('d', d);
+ l.dot.setAttribute('cx', f1(a[0])); l.dot.setAttribute('cy', f1(a[1])); l.dot.setAttribute('r', f1(5 * E.outCubic(seg(t, lb.at, 0.25))));
+ var anchor = gm.dir < 0 ? 'end' : 'start';
+ [l.tt, l.sub].forEach(function (e) { e.setAttribute('text-anchor', anchor); e.setAttribute('x', f1(gm.tx)); e.setAttribute('opacity', f3(tin)); });
+ l.tt.setAttribute('y', f1(gm.sh[1] - 4 + rise)); l.sub.setAttribute('y', f1(gm.sh[1] + L.size.sub + 8 + rise));
+ var r = gm.rect;
+ l.plate.setAttribute('x', f1(r.x)); l.plate.setAttribute('y', f1(r.y)); l.plate.setAttribute('width', f1(r.w)); l.plate.setAttribute('height', f1(r.h));
+ l.plate.setAttribute('opacity', f3(tin * (L.labelPlateOpacity || 0.9)));
+ });
+ tags.forEach(function (g) {
+ var tg = g.tg, a = tagAnchor(g, cam, t), fs = g.fs, h = g.h;
+ var lv = g.log ? liveTagAt(g, t) : null, first = lv ? lv.at : g.keys[0][0], until = lv ? lv.until : tg.until;
+ var o = a ? seg(t, first, TEXT_FADE) * (1 - textHide(t, g.ids, tg.focus)) * (until != null ? 1 - seg(t, until, TEXT_FADE) : 1) : 0;
+ if (tg.token && a) { var stk = tokenAt(tokById[tg.token], t); o *= stk ? clamp(stk.o * 1.5, 0, 1) : 0; }
+ var rise = (1 - seg(t, first, 0.35, E.outCubic)) * 8 + (tg.press != null ? 5 * Math.sin(Math.PI * seg(t, tg.press, 0.22)) : 0);
+ if (o > 0) o *= onScreen(function (u) { return tagRectRaw(g, camera(u), u); }, t, TEXT_SAFE);
+ if (!a) a = [0, 0];
+ g.g.setAttribute('opacity', f3(o)); g.g.setAttribute('visibility', o > 0 ? 'visible' : 'hidden');
+ var cur = 0; if (lv) cur = lv.i; else g.keys.forEach(function (k, i) { if (t >= k[0]) cur = i; });
+ var off2 = tg.off || [0, -36], w = (tg.type ? Math.max.apply(null, g.ws) + 30 + fs * 0.7 : (g.ws[cur] || 0) + 30), cy = a[1] + off2[1] + rise;
+ var cx = a[0] + off2[0] + (tg.align === 'right' ? -w / 2 : tg.align === 'left' ? w / 2 : 0); // align: the pill's edge sits on the offset
+ g.r.setAttribute('x', f1(cx - w / 2)); g.r.setAttribute('y', f1(cy - h / 2)); g.r.setAttribute('width', f1(w)); g.r.setAttribute('height', f1(h)); g.r.setAttribute('rx', f1(h / 2));
+ var ktn = lv && lv.tone ? toneOf(L, lv.tone) : g.keys[cur][2] ? toneOf(L, g.keys[cur][2]) : toneOf(L, tg.tone || tg.temp);
+ if (lv) g.tx[cur].setAttribute('fill', ktn.tagInk);
+ if (tg.press != null && t >= tg.press && t < tg.press + 0.3) ktn = toneOf(L, tg.pressTone || 'warm');
+ g.r.setAttribute('fill', ktn.tag); if (L.tagStyle === 'outline') g.r.setAttribute('stroke', ktn.tagInk);
+ g.tx.forEach(function (e, i) {
+ var tx0 = tg.type ? cx - w / 2 + 15 : cx;
+ e.setAttribute('x', f1(tx0)); e.setAttribute('y', f1(cy + fs * 0.36)); e.setAttribute('opacity', i === cur ? 1 : 0); e.setAttribute('visibility', i === cur ? 'visible' : 'hidden');
+ if (tg.press != null) e.setAttribute('fill', (t >= tg.press && t < tg.press + 0.3 ? toneOf(L, tg.pressTone || 'warm') : (g.keys[i][2] ? toneOf(L, g.keys[i][2]) : toneOf(L, tg.tone || tg.temp))).tagInk);
+ });
+ if (tg.type) { // typed: the text is revealed left to right, a caret follows it and blinks while it waits
+ var t0f = tg.typeFrom ? tg.typeFrom / Math.max(1, String(g.keys[0][1]).length) : 0; // typeFrom: characters already there before typing starts (a prompt)
+ var tp = lerp(t0f, 1, seg(t, tg.type[0], tg.type[1] - tg.type[0])), tw = (g.ws[cur] || 0) * (cur === 0 ? tp : 1), x0 = cx - w / 2 + 15;
+ g.clip.setAttribute('x', f1(x0 - 2)); g.clip.setAttribute('y', f1(cy - h / 2)); g.clip.setAttribute('width', f1(tw + 2)); g.clip.setAttribute('height', f1(h));
+ var typing = t >= tg.type[0] && t < tg.type[1], blink = ((Math.floor((t - tg.type[0]) * 2.4) % 2) + 2) % 2 === 0;
+ var showCaret = (typing || blink || t < tg.type[0]) && (tg.caretUntil == null || t < tg.caretUntil);
+ g.caret.setAttribute('x', f1(x0 + tw + 3)); g.caret.setAttribute('y', f1(cy - fs * 0.55)); g.caret.setAttribute('width', f1(fs * 0.5)); g.caret.setAttribute('height', f1(fs * 1.1));
+ g.caret.setAttribute('opacity', showCaret ? 1 : 0);
+ }
+ });
+ steps(t);
+ reveals.forEach(function (rv) {
+ var o = seg(t, rv.at, TEXT_FADE) * (rv.until != null ? 1 - seg(t, rv.until, TEXT_FADE) : 1);
+ rv.els.forEach(function (e) { e.style.opacity = f3(o); e.style.visibility = o > 0 ? 'visible' : 'hidden'; });
+ });
+ footerHoles();
+ if (spec.onFrame) spec.onFrame(t, { cam: cam, P: P, seg: seg, E: E, focus: fa });
+ }
+
+ /* ---------- steps: one persistent line per beat in the page (.ld-steps), shown in its window ---------- */
+ var stepHost = document.querySelector('.ld-steps');
+ var stepEls = (spec.steps || []).map(function (st, i) {
+ if (!stepHost) return null;
+ var e = document.createElement('div'); e.className = 'ld-step'; e.setAttribute('data-ld-step', String(i));
+ if (st.kicker) { var k = document.createElement('span'); k.className = 'ld-step-k'; k.textContent = st.kicker; e.appendChild(k); }
+ var tx = document.createElement('span'); tx.className = 'ld-step-t'; tx.textContent = st.text; e.appendChild(tx);
+ stepHost.appendChild(e); return e;
+ });
+ if ((spec.steps || []).length && !stepHost) warn('the scene has steps but the page has no .ld-steps element to show them in');
+ function steps(t) {
+ (spec.steps || []).forEach(function (st, i) {
+ var e = stepEls[i]; if (!e) return;
+ var next = spec.steps[i + 1], end = st.until != null ? st.until : (next ? next.at : Infinity);
+ var o = seg(t, st.at, TEXT_FADE) * (1 - seg(t, end - TEXT_FADE, TEXT_FADE)), rise = (1 - seg(t, st.at, 0.4, E.outCubic)) * 10;
+ e.style.opacity = f3(o); e.style.visibility = o > 0 ? 'visible' : 'hidden'; e.style.transform = 'translateY(' + f1(rise) + 'px)';
+ });
+ }
+
+ var reveals = (spec.reveal || []).map(function (rv) {
+ var els = Array.prototype.slice.call(document.querySelectorAll(rv.sel));
+ if (!els.length) warn('reveal: nothing on the page matches "' + rv.sel + '"');
+ return { at: rv.at, until: rv.until, els: els };
+ });
+ /* ---------- live mode: keys written at the moment the viewer acts (Diagram.live) ----------
+ set(target, value, {at, dur, tone}): a number is a store's level (0..1) or a stack's count; a string is a tag's
+ text (null hides it);
+ fire(target, {at, tone, dur} | {at, moves, stay}): a pulse on a part, or a token's route (moves as in
+ spec.tokens, `at` relative to the call; no moves hides it); focus(part | null, {at, with}): the veil on every
+ other part, the part's own pipes and links lit with it; hit(x, y, t): the topmost part under a stage point.
+ `at` defaults to the page's clock (opts.live.now). Each call only appends or rewrites keys, so any t is
+ still drawn the same way whatever came before. */
+ function visAt(log, t) { // a live show/hide log [{at, on}] -> 0..1 (0.3 s fades)
+ var k = -1; for (var j = 0; j < log.length && log[j].at <= t; j++) k = j;
+ if (k < 0) return 1;
+ var e = log[k], was = k > 0 ? log[k - 1].on : true;
+ if (e.on === was) return e.on ? 1 : 0;
+ return e.on ? seg(t, e.at, 0.3) : 1 - seg(t, e.at, 0.3);
+ }
+ function liveTagAt(g, t) { // -> null (no live value yet at t: the scene's own keys) | {i, at, until, tone}
+ var log = g.log, k = -1; for (var j = 0; j < log.length && log[j].at <= t; j++) k = j;
+ if (k < 0) return null;
+ var e = log[k];
+ if (e.i == null) { // hidden from e.at: fading out what showed before (a live value or the scene's own)
+ var p = k > 0 ? log[k - 1] : null, wasOn = p ? p.i != null : (e.at >= g.keys[0][0] && (g.tg.until == null || g.tg.until > e.at));
+ var fi = 0; if (!p) g.keys.forEach(function (kk, ii) { if (e.at >= kk[0]) fi = ii; });
+ return wasOn ? { i: p ? p.i : fi, at: -1e9, until: e.at, tone: p ? p.tone : null } : { i: 0, at: 1e12, until: null, tone: null };
+ }
+ // shown since: the start of the run of shown values this one belongs to (a new value replaces the old at once)
+ var since = e.at, m = k;
+ while (m > 0 && log[m - 1].i != null) { m--; since = log[m].at; }
+ if (m === 0) { var on0 = since >= g.keys[0][0] && (g.tg.until == null || g.tg.until > since); if (on0) since = -1e9; }
+ return { i: e.i, at: since, until: null, tone: e.tone };
+ }
+ var liveApi = null;
+ if (LIVE) {
+ var tagById = {}; tags.forEach(function (g) { if (g.tg.id && !tagById[g.tg.id]) tagById[g.tg.id] = g; });
+ var liveFocus = null;
+ var when = function (o) { return o && o.at != null ? o.at : (LIVE.now ? LIVE.now() : 0); };
+ var incident = function (id) { // the pipes and links that end on a part: they light with it
+ return items.filter(function (it) {
+ return (it.kind === 'pipe' || it.kind === 'link') && it.id && [it.from, it.to].some(function (r) { return typeof r === 'string' && r.split('.')[0] === id; });
+ }).map(function (it) { return it.id; });
+ };
+ // a tag's live log: [{at, i | null (hidden), tone}], in time; a call at `at` drops what was scheduled after it
+ var liveTag = function (g, text, at, tone) {
+ var log = g.log || (g.log = []);
+ while (log.length && log[log.length - 1].at > at) log.pop();
+ if (text == null) { log.push({ at: at, i: null, tone: null }); return; }
+ text = String(text);
+ var i = -1; for (var j = 0; j < g.tx.length; j++) if (g.tx[j].textContent === text) { i = j; break; }
+ if (i < 0) { // a value the scene did not list: one more persistent text, measured once
+ var tn0 = toneOf(L, tone || g.tg.tone || g.tg.temp);
+ var e = mk('text', { 'font-family': L.font.mono, 'font-size': g.fs, 'font-weight': 600, fill: tn0.tagInk, 'text-anchor': 'middle', opacity: 0, visibility: 'hidden' }, g.g);
+ e.textContent = text; g.tx.push(e); g.keys.push([1e12, text]); g.ws.push(lay.done ? e.getComputedTextLength() : text.length * g.fs * 0.6);
+ i = g.tx.length - 1;
+ }
+ log.push({ at: at, i: i, tone: tone || null });
+ if (log.length > 400) log.splice(0, log.length - 400);
+ };
+ liveApi = {
+ set: function (target, value, o) {
+ // a number moves a store's level or a stack's count; a string (or null) is a tag's text: a tag may share
+ // its id with the part it names
+ o = o || {}; var at = when(o), num = typeof value === 'number', lv = num ? liveLevels[target] : null, g = num ? null : tagById[target];
+ if (lv && lv.stack) {
+ var k = lv.keys; while (k.length > 1 && k[k.length - 1][0] > at) k.pop();
+ k.push([at, Math.max(0, Math.round(Number(value) || 0))]);
+ return;
+ }
+ if (lv) {
+ var kk = lv.keys, v0 = keyed(kk, at, 0), d = o.dur == null ? 0.8 : o.dur;
+ while (kk.length > 1 && kk[kk.length - 1][0] >= at) kk.pop();
+ kk.push([at, v0], [at + Math.max(0.001, d), clamp(Number(value) || 0, 0, 1)]);
+ return;
+ }
+ if (g) { liveTag(g, value, at, o.tone); return; }
+ warn('set: "' + target + '" is not ' + (num ? 'a store or a stack (a number sets a level or a count)' : 'a tag id (a string sets a tag\'s text)'));
+ },
+ fire: function (target, o) {
+ o = o || {}; var at = when(o), tk = tokById[target];
+ if (tk) { // a route (no moves: hidden from `at`); the routes stay in time, a call drops the ones after it
+ var routes = tk.routes || (tk.routes = [{ start: -1e12, moves: tk.moves || [], until: tk.until }]);
+ while (routes.length > 1 && routes[routes.length - 1].start >= at) routes.pop();
+ var mv = (o.moves || []).map(function (m) { return Object.assign({}, m, { at: at + (m.at || 0) }); }), last = mv[mv.length - 1];
+ routes.push({ start: at, moves: mv, until: !last || o.stay === true ? null : last.at + (last.dur == null ? 0.8 : last.dur) + (o.stay == null ? 0.3 : o.stay) });
+ return;
+ }
+ if (byId[target]) {
+ if (pulses.length > 600) pulses = pulses.filter(function (st) { return !st.live || st.at > at - 60; });
+ pulses.push({ target: target, at: at, tone: o.tone || 'cold', dur: o.dur == null ? 0.8 : o.dur, amount: o.amount, pulse: true, live: true });
+ return;
+ }
+ warn('fire: "' + target + '" is not a token or a part');
+ },
+ focus: function (id, o) {
+ o = o || {}; var at = when(o), d = o.dur == null ? 0.15 : o.dur;
+ if (liveFocus && liveFocus.part === id) return;
+ if (liveFocus) liveFocus.until = at;
+ liveFocus = null;
+ if (focuses.length > 400) focuses = focuses.filter(function (fc) { return !fc.live || fc.until === Infinity || fc.until + fc.out + 60 > at; });
+ if (id && byId[id]) { liveFocus = { part: id, with: incident(id).concat(o.with || []), at: at, dur: d, out: d, until: Infinity, live: true }; focuses.push(liveFocus); }
+ else if (id) warn('focus: unknown part "' + id + '"');
+ },
+ hit: function (x, y, t, only) {
+ var rank = {}; sorted.forEach(function (it, i) { if (it.id) rank[it.id] = i; });
+ var best = null;
+ partHulls(camera(t), t).forEach(function (h) {
+ if (only && only.indexOf(h.id) < 0) return;
+ if (!inPoly(x, y, h.poly)) return;
+ var r = rank[h.id] == null ? -1 : rank[h.id]; if (!best || r > best.r) best = { id: h.id, r: r };
+ });
+ return best ? best.id : null;
+ },
+ box: function (id, t) {
+ var h = partHulls(camera(t), t).filter(function (x) { return x.id === id; })[0]; if (!h) return null;
+ var x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
+ h.poly.forEach(function (p) { x0 = Math.min(x0, p[0]); y0 = Math.min(y0, p[1]); x1 = Math.max(x1, p[0]); y1 = Math.max(y1, p[1]); });
+ return { x: x0, y: y0, w: x1 - x0, h: y1 - y0 };
+ },
+ // tone(part | pipe, tone | null, {at, dur}): its colour from `at` (null: back to neutral), as a scene's states
+ tone: function (target, tone, o) {
+ o = o || {}; var at = when(o);
+ if (!byId[target]) { warn('tone: unknown part or pipe "' + target + '"'); return; }
+ for (var j = states.length - 1; j >= 0; j--) if (states[j].live && states[j].target === target && states[j].at > at) states.splice(j, 1);
+ var st = { target: target, at: at, tone: tone || null, dur: o.dur == null ? 0.4 : o.dur, live: true }, k = states.length;
+ while (k > 0 && states[k - 1].at > at) k--;
+ states.splice(k, 0, st);
+ },
+ // show(part, on, {at}): a part shown or hidden from `at` (0.3 s fade); a scene's floor marks included
+ show: function (target, on, o) {
+ o = o || {}; var at = when(o), it = byId[target];
+ if (!it) { warn('show: unknown item "' + target + '"'); return; }
+ var log = it.vis || (it.vis = []);
+ while (log.length && log[log.length - 1].at > at) log.pop();
+ var last = log.length ? log[log.length - 1].on : true;
+ if (last !== !!on) log.push({ at: at, on: !!on });
+ },
+ incident: incident,
+ tags: function () { return Object.keys(tagById); },
+ };
+ }
+ if (root.ST && ST.onSeek && !(LIVE && !LIVE.seek)) ST.onSeek(function (t) { render(t); });
+ var api = { render: render, report: report, ready: ready, theme: L, project: P, camera: camera, order: sorted, pipes: pipes, validate: function () { return validate(spec); } };
+ if (liveApi) Object.assign(api, liveApi);
+ Diagram.current = api; Diagram.report = report;
+ return api;
+ }
+
+ // a live figure: mount(spec) whose keys the page writes as the viewer acts. opts.live: {now: fn -> seconds (the
+ // page's clock, the default `at` of set/fire/focus), seek: true to follow ST.seek (a film made from a live scene)}
+ function live(spec, opts) { opts = Object.assign({}, opts || {}); opts.live = opts.live && opts.live !== true ? opts.live : {}; return mount(spec, opts); }
+ var Diagram = { mount: mount, live: live, validate: validate, themes: THEMES, parts: LIB, seg: seg, E: E, version: '0.2.0' };
+ root.Diagram = Diagram; root.LD = Diagram;
+})(typeof window !== 'undefined' ? window : this);
diff --git a/skills/showtime/runtime/figure-film.js b/skills/showtime/runtime/figure-film.js
new file mode 100644
index 0000000..7de520f
--- /dev/null
+++ b/skills/showtime/runtime/figure-film.js
@@ -0,0 +1,116 @@
+/* showtime living diagrams: what a live figure's steps write, and the film of a live scene (runtime/figure-film.js).
+ *
+ * Classic script, one global: `Figure` (runtime/figure.js adds the live page to it). Load after /_st/diagram.js.
+ * A film page (the diagram template's index.html) loads only this file: Figure.film(SCENE) draws a live-first
+ * scene's tour on the film's clock, so it uses no wall clock, no timer and no randomness (the same rules as
+ * diagram.js). The live page's clock, timers and pointer live in figure.js.
+ *
+ * makeFx(api, clock, state, I) is the fx a step's run(fx, again) gets: level, count, say, hide, pulse, tone, show,
+ * send, park, focus, every; each lands at the action's time plus its delay (references/workflows/diagram.md).
+ */
+(function (root) {
+ 'use strict';
+ var Figure = root.Figure || {};
+
+ /* ---------------- the actions a step writes: shared by the live page, the walk and the film ---------------- */
+ // clock: {now(), reduced}; api: the Diagram.live api. Returns fx (handed to steps) and the bookkeeping.
+ function makeFx(api, clock, state, I) {
+ var loops = [];
+ var fx = {
+ state: state, reduced: !!clock.reduced, data: I.data || {}, tau: 0,
+ at: function (o) { return fx.tau + (clock.reduced ? 0 : ((o && o.delay) || 0)); },
+ level: function (id, v, o) { api.set(id, v, { at: fx.at(o), dur: clock.reduced ? 0.001 : (o && o.dur != null ? o.dur : 0.8) }); },
+ count: function (id, n, o) { api.set(id, n, { at: fx.at(o) }); },
+ say: function (tag, text, tone, o) { if (tone && typeof tone === 'object') { o = tone; tone = o.tone; } api.set(tag, text, { at: fx.at(o), tone: tone }); },
+ hide: function (tag, o) { api.set(tag, null, { at: fx.at(o) }); },
+ pulse: function (id, tone, o) { if (clock.reduced) return; api.fire(id, { at: fx.at(o), tone: tone || 'cold', dur: o && o.dur, amount: o && o.amount }); },
+ send: function (token, moves, o) {
+ o = o || {};
+ if (clock.reduced) { // the end of the route, at once; a passing packet is not shown
+ if (!o.stay) return;
+ moves = moves.map(function (m) { return Object.assign({}, m, { at: 0, dur: 0.001 }); });
+ }
+ api.fire(token, { at: fx.at(o), moves: moves, stay: o.stay === true ? true : o.stay });
+ },
+ park: function (token, o) { api.fire(token, { at: fx.at(o), moves: [] }); },
+ tone: function (id, tone, o) { api.tone(id, tone || null, { at: fx.at(o), dur: clock.reduced ? 0.001 : (o && o.dur) }); },
+ show: function (id, on, o) { api.show(id, on !== false, { at: fx.at(o) }); },
+ focus: function (id, o) { api.focus(id || null, { at: fx.at(o) }); },
+ every: function (ms, fn, name) { clock.every(ms, fn, loops, name || ''); },
+ stopLoops: function (name) {
+ var stop = loops.filter(function (l) { return name == null || l.name === name; });
+ clock.stop(stop); for (var i = loops.length - 1; i >= 0; i--) if (stop.indexOf(loops[i]) >= 0) loops.splice(i, 1);
+ },
+ };
+ return fx;
+ }
+ function stepText(st, state) { return typeof st.text === 'function' ? st.text(state) : (st.text || ''); }
+ function knobDefaults(I) { var s = {}; Object.keys(I.knobs || {}).forEach(function (k) { s[k] = I.knobs[k].default; }); return s; }
+ function stepIndex(I, id) { for (var i = 0; i < I.steps.length; i++) if (I.steps[i].id === id) return i; return -1; }
+ function partsOf(spec, I) {
+ if (I.parts) return I.parts.slice();
+ var seen = {}, out = [];
+ (spec.labels || []).forEach(function (lb) { if (lb.for && !seen[lb.for]) { seen[lb.for] = 1; out.push({ id: lb.for, name: lb.title, sub: lb.sub || '' }); } });
+ return out;
+ }
+ function normalise(spec) {
+ var I = Object.assign({ steps: [], knobs: {}, tour: null }, spec.interactive || {});
+ I.steps = I.steps || [];
+ return I;
+ }
+
+ /* ---------------- the film of a live scene: its tour, drawn on the film's clock ---------------- */
+ // index.html of a scene with interactive.film === 'tour': Figure.film(SCENE). The tour's actions are applied once,
+ // at mount, at their times on the film's clock (an every() loop repeats until the next action), so every frame
+ // is a pure function of t, like any film.
+ function film(spec, opts) {
+ opts = opts || {};
+ var I = normalise(spec), state = knobDefaults(I), T = 0, loops = [], log = [];
+ var SCRIPT = I.tour || I.steps.map(function (s) { return [{ step: s.id }, 7000]; });
+ // the step lines of the film: one per step entered, and again when a knob changes the step's words
+ var steps = [], cur = null, total = 0;
+ SCRIPT.forEach(function (s) {
+ var a = s[0];
+ if (a && a.step != null) cur = I.steps[stepIndex(I, a.step)];
+ if (a && a.knob) state[a.knob[0]] = a.knob[1];
+ var txt = cur ? stepText(cur, state) : '', prev = steps[steps.length - 1];
+ if (cur && (a.step != null || a.knob) && !(prev && prev.kicker === cur.kicker && prev.text === txt)) steps.push({ at: total + 0.05, kicker: cur.kicker, text: txt });
+ total += s[1] / 1000;
+ });
+ state = knobDefaults(I);
+ var filmSpec = Object.assign({}, spec, { steps: (spec.steps || []).concat(steps) });
+ var clock = { reduced: false, now: function () { return T; }, manual: true,
+ every: function (ms, fn, ls, name) { fn(); if (ms > 0) ls.push({ ms: ms, fn: fn, next: T + ms / 1000, name: name || '' }); }, stop: function () {} };
+ var api = Diagram.live(filmSpec, Object.assign({}, opts, { live: { now: clock.now, seek: true } }));
+ if (!api) return null;
+ var fx = makeFx(api, clock, state, I);
+ fx.every = function (ms, fn, name) { clock.every(ms, fn, loops, name); };
+ fx.stopLoops = function (name) { for (var i = loops.length - 1; i >= 0; i--) if (name == null || loops[i].name === name) loops.splice(i, 1); };
+ var runUntil = function (t) { // the loops' repeats before t
+ loops.forEach(function (l) { while (l.next < t - 1e-9) { var keep = T; T = l.next; fx.tau = T; l.fn(); T = keep; l.next += l.ms / 1000; } });
+ };
+ var step = null, hover = null;
+ SCRIPT.forEach(function (s) {
+ var a = s[0];
+ runUntil(T);
+ fx.tau = T;
+ if (typeof a === 'function') a(fx, state);
+ else {
+ if (a.knob) state[a.knob[0]] = a.knob[1];
+ if (a.step != null) { step = I.steps[stepIndex(I, a.step)]; loops.length = 0; if (I.reset) I.reset(fx); if (step && step.run) step.run(fx, false); }
+ else if (a.knob && step && step.knob === a.knob[0] && step.run) step.run(fx, true);
+ if (a.hover !== undefined && a.hover !== hover) { hover = a.hover; api.focus(hover || null, { at: T }); }
+ }
+ log.push([T, a]);
+ T += s[1] / 1000;
+ });
+ runUntil(T);
+ api.filmLength = T;
+ return api;
+ }
+
+ Figure.film = film;
+ Figure.core = { makeFx: makeFx, stepText: stepText, knobDefaults: knobDefaults, stepIndex: stepIndex, partsOf: partsOf, normalise: normalise };
+ Figure.version = '0.1.0';
+ root.Figure = Figure;
+})(typeof window !== 'undefined' ? window : this);
diff --git a/skills/showtime/runtime/figure.css b/skills/showtime/runtime/figure.css
new file mode 100644
index 0000000..5e49fa0
--- /dev/null
+++ b/skills/showtime/runtime/figure.css
@@ -0,0 +1,120 @@
+/* showtime living diagrams: the live figure page (runtime/figure.js). White ground, neutral greys, blue for what
+ flows or is selected, warm for a rise or an alert; Inter and JetBrains Mono. Every readable colour is >= 4.5:1. */
+.fg {
+ --fg-bg: #FFFFFF; --fg-soft: #F7F8FA; --fg-line: #E5E7EB; --fg-line2: #D1D5DB; --fg-ink: #111827; --fg-ink2: #4B5563; --fg-ink3: #6B7280;
+ --fg-blue: #2563EB; --fg-blue-ink: #1D4ED8; --fg-blue-soft: #EFF4FF; --fg-warm: #C2410C; --fg-ok: #15803D;
+ color: var(--fg-ink); font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
+}
+html, body { margin: 0; background: #FFFFFF; }
+:root[data-theme="dark"] .fg { --fg-bg: #0A0F19; --fg-soft: #111A2A; --fg-line: #23314A; --fg-line2: #33445F; --fg-ink: #EEF2F8; --fg-ink2: #A9B6C8;
+ --fg-ink3: #8FA0B8; --fg-blue: #5CD3FF; --fg-blue-ink: #7FDCFF; --fg-blue-soft: #10233A; --fg-warm: #FF8F66; --fg-ok: #6EEBA3; }
+:root[data-theme="dark"], :root[data-theme="dark"] body { background: #0A0F19; }
+.fg .fg-app { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; min-height: 100vh; background: var(--fg-bg); }
+.fg .fg-main { padding: 24px 28px 28px; box-sizing: border-box; min-width: 0; }
+.fg .fg-fig { position: relative; overflow: hidden; width: 100%; border: 1px solid var(--fg-line); border-radius: 14px; background: var(--fg-bg); touch-action: manipulation; outline: none; }
+.fg .fg-fig .ld-stage { position: absolute; left: 0; top: 0; background: var(--fg-bg); }
+.fg .fg-ld { position: absolute; inset: 0; }
+.fg .fg-card { position: absolute; width: 440px; padding: 20px 24px 22px; background: var(--fg-bg); border: 1.5px solid var(--fg-line); border-radius: 14px;
+ box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08); pointer-events: none; box-sizing: border-box; }
+.fg .fg-card .n { display: block; font-weight: 650; font-size: 34px; line-height: 1.15; letter-spacing: -0.01em; }
+.fg .fg-card .s { display: block; font-size: 26px; line-height: 1.35; color: var(--fg-ink2); margin-top: 4px; }
+.fg .fg-card .v { display: block; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 26px; line-height: 1.35; color: var(--fg-blue-ink); margin-top: 12px; }
+.fg .fg-card .v[hidden] { display: none; }
+.fg .fg-tone-hot .v, .fg .fg-card .v.fg-tone-hot, .fg .fg-card .v.fg-tone-warm { color: var(--fg-warm); }
+.fg .fg-card .v.fg-tone-ok { color: var(--fg-ok); }
+.fg .fg-card .v.fg-tone-mute { color: var(--fg-ink2); }
+.fg button { font: inherit; color: inherit; }
+.fg button:focus-visible, .fg input:focus-visible, .fg summary:focus-visible { outline: 2px solid var(--fg-blue); outline-offset: 2px; }
+/* the rail */
+.fg .fg-rail { padding: 28px 24px 28px 4px; box-sizing: border-box; }
+.fg .fg-brand { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-ink3); }
+.fg h1 { font-weight: 650; font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; margin: 6px 0; }
+.fg .fg-sub { font-size: 14px; line-height: 1.5; color: var(--fg-ink2); margin: 0 0 8px; }
+.fg .fg-sec { margin-top: 22px; }
+.fg .fg-sec[hidden] { display: none; }
+.fg .fg-sec > h2, .fg .fg-reads h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-ink3); margin: 0 0 8px; }
+.fg .fg-steps { display: flex; flex-direction: column; gap: 2px; }
+.fg .fg-stepb { display: flex; gap: 12px; align-items: center; text-align: left; background: transparent; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer; min-height: 40px; }
+.fg .fg-stepb .n { font-size: 12px; font-weight: 600; width: 22px; height: 22px; border-radius: 50%; background: var(--fg-soft); border: 1px solid var(--fg-line); color: var(--fg-ink2);
+ display: inline-flex; align-items: center; justify-content: center; flex: none; }
+.fg .fg-stepb .k { font-size: 14.5px; line-height: 1.3; color: var(--fg-ink2); }
+.fg .fg-stepb:hover { background: var(--fg-soft); }
+.fg .fg-stepb[aria-current="step"] { background: var(--fg-blue-soft); }
+.fg .fg-stepb[aria-current="step"] .n { background: var(--fg-blue-ink); border-color: var(--fg-blue-ink); color: #FFFFFF; }
+.fg .fg-stepb[aria-current="step"] .k { color: var(--fg-ink); font-weight: 600; }
+.fg .fg-parts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
+.fg .fg-part { text-align: left; border: 1px solid var(--fg-line); background: var(--fg-bg); border-radius: 10px; padding: 9px 11px; cursor: pointer; min-height: 44px; }
+.fg .fg-part .n { display: block; font-weight: 600; font-size: 14px; }
+.fg .fg-part .s { display: block; font-size: 12px; line-height: 1.35; color: var(--fg-ink3); margin-top: 1px; }
+.fg .fg-part.on, .fg .fg-part:hover { border-color: var(--fg-blue); background: var(--fg-blue-soft); }
+.fg .fg-part[aria-pressed="true"] { border-color: var(--fg-blue); box-shadow: inset 0 0 0 1px var(--fg-blue); }
+.fg details { font-size: 14px; }
+.fg details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--fg-ink2); min-height: 32px; display: flex; align-items: center; }
+.fg .fg-narr { line-height: 1.55; color: var(--fg-ink2); margin: 4px 0 0; }
+.fg .fg-row { display: flex; gap: 8px; flex-wrap: wrap; }
+.fg .fg-btn { border: 1px solid var(--fg-line); background: var(--fg-bg); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; min-height: 40px; color: var(--fg-ink2); }
+.fg .fg-btn:hover { border-color: var(--fg-line2); color: var(--fg-ink); }
+.fg .fg-keys { font-size: 12px; color: var(--fg-ink3); line-height: 1.8; margin-top: 16px; }
+.fg .fg-keys kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; border: 1px solid var(--fg-line); border-radius: 5px; padding: 1px 5px; background: var(--fg-soft); color: var(--fg-ink2); }
+.fg .fg-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+/* under the figure: the step, the knob beside the numbers it moves */
+.fg .fg-strip { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px 24px; padding: 20px 2px 0; align-items: start; }
+.fg .fg-step { grid-column: 1 / -1; }
+.fg .fg-step[hidden] { display: none; }
+.fg .fg-step .k { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-blue-ink); }
+.fg .fg-step .t { display: block; font-size: 20px; line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; margin-top: 4px; max-width: 46em; }
+.fg .fg-board { display: none; }
+.fg .fg-keybtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
+.fg .fg-keybtns[hidden] { display: none; }
+.fg .fg-keybtns .fg-btn { color: var(--fg-ink); font-weight: 600; min-height: 44px; }
+.fg .fg-knob { background: var(--fg-bg); border: 1px solid var(--fg-line); border-radius: 12px; padding: 14px 14px 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
+.fg .fg-knob[hidden] { display: none; }
+.fg .fg-noknob .fg-ctrl { display: none; }
+.fg .kh { display: block; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
+.fg .kh span { display: block; font-weight: 400; font-size: 12.5px; color: var(--fg-ink3); margin-top: 2px; }
+.fg .kh b { font-family: 'JetBrains Mono', monospace; color: var(--fg-blue-ink); }
+.fg .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--fg-soft); border: 1px solid var(--fg-line); border-radius: 10px; padding: 3px; }
+.fg .seg button { border: 0; background: transparent; border-radius: 8px; padding: 8px 4px; cursor: pointer; min-height: 52px; }
+.fg .seg button b { display: block; font-family: 'JetBrains Mono', monospace; font-size: 19px; font-weight: 600; }
+.fg .seg button span { display: block; font-size: 11.5px; color: var(--fg-ink3); margin-top: 1px; }
+.fg .seg button[aria-checked="true"] { background: var(--fg-bg); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12), 0 0 0 1px var(--fg-line); }
+.fg .seg button[aria-checked="true"] b { color: var(--fg-blue-ink); }
+.fg input[type=range] { width: 100%; accent-color: var(--fg-blue); height: 32px; }
+.fg .fg-reads { grid-column: 2; }
+.fg .fg-noknob .fg-reads { grid-column: 1 / -1; }
+.fg .fg-ro { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
+.fg .ro { display: block; background: var(--fg-bg); border: 1px solid var(--fg-line); border-radius: 12px; padding: 10px 12px; }
+.fg .ro .k { display: block; font-size: 12.5px; color: var(--fg-ink2); }
+.fg .ro .v { display: block; font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; margin-top: 3px; color: var(--fg-ink); }
+.fg .ro .u { display: block; font-size: 11.5px; color: var(--fg-ink3); margin-top: 2px; }
+.fg .ro.txt .v { font-family: 'Inter', sans-serif; font-size: 16px; line-height: 1.3; }
+.fg .ro.fg-tone-hot .v, .fg .ro.fg-tone-warm .v { color: var(--fg-warm); }
+.fg .ro.fg-tone-cold .v { color: var(--fg-blue-ink); }
+.fg .ro.fg-tone-ok .v { color: var(--fg-ok); }
+.fg .ro.fg-tone-mute .v { color: var(--fg-ink2); }
+.fg .ro.on { border-color: var(--fg-blue); box-shadow: inset 0 0 0 1px var(--fg-blue); }
+.fg .fg-note { font-size: 13px; line-height: 1.5; color: var(--fg-ink2); margin: 10px 2px 0; }
+.fg .fg-src { font-size: 12px; color: var(--fg-ink3); margin: 4px 2px 0; }
+.fg .fg-tour[hidden] { display: none; }
+.fg .fg-tour { grid-column: 1 / -1; justify-self: start; font-size: 12.5px; color: var(--fg-ink2); background: var(--fg-bg); border: 1px solid var(--fg-line); border-radius: 999px;
+ padding: 5px 6px 5px 12px; display: flex; gap: 10px; align-items: center; }
+.fg .fg-tour button { border: 0; background: var(--fg-ink); color: var(--fg-bg); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; }
+.fg .fg-tour .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-blue); }
+/* phone: the words leave the drawing; the panel carries them */
+.fg-phone .fg .fg-app { grid-template-columns: minmax(0, 1fr); }
+.fg-phone .fg .fg-main { padding: 12px 12px 0; }
+.fg-phone .fg .fg-fig { border-radius: 12px; }
+.fg-phone .fg .fg-rail { padding: 6px 16px 28px; }
+.fg-phone .fg .fg-ld [data-ld-label], .fg-phone .fg .fg-ld [data-ld-tag] { display: none; }
+.fg-phone .fg .fg-brand, .fg-phone .fg h1, .fg-phone .fg .fg-sub { display: none; }
+.fg-phone .fg .fg-strip { grid-template-columns: minmax(0, 1fr); padding: 14px 4px 0; gap: 12px; }
+.fg-phone .fg .fg-reads { grid-column: 1; }
+.fg-phone .fg .fg-step .t { font-size: 17px; }
+.fg-phone .fg .fg-board { display: flex; flex-wrap: wrap; gap: 6px; }
+.fg-phone .fg .fg-board span { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; background: var(--fg-soft); color: var(--fg-ink); border-radius: 999px; padding: 4px 10px; }
+.fg-phone .fg .fg-ro { grid-template-columns: 1fr 1fr; }
+.fg-phone .fg .ro .v { font-size: 20px; }
+.fg-phone .fg .fg-steps { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; }
+.fg-phone .fg .fg-stepb { flex: none; border: 1px solid var(--fg-line); min-height: 44px; }
+.fg-phone .fg .fg-stepb .k { white-space: nowrap; }
+.fg-phone .fg .fg-keys { display: none; }
diff --git a/skills/showtime/runtime/figure.js b/skills/showtime/runtime/figure.js
new file mode 100644
index 0000000..563b824
--- /dev/null
+++ b/skills/showtime/runtime/figure.js
@@ -0,0 +1,483 @@
+/* showtime living diagrams: the live figure page around Diagram.live (runtime/figure.js + figure.css).
+ *
+ * Classic script: adds Figure.mount to the global `Figure` of /_st/figure-film.js. Load after diagram.js and it:
+ *
+ * <html data-theme="white">
+ * <link rel="stylesheet" href="/_st/diagram.css"> <link rel="stylesheet" href="/_st/figure.css">
+ * <script src="/_st/diagram.js"></script> <script src="/_st/figure-film.js"></script> <script src="/_st/figure.js"></script>
+ * <div id="figure"></div> <script src="scene.js"></script> <script>Figure.mount(SCENE);</script>
+ *
+ * The board is there and moving from the first frame (no play button, no timeline). The viewer hovers or tabs to a
+ * part (the film's focus veil lights it and its own wires; a card says what it is and its value), picks a step
+ * (an experiment that runs on the board), turns a knob (the step runs again with the new value: fills, stacks and
+ * tags answer at once). Untouched, an idle tour of the same live actions plays; any input stops it and it comes
+ * back after 20 s. Keys, deep links (#step=...&<knob>=...&part=...), reduced motion (still, input still works),
+ * a pause when off screen or hidden, and a phone layout (the words leave the drawing for the panel).
+ *
+ * The scene says what is interactive in SCENE.interactive (references/workflows/diagram.md, Interactive):
+ * { title, sub, parts: [{id, name, sub}], steps: [{id, kicker, text | fn(state), knob, narr, run(fx, again)}],
+ * reset(fx), knobs: {name: {label, hint, options: [[value, words]] | min, max, step, format(v)}, default},
+ * readouts(state, stepId) -> {rows: [{part, k, v, u, tone}], note}, source, tour: [[action, ms]],
+ * agree(state, stepId, {board, step, readouts}) -> [contradictions] (the walk reports them),
+ * crop: {desk: [x0, y0, x1, y1], phone: [...]}, start: t (the live clock starts here: a film-first scene starts
+ * after its build), film: 'tour' (index.html draws the tour as the film: Figure.film) }
+ * A step's run(fx, again) writes keys through fx: level(id, v), count(id, n), say(tag, text, tone), hide(tag),
+ * pulse(part, tone), tone(part, tone | null), show(part, on), send(token, moves, {stay}), park(token), focus(part),
+ * every(ms, fn, name); each takes {delay, dur} where it
+ * applies; `again` is true when only a knob moved (retarget, no new shock). fx.state holds the knobs' values.
+ * Every call lands at the action's time plus its delay, so a figure is a pure function of its clock and its log.
+ */
+(function (root) {
+ 'use strict';
+ var D = root.document;
+ var W = 1920, H = 1080, SAFE = [64, 58, 1856, 990];
+ var esc = function (s) { return String(s == null ? '' : s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); };
+ var el = function (tag, cls, html) { var e = D.createElement(tag); if (cls) e.className = cls; if (html != null) e.innerHTML = html; return e; };
+ var warn = function (m) { if (root.console) console.warn('[showtime] figure: ' + m); };
+
+ var C = root.Figure && root.Figure.core;
+ if (!C) { if (root.console) console.warn('[showtime] figure: load /_st/figure-film.js before /_st/figure.js'); return; }
+ var makeFx = C.makeFx, stepText = C.stepText, knobDefaults = C.knobDefaults, stepIndex = C.stepIndex, partsOf = C.partsOf, normalise = C.normalise;
+
+ /* ---------------- the live page ---------------- */
+ function mount(spec, opts) {
+ opts = opts || {};
+ var I = normalise(spec), host = typeof opts.host === 'string' ? D.querySelector(opts.host) : (opts.host || D.querySelector('#figure'));
+ if (!host) { warn('no host element (#figure) on the page'); return null; }
+ var theme = opts.theme || D.documentElement.getAttribute('data-theme') || spec.theme || 'white';
+ var mq = function (q) { try { return root.matchMedia && root.matchMedia(q).matches; } catch (e) { return false; } };
+ var RM = opts.reduced != null ? !!opts.reduced : mq('(prefers-reduced-motion: reduce)');
+ var parts = partsOf(spec, I), PART = {}; parts.forEach(function (p) { PART[p.id] = p; });
+ var state = Object.assign(knobDefaults(I), opts.state || {}), S = { step: 0, hover: '', pin: '' };
+
+ /* ---- DOM ---- */
+ host.classList.add('fg');
+ var title0 = String(I.title || (spec.page && spec.page.title) || '').replace(/\*/g, '').trim();
+ if (title0 && /^\s*(living diagram)?\s*$/i.test(D.title)) D.title = title0; // the template page's placeholder title
+ host.innerHTML = '';
+ var main = el('main', 'fg-main'), fig = el('div', 'fg-fig'), stage = el('div', 'ld-stage'), ldHost = el('div', 'fg-ld');
+ var card = el('div', 'fg-card', '<span class="n"></span><span class="s"></span><span class="v"></span>'); card.hidden = true;
+ fig.setAttribute('role', 'img'); fig.tabIndex = -1;
+ stage.appendChild(ldHost); stage.appendChild(card); fig.appendChild(stage); main.appendChild(fig);
+ var strip = el('section', 'fg-strip');
+ strip.setAttribute('aria-label', 'Step, controls and readouts');
+ strip.innerHTML = '<div class="fg-step"><span class="k"></span><span class="t"></span></div><div class="fg-board" aria-hidden="true"></div>' +
+ '<div class="fg-ctrl"><div class="fg-knob" hidden></div></div><div class="fg-reads"><h2>Readouts</h2><div class="fg-ro"></div><p class="fg-note"></p>' +
+ (I.source ? '<p class="fg-src">' + esc(I.source) + '</p>' : '') + '</div>' +
+ '<div class="fg-tour" hidden><span class="dot"></span><span>Showing you around: touch anything to take over</span><button type="button">Take over</button></div>';
+ main.appendChild(strip);
+ var rail = el('aside', 'fg-rail');
+ rail.setAttribute('aria-label', 'Steps and parts');
+ rail.innerHTML = '<div class="fg-brand">' + esc(I.kicker || 'Live figure') + '</div><h1>' + esc(I.title || (spec.page && spec.page.title || '').replace(/\*/g, '') || 'Living diagram') + '</h1>' +
+ (I.sub ? '<p class="fg-sub">' + esc(I.sub) + '</p>' : '') +
+ (I.steps.length ? '<section class="fg-sec"><h2 id="fg-h-steps">Steps</h2><nav class="fg-steps" aria-labelledby="fg-h-steps"></nav></section>' : '') +
+ (parts.length ? '<section class="fg-sec"><h2 id="fg-h-parts">Parts</h2><div class="fg-parts" role="group" aria-labelledby="fg-h-parts"></div></section>' : '') +
+ '<section class="fg-sec fg-narr-sec" hidden><details><summary>Narration for this step</summary><p class="fg-narr"></p></details></section>' +
+ '<section class="fg-sec fg-row">' + (I.steps.length ? '<button type="button" class="fg-btn fg-again">Run this step again</button>' : '') + '<button type="button" class="fg-btn fg-copy">Copy a link to this state</button></section>' +
+ '<div class="fg-keys">' + (I.steps.length ? '<kbd>←</kbd> <kbd>→</kbd> steps · <kbd>1</kbd>-<kbd>9</kbd> jump · <kbd>R</kbd> run again · ' : '') + '<kbd>Tab</kbd> parts and controls · <kbd>Esc</kbd> clear · <kbd>L</kbd> copy link</div>' +
+ '<div class="fg-live" aria-live="polite"></div>';
+ var app = el('div', 'fg-app'); app.appendChild(main); app.appendChild(rail); host.appendChild(app);
+ var $ = function (s) { return host.querySelector(s); };
+
+ /* ---- clock: real time, frozen under reduced motion (each action then jumps it past its own keys) ---- */
+ var t0 = (root.performance ? performance.now() : Date.now()) / 1000, start = I.start || 0, frozen = start;
+ var clock = {
+ reduced: RM,
+ now: function () { return RM || clock.manual ? frozen : start + (root.performance ? performance.now() : Date.now()) / 1000 - t0; },
+ every: function (ms, fn, loops, name) { fn(); if (ms > 0 && !RM && !clock.manual) loops.push({ name: name, id: setInterval(function () { if (!D.hidden && onscreen) { fx.tau = clock.now() + 0.05; fn(); dirty = true; } }, ms) }); },
+ stop: function (ls) { ls.forEach(function (l) { clearInterval(l.id); }); },
+ manual: false,
+ };
+ // the live page may frame the board on its own (interactive.camera: no title column beside it)
+ var api = Diagram.live(I.camera ? Object.assign({}, spec, { camera: I.camera }) : spec, { host: ldHost, theme: theme, look: opts.look, live: { now: clock.now } });
+ if (!api) return null;
+ var fx = makeFx(api, clock, state, I);
+ var act = function (fn) { fx.tau = clock.now() + (RM || clock.manual ? 0 : 0.05); fn(); if (RM || clock.manual) frozen += 6; dirty = true; };
+
+ /* ---- fit: the stage to the figure box, cropped (desktop and phone crops) ---- */
+ var phone = false, k = 1, crop = [0, 0, W, H], hullsCache = null;
+ function fit() {
+ phone = (root.innerWidth || W) < 820; D.documentElement.classList.toggle('fg-phone', phone);
+ var cr = I.crop || {}; crop = (phone ? cr.phone || cr.desk : cr.desk) || [0, 0, W, H];
+ var w = fig.clientWidth || 1; k = w / (crop[2] - crop[0]);
+ stage.style.transformOrigin = '0 0';
+ stage.style.transform = 'translate(' + (-crop[0] * k) + 'px,' + (-crop[1] * k) + 'px) scale(' + k + ')';
+ fig.style.height = Math.round((crop[3] - crop[1]) * k) + 'px';
+ dirty = true; hullsCache = null;
+ }
+ root.addEventListener('resize', fit);
+
+ /* ---- steps ---- */
+ function reset() { fx.stopLoops(); if (I.reset) I.reset(fx); }
+ function enter(i, o) {
+ o = o || {};
+ if (!I.steps.length) return;
+ S.step = Math.max(0, Math.min(I.steps.length - 1, i));
+ act(function () { reset(); var st = I.steps[S.step]; if (st.run) st.run(fx, false); });
+ ui(); sync();
+ }
+ function setKnob(name, v, fromTour) {
+ state[name] = v;
+ var cur = I.steps[S.step], own = stepIndex(I, (I.steps.filter(function (s) { return s.knob === name; })[0] || {}).id);
+ if (!cur || cur.knob !== name) { if (own >= 0) { enter(own); } }
+ else act(function () { if (cur.run) cur.run(fx, true); });
+ if (!fromTour) touched();
+ ui(); sync();
+ }
+
+ /* ---- drawing ---- */
+ var dirty = true, raf = 0, onscreen = true, last = 0, cost = { n: 0, ms: 0 };
+ function draw() {
+ var t = clock.now(), a = root.performance ? performance.now() : 0;
+ api.render(t);
+ cost.n++; cost.ms += (root.performance ? performance.now() : 0) - a;
+ placeCard(t);
+ if (phone) board();
+ }
+ function loop(ts) {
+ raf = 0;
+ if (D.hidden || !onscreen) return;
+ if (RM || clock.manual) { if (dirty) { draw(); dirty = false; } }
+ else if (ts - last > 32 || dirty) { last = ts; draw(); dirty = false; } // gentle motion: about 30 fps is plenty
+ raf = root.requestAnimationFrame(loop);
+ }
+ function wake() { if (!raf) raf = root.requestAnimationFrame(loop); }
+ D.addEventListener('visibilitychange', wake);
+ if ('IntersectionObserver' in root) new IntersectionObserver(function (e) { onscreen = e[0].isIntersecting; wake(); }).observe(fig);
+
+ /* ---- hover, the card, the parts ---- */
+ function current() { return S.pin || S.hover; }
+ function setHover(id, from) {
+ id = id || '';
+ if (S.hover === id) return;
+ S.hover = id;
+ api.focus(current() || null, { at: clock.now() });
+ if (RM || clock.manual) frozen += 0.5;
+ dirty = true; ui();
+ if (id && from !== 'tour') say(PART[id].name + ', ' + (PART[id].sub || '') + (valueFor(id) ? '. ' + valueFor(id).text : ''));
+ }
+ function pin(id) { S.pin = S.pin === id ? '' : id; api.focus(current() || null, { at: clock.now() }); if (RM || clock.manual) frozen += 0.5; dirty = true; ui(); sync(); }
+ function valueFor(id) {
+ var R = readouts(), row = R.rows.filter(function (r) { return r.part === id; })[0];
+ return row ? { text: row.k + ' ' + row.v + (row.u ? ' ' + row.u : ''), tone: row.tone || '' } : null;
+ }
+ function placeCard(t) {
+ var p = current();
+ if (!p || phone || !PART[p]) { card.hidden = true; return; }
+ card.hidden = false;
+ card.querySelector('.n').textContent = PART[p].name; card.querySelector('.s').textContent = PART[p].sub || '';
+ var v = valueFor(p), ve = card.querySelector('.v');
+ ve.textContent = v ? v.text : ''; ve.hidden = !v; ve.className = 'v' + (v && v.tone ? ' fg-tone-' + v.tone : '');
+ var pos = I.card || [crop[0] + 36, crop[1] + 36];
+ card.style.left = pos[0] + 'px'; card.style.top = pos[1] + 'px';
+ }
+ function hit(cx, cy) {
+ var r = fig.getBoundingClientRect(), x = (cx - r.left) / k + crop[0], y = (cy - r.top) / k + crop[1];
+ return api.hit(x, y, clock.now(), parts.map(function (p) { return p.id; }));
+ }
+
+ /* ---- the panel ---- */
+ var stepsEl = $('.fg-steps'), partsEl = $('.fg-parts'), knobEl = $('.fg-knob'), roEl = $('.fg-ro'), noteEl = $('.fg-note'), liveEl = $('.fg-live');
+ I.steps.forEach(function (st, i) {
+ var b = el('button', 'fg-stepb', '<span class="n">' + (i + 1) + '</span><span class="k"></span>'); b.type = 'button';
+ b.querySelector('.k').textContent = st.kicker || st.id;
+ b.addEventListener('click', function () { touched(); enter(i); });
+ stepsEl.appendChild(b);
+ });
+ parts.forEach(function (p) {
+ var b = el('button', 'fg-part', '<span class="n"></span><span class="s"></span>'); b.type = 'button'; b.setAttribute('data-part', p.id);
+ b.querySelector('.n').textContent = p.name; b.querySelector('.s').textContent = p.sub || '';
+ b.addEventListener('focus', function () { setHover(p.id); });
+ b.addEventListener('blur', function () { setHover(''); });
+ b.addEventListener('mouseenter', function () { setHover(p.id); });
+ b.addEventListener('mouseleave', function () { setHover(''); });
+ b.addEventListener('click', function () { touched(); pin(p.id); });
+ partsEl.appendChild(b);
+ });
+ var shownKnob = null;
+ function knobUI() {
+ var st = I.steps[S.step] || {}, name = st.knob, K = name && I.knobs[name];
+ var key = name ? name + '|' + state[name] : '';
+ if (key === shownKnob) return;
+ var focused = knobEl.contains(D.activeElement);
+ shownKnob = key; knobEl.innerHTML = ''; knobEl.hidden = !K;
+ strip.classList.toggle('fg-noknob', !K);
+ if (!K) return;
+ if (K.options) {
+ knobEl.innerHTML = '<div class="kh" id="fg-kh">' + esc(K.label) + (K.hint ? '<span>' + esc(K.hint) + '</span>' : '') + '</div><div class="seg" role="radiogroup" aria-labelledby="fg-kh"></div>';
+ var seg = knobEl.querySelector('.seg'), vals = K.options.map(function (o) { return o[0]; });
+ K.options.forEach(function (o) {
+ var b = el('button', '', '<b>' + esc(o[0]) + '</b>' + (o[1] ? '<span>' + esc(o[1]) + '</span>' : '')); b.type = 'button';
+ var on = String(state[name]) === String(o[0]);
+ b.setAttribute('role', 'radio'); b.setAttribute('aria-checked', String(on)); b.tabIndex = on ? 0 : -1;
+ b.addEventListener('click', function () { setKnob(name, o[0]); });
+ seg.appendChild(b);
+ });
+ seg.addEventListener('keydown', function (e) {
+ var i = vals.map(String).indexOf(String(state[name])), d = { ArrowRight: 1, ArrowUp: 1, ArrowLeft: -1, ArrowDown: -1 }[e.key];
+ if (d == null) return; e.preventDefault(); e.stopPropagation();
+ setKnob(name, vals[Math.max(0, Math.min(vals.length - 1, i + d))]);
+ });
+ if (focused) { var q = seg.querySelector('[aria-checked="true"]'); if (q) q.focus(); }
+ } else {
+ var fmt = K.format || function (v) { return String(v); };
+ knobEl.innerHTML = '<label class="kh" for="fg-range">' + esc(K.label) + ' <b></b>' + (K.hint ? '<span>' + esc(K.hint) + '</span>' : '') + '</label><input id="fg-range" type="range">';
+ var r = knobEl.querySelector('input'); r.min = K.min; r.max = K.max; r.step = K.step || 1; r.value = state[name];
+ knobEl.querySelector('b').textContent = fmt(state[name]);
+ r.setAttribute('aria-valuetext', fmt(state[name]));
+ r.addEventListener('input', function () { var v = Number(r.value); shownKnob = name + '|' + v; setKnob(name, v); knobEl.querySelector('b').textContent = fmt(v); r.setAttribute('aria-valuetext', fmt(v)); });
+ r.addEventListener('keydown', function (e) { e.stopPropagation(); });
+ if (focused) r.focus();
+ }
+ }
+ function readouts() {
+ var st = I.steps[S.step] || {}, R = I.readouts ? I.readouts(state, st.id) : null;
+ return R && R.rows ? R : { rows: [], note: (R && R.note) || '' };
+ }
+ function ui() {
+ var st = I.steps[S.step] || {}, text = stepText(st, state), hp = current();
+ if (stepsEl) Array.prototype.forEach.call(stepsEl.children, function (b, i) { b.setAttribute('aria-current', i === S.step ? 'step' : 'false'); });
+ if (partsEl) Array.prototype.forEach.call(partsEl.children, function (b) { var id = b.getAttribute('data-part'); b.setAttribute('aria-pressed', String(S.pin === id)); b.classList.toggle('on', hp === id); });
+ $('.fg-step .k').textContent = st.kicker || ''; $('.fg-step .t').textContent = text;
+ $('.fg-step').hidden = !st.kicker && !text;
+ knobUI(); keyButtons();
+ var R = readouts();
+ roEl.innerHTML = '';
+ R.rows.forEach(function (r) {
+ var d = el('div', 'ro' + (r.tone ? ' fg-tone-' + r.tone : '') + (hp && r.part === hp ? ' on' : '') + (/^[×+−-]?[0-9]/.test(String(r.v)) ? '' : ' txt'),
+ '<span class="k"></span><span class="v"></span><span class="u"></span>');
+ d.querySelector('.k').textContent = r.k; d.querySelector('.v').textContent = r.v; d.querySelector('.u').textContent = r.u || '';
+ roEl.appendChild(d);
+ });
+ noteEl.textContent = R.note || (R.rows.length ? '' : (I.steps.length ? 'No numbers on this step: hover a part, or pick another step.' : 'Hover a part to see what it does.'));
+ var narr = typeof st.narr === 'function' ? st.narr(state) : st.narr;
+ $('.fg-narr').textContent = narr || ''; $('.fg-narr-sec').hidden = !narr;
+ fig.setAttribute('aria-label', (I.title || 'Live figure') + (st.kicker ? '. ' + st.kicker + ': ' + text : ''));
+ if (!tour.on) say((st.kicker ? st.kicker + '. ' : '') + text + (R.rows.length ? ' ' + R.rows.map(function (r) { return r.k + ' ' + r.v + (r.u ? ' ' + r.u : ''); }).join('; ') : ''));
+ }
+ var sayT = 0;
+ function say(s) { if (tour.on) return; clearTimeout(sayT); sayT = setTimeout(function () { liveEl.textContent = s; }, 400); }
+
+ /* ---- the phone: what the board shows, as chips in their own colours ---- */
+ var boardEl = $('.fg-board'), lastBoard = '';
+ function board() {
+ var out = [];
+ ldHost.querySelectorAll('[data-ld-tag]').forEach(function (g) {
+ if (g.getAttribute('visibility') !== 'visible' || +g.getAttribute('opacity') < 0.5) return;
+ var r = g.querySelector('rect'), bg = r ? r.getAttribute('fill') : '';
+ g.querySelectorAll('text').forEach(function (tx) { if (tx.getAttribute('visibility') === 'visible') out.push([tx.textContent, bg, tx.getAttribute('fill')]); });
+ });
+ var key = JSON.stringify(out); if (key === lastBoard) return; lastBoard = key;
+ boardEl.innerHTML = '';
+ out.forEach(function (x) { var c = el('span'); c.textContent = x[0]; if (x[1]) c.style.background = x[1]; if (x[2]) c.style.color = x[2]; boardEl.appendChild(c); });
+ }
+
+ /* ---- pointer and keys ---- */
+ fig.addEventListener('pointermove', function (e) {
+ var id = hit(e.clientX, e.clientY); fig.style.cursor = id ? 'pointer' : 'default';
+ if (e.pointerType === 'mouse') { touched(); setHover(id); }
+ });
+ fig.addEventListener('pointerleave', function () { setHover(''); });
+ fig.addEventListener('click', function (e) { touched(); var id = hit(e.clientX, e.clientY); if (id) pin(id); else if (S.pin) pin(S.pin); });
+ root.addEventListener('keydown', function (e) {
+ var tag = (e.target && e.target.tagName) || '';
+ touched();
+ if (e.key === 'Escape') { S.pin = ''; setHover(''); api.focus(null, { at: clock.now() }); dirty = true; ui(); sync(); return; }
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || e.metaKey || e.ctrlKey || e.altKey) return;
+ if (e.key === 'ArrowRight' || e.key === 'PageDown') { if (I.steps.length) { e.preventDefault(); enter(S.step + 1); } }
+ else if (e.key === 'ArrowLeft' || e.key === 'PageUp') { if (I.steps.length) { e.preventDefault(); enter(S.step - 1); } }
+ else if (/^[1-9]$/.test(e.key) && +e.key <= I.steps.length) enter(+e.key - 1);
+ else if (e.key === 'r' || e.key === 'R') enter(S.step);
+ else if (e.key === 'l' || e.key === 'L') copyLink();
+ else if (I.keys && I.keys[e.key.toLowerCase()]) pressKey(e.key.toLowerCase());
+ });
+ ['pointerdown', 'wheel', 'touchstart'].forEach(function (ev) { root.addEventListener(ev, function () { touched(); }, { passive: true }); });
+ host.addEventListener('focusin', function () { touched(); });
+ var againB = $('.fg-again'); if (againB) againB.addEventListener('click', function () { touched(); enter(S.step); });
+ var copyB = $('.fg-copy');
+ copyB.addEventListener('click', copyLink);
+ function copyLink() {
+ sync(true);
+ var done = function () { copyB.textContent = 'Link copied'; setTimeout(function () { copyB.textContent = 'Copy a link to this state'; }, 1600); };
+ try { if (root.navigator && navigator.clipboard) navigator.clipboard.writeText(root.location.href).then(done, function () {}); } catch (e) { /* a host without a clipboard */ }
+ }
+
+ /* ---- the scene's keys: {k: fn(fx, state, stepId)} or {k: {label, step, when(state), run}}: a button too, on that
+ step while when() holds (a phone has no keys) ---- */
+ var keyRun = function (k) { var v = I.keys && I.keys[k]; return typeof v === 'function' ? v : v && v.run; };
+ function pressKey(k) { var f = keyRun(k), sid = (I.steps[S.step] || {}).id; if (!f) return; act(function () { f(fx, state, sid); }); ui(); sync(); }
+ var keysEl = el('div', 'fg-keybtns'); $('.fg-step').appendChild(keysEl);
+ function keyButtons() {
+ var sid = (I.steps[S.step] || {}).id, want = Object.keys(I.keys || {}).filter(function (k) { var v = I.keys[k]; return v && v.label && (!v.step || v.step === sid) && (!v.when || v.when(state)); });
+ var key = want.join(',') + '|' + sid; if (keysEl.getAttribute('data-k') === key) return;
+ keysEl.setAttribute('data-k', key); keysEl.innerHTML = '';
+ want.forEach(function (k) {
+ var b = el('button', 'fg-btn', ''); b.type = 'button'; b.textContent = I.keys[k].label + ' (' + k.toUpperCase() + ')';
+ b.addEventListener('click', function () { touched(); pressKey(k); });
+ keysEl.appendChild(b);
+ });
+ keysEl.hidden = !want.length;
+ }
+
+ /* ---- deep links: #step=<id>&<knob>=<value>&part=<id> ---- */
+ function hashOf() {
+ var st = I.steps[S.step], q = [];
+ if (st) q.push('step=' + encodeURIComponent(st.id));
+ if (st && st.knob) q.push(encodeURIComponent(st.knob) + '=' + encodeURIComponent(state[st.knob]));
+ if (S.pin) q.push('part=' + encodeURIComponent(S.pin));
+ return q.join('&');
+ }
+ function sync(force) {
+ if (tour.on && !force) return;
+ try { root.history.replaceState(null, '', '#' + hashOf()); } catch (e) { /* a sandboxed host */ }
+ }
+ function parseHash(str) { // '#a=1&b=2' -> {a: '1', b: '2'}; a pair that does not decode (a link cut after a %) is left out
+ var h = {}, dec = function (x) { try { return decodeURIComponent(x); } catch (e) { return null; } };
+ String(str || '').replace(/^#/, '').split('&').forEach(function (kv) {
+ var i = kv.indexOf('='), k = dec(i < 0 ? kv : kv.slice(0, i)), v = dec(i < 0 ? '' : kv.slice(i + 1));
+ if (k && v != null) h[k] = v;
+ });
+ return h;
+ }
+ function fromHash(str) {
+ var h = parseHash(str == null ? root.location.hash : str);
+ if (!h.step && !h.part) return false;
+ Object.keys(I.knobs || {}).forEach(function (n) {
+ if (h[n] == null) return;
+ var K = I.knobs[n];
+ if (K.options) { var o = K.options.filter(function (x) { return String(x[0]) === h[n]; })[0]; if (o) state[n] = o[0]; }
+ else { var v = Number(h[n]); if (isFinite(v) && v >= K.min && v <= K.max) state[n] = v; }
+ });
+ var i = stepIndex(I, h.step);
+ if (I.steps.length) enter(i >= 0 ? i : 0);
+ if (PART[h.part]) { S.pin = h.part; api.focus(h.part, { at: clock.now() }); }
+ return true;
+ }
+
+ /* ---- the idle tour: a script of live actions; any input stops it, it comes back after 20 s ---- */
+ var tour = { on: false, i: 0, timer: 0, idle: 0 };
+ var SCRIPT = I.tour || (I.steps.length ? I.steps.map(function (s) { return [{ step: s.id }, 7000]; }) : parts.map(function (p) { return [{ hover: p.id }, 2400]; }).concat([[{ hover: null }, 1200]]));
+ function run(a) {
+ if (typeof a === 'function') { act(function () { a(fx, state); }); ui(); return; }
+ if (a.step != null) { if (a.knob) state[a.knob[0]] = a.knob[1]; enter(stepIndex(I, a.step)); }
+ else if (a.knob) setKnob(a.knob[0], a.knob[1], true);
+ if (a.hover !== undefined) setHover(a.hover || '', 'tour');
+ }
+ function next() { if (!tour.on || !SCRIPT.length) return; var s = SCRIPT[tour.i % SCRIPT.length]; tour.i++; run(s[0]); tour.timer = setTimeout(next, s[1]); }
+ function startTour() { if (RM || tour.on || clock.manual) return; tour.on = true; $('.fg-tour').hidden = false; next(); }
+ function stopTour() { if (!tour.on) return; tour.on = false; clearTimeout(tour.timer); $('.fg-tour').hidden = true; setHover(''); ui(); sync(); }
+ function touched() { if (tour.on) stopTour(); clearTimeout(tour.idle); if (!RM && !clock.manual) tour.idle = setTimeout(startTour, 20000); }
+ $('.fg-tour button').addEventListener('click', function () { touched(); });
+
+ /* ---- walk: every state, at rest, for showtime check (and the tests) ---- */
+ function walk() {
+ clock.manual = true; stopTour(); clearTimeout(tour.idle);
+ var probs = [], states = 0;
+ var visibleTexts = function () {
+ var out = [], base = stage.getBoundingClientRect(), kk = k;
+ var add = function (sel, kind) {
+ ldHost.querySelectorAll(sel).forEach(function (g) {
+ if (g.getAttribute('visibility') !== 'visible' || +g.getAttribute('opacity') < 0.5) return;
+ // the plate (a label) or the pill (a tag): the leader of a label is not text
+ var plate = g.querySelector('rect'), r = (plate || g).getBoundingClientRect(); if (!r.width) return;
+ var t = [].slice.call(g.querySelectorAll('text')).filter(function (x) { return x.getAttribute('visibility') !== 'hidden' && +(x.getAttribute('opacity') || 1) > 0.5 && x.textContent; }).map(function (x) { return x.textContent; }).join(' / ');
+ out.push({ kind: kind, text: t, x: (r.left - base.left) / kk, y: (r.top - base.top) / kk, w: r.width / kk, h: r.height / kk });
+ });
+ };
+ add('[data-ld-tag]', 'tag'); add('[data-ld-label]', 'label');
+ return out;
+ };
+ var check = function (where) {
+ states++;
+ draw();
+ var tx = visibleTexts(), box = [Math.max(crop[0], SAFE[0]), Math.max(crop[1], SAFE[1]), Math.min(crop[2], SAFE[2]), Math.min(crop[3], SAFE[3])];
+ tx.forEach(function (a, i) {
+ if (a.x < box[0] - 1 || a.y < box[1] - 1 || a.x + a.w > box[2] + 1 || a.y + a.h > box[3] + 1) probs.push({ code: 'figure_text_cut', where: where, text: a.text, message: '"' + a.text + '" is cut by the figure\'s frame' });
+ for (var j = i + 1; j < tx.length; j++) {
+ var b = tx[j], ox = Math.min(a.x + a.w, b.x + b.w) - Math.max(a.x, b.x), oy = Math.min(a.y + a.h, b.y + b.h) - Math.max(a.y, b.y);
+ if (ox > 4 && oy > 4) probs.push({ code: 'figure_text_overlap', where: where, text: a.text + ' | ' + b.text, message: '"' + a.text + '" and "' + b.text + '" overlap' });
+ }
+ });
+ var R = readouts();
+ R.rows.forEach(function (r) { if (/NaN|undefined|Infinity|null/.test(String(r.v) + ' ' + String(r.u == null ? '' : r.u))) probs.push({ code: 'figure_readout', where: where, text: r.k, message: 'readout "' + r.k + '" shows ' + r.v }); });
+ // the scene's own story check: what the board, the step and the readouts say must agree (interactive.agree)
+ if (I.agree) {
+ var st0 = I.steps[S.step] || {}, said = tx.filter(function (x) { return x.kind === 'tag'; }).map(function (x) { return x.text; });
+ (I.agree(state, st0.id, { board: said, step: stepText(st0, state), readouts: R.rows }) || []).forEach(function (m) {
+ probs.push({ code: 'figure_story', where: where, text: String(m), message: String(m) });
+ });
+ }
+ };
+ // the link of a state, followed: it must open the same step, knob value and pinned part
+ var linkBack = function (where) {
+ var st0 = I.steps[S.step], want = { step: S.step, knob: st0 && st0.knob ? String(state[st0.knob]) : null, pin: S.pin }, h = hashOf();
+ var keep = st0 && st0.knob ? state[st0.knob] : null;
+ fromHash('#' + h);
+ var st1 = I.steps[S.step], got = { step: S.step, knob: st1 && st1.knob ? String(state[st1.knob]) : null, pin: S.pin };
+ if (got.step !== want.step || got.knob !== want.knob || got.pin !== want.pin) {
+ probs.push({ code: 'figure_link', where: where, text: h, message: 'the link #' + h + ' opens another state (step ' + ((I.steps[got.step] || {}).id) + (got.knob != null ? ', ' + got.knob : '') + ')' });
+ S.step = want.step; if (st0 && st0.knob) state[st0.knob] = keep;
+ }
+ };
+ var seenIds = {};
+ I.steps.forEach(function (st) { if (seenIds['s' + st.id]) probs.push({ code: 'figure_link', where: 'steps', text: 'step ' + st.id, message: 'two steps share the id "' + st.id + '": a link to the second opens the first' }); seenIds['s' + st.id] = 1; });
+ parts.forEach(function (p) { if (seenIds['p' + p.id]) probs.push({ code: 'figure_link', where: 'parts', text: 'part ' + p.id, message: 'two parts share the id "' + p.id + '"' }); seenIds['p' + p.id] = 1; });
+ // a knob's values: every option; a range of up to 25 values all of them, a longer one 9 points across it
+ var valuesOf = function (K) {
+ if (!K) return [null];
+ if (K.options) return K.options.map(function (o) { return o[0]; });
+ var step = K.step || 1, n = Math.floor((K.max - K.min) / step + 1e-9) + 1, out = [];
+ if (n <= 25) for (var j = 0; j < n; j++) out.push(+(K.min + j * step).toFixed(6));
+ else { for (var q = 0; q <= 8; q++) out.push(+(K.min + Math.round(q * (n - 1) / 8) * step).toFixed(6)); if (out.indexOf(K.default) < 0) out.push(K.default); }
+ return out;
+ };
+ var keyNames = Object.keys(I.keys || {});
+ var safely = function (where, fn) { try { fn(); } catch (e) { probs.push({ code: 'figure_error', where: where, message: String(e && e.message || e) }); } };
+ safely('start', function () { check('start'); });
+ I.steps.forEach(function (st, i) {
+ var K = st.knob && I.knobs[st.knob], vals = valuesOf(K);
+ vals.forEach(function (v) {
+ var where = 'step ' + st.id + (v != null ? ' ' + st.knob + '=' + v : '');
+ safely(where, function () {
+ if (v != null) state[st.knob] = v;
+ enter(i); check(where); linkBack(where);
+ parts.forEach(function (p) { setHover(p.id); check(where + ', ' + p.id + ' hovered'); });
+ setHover('');
+ // the scene's keys (an answer it asks for), each from this state
+ keyNames.forEach(function (kn) {
+ safely(where + ', key ' + kn, function () {
+ if (v != null) state[st.knob] = v;
+ enter(i);
+ act(function () { keyRun(kn)(fx, state, st.id); }); ui();
+ check(where + ', key ' + kn.toUpperCase());
+ });
+ });
+ });
+ });
+ if (K) state[st.knob] = K.default;
+ });
+ if (!I.steps.length) parts.forEach(function (p) { safely(p.id, function () { setHover(p.id); check(p.id + ' hovered'); }); });
+ setHover('');
+ var seen = {}; probs = probs.filter(function (p) { var key = p.code + '|' + p.text; if (seen[key]) return false; seen[key] = 1; return true; });
+ return { states: states, problems: probs, keys: keyNames.length, steps: I.steps.length, parts: parts.length, knobs: Object.keys(I.knobs || {}).length, theme: api.report.theme, warnings: api.report.warnings.slice() };
+ }
+
+ /* ---- start: the board is already there and moving ---- */
+ var fig0 = { api: api, enter: enter, setKnob: setKnob, setHover: setHover, pin: pin, walk: walk, state: state, S: S, cost: cost, readouts: readouts,
+ tour: function () { return tour.on; }, hash: hashOf, phone: function () { return phone; } };
+ api.ready.then(function () {
+ fit();
+ // the tour's first wait: opts.tourAfter, or window.SHOWTIME_TEST_TOUR_AFTER (tests), else 2.5 s
+ var after = opts.tourAfter != null ? opts.tourAfter : (typeof root.SHOWTIME_TEST_TOUR_AFTER === 'number' ? root.SHOWTIME_TEST_TOUR_AFTER : 2500);
+ if (!fromHash()) { if (I.steps.length) enter(0); if (!RM) tour.idle = setTimeout(startTour, after); }
+ else if (!RM) tour.idle = setTimeout(startTour, 20000);
+ ui(); wake();
+ });
+ fit(); ui(); wake();
+ Figure.current = fig0;
+ return fig0;
+ }
+
+ var Figure = root.Figure;
+ Figure.mount = mount;
+})(typeof window !== 'undefined' ? window : this);
diff --git a/skills/showtime/scripts/check.mjs b/skills/showtime/scripts/check.mjs
index ae65bb3..c77718f 100644
--- a/skills/showtime/scripts/check.mjs
+++ b/skills/showtime/scripts/check.mjs
@@ -18,6 +18,7 @@ import { resolveShowreel, showreelConfig, flashVerdict, flashNote } from './lib/
import { blurConfig, blurFindings, blurSummary } from './lib/blurcheck.mjs';
import { mixSpecProblem } from './lib/audio.mjs';
import { enclosingJob, readJSON } from './lib/studio/paths.mjs';
+import { figureFindings } from './lib/figurecheck.mjs';
const PROBES = ['black', 'frozen', 'nondeterministic', 'error'];
@@ -1497,7 +1498,7 @@ async function main() {
for (const m of consoleErrs.slice(0, 5)) add('warning', 'console_error', `console error: ${m.text}${m.url ? ` (${m.url.replace(server.url, '')}:${m.line})` : ''}`);
// showtime components explain misuse on the console ("[showtime] caption-karaoke: ..."): surface it
const compWarns = [...new Set(log.console.filter((m) => (m.type === 'warning' || m.type === 'warn') && /^\[showtime\] /.test(m.text)).map((m) => m.text))];
- for (const t of compWarns.slice(0, 8)) add('warning', 'component', t.replace(/^\[showtime\] /, ''), { fix: 'see the component\'s options in references/components.md' });
+ for (const t of compWarns.slice(0, 8)) add('warning', 'component', t.replace(/^\[showtime\] /, ''), { fix: /^\[showtime\] diagram:/.test(t) ? 'see references/workflows/diagram.md (showtime guide diagram)' : 'see the component\'s options in references/components.md' });
for (const u of log.blocked.slice(0, 5)) add('error', 'network', `the page requests ${u}; renders are offline, so this will be missing`, { fix: 'download it into the project (fonts: /_lib/@fontsource/..., libraries: /_lib/<package>/...)' });
const missing = log.http.filter((h) => h.status === 404);
for (const m of missing.slice(0, 8)) add('error', 'missing_file', `missing file: ${m.url.replace(server.url, '')}`, { fix: 'fix the path (paths are relative to the project folder; /_lib/... and /_st/... are built in)' });
@@ -1616,6 +1617,13 @@ async function main() {
report.sheet = path.join(outDir, 'sheet.jpg');
fs.writeFileSync(report.sheet, sheet);
}
+ // a living diagram's live figure (figure.html): every step x knob value x hovered part, at rest; the phone
+ if (fs.existsSync(path.join(proj.dir, 'figure.html')) && proj.page === 'index.html') {
+ step('walking the live figure (figure.html): every step, knob value and hovered part');
+ const ff = await figureFindings({ browser: b.browser, url: server.url, projectDir: proj.dir }).catch((e) => [{ severity: 'error', code: 'figure_error', message: `live figure: ${String(e.message || e).split('\n')[0]}` }]);
+ for (const f of ff) add(f.severity, f.code, f.message, { ...(f.fix ? { fix: f.fix } : {}), ...(f.state ? { state: f.state } : {}) });
+ if (ff.walk) report.figure = ff.walk;
+ }
await lookHistory();
return await finish();
} finally {
diff --git a/skills/showtime/scripts/export.mjs b/skills/showtime/scripts/export.mjs
index 641a4be..df23b1b 100644
--- a/skills/showtime/scripts/export.mjs
+++ b/skills/showtime/scripts/export.mjs
@@ -17,10 +17,11 @@ import { writeExport, estimateSingle, notices, showtimeVersion, category, jsonBy
import { fitFootage } from './lib/export/fit.mjs';
import { timeIssues, socraticDoc } from './lib/questions.mjs';
import { resolveShare, shareMeta, genericTitle, genericChapters } from './lib/export/share.mjs';
+import { packFigure, sceneInfo, TEMPLATE_TITLE } from './lib/export/figure.mjs';
const SPEC = {
name: 'export',
- usage: 'showtime export html <project|job> [-o out.html] [--audio auto|embed|score|none] [--folder] [--controls full|minimal|none] [--target file|artifact] [--lang CODE] [--no-questions] [--auto-continue S]',
+ usage: 'showtime export html <project|job> [-o out.html] [--interactive] [--audio auto|embed|score|none] [--folder] [--controls full|minimal|none] [--target file|artifact] [--lang CODE] [--no-questions] [--auto-continue S]',
summary: 'Export a project as an interactive HTML video that plays in any browser, offline, from one file.',
description: [
'The page is packed with everything it uses (runtime, scripts, styles, fonts, images, emoji, data,',
@@ -55,6 +56,10 @@ const SPEC = {
'<name>.share.jpg beside it). Most previews need an absolute image URL: give the share URL.',
'The export warns when the title is a default ("Project") or the chapters are scene ids ("Shot 1").',
'A project file the page needs that cannot be read stops the export.',
+ '',
+ 'A living diagram exports its live figure with --interactive: figure.html (or the diagram template\'s) packed',
+ 'into one offline file with no player; the board is live from the first frame: the viewer hovers parts, picks',
+ 'steps and turns knobs (references/workflows/diagram.md, Interactive). Default name: <title>-figure.html.',
].join('\n'),
options: {
output: { short: 'o', help: 'output .html file (with --folder: output folder)', metavar: 'FILE' },
@@ -66,6 +71,7 @@ const SPEC = {
bitrate: { help: 'embedded audio bitrate (default 96k)', metavar: 'RATE' },
codec: { help: 'embedded audio codec: aac (default, plays everywhere) or opus (smaller)', metavar: 'NAME' },
folder: { type: 'boolean', help: 'write a folder (index.html + assets/) instead of one file' },
+ interactive: { type: 'boolean', help: 'a living diagram: its live figure (figure.html) instead of the film, one offline file without a player' },
controls: { help: 'player chrome: full (default), minimal, or none (for embedding)', metavar: 'KIND' },
target: { help: 'file (default) or artifact: for a host that shows the page in a sandboxed frame (an HTML artifact): one file under 16 MB, no "copy link" or other file-address features (the player also detects such hosts by itself)', metavar: 'KIND' },
'autoplay-muted': { type: 'boolean', help: 'start playing muted as soon as it loads (browsers allow that without a click)' },
@@ -106,6 +112,7 @@ const SPEC = {
'showtime export html my-video --folder --share-url https://me.github.io/launch/ # link previews with the poster',
'showtime export html my-video --controls none --autoplay-muted --loop # for embedding in a page',
'showtime export html my-video --target artifact -o launch.html # to publish as an HTML artifact',
+ 'showtime export html my-diagram --interactive # the live figure: hover, steps, knobs; one file',
'showtime export html my-film --subtitle "Fix the cuts" --kicker "Studio how-to · 01"',
'showtime export html my-explainer --auto-continue 6 # questions go on 6 s after an answer',
'# open at a moment: my-film.html#t=1:05 or my-film.html#chapter=3',
@@ -184,6 +191,7 @@ async function main() {
const target = String(a.target || 'file').toLowerCase();
if (!['file', 'artifact'].includes(target)) throw new UserError(`--target must be file or artifact (got ${a.target})`);
if (target === 'artifact' && folder) throw new UserError('--target artifact writes one file; leave out --folder');
+ if (a.interactive && folder) throw new UserError('--interactive writes one file; leave out --folder', 'showtime export html <project> --interactive -o figure.html');
let maxMb = a['max-mb'] === undefined ? 16 : Number(a['max-mb']);
if (!(maxMb >= 0)) throw new UserError(`--max-mb must be a number >= 0 (got ${a['max-mb']})`);
if (target === 'artifact' && (maxMb === 0 || maxMb > 16)) { addWarn('--target artifact: the file must stay under 16 MB (the artifact limit); --max-mb set to 16'); maxMb = 16; }
@@ -227,7 +235,7 @@ async function main() {
out = fs.existsSync(want) && fs.readdirSync(want).length ? freshPath(want) : want;
} else if (isDir) {
// -o an existing folder (or one ending in /): the file goes inside it
- want = path.join(want, `${proj.slug}.html`);
+ want = path.join(want, `${proj.slug}${a.interactive ? '-figure' : ''}.html`);
out = freshPath(want);
} else {
if (!path.extname(want)) want += '.html';
@@ -237,8 +245,9 @@ async function main() {
} else {
const dir = a.job ? resolveJobDir(a.job) : (fromJob && !a['out-dir'] ? fromJob.job : jobDir(proj.slug, a['out-dir']));
if (!dir || !fs.existsSync(dir)) throw new UserError(`no job named "${a.job}"`, 'list jobs with `showtime job list`');
- out = freshPath(path.join(dir, folder ? `${proj.slug}-html` : `${proj.slug}.html`));
+ out = freshPath(path.join(dir, folder ? `${proj.slug}-html` : `${proj.slug}${a.interactive ? '-figure' : ''}.html`));
}
+ if (a.interactive) return exportFigure({ a, proj, out, title, target, maxMb, warnings, addWarn, T0 });
const workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'showtime-export-'));
const server = await startServer({ root: proj.dir, port: 0 });
@@ -532,3 +541,29 @@ function sizeError(total, maxMb, files, poster, audioPack, { mode, html, scoreOn
}
runMain(main);
+
+/** --interactive: the live figure, one offline file (scripts/lib/export/figure.mjs). */
+function exportFigure({ a, proj, out, title, target, maxMb, warnings, addWarn, T0 }) {
+ // a project still named after the template (or nothing) takes its scene's title: the page's <title> and og:title
+ const info = sceneInfo(proj.dir);
+ if (!a.title && info.title && (!title || title === TEMPLATE_TITLE || genericTitle(title) || title === proj.slug)) title = info.title;
+ const r = packFigure({ projectDir: proj.dir, title, description: info.description, allFonts: !!a['all-fonts'], minify: String(a.minify || 'auto').toLowerCase() !== 'off', noCsp: !!a['no-csp'] });
+ if (r.remote.length) throw new UserError(`the live figure loads ${r.remote.slice(0, 3).join(', ')} from the network; the export is offline`, 'use a local copy (fonts: /_st/themes/fonts/*.css, packages: /_lib/...)');
+ if (r.missing.length) throw new UserError(`the live figure needs files that are not there: ${r.missing.slice(0, 6).join(', ')}`, 'fix the paths in figure.html (relative to the project; /_st/ and /_lib/ are built in)');
+ if (maxMb > 0 && r.bytes > maxMb * MB) {
+ const big = r.files.slice().sort((x, y) => y.bytes - x.bytes).slice(0, 5).map((f) => `${f.url} ${fmtBytes(f.bytes)}`).join(', ');
+ throw new UserError(`the live figure is ${fmtBytes(r.bytes)}, over --max-mb ${maxMb}; largest: ${big}`, 'drop large images from the scene, or raise --max-mb (an artifact is limited to 16 MB)');
+ }
+ fs.mkdirSync(path.dirname(out), { recursive: true });
+ fs.writeFileSync(out, r.html);
+ const report = { output: out, interactive: true, page: r.page, bytes: r.bytes, mb: +(r.bytes / MB).toFixed(2), max_mb: maxMb, title, target,
+ files: r.files.length, fonts_dropped: r.fontsDropped, largest: r.files.slice().sort((x, y) => y.bytes - x.bytes).slice(0, 6), warnings, seconds: +((Date.now() - T0) / 1000).toFixed(1) };
+ if (a.json) process.stdout.write(JSON.stringify(report, null, 2) + '\n');
+ else {
+ console.log(`${c.green('exported')} ${out}`);
+ console.log(` the live figure: ${fmtBytes(r.bytes)} of ${maxMb || 'unlimited'} MB, one file, no player; it makes no network request`);
+ console.log(` the board is live from the first frame: hover a part, pick a step, turn a knob; links like #step=<id> open a state`);
+ showCard({ title: `${path.basename(out)} is ready`, file: out, facts: ['live figure', fmtBytes(r.bytes)], next: openHint(out) });
+ }
+ return 0;
+}
diff --git a/skills/showtime/scripts/lib/export/figure.mjs b/skills/showtime/scripts/lib/export/figure.mjs
new file mode 100644
index 0000000..e212667
--- /dev/null
+++ b/skills/showtime/scripts/lib/export/figure.mjs
@@ -0,0 +1,209 @@
+// `showtime export html <project> --interactive`: a living diagram's live figure (figure.html) as one offline file.
+//
+// No player and no virtual clock: the page runs its own (runtime/figure.js). Every stylesheet and script the page
+// links is inlined, fonts become data: URLs (faces for scripts no text uses are dropped), and a
+// Content-Security-Policy blocks any network request. A project without a figure.html uses the diagram template's.
+import fs from 'node:fs';
+import path from 'node:path';
+import { skillDir, nodeModulesDir } from '../deps.mjs';
+import { UserError } from '../cli.mjs';
+import { addCodePoints, pruneFontFaces } from './collect.mjs';
+import { minifyJs, minifyCss } from './minify.mjs';
+import { notices } from './build.mjs';
+
+export const FIGURE_CSP = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; font-src data:; img-src data: blob:; media-src data: blob:";
+const FONT_MIME = { '.woff2': 'font/woff2', '.woff': 'font/woff', '.ttf': 'font/ttf', '.otf': 'font/otf' };
+const IMG_MIME = { '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.svg': 'image/svg+xml', '.webp': 'image/webp', '.gif': 'image/gif' };
+
+// the diagram template's showtime.json title: a project still named that takes its scene's title
+export const TEMPLATE_TITLE = 'Living Diagram';
+
+/**
+ * The scene's own words: {title, description} from SCENE.interactive (title, sub), else SCENE.page (title without
+ * its *accent* marks, dek), read as string literals from scene.js. Nothing in the project is run here: project code
+ * only ever runs inside the browser.
+ */
+/**
+ * The string-valued keys of the first `block: { ... }` object literal in a script, its own keys only (not those of
+ * nested objects), skipping comments and strings: {key: raw text}. A value that is not a plain string literal is
+ * left out. Nothing is run.
+ */
+export function blockLiterals(src, block) {
+ const n = src.length;
+ let i = 0;
+ const str = (q) => { let j = i + 1, raw = ''; while (j < n && src[j] !== q) { if (src[j] === '\\') { raw += src.slice(j, j + 2); j += 2; continue; } if (q !== '`' && src[j] === '\n') break; raw += src[j]; j++; } return { end: j + 1, raw }; };
+ const comment = () => {
+ if (src[i] === '/' && src[i + 1] === '/') { const e = src.indexOf('\n', i); i = e < 0 ? n : e; return true; }
+ if (src[i] === '/' && src[i + 1] === '*') { const e = src.indexOf('*/', i + 2); i = e < 0 ? n : e + 2; return true; }
+ return false;
+ };
+ const readObject = () => {
+ const out = {}; let depth = 1, key = null;
+ while (i < n && depth > 0) {
+ if (comment()) continue;
+ const c = src[i];
+ if (c === '"' || c === "'" || c === '`') { const v = str(c); if (depth === 1 && key && c !== '`' && !(key in out) && /^\s*[,}\n]/.test(src.slice(v.end, v.end + 2) || '}')) out[key] = v.raw; key = null; i = v.end; continue; }
+ if (c === '{' || c === '[' || c === '(') { depth++; key = null; i++; continue; }
+ if (c === '}' || c === ']' || c === ')') { depth--; i++; continue; }
+ if (depth === 1 && /[A-Za-z_$]/.test(c)) { const m = /^([A-Za-z_$][\w$]*)\s*:/.exec(src.slice(i, i + 120)); if (m) { key = m[1]; i += m[0].length; continue; } }
+ if (!/\s/.test(c)) key = null; // anything but a string literal after the colon: not a literal value
+ i++;
+ }
+ return out;
+ };
+ while (i < n) {
+ if (comment()) continue;
+ const c = src[i];
+ if (c === '"' || c === "'" || c === '`') { i = str(c).end; continue; }
+ if (/[A-Za-z_$]/.test(c) && !/[\w$.]/.test(src[i - 1] || '')) {
+ const w = /^[A-Za-z_$][\w$]*/.exec(src.slice(i, i + 64))[0]; i += w.length;
+ if (w === block) { const m = /^\s*:\s*\{/.exec(src.slice(i, i + 64)); if (m) { i += m[0].length; return readObject(); } }
+ continue;
+ }
+ i++;
+ }
+ return {};
+}
+
+/** A JS string literal's escapes, decoded (\n, \', \u2019, \u{1F600}, \x41). */
+function unescapeJs(raw) {
+ return String(raw || '').replace(/\\(u\{[0-9a-fA-F]+\}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[\s\S])/g, (all, e) => {
+ if (e[0] === 'u' && e.length > 1) return String.fromCodePoint(parseInt(e[1] === '{' ? e.slice(2, -1) : e.slice(1), 16));
+ if (e[0] === 'x' && e.length === 3) return String.fromCharCode(parseInt(e.slice(1), 16));
+ return { n: '\n', t: '\t', r: '' }[e] != null ? { n: '\n', t: '\t', r: '' }[e] : e;
+ });
+}
+
+/**
+ * The scene's own words: {title, description} from SCENE.interactive (title, sub), else SCENE.page (title without
+ * its *accent* marks, dek), read as string literals from scene.js. Nothing in the project is run here: project code
+ * only ever runs inside the browser.
+ */
+export function sceneInfo(projectDir) {
+ const out = { title: '', description: '' };
+ let src = '';
+ try { src = fs.readFileSync(path.join(projectDir, 'scene.js'), 'utf8'); } catch { /* no scene */ }
+ const I = blockLiterals(src, 'interactive'), P = blockLiterals(src, 'page');
+ out.title = unescapeJs(I.title || P.title || '').replace(/\*/g, '').trim();
+ out.description = unescapeJs(I.sub || P.dek || '').trim();
+ if (!out.title || !out.description) { // the film page's own title block (a scene that keeps its words in index.html)
+ try {
+ const html = fs.readFileSync(path.join(projectDir, 'index.html'), 'utf8');
+ const text = (re) => { const m = re.exec(html); return m ? m[1].replace(/<[^>]+>/g, '').replace(/&nbsp;/g, ' ').replace(/\s+/g, ' ').trim() : ''; };
+ out.title = out.title || text(/<h1\b[^>]*class="[^"]*\bld-title\b[^"]*"[^>]*>([\s\S]*?)<\/h1>/i);
+ out.description = out.description || text(/<div\b[^>]*class="[^"]*\bld-dek\b[^"]*"[^>]*>([\s\S]*?)<\/div>/i);
+ } catch { /* no index.html */ }
+ }
+ return out;
+}
+
+/** A URL the page uses -> the file on disk (the same mapping as the showtime server), or null. */
+export function figureFile(url, { projectDir, base = '/' }) {
+ const u = String(url).trim().replace(/[?#].*$/, '');
+ if (!u || /^(data|blob):/i.test(u)) return { inline: true };
+ if (/^[a-z][a-z0-9+.-]*:/i.test(u) || u.startsWith('//')) return { remote: u };
+ const abs = u.startsWith('/') ? u : path.posix.join(path.posix.dirname(base), u);
+ const rel = decodeURIComponent(abs);
+ let root, sub;
+ if (rel.startsWith('/_st/')) { root = path.join(skillDir(), 'runtime'); sub = rel.slice(5); }
+ else if (rel.startsWith('/_lib/')) { root = nodeModulesDir(); sub = rel.slice(6); }
+ else { root = projectDir; sub = rel.slice(1); }
+ const file = path.resolve(root, ...sub.split('/'));
+ if (file !== root && !file.startsWith(root + path.sep)) return { escapes: rel };
+ return { file, url: rel };
+}
+
+/**
+ * Pack the live figure. -> {html, bytes, page, files: [{url, bytes, kind}], fontsDropped, missing: [url], remote: [url]}
+ * @param o.projectDir
+ * @param o.title the page title (default: the page's own)
+ * @param o.allFonts keep every font face
+ * @param o.minify shrink scripts and styles (default true)
+ * @param o.noCsp leave out the Content-Security-Policy
+ */
+export function packFigure(o) {
+ const projectDir = path.resolve(o.projectDir);
+ let pagePath = path.join(projectDir, 'figure.html'), own = true;
+ if (!fs.existsSync(pagePath)) { pagePath = path.join(skillDir(), 'templates', 'diagram', 'figure.html'); own = false; }
+ if (!fs.existsSync(path.join(projectDir, 'scene.js'))) {
+ throw new UserError('--interactive packs a living diagram: this project has no scene.js', 'start one with `showtime new diagram <dir>` (references/workflows/diagram.md)');
+ }
+ let html = fs.readFileSync(pagePath, 'utf8');
+ if (!own) { // the template's page takes the project's theme (showtime.json) when it has one
+ let cfg = {};
+ try { cfg = JSON.parse(fs.readFileSync(path.join(projectDir, 'showtime.json'), 'utf8')); } catch { /* none */ }
+ if (cfg.theme && /^[\w-]+$/.test(cfg.theme)) html = html.replace(/(<html\b[^>]*\bdata-theme=")[\w-]+(")/, (m, a, b) => a + cfg.theme + b);
+ }
+ const files = [], missing = [], remote = [];
+ const read = (url, base, binary) => {
+ const f = figureFile(url, { projectDir, base });
+ if (f.inline) return null;
+ if (f.remote) { remote.push(f.remote); return null; }
+ if (f.escapes || !fs.existsSync(f.file) || !fs.statSync(f.file).isFile()) { missing.push(f.escapes || f.url); return null; }
+ const buf = fs.readFileSync(f.file);
+ return { buf, text: binary ? null : buf.toString('utf8'), url: f.url, ext: path.extname(f.file).toLowerCase() };
+ };
+ // scripts and styles, in page order
+ const scripts = [], styles = [];
+ html = html.replace(/<script\b([^>]*)\bsrc="([^"]+)"([^>]*)>\s*<\/script>/gi, (m, a, src) => {
+ const r = read(src, '/figure.html'); if (!r) return m;
+ files.push({ url: r.url, bytes: r.buf.length, kind: 'script' });
+ const k = `\u0000S${scripts.length}\u0000`; scripts.push(r.text); return k;
+ });
+ html = html.replace(/<link\b[^>]*\brel="stylesheet"[^>]*>/gi, (m) => {
+ const href = (/\bhref="([^"]+)"/i.exec(m) || [])[1]; if (!href) return m;
+ const r = read(href, '/figure.html'); if (!r) return m;
+ files.push({ url: r.url, bytes: r.buf.length, kind: 'style' });
+ const k = `\u0000C${styles.length}\u0000`; styles.push({ text: r.text, url: r.url }); return k;
+ });
+ // the characters any text can show: the page, its scripts (the scene's words, the figure's own) and styles
+ const used = new Set();
+ addCodePoints(used, html.replace(/<[^>]+>/g, ' '));
+ scripts.forEach((s) => addCodePoints(used, s));
+ let fontsDropped = 0;
+ const cssOut = styles.map((st) => {
+ let css = st.text;
+ if (!o.allFonts) { const r = pruneFontFaces(css, used); css = r.text; fontsDropped += r.dropped; }
+ css = css.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/g, (m, q, u) => {
+ const r = read(u, st.url, true); if (!r) return m;
+ const mime = FONT_MIME[r.ext] || IMG_MIME[r.ext];
+ if (!mime) { missing.push(r.url + ' (not a font or an image)'); return m; }
+ files.push({ url: r.url, bytes: r.buf.length, kind: FONT_MIME[r.ext] ? 'font' : 'image' });
+ return `url(data:${mime};base64,${r.buf.toString('base64')})`;
+ });
+ return o.minify === false ? css : minifyCss(css);
+ });
+ // inside an inlined script the HTML parser looks for `</script` (it ends the script) and `<!--` (its "escaped" state,
+ // the only way into the "double escaped" state where the next `</script>` no longer ends it): both are written with
+ // an escape that means the same characters in a JS string, template or regex, in the text's own case. `<script` is
+ // left alone: without `<!--` it is harmless, and it can be code (`i<scriptSteps`)
+ const jsSafe = (t) => t.replace(/<\/(script)/gi, (m, w) => '<\\/' + w).replace(/<!--/g, '<\\x21--');
+ const jsOut = scripts.map((s) => jsSafe(o.minify === false ? s : minifyJs(s).text));
+ html = html.replace(/\u0000S(\d+)\u0000/g, (m, i) => `<script>\n${jsOut[+i]}\n</script>`);
+ html = html.replace(/\u0000C(\d+)\u0000/g, (m, i) => `<style>\n${cssOut[+i].replace(/<\/style/gi, '<\\/style')}\n</style>`);
+ const attr = (v) => String(v).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
+ // function replacers throughout: a title with $& or $' is text, never a replacement pattern
+ if (o.title) html = html.replace(/<title>[^<]*<\/title>/i, () => `<title>${attr(o.title)}</title>`);
+ // link previews: the title (and the scene's line under it) when the file is shared
+ const og = (o.title ? `\n<meta property="og:title" content="${attr(o.title)}">\n<meta name="twitter:title" content="${attr(o.title)}">` : '') +
+ (o.description ? `\n<meta name="description" content="${attr(o.description)}">\n<meta property="og:description" content="${attr(o.description)}">` : '') +
+ (o.title ? '\n<meta property="og:type" content="website">\n<meta name="twitter:card" content="summary">' : '');
+ html = html.replace(/<head([^>]*)>/i, (m, a) => `<head${a}>${o.noCsp ? '' : `\n<meta http-equiv="Content-Security-Policy" content="${FIGURE_CSP}">`}${og}`);
+ // third-party notices, as the film export writes them: the packages packed (the fonts' OFL), project credits
+ // the font files are packed as data: URLs (their CSS headers are minified away): name them and their licence here
+ const fontPkgs = [...new Set(files.filter((f) => f.kind === 'font').map((f) => (/^\/_lib\/((?:@[^/]+\/)?[^/]+)\//.exec(f.url) || [])[1]).filter(Boolean))];
+ const ofl = fontPkgs.filter((p) => {
+ try { return /OFL/i.test(JSON.parse(fs.readFileSync(path.join(nodeModulesDir(), ...p.split('/'), 'package.json'), 'utf8')).license || ''); } catch { return false; }
+ });
+ const fontCredit = ofl.length ? [`Fonts: ${ofl.join(', ')}, under the SIL Open Font License 1.1 (https://openfontlicense.org)`] : [];
+ // (no scene words in it: the comment is about the file's parts, and nothing a scene says can end it early)
+ const notice = (`A living diagram's live figure, exported with showtime; every file it uses is packed inside.\n` +
+ notices(new Map(files.map((f) => [f.url, f])), { projDir: projectDir, extraCredits: fontCredit }))
+ .replace('Third-party packages (their own license headers are kept in the packed files):', 'Third-party packages packed in this file:');
+ // the charset first in <head> (browsers look for it in the first 1024 bytes), then this notice
+ html = html.replace(/<meta\s+charset="[^"]*"\s*\/?>\s*/i, '');
+ html = html.replace(/<head([^>]*)>/i, (m, a) => `<head${a}>\n<meta charset="utf-8">\n<!--\n${notice.replace(/--/g, '- -')}\n-->`);
+ // any remaining reference to a file is a page that would reach the network or miss a file offline
+ for (const m of html.matchAll(/\b(?:src|href)="([^"#][^"]*)"/gi)) { const f = figureFile(m[1], { projectDir }); if (!f.inline) (f.remote ? remote : missing).push(f.remote || f.url || m[1]); }
+ return { html, bytes: Buffer.byteLength(html), page: own ? 'figure.html' : 'the diagram template\'s figure.html', files, fontsDropped, missing: [...new Set(missing)], remote: [...new Set(remote)] };
+}
diff --git a/skills/showtime/scripts/lib/figurecheck.mjs b/skills/showtime/scripts/lib/figurecheck.mjs
new file mode 100644
index 0000000..b2e5a61
--- /dev/null
+++ b/skills/showtime/scripts/lib/figurecheck.mjs
@@ -0,0 +1,71 @@
+// `showtime check` on a living diagram with a live figure (figure.html): walk every state of the page.
+//
+// Desktop: every step x each knob value (an option list, or min / default / max) x each hovered part, at rest:
+// text cut by the figure's frame, texts that overlap, a readout that shows NaN or undefined, a state whose link
+// does not stick, an exception in a step. Phone (390 px): no sideways scroll, no panel text under 12 px. Every
+// button and input has a name a screen reader can read.
+import fs from 'node:fs';
+import path from 'node:path';
+
+const SEVERITY = { figure_error: 'error', figure_readout: 'error', figure_text_overlap: 'warning', figure_text_cut: 'warning', figure_link: 'warning' };
+const FIX = {
+ figure_error: 'a step of SCENE.interactive threw: open figure.html with `showtime preview` and read the console',
+ figure_readout: 'interactive.readouts() returned a value that is not a number or words for this state',
+ figure_text_overlap: 'move one tag (its off / align), shorten it, or give the label an elbow; the state is named in the message',
+ figure_text_cut: 'move the tag or label inside the figure\'s crop (interactive.crop), or shorten it',
+ figure_link: 'the deep link of this state (#step=...) did not restore it: check the step ids and knob values',
+};
+
+/**
+ * -> [{severity, code, message, fix, state}]
+ * @param o.browser a playwright Browser
+ * @param o.url the project's server base URL
+ * @param o.projectDir the project folder
+ */
+export async function figureFindings(o) {
+ if (!fs.existsSync(path.join(o.projectDir, 'figure.html'))) return [];
+ const out = [];
+ const add = (sev, code, message, extra = {}) => out.push({ severity: sev, code, message, ...extra });
+ const open = async (ctxOpts) => {
+ const ctx = await o.browser.newContext(ctxOpts);
+ const page = await ctx.newPage();
+ const errors = [];
+ page.on('pageerror', (e) => errors.push(String(e.message || e)));
+ await page.goto(o.url + '/figure.html', { waitUntil: 'load', timeout: 60000 });
+ const ok = await page.waitForFunction(() => window.Figure && window.Figure.current && window.Figure.current.api, null, { timeout: 30000 }).then(() => true, () => false);
+ if (ok) await page.evaluate(() => window.Figure.current.api.ready);
+ return { ctx, page, errors, ok };
+ };
+ let d = null, p = null;
+ try {
+ d = await open({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' });
+ if (!d.ok) { add('error', 'figure_error', `figure.html did not start a live figure${d.errors.length ? ': ' + d.errors[0] : ''}`, { fix: FIX.figure_error }); return out; }
+ const w = await d.page.evaluate(() => window.Figure.current.walk());
+ for (const pr of w.problems) add(SEVERITY[pr.code] || 'warning', pr.code, `live figure, ${pr.where}: ${pr.message}`, { fix: FIX[pr.code], state: pr.where });
+ for (const e of d.errors.slice(0, 3)) add('error', 'figure_error', `live figure: ${e}`, { fix: FIX.figure_error });
+ const unnamed = await d.page.evaluate(() => [...document.querySelectorAll('.fg button, .fg input')]
+ .filter((e) => !(e.getAttribute('aria-label') || e.textContent.trim() || (e.id && document.querySelector('label[for="' + e.id + '"]')) || e.getAttribute('aria-labelledby')))
+ .map((e) => e.outerHTML.slice(0, 60)));
+ for (const u of unnamed.slice(0, 3)) add('warning', 'figure_a11y', `live figure: a control without a name a screen reader can read: ${u}`, { fix: 'give it text or an aria-label' });
+ out.walk = { states: w.states, steps: w.steps, parts: w.parts, knobs: w.knobs };
+ p = await open({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true, reducedMotion: 'reduce' });
+ if (p.ok) {
+ const ph = await p.page.evaluate(() => {
+ const small = [];
+ document.querySelectorAll('.fg-strip *, .fg-rail *').forEach((e) => {
+ if (![...e.childNodes].some((n) => n.nodeType === 3 && n.textContent.trim())) return;
+ const r = e.getBoundingClientRect(); if (!r.width || !r.height) return;
+ const st = getComputedStyle(e); if (st.visibility === 'hidden' || st.display === 'none') return;
+ const fs = parseFloat(st.fontSize); if (fs < 12) small.push(`${e.textContent.trim().slice(0, 30)} (${fs}px)`);
+ });
+ return { wide: document.documentElement.scrollWidth - innerWidth, phone: document.documentElement.classList.contains('fg-phone'), small };
+ });
+ if (ph.wide > 1) add('warning', 'figure_phone', `live figure on a phone (390 px): the page scrolls sideways by ${ph.wide}px`, { fix: 'something in the panel is wider than the screen' });
+ for (const s of ph.small.slice(0, 3)) add('warning', 'figure_phone', `live figure on a phone: "${s}" is under 12 px`, { fix: 'raise its size in the page\'s styles' });
+ }
+ } finally {
+ if (d) await d.ctx.close().catch(() => {});
+ if (p) await p.ctx.close().catch(() => {});
+ }
+ return out;
+}
diff --git a/skills/showtime/scripts/lib/stagehost.mjs b/skills/showtime/scripts/lib/stagehost.mjs
index 16f2354..437b875 100644
--- a/skills/showtime/scripts/lib/stagehost.mjs
+++ b/skills/showtime/scripts/lib/stagehost.mjs
@@ -488,9 +488,9 @@ async function openStageOnce(browser, o) {
// page that swaps pictures) is not a failure: counted, and kept out of the ring so it never pushes real
// failures out of it
if (/ERR_ABORTED/.test(error)) { log.cancelled++; return; }
- if (!log.blocked.includes(r.url())) ring(log.failed, { url: r.url(), error });
+ if (!log.blocked.includes(r.url())) ring(log.failed, { url: r.url(), error, type: r.resourceType() });
});
- page.on('response', (r) => { if (r.status() >= 400) ring(log.http, { url: r.url(), status: r.status() }); });
+ page.on('response', (r) => { if (r.status() >= 400) ring(log.http, { url: r.url(), status: r.status(), type: r.request().resourceType() }); });
page.on('request', (r) => ring(log.requests, r.url(), 500));
track.step = 'setting up the tab';
await page.route('**/*', (route) => {
@@ -699,6 +699,63 @@ export function imageSize(b) {
return null;
}
+/**
+ * The page's own requests that failed while it opened in a way the next open may not repeat: in the network (a
+ * reset or refused connection, an empty reply) or with a server error (HTTP 500 and up from a local server:
+ * render's own answers 500 when it cannot read a file, as on a machine out of file handles). Not counted: the
+ * ones cancelled while they ran (ERR_ABORTED), the blocked outside ones, media (a video's range requests come and
+ * go), and a 4xx (a missing file is missing on every open). -> [{url, error, type}]
+ */
+export function loadFailures(sess) {
+ const net = sess.log.failed.filter((f) => !/ERR_ABORTED|ERR_BLOCKED_BY_CLIENT/.test(f.error) && f.type !== 'media');
+ const http = sess.log.http.filter((h) => h.status >= 500 && h.type !== 'media' && isLocalUrl(h.url))
+ .map((h) => ({ url: h.url, error: `HTTP ${h.status}`, type: h.type || 'other' }));
+ return [...net, ...http];
+}
+
+/**
+ * What the page set up once it was ready: each [data-st] component (mounted and ready, mounted and not ready
+ * because its setup failed, or not mounted: a module of it did not load), each look (WebGL or its fallback; a
+ * context lost while it set up is left out: the look gets a new one when it draws, gl.js draw), and its requests
+ * that failed while it opened (loadFailures, by path). A render's
+ * workers each open the page in their own browser and must all get the setup of the first page: one whose
+ * components module failed to load draws none of them, and every frame of its lane is the bare page (the four
+ * looks of tests/test_looks.py missing in workers 2 and 3 of a 3-worker render, macOS Intel CI). Read once the
+ * page is ready (every component's setup has ended by then). A 4xx is left out: the server answers the same on
+ * every open, and a late one (a favicon) would only make two equal pages differ here; a module that answers 404
+ * shows as its components not mounted. -> {failed, comps, looks}, lists of strings, sorted.
+ */
+export async function pageSetup(sess) {
+ const inPage = await withPacedTimeout(sess.page.evaluate(() => ({
+ comps: Array.from(document.querySelectorAll('[data-st]'), (el) => `${(el.getAttribute('data-st') || '').trim()}: ` +
+ (el.__stComponent ? (el.hasAttribute('data-st-ready') ? 'ready' : 'mounted, not ready (its setup failed)') : 'not mounted')),
+ looks: (window.__stLooks || []).map((l) => `${l.look} ${l.sel}: ${l.gl ? 'webgl' : 'fallback'}`),
+ })), 60000, 'reading the page\'s setup', sess.pace);
+ // the path only: the port differs between servers, and a query (a cache-buster) can differ between opens
+ const local = (u) => String(u).replace(/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\]):\d+/, '').replace(/[?#].*$/, '');
+ const uniq = (a) => [...new Set(a)].sort();
+ // the same entry n times: once, with its count (20 looks of one kind, one of them on its fallback, still shows)
+ const counted = (a) => { const n = new Map(); for (const v of a) n.set(v, (n.get(v) || 0) + 1); return [...n].map(([v, k]) => (k > 1 ? `${v} (x${k})` : v)).sort(); };
+ return {
+ failed: uniq(loadFailures(sess).map((f) => `${local(f.url)} (${f.error})`)),
+ comps: counted(inPage.comps), looks: counted(inPage.looks),
+ };
+}
+
+/** How setup b differs from setup a (pageSetup): per kind, its first `max` differences; '' when they are the same. */
+export function setupDiff(a, b, max = 6) {
+ const out = [];
+ const names = { failed: 'failed to load', comps: 'components', looks: 'looks' };
+ for (const k of Object.keys(names)) {
+ const A = new Set(a[k] || []), B = new Set(b[k] || []);
+ const only = (x, y) => [...x].filter((v) => !y.has(v));
+ const plus = only(B, A), minus = only(A, B);
+ const all = [...plus.map((v) => `+ ${v}`), ...minus.map((v) => `- ${v}`)];
+ if (all.length) out.push(`${names[k]}: ${all.slice(0, max).join('; ')}${all.length > max ? ` (+${all.length - max} more)` : ''}`);
+ }
+ return out.join(' | ');
+}
+
export function withTimeout(p, ms, label) {
let timer;
return Promise.race([
diff --git a/skills/showtime/scripts/preview.mjs b/skills/showtime/scripts/preview.mjs
index 8a609d2..158f8a8 100644
--- a/skills/showtime/scripts/preview.mjs
+++ b/skills/showtime/scripts/preview.mjs
@@ -123,8 +123,11 @@ async function main() {
const a = parseCli(SPEC);
const proj = resolveProject(a._[0] || '.', { page: a.page });
const rec = await running(proj.dir);
- // the player link, with the server's session key (a server started before keys existed has none)
- const playerUrl = (r) => withKey(`${r.url}/_st/preview?page=/${encodeURI(proj.page)}`, r.key);
+ // the player link, with the server's session key (a server started before keys existed has none). A live page
+ // (<html data-st-live>: a living diagram's figure.html) runs its own clock: it opens as itself, not in the player.
+ let live = false;
+ try { live = /<html\b[^>]*\sdata-st-live\b/i.test(fs.readFileSync(path.join(proj.dir, ...proj.page.split('/')), 'utf8')); } catch { /* no page yet */ }
+ const playerUrl = (r) => withKey(live ? `${r.url}/${encodeURI(proj.page)}` : `${r.url}/_st/preview?page=/${encodeURI(proj.page)}`, r.key);
if (a.status) {
if (a.json) console.log(JSON.stringify(rec ? { running: true, ...rec, player: playerUrl(rec) } : { running: false }));
diff --git a/skills/showtime/scripts/render.mjs b/skills/showtime/scripts/render.mjs
index 599005d..e3be617 100644
--- a/skills/showtime/scripts/render.mjs
+++ b/skills/showtime/scripts/render.mjs
@@ -12,7 +12,7 @@ import {
import { checkFreshness, sourcesHash } from './lib/lean.mjs';
import { FILM_HOOK } from './lib/export/probe.mjs';
import { chapterTable, checkTiling, checkPieces, joinPieces, reencodePieces, withForcedKeys, seamAudio, framePsnr, pieceName, piecesDir, ONE_MACHINE, SEAM_PSNR_DB, SEAM_PSNR_REL_DB, SEAM_PSNR_FLOOR_DB, seamThreshold, SEAM_LOUDNESS_DB, SEAM_LAG_SAMPLES } from './lib/chapters.mjs';
-import { openBrowser, openStage, openPage, abandonBrowser, PAGE_OPEN_MS, writeDiagnostics, pullScore, parseSize, glRenderer, withTimeout, withPacedTimeout, newPace, paceSummary } from './lib/stagehost.mjs';
+import { openBrowser, openStage, openPage, abandonBrowser, PAGE_OPEN_MS, writeDiagnostics, pullScore, parseSize, glRenderer, withTimeout, withPacedTimeout, newPace, paceSummary, pageSetup, setupDiff, loadFailures } from './lib/stagehost.mjs';
import { resolveFF, ffmpeg, probe, ebur128, writeWavFloat, fpsArg, hasEncoder, setLogFile, logLine, meanFrameDiff, JPEG_VF } from './lib/ff.mjs';
import { CaptureQueue, OrderedFeed, autoWorkers, machineLimits } from './lib/pipeline.mjs';
import { renderFlags } from './lib/chrome.mjs';
@@ -419,6 +419,20 @@ async function main(retry = null) {
openOpts.config = cfg;
sessions.push(await openFirst(openOpts));
}
+ // What the first page set up (its components, looks and failed requests): every other page this render
+ // captures from must set up the same (openWorkerPage), or its frames are another page's. A request of the
+ // page's own that failed in the network while it opened (a reset connection on a busy machine: one
+ // components module missing and no component draws) can be gone on the next open, so this page opens
+ // again, twice at most; one that fails every time is part of the page as it is here (a warning says so).
+ let baseSetup = await pageSetup(sessions[0]);
+ for (let k = 1; baseSetup.failed.length && k <= 2; k++) {
+ logLine(`first page: ${baseSetup.failed.length} request(s) failed while it opened (${baseSetup.failed.slice(0, 4).join(', ')}); opening it again (${k}/2)`);
+ await closeSoon(sessions[0].close());
+ sessions.length = 0;
+ sessions.push(await openFirst(openOpts));
+ baseSetup = await pageSetup(sessions[0]);
+ }
+ if (baseSetup.failed.length) addWarn(`the page's request(s) failed on each of 3 opens, so the video is drawn without them: ${baseSetup.failed.slice(0, 4).join(', ')}`);
const info0 = sessions[0].info;
timings.load = Date.now() - t;
stage('main', 'preparing the capture');
@@ -732,6 +746,36 @@ async function main(retry = null) {
for (const x of ts) await sess.seek(x);
};
+ // SHOWTIME_TEST_HOLD_START=1 (tests only): no worker takes a frame until every worker has opened its page (or
+ // given up), so each lane is captured by its own worker's page, as in a long render (in a short one a worker whose
+ // page opened first takes the lanes of the others while they still open: frames handed over, all of them right)
+ const holdStart = workers > 1 && process.env.SHOWTIME_TEST_HOLD_START === '1';
+ const openDone = Array.from({ length: workers }, () => { let r; const p = new Promise((x) => { r = x; }); p.done = r; return p; });
+ // A worker's page that differs from the first page's: which one is wrong? The first time, one more page is opened
+ // (in the first browser) and read. When it opened with no failed request and agrees with the worker and not with
+ // the first page, the first page is the one that opened short (a failure that left no trace in its requests, such
+ // as a setup that threw), and its frames are already in the video: the render stops with an error instead of
+ // shipping them. Otherwise the worker's page is the odd one and is opened again.
+ let referee = null;
+ const judgeFirst = () => referee || (referee = (async () => {
+ const pace = newPace();
+ const p = openStage(b0.browser, { ...openOpts, pace });
+ let ref;
+ try { ref = await withPacedTimeout(p, PAGE_OPEN_MS, 'opening a second first page', pace); } catch (e) { p.then((x) => x.close(), () => {}); throw e; }
+ try { return await pageSetup(ref); } finally { await closeSoon(ref.close()); }
+ })().catch((e) => { logLine(`a second first page could not be read: ${String(e && e.message || e).split('\n')[0]}`); return null; }));
+ // what decides the tie: the components and the failed requests (a look on its fallback in two pages and on WebGL
+ // in the first is a GPU that stopped giving contexts, not a first page that opened short)
+ const setupCore = (x) => ({ failed: x.failed, comps: x.comps });
+ // before the render stops on the first page: what that page itself logged, in render.log, and its diagnostics
+ const logFirstPage = async () => {
+ const s0 = sessions[0], L = s0.log;
+ for (const f of loadFailures(s0).slice(0, 20)) logLine(`first page: request failed: ${f.url} (${f.error}, ${f.type})`);
+ for (const h of L.http.slice(0, 20)) logLine(`first page: http ${h.status}: ${h.url}`);
+ for (const e of L.errors.slice(0, 20)) logLine(`first page: page error: ${e.message}`);
+ for (const m of L.console.filter((x) => x.type === 'error').slice(0, 20)) logLine(`first page: console error: ${m.text}`);
+ await withTimeout(writeDiagnostics(s0, diagDir, 'first-page'), 30000, 'diagnostics').catch(() => {});
+ };
const wsess = [sessions[0]]; // one page per worker, kept across its runs
const drawn = []; // per worker: the frame after the last one its page drew (null: a new page)
// a worker's page. A browser that never answers while it opens one is closed after PAGE_OPEN_MS and
@@ -766,6 +810,23 @@ async function main(retry = null) {
if (b) abandonBrowser(b); // closed if it can, its process killed
throw e;
}
+ // the same setup as the first page, or this lane's frames would be another page's (pageSetup)
+ const got = await pageSetup(sess).catch((e) => ({ error: String(e && e.message || e).split('\n')[0] }));
+ const diff = got.error ? `its setup could not be read: ${got.error}` : setupDiff(baseSetup, got);
+ if (diff) {
+ await closeSoon(sess.close());
+ logLine(`worker ${w}: its page's setup against the first page's: ${diff}`);
+ const ref = got.error ? null : await judgeFirst();
+ // the second first page decides only when nothing failed while it opened (else it may be as short as the worker's)
+ if (ref && !ref.failed.length && !setupDiff(ref, got) && setupDiff(setupCore(baseSetup), setupCore(ref))) {
+ await logFirstPage();
+ const err = new UserError(`the first page did not set up as the pages opened after it did (${setupDiff(baseSetup, ref, 2)}), so its frames cannot be used`,
+ `re-run the render (a request or a component setup failed while the first page opened, as on a busy machine); render.log has the first page's HTTP errors, page errors and console errors (lines "first page: ..."), and ${diagDir} its screenshot, DOM and log (first-page.*)`);
+ err.firstPageWrong = true;
+ throw err;
+ }
+ throw new Error(`the page in worker ${w} did not set up as the first page did (${got.error ? diff : setupDiff(baseSetup, got, 2)})`);
+ }
sessions.push(sess);
wsess[w] = sess;
drawn[w] = null;
@@ -827,6 +888,7 @@ async function main(retry = null) {
stage(who, null);
return;
} catch (err) {
+ if (err && err.firstPageWrong) { interrupted = true; throw err; }
if (interrupted) return;
if (err && err.glLost) throw err; // not this worker's: the whole render runs again without the GPU
if (drawing !== null) queue.unclaim(w, drawing);
@@ -879,17 +941,22 @@ async function main(retry = null) {
const pre = early[w - 1];
browsers[w] = pre ? await pre.catch(() => openBrowser({ gpu, ownSignals: true, args: renderFlags() })) : await openBrowser({ gpu, ownSignals: true, args: renderFlags() });
}
- for (let k = 1; !wsess[w]; k++) {
- if (interrupted || queue.left() === 0) return;
- try {
- await openWorkerPage(w);
- } catch (e) {
- if (interrupted) return;
- const msg = String(e.message || e).split('\n')[0];
- logLine(`worker ${w}: ${msg}`);
- if (k >= 3) { prog.clear(); warn(`worker ${w} could not open the page (${msg}); the other workers take its frames`); return; }
+ try {
+ for (let k = 1; !wsess[w]; k++) {
+ if (interrupted || queue.left() === 0) return;
+ try {
+ await openWorkerPage(w);
+ } catch (e) {
+ if (e && e.firstPageWrong) { interrupted = true; throw e; }
+ // the others drew every frame while this page opened: render closes the browsers, and this open ends there
+ if (interrupted || queue.left() === 0) return;
+ const msg = String(e.message || e).split('\n')[0];
+ logLine(`worker ${w}: ${msg}`);
+ if (k >= 3) { prog.clear(); warn(`worker ${w} could not open the page (${msg}); the other workers take its frames`); return; }
+ }
}
- }
+ } finally { openDone[w].done(); }
+ if (holdStart) await Promise.all(openDone);
for (;;) {
if (interrupted || (feed && feed.dead)) return;
const run = queue.take(w);
@@ -915,7 +982,15 @@ async function main(retry = null) {
addWarn(`${missing.length} frame(s) missing after capture; re-capturing`);
const b = await openBrowser({ gpu, ownSignals: true, args: renderFlags() });
browsers.push(b);
- const sess = await openPage(b, openOpts, { onRetry: (m) => { warn(m); logLine(m); } });
+ let sess = null;
+ for (let k = 1; !sess; k++) {
+ const s = await openPage(b, openOpts, { onRetry: (m) => { warn(m); logLine(m); } });
+ const diff = await pageSetup(s).then((g) => setupDiff(baseSetup, g), (e) => `its setup could not be read: ${String(e && e.message || e).split('\n')[0]}`);
+ if (!diff) { sess = s; break; }
+ await closeSoon(s.close());
+ if (k >= 3) throw new UserError(`the page opened for the missing frames did not set up as the first page did, 3 times (${diff})`);
+ logLine(`missing frames: the page did not set up as the first page did (${diff}); opening it again`);
+ }
sessions.push(sess);
for (const i of missing) {
await sess.seek(i / fps);
@@ -935,6 +1010,7 @@ async function main(retry = null) {
for (const e of pageLog.errors.slice(0, 50)) logLine(`browser page error: ${e.message}`);
for (const m of pageLog.console.filter((x) => x.type === 'error' || x.type === 'warning').slice(0, 100)) logLine(`browser console ${m.type}: ${m.text}${m.url ? ` (${m.url}:${m.line})` : ''}`);
for (const u of pageLog.blocked.slice(0, 20)) logLine(`browser blocked request: ${u}`);
+ for (const s of sessions) for (const f of loadFailures(s).slice(0, 20)) logLine(`browser request failed: ${f.url} (${f.error}, ${f.type})`);
for (const h of pageLog.http.filter((x) => x.status >= 400).slice(0, 50)) logLine(`browser http ${h.status}: ${h.url}`);
stage('main', 'closing the pages and the workers\' browsers');
const diag = await sessions[0].diag().catch(() => null);
@@ -1445,6 +1521,12 @@ async function buildAudio({ proj, cfg, info, browser, openOpts, audioDir, from,
const sess = await openPage({ browser }, { ...openOpts, scale: 1 }, { label: 'opening the page for the soundtrack' });
try {
const sc = await pullScore(sess.page, { duration: fullDur, sampleRate: 48000 });
+ // the first page has a score: a page without one opened short (a module that set ST.score did not load); the
+ // audio retry opens it again, and a project with audio never ships silent
+ if (!sc) {
+ const lost = loadFailures(sess).map((f) => `${f.url} (${f.error})`);
+ throw new Error(`the page for the soundtrack has no ST.score, though the first page had one${lost.length ? `; failed while it opened: ${lost.slice(0, 3).join(', ')}` : ''}`);
+ }
if (sc) {
const f = path.join(audioDir, 'score.wav');
writeWavFloat(f, sc.channels, sc.sampleRate);
diff --git a/skills/showtime/scripts/server.mjs b/skills/showtime/scripts/server.mjs
index 2178e6b..76cf9e8 100644
--- a/skills/showtime/scripts/server.mjs
+++ b/skills/showtime/scripts/server.mjs
@@ -121,9 +121,11 @@ function findEmoji(dir, code) {
return null;
}
-/** Insert <script src="/_st/stage.js"> as the first script of an HTML page that lacks it. */
+/** Insert <script src="/_st/stage.js"> as the first script of an HTML page that lacks it. A live page
+ * (<html data-st-live>: a living diagram's figure.html) runs its own clock and gets none. */
export function injectStage(html) {
if (/\/_st\/stage\.js/.test(html)) return html;
+ if (/<html\b[^>]*\sdata-st-live\b/i.test(html)) return html;
const tag = '<script src="/_st/stage.js"></script>';
if (/<head[^>]*>/i.test(html)) return html.replace(/<head[^>]*>/i, (m) => m + tag);
if (/<html[^>]*>/i.test(html)) return html.replace(/<html[^>]*>/i, (m) => m + '<head>' + tag + '</head>');
diff --git a/skills/showtime/setup/package.json b/skills/showtime/setup/package.json
index 0c0fd27..0a561a7 100644
--- a/skills/showtime/setup/package.json
+++ b/skills/showtime/setup/package.json
@@ -1,6 +1,6 @@
{
"name": "showtime-runtime",
- "version": "0.4.2",
+ "version": "0.4.3",
"private": true,
"description": "Node dependencies for showtime (installed by setup.py into ~/.showtime/node). Versions are pinned exactly. Icon sets are not installed here: they are fetched per icon on first use (manifest.json \"icon_packs\").",
"license": "MIT",
diff --git a/skills/showtime/templates/diagram/README.md b/skills/showtime/templates/diagram/README.md
new file mode 100644
index 0000000..baf65ef
--- /dev/null
+++ b/skills/showtime/templates/diagram/README.md
@@ -0,0 +1,22 @@
+# Living diagram: a system that builds, flows and explains itself, as a film and as a live figure
+
+An isometric figure drawn by `/_st/diagram.js` as a pure function of time: parts arrive in the order that
+explains them, pipes and links join them by port name, flows and packets move through them, labels land
+when their part matters and the camera chooses what to look at.
+
+- `scene.js`: the spec (`window.SCENE`) and the `CUE` table of beat times (one per line, so
+ `showtime new diagram --duration` and `showtime retime` move them). It starts as a heat pump.
+- `examples/market.js` (a matching market: nodes, links, envelopes, steps) and `examples/enter.js` (a coding
+ agent's loop across your machine and the cloud, narrated): `showtime new diagram <dir> --example market` (or
+ `enter`) starts from one at its own length.
+- `examples/econ-lab.js`: a three-equation economy (households, firms, a central bank) as a live-first figure:
+ steps are experiments, the rule strength and a promise's horizon are knobs; its film is its tour.
+- `index.html`: the film's page (title block, corner notes, footers) and the fonts of the themes. The theme is
+ `<html data-theme>`: `showtime new diagram <dir> --theme dark` (or `white`) sets it, with `"theme"` and
+ `"background"` in `showtime.json`.
+- `figure.html`: the same scene as a live figure (hover a part, pick a step, turn a knob), from the scene's
+ `interactive` block: `showtime export html <dir> --interactive` makes it one offline file.
+- `audio/mix.json`: a quiet bed; add the voice track for a narrated film.
+
+The guide: `references/workflows/diagram.md` (`showtime guide diagram`). The poster is a still at the end
+(`"poster"`), never baked into frame 0 (`"render": {"poster_bake": "off"}`): the film opens on the empty plate.
diff --git a/skills/showtime/templates/diagram/audio/mix.json b/skills/showtime/templates/diagram/audio/mix.json
new file mode 100644
index 0000000..f577c28
--- /dev/null
+++ b/skills/showtime/templates/diagram/audio/mix.json
@@ -0,0 +1,8 @@
+{
+ "_comment": "A quiet bed under the build. For narration add {\"id\": \"voice\", \"kind\": \"voice\", \"file\": \"voice/vo.wav\", \"start\": 0.4} and a \"duck\": {\"under\": \"voice\", \"depth_db\": 14} on the bed (references/workflows/diagram.md).",
+ "sample_rate": 48000,
+ "tracks": [
+ {"id": "bed", "kind": "music", "compose": {"style": "underscore", "sections": "0:intro,7.2:verse,16:outro", "seed": "auto"}, "gain_db": -4, "fade_out": 1.5}
+ ],
+ "master": {"lufs": -14, "true_peak": -1}
+}
diff --git a/skills/showtime/templates/diagram/examples/econ-lab.js b/skills/showtime/templates/diagram/examples/econ-lab.js
new file mode 100644
index 0000000..72ff047
--- /dev/null
+++ b/skills/showtime/templates/diagram/examples/econ-lab.js
@@ -0,0 +1,221 @@
+/* "The lab with three equations": a textbook New Keynesian model (households, firms and a central bank wired in a
+ loop through the output gap, inflation and the policy rate; Woodford 2003, calibration of Galí 2015, ch. 3) as a
+ LIVE figure. It is built from the first frame; each step is an experiment that runs on the board, the rule
+ strength and the promise horizon are knobs, and every number on screen comes from DATA below.
+ DATA is copied from set_the_rate.json, the results of the open-source set-the-rate toy (MIT): impact responses
+ after a 1 point shock, the Taylor-principle check, the forward-guidance puzzle ratios. Textbook model,
+ illustrative calibration: a lab about a model, not a forecast.
+ The live page is figure.html (`showtime export html <project> --interactive`); index.html films the tour (the same
+ live actions, on the film's clock: interactive.film = 'tour'), so CUE.duration is the tour's length.
+ To use it: `showtime new diagram <dir> --example econ-lab --theme white`. */
+var CUE = {
+ duration: 67.3,
+};
+
+(function () {
+ var DATA = {"demand": {"output_gap": 0.259, "inflation": 0.352, "policy_rate": 0.658}, "cost": {"baseline": {"output_gap": -0.513, "inflation": 1.283, "policy_rate": 1.667}, "strong": {"output_gap": -0.839, "inflation": 0.839, "policy_rate": 2.098}, "phiBaseline": 1.5, "phiStrong": 3}, "taylor": {"active": {"phi": 1.5, "outside": 2, "plain": "The rate rises more than one for one with inflation, and the model has exactly one bounded path after any shock."}, "passive": {"phi": 0.8, "outside": 1, "plain": "The rate rises less than one for one with inflation, and the model has many bounded paths, so the three equations alone do not say which one the economy follows."}}, "promise": {"quarter": 8, "cut": 1, "today": {"output_gap": -0.05, "inflation": 0.142, "policy_rate": 0.188}}, "puzzle": {"quarters": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "output_gap_ratio": [1.0, 1.172, 1.543, 2.175, 3.174, 4.708, 7.036, 10.547, 15.834, 23.787, 35.743, 53.715, 80.729], "inflation_ratio": [1.0, 2.162, 3.683, 5.821, 8.937, 13.556, 20.456, 30.799, 46.325, 69.648, 104.695, 157.363, 236.519]}, "calibration": {"beta": 0.99, "sigma": 1.0, "kappa": 0.172, "phi_y": 0.125, "rho_demand": 0.5, "rho_cost_push": 0.5}};
+ var R0 = 0.5, N0 = 4; // the resting board: trays half full, four cells of rate
+ var fI = function (pp) { return R0 + 0.3 * pp; }; // drawn levels (illustrative scale): inflation, pp a year
+ var fG = function (pct) { return R0 + 0.5 * pct; }; // the output gap, % of potential
+ var nRate = function (pp) { return Math.max(0, Math.min(8, N0 + Math.round(pp * 1.9))); };
+ var sgn = function (v, d) { var s = Math.abs(v).toFixed(d == null ? 2 : d); return (v < 0 ? '−' : '+') + s; };
+ var RULE = { '1.5': DATA.cost.baseline, '3': DATA.cost.strong, '0.8': null };
+ var HZ = DATA.puzzle;
+
+ var node = function (id, icon, x, y) { return { id: id, part: 'node', icon: icon, at: [x, y, 0], r: 5.2, scale: 1.75, build: -3, lift: 0 }; };
+ var wire = function (id, a, b, o) { return Object.assign({ id: id, kind: 'link', from: a, to: b, w: 2.6, tone: 'mute', build: [-3, 0.01] }, o || {}); };
+ var hop = function (path, at, h) { return path.map(function (p, i) { var rev = p[0] === '-'; return { at: at + i * h, dur: h, along: rev ? p.slice(1) : p, reverse: rev }; }); };
+ var hidden = 1e9;
+
+ window.SCENE = {
+ page: {
+ kicker: 'A textbook model · as a lab', figno: 'Woodford (2003)',
+ title: 'The lab with *three equations*',
+ dek: 'Households, firms and a central bank, wired in a loop. Textbook model, illustrative calibration.',
+ footL: 'Educational demo, not research', footR: 'Numbers · set-the-rate toy', steps: { at: [112, 400], width: 560 },
+ },
+ world: { scale: 10, origin: [960, 250] },
+ leaderCost: 5,
+ items: [
+ { id: 'labplate', part: 'plate', at: [36, -8, -2], size: [60, 52, 2], grid: 6, build: -3, lift: 0 },
+ node('hh', 'house', 46, 32),
+ { id: 'gap', part: 'store', at: [57, 27.5, 0], size: [11, 8, 6], tone: 'cold', fill: R0, build: -3, lift: 0 },
+ node('firm', 'firm', 82, 28),
+ { id: 'infl', part: 'store', at: [76, 2, 0], size: [9, 9, 6], tone: 'hot', fill: R0, build: -3, lift: 0 },
+ node('bank', 'bank', 56, 1),
+ { id: 'rate', part: 'stack', at: [41.5, 3, 0], size: [5, 5], max: 8, cell: 0.95, gap: 0.3, tone: 'cold', count: [[-3, N0]], build: -3, lift: 0 },
+ wire('w1', 'hh.x+', 'gap.x-'), wire('w2', 'gap.x+', 'firm.x-'), wire('w3', 'firm.y-', 'infl.y+'),
+ wire('w4', 'infl.x-', 'bank.x+'), wire('w5', 'bank.y+', 'hh.y-'), wire('w6', 'rate.x+', 'bank.x-', { w: 2 }),
+ ],
+ // the loop, always moving: spending -> gap -> inflation -> rate -> spending
+ flows: [{ id: 'loop', at: 0, speed: 80, spacing: 34, dash: 12, path: [{ pipe: 'w1', tone: 'cold' }, { gap: 30 }, { pipe: 'w2', tone: 'cold' }, { gap: 40 },
+ { pipe: 'w3', tone: 'cold' }, { gap: 30 }, { pipe: 'w4', tone: 'cold' }, { gap: 40 }, { pipe: 'w5', tone: 'cold' }, { gap: 40 }] }],
+ // packets the steps send (no moves: hidden until a step routes them)
+ tokens: [
+ { id: 'chipD', tone: 'hot', shape: 'chip', size: [3.6, 2.6, 0.8], moves: [] },
+ { id: 'chipS', tone: 'hot', shape: 'chip', size: [3.6, 2.6, 0.8], moves: [] },
+ { id: 'puck', tone: 'hot', r: 1.2, moves: [] },
+ { id: 'back', tone: 'cold', shape: 'chip', size: [3, 2.2, 0.6], moves: [] },
+ { id: 'env', tone: 'hot', shape: 'envelope', size: [4.4, 3.2, 0.6], moves: [] },
+ { id: 'ghI', tone: 'mute', shape: 'chip', size: [8.4, 0.5, 0.12], moves: [] },
+ { id: 'ghG', tone: 'mute', shape: 'chip', size: [10.4, 0.5, 0.12], moves: [] },
+ { id: 'a1', tone: 'hot', r: 1.1, moves: [] }, { id: 'a2', tone: 'hot', r: 1.1, moves: [] }, { id: 'a3', tone: 'hot', r: 1.1, moves: [] },
+ ],
+ labels: [
+ { for: 'hh', at: -3, title: 'Households' },
+ { for: 'firm', anchor: [86.5, 29, 4], at: -3, title: 'Firms' }, // anchored on its side: the leader leaves it at once
+ { for: 'bank', at: -3, title: 'Central bank' },
+ ],
+ // the board's words: a name at rest, a value while a step runs (set by the steps below)
+ tags: [
+ { id: 'infl', for: 'infl', text: 'inflation', at: -3, tone: 'mute', off: [70, -96], align: 'right' },
+ { id: 'gap', for: 'gap', text: 'output gap', at: -3, tone: 'mute', off: [0, -80] },
+ { id: 'rate', for: 'rate', text: 'policy rate', at: -3, tone: 'mute', off: [-40, -40], align: 'right' },
+ { id: 'bank', for: 'bank', text: 'rule 1.5', at: -3, tone: 'mute', off: [40, -72], align: 'right' },
+ { id: 'spend', anchor: [46, 32, 17], text: 'spend more now', at: hidden, tone: 'hot', off: [150, -20], align: 'left' },
+ { id: 'cost', anchor: [82, 28, 11], text: 'cost shock', at: hidden, tone: 'hot', off: [-130, -6], align: 'right' },
+ { id: 'news', token: 'env', text: 'news', at: hidden, tone: 'hot', off: [0, -60] },
+ ],
+ // the film (index.html, the tour on the film's clock): the board right of the page's text column
+ camera: [{ at: -10, dur: 0.01, zoom: 1.4, focus: [56, 10, 0], to: [1330, 560] }],
+
+ interactive: {
+ film: 'tour',
+ kicker: 'Live figure', title: 'The lab with three equations',
+ sub: 'Households, firms and a central bank, wired in a loop. Hover a part, pick a step, turn the rule under the figure.',
+ source: 'Textbook model, illustrative calibration. Numbers from the set-the-rate toy (set_the_rate.json).',
+ // the live page: no title column, the board in the middle
+ camera: [{ at: -10, dur: 0.01, zoom: 1.5, focus: [56, 10, 0], to: [960, 600] }],
+ crop: { desk: [180, 60, 1740, 1040], phone: [360, 200, 1560, 1030] },
+ parts: [
+ { id: 'hh', name: 'Households', sub: 'spend, looking ahead' },
+ { id: 'gap', name: 'Output gap', sub: 'output against its natural level' },
+ { id: 'firm', name: 'Firms', sub: 'set prices, looking ahead' },
+ { id: 'infl', name: 'Inflation', sub: 'how fast prices rise' },
+ { id: 'bank', name: 'Central bank', sub: 'sets the rate by a rule' },
+ { id: 'rate', name: 'Policy rate', sub: 'the rate the rule sets' },
+ ],
+ knobs: {
+ rule: { label: 'Rule strength', hint: 'how hard the rate answers inflation', options: [['0.8', 'less than 1'], ['1.5', 'the textbook'], ['3', 'stronger']], default: '1.5' },
+ q: { label: 'Promise for quarter', hint: 'the rate is held still until then', min: 0, max: 12, step: 1, default: 8, format: function (v) { return String(HZ.quarters[v]); } },
+ },
+ reset: function (fx) {
+ fx.level('gap', R0, { dur: 0.6 }); fx.level('infl', R0, { dur: 0.6 }); fx.count('rate', N0);
+ fx.say('infl', 'inflation', 'mute'); fx.say('gap', 'output gap', 'mute'); fx.say('rate', 'policy rate', 'mute'); fx.say('bank', 'rule 1.5', 'mute');
+ ['spend', 'cost', 'news'].forEach(function (t) { fx.hide(t); });
+ ['chipD', 'chipS', 'puck', 'back', 'env', 'ghI', 'ghG', 'a1', 'a2', 'a3'].forEach(function (k) { fx.park(k); });
+ // the loop is always running: a soft wave around it every few seconds, under every step
+ fx.every(4200, function () { ['hh', 'gap', 'firm', 'infl', 'bank'].forEach(function (id, i) { fx.pulse(id, 'cold', { delay: 0.15 + i * 0.55, dur: 1.1, amount: 0.55 }); }); }, 'wave');
+ },
+ steps: [
+ { id: 'loop', kicker: 'The loop', text: 'Spending moves the gap, the gap moves inflation, inflation moves the rate, and the rate moves spending.',
+ narr: 'Wire them up, and each part moves the next.',
+ run: function (fx) { fx.pulse('hh', 'warm'); } },
+ { id: 'spending', kicker: 'Experiment 1 · spending burst', text: 'Gap opens, inflation rises, the rule lifts the rate, spending cools.',
+ narr: 'Send in a burst of spending: households want more, now. The gap opens, inflation rises, the rule lifts the rate, and spending cools.',
+ run: function (fx) {
+ fx.send('chipD', [{ at: 0, dur: 0.01, to: [46, 32, 22] }, { at: 0.02, dur: 0.7, to: 'hh.top' }]);
+ fx.send('puck', hop(['w1', 'w2', 'w3', 'w4'], 0.9, 0.62));
+ fx.send('back', hop(['w5'], 3.6, 1.2));
+ fx.pulse('hh', 'hot', { delay: 0.6 }); fx.pulse('firm', 'hot', { delay: 2.0 }); fx.pulse('bank', 'cold', { delay: 3.4 }); fx.pulse('hh', 'cold', { delay: 4.8 });
+ fx.say('spend', 'spend more now', 'hot'); fx.hide('spend', { delay: 2.6 });
+ fx.level('gap', fG(DATA.demand.output_gap), { delay: 1.3 }); fx.say('gap', '↑ gap ' + sgn(DATA.demand.output_gap), 'cold', { delay: 1.3 });
+ fx.level('infl', fI(DATA.demand.inflation), { delay: 2.2 }); fx.say('infl', '↑ inflation ' + sgn(DATA.demand.inflation), 'hot', { delay: 2.2 });
+ fx.count('rate', nRate(DATA.demand.policy_rate), { delay: 3.4 }); fx.say('rate', '↑ rate ' + sgn(DATA.demand.policy_rate), 'cold', { delay: 3.4 });
+ } },
+ { id: 'cost', kicker: 'Experiment 2 · a cost shock', knob: 'rule',
+ text: function (s) { return { '1.5': 'Inflation up, output down. The rule still raises the rate.', '3': 'A stronger rule: less inflation, a deeper dip.',
+ '0.8': 'The rate rises less than one for one: the anchor is lost; many paths are possible.' }[s.rule]; },
+ narr: function (s) { return s.rule === '0.8' ? 'If inflation rises one point and the rate less than one point, the model loses its anchor: many paths are possible.'
+ : 'An energy-cost shock hits firms: inflation up, output down. The rule still raises the rate; a stronger rule means less inflation and a deeper dip.'; },
+ run: function (fx, again) {
+ var r = RULE[fx.state.rule], strong = fx.state.rule === '3', d = again ? 0 : 1;
+ if (!again) {
+ fx.send('chipS', [{ at: 0, dur: 0.01, to: [82, 28, 22] }, { at: 0.02, dur: 0.7, to: 'firm.top' }]);
+ fx.send('puck', hop(['w3', 'w4'], 0.9, 0.6));
+ fx.pulse('firm', 'hot', { delay: 0.6 }); fx.say('cost', 'cost shock', 'hot'); fx.hide('cost', { delay: 2.2 });
+ }
+ fx.stopLoops('paths'); ['a1', 'a2', 'a3', 'ghI', 'ghG'].forEach(function (k) { fx.park(k); });
+ fx.say('bank', 'rule ' + fx.state.rule, fx.state.rule === '0.8' ? 'hot' : fx.state.rule === '3' ? 'cold' : 'mute');
+ if (!r) { // 0.8: no unique bounded path; three paths leave the inflation tray, none is drawn as the answer
+ fx.level('infl', R0, { dur: 0.5 }); fx.level('gap', R0, { dur: 0.5 }); fx.count('rate', N0);
+ fx.say('infl', 'many possible paths', 'hot', { delay: 1.2 * d }); fx.say('gap', 'no unique path', 'mute', { delay: 1.2 * d }); fx.say('rate', 'less than one for one', 'hot', { delay: 1.2 * d });
+ fx.every(3200, function () {
+ [['a1', [88, -2, 13], 0], ['a2', [80, 6, 17], 0.1], ['a3', [71, 11, 12], 0.2]].forEach(function (a) {
+ fx.send(a[0], [{ at: 0, dur: 0.01, to: 'infl.top' }, { at: 0.1 + a[2], dur: 1.6, to: a[1] }], { delay: 1.2 * d, stay: 0.6 });
+ });
+ }, 'paths');
+ return;
+ }
+ if (!again) { fx.send('back', hop(['w5', '-w1'], 2.3, 0.9)); fx.pulse('bank', 'cold', { delay: 2.1 }); } else fx.pulse('bank', 'cold');
+ fx.level('infl', fI(r.inflation), { delay: 1.3 * d, dur: again ? 0.6 : 0.8 });
+ fx.level('gap', fG(r.output_gap), { delay: 2.4 * d, dur: again ? 0.6 : 0.8 });
+ fx.count('rate', nRate(r.policy_rate), { delay: 2.1 * d });
+ var was = function (v, b) { return strong ? ' (was ' + sgn(b) + ')' : ''; };
+ fx.say('infl', '↑ inflation ' + sgn(r.inflation) + was(r.inflation, DATA.cost.baseline.inflation), 'hot', { delay: 1.3 * d });
+ fx.say('gap', '↓ output ' + sgn(r.output_gap) + was(r.output_gap, DATA.cost.baseline.output_gap), 'cold', { delay: 2.4 * d });
+ fx.say('rate', '↑ rate ' + sgn(r.policy_rate), 'cold', { delay: 2.1 * d });
+ if (strong) { // the rule-1.5 run stays as faint bars
+ fx.send('ghI', [{ at: 0, dur: 0.01, to: [80.5, 10.6, 0.4 + 5.4 * fI(DATA.cost.baseline.inflation)] }], { stay: true });
+ fx.send('ghG', [{ at: 0, dur: 0.01, to: [62.5, 35.1, 0.4 + 5.4 * fG(DATA.cost.baseline.output_gap)] }], { stay: true });
+ }
+ } },
+ { id: 'promise', kicker: 'Experiment 3 · a promise', text: 'A lower rate promised two years out raises prices now.',
+ narr: 'The wires carry words too. To people who look ahead, a promise is news. A lower rate promised two years out raises prices now.',
+ run: function (fx) {
+ fx.send('env', [{ at: 0, dur: 0.01, to: 'bank.top', off: [0, 0, 1] }, { at: 0.3, dur: 1.2, along: 'w5' }].concat(hop(['w1', 'w2', 'w3'], 1.6, 0.75)));
+ fx.say('news', 'news', 'hot'); fx.say('news', 'lower rate, two years out', 'hot', { delay: 1.5 }); fx.hide('news', { delay: 3.9 });
+ fx.pulse('bank', 'hot'); fx.pulse('hh', 'hot', { delay: 1.5 }); fx.pulse('firm', 'hot', { delay: 3.1 });
+ var t = DATA.promise.today;
+ fx.level('infl', fI(t.inflation), { delay: 3.6 }); fx.say('infl', '↑ prices move now ' + sgn(t.inflation), 'hot', { delay: 3.6 });
+ fx.level('gap', fG(t.output_gap), { delay: 3.6 }); fx.say('gap', 'gap ' + sgn(t.output_gap), 'mute', { delay: 3.6 });
+ fx.count('rate', nRate(t.policy_rate), { delay: 3.8 }); fx.say('rate', 'rule on: rate ' + sgn(t.policy_rate), 'cold', { delay: 3.8 });
+ } },
+ { id: 'puzzle', kicker: 'Its limit', knob: 'q', text: 'Rate held until then: the further out, the bigger the effect today. The forward guidance puzzle.',
+ narr: 'Hold the rate still until then, and in this simple model, the further out the promise, the bigger the effect today: the forward guidance puzzle.',
+ run: function (fx, again) {
+ var i = fx.state.q, last = HZ.quarters.length - 1;
+ var li = Math.log(HZ.inflation_ratio[i]) / Math.log(HZ.inflation_ratio[last]), lg = Math.log(HZ.output_gap_ratio[i]) / Math.log(HZ.output_gap_ratio[last]);
+ if (!again) { fx.send('env', [{ at: 0, dur: 0.01, to: 'bank.top', off: [0, 0, 1] }], { stay: true }); fx.pulse('bank', 'hot'); }
+ fx.level('infl', R0 + 0.45 * li, { dur: 0.5 }); fx.level('gap', R0 + 0.45 * lg, { dur: 0.5 }); fx.count('rate', N0);
+ fx.say('infl', 'inflation today ×' + HZ.inflation_ratio[i].toFixed(1), 'hot');
+ fx.say('gap', 'gap today ×' + HZ.output_gap_ratio[i].toFixed(1), 'cold');
+ fx.say('rate', 'rate held until then', 'mute'); fx.say('bank', 'promise: quarter ' + HZ.quarters[i], 'hot');
+ } },
+ { id: 'leaves', kicker: 'It leaves out', text: 'Zero-rate floor, investment, any real central bank.',
+ narr: 'A laboratory, not an oracle: it leaves out the floor on rates near zero, investment, and any real central bank.' },
+ ],
+ readouts: function (s, step) {
+ var three = function (r, note) {
+ return { rows: [{ part: 'infl', k: 'Inflation', v: sgn(r.inflation), u: 'pp a year', tone: 'hot' },
+ { part: 'gap', k: 'Output gap', v: sgn(r.output_gap), u: '% of potential', tone: 'cold' },
+ { part: 'rate', k: 'Policy rate', v: sgn(r.policy_rate), u: 'pp a year', tone: 'cold' }], note: note };
+ };
+ if (step === 'spending') return three(DATA.demand, 'On impact, rule ' + DATA.taylor.active.phi + ' (the toy ran this shock at ' + DATA.taylor.active.phi + ').');
+ if (step === 'cost') {
+ var r = RULE[s.rule];
+ if (!r) return { rows: [{ part: 'bank', k: 'Solution', v: 'many bounded paths', u: DATA.taylor.passive.outside + ' of 2 eigenvalues outside the unit circle', tone: 'hot' }], note: DATA.taylor.passive.plain };
+ var o = three(r, 'On impact, rule ' + s.rule + '.' + (s.rule === '3' ? ' Faint bars: the rule-1.5 run.' : ''));
+ o.rows.push({ part: 'bank', k: 'Solution', v: 'one bounded path', u: s.rule === '1.5' ? DATA.taylor.active.outside + ' of 2 eigenvalues outside the unit circle' : 'more than one for one' });
+ return o;
+ }
+ if (step === 'promise') return three(DATA.promise.today, 'Today, after a promised cut of ' + DATA.promise.cut + ' pp a year in quarter ' + DATA.promise.quarter + ' (the rule on in every quarter).');
+ if (step === 'puzzle') return { rows: [
+ { part: 'infl', k: 'Inflation today', v: '×' + HZ.inflation_ratio[s.q].toFixed(1), u: 'the same cut made today', tone: 'hot' },
+ { part: 'gap', k: 'Output gap today', v: '×' + HZ.output_gap_ratio[s.q].toFixed(1), u: 'the same cut made today', tone: 'cold' }],
+ note: 'Rate held at its steady state until quarter ' + HZ.quarters[s.q] + ', then cut. A limit of this simple model, not a fact about economies.' };
+ return { rows: [], note: '' };
+ },
+ // untouched, the figure shows itself around: live actions, not a timeline (also the film, interactive.film)
+ tour: [
+ [{ step: 'loop' }, 6500], [{ hover: 'infl' }, 2200], [{ hover: 'bank' }, 2200], [{ hover: null }, 600],
+ [{ step: 'spending' }, 7000],
+ [{ knob: ['rule', '1.5'], step: 'cost' }, 6000], [{ knob: ['rule', '3'] }, 4500], [{ hover: 'infl' }, 2400], [{ hover: null }, 400],
+ [{ knob: ['rule', '0.8'] }, 6500], [{ knob: ['rule', '1.5'] }, 4500],
+ [{ step: 'promise' }, 6500],
+ [{ knob: ['q', 0], step: 'puzzle' }, 6000], [{ knob: ['q', 4] }, 2000], [{ knob: ['q', 8] }, 2000], [{ knob: ['q', 12] }, 4000],
+ [{ knob: ['q', 8], step: 'leaves' }, 4000],
+ ],
+ },
+ };
+})();
diff --git a/skills/showtime/templates/diagram/examples/enter.js b/skills/showtime/templates/diagram/examples/enter.js
new file mode 100644
index 0000000..4d1a461
--- /dev/null
+++ b/skills/showtime/templates/diagram/examples/enter.js
@@ -0,0 +1,325 @@
+/* "What happens when you press Enter": a coding agent's loop as a living diagram (illustrative, simplified).
+ Your machine is a long plate on the diagonal (terminal at the front, Claude Code at the back); the cloud floats at
+ the upper right in its own material (glass). It opens close on the terminal: the request is typed, Enter lands,
+ the camera pulls back as the system builds. The harness on your machine
+ builds the request, the model in the cloud answers with tool calls, each call passes a permission gate and runs
+ locally, the result goes back, and the loop repeats until a failing test passes.
+ Beats follow the narration: CUE holds numbers (so `showtime retime` can scale them); when the page loads
+ voice/cues.js (`showtime voice cues voice/timeline.json -o voice/cues.js --offset <voice start>`), each beat
+ lands on its spoken word instead (see words() below). To use it: `showtime new diagram <dir> --example enter`. */
+var CUE = {
+ enter: 0.87,
+ claude: 1.8,
+ message: 2.9,
+ history: 3.81,
+ memory: 4.81,
+ tools: 6.37,
+ model: 7.82,
+ cloud: 8.42,
+ calls: 9.86,
+ gate: 12.51,
+ runs: 13.95,
+ back: 15.83,
+ loops: 17.27,
+ test: 17.95,
+ edit: 18.46,
+ again: 18.9,
+ passes: 20.85,
+ nomore: 21.78,
+ answer: 23.25,
+ duration: 27,
+};
+
+(function () {
+ // the spoken word each beat lands on: [line id, word index] in the narration (VO.words)
+ var words = { enter: ['enter', 2], claude: ['enter', 3], message: ['enter', 7], history: ['enter', 9], memory: ['enter', 12], tools: ['enter', 18], model: ['cloud', 1], cloud: ['cloud', 4], calls: ['cloud', 7], gate: ['gate', 4], runs: ['gate', 7], back: ['loop', 0], loops: ['loop', 4], test: ['loop', 5], edit: ['loop', 6], again: ['loop', 7], passes: ['done', 2], nomore: ['done', 3], answer: ['done', 9] };
+ var T = Object.assign({}, CUE);
+ if (window.VO && VO.words) Object.keys(words).forEach(function (k) { var w = VO.words[words[k][0]]; if (w && w[words[k][1]]) T[k] = w[words[k][1]][1]; });
+
+ var node = function (id, icon, x, y, b, o) { return Object.assign({ id: id, part: 'node', icon: icon, at: [x, y, 0], r: 3.6, build: b }, o || {}); };
+ var link = function (id, a, b, at, o) { return Object.assign({ id: id, kind: 'link', from: a + '.center', to: b + '.center', w: 3, layer: 'floor', build: [at, 0.4] }, o || {}); };
+ // a packet that hops along links in order (a leading '-' runs a link backwards), `hop` seconds a link
+ var hops = function (path, at, hop, off) { return path.map(function (p, i) { var rev = p[0] === '-'; return { at: at + i * hop, dur: hop, along: rev ? p.slice(1) : p, reverse: rev, off: off }; }); };
+ var send = function (id, path, at, tone, hop, o) { return Object.assign({ id: id, tone: tone, r: 1.35, moves: hops(path, at, hop), until: at + path.length * hop + 0.05 }, o || {}); };
+ var pulse = function (target, at, tone, dur) { return { target: target, at: at, tone: tone || 'cold', dur: dur || 0.6, pulse: true }; };
+ var S = 16, O = [1130, 345], C = Math.cos(Math.PI / 6);
+ var scr = function (x, y, z) { return [O[0] + (x - y) * C * S, O[1] + (x + y) * 0.5 * S - (z || 0) * S]; }; // world -> screen at zoom 1
+ var b0 = 1.15; // the rest of the system builds as the camera pulls back from the terminal
+
+ // turn 1: run the tests (allowed), they fail; turn 2: edit the file (the gate asks you); turn 3: run again, they pass
+ var t2 = T.loops - 0.3, t3 = T.passes - 0.87;
+ var toModel = ['harness-dock', 'net'], fromModel = ['-net', '-harness-dock'];
+ var CH = 0.62, dockZ = 0.45; // the request bundle: chip height in the stack, the dock's top
+ // the context chips: each comes from where it lives, lands on the dock beside Claude Code, then the bundle leaves
+ var leave = T.model - 0.25, fly = 1.1;
+ var chip = function (id, i, moves, tone) {
+ return { id: id, shape: 'chip', size: [3, 2.2, 0.48], tone: tone || 'cold',
+ moves: moves.concat([{ at: leave, dur: fly, along: 'net', off: [0, 0, i * CH] }]), until: leave + fly - 0.1 };
+ };
+ var slot = function (i) { return { to: 'dock.top', off: [0, 0, i * CH], hop: 1.6 }; };
+ var at = function (t, o) { return Object.assign({ at: t }, o); };
+
+ // live figure helpers: the call goes on to Bash; your answer at the permission check
+ var toBash = function (fx, at, after) {
+ fx.send('call1', [at, { at: after, dur: 0.5, along: 'gate-bash' }]); fx.hide('t-call1', { delay: after + 0.5 });
+ fx.pulse('bash', 'warm', { delay: after + 0.5 }); fx.say('bash', 'Bash: running the tests', 'warm', { delay: after + 0.5 });
+ };
+ var answer = function (fx, s, yes) {
+ s.answer = yes ? 'yes' : 'no';
+ var at = { at: 0, dur: 0.01, to: 'gate.center' };
+ if (yes) { fx.say('gate', 'you said yes', 'ok'); fx.tone('gate', 'ok'); toBash(fx, at, 0.3); }
+ else { fx.say('gate', 'you said no', 'hot'); fx.tone('gate', 'hot'); fx.send('call1', [at], { stay: 0.6 }); fx.hide('t-call1', { delay: 0.5 }); }
+ };
+
+ window.SCENE = {
+ page: {
+ kicker: 'Claude Code at work', figno: 'One request, three turns',
+ title: 'What happens when you press *Enter*',
+ dek: 'Thinking happens in the cloud. Every action happens on your machine, through a permission check.',
+ footL: 'Illustrative sample · simplified', footR: '', steps: { at: [112, 800], width: 520 },
+ },
+ world: { scale: S, origin: O },
+ leaderCost: 5,
+ items: [
+ { id: 'plate', part: 'plate', at: [0, 0, -2], size: [30, 44, 2], grid: 5, build: b0 - 0.25, lift: 0 },
+ { kind: 'floortext', at: [10, 43.6, 0], text: 'YOUR MACHINE', at0: b0 + 0.6 },
+ // the cloud: a glass platform floating up and to the right
+ { id: 'cloud', part: 'plate', at: [23.5, -13, 2], size: [12, 12, 2], grid: 5, glass: true, build: b0 + 0.35, lift: 3 },
+ { kind: 'floortext', at: [28.6, -1.4, 4], text: 'CLOUD', at0: b0 + 0.9 },
+ node('model', 'core', 30.2, -8.2, b0 + 0.55, { at: [30.2, -8.2, 4], scale: 1.05, r: 4.2, glass: true }),
+
+ node('terminal', 'terminal', 5, 38, -1, { scale: 1.45, r: 4 }),
+ node('harness', 'hub', 13, 9, b0 + 0.15, { scale: 1.45, r: 4.5 }),
+ { id: 'dock', part: 'slab', at: [21, 0.5, 0], size: [5, 5, dockZ], build: b0 + 0.3, ports: { top: { at: [2.5, 2.5, dockZ], face: 'top' } } },
+ node('gate', 'gate', 16, 21, b0 + 0.25, { scale: 1.3, r: 3.6 }),
+ node('edit', 'files', 10.5, 31, b0 + 0.35, { scale: 1.15, r: 3.3 }),
+ node('bash', 'lamp', 23, 31.5, b0 + 0.4, { scale: 1.1, r: 3.3 }),
+ { id: 'pass-ring', layer: 'floor', shapes: [{ kind: 'ring', at: [23, 31.5, 0.03], r: 4.8, from: T.passes - 0.1, dur: 0.6, tone: 'ok' }] },
+
+ link('term-harness', 'terminal', 'harness', b0 + 0.3, { via: [[2.2, 32, 0.6], [2.2, 13, 0.6]] }),
+ link('harness-dock', 'harness', 'dock', b0 + 0.45, { to: 'dock.top' }),
+ { id: 'net', kind: 'link', from: 'dock.top', to: 'model.x-', w: 3.2, dash: '14 9', build: [b0 + 0.7, 0.7] },
+ link('harness-gate', 'harness', 'gate', b0 + 0.4),
+ link('gate-edit', 'gate', 'edit', b0 + 0.5), link('gate-bash', 'gate', 'bash', b0 + 0.55),
+ ],
+ tokens: [
+ // the request: four chips gather on the dock, then travel together to the model
+ chip('c-msg', 0, [at(T.enter + 0.12, { dur: 1.0, along: 'term-harness' }), at(T.message - 0.3, Object.assign({ dur: 0.45 }, slot(0)))]),
+ chip('c-hist', 1, [at(T.history - 0.35, Object.assign({ dur: 0.5, from: 'harness.top' }, slot(1)))]),
+ chip('c-mem', 2, [at(T.memory - 0.55, Object.assign({ dur: 0.85, from: 'edit.top' }, slot(2), { hop: 7 }))]),
+ chip('c-tools', 3, [at(T.tools - 0.6, Object.assign({ dur: 0.85, from: 'bash.top' }, slot(3), { hop: 7 }))]),
+ // the answer streams back: small beads, then the tool call itself, an envelope that waits at the gate
+ send('s1', fromModel, T.calls - 0.45, 'warm', 0.55, { r: 0.8 }), send('s2', fromModel, T.calls - 0.3, 'warm', 0.55, { r: 0.8 }),
+ send('s3', fromModel, T.calls - 0.15, 'warm', 0.55, { r: 0.8 }),
+ { id: 'call1', shape: 'envelope', tone: 'warm', moves: hops(fromModel.concat(['harness-gate']), T.calls, 0.55).concat([at(T.runs - 0.1, { dur: 0.5, along: 'gate-bash' })]), until: T.runs + 0.45 },
+ send('out1', ['-gate-bash', '-harness-gate'].concat(toModel), T.back - 0.25, 'cold', 0.3, { shape: 'chip', size: [2.8, 2, 0.5] }),
+ { id: 'call2', shape: 'envelope', tone: 'warm', moves: hops(fromModel.concat(['harness-gate']), t2, 0.3).concat([at(t2 + 1.95, { dur: 0.35, along: 'gate-edit' })]), until: t2 + 2.3 },
+ send('out2', ['-gate-edit', '-harness-gate'].concat(toModel), t2 + 2.3, 'cold', 0.2, { shape: 'chip', size: [2.8, 2, 0.5] }),
+ { id: 'call3', shape: 'envelope', tone: 'warm', moves: hops(fromModel.concat(['harness-gate', 'gate-bash']), t3, 0.22), until: t3 + 0.9 },
+ send('out3', ['-gate-bash', '-harness-gate'].concat(toModel), T.passes + 0.05, 'cold', 0.22, { shape: 'chip', size: [2.8, 2, 0.5] }),
+ // no more tool calls: the answer comes back as text, to your terminal
+ send('answer', fromModel.concat(['-term-harness']), T.answer - 0.95, 'ok', 0.32, { shape: 'chip', size: [3.4, 2.4, 0.55] }),
+ ],
+ states: [
+ pulse('terminal', T.enter, 'warm', 0.5), pulse('harness', T.claude, 'cold', 0.7),
+ pulse('model', T.cloud, 'cold', 0.9), pulse('model', T.calls - 0.5, 'warm', 0.6),
+ { target: 'gate', at: T.gate - 0.1, tone: 'ok', dur: 0.3 },
+ pulse('bash', T.runs + 0.4, 'warm', 0.6), { target: 'bash', at: T.runs + 0.75, tone: 'hot', dur: 0.3 },
+ { target: 'gate', at: t2 + 0.62, tone: 'warm', dur: 0.2 }, { target: 'gate', at: t2 + 1.9, tone: 'ok', dur: 0.2 },
+ pulse('edit', t2 + 2.25, 'warm', 0.6), pulse('model', t2 + 3.05, 'cold', 0.4), pulse('harness', t2 + 0.3, 'warm', 0.4), pulse('harness', t3 + 0.3, 'warm', 0.4),
+ // the moment: the light goes green and breathes twice
+ { target: 'bash', at: T.passes - 0.15, tone: 'ok', dur: 0.3 }, pulse('bash', T.passes + 0.2, 'ok', 0.7), pulse('bash', T.passes + 1.0, 'ok', 0.7),
+ pulse('model', T.passes + 0.8, 'cold', 0.5), pulse('terminal', T.answer + 0.2, 'ok', 0.8),
+ { target: 'net', at: leave, tone: 'cold', dur: 0.4 },
+ ],
+ // fewer at once: each label leaves when its beat is over and all of them return for the end
+ labels: [
+ { for: 'terminal', at: T.claude + 0.7, until: T.claude + 2.4, back: T.answer + 0.35, title: 'Your terminal', sub: 'you press Enter' },
+ { for: 'harness', at: 3.15, until: T.model, back: T.answer + 0.45, title: 'Claude Code', sub: 'on your machine' },
+ { for: 'model', at: T.cloud - 0.3, until: T.gate - 0.4, back: T.answer + 0.55, title: 'The model', sub: 'in the cloud' },
+ { for: 'gate', anchor: [18.6, 23.6, 0.6], at: T.gate - 0.25, until: T.back + 0.6, back: T.answer + 0.65, title: 'Permission check', sub: 'allow, ask you, or deny' },
+ ],
+ tags: [
+ // the hook: the request is typed at the prompt, then Enter lands
+ { id: 'prompt', for: 'terminal', tone: 'mute', size: 34, type: [0.12, 0.66], typeFrom: 2, caretUntil: T.enter + 0.1, text: '> fix the failing test', at: -1, until: T.claude - 0.2, off: [0, -64] },
+ { id: 'reply', for: 'terminal', tone: 'ok', text: 'fixed: the test passes', at: T.answer + 0.15, off: [-96, 40], align: 'right' },
+ { for: 'terminal', tone: 'mute', size: 30, text: 'Enter', at: 0.56, until: T.enter + 0.6, press: T.enter - 0.06, off: [210, 6] },
+ // the chips name themselves while they gather, then the bundle is one request
+ { id: 't-msg', token: 'c-msg', tone: 'cold', text: 'your message', at: T.message, until: leave - 0.4, off: [58, 181], align: 'left' },
+ { id: 't-hist', token: 'c-hist', tone: 'cold', text: 'the chat so far', at: T.history, until: leave - 0.4, off: [58, 145], align: 'left' },
+ { id: 't-mem', token: 'c-mem', tone: 'cold', text: 'CLAUDE.md', at: T.memory, until: leave - 0.4, off: [58, 109], align: 'left' },
+ { id: 't-tools', token: 'c-tools', tone: 'cold', text: 'its tools', at: T.tools - 0.3, until: leave - 0.22, off: [58, 73], align: 'left' },
+ { id: 't-req', token: 'c-tools', tone: 'cold', text: 'request', at: leave - 0.18, until: leave + fly - 0.1, off: [0, -40] },
+ // each tool call names itself on the way down
+ { id: 't-call1', token: 'call1', tone: 'warm', text: 'run the tests', at: T.calls + 0.75, until: T.runs + 0.3, off: [0, -38] },
+ { id: 't-call2', token: 'call2', tone: 'warm', text: 'edit the file', at: t2 + 0.1, until: t2 + 2.2, off: [0, -38] },
+ { id: 't-out', token: 'out1', tone: 'cold', text: 'test output', at: T.back - 0.2, until: T.back + 0.9, off: [0, -38] },
+ { id: 'bash', for: 'bash', tone: 'mute', keys: [[b0 + 1.0, 'Bash: tests'], [T.runs + 0.8, '1 failing', 'hot'], [T.passes - 0.1, 'Bash: all pass', 'ok']], off: [84, 26], align: 'left', size: 28 },
+ { id: 'edit', for: 'edit', tone: 'mute', text: 'Edit: files', at: b0 + 1.0, off: [10, 70] },
+ { id: 'gate', for: 'gate', tone: 'ok', keys: [[T.gate, 'allowed'], [t2 + 0.62, 'asks you', 'warm'], [t2 + 1.9, 'you said yes'], [t3 + 0.5, 'allowed']], off: [-118, -8], until: T.answer - 0.4 },
+ { id: 'model', for: 'model', tone: 'mute', keys: [[T.calls, 'turn 1'], [t2, 'turn 2'], [t3, 'turn 3'], [T.nomore, 'done']], off: [0, -44] },
+ ],
+ camera: [
+ // the hook: close on the terminal, a slow creep while the request is typed and Enter lands
+ { at: -1, dur: 0.01, zoom: 3.0, focus: 'terminal', to: [960, 400] },
+ { at: 0, dur: 1.15, zoom: 3.15, focus: 'terminal', to: [960, 400] },
+ // pull back as the system builds, to a rest that fills the frame
+ { at: 1.15, dur: 2.0, zoom: 1.08, focus: [1190, 610], to: [1190, 610] },
+ { at: 3.4, dur: T.cloud - 3.2, zoom: 1.11, focus: [1190, 610], to: [1190, 610] },
+ // the answer comes back from the cloud: lean toward it
+ { at: T.cloud + 0.4, dur: T.gate - T.cloud - 1.4, zoom: 1.17, focus: scr(24, 0, 2), to: [scr(24, 0, 2)[0] - 40, scr(24, 0, 2)[1] + 20] },
+ { at: T.gate - 0.9, dur: 3.6, zoom: 1.16, focus: scr(16, 25, 0), to: [scr(16, 25, 0)[0] - 90, scr(16, 25, 0)[1]] },
+ { at: T.back - 0.2, dur: 1.4, zoom: 1.1, focus: [1190, 610], to: [1190, 610] },
+ { at: T.back + 1.3, dur: T.passes - T.back - 2.7, zoom: 1.14, focus: scr(15, 26, 0), to: [scr(15, 26, 0)[0] - 90, scr(15, 26, 0)[1]] },
+ // the moment: a push toward the light as it turns green, held, then back for the whole figure
+ { at: T.passes - 1.3, dur: 0.9, zoom: 1.2, focus: scr(23, 31.5, 3), to: [scr(23, 31.5, 3)[0] - 150, scr(23, 31.5, 3)[1] + 20] },
+ { at: T.passes + 1.15, dur: 1.2, zoom: 1.08, focus: [1190, 610], to: [1190, 610] },
+ { at: T.passes + 2.45, dur: CUE.duration - T.passes - 2.45, zoom: 1.1, focus: [1190, 610], to: [1190, 610] },
+ ],
+ // the payoff, after the answer lands: the film's one idea, as a beat line
+ steps: [{ at: Math.max(T.answer - 0.3, T.passes + 2.45), kicker: 'The loop', text: 'Thinks in the cloud. Acts on your machine, with your permission.' }],
+
+ // the live figure (figure.html, `showtime export html <project> --interactive`): it opens on the built figure
+ // (the film's end) and each step runs one part of the loop on it; the permission check is a knob, and when it
+ // asks you, you answer with A (allow) or D (deny)
+ interactive: {
+ title: 'What happens when you press Enter',
+ sub: 'A coding agent\u2019s loop: it thinks in the cloud and acts on your machine, through a permission check. Pick a step, set the permission, hover a part.',
+ source: 'Illustrative sample, simplified.',
+ start: CUE.duration,
+ camera: [{ at: -1, dur: 0.01, zoom: 1.05, focus: [1190, 610], to: [930, 590] }],
+ crop: { desk: [80, 50, 1840, 1040], phone: [190, 150, 1560, 1010] },
+ parts: [
+ { id: 'terminal', name: 'Your terminal', sub: 'you type a request and press Enter' },
+ { id: 'harness', name: 'Claude Code', sub: 'on your machine: builds the request, runs the tools' },
+ { id: 'model', name: 'The model', sub: 'in the cloud: answers with text or tool calls' },
+ { id: 'gate', name: 'Permission check', sub: 'allowed, asks you, or denied' },
+ { id: 'bash', name: 'Bash', sub: 'runs commands, like the tests' },
+ { id: 'edit', name: 'Files', sub: 'read and edited on your machine' },
+ ],
+ knobs: { permission: { label: 'Permission for "run the tests"', hint: 'your settings decide; risky actions can wait for your yes',
+ options: [['allow', 'allowed'], ['ask', 'asks you'], ['deny', 'denied']], default: 'ask' } },
+ reset: function (fx) {
+ fx.hide('prompt'); fx.hide('reply'); fx.say('bash', 'Bash: tests', 'mute'); fx.say('edit', 'Edit: files', 'mute');
+ fx.hide('gate'); fx.hide('model');
+ // the film ends green: the live figure starts each step from a neutral machine
+ fx.tone('gate', null); fx.tone('bash', null); fx.show('pass-ring', false);
+ ['t-msg', 't-hist', 't-mem', 't-tools', 't-req', 't-call1', 't-call2', 't-out'].forEach(function (t) { fx.hide(t); });
+ ['c-msg', 'c-hist', 'c-mem', 'c-tools', 's1', 's2', 's3', 'call1', 'out1', 'call2', 'out2', 'call3', 'out3', 'answer'].forEach(function (k) { fx.park(k); });
+ },
+ steps: [
+ { id: 'enter', kicker: '1 \u00b7 You press Enter', text: 'Claude Code builds the request on your machine: your message, the chat so far, CLAUDE.md, its tools.',
+ run: function (fx) {
+ var net = function (i) { return { at: 3.2, dur: fly, along: 'net', off: [0, 0, i * CH] }; };
+ fx.say('prompt', '> fix the failing test', 'mute'); fx.hide('prompt', { delay: 1.0 });
+ fx.pulse('terminal', 'warm'); fx.pulse('harness', 'cold', { delay: 0.6 });
+ fx.send('c-msg', [{ at: 0, dur: 1.0, along: 'term-harness' }, { at: 1.05, dur: 0.45, to: 'dock.top', off: [0, 0, 0], hop: 1.6 }, net(0)]);
+ fx.send('c-hist', [{ at: 0.5, dur: 0.5, from: 'harness.top', to: 'dock.top', off: [0, 0, CH], hop: 1.6 }, net(1)]);
+ fx.send('c-mem', [{ at: 1.0, dur: 0.85, from: 'edit.top', to: 'dock.top', off: [0, 0, 2 * CH], hop: 7 }, net(2)]);
+ fx.send('c-tools', [{ at: 1.5, dur: 0.85, from: 'bash.top', to: 'dock.top', off: [0, 0, 3 * CH], hop: 7 }, net(3)]);
+ fx.say('t-msg', 'your message', 'cold', { delay: 1.4 }); fx.say('t-hist', 'the chat so far', 'cold', { delay: 1.0 });
+ fx.say('t-mem', 'CLAUDE.md', 'cold', { delay: 1.8 }); fx.say('t-tools', 'its tools', 'cold', { delay: 2.3 });
+ ['t-msg', 't-hist', 't-mem', 't-tools'].forEach(function (t) { fx.hide(t, { delay: 3.0 }); });
+ fx.say('t-req', 'request', 'cold', { delay: 3.1 }); fx.hide('t-req', { delay: 4.2 });
+ fx.pulse('model', 'cold', { delay: 4.3, dur: 0.9 });
+ } },
+ { id: 'answer', kicker: '2 \u00b7 The model answers', text: 'In the cloud, the model answers with a tool call: run the tests. It does not touch your machine itself.',
+ run: function (fx) {
+ fx.pulse('model', 'warm');
+ ['s1', 's2', 's3'].forEach(function (k, i) { fx.send(k, hops(fromModel, 0.1 + i * 0.15, 0.55)); });
+ fx.send('call1', hops(fromModel.concat(['harness-gate']), 0.6, 0.55), { stay: true });
+ fx.say('t-call1', 'run the tests', 'warm', { delay: 1.2 }); fx.say('model', 'turn 1', 'mute');
+ } },
+ { id: 'gate', kicker: '3 \u00b7 The permission check', knob: 'permission',
+ // the knob is your settings; when they say "ask", A and D are your answer (state.answer)
+ text: function (s) {
+ if (s.permission === 'allow') return 'Your settings allow it: the call goes on to Bash.';
+ if (s.permission === 'deny') return 'Your settings deny it: the call stops here.';
+ if (s.answer === 'yes') return 'It asked you, and you said yes: the call goes on to Bash.';
+ if (s.answer === 'no') return 'It asked you, and you said no: the call stops here.';
+ return 'It asks you first: allow it or deny it.';
+ },
+ run: function (fx, again) {
+ var s = fx.state, at = { at: 0, dur: 0.01, to: 'gate.center' };
+ s.answer = null; // a setting changed: nothing has been answered yet
+ if (!again) fx.say('model', 'turn 1', 'mute');
+ fx.say('bash', 'Bash: tests', 'mute'); fx.tone('bash', null);
+ fx.say('t-call1', 'run the tests', 'warm');
+ if (s.permission === 'allow') {
+ fx.say('gate', 'allowed', 'ok'); fx.tone('gate', 'ok'); fx.pulse('gate', 'ok');
+ toBash(fx, at, 0.5);
+ } else if (s.permission === 'ask') {
+ fx.say('gate', 'asks you', 'warm'); fx.tone('gate', 'warm'); fx.pulse('gate', 'warm');
+ fx.send('call1', [at], { stay: true });
+ } else {
+ fx.say('gate', 'denied', 'hot'); fx.tone('gate', 'hot'); fx.pulse('gate', 'hot');
+ fx.send('call1', [at], { stay: 0.8 }); fx.hide('t-call1', { delay: 0.6 });
+ }
+ } },
+ { id: 'runs', kicker: '4 \u00b7 It runs on your machine', text: 'Bash runs the tests here. The output goes back to the model as part of the chat.',
+ run: function (fx) {
+ fx.say('gate', 'allowed', 'ok'); fx.tone('gate', 'ok'); fx.pulse('bash', 'warm');
+ fx.say('bash', '1 failing', 'hot', { delay: 0.6 }); fx.tone('bash', 'hot', { delay: 0.6 });
+ fx.send('out1', hops(['-gate-bash', '-harness-gate'].concat(toModel), 0.8, 0.3));
+ fx.say('t-out', 'test output', 'cold', { delay: 0.9 }); fx.hide('t-out', { delay: 2.0 });
+ fx.pulse('model', 'cold', { delay: 2.1 });
+ } },
+ { id: 'loop', kicker: '5 \u00b7 The loop', text: 'Turn 2 edits the file; turn 3 runs the tests again. Each turn the model sees what happened.',
+ run: function (fx) {
+ fx.say('model', 'turn 2', 'mute'); fx.say('bash', '1 failing', 'hot'); fx.tone('bash', 'hot'); fx.tone('gate', 'ok');
+ fx.send('call2', hops(fromModel.concat(['harness-gate', 'gate-edit']), 0, 0.3));
+ fx.say('t-call2', 'edit the file', 'warm', { delay: 0.2 }); fx.hide('t-call2', { delay: 1.9 });
+ fx.say('gate', 'allowed', 'ok', { delay: 0.6 }); fx.pulse('edit', 'warm', { delay: 1.5 });
+ fx.send('out2', hops(['-gate-edit', '-harness-gate'].concat(toModel), 2.0, 0.22));
+ fx.say('model', 'turn 3', 'mute', { delay: 3.0 });
+ fx.send('call3', hops(fromModel.concat(['harness-gate', 'gate-bash']), 3.0, 0.22));
+ fx.say('bash', 'Bash: all pass', 'ok', { delay: 4.3 }); fx.tone('bash', 'ok', { delay: 4.2 }); fx.show('pass-ring', true, { delay: 4.2 });
+ fx.pulse('bash', 'ok', { delay: 4.3 }); fx.pulse('bash', 'ok', { delay: 5.1 });
+ fx.send('out3', hops(['-gate-bash', '-harness-gate'].concat(toModel), 4.6, 0.22));
+ } },
+ { id: 'done', kicker: '6 \u00b7 No more tool calls', text: 'The model answers with text: it comes back to your terminal. Thinks in the cloud, acts on your machine, with your permission.',
+ run: function (fx) {
+ fx.say('bash', 'Bash: all pass', 'ok'); fx.tone('bash', 'ok'); fx.tone('gate', 'ok'); fx.show('pass-ring', true); fx.say('model', 'done', 'mute');
+ fx.send('answer', hops(fromModel.concat(['-term-harness']), 0, 0.32));
+ fx.say('reply', 'fixed: the test passes', 'ok', { delay: 1.3 }); fx.pulse('terminal', 'ok', { delay: 1.3 });
+ } },
+ ],
+ // your answer when the check asks: A allows, D denies (only then, and only once)
+ keys: {
+ a: { label: 'Allow', step: 'gate', when: function (s) { return s.permission === 'ask' && !s.answer; }, run: function (fx, s, step) { if (step === 'gate' && s.permission === 'ask' && !s.answer) answer(fx, s, true); } },
+ d: { label: 'Deny', step: 'gate', when: function (s) { return s.permission === 'ask' && !s.answer; }, run: function (fx, s, step) { if (step === 'gate' && s.permission === 'ask' && !s.answer) answer(fx, s, false); } },
+ },
+ // what the board says must match the setting and the answer (the walk in showtime check asks this)
+ agree: function (s, step, shown) {
+ if (step !== 'gate') return [];
+ var on = function (t) { return shown.board.some(function (b) { return b.indexOf(t) >= 0; }); }, out = [];
+ var running = s.permission === 'allow' || s.answer === 'yes';
+ if (on('Bash: running the tests') && !running) out.push('"Bash: running the tests" while the call was not let through');
+ if (on('you said yes') && s.answer !== 'yes') out.push('"you said yes" but nobody answered yes');
+ if (on('you said no') && s.answer !== 'no') out.push('"you said no" but nobody answered no');
+ if (on('asks you') && (s.permission !== 'ask' || s.answer)) out.push('"asks you" when it is not asking');
+ if (on('allowed') && s.permission !== 'allow') out.push('"allowed" when the setting is ' + s.permission);
+ if (on('denied') && s.permission !== 'deny') out.push('"denied" when the setting is ' + s.permission);
+ return out;
+ },
+ readouts: function (s, step) {
+ if (step === 'enter') return { rows: [{ part: 'harness', k: 'The request', v: '4 parts', u: 'message, chat so far, CLAUDE.md, tools' }], note: '' };
+ if (step === 'answer') return { rows: [{ part: 'model', k: 'Turn', v: '1' }, { part: 'model', k: 'The model', v: 'a tool call', u: 'it does not touch your machine itself' }], note: '' };
+ if (step === 'gate') {
+ var v = s.permission === 'ask' ? (s.answer === 'yes' ? 'you said yes' : s.answer === 'no' ? 'you said no' : 'asks you') : s.permission === 'allow' ? 'allowed' : 'denied';
+ return { rows: [{ part: 'gate', k: 'Permission', v: v, tone: { allowed: 'ok', 'you said yes': 'ok', 'asks you': 'warm', 'you said no': 'hot', denied: 'hot' }[v] }], note: 'Hooks can check a call too.' };
+ }
+ if (step === 'runs') return { rows: [{ part: 'bash', k: 'Runs', v: 'on your machine' }, { part: 'bash', k: 'Tests', v: '1 failing', tone: 'hot' }], note: '' };
+ if (step === 'loop') return { rows: [{ part: 'model', k: 'Turns', v: '3' }, { part: 'bash', k: 'Tests', v: 'all pass', tone: 'ok' }], note: 'Illustrative sample: a fix in three turns.' };
+ if (step === 'done') return { rows: [{ part: 'terminal', k: 'Answer', v: 'in your terminal', tone: 'ok' }], note: '' };
+ return { rows: [], note: '' };
+ },
+ tour: [
+ [{ step: 'enter' }, 6000], [{ step: 'answer' }, 4500], [{ knob: ['permission', 'ask'], step: 'gate' }, 3500],
+ [function (fx, s) { answer(fx, s, true); }, 2500],
+ [{ hover: 'gate' }, 2400], [{ hover: null }, 400],
+ [{ step: 'runs' }, 4500], [{ step: 'loop' }, 7000], [{ hover: 'model' }, 2400], [{ hover: null }, 400], [{ step: 'done' }, 6000],
+ ],
+ },
+ };
+})();
diff --git a/skills/showtime/templates/diagram/examples/market.js b/skills/showtime/templates/diagram/examples/market.js
new file mode 100644
index 0000000..1c5667e
--- /dev/null
+++ b/skills/showtime/templates/diagram/examples/market.js
@@ -0,0 +1,104 @@
+/* "How a fair match settles": a matching market as a living diagram (illustrative sample: invented applicants,
+ schools and preferences). Not a machine: nodes, links and tokens in the same grammar.
+ Applicants propose to their first choice; each school holds its favourite so far and turns the rest away;
+ a held offer can still be bumped; the process stops when no one is turned away (deferred acceptance).
+ To use it: `showtime new diagram <dir> --example market` (it becomes scene.js at its own length; it carries its own
+ title block in `page`), then `showtime check`. */
+var CUE = {
+ build: 0.3,
+ r1: 1.9,
+ hold1: 4.8,
+ r2: 8.3,
+ hold2: 9.8,
+ r3: 12.1,
+ hold3: 13.4,
+ stable: 14.6,
+ duration: 20.7,
+};
+
+(function () {
+ var T = CUE, go = 1.0, back = 1.5; // an application crosses in 1 s; a turned-away one walks home slower, so its badge reads
+ var person = function (id, x, b) { return { id: id, part: 'node', icon: 'person', at: [x, 40, 0], r: 4.6, scale: 1.45, build: T.build + b }; };
+ var school = function (id, x, b) { return { id: id, part: 'node', icon: 'school', at: [x, 6, 0], r: 5.4, scale: 1.45, seats: 1, seatSide: 'x+', seatSize: 3.6, build: T.build + b }; };
+ var link = function (id, from, to, at) { return { id: id, kind: 'link', from: from + '.y-', to: to + '.y+', w: 3, build: [at, 0.45] }; };
+ var ring = function (id, at, r, from) { return { id: id, layer: 'floor', shapes: [{ kind: 'ring', at: at, r: r, from: from, tone: 'warm' }] }; };
+ // an application: crosses its link, then is held (hops into the seat, warm) or turned away (grey, back home)
+ // held: when the school takes it into its seat; away: when it is turned away (from the seat if it was held)
+ var apply = function (id, ln, at, school, held, away) {
+ var mv = [{ at: at, dur: go, along: ln }], tones = [];
+ if (held) { mv.push({ at: held, dur: 0.5, to: school + '.seat1', hop: 2.2 }); tones.push({ at: held, tone: 'warm' }); }
+ if (away) {
+ if (held) mv.push({ at: away, dur: 0.5, to: school + '.y+', hop: 2.2 });
+ mv.push({ at: away + (held ? 0.5 : 0), dur: back, along: ln, reverse: true });
+ tones.push({ at: away, tone: 'mute' });
+ }
+ return { id: id, tone: 'cold', shape: 'envelope', size: [3.4, 2.4, 0.5], moves: mv, tones: tones, until: away ? away + (held ? 0.5 : 0) + back : undefined };
+ };
+
+ window.SCENE = {
+ page: {
+ kicker: 'Fig. 2 · Matching market', figno: 'Three applicants, three schools',
+ title: 'How a fair match *settles*', dek: 'Deferred acceptance, round by round.',
+ footL: 'Illustrative sample · invented preferences', footR: '3 rounds · 3 matched · stable',
+ },
+ world: { scale: 11, origin: [1090, 350] },
+ items: [
+ { id: 'plate', part: 'plate', at: [-3, -3, -2], size: [66, 52, 2], grid: 6 },
+ person('ana', 8, 0.1), person('ben', 28, 0.2), person('cy', 48, 0.3),
+ school('north', 8, 0.35), school('south', 28, 0.45), school('east', 48, 0.55),
+ link('ana-north', 'ana', 'north', T.r1), link('ben-north', 'ben', 'north', T.r1 + 0.08), link('cy-south', 'cy', 'south', T.r1 + 0.16),
+ link('ben-south', 'ben', 'south', T.r2), link('cy-east', 'cy', 'east', T.r3),
+ ring('ring-north', [8, 6, 0.02], 7.4, T.stable), ring('ring-south', [28, 6, 0.02], 7.4, T.stable + 0.12), ring('ring-east', [48, 6, 0.02], 7.4, T.stable + 0.24),
+ ring('ring-ana', [8, 40, 0.02], 6.4, T.stable), ring('ring-ben', [28, 40, 0.02], 6.4, T.stable + 0.12), ring('ring-cy', [48, 40, 0.02], 6.4, T.stable + 0.24),
+ ],
+ tokens: [
+ apply('a1', 'ana-north', T.r1 + 0.45, 'north', T.hold1, null),
+ apply('b1', 'ben-north', T.r1 + 0.55, 'north', null, T.hold1),
+ apply('c1', 'cy-south', T.r1 + 0.65, 'south', T.hold1 + 0.12, T.hold2),
+ apply('b2', 'ben-south', T.r2 + 0.45, 'south', T.hold2, null),
+ apply('c2', 'cy-east', T.r3 + 0.45, 'east', T.hold3, null),
+ ],
+ // each envelope wears its fate: held while it sits in a seat, turned away on the way home
+ tags: [
+ { for: 'ana', tone: 'mute', text: 'Ana', at: T.build + 0.7, off: [0, -40] },
+ { for: 'ben', tone: 'mute', text: 'Ben', at: T.build + 0.8, off: [0, -40] },
+ { for: 'cy', tone: 'mute', text: 'Cy', at: T.build + 0.9, off: [0, -40] },
+ { for: 'north', tone: 'mute', text: 'North', at: T.build + 1.0, off: [0, -40] },
+ { for: 'south', tone: 'mute', text: 'South', at: T.build + 1.1, off: [0, -40] },
+ { for: 'east', tone: 'mute', text: 'East', at: T.build + 1.2, off: [0, -40] },
+ { token: 'a1', tone: 'warm', text: 'held', at: T.hold1 + 0.4, off: [0, -34] },
+ { token: 'b1', tone: 'mute', text: 'turned away', at: T.hold1 + 0.05, off: [0, -34] },
+ { token: 'c1', tone: 'warm', keys: [[T.hold1 + 0.5, 'held'], [T.hold2 + 0.05, 'bumped', 'mute']], off: [0, -34] },
+ { token: 'b2', tone: 'warm', text: 'held', at: T.hold2 + 0.4, off: [0, -34] },
+ { token: 'c2', tone: 'warm', text: 'held', at: T.hold3 + 0.4, off: [0, -34] },
+ ],
+ // a link turns grey when its offer is turned away, warm when it becomes the match
+ states: [
+ // a school lights up as an application reaches it
+ { target: 'north', at: T.r1 + 1.45, tone: 'cold', pulse: true }, { target: 'south', at: T.r1 + 1.65, tone: 'cold', pulse: true },
+ { target: 'south', at: T.r2 + 1.45, tone: 'cold', pulse: true }, { target: 'east', at: T.r3 + 1.45, tone: 'cold', pulse: true },
+ { target: 'ben-north', at: T.hold1, tone: 'mute' }, { target: 'cy-south', at: T.hold2, tone: 'mute' },
+ { target: 'ana-north', at: T.stable, tone: 'warm' }, { target: 'ben-south', at: T.stable + 0.12, tone: 'warm' },
+ { target: 'cy-east', at: T.stable + 0.24, tone: 'warm' },
+ ],
+ steps: [
+ { at: T.r1, kicker: 'Round 1', text: 'Everyone applies to their first choice.' },
+ { at: T.hold1, kicker: 'Round 1', text: 'North holds Ana and turns Ben away.' },
+ { at: T.r2, kicker: 'Round 2', text: 'Ben tries South, which prefers him: Cy is bumped.' },
+ { at: T.r3, kicker: 'Round 3', text: 'Cy tries his next choice, East.' },
+ { at: T.stable, kicker: 'Stable', text: 'No one is turned away, so the holds become the match.' },
+ ],
+ // a slow push into each round, easing back as it settles
+ // a push into each round's action; the whole market, held, for the end
+ camera: [
+ { at: 0, dur: T.r1, zoom: 1.04, focus: [1200, 600], to: [1200, 600] },
+ { at: T.r1 + 0.2, dur: T.hold1 - T.r1 + 0.6, zoom: 1.18, focus: [1080, 600], to: [1120, 600] },
+ { at: T.hold1 + 0.85, dur: T.r2 - T.hold1 - 1.1, zoom: 1.08, focus: [1150, 620], to: [1150, 620] },
+ { at: T.r2 - 0.2, dur: T.hold2 - T.r2 + 0.8, zoom: 1.2, focus: [1190, 640], to: [1200, 620] },
+ { at: T.r3 - 0.2, dur: T.hold3 - T.r3 + 0.8, zoom: 1.2, focus: [1270, 700], to: [1250, 660] },
+ { at: T.stable - 0.3, dur: 1.6, zoom: 1.04, focus: [1200, 600], to: [1200, 600] },
+ { at: T.stable + 1.5, dur: CUE.duration - T.stable - 1.5, zoom: 1.08, focus: [1200, 600], to: [1200, 600] },
+ ],
+ reveal: [{ sel: '.ld-foot.r', at: T.stable + 0.4 }],
+ };
+})();
diff --git a/skills/showtime/templates/diagram/figure.html b/skills/showtime/templates/diagram/figure.html
new file mode 100644
index 0000000..da0162d
--- /dev/null
+++ b/skills/showtime/templates/diagram/figure.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en" data-theme="white" data-st-live>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Living diagram</title>
+<!-- the live figure of the same scene: `showtime export html <project> --interactive` packs this page into one
+ offline file. The board is live from the first frame: hover a part, pick a step, turn a knob. -->
+<link rel="stylesheet" href="/_st/themes/fonts/inter.css">
+<link rel="stylesheet" href="/_st/themes/fonts/jetbrains-mono.css">
+<link rel="stylesheet" href="/_st/diagram.css">
+<link rel="stylesheet" href="/_st/figure.css">
+<script src="/_st/diagram.js"></script>
+<script src="/_st/figure-film.js"></script>
+<script src="/_st/figure.js"></script>
+</head>
+<body>
+<div id="figure"></div>
+<script src="scene.js"></script>
+<script>Figure.mount(SCENE);</script>
+</body>
+</html>
diff --git a/skills/showtime/templates/diagram/index.html b/skills/showtime/templates/diagram/index.html
new file mode 100644
index 0000000..22cbae3
--- /dev/null
+++ b/skills/showtime/templates/diagram/index.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="en" data-theme="light">
+<head>
+<meta charset="utf-8">
+<title>Living diagram</title>
+<script src="/_st/stage.js"></script>
+<!-- fonts: light = Geist, Geist Mono, Instrument Serif; dark = IBM Plex Sans, IBM Plex Mono, Space Grotesk; white = Inter, JetBrains Mono -->
+<link rel="stylesheet" href="/_st/themes/fonts/geist.css">
+<link rel="stylesheet" href="/_st/themes/fonts/geist-mono.css">
+<link rel="stylesheet" href="/_st/themes/fonts/instrument-serif.css">
+<link rel="stylesheet" href="/_st/themes/fonts/ibm-plex-sans.css">
+<link rel="stylesheet" href="/_st/themes/fonts/ibm-plex-mono.css">
+<link rel="stylesheet" href="/_st/themes/fonts/space-grotesk.css">
+<link rel="stylesheet" href="/_st/themes/fonts/inter.css">
+<link rel="stylesheet" href="/_st/themes/fonts/jetbrains-mono.css">
+<link rel="stylesheet" href="/_st/diagram.css">
+<script src="/_st/diagram.js"></script>
+<script src="/_st/figure-film.js"></script>
+</head>
+<body>
+<div class="ld-stage">
+ <div id="ld"></div>
+ <div class="ld-frame"></div><i class="ld-tick a"></i><i class="ld-tick b"></i><i class="ld-tick c"></i><i class="ld-tick d"></i>
+ <div class="ld-meta ld-kicker"><b>Fig. 1</b> &nbsp;·&nbsp; Vapour-compression cycle</div>
+ <div class="ld-meta ld-figno">Heat pump, air to air</div>
+ <h1 class="ld-title">How a heat pump <em>moves</em> heat</h1>
+ <div class="ld-dek">It doesn't make heat. It carries it in from the cold air outside.</div>
+ <div class="ld-steps"></div>
+ <div class="ld-meta ld-foot l">Illustrative sample · typical values</div>
+ <div class="ld-meta ld-foot r"><span class="k">1 kWh in ·</span> about 3 kWh of heat out</div>
+</div>
+<script src="scene.js"></script>
+<!-- a live-first scene (SCENE.interactive.film = 'tour') films its tour; the live page is figure.html -->
+<script>(SCENE.interactive && SCENE.interactive.film === 'tour' ? Figure.film : Diagram.mount)(SCENE);</script>
+</body>
+</html>
diff --git a/skills/showtime/templates/diagram/scene.js b/skills/showtime/templates/diagram/scene.js
new file mode 100644
index 0000000..b027dd3
--- /dev/null
+++ b/skills/showtime/templates/diagram/scene.js
@@ -0,0 +1,84 @@
+/* "How a heat pump moves heat": the starting scene of the diagram template (illustrative sample values).
+ Beat times live in CUE (one per line, seconds), so `showtime new diagram --duration` and `showtime retime`
+ move the whole timeline together. Keep only times in CUE: every number in it is scaled.
+ World units are isometric: x to the lower right, y to the lower left, z up. The reference for every key
+ is references/workflows/diagram.md. */
+var CUE = {
+ build: 0.3,
+ pipes: 1.7,
+ flow: 2.8,
+ outdoor: 3.5,
+ cold: 4.7,
+ compressor: 7.2,
+ hot: 8.7,
+ indoor: 11.8,
+ valve: 13.6,
+ ratio: 16.0,
+ duration: 20,
+};
+
+window.SCENE = {
+ world: { scale: 8.2, origin: [1000, 268] },
+ bands: [300, 170],
+ items: [
+ { id: 'plate', part: 'plate', at: [-2, -2, -2.4], size: [100, 64, 2.4], grid: 6 },
+ { id: 'floor-in', part: 'floor', at: [69, -2, 0], size: [29, 64, 0.35], build: CUE.build * 0.5, lift: 0,
+ shapes: [{ kind: 'bloom', at: [84, 14, 0.36], r: 15, from: CUE.indoor, dur: 1.8 }] },
+ { kind: 'floortext', at: [13, 59.4, 0], text: 'OUTSIDE 2°C', at0: CUE.build + 0.5 },
+ { kind: 'floortext', at: [95.6, 61, 0.35], dir: 'y', text: 'INSIDE 21°C', at0: CUE.build + 0.7 },
+
+ { id: 'outdoor', part: 'unit', at: [10, 34, 0], size: [24, 18, 24], build: CUE.build + 0.1,
+ spin: { at: CUE.flow - 1.2, rate: 5.5 } },
+ { id: 'compressor', part: 'compressor', at: [50, 26, 0], build: CUE.build + 0.35 },
+ { id: 'wall', part: 'wall', at: [66, 0, 0], size: [3, 34, 26], build: CUE.build + 0.55, lift: 5,
+ ports: { in: { at: [0, 26, 22], face: 'x-' }, out: { at: [3, 26, 21.5], face: 'x+' } } },
+ { id: 'wall-ghost', shapes: [{ kind: 'ghost', at: [66, 34, 0], size: [3, 28, 26] }], layer: 'floor', build: CUE.build + 0.7, lift: 0 },
+ { id: 'indoor', part: 'cassette', at: [69, 4, 16.5], size: [4.4, 18, 7], build: CUE.build + 0.75, lift: 4,
+ ports: { in: { at: [2.2, 18, 5], face: 'y+' }, out: { at: [2.2, 15, 0], face: 'bottom' } } },
+ { id: 'valve', part: 'valve', at: [55, 46.3, 2.4], build: CUE.build + 0.9 },
+
+ { id: 'suction', kind: 'pipe', tone: 'cold', from: 'outdoor.out', to: 'compressor.in', route: 'xy', build: [CUE.pipes, 0.42] },
+ { id: 'discharge', kind: 'pipe', tone: 'hot', from: 'compressor.out', to: 'wall.in', route: 'zx', build: [CUE.pipes + 0.18, 0.36] },
+ { id: 'discharge-in', kind: 'pipe', tone: 'hot', from: 'wall.out', to: 'indoor.in', route: 'xy', bend: 1.6, build: [CUE.pipes + 0.5, 0.2] },
+ { id: 'liquid', kind: 'pipe', tone: 'warm', from: 'indoor.out', to: 'valve.x+', route: 'zyx', bend: 2.2, build: [CUE.pipes + 0.34, 0.38] },
+ { id: 'return', kind: 'pipe', tone: 'cold', from: 'valve.x-', to: 'outdoor.in', route: 'x', build: [CUE.pipes + 0.66, 0.36] },
+
+ { id: 'air-out', kind: 'air', tone: 'cold', at: CUE.flow + 0.1, speed: 64, dash: '54 20', waves: 1.0, amp: 0.45, wob: [1, 0],
+ lines: [[[16, 15], [57.5, 68], [9.5, 8]], [[22, 22], [57.5, 69], [13, 12.5]], [[28, 29], [57.5, 68], [16.5, 17]]] },
+ { id: 'air-in', kind: 'air', tone: 'hot', at: CUE.indoor, speed: 56, dash: '54 20', waves: 1.0, amp: 0.7, wob: [0, 1],
+ lines: [[[75, 87], [7, 7], [16, 7]], [[75, 89], [12.5, 12.5], [16, 7.5]], [[75, 87], [18, 18], [16, 7]]] },
+ ],
+ // the refrigerant loop in order: pipes and the bodies between them (gap = hidden length in screen px)
+ flows: [{ id: 'refrigerant', at: CUE.flow, speed: 150, spacing: 34, dash: 14, path: [
+ { pipe: 'suction' }, { gap: 70 }, { pipe: 'discharge' }, { gap: 26 }, { pipe: 'discharge-in' }, { gap: 120 },
+ { pipe: 'liquid' }, { gap: 24 }, { pipe: 'return' }, { gap: 160 }] }],
+ labels: [
+ { for: 'outdoor', at: CUE.outdoor, title: 'Outdoor unit', sub: 'soaks up heat, even from 2 °C air' },
+ { for: 'compressor', at: CUE.compressor + 0.3, title: 'Compressor', sub: 'squeezes the vapour: 4 to 15 bar' },
+ { for: 'indoor', at: CUE.indoor + 0.4, title: 'Indoor coil', sub: 'warms the room' },
+ { for: 'valve', at: CUE.valve, title: 'Expansion valve', sub: 'pressure drops, the fluid chills' },
+ ],
+ tags: [
+ { pipe: 'suction', f: 0.42, tone: 'cold', text: '−5 °C', at: CUE.cold },
+ { pipe: 'discharge', f: 0.8, tone: 'hot', text: '70 °C', at: CUE.hot },
+ ],
+ focus: [{ part: 'compressor', with: ['suction', 'discharge'], at: CUE.compressor, until: CUE.indoor - 0.5 }],
+ // camera keys run in order, each from where the last one left it; focus is a part, a world point or a screen point
+ camera: [
+ { at: CUE.outdoor - 0.3, dur: 3.6, zoom: 1.07, focus: [880, 560] },
+ { at: CUE.compressor, dur: 1.45, zoom: 1.5, focus: 'compressor', to: [960, 600] },
+ { at: CUE.compressor + 1.5, dur: 2.6, zoom: 1.57, focus: 'compressor', to: [960, 600] },
+ { at: CUE.indoor - 0.5, dur: 1.6, zoom: 1.1, focus: [1250, 620], to: [1250, 620] },
+ { at: CUE.indoor + 1.2, dur: 3.2, zoom: 1.15, focus: [1250, 620], to: [1250, 620] },
+ { at: CUE.ratio - 0.4, dur: 1.6, zoom: 1, focus: [960, 540] },
+ { at: CUE.ratio + 1.3, dur: 2.7, zoom: 1.025, focus: [960, 540] },
+ ],
+ reveal: [{ sel: '.ld-foot.r', at: CUE.ratio }],
+ // the live figure of the same scene (figure.html, `showtime export html <project> --interactive`): it starts with
+ // everything built and the refrigerant flowing; the viewer hovers the parts (references/workflows/diagram.md)
+ interactive: {
+ title: 'How a heat pump moves heat',
+ sub: 'It carries heat in from the cold air outside. Hover a part to see what it does and the pipes it joins.',
+ start: CUE.duration,
+ },
+};
diff --git a/skills/showtime/templates/diagram/showtime.json b/skills/showtime/templates/diagram/showtime.json
new file mode 100644
index 0000000..008eda2
--- /dev/null
+++ b/skills/showtime/templates/diagram/showtime.json
@@ -0,0 +1,14 @@
+{
+ "title": "Living Diagram",
+ "width": 1920,
+ "height": 1080,
+ "fps": 30,
+ "duration": 20,
+ "background": "#F4F3EF",
+ "theme": "light",
+ "poster": 17.25,
+ "render": {
+ "poster_bake": "off"
+ },
+ "audio": "audio/mix.json"
+}
diff --git a/skills/showtime/tests/fixtures/diagram/film-frames.json b/skills/showtime/tests/fixtures/diagram/film-frames.json
new file mode 100644
index 0000000..e8800e0
--- /dev/null
+++ b/skills/showtime/tests/fixtures/diagram/film-frames.json
@@ -0,0 +1,130 @@
+{
+ "film-dark": {
+ "0.300": "2cc7c992:14017",
+ "0.969": "23b95018:34892",
+ "1.638": "aadebf7b:37918",
+ "10.334": "58786fc9:57950",
+ "11.003": "c0a67001:57823",
+ "11.672": "4e0cc66b:57685",
+ "12.341": "4fdd8de1:53444",
+ "13.010": "21101d51:53496",
+ "13.679": "40d9815b:53490",
+ "14.348": "238a7c00:53642",
+ "15.017": "d68433e9:53602",
+ "15.686": "bc448adf:53790",
+ "16.355": "4ea6d779:53665",
+ "17.024": "bc6b4318:53920",
+ "17.693": "bfd32f06:53576",
+ "18.362": "d6183faa:53913",
+ "19.031": "619e24b3:53920",
+ "19.700": "6e0451c7:53782",
+ "2.307": "1a2c29a0:42709",
+ "2.976": "faa75262:51151",
+ "3.645": "19305d2a:51291",
+ "4.314": "ec21131a:51286",
+ "4.983": "3506f4a1:51419",
+ "5.652": "4a02913d:51682",
+ "6.321": "2dd3776b:51563",
+ "6.990": "8909078d:51677",
+ "7.659": "be3e18f1:58236",
+ "8.328": "597004b4:58203",
+ "8.997": "3477c975:57409",
+ "9.666": "f48865c3:57663"
+ },
+ "film-enter": {
+ "0.300": "972839ae:2039",
+ "0.969": "c506e295:6202",
+ "1.638": "45362b75:16895",
+ "10.334": "61f96514:21103",
+ "11.003": "74fdca6a:20849",
+ "11.672": "e537039f:20289",
+ "12.341": "f702d5c6:20291",
+ "13.010": "5fe4ac9:20219",
+ "13.679": "6e8ddaa2:20266",
+ "14.348": "9d48a3f8:20268",
+ "15.017": "3b97579f:19646",
+ "15.686": "6bf32cbd:20278",
+ "16.355": "b00f3c2:20272",
+ "17.024": "fe115001:20900",
+ "17.693": "8d8af83f:20291",
+ "18.362": "418bfac2:20261",
+ "19.031": "27493259:20283",
+ "19.700": "782b4479:20274",
+ "2.307": "e09cf5a2:20257",
+ "2.976": "b1a9fe46:20289",
+ "3.645": "9f74611c:20909",
+ "4.314": "511ad13c:21510",
+ "4.983": "169e229d:21523",
+ "5.652": "dfc7a9d5:21522",
+ "6.321": "b98f460:22153",
+ "6.990": "eaaed899:22147",
+ "7.659": "a0298b53:22156",
+ "8.328": "d8ed14aa:22123",
+ "8.997": "31b3baa3:19655",
+ "9.666": "86a86e38:20199"
+ },
+ "film-light": {
+ "0.300": "87c7b031:14013",
+ "0.969": "fc83ed85:34830",
+ "1.638": "17822f9d:37863",
+ "10.334": "6bfd1c29:61767",
+ "11.003": "bcfbd614:61759",
+ "11.672": "dc2a94f5:61514",
+ "12.341": "43423b5f:56226",
+ "13.010": "aace458b:56210",
+ "13.679": "82b0c6d5:56206",
+ "14.348": "7a92e5fa:56358",
+ "15.017": "6d949e96:56343",
+ "15.686": "1ce79d1a:56506",
+ "16.355": "9c145640:56381",
+ "17.024": "1be76e22:56636",
+ "17.693": "3f44d77e:56207",
+ "18.362": "fbb5c776:56635",
+ "19.031": "3e7fc824:56642",
+ "19.700": "c9bf9ad4:56504",
+ "2.307": "cc40fce0:44716",
+ "2.976": "52388fef:53820",
+ "3.645": "17205014:53944",
+ "4.314": "4bce904a:54122",
+ "4.983": "eabf956:54036",
+ "5.652": "a72c2d8c:54417",
+ "6.321": "e5745a87:54277",
+ "6.990": "21a33ddd:54391",
+ "7.659": "23b6df26:62056",
+ "8.328": "16745749:62035",
+ "8.997": "84318016:61620",
+ "9.666": "2ca3f241:61483"
+ },
+ "film-market": {
+ "0.300": "bc187d84:7631",
+ "0.969": "a2fec953:17789",
+ "1.638": "b408cef7:17747",
+ "10.334": "df401e7e:20151",
+ "11.003": "769c417:20135",
+ "11.672": "d3578eae:20145",
+ "12.341": "6b134929:19642",
+ "13.010": "dd3c0833:20282",
+ "13.679": "9e70fcac:20284",
+ "14.348": "b3907306:20282",
+ "15.017": "e782c559:21303",
+ "15.686": "c539ffed:21285",
+ "16.355": "290c5c86:21279",
+ "17.024": "40cd34fd:21285",
+ "17.693": "65f42e1e:21285",
+ "18.362": "160b6367:21250",
+ "19.031": "20431ea1:21285",
+ "19.700": "c5cdfb21:21281",
+ "2.307": "46210911:18153",
+ "2.976": "8fed3708:20070",
+ "3.645": "ff6a9675:20048",
+ "4.314": "43cc71cf:20070",
+ "4.983": "1de82184:20006",
+ "5.652": "5c8a7e0f:20046",
+ "6.321": "9c4a919a:20083",
+ "6.990": "51778dea:19442",
+ "7.659": "830c9533:19440",
+ "8.328": "f528bff:19441",
+ "8.997": "fd1b982f:20217",
+ "9.666": "6e53f740:20224"
+ }
+}
diff --git a/skills/showtime/tests/fixtures/diagram/film-frames.sh b/skills/showtime/tests/fixtures/diagram/film-frames.sh
new file mode 100644
index 0000000..f729ebb
--- /dev/null
+++ b/skills/showtime/tests/fixtures/diagram/film-frames.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Rebuild film-frames.json (the film-parity baseline of tests/test_interactive.py) from the diagram engine of an
+# older revision: today's template and examples, drawn by that revision's runtime/diagram.js.
+# sh tests/fixtures/diagram/film-frames.sh <rev> # <rev>: the commit before live mode
+# The test then checks that today's engine draws every film frame of the baseline identically.
+set -eu
+[ $# -eq 1 ] || { echo "usage: sh film-frames.sh <git revision>" >&2; exit 2; }
+here=$(cd "$(dirname "$0")" && pwd)
+repo=$(git -C "$here" rev-parse --show-toplevel)
+tmp=$(mktemp -d)
+cleanup() { git -C "$repo" worktree remove --force "$tmp/old" >/dev/null 2>&1 || true; rm -rf "$tmp"; }
+trap cleanup EXIT
+git -C "$repo" worktree add --detach "$tmp/old" "$1" >/dev/null 2>&1
+python3 "$repo/skills/showtime/tests/test_interactive.py" TestFilmUntouched --write-golden --engine-from "$tmp/old/skills/showtime"
+echo "film-frames.json rebuilt from $(git -C "$repo" rev-parse --short "$1")"
diff --git a/skills/showtime/tests/fixtures/recap/session.jsonl b/skills/showtime/tests/fixtures/recap/session.jsonl
new file mode 100644
index 0000000..81764f8
--- /dev/null
+++ b/skills/showtime/tests/fixtures/recap/session.jsonl
@@ -0,0 +1,31 @@
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"type": "text", "text": "<system-reminder>\nMEMORY: the client is Zorblax Industries; the build machine is ci-runner-07.\n</system-reminder>"}, {"type": "text", "text": "Fix the flaky parser test in acme (it lives in /Users/me/code/acme/src/parser.py). Keep the change small.\nUse the staging key sk-test-notarealkey0000000000 if you need it.\n\nMore context: https://intranet.example.com/wiki/acme"}]}, "timestamp": "2026-10-01T09:00:37.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "attachment", "attachment": {"type": "memory", "content": "PRIVATE-MEMORY-NOTE about Zorblax"}, "timestamp": "2026-10-01T09:01:14.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_00", "role": "assistant", "content": [{"type": "thinking", "thinking": "THINKING-SECRET the key is AKIAIOSFODNN7EXAMPLE", "signature": "x"}]}, "timestamp": "2026-10-01T09:01:51.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_00", "role": "assistant", "content": [{"type": "text", "text": "ASSISTANT-PROSE-SECRET: I will read /Users/me/code/acme/src/parser.py first."}]}, "timestamp": "2026-10-01T09:02:28.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_01", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01", "name": "Read", "input": {"file_path": "/Users/me/code/acme/src/parser.py"}}]}, "timestamp": "2026-10-01T09:03:05.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01", "type": "tool_result", "content": "def parse(s):\n AWS = 'AKIAIOSFODNN7EXAMPLE'\n", "is_error": false}]}, "timestamp": "2026-10-01T09:03:42.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_02", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_02", "name": "Read", "input": {"file_path": "/Users/me/.claude/projects/acme/memory/MEMORY.md"}}]}, "timestamp": "2026-10-01T09:04:19.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_02", "type": "tool_result", "content": "Zorblax Industries is the client", "is_error": false}]}, "timestamp": "2026-10-01T09:04:56.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_03", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_03", "name": "Grep", "input": {"pattern": "parse", "path": "/Users/me/code/acme"}}]}, "timestamp": "2026-10-01T09:05:33.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_03", "type": "tool_result", "content": "src/parser.py:1", "is_error": false}]}, "timestamp": "2026-10-01T09:06:10.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_04", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_04", "name": "Bash", "input": {"command": "cd /Users/me/code/acme && python -m pytest tests/test_parser.py -q 2>&1 | tail -3"}}]}, "timestamp": "2026-10-01T09:06:47.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_04", "type": "tool_result", "content": "F..........\nFAILED tests/test_parser.py::test_empty - IndexError\n========== 1 failed, 11 passed in 0.52s ==========", "is_error": false}]}, "timestamp": "2026-10-01T09:07:24.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_05", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_05", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/src/parser.py", "old_string": "a", "new_string": "b"}}]}, "timestamp": "2026-10-01T09:08:01.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_05", "type": "tool_result", "content": "The file has been updated.", "is_error": false}]}, "timestamp": "2026-10-01T09:08:38.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_06", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_06", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/.env", "old_string": "A=1", "new_string": "A=2"}}]}, "timestamp": "2026-10-01T09:09:15.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_06", "type": "tool_result", "content": "The file has been updated.", "is_error": false}]}, "timestamp": "2026-10-01T09:09:52.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_07", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_07", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/src/missing.py", "old_string": "x", "new_string": "y"}}]}, "timestamp": "2026-10-01T09:10:29.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_07", "type": "tool_result", "content": "String not found", "is_error": true}]}, "timestamp": "2026-10-01T09:11:06.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_08", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_08", "name": "Bash", "input": {"command": "export TOKEN=@@GITHUB_TOKEN@@ && curl -s https://internal.example.com/api | jq ."}}]}, "timestamp": "2026-10-01T09:11:43.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_08", "type": "tool_result", "content": "{\"secret\": \"value\"}", "is_error": false}]}, "timestamp": "2026-10-01T09:12:20.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_09", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_09", "name": "Bash", "input": {"command": "ssh ci-runner-07 'cd ~/acme && pytest -q'"}}]}, "timestamp": "2026-10-01T09:12:57.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_09", "type": "tool_result", "content": "============ 12 passed in 0.40s ============", "is_error": false}]}, "timestamp": "2026-10-01T09:13:34.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_10", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_10", "name": "Bash", "input": {"command": "python3 tests/run_all.py -k parser"}}]}, "timestamp": "2026-10-01T09:14:11.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_10", "type": "tool_result", "content": "12/12 test files passed in 3.1s wall", "is_error": false}]}, "timestamp": "2026-10-01T09:14:48.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_11", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_11", "name": "Bash", "input": {"command": "git add -A && git commit -q -m 'Fix the parser on empty input'"}}]}, "timestamp": "2026-10-01T09:15:25.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_11", "type": "tool_result", "content": "[main abc1234] Fix the parser on empty input\n 1 file changed, 3 insertions(+), 1 deletion(-)", "is_error": false}]}, "timestamp": "2026-10-01T09:16:02.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_12", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_12", "name": "mcp__1a59c906-04da-521d-bda7-7f71b9f9e01c__fetch", "input": {"url": "https://example.com"}}]}, "timestamp": "2026-10-01T09:16:39.000Z"}
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_12", "type": "tool_result", "content": "page", "is_error": false}]}, "timestamp": "2026-10-01T09:17:16.000Z"}
+{"type": "future_event_kind", "timestamp": "2026-10-01T09:30:00.000Z", "payload": {"x": 1}}
+{not json at all
+{"isSidechain": false, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_99", "role": "assistant", "content": [{"type": "text", "text": "Done. ASSISTANT-PROSE-SECRET summary."}]}, "timestamp": "2026-10-01T09:17:53.000Z"}
diff --git a/skills/showtime/tests/fixtures/recap/subagents/agent-a1.jsonl b/skills/showtime/tests/fixtures/recap/subagents/agent-a1.jsonl
new file mode 100644
index 0000000..e377a61
--- /dev/null
+++ b/skills/showtime/tests/fixtures/recap/subagents/agent-a1.jsonl
@@ -0,0 +1,31 @@
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"type": "text", "text": "<system-reminder>\nMEMORY: the client is Zorblax Industries; the build machine is ci-runner-07.\n</system-reminder>"}, {"type": "text", "text": "Fix the flaky parser test in acme (it lives in /Users/me/code/acme/src/parser.py). Keep the change small.\nUse the staging key sk-test-notarealkey0000000000 if you need it.\n\nMore context: https://intranet.example.com/wiki/acme"}]}, "timestamp": "2026-10-01T09:00:37.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "attachment", "attachment": {"type": "memory", "content": "PRIVATE-MEMORY-NOTE about Zorblax"}, "timestamp": "2026-10-01T09:01:14.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_00", "role": "assistant", "content": [{"type": "thinking", "thinking": "THINKING-SECRET the key is AKIAIOSFODNN7EXAMPLE", "signature": "x"}]}, "timestamp": "2026-10-01T09:01:51.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_00", "role": "assistant", "content": [{"type": "text", "text": "ASSISTANT-PROSE-SECRET: I will read /Users/me/code/acme/src/parser.py first."}]}, "timestamp": "2026-10-01T09:02:28.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_01", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_01", "name": "Read", "input": {"file_path": "/Users/me/code/acme/src/parser.py"}}]}, "timestamp": "2026-10-01T09:03:05.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_01", "type": "tool_result", "content": "def parse(s):\n AWS = 'AKIAIOSFODNN7EXAMPLE'\n", "is_error": false}]}, "timestamp": "2026-10-01T09:03:42.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_02", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_02", "name": "Read", "input": {"file_path": "/Users/me/.claude/projects/acme/memory/MEMORY.md"}}]}, "timestamp": "2026-10-01T09:04:19.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_02", "type": "tool_result", "content": "Zorblax Industries is the client", "is_error": false}]}, "timestamp": "2026-10-01T09:04:56.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_03", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_03", "name": "Grep", "input": {"pattern": "parse", "path": "/Users/me/code/acme"}}]}, "timestamp": "2026-10-01T09:05:33.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_03", "type": "tool_result", "content": "src/parser.py:1", "is_error": false}]}, "timestamp": "2026-10-01T09:06:10.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_04", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_04", "name": "Bash", "input": {"command": "cd /Users/me/code/acme && python -m pytest tests/test_parser.py -q 2>&1 | tail -3"}}]}, "timestamp": "2026-10-01T09:06:47.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_04", "type": "tool_result", "content": "F..........\nFAILED tests/test_parser.py::test_empty - IndexError\n========== 1 failed, 11 passed in 0.52s ==========", "is_error": false}]}, "timestamp": "2026-10-01T09:07:24.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_05", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_05", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/src/parser.py", "old_string": "a", "new_string": "b"}}]}, "timestamp": "2026-10-01T09:08:01.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_05", "type": "tool_result", "content": "The file has been updated.", "is_error": false}]}, "timestamp": "2026-10-01T09:08:38.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_06", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_06", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/.env", "old_string": "A=1", "new_string": "A=2"}}]}, "timestamp": "2026-10-01T09:09:15.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_06", "type": "tool_result", "content": "The file has been updated.", "is_error": false}]}, "timestamp": "2026-10-01T09:09:52.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_07", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_07", "name": "Edit", "input": {"file_path": "/Users/me/code/acme/src/missing.py", "old_string": "x", "new_string": "y"}}]}, "timestamp": "2026-10-01T09:10:29.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_07", "type": "tool_result", "content": "String not found", "is_error": true}]}, "timestamp": "2026-10-01T09:11:06.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_08", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_08", "name": "Bash", "input": {"command": "export TOKEN=@@GITHUB_TOKEN@@ && curl -s https://internal.example.com/api | jq ."}}]}, "timestamp": "2026-10-01T09:11:43.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_08", "type": "tool_result", "content": "{\"secret\": \"value\"}", "is_error": false}]}, "timestamp": "2026-10-01T09:12:20.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_09", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_09", "name": "Bash", "input": {"command": "ssh ci-runner-07 'cd ~/acme && pytest -q'"}}]}, "timestamp": "2026-10-01T09:12:57.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_09", "type": "tool_result", "content": "============ 12 passed in 0.40s ============", "is_error": false}]}, "timestamp": "2026-10-01T09:13:34.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_10", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_10", "name": "Bash", "input": {"command": "python3 tests/run_all.py -k parser"}}]}, "timestamp": "2026-10-01T09:14:11.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_10", "type": "tool_result", "content": "12/12 test files passed in 3.1s wall", "is_error": false}]}, "timestamp": "2026-10-01T09:14:48.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_11", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_11", "name": "Bash", "input": {"command": "git add -A && git commit -q -m 'Fix the parser on empty input'"}}]}, "timestamp": "2026-10-01T09:15:25.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_11", "type": "tool_result", "content": "[main abc1234] Fix the parser on empty input\n 1 file changed, 3 insertions(+), 1 deletion(-)", "is_error": false}]}, "timestamp": "2026-10-01T09:16:02.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_12", "role": "assistant", "content": [{"type": "tool_use", "id": "toolu_12", "name": "mcp__1a59c906-04da-521d-bda7-7f71b9f9e01c__fetch", "input": {"url": "https://example.com"}}]}, "timestamp": "2026-10-01T09:16:39.000Z"}
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "user", "message": {"role": "user", "content": [{"tool_use_id": "toolu_12", "type": "tool_result", "content": "page", "is_error": false}]}, "timestamp": "2026-10-01T09:17:16.000Z"}
+{"type": "future_event_kind", "timestamp": "2026-10-01T09:30:00.000Z", "payload": {"x": 1}}
+{not json at all
+{"isSidechain": true, "userType": "external", "entrypoint": "cli", "cwd": "/Users/me/code/acme", "agentId": "a1", "sessionId": "0000-fixture", "version": "2.1.999", "gitBranch": "main", "type": "assistant", "message": {"id": "msg_99", "role": "assistant", "content": [{"type": "text", "text": "Done. ASSISTANT-PROSE-SECRET summary."}]}, "timestamp": "2026-10-01T09:17:53.000Z"}
diff --git a/skills/showtime/tests/fixtures/recap/subagents/agent-a1.meta.json b/skills/showtime/tests/fixtures/recap/subagents/agent-a1.meta.json
new file mode 100644
index 0000000..d6b10f7
--- /dev/null
+++ b/skills/showtime/tests/fixtures/recap/subagents/agent-a1.meta.json
@@ -0,0 +1 @@
+{"agentType":"general-purpose","description":"Fix the parser flake"}
diff --git a/skills/showtime/tests/fixtures/repro/app/index.html b/skills/showtime/tests/fixtures/repro/app/index.html
new file mode 100644
index 0000000..26aea72
--- /dev/null
+++ b/skills/showtime/tests/fixtures/repro/app/index.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>Acme sign in</title>
+<style>
+ body { font: 18px/1.4 system-ui, sans-serif; background: #f4f5f7; color: #1d2330; margin: 0; }
+ main { max-width: 420px; margin: 80px auto; background: #fff; padding: 32px 36px; border-radius: 12px;
+ box-shadow: 0 4px 24px rgb(0 0 0 / 0.08); }
+ h1 { font-size: 28px; margin: 0 0 20px; }
+ label { display: block; margin: 14px 0 4px; font-weight: 600; }
+ input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; border: 1px solid #c5cad3;
+ border-radius: 8px; }
+ button { margin-top: 22px; width: 100%; padding: 12px; font: inherit; font-weight: 600; color: #fff;
+ background: #2f5bea; border: 0; border-radius: 8px; }
+</style>
+</head>
+<body>
+<main>
+ <h1>Sign in to Acme</h1>
+ <form id="f">
+ <label for="email">Email</label>
+ <input id="email" name="email" type="email" autocomplete="username">
+ <label for="password">Password</label>
+ <input id="password" name="password" type="password" autocomplete="current-password">
+ <label for="token">API token</label>
+ <input id="token" name="api_token" type="text">
+ <button type="submit">Sign in</button>
+ </form>
+</main>
+<script>
+ document.getElementById("f").addEventListener("submit", function (e) {
+ e.preventDefault();
+ var name = document.getElementById("email").value.split("@")[0];
+ name = name.charAt(0).toUpperCase() + name.slice(1);
+ console.error("Failed to load avatar for " + name + ": 404");
+ document.querySelector("main").innerHTML = "<h1>Welcome back, " + name + "</h1><p>You have 3 new messages.</p>";
+ });
+</script>
+</body>
+</html>
diff --git a/skills/showtime/tests/fixtures/repro/login.spec.js b/skills/showtime/tests/fixtures/repro/login.spec.js
new file mode 100644
index 0000000..f2e7eb8
--- /dev/null
+++ b/skills/showtime/tests/fixtures/repro/login.spec.js
@@ -0,0 +1,13 @@
+// A test that fails on purpose (the page says "Welcome back, Ada"), for `showtime repro`'s tests.
+const { test, expect } = require('playwright/test');
+const path = require('path');
+const { pathToFileURL } = require('url');
+
+test('signs in and greets the user', async ({ page }) => {
+ await page.goto(pathToFileURL(path.join(__dirname, 'app', 'index.html')).href + '?session=s3ss10n-n0t-real#debug');
+ await page.getByLabel('Email').fill('[email protected]');
+ await page.getByLabel('Password').fill('hunter2-not-real');
+ await page.getByLabel('API token').fill('tok-0000-not-real');
+ await page.getByRole('button', { name: 'Sign in' }).click();
+ await expect(page.getByRole('heading', { level: 1 })).toHaveText('Welcome, Ada!', { timeout: 1500 });
+});
diff --git a/skills/showtime/tests/fixtures/repro/trace.zip b/skills/showtime/tests/fixtures/repro/trace.zip
new file mode 100644
index 0000000..264cdfe
Binary files /dev/null and b/skills/showtime/tests/fixtures/repro/trace.zip differ
diff --git a/skills/showtime/tests/run_all.py b/skills/showtime/tests/run_all.py
index 6bd5bf7..49d1ffd 100755
--- a/skills/showtime/tests/run_all.py
+++ b/skills/showtime/tests/run_all.py
@@ -104,7 +104,7 @@ SHARD_WEIGHTS = {
"test_audio.py": 185, "test_footage.py": 133, "test_qa.py": 131, "test_voice.py": 102,
"test_foundation.py": 35, "test_job.py": 34, "test_mcp.py": 26, "test_studio.py": 26,
"test_manim.py": 4, "test_skill_structure.py": 3, "test_doc.py": 3, "test_delight.py": 1,
- "test_film.py": 1, "test_caption_cards.py": 1, "test_runtime.py": 1, "test_chart_labels.py": 1,
+ "test_film.py": 1, "test_diagram.py": 1, "test_caption_cards.py": 1, "test_runtime.py": 1, "test_chart_labels.py": 1,
"test_run_all.py": 5, "test_preview_server.py": 3, "test_packages.py": 8, "test_hosts.py": 4,
}
SHARD_DEFAULT_WEIGHT = 60
diff --git a/skills/showtime/tests/test_bed.py b/skills/showtime/tests/test_bed.py
new file mode 100644
index 0000000..2d2d6de
--- /dev/null
+++ b/skills/showtime/tests/test_bed.py
@@ -0,0 +1,307 @@
+#!/usr/bin/env python3
+"""st.bed: the bed and the effects of recap and repro films differ from film to film, and not by chance.
+
+Checks (no network, no render): two different inputs get different music (a composed style or a catalog
+track) and different effect seeds; the same input gets the same choice twice; with nothing cached and
+SHOWTIME_OFFLINE=1 the bed is a composed style from the kind's calm list; a cached catalog track is preferred
+and rotates away from the last jobs' styles; `pin` (--music) wins (a style, a catalog id, none); a catalog bed
+whose fetch fails becomes its composed fallback in mix.json.
+
+usage: python tests/test_bed.py [--fast] [-v]
+"""
+from __future__ import annotations
+
+import _isolate # noqa: F401 (run from a scratch folder: never write into the repository)
+
+import json
+import os
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "lib"))
+
+import numpy as np # noqa: E402
+
+from st import bed # noqa: E402
+from st.audio import SR, compose, music, sfx # noqa: E402
+from st.common import ShowtimeError # noqa: E402
+
+SECTIONS = "0:intro,4:verse,9:outro"
+KEYS = ["session-%02d" % i for i in range(12)]
+
+
+def choose(kind, key, **kw):
+ return bed.choose(kind, key, 40.0, SECTIONS, **kw)
+
+
+def _env(x, w=0.005):
+ """The 5 ms RMS envelope of a (stereo) clip."""
+ k = int(w * SR)
+ return np.convolve(np.abs(x).mean(axis=1) ** 2, np.ones(k) / k, "same") ** 0.5
+
+
+class TestSoftTransitions(unittest.TestCase):
+ """0.4.3: the transition sounds (whoosh, swoosh-in, swoosh-out) are soft by default: a slow attack, no hiss
+ above 4 kHz, and an end-synced swoosh eases out instead of stopping at its peak. (3bec5d2: swoosh-out attacked in
+ 11 ms; 34-45% of every one's energy was above 4 kHz; swoosh-in stopped at 84% of its peak.)"""
+
+ def test_attack_and_top_end(self):
+ for name in ("whoosh", "swoosh-in", "swoosh-out"):
+ for seed in (1, 2, 3):
+ x, _ = sfx.render(name, seed=seed, intensity=0.35)
+ e = _env(x)
+ pk = e.max()
+ attack = (int(np.argmax(e >= 0.9 * pk)) - int(np.argmax(e >= 0.1 * pk))) / SR
+ self.assertGreaterEqual(attack, 0.08, (name, seed, attack))
+ mono = x.mean(axis=1)
+ spec = np.abs(np.fft.rfft(mono)) ** 2
+ hi = spec[np.fft.rfftfreq(len(mono), 1 / SR) > 4000].sum() / spec.sum()
+ self.assertLess(hi, 0.03, (name, seed, hi))
+
+ def test_swoosh_in_eases_out(self):
+ x, m = sfx.render("swoosh-in", seed=3, intensity=0.35)
+ e = _env(x)
+ self.assertLess(e[-int(0.01 * SR) - 1] / e.max(), 0.25) # the last 10 ms are well under the peak
+ self.assertEqual(m["hit"], m["duration"]) # still end-synced
+
+ def test_other_sounds_are_untouched(self):
+ x, _ = sfx.render("click", seed=3)
+ e = _env(x, 0.001)
+ self.assertLess((int(np.argmax(e >= 0.9 * e.max())) - int(np.argmax(e >= 0.1 * e.max()))) / SR, 0.01) # still a click
+
+ def test_films_use_soft_cuts_far_under_the_bed(self):
+ self.assertNotIn("whoosh", bed.CUT)
+ self.assertEqual(bed.CUT, ("swoosh-in", "swoosh-out"))
+ self.assertLessEqual(bed.CUT_GAIN_DB, -18.0)
+ self.assertEqual(bed.synth("a", "cut", 1, 0.3, "Am")["key"], "Am")
+
+
+class TestRerunsAndFallback(unittest.TestCase):
+ """0.4.3 review: a job keeps its bed on a rerun, the catalog bed's credit is reported, the fallback keeps the
+ bed's placement, and the wording of the mix says what was downloaded."""
+
+ def setUp(self):
+ self.tmp = Path(tempfile.mkdtemp(prefix="st-bed-rerun-"))
+ self.proj = self.tmp / "project"
+ (self.proj / "audio").mkdir(parents=True)
+ for p in (mock.patch.dict(os.environ, {"SHOWTIME_MUSIC_CACHE": str(self.tmp / "music"), "SHOWTIME_OFFLINE": "1"}),):
+ p.start()
+ self.addCleanup(p.stop)
+
+ def look(self, **kw):
+ return dict({"job": "j", "project": str(self.proj.resolve()), "music": []}, **kw)
+
+ def history(self, looks):
+ from st.variety import history
+ for p in (mock.patch.object(history, "load", return_value=looks),
+ mock.patch.object(history, "enabled", return_value=(True, ""))):
+ p.start()
+ self.addCleanup(p.stop)
+
+ def test_rerun_reuses_the_bed_in_the_project(self):
+ first = bed.choose("recap", "hash-1", 40.0, SECTIONS, project=self.proj)
+ (self.proj / "audio" / "mix.json").write_text(json.dumps({"tracks": [first["track"]]}), encoding="utf-8")
+ again = bed.choose("recap", "another-hash", 40.0, "0:intro,9:outro", project=self.proj)
+ self.assertEqual(again["style"], first["style"])
+ self.assertEqual(again["track"]["compose"]["seed"], first["track"]["compose"]["seed"])
+ self.assertEqual(again["track"]["compose"]["key"], first["track"]["compose"]["key"])
+ self.assertEqual(again["track"]["compose"]["sections"], "0:intro,9:outro") # the scenes are the new ones
+ with mock.patch.object(music, "is_cached", return_value=True):
+ cat = bed.choose("recap", "hash-1", 40.0, SECTIONS, project=self.tmp / "other")
+ (self.proj / "audio" / "mix.json").write_text(json.dumps({"tracks": [cat["track"]]}), encoding="utf-8")
+ self.assertEqual(bed.choose("recap", "x", 40.0, SECTIONS, project=self.proj)["id"], cat["id"]) # not cached now
+ self.assertEqual(bed.choose("recap", "x", 40.0, SECTIONS, project=self.proj, pin="lofi-chill")["style"], "lofi-chill")
+
+ def test_rerun_reuses_what_the_history_recorded(self):
+ self.history([self.look(music=[{"ref": "compose:ambient-pad", "style": "ambient-pad", "seed": 42, "key": "Em"}])])
+ c = bed.choose("repro", "any", 40.0, SECTIONS, project=self.proj)
+ self.assertEqual((c["style"], c["track"]["compose"]["seed"], c["track"]["compose"]["key"]), ("ambient-pad", 42, "Em"))
+ tid = music.tracks()[3]["id"]
+ self.history([self.look(music=[{"ref": "catalog:" + tid}])])
+ self.assertEqual(bed.choose("repro", "any", 40.0, SECTIONS, project=self.proj)["id"], tid)
+
+ def test_the_job_itself_is_not_recent_and_rotation_off_is_honoured(self):
+ base = choose("repro", "a")["style"]
+ # the job's own entry (no seed to reuse) must not push its style out of the pool
+ self.history([self.look(music=[{"ref": "compose:" + base, "style": base}])])
+ self.assertEqual(bed.pick_style("repro", "a", self.proj), base)
+ other = {"job": "other", "project": str(self.tmp / "other"), "music": [{"ref": "compose:" + base, "style": base}]}
+ self.history([other])
+ self.assertNotEqual(bed.pick_style("repro", "a", self.proj), base)
+ with mock.patch.dict(os.environ, {"SHOWTIME_MUSIC_ROTATION": "off"}):
+ self.assertEqual(bed.pick_style("repro", "a", self.proj), base)
+
+ def test_a_cached_candidate_beats_a_download(self):
+ q = bed.CATALOG["recap"]
+ cands = [r["track"]["id"] for r in music.search(use=q["use"], energy=q["energy"], vocals="none", dur=40.0,
+ limit=bed.CANDIDATES, key=str(self.proj.resolve()))]
+ want = cands[(bed.stable("a", "recap", "track") % len(cands) + 1) % len(cands)]
+ with mock.patch.object(music, "is_cached", side_effect=lambda t: t["id"] == want), \
+ mock.patch("st.assets.net.offline", return_value=False):
+ self.assertEqual(bed.choose("recap", "a", 40.0, SECTIONS, fetch=True, project=self.proj)["id"], want)
+
+ def catalog_choice(self):
+ with mock.patch.object(music, "is_cached", return_value=True):
+ return bed.choose("recap", "a", 40.0, SECTIONS, duck={"under": "voice"}, gain_db=-2)
+
+ def test_fallback_keeps_the_placement_and_the_scenes(self):
+ c = self.catalog_choice()
+ tr = dict(c["track"], duck={"under": "voice", "depth_db": 9}, start=0.5, gain_points=[[0, 1], [2, 0]])
+ (self.proj / "audio" / "mix.json").write_text(json.dumps({"_comment": "x", "tracks": [tr]}), encoding="utf-8")
+ (self.proj / "index.html").write_text(
+ '<section class="scene" id="a" data-start="0" data-dur="3.50"></section>'
+ '<section class="scene" id="b" data-start="#a" data-dur="4.00"></section>'
+ '<section class="scene" id="c" data-start="#b" data-dur="2.00"></section>', encoding="utf-8")
+ for exc in (ShowtimeError("offline"), OSError("disk full")):
+ (self.proj / "audio" / "mix.json").write_text(json.dumps({"_comment": "x", "tracks": [tr]}), encoding="utf-8")
+ cc = dict(c)
+ with mock.patch.object(music, "fetch", side_effect=exc):
+ bed.ensure(self.proj / "audio" / "mix.json", cc)
+ mix = json.loads((self.proj / "audio" / "mix.json").read_text(encoding="utf-8"))
+ b = mix["tracks"][0]
+ self.assertEqual((b["duck"], b["start"], b["gain_points"], b["gain_db"]),
+ ({"under": "voice", "depth_db": 9}, 0.5, [[0, 1], [2, 0]], -2))
+ self.assertEqual(b["compose"]["sections"], "0:intro,3.5:verse,7.5:outro")
+ self.assertIn("seed", cc["label"])
+ self.assertIn("all made on this machine", mix["_comment"])
+
+ def test_a_pinned_track_that_cannot_be_fetched_fails(self):
+ tid = music.tracks()[0]["id"]
+ c = bed.choose("recap", "a", 40.0, SECTIONS, pin=tid)
+ self.assertTrue(c["pinned"])
+ (self.proj / "audio" / "mix.json").write_text(json.dumps({"tracks": [c["track"]]}), encoding="utf-8")
+ with mock.patch.object(music, "fetch", side_effect=OSError("read-only")):
+ with self.assertRaises(ShowtimeError):
+ bed.ensure(self.proj / "audio" / "mix.json", c)
+
+ def test_credits_and_notes_are_reported(self):
+ buckley = next(t for t in music.tracks() if t["source"] == "buckley" and t.get("content_id") == "smart-cid-releasable")
+ c = bed.choose("recap", "a", 40.0, SECTIONS, pin=buckley["id"])
+ video = self.tmp / "recap.mp4"
+ (self.tmp / "recap.credits.txt").write_text("credit", encoding="utf-8")
+ (self.tmp / "share.txt").write_text("share", encoding="utf-8")
+ r = bed.credit_report(video, c)
+ self.assertEqual((r["credits"], r["share"]), (str(self.tmp / "recap.credits.txt"), str(self.tmp / "share.txt")))
+ self.assertIn("Content ID", " ".join(r["notes"]))
+ self.assertIn(buckley["artist"], r["attribution"])
+ self.assertEqual(bed.credit_report(video, choose("recap", "a")), {"credits": None, "share": None, "notes": [], "attribution": None})
+ from st import repro as rp
+ rep = {"failure": None, "test": {"title": "t", "location": ""}, "browser": "", "playwright": "", "steps": [],
+ "console": []}
+ self.assertIn("Music: " + r["attribution"], rp.markdown(rep, {"rerun": "", "viewer": ""}, "repro.mp4", r["attribution"]))
+
+ def test_the_synth_cache_key_follows_the_synth_version(self):
+ from st.audio import mix
+ spec = {"t": "swoosh-in", "dur": None, "intensity": 0.35, "seed": 3, "key": "C"}
+ before = mix.sfx_cache_key(spec)
+ self.assertEqual(before, mix.sfx_cache_key(dict(spec)))
+ with mock.patch.object(sfx, "SYNTH_VERSION", sfx.SYNTH_VERSION + 1):
+ self.assertNotEqual(mix.sfx_cache_key(spec), before)
+ self.assertGreaterEqual(sfx.SYNTH_VERSION, 2) # bumped with the softer transitions
+ self.assertNotEqual(mix.sfx_cache_key(dict(spec, seed=4)), before)
+
+ def test_the_comment_claims_sounds_only_when_there_are_any(self):
+ self.assertNotIn("sounds", bed.comment(self.catalog_choice(), False))
+ self.assertIn("soft sounds", bed.comment(self.catalog_choice(), True))
+ self.assertNotIn("sounds", bed.comment(choose("recap", "a"), False))
+
+ def test_the_comment_says_what_was_downloaded(self):
+ self.assertIn("downloaded once", bed.comment(self.catalog_choice()))
+ self.assertIn("all made on this machine", bed.comment(choose("recap", "a")))
+ self.assertNotIn("deep-house", bed.STYLES["recap"])
+
+
+class TestBed(unittest.TestCase):
+ def setUp(self):
+ self.tmp = Path(tempfile.mkdtemp(prefix="st-bed-"))
+ patches = [mock.patch.dict(os.environ, {"SHOWTIME_MUSIC_CACHE": str(self.tmp / "music"),
+ "SHOWTIME_OFFLINE": "1"}),
+ mock.patch.object(music, "recent_music", return_value=[])]
+ for p in patches:
+ p.start()
+ self.addCleanup(p.stop)
+
+ def test_same_input_same_choice(self):
+ for kind in bed.STYLES:
+ self.assertEqual(choose(kind, "a"), choose(kind, "a"))
+ self.assertEqual(bed.synth("a", "click", 3), bed.synth("a", "click", 3))
+
+ def test_different_inputs_differ(self):
+ for kind in bed.STYLES:
+ beds = [json.dumps(choose(kind, k)["track"], sort_keys=True) for k in KEYS]
+ styles = {choose(kind, k)["style"] for k in KEYS}
+ self.assertGreaterEqual(len(styles), 3, (kind, styles)) # not the same style every time
+ self.assertGreaterEqual(len(set(beds)), len(KEYS) - 1) # and the seed and key move even in one style
+ self.assertTrue(styles <= {compose.resolve_style(s) for s in bed.STYLES[kind]})
+ cuts = [bed.synth(k, "cut", 4) for k in KEYS]
+ self.assertGreaterEqual(len({c["type"] for c in cuts}), 2)
+ self.assertEqual(len({c["seed"] for c in cuts}), len(KEYS))
+ for role, fams in (("click", bed.CLICK), ("error", bed.ERROR), ("cut", bed.CUT)):
+ for k in KEYS:
+ self.assertIn(bed.synth(k, role, 1)["type"], fams)
+
+ def test_offline_without_cache_is_composed(self):
+ c = choose("recap", "a", fetch=True)
+ self.assertEqual(c["how"], "compose")
+ self.assertIsNone(c["fallback"])
+ tr = c["track"]
+ self.assertEqual((tr["id"], tr["kind"], tr["gain_db"], tr["fade_out"]), ("bed", "music", -3.0, 1.2))
+ self.assertEqual(tr["compose"]["sections"], SECTIONS)
+ self.assertEqual(tr["compose"]["key"], compose.auto_key(tr["compose"]["style"], tr["compose"]["seed"]))
+
+ def test_cached_catalog_track_is_preferred_and_varies(self):
+ with mock.patch.object(music, "is_cached", return_value=True):
+ picks = {k: choose("recap", k, duck={"under": "voice", "depth_db": 12}) for k in KEYS}
+ ids = {c["id"] for c in picks.values()}
+ self.assertGreaterEqual(len(ids), 3, ids)
+ again = choose("recap", KEYS[0], duck={"under": "voice", "depth_db": 12})
+ self.assertEqual(again, picks[KEYS[0]])
+ c = picks[KEYS[0]]
+ self.assertEqual(c["how"], "catalog")
+ self.assertEqual(c["track"]["catalog"], c["id"])
+ self.assertTrue(c["track"]["fit"])
+ self.assertEqual(c["track"]["duck"], {"under": "voice", "depth_db": 12})
+ self.assertEqual(c["fallback"]["compose"]["sections"], SECTIONS)
+ t = music.get(c["id"])
+ self.assertEqual(t["vocals"], "none")
+ self.assertLessEqual(float(t["energy"]), 0.6)
+
+ def test_style_rotates_away_from_recent_jobs(self):
+ first = choose("repro", "a")["style"]
+ row = {"job": "j", "tracks": [], "families": [], "artists": [], "composed": [first]}
+ with mock.patch.object(music, "recent_music", return_value=[row]):
+ self.assertNotEqual(choose("repro", "a")["style"], first)
+
+ def test_pin(self):
+ c = choose("recap", "a", pin="lofi-chill")
+ self.assertEqual((c["how"], c["style"]), ("compose", "lofi-chill"))
+ self.assertEqual(choose("recap", "b", pin="lofi-chill")["style"], "lofi-chill")
+ none = choose("repro", "a", pin="none")
+ self.assertEqual((none["how"], none["track"]), ("none", None))
+ tid = music.tracks()[0]["id"]
+ c = choose("recap", "a", pin=tid)
+ self.assertEqual((c["how"], c["id"], c["track"]["catalog"]), ("catalog", tid, tid))
+ with self.assertRaises(ShowtimeError):
+ choose("recap", "a", pin="no-such-style-or-track")
+
+ def test_failed_fetch_falls_back_to_the_composed_bed(self):
+ with mock.patch.object(music, "is_cached", return_value=True):
+ c = choose("recap", "a")
+ mix = self.tmp / "mix.json"
+ mix.write_text(json.dumps({"tracks": [c["track"], {"kind": "sfx", "synth": {"type": "click"}}]}), encoding="utf-8")
+ with mock.patch.object(music, "fetch", side_effect=ShowtimeError("offline")):
+ bed.ensure(mix, c)
+ tracks = json.loads(mix.read_text(encoding="utf-8"))["tracks"]
+ self.assertIn("compose", tracks[0])
+ self.assertEqual(tracks[1]["kind"], "sfx")
+ self.assertEqual(c["how"], "compose")
+ with mock.patch.object(music, "fetch", return_value=Path("x")) as f:
+ bed.ensure(mix, c) # composed already: nothing to fetch
+ f.assert_not_called()
+
+
+if __name__ == "__main__":
+ unittest.main(argv=[a for a in sys.argv if a != "--fast"])
diff --git a/skills/showtime/tests/test_diagram.py b/skills/showtime/tests/test_diagram.py
new file mode 100644
index 0000000..240cd4d
--- /dev/null
+++ b/skills/showtime/tests/test_diagram.py
@@ -0,0 +1,496 @@
+#!/usr/bin/env python3
+"""Living diagrams: runtime/diagram.js, runtime/diagram.css, templates/diagram, `showtime new diagram --theme`.
+
+ * static: the files exist; the runtime has no wall clocks, timers or unseeded randomness; every example scene
+ keeps its beat times in a CUE table; the guide is routed from SKILL.md
+ * CLI: `new diagram --theme dark` sets the page's data-theme, showtime.json theme and background; --duration
+ scales the CUE table; --theme on another template is an error
+ * browser: spec validation names the bad keys; two seeks to the same t from different frames give the same
+ SVG; pipes start on their ports and the depth order follows the port rule; a label pushed onto a part is
+ reported as a collision; both themes render a frame (light paper, dark ground)
+
+Stdlib only. usage: python tests/test_diagram.py [--fast] [-v]
+ --fast skip everything that needs a browser
+"""
+from __future__ import annotations
+
+import _isolate # noqa: F401 (run from a scratch folder: never write into the repository)
+
+import json
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+TESTS_DIR = Path(__file__).resolve().parent
+SKILL = TESTS_DIR.parent
+LAUNCHER = SKILL / "lib" / "st" / "launcher.py"
+RUNTIME = SKILL / "runtime" / "diagram.js"
+TEMPLATE = SKILL / "templates" / "diagram"
+sys.path.insert(0, str(SKILL / "lib"))
+
+from st.launcher import build_env, showtime_home # noqa: E402
+
+FAST = "--fast" in sys.argv
+ENV = build_env(showtime_home())
+NODE = shutil.which("node", path=ENV.get("PATH"))
+TMP = Path(tempfile.mkdtemp(prefix="st-diagram-"))
+
+
+def showtime(*args, check=True, timeout=300):
+ cp = subprocess.run([sys.executable, str(LAUNCHER)] + [str(a) for a in args], env=ENV,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8",
+ errors="replace", timeout=timeout)
+ if check and cp.returncode != 0:
+ raise AssertionError("showtime %s failed (rc=%d):\n%s\n%s" % (
+ " ".join(map(str, args)), cp.returncode, cp.stdout[-3000:], cp.stderr[-3000:]))
+ return cp
+
+
+class TestStatic(unittest.TestCase):
+ def test_files_present(self):
+ for p in (RUNTIME, SKILL / "runtime" / "diagram.css", SKILL / "runtime" / "figure-film.js", SKILL / "runtime" / "figure.js",
+ SKILL / "runtime" / "figure.css", TEMPLATE / "figure.html", TEMPLATE / "examples" / "econ-lab.js",
+ TEMPLATE / "index.html", TEMPLATE / "scene.js",
+ TEMPLATE / "showtime.json", TEMPLATE / "examples" / "market.js", TEMPLATE / "examples" / "enter.js",
+ SKILL / "references" / "workflows" / "diagram.md"):
+ self.assertTrue(p.is_file(), p)
+
+ def test_no_clocks_timers_or_unseeded_random(self):
+ # figure-film.js is loaded by every diagram film (index.html) and holds Figure.film: it is film code. The live
+ # page's clock and timers are in figure.js, which only figure.html loads (TestLivePageStaysOffFilms).
+ for p in [RUNTIME, SKILL / "runtime" / "figure-film.js"] + sorted(TEMPLATE.rglob("*.js")):
+ code = re.sub(r"/\*.*?\*/|//[^\n]*", "", p.read_text(encoding="utf-8"), flags=re.S)
+ for bad in ("Math.random", "Date.now", "new Date", "performance.now", "setTimeout", "setInterval",
+ "requestAnimationFrame", ".animate("):
+ self.assertNotIn(bad, code, "%s uses %s" % (p.name, bad))
+
+ def test_no_css_motion(self):
+ """Motion in CSS (transitions, animations) runs on the wall clock, not on ST time."""
+ for p in [SKILL / "runtime" / "diagram.css", SKILL / "runtime" / "figure.css", TEMPLATE / "index.html", TEMPLATE / "figure.html"]:
+ css = re.sub(r"/\*.*?\*/", "", p.read_text(encoding="utf-8"), flags=re.S)
+ for bad in ("transition", "animation", "@keyframes"):
+ self.assertNotIn(bad, css, "%s uses CSS %s" % (p.name, bad))
+
+ def test_live_page_stays_off_films(self):
+ """The wall-clock live page (figure.js) is loaded by figure.html only, never by a film page."""
+ self.assertNotIn("/_st/figure.js", (TEMPLATE / "index.html").read_text(encoding="utf-8"))
+ self.assertIn("/_st/figure-film.js", (TEMPLATE / "index.html").read_text(encoding="utf-8"))
+ fig = (TEMPLATE / "figure.html").read_text(encoding="utf-8")
+ self.assertLess(fig.index("/_st/figure-film.js"), fig.index("/_st/figure.js"))
+
+ def test_scenes_keep_beats_in_a_cue_table(self):
+ """`showtime retime` scales `var CUE = {...}`: every scene has one, one number per line."""
+ for p in [TEMPLATE / "scene.js"] + sorted((TEMPLATE / "examples").glob("*.js")):
+ text = p.read_text(encoding="utf-8")
+ m = re.search(r"var CUE = \{\n(.*?)\n\};", text, re.S)
+ self.assertIsNotNone(m, p.name)
+ lines = [l for l in m.group(1).splitlines() if l.strip()]
+ self.assertTrue(all(re.match(r"^\s+\w+: [0-9.]+,$", l) for l in lines), (p.name, lines))
+ self.assertTrue(any(l.strip().startswith("duration:") for l in lines), p.name)
+
+ def test_template_poster_is_never_baked(self):
+ cfg = json.loads((TEMPLATE / "showtime.json").read_text(encoding="utf-8"))
+ self.assertEqual(cfg.get("render", {}).get("poster_bake"), "off")
+ self.assertGreater(cfg["poster"], cfg["duration"] * 0.6, "the poster is the built figure, near the end")
+ self.assertEqual(cfg.get("theme"), "light")
+
+ def test_skill_routes_the_guide(self):
+ self.assertIn("`diagram`", (SKILL / "SKILL.md").read_text(encoding="utf-8"))
+ self.assertIn("workflows/diagram.md", (SKILL / "references" / "index.md").read_text(encoding="utf-8"))
+
+
+class TestCli(unittest.TestCase):
+ def test_theme_dark(self):
+ d = TMP / "dark"
+ showtime("new", "diagram", d, "--theme", "dark")
+ self.assertIn('data-theme="dark"', (d / "index.html").read_text(encoding="utf-8"))
+ cfg = json.loads((d / "showtime.json").read_text(encoding="utf-8"))
+ self.assertEqual((cfg["theme"], cfg["background"]), ("dark", "#0A0F19"))
+
+ def test_duration_scales_the_cue_table(self):
+ d = TMP / "long"
+ showtime("new", "diagram", d, "-d", "30")
+ old = re.search(r"compressor: ([0-9.]+),", (TEMPLATE / "scene.js").read_text(encoding="utf-8")).group(1)
+ new = re.search(r"compressor: ([0-9.]+),", (d / "scene.js").read_text(encoding="utf-8")).group(1)
+ old_d = json.loads((TEMPLATE / "showtime.json").read_text(encoding="utf-8"))["duration"]
+ self.assertAlmostEqual(float(new), float(old) * 30 / old_d, places=2)
+ self.assertEqual(json.loads((d / "showtime.json").read_text(encoding="utf-8"))["duration"], 30)
+
+ def test_example_takes_its_own_length(self):
+ """--example makes an example the scene at its own CUE.duration, so --duration scales from that base."""
+ ex = (TEMPLATE / "examples" / "enter.js").read_text(encoding="utf-8")
+ base = float(re.search(r"^ duration: ([0-9.]+),$", ex, re.M).group(1))
+ answer = float(re.search(r"^ answer: ([0-9.]+),$", ex, re.M).group(1))
+ d = TMP / "ex-enter"
+ showtime("new", "diagram", d, "--example", "enter")
+ cfg = json.loads((d / "showtime.json").read_text(encoding="utf-8"))
+ self.assertEqual(cfg["duration"], base)
+ self.assertAlmostEqual(cfg["poster"], base - 0.8, places=2)
+ self.assertIn("press *Enter*", (d / "scene.js").read_text(encoding="utf-8"))
+ d2 = TMP / "ex-enter-30"
+ showtime("new", "diagram", d2, "--example", "enter", "-d", "30")
+ got = float(re.search(r"^ answer: ([0-9.]+),$", (d2 / "scene.js").read_text(encoding="utf-8"), re.M).group(1))
+ self.assertAlmostEqual(got, answer * 30 / base, places=2)
+ cp = showtime("new", "diagram", TMP / "ex-nope", "--example", "nope", check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("examples of diagram: econ-lab, enter, market", cp.stderr + cp.stdout)
+
+ def test_theme_keeps_an_explicit_background(self):
+ d = TMP / "dark-bg"
+ showtime("new", "diagram", d, "--theme", "dark", "--background=#112233")
+ cfg = json.loads((d / "showtime.json").read_text(encoding="utf-8"))
+ self.assertEqual((cfg["theme"], cfg["background"]), ("dark", "#112233"))
+
+ def test_storyboard_is_refused_for_a_diagram(self):
+ sb = TMP / "board.md"
+ sb.write_text("| Shot | Length | Visual | Narration |\n|---|---|---|---|\n| a | 3 s | a plate | hello |\n", encoding="utf-8")
+ cp = showtime("new", "diagram", TMP / "sb-diagram", "--from-storyboard", sb, check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("draws one scene spec", cp.stderr + cp.stdout)
+
+ def test_theme_on_another_template_is_an_error(self):
+ cp = showtime("new", "dom", TMP / "dom", "--theme", "dark", check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("--theme is for the diagram template", cp.stderr + cp.stdout)
+ self.assertFalse((TMP / "dom").exists() and any((TMP / "dom").iterdir()), "nothing is copied")
+
+
+# The footer scene: footers on both sides, plates running under both, a tag 4 px above footer L's box, a small
+# part just above footer R's text (inside the old CSS mask's feather), and footer R revealed only at 3 s
+FOOT_SCENE = r"""
+var CUE = {
+ duration: 4,
+};
+window.SCENE = {
+ page: { kicker: 'Footer test', title: 'Footer *mask*', dek: 'Plates fade under the footers; nothing else does.',
+ footL: 'Illustrative sample · footer test', footR: 'made with showtime' },
+ world: { scale: 10, origin: [400, 900] },
+ items: [
+ { id: 'plate', part: 'plate', at: [-10, -10, -2], size: [30, 30, 2], grid: 5 },
+ { id: 'plate-r', part: 'plate', at: [70, -75, -2], size: [18, 18, 2], grid: 5 },
+ { id: 'crate', part: 'box', at: [76.5, -68, 0], size: [3, 3, 1] },
+ ],
+ tags: [{ anchor: [0, 0, 0], tone: 'mute', text: 'near the footer', at: 0, off: [0, 35] }],
+ reveal: [{ sel: '.ld-foot.r', at: 3 }],
+};
+"""
+
+DRIVER = r"""
+import fs from 'node:fs';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, LIGHT, DARK, ENTER, MARKET, FOOT, FOOTDARK] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer } = await imp('server.mjs');
+const { openBrowser, openStage } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const out = {};
+const consoleLines = [], pageErrors = [];
+async function open(dir) {
+ const srv = await startServer({ root: dir });
+ const cfg = JSON.parse(fs.readFileSync(path.join(dir, 'showtime.json'), 'utf8'));
+ const sess = await openStage(browser, { url: srv.url, config: cfg });
+ sess.page.on('console', (m) => consoleLines.push(m.text()));
+ sess.page.on('pageerror', (e) => pageErrors.push(String(e.message || e)));
+ return { srv, sess, page: sess.page };
+}
+// the whole stage (svg and the HTML beat lines) at t, reached from different frames in different orders
+async function sameT(dir) {
+ const S = await open(dir);
+ const dur = await S.page.evaluate(() => window.ST.duration || 20);
+ const ts = []; for (let i = 0; i < 24; i++) ts.push(Math.round((0.3 + i * (dur - 0.6) / 23) * 1000) / 1000);
+ const grab = async (order) => { const m = {}; for (const t of order) m[t] = await S.page.evaluate(async (x) => { await window.ST.seek(x); return document.querySelector('.ld-stage').outerHTML; }, t); return m; };
+ const fwd = await grab(ts);
+ const rev = await grab(ts.slice().reverse());
+ const strided = await grab(ts.filter((t, i) => i % 3 === 0).concat(ts.filter((t, i) => i % 3 === 1).reverse(), ts.filter((t, i) => i % 3 === 2)));
+ const bad = ts.filter((t) => fwd[t] !== rev[t] || fwd[t] !== strided[t]);
+ await S.sess.close(); await S.srv.close?.();
+ return { n: ts.length, bad };
+}
+const svgAt = (page, t) => page.evaluate(async (x) => { await window.ST.seek(x); return document.querySelector('#ld svg').outerHTML; }, t);
+try {
+ const L = await open(LIGHT);
+ const page = L.page;
+ // 1. validation names what is wrong
+ out.errors = await page.evaluate(() => Diagram.validate({ world: { scale: 8, origin: [0, 0] }, items: [
+ { id: 'a', part: 'sprocket', at: [0, 0, 0] }, { id: 'p', kind: 'pipe', from: 'ghost.top', to: 'a.top' }],
+ labels: [{ for: 'nobody', at: 'soon', title: 'X' }], flows: [{ at: 1, path: [{ pipe: 'missing' }] }] }));
+ out.okErrors = await page.evaluate(() => Diagram.validate(window.SCENE));
+ // 2. determinism: the same t from different frames
+ const a1 = await svgAt(page, 9.4); await svgAt(page, 0.5); await svgAt(page, 17.9);
+ const a2 = await svgAt(page, 9.4);
+ out.same = a1 === a2; out.len = a1.length;
+ if (!out.same) { let i = 0; while (i < a1.length && a1[i] === a2[i]) i++; out.diff = [a1.slice(Math.max(0, i - 300), i + 200), a2.slice(Math.max(0, i - 300), i + 200)]; }
+ // 3. ports and depth
+ out.ports = await page.evaluate(() => {
+ const D = Diagram.current, p = D.pipes;
+ const end = (id, k) => (k ? p[id].p3[p[id].p3.length - 1] : p[id].p3[0]).map((v) => Math.round(v * 100) / 100);
+ const ids = D.order.map((it) => it.id);
+ return { suctionStart: end('suction', 0), suctionEnd: end('suction', 1), dischargeEnd: end('discharge', 1), order: ids, report: Diagram.report };
+ });
+ // 4b. depth without ports: a box wholly behind another along x is drawn first, even where the tie-break key
+ // says otherwise; a pinwheel of three boxes is a cycle, and the cycle is reported
+ out.depth = await page.evaluate(() => {
+ const mount = (id, items) => { const h = document.createElement('div'); h.id = id; h.style.cssText = 'position:absolute;left:0;top:0;width:1920px;height:1080px;visibility:hidden'; document.body.appendChild(h);
+ return Diagram.mount({ world: { scale: 10, origin: [960, 300] }, avoid: '#none', items }, { host: '#' + id }); };
+ const a = mount('ld-depth', [{ id: 'near', part: 'box', at: [3, 0, 0], size: [2, 2, 2] }, { id: 'long', part: 'box', at: [0, 0, 0], size: [2, 30, 2] }]);
+ const b = mount('ld-cycle', [{ id: 'A', part: 'box', at: [0, 0, 2], size: [1, 10, 1] }, { id: 'B', part: 'box', at: [1, 0, 0], size: [1, 1, 3] }, { id: 'C', part: 'box', at: [0, 1, 0], size: [2, 1, 2] }]);
+ return { order: a.order.map((it) => it.id), cycle: b.report.warnings };
+ });
+ // 4b'. a leader that runs up a tall part whose outline holds the anchor (a tower behind a crate) is reported:
+ // that part counts like the label's own (past halfway), it is not skipped
+ out.tower = await page.evaluate(async () => {
+ const h = document.createElement('div'); h.id = 'ld-tower'; h.style.cssText = 'position:absolute;left:0;top:0;width:1920px;height:1080px;visibility:hidden'; document.body.appendChild(h);
+ const api = Diagram.mount({ world: { scale: 10, origin: [960, 700] }, avoid: '#none', items: [
+ { id: 'tower', part: 'box', at: [0, 0, 0], size: [10, 10, 60] }, { id: 'crate', part: 'box', at: [10, 10, 0], size: [6, 6, 6] }],
+ labels: [{ for: 'crate', at: 0, title: 'Crate', sub: 'in front of the tower', elbow: [-60, -500], side: 'left' }] }, { host: '#ld-tower' });
+ await api.ready;
+ return api.report.warnings;
+ });
+ // 4c. a scene without a world says so and stops (no exception); scene strings cannot break SVG attributes
+ out.noWorld = await page.evaluate(() => { const h = document.createElement('div'); h.id = 'ld-noworld'; document.body.appendChild(h);
+ try { return Diagram.mount({ items: [] }, { host: '#ld-noworld' }) === null; } catch (e) { return 'threw: ' + e.message; } });
+ out.dash = await page.evaluate(() => { const h = document.createElement('div'); h.id = 'ld-dash'; h.style.cssText = 'visibility:hidden'; document.body.appendChild(h);
+ const api = Diagram.mount({ world: { scale: 10, origin: [960, 300] }, items: [{ id: 'l', kind: 'link', path: [[0, 0, 0], [10, 0, 0]], dash: '6 4" data-x="1', opacity: '1" data-y="2', build: [-1, 0.1] }] }, { host: '#ld-dash' });
+ api.render(1); return h.innerHTML; });
+ // 4d. text that never shows inside the text safe zone is reported: a label in the bottom band (y 990-1000),
+ // a tag pushed off the frame, floor text outside the frame
+ out.unsafe = await page.evaluate(async () => {
+ const h = document.createElement('div'); h.id = 'ld-unsafe'; h.style.cssText = 'position:absolute;left:0;top:0;width:1920px;height:1080px;visibility:hidden'; document.body.appendChild(h);
+ // the box's anchor sits at y 610, so the label's plate ends at y ~994: inside the old layout zone (1000), in the
+ // phone band the renderer hides (below 990)
+ const api = Diagram.mount({ world: { scale: 10, origin: [960, 660] }, avoid: '#none', items: [
+ { id: 'a', part: 'box', at: [0, 0, 0], size: [10, 10, 10] }, { kind: 'floortext', at: [80, 80, 0], text: 'FAR AWAY', at0: 0 }],
+ labels: [{ for: 'a', at: 0.5, title: 'Low', sub: 'in the band', elbow: [40, 335] }],
+ tags: [{ for: 'a', text: 'gone', at: 0.5, off: [0, 900] }] }, { host: '#ld-unsafe' });
+ await api.ready;
+ const lb = api.report.labels.find((x) => x.title === 'Low');
+ return api.report.warnings.concat(['rect-check ' + JSON.stringify(lb && lb.elbow)]);
+ });
+ // 4. a label pushed onto a part is reported
+ out.collide = await page.evaluate(async () => {
+ const host = document.createElement('div'); host.id = 'ld-test'; host.style.cssText = 'position:absolute;left:0;top:0;width:1920px;height:1080px;visibility:hidden';
+ document.body.appendChild(host);
+ const api = Diagram.mount({ world: { scale: 10, origin: [960, 300] }, avoid: '#none', items: [
+ { id: 'a', part: 'box', at: [0, 0, 0], size: [20, 20, 20] }, { id: 'b', part: 'box', at: [24, 0, 0], size: [20, 20, 20] }],
+ labels: [{ for: 'a', at: 0, title: 'Box A', sub: 'sits on box B', elbow: [180, 120], side: 'right' },
+ { for: 'b', at: 0, title: 'Box B', sub: 'leader over A', elbow: [-330, 40], side: 'left' }] }, { host: '#ld-test' });
+ await api.ready;
+ return api.report;
+ });
+ await L.sess.close(); await L.srv.close?.();
+ // 5. both themes render a frame
+ const shot = async (dir) => {
+ const S = await open(dir);
+ await S.page.evaluate(async () => { await window.ST.seek(12); });
+ const r = await S.page.evaluate(() => ({ theme: Diagram.report.theme, ground: getComputedStyle(document.querySelector('.ld-stage')).backgroundColor,
+ parts: document.querySelectorAll('#ld-draw polygon').length, labels: [...document.querySelectorAll('[data-ld-label]')].filter((g) => g.getAttribute('visibility') === 'visible').length }));
+ const png = await S.page.screenshot({ clip: { x: 60, y: 1000, width: 4, height: 4 } });
+ r.png = png.length;
+ await S.sess.close(); await S.srv.close?.();
+ return r;
+ };
+ out.light = await shot(LIGHT);
+ out.dark = await shot(DARK);
+ // 7. the footer mask touches the floor layer only: a tag 4 px above a footer keeps its full colour, parts and text
+ // are never under a mask, the footers paint no backing, an empty footer paints nothing
+ async function footCheck(dir) {
+ const S = await open(dir);
+ await S.page.evaluate(async () => { await window.ST.seek(2); });
+ const o = await S.page.evaluate(() => {
+ const masked = (sel) => { const e = document.querySelector(sel); return !!(e && (e.closest('[mask]'))); };
+ const tag = document.querySelector('[data-ld-tag] rect'), tb = tag.getBoundingClientRect();
+ const f = getComputedStyle(document.querySelector('.ld-foot.l'));
+ return { rects: Diagram.report.footerMask, floor: masked('#ld-floor'), draw: masked('#ld-draw'), wtext: masked('#ld-wtext'),
+ over: masked('#ld-over'), pillFill: getComputedStyle(tag).fill, shadow: f.boxShadow, bg: f.backgroundColor,
+ tagBox: [tb.left, tb.top, tb.width, tb.height], footTop: document.querySelector('.ld-foot.l').getBoundingClientRect().top,
+ warnings: Diagram.report.warnings };
+ });
+ // the pill's lowest rows, nearest the footer: inside the rounded end and below the text's baseline
+ const b = o.tagBox, clip = { x: Math.round(b[0] + b[3] / 2 + 8), y: Math.round(b[1] + b[3] - 7), width: 6, height: 3 };
+ const pixels = async (c) => S.page.evaluate(async (data) => {
+ const img = new Image(); img.src = 'data:image/png;base64,' + data; await img.decode();
+ const cv = document.createElement('canvas'); cv.width = img.width; cv.height = img.height; const g = cv.getContext('2d'); g.drawImage(img, 0, 0);
+ return Array.from(g.getImageData(0, 0, img.width, img.height).data);
+ }, (await S.page.screenshot({ clip: c })).toString('base64'));
+ o.pillPixels = await pixels(clip);
+ // how much of the plate shows inside each footer's box: mask on vs off, against the ground with no floor at all;
+ // the footers' own text is made transparent so only the floor changes
+ await S.page.addStyleTag({ content: '.ld-foot, .ld-foot * { color: transparent !important; }' });
+ const box = (r) => ({ x: r[0] + 10, y: r[1] + 8, width: r[2] - 20, height: r[3] - 16 });
+ const shot = async (t, how, c) => {
+ await S.page.evaluate(async (a) => { await window.ST.seek(a.t);
+ if (a.how === 'off') document.querySelector('#ld-floormask').removeAttribute('mask');
+ if (a.how === 'ground') document.querySelector('#ld-floor').style.display = 'none'; }, { t, how });
+ const p = await pixels(c);
+ await S.page.evaluate(() => { document.querySelector('#ld-floor').style.display = ''; });
+ return p;
+ };
+ const kept = async (t, r) => { // share of the plate's difference from the ground that survives the mask
+ const c = box(r), on = await shot(t, 'on', c), off = await shot(t, 'off', c), g = await shot(t, 'ground', c);
+ let a = 0, b = 0, same = 0; for (let i = 0; i < on.length; i += 4) for (let k = 0; k < 3; k++) {
+ a += Math.abs(on[i + k] - g[i + k]); b += Math.abs(off[i + k] - g[i + k]); same += Math.abs(on[i + k] - off[i + k]); }
+ return { kept: b ? a / b : null, plate: b, onVsOff: same };
+ };
+ const [L, R] = o.rects;
+ o.keptL = await kept(2, L); // footer L is on screen from the start: its plate fades
+ o.keptRBefore = await kept(1, R); // footer R is revealed at 3 s: before, the plate under it is untouched
+ o.keptRAfter = await kept(3.6, R); // after the reveal it fades too
+ o.emptyDisplay = await S.page.evaluate(() => { const r = document.querySelector('.ld-foot.r'); r.textContent = ''; return getComputedStyle(r).display; });
+ await S.sess.close(); await S.srv.close?.();
+ return o;
+ }
+ out.foot = await footCheck(FOOT);
+ out.footDark = await footCheck(FOOTDARK);
+ // 6. same t, same stage, on the examples that use leave/return labels, typed and pressed tags, packets, steps
+ out.enterSame = await sameT(ENTER);
+ out.marketSame = await sameT(MARKET);
+ out.console = consoleLines.filter((l) => l.indexOf('[showtime] diagram:') === 0);
+ out.pageErrors = pageErrors;
+} finally { await browser.close(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestBrowser(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ light, dark, enter, market = TMP / "b-light", TMP / "b-dark", TMP / "b-enter", TMP / "b-market"
+ showtime("new", "diagram", light)
+ showtime("new", "diagram", dark, "--theme", "dark")
+ showtime("new", "diagram", enter, "--example", "enter")
+ showtime("new", "diagram", market, "--example", "market")
+ foot = TMP / "b-foot"
+ showtime("new", "diagram", foot, "-d", "4")
+ (foot / "scene.js").write_text(FOOT_SCENE, encoding="utf-8")
+ foot_dark = TMP / "b-foot-dark"
+ showtime("new", "diagram", foot_dark, "-d", "4", "--theme", "dark")
+ (foot_dark / "scene.js").write_text(FOOT_SCENE, encoding="utf-8")
+ drv = TMP / "drv.mjs"
+ drv.write_text(DRIVER, encoding="utf-8")
+ cp = subprocess.run([NODE, str(drv), str(SKILL), str(light), str(dark), str(enter), str(market), str(foot),
+ str(foot_dark)], env=ENV,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", errors="replace", timeout=600)
+ assert cp.returncode == 0, cp.stderr[-3000:]
+ cls.r = json.loads(cp.stdout.strip().splitlines()[-1])
+
+ def test_validation_names_the_bad_keys(self):
+ e = "\n".join(self.r["errors"])
+ for want in ('unknown part "sprocket"', 'unknown part "ghost"', 'labels[0] "X": needs anchor', "at must be a number",
+ 'unknown pipe "missing"'):
+ self.assertIn(want, e)
+ self.assertEqual(self.r["okErrors"], [], "the template's own scene is valid")
+
+ def test_same_t_same_svg(self):
+ self.assertTrue(self.r["same"], "two seeks to 9.4 s drew different SVG: %s" % self.r.get("diff"))
+ self.assertGreater(self.r["len"], 20000)
+
+ def test_pipes_start_on_their_ports(self):
+ p = self.r["ports"]
+ self.assertEqual(p["suctionStart"], [34, 37, 11.52]) # outdoor.out
+ self.assertEqual(p["suctionEnd"][:2], [50, 30.6]) # compressor.in (its y+ side)
+ self.assertEqual(p["dischargeEnd"], [66, 26, 22]) # wall.in (custom port)
+
+ def test_depth_follows_the_port_rule(self):
+ order = self.r["ports"]["order"]
+ # discharge enters the wall's back face: drawn before the wall; suction leaves the outdoor unit's front face
+ self.assertLess(order.index("discharge"), order.index("wall"))
+ self.assertLess(order.index("outdoor"), order.index("suction"))
+ self.assertLess(order.index("liquid"), order.index("indoor")) # hangs from the indoor unit's bottom
+
+ def test_template_labels_are_placed_clean(self):
+ self.assertEqual(self.r["ports"]["report"]["warnings"], [])
+ self.assertEqual(len(self.r["ports"]["report"]["labels"]), 4)
+
+ def test_collision_is_reported(self):
+ w = "\n".join(self.r["collide"]["warnings"])
+ self.assertIn('label "Box A" collides', w)
+ self.assertIn("part b", w)
+
+ def test_leader_across_a_part_is_reported(self):
+ self.assertRegex("\n".join(self.r["collide"]["warnings"]), r'label "Box B" collides:[^\n]*leader across part a')
+
+ def test_leader_up_an_anchor_holding_part_is_reported(self):
+ self.assertRegex("\n".join(self.r["tower"]), r'label "Crate" collides:[^\n]*leader across part tower \(\d+%\)')
+
+ def test_collision_reaches_the_console_check_reads(self):
+ """`showtime check` lists `[showtime] ...` console warnings: the collision must be there, not only in the report."""
+ self.assertTrue(any(l.startswith('[showtime] diagram: label "Box A" collides') for l in self.r["console"]), self.r["console"])
+
+ def test_text_outside_the_safe_zone_is_reported(self):
+ w = "\n".join(self.r["unsafe"])
+ self.assertTrue(re.search(r'label "Low" collides: outside|"Low" never shows fully inside', w), w) # B1: the bottom band
+ self.assertIn('"gone" never shows fully inside', w)
+ self.assertIn('"FAR AWAY" never shows fully inside', w)
+ self.assertTrue(any('"Low"' in l for l in self.r["console"]), self.r["console"])
+
+ def test_depth_without_ports(self):
+ o = self.r["depth"]["order"]
+ self.assertLess(o.index("long"), o.index("near"), "a box wholly behind another along x is drawn first")
+ self.assertTrue(any("cycle" in w for w in self.r["depth"]["cycle"]), self.r["depth"]["cycle"])
+
+ def test_no_world_and_attribute_strings(self):
+ self.assertIs(self.r["noWorld"], True)
+ self.assertNotIn("data-x", self.r["dash"])
+ self.assertNotIn("data-y", self.r["dash"])
+ self.assertEqual(self.r["pageErrors"], [])
+
+ def test_footer_mask_touches_the_floor_only(self):
+ for theme, key in (("light", "foot"), ("dark", "footDark")):
+ with self.subTest(theme=theme):
+ self._floor_only(self.r[key])
+
+ def _floor_only(self, f):
+ self.assertEqual(len(f["rects"]), 2, f["rects"]) # one hole per footer line with text
+ self.assertTrue(f["floor"], "the floor layer is masked under the footers")
+ self.assertFalse(f["draw"] or f["wtext"] or f["over"], "parts, floor text and tags are never masked")
+ self.assertEqual(f["shadow"], "none") # the footers paint no backing of their own
+ self.assertIn(f["bg"], ("rgba(0, 0, 0, 0)", "transparent"))
+ self.assertEqual(f["emptyDisplay"], "none") # an empty footer paints nothing
+ self.assertLess(f["tagBox"][1] + f["tagBox"][3], f["footTop"]) # the tag sits just above the footer box
+ self.assertGreater(f["tagBox"][1] + f["tagBox"][3], f["footTop"] - 12)
+ # the pill's lowest rows keep the fill the theme paints the tag with (read from the page, not hard-coded)
+ want = [int(x) for x in re.findall(r"\d+", f["pillFill"])[:3]]
+ px = f["pillPixels"]
+ off = max(abs(px[i + k] - want[k]) for i in range(0, len(px), 4) for k in range(3))
+ self.assertLessEqual(off, 16, "the tag's pill keeps its fill %s next to the footer: %s" % (f["pillFill"], px))
+ self.assertEqual(f["warnings"], [])
+
+ def test_footer_holes_fade_the_floor_and_follow_reveal(self):
+ for theme, key in (("light", "foot"), ("dark", "footDark")):
+ with self.subTest(theme=theme):
+ self._holes(self.r[key])
+
+ def _holes(self, f):
+ for k in ("keptL", "keptRBefore", "keptRAfter"):
+ self.assertGreater(f[k]["plate"], 0, "%s: no plate under the footer to measure (%s)" % (k, f[k]))
+ self.assertLess(f["keptL"]["kept"], 0.2, f["keptL"]) # the hole is where the footer is
+ # not cut before its footer appears (the masked layer may differ by a few levels of raster noise, not a hole)
+ self.assertGreater(f["keptRBefore"]["kept"], 0.99, f["keptRBefore"])
+ self.assertLess(f["keptRAfter"]["kept"], 0.2, f["keptRAfter"]) # cut once it is on screen
+
+ def test_same_t_same_stage_on_the_examples(self):
+ for k in ("enterSame", "marketSame"):
+ self.assertEqual(self.r[k]["bad"], [], "%s: different stage at %s after reseeking" % (k, self.r[k]["bad"]))
+ self.assertEqual(self.r[k]["n"], 24)
+
+ def test_both_themes_render(self):
+ lt, dk = self.r["light"], self.r["dark"]
+ self.assertEqual((lt["theme"], dk["theme"]), ("light", "dark"))
+ self.assertGreater(lt["parts"], 25)
+ self.assertGreater(dk["parts"], 25)
+ self.assertGreaterEqual(lt["labels"], 1)
+ lum = lambda c: sum(int(x) for x in re.findall(r"\d+", c)[:3]) / 3 # noqa: E731
+ self.assertGreater(lum(lt["ground"]), 200)
+ self.assertLess(lum(dk["ground"]), 60)
+
+
+if __name__ == "__main__":
+ argv = [a for a in sys.argv if a != "--fast"]
+ unittest.main(argv=argv, verbosity=2 if "-v" in argv else 1)
diff --git a/skills/showtime/tests/test_interactive.py b/skills/showtime/tests/test_interactive.py
new file mode 100644
index 0000000..b5c9f0b
--- /dev/null
+++ b/skills/showtime/tests/test_interactive.py
@@ -0,0 +1,864 @@
+#!/usr/bin/env python3
+"""Interactive living diagrams: Diagram.live (set / fire / focus / hit), the white theme, the engine fixes the live
+figure needed, runtime/figure.js, `showtime export html --interactive` and check's walk through a figure's states.
+
+ * film untouched: the film frames of the template (light, dark) and the examples are the ones the engine drew
+ before live mode existed. tests/fixtures/diagram/film-frames.json is made by tests/fixtures/diagram/film-frames.sh
+ <rev> from the diagram engine of that older revision (it checks the revision out in a temporary git worktree and
+ draws today's template and examples with its runtime); the world drawing only (labels and tags depend on measured
+ text, so they are compared within one browser elsewhere)
+ * engine fixes, each with a test that fails on the old code: a stack shrinks when its count goes down; flow dashes
+ on a link of their own colour show
+ * live API: set (store level, stack count, tag text), fire (pulse, token route), focus (the veil on one part and
+ its own wires), hit (the part under a point); film mode is unchanged by an idle live mount
+ * the figure page, export --interactive and check: see the classes below
+
+Stdlib only. usage: python tests/test_interactive.py [--fast] [-v] [--write-golden [--engine-from SKILL_DIR]]
+ --fast skip everything that needs a browser
+ --write-golden rewrite the film-frames fixture (film-frames.sh calls it with --engine-from)
+ --engine-from draw the frames with the runtime of this skill folder (an older checkout)
+"""
+from __future__ import annotations
+
+import _isolate # noqa: F401 (run from a scratch folder: never write into the repository)
+
+import json
+import shutil
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+TESTS_DIR = Path(__file__).resolve().parent
+SKILL = TESTS_DIR.parent
+LAUNCHER = SKILL / "lib" / "st" / "launcher.py"
+RUNTIME = SKILL / "runtime"
+GOLDEN = TESTS_DIR / "fixtures" / "diagram" / "film-frames.json"
+sys.path.insert(0, str(SKILL / "lib"))
+
+from st.launcher import build_env, showtime_home # noqa: E402
+
+FAST = "--fast" in sys.argv
+WRITE_GOLDEN = "--write-golden" in sys.argv
+ENGINE_FROM = None
+if "--engine-from" in sys.argv:
+ i = sys.argv.index("--engine-from")
+ ENGINE_FROM = Path(sys.argv[i + 1]).resolve()
+ del sys.argv[i:i + 2]
+for flag in ("--fast", "--write-golden"):
+ if flag in sys.argv:
+ sys.argv.remove(flag)
+ENV = build_env(showtime_home())
+NODE = shutil.which("node", path=ENV.get("PATH"))
+TMP = Path(tempfile.mkdtemp(prefix="st-interactive-"))
+
+
+def showtime(*args, check=True, timeout=300):
+ cp = subprocess.run([sys.executable, str(LAUNCHER)] + [str(a) for a in args], env=ENV,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8",
+ errors="replace", timeout=timeout)
+ if check and cp.returncode != 0:
+ raise AssertionError("showtime %s failed (rc=%d):\n%s\n%s" % (
+ " ".join(map(str, args)), cp.returncode, cp.stdout[-3000:], cp.stderr[-3000:]))
+ return cp
+
+
+def run_driver(src: str, *args, timeout=600, skill: Path = SKILL) -> dict:
+ drv = TMP / ("drv-%d.mjs" % abs(hash(src)))
+ drv.write_text(src, encoding="utf-8")
+ # the showtime server inside a driver serves /_st/ from SHOWTIME_SKILL first: it must be the skill folder the
+ # driver is run for (an older checkout with --engine-from), never the launcher's own
+ cp = subprocess.run([NODE, str(drv), str(skill)] + [str(a) for a in args], env=dict(ENV, SHOWTIME_SKILL=str(skill)), stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, encoding="utf-8", errors="replace", timeout=timeout)
+ assert cp.returncode == 0, cp.stderr[-3000:] + cp.stdout[-2000:]
+ return json.loads(cp.stdout.strip().splitlines()[-1])
+
+
+# the film's world drawing at 30 times per project: the plate, parts, pipes, flows, packets, veil and camera
+FILM_DRIVER = r"""
+import fs from 'node:fs';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, ...DIRS] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer } = await imp('server.mjs');
+const { openBrowser, openStage } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const out = { frames: {} };
+try {
+ for (const dir of DIRS) {
+ const srv = await startServer({ root: dir });
+ // the engine drawing these frames is the one in SKILL (the old checkout when rebuilding the baseline)
+ const served = await (await fetch(srv.url + '/_st/diagram.js')).text();
+ out.served = (out.served !== false) && served === fs.readFileSync(path.join(SKILL, 'runtime', 'diagram.js'), 'utf8');
+ const cfg = JSON.parse(fs.readFileSync(path.join(dir, 'showtime.json'), 'utf8'));
+ const sess = await openStage(browser, { url: srv.url, config: cfg });
+ const dur = await sess.page.evaluate(() => window.ST.duration || 20);
+ const frames = {};
+ for (let i = 0; i < 30; i++) {
+ const t = Math.round((0.3 + i * (dur - 0.6) / 29) * 1000) / 1000;
+ frames[t.toFixed(3)] = await sess.page.evaluate(async (x) => {
+ await window.ST.seek(x);
+ const q = (s) => { const e = document.querySelector('#ld ' + s); return e ? e.innerHTML : ''; };
+ const s = document.querySelector('#ld #ld-world').getAttribute('transform') + '|' + q('#ld-floor') + '|' + q('#ld-draw') + '|' + q('#ld-bands');
+ let h = 0x811c9dc5; for (let k = 0; k < s.length; k++) { h ^= s.charCodeAt(k); h = Math.imul(h, 0x01000193) >>> 0; }
+ return h.toString(16) + ':' + s.length;
+ }, t);
+ }
+ out.frames[path.basename(dir)] = frames;
+ await sess.close(); await srv.close?.();
+ }
+} finally { await browser.close(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
+def film_projects() -> list:
+ out = []
+ for name, extra in (("light", ()), ("dark", ("--theme", "dark")), ("enter", ("--example", "enter")),
+ ("market", ("--example", "market"))):
+ d = TMP / ("film-" + name)
+ if not d.exists():
+ showtime("new", "diagram", d, *extra)
+ out.append(d)
+ return out
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestFilmUntouched(unittest.TestCase):
+ def test_a_planted_engine_change_changes_the_frames(self):
+ """The rebuild recipe can see a difference: an engine copy with one extra element drawn differs everywhere."""
+ mut = TMP / "mutant-skill"
+ if not mut.exists():
+ mut.mkdir()
+ for e in SKILL.iterdir():
+ if e.name != "runtime":
+ (mut / e.name).symlink_to(e)
+ # the runtime is copied, not linked: the server refuses a file whose real path leaves its folder
+ shutil.copytree(SKILL / "runtime", mut / "runtime")
+ src = (SKILL / "runtime" / "diagram.js").read_text(encoding="utf-8")
+ a = "gDraw.innerHTML = shadows + body + toks + top;"
+ self.assertEqual(src.count(a), 1)
+ (mut / "runtime" / "diagram.js").write_text(src.replace(a, "gDraw.innerHTML = '<g data-planted=\"1\"></g>' + shadows + body + toks + top;"), encoding="utf-8")
+ res = run_driver(FILM_DRIVER, *film_projects()[:1], skill=mut)
+ self.assertTrue(res["served"], "the server must serve the mutant's runtime")
+ want = json.loads(GOLDEN.read_text(encoding="utf-8"))["film-light"]
+ got = res["frames"]["film-light"]
+ self.assertEqual([t for t in want if got.get(t) == want[t]], [], "every frame should differ from the baseline")
+
+ def test_film_frames_match_the_engine_before_live_mode(self):
+ # the server inside the driver serves /_st/ from the skill folder the driver imports it from: --engine-from
+ # draws with that checkout's runtime (an older diagram.js), today's template and examples
+ res = run_driver(FILM_DRIVER, *film_projects(), skill=ENGINE_FROM or SKILL)
+ self.assertTrue(res["served"], "the frames must be drawn by the engine in %s" % (ENGINE_FROM or SKILL))
+ got = res["frames"]
+ if WRITE_GOLDEN:
+ GOLDEN.parent.mkdir(parents=True, exist_ok=True)
+ GOLDEN.write_text(json.dumps(got, indent=1, sort_keys=True) + "\n", encoding="utf-8")
+ self.skipTest("wrote %s" % GOLDEN)
+ want = json.loads(GOLDEN.read_text(encoding="utf-8"))
+ self.assertEqual(sorted(got), sorted(want))
+ for name in want:
+ bad = [t for t in want[name] if got[name].get(t) != want[name][t]]
+ self.assertEqual(bad, [], "%s: the film's world drawing changed at t = %s" % (name, ", ".join(bad[:6])))
+
+
+# the engine on its own, in the template's page: fixes and the live API (each live call is checked against the same
+# keys written into a film spec: a live figure draws exactly what a film with those keys would)
+ENGINE_DRIVER = r"""
+import fs from 'node:fs';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, DIR] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer } = await imp('server.mjs');
+const { openBrowser, openStage } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const out = {};
+try {
+ const srv = await startServer({ root: DIR });
+ const cfg = JSON.parse(fs.readFileSync(path.join(DIR, 'showtime.json'), 'utf8'));
+ const sess = await openStage(browser, { url: srv.url, config: cfg });
+ const page = sess.page;
+ const logs = []; page.on('console', (m) => logs.push(m.text()));
+ Object.assign(out, await page.evaluate(async () => {
+ let n = 0;
+ const host = () => { const h = document.createElement('div'); h.id = 'ld-t' + (++n); h.style.cssText = 'position:absolute;left:0;top:0;width:1920px;height:1080px;visibility:hidden'; document.body.appendChild(h); return h; };
+ const W = { world: { scale: 10, origin: [960, 400] }, avoid: '#none' };
+ const film = (spec) => { const h = host(); return { h, api: Diagram.mount(Object.assign({}, W, spec), { host: h }) }; };
+ const live = (spec) => { const h = host(); return { h, api: Diagram.live(Object.assign({}, W, spec), { host: h }) }; };
+ const draw = (m, t) => { m.api.render(t); return m.h.querySelector('#ld-draw').innerHTML; };
+ const r = {};
+ // 1. a stack whose count goes down loses cells (the old engine kept every cell it had ever shown)
+ const st = film({ items: [{ id: 's', part: 'stack', at: [0, 0, 0], size: [4, 4], max: 8, count: [[0, 2], [1, 6], [2, 3]] }] });
+ const polys = (t) => (draw(st, t).match(/<polygon/g) || []).length;
+ r.stack = { at05: polys(0.5), at18: polys(1.8), at25: polys(2.5) };
+ // 2. flow dashes over a link of their own colour: they show as travelling gaps in the pipe body colour
+ const fl = film({ items: [{ id: 'a', part: 'box', at: [0, 0, 0], size: [4, 4, 4] }, { id: 'b', part: 'box', at: [30, 0, 0], size: [4, 4, 4] },
+ { id: 'w', kind: 'link', from: 'a.x+', to: 'b.x-', w: 3, tone: 'cold', build: [-1, 0.01] }],
+ flows: [{ at: 0, speed: 60, spacing: 30, dash: 12, path: [{ pipe: 'w' }] }] });
+ const svg = draw(fl, 3);
+ const stroke = (svg.match(/<path d="[^"]*" fill="none" stroke="(#[0-9A-Fa-f]{6})"/) || [])[1];
+ const fills = [...svg.matchAll(/<rect [^>]*fill="(#[0-9A-Fa-f]{6})"/g)].map((m) => m[1]);
+ r.dash = { stroke, fills: [...new Set(fills)], n: fills.length, body: Diagram.themes.light.pipe.body };
+ // 3. live keys draw what the same keys in a film spec draw
+ const base = () => ({ items: [{ id: 'p', part: 'plate', at: [-5, -5, -1], size: [40, 40, 1], build: -1, lift: 0 },
+ { id: 'a', part: 'box', at: [0, 0, 0], size: [5, 5, 5], build: -1 }, { id: 'tray', part: 'store', at: [10, 0, 0], size: [8, 6, 4], tone: 'hot', fill: 0.5, build: -1 },
+ { id: 'stk', part: 'stack', at: [22, 0, 0], size: [4, 4], max: 8, count: [[-1, 3]], build: -1 },
+ { id: 'w', kind: 'link', from: 'a.x+', to: 'tray.x-', w: 3, tone: 'mute', build: [-1, 0.01] }],
+ tokens: [{ id: 'k', tone: 'hot', r: 1.2, moves: [] }] });
+ const L = live(base());
+ L.api.set('tray', 0.9, { at: 1, dur: 0.5 }); L.api.set('stk', 6, { at: 1.2 }); L.api.set('stk', 2, { at: 3 });
+ L.api.fire('a', { at: 1.5, tone: 'hot', dur: 0.8 });
+ L.api.fire('k', { at: 2, moves: [{ at: 0, dur: 0.01, to: 'a.top' }, { at: 0.1, dur: 0.8, along: 'w' }], stay: 0.4 });
+ L.api.focus('a', { at: 4 });
+ // the same keys written into a film spec
+ const F2 = film(Object.assign(base(), {
+ items: base().items.map((it) => it.id === 'tray' ? Object.assign({}, it, { fill: [[1, 0.5], [1.5, 0.9]] }) : it.id === 'stk' ? Object.assign({}, it, { count: [[-1, 3], [1.2, 6], [3, 2]] }) : it),
+ states: [{ target: 'a', at: 1.5, tone: 'hot', dur: 0.8, pulse: true }],
+ tokens: [{ id: 'k', tone: 'hot', r: 1.2, moves: [{ at: 2, dur: 0.01, to: 'a.top' }, { at: 2.1, dur: 0.8, along: 'w' }], until: 2.1 + 0.8 + 0.4 }],
+ focus: [{ part: 'a', with: ['w'], at: 4, dur: 0.15, out: 0.15 }] }));
+ r.same = [0.5, 1.2, 1.4, 1.9, 2.5, 3.1, 3.6, 4.1, 5].map((t) => ({ t, ok: draw(L, t) === draw(F2, t) }));
+ r.incident = L.api.incident('a');
+ // 4. live tags: a new value, its tone, then hidden
+ const T = live({ items: [{ id: 'a', part: 'box', at: [0, 0, 0], size: [5, 5, 5], build: -1 }], tags: [{ id: 'v', for: 'a', text: 'name', at: -1, tone: 'mute' }] });
+ await T.api.ready;
+ const tagAt = (t) => { T.api.render(t); const g = T.h.querySelector('[data-ld-tag]'); const vis = [...g.querySelectorAll('text')].filter((e) => e.getAttribute('visibility') === 'visible').map((e) => e.textContent);
+ return { vis, shown: g.getAttribute('visibility'), pill: g.querySelector('rect').getAttribute('fill') }; };
+ r.tag0 = tagAt(0.5);
+ T.api.set('v', 'up 1.3', { at: 1, tone: 'hot' });
+ r.tag1 = tagAt(1.6);
+ T.api.set('v', null, { at: 2 });
+ r.tag2 = tagAt(2.6);
+ T.api.set('v', 'back', { at: 3 });
+ r.tag3 = tagAt(3.6);
+ r.hotTag = Diagram.themes.light.tones.hot.tag;
+ // 5. hit: the topmost part under a point; nothing on the empty ground
+ const H = live({ items: [{ id: 'back', part: 'box', at: [0, 0, 0], size: [6, 6, 6], build: -1 }, { id: 'front', part: 'box', at: [6, 6, 0], size: [6, 6, 6], build: -1 }] });
+ const c = (id) => { const b = H.api.box(id, 1); return [b.x + b.w / 2, b.y + b.h / 2]; };
+ const cb = c('back'), cf = c('front');
+ r.hit = { back: H.api.hit(cb[0], cb[1] - 20, 1), front: H.api.hit(cf[0], cf[1], 1), none: H.api.hit(20, 20, 1) };
+ // 6. an idle live mount of the template draws the film's frames
+ const A = film(window.SCENE), B = live(window.SCENE);
+ r.idle = [1, 4.5, 9, 13.5, 18].map((t) => draw(A, t) === draw(B, t));
+ // 7. the white theme
+ const Wt = { h: host() }; Wt.api = Diagram.mount(Object.assign({}, W, { items: [{ id: 'a', part: 'box', at: [0, 0, 0], size: [5, 5, 5], build: -1 }] }), { host: Wt.h, theme: 'white' });
+ r.white = { name: Wt.api.report.theme, ground: Diagram.themes.white.ground, top: draw(Wt, 1).indexOf(Diagram.themes.white.faces.top) >= 0 };
+ return r;
+ }));
+ out.warnings = logs.filter((l) => /\[showtime\] diagram: (set|fire|focus)/.test(l));
+ await sess.close(); await srv.close?.();
+} finally { await browser.close(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestEngine(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ d = TMP / "engine"
+ showtime("new", "diagram", d)
+ cls.r = run_driver(ENGINE_DRIVER, d)
+
+ def test_stack_shrinks_when_its_count_goes_down(self):
+ s = self.r["stack"]
+ per = (s["at18"] - s["at05"]) / 4.0 # count 2 -> 6: four cells
+ self.assertGreater(per, 0)
+ self.assertEqual(s["at25"], s["at05"] + per, "count 3 at t=2.5 should draw one cell more than count 2: %s" % s)
+
+ def test_dashes_show_on_a_link_of_their_colour(self):
+ d = self.r["dash"]
+ self.assertGreater(d["n"], 2, d)
+ self.assertNotIn(d["stroke"], d["fills"], "every dash is the link's own colour: invisible (%s)" % d)
+ self.assertEqual(d["fills"], [d["body"]], d)
+
+ def test_live_keys_draw_what_film_keys_draw(self):
+ bad = [x["t"] for x in self.r["same"] if not x["ok"]]
+ self.assertEqual(bad, [], "set/fire/focus differ from the same keys in a film spec at t = %s" % bad)
+ self.assertEqual(self.r["incident"], ["w"])
+
+ def test_live_tag_values_tone_and_hiding(self):
+ self.assertEqual(self.r["tag0"]["vis"], ["name"])
+ self.assertEqual(self.r["tag1"]["vis"], ["up 1.3"])
+ self.assertEqual(self.r["tag1"]["pill"], self.r["hotTag"], "the value's tone colours the pill")
+ self.assertEqual(self.r["tag2"]["shown"], "hidden")
+ self.assertEqual(self.r["tag3"]["vis"], ["back"])
+ self.assertEqual(self.r["tag3"]["shown"], "visible")
+
+ def test_hit_finds_the_topmost_part(self):
+ self.assertEqual(self.r["hit"], {"back": "back", "front": "front", "none": None})
+
+ def test_an_idle_live_mount_draws_the_film(self):
+ self.assertEqual(self.r["idle"], [True] * 5)
+
+ def test_white_theme(self):
+ w = self.r["white"]
+ self.assertEqual(w["name"], "white")
+ self.assertEqual(w["ground"], "#FFFFFF")
+ self.assertTrue(w["top"])
+ self.assertEqual(self.r["warnings"], [])
+
+
+# the live page (figure.html through the showtime server) and the film a live scene makes of its tour
+FIGURE_DRIVER = r"""
+import fs from 'node:fs';
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, ECON, HEAT, ENTER] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer, injectStage } = await imp('server.mjs');
+const { openBrowser, openStage } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const wait = (ms) => new Promise((r) => setTimeout(r, ms));
+// every positive check waits on the page's state (never on a fixed delay); the few negative ones ("nothing
+// happens") wait a short bounded time after the state that would have made something happen
+const until = (page, fn, arg) => page.waitForFunction(fn, arg, { timeout: 30000, polling: 50 });
+const out = { errors: [] };
+const srv = await startServer({ root: ECON }), heat = await startServer({ root: HEAT }), ent = await startServer({ root: ENTER });
+const open = async (url, opts = {}, tourAfter = 60000) => {
+ const ctx = await browser.newContext(Object.assign({ viewport: { width: 1440, height: 900 } }, opts));
+ await ctx.addInitScript((ms) => { window.SHOWTIME_TEST_TOUR_AFTER = ms; }, tourAfter);
+ const page = await ctx.newPage();
+ page.on('pageerror', (e) => out.errors.push(String(e.message || e)));
+ await page.goto(url);
+ await until(page, () => window.Figure && Figure.current && Figure.current.api);
+ await page.evaluate(() => Figure.current.api.ready);
+ await until(page, () => Figure.current.cost.n >= 1); // drawn at least once (reduced motion draws only on change)
+ return { ctx, page };
+};
+const ro = (page) => page.evaluate(() => [...document.querySelectorAll('.fg-ro .ro')].map((e) => e.querySelector('.k').textContent + ' ' + e.querySelector('.v').textContent));
+const board = (page) => page.evaluate(() => [...document.querySelectorAll('.fg-ld [data-ld-tag]')].filter((g) => g.getAttribute('visibility') === 'visible')
+ .map((g) => [...g.querySelectorAll('text')].filter((t) => t.getAttribute('visibility') === 'visible').map((t) => t.textContent).join('')));
+const roHas = (page, s) => until(page, (x) => [...document.querySelectorAll('.fg-ro .ro')].some((e) => (e.querySelector('.k').textContent + ' ' + e.querySelector('.v').textContent) === x), s);
+const boardHas = (page, s) => until(page, (x) => [...document.querySelectorAll('.fg-ld [data-ld-tag]')].filter((g) => g.getAttribute('visibility') === 'visible' && +g.getAttribute('opacity') > 0.9)
+ .some((g) => [...g.querySelectorAll('text')].some((t) => t.getAttribute('visibility') === 'visible' && t.textContent.indexOf(x) >= 0)), s);
+try {
+ // 1. desktop: live from the first frame, the tour, steps, the knob, hover, keys, the pointer
+ { const { ctx, page } = await open(srv.url + '/figure.html', {}, 400);
+ out.title = await page.evaluate(() => document.title);
+ out.stage = await page.evaluate(() => !!window.ST);
+ await page.evaluate(() => { window.__d0 = document.querySelector('.fg-ld #ld-draw').innerHTML; window.__n0 = Figure.current.cost.n; });
+ await until(page, () => Figure.current.cost.n > window.__n0 + 5 && document.querySelector('.fg-ld #ld-draw').innerHTML !== window.__d0);
+ out.moving = true;
+ await until(page, () => Figure.current.tour()); out.tourOn = await page.isVisible('.fg-tour');
+ await page.mouse.move(700, 300); await page.mouse.move(705, 305);
+ await until(page, () => !Figure.current.tour()); out.tourAfterTouch = await page.isVisible('.fg-tour');
+ await page.keyboard.press('3'); await roHas(page, 'Inflation +1.28'); out.cost15 = await ro(page);
+ await page.click('.seg button:nth-child(3)'); await roHas(page, 'Inflation +0.84'); await boardHas(page, '(was +1.28)');
+ out.cost3 = await ro(page); out.board3 = await board(page); out.hash3 = await page.evaluate(() => location.hash);
+ await page.focus('.fg-part[data-part="infl"]');
+ await until(page, () => Figure.current.S.hover === 'infl' && !document.querySelector('.fg-card').hidden && document.querySelector('.fg-card .n').textContent === 'Inflation'
+ && /opacity="0\.6/.test(document.querySelector('.fg-ld #ld-draw').innerHTML));
+ out.hover = await page.evaluate(() => ({ hover: Figure.current.S.hover, card: !document.querySelector('.fg-card').hidden, name: document.querySelector('.fg-card .n').textContent,
+ value: document.querySelector('.fg-card .v').textContent, tone: document.querySelector('.fg-card .v').className, veil: true }));
+ await page.evaluate(() => document.activeElement.blur()); await page.keyboard.press('Escape');
+ await page.keyboard.press('ArrowRight'); await until(page, () => Figure.current.S.step === 3);
+ out.afterRight = await page.evaluate(() => Figure.current.S.step);
+ const p2 = await page.evaluate(() => {
+ const F = Figure.current, fig = document.querySelector('.fg-fig').getBoundingClientRect(), st = document.querySelector('.fg .ld-stage');
+ const m = /translate\(([-\d.]+)px,\s*([-\d.]+)px\) scale\(([\d.]+)\)/.exec(st.style.transform);
+ const k = +m[3], ox = +m[1], oy = +m[2], b = F.api.box('firm', 50);
+ return [fig.left + ox + (b.x + b.w / 2) * k, fig.top + oy + (b.y + b.h * 0.7) * k];
+ });
+ await page.mouse.move(p2[0], p2[1]); await page.mouse.move(p2[0] + 1, p2[1] + 1);
+ await until(page, () => Figure.current.S.hover === 'firm'); out.pointer = 'firm';
+ // hidden: the loop stops drawing
+ await page.evaluate(() => { Object.defineProperty(document, 'hidden', { configurable: true, get: () => true }); document.dispatchEvent(new Event('visibilitychange')); });
+ await wait(200); const h0 = await page.evaluate(() => Figure.current.cost.n); await wait(800);
+ out.hiddenFrames = (await page.evaluate(() => Figure.current.cost.n)) - h0;
+ await ctx.close(); }
+ // 2. a deep link opens a state
+ { const { ctx, page } = await open(srv.url + '/figure.html#step=puzzle&q=12&part=infl');
+ await roHas(page, 'Inflation today ×236.5');
+ out.deep = await page.evaluate(() => ({ step: Figure.current.S.step, q: Figure.current.state.q, pin: Figure.current.S.pin, hash: location.hash }));
+ out.deepRo = await ro(page);
+ await ctx.close(); }
+ // 3. reduced motion: no tour, still, input still works
+ { const { ctx, page } = await open(srv.url + '/figure.html', { reducedMotion: 'reduce' }, 200);
+ await wait(1200); out.rmTour = await page.isVisible('.fg-tour');
+ const a = await page.screenshot(); await wait(700); const b = await page.screenshot(); out.rmStill = a.equals(b);
+ await page.keyboard.press('2'); await roHas(page, 'Inflation +0.35'); out.rmRo = await ro(page);
+ await ctx.close(); }
+ // 4. phone: the words leave the drawing, chips in their own colours, nothing wider than the screen
+ { const { ctx, page } = await open(srv.url + '/figure.html#step=cost&rule=3', { viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
+ await until(page, () => [...document.querySelectorAll('.fg-board span')].some((s) => /was/.test(s.textContent)));
+ out.phone = await page.evaluate(() => ({ cls: document.documentElement.classList.contains('fg-phone'), wide: document.documentElement.scrollWidth, inner: innerWidth,
+ labels: [...document.querySelectorAll('.fg-ld [data-ld-label]')].map((e) => getComputedStyle(e).display),
+ chips: [...document.querySelectorAll('.fg-board span')].map((s) => [s.textContent, s.style.background]) }));
+ await ctx.close(); }
+ // 5. the walk: every state of the econ lab, the Enter teaser and the heat pump (no steps: its parts)
+ { const { ctx, page } = await open(srv.url + '/figure.html'); out.walk = await page.evaluate(() => Figure.current.walk()); await ctx.close(); }
+ { const { ctx, page } = await open(ent.url + '/figure.html'); out.walkEnter = await page.evaluate(() => Figure.current.walk());
+ // the permission check asks: A answers it
+ await page.evaluate(() => { Figure.current.setKnob('permission', 'ask'); Figure.current.enter(2); });
+ await page.keyboard.press('a'); await until(page, () => Figure.current.state.answer === 'yes');
+ out.enterAllow = await page.evaluate(() => [Figure.current.state.permission, Figure.current.state.answer]);
+ await ctx.close(); }
+ // a link cut after a % still opens the page (the bad pair is left out)
+ { const { ctx, page } = await open(ent.url + '/figure.html#step=gate&part=bogus%'); await until(page, () => Figure.current.S.step === 2);
+ out.badLink = await page.evaluate(() => ({ step: Figure.current.S.step, pin: Figure.current.S.pin, text: document.querySelector('.fg-step .t').textContent })); await ctx.close(); }
+ // Enter: the setting and the answer tell one story
+ { const { ctx, page } = await open(ent.url + '/figure.html#step=gate&permission=allow', { reducedMotion: 'reduce' });
+ const board = () => page.evaluate(() => [...document.querySelectorAll('.fg-ld [data-ld-tag]')].filter((g) => g.getAttribute('visibility') === 'visible')
+ .map((g) => [...g.querySelectorAll('text')].filter((t) => t.getAttribute('visibility') === 'visible').map((t) => t.textContent).join('')));
+ await until(page, () => Figure.current.S.step === 2);
+ out.enterAllow0 = { board: await board(), text: await page.evaluate(() => document.querySelector('.fg-step .t').textContent) };
+ const shows = (t) => until(page, (x) => [...document.querySelectorAll('.fg-ld [data-ld-tag]')].some((g) => g.getAttribute('visibility') === 'visible'
+ && [...g.querySelectorAll('text')].some((e) => e.getAttribute('visibility') === 'visible' && e.textContent === x)), t);
+ await page.click('.seg button:nth-child(2)'); await shows('asks you');
+ out.enterAsk = await board();
+ out.enterButtons = await page.evaluate(() => [...document.querySelectorAll('.fg-keybtns button')].map((b) => b.textContent));
+ await page.keyboard.press('d'); await shows('you said no');
+ out.enterButtonsAfter = await page.evaluate(() => [...document.querySelectorAll('.fg-keybtns button')].length);
+ out.enterNo = { board: await board(), text: await page.evaluate(() => document.querySelector('.fg-step .t').textContent) };
+ await ctx.close(); }
+ { const { ctx, page } = await open(heat.url + '/figure.html'); out.walkHeat = await page.evaluate(() => Figure.current.walk()); out.heatTitle = await page.evaluate(() => document.title); await ctx.close(); }
+ // 6. the film of the tour: the same t from different frames, and the tour's values on the board
+ { const cfg = JSON.parse(fs.readFileSync(path.join(ECON, 'showtime.json'), 'utf8'));
+ const sess = await openStage(browser, { url: srv.url, config: cfg });
+ const svgAt = (t) => sess.page.evaluate(async (x) => { await window.ST.seek(x); return document.querySelector('#ld svg').outerHTML; }, t);
+ const a = await svgAt(15.5); await svgAt(40); await svgAt(3); const b = await svgAt(15.5);
+ out.filmSame = a === b;
+ out.filmLen = await sess.page.evaluate(() => Diagram.current.filmLength);
+ out.filmLive = await sess.page.evaluate(() => typeof Figure.mount);
+ await svgAt(15.5);
+ out.filmBoard = await sess.page.evaluate(() => [...document.querySelectorAll('[data-ld-tag]')].filter((g) => g.getAttribute('visibility') === 'visible')
+ .map((g) => [...g.querySelectorAll('text')].filter((t) => t.getAttribute('visibility') === 'visible').map((t) => t.textContent).join('')));
+ await sess.close(); }
+ out.inject = { live: injectStage('<html data-st-live><head></head></html>').includes('stage.js'), film: injectStage('<html><head></head></html>').includes('stage.js') };
+} finally { await browser.close(); await srv.close?.(); await heat.close?.(); await ent.close?.(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
+def econ_project(name="econ") -> Path:
+ d = TMP / name
+ if not d.exists():
+ showtime("new", "diagram", d, "--example", "econ-lab", "--theme", "white")
+ return d
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestFigure(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ heat, enter = TMP / "heat", TMP / "enter"
+ showtime("new", "diagram", heat, "--theme", "white")
+ showtime("new", "diagram", enter, "--example", "enter", "--theme", "white")
+ cls.r = run_driver(FIGURE_DRIVER, econ_project(), heat, enter)
+
+ def test_no_page_errors_and_no_stage(self):
+ self.assertEqual(self.r["errors"], [])
+ self.assertFalse(self.r["stage"], "a live page gets no stage.js")
+ self.assertEqual(self.r["inject"], {"live": False, "film": True})
+
+ def test_title_comes_from_the_scene(self):
+ self.assertEqual(self.r["title"], "The lab with three equations")
+ self.assertEqual(self.r["heatTitle"], "How a heat pump moves heat")
+
+ def test_live_from_the_first_frame(self):
+ self.assertTrue(self.r["moving"], "the loop's flow moves the drawing with nothing touched")
+
+ def test_idle_tour_and_touch(self):
+ self.assertTrue(self.r["tourOn"], "the tour starts when nobody touches the figure")
+ self.assertFalse(self.r["tourAfterTouch"], "any input stops it")
+
+ def test_steps_and_the_rule_knob(self):
+ self.assertIn("Inflation +1.28", self.r["cost15"])
+ self.assertIn("Inflation +0.84", self.r["cost3"])
+ self.assertTrue(any("(was +1.28)" in t for t in self.r["board3"]), self.r["board3"])
+ self.assertIn("rule=3", self.r["hash3"])
+ self.assertIn("step=cost", self.r["hash3"])
+
+ def test_hover_card_and_veil(self):
+ h = self.r["hover"]
+ self.assertEqual(h["hover"], "infl")
+ self.assertTrue(h["card"])
+ self.assertEqual(h["name"], "Inflation")
+ self.assertIn("+0.84", h["value"])
+ self.assertIn("fg-tone-hot", h["tone"], "inflation's value is warm on the card")
+ self.assertTrue(h["veil"], "the focus veil is drawn over the other parts")
+
+ def test_keys_and_pointer(self):
+ self.assertEqual(self.r["afterRight"], 3, "ArrowRight goes to the next step")
+ self.assertEqual(self.r["pointer"], "firm", "the pointer over a part hovers it")
+
+ def test_a_cut_link_still_opens(self):
+ b = self.r["badLink"]
+ self.assertEqual((b["step"], b["pin"]), (2, ""), b)
+
+ def test_enter_settings_and_answers_agree(self):
+ a0 = self.r["enterAllow0"]
+ self.assertIn("allowed", a0["board"])
+ self.assertIn("Your settings allow it", a0["text"])
+ self.assertNotIn("you said yes", " ".join(a0["board"]), "nobody was asked")
+ self.assertIn("asks you", self.r["enterAsk"])
+ self.assertNotIn("Bash: running the tests", self.r["enterAsk"], "switching to ask undoes allow's run")
+ no = self.r["enterNo"]
+ self.assertIn("you said no", no["board"])
+ self.assertNotIn("Bash: running the tests", no["board"])
+ self.assertIn("you said no", no["text"])
+ self.assertEqual(self.r["enterButtons"], ["Allow (A)", "Deny (D)"], "a phone has no keys: the answers are buttons")
+ self.assertEqual(self.r["enterButtonsAfter"], 0, "once answered, the buttons go")
+
+ def test_hidden_page_draws_nothing(self):
+ self.assertEqual(self.r["hiddenFrames"], 0)
+
+ def test_deep_link(self):
+ d = self.r["deep"]
+ self.assertEqual((d["step"], d["q"], d["pin"]), (4, 12, "infl"))
+ self.assertIn("Inflation today ×236.5", self.r["deepRo"])
+
+ def test_reduced_motion(self):
+ self.assertFalse(self.r["rmTour"])
+ self.assertTrue(self.r["rmStill"], "under reduced motion the figure holds still")
+ self.assertIn("Inflation +0.35", self.r["rmRo"], "and input still works")
+
+ def test_phone(self):
+ p = self.r["phone"]
+ self.assertTrue(p["cls"])
+ self.assertEqual(p["wide"], p["inner"], "nothing wider than the screen")
+ self.assertEqual(set(p["labels"]), {"none"}, "labels leave the drawing on a phone")
+ self.assertTrue(p["chips"], "the board's words are chips under the figure")
+ self.assertTrue(all(bg for _, bg in p["chips"]), "each chip in its tag's colour: %s" % p["chips"])
+
+ def test_walk_finds_nothing_on_the_examples(self):
+ w = self.r["walk"]
+ self.assertGreaterEqual(w["states"], 60)
+ self.assertEqual(w["problems"], [])
+ self.assertGreaterEqual(self.r["walkEnter"]["states"], 50)
+ self.assertEqual(self.r["walkEnter"]["problems"], [])
+ self.assertEqual(self.r["enterAllow"], ["ask", "yes"], "A answers the check when it asks; the setting stays ask")
+ self.assertGreaterEqual(self.r["walkHeat"]["states"], 2)
+ self.assertEqual(self.r["walkHeat"]["problems"], [])
+
+ def test_the_film_of_the_tour(self):
+ self.assertTrue(self.r["filmSame"], "the same t from different frames draws the same film frame")
+ self.assertEqual(self.r["filmLive"], "undefined", "a film page loads figure-film.js only, never the live page")
+ self.assertAlmostEqual(self.r["filmLen"], 67.3, places=2)
+ self.assertTrue(any(t.startswith("↑ gap") for t in self.r["filmBoard"]), self.r["filmBoard"])
+
+
+# export --interactive: one offline file, the scene's title, no network, every state clean; check walks a figure
+FILE_DRIVER = r"""
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, FILE] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { openBrowser } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const out = { errors: [], requests: [] };
+try {
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
+ const page = await ctx.newPage();
+ page.on('pageerror', (e) => out.errors.push(String(e.message || e)));
+ page.on('console', (m) => { if (m.type() === 'error') out.errors.push(m.text()); });
+ page.on('request', (r) => { if (!/^(file|data|blob):/.test(r.url())) out.requests.push(r.url()); });
+ await page.goto(pathToFileURL(FILE).href + '#step=cost&rule=0.8');
+ await page.waitForFunction(() => window.Figure && Figure.current);
+ await page.evaluate(() => Figure.current.api.ready);
+ await new Promise((r) => setTimeout(r, 1500));
+ out.fonts = await page.evaluate(() => [...document.fonts].filter((f) => f.status === 'loaded').map((f) => f.family));
+ out.walk = await page.evaluate(() => Figure.current.walk());
+ await ctx.close();
+} finally { await browser.close(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestExportInteractive(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.econ = econ_project("econ-x")
+ cls.out = TMP / "econ-figure.html"
+ cp = showtime("export", "html", cls.econ, "--interactive", "-o", cls.out, "--json")
+ cls.report = json.loads(cp.stdout)
+ cls.html = cls.out.read_text(encoding="utf-8")
+ cls.r = run_driver(FILE_DRIVER, cls.out)
+
+ def test_one_offline_file(self):
+ self.assertTrue(self.report["interactive"])
+ self.assertLess(self.report["bytes"], 1000 * 1000, "a live figure stays under 1 MB")
+ self.assertIn('http-equiv="Content-Security-Policy"', self.html)
+ self.assertNotRegex(self.html, r'(?:src|href)="/_(?:st|lib)/', "every runtime file is inlined")
+ self.assertNotIn("/_st/stage.js", self.html)
+ self.assertEqual(self.r["requests"], [])
+ self.assertEqual(self.r["errors"], [])
+ self.assertEqual(set(self.r["fonts"]), {"Inter", "JetBrains Mono"})
+
+ def test_title_and_link_preview(self):
+ self.assertIn("<title>The lab with three equations</title>", self.html)
+ self.assertIn('property="og:title" content="The lab with three equations"', self.html)
+ self.assertIn('property="og:description"', self.html)
+
+ def test_every_state_clean_offline(self):
+ self.assertGreaterEqual(self.r["walk"]["states"], 60)
+ self.assertEqual(self.r["walk"]["problems"], [])
+
+ def test_export_runs_no_project_code(self):
+ """The export reads the scene's words; it never runs scene.js (project code only runs inside the browser)."""
+ d = TMP / "hostile"
+ showtime("new", "diagram", d, "--theme", "white")
+ m1, m2 = TMP / "pwned-require.txt", TMP / "pwned-process.txt"
+ with open(d / "scene.js", "a", encoding="utf-8") as f:
+ f.write("\ntry { require('fs').writeFileSync(%s, 'x'); } catch (e) {}\n"
+ "try { this.constructor.constructor('return process')().getBuiltinModule('fs').writeFileSync(%s, 'x'); } catch (e) {}\n"
+ % (json.dumps(str(m1)), json.dumps(str(m2))))
+ out = TMP / "hostile.html"
+ showtime("export", "html", d, "--interactive", "-o", out)
+ self.assertFalse(m1.exists())
+ self.assertFalse(m2.exists())
+ self.assertIn("<title>How a heat pump moves heat</title>", out.read_text(encoding="utf-8"))
+
+ def test_licence_notices(self):
+ head = self.html.split("-->", 1)[0]
+ self.assertIn("SIL Open Font License", head)
+ self.assertIn("@fontsource-variable/inter", head)
+ self.assertIn("@fontsource-variable/jetbrains-mono", head)
+ self.assertIn("MIT licensed", head)
+
+ def test_artifact_target_and_refusals(self):
+ out = TMP / "econ-artifact.html"
+ showtime("export", "html", self.econ, "--interactive", "--target", "artifact", "-o", out)
+ self.assertTrue(out.is_file())
+ cp = showtime("export", "html", self.econ, "--interactive", "--folder", "-o", TMP / "dir-out", check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("--interactive writes one file", cp.stderr + cp.stdout)
+ bare = TMP / "bare"
+ bare.mkdir(exist_ok=True)
+ (bare / "showtime.json").write_text('{"title": "x", "width": 1920, "height": 1080, "fps": 30, "duration": 5}', encoding="utf-8")
+ (bare / "index.html").write_text("<!doctype html><html><body>x</body></html>", encoding="utf-8")
+ cp = showtime("export", "html", bare, "--interactive", "-o", TMP / "bare.html", check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("no scene.js", cp.stderr + cp.stdout)
+
+
+# words that look like markup or replacement patterns stay words: in the live page and in the exported file
+EVIL_SCENE = r"""
+window.SCENE.labels[0].title = '</script><img src=x onerror="window.__pwned=1">';
+window.SCENE.tags = (window.SCENE.tags || []).concat([{ id: 'evil', for: 'compressor', text: '<img src=x onerror=window.__pwned=2>', at: -1 }]);
+window.SCENE.interactive.title = 'Evil </script><img src=x onerror=window.__pwned=3> $& $\' $1 title';
+window.SCENE.interactive.steps = [{ id: 's1', kicker: '<img src=x onerror=window.__pwned=4>', text: '</script><b>bold?</b>' }];
+window.SCENE.tags = window.SCENE.tags.concat([{ id: 'dbl', for: 'valve', text: 'a<!--<script>b', at: -1 }, { id: 'caps', for: 'outdoor', text: '</SCRIPT >x', at: -1 }]);
+"""
+EVIL_TITLE = "Evil </script><img src=x onerror=window.__pwned=3> $& $' $1 title"
+
+EVIL_DRIVER = r"""
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, DIR, FILE] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer } = await imp('server.mjs');
+const { openBrowser } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const srv = await startServer({ root: DIR });
+const out = {};
+const look = async (url) => {
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
+ const page = await ctx.newPage();
+ await page.goto(url);
+ await page.waitForFunction(() => window.Figure && Figure.current, null, { timeout: 30000 });
+ await page.evaluate(() => Figure.current.api.ready);
+ await page.waitForFunction(() => Figure.current.cost.n > 2, null, { timeout: 30000 });
+ const r = await page.evaluate(() => ({ pwned: window.__pwned || null, imgs: document.querySelectorAll('img').length, bold: document.querySelectorAll('.fg b').length,
+ title: document.title, h1: document.querySelector('.fg h1').textContent, kicker: document.querySelector('.fg-step .k').textContent,
+ texts: [...document.querySelectorAll('.fg-ld text')].map((t) => t.textContent) }));
+ await ctx.close();
+ return r;
+};
+try { out.live = await look(srv.url + '/figure.html'); out.file = await look(pathToFileURL(FILE).href); }
+finally { await browser.close(); await srv.close?.(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
+# scene code the escaping must leave working: a name that starts with "script" after a < (the minifier writes
+# `i<scriptSteps`), and comment openers inside strings
+CODE_SCENE = r"""
+var scriptSteps = 2; for (var i = 0; i < scriptSteps; i++) { window.__steps = i; }
+var Scripted = { n: 3 }; window.__cmp = 1 < Scripted.n;
+window.__cmt = 'a<!--<script>b' + "c<!--d" + `e<!--<SCRIPT>f`;
+"""
+
+CODE_DRIVER = r"""
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, FILE] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { openBrowser } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const out = { errors: [] };
+try {
+ const page = await (await browser.newContext()).newPage();
+ page.on('pageerror', (e) => out.errors.push(String(e.message || e)));
+ await page.goto(pathToFileURL(FILE).href);
+ await page.waitForFunction(() => window.Figure && Figure.current, null, { timeout: 30000 }).catch(() => {});
+ out.r = await page.evaluate(() => ({ figure: !!(window.Figure && Figure.current), steps: window.__steps, cmp: window.__cmp, cmt: window.__cmt, charset: document.characterSet }));
+} finally { await browser.close(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestExportKeepsCodeWorking(unittest.TestCase):
+ def test_script_names_and_comment_openers(self):
+ d = TMP / "code"
+ showtime("new", "diagram", d, "--theme", "white")
+ with open(d / "scene.js", "a", encoding="utf-8") as f:
+ f.write(CODE_SCENE)
+ out = TMP / "code-figure.html"
+ showtime("export", "html", d, "--interactive", "-o", out)
+ html = out.read_bytes()
+ self.assertLess(html.find(b'<meta charset="utf-8">'), 1024, "the charset sits in the first 1024 bytes")
+ r = run_driver(CODE_DRIVER, out)
+ self.assertEqual(r["errors"], [])
+ self.assertEqual(r["r"], {"figure": True, "steps": 1, "cmp": True, "cmt": "a<!--<script>bc<!--de<!--<SCRIPT>f", "charset": "UTF-8"})
+
+
+class TestSceneWords(unittest.TestCase):
+ """The export reads the scene's title as text: the interactive block's own keys, outside comments and strings."""
+ def words(self, src):
+ d = TMP / ("words-%d" % abs(hash(src)))
+ d.mkdir(exist_ok=True)
+ (d / "scene.js").write_text(src, encoding="utf-8")
+ cp = subprocess.run([NODE, "--input-type=module", "-e",
+ "import { sceneInfo } from %s; console.log(JSON.stringify(sceneInfo(%s)));" % (
+ json.dumps((SKILL / "scripts" / "lib" / "export" / "figure.mjs").as_uri()), json.dumps(str(d)))],
+ env=ENV, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")
+ self.assertEqual(cp.returncode, 0, cp.stderr)
+ return json.loads(cp.stdout)
+
+ @unittest.skipIf(not NODE, "no node")
+ def test_own_keys_only(self):
+ w = self.words("window.SCENE = { labels: [{ title: 'A label' }], interactive: { steps: [{ title: 'nested' }], sub: 'Sub' },"
+ " page: { title: 'The *page* title' } };")
+ self.assertEqual(w, {"title": "The page title", "description": "Sub"})
+
+ @unittest.skipIf(not NODE, "no node")
+ def test_comments_strings_and_escapes(self):
+ w = self.words("// interactive: { title: 'commented' }\nvar s = 'interactive: { title: \"in a string\" }';\n"
+ "window.SCENE = { interactive: { title: 'Real \\u2019s \\'quoted\\'', sub: 'a' + 'b' } };")
+ self.assertEqual(w["title"], "Real \u2019s 'quoted'")
+ self.assertEqual(w["description"], "", "a value built by code is not read")
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestEscaping(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ d = TMP / "evil"
+ showtime("new", "diagram", d, "--theme", "white")
+ with open(d / "scene.js", "a", encoding="utf-8") as f:
+ f.write(EVIL_SCENE)
+ cls.out = TMP / "evil-figure.html"
+ showtime("export", "html", d, "--interactive", "-o", cls.out, "--title", EVIL_TITLE)
+ cls.html = cls.out.read_text(encoding="utf-8")
+ cls.r = run_driver(EVIL_DRIVER, d, cls.out)
+
+ def test_markup_in_scene_words_stays_text(self):
+ for where in ("live", "file"):
+ r = self.r[where]
+ self.assertIsNone(r["pwned"], where)
+ self.assertEqual(r["imgs"], 0, where)
+ self.assertEqual(r["bold"], 0, where)
+ self.assertEqual(r["h1"], EVIL_TITLE, where)
+ self.assertEqual(r["kicker"], "<img src=x onerror=window.__pwned=4>", where)
+ self.assertIn('</script><img src=x onerror="window.__pwned=1">', r["texts"], where)
+ self.assertIn("<img src=x onerror=window.__pwned=2>", r["texts"], where)
+ self.assertIn("a<!--<script>b", r["texts"], "%s: a comment opener in a scene string keeps the page working" % where)
+ self.assertIn("</SCRIPT >x", r["texts"], "%s: the text keeps its own case" % where)
+
+ def test_exported_title_is_verbatim(self):
+ self.assertEqual(self.r["file"]["title"], EVIL_TITLE, "replacement patterns ($& $' $1) and markup stay text")
+ self.assertNotIn("<!--<script", self.html.split("-->", 1)[1], "no comment opener reaches the parser inside a script")
+ self.assertIn("$&amp; $'", self.html)
+ self.assertNotIn("</script><img", self.html, "scene text cannot close the script it is packed in")
+ self.assertNotIn("</script><b>", self.html)
+
+
+# the walk catches what it says it checks: planted faults at states only a full walk reaches
+PLANTED = r"""
+(function () {
+ var I = window.SCENE.interactive, r0 = I.readouts;
+ I.steps[1].id = 'loop'; // two steps share an id: a link to the second opens the first
+ I.readouts = function (s, st) { // a broken readout at one value inside the slider's range
+ var o = r0(s, st); if (st === 'puzzle' && s.q === 5) o.rows = o.rows.concat([{ k: 'planted', v: String(1 / 0), u: '' }]); return o;
+ };
+ I.keys = { z: function (fx, s, st) { if (st === 'cost') s.planted = true; } };
+ I.agree = function (s, st) { return s.planted ? ['planted contradiction after Z'] : []; };
+})();
+"""
+
+WALK_DRIVER = r"""
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+const [SKILL, DIR] = process.argv.slice(2);
+const imp = (p) => import(pathToFileURL(path.join(SKILL, 'scripts', p)).href);
+const { startServer } = await imp('server.mjs');
+const { openBrowser } = await imp('lib/stagehost.mjs');
+const { browser } = await openBrowser({ headless: true });
+const srv = await startServer({ root: DIR });
+let out = {};
+try {
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' });
+ const page = await ctx.newPage();
+ await page.goto(srv.url + '/figure.html');
+ await page.waitForFunction(() => window.Figure && Figure.current, null, { timeout: 30000 });
+ await page.evaluate(() => Figure.current.api.ready);
+ out = await page.evaluate(() => Figure.current.walk());
+} finally { await browser.close(); await srv.close?.(); }
+console.log(JSON.stringify(out));
+process.exit(0);
+"""
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestWalkCatches(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ d = TMP / "planted-walk"
+ showtime("new", "diagram", d, "--example", "econ-lab", "--theme", "white")
+ with open(d / "scene.js", "a", encoding="utf-8") as f:
+ f.write(PLANTED)
+ cls.r = run_driver(WALK_DRIVER, d)
+ cls.msgs = [(p["code"], p.get("where", ""), p["message"]) for p in cls.r["problems"]]
+
+ def test_duplicate_step_id_and_the_link_it_breaks(self):
+ self.assertTrue(any(c == "figure_link" and "share the id" in m for c, w, m in self.msgs), self.msgs)
+ self.assertTrue(any(c == "figure_link" and "opens another state" in m for c, w, m in self.msgs), self.msgs)
+
+ def test_every_value_of_a_short_range(self):
+ self.assertTrue(any(c == "figure_readout" and "q=5" in w for c, w, m in self.msgs), self.msgs)
+
+ def test_the_scenes_keys_and_its_story(self):
+ self.assertEqual(self.r["keys"], 1)
+ self.assertTrue(any(c == "figure_story" and "key Z" in w for c, w, m in self.msgs), self.msgs)
+
+
[email protected](FAST or not NODE, "--fast: no browser")
+class TestCheckWalk(unittest.TestCase):
+ def test_check_reports_a_figure_overlap(self):
+ d = TMP / "planted"
+ showtime("new", "diagram", d, "--theme", "white")
+ # two tags on the same spot of the same part: the walk sees them overlap in the figure's first state
+ with open(d / "scene.js", "a", encoding="utf-8") as f:
+ f.write("\nwindow.SCENE.tags = (window.SCENE.tags || []).concat([{ id: 'p1', for: 'compressor', text: 'PLANTED ONE', at: -1, off: [0, -60] },"
+ " { id: 'p2', for: 'compressor', text: 'PLANTED TWO', at: -1, off: [10, -56] }]);\n")
+ cp = showtime("check", d, "--json", check=False, timeout=900)
+ rep = json.loads(cp.stdout)
+ codes = [(f["code"], f["message"]) for f in rep["findings"] if f["code"].startswith("figure_")]
+ self.assertTrue(any(c == "figure_text_overlap" and "PLANTED" in m for c, m in codes), codes)
+ self.assertGreaterEqual(rep["figure"]["states"], 2)
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2 if "-v" in sys.argv else 1)
diff --git a/skills/showtime/tests/test_looks.py b/skills/showtime/tests/test_looks.py
index 2d698d4..3ce088c 100644
--- a/skills/showtime/tests/test_looks.py
+++ b/skills/showtime/tests/test_looks.py
@@ -463,6 +463,118 @@ class LooksTests(unittest.TestCase):
self.assertGreater(moved[3], 200, "the metaballs fallback does not move: %s" % moved)
self.assertEqual(moved[:3], [0, 0, 0], "a still fallback moved: %s" % moved)
+ def test_07b_a_page_that_opened_short_is_opened_again(self):
+ """A page whose components module failed to load while it opened (a reset connection on a busy machine)
+ draws none of its components, and every frame its worker captures is the bare page: the four looks
+ missing from frames 31-92, workers 2 and 3 of a 3-worker render (macOS Intel nightly, 12 Oct). Here the
+ components come from a server that fails marble.js for chosen page loads (counted by index.js requests):
+ * no reply, the 2nd and 3rd loads (the pages of workers 2 and 3) of a 3-worker render, no worker taking a
+ frame until every page is open (SHOWTIME_TEST_HOLD_START), so each captures its own lane: each page is opened again
+ (render.log says so), no frame is handed over, and the frames are those of a render where nothing failed;
+ * no reply, and HTTP 500, on the 1st load of a 1-worker render (its only page): the page is opened again;
+ * a 404 on the first page only (a failure the page's requests do not count, like a setup that threw): the
+ workers' pages differ from it, a second first page agrees with them, and the render fails with an error
+ instead of shipping the first page's bare frames."""
+ import http.server
+ import threading
+ hits, fail, lock = {"n": 0}, {}, threading.Lock() # n: page loads (requests of index.js); fail: {n: how}
+
+ class Flaky(http.server.SimpleHTTPRequestHandler):
+ def __init__(self, *a, **k):
+ super().__init__(*a, directory=str(RUNTIME), **k)
+
+ def log_message(self, *a):
+ pass
+
+ def guess_type(self, path):
+ # modules need a JavaScript type, whatever the OS's own table says (Windows reads it from the registry)
+ ext = str(path).rsplit(".", 1)[-1].lower()
+ return {"js": "text/javascript", "css": "text/css"}.get(ext) or super().guess_type(path)
+
+ def end_headers(self):
+ self.send_header("Access-Control-Allow-Origin", "*")
+ self.send_header("Cache-Control", "no-store")
+ super().end_headers()
+
+ def do_GET(self):
+ p = self.path.split("?")[0]
+ with lock:
+ if p == "/components/index.js":
+ hits["n"] += 1
+ how = fail.get(hits["n"]) if p == "/components/marble.js" else None
+ if how == "reset":
+ # no reply at all (the browser sees an empty response), to every request of marble.js while that
+ # page loads, so a request the browser makes again by itself fails too
+ self.close_connection = True
+ return
+ if how in (500, 404):
+ self.send_error(how)
+ return
+ super().do_GET()
+
+ srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Flaky)
+ threading.Thread(target=srv.serve_forever, daemon=True).start()
+ env = dict(ENV, SHOWTIME_TEST_HOLD_START="1")
+ try:
+ base = "http://127.0.0.1:%d" % srv.server_address[1]
+ html = page2(NO_WEBGL).replace("/_st/components/index.js", base + "/components/index.js")
+ proj = self.project("opened-short", html, dur=1)
+
+ def render(tag, workers, failing):
+ with lock:
+ hits["n"] = 0
+ fail.clear()
+ fail.update(failing)
+ out = self.tmp / ("short-" + tag) / "v.mp4"
+ cp = subprocess.run([sys.executable, str(LAUNCHER), "render", str(proj), "-o", str(out), "--workers", str(workers),
+ "--gpu", "off", "--format", "png", "--keep-frames", "--no-audio", "--poster", "none", "--quiet"],
+ env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", errors="replace", timeout=900)
+ skip_if_listen_refused(cp)
+ logs = list(out.parent.rglob("render.log"))
+ log = logs[0].read_text(encoding="utf-8", errors="replace") if logs else ""
+ files = sorted(p for p in (out.parent / "v.work" / "frames").glob("*.png")) if cp.returncode == 0 else []
+ return cp, log, files
+
+ cp, log, clean = render("clean", 1, {})
+ self.assertEqual(cp.returncode, 0, cp.stderr[-2000:])
+ self.assertEqual(len(clean), 30)
+ # the looks are drawn: the bare page is the ground (about 6 in grey) in every quadrant
+ q = self.gray(clean[20], 2, 2)
+ self.assertGreaterEqual(sum(v > 20 for v in q), 3, "the looks are not drawn (grey per quadrant: %s)" % q)
+ ref = [hashlib.sha256(p.read_bytes()).hexdigest() for p in clean]
+ for tag, workers, failing in (("w3", 3, {2: "reset", 3: "reset"}), ("w1", 1, {1: "reset"}), ("w1-500", 1, {1: 500})):
+ cp, log, files = render(tag, workers, failing)
+ self.assertEqual(cp.returncode, 0, "%s: %s" % (tag, cp.stderr[-2000:]))
+ got = [hashlib.sha256(p.read_bytes()).hexdigest() for p in files]
+ self.assertEqual(len(got), 30, tag)
+ diff = [i for i in range(30) if got[i] != ref[i]]
+ where = [(i, quad_diff(clean[i], files[i])) for i in diff[:3]]
+ self.assertEqual(diff, [], "%s: frames that differ from the render where nothing failed: %s; first "
+ "differences (frame, changed pixels per quadrant, largest change): %s" % (tag, diff[:12], where))
+ if workers == 3:
+ # a worker's page that lost marble.js was opened again (both, unless a slow browser let the second
+ # first page take one of the two failing loads), and each worker captured its own lane
+ reopened = sorted(set(re.findall(r"worker (\d): the page in worker \1 did not set up as the first page did", log)))
+ self.assertTrue(reopened, "%s: no worker's page was opened again:\n%s" % (tag, log[-3000:]))
+ self.assertNotIn("could not open the page", log)
+ self.assertRegex(log, r"capture: 3 worker\(s\), 1 part\(s\) each, 0 hand-over\(s\)", "%s: a lane was handed over" % tag)
+ else:
+ self.assertIn("first page: 1 request(s) failed while it opened", log, "%s:\n%s" % (tag, log[-3000:]))
+ # the first page is the one that opened short, and nothing in its requests says so: the render fails
+ cp, log, _ = render("first-404", 3, {1: 404})
+ self.assertNotEqual(cp.returncode, 0, "a render whose first page lost its components finished: %s" % log[-2000:])
+ # the error names the difference, and what it points to is there: the first page's own HTTP error in
+ # render.log, and its diagnostics
+ m = re.search(r"the first page did not set up as the pages opened after it did \((.*?)\), so its frames cannot be used", cp.stderr)
+ self.assertTrue(m, cp.stderr[-2000:])
+ self.assertIn("marble: ready", m.group(1))
+ self.assertIn('lines "first page: ..."', cp.stderr)
+ self.assertRegex(log, r"first page: http 404: http://127\.0\.0\.1:\d+/components/marble\.js")
+ self.assertTrue(list((self.tmp / "short-first-404").rglob("first-page.json")), "no first-page diagnostics")
+ finally:
+ srv.shutdown()
+ srv.server_close()
+
def test_08_newer_looks_fallbacks(self):
"""Without WebGL each newer look draws its fallback: check lists four, each quadrant is drawn (not flat) and
differs from the WebGL frame."""
diff --git a/skills/showtime/tests/test_motion.py b/skills/showtime/tests/test_motion.py
index c3e2eaa..f26408c 100644
--- a/skills/showtime/tests/test_motion.py
+++ b/skills/showtime/tests/test_motion.py
@@ -384,9 +384,17 @@ class MotionTests(unittest.TestCase):
self.assertAlmostEqual(max(c["t1"] for c in scenes), new, places=3, msg=name)
starts = sorted(c["t0"] for c in scenes)
else:
- cues = (proj / "cues.js").read_text(encoding="utf-8")
+ # a canvas film keeps its cue table in cues.js; a living diagram keeps it in scene.js: whichever
+ # top-level script holds `var CUE = {...}`, its duration is the new length and its beats are the
+ # times music sections may start on
+ tables = [p for p in sorted(proj.glob("*.js")) if re.search(r"\bvar CUE\s*=\s*\{", p.read_text(encoding="utf-8"))]
+ self.assertEqual(len(tables), 1, (name, [p.name for p in proj.glob("*.js")]))
+ cues = tables[0].read_text(encoding="utf-8")
self.assertRegex(cues, r"\n\s*duration: %s," % re.escape(("%g" % new)), name)
- starts = []
+ body = cues[cues.index("var CUE"):]
+ body = body[:body.index("\n};")]
+ beats = [float(v) for k, v in re.findall(r"^\s*(\w+):\s*([0-9.]+),", body, re.M) if k not in ("duration", "bpm", "cps")]
+ starts = [0.0] + beats # music sections start on CUE beats, whichever file holds the table
mix = proj / "audio" / "mix.json"
if mix.is_file():
spec = json.loads(mix.read_text(encoding="utf-8"))
@@ -395,7 +403,7 @@ class MotionTests(unittest.TestCase):
secs = (tr.get("compose") or {}).get("sections")
if secs:
times = [float(x.split(":")[0]) for x in secs.split(",")]
- for t in times: # every music section starts on a scene start
+ for t in times: # every music section starts on a scene start (or a CUE beat)
self.assertTrue(any(abs(t - s0) < 0.002 for s0 in starts), (name, new, secs, starts))
diff --git a/skills/showtime/tests/test_recap.py b/skills/showtime/tests/test_recap.py
new file mode 100644
index 0000000..feb31fb
--- /dev/null
+++ b/skills/showtime/tests/test_recap.py
@@ -0,0 +1,1317 @@
+#!/usr/bin/env python3
+"""`showtime recap` (lib/st/recap.py, cli_recap.py): a Claude Code session -> a short film of what the agent did.
+
+A synthetic transcript (tests/fixtures/recap: a session and a sub-agent; never a real one) holds planted private
+material: a key in the request, keys in tool output and in a command, a memory block in a system reminder, an
+attachment event, assistant thinking and prose, a file outside the repository, a .env file, a URL, an ssh host,
+an unknown event type and a broken line. The tests check the parser, the allow-list (none of the planted material
+reaches script.md, facts.json or any file of the project), the hard filter (keys and absolute paths, also when the
+user pastes them into script.md), commands as program + subcommand, test counts per runner, the diff stats from git,
+the script round trip, and the end to end (`--no-voice --preview`, qa PASS or WARN; skipped with --fast).
+
+usage: python tests/test_recap.py [--fast] [-v]
+"""
+from __future__ import annotations
+
+import _isolate # noqa: F401 (run from a scratch folder: never write into the repository)
+
+import json
+import re
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+from unittest import mock
+
+TESTS_DIR = Path(__file__).resolve().parent
+SKILL = TESTS_DIR.parent
+LAUNCHER = SKILL / "lib" / "st" / "launcher.py"
+FIX = TESTS_DIR / "fixtures" / "recap"
+sys.path.insert(0, str(SKILL / "lib"))
+
+from st import recap as rc # noqa: E402
+from st.common import ShowtimeError # noqa: E402
+from st.launcher import build_env, showtime_home # noqa: E402
+
+FAST = "--fast" in sys.argv
+ENV = build_env(showtime_home())
+PLACEHOLDER_ROOT = "/Users/me/code/acme"
+GH_TOKEN = "gh" + "p_0123456789abcdefghijABCDEFGHIJ012345" # a fake token, assembled at run time
+PLANTED = ("sk-test-notarealkey", "AKIAIOSFODNN7EXAMPLE", "ghp_0123456789", "Zorblax", "PRIVATE-MEMORY-NOTE",
+ "THINKING-SECRET", "ASSISTANT-PROSE-SECRET", "ci-runner-07", "/Users/me", "intranet.example.com",
+ "internal.example.com", "MEMORY.md", ".env", "missing.py", "1a59c906", "secret")
+
+
+def git(repo: Path, *args: str) -> str:
+ env = dict(os.environ, GIT_AUTHOR_NAME="T", GIT_AUTHOR_EMAIL="[email protected]", GIT_COMMITTER_NAME="T",
+ GIT_COMMITTER_EMAIL="[email protected]")
+ return subprocess.run(["git", "-C", str(repo)] + list(args), check=True, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, encoding="utf-8", env=env).stdout
+
+
+def make_repo(root: Path) -> tuple:
+ """A git repository with src/parser.py and a commit that changes it; (base sha, fix sha)."""
+ (root / "src").mkdir(parents=True)
+ (root / "tests").mkdir()
+ (root / "src" / "parser.py").write_text("def parse(s):\n return s.split()[0]\n", encoding="utf-8")
+ (root / "tests" / "test_parser.py").write_text("def test_x():\n pass\n", encoding="utf-8")
+ git(root, "init", "-q", "-b", "main")
+ git(root, "add", "-A")
+ git(root, "commit", "-q", "-m", "base")
+ base = git(root, "rev-parse", "HEAD").strip()
+ (root / "src" / "parser.py").write_text("def parse(s):\n parts = s.split()\n if not parts:\n"
+ " return ''\n return parts[0]\n", encoding="utf-8")
+ git(root, "commit", "-q", "-am", "Fix the parser on empty input")
+ fix = git(root, "rev-parse", "--short", "HEAD").strip()
+ return base, fix
+
+
+def fixture_copy(dest: Path, repo: Path, sha: str, *, sub: bool = False) -> Path:
+ """The fixture with its placeholder repository path (and commit hash) pointing at a real temporary repo."""
+ src = FIX / ("subagents/agent-a1.jsonl" if sub else "session.jsonl")
+ text = src.read_text(encoding="utf-8").replace(PLACEHOLDER_ROOT, str(repo)).replace("abc1234", sha)
+ text = text.replace("@@GITHUB_TOKEN@@", GH_TOKEN) # built here: the repository's secret scanner
+ if sub:
+ (dest / "subagents").mkdir(parents=True, exist_ok=True)
+ out = dest / "subagents" / "agent-a1.jsonl"
+ shutil.copy(FIX / "subagents" / "agent-a1.meta.json", dest / "subagents" / "agent-a1.meta.json")
+ else:
+ dest.mkdir(parents=True, exist_ok=True)
+ out = dest / "session.jsonl"
+ out.write_text(text, encoding="utf-8")
+ return out
+
+
+def showtime(*args, check=True, cwd=None, env=None):
+ cp = subprocess.run([sys.executable, str(LAUNCHER)] + [str(a) for a in args], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, encoding="utf-8", errors="replace", env=env or ENV, cwd=cwd,
+ timeout=900)
+ if check and cp.returncode != 0:
+ raise AssertionError("showtime %s failed (%d):\n%s\n%s" % (" ".join(map(str, args)), cp.returncode,
+ cp.stdout[-3000:], cp.stderr[-3000:]))
+ return cp
+
+
+def all_text(folder: Path) -> str:
+ out = []
+ for p in sorted(Path(folder).rglob("*")):
+ if p.is_file() and p.suffix in (".md", ".json", ".html", ".txt", ".srt", ".vtt", ".ass", ""):
+ out.append(p.read_text(encoding="utf-8", errors="replace"))
+ return "\n".join(out)
+
+
+class Base(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.tmp = Path(os.path.realpath(tempfile.mkdtemp(prefix="st-recap-")))
+ cls.repo = cls.tmp / "acme"
+ cls.base, cls.fix = make_repo(cls.repo)
+ cls.session = fixture_copy(cls.tmp / "t", cls.repo, cls.fix)
+ cls.sub = fixture_copy(cls.tmp / "t", cls.repo, cls.fix, sub=True)
+ cls.ses = rc.parse_session(cls.session)
+ cls.top, cls.roots = rc.repo_roots(cls.ses)
+ cls.facts = rc.collect(cls.ses, cls.top, cls.roots)
+
+ @classmethod
+ def tearDownClass(cls):
+ shutil.rmtree(cls.tmp, ignore_errors=True)
+
+
+class TestParser(Base):
+ def test_events_and_unknown_types(self):
+ s = self.ses
+ self.assertEqual(s["events"], 30) # 31 lines: the broken one is skipped, the unknown kept
+ self.assertEqual(len(s["uses"]), 12)
+ self.assertEqual(len(s["results"]), 12)
+ self.assertEqual(len(s["turns"]), 14) # message ids: one per assistant response
+ self.assertEqual(s["kind"], "session")
+ self.assertIn("Fix the flaky parser test", s["request"]) # the reminder block is not the request
+ self.assertGreater(s["end"], s["start"])
+
+ def test_sub_agent_and_its_description(self):
+ s = rc.parse_session(self.sub)
+ self.assertEqual(s["kind"], "sub-agent")
+ f = rc.collect(s, self.top, self.roots)
+ sugg = rc.suggestions_for(s)
+ self.assertIn(("the sub-agent's description", "Fix the parser flake"), sugg) # a suggestion only
+ self.assertNotIn("parser flake", json.dumps(f))
+ lines = rc.script_lines(f)
+ self.assertEqual(lines["hook.title"]["text"], rc.facts_title(f))
+ self.assertNotIn("parser flake", json.dumps(lines))
+ md = rc.write_script(lines, f["ref"], sugg)
+ self.assertIn("# show hook.title: Fix the parser flake", md)
+ _ref, back = rc.read_script(md)
+ self.assertEqual(back["hook.title"]["text"], rc.facts_title(f)) # commented: not used
+ _ref, back = rc.read_script(md.replace("# show hook.title: Fix", "show hook.title: Fix"))
+ self.assertEqual(back["hook.title"]["text"], "Fix the parser flake") # uncommented: used
+ # N-g: two hook.title lines become one, in the first one's place
+ self.assertEqual(sum(1 for k in back if k == "hook.title"), 1)
+ self.assertEqual([k for k in back if back[k]["scene"] == "hook"][:2], ["hook.kicker", "hook.title"])
+
+ def test_tolerates_any_line(self):
+ p = self.tmp / "odd.jsonl"
+ p.write_text('[1,2]\n"x"\n{"type": "assistant", "message": "not a dict"}\n'
+ '{"type": "user", "message": {"content": 5}}\n{"type": "assistant", "message": {"content": '
+ '[{"type": "tool_use", "name": "Bash", "input": "not a dict"}]}}\n', encoding="utf-8")
+ s = rc.parse_session(p)
+ self.assertEqual(len(s["uses"]), 1)
+ (self.tmp / "empty.jsonl").write_text("\n\nnot json\n", encoding="utf-8")
+ with self.assertRaises(ShowtimeError):
+ rc.parse_session(self.tmp / "empty.jsonl")
+
+
+class TestAllowList(Base):
+ def test_only_repo_files_relative(self):
+ f = self.facts
+ self.assertEqual([x["path"] for x in f["files"]], ["src/parser.py"])
+ self.assertEqual((f["files"][0]["read"], f["files"][0]["edited"]), (1, 1))
+ self.assertEqual(f["files_outside"], 2) # the memory file and the .env
+
+ def test_tools_and_commands(self):
+ f = self.facts
+ tools = dict(f["tools"])
+ self.assertEqual(tools["Bash"], 5)
+ self.assertEqual(tools["MCP tool"], 1) # never the server's or the tool's own name (RS9)
+ self.assertEqual(rc.tool_display("mcp__zorgcrm__lookup_zorgcorp_invoices"), "MCP tool")
+ self.assertEqual(rc.tool_display("ZorgCustomTool"), rc.OTHER)
+ self.assertEqual(rc.tool_display("Edit"), "Edit")
+ cmds = dict(f["commands"])
+ for want in ("python -m pytest", "tail", "curl", "jq", "ssh", "python3", "git add",
+ "git commit"):
+ self.assertIn(want, cmds)
+ self.assertNotIn("export", cmds)
+ self.assertNotIn("cd", cmds)
+
+ def test_tests_red_to_green(self):
+ t = self.facts["tests"]
+ self.assertEqual([(x["passed"], x["failed"], x["ok"]) for x in t],
+ [(11, 1, False), (12, 0, True), (12, 0, True)])
+ self.assertEqual(t[-1]["unit"], "test files")
+ st = rc.test_story(t)
+ self.assertTrue(st["red_to_green"])
+ self.assertEqual(st["red"], 1)
+
+ def test_diff_from_the_commit_it_made(self):
+ d = self.facts["diff"]
+ self.assertEqual(self.facts["commits"], 1)
+ self.assertEqual((d["source"], d["files"], d["additions"], d["deletions"]), ("commits", 1, 4, 1))
+ self.assertEqual(d["per_file"], {"src/parser.py": [4, 1]})
+
+ def test_diff_since(self):
+ f = rc.collect(self.ses, self.top, self.roots, since=self.base)
+ self.assertEqual((f["diff"]["source"], f["diff"]["additions"]), ("since", 4))
+ with self.assertRaises(ShowtimeError):
+ rc.collect(self.ses, self.top, self.roots, since="no-such-ref")
+
+ def test_request_without_paths_keys_or_urls(self):
+ r = dict(rc.suggestions_for(self.ses))["your first message"]
+ self.assertTrue(r.startswith("Fix the flaky parser test in acme."), r)
+ for bad in ("/", "sk-", "http", "Zorblax"):
+ self.assertNotIn(bad, r)
+ # RS5: free text is never kept in the facts (facts.json, the project's recap.json)
+ self.assertNotIn("request", self.facts)
+ self.assertNotIn("suggested_title", self.facts)
+ self.assertNotIn("flaky parser", json.dumps(self.facts))
+
+ def test_nothing_planted_reaches_the_script_or_the_facts(self):
+ lines, _ = rc.hard_filter(rc.script_lines(self.facts))
+ text = rc.write_script(lines, self.facts["ref"]) + json.dumps(self.facts)
+ for bad in PLANTED + (str(self.repo),):
+ self.assertNotIn(bad, text, bad)
+
+ def test_repo_must_be_known(self):
+ ses = dict(self.ses, cwds=rc.Counter({"/nonexistent/folder": 3}))
+ with self.assertRaises(ShowtimeError):
+ rc.repo_roots(ses)
+ top, roots = rc.repo_roots(ses, str(self.repo))
+ self.assertEqual(top, str(self.repo))
+
+ def test_removed_worktree_paths(self):
+ roots = [str(self.repo) + "/.claude/worktrees/agent-x", str(self.repo)]
+ self.assertEqual(rc.rel_path(str(self.repo) + "/.claude/worktrees/agent-x/src/a.py", roots), "src/a.py")
+ self.assertEqual(rc.rel_path(str(self.repo) + "/.claude/worktrees/agent-y/src/b.py", roots), "src/b.py")
+ self.assertIsNone(rc.rel_path(str(self.repo) + "/.git/config", roots))
+ self.assertIsNone(rc.rel_path(str(self.repo) + "/config/.env", roots))
+ self.assertIsNone(rc.rel_path("/elsewhere/src/a.py", roots))
+ self.assertIsNone(rc.rel_path("~/notes.md", roots))
+
+
+class TestCommands(Base):
+ def test_program_and_subcommand_only(self):
+ L = rc.command_labels
+ self.assertEqual(L("cd /x/y && git -C /x/y commit -q -m 'secret message'"), ["git commit"])
+ self.assertEqual(L("ssh -o ConnectTimeout=5 buildhost 'pytest -q'"), ["ssh"])
+ self.assertEqual(L("scp a.txt host:/tmp/"), ["scp"])
+ self.assertEqual(L("curl -s https://x.example/api?token=abc | jq ."), ["curl", "jq"])
+ # never a script path, inside the repository or not (the director's allow-list pivot)
+ self.assertEqual(L("FOO=1 BAR=2 timeout 600 python3 tests/run_all.py -k x 2>&1 | tail -5"), ["python3", "tail"])
+ self.assertEqual(L("cd sub && python3 run.py"), ["python3"])
+ self.assertEqual(L("python - <<'EOF'\nimport os; os.system('rm -rf x')\nprint(1)\nEOF\necho done"),
+ ["python", "echo"])
+ self.assertEqual(L('cat <<< "word"; ls'), ["cat", "ls"]) # a here-string is not a heredoc
+ self.assertEqual(L("grep -n foo src/a.py 2>/dev/null; ls"), ["grep", "ls"])
+ self.assertEqual(L("~/.venv/bin/python3.12 -m pytest -q"), ["python3 -m pytest"])
+ self.assertEqual(L("npm run build && npm test"), ["npm run", "npm test"])
+ self.assertEqual(L("echo 'unterminated"), ["echo"])
+ self.assertEqual(L("python -m clientname.tool --x"), ["python"]) # a project's own package
+ self.assertEqual(L("python3 -m http.server 8000"), ["python3"]) # not a runner module
+ self.assertEqual(L("make deploy-clientname && make test"), ["make", "make test"])
+ self.assertEqual(L("rake secret_task; bundle exec rspec"), ["rake", "bundle exec"])
+ self.assertEqual(L("./bin/tool --x"), ["other"]) # the user's own program
+
+ # two adversarial review grids: every command row shows nothing private
+ ADVERSARIAL_COMMANDS = [
+ "python3 tools/zorg_export_persisted_cwd.py", "cd /outside && ./zorg_deploy_prod.sh",
+ "/Users/me/clients/zorgcorp/bin/zorgsync --push", "/Users/me/clients/zorgcorp/bin/zorgabsrun.py",
+ "cd C:\\Users\\me\\zorgwin && python tools\\zorgwin.py", "cd C:/zorgfwd && python tools/zorgfwd.py",
+ "& 'C:\\zorgps\\zorgpsrun.ps1'", "Set-Location C:\\zorgsl; python tools\\zorgsl.py",
+ "Push-Location C:\\zorgpush; python tools\\zorgpushps.py",
+ "Set-Location -Path C:\\zorgslp; python tools\\zorgslp.py", "cd -Path C:\\zorgcdp; python tools\\zorgcdp.py",
+ "cd -P /out && python3 tools/zorgcdP.py", "command cd /out && python3 tools/zorgcommand.py",
+ "builtin cd /out && python3 tools/zorgbuiltin.py", "cd -- /out && python3 tools/zorgcddash.py",
+ "{ cd /out; python3 tools/zorgbrace.py; }", "env -C /out python3 tools/zorgenvC.py",
+ "CDPATH=/parent cd zorgcorp && python3 tools/zorgcdpath.py", "zorgctl sync --all", "acme-zorg-deploy --prod",
+ "git -C /out commit -qm zorgmsg", 'cd "/out/Zorg Client" && python3 tools/zorgspace.py',
+ 'python3 "/out/Zorg Client/zorgspace2.py"', "pushd /out && popd && python3 tools/zorgpopd.py",
+ "cd /out; cd -; python3 zorgdash.py", "(cd /out && python3 zorgsub.py)", "bash -c 'cd /out && ./zorgx.sh'",
+ "cd /repo/../outside && python3 zorgup.py", "make -C /out zorg-deploy", "npx zorg-cli", "uv run zorg-tool",
+ "docker exec zorgcontainer ls", "git switch zorg-client-branch", "git zorg-alias", "cargo zorg-deploy",
+ "kubectl zorgctl-plugin", "gh zorg-ext run", "showtime zorg"]
+
+ def test_adversarial_command_rows_show_nothing_private(self):
+ for cmd in self.ADVERSARIAL_COMMANDS:
+ for cwd in ("/repo", "/outside"):
+ labels = rc.command_labels(cmd, cwd=cwd, roots=["/repo"])
+ text = " ".join(labels)
+ self.assertNotIn("zorg", text.lower(), cmd)
+ self.assertNotRegex(text, r"[/\\\\]", cmd)
+ for lab in labels:
+ self.assertTrue(lab == rc.OTHER or lab.split()[0] in rc.ALLOWED_PROGRAMS, (cmd, lab))
+
+ def test_amended_reset_and_failing_follow_up_commits(self):
+ """N-j: an amended or reset commit (its object still exists, outside the history) is not counted.
+ N-i: a real commit counts even when a later step of the same call fails (a rejected push)."""
+ repo = self.tmp / "nj-repo"
+ repo.mkdir()
+ git(repo, "init", "-q", "-b", "main")
+ (repo / "a.txt").write_text("a\n", encoding="utf-8")
+ git(repo, "add", "-A")
+ git(repo, "commit", "-q", "-m", "one")
+ (repo / "a.txt").write_text("b\n", encoding="utf-8")
+ git(repo, "commit", "-q", "-am", "two")
+ two = git(repo, "rev-parse", "HEAD").strip()
+ git(repo, "commit", "-q", "--amend", "-m", "two, amended")
+ amended = git(repo, "rev-parse", "HEAD").strip()
+ (repo / "a.txt").write_text("c\n", encoding="utf-8")
+ git(repo, "commit", "-q", "-am", "three")
+ three = git(repo, "rev-parse", "HEAD").strip()
+ git(repo, "reset", "-q", "--hard", "HEAD~1")
+ top = rc.git_toplevel(str(repo))
+ self.assertEqual(rc.verified_commits(top, [two[:7], three[:7], amended[:7]]), [amended])
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(repo), "sessionId": "s",
+ "message": {"content": "Commit and push."}},
+ {"type": "assistant", "timestamp": "2026-10-01T10:00:05Z", "cwd": str(repo), "sessionId": "s",
+ "message": {"id": "m", "content": [{"type": "tool_use", "id": "t", "name": "Bash",
+ "input": {"command": "git commit -am x && git push"}}]}},
+ {"type": "user", "timestamp": "2026-10-01T10:00:09Z", "cwd": str(repo), "sessionId": "s",
+ "message": {"content": [{"type": "tool_result", "tool_use_id": "t", "is_error": True,
+ "content": "[main %s] x\n 1 file changed\n! [rejected] main -> main" %
+ amended[:7]}]}}]
+ p = self.tmp / "nj.jsonl"
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ self.assertEqual(rc.collect(ses, *rc.repo_roots(ses))["commits"], 1)
+
+ def test_commits_count_only_inside_the_repository(self):
+ """RS6 (and N3, N-a): a commit counts only when the hash `git commit` printed exists in this
+ repository's history. A commit made in another repository, however the command got there (GIT_DIR, eval cd,
+ source, a function, if cd, pushd +1, a nested git init, git -C), prints a hash this repository does not have."""
+ other = self.tmp / "other-repo"
+ if not other.exists():
+ other.mkdir()
+ git(other, "init", "-q", "-b", "main")
+ (other / "x.txt").write_text("x\n", encoding="utf-8")
+ git(other, "add", "-A")
+ git(other, "commit", "-q", "-m", "zorg outside")
+ outside_sha = git(other, "rev-parse", "--short", "HEAD").strip()
+ self.assertEqual(rc.verified_commits(self.top, [outside_sha, "deadbee", self.fix]),
+ [git(self.repo, "rev-parse", self.fix).strip()])
+ evasions = ["GIT_DIR=%s/.git git commit -m x" % other, "env GIT_DIR=%s/.git git commit -m x" % other,
+ "export GIT_DIR=%s/.git; git commit -m x" % other, "eval cd %s && git commit -m x" % other,
+ "source %s/go.sh && git commit -m x" % other, "f() { cd %s; }; f; git commit -m x" % other,
+ "if cd %s; then git commit -m x; fi" % other, "pushd %s; pushd %s; pushd +1; git commit" % (other, self.repo),
+ "mkdir d && cd d && git init && git commit -m x", "git -C %s commit -qm zorgmsg" % other]
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"content": "Commit things."}}]
+ for i, cmd in enumerate(evasions):
+ ev.append({"type": "assistant", "timestamp": "2026-10-01T10:01:%02dZ" % i, "cwd": str(self.repo),
+ "sessionId": "s", "message": {"id": "m%d" % i, "content": [
+ {"type": "tool_use", "id": "c%d" % i, "name": "Bash", "input": {"command": cmd}}]}})
+ ev.append({"type": "user", "timestamp": "2026-10-01T10:01:%02dZ" % i, "cwd": str(self.repo),
+ "sessionId": "s", "message": {"content": [{"type": "tool_result", "tool_use_id": "c%d" % i,
+ "content": "[main %s] zorg\n 1 file changed" %
+ outside_sha}]}})
+ p = self.tmp / "commits.jsonl"
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ f = rc.collect(ses, self.top, self.roots)
+ self.assertEqual((f["commits"], f["diff"]["source"]), (0, "none"))
+ self.assertEqual(self.facts["commits"], 1) # the fixture's own commit, printed and real
+
+ def test_only_worktree_folders_become_roots(self):
+ """N2: a removed folder under the repository that is not a worktree is not a root of its own."""
+ ses = dict(self.ses, cwds=rc.Counter({str(self.repo): 5, str(self.repo / "build" / "gone"): 2,
+ str(self.repo / ".claude" / "worktrees" / "agent-x"): 1}))
+ top, roots = rc.repo_roots(ses)
+ self.assertNotIn(str(self.repo / "build" / "gone"), roots)
+ self.assertIn(str(self.repo / ".claude" / "worktrees" / "agent-x"), roots)
+ self.assertEqual(rc.rel_path(str(self.repo / "build" / "x.py"), roots), "build/x.py")
+
+ def test_outside_cwd_in_a_transcript(self):
+ """B1 end to end: a call whose recorded working folder is outside the repository."""
+ outside = self.tmp / "outside"
+ outside.mkdir(exist_ok=True)
+ p = self.tmp / "b1.jsonl"
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"content": "Fix the build."}},
+ {"type": "assistant", "timestamp": "2026-10-01T10:00:05Z", "cwd": str(outside), "sessionId": "s",
+ "message": {"id": "m1", "content": [{"type": "tool_use", "id": "t1", "name": "Bash",
+ "input": {"command": "python3 tools/zorg_export.py && ./zorg.sh"}}]}},
+ {"type": "user", "timestamp": "2026-10-01T10:00:06Z", "cwd": str(outside), "sessionId": "s",
+ "message": {"content": [{"type": "tool_result", "tool_use_id": "t1", "content": "ok"}]}}]
+ p.write_text("\r\n".join(json.dumps(e) for e in ev) + "\r\n", encoding="utf-8") # CRLF on purpose
+ ses = rc.parse_session(p)
+ f = rc.collect(ses, *rc.repo_roots(ses, str(self.repo)))
+ self.assertNotIn("zorg", json.dumps(f))
+ self.assertEqual(dict(f["commands"]), {"python3": 1, rc.OTHER: 1})
+
+ def test_known_subcommands_only(self):
+ """S7: aliases, plugins and extensions are the user's own names."""
+ L = rc.command_labels
+ for cmd, want in (("git zorg-alias", "git"), ("cargo zorg-deploy", "cargo"), ("kubectl zorgctl-plugin", "kubectl"),
+ ("gh zorg-ext run", "gh"), ("git status", "git status"), ("gh pr view 3", "gh pr"),
+ ("showtime render x", "showtime render"), ("showtime zorg", "showtime"),
+ ("docker compose up", "docker compose")):
+ self.assertEqual(L(cmd), [want], cmd)
+
+ def test_test_commands(self):
+ T = rc.is_test_command
+ for yes in ("pytest -q", "python -m unittest discover", "python3 tests/run_all.py", "npm test",
+ "cd x && python3 tests/test_voice.py -v", "ssh box 'cd w && python3 tests/run_all.py --fast'",
+ "bash -c 'go test ./...'", "cargo test", "node --test", "npx jest --ci", "uv run pytest",
+ "poetry run pytest -x", "docker exec -it app pytest", "sudo -u ci python3 -m pytest",
+ "npm run test:unit", "make test"):
+ self.assertTrue(T(yes), yes)
+ for no in ("grep -n test_voice tests/test_voice.py", "sed -n 1,40p tests/test_x.py", "cat pytest.ini",
+ "git add tests/test_x.py", "ls tests",
+ # S3: installs, lint and type checks of test files, version and info queries
+ "pip install pytest", "uv pip install pytest", "npm i -D jest", "pip show pytest",
+ "ruff check tests/test_parser.py", "black tests/test_x.py", "mypy tests/test_x.py",
+ "flake8 tests/test_x.py", "python -m py_compile tests/test_x.py", "pytest --version",
+ "echo pytest", "npm install"):
+ self.assertFalse(T(no), no)
+
+ def test_counts_per_runner(self):
+ C = rc.test_counts
+ self.assertEqual(C("...\n59/60 test files passed in 12.0s wall"), {"passed": 59, "failed": 1, "unit": "test files"})
+ self.assertEqual(C("Ran 12 tests in 0.3s\n\nFAILED (failures=2, errors=1, skipped=1)")["passed"], 8)
+ self.assertEqual(C("Ran 5 tests in 0.1s\n\nOK"), {"passed": 5, "failed": 0, "unit": "tests"})
+ self.assertEqual(C("===== 3 failed, 40 passed, 2 skipped in 1.20s ====="), {"passed": 40, "failed": 3,
+ "unit": "tests"})
+ self.assertEqual(C("Tests: 1 failed, 9 passed, 10 total"), {"passed": 9, "failed": 1, "unit": "tests"})
+ self.assertEqual(C("test result: ok. 7 passed; 0 failed; 0 ignored"), {"passed": 7, "failed": 0, "unit": "tests"})
+ self.assertEqual(C("# pass 4\n# fail 1\n"), {"passed": 4, "failed": 1, "unit": "tests"})
+ self.assertEqual(C("ok \tacme/x\t0.1s\nFAIL\tacme/y\t0.2s\n"), {"passed": 1, "failed": 1, "unit": "packages"})
+ self.assertEqual(C("FAILED (failures=1)")["status"], "fail")
+ self.assertIsNone(C("no counts here"))
+
+
+class TestHardFilter(Base):
+ def test_keys_and_tokens(self):
+ hexrun = "0123456789abcdef" * 2
+ for line in ("key sk-test-notarealkey0000000000", "AKIAIOSFODNN7EXAMPLE", "token gh" + "p_" + "A1b2C3d4" * 5,
+ "commit " + hexrun, "blob " + "QmFzZTY0IGlzIG5vdCBhIGtleSBidXQgbG9va3MgbGlrZSBvbmU9",
+ 'password = "hunter22hunter"', "xo" + "xb-1234567890-abcdefghij",
+ # B2: labelled values mid-sentence, AWS's slashed secret shape, lower-case+digit tokens,
+ # hex of 20-31 characters
+ "use password: hunter2xyz for it", "token: abcd1234efgh5678ijkl please",
+ "the api key 9f8e7d6c5b4a3210fedc here", "secret=s3cr3tvalue", "Authorization: Bearer abcdefghij123456",
+ "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "a1b2c3d4e5f6" * 3 + "a1b2",
+ "deadbeef0123456789ab", "x " + "0f" * 12 + " y"):
+ self.assertEqual(rc.unsafe_reason(line), "key", line)
+
+ def test_request_drops_secrets_hosts_and_paths(self):
+ """B2 + S1: a key's name goes with its value; hosts, IPs, user@host, slashed words and ~user go."""
+ r = rc.clean_request("Deploy to zorg-prod.internal (10.1.2.3) now. Use password: hunter2xyz and token: "
+ "abcd1234efgh5678ijkl, the api key 9f8e7d6c5b4a3210fedc, notes in ../zorg-client/plan.md "
+ "and ~favio/notes, then ssh deploy@zorgbox to 10.9.8.7 or fe80::1:2:3 and zorgcorp.com "
+ "and /zorgsecret. Keep it small. Reach me via [email protected] today.", limit=400)
+ for bad in ("zorg", "10.1.2.3", "hunter2xyz", "abcd1234", "9f8e7d6c", "favio", "deploy@", "10.9.8.7",
+ "fe80", "secret", "password", "token"):
+ self.assertNotIn(bad, r.lower(), r)
+ self.assertEqual(r, "") # the first sentence names a host: no later sentence takes its place
+ self.assertEqual(rc.clean_request("Fix the parser. Keep it small. Use password: hunter2xyz now. Then ship."),
+ "Fix the parser. Keep it small.")
+ for line in ("zorg-prod.internal", "at 10.1.2.3", "deploy@zorgbox", "zorgcorp.com/admin/keys", "~favio/notes",
+ "see /zorgsecret now"):
+ self.assertIsNotNone(rc.unsafe_reason(line), line)
+
+ def test_request_suggestion_rows(self):
+ """RS1-RS3: the request is never film text; as a suggestion it keeps ordinary sentences
+ (CI/CD, versions) and drops split keys, passcodes, licence keys, value-like words and hosts on any TLD."""
+ R = rc.clean_request
+ self.assertEqual(R("Fix the CI/CD flow so the release job stops failing. Keep the changes small."),
+ "Fix the CI/CD flow so the release job stops failing. Keep the changes small.")
+ self.assertEqual(R("Update the v1.2/v1.3 notes in the changelog."), "Update the v1.2/v1.3 notes in the changelog.")
+ # RS5: a key word with anything after it, letters mixed with digits whatever the punctuation, x:y,
+ # three or more digit groups
+ for bad in ("Fix the token counting bug in the tokenizer.", "Make it fail when the password is wrong.",
+ "Log in with zorgadmin:Zx9Qw8Er7Ty6 now.", "Log in as admin:Zx9Qw8Er7Ty6 now.",
+ "Use zorgadmin:hunter2 now.", "Use Tr0ub4dor&3 there.", "Use Hunter2! now.",
+ "Key Q9w8E7r6,T5y4U3i2 here.", "The password is swordfish.",
+ "The password is CorrectHorseBatteryStaple today.", "Card 4111 1111 1111 1111 ok.",
+ "Pay with card 4111 1111 1111 1111 today.", "Pay with card 4111-1111-1111-1111 today."): # N-j: a sentence long enough to be kept
+ self.assertEqual(R(bad), "", bad)
+ for bad in ("The value is Q9w8E7r6T5y4U3i2 O1p0A9s8D7f6G5h4 for prod.", "Use the passcode Zx9Qw8Er7Ty6 for the box.",
+ "The license key is Q9W8-E7R6-T5Y4-U3I2 now.", "Log in as zorgadmin with Zx9Qw8Er7Ty6Ab today.",
+ "Open portal.zorgagency.gov to check.", "Mirror at zorgmirror.cl for Chile.",
+ "Deploy to zorg-prod.internal now.", "Ping 10.1.2.3 first.", "ssh deploy@zorgbox now.",
+ "See zorgcorp.com/admin/keys today.", "Read ../zorg-client/plan.md first.", "Check ~zorguser/notes.",
+ "Look in /zorgsecret now.", "Use password: hunter2xyz for it.", "token: abcd1234efgh5678ijkl here.",
+ "Use api key 9f8e7d6c5b4a3210fedc here.", "The key is wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ok.",
+ "Token a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2 ok.", "Hex deadbeef0123456789abcdef01 ok.",
+ "Run it at socket.io now.", "Long " + "a-" * 300 + " word."):
+ self.assertEqual(R(bad), "", bad)
+
+ def test_absolute_paths_urls_and_mail(self):
+ for line, why in (("see /Users/someone/x.py", "absolute path"), ("/etc/hosts", "absolute path"),
+ ("in ~/notes", "absolute path"), ("C:\\Users\\me\\a.txt", "absolute path"),
+ ("run /opt/tool/bin/x", "absolute path"), ("at /srv/app", "absolute path"),
+ ("https://example.com/a", "URL"), ("mail [email protected]", "e-mail")):
+ self.assertEqual(rc.unsafe_reason(line), why, line)
+
+ def test_safe_lines_stay(self):
+ for line in ("skills/showtime/runtime/stage.js", "59/60", "+12 \u221203", "git commit \u00d74",
+ "43 min \u00b7 80 turns \u00b7 83 tool calls", "Fix the nightly css_clock flake",
+ "python3 tests/run_all.py \u00d74", "read/edit/run", "Recap \u00b7 Claude Code session \u00b7 2 Oct 2026",
+ "tests/test_parser.py", "a_very_long_snake_case_identifier_name_in_a_path/x.py"):
+ self.assertIsNone(rc.unsafe_reason(line), line)
+
+ def test_long_tokens_stay_fast(self):
+ """Review 2 #1: one long unbroken run (60 KB of `a.`) through every pattern and the request cleaner."""
+ import time
+ for x in ("a." * 30000, "a" * 60000, "a-" * 30000, "a.a" * 20000 + "@", "www." * 15000, "x://" * 15000):
+ t = time.time()
+ self.assertEqual(rc.unsafe_reason(x), "key")
+ self.assertEqual(rc.clean_request("Fix it. Then " + x + " now."), "Fix it.")
+ rc._URL.search(x) # the patterns themselves, unguarded, on the whole run
+ rc._EMAIL.search(x)
+ self.assertLess(time.time() - t, 1.5, x[:8])
+
+ def test_pasted_code_and_long_commands_stay_fast(self):
+ """RS8 and N-f: a 218 KB TypeScript paste as the request; a 1 MB command token."""
+ import time
+ ts = ("function f(m: Map<string, Array<number>>): Promise<Result> { return g<T>(m); }\n" * 2800)
+ t = time.time()
+ rc.clean_request("Refactor the parser. " + ts)
+ rc._strip_tags(ts)
+ self.assertLess(time.time() - t, 1.0)
+ t = time.time()
+ rc.command_labels("python3 -c " + "x" * 1000000)
+ self.assertLess(time.time() - t, 2.0)
+
+ def test_long_tagged_blocks_never_become_the_request(self):
+ """RS11: a tagged block longer than the 8 KB cut is removed whole before the cut; an unclosed block
+ ends the text. N-o: a 6+ digit run ends the suggestion."""
+ p = self.tmp / "tagged.jsonl"
+ note = "Zorg private note: the client is Zorgcorp and the launch slips to Friday because of the audit. "
+ texts = ["<system-reminder>\n" + note + "x " * 6000 + "\n</system-reminder>\nFix the parser bug.",
+ "<ide_selection>The user selected these lines: " + note + "y " * 6000 + "\nFix the parser bug."]
+ for i, text in enumerate(texts):
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"content": text}},
+ {"type": "assistant", "timestamp": "2026-10-01T10:01:00Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"id": "m", "content": [{"type": "text", "text": "ok"}]}}]
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ self.assertNotIn("Zorg", ses["request"], i)
+ sugg = dict(rc.suggestions_for(ses)).get("your first message", "")
+ self.assertNotIn("Zorg", sugg, i)
+ self.assertEqual(dict(rc.suggestions_for(rc.parse_session(p))).get("your first message"), None) # unclosed
+ self.assertEqual(rc.clean_request("Ticket 482193 is due. Ship it."), "")
+ self.assertEqual(rc.clean_request("Fix it. Ref 12345678901234 here."), "Fix it.")
+
+ def test_digit_groups_any_separator(self):
+ """RS20: digit groups split by separators of any length (-- , ...) are refused, in a line and as a request
+ suggestion."""
+ for text in ("Card 4111 -- 1111 -- 1111 -- 1111 here", "SSN 123 -- 45 -- 6789", "4111 ... 1111 ... 1111 ... 1111"):
+ with self.subTest(text=text):
+ self.assertTrue(rc.free_text_refused(text), text)
+ self.assertEqual(rc.clean_request("Fix it. Pay " + text + ". Keep it small."), "Fix it.")
+
+ def test_digit_groups_stay_linear(self):
+ """The digit-group rule on long digit runs (it was quadratic: 20 KB took 11-15 s), and on long separator runs."""
+ import time
+ t = time.time()
+ rc._DIGIT_GROUPS.search("1 -- " * 40000) # 200 KB of separators: linear
+ self.assertLess(time.time() - t, 1.0)
+ for big in ("1" * 20000, "1" * 100000 + "-12-34", ("12-" * 20000) + "x"):
+ t = time.time()
+ rc._clean_words("Fix it " + big + " now.")
+ with self.subTest(n=len(big)):
+ self.assertLess(time.time() - t, 1.0)
+
+ def test_hidden_characters_lookalikes_and_digit_chains(self):
+ """B1: a format or bidi control character (zero-width space, word joiner, soft hyphen, ...) refuses the line in
+ the hard filter, and every rule judges an NFKC-folded copy. S1/S2: digit groups that make a long number across
+ short words or side by side. S3: lookalike digits and punctuation. The review's adversarial inputs."""
+ zw = "\u200b"
+ refused = ["Card " + zw.join("4111111111111111") + " ends it.",
+ "Card " + "\u2060".join("4111111111111111") + " ends it.",
+ "Card " + "\u00ad".join("4111111111111111") + " ends it.",
+ "Deploy to 10" + zw + ".1.2.3 now.", "Pay \u202e1111 4111\u202c now.",
+ "4111 1111", "1111 1111", "55512 34567", "4111 1111 turns \u00b7 1111 1111 tool calls \u00b7 5 commands",
+ "Card 4111 x 1111 x 1111 x 1111 here.", "Pay 4111 then 1111 then 1111 then 1111 now.",
+ "SSN 123 and 45 and 6789.", "\u2463\u2460\u2460\u2460 \u2460\u2460\u2460\u2460 \u2460\u2460\u2460\u2460",
+ "\u2074\u00b9\u00b9\u00b9 \u00b9\u00b9\u00b9\u00b9 \u00b9\u00b9\u00b9\u00b9 \u00b9\u00b9\u00b9\u00b9",
+ "\uff0fUsers\uff0ffavio\uff0f.ssh\uff0fid rsa", "\u2215Users\u2215favio\u2215.ssh\u2215id rsa",
+ "favio\uff20example\uff0ecom", "\uff14\uff11\uff11\uff11 \uff11\uff11\uff11\uff11 \uff11\uff11\uff11\uff11"]
+ for text in refused:
+ with self.subTest(refused=text):
+ self.assertTrue(rc.free_text_refused(text), repr(text))
+ for text in refused[:5]:
+ with self.subTest(hard_filter=text):
+ self.assertEqual(rc.unsafe_reason(text), "hidden character")
+ for text in ("between 2024 and 2026", "12 34", "Ended green: 5/5 tests passed \u00b7 1 commit",
+ "140 turns \u00b7 155 tool calls \u00b7 128 commands", "+305 \u221217", "Read 5",
+ "In 42 minutes, a sub-agent edited 6 files and took the tests from red to green."):
+ with self.subTest(kept=text):
+ self.assertFalse(rc.free_text_refused(text), text)
+ # the kept text is never rewritten: a refused line is dropped, a kept one stays as written
+ self.assertEqual(rc.clean_request("Fix the \uff32EADME docs."), "Fix the \uff32EADME docs.")
+
+ def test_natural_numbers_pass_and_spread_numbers_do_not(self):
+ """The guard targets accidental private text in natural forms. Ordinary lines with numbers pass (they passed
+ before the digit-chain rule); a number spread with single spaces, invisible marks or across sentences is
+ refused; the chain rule and the folding stay linear."""
+ R = rc.free_text_refused
+ for text in ("From 2024-2026.", "Renders at 1920\u00d71080.", "Closes #1234 #5678.",
+ "Tested on Python 3.11, 3.12 and 3.13.", "Node 18, 20 and 22 pass.", "between 2024 and 2026",
+ "12 of 34 tests, 56 skipped.", "Edited 3 files in 2 commits, 45 lines.", "Ship it \U0001F468\u200d\U0001F4BB today.",
+ "Proud \U0001F3F3\ufe0f\u200d\U0001F308 flag."):
+ with self.subTest(passes=text):
+ self.assertFalse(R(text), text)
+ card = "4111111111111111"
+ spread = ["Card " + " ".join(card) + " ends it.", "Card 4111. Then 1111. Then 1111. Then 1111.",
+ "Re\u200bfactor"] + ["Card " + sep.join(card) + " ends it." for sep in (
+ "\u0301", "\ufe0f", "\u034f", "\u115f", "\u1160", "\u3164", "\uffa0", "\u2800", "\U000e0000",
+ "\U000e0080")]
+ for text in spread:
+ with self.subTest(refused=text):
+ self.assertTrue(R(text), repr(text))
+ import time
+ for f, big in ((R, "4 1 " * 75000), (rc._digit_chain, "1 xxxxx " * 37500), (rc._digit_chain, "4 1 " * 75000),
+ (R, "4\u0301" * 150000), (rc._clean_words, "4 1 " * 75000)):
+ t = time.time()
+ f(big)
+ with self.subTest(timing=(f.__name__, big[:6])):
+ self.assertLess(time.time() - t, 1.0)
+
+ def test_most_used_is_capped(self):
+ """S4: a "Most used" line is recap's own only with at most 4 parts, distinct labels and counts 1-99999."""
+ F = {"files": []}
+ own = lambda t: rc.own_line("timeline.commands", t, {}, F) # noqa: E731
+ self.assertEqual(own("Most used: git commit \u00d72 \u00b7 python3 -m pytest \u00d74"), "own")
+ for text in ("Most used: " + " \u00b7 ".join("git \u00d74111" for _ in range(30)),
+ "Most used: git \u00d74111 \u00b7 git \u00d71111",
+ "Most used: git \u00d74111 \u00b7 npm \u00d71111 \u00b7 make \u00d71111 \u00b7 cargo \u00d71111 \u00b7 ls \u00d71",
+ "Most used: git \u00d704111", "Most used: git \u00d70"):
+ with self.subTest(text=text):
+ self.assertNotEqual(own(text), "own")
+
+ def test_prefixed_key_shapes(self):
+ """Review 2 #2: vendor-prefixed keys are caught by their prefix, whatever the rest looks like (assembled here:
+ the repository's secret scanner refuses them as literals)."""
+ tail16 = "abcdefghijklmnop"
+ for key in ("sk" + "_live_" + tail16 + "qrst", "sk" + "_test_" + tail16, "rk" + "_live_" + tail16,
+ "pk" + "_live_" + tail16, "gh" + "o_" + tail16 + "abcd", "gh" + "s_" + tail16 + "abcd",
+ "gh" + "u_" + tail16 + "abcd", "github" + "_pat_" + tail16 + "_x", "xo" + "xp-1234-" + tail16,
+ "xo" + "xb-" + tail16, "gl" + "pat-" + tail16, "AI" + "za" + tail16 + "ABCDEFGHIJKLMN",
+ "AS" + "IA" + "ABCDEFGHIJKLMNOP", "hf" + "_" + tail16 + "abcdef", "SG" + "." + tail16 + "x",
+ "np" + "m_" + tail16 + "abcdefgh", "py" + "pi-" + tail16, "wh" + "sec_" + tail16):
+ self.assertEqual(rc.unsafe_reason("the key " + key + " here"), "key", key)
+ self.assertEqual(rc.unsafe_reason(key), "key", key)
+ for ok in ("pk_reader is a name", "sk-like words", "ghost_writer.py", "skills/showtime/x.py"):
+ self.assertIsNone(rc.unsafe_reason(ok), ok)
+
+ def test_user_edits_are_filtered_too(self):
+ facts = {"ref": "abcdef1234"}
+ L = rc.OrderedDict([("hook.title", {"scene": "hook", "kind": "show", "text": "A title"})])
+ md = rc.write_script(L, facts["ref"])
+ md = md.replace("show hook.title: A title", "show hook.title: A title\nshow hook.request: see /Users/me/secret.txt"
+ "\nsay hook.say: the key is sk-test-notarealkey0000000000\nshow hook.meta: fine line")
+ ref, lines = rc.read_script(md)
+ kept, dropped = rc.hard_filter(lines)
+ self.assertEqual(ref, "abcdef1234")
+ self.assertEqual(list(kept), ["hook.title", "hook.meta"])
+ self.assertEqual(dict(dropped), {"absolute path": 1, "key": 1})
+
+
+class TestRobustness(Base):
+ def test_compact_summary_is_not_the_request(self):
+ """S2: a compaction summary is assistant-written; the request is the next real message."""
+ p = self.tmp / "compact.jsonl"
+ ev = [{"type": "user", "isCompactSummary": True, "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo),
+ "message": {"content": "This session is being continued from a previous conversation. Summary..."}},
+ {"type": "user", "timestamp": "2026-10-01T10:01:00Z", "cwd": str(self.repo),
+ "message": {"content": "Now add the docs page."}}]
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ self.assertEqual(rc.parse_session(p)["request"], "Now add the docs page.")
+
+ def test_only_command_output_is_kept_and_cut(self):
+ """S4: Read output is never kept; a command's output keeps its last 64 KB; long lines stay fast."""
+ p = self.tmp / "big.jsonl"
+ long_line = "= passed " * 40000 + "\n========== 3 passed in 0.10s =========="
+ ev = [{"type": "assistant", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo),
+ "message": {"id": "m1", "content": [
+ {"type": "tool_use", "id": "r1", "name": "Read", "input": {"file_path": str(self.repo / "a.py")}},
+ {"type": "tool_use", "id": "b1", "name": "Bash", "input": {"command": "pytest -q"}}]}},
+ {"type": "user", "timestamp": "2026-10-01T10:00:09Z", "cwd": str(self.repo), "message": {"content": [
+ {"type": "tool_result", "tool_use_id": "r1", "content": "R" * 100000},
+ {"type": "tool_result", "tool_use_id": "b1", "content": long_line}]}}]
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ self.assertEqual(ses["results"]["r1"]["text"], "")
+ self.assertLessEqual(len(ses["results"]["b1"]["text"]), rc.RESULT_KEEP)
+ import time
+ t = time.time()
+ c = rc.test_counts("= passed " * 35000) # one 300 KB line, no summary
+ self.assertIsNone(c)
+ self.assertLess(time.time() - t, 2.0)
+ f = rc.collect(ses, *rc.repo_roots(ses))
+ self.assertEqual((f["tests"][0]["passed"], f["tests"][0]["ok"]), (3, True))
+
+ def test_active_time_leaves_out_idle_gaps(self):
+ """S6: a session resumed the next morning is not hours "of work"."""
+ self.assertEqual(rc.active_seconds([0, 60, 120, 120 + 8 * 3600, 120 + 8 * 3600 + 30]), 150.0)
+ self.assertLessEqual(self.facts["duration"], self.facts["span"])
+
+ def test_symlinked_paths(self):
+ """S8: a transcript that names the repository through a symlink still maps its files."""
+ link = self.tmp / "link-to-acme"
+ if not link.exists():
+ os.symlink(str(self.repo), str(link))
+ self.assertEqual(rc.rel_path(str(link / "src" / "parser.py"), self.roots), "src/parser.py")
+
+ def test_since_is_checked(self):
+ """N1: --since never reaches git as an option."""
+ for bad in ("--output=/tmp/x", "no-such-ref"):
+ with self.assertRaises(ShowtimeError):
+ rc.collect(self.ses, self.top, self.roots, since=bad)
+
+
+class TestScriptAndPage(Base):
+ def test_round_trip(self):
+ lines = rc.script_lines(self.facts)
+ ref, back = rc.read_script(rc.write_script(lines, self.facts["ref"]))
+ self.assertEqual(ref, self.facts["ref"])
+ self.assertEqual(back, lines)
+ self.assertEqual([k for k in lines if lines[k]["kind"] == "say"],
+ ["hook.say", "numbers.say", "timeline.say", "files.say", "tests.say", "diff.say", "end.say"])
+ # the critic's round 1: the voice uses the lanes' own counts, the outcome is said, 8 vs 6 files is explained
+ self.assertEqual(lines["timeline.say"]["text"], "It edited 1 file, ran 2 commands and 3 test runs.")
+ self.assertEqual(lines["end.outcome"]["text"], "Ended green: 12/12 test files passed · 1 commit")
+
+ def test_page_shows_only_script_lines(self):
+ lines = rc.script_lines(self.facts)
+ lines["hook.title"]["text"] = "An edited title"
+ scenes = rc.scenes_for(self.facts)
+ durs = rc.durations(self.facts, lines, scenes)
+ files = rc.project_files(self.facts, lines, scenes, durs)
+ page = files["index.html"]
+ self.assertIn("An edited title", page)
+ self.assertNotIn("Keep the change small", page)
+ self.assertEqual(page.count('class="scene"'), len(scenes))
+ self.assertGreaterEqual(files["duration"], 30.0)
+ self.assertLessEqual(files["duration"], 60.0)
+
+ def test_sound_differs_per_session_and_is_stable(self):
+ """0.4.3: the bed and the effects come from the session: the same one sounds the same, another one not."""
+ lines = rc.script_lines(self.facts)
+ scenes = rc.scenes_for(self.facts)
+ durs = rc.durations(self.facts, lines, scenes)
+
+ def mix(ref, **kw):
+ facts = dict(self.facts, ref=ref)
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": str(self.tmp / "nomusic")}):
+ f = rc.project_files(facts, lines, scenes, durs, **kw)
+ return json.loads(f["audio/mix.json"])["tracks"]
+ a, b = mix("session-a"), mix("session-b")
+ self.assertEqual(a, mix("session-a"))
+ self.assertNotEqual(a[0], b[0]) # the bed
+ self.assertEqual([x["id"] for x in a], ["bed"]) # no sound on the cuts by default
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": str(self.tmp / "nomusic")}):
+ f = rc.project_files(dict(self.facts, ref="session-a"), lines, scenes, durs)
+ self.assertNotIn("sounds", json.loads(f["audio/mix.json"])["_comment"])
+ self.assertEqual(a[0]["gain_db"], -2)
+ sfx = lambda t: [x["synth"] for x in t if x.get("kind") == "sfx"] # noqa: E731
+ ca, cb = mix("session-a", cut_sounds=True), mix("session-b", cut_sounds=True) # --cut-sounds: opt in
+ self.assertEqual(len(sfx(ca)), len(scenes) - 1)
+ self.assertNotEqual(sfx(ca), sfx(cb))
+ self.assertTrue(all(x["type"] in ("swoosh-in", "swoosh-out") and
+ x["gain_db"] == -18.0 for x in [dict(t["synth"], gain_db=t["gain_db"]) for t in ca if t.get("synth")]))
+ self.assertEqual(mix("session-a", music="lofi-chill")[0]["compose"]["style"], "lofi-chill")
+ self.assertEqual(mix("session-a", music="none"), [])
+
+ def test_bed_under_narration_ducks_10_db(self):
+ """The bed under the voice dips 10 dB (not the mixer's 12): about 1.5-2 dB louder; no duck without narration."""
+ lines = rc.script_lines(self.facts)
+ scenes = rc.scenes_for(self.facts)
+ durs = rc.durations(self.facts, lines, scenes)
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": str(self.tmp / "nomusic")}):
+ voiced = json.loads(rc.project_files(self.facts, lines, scenes, durs, captions=True)["audio/mix.json"])
+ silent = json.loads(rc.project_files(self.facts, lines, scenes, durs)["audio/mix.json"])
+ self.assertEqual(voiced["tracks"][0]["duck"], {"under": "voice", "depth_db": 10.0})
+ self.assertNotIn("duck", silent["tracks"][0])
+
+ def test_callouts_never_overlap(self):
+ items = [(30.0, "stage.js"), (31.0, "stage-api.md"), (32.0, "check.mjs"), (33.0, "test_cut_frames.py"),
+ (99.0, "CHANGELOG.md")]
+ placed = rc._callout_tiers(items)
+ for tier in (0, 1):
+ spans = sorted((x, x + (len(t) * 0.95 + 1.8) / 72.6 * 100) for (x, tr), (_x, t) in zip(placed, items)
+ if tr == tier)
+ for (a0, a1), (b0, _b1) in zip(spans, spans[1:]):
+ self.assertLessEqual(a1, b0 + 1e-6)
+ self.assertTrue(all(x + (len(t) * 0.95 + 1.8) / 72.6 * 100 <= 100.01 for (x, _), (_x, t) in zip(placed, items)))
+
+ def test_vertical_project(self):
+ lines = rc.script_lines(self.facts)
+ scenes = rc.scenes_for(self.facts)
+ files = rc.project_files(self.facts, lines, scenes, rc.durations(self.facts, lines, scenes), aspect="9:16")
+ cfg = json.loads(files["showtime.json"])
+ self.assertEqual((cfg["width"], cfg["height"], cfg["background"]), (1080, 1920, "#F4F3EF"))
+
+ def test_test_dots_arrive_after_the_cut_settles(self):
+ """The 16:9 sample's qa dead_stop: the first dot popped (with an overshoot) right after the cut; dots now arrive
+ after the dip and the heading, easing in without an overshoot."""
+ lines = rc.script_lines(self.facts)
+ scenes = rc.scenes_for(self.facts)
+ page = rc.project_files(self.facts, lines, scenes, rc.durations(self.facts, lines, scenes))["index.html"]
+ dots = re.search(r'<div class="dots">(.*?)</div>', page).group(1)
+ first = float(re.search(r"--at:([\d.]+)s", dots).group(1))
+ self.assertGreaterEqual(first, 0.9)
+ self.assertNotRegex(page, r"\.dots i \{[^}]*animation: pop")
+
+ def test_narration_lines_match_scenes(self):
+ lines = rc.script_lines(self.facts)
+ md = rc.narration_md(lines, rc.scenes_for(self.facts), pauses={"timeline": 1.0})
+ self.assertIn("## hook\n", md)
+ self.assertIn("## timeline {pause_after=1.45}", md)
+ self.assertIn("## end\nIt ended green, in 1 commit.", md)
+
+
+class TestCli(Base):
+ def test_script_first_then_project(self):
+ out = self.tmp / "out1"
+ cp = showtime("recap", self.session, "--out", out)
+ self.assertTrue((out / "script.md").is_file())
+ self.assertFalse((out / "project").exists())
+ self.assertIn("--yes", cp.stderr)
+ # the user edits the script; --yes uses it as left
+ md = (out / "script.md").read_text(encoding="utf-8")
+ md = md.replace("show hook.title: ", "show hook.title: Edited: ").replace(
+ "show hook.meta: ", "show hook.meta: /Users/me/secret ")
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render", "--json")
+ res = json.loads(cp.stdout)
+ self.assertTrue(res["kept_script"])
+ self.assertNotIn("edited_script", res) # Linux smoke: the key said "edited" when only kept
+ self.assertEqual(res["refused"], ["hook.meta"]) # the person's line, refused; recap's own kept
+ self.assertEqual(res["dropped"], {})
+ page = (out / "project" / "index.html").read_text(encoding="utf-8")
+ self.assertIn("Edited: ", page)
+ text = all_text(out / "project") + (out / "facts.json").read_text(encoding="utf-8") # script.md is the user's
+ for bad in PLANTED + (str(self.repo),):
+ self.assertNotIn(bad, text, bad)
+
+ def test_yes_never_renders_the_script_it_writes(self):
+ """S5: --yes on a first run (or with --fresh) writes script.md and stops for the read."""
+ out = self.tmp / "out-yes"
+ for flags in ([], ["--fresh"]):
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", *flags)
+ self.assertTrue((out / "script.md").is_file())
+ self.assertFalse((out / "project").exists())
+ self.assertIn("rerun with --yes", cp.stderr)
+ showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertTrue((out / "project" / "index.html").is_file())
+
+ def test_only_transcripts_are_read(self):
+ """Review 2 #3: a file that is not a Claude Code transcript is refused."""
+ for name, text in (("notes.txt", "hello"), ("data.jsonl", '{"a": 1}\n{"type": "user"}\n'),
+ ("other.jsonl", '{"type": "user", "message": {"content": "x"}}\n')):
+ p = self.tmp / name
+ p.write_text(text, encoding="utf-8")
+ with self.assertRaises(ShowtimeError):
+ rc.find_session(str(p))
+ cp = showtime("recap", p, "--out", self.tmp / ("o-" + name), check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("not a Claude Code session transcript", cp.stderr)
+ self.assertEqual(rc.find_session(str(self.session)), self.session)
+
+ def test_default_out_is_a_job_folder_never_tracked_by_git(self):
+ """Review 2 #3: no --out inside a repository refuses (git would track it); with SHOWTIME_OUT elsewhere, the
+ default is <SHOWTIME_OUT>/showtime-out/recap-<session>."""
+ cp = showtime("recap", self.session, check=False, cwd=self.repo, env={k: v for k, v in ENV.items() if k != "SHOWTIME_OUT"})
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("inside a git repository", cp.stderr)
+ self.assertFalse((self.repo / "showtime-out").exists())
+ (self.repo / ".gitignore").write_text("showtime-out/\n", encoding="utf-8")
+ try:
+ showtime("recap", self.session, cwd=self.repo)
+ self.assertTrue((self.repo / "showtime-out" / ("recap-" + self.facts["ref"]) / "script.md").is_file())
+ finally:
+ (self.repo / ".gitignore").unlink()
+ shutil.rmtree(self.repo / "showtime-out", ignore_errors=True)
+ elsewhere = self.tmp / "elsewhere"
+ elsewhere.mkdir(exist_ok=True)
+ showtime("recap", self.session, cwd=self.repo, env=dict(ENV, SHOWTIME_OUT=str(elsewhere)))
+ self.assertTrue((elsewhere / "showtime-out" / ("recap-" + self.facts["ref"]) / "script.md").is_file())
+
+ def test_adversarial_grid_end_to_end(self):
+ """Every row of the two adversarial leak grids in one CRLF transcript: nothing of them in any file recap writes."""
+ outside = self.tmp / "out-zorg"
+ outside.mkdir(exist_ok=True)
+ request = ("Fix the parser bug. Deploy to zorg-prod.internal (10.1.2.3) now. Use password: hunter2xyz and "
+ "token: abcd1234efgh5678ijkl. The value is Q9w8E7r6T5y4U3i2 O1p0A9s8D7f6G5h4 for prod. Open "
+ "portal.zorgagency.gov and zorgmirror.cl. Ask deploy@zorgbox about ~zorguser/notes.")
+ ev = [{"type": "user", "isCompactSummary": True, "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo),
+ "sessionId": "s", "message": {"content": "ZORGSUMMARY of the earlier part"}},
+ {"type": "user", "timestamp": "2026-10-01T10:00:01Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"content": request}}]
+ t = 2
+ for i, cmd in enumerate(TestCommands.ADVERSARIAL_COMMANDS):
+ cwd = str(self.repo if i % 2 else outside)
+ ev.append({"type": "assistant", "timestamp": "2026-10-01T10:%02d:%02dZ" % (t // 60, t % 60), "cwd": cwd,
+ "sessionId": "s", "message": {"id": "m%d" % i, "content": [
+ {"type": "tool_use", "id": "t%d" % i, "name": "PowerShell" if "Location" in cmd else "Bash",
+ "input": {"command": cmd}}]}})
+ ev.append({"type": "user", "timestamp": "2026-10-01T10:%02d:%02dZ" % (t // 60, t % 60 + 1), "cwd": cwd,
+ "sessionId": "s", "message": {"content": [{"type": "tool_result", "tool_use_id": "t%d" % i,
+ "content": "ok zorg"}]}})
+ t += 5
+ for j, name in enumerate(("mcp__zorgcrm__lookup_zorgcorp_invoices", "ZorgCustomTool")): # RS9
+ ev.append({"type": "assistant", "timestamp": "2026-10-01T11:00:0%dZ" % j, "cwd": str(self.repo),
+ "sessionId": "s", "message": {"id": "z%d" % j, "content": [
+ {"type": "tool_use", "id": "z%d" % j, "name": name, "input": {}}]}})
+ p = self.tmp / "grid.jsonl"
+ p.write_text("\r\n".join(json.dumps(e) for e in ev) + "\r\n", encoding="utf-8")
+ out = self.tmp / "grid-out"
+ showtime("recap", p, "--repo", self.repo, "--out", out)
+ showtime("recap", p, "--repo", self.repo, "--out", out, "--yes", "--no-voice", "--no-render")
+ text = all_text(out).lower()
+ for bad in ("zorg", "hunter2", "abcd1234", "q9w8", "10.1.2.3", "deploy@", "summary"):
+ self.assertNotIn(bad, text, bad)
+ self.assertIn("# show hook.request: fix the parser bug.", text) # the one clean sentence, offered only
+
+ def test_only_script_md_changes_the_screen(self):
+ """RB2: there is no --title; a title or request line the person writes into script.md goes through the
+ strict request rule and the hard filter, and the CLI says what it refused."""
+ cp = showtime("recap", self.session, "--out", self.tmp / "t0", "--title", "x", check=False)
+ self.assertEqual(cp.returncode, 2)
+ self.assertIn("--title", cp.stderr)
+ for i, title in enumerate(("Use passcode Zx9Qw8Er7Ty6", "Ship portal.zorgagency.gov fix",
+ "Log in with zorgadmin:Zx9Qw8Er7Ty6", "Key Q9W8-E7R6-T5Y4-U3I2",
+ "Read ../zorg-client/plan.md", "The password is swordfish")):
+ out = self.tmp / ("rb2-%d" % i)
+ showtime("recap", self.session, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ md = md.replace("# show hook.request: ", "show hook.request: " + title + " ")
+ md = md.replace(re.search(r"show hook.title: [^\n]*", md).group(0), "show hook.title: " + title)
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertIn("refused hook.title", cp.stderr, title)
+ self.assertIn("refused hook.request", cp.stderr, title)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8").lower()
+ for w in ("zorg", "zx9q", "q9w8", "swordfish", "passcode"):
+ self.assertNotIn(w, page, title)
+ # a clean title the person writes is used
+ out = self.tmp / "rb2-ok"
+ showtime("recap", self.session, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ md = md.replace(re.search(r"show hook.title: [^\n]*", md).group(0), "show hook.title: The parser fix")
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertNotIn("refused", cp.stderr)
+ self.assertIn("The parser fix", (out / "project" / "index.html").read_text(encoding="utf-8"))
+ self.assertNotIn("parser test", (out / "facts.json").read_text(encoding="utf-8"))
+
+ def test_every_line_the_person_writes_is_checked(self):
+ """RS10: the strict rule and the hard filter on any line of script.md recap did not write (captions,
+ narration, labels, any key), each refusal named."""
+ out = self.tmp / "rs10"
+ showtime("recap", self.session, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ shapes = {"end.note": "Log in with zorgadmin:Zx9Qw8Er7Ty6", "hook.say": "Use passcode Zx9Qw8Er7Ty6 now.",
+ "stat.calls.label": "Ship portal.zorgagency.gov fix", "files.kicker": "Ticket 4821937 here"}
+ for key, text in shapes.items():
+ md = re.sub(r"(?m)^((?:show|say) %s:) .*$" % re.escape(key), lambda m: m.group(1) + " " + text, md)
+ md = md.replace("## end\n", "## end\n\nshow end.extra: Key Q9W8-E7R6-T5Y4-U3I2\n") # a key recap never writes
+ md = md.replace(re.search(r"show stat\.turns\.label: [^\n]*", md).group(0), "show stat.turns.label: rounds")
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render")
+ for key in list(shapes) + ["end.extra"]:
+ self.assertIn("refused %s from script.md" % key, cp.stderr, key)
+ self.assertNotIn("refused stat.turns.label", cp.stderr)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8").lower()
+ for w in ("zorg", "zx9q", "q9w8", "passcode", "4821937"):
+ self.assertNotIn(w, page, w)
+ self.assertIn("rounds", page) # a clean edit is used
+
+ def test_a_growing_session_keeps_recaps_own_lines(self):
+ """RS12: the transcript grows between the two calls (a recap run inside the live session). recap's own
+ earlier lines (file paths, a "Most used" line with python3) are kept as the person left them, never
+ "refused", and the page shows what script.md says."""
+ p = self.tmp / "growing.jsonl"
+ shutil.copy(self.session, p)
+ first = []
+ for i in range(3): # python3 tops the "Most used" line (the strict rule refuses python3)
+ first.append({"type": "assistant", "timestamp": "2026-10-01T10:3%d:00.000Z" % i, "cwd": str(self.repo),
+ "sessionId": "0000-fixture", "message": {"id": "f%d" % i, "content": [
+ {"type": "tool_use", "id": "f%d" % i, "name": "Bash",
+ "input": {"command": "python3 tools/x.py"}}]}})
+ first.append({"type": "user", "timestamp": "2026-10-01T10:3%d:02.000Z" % i, "cwd": str(self.repo),
+ "sessionId": "0000-fixture", "message": {"content": [
+ {"type": "tool_result", "tool_use_id": "f%d" % i, "content": "ok"}]}})
+ with open(p, "a", encoding="utf-8") as fh:
+ fh.write("\n".join(json.dumps(e) for e in first) + "\n")
+ out = self.tmp / "rs12"
+ showtime("recap", p, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ cmds = re.search(r"show timeline\.commands: ([^\n]*)", md).group(1)
+ self.assertIn("python3", cmds)
+ extra = []
+ for i in range(2): # two more test runs and a python3 call, an hour later
+ extra.append({"type": "assistant", "timestamp": "2026-10-01T11:0%d:00.000Z" % i, "cwd": str(self.repo),
+ "sessionId": "0000-fixture", "message": {"id": "g%d" % i, "content": [
+ {"type": "tool_use", "id": "g%d" % i, "name": "Bash",
+ "input": {"command": "python3 -m pytest -q && python3 tools/x.py"}}]}})
+ extra.append({"type": "user", "timestamp": "2026-10-01T11:0%d:05.000Z" % i, "cwd": str(self.repo),
+ "sessionId": "0000-fixture", "message": {"content": [
+ {"type": "tool_result", "tool_use_id": "g%d" % i,
+ "content": "========== 12 passed in 0.40s =========="}]}})
+ with open(p, "a", encoding="utf-8") as fh:
+ fh.write("\n".join(json.dumps(e) for e in extra) + "\n")
+ cp = showtime("recap", p, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertNotIn("refused", cp.stderr)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8")
+ self.assertIn(rc._e(cmds.replace("Most used:", "").strip().split(" · ")[0]), page)
+ self.assertIn("parser.py", page)
+ # a deliberate edit that recap would not write is still checked
+ md = md.replace("show timeline.commands: " + cmds, "show timeline.commands: Most used: [email protected] ×3")
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", p, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertIn("refused timeline.commands", cp.stderr)
+ F = {"files": [{"path": "src/parser.py", "edited": 1}, {"path": "src/read_only.py", "read": 1, "edited": 0}]}
+ self.assertTrue(rc.own_line("file.3", "src/parser.py", {}, F))
+ self.assertFalse(rc.own_line("file.3", "src/zorg/secret.py", {}, F))
+ self.assertFalse(rc.own_line("file.3", "src/read_only.py", {}, F)) # a read file is not recap's row
+ self.assertTrue(rc.own_line("timeline.commands", "Most used: git commit ×2 · python3 -m pytest ×4", {}, F))
+ self.assertFalse(rc.own_line("timeline.commands", "Most used: ssh deploy@zorgbox ×2", {}, F))
+ # N-t: a count is at most 5 digits; a longer one is checked like any number
+ self.assertFalse(rc.own_line("timeline.commands", "Most used: git commit ×4821937", {}, F))
+ self.assertFalse(rc.own_line("timeline.commands", "Most used: git commit ×12345678901234", {}, F))
+
+ def _tf_session(self, path: Path, upto: int) -> None:
+ """A session in a Terraform repository whose most edited file is infra/main.tf; `upto` stages."""
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo), "sessionId": "tf",
+ "message": {"content": "Tidy the infra."}}]
+ n = 0
+ for stage in range(upto):
+ for target in ["infra/main.tf"] * (3 + stage) + ["README.md"] * (stage + 1):
+ n += 1
+ ts = "2026-10-01T1%d:%02d:%02dZ" % (stage, n // 60, n % 60)
+ ev.append({"type": "assistant", "timestamp": ts, "cwd": str(self.repo), "sessionId": "tf",
+ "message": {"id": "e%d" % n, "content": [
+ {"type": "tool_use", "id": "e%d" % n, "name": "Edit",
+ "input": {"file_path": str(self.repo / target), "old_string": "a", "new_string": "b"}}]}})
+ ev.append({"type": "user", "timestamp": ts, "cwd": str(self.repo), "sessionId": "tf",
+ "message": {"content": [{"type": "tool_result", "tool_use_id": "e%d" % n,
+ "content": "The file has been updated."}]}})
+ path.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+
+ def test_three_calls_on_a_growing_session(self):
+ """RS12-rest: call 1 writes script.md, calls 2 and 3 render while the session grows (most edited:
+ main.tf, which the strict rule alone would take for a host). Nothing is refused; the page shows script.md."""
+ p = self.tmp / "tf.jsonl"
+ out = self.tmp / "tf-out"
+ self._tf_session(p, 1)
+ showtime("recap", p, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ self.assertIn("main.tf", re.search(r"say files\.say: ([^\n]*)", md).group(1))
+ for upto in (2, 3):
+ self._tf_session(p, upto)
+ cp = showtime("recap", p, "--out", out, "--yes", "--no-voice", "--no-render")
+ self.assertNotIn("refused", cp.stderr, upto)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8")
+ for key in ("hook.title", "file.1.stat", "stat.calls.value", "lane.edit"):
+ text = re.search(r"show %s: ([^\n]*)" % re.escape(key), md).group(1)
+ self.assertIn(rc._e(text) if key != "lane.edit" else text.split()[-1], page, key)
+
+ def test_shapes_not_masks(self):
+ """RS14/RS15: lines are compared by shape with what recap writes, never erased and re-judged. Digits
+ inside words, a key word or user name that is also a file stem, and a read-only file's stem exempt nothing.
+ N-y: a snake_case files line with a stale count is recap's own."""
+ repo = self.tmp / "shapes-repo"
+ if not repo.exists():
+ repo.mkdir()
+ git(repo, "init", "-q", "-b", "main")
+ (repo / "x.txt").write_text("x\n", encoding="utf-8")
+ git(repo, "add", "-A")
+ git(repo, "commit", "-q", "-m", "x")
+ edits = ["api.py", "admin.py", "infra/deploy_infra.tf", "infra/deploy_infra.tf", "infra/deploy_infra.tf",
+ "notes/2026-10-12-1530.md", "notes/2026-10-12.md", "logs/2026/10/12/run.md",
+ "notes/Report 2026 10 12 1530.md", "notes/Minutes 2026 10 12.md", "notes/Plan 2026 10 12.md"]
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(repo), "sessionId": "sh",
+ "message": {"content": "Tidy up."}}]
+ for i, f in enumerate(edits + ["hunter2xyz.txt"]):
+ name = "Read" if f.endswith(".txt") else "Edit"
+ ev.append({"type": "assistant", "timestamp": "2026-10-01T10:00:%02dZ" % (i + 1), "cwd": str(repo),
+ "sessionId": "sh", "message": {"id": "s%d" % i, "content": [
+ {"type": "tool_use", "id": "s%d" % i, "name": name,
+ "input": {"file_path": str(repo / f), "old_string": "a", "new_string": "b"}}]}})
+ ev.append({"type": "user", "timestamp": "2026-10-01T10:00:%02dZ" % (i + 1), "cwd": str(repo),
+ "sessionId": "sh", "message": {"content": [{"type": "tool_result", "tool_use_id": "s%d" % i,
+ "content": "ok"}]}})
+ p = self.tmp / "shapes.jsonl"
+ p.write_text("\n".join(json.dumps(e) for e in ev) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ facts = rc.collect(ses, *rc.repo_roots(ses))
+ fresh = rc.script_lines(facts)
+ own = lambda k, t: rc.own_line(k, t, fresh, facts) # noqa: E731
+ for key, text in (("stat.calls.value", "Ticket 4,821,937 here"), ("lane.read", "Account 4 821 937"),
+ ("stat.calls.value", "Ticket 4821937 here"), ("lane.read", "Account 48 21 93 77"),
+ ("stat.files.value", "Log in with Q7x2Lm9Kp4Rt"), ("stat.time.label", "api key swordfish"),
+ ("stat.turns.label", "admin:swordfish"), ("files.kicker", "password hunter2xyz")):
+ with self.subTest(key=key, text=text):
+ self.assertIsNone(own(key, text), (key, text))
+ self.assertTrue(rc.free_text_refused(text), (key, text))
+ for key in ("file.1", "callout.1"): # a file the session only read is never recap's row
+ with self.subTest(read_only=key):
+ self.assertIsNone(own(key, "hunter2xyz.txt"), key)
+ self.assertEqual(own("stat.calls.value", "12"), "own") # a stale count
+ self.assertEqual(own("stat.calls.value", "12,345"), "own") # 5 digits, grouped
+ # RS16: a stale count is 1-5 digits in all, grouping included; longer comma numbers are never own
+ for value in ("4,111,111,111,111,111", "123,456,789", "5,551,234,567", "123,456"):
+ for key in ("stat.calls.value", "hook.meta", "diff.adds"):
+ if key not in fresh:
+ continue
+ with self.subTest(key=key, value=value):
+ self.assertNotEqual(own(key, fresh[key]["text"].replace(
+ re.findall(r"[0-9][0-9,]*", fresh[key]["text"])[0], value, 1)), "own")
+ import time
+ t = time.time()
+ rc._shape("1," + "111," * 75000 + "111a") # 300 KB: linear
+ self.assertLess(time.time() - t, 1.0)
+ for big in ("9" * 300000, "a." * 150000, "1" * 40000 + "a"): # RS19: digits, a.a.
+ for key in ("stat.calls.value", "files.say", "file.1"):
+ t = time.time()
+ rc.own_line(key, big, fresh, facts)
+ with self.subTest(rs19=(key, big[:6])):
+ self.assertLess(time.time() - t, 1.0)
+ self.assertEqual(own("stat.calls.value", "1234567"), "stale") # a 6+ digit count: today's
+ # RS17: digits inside a path (a dated note, a dated folder) are never counts. Another number written
+ # there (a card, an SSN) is not recap's row, in file.N, callout.N or the files line
+ by_path = {ln["text"]: k for k, ln in fresh.items() if re.fullmatch(r"(file|callout)\.\d+", k)}
+ for real, fake in (("notes/2026-10-12-1530.md", "notes/5500-0000-0000-0004.md"),
+ ("notes/2026-10-12.md", "notes/123-45-6789.md"),
+ ("logs/2026/10/12/run.md", "logs/4111/1111/1111/run.md"),
+ ("2026-10-12-1530.md", "5500-0000-0000-0004.md"), ("2026-10-12.md", "123-45-6789.md")):
+ key = by_path.get(real) or ("callout.1" if "/" not in real else "file.1")
+ row = dict(fresh, **{key: {"scene": "files", "kind": "show", "text": real}}) # recap's row for it
+ with self.subTest(real=real, fake=fake):
+ self.assertEqual(rc.own_line(key, real, row, facts), "own")
+ self.assertNotEqual(rc.own_line(key, fake, row, facts), "own")
+ self.assertTrue(rc.free_text_refused(fake), fake) # not own: the strict rule refuses it
+ f = next((x for x in facts["files"] if x["path"].endswith(real)), None)
+ if f and real.rsplit("/", 1)[-1] != fake.rsplit("/", 1)[-1]:
+ say = rc.files_say(f, {}, 3)
+ with self.subTest(files_say=say):
+ self.assertEqual(own("files.say", say), "own")
+ faked = say.replace(real.rsplit("/", 1)[-1][:-3], fake.rsplit("/", 1)[-1][:-3])
+ self.assertNotEqual(own("files.say", faked), "own")
+ self.assertTrue(rc.free_text_refused(faked), faked)
+ # RS18: a file's name is never shape-compared, whatever separates its digit runs (spaces, several
+ # spaces, a tab, NBSP, a thin space): only the exact name of an edited file is recap's
+ n_ed = sum(1 for x in facts["files"] if x["edited"])
+ for real, fake in (("notes/Report 2026 10 12 1530.md", "notes/Report 5500 0000 0000 0004.md"),
+ ("notes/Minutes 2026 10 12.md", "notes/Minutes 123 45 6789.md"),
+ ("notes/Plan 2026 10 12.md", "notes/Plan 4111 1111 1111.md"),
+ ("notes/Report 2026 10 12 1530.md", "notes/Report\t5500\t0000\t0000\t0004.md"),
+ ("notes/Report 2026 10 12 1530.md", "notes/Report\u00a05500\u00a00000\u00a00000\u00a00004.md"),
+ ("notes/Report 2026 10 12 1530.md", "notes/Report\u20095500\u20090000\u20090000\u20090004.md")):
+ f = next(x for x in facts["files"] if x["path"] == real)
+ name_real, name_fake = real.rsplit("/", 1)[-1], fake.rsplit("/", 1)[-1]
+ row = dict(fresh, **{"file.1": {"scene": "files", "kind": "show", "text": real},
+ "callout.1": {"scene": "timeline", "kind": "show", "text": name_real}})
+ with self.subTest(rs18=fake):
+ self.assertEqual(rc.own_line("file.1", real, row, facts), "own")
+ self.assertNotEqual(rc.own_line("file.1", fake, row, facts), "own")
+ self.assertTrue(rc.free_text_refused(fake), fake)
+ self.assertEqual(rc.own_line("callout.1", name_real, row, facts), "own")
+ self.assertNotEqual(rc.own_line("callout.1", name_fake, row, facts), "own")
+ self.assertTrue(rc.free_text_refused(name_fake), name_fake)
+ for p_ in ({}, {real: [30, 1]}):
+ say, spoken = rc.files_say_parts(f, p_, n_ed)
+ fake_spoken = rc.files_say_parts(dict(f, path=fake), p_, n_ed)[1]
+ self.assertEqual(rc.own_line("files.say", say, row, dict(facts, diff=dict(facts["diff"], per_file=p_))),
+ "own")
+ self.assertNotEqual(rc.own_line("files.say", say.replace(spoken, fake_spoken), row,
+ dict(facts, diff=dict(facts["diff"], per_file=p_))), "own")
+ self.assertTrue(rc.free_text_refused(say.replace(spoken, fake_spoken)))
+ # N-ag: script.md lines are read with their whitespace runs collapsed; an edited name with two spaces still
+ # matches at any key (a row that moved in a growing session)
+ self.assertEqual(rc.own_line("file.7", "notes/Plan 2026 10 12.md", {}, facts), "own")
+ self.assertEqual(rc.own_line("callout.4", "Plan 2026 10 12.md", {}, facts), "own")
+ self.assertIn("deploy infra.tf", fresh["files.say"]["text"])
+ self.assertEqual(own("files.say", fresh["files.say"]["text"].replace("3 of them", "2 of them")), "own")
+ self.assertEqual(own("files.say", "Most edits went into zorg.internal: 2 of them."), None)
+
+ def test_hand_edited_facts_json_is_not_trusted(self):
+ """RS13: facts.json is output, never trusted. Private text put into it, with matching script.md lines,
+ is refused on --yes. N-u: a malformed facts.json does not crash the call."""
+ out = self.tmp / "rs13"
+ showtime("recap", self.session, "--out", out)
+ facts = json.loads((out / "facts.json").read_text(encoding="utf-8"))
+ facts["files"][0]["path"] = "Use passcode Zx9Qw8Er7Ty6"
+ facts["tests"][-1]["unit"] = "ZORG zorgadmin:Zx9Qw8Er7Ty6"
+ facts["commands"][0][0] = "Ship portal.zorgagency.gov fix"
+ (out / "facts.json").write_text(json.dumps(facts), encoding="utf-8")
+ md = (out / "script.md").read_text(encoding="utf-8")
+ md = re.sub(r"(?m)^show file\.1: .*$", "show file.1: Use passcode Zx9Qw8Er7Ty6", md)
+ md = re.sub(r"(?m)^show tests\.label: .*$", "show tests.label: ZORG zorgadmin:Zx9Qw8Er7Ty6 tests passed", md)
+ md = re.sub(r"(?m)^show timeline\.commands: .*$", "show timeline.commands: Most used: Ship portal.zorgagency.gov fix ×1", md)
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render")
+ for key in ("file.1", "tests.label", "timeline.commands"):
+ self.assertIn("refused %s from script.md" % key, cp.stderr, key)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8").lower()
+ for w in ("passcode", "zorg", "zx9q"):
+ self.assertNotIn(w, page, w)
+ (out / "facts.json").write_text("[1, 2, {\"path\": 5}]", encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--no-render", check=False)
+ self.assertEqual(cp.returncode, 0, cp.stderr[-800:])
+
+ def test_wrappers_anywhere_and_linear_line_starts(self):
+ """N-v: a known wrapper ends the text wherever it sits (mid-line, after a no-break space or U+2028).
+ N-w: the line-start test is linear."""
+ import time
+ for text in ("Fix it. <system-reminder>Zorg note", "Fix it.\u00a0<system-reminder>Zorg note",
+ "Fix it.\u2028<ide_selection>Zorg note"):
+ self.assertNotIn("Zorg", rc._strip_tags(text), repr(text))
+ for big in ("x\t<a-b>" * 70000, "<a-b>" * 100000):
+ t = time.time()
+ rc._strip_tags(big)
+ self.assertLess(time.time() - t, 1.0)
+
+ def test_wrapper_tags_and_inline_tags(self):
+ """N-p: an unclosed dashed tag inside the person's sentence is dropped alone; a wrapper that starts a
+ line still ends the text. N-q: a text block that starts with a block-style tag goes whole (nested reminders)."""
+ self.assertIn("hover state in the header", rc._strip_tags("Please fix the <my-button> hover state in the header."))
+ self.assertNotIn("Zorg", rc._strip_tags("Fix it.\n<ide_selection>Zorg note runs on"))
+ p = self.tmp / "nested.jsonl"
+ ev = [{"type": "user", "timestamp": "2026-10-01T10:00:00Z", "cwd": str(self.repo), "sessionId": "s",
+ "message": {"content": [
+ {"type": "text", "text": "<system-reminder> a <system-reminder> b </system-reminder> Zorg note "
+ "</system-reminder>"},
+ {"type": "text", "text": "Fix the parser bug."}]}}]
+ p.write_text(json.dumps(ev[0]) + "\n", encoding="utf-8")
+ ses = rc.parse_session(p)
+ self.assertEqual(ses["request"].strip(), "Fix the parser bug.")
+
+ def test_spoken_file_name_and_plurals(self):
+ """N-m: the most edited file is spoken as its stem's words and its extension. Linux smoke: "1 path"."""
+ f = json.loads(json.dumps(self.facts))
+ f["files"] = [{"path": "src/test_cut_frames.py", "read": 0, "edited": 4, "first": 1, "first_edit": 1},
+ {"path": "src/b.py", "read": 0, "edited": 1, "first": 2, "first_edit": 2}]
+ f["diff"]["per_file"] = {}
+ say = rc.script_lines(f)["files.say"]["text"]
+ self.assertIn("test cut frames.py", say)
+ self.assertNotIn("_", say)
+ f["files_outside"] = 1
+ self.assertIn("1 path outside", rc.summary(f))
+
+ def test_default_out_missing_folder_inside_a_repo(self):
+ """RS7: a SHOWTIME_OUT that does not exist yet, inside a repository that would track it, is refused."""
+ for sub in ("newdir", "a/b/showtime-out"):
+ cp = showtime("recap", self.session, check=False, cwd=self.tmp,
+ env=dict(ENV, SHOWTIME_OUT=str(self.repo / sub)))
+ self.assertNotEqual(cp.returncode, 0, sub)
+ self.assertIn("inside a git repository", cp.stderr)
+ self.assertFalse((self.repo / sub.split("/")[0]).exists(), sub)
+
+ def test_script_from_another_session(self):
+ out = self.tmp / "out2"
+ showtime("recap", self.session, "--out", out)
+ cp = showtime("recap", self.sub, "--out", out, check=False)
+ self.assertNotEqual(cp.returncode, 0)
+ self.assertIn("another session", cp.stderr)
+ showtime("recap", self.sub, "--out", out, "--fresh")
+
+ def test_latest(self):
+ home = self.tmp / "claude"
+ proj = home / "projects" / rc.project_slug(self.repo)
+ proj.mkdir(parents=True)
+ shutil.copy(self.session, proj / "0000aaaa-fixture.jsonl")
+ env_old = os.environ.get("CLAUDE_CONFIG_DIR")
+ os.environ["CLAUDE_CONFIG_DIR"] = str(home)
+ try:
+ self.assertEqual(rc.latest_session(self.repo / "src"), proj / "0000aaaa-fixture.jsonl")
+ self.assertEqual(rc.find_session("0000aaaa-fixture"), proj / "0000aaaa-fixture.jsonl")
+ finally:
+ if env_old is None:
+ os.environ.pop("CLAUDE_CONFIG_DIR", None)
+ else:
+ os.environ["CLAUDE_CONFIG_DIR"] = env_old
+
+ @unittest.skipIf(FAST, "--fast: the voice is synthesized")
+ def test_a_persons_say_line_reaches_neither_page_nor_voice(self):
+ """A person's say and show lines with a hidden-character card are refused: neither index.html nor the
+ narration (voice/narration.md, the captions' source) holds them."""
+ out = self.tmp / "say-cli"
+ showtime("recap", self.session, "--out", out)
+ md = (out / "script.md").read_text(encoding="utf-8")
+ card = "\u200b".join("4111111111111111")
+ md = re.sub(r"(?m)^say hook\.say: .*$", "say hook.say: Pay with " + card + " today.", md)
+ md = re.sub(r"(?m)^show end\.note: .*$", "show end.note: Card " + card + " ends it.", md)
+ md = re.sub(r"(?m)^say numbers\.say: .*$", "say numbers.say: Pay 4111 then 1111 then 1111 then 1111 now.", md)
+ (out / "script.md").write_text(md, encoding="utf-8")
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-render")
+ for key in ("hook.say", "end.note", "numbers.say"):
+ self.assertIn("refused %s from script.md" % key, cp.stderr, key)
+ page = (out / "project" / "index.html").read_text(encoding="utf-8")
+ narration = (out / "project" / "voice" / "narration.md").read_text(encoding="utf-8")
+ for text in (page, narration):
+ self.assertNotIn("4111", text.replace("\u200b", ""))
+ self.assertNotIn("\u200b", text)
+
+ @unittest.skipIf(FAST, "--fast: no render")
+ def test_end_to_end_render_and_qa(self):
+ out = self.tmp / "e2e"
+ showtime("recap", self.session, "--out", out) # the script, read first
+ cp = showtime("recap", self.session, "--out", out, "--yes", "--no-voice", "--preview", "--json",
+ "--music", "minimal-pulse", check=False)
+ res = json.loads(cp.stdout[cp.stdout.index("{"):])
+ self.assertTrue(Path(res["video"]).is_file(), cp.stderr[-2000:])
+ self.assertIn(res["qa"]["verdict"], ("PASS", "WARN"), res["qa"])
+ text = all_text(out)
+ for bad in PLANTED + (str(self.repo),):
+ self.assertNotIn(bad, text, bad)
+
+
+if __name__ == "__main__":
+ argv = [a for a in sys.argv if a != "--fast"]
+ unittest.main(argv=argv)
diff --git a/skills/showtime/tests/test_release_video.py b/skills/showtime/tests/test_release_video.py
index 75fb8bb..907e886 100644
--- a/skills/showtime/tests/test_release_video.py
+++ b/skills/showtime/tests/test_release_video.py
@@ -193,7 +193,9 @@ class TestPlanAndPage(unittest.TestCase):
self.assertEqual(cfg["expect"]["must_show"], ["acme-tool"])
mix = json.loads((tmp / "p" / "audio" / "mix.json").read_text(encoding="utf-8"))
self.assertEqual(mix["tracks"][0]["compose"]["style"], "minimal-pulse")
- self.assertEqual(len([t for t in mix["tracks"] if t["kind"] == "sfx"]), len(p["scenes"]) - 1)
+ self.assertEqual([t for t in mix["tracks"] if t["kind"] == "sfx"], []) # no sound on the cuts
+ self.assertEqual(len([t for t in rv.build_mix(p, cut_sounds=True)["tracks"] if t["kind"] == "sfx"]),
+ len(p["scenes"]) - 1) # --cut-sounds: opt in
scenes = re.findall(r'data-dur="([\d.]+)"', (tmp / "p" / "index.html").read_text(encoding="utf-8"))
self.assertAlmostEqual(sum(map(float, scenes)), cfg["duration"], places=1)
with self.assertRaises(FileExistsError):
diff --git a/skills/showtime/tests/test_repro.py b/skills/showtime/tests/test_repro.py
new file mode 100644
index 0000000..3b7937c
--- /dev/null
+++ b/skills/showtime/tests/test_repro.py
@@ -0,0 +1,1186 @@
+#!/usr/bin/env python3
+"""`showtime repro` (lib/st/repro.py, cli_repro.py): a failing Playwright test -> a narrated video for a bug report.
+
+Pure Python, no browser: the trace parser on a real trace (fixtures/repro/trace.zip, written by
+`playwright test --trace on` from fixtures/repro/login.spec.js against fixtures/repro/app/, machine paths replaced
+by /home/user), a library-only trace (what `pytest --tracing on` writes) and an attack trace (the fixture edited:
+keyboard.type, a type="password" field, secrets in console and error text, an error the test caught) built here;
+the filters (typed values, query strings, paths, auth headers, NAME=value, e-mails, --redact everywhere it shows,
+linear time), the limits on big traces, locators and captions, script.md and its edits, the plan, the captions
+file, the runner (flags, environment, where traces are looked for), and the CLI without rendering (the review
+gate, every file of the job, nothing left behind, a fake pytest for the command path). With a browser (skipped under --fast and when Playwright or its browser is missing): the
+fixture test run with tracing on by `showtime repro -- node .../cli.js test` (a real trace, deleted after it was
+read), and `showtime repro <trace.zip>` then `--yes --no-voice --preview` end to end (repro.mp4, steps.json,
+repro.md, qa PASS or WARN, no path of the machine outside the ledger and qa's reports).
+
+usage: python tests/test_repro.py [--fast] [-v]
+"""
+from __future__ import annotations
+
+import _isolate # noqa: F401 (run from a scratch folder: never write into the repository)
+
+import json
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+import unittest
+import zipfile
+from unittest import mock
+from pathlib import Path
+
+from _listen import needs_listen, skip_if_listen_refused
+
+TESTS_DIR = Path(__file__).resolve().parent
+SKILL = TESTS_DIR.parent
+LAUNCHER = SKILL / "lib" / "st" / "launcher.py"
+FIX = TESTS_DIR / "fixtures" / "repro"
+TRACE = FIX / "trace.zip"
+sys.path.insert(0, str(SKILL / "lib"))
+
+from st import repro as rp # noqa: E402
+from st.common import ShowtimeError # noqa: E402
+from st.launcher import build_env, showtime_home # noqa: E402
+
+FAST = "--fast" in sys.argv
+HOME = showtime_home()
+ENV = build_env(HOME)
+NODE = shutil.which("node", path=ENV.get("PATH"))
+NM = HOME / "node" / "node_modules"
+BROWSERS = HOME / "browsers"
+READY = bool(NODE) and (NM / "playwright" / "cli.js").is_file() and any(BROWSERS.glob("chromium*"))
+# what the fixture test types and visits: none of it may reach a text the film, the captions or the reports show
+SECRETS = ("hunter2-not-real", "tok-0000-not-real", "s3ss10n-n0t-real", "session=", "[email protected]")
+# what the attack trace (attack_trace) adds: typed with the keyboard, logged by the app, the machine's paths
+ATTACK = SECRETS + ("kb-secret-77xy", "abcd1234efgh5678ijkl9999", "ERRTOK-7766-ab", "zz9988xx", "ada.lovelace",
+ "hunter3pw", "alice.smith", "/Users/alice", "/home/user", "Sup3rS3cretPw")
+SCREENSHOTS = "screenshots are shown as captured; --redact does not touch pixels"
+
+
+def showtime(*args, check=True, env=None, cwd=None, timeout=300, stdin=None):
+ cp = subprocess.run([sys.executable, str(LAUNCHER)] + [str(a) for a in args], env=env or ENV, cwd=cwd,
+ stdin=stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8",
+ errors="replace", timeout=timeout)
+ if check and cp.returncode != 0:
+ raise AssertionError("showtime %s failed (rc=%d):\n%s\n%s" % (
+ " ".join(map(str, args)), cp.returncode, cp.stdout[-3000:], cp.stderr[-3000:]))
+ return cp
+
+
+def texts_of(folder: Path):
+ """Every file under a folder, as text (screenshots too: no secret may sit in their bytes either)."""
+ for f in sorted(folder.rglob("*")):
+ if f.is_file():
+ yield f, f.read_bytes().decode("utf-8", errors="replace")
+
+
+LEDGER = ("job.json", "SHOWTIME.md") # showtime's own bookkeeping: the job's folder and its tools' paths
+
+
+def assert_clean(test, job: Path, planted, machine=()):
+ """No file of the job holds a planted secret or the trace's machine paths; no file but the ledger (and the
+ reports qa keeps in work/) holds a path of this machine."""
+ for f, text in texts_of(job):
+ for s in planted:
+ test.assertNotIn(s, text, "%s shows %r" % (f.relative_to(job), s))
+ if f.name not in LEDGER and f.relative_to(job).parts[0] != "work":
+ for s in machine:
+ test.assertNotIn(s, text, "%s shows the path %r" % (f.relative_to(job), s))
+
+
+def jpeg_bytes() -> bytes:
+ with zipfile.ZipFile(str(TRACE)) as z:
+ return z.read(next(n for n in z.namelist() if n.endswith(".jpeg")))
+
+
+def library_trace(path: Path, n_steps: int, *, fail: bool = True, secret_field: bool = False,
+ keyboard: bool = False) -> Path:
+ """A trace with only the library's events (what pytest --tracing on writes): goto, then clicks, then (failing)
+ an expect; a frame per step; stacks pointing at tests/test_long.py. `keyboard`: step 2 clicks a password field
+ known only by type="password" (label "Mot de passe") and step 3 types into it with page.keyboard.type."""
+ ev = [{"version": 9, "type": "context-options", "origin": "library", "browserName": "chromium",
+ "playwrightVersion": "1.63.0", "sdkLanguage": "python", "wallTime": 1, "monotonicTime": 0,
+ "options": {"viewport": {"width": 1000, "height": 500}}}]
+ stacks = []
+ t = 100.0
+ files = {}
+ for i in range(n_steps):
+ cid = 10 + 2 * i
+ last = i == n_steps - 1
+ cls = "Frame"
+ if i == 0:
+ before = {"method": "goto", "params": {"url": "https://shop.example.test/cart?coupon=SECRET-COUPON#top"}}
+ elif last:
+ before = {"method": "expect", "title": 'Expect "toHaveText"',
+ "params": {"selector": "internal:testid=[data-testid=\"total\"s]", "expression": "to.have.text",
+ "expectedText": [{"string": "$10.00"}], "isNot": False}}
+ elif secret_field and i == 1:
+ before = {"method": "fill", "params": {"selector": "#otp", "value": "918273"}}
+ elif keyboard and i == 1:
+ before = {"method": "click", "params": {"selector": "internal:label=\"Mot de passe\"i"}}
+ elif keyboard and i == 2:
+ before, cls = {"method": "keyboardType", "params": {"text": "kb-secret-77xy"}}, "Page"
+ else:
+ before = {"method": "click", "params": {"selector": "internal:role=button[name=\"Add %d\"i]" % i}}
+ ev.append(dict({"type": "before", "callId": "call@%d" % cid, "startTime": t, "class": cls}, **before))
+ if secret_field and i == 1:
+ ev.append({"type": "log", "callId": "call@%d" % cid, "time": t + 1,
+ "message": " locator resolved to <input id=\"otp\" name=\"code\" autocomplete=\"one-time-code\"/>"})
+ if keyboard and i == 1:
+ ev.append({"type": "log", "callId": "call@%d" % cid, "time": t + 1,
+ "message": " locator resolved to <input id=\"mdp\" type=\"password\"/>"})
+ ev.append({"type": "input", "callId": "call@%d" % cid, "point": {"x": 500, "y": 150},
+ "box": {"x": 300, "y": 130, "width": 400, "height": 40}})
+ elif before["method"] == "click":
+ ev.append({"type": "log", "callId": "call@%d" % cid, "time": t + 1,
+ "message": "waiting for getByRole('button', { name: 'Add %d' })" % i})
+ ev.append({"type": "input", "callId": "call@%d" % cid, "point": {"x": 500, "y": 250},
+ "box": {"x": 450, "y": 230, "width": 100, "height": 40}})
+ if last and fail:
+ ev.append({"type": "log", "callId": "call@%d" % cid, "time": t + 2, "message": ' unexpected value "$12.00"'})
+ name = "resources/frame-%03d.jpeg" % i
+ files[name] = jpeg_bytes()
+ ev.append({"type": "screencast-frame", "pageId": "page@1", "file": name, "width": 1000, "height": 500,
+ "timestamp": t + 5})
+ ev.append(dict({"type": "after", "callId": "call@%d" % cid, "endTime": t + 20},
+ **({"error": {"message": "Expect failed"}} if last and fail else {})))
+ stacks.append([cid, [[0, 5 + i, 4, ""]]])
+ t += 100.0
+ with zipfile.ZipFile(str(path), "w") as z:
+ z.writestr("trace.trace", "\n".join(json.dumps(e) for e in ev) + "\n")
+ z.writestr("trace.stacks", json.dumps({"files": ["/home/user/shop/tests/test_long.py"], "stacks": stacks}))
+ for k, v in files.items():
+ z.writestr(k, v)
+ return path
+
+
+def built_trace(path: Path, calls) -> Path:
+ """A library-only trace from call specs: {method, cls, params, resolved (the element the locator resolved
+ to), box, error, snaps: [(phase, html)]}, a 1000x500 page, one screencast frame after each call."""
+ ev = [{"version": 9, "type": "context-options", "origin": "library", "browserName": "chromium",
+ "playwrightVersion": "1.63.0", "sdkLanguage": "python", "wallTime": 1, "monotonicTime": 0,
+ "options": {"viewport": {"width": 1000, "height": 500}}}]
+ files = {}
+ t = 100.0
+ for i, c in enumerate(calls):
+ cid = "call@%d" % (10 + 2 * i)
+ ev.append({"type": "before", "callId": cid, "startTime": t, "class": c.get("cls", "Frame"),
+ "method": c["method"], "params": c.get("params") or {}, **({"title": c["title"]} if "title" in c else {})})
+ if c.get("resolved"):
+ ev.append({"type": "log", "callId": cid, "time": t + 1, "message": " locator resolved to " + c["resolved"]})
+ if c.get("box"):
+ x, y, w, h = c["box"]
+ ev.append({"type": "input", "callId": cid, "point": {"x": x + w / 2, "y": y + h / 2},
+ "box": {"x": x, "y": y, "width": w, "height": h}})
+ for phase, html in c.get("snaps") or ():
+ ev.append({"type": "frame-snapshot", "snapshot": {
+ "callId": cid, "phase": phase, "pageId": "page@1", "frameId": "frame@1",
+ "frameUrl": "https://app.example.test/form", "isMainFrame": True, "html": html}})
+ name = "resources/frame-%03d.jpeg" % i
+ files[name] = jpeg_bytes()
+ ev.append({"type": "after", "callId": cid, "endTime": t + 20, **({"error": c["error"]} if c.get("error") else {})})
+ ev.append({"type": "screencast-frame", "pageId": "page@1", "file": name, "width": 1000, "height": 500,
+ "timestamp": t + 30})
+ t += 100.0
+ with zipfile.ZipFile(str(path), "w") as z:
+ z.writestr("trace.trace", "\n".join(json.dumps(e) for e in ev) + "\n")
+ for k, v in files.items():
+ z.writestr(k, v)
+ return path
+
+
+def form(token="", scroll=0, target=None, other=True):
+ """A page's DOM snapshot: the API token field (its value, as Playwright records it), a button, and maybe
+ another field; `scroll`: the page scrolled down that many pixels; `target`: the element the call acts on."""
+ tgt = lambda name: {"__playwright_target__": ""} if target == name else {} # noqa: E731
+ body = ["BODY", {}, ["INPUT", dict({"id": "token", "name": "api_token", "type": "text",
+ "__playwright_value_": token}, **tgt("token"))],
+ ["BUTTON", dict({"id": "go"}, **tgt("go")), "Go"]]
+ if other:
+ body.append(["INPUT", dict({"id": "email", "type": "email", "__playwright_value_": ""}, **tgt("email"))])
+ return ["HTML", {"__playwright_scroll_top_": str(scroll)} if scroll else {}, ["HEAD", {}], body]
+
+
+def node_count(html) -> int:
+ """How many nodes a snapshot numbers (strings and elements; references are not numbered)."""
+ if isinstance(html, str):
+ return 1
+ if html and isinstance(html[0], list):
+ return 0
+ return 1 + sum(node_count(c) for c in html[2:])
+
+
+def boxes(step):
+ """A step's covers, as boxes (without the step each one is for)."""
+ return [{k: c[k] for k in ("x", "y", "w", "h")} for c in step["covers"]]
+
+
+EXPECT_FAIL = {"method": "expect", "title": 'Expect "toHaveText"', "error": {"message": "Expect failed"},
+ "params": {"selector": "#out", "expression": "to.have.text", "expectedText": [{"string": "ok"}]}}
+
+
+ATTACK_LOG = ("GET https://admin:[email protected]/login?next=/x&sid=s3ss10n-n0t-real#access_token=zz "
+ "failed: Authorization: Bearer abcd1234efgh5678ijkl9999 token ERRTOK-7766-ab) api_key=zz9988xx rejected "
+ "for [email protected] password: hunter3pw at /Users/alice.smith/acme/app.js:3")
+
+
+def attack_trace(path: Path, *, caught: bool = False, passing: bool = False, same: bool = False) -> Path:
+ """The fixture trace, edited: the machine's paths are /Users/alice.smith/; the password field is known only
+ by type="password" (label "Mot de passe"); step 4 types with page.keyboard.type (no locator) instead of
+ filling the API token field; the console error and the failure carry a Bearer token, `token X`, NAME=value
+ secrets, an e-mail and a home path. `caught`: step 2 also has an error the test caught. `passing`: the test
+ passed (no error event, the expect passed), with step 2's caught error left. `same`: the caught error has
+ the same first line as the test's own (a retry loop in try/catch)."""
+ with zipfile.ZipFile(str(TRACE)) as src:
+ final = next(json.loads(x)["message"] for x in src.read("test.trace").decode("utf-8").splitlines()
+ if x.strip() and json.loads(x).get("type") == "error")
+ with zipfile.ZipFile(str(TRACE)) as src, zipfile.ZipFile(str(path), "w") as dst:
+ for info in src.infolist():
+ data = src.read(info.filename)
+ if info.filename.endswith(".trace"):
+ out = []
+ for line in data.decode("utf-8").splitlines():
+ if not line.strip():
+ continue
+ e = json.loads(line)
+ cid = e.get("callId") or e.get("stepId")
+ if e.get("type") == "before" and cid == "pw:api@46":
+ e["subtitle"] = e["params"]["locator"] = "getByLabel('Mot de passe')"
+ if e.get("type") == "before" and cid == "call@15":
+ e["params"]["selector"] = "internal:label=\"Mot de passe\"i"
+ if e.get("type") == "log" and cid == "call@15" and "locator resolved" in e["message"]:
+ e["message"] = " locator resolved to <input id=\"mdp\" type=\"password\"/>"
+ if e.get("type") == "before" and cid == "pw:api@47":
+ e.update(title='Type "kb-secret-77xy"', subtitle="", params={"text": "kb-secret-77xy"})
+ if e.get("type") == "before" and cid == "call@17":
+ e.update({"class": "Page", "method": "keyboardType", "params": {"text": "kb-secret-77xy"}})
+ if cid == "call@17" and (e.get("type") == "input" or e.get("type") == "log"
+ and ("waiting for" in e["message"] or "resolved" in e["message"])):
+ continue
+ if e.get("type") == "console":
+ e["text"] = ATTACK_LOG
+ e["args"] = []
+ if e.get("type") == "error" or (e.get("type") == "after" and e.get("error")):
+ target = e if e.get("type") == "error" else e["error"]
+ target["message"] = target["message"].replace(
+ "Timeout: 1500ms\n", "Timeout: 1500ms\nServer said: " + ATTACK_LOG + "\n")
+ if passing:
+ if e.get("type") == "error":
+ continue
+ e.pop("error")
+ if caught or passing or same:
+ if e.get("type") == "after" and cid in ("pw:api@45", "call@13"):
+ e["error"] = {"message": final if same else "TimeoutError: locator.click: Timeout 500ms "
+ "exceeded.\nCall log:\n - waiting for getByLabel('Email')"}
+ out.append(json.dumps(e))
+ data = ("\n".join(out) + "\n").encode("utf-8")
+ data = data.replace(b"tok-0000-not-real", b"kb-secret-77xy").replace(b"/home/user/", b"/Users/alice.smith/")
+ dst.writestr(info, data)
+ return path
+
+
+def fake_pytest(folder: Path, *, into_cwd: bool = False) -> Path:
+ """An executable named pytest that copies the fixture trace (a failing test) to <--output>/t1/trace.zip, as
+ `pytest --tracing retain-on-failure` would; `into_cwd`: into ./elsewhere/ instead (where showtime never looks)."""
+ folder.mkdir(parents=True, exist_ok=True)
+ exe = folder / "pytest"
+ exe.write_text("#!%s\nimport os, shutil, sys\nargs = sys.argv[1:]\nout = args[args.index('--output') + 1]\n"
+ "dst = os.path.join(%s, 't1')\nos.makedirs(dst, exist_ok=True)\n"
+ "shutil.copyfile(%r, os.path.join(dst, 'trace.zip'))\nsys.exit(1)\n"
+ % (sys.executable, "'elsewhere'" if into_cwd else "out", str(TRACE)), encoding="utf-8")
+ exe.chmod(0o755)
+ return exe
+
+
+class TestParse(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.rep = rp.parse(TRACE)
+
+ def test_steps(self):
+ steps = self.rep["steps"]
+ self.assertEqual([s["kind"] for s in steps], ["goto", "fill", "fill", "fill", "click", "expect"])
+ self.assertEqual([s["caption"] for s in steps], [
+ "Open app/index.html",
+ "Type 16 characters into the 'Email' field",
+ "Type 16 characters into the 'Password' field",
+ "Type 17 characters into the 'API token' field",
+ "Click the 'Sign in' button",
+ "Expect the level-1 heading to have text \u201cWelcome, Ada!\u201d"])
+ self.assertEqual([s["line"] for s in steps], [7, 8, 9, 10, 11, 12])
+ self.assertTrue(all(s["file"] == "login.spec.js" for s in steps))
+ self.assertEqual([s["status"] for s in steps], ["passed"] * 5 + ["failed"])
+ click = steps[4]
+ self.assertEqual(click["point"], {"x": 50.0, "y": 65.96}) # 640, 474.9 in a 1280x720 page
+ self.assertEqual(click["box"], {"x": 33.59, "y": 62.54, "w": 32.81, "h": 6.83})
+ self.assertTrue(all(s["shot"] for s in steps))
+ self.assertEqual(self.rep["viewport"], {"width": 1280, "height": 720})
+ self.assertEqual((self.rep["browser"], self.rep["playwright"], self.rep["language"]),
+ ("chromium", "1.63.0", "javascript"))
+
+ def test_fill_scenes_show_the_page_after_the_fill(self):
+ """Screencast frames lag: a fill's screenshot is one taken after it ended, not the empty field."""
+ with zipfile.ZipFile(str(TRACE)) as z:
+ raw = rp.read_raw(z)
+ at = {e["file"]: e["timestamp"] for e in raw["lib"] if e.get("type") == "screencast-frame"}
+ ends = sorted(e["endTime"] for e in raw["lib"] if e.get("type") == "after" and e.get("callId") in
+ ("call@13", "call@15", "call@17"))
+ fills = [s for s in self.rep["steps"] if s["kind"] == "fill"]
+ for s, end in zip(fills, ends):
+ self.assertGreater(at[s["shot"]], end, "step %d shows a frame from before its fill" % s["n"])
+
+ def test_test_and_failure(self):
+ self.assertEqual(self.rep["test"], {"title": "signs in and greets the user", "file": "login.spec.js", "line": 6,
+ "location": "login.spec.js:6"})
+ f = self.rep["failure"]
+ self.assertEqual((f["step"], f["file"], f["line"]), (6, "login.spec.js", 12))
+ self.assertEqual(f["headline"], "expect(locator).toHaveText(expected) failed")
+ self.assertEqual(f["expected"]["text"], '"Welcome, Ada!"')
+ self.assertEqual(f["received"]["text"], '"Welcome back, Ada"')
+ # the parts Playwright marks as different (inverse video in its message)
+ self.assertEqual(f["expected"]["parts"], [['"Welcome, Ada', False], ["!", True], ['"', False]])
+ self.assertEqual(f["received"]["parts"], [['"Welcome', False], [" back", True], [', Ada"', False]])
+ self.assertEqual(f["details"], ["Timeout: 1500ms"])
+ self.assertEqual(f["call_log"], 'unexpected value "Welcome back, Ada"')
+ self.assertEqual(f["source"], {"line": 12, "text": "await expect(page.getByRole('heading', { level: 1 }))"
+ ".toHaveText('Welcome, Ada!', { timeout: 1500 });"})
+ self.assertEqual(self.rep["console"], [{"at": 0.799, "text": "Failed to load avatar for Ada: 404"}])
+
+ def test_a_caught_error_is_not_the_failure(self):
+ """An error the test caught (step 2's .catch()) neither is the failing step nor makes a passing test fail."""
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-caught-"))
+ try:
+ rep = rp.parse(attack_trace(tmp / "t.zip", caught=True))
+ self.assertEqual(rep["failure"]["step"], 6)
+ self.assertEqual(rep["failure"]["expected"]["text"], '"Welcome, Ada!"')
+ self.assertEqual([s["status"] for s in rep["steps"]], ["passed"] * 5 + ["failed"])
+ self.assertTrue(rep["steps"][1].get("caught"))
+ p = rp.plan(rep, rerun="")
+ self.assertIn("fail", [sc["id"] for sc in p["scenes"]])
+ self.assertEqual(p["shown_steps"], 6)
+ self.assertIn("2. Type 16 characters into the 'Email' field (`login.spec.js:8`) (an error the test caught)",
+ rp.markdown(rep, p))
+ self.assertEqual(rp.has_failure(tmp / "t.zip")[0], True)
+ self.assertEqual(rp.has_failure(attack_trace(tmp / "ok.zip", passing=True))[0], False)
+ # a caught error with the test's own first line (a retry loop): the last step that raised it failed
+ same = rp.parse(attack_trace(tmp / "same.zip", same=True))
+ self.assertEqual(same["failure"]["step"], 6)
+ self.assertEqual([s["status"] for s in same["steps"]], ["passed"] * 5 + ["failed"])
+ self.assertTrue(same["steps"][1].get("caught"))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_library_only_trace(self):
+ """pytest --tracing on: no runner steps, so the library's calls, stacks and expect params are used."""
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-lib-"))
+ try:
+ rep = rp.parse(library_trace(tmp / "trace.zip", 4))
+ self.assertEqual([s["caption"] for s in rep["steps"]], [
+ "Open shop.example.test/cart", "Click the 'Add 1' button", "Click the 'Add 2' button",
+ "Expect test id 'total' to have text \u201c$10.00\u201d"])
+ f = rep["failure"]
+ self.assertEqual((f["step"], f["file"], f["line"]), (4, "test_long.py", 8))
+ self.assertEqual((f["expected"]["text"], f["received"]["text"]), ("$10.00", "$12.00"))
+ self.assertEqual(f["headline"], "expect(...).toHaveText() failed")
+ self.assertEqual(rep["language"], "python")
+ self.assertEqual(rep["test"]["title"], "Playwright test")
+ self.assertNotIn("SECRET-COUPON", json.dumps(rep))
+ passing = rp.parse(library_trace(tmp / "ok.zip", 3, fail=False))
+ self.assertIsNone(passing["failure"])
+ self.assertEqual(rp.has_failure(tmp / "trace.zip")[0], True)
+ self.assertEqual(rp.has_failure(tmp / "ok.zip")[0], False)
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_not_a_trace(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-bad-"))
+ try:
+ (tmp / "a.zip").write_text("not a zip", encoding="utf-8")
+ with zipfile.ZipFile(str(tmp / "b.zip"), "w") as z:
+ z.writestr("readme.txt", "hi")
+ for name, msg in (("a.zip", "is not a zip file"), ("b.zip", "holds no Playwright trace"),
+ ("none.zip", "trace not found")):
+ with self.assertRaises(ShowtimeError) as cm:
+ rp.parse(tmp / name)
+ self.assertIn(msg, str(cm.exception))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_limits_on_big_traces(self):
+ """Members are counted, event lines are streamed with a length cap (a long DOM snapshot keeps only its
+ callId and frame URL) and big attachments are not opened."""
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-big-"))
+ saved = (rp.MAX_MEMBERS, rp.MAX_LINE, rp.MAX_ATTACHMENT)
+ try:
+ rp.MAX_MEMBERS = 5
+ with self.assertRaises(ShowtimeError) as cm:
+ rp.parse(TRACE)
+ self.assertIn("too large to read safely", str(cm.exception))
+ rp.MAX_MEMBERS = saved[0]
+ rp.MAX_LINE = 2000 # every frame snapshot of the fixture is longer
+ rep = rp.parse(TRACE)
+ self.assertEqual(rep["steps"][1]["url"], "app/index.html") # the snapshot's frame URL was kept
+ rp.MAX_LINE, rp.MAX_ATTACHMENT = saved[1], 100
+ self.assertEqual(rp.parse(TRACE, label="the-folder")["test"]["title"], "signs in and greets the user")
+ finally:
+ rp.MAX_MEMBERS, rp.MAX_LINE, rp.MAX_ATTACHMENT = saved
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_the_event_cap_is_counted_while_reading(self):
+ """The cap stops the read at the first event past it, not after a whole .trace member is in memory."""
+ real, read = rp._jsonl, []
+
+ def counting(*a, **k):
+ for e in real(*a, **k):
+ read.append(1)
+ yield e
+ with mock.patch.object(rp, "MAX_EVENTS", 10), mock.patch.object(rp, "_jsonl", counting):
+ with self.assertRaises(ShowtimeError) as cm:
+ rp.parse(TRACE)
+ self.assertIn("more than 10 events", str(cm.exception))
+ self.assertEqual(len(read), 11)
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-cap-"))
+ try: # the stacks are still read
+ self.assertEqual(rp.parse(library_trace(tmp / "t.zip", 3))["failure"]["file"], "test_long.py")
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+
+class TestRedaction(unittest.TestCase):
+ def test_secret_fields(self):
+ for yes in ("Password", "password_confirm", "api_key", "API key", "apiKey", "otp", "OTP code", "otpCode",
+ "client secret", "token", "x-auth-token", "license-keys"):
+ self.assertTrue(rp.is_sensitive(yes), yes)
+ for no in ("Email", "Keyword", "monkey", "footprint", "Search", "hockey team"):
+ self.assertFalse(rp.is_sensitive(no), no)
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-otp-"))
+ try: # by the element: autocomplete="one-time-code" on #otp
+ rep = rp.parse(library_trace(tmp / "t.zip", 3, secret_field=True))
+ self.assertEqual(rep["steps"][1]["caption"], "Type 6 characters into #otp")
+ self.assertTrue(rep["steps"][1]["secret_field"])
+ self.assertNotIn("918273", json.dumps(rep))
+ # --show-typed never shows a secret field's value
+ rep = rp.parse(tmp / "t.zip", show_typed=True)
+ self.assertNotIn("918273", json.dumps(rep))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_password_type_alone_marks_a_field_secret(self):
+ """type="password" with a label that says nothing (Mot de passe): the field is secret by its type."""
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-pw-"))
+ try:
+ rep = rp.parse(attack_trace(tmp / "t.zip"), show_typed=True)
+ pw = rep["steps"][2]
+ self.assertEqual((pw["caption"], pw["secret_field"]), ("Type 16 characters into the 'Mot de passe' field", True))
+ self.assertNotIn("hunter2-not-real", json.dumps(rep))
+ self.assertEqual(rep["steps"][1]["caption"], "Fill the 'Email' field with \u201c%[email protected]\u201d" % rp.MASK)
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_typed_values_never_shown_or_spoken(self):
+ """Any field, any API: fill, and page.keyboard.type with no locator (after clicking a password field) show
+ how many characters were typed, never what; the field is covered on screen from then on."""
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-typed-"))
+ try:
+ for trace, kb in ((library_trace(tmp / "lib.zip", 5, keyboard=True), 2),
+ (attack_trace(tmp / "run.zip"), 3)):
+ rep = rp.parse(trace)
+ s = rep["steps"][kb]
+ self.assertEqual((s["kind"], s["caption"], s["value"]), ("type", "Type 14 characters into the page", None))
+ self.assertTrue(s["masked"] and s["secret_field"])
+ p = rp.plan(rep, rerun="")
+ lines = rp.narration(rep, p)
+ self.assertEqual(lines.get("step%d" % (kb + 1)), "Type into the page.")
+ outputs = [json.dumps(rp.steps_json(rep, p)), rp.markdown(rep, p), rp.build_srt(p, lines),
+ rp.build_page(rep, p, {}), json.dumps(lines), rp.write_script(rep, "", "")]
+ for text in outputs:
+ for secret in ("kb-secret-77xy", "hunter2-not-real", "[email protected]"):
+ self.assertNotIn(secret, text)
+ prev = rep["steps"][kb - 1]
+ self.assertIn(prev["box"], boxes(s)) # the field it typed into is covered
+ self.assertIn('class="cover"', rp.build_page(rep, p, {}))
+ # no DOM snapshots: the cover stays on the same page; the runner's trace: the form is gone at the end
+ lib = rp.parse(tmp / "lib.zip")
+ self.assertIn(lib["steps"][1]["box"], boxes(lib["steps"][-1]))
+ self.assertEqual(rep["steps"][-1]["covers"], [])
+ fx = rp.parse(TRACE)
+ self.assertEqual(len(fx["steps"][3]["covers"]), 3)
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_covers_follow_their_field(self):
+ """A cover follows its field through the DOM snapshots: it moves with the page's scroll (with a second
+ chip at the old place, unless that would hide the step's own target: a fixed field does not scroll), is
+ re-anchored when a step acts on the field again, and goes when the field is emptied or gone."""
+ fx = rp.parse(TRACE)
+ self.assertEqual(len(fx["steps"][4]["covers"]), 3) # the Sign in click: the form is still there
+ self.assertEqual(fx["steps"][5]["covers"], []) # the welcome page replaced it (the failure)
+ self.assertEqual(boxes(fx["steps"][0]), [fx["steps"][1]["box"]]) # its shot was taken during the fill
+ tok, email, go = ('<input id="token" name="api_token" type="text"/>', '<input id="email" type="email"/>',
+ '<button id="go">')
+ val = "tok-SECRET-1"
+ calls = [
+ {"method": "goto", "params": {"url": "https://app.example.test/form"}, "snaps": [("after", form())]},
+ {"method": "fill", "params": {"selector": "#token", "value": val}, "resolved": tok, "box": (300, 300, 400, 40),
+ "snaps": [("before", form()), ("action", form(target="token")), ("after", form(val, target="token"))]},
+ # the page scrolls 200 px to bring the button where the field was: the cover moves up with the field
+ {"method": "click", "params": {"selector": "#go"}, "resolved": go, "box": (300, 300, 400, 40),
+ "snaps": [("before", form(val, 200)), ("action", form(val, 200, target="go")), ("after", form(val, 200))]},
+ {"method": "click", "params": {"selector": "#email"}, "resolved": email, "box": (300, 50, 400, 40),
+ "snaps": [("before", form(val, 200)), ("action", form(val, 200, target="email"))]},
+ {"method": "click", "params": {"selector": "#token"}, "resolved": tok, "box": (300, 120, 400, 40),
+ "snaps": [("before", form(val, 200)), ("action", form(val, 200, target="token"))]},
+ {"method": "click", "params": {"selector": "#go"}, "resolved": go, "box": (300, 200, 400, 40),
+ "snaps": [("before", form(val, 200)), ("after", form("", 200))]}, # this click empties it
+ {"method": "click", "params": {"selector": "#email"}, "resolved": email, "box": (300, 50, 400, 40),
+ "snaps": [("before", [[1, node_count(form("", 200)) - 1]]), ("after", form("", 200, target="email"))]},
+ dict(EXPECT_FAIL, snaps=[("before", ["HTML", {}, ["BODY", {}, "Done"]])]),
+ ]
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-cover-"))
+ try:
+ rep = rp.parse(built_trace(tmp / "t.zip", calls))
+ field = {"x": 30.0, "y": 60.0, "w": 40.0, "h": 8.0}
+ up = dict(field, y=20.0) # 200 px of a 500 px page
+ self.assertEqual([boxes(s) for s in rep["steps"]], [
+ [], [field], [up], [up, field], [dict(field, y=24.0)], [dict(field, y=24.0)], [], []])
+ self.assertTrue(all(c["step"] == 2 for s in rep["steps"] for c in s["covers"]))
+ self.assertIn("# step 2: Type 12 characters into #token (a secret field); the value is not shown or spoken; "
+ "its field is covered on screen in steps 2-6", rp.write_script(rep, "", ""))
+ self.assertNotIn(val, json.dumps(rep))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_typing_into_a_field_it_cannot_name_is_secret(self):
+ """--show-typed shows what page.keyboard typed into a field it can name that is not secret; after a Tab,
+ or a hover after clicking a password field (a hover moves no focus), the field is unknown or secret:
+ hidden, and script.md says it is not covered."""
+ email, pw = '<input id="email" type="email"/>', '<input id="pw" type="password"/>'
+ click = lambda sel, el: {"method": "click", "params": {"selector": sel}, "resolved": el, # noqa: E731
+ "box": (300, 100, 400, 40)}
+ kb = lambda text: {"method": "keyboardType", "cls": "Page", "params": {"text": text}} # noqa: E731
+ tab = {"method": "keyboardPress", "cls": "Page", "params": {"key": "Tab"}}
+ hover = {"method": "hover", "params": {"selector": "#email"}, "resolved": email, "box": (300, 200, 400, 40)}
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-tab-"))
+ try:
+ for i, (calls, secret) in enumerate((([click("#email", email), tab, kb("kb-secret-77xy")], "kb-secret-77xy"),
+ ([click("#pw", pw), hover, kb("kb-secret-77xy")], "kb-secret-77xy"),
+ ([click("#email", email), kb("hello there")], None))):
+ rep = rp.parse(built_trace(tmp / ("t%d.zip" % i), calls + [EXPECT_FAIL]), show_typed=True)
+ s = next(x for x in rep["steps"] if x["kind"] == "type")
+ script = rp.write_script(rep, "", "")
+ if secret is None:
+ self.assertEqual((s["value"], s["masked"]), ("hello there", False))
+ continue
+ self.assertEqual((s["caption"], s["value"], s["masked"], s["secret_field"]),
+ ("Type 14 characters into the page", None, True, True))
+ for text in (json.dumps(rep), script):
+ self.assertNotIn(secret, text)
+ self.assertIn("(a secret field)", rp.write_script(rp.parse(tmp / "t1.zip", show_typed=True), "", ""))
+ tabbed = rp.write_script(rp.parse(tmp / "t0.zip", show_typed=True), "", "")
+ self.assertIn("(typed into a field showtime cannot name, so it counts as secret); the value is not shown "
+ "or spoken; it is NOT covered on screen", tabbed)
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_values_and_urls_never_shown(self):
+ rep = rp.parse(TRACE)
+ self.assertEqual([s["masked"] for s in rep["steps"]], [False, True, True, True, False, False])
+ self.assertEqual(rep["privacy"]["masked_values"], 3)
+ blob = json.dumps(rep)
+ for s in SECRETS:
+ self.assertNotIn(s, blob)
+ self.assertNotIn("/home/user/", blob)
+ self.assertEqual(rp.display_url("https://u:[email protected]/a/b?token=x#frag"), "app.example.test/a/b")
+ self.assertEqual(rp.display_url("file:///Users/someone/proj/app/index.html?x=1"), "app/index.html")
+ red = rp.Redactor()
+ self.assertEqual(red("see http://localhost:3000/login?next=/admin&t=abc#x now"), "see http://localhost:3000/login now")
+ self.assertEqual(red("navigating to /api/users?id=7"), "navigating to /api/users")
+ self.assertEqual(red("expected /^Welcome?/i"), "expected /^Welcome?/i")
+ self.assertIn(rp.MASK, red("Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NSJ9.abcdefghijklmno"))
+
+ def test_paths_show_their_last_part(self):
+ red = rp.Redactor()
+ self.assertEqual(red("at /Users/someone/proj/x.spec.ts:4"), "at x.spec.ts:4")
+ self.assertEqual(red("at /home/runner/work/app/tests/a.py:9 and ~/proj/b.ts"), "at a.py:9 and b.ts")
+ self.assertEqual(red("C:\\Users\\bob\\proj\\c.ts:3 and /pri" "vate/var/fold" "ers/x/T/d.zip"), "c.ts:3 and d.zip")
+ self.assertEqual(red("GET http://localhost:3000/home/x 404"), "GET http://localhost:3000/home/x 404")
+
+ def test_secrets_in_console_and_error_text(self):
+ red = rp.Redactor()
+ out = red(ATTACK_LOG)
+ for s in ("Sup3rS3cretPw", "admin", "s3ss10n-n0t-real", "abcd1234efgh5678ijkl9999", "ERRTOK-7766-ab",
+ "zz9988xx", "ada.lovelace", "hunter3pw", "alice.smith", "access_token"):
+ self.assertNotIn(s, out)
+ self.assertIn(rp.MASK + "@corp.example", out)
+ self.assertIn("app.js:3", out)
+ self.assertEqual(red("session=abc123; Path=/"), "session=%s; Path=/" % rp.MASK)
+ self.assertEqual(red("Invalid token verification failed"), "Invalid token verification failed")
+ self.assertEqual(red('fill("[email protected]")'), 'fill("%s")' % rp.MASK)
+ self.assertEqual(red("bob:[email protected]"), rp.MASK + "@db.local")
+ self.assertEqual(rp.Redactor(show_emails=True)("mail [email protected]"), "mail [email protected]")
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-att-"))
+ try:
+ rep = rp.parse(attack_trace(tmp / "t.zip"))
+ blob = json.dumps(rep)
+ for s in ATTACK:
+ self.assertNotIn(s, blob)
+ self.assertIn("Server said: GET https://staging.acme.test/login failed", " ".join(rep["failure"]["details"]))
+ self.assertEqual(rep["failure"]["expected"]["text"], '"Welcome, Ada!"') # kept, filtered
+ self.assertEqual(rep["failure"]["received"]["text"], '"Welcome back, Ada"')
+ self.assertLessEqual(len(rep["console"][0]["text"]), 301)
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_console_lines_are_capped(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-cons-"))
+ try:
+ src = library_trace(tmp / "t.zip", 3)
+ with zipfile.ZipFile(str(src)) as z:
+ members = {n: z.read(n) for n in z.namelist()}
+ extra = "".join(json.dumps({"type": "console", "messageType": "error", "time": 101 + i,
+ "text": "boom %d " % i + "x" * 2000}) + "\n" for i in range(50))
+ members["trace.trace"] += extra.encode("utf-8")
+ with zipfile.ZipFile(str(tmp / "c.zip"), "w") as z:
+ for n, d in members.items():
+ z.writestr(n, d)
+ rep = rp.parse(tmp / "c.zip")
+ self.assertEqual((len(rep["console"]), rep["console_more"]), (rp.MAX_CONSOLE, 50 - rp.MAX_CONSOLE))
+ self.assertTrue(all(len(c["text"]) <= 301 for c in rep["console"]))
+ p = rp.plan(rep, rerun="")
+ self.assertIn("The console logged 50 errors.", rp.narration(rep, p)["fail"])
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_filters_run_in_linear_time(self):
+ """Untrusted trace text never stalls the filters (the old path pattern was quadratic, the shared masks
+ worse): long inputs are cut, long words are cut before the shared masks run."""
+ import time
+ red = rp.Redactor()
+ for text in ("/a" * 16000, "a." * 16000, ("a." * 120 + " ") * 60, "@" + "a." * 8000, "token=" + "a" * 9000):
+ t = time.time()
+ red(text)
+ self.assertLess(time.time() - t, 1.0, text[:20])
+
+ def test_redact_patterns_everywhere(self):
+ red = rp.Redactor([r"Ada\b", r"example\.test"])
+ rep = rp.parse(TRACE, red)
+ p = rp.plan(rep, rerun=rp.rerun_command(rep, None, red))
+ lines = rp.narration(rep, p)
+ outputs = {"steps": json.dumps(rp.steps_json(rep, p)), "md": rp.markdown(rep, p),
+ "srt": rp.build_srt(p, lines), "page": rp.build_page(rep, p, {}), "narration": json.dumps(lines),
+ "script": rp.write_script(rep, p["rerun"], "")}
+ for name, text in outputs.items():
+ self.assertNotRegex(text, r"Ada\b", name)
+ self.assertNotIn("example.test", text, name)
+ self.assertEqual(rep["failure"]["received"]["text"], '"Welcome back, %s"' % rp.MASK)
+ self.assertEqual(rep["failure"]["received"]["parts"], [['"Welcome back, %s"' % rp.MASK, False]]) # no diff marks
+ self.assertEqual(rep["console"][0]["text"], "Failed to load avatar for %s: 404" % rp.MASK)
+ with self.assertRaises(ShowtimeError) as cm:
+ rp.Redactor(["(unclosed"])
+ self.assertIn("not a valid regular expression", str(cm.exception))
+
+
+class TestScript(unittest.TestCase):
+ def test_script_lists_every_line_and_edits_go_through_the_filter(self):
+ rep = rp.parse(TRACE)
+ text = rp.write_script(rep, "npx playwright test login.spec.js:6", "npx playwright show-trace trace.zip")
+ for want in ("show test.title: signs in and greets the user", "say step3: Type into the Password field.",
+ "show fail.received: \"Welcome back, Ada\"", "show console1: Failed to load avatar for Ada: 404",
+ "show end.rerun: npx playwright test login.spec.js:6", "# step 3: Type 16 characters into the "
+ "'Password' field (a secret field)", SCREENSHOTS):
+ self.assertIn(want, text)
+ text = text.replace("show step1.caption: Open app/index.html",
+ "show step1.caption: Open acct-12345 with Bearer abcdefghijklmnop123 as /Users/someone/x.html")
+ text = "\n".join(x for x in text.splitlines() if not x.startswith(("say step2:", "show console1:")))
+ edited, rerun, viewer = rp.apply_script(rep, "npx playwright test login.spec.js:6", "", rp.read_script(text),
+ rp.Redactor([r"acct-[0-9]+"]))
+ self.assertEqual(edited["steps"][0]["caption"], "Open %s with Bearer %s as x.html" % (rp.MASK, rp.MASK))
+ self.assertEqual(edited["console"], [])
+ p = rp.plan(edited, rerun=rerun)
+ lines = rp.narration(edited, p)
+ self.assertNotIn("step2", lines) # a deleted spoken line: a silent scene
+ self.assertEqual(lines["step3"], "Type into the Password field.")
+ self.assertEqual(edited["failure"]["expected"]["parts"], rep["failure"]["expected"]["parts"]) # unedited
+
+ def test_edits_reach_every_output(self):
+ """An edited caption, locator and value line leave nothing of the old text in steps.json, the project's
+ repro.json, repro.md, the page, the narration or the captions (the step's target is rebuilt from its
+ locator); the test's file follows its location; nothing is kept that script.md did not list."""
+ red = rp.Redactor(show_emails=True)
+ rep = rp.parse(TRACE, red, show_typed=True)
+ text = rp.write_script(rep, "npx playwright test login.spec.js:6", "")
+ for want in ("show step2.value: [email protected]", "show step6.matcher: toHaveText"):
+ self.assertIn(want, text)
+ edits = {"show step2.caption:": "show step2.caption: Fill the first field",
+ "show step2.locator:": "show step2.locator: the first field",
+ "say step2:": "say step2: Fill the first field.", "show test.location:": "show test.location: x.spec.js:3"}
+ out = []
+ for line in text.splitlines():
+ if line.startswith("show step2.value:"):
+ continue # deleted
+ out.append(next((v for k, v in edits.items() if line.startswith(k)), line))
+ edited, rerun, viewer = rp.apply_script(rep, "npx playwright test login.spec.js:6", "",
+ rp.read_script("\n".join(out)), red)
+ s = edited["steps"][1]
+ self.assertEqual((s["caption"], s["locator"], s["target"], s["value"]),
+ ("Fill the first field", "the first field", "the first field", None))
+ self.assertEqual((edited["test"]["file"], edited["test"]["line"]), ("x.spec.js", 3))
+ p = rp.plan(edited, rerun=rerun)
+ lines = rp.narration(edited, p)
+ outputs = {"steps.json": json.dumps(rp.steps_json(edited, p)), "repro.md": rp.markdown(edited, p),
+ "page": rp.build_page(edited, p, {}), "narration": json.dumps(lines), "srt": rp.build_srt(p, lines)}
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-edit-"))
+ try:
+ rp.write_project(tmp / "project", edited, p, tmp)
+ for f in ("repro.json", "index.html", "showtime.json"):
+ outputs["project/" + f] = (tmp / "project" / f).read_text(encoding="utf-8")
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+ for name, blob in outputs.items():
+ for old in ("Email", "[email protected]"):
+ self.assertNotIn(old, blob, "%s keeps %r" % (name, old))
+ self.assertEqual(json.loads(outputs["project/repro.json"])["test"],
+ {"title": "signs in and greets the user", "file": "x.spec.js", "line": 3, "location": "x.spec.js:3"})
+
+
+class TestLocatorsAndCaptions(unittest.TestCase):
+ def test_human_locator(self):
+ cases = {
+ "getByRole('button', { name: 'Sign in' })": "the 'Sign in' button",
+ "getByRole('heading', { level: 1 })": "the level-1 heading",
+ "getByRole('textbox')": "the field",
+ "getByLabel('Email')": "the 'Email' field",
+ "getByPlaceholder('Search docs')": "the 'Search docs' field",
+ "getByText('Welcome')": "the text 'Welcome'",
+ "getByTestId('total')": "test id 'total'",
+ "getByRole('dialog').getByRole('link', { name: 'Docs' }).first()": "the 'Docs' link",
+ "locator('#cart .count')": "#cart .count",
+ }
+ for api, want in cases.items():
+ self.assertEqual(rp.human_locator(api), want, api)
+
+ def test_selector_api(self):
+ self.assertEqual(rp._selector_api('internal:role=button[name="Sign in"i]'), "getByRole('button', { name: 'Sign in' })")
+ self.assertEqual(rp._selector_api("internal:role=heading[level=2]"), "getByRole('heading', { level: 2 })")
+ self.assertEqual(rp._selector_api('internal:label="Email"i'), "getByLabel('Email')")
+ self.assertEqual(rp._selector_api('internal:attr=[placeholder="Search"i]'), "getByPlaceholder('Search')")
+ self.assertEqual(rp._selector_api('internal:testid=[data-testid="x"s]'), "getByTestId('x')")
+ self.assertEqual(rp._selector_api("#a > b"), "locator('#a > b')")
+
+ def test_captions(self):
+ c = rp.caption
+ self.assertEqual(c("press", "the 'Search' field", "Enter", "", "", None), "Press Enter in the 'Search' field")
+ self.assertEqual(c("expect", "", None, "", "toHaveURL", "/dashboard"), "Expect the page to have the URL \u201c/dashboard\u201d")
+ self.assertEqual(c("expect", "the 'Save' button", None, "", "not.toBeVisible", None),
+ "Expect the 'Save' button not to be visible")
+ self.assertEqual(c("check", "the 'Terms' checkbox", None, "", "", None), "Check the 'Terms' checkbox")
+ self.assertEqual(c("select", "the 'Size' dropdown", "L", "", "", None), "Select \u201cL\u201d in the 'Size' dropdown")
+ self.assertEqual(c("fill", "the 'Name' field", None, "", "", None, typed=1), "Type 1 character into the 'Name' field")
+ self.assertEqual(c("fill", "the 'Name' field", None, "", "", None, typed=0), "Clear the 'Name' field")
+ self.assertEqual(c("press", "", None, "", "", None), "Press a key")
+
+
+class TestSound(unittest.TestCase):
+ def test_sound_differs_per_test_and_is_stable(self):
+ """0.4.3: the bed and the effects come from the test: the same one sounds the same, another one not."""
+ import copy
+ from unittest import mock
+ rep = rp.parse(TRACE)
+ p = rp.plan(rep, rerun="")
+ other = copy.deepcopy(rep)
+ other["test"]["title"] = "another test entirely"
+
+ def mix(r, **kw):
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": "/nonexistent-music"}):
+ ch = rp.bed_for(p, r, (), kw.get("music"), True)
+ return rp.build_mix(p, r, (), ch)["tracks"]
+ a, b = mix(rep), mix(other)
+ self.assertEqual(a, mix(rep))
+ self.assertNotEqual(a[0], b[0])
+ sfx = lambda t: [x["synth"] for x in t if x.get("kind") == "sfx"] # noqa: E731
+ self.assertNotEqual(sfx(a), sfx(b))
+ self.assertTrue(any(x["synth"]["type"] in ("error", "power-down") for x in a if x.get("kind") == "sfx"))
+ marks = ("click", "tick", "pop", "toggle", "error", "power-down") # sounds that mark what happens
+ self.assertTrue(all(x["synth"]["type"] in marks for x in a if x.get("kind") == "sfx")) # none on the cuts
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": "/nonexistent-music"}):
+ cuts = rp.build_mix(p, rep, (), rp.bed_for(p, rep, (), None, True), True)["tracks"]
+ self.assertEqual(sum(1 for x in cuts if x.get("synth", {}).get("type") in ("swoosh-in", "swoosh-out")),
+ len(p["scenes"]) - 1) # --cut-sounds: opt in
+ self.assertEqual(mix(rep, music="deep-house")[0]["compose"]["style"], "deep-house")
+ with mock.patch.dict(os.environ, {"SHOWTIME_OFFLINE": "1", "SHOWTIME_MUSIC_CACHE": "/nonexistent-music"}):
+ voice = [{"id": "vo-x", "kind": "voice", "file": "voice/x.wav", "start": 1.0}]
+ self.assertEqual(rp.build_mix(p, rep, voice, rp.bed_for(p, rep, voice, None, True))["tracks"][0]["duck"],
+ {"under": "voice", "depth_db": 10.0, "carve": 0.4}) # 10 dB, not 12 (0.4.3)
+ self.assertNotIn("duck", mix(rep)[0])
+ self.assertNotIn("music", [x["kind"] for x in mix(rep, music="none")])
+
+
+class TestPlan(unittest.TestCase):
+ def test_fixture_plan(self):
+ rep = rp.parse(TRACE)
+ p = rp.plan(rep, rerun="npx playwright test login.spec.js:6")
+ self.assertEqual([s["id"] for s in p["scenes"]], ["title", "step1", "step2", "step3", "step4", "step5", "fail", "end"])
+ self.assertTrue(rp.MIN_SECONDS <= p["duration"] <= rp.MAX_SECONDS, p["duration"])
+ fail = next(s for s in p["scenes"] if s["id"] == "fail")
+ self.assertGreater(fail["dur"], max(s["dur"] for s in p["scenes"] if s["kind"] == "step")) # it slows down
+ starts = [s["start"] for s in p["scenes"]]
+ self.assertEqual(starts, sorted(starts))
+ lines = rp.narration(rep, p)
+ self.assertEqual(lines["step2"], "Type into the Email field.") # values are never spoken
+ self.assertEqual(lines["step3"], "Type into the Password field.")
+ self.assertEqual(lines["fail"], 'Step 6 fails. It expected "Welcome, Ada!", but got "Welcome back, Ada". '
+ "The console logged an error.")
+ # a masked e-mail is spoken as one, not as "a hidden value at" its domain
+ title = rp.Redactor()("signs in as [email protected]")
+ self.assertEqual(rp.title_line(dict(rep, test=dict(rep["test"], title=title))),
+ "Signs in as a hidden email address. This test fails at step 6.")
+ self.assertEqual(rp._say("Got %s and %[email protected]." % (rp.MASK, rp.MASK)),
+ "Got a hidden value and a hidden email address.")
+
+ def test_long_tests_compress_passing_steps(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-long-"))
+ try:
+ rep = rp.parse(library_trace(tmp / "t.zip", 30))
+ p = rp.plan(rep, rerun="pytest tests/test_long.py")
+ ids = [s["id"] for s in p["scenes"]]
+ self.assertLessEqual(p["duration"], rp.MAX_SECONDS)
+ self.assertEqual(ids[:3], ["title", "step1", "skip"]) # the first step, then the sum
+ self.assertEqual(ids[-2:], ["fail", "end"])
+ skip = p["scenes"][2]
+ self.assertEqual(skip["skipped"], list(range(2, 2 + len(skip["skipped"]))))
+ kept = [s["step"] for s in p["scenes"] if s["kind"] == "step"]
+ self.assertEqual(kept[1:], list(range(kept[1], 30))) # the steps before the failure
+ self.assertEqual(sorted(kept + skip["skipped"]), list(range(1, 30)))
+ page = rp.build_page(rep, p, {})
+ self.assertIn("passing steps", page)
+ self.assertEqual(rp.narration(rep, p)["skip"], "Then %d more steps pass." % len(skip["skipped"]))
+ # a two-step test still runs past 10 s; narration makes a scene at least as long as its line
+ short = rp.parse(library_trace(tmp / "s.zip", 2))
+ ps = rp.plan(short, rerun="")
+ self.assertGreaterEqual(ps["duration"], rp.MIN_SECONDS)
+ pv = rp.plan(short, rerun="", speech={"step1": 6.0})
+ s1 = next(s for s in pv["scenes"] if s["id"] == "step1")
+ self.assertEqual(s1["dur"], round(rp.VOICE_PAD + 6.0 + rp.VOICE_TAIL, 2))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ def test_captions_file(self):
+ from st.captions_rules import MAX_CPS, MAX_LINE_CHARS
+ rep = rp.parse(TRACE)
+ p = rp.plan(rep, rerun="npx playwright test login.spec.js:6")
+ srt = rp.build_srt(p, rp.narration(rep, p))
+ cues = [c for c in srt.strip().split("\n\n") if c]
+ self.assertGreaterEqual(len(cues), len(p["scenes"]))
+ last_end = 0.0
+ for c in cues:
+ parts = c.split("\n")
+ a, b = [rp_time(x) for x in parts[1].split(" --> ")]
+ text = parts[2:]
+ self.assertLessEqual(len(text), 2, c)
+ self.assertTrue(all(len(x) <= MAX_LINE_CHARS for x in text), c)
+ self.assertGreaterEqual(a, last_end - 1e-6)
+ self.assertLessEqual(len(" ".join(text)) / (b - a), MAX_CPS + 0.01, c)
+ last_end = b
+ self.assertLessEqual(last_end, p["duration"])
+
+
+def rp_time(s: str) -> float:
+ h, m, rest = s.split(":")
+ sec, ms = rest.split(",")
+ return int(h) * 3600 + int(m) * 60 + int(sec) + int(ms) / 1000.0
+
+
+class TestRunner(unittest.TestCase):
+ def test_tracing_flags(self):
+ out = Path("/tmp/x")
+ cmd, kind = rp.tracing_command(["npx", "playwright", "test", "tests/login.spec.ts"], out)
+ self.assertEqual((kind, cmd[-4:]), ("playwright", ["--trace", "retain-on-failure", "--output", str(out)]))
+ cmd, kind = rp.tracing_command(["npx", "playwright", "test", "--trace=on", "--output", "o"], out)
+ self.assertEqual(cmd, ["npx", "playwright", "test", "--trace=on", "--output", "o"])
+ cmd, kind = rp.tracing_command(["python", "-m", "pytest", "tests/test_login.py"], out)
+ self.assertEqual((kind, cmd[-4:]), ("pytest", ["--tracing", "retain-on-failure", "--output", str(out)]))
+ self.assertEqual(rp.runner_of(["pytest", "-k", "login"]), "pytest")
+ self.assertEqual(rp.runner_of(["node", "node_modules/playwright/cli.js", "test"]), "playwright")
+ self.assertEqual(rp.runner_of(["pnpm", "exec", "playwright", "test"]), "playwright")
+ self.assertEqual(rp.runner_of(["npm", "test"]), "")
+ self.assertEqual(rp.tracing_command(["npm", "test"], out), (["npm", "test"], ""))
+
+ def test_user_env_drops_what_the_launcher_adds(self):
+ e = rp.user_env(ENV)
+ self.assertEqual(e["PATH"], ENV["SHOWTIME_USER_PATH"])
+ self.assertNotIn(str(SKILL / "lib"), (e.get("PYTHONPATH") or "").split(os.pathsep))
+ self.assertNotIn(ENV["SHOWTIME_NODE_MODULES"], (e.get("NODE_PATH") or "").split(os.pathsep))
+ self.assertNotEqual(e.get("PLAYWRIGHT_BROWSERS_PATH"), str(HOME / "browsers"))
+ mine = dict(ENV, PLAYWRIGHT_BROWSERS_PATH="/opt/pw", PYTHONPATH=str(SKILL / "lib") + os.pathsep + "/my/src")
+ e = rp.user_env(mine)
+ self.assertEqual((e["PLAYWRIGHT_BROWSERS_PATH"], e["PYTHONPATH"]), ("/opt/pw", "/my/src"))
+ # from a bare environment: nothing the launcher set for itself reaches the user's tests
+ bare = {k: v for k, v in os.environ.items() if k in ("PATH", "HOME", "USERPROFILE", "SYSTEMROOT", "TMPDIR")}
+ bare["HTTPS_PROXY"] = "http://proxy.example.test:3128"
+ with mock.patch.dict(os.environ, bare, clear=True):
+ env = build_env(HOME)
+ e = rp.user_env(env)
+ for var in ("PYTHONUTF8", "PYTHONIOENCODING", "HF_HUB_DISABLE_TELEMETRY", "SUPERTONIC_CACHE_DIR", "U2NET_HOME",
+ "HF_HOME", "NODE_USE_ENV_PROXY", "NO_PROXY", "IMAGEIO_FFMPEG_EXE", "SHOWTIME_HOME",
+ "SHOWTIME_ADDED_ENV", "SHOWTIME_USER_PATH"):
+ self.assertNotIn(var, e)
+ self.assertEqual(e["HTTPS_PROXY"], "http://proxy.example.test:3128")
+
+ def test_rerun_command(self):
+ rep = rp.parse(TRACE)
+ red = rp.Redactor()
+ self.assertEqual(rp.rerun_command(rep, None, red), "npx playwright test login.spec.js:6")
+ self.assertEqual(rp.rerun_command(rep, ["npx", "playwright", "test", "a b.spec.ts"], red),
+ "npx playwright test 'a b.spec.ts'")
+ self.assertEqual(rp.viewer_command(rep, "t.zip"), "npx playwright show-trace t.zip")
+
+ @unittest.skipIf(os.name == "nt", "a POSIX executable script")
+ def test_traces_only_where_the_runner_was_told(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-where-"))
+ try:
+ exe = fake_pytest(tmp / "bin", into_cwd=True)
+ run = rp.run_and_find([str(exe), "tests"], tmp / "out", cwd=tmp)
+ self.assertTrue((tmp / "elsewhere" / "t1" / "trace.zip").is_file())
+ self.assertEqual((run["trace"], run["traces"]), (None, [])) # the working tree is not searched
+ run = rp.run_and_find([str(fake_pytest(tmp / "bin2")), "tests"], tmp / "out2", cwd=tmp)
+ self.assertEqual(Path(run["trace"]).parent.parent, tmp / "out2")
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ @unittest.skipIf(os.name == "nt", "a pseudo-terminal")
+ def test_the_command_never_reads_the_terminal(self):
+ """In a terminal, Playwright's html reporter serves its report and waits for Ctrl+C: the command gets an
+ empty stdin and PLAYWRIGHT_HTML_OPEN=never (unless the user set it, or PW_TEST_HTML_REPORT_OPEN)."""
+ import pty
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-tty-"))
+ exe = tmp / "probe"
+ exe.write_text("#!%s\nimport json, os, sys\njson.dump({'tty': os.isatty(0), 'open': os.environ.get("
+ "'PLAYWRIGHT_HTML_OPEN')}, open(%r, 'w'))\n" % (sys.executable, str(tmp / "seen.json")),
+ encoding="utf-8")
+ exe.chmod(0o755)
+ master, slave = pty.openpty()
+ saved = os.dup(0)
+ try:
+ os.dup2(slave, 0) # showtime itself runs in a terminal
+ seen = []
+ for env in ({}, {"PLAYWRIGHT_HTML_OPEN": "always"}, {"PW_TEST_HTML_REPORT_OPEN": "on-failure"}):
+ with mock.patch.dict(os.environ, env):
+ for k in {"PLAYWRIGHT_HTML_OPEN", "PW_TEST_HTML_REPORT_OPEN"} - set(env):
+ os.environ.pop(k, None)
+ rp.run_and_find([str(exe)], tmp / "out", cwd=tmp, timeout=30)
+ seen.append(json.loads((tmp / "seen.json").read_text(encoding="utf-8")))
+ finally:
+ os.dup2(saved, 0)
+ for fd in (saved, master, slave):
+ os.close(fd)
+ shutil.rmtree(str(tmp), ignore_errors=True)
+ self.assertEqual(seen, [{"tty": False, "open": "never"}, {"tty": False, "open": "always"},
+ {"tty": False, "open": None}])
+
+
+class TestCli(unittest.TestCase):
+ def setUp(self):
+ self.tmp = Path(tempfile.mkdtemp(prefix="st-repro-cli-"))
+
+ def tearDown(self):
+ shutil.rmtree(str(self.tmp), ignore_errors=True)
+
+ def test_review_gate_then_yes(self):
+ """The first call writes script.md and renders nothing; --yes renders from the script as edited, every
+ line through the filter again."""
+ out = self.tmp / "bug"
+ cp = showtime("repro", TRACE, "--out", out, "--json", cwd=self.tmp)
+ res = json.loads(cp.stdout)
+ self.assertEqual((res["rendered"], res["failed_step"], res["masked_values"]), (False, 6, 3))
+ self.assertIn("then rerun with --yes", res["next"])
+ self.assertEqual(sorted(x.name for x in out.iterdir()), ["SHOWTIME.md", "job.json", "report.json",
+ "script.md", "shots"])
+ cp = showtime("repro", TRACE, "--out", self.tmp / "bug2", cwd=self.tmp)
+ self.assertIn("read %s" % (self.tmp / "bug2" / "script.md"), cp.stdout)
+ self.assertIn("then rerun with --yes", cp.stdout)
+ self.assertIn(SCREENSHOTS, cp.stderr)
+ script = out / "script.md"
+ text = script.read_text(encoding="utf-8").replace(
+ "show step5.caption: Click the 'Sign in' button",
+ "show step5.caption: Click Sign in for acct-12345 with token=ERRTOK-7766-ab and /Users/someone/notes.txt")
+ script.write_text("\n".join(x for x in text.splitlines() if not x.startswith("say step2:")), encoding="utf-8")
+ cp = showtime("repro", "--yes", "--out", out, "--no-voice", "--no-render", "--redact", "acct-[0-9]+",
+ "--json", cwd=self.tmp)
+ res = json.loads(cp.stdout)
+ self.assertEqual(res["privacy"]["screenshots"], "as captured")
+ steps = json.loads((out / "steps.json").read_text(encoding="utf-8"))
+ self.assertEqual(steps["steps"][4]["caption"], "Click Sign in for %s with token=%s and notes.txt"
+ % (rp.MASK, rp.MASK))
+ srt = (out / "repro.srt").read_text(encoding="utf-8")
+ self.assertNotIn("Type into the Email field", srt)
+ self.assertIn("Type into the Password field", srt)
+ self.assertIn("6. **FAILED:** Expect the level-1 heading", (out / "repro.md").read_text(encoding="utf-8"))
+ # the same trace with --yes again finds its job (the newest made from it) and renders nothing new to
+ # a script; a trace never seen with --yes writes its script and stops
+ lib = library_trace(self.tmp / "lib.zip", 3)
+ cp = showtime("repro", lib, "--yes", "--no-voice", "--no-render", "--json", cwd=self.tmp)
+ first = json.loads(cp.stdout)
+ self.assertEqual(first["rendered"], False)
+ cp = showtime("repro", lib, "--yes", "--no-voice", "--no-render", "--json", cwd=self.tmp)
+ second = json.loads(cp.stdout)
+ self.assertEqual(Path(second["job"]).resolve(), Path(first["job"]).resolve())
+ self.assertTrue((Path(second["job"]) / "steps.json").is_file())
+
+ def test_every_file_of_the_job(self):
+ """No file of the job holds the trace's machine paths or a planted secret, and no file but the ledger
+ holds a path of this machine: report.json, script.md, steps.json, repro.md, repro.srt, project/ included."""
+ trace = attack_trace(self.tmp / "attack.zip")
+ out = self.tmp / "job"
+ showtime("repro", trace, "--out", out, "--redact", "Mot de passe", cwd=self.tmp)
+ showtime("repro", "--yes", "--out", out, "--no-voice", "--no-render", cwd=self.tmp)
+ for name in ("steps.json", "repro.md", "repro.srt", "report.json", "script.md", "project/index.html",
+ "project/repro.json", "project/showtime.json"):
+ self.assertTrue((out / name).is_file(), name)
+ assert_clean(self, out, ATTACK + ("Mot de passe",),
+ machine=(str(Path.home()), str(self.tmp), str(self.tmp.resolve()), str(SKILL)))
+ fixture_job = self.tmp / "fx"
+ showtime("repro", TRACE, "--out", fixture_job, cwd=self.tmp)
+ showtime("repro", "--yes", "--out", fixture_job, "--no-voice", "--no-render", cwd=self.tmp)
+ assert_clean(self, fixture_job, SECRETS + ("/home/user",), machine=(str(Path.home()), str(self.tmp.resolve())))
+ report = json.loads((fixture_job / "report.json").read_text(encoding="utf-8"))
+ self.assertEqual(report["viewer"], "npx playwright show-trace trace.zip") # outside the folder: its name
+
+ def test_errors(self):
+ cp = showtime("repro", check=False, cwd=self.tmp)
+ self.assertIn("no trace or test command given", cp.stderr)
+ cp = showtime("repro", self.tmp / "missing.zip", check=False, cwd=self.tmp)
+ self.assertIn("trace not found", cp.stderr)
+ library_trace(self.tmp / "ok.zip", 3, fail=False)
+ cp = showtime("repro", self.tmp / "ok.zip", check=False, cwd=self.tmp)
+ self.assertIn("the trace records no failure", cp.stderr)
+ cp = showtime("repro", TRACE, "--redact", "(", check=False, cwd=self.tmp)
+ self.assertIn("not a valid regular expression", cp.stderr)
+ cp = showtime("repro", "--", sys.executable, "-c", "print('ok')", check=False, cwd=self.tmp)
+ self.assertIn("the command wrote no trace.zip (exit code 0)", cp.stderr)
+ self.assertNotIn("Traceback", cp.stderr)
+ cp = showtime("repro", "--timeout", "2", "--", sys.executable, "-c", "import time; time.sleep(60)",
+ check=False, cwd=self.tmp, timeout=60)
+ self.assertIn("ran longer than 2 s and was stopped", cp.stderr)
+ self.assertFalse((self.tmp / "showtime-out").exists()) # a failed run leaves nothing behind
+
+ @unittest.skipIf(os.name == "nt", "a POSIX executable script")
+ def test_a_single_script_after_dashes_is_a_command(self):
+ script = self.tmp / "e2e.sh"
+ script.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")
+ script.chmod(0o755)
+ cp = showtime("repro", "--", "./e2e.sh", check=False, cwd=self.tmp)
+ self.assertIn("the command wrote no trace.zip", cp.stderr)
+ self.assertNotIn("not a zip file", cp.stderr)
+
+ @unittest.skipIf(os.name == "nt", "a POSIX executable script")
+ def test_command_traces_are_deleted_unless_kept(self):
+ """A run's raw traces (they hold what was typed) never stay in the job, unless --keep-trace."""
+ exe = fake_pytest(self.tmp / "bin")
+ cp = showtime("repro", "--json", "--out", self.tmp / "a", "--", exe, "tests", cwd=self.tmp)
+ res = json.loads(cp.stdout)
+ self.assertEqual((res["run"]["runner"], res["privacy"]["raw_trace"]), ("pytest", "deleted"))
+ self.assertEqual(list((self.tmp / "a").rglob("trace.zip")), [])
+ self.assertEqual(list(Path(tempfile.gettempdir()).glob("showtime-repro-*")), [])
+ assert_clean(self, self.tmp / "a", SECRETS)
+ cp = showtime("repro", "--json", "--keep-trace", "--out", self.tmp / "b", "--", exe, "tests", cwd=self.tmp)
+ self.assertEqual(len(list((self.tmp / "b" / "work" / "test-results").rglob("trace.zip"))), 1)
+ self.assertIn("show-trace", json.loads((self.tmp / "b" / "report.json").read_text(encoding="utf-8"))["viewer"])
+
+
[email protected](FAST, "--fast (runs Playwright's test runner)")
[email protected](os.name == "nt", "a pseudo-terminal")
[email protected](bool(NODE) and (NM / "playwright" / "cli.js").is_file(), "needs Node and showtime setup's Playwright")
+class TestWithPlaywright(unittest.TestCase):
+ def test_html_reporter_in_a_terminal_does_not_wait(self):
+ """`npm init playwright`'s config (reporter: 'html'), run from a terminal by a person (no coding agent
+ variable): the reporter would serve its report until Ctrl+C. No browser: the test fails on expect(1)."""
+ import pty
+ import time
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-html-"))
+ master, slave = pty.openpty()
+ try:
+ (tmp / "playwright.config.js").write_text("module.exports = { reporter: 'html' };\n", encoding="utf-8")
+ (tmp / "a.spec.js").write_text(
+ "const { test, expect } = require(%s);\ntest('one is two', async () => {\n expect(1).toBe(2);\n});\n"
+ % json.dumps(str(NM / "playwright" / "test")), encoding="utf-8")
+ env = {k: v for k, v in ENV.items() if k not in ("CLAUDECODE", "COPILOT_CLI", "CI", "PLAYWRIGHT_HTML_OPEN",
+ "PW_TEST_HTML_REPORT_OPEN")}
+ t = time.time()
+ cp = showtime("repro", "--out", tmp / "job", "--timeout", "60", "--json", "--", NODE,
+ NM / "playwright" / "cli.js", "test", "a.spec.js", env=env, cwd=tmp, timeout=200, stdin=slave)
+ self.assertLess(time.time() - t, 45, cp.stderr[-2000:])
+ self.assertNotIn("Serving HTML report", cp.stderr)
+ res = json.loads(cp.stdout)
+ self.assertEqual((res["run"]["runner"], res["run"]["failing"], res["rendered"]), ("playwright", 1, False))
+ self.assertTrue((tmp / "job" / "script.md").is_file())
+ finally:
+ os.close(master)
+ os.close(slave)
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+
[email protected](FAST, "--fast (runs a browser)")
[email protected](READY, "needs Node, showtime setup's Playwright and its Chromium")
+class TestWithBrowser(unittest.TestCase):
+ """A real run: the fixture test with tracing on, then the film rendered and checked."""
+
+ def test_command_writes_a_real_trace(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-run-"))
+ try:
+ shutil.copytree(str(FIX / "app"), str(tmp / "app"))
+ spec = (FIX / "login.spec.js").read_text(encoding="utf-8")
+ # a project would have playwright in its own node_modules; this one uses showtime's
+ spec = spec.replace("require('playwright/test')", "require(%s)" % json.dumps(str(NM / "playwright" / "test")))
+ (tmp / "login.spec.js").write_text(spec, encoding="utf-8")
+ # showtime's browsers, spelled the way a user's own setting would be (user_env drops showtime's own)
+ env = dict(ENV, PLAYWRIGHT_BROWSERS_PATH=str(BROWSERS) + os.sep)
+ cp = showtime("repro", "--out", tmp / "job", "--json", "--",
+ NODE, NM / "playwright" / "cli.js", "test", "login.spec.js", "--reporter", "line",
+ env=env, cwd=tmp, timeout=240)
+ res = json.loads(cp.stdout)
+ self.assertEqual((res["run"]["runner"], res["run"]["failing"], res["rendered"]), ("playwright", 1, False))
+ self.assertNotEqual(res["run"]["rc"], 0)
+ self.assertEqual(list((tmp / "job").rglob("trace.zip")), []) # the raw trace is gone
+ fresh = json.loads((tmp / "job" / "report.json").read_text(encoding="utf-8"))["report"]
+ fixed = rp.parse(TRACE)
+ self.assertEqual([s["caption"] for s in fresh["steps"]], [s["caption"] for s in fixed["steps"]])
+ self.assertEqual(fresh["failure"]["source"], fixed["failure"]["source"]) # the trace's own source
+ self.assertEqual(fresh["test"], fixed["test"])
+ showtime("repro", "--yes", "--out", tmp / "job", "--no-voice", "--no-render", env=env, cwd=tmp)
+ steps = json.loads((tmp / "job" / "steps.json").read_text(encoding="utf-8"))
+ self.assertIn("cli.js test login.spec.js", steps["rerun"])
+ assert_clean(self, tmp / "job", SECRETS, machine=(str(Path.home()), str(tmp.resolve())))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+ @needs_listen
+ def test_end_to_end_preview(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-repro-e2e-"))
+ try:
+ showtime("repro", TRACE, "--out", tmp / "job", cwd=tmp)
+ cp = showtime("repro", "--yes", "--out", tmp / "job", "--no-voice", "--preview", "--json",
+ "--music", "minimal-pulse", check=False,
+ cwd=tmp, timeout=900)
+ skip_if_listen_refused(cp)
+ self.assertEqual(cp.returncode, 0, cp.stderr[-3000:])
+ res = json.loads(cp.stdout)
+ job = tmp / "job"
+ for name in ("repro.mp4", "repro.srt", "repro.poster.jpg", "steps.json", "repro.md"):
+ self.assertTrue((job / name).is_file(), name)
+ self.assertIn(res["qa"]["verdict"], ("PASS", "WARN"), res["qa"])
+ from st import ff
+ info = ff.probe(job / "repro.mp4")
+ self.assertAlmostEqual(float(info["duration"]), res["duration"], delta=0.5)
+ self.assertFalse((job / "repro.work").exists()) # removed after qa
+ self.assertFalse((job / "project" / "work").exists())
+ data = json.loads((job / "job.json").read_text(encoding="utf-8"))
+ self.assertIn("repro.mp4", json.dumps(data.get("outputs")))
+ assert_clean(self, job, SECRETS + ("/home/user",), machine=(str(Path.home()), str(tmp.resolve())))
+ finally:
+ shutil.rmtree(str(tmp), ignore_errors=True)
+
+
+if __name__ == "__main__":
+ argv = [a for a in sys.argv if a != "--fast"]
+ unittest.main(argv=argv, verbosity=2 if "-v" in argv else 1)
diff --git a/skills/showtime/tests/test_site_build.py b/skills/showtime/tests/test_site_build.py
index 99ecd99..11a5a68 100644
--- a/skills/showtime/tests/test_site_build.py
+++ b/skills/showtime/tests/test_site_build.py
@@ -358,6 +358,29 @@ class GalleryCards(unittest.TestCase):
self.assertFalse((self.tmp / "out" / "media" / "41-y" / "notes.txt").exists())
[email protected](build is None, "needs markdown-it-py (showtime's venv has it)")
[email protected](HAVE_EXAMPLES and (build.EXAMPLES / "_harness").is_dir(), NO_EXAMPLES)
+class HarnessPage(unittest.TestCase):
+ """harness/: the harness manual is a whole site page with its own title, the editor's note (ARTICLE_URL) stripped,
+ the article link filled in, and a search entry whose anchors exist."""
+
+ def test_build_harness_writes_the_page(self):
+ tmp = Path(tempfile.mkdtemp(prefix="st-harness-"))
+ self.addCleanup(shutil.rmtree, tmp, True)
+ site = build.Site(tmp, [], "owner/repo", None, "main")
+ build.build_harness(site)
+ text = (tmp / build.HARNESS_PAGE).read_text(encoding="utf-8")
+ self.assertIn("<title>Many hands, one yes: a guide to harness engineering</title>", text)
+ self.assertNotIn("ARTICLE_URL", text)
+ self.assertNotIn("{{", text)
+ url = build.ARTICLE_URL.match(build.HARNESS_SRC.read_text(encoding="utf-8")).group(1)
+ self.assertIn('href="%s"' % url, text)
+ self.assertNotIn('"media/', text)
+ self.assertEqual(build.check_pages(tmp, site.written, site.h2_expect), [])
+ self.assertEqual([e["u"] for e in site.search], [build.HARNESS_PAGE])
+ self.assertEqual(build.check_search(site), [])
+
+
@unittest.skipIf(build is None, "needs markdown-it-py (showtime's venv has it)")
class StartHereAndShelves(unittest.TestCase):
"""The docs proposal (0.4.2): the gallery's shelves come from site/content/gallery.json, Start here names the kind
@@ -423,7 +446,17 @@ class StartHereAndShelves(unittest.TestCase):
self.assertEqual(sorted(on), sorted(e["num"] for e in exs))
self.assertEqual([g["name"] for g in shelves], ["Explainers", "Your footage", "Products and brands", "Code and data",
"Social and trailers", "Looks and motion"])
- self.assertEqual(sum(1 for e in exs if e["num"] in build.NEW_IDS), 10)
+ self.assertEqual(sum(1 for e in exs if e["num"] in build.NEW_IDS), 13)
+
+ @unittest.skipUnless(HAVE_EXAMPLES, NO_EXAMPLES)
+ def test_live_figures_are_the_cards_html_not_its_videos(self):
+ # a diagram card lists its --interactive exports after "Live figures:"; they are its HTML, never a video
+ _groups, exs = build.parse_examples()
+ d = next(e for e in exs if e["num"] == "diagram")
+ self.assertEqual(d["watch"], ["_diagram/enter-720p.mp4"])
+ self.assertEqual(d["html"], ["_diagram/econ-lab-figure.html", "_diagram/enter-figure.html"])
+ for e in exs:
+ self.assertFalse(any(w.endswith(".html") for w in e["watch"]), e["num"])
def test_new_in_name_follows_the_release_series(self):
# the badges and tab (gallery.json) and the landing tile (whats-new.md) must name the same release series
diff --git a/skills/showtime/tests/test_site_search.py b/skills/showtime/tests/test_site_search.py
index 33b4823..5d6611e 100644
--- a/skills/showtime/tests/test_site_search.py
+++ b/skills/showtime/tests/test_site_search.py
@@ -221,9 +221,9 @@ class RealBuild(unittest.TestCase):
start = gallery[gallery.index('id="shelf-start-here"'):gallery.index('id="shelf-explainers"')]
self.assertEqual(re.findall(r"<h3><a [^>]*>([^<]+)</a></h3>", start), ["Launch video", "Narrated explainer", "Your footage, edited"])
self.assertIn("Make a 20-second launch video", start, "the kind's name sits over the example's own request")
- self.assertEqual(gallery.count('<span class="badge">New in 0.4</span>'), 10)
+ self.assertEqual(gallery.count('<span class="badge">New in 0.4</span>'), 13)
self.assertIn('<span class="spec">25 \u00b7 2:38</span>', gallery)
- self.assertIn("Thirty examples and two demos", gallery)
+ self.assertIn("Thirty examples and five demos", gallery)
landing = (out / "index.html").read_text(encoding="utf-8")
self.assertIn('<a class="btn primary" href="docs/guides/first-video.html">Get started</a>', landing)
self.assertIn("<h3>New in 0.4</h3>", landing)