commit 5b2de5c1bc1bd7a5c85da6fe87b79ab49b924d25
parent 8d74a3c7684a90e8b8b163c34c091bdbb646b137
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 00:25:09 -0500
Merge lane/measure-extras: the weight video's goal stack, remembered-peak drift, promise clock (a second speaker's claims, refunded/kept outcomes), diet badge and streak chain as deck modules drawn the same by the render and Play; cue pages' windowed first frame primed; Play serves every module layer (operator, 5 Nov: "all modules"; "I think all the p3 and p2 modules that could be used here should be tried out … Make variants for me to judge"; "Involve MadamSavvy as a character")
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
25 files changed, 2538 insertions(+), 14 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -1509,10 +1509,15 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr
| [Then and now (pair)](#then-and-now-pair) `pair` | Two clips on one subject, each with its date: a then \| now strip (or a then→now card) with the pair's caption. (a page over the whole cut) | `render.chrome.pair` |
| [Status ledger](#status-ledger) `status` | A row per item -- announced, then followed up or not -- filling a column as the cut plays. (a page over the whole cut) | `render.chrome.status` |
| [Effects](#effects) `fx` | Overlays on the picture: receipts, a zoom, a scrubber, captions. (a page over the whole cut) | `render.chrome.fx` |
+| [Streak chain](#streak-chain) `streak` | A chain per run along the in-record dates, cracked with its length when the run ends; past runs dimmed in a row. (a page over the whole cut) | `render.chrome.deck.streak` |
+| [Diet badge](#diet-badge) `diet` | The diet he names as a stamp that slams on at each change, with its number; "No diet" when the state says so. (a page over the whole cut) | `render.chrome.deck.diet` |
+| [Moving start](#moving-start) `peak` | The starting weight as he retells it: a tick per telling on a small scale, a count per repeat, the drift bracketed. (a page over the whole cut) | `render.chrome.deck.peak` |
+| [Goal stack](#goal-stack) `goals` | Each goal he names as a sticky note on a pile -- a repeat merged with its count, a deadline counted down to the render date. (a page over the whole cut) | `render.chrome.deck.goals` |
| [Thread rail](#thread-rail) `threads` | A card per thread beside the footage, lit as its clips play. (a page over the whole cut) | `render.chrome.threads` |
| [Flips](#flips) `flips` | Pairs of what was said then and now, in the side panel. (a page over the whole cut) | `render.chrome.flips` |
| [Chapters](#chapters) `chapter` | A section bumper over the first seconds of the clip it opens: title, subtitle, date. (pages at their own seconds) | `render.chrome.chapter` |
| [Finale](#finale) `finale` | The cut's last clips under the rail redrawn large, the final totals and stats cards. (pages at their own seconds) | `render.chrome.deck.finale` |
+| [Promise clock](#promise-clock) `promise` | Days since a promise -- to the clip on screen, then to the render date -- with each check's words and whether it was kept. (a page over the whole cut) | `render.chrome.deck.promise` |
### Play the cut and the live preview
@@ -1524,7 +1529,7 @@ it can be seeked. `POST /api/report/chrome/preview` returns every such module th
build's predicate) as `layers: [{id, z, region, clock, ready, geometry, src | windows}]`; the client lays them
by z over the deck's page, a whole-cut page for the whole cut, a window module's page only inside each window.
-Declaring `play`: `stats`, `pair`, `status`, `fx`, `threads`, `flips`, `chapter`.
+Declaring `play`: `stats`, `pair`, `status`, `fx`, `streak`, `diet`, `peak`, `goals`, `threads`, `flips`, `chapter`, `promise`.
Still drawn by their own paths (the response's `src`, `feed`, `posts`, `stamp` and `finale` keys), and what moving
each onto `play` needs: the deck (`shell`) -- its typed words patched in live (`deck:text`) and the `deck:ready`
@@ -1729,6 +1734,51 @@ Overlays on the picture -- receipts, a zoom, the scrubber, a kinetic quote, punc
| beside popup posts that move the footage (`deck.posts.shift`) | the effects are drawn over the footage box where it stays, so an effect on screen WHILE the posts hold the footage aside is refused, naming both and their seconds — a zoom, receipts, a quote or a punch-in on its own clip's span; a whip, glitch or THEN/NOW wipe around its cut; the scrubber and the odometer over every clip (so beside any shift). A persisting bar holds it aside from its first post to its glide back. Apart in time, both are drawn. `umtool check` reads the estimated schedule; the build checks again on the measured one before any chrome is drawn | `deck.posts.shift=false`, the feed, or move one of them |
| the zoom's timing (`fx.zoom.at`, `.hold`) | up 0.2 s into the clip's clean span (the card rises in over 0.38 s, `back.out`); its focus box draws 0.55 s later (0.45 s); it pushes in on the box at `at` — seconds into the clip, default as soon as the box has drawn — over 1 s (`power2.inOut`), then drifts slowly on the detail. It leaves with a 0.3 s fade 0.3 s before the clip's clean span ends, or with `hold` (0.5–10 s) that long after the push lands (never past the clip's own leave) | `fx.zoom='{…,"hold":4}'` |
+### Streak chain
+
+A chain per run along a time axis by in-record date (`render.chrome.deck.streak`, measure-extras.mjs): a run starts a chain, each day it holds extends it (the live chain grows with the in-record date of what is on screen, its day count beside it), and when the run ends the chain cracks -- its tip snaps off, a red break, its length tagged ("KETO · 41 days", a lapse "after 73 days") -- then dims into the row, so the stop-start rhythm stays on screen. `source` picks the runs: `diet` (the state's diet turning on or changing -- a new regime or diet number -- ends the last and starts the next; off ends it), `lostRuns` (the odometer's runs, each from its start to the next one's), `pledges` (the sobriety video's: a `pledge` event starts a run, a `lapse` snaps it -- an adapter only until the ledger writes those kinds). `axis: "runs"` lays the chains one after another, each as wide as the square root of its length, instead of on the dates. It sits bottom-centre, between the diet badge and the goal stack, so the diet badge, the chain, or both can run (`umtool look <p> deck.diet=false` / `deck.streak=false`).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.streak` | `true` · `false` · `{show, position, x, y, scale, hold, finale, source, axis, title, color, colors, labels}` · default on with a measure slice | `umtool look <p> deck.streak=false` |
+| `deck.streak.source`, `.axis` | `diet` `lostRuns` `pledges` · `date` `runs` · default `diet`, `date` | `umtool look <p> deck.streak.source=lostRuns` |
+| `deck.streak.position`, `.x`/`.y`, `.scale` | an anchor in the footage box · design px · 0.5–2 · default `bottom-center`, unset, 1 | `umtool look <p> deck.streak.position=bottom-left` |
+| `deck.streak.hold`, `.finale` | 0 (up from the first run on) or 2–600 s · `hide` `show` · default 0, `hide` | `umtool look <p> deck.streak.hold=15` |
+| `deck.streak.title`, `.color`, `.colors`, `.labels` | ≤40 · #hex · `{<regime>: #hex}` · `{<regime>: words}` · default the source's word, the accent, the regimes' inks and names | `umtool look <p> deck.streak.title='Every diet'` |
+
+### Diet badge
+
+The diet he names as a rubber stamp in a corner of the footage box (`render.chrome.deck.diet`, measure-extras.mjs): at each change of the state's diet -- its regime or its diet number -- a new stamp slams on (in big and turned, onto the page, a shake), the regime's word in its ink and "DIET #n" under it with the ledger's words when they say more ("Keto · 5 carbs a day"); a change of words alone fades the new stamp in. A null diet after one fades to "NO DIET" in grey. It draws `state.diet` as the measure slice gives it -- the off-scope rule ("off GLP-1" while on keto is still keto) is the ledger's. The inks default to the quartering-diet regimes' (keto #E0913C, carnivore #C9534B, fasting #4E9BD8, calories #3FA9A0, glp1 #B168C6, other #8E97A8, off #98A29B).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.diet` | `true` · `false` · `{show, position, x, y, scale, hold, finale, colors, labels}` · default on with a measure slice | `umtool look <p> deck.diet=false` |
+| `deck.diet.position`, `.x`/`.y`, `.scale` | an anchor in the footage box · design px · 0.5–2 · default `bottom-left`, unset, 1 | `umtool look <p> deck.diet.position=top-right` |
+| `deck.diet.hold`, `.finale` | 0 (up from the first diet on) or 2–600 s · `hide` `show` · default 0, `hide` | `umtool look <p> deck.diet.hold=15` |
+| `deck.diet.colors`, `.labels` | `{<regime>: #hex}` · `{<regime>: words ≤40}` · default the regimes' inks and names | `umtool look <p> deck.diet.labels='{"glp1":"Ozempic"}'` |
+
+### Moving start
+
+The weight he says he started at, as he retells it (`render.chrome.deck.peak`, measure-extras.mjs): each remembered weight that is one of the measure totals' `peakDrift` values (`values: "drift"`; `all` draws every remembered weight) adds a tick on a small vertical scale -- the scale's range is fixed over the whole cut, so nothing rescales -- with its value, a retelling of the same number a count ("≈390 ×5"), the newest lit; the spread from the lowest to the highest so far is bracketed in red and written under it ("+24.3 lb"). Up for `hold` seconds after each telling (default 12).
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.peak` | `true` · `false` · `{show, position, x, y, scale, hold, finale, title, values, color}` · default on with a measure slice | `umtool look <p> deck.peak=false` |
+| `deck.peak.position`, `.x`/`.y`, `.scale` | an anchor in the footage box · design px · 0.5–2 · default `top-right`, unset, 1 | `umtool look <p> deck.peak.scale=0.9` |
+| `deck.peak.hold`, `.finale` | 0 (stays up) or 2–600 s · `hide` `show` · default 12, `hide` | `umtool look <p> deck.peak.hold=0` |
+| `deck.peak.title`, `.values`, `.color` | ≤40 · `drift` `all` · #hex · default "The start keeps moving", `drift`, #FF5A4E | `umtool look <p> deck.peak.values=all` |
+
+### Goal stack
+
+A sticky note per goal on a pile in a corner of the footage box, read off the schedule's `measure` slice (`render.chrome.deck.goals`, measure-extras.mjs): each goal or goalLoss event drops one, turned a little, onto the pile; the same goal in the same words ("lose 100") merges into its note with a count ("×8") and comes to the front; `max` notes show, the newest in front, with the goals set so far under them. A goal with a `deadline` counts down to `measure.asOfRender` ("by Christmas · 50 days left · needs 226.5"): Christmas is the next 25 Dec from the day he said it, "next year" a year on, a named year that year; words that name no date ("by my birthday") keep their label and no countdown. On whenever the cut has a measure slice with a goal on camera; `false` turns it off. Up for `hold` seconds after each goal (default 20), the pile as it stands each time. The four measure extras sit at anchors of the footage box by default, clear of the instrument panel's right column and of the top-left, where the streams' face cam most often is (the diet badge bottom-left, the goal stack bottom-right, the moving start top-right, the promise clock top-centre); `position` or `x`/`y` move one.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.goals` | `true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown}` · default on with a measure slice | `umtool look <p> deck.goals=false` |
+| `deck.goals.position`, `.x`/`.y`, `.scale` | `top-left` `top-right` `bottom-left` `bottom-right` `top-center` `bottom-center` · design px · 0.5–2 · default `bottom-right`, unset, 1 | `umtool look <p> deck.goals.position=bottom-left` |
+| `deck.goals.max`, `.color`, `.countdown` | 1–8 notes · #hex paper · bool · default 4, the palette's amber, `true` | `umtool look <p> deck.goals.max=6` |
+| `deck.goals.hold`, `.finale` | 0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide` | `umtool look <p> deck.goals.hold=0` |
+
### Thread rail
A card per thread in the side panel beside the footage, lit as its clips play; a thread’s outcome stamped on its last clip (`render.chrome.threads`, threads.mjs).
@@ -1764,4 +1814,16 @@ The full reference is [The finale](#the-finale-the-timeline-in-primary-view). It
| `deck.finale` | `{video, motion, totals, stats, statsTitle, railLabels, pips, timelineShare, claims}` | `umtool look <p> deck.finale='{…}'` |
| a clip's `layout` | `finale` on one run of clips at the end | `umtool set <p> <clip> layout=finale` |
+### Promise clock
+
+A days-since counter for a promise (`render.chrome.deck.promise`, measure-extras.mjs), from the promise's event on: "SCALE VIDEO OFFERED 23 OCT", the days from the day he said it to the in-record date of the latest event on screen, and "NONE POSTED" in red until a row says it was kept ("POSTED", green). Each promise check's words come in under it with a flash (`checks`: the row's `label`, or its transcript `quote`). From the finale's start -- else 4 s after the last event -- the days count on, a day a step, to `measure.asOfRender`. Another party on the promise (CONTRACT addendum: a ledger row with a `speaker`, a `promise_claim`) shows under the header -- "PAID 23 OCT BY @MadamSavvy" (`claimVerb`, her `paidOn` else the claim's date), with her picture from the manifest's `postAvatars` (`umtool posts avatar`; else a monogram) -- and her words flash under the clock in her ink (`claimColor`, or `speakers.<k>.color`), his in amber. An outcome (`promise_outcome`) is drawn too: `refunded` slams on a stamp "REFUNDED · by 31 Oct · no video" while the days keep counting to the render date, `withdrawn` likewise in grey, `kept` turns it green ("POSTED") and stops the count on the day. Laid over the finale (z 95) unless `finale: "hide"`.
+
+| Knob | Range · default | From a terminal |
+|---|---|---|
+| `deck.promise` | `true` · `false` · `{show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks}` · default on with a measure slice | `umtool look <p> deck.promise=false` |
+| `deck.promise.position`, `.x`/`.y`, `.scale` | an anchor in the footage box · design px · 0.5–2 · default `top-center`, unset, 1 | `umtool look <p> deck.promise.position=bottom-center` |
+| `deck.promise.hold`, `.finale` | 0 (stays up) or 2–600 s · `hide` `show` · default 0, `show` | `umtool look <p> deck.promise.finale=hide` |
+| `deck.promise.label`, `.verb`, `.kept`, `.broken`, `.checks` | ≤40 each · `label` `quote` · default the row's display, "offered", "Posted", "None posted", `label` | `umtool look <p> deck.promise.label='scale video'` |
+| `deck.promise.speakers`, `.claimVerb`, `.claimColor` | `{<speaker>: {handle, color}}` · ≤40 · #hex · default `{}` (the postAvatars handle), "paid", #E37AB8 | `umtool look <p> deck.promise.speakers='{"madamsavvy":{"handle":"MadamSavvy"}}'` |
+
<!-- modules:end -->
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -50,6 +50,7 @@ import { makeModulesFixture } from "./modules-fixture.mjs";
import { makeMarksFixture } from "./marks-fixture.mjs";
import { makeLivePreviewFixture } from "./live-preview-fixture.mjs";
import { makePlayCutFixture } from "./play-cut-fixture.mjs";
+import { makeMeasureExtrasFixture } from "./measure-extras-fixture.mjs";
import { makeVideoEntryFixture } from "./video-entry-fixture.mjs";
import { makeCutEditingFixture } from "./cut-editing-fixture.mjs";
import { makeReelFixture } from "./reel-fixture.mjs";
@@ -2029,6 +2030,10 @@ pm.timeline = pm.timeline.map((e) => (e.id === "c03" ? { ...e, verdict: "incorre
writeFileSync(pmFile, JSON.stringify(pm, null, 2) + "\n");
}
+// The same cut with a measure slice in its schedule (play-measure.spec.ts): the weight
+// video's goal stack, moving start, promise clock and diet badge drawn in Play the cut.
+await makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") });
+
// Wrong speaker in Play the cut (play-modules.spec.ts), which WRITES (removes c02, then undoes):
// its own copy, so no other spec's cut moves under it.
makePlayCutFixture({ reports, deckManifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), name: "play-wrong-fixture", title: "The Play Wrong Speaker Fixture" });
diff --git a/umtool/e2e/fixtures/measure-extras-fixture.mjs b/umtool/e2e/fixtures/measure-extras-fixture.mjs
@@ -0,0 +1,72 @@
+// What play-measure.spec.ts plays: play-cut-fixture's short deck cut on playvid
+// with a MEASURE LEDGER (the weight video's measure extras:
+// report-to-video/measure-extras.mjs) -- so its schedule, the estimate's that
+// Play draws, carries the measure slice (deck.mjs estimateSchedule ->
+// measure-slice.mjs), and the goal stack, the moving start, the promise clock,
+// the diet badge and the streak chain play in Play the cut through the module
+// contract's `play`. Rows are pinned to the clips by `entryId`; with no words
+// in an estimate, a clip's rows land at its start.
+//
+// c01 diet keto, "lose 100" c02 ≈390 remembered, "lose 100" again, 365.7 remembered
+// c03 carnivore, 291.5 stated, the scale-video promise (23 Oct), a SYNTHETIC claim by madamsavvy (24 Oct)
+// c04 "lose 65" by Christmas, the check (3 Nov)
+//
+// Synthetic, like every fixture.
+import { readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+import { makePlayCutFixture } from "./play-cut-fixture.mjs";
+
+export const MEASURE_SCHEMA = {
+ kind: "measure", unit: "lb", yMin: 220, yMax: 400, bandGapDays: 60,
+ tracks: [
+ { key: "weight", role: "value", label: "Weight" },
+ { key: "regime", role: "regime", label: "Diet", regimes: ["keto", "carnivore", "off"] },
+ ],
+ forms: ["current", "past", "delta", "goal", "goal_loss", "overweight_by", "status"],
+ regimes: [{ key: "keto", label: "Keto" }, { key: "carnivore", label: "Carnivore" }, { key: "off", label: "No diet" }],
+ // The bound a row may carry ("≈390"): a field of the schema, as the weight ledger's.
+ fields: [{ key: "qualifier", label: "Bound", kind: "enum", options: [">", "<", "≈"], appliesTo: { scope: "weight" }, render: "cell" }],
+};
+
+const row = (o) => ({ scope: "weight", scopeBasis: "his words", scopeConfidence: "read", valueKind: "uttered", flags: [], asOf: null, ...o });
+
+export const MEASURE_LEDGER = [
+ row({ id: "r01", date: "2026-07-19", scope: "regime", population: "status", value: "keto", event: "start", display: "Keto", entryId: "c01" }),
+ row({ id: "w01", date: "2026-07-19", population: "goal_loss", value: -100, display: "lose 100", entryId: "c01" }),
+ row({ id: "w02", date: "2026-08-01", population: "past", asOf: "2025-02-01", value: 390, qualifier: "≈", display: "≈390 lb", entryId: "c02" }),
+ row({ id: "w03", date: "2026-08-01", population: "goal_loss", value: -100, display: "lose 100", entryId: "c02" }),
+ row({ id: "w04", date: "2026-08-02", population: "past", asOf: "2023-12-31", value: 365.7, display: "365.7 lb", entryId: "c02" }),
+ row({ id: "r02", date: "2026-09-01", scope: "regime", population: "status", value: "carnivore", event: "start", display: "Carnivore", entryId: "c03" }),
+ row({ id: "w05", date: "2026-10-20", population: "current", value: 291.5, display: "291.5 lb", entryId: "c03" }),
+ row({ id: "p01", date: "2026-10-23", population: "promise", value: null, display: "post a video of the scale", label: "I'll post a video of the scale", entryId: "c03" }),
+ row({ id: "SYNTH-c01", date: "2026-10-24", population: "promise_claim", value: null, speaker: "madamsavvy", promise: "p01",
+ display: "bought the 5 bags", label: "I bought the 5 bags — where's the scale video?", synthetic: true, entryId: "c03" }),
+ row({ id: "w06", date: "2026-10-26", population: "goal_loss", value: -65, display: "lose 65", deadline: "by Christmas", due: "2026-12-25", entryId: "c04" }),
+ row({ id: "p02", date: "2026-11-03", population: "promise_check", value: null, promise: "p01", display: "brush-off",
+ label: "\"just pull up a video from three months ago\"", entryId: "c04" }),
+];
+
+/**
+ * @param {{ reports: string, deckManifest: Function, cachedWindow: string }} o
+ */
+export async function makeMeasureExtrasFixture({ reports, deckManifest, cachedWindow }) {
+ const { dir } = makePlayCutFixture({
+ reports, deckManifest, cachedWindow, name: "play-measure-fixture", title: "The Play Measure Fixture",
+ chrome: {
+ // The tally's word fitted to its cell (the Play cut's own "Seizures" overflows it, so its chrome never composes).
+ factcheck: { verdicts: { CORROBORATED: { label: "Seizures", tallyLabel: "Seized", color: "#6fa8dc" } }, stamp: { seconds: 1 } },
+ },
+ });
+ const file = path.join(dir, "video.manifest.json");
+ const m = JSON.parse(readFileSync(file, "utf8"));
+ m.ledgerSchema = MEASURE_SCHEMA;
+ m.ledger = MEASURE_LEDGER;
+ m.render.chrome.deck = {
+ ...(m.render.chrome.deck ?? {}),
+ measure: { scopes: ["weight", "regime"], asOf: "2026-11-05" },
+ promise: { label: "scale video" },
+ };
+ writeFileSync(file, JSON.stringify(m, null, 2) + "\n");
+ return { dir };
+}
diff --git a/umtool/e2e/modules.spec.ts b/umtool/e2e/modules.spec.ts
@@ -125,7 +125,12 @@ test("the chat module's settings are saved through the panel and refused with th
await expect(card.getByTestId("module-status-chat")).toHaveText("saved");
await expect.poll(() => readManifest().render.chrome.chat.position).toBe("left");
// A value the build would refuse is refused with its sentence, the manifest untouched.
- await card.getByTestId("module-field-chat-lines").fill("99");
+ // (The save reloads the panel, and the reload resets the card's draft: a fill
+ // that lands before it is wiped. Fill until the draft holds.)
+ await expect(async () => {
+ await card.getByTestId("module-field-chat-lines").fill("99");
+ await expect(card.getByTestId("module-save-chat")).toBeEnabled({ timeout: 1_000 });
+ }).toPass({ timeout: 15_000 });
await card.getByTestId("module-save-chat").click();
await expect(card.getByTestId("module-errors-chat")).toContainText("render.chrome.chat.lines");
expect(readManifest().render.chrome.chat.position).toBe("left");
diff --git a/umtool/e2e/play-measure.spec.ts b/umtool/e2e/play-measure.spec.ts
@@ -0,0 +1,104 @@
+import { test, expect, type Page } from "@playwright/test";
+import * as urls from "./urls";
+
+// ---------------------------------------------------------------------------
+// Play the cut draws the weight video's measure extras (umtool/docs/knobs.md,
+// Modules: Goal stack, Moving start, Promise clock, Diet badge): each module
+// reads the schedule's `measure` slice and declares `play`, so the full preview
+// returns it as a layer -- its own page, composed for preview, laid at its
+// region over the footage and seeked on the cut clock (`deck:seek`), posting
+// `<region>:ready` once it can be.
+//
+// Fixture: e2e/fixtures/measure-extras-fixture.mjs as play-measure-fixture --
+// the Play cut with a measure LEDGER pinned to its clips, so the estimate's
+// schedule (what Play draws) carries the measure slice; a clip's rows land at
+// its start (c01 0, c02 1.6, c03 4.3, c04 5.9 on the estimate's clock):
+// c01 keto, "lose 100" c02 ≈390, "lose 100" again, 365.7
+// c03 carnivore, 291.5, the scale-video promise (23 Oct), a SYNTHETIC claim by madamsavvy (24 Oct)
+// c04 "lose 65" by Christmas, the check (3 Nov)
+// ---------------------------------------------------------------------------
+
+const PROJECT = "reports/play-measure-fixture";
+const IDS = ["streak", "diet", "peak", "goals", "promise"] as const;
+
+const root = (page: Page) => page.locator("[data-play-cut]");
+const layer = (page: Page, id: string) => page.locator(`[data-play-layer="${id}"]`);
+
+/**
+ * What a module's page draws at the playhead: the words of the state blocks on
+ * screen, or null while its panel is down -- read inside its own page, which is
+ * what the render captures.
+ */
+const shown = (page: Page, id: string) =>
+ page
+ .frameLocator(`[data-testid="play-layer-${id}-iframe"]`)
+ .locator("#pn")
+ .evaluate((pn) => {
+ if (Number(getComputedStyle(pn).opacity) < 0.5 || getComputedStyle(pn).visibility === "hidden") return null;
+ const on = [...pn.querySelectorAll<HTMLElement>(".st")].filter((e) => getComputedStyle(e).visibility !== "hidden" && Number(getComputedStyle(e).opacity) > 0.5);
+ return on.map((e) => (e.textContent ?? "").replace(/\s+/g, " ").trim()).join(" | ");
+ });
+
+/** Every layer laid and its page ready (it posted `<region>:ready`). */
+async function ready(page: Page) {
+ await expect(root(page)).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 });
+ await expect(page.locator('[data-testid="play-deck"]')).toBeVisible({ timeout: 30_000 });
+ for (const id of IDS) {
+ await expect(layer(page, id)).toHaveAttribute("data-play-layer-up", "1", { timeout: 30_000 });
+ await expect(page.getByTestId(`play-layer-${id}`)).toHaveAttribute("data-feed-ready", "1", { timeout: 30_000 });
+ }
+}
+
+test.beforeEach(() => {
+ test.setTimeout(150_000);
+});
+
+test("the measure extras play in Play the cut, each page seeked to the playhead's state", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 1000 });
+
+ // A second into c04: every row before it has landed.
+ await page.goto(urls.playHref(PROJECT, { clip: "c04", at: 1 }));
+ await ready(page);
+ await expect(root(page)).toHaveAttribute("data-play-item", "c04");
+ // Laid in the build's z order: the streak (65), diet (66), peak (67), goals (68), the promise clock (95, over the finale).
+ expect(await page.locator("[data-play-layer]").evaluateAll((els) => els.map((e) => e.getAttribute("data-play-layer")))).toEqual([...IDS]);
+
+ await expect.poll(() => shown(page, "goals"), { timeout: 10_000 }).toContain("LOSE 65");
+ const goals = await shown(page, "goals");
+ expect(goals).toContain("by Christmas · 50 days left");
+ expect(goals).toContain("needs 226.5");
+ expect(goals).toContain("×2");
+ expect(goals).toContain("3 goals set");
+ const peak = await shown(page, "peak");
+ expect(peak).toContain("≈390");
+ expect(peak).toContain("365.7");
+ expect(peak).toContain("+24.3 lb");
+ const promise = await shown(page, "promise");
+ expect(promise).toContain("scale video offered 23 Oct");
+ expect(promise).toContain("11 days");
+ expect(promise).toContain("None posted");
+ // Her claim (SYNTHETIC in the fixture): the counterparty under the header.
+ expect(promise).toContain("paid 24 Oct by @madamsavvy");
+ expect(promise).toContain("just pull up a video from three months ago");
+ const diet = await shown(page, "diet");
+ expect(diet).toContain("Carnivore");
+ expect(diet).toContain("Diet #2");
+ const streak = await shown(page, "streak");
+ expect(streak).toContain("Carnivore");
+ expect(streak).toContain("Day 63");
+ await page.screenshot({ path: test.info().outputPath("play-measure-c04.png") });
+
+ // Back five seconds, in the page (0.3 s into c02): the pages are seeked back.
+ await expect(root(page)).toHaveAttribute("data-play-state", "paused");
+ await page.getByRole("button", { name: "−5" }).click();
+ await expect(root(page)).toHaveAttribute("data-play-item", "c02");
+ await expect.poll(() => shown(page, "goals"), { timeout: 10_000 }).toContain("2 goals set");
+ expect(await shown(page, "goals")).toContain("×2");
+ expect(await shown(page, "goals")).not.toContain("LOSE 65");
+ expect(await shown(page, "diet")).toContain("Keto");
+ expect(await shown(page, "diet")).toContain("Diet #1");
+ expect(await shown(page, "streak")).toContain("Keto");
+ await expect.poll(() => shown(page, "peak"), { timeout: 10_000 }).toContain("365.7");
+ expect(await shown(page, "promise")).toBeNull();
+ await page.screenshot({ path: test.info().outputPath("play-measure-c02.png") });
+});
diff --git a/umtool/lib/report/layerPreview.test.mjs b/umtool/lib/report/layerPreview.test.mjs
@@ -40,8 +40,11 @@ test("each layer composed alone: a whole page once, a window page per window, a
assert.ok(calls.every((c) => c.schedule === schedule && c.manifestPath === "/p/video.manifest.json"));
});
-test("the files route serves a layer's project by its name, a window's only for the cut's own entry", () => {
+test("the files route serves a layer's project by its name, a window's only for the cut's own entry", async () => {
assert.equal(layerPreviewOf("pair-preview"), "pair-preview");
+ // Every module Play draws as a layer is served by the files route (its iframe would be a 404 otherwise).
+ const { playModules } = await import("umtool-report-to-video/modules");
+ for (const m of playModules()) assert.equal(layerPreviewOf(`${m.region}-preview`), `${m.region}-preview`, m.id);
assert.equal(layerPreviewOf("chapter-preview-b", ["a", "b"]), "chapter-preview-b");
assert.equal(layerPreviewOf("chapter-preview-zz", ["a", "b"]), null);
assert.equal(layerPreviewOf("chapter-preview-..", [".."]), null);
diff --git a/umtool/lib/report/serve.mjs b/umtool/lib/report/serve.mjs
@@ -979,7 +979,8 @@ export function previewDirFor(projectDir, variant, rest, segmentIds) {
// ---------------------------------------------------------------------------
/** The regions whose pages the panel previews alone. */
-export const LAYER_REGIONS = Object.freeze(["pair", "status", "chapter", "stats", "threads", "flips", "fx"]);
+// (Every module that declares `play` must be here, or Play's iframe of its page is a 404: the measure extras too.)
+export const LAYER_REGIONS = Object.freeze(["pair", "status", "chapter", "stats", "threads", "flips", "fx", "diet", "peak", "goals", "promise", "streak"]);
/** The project name a layer preview is served under, or null when `head` is not one. */
export function layerPreviewOf(head, segmentIds = []) {
diff --git a/umtool/report-to-video/chrome-cues.mjs b/umtool/report-to-video/chrome-cues.mjs
@@ -94,7 +94,14 @@ function fontFaces(fonts) {
* @param {{ id: string, W: number, H: number, fps: number, fonts?: {regular?: string, bold?: string},
* gsapSrc?: string, css: string, body: string, init: object, cues: object[],
* whole?: { total: number, from?: number, duration?: number | null, ids?: string[] },
- * window?: { from: number, dur: number } }} p
+ * window?: { from: number, dur: number }, primeWindow?: boolean }} p
+ *
+ * `primeWindow` (opt-in, the measure extras'): a WINDOW of a whole page is
+ * rendered once at its end and back at its start before anything seeks it. A
+ * window's timeline seeked to exactly 0 -- the renderer's first frame -- is
+ * no change from where it stands, so GSAP renders nothing and the frame shows
+ * init (everything hidden) instead of the cut's state at `from`; with frame
+ * keys, every frame keyed like it is reused from that empty capture.
*/
export function cuePageHtml(p) {
const { id, W, H, fps, css, body, init, cues } = p;
@@ -170,7 +177,9 @@ export function cuePageHtml(p) {
if (!el) continue;
inner.fromTo(el, c.from, { ...c.to, duration: c.dur, ease: c.ease, immediateRender: false }, c.at);
}
- ${play}
+ ${play}${p.primeWindow && !p.window ? `
+ // Primed: a window seeked to 0 must draw the cut's state at its start (see primeWindow).
+ if (S.window) tl.progress(1, true).progress(0, true);` : ""}
window.__timelines = window.__timelines || {};
window.__timelines["${id}"] = tl;
diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs
@@ -0,0 +1,663 @@
+// THE MEASURE EXTRAS' PAGES (weight video rev 9, lane measure-extras): the
+// goal stack, the moving start, the promise clock and the diet badge, each a
+// cue page (chrome-cues.mjs) over the whole cut -- the render captures it
+// frame by frame (HyperFrames png-sequence) and Play iframes the SAME page,
+// seeked by `deck:seek`, posting `<region>:ready`.
+//
+// Each STATE (measure-extras.mjs) is its own block, shown over exactly its
+// span and handed to the frame keys as an item gated by its own autoAlpha:
+// a frame keys only the block on screen, so between two events every frame
+// is the same frame and the render reuses it. Motion is the block's own: the
+// note that lands, the tick that grows, the stamp that slams -- each a cue
+// with its FROM stated, so a seek from anywhere lands on the same pixels.
+//
+// PURE: a schedule and a render block in, `{ html, items }` out.
+import { rgba } from "./chrome-deck.mjs";
+import { compileCues, cuePageHtml, esc, INSTANT, joinSpans, r4, spanEvents } from "./chrome-cues.mjs";
+import {
+ daysBetween, daysLeftText, daysText, dietStates, goalStates, measureExtraGeometry, measureOf, MEASURE_BOXES,
+ monthYear, peakStates, promiseStates, shortDate, streakStates, upSpans, weightText,
+} from "./measure-extras.mjs";
+import { MEASURE_RED, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
+
+/** How each module's panel comes in and goes out, s. */
+export const MEASURE_FADE = Object.freeze({ in: 0.35, out: 0.4 });
+
+const feedOf = (schedule) => schedule?.layout === "feed";
+
+/** The page's frame: its region, its pixel scale against its design box, its fps. */
+function frameOf(id, schedule, render) {
+ const geo = measureExtraGeometry(id, render, { feed: feedOf(schedule) });
+ const k = geo.width / MEASURE_BOXES[id].width;
+ const px = (v) => Math.max(1, Math.round(v * k));
+ return { geo, k, px, fps: schedule.fps ?? render.fps ?? 30 };
+}
+
+/** The display face, when the render names one (`fontDisplay`): the condensed extra-bold, else the deck's bold. */
+const displayFace = (fonts) => (fonts?.display
+ ? `@font-face { font-family: 'MeasureDisplay'; font-weight: 400; font-style: normal; src: url('${esc(fonts.display)}'); }`
+ : "");
+const DISPLAY = "'MeasureDisplay', 'DeckSansBold', sans-serif";
+
+/**
+ * The cues every state page shares: the panel `pn` up over the module's spans,
+ * each state `s<j>` shown from its `at` to the next one's (+ `overlap`, while
+ * the next one's entrance runs), and the state's own events.
+ */
+function stateCues(states, spans, { overlap = 0, own = () => [] } = {}, initExtra = {}) {
+ const init = { pn: { autoAlpha: 0 }, ...initExtra };
+ const ev = [];
+ for (const sp of spans) ev.push(...spanEvents("pn", sp.in, sp.out, { fadeIn: MEASURE_FADE.in, fadeOut: MEASURE_FADE.out }));
+ states.forEach((st, j) => {
+ const k = `s${j}`;
+ init[k] = { autoAlpha: 0 };
+ const until = states[j + 1] ? states[j + 1].at + overlap : null;
+ ev.push({ k, at: st.at, dur: INSTANT, to: { autoAlpha: 1 }, ease: "none" });
+ if (until !== null) ev.push({ k, at: until, dur: INSTANT, to: { autoAlpha: 0 }, ease: "none" });
+ ev.push(...own(st, j, init));
+ });
+ return compileCues(init, ev);
+}
+
+const page = (id, schedule, opts, { geo, fps }, css, body, init, cues, ids) => cuePageHtml({
+ id, W: geo.width, H: geo.height, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css: `${displayFace(opts.fonts)}\n ${css}`,
+ body, init, cues, whole: { total: schedule.total, from: opts.from, duration: opts.duration, ids }, primeWindow: true,
+});
+
+// ---------------------------------------------------------------------------
+// GOALS: the sticky notes.
+// ---------------------------------------------------------------------------
+
+/** A note's place at `depth` in the pile (0 the front), region pixels. */
+function notePlace(note, depth, px, H) {
+ return {
+ x: px(40 + note.dx + 6 * depth),
+ y: H - px(46 + 150) - px(36 * depth),
+ rotation: r4(note.rot + (depth ? (depth % 2 ? -2.5 : 2) : 0)),
+ };
+}
+
+/** The goal stack's page: `{ html, items }`. */
+export function goalsHtml(schedule, render, opts = {}) {
+ const cfg = resolveMeasureExtra("goals", render);
+ const m = measureOf(schedule);
+ const states = goalStates(schedule, render);
+ if (!cfg || !m || !states.length) throw new Error("goals: the schedule's measure slice has no goal on camera");
+ const F = frameOf("goals", schedule, render);
+ const { geo, px } = F;
+ const H = geo.height;
+ const pal = render.palette;
+ const paper = cfg.color ?? pal.amber ?? "#E8A33F";
+ const spans = upSpans(states.map((s) => s.at), cfg, schedule);
+ const items = [];
+ const { init, cues } = stateCues(states, spans, {
+ own: (st, j, init) => {
+ const ev = [];
+ for (const n of st.notes) {
+ const k = `s${j}.${n.id}`;
+ const to = notePlace(n, n.depth, px, H);
+ if (n.key === st.top) {
+ // The new note lands: from above, turned, a size up -- onto the pile.
+ init[k] = { x: to.x - px(30), y: to.y - px(230), rotation: r4(to.rotation + 13), scale: 1.12, opacity: 0 };
+ ev.push({ k, at: st.at, dur: 0.42, to: { x: to.x, y: to.y, rotation: to.rotation, scale: 1, opacity: 1 }, ease: "back.out(1.3)" });
+ if (n.count > 1) {
+ init[`${k}c`] = { scale: 1.9, opacity: 0 };
+ ev.push({ k: `${k}c`, at: st.at + 0.3, dur: 0.32, to: { scale: 1, opacity: 1 }, ease: "back.out(2.2)" });
+ }
+ } else if (n.prev !== null && n.prev !== n.depth) {
+ const from = notePlace(n, n.prev, px, H);
+ init[k] = { x: from.x, y: from.y, rotation: from.rotation };
+ ev.push({ k, at: st.at, dur: 0.36, to: { x: to.x, y: to.y, rotation: to.rotation }, ease: "power2.out" });
+ } else {
+ init[k] = { x: to.x, y: to.y, rotation: to.rotation };
+ }
+ }
+ return ev;
+ },
+ });
+ const blocks = states.map((st, j) => {
+ const notes = st.notes.map((n) => {
+ const k = `s${j}.${n.id}`;
+ const dl = cfg.countdown && n.deadline
+ ? `<div class="dl">${esc(n.deadline)}${n.days !== null ? ` · ${esc(daysLeftText(n.days))}` : ""}</div>${n.target !== null ? `<div class="dl2">needs ${esc(weightText(n.target))}</div>` : ""}`
+ : "";
+ const count = n.count > 1 ? `<div class="ct" data-k="${k}c">×${n.count}</div>` : "";
+ const shade = n.depth ? `<div class="sh" style="opacity:${r4(Math.min(0.5, 0.14 * n.depth))}"></div>` : "";
+ return `<div class="note${dl ? " due" : ""}" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div><div class="nh">Goal${n.date ? ` · ${esc(monthYear(n.date))}` : ""}</div><div class="nt">${esc(n.text)}</div>${dl}${count}${shade}</div>`;
+ }).join("");
+ const html = `<div class="st" data-k="s${j}">${notes}<div class="hd"><span class="hn">${st.goalsSet}</span> goal${st.goalsSet === 1 ? "" : "s"} set</div></div>`;
+ items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
+ return html;
+ });
+ const css = `
+ #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ .st { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ .note { position: absolute; left: 0; top: 0; width: ${px(290)}px; height: ${px(150)}px; padding: ${px(14)}px ${px(18)}px;
+ border-radius: ${px(3)}px; color: #2a1c06; overflow: hidden;
+ background: linear-gradient(168deg, ${paper} 0%, ${paper} 62%, ${rgba(paper, 0.86)} 100%);
+ box-shadow: 0 ${px(10)}px ${px(22)}px rgba(0, 0, 0, 0.45), 0 ${px(1)}px ${px(2)}px rgba(0, 0, 0, 0.3);
+ display: flex; flex-direction: column; justify-content: center; gap: ${px(2)}px; }
+ .tape { position: absolute; left: 50%; top: ${px(-8)}px; width: ${px(84)}px; height: ${px(24)}px; margin-left: ${px(-42)}px;
+ background: rgba(255, 255, 255, 0.38); transform: rotate(-3deg); }
+ .nh { font-family: 'DeckSansBold', sans-serif; font-size: ${px(15)}px; line-height: ${px(18)}px; letter-spacing: 0.14em;
+ text-transform: uppercase; color: rgba(42, 28, 6, 0.62); }
+ .nt { font-family: ${DISPLAY}; font-size: ${px(54)}px; line-height: ${px(58)}px; white-space: nowrap; letter-spacing: 0.01em; }
+ .due .nt { font-size: ${px(44)}px; line-height: ${px(48)}px; }
+ .dl { font-family: 'DeckSansBold', sans-serif; font-size: ${px(19)}px; line-height: ${px(23)}px; color: #7d150c; white-space: nowrap; }
+ .dl2 { font-family: 'DeckSansBold', sans-serif; font-size: ${px(18)}px; line-height: ${px(22)}px; color: rgba(42, 28, 6, 0.8); white-space: nowrap; }
+ /* The count sits in the note's top strip: what shows of a note further down the pile. */
+ .ct { position: absolute; right: ${px(12)}px; top: ${px(6)}px; min-width: ${px(54)}px; height: ${px(30)}px; padding: 0 ${px(9)}px;
+ border-radius: ${px(15)}px; background: #2a1c06; color: ${paper}; text-align: center;
+ font-family: ${DISPLAY}; font-size: ${px(24)}px; line-height: ${px(30)}px; }
+ .sh { position: absolute; inset: 0; background: #000; pointer-events: none; }
+ .hd { position: absolute; left: ${px(10)}px; bottom: ${px(4)}px; height: ${px(32)}px; padding: 0 ${px(14)}px; border-radius: ${px(16)}px;
+ background: ${rgba(pal.bg, 0.88)}; color: ${pal.muted}; font-family: 'DeckSansBold', sans-serif; font-size: ${px(17)}px;
+ line-height: ${px(32)}px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
+ .hn { color: ${paper}; font-family: ${DISPLAY}; font-size: ${px(22)}px; letter-spacing: 0.02em; }`;
+ const body = `<div id="pn" data-k="pn">
+ ${blocks.join("\n ")}
+ </div>`;
+ return { html: page("goals", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`)), items };
+}
+
+// ---------------------------------------------------------------------------
+// PEAK: the moving start.
+// ---------------------------------------------------------------------------
+
+/** Label rows on a scale: each wanted y, pushed apart to `gap` and kept in [top, bottom]. */
+export function spreadLabels(ys, gap, top, bottom) {
+ const order = ys.map((y, i) => ({ y, i })).sort((a, b) => a.y - b.y);
+ const out = order.map((o) => o.y);
+ for (let i = 1; i < out.length; i += 1) out[i] = Math.max(out[i], out[i - 1] + gap);
+ if (out.length && out[out.length - 1] > bottom) {
+ out[out.length - 1] = bottom;
+ for (let i = out.length - 2; i >= 0; i -= 1) out[i] = Math.min(out[i], out[i + 1] - gap);
+ }
+ if (out.length && out[0] < top) {
+ out[0] = top;
+ for (let i = 1; i < out.length; i += 1) out[i] = Math.max(out[i], out[i - 1] + gap);
+ }
+ const res = new Array(ys.length);
+ order.forEach((o, n) => { res[o.i] = out[n]; });
+ return res;
+}
+
+/** The moving start's page: `{ html, items }`. */
+export function peakHtml(schedule, render, opts = {}) {
+ const cfg = resolveMeasureExtra("peak", render);
+ const states = peakStates(schedule, render);
+ if (!cfg || !states.length) throw new Error("peak: the schedule's measure slice has no remembered start on camera");
+ const F = frameOf("peak", schedule, render);
+ const { geo, px } = F;
+ const pal = render.palette;
+ const red = cfg.color ?? MEASURE_RED;
+ const [lo, hi] = states[0].range;
+ const top = px(96);
+ const bottom = geo.height - px(84);
+ const yOf = (v) => r4(bottom - ((v - lo) / (hi - lo)) * (bottom - top));
+ const rulerX = px(72);
+ // The ruler: a tick a pound, a number every five.
+ const marks = [];
+ for (let v = Math.ceil(lo); v <= hi; v += 1) {
+ const major = v % 5 === 0;
+ marks.push(`<div class="mk${major ? " mj" : ""}" style="top:${yOf(v)}px"></div>${major ? `<div class="ml" style="top:${r4(yOf(v) - px(9))}px">${v}</div>` : ""}`);
+ }
+ const spans = upSpans(states.map((s) => s.at), cfg, schedule);
+ const items = [];
+ const { init, cues } = stateCues(states, spans, {
+ own: (st, j, init) => {
+ const ev = [];
+ const t = st.ticks.find((x) => x.latest);
+ const k = `s${j}.t${String(t.value).replace(".", "_")}`;
+ if (!st.repeat) {
+ init[`${k}b`] = { scaleX: 0 };
+ init[`${k}l`] = { opacity: 0, x: px(-12) };
+ ev.push({ k: `${k}b`, at: st.at, dur: 0.35, to: { scaleX: 1 }, ease: "power3.out" });
+ ev.push({ k: `${k}l`, at: st.at + 0.15, dur: 0.3, to: { opacity: 1, x: 0 }, ease: "power2.out" });
+ } else {
+ init[`${k}n`] = { scale: 1.8, opacity: 0 };
+ ev.push({ k: `${k}n`, at: st.at + 0.05, dur: 0.32, to: { scale: 1, opacity: 1 }, ease: "back.out(2.2)" });
+ }
+ // The drift bracket grows to its new extent.
+ const prev = states[j - 1];
+ if (prev && (prev.lo !== st.lo || prev.hi !== st.hi)) {
+ init[`s${j}.br`] = { y: r4(yOf(prev.hi) - yOf(st.hi)), height: r4(yOf(prev.lo) - yOf(prev.hi)) };
+ ev.push({ k: `s${j}.br`, at: st.at + 0.1, dur: 0.45, to: { y: 0, height: r4(yOf(st.lo) - yOf(st.hi)) }, ease: "power2.out" });
+ }
+ return ev;
+ },
+ });
+ const labelGap = px(30);
+ const blocks = states.map((st, j) => {
+ const ys = st.ticks.map((t) => yOf(t.value));
+ const ly = spreadLabels(ys, labelGap, top - px(8), bottom + px(8));
+ const ticks = st.ticks.map((t, i) => {
+ const k = `s${j}.t${String(t.value).replace(".", "_")}`;
+ const cls = t.latest ? " now" : "";
+ const lead = Math.abs(ly[i] - ys[i]) > 1
+ ? `<svg class="ld" style="top:${r4(Math.min(ys[i], ly[i]) - 1)}px;height:${r4(Math.abs(ly[i] - ys[i]) + 2)}px" viewBox="0 0 ${px(14)} ${r4(Math.abs(ly[i] - ys[i]) + 2)}" preserveAspectRatio="none"><line x1="0" y1="${ys[i] < ly[i] ? 1 : r4(Math.abs(ly[i] - ys[i]) + 1)}" x2="${px(14)}" y2="${ys[i] < ly[i] ? r4(Math.abs(ly[i] - ys[i]) + 1) : 1}" /></svg>`
+ : "";
+ const n = t.count > 1 ? `<span class="tn" data-k="${k}n">×${t.count}</span>` : "";
+ return `<div class="tb${cls}" data-k="${k}b" style="top:${r4(ys[i] - px(2))}px"></div>${lead}<div class="tl${cls}" data-k="${k}l" style="top:${r4(ly[i] - px(15))}px"><span class="tv">${t.approx ? "≈" : ""}${esc(weightText(t.value))}</span>${n}</div>`;
+ }).join("");
+ const br = st.hi > st.lo
+ ? `<div class="br" data-k="s${j}.br" style="top:${yOf(st.hi)}px;height:${r4(yOf(st.lo) - yOf(st.hi))}px"></div>`
+ : "";
+ const foot = `<div class="ft"><div class="fd${st.hi > st.lo ? "" : " one"}">${st.hi > st.lo ? `+${esc(weightText(st.drift))} lb` : `${st.ticks[0].approx ? "≈" : ""}${esc(weightText(st.lo))} lb`}</div><div class="fs">${st.hi > st.lo ? "between his tellings" : "his first telling"} · told ${st.told}×</div></div>`;
+ const html = `<div class="st" data-k="s${j}">${br}${ticks}${foot}</div>`;
+ items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
+ return html;
+ });
+ const css = `
+ #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; border-radius: ${px(10)}px;
+ background: ${rgba(pal.bg, 0.88)}; border-left: ${px(5)}px solid ${pal.muted};
+ box-shadow: 0 ${px(8)}px ${px(26)}px rgba(0, 0, 0, 0.4); }
+ .ti { position: absolute; left: ${px(20)}px; right: ${px(16)}px; top: ${px(16)}px; font-family: 'DeckSansBold', sans-serif;
+ font-size: ${px(19)}px; line-height: ${px(24)}px; letter-spacing: 0.1em; text-transform: uppercase; color: ${pal.fg}; }
+ .ti small { display: block; margin-top: ${px(2)}px; font-family: 'DeckSans', sans-serif; font-size: ${px(16)}px; letter-spacing: 0.02em;
+ text-transform: none; color: ${pal.muted}; white-space: nowrap; }
+ .ru { position: absolute; left: ${rulerX}px; top: ${top}px; width: ${px(2)}px; height: ${r4(bottom - top)}px; background: ${rgba(pal.muted, 0.7)}; }
+ .mk { position: absolute; left: ${rulerX - px(6)}px; width: ${px(6)}px; height: ${px(1)}px; background: ${rgba(pal.muted, 0.55)}; }
+ .mk.mj { left: ${rulerX - px(12)}px; width: ${px(12)}px; height: ${px(2)}px; background: ${pal.muted}; }
+ .ml { position: absolute; left: ${px(14)}px; width: ${px(40)}px; text-align: right; font-size: ${px(15)}px; line-height: ${px(18)}px;
+ color: ${pal.muted}; font-variant-numeric: tabular-nums; }
+ .st { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ .tb { position: absolute; left: ${rulerX + px(2)}px; width: ${px(40)}px; height: ${px(4)}px; border-radius: ${px(2)}px;
+ background: ${pal.muted}; transform-origin: 0 50%; }
+ .tb.now { background: ${pal.fg}; box-shadow: 0 0 ${px(10)}px ${rgba(pal.fg, 0.6)}; }
+ .ld { position: absolute; left: ${rulerX + px(42)}px; width: ${px(14)}px; overflow: visible; }
+ .ld line { stroke: ${pal.muted}; stroke-width: ${px(1.5)}; }
+ .tl { position: absolute; left: ${rulerX + px(58)}px; height: ${px(30)}px; white-space: nowrap; color: ${pal.muted};
+ display: flex; align-items: baseline; gap: ${px(6)}px; }
+ .tl.now { color: ${pal.fg}; }
+ .tv { font-family: ${DISPLAY}; font-size: ${px(27)}px; line-height: ${px(30)}px; font-variant-numeric: tabular-nums; }
+ .tn { display: inline-block; font-family: 'DeckSansBold', sans-serif; font-size: ${px(19)}px; color: ${red}; transform-origin: 0 70%; }
+ .br { position: absolute; left: ${px(32)}px; width: ${px(10)}px; border: ${px(3)}px solid ${red}; border-right: none;
+ border-radius: ${px(3)}px 0 0 ${px(3)}px; }
+ .ft { position: absolute; left: ${px(20)}px; right: ${px(14)}px; bottom: ${px(14)}px; }
+ .fd { font-family: ${DISPLAY}; font-size: ${px(36)}px; line-height: ${px(38)}px; color: ${red}; white-space: nowrap; }
+ .fd.one { color: ${pal.fg}; }
+ .fs { font-size: ${px(15)}px; line-height: ${px(19)}px; color: ${pal.muted}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }`;
+ const body = `<div id="pn" data-k="pn">
+ <div class="ti">${esc(cfg.title)}<small>what he says he started at</small></div>
+ <div class="ru"></div>
+ ${marks.join("")}
+ ${blocks.join("\n ")}
+ </div>`;
+ return { html: page("peak", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`)), items };
+}
+
+// ---------------------------------------------------------------------------
+// PROMISE: the days since.
+// ---------------------------------------------------------------------------
+
+/** A speaker's handle as the clock writes it: `promise.speakers[k].handle`, the manifest's postAvatars key, else the key. */
+const handleOf = (speaker, cfg, opts) => String(cfg.speakers?.[speaker]?.handle ?? opts.handles?.[speaker] ?? speaker ?? "").replace(/^@/, "");
+
+/** The promise clock's page: `{ html, items }`. `opts.avatars` = `{ <speaker>: "assets/…" }`, `opts.handles` = `{ <speaker>: handle }`. */
+export function promiseHtml(schedule, render, opts = {}) {
+ const cfg = resolveMeasureExtra("promise", render);
+ const states = promiseStates(schedule, render);
+ if (!cfg || !states.length) throw new Error("promise: the schedule's measure slice has no promise on camera");
+ const F = frameOf("promise", schedule, render);
+ const { px } = F;
+ const pal = render.palette;
+ const red = MEASURE_RED;
+ const green = pal.accent ?? "#22AB83";
+ const amber = pal.amber ?? "#E8A33F";
+ const inkOf = (speaker) => cfg.speakers?.[speaker]?.color ?? cfg.claimColor;
+ const bottom = cfg.position.startsWith("bottom") && !(Number.isFinite(cfg.x) && Number.isFinite(cfg.y));
+ const spans = upSpans(states.map((s) => s.at), cfg, schedule);
+ const items = [];
+ const { init, cues } = stateCues(states, spans, {
+ own: (st, j, init) => {
+ const ev = [];
+ const prev = states[j - 1];
+ st.rows.forEach((r, i) => {
+ const k = `s${j}.r${i}`;
+ const was = prev?.rows[i];
+ if (was && was.days !== r.days) {
+ init[`${k}d`] = { y: px(-14), opacity: 0.35 };
+ ev.push({ k: `${k}d`, at: st.at, dur: 0.18, to: { y: 0, opacity: 1 }, ease: "power2.out" });
+ }
+ if (r.fresh && r.word) {
+ init[`${k}f`] = { opacity: 0.9 };
+ init[`${k}q`] = { x: px(18), opacity: 0 };
+ ev.push({ k: `${k}q`, at: st.at, dur: 0.3, to: { x: 0, opacity: 1 }, ease: "power2.out" });
+ ev.push({ k: `${k}f`, at: st.at + 0.15, dur: 1.4, to: { opacity: 0 }, ease: "power1.in" });
+ }
+ if (r.claim && !was?.claim) {
+ init[`${k}c`] = { opacity: 0, x: px(-14) };
+ ev.push({ k: `${k}c`, at: st.at, dur: 0.35, to: { opacity: 1, x: 0 }, ease: "power2.out" });
+ }
+ // An outcome that is not "kept" slams on as a stamp.
+ if (r.outcome && r.outcome.kind !== "kept" && was?.outcome?.kind !== r.outcome.kind) {
+ init[`${k}o`] = { scale: 2, rotation: -12, opacity: 0 };
+ ev.push({ k: `${k}o`, at: st.at, dur: 0.16, to: { scale: 1, rotation: -4, opacity: 1 }, ease: "power4.in" });
+ }
+ });
+ return ev;
+ },
+ });
+ const blocks = states.map((st, j) => {
+ const rows = st.rows.map((r, i) => {
+ const k = `s${j}.r${i}`;
+ const days = r.days === 0 ? "Today" : `${r.days} day${r.days === 1 ? "" : "s"}`;
+ let claim = "";
+ if (r.claim) {
+ const h = handleOf(r.claim.speaker, cfg, opts);
+ const ink = inkOf(r.claim.speaker);
+ const av = opts.avatars?.[r.claim.speaker]
+ ? `<img class="av" src="${esc(opts.avatars[r.claim.speaker])}" alt="">`
+ : `<span class="av mono" style="background:${esc(ink)}">${esc((h[0] ?? "?").toUpperCase())}</span>`;
+ const when = r.claim.paidOn ?? r.claim.date;
+ claim = `<div class="cl" data-k="${k}c">${av}<span>${esc(cfg.claimVerb)}${when ? ` ${esc(shortDate(when))}` : ""} by <b style="color:${esc(ink)}">@${esc(h)}</b></span></div>`;
+ }
+ let status;
+ const o = r.outcome;
+ if (o && o.kind !== "kept") {
+ const word = o.kind === "refunded" ? "Refunded" : "Withdrawn";
+ status = `<div class="stamp ${esc(o.kind)}" data-k="${k}o"><div class="sw">${word}</div><div class="ss">${o.date ? `by ${esc(shortDate(o.date))} · ` : ""}no video</div></div>`;
+ } else status = `<div class="pill">${esc(r.kept ? cfg.kept : cfg.broken)}</div>`;
+ let q;
+ if (r.word) {
+ const hers = !r.word.his && r.word.speaker;
+ const ink = hers ? inkOf(r.word.speaker) : amber;
+ // An outcome's words are what she reports (his refund email): "reads", not "says".
+ const who = hers ? `<b class="who" style="color:${esc(ink)}">@${esc(handleOf(r.word.speaker, cfg, opts))}</b>${r.word.outcome ? " reads" : ""} ` : "";
+ q = `<div class="ck" data-k="${k}q"><div class="cf" data-k="${k}f" style="background:${rgba(ink, 0.5)}"></div>${who}<span class="qm" style="color:${esc(ink)}">“</span>${esc(r.word.text.replace(/^["“”]+|["“”]+$/g, ""))}<span class="qm" style="color:${esc(ink)}">”</span>${r.word.date ? ` <span class="cd">· ${esc(shortDate(r.word.date))}</span>` : ""}</div>`;
+ } else q = `<div class="ck none">no word on it since</div>`;
+ return `<div class="row"><div class="hd">${esc(r.what)} ${esc(cfg.verb)} ${esc(shortDate(r.said))}</div>${claim}<div class="mid"><div class="dy" data-k="${k}d">${esc(days)}</div><div class="to">as of<br>${esc(shortDate(r.to))}</div>${status}</div>${q}</div>`;
+ }).join("");
+ const r0 = st.rows[0];
+ const cls = r0?.kept ? " kept" : r0?.outcome ? ` ${r0.outcome.kind}` : "";
+ const html = `<div class="st${cls}" data-k="s${j}">${rows}</div>`;
+ items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
+ return html;
+ });
+ const css = `
+ #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ /* The card is as tall as what it says, hung from its anchor's edge. */
+ .st { position: absolute; left: 0; right: 0; ${bottom ? "bottom: 0;" : "top: 0;"} visibility: hidden; opacity: 0; border-radius: ${px(10)}px;
+ background: ${rgba(pal.bg, 0.95)}; border-left: ${px(6)}px solid ${red};
+ box-shadow: 0 ${px(8)}px ${px(26)}px rgba(0, 0, 0, 0.45); padding: ${px(14)}px ${px(22)}px ${px(12)}px ${px(22)}px; }
+ .st.kept { border-left-color: ${green}; }
+ .row { display: flex; flex-direction: column; gap: ${px(4)}px; }
+ .hd { font-family: 'DeckSansBold', sans-serif; font-size: ${px(21)}px; line-height: ${px(26)}px; letter-spacing: 0.12em;
+ text-transform: uppercase; color: ${pal.muted}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+ .cl { display: flex; align-items: center; gap: ${px(10)}px; font-family: 'DeckSansBold', sans-serif; font-size: ${px(19)}px;
+ line-height: ${px(30)}px; letter-spacing: 0.1em; text-transform: uppercase; color: ${pal.fg}; white-space: nowrap; }
+ .cl b { letter-spacing: 0.02em; text-transform: none; font-size: ${px(21)}px; }
+ .av { flex: none; width: ${px(30)}px; height: ${px(30)}px; border-radius: 50%; object-fit: cover; }
+ .av.mono { display: inline-block; text-align: center; color: #fff; font-family: ${DISPLAY}; font-size: ${px(20)}px; line-height: ${px(30)}px; letter-spacing: 0; }
+ .mid { display: flex; align-items: center; justify-content: space-between; gap: ${px(16)}px; height: ${px(78)}px; }
+ .dy { font-family: ${DISPLAY}; font-size: ${px(74)}px; line-height: ${px(78)}px; color: ${pal.fg}; text-transform: uppercase;
+ white-space: nowrap; font-variant-numeric: tabular-nums; }
+ .to { flex: 1 1 auto; align-self: flex-end; padding-bottom: ${px(14)}px; font-family: 'DeckSansBold', sans-serif; font-size: ${px(16)}px;
+ line-height: ${px(19)}px; letter-spacing: 0.1em; text-transform: uppercase; color: ${pal.muted}; white-space: nowrap; }
+ .pill { flex: none; padding: 0 ${px(16)}px; height: ${px(42)}px; border-radius: ${px(6)}px; background: ${red}; color: #fff;
+ font-family: 'DeckSansBold', sans-serif; font-size: ${px(23)}px; line-height: ${px(42)}px; letter-spacing: 0.1em;
+ text-transform: uppercase; white-space: nowrap; }
+ .kept .pill { background: ${green}; }
+ .stamp { flex: none; padding: ${px(2)}px ${px(14)}px ${px(4)}px; border: ${px(4)}px solid ${red}; border-radius: ${px(6)}px; color: ${red};
+ text-align: center; transform: rotate(-4deg); }
+ .stamp.withdrawn { border-color: ${pal.muted}; color: ${pal.muted}; }
+ .sw { font-family: ${DISPLAY}; font-size: ${px(34)}px; line-height: ${px(36)}px; text-transform: uppercase; letter-spacing: 0.04em; }
+ .ss { font-family: 'DeckSansBold', sans-serif; font-size: ${px(15)}px; line-height: ${px(18)}px; text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }
+ .ck { position: relative; font-size: ${px(20)}px; line-height: ${px(25)}px; color: ${pal.fg}; padding: ${px(2)}px ${px(6)}px;
+ margin-left: ${px(-6)}px; border-radius: ${px(4)}px;
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+ .ck.none { color: ${pal.muted}; }
+ .cf { position: absolute; inset: 0; opacity: 0; border-radius: ${px(4)}px; z-index: -1; }
+ .ck { isolation: isolate; }
+ .who { font-family: 'DeckSansBold', sans-serif; }
+ .qm { font-family: 'DeckSansBold', sans-serif; }
+ .cd { color: ${pal.muted}; white-space: nowrap; }`;
+ const body = `<div id="pn" data-k="pn">
+ ${blocks.join("\n ")}
+ </div>`;
+ return { html: page("promise", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`)), items };
+}
+
+// ---------------------------------------------------------------------------
+// DIET: the stamp.
+// ---------------------------------------------------------------------------
+
+/** The stamp's words a size that fits its box: the condensed face at ~0.5 em a letter. */
+export function stampSize(label, room) {
+ const n = Math.max(1, [...String(label)].length);
+ return Math.max(30, Math.min(76, Math.floor(room / (0.52 * n))));
+}
+
+// An ink texture: fractal noise as the stamp's alpha, so it reads pressed, not printed.
+const INK = "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.6 1.75'/></filter><rect width='240' height='120' filter='url(%23n)'/></svg>\")";
+
+/** The diet badge's page: `{ html, items }`. */
+export function dietHtml(schedule, render, opts = {}) {
+ const cfg = resolveMeasureExtra("diet", render);
+ const states = dietStates(schedule, render);
+ if (!cfg || !states.length) throw new Error("diet: the schedule's measure slice has no diet on camera");
+ const F = frameOf("diet", schedule, render);
+ const { geo, px } = F;
+ const pal = render.palette;
+ const SLAM = 0.16;
+ const spans = upSpans(states.map((s) => s.at), cfg, schedule);
+ const items = [];
+ const { init, cues } = stateCues(states, spans, {
+ overlap: SLAM,
+ own: (st, j, init) => {
+ const k = `s${j}.s`;
+ const ev = [];
+ if (!st.diet) {
+ init[k] = { opacity: 0 };
+ ev.push({ k, at: st.at, dur: 0.5, to: { opacity: 0.6 }, ease: "power1.out" });
+ } else if (st.slam) {
+ // The slam: in from big and turned, hard onto the page, then a shake.
+ init[k] = { scale: 2.3, rotation: -15, opacity: 0 };
+ ev.push({ k, at: st.at, dur: SLAM, to: { scale: 1, rotation: -5, opacity: 1 }, ease: "power4.in" });
+ init[`s${j}.w`] = { x: 0 };
+ const shake = [8, -6, 4, -2, 0].map((v) => Math.round(v * F.k));
+ shake.forEach((x, n) => ev.push({ k: `s${j}.w`, at: st.at + SLAM + n * 0.045, dur: 0.045, to: { x }, ease: "sine.inOut" }));
+ } else {
+ init[k] = { opacity: 0 };
+ ev.push({ k, at: st.at, dur: 0.3, to: { opacity: 1 }, ease: "power1.out" });
+ }
+ return ev;
+ },
+ });
+ // The words' room in design pixels (the box less the stamp's border and padding).
+ const room = MEASURE_BOXES.diet.width - 110;
+ const blocks = states.map((st, j) => {
+ const d = st.diet;
+ const label = d ? d.label : cfg.labels.off ?? "No diet";
+ const ink = d ? d.color : pal.muted;
+ const size = stampSize(label, room);
+ const sub = d
+ ? `<div class="sb"><span class="dn">Diet${d.n !== null ? ` #${d.n}` : ""}</span>${d.detail ? `<span class="dd">${esc(d.detail)}</span>` : ""}</div>`
+ : `<div class="sb"><span class="dd">he says he is on none</span></div>`;
+ const html = `<div class="st" data-k="s${j}"><div class="wr" data-k="s${j}.w"><div class="sp${d ? "" : " off"}" data-k="s${j}.s"><div class="ink" style="color:${ink};border-color:${ink}"><div class="lb" style="font-size:${px(size)}px;line-height:${px(Math.round(size * 1.02))}px">${esc(label)}</div>${sub}</div></div></div></div>`;
+ items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
+ return html;
+ });
+ const css = `
+ #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ .st { position: absolute; inset: 0; visibility: hidden; opacity: 0; display: flex; align-items: center; justify-content: center; }
+ .wr { display: flex; align-items: center; justify-content: center; }
+ /* The plate is solid (it has to read over any footage); only the ink is pressed. */
+ .sp { max-width: ${geo.width - px(40)}px; border-radius: ${px(10)}px; background: ${rgba(pal.bg, 0.93)}; padding: ${px(6)}px;
+ box-shadow: 0 ${px(8)}px ${px(22)}px rgba(0, 0, 0, 0.5); transform: rotate(-5deg); }
+ .ink { padding: ${px(6)}px ${px(22)}px ${px(10)}px ${px(22)}px; border: ${px(6)}px solid; border-radius: ${px(7)}px;
+ box-shadow: inset 0 0 0 ${px(3)}px ${rgba(pal.bg, 0.9)}, inset 0 0 0 ${px(5)}px currentColor;
+ display: flex; flex-direction: column; align-items: center;
+ -webkit-mask-image: ${INK}; mask-image: ${INK}; -webkit-mask-size: ${px(240)}px ${px(120)}px; mask-size: ${px(240)}px ${px(120)}px; }
+ .lb { font-family: ${DISPLAY}; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
+ .sb { display: flex; align-items: baseline; gap: ${px(12)}px; margin-top: ${px(2)}px; white-space: nowrap; max-width: 100%; }
+ .dn { font-family: 'DeckSansBold', sans-serif; font-size: ${px(22)}px; letter-spacing: 0.16em; text-transform: uppercase; }
+ .dd { font-family: 'DeckSansBold', sans-serif; font-size: ${px(20)}px; color: ${pal.fg}; overflow: hidden; text-overflow: ellipsis; }
+ .off .dd { color: ${pal.muted}; }`;
+ const body = `<div id="pn" data-k="pn">
+ ${blocks.join("\n ")}
+ </div>`;
+ return { html: page("diet", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`)), items };
+}
+
+// ---------------------------------------------------------------------------
+// STREAK: the chains.
+// ---------------------------------------------------------------------------
+
+/** Each source's own word over the readout when `title` is not set. */
+const STREAK_TITLES = Object.freeze({ diet: "Diet runs", lostRuns: "Weight-loss runs", pledges: "Dry streaks" });
+
+/**
+ * The streak chain's page: `{ html, items }`. Past chains are items of their
+ * own (each up from its crack on, dimmed); the live chain and the readout are
+ * a block per state.
+ */
+export function streakHtml(schedule, render, opts = {}) {
+ const cfg = resolveMeasureExtra("streak", render);
+ const { runs, states, span } = streakStates(schedule, render);
+ if (!cfg || !states.length) throw new Error("streak: the schedule's measure slice has no run on camera");
+ const F = frameOf("streak", schedule, render);
+ const { px } = F;
+ const pal = render.palette;
+ const red = MEASURE_RED;
+ const X0 = px(196);
+ const X1 = F.geo.width - px(18);
+ const barY = px(66);
+ const barH = px(16);
+ // Where a run's chain stands: to scale on the dates, or each in its own slot (√ of its length).
+ const total = Math.max(1, daysBetween(span[0], span[1]) ?? 1);
+ const xOfDate = (d) => r4(X0 + ((daysBetween(span[0], d) ?? 0) / total) * (X1 - X0));
+ let slots = null;
+ if (cfg.axis === "runs") {
+ const gap = px(3);
+ const ws = runs.map((r) => Math.sqrt(r.days + 1));
+ const k = (X1 - X0 - gap * (runs.length - 1)) / ws.reduce((a, b) => a + b, 0);
+ let x = X0;
+ slots = ws.map((w) => { const s = { x: r4(x), w: r4(Math.max(px(2), w * k)) }; x += w * k + gap; return s; });
+ }
+ const left = (i) => (slots ? slots[i].x : xOfDate(runs[i].start));
+ const widthAt = (i, days) => {
+ if (slots) return r4(Math.max(px(3), slots[i].w * Math.sqrt(days + 1) / Math.sqrt(runs[i].days + 1)));
+ return r4(Math.max(px(3), (days / total) * (X1 - X0)));
+ };
+ const spans = upSpans(states.map((s) => s.at), cfg, schedule);
+ const items = [];
+ const init = {};
+ const extra = [];
+ // The past chains: each up from its crack, the tip snapping off, its length
+ // tagged until the next crack, then dimmed into the row.
+ const cracks = runs.map((r, i) => ({ i, t: r.endT })).filter((c) => c.t !== null).sort((a, b) => a.t - b.t);
+ const chains = runs.map((r, i) => {
+ if (r.endT === null) return "";
+ const k = `c${i}`;
+ const w = widthAt(i, r.days);
+ const next = cracks.find((c) => c.t > r.endT + 1e-6);
+ init[k] = { autoAlpha: 0 };
+ init[`${k}.b`] = { opacity: 1 };
+ init[`${k}.tip`] = { x: 0, y: 0, rotation: 0, opacity: 1 };
+ init[`${k}.l`] = { opacity: 0, scale: 1.5 };
+ init[`${k}.z`] = { opacity: 0 };
+ init[`${k}.lf`] = { opacity: 0.95 };
+ extra.push({ k, at: r.endT, dur: INSTANT, to: { autoAlpha: 1 }, ease: "none" });
+ extra.push({ k: `${k}.tip`, at: r.endT, dur: 0.5, to: { x: px(16), y: px(14), rotation: 38, opacity: 0 }, ease: "power2.in" });
+ extra.push({ k: `${k}.l`, at: r.endT, dur: 0.3, to: { opacity: 1, scale: 1 }, ease: "back.out(2)" });
+ extra.push({ k: `${k}.z`, at: r.endT, dur: 0.12, to: { opacity: 1 }, ease: "power1.out" });
+ extra.push({ k: `${k}.lf`, at: r.endT + 0.2, dur: 1, to: { opacity: 0 }, ease: "power1.in" });
+ extra.push({ k: `${k}.b`, at: r.endT + 0.6, dur: 0.8, to: { opacity: 0.36 }, ease: "power1.out" });
+ // The break and the tag stay until the next crack takes over.
+ if (next) {
+ extra.push({ k: `${k}.l`, at: Math.max(r.endT + 0.35, next.t), dur: INSTANT, to: { opacity: 0 }, ease: "none" });
+ extra.push({ k: `${k}.z`, at: Math.max(r.endT + 0.15, next.t), dur: INSTANT, to: { opacity: 0 }, ease: "none" });
+ }
+ const word = r.days === 0 && r.zeroWord ? r.zeroWord : r.ended === "lapse" ? `after ${daysText(r.days)}` : daysText(r.days);
+ const lx = Math.max(X0, Math.min(X1 - px(240), left(i) + w - px(120)));
+ const html = `<div class="ch" data-k="${k}"><div class="bar" data-k="${k}.b" style="left:${left(i)}px;width:${w}px;--c:${esc(r.color)}"></div><div class="tip" data-k="${k}.tip" style="left:${r4(left(i) + w - px(6))}px;--c:${esc(r.color)}"></div><div class="zz" data-k="${k}.z" style="left:${r4(left(i) + w - px(3))}px"></div><div class="tag" data-k="${k}.l" style="left:${r4(lx)}px"><span class="tf" data-k="${k}.lf"></span><b style="color:${esc(r.color)}">${esc(r.name)}</b> · ${esc(word)}</div></div>`;
+ items.push({ key: k, gate: [k, "autoAlpha"], html });
+ return html;
+ }).join("");
+ const compiled = stateCues(states, spans, {
+ own: (st, j, init2) => {
+ const ev = [];
+ if (!st.live) return ev;
+ const prev = states[j - 1];
+ const k = `s${j}.lv`;
+ const w = widthAt(st.live.i, st.live.days);
+ const from = prev?.live?.i === st.live.i ? widthAt(st.live.i, prev.live.days) : px(3);
+ if (from !== w) {
+ init2[k] = { width: from };
+ ev.push({ k, at: st.at, dur: 0.4, to: { width: w }, ease: "power2.out" });
+ }
+ return ev;
+ },
+ }, init);
+ const allCues = compileCues(compiled.init, [...compiled.cues.map(({ from: _f, ...c }) => c), ...extra]);
+ const blocks = states.map((st, j) => {
+ let readout;
+ let live = "";
+ if (st.live) {
+ const r = runs[st.live.i];
+ live = `<div class="bar live" data-k="s${j}.lv" style="left:${left(st.live.i)}px;width:${widthAt(st.live.i, st.live.days)}px;--c:${esc(r.color)}"></div>`;
+ // A long name ("Counting calories") a size down to fit the readout's width.
+ const ns = Math.max(18, Math.min(32, Math.floor(166 / (0.5 * Math.max(1, [...r.name].length)))));
+ readout = `<div class="nm" style="color:${esc(r.color)};font-size:${px(ns)}px">${esc(r.name)}</div><div class="dy">Day ${st.live.days}</div>${r.detail ? `<div class="dt">${esc(r.detail)}</div>` : ""}`;
+ } else {
+ const last = [...runs.keys()].filter((i) => runs[i].endT !== null && runs[i].endT <= st.at + 1e-6).pop();
+ const r = last !== undefined ? runs[last] : null;
+ readout = r
+ ? `<div class="nm sn">Snapped</div><div class="dy sm">${esc(r.name)}</div><div class="dt">after ${esc(daysText(r.days))}</div>`
+ : `<div class="nm sn">—</div>`;
+ }
+ const html = `<div class="st" data-k="s${j}"><div class="ro">${readout}</div>${live}</div>`;
+ items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
+ return html;
+ });
+ // The axis: the years, when the chains stand on the dates.
+ const years = [];
+ if (!slots) {
+ const y0 = Number(span[0].slice(0, 4));
+ const y1 = Number(span[1].slice(0, 4));
+ const every = y1 - y0 > 8 ? 2 : 1;
+ for (let y = y0 + 1; y <= y1; y += 1) {
+ const x = xOfDate(`${y}-01-01`);
+ years.push(`<div class="yt" style="left:${x}px"></div>${(y - y0) % every === 0 ? `<div class="yl" style="left:${r4(x - px(20))}px">${y}</div>` : ""}`);
+ }
+ }
+ const title = cfg.title ?? STREAK_TITLES[cfg.source];
+ const css = `
+ #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; border-radius: ${px(10)}px;
+ background: ${rgba(pal.bg, 0.9)}; box-shadow: 0 ${px(8)}px ${px(26)}px rgba(0, 0, 0, 0.45); }
+ .ti { position: absolute; left: ${px(18)}px; top: ${px(12)}px; font-family: 'DeckSansBold', sans-serif; font-size: ${px(15)}px;
+ letter-spacing: 0.14em; text-transform: uppercase; color: ${pal.muted}; white-space: nowrap; }
+ .ax { position: absolute; left: ${X0}px; width: ${r4(X1 - X0)}px; top: ${barY + barH + px(10)}px; height: ${px(2)}px; background: ${rgba(pal.muted, 0.45)}; }
+ .yt { position: absolute; top: ${barY + barH + px(6)}px; width: ${px(1)}px; height: ${px(10)}px; background: ${rgba(pal.muted, 0.6)}; }
+ .yl { position: absolute; top: ${barY + barH + px(18)}px; width: ${px(40)}px; text-align: center; font-size: ${px(14)}px; color: ${pal.muted};
+ font-variant-numeric: tabular-nums; }
+ .ch, .st { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ /* A chain: links of the run's colour, a gap every few pixels. */
+ .bar { position: absolute; top: ${barY}px; height: ${barH}px; border-radius: ${px(4)}px;
+ background: repeating-linear-gradient(90deg, var(--c) 0 ${px(6)}px, transparent ${px(6)}px ${px(8)}px); }
+ .bar.live { box-shadow: 0 0 ${px(10)}px var(--c); }
+ .tip { position: absolute; top: ${barY}px; width: ${px(6)}px; height: ${barH}px; border-radius: ${px(2)}px; background: var(--c); }
+ .zz { position: absolute; top: ${barY - px(4)}px; width: ${px(6)}px; height: ${barH + px(8)}px;
+ background: linear-gradient(115deg, transparent 40%, ${red} 40% 60%, transparent 60%); }
+ .tf { position: absolute; inset: 0; border-radius: ${px(4)}px; background: ${rgba(red, 0.75)}; z-index: -1; }
+ .tag { position: absolute; top: ${px(36)}px; width: ${px(240)}px; isolation: isolate; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
+ font-size: ${px(16)}px; line-height: ${px(22)}px; color: ${pal.fg}; transform-origin: 50% 100%; }
+ .tag b { font-family: 'DeckSansBold', sans-serif; text-transform: uppercase; letter-spacing: 0.06em; }
+ .ro { position: absolute; left: ${px(18)}px; top: ${px(34)}px; width: ${px(166)}px; }
+ .nm { font-family: ${DISPLAY}; font-size: ${px(32)}px; line-height: ${px(36)}px; text-transform: uppercase; white-space: nowrap;
+ overflow: hidden; text-overflow: ellipsis; }
+ .nm.sn { color: ${red}; }
+ .dy { font-family: ${DISPLAY}; font-size: ${px(30)}px; line-height: ${px(34)}px; color: ${pal.fg}; text-transform: uppercase;
+ white-space: nowrap; font-variant-numeric: tabular-nums; }
+ .dy.sm { font-size: ${px(22)}px; line-height: ${px(28)}px; overflow: hidden; text-overflow: ellipsis; }
+ .dt { font-size: ${px(15)}px; line-height: ${px(19)}px; color: ${pal.muted}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }`;
+ const body = `<div id="pn" data-k="pn">
+ <div class="ti">${esc(title)}</div>
+ ${slots ? "" : `<div class="ax"></div>${years.join("")}`}
+ ${chains}
+ ${blocks.join("\n ")}
+ </div>`;
+ return { html: page("streak", schedule, opts, F, css, body, allCues.init, allCues.cues, states.map((_, j) => `s${j}`)), items };
+}
diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs
@@ -176,9 +176,12 @@ export function validateChrome(chrome, render = {}) {
// (counter.mjs: the tally's named series).
// `rail` (rail.mjs: `{labels}`) likewise has no default to fill, nor
// `sectionTitle` (section-title.mjs: the current section's name).
- // `measure` (measure-slice.mjs: the measure ledger's slice for the
- // instruments) likewise.
- unknownKeys(d, [...Object.keys(DECK_DEFAULTS), "finale", "claims", "counter", "rail", "sectionTitle", "measure"], w, errors);
+ // So are `measure` (measure-slice.mjs: the measure ledger's slice for the
+ // instruments) and the measure extras' (`goals`, `peak`, `promise`,
+ // `diet`, `streak`: measure-extras-settings.mjs) -- every deck key a
+ // SETTINGS entry owns.
+ const owned = SETTINGS.filter((s) => s.deck && !s.whole).map((s) => s.key.slice("deck.".length));
+ unknownKeys(d, [...new Set([...Object.keys(DECK_DEFAULTS), "finale", "claims", "counter", "rail", "sectionTitle", "measure", ...owned])], w, errors);
deckChecked = true;
}
errors.push(...entry.validate(settingValue(chrome, entry), { render, chrome, deck: d, where: w }));
diff --git a/umtool/report-to-video/fixtures/measure-extras/make-fixture.mjs b/umtool/report-to-video/fixtures/measure-extras/make-fixture.mjs
@@ -0,0 +1,82 @@
+// The measure extras' test fixture (measure-extras.test.mjs), made from the
+// synthetic measure slice the weight-video lanes shared (real quartering-diet
+// ledger rows, fake cut times; 438 KB): only what the goal stack, the moving
+// start, the promise clock and the diet badge read -- every goal, remembered
+// weight, promise and check, the diet events that change the state's diet --
+// and of each state only the fields they read.
+//
+// node umtool/report-to-video/fixtures/measure-extras/make-fixture.mjs <measure-slice.fixture.json>
+//
+// writes measure.json beside this file. Synthetic times, like every fixture.
+import { readFileSync, writeFileSync } from "node:fs";
+import { fileURLToPath } from "node:url";
+
+// SYNTHETIC (CONTRACT addenda, 6 Nov): a second speaker's claim on the scale-video
+// promise and its outcome, so the promise clock's counterparty and refunded
+// stamp have something to draw. NOT ledger rows -- the measure-ledger lane
+// writes the real ones (her X post, her video). Each is marked `synthetic`.
+export function addSyntheticPromiseRows(slice) {
+ const claim = {
+ t: 716, row: "SYNTH-c01", segment: "s179", date: "2026-10-24", asOf: null, kind: "promiseClaim", value: null, qualifier: null,
+ display: "paid for it", label: "I bought the 5 bags — where's the scale video?", deadline: null, regime: null, event: null,
+ promise: "p01", speaker: "madamsavvy", source: "post", synthetic: true,
+ };
+ const outcome = {
+ t: 722, row: "SYNTH-o01", segment: "s180", date: "2026-10-31", asOf: null, kind: "promiseOutcome", value: null, qualifier: null,
+ display: "refunded", label: "Your refund has been processed… best of luck on your weight loss journey", deadline: null, regime: null,
+ event: null, promise: "p01", speaker: "madamsavvy", outcome: "refunded", source: "clip", synthetic: true,
+ };
+ for (const e of [claim, outcome]) {
+ const i = slice.events.findIndex((x) => x.t > e.t);
+ const at = i < 0 ? slice.events.length : i;
+ const before = slice.state[at];
+ slice.events.splice(at, 0, e);
+ slice.state.splice(at + 1, 0, { ...structuredClone(before), t: e.t });
+ }
+ slice.state = slice.state.map((s) => ({
+ ...s,
+ promises: (s.promises ?? []).map((p) => (p.row !== "p01" ? p : {
+ ...p,
+ claims: s.t >= claim.t ? [{ row: claim.row, speaker: "madamsavvy", date: claim.date, label: claim.label, synthetic: true }] : [],
+ outcome: s.t >= outcome.t ? { kind: "refunded", date: outcome.date, row: outcome.row, synthetic: true } : null,
+ })),
+ }));
+ return slice;
+}
+
+if (import.meta.url === `file://${process.argv[1]}`) {
+ const src = process.argv[2];
+ if (!src) {
+ console.error("usage: make-fixture.mjs <measure-slice.fixture.json>");
+ process.exit(2);
+ }
+ const m = JSON.parse(readFileSync(src, "utf8"));
+ const KINDS = new Set(["goal", "goalLoss", "remembered", "promise", "promiseCheck"]);
+ const EVENT_KEYS = ["t", "row", "segment", "date", "asOf", "kind", "value", "qualifier", "display", "label", "deadline", "regime", "event", "promise", "source"];
+ const STATE_KEYS = ["t", "goal", "goals", "diet", "promises"];
+ const pick = (o, keys) => Object.fromEntries(keys.filter((k) => o[k] !== undefined).map((k) => [k, o[k]]));
+
+ const events = [];
+ const state = [pick(m.state[0], STATE_KEYS)];
+ let dietKey = null;
+ m.events.forEach((e, i) => {
+ const s = m.state[i + 1];
+ const d = s?.diet ? `${s.diet.regime}|${s.diet.n}|${s.diet.display}` : "none";
+ const keep = KINDS.has(e.kind) || (e.kind === "diet" && d !== dietKey);
+ dietKey = d;
+ if (!keep) return;
+ events.push({ ...pick(e, EVENT_KEYS), ...(e.kind === "promise" || e.kind === "promiseCheck" ? { quote: e.quote } : {}) });
+ state.push(pick(s, STATE_KEYS));
+ });
+ const out = {
+ version: m.version, unit: m.unit, scale: m.scale, asOfRender: m.asOfRender, scopes: m.scopes,
+ events, hidden: [], state,
+ totals: pick(m.totals, ["goals", "goalRepeats", "diets", "peakDrift"]),
+ _fixture: "measure-extras test fixture: made by make-fixture.mjs from the lanes' synthetic measure slice (real ledger rows, fake cut times)",
+ };
+ addSyntheticPromiseRows(out);
+ out._fixture += "; SYNTHETIC rows SYNTH-c01 (a promiseClaim by madamsavvy) and SYNTH-o01 (a refunded promiseOutcome) added by addSyntheticPromiseRows";
+ const file = fileURLToPath(new URL("./measure.json", import.meta.url));
+ writeFileSync(file, JSON.stringify(out) + "\n");
+ console.log(`${file}: ${events.length} events, ${(JSON.stringify(out).length / 1024).toFixed(1)} KB`);
+}
diff --git a/umtool/report-to-video/fixtures/measure-extras/measure.json b/umtool/report-to-video/fixtures/measure-extras/measure.json
@@ -0,0 +1 @@
+{"version":1,"unit":"lb","scale":{"min":220,"max":400},"asOfRender":"2026-11-05","scopes":["weight","regime"],"events":[{"t":8,"row":"r01","segment":"s000","date":"2018-02-06","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"says he is on a diet he does not name","deadline":null,"regime":"other","event":"on","source":"clip"},{"t":11.96,"row":"r02","segment":"s001","date":"2018-02-20","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"says he is on a diet he does not name","deadline":null,"regime":"other","event":"on","source":"clip"},{"t":27.78,"row":"w02","segment":"s005","date":"2021-01-06","asOf":null,"kind":"goalLoss","value":-40,"qualifier":null,"display":"lose 40","label":"the 2021 new-year goal","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":31.74,"row":"r05","segment":"s006","date":"2021-04-02","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"says he is on a diet he does not name","deadline":null,"regime":"other","event":"on","source":"clip"},{"t":39.65,"row":"r07","segment":"s008","date":"2021-09-14","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"starts keto","deadline":null,"regime":"keto","event":"start","source":"clip"},{"t":43.6,"row":"w06","segment":"s009","date":"2021-09-14","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"needs to lose 100, at the first keto start","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":47.56,"row":"r09","segment":"s010","date":"2021-09-18","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":55.47,"row":"r10","segment":"s012","date":"2022-07-27","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":63.38,"row":"w08","segment":"s014","date":"2022-07-27","asOf":null,"kind":"goalLoss","value":-30,"qualifier":null,"display":"lose 30","label":"the five-month goal","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":67.34,"row":"r14","segment":"s015","date":"2022-12-30","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":71.3,"row":"w09","segment":"s016","date":"2022-12-30","asOf":null,"kind":"goalLoss","value":-50,"qualifier":null,"display":"lose 50","label":"the 2023 new-year goal","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":75.25,"row":"w11","segment":"s017","date":"2023-01-13","asOf":null,"kind":"goalLoss","value":-50,"qualifier":null,"display":"lose 50","label":"fifty by summer","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":79.21,"row":"r15","segment":"s018","date":"2023-02-09","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":83.16,"row":"r17","segment":"s019","date":"2023-03-01","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":87.12,"row":"r18","segment":"s020","date":"2023-03-01","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Calories","label":"starts counting calories","deadline":null,"regime":"calories","event":"start","source":"clip"},{"t":95.03,"row":"w13","segment":"s022","date":"2023-03-02","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"'at least 100' at his then-fattest","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":102.95,"row":"r20","segment":"s024","date":"2023-05-04","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"says he is on a diet he does not name","deadline":null,"regime":"other","event":"on","source":"clip"},{"t":110.86,"row":"w16","segment":"s026","date":"2023-06-07","asOf":null,"kind":"goalLoss","value":-75,"qualifier":null,"display":"lose 75","label":"seventy-five to go","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":118.77,"row":"r23","segment":"s028","date":"2023-07-20","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Calories","label":"starts counting calories","deadline":null,"regime":"calories","event":"start","source":"clip"},{"t":126.68,"row":"w19","segment":"s030","date":"2023-07-26","asOf":null,"kind":"goalLoss","value":-75,"qualifier":null,"display":"lose 75","label":"seventy-five, then fifty, in one breath","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":134.59,"row":"r25","segment":"s032","date":"2023-08-21","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":138.55,"row":"w21","segment":"s033","date":"2023-09-29","asOf":"2023-07-01","kind":"remembered","value":390,"qualifier":"≈","display":"390 lb","label":"the scale that ruined a vacation","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":142.51,"row":"w22","segment":"s034","date":"2023-10-12","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"what he told his doctor","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":146.46,"row":"r29","segment":"s035","date":"2023-12-14","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":150.42,"row":"r31","segment":"s036","date":"2024-01-02","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":154.37,"row":"r32","segment":"s037","date":"2024-01-09","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":158.33,"row":"r33","segment":"s038","date":"2024-01-12","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":166.24,"row":"w26","segment":"s040","date":"2024-01-12","asOf":"2023-12-31","kind":"remembered","value":365.7,"qualifier":null,"display":"365.7 lb","label":"365.7 - the most precise number he ever gives","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":170.2,"row":"w27","segment":"s041","date":"2024-01-12","asOf":null,"kind":"goal","value":250,"qualifier":"≈","display":"250","label":"'I look good at like 250'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":174.15,"row":"r34","segment":"s042","date":"2024-01-26","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":182.07,"row":"w29","segment":"s044","date":"2024-01-26","asOf":null,"kind":"goalLoss","value":-50,"qualifier":null,"display":"lose 50","label":"the end of the 2024 goal ladder","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":189.98,"row":"w31","segment":"s046","date":"2024-01-30","asOf":"2023-12-31","kind":"remembered","value":365.7,"qualifier":null,"display":"365.7 lb","label":"365.7, restated","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":193.93,"row":"w32","segment":"s047","date":"2024-01-30","asOf":null,"kind":"goal","value":230,"qualifier":null,"display":"220-240","label":"'when I'm at like 220 to 240, I'm good'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":201.85,"row":"r35","segment":"s049","date":"2024-02-13","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":205.8,"row":"r36","segment":"s050","date":"2024-02-28","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":209.76,"row":"r37","segment":"s051","date":"2024-04-02","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":213.71,"row":"r38","segment":"s052","date":"2024-04-09","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":217.67,"row":"r39","segment":"s053","date":"2024-04-18","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":225.58,"row":"w35","segment":"s055","date":"2024-04-25","asOf":"2008-06-30","kind":"remembered","value":368,"qualifier":null,"display":"368 lb","label":"368 at his wedding","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":229.54,"row":"r41","segment":"s056","date":"2024-05-07","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":237.45,"row":"r42","segment":"s058","date":"2024-05-14","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":245.36,"row":"r43","segment":"s060","date":"2024-07-09","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":249.32,"row":"r44","segment":"s061","date":"2024-07-30","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":257.23,"row":"r46","segment":"s063","date":"2024-07-31","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Calories","label":"starts counting calories","deadline":null,"regime":"calories","event":"start","source":"clip"},{"t":261.19,"row":"r47","segment":"s064","date":"2024-08-22","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":265.14,"row":"r48","segment":"s065","date":"2024-09-03","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":269.1,"row":"r49","segment":"s066","date":"2024-10-03","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":273.05,"row":"r50","segment":"s067","date":"2024-10-16","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":277.01,"row":"w40","segment":"s068","date":"2024-11-04","asOf":null,"kind":"goalLoss","value":-70,"qualifier":null,"display":"lose 70","label":"seventy to go, post-election","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":280.97,"row":"r51","segment":"s069","date":"2024-11-05","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"starts keto","deadline":null,"regime":"keto","event":"start","source":"clip"},{"t":288.88,"row":"w41","segment":"s071","date":"2024-11-05","asOf":null,"kind":"goalLoss","value":-30,"qualifier":null,"display":"lose 30","label":"thirty by Christmas","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":292.84,"row":"r52","segment":"s072","date":"2024-11-07","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":296.79,"row":"r53","segment":"s073","date":"2024-11-11","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"starts carnivore","deadline":null,"regime":"carnivore","event":"start","source":"clip"},{"t":304.7,"row":"r54","segment":"s075","date":"2024-11-26","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":308.66,"row":"r55","segment":"s076","date":"2024-12-03","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":312.62,"row":"w44","segment":"s077","date":"2024-12-24","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"the round hundred again","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":316.57,"row":"r56","segment":"s078","date":"2025-01-02","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"starts carnivore","deadline":null,"regime":"carnivore","event":"start","source":"clip"},{"t":324.48,"row":"r59","segment":"s080","date":"2025-03-11","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":328.44,"row":"r60","segment":"s081","date":"2025-03-20","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":336.35,"row":"r61","segment":"s083","date":"2025-03-27","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"starts carnivore","deadline":null,"regime":"carnivore","event":"start","source":"clip"},{"t":340.31,"row":"r62","segment":"s084","date":"2025-04-08","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":344.26,"row":"w46","segment":"s085","date":"2025-04-08","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"a promise with a one-year clock","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":356.13,"row":"w50","segment":"s088","date":"2025-05-02","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"a hundred by Christmas","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":360.09,"row":"w51","segment":"s089","date":"2025-05-02","asOf":"2025-02-01","kind":"remembered","value":370,"qualifier":null,"display":"370 lb","label":"370 at the start of the 2025 run","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":364.04,"row":"r63","segment":"s090","date":"2025-05-06","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":368,"row":"r64","segment":"s091","date":"2025-05-28","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":371.96,"row":"r65","segment":"s092","date":"2025-06-06","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":379.87,"row":"r66","segment":"s094","date":"2025-06-25","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":383.82,"row":"r67","segment":"s095","date":"2025-07-15","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":387.78,"row":"w55","segment":"s096","date":"2025-07-15","asOf":"2024-07-01","kind":"remembered","value":390,"qualifier":"≈","display":"390 lb","label":"390, 'last year'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":391.74,"row":"w56","segment":"s097","date":"2025-07-15","asOf":"2024-05-09","kind":"remembered","value":335,"qualifier":null,"display":"330-340 lb","label":"the crash diet floor","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":395.69,"row":"w57","segment":"s098","date":"2025-07-15","asOf":null,"kind":"goal","value":265,"qualifier":null,"display":"260-270","label":"'I'll look thin'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":399.65,"row":"r68","segment":"s099","date":"2025-07-15","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"GLP-1","label":"says he is on the shot","deadline":null,"regime":"glp1","event":"on","source":"clip"},{"t":403.6,"row":"r70","segment":"s100","date":"2025-07-29","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":407.56,"row":"r71","segment":"s101","date":"2025-08-15","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":415.47,"row":"w60","segment":"s103","date":"2025-08-15","asOf":"2025-04-15","kind":"remembered","value":387,"qualifier":null,"display":"387 lb","label":"387, four months earlier","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":419.43,"row":"w61","segment":"s104","date":"2025-08-15","asOf":"2026-04-01","kind":"goal","value":275,"qualifier":null,"display":"275","label":"275 by his birthday","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":435.25,"row":"r74","segment":"s108","date":"2025-10-03","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":439.21,"row":"r75","segment":"s109","date":"2025-10-03","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"says he is on carnivore","deadline":null,"regime":"carnivore","event":"on","source":"clip"},{"t":447.12,"row":"r76","segment":"s111","date":"2025-10-07","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Some diet","label":"starts a diet he does not name","deadline":null,"regime":"other","event":"start","source":"clip"},{"t":451.08,"row":"r77","segment":"s112","date":"2025-10-08","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"cutting carbs","label":"says he is on counting calories","deadline":null,"regime":"calories","event":"on","source":"clip"},{"t":458.99,"row":"w68","segment":"s114","date":"2025-10-08","asOf":null,"kind":"goalLoss","value":-100,"qualifier":null,"display":"lose 100","label":"still a hundred to go","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":462.95,"row":"w69","segment":"s115","date":"2025-10-09","asOf":null,"kind":"goalLoss","value":-150,"qualifier":null,"display":"lose 150","label":"'like 150'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":478.77,"row":"w72","segment":"s119","date":"2025-12-09","asOf":null,"kind":"goalLoss","value":-20,"qualifier":null,"display":"lose 20","label":"twenty a year","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":486.68,"row":"w73","segment":"s121","date":"2026-01-09","asOf":"2025-02-01","kind":"remembered","value":385,"qualifier":null,"display":"380-390 lb","label":"the Hawaii peak","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":494.59,"row":"r82","segment":"s123","date":"2026-01-16","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"says he is on intermittent fasting","deadline":null,"regime":"fasting","event":"on","source":"clip"},{"t":506.46,"row":"w77","segment":"s126","date":"2026-01-16","asOf":"2026-04-01","kind":"goal","value":320,"qualifier":null,"display":"320","label":"320 by his birthday","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":510.42,"row":"w78","segment":"s127","date":"2026-01-16","asOf":null,"kind":"goal","value":240,"qualifier":"≈","display":"240","label":"the eventual target","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":514.37,"row":"r83","segment":"s128","date":"2026-02-05","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"starts keto","deadline":null,"regime":"keto","event":"start","source":"clip"},{"t":518.33,"row":"r85","segment":"s129","date":"2026-03-17","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"starts carnivore","deadline":null,"regime":"carnivore","event":"start","source":"clip"},{"t":522.29,"row":"r86","segment":"s130","date":"2026-03-24","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"starts keto","deadline":null,"regime":"keto","event":"start","source":"clip"},{"t":526.24,"row":"r87","segment":"s131","date":"2026-04-13","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Fasting","label":"starts intermittent fasting","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":538.11,"row":"r90","segment":"s134","date":"2026-07-09","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Carnivore","label":"starts carnivore","deadline":null,"regime":"carnivore","event":"start","source":"clip"},{"t":542.07,"row":"r91","segment":"s135","date":"2026-07-20","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"starts keto","deadline":null,"regime":"keto","event":"start","source":"clip"},{"t":549.98,"row":"r92","segment":"s137","date":"2026-07-21","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":569.76,"row":"w85","segment":"s142","date":"2026-07-28","asOf":null,"kind":"goalLoss","value":-50,"qualifier":null,"display":"lose 50","label":"fifty by the end of 2026","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":581.63,"row":"w88","segment":"s145","date":"2026-07-31","asOf":null,"kind":"goal","value":250,"qualifier":null,"display":"250","label":"'closer to 250'","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":585.58,"row":"w89","segment":"s146","date":"2026-07-31","asOf":"2025-02-01","kind":"remembered","value":390,"qualifier":null,"display":"390 lb","label":"390 on the scale, remembered again","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":589.54,"row":"w90","segment":"s147","date":"2026-07-31","asOf":null,"kind":"goal","value":235,"qualifier":null,"display":"230-240","label":"230-240, computed from a height chart on air","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":593.49,"row":"w91","segment":"s148","date":"2026-08-03","asOf":"2026-07-19","kind":"remembered","value":349,"qualifier":null,"display":"349 lb","label":"349 on keto day one - first time he names a start weight","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":597.45,"row":"w92","segment":"s149","date":"2026-08-03","asOf":"2026-07-27","kind":"remembered","value":342,"qualifier":null,"display":"342 lb","label":"342 on 27 July (same ladder)","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":605.36,"row":"r96","segment":"s151","date":"2026-08-06","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto · 5 carbs a day","label":"says he is on keto","deadline":null,"regime":"keto","event":"on","source":"clip"},{"t":617.23,"row":"r101","segment":"s154","date":"2026-08-17","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto + fasting Thu/Fri","label":"adds two fasting days a week","deadline":null,"regime":"fasting","event":"start","source":"clip"},{"t":644.92,"row":"w103","segment":"s161","date":"2026-08-28","asOf":"2023-12-31","kind":"remembered","value":365.7,"qualifier":null,"display":"365.7 lb","label":"365.7 - \"when I started this weight loss journey\"","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":660.75,"row":"r102","segment":"s165","date":"2026-09-11","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"IF 2-3 days · ~400 kcal","label":"\"most days I eat like four hundred calories\"","deadline":null,"regime":"calories","event":"on","source":"clip"},{"t":676.57,"row":"w109","segment":"s169","date":"2026-09-17","asOf":"2024-09-01","kind":"remembered","value":390,"qualifier":"≈","display":"390 lb","label":"390 on a Florida scale \"two years ago\"","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":684.48,"row":"w111","segment":"s171","date":"2026-09-24","asOf":null,"kind":"goal","value":225,"qualifier":"≈","display":"225","label":"\"two and a quarter\" (happy at 240)","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":700.31,"row":"w116","segment":"s175","date":"2026-10-15","asOf":"2025-02-01","kind":"remembered","value":390,"qualifier":"≈","display":"390 lb","label":"\"almost 390 when I started my weight loss journey\"","deadline":null,"regime":null,"event":null,"source":"clip"},{"t":704.26,"row":"r104","segment":"s176","date":"2026-10-15","asOf":null,"kind":"diet","value":null,"qualifier":null,"display":"Keto + IF + walking","label":"\"Keto + Intermittent fasting + walking. That's it.\" (X)","deadline":null,"regime":"fasting","event":"on","source":"post"},{"t":712.18,"row":"p01","segment":"s178","date":"2026-10-23","asOf":null,"kind":"promise","value":null,"qualifier":null,"display":"scale video","label":"\"Buy 5 bags … I'll post a video of the scale. If I'm lying … $100\"","deadline":null,"regime":null,"event":null,"source":"post","quote":"291. Buy 5 bags if Huck's blend and I'll post a video of the scale"},{"t":716,"row":"SYNTH-c01","segment":"s179","date":"2026-10-24","asOf":null,"kind":"promiseClaim","value":null,"qualifier":null,"display":"paid for it","label":"I bought the 5 bags — where's the scale video?","deadline":null,"regime":null,"event":null,"promise":"p01","speaker":"madamsavvy","source":"post","synthetic":true},{"t":720.09,"row":"w120","segment":"s180","date":"2026-10-31","asOf":null,"kind":"goalLoss","value":-65,"qualifier":null,"display":"lose 65","label":"65 by Christmas (was 50, then 60)","deadline":"by Christmas","regime":null,"event":null,"source":"post"},{"t":722,"row":"SYNTH-o01","segment":"s180","date":"2026-10-31","asOf":null,"kind":"promiseOutcome","value":null,"qualifier":null,"display":"refunded","label":"Your refund has been processed… best of luck on your weight loss journey","deadline":null,"regime":null,"event":null,"promise":"p01","speaker":"madamsavvy","outcome":"refunded","source":"clip","synthetic":true},{"t":724.04,"row":"p02","segment":"s181","date":"2026-11-03","asOf":null,"kind":"promiseCheck","value":null,"qualifier":null,"display":"brush-off","label":"\"just pull up a video from three months ago\"","deadline":null,"regime":null,"event":null,"promise":"p01","source":"clip","quote":"you have to get on a scale it's like brother just pull up a video from three months ago"}],"hidden":[],"state":[{"t":0,"goal":null,"goals":[],"diet":null,"promises":[]},{"t":8,"goal":null,"goals":[],"diet":{"regime":"other","display":"Some diet","row":"r01","n":1},"promises":[]},{"t":11.96,"goal":null,"goals":[],"diet":{"regime":"other","display":"Some diet","row":"r02","n":2},"promises":[]},{"t":27.78,"goal":{"value":null,"loss":40,"deadline":null,"row":"w02"},"goals":["w02"],"diet":{"regime":"other","display":"Some diet","row":"r02","n":2},"promises":[]},{"t":31.74,"goal":{"value":null,"loss":40,"deadline":null,"row":"w02"},"goals":["w02"],"diet":{"regime":"other","display":"Some diet","row":"r05","n":3},"promises":[]},{"t":39.65,"goal":{"value":null,"loss":40,"deadline":null,"row":"w02"},"goals":["w02"],"diet":{"regime":"keto","display":"Keto","row":"r07","n":4},"promises":[]},{"t":43.6,"goal":{"value":null,"loss":100,"deadline":null,"row":"w06"},"goals":["w02","w06"],"diet":{"regime":"keto","display":"Keto","row":"r07","n":4},"promises":[]},{"t":47.56,"goal":{"value":null,"loss":100,"deadline":null,"row":"w06"},"goals":["w02","w06"],"diet":{"regime":"keto","display":"Keto","row":"r09","n":5},"promises":[]},{"t":55.47,"goal":{"value":null,"loss":100,"deadline":null,"row":"w06"},"goals":["w02","w06"],"diet":{"regime":"other","display":"Some diet","row":"r10","n":6},"promises":[]},{"t":63.38,"goal":{"value":210,"loss":30,"deadline":null,"row":"w08"},"goals":["w02","w06","w08"],"diet":{"regime":"other","display":"Some diet","row":"r10","n":6},"promises":[]},{"t":67.34,"goal":{"value":210,"loss":30,"deadline":null,"row":"w08"},"goals":["w02","w06","w08"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r14","n":7},"promises":[]},{"t":71.3,"goal":{"value":190,"loss":50,"deadline":null,"row":"w09"},"goals":["w02","w06","w08","w09"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r14","n":7},"promises":[]},{"t":75.25,"goal":{"value":190,"loss":50,"deadline":null,"row":"w11"},"goals":["w02","w06","w08","w09","w11"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r14","n":7},"promises":[]},{"t":79.21,"goal":{"value":190,"loss":50,"deadline":null,"row":"w11"},"goals":["w02","w06","w08","w09","w11"],"diet":{"regime":"other","display":"Some diet","row":"r15","n":8},"promises":[]},{"t":83.16,"goal":{"value":190,"loss":50,"deadline":null,"row":"w11"},"goals":["w02","w06","w08","w09","w11"],"diet":{"regime":"other","display":"Some diet","row":"r17","n":9},"promises":[]},{"t":87.12,"goal":{"value":190,"loss":50,"deadline":null,"row":"w11"},"goals":["w02","w06","w08","w09","w11"],"diet":{"regime":"calories","display":"Calories","row":"r18","n":10},"promises":[]},{"t":95.03,"goal":{"value":140,"loss":100,"deadline":null,"row":"w13"},"goals":["w02","w06","w08","w09","w11","w13"],"diet":{"regime":"calories","display":"Calories","row":"r18","n":10},"promises":[]},{"t":102.95,"goal":{"value":140,"loss":100,"deadline":null,"row":"w13"},"goals":["w02","w06","w08","w09","w11","w13"],"diet":{"regime":"other","display":"Some diet","row":"r20","n":11},"promises":[]},{"t":110.86,"goal":{"value":165,"loss":75,"deadline":null,"row":"w16"},"goals":["w02","w06","w08","w09","w11","w13","w16"],"diet":{"regime":"other","display":"Some diet","row":"r20","n":11},"promises":[]},{"t":118.77,"goal":{"value":165,"loss":75,"deadline":null,"row":"w16"},"goals":["w02","w06","w08","w09","w11","w13","w16"],"diet":{"regime":"calories","display":"Calories","row":"r23","n":12},"promises":[]},{"t":126.68,"goal":{"value":165,"loss":75,"deadline":null,"row":"w19"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19"],"diet":{"regime":"calories","display":"Calories","row":"r23","n":12},"promises":[]},{"t":134.59,"goal":{"value":165,"loss":75,"deadline":null,"row":"w19"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19"],"diet":{"regime":"other","display":"Some diet","row":"r25","n":13},"promises":[]},{"t":138.55,"goal":{"value":165,"loss":75,"deadline":null,"row":"w19"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19"],"diet":{"regime":"other","display":"Some diet","row":"r25","n":13},"promises":[]},{"t":142.51,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"other","display":"Some diet","row":"r25","n":13},"promises":[]},{"t":146.46,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r29","n":14},"promises":[]},{"t":150.42,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"fasting","display":"Fasting","row":"r31","n":15},"promises":[]},{"t":154.37,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"fasting","display":"Fasting","row":"r32","n":16},"promises":[]},{"t":158.33,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r33","n":17},"promises":[]},{"t":166.24,"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r33","n":17},"promises":[]},{"t":170.2,"goal":{"value":250,"loss":null,"deadline":null,"row":"w27"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r33","n":17},"promises":[]},{"t":174.15,"goal":{"value":250,"loss":null,"deadline":null,"row":"w27"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27"],"diet":{"regime":"fasting","display":"Fasting","row":"r34","n":18},"promises":[]},{"t":182.07,"goal":{"value":190,"loss":50,"deadline":null,"row":"w29"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29"],"diet":{"regime":"fasting","display":"Fasting","row":"r34","n":18},"promises":[]},{"t":189.98,"goal":{"value":190,"loss":50,"deadline":null,"row":"w29"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29"],"diet":{"regime":"fasting","display":"Fasting","row":"r34","n":18},"promises":[]},{"t":193.93,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r34","n":18},"promises":[]},{"t":201.85,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r35","n":19},"promises":[]},{"t":205.8,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r36","n":20},"promises":[]},{"t":209.76,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r37","n":21},"promises":[]},{"t":213.71,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r38","n":22},"promises":[]},{"t":217.67,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r39","n":23},"promises":[]},{"t":225.58,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r39","n":23},"promises":[]},{"t":229.54,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r41","n":24},"promises":[]},{"t":237.45,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r42","n":25},"promises":[]},{"t":245.36,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"keto","display":"Keto","row":"r43","n":26},"promises":[]},{"t":249.32,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"keto","display":"Keto","row":"r44","n":27},"promises":[]},{"t":257.23,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"calories","display":"Calories","row":"r46","n":28},"promises":[]},{"t":261.19,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r47","n":29},"promises":[]},{"t":265.14,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r48","n":30},"promises":[]},{"t":269.1,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r49","n":31},"promises":[]},{"t":273.05,"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32"],"diet":{"regime":"fasting","display":"Fasting","row":"r50","n":32},"promises":[]},{"t":277.01,"goal":{"value":170,"loss":70,"deadline":null,"row":"w40"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40"],"diet":{"regime":"fasting","display":"Fasting","row":"r50","n":32},"promises":[]},{"t":280.97,"goal":{"value":170,"loss":70,"deadline":null,"row":"w40"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40"],"diet":{"regime":"keto","display":"Keto","row":"r51","n":33},"promises":[]},{"t":288.88,"goal":{"value":210,"loss":30,"deadline":null,"row":"w41"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41"],"diet":{"regime":"keto","display":"Keto","row":"r51","n":33},"promises":[]},{"t":292.84,"goal":{"value":210,"loss":30,"deadline":null,"row":"w41"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41"],"diet":{"regime":"fasting","display":"Fasting","row":"r52","n":34},"promises":[]},{"t":296.79,"goal":{"value":210,"loss":30,"deadline":null,"row":"w41"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r53","n":35},"promises":[]},{"t":304.7,"goal":{"value":210,"loss":30,"deadline":null,"row":"w41"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41"],"diet":{"regime":"keto","display":"Keto","row":"r54","n":36},"promises":[]},{"t":308.66,"goal":{"value":210,"loss":30,"deadline":null,"row":"w41"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41"],"diet":{"regime":"keto","display":"Keto","row":"r55","n":37},"promises":[]},{"t":312.62,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"keto","display":"Keto","row":"r55","n":37},"promises":[]},{"t":316.57,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r56","n":38},"promises":[]},{"t":324.48,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"other","display":"Some diet","row":"r59","n":39},"promises":[]},{"t":328.44,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"fasting","display":"Fasting","row":"r60","n":40},"promises":[]},{"t":336.35,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r61","n":41},"promises":[]},{"t":340.31,"goal":{"value":140,"loss":100,"deadline":null,"row":"w44"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44"],"diet":{"regime":"fasting","display":"Fasting","row":"r62","n":42},"promises":[]},{"t":344.26,"goal":{"value":140,"loss":100,"deadline":null,"row":"w46"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46"],"diet":{"regime":"fasting","display":"Fasting","row":"r62","n":42},"promises":[]},{"t":356.13,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r62","n":42},"promises":[]},{"t":360.09,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r62","n":42},"promises":[]},{"t":364.04,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r63","n":43},"promises":[]},{"t":368,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r64","n":44},"promises":[]},{"t":371.96,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"other","display":"Some diet","row":"r65","n":45},"promises":[]},{"t":379.87,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r66","n":46},"promises":[]},{"t":383.82,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r67","n":47},"promises":[]},{"t":387.78,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r67","n":47},"promises":[]},{"t":391.74,"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50"],"diet":{"regime":"fasting","display":"Fasting","row":"r67","n":47},"promises":[]},{"t":395.69,"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57"],"diet":{"regime":"fasting","display":"Fasting","row":"r67","n":47},"promises":[]},{"t":399.65,"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57"],"diet":{"regime":"glp1","display":"GLP-1","row":"r68","n":48},"promises":[]},{"t":403.6,"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r70","n":49},"promises":[]},{"t":407.56,"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57"],"diet":{"regime":"fasting","display":"Fasting","row":"r71","n":50},"promises":[]},{"t":415.47,"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57"],"diet":{"regime":"fasting","display":"Fasting","row":"r71","n":50},"promises":[]},{"t":419.43,"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61"],"diet":{"regime":"fasting","display":"Fasting","row":"r71","n":50},"promises":[]},{"t":435.25,"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61"],"diet":{"regime":"fasting","display":"Fasting","row":"r74","n":51},"promises":[]},{"t":439.21,"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r75","n":52},"promises":[]},{"t":447.12,"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61"],"diet":{"regime":"other","display":"Some diet","row":"r76","n":53},"promises":[]},{"t":451.08,"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61"],"diet":{"regime":"calories","display":"cutting carbs","row":"r77","n":54},"promises":[]},{"t":458.99,"goal":{"value":251,"loss":100,"deadline":null,"row":"w68"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68"],"diet":{"regime":"calories","display":"cutting carbs","row":"r77","n":54},"promises":[]},{"t":462.95,"goal":{"value":201,"loss":150,"deadline":null,"row":"w69"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69"],"diet":{"regime":"calories","display":"cutting carbs","row":"r77","n":54},"promises":[]},{"t":478.77,"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72"],"diet":{"regime":"calories","display":"cutting carbs","row":"r77","n":54},"promises":[]},{"t":486.68,"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72"],"diet":{"regime":"calories","display":"cutting carbs","row":"r77","n":54},"promises":[]},{"t":494.59,"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72"],"diet":{"regime":"fasting","display":"Fasting","row":"r82","n":55},"promises":[]},{"t":506.46,"goal":{"value":320,"loss":null,"deadline":null,"row":"w77"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77"],"diet":{"regime":"fasting","display":"Fasting","row":"r82","n":55},"promises":[]},{"t":510.42,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"fasting","display":"Fasting","row":"r82","n":55},"promises":[]},{"t":514.37,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"keto","display":"Keto","row":"r83","n":56},"promises":[]},{"t":518.33,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r85","n":57},"promises":[]},{"t":522.29,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"keto","display":"Keto","row":"r86","n":58},"promises":[]},{"t":526.24,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"fasting","display":"Fasting","row":"r87","n":59},"promises":[]},{"t":538.11,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"carnivore","display":"Carnivore","row":"r90","n":60},"promises":[]},{"t":542.07,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"keto","display":"Keto","row":"r91","n":61},"promises":[]},{"t":549.98,"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":569.76,"goal":{"value":250,"loss":50,"deadline":null,"row":"w85"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":581.63,"goal":{"value":250,"loss":null,"deadline":null,"row":"w88"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":585.58,"goal":{"value":250,"loss":null,"deadline":null,"row":"w88"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":589.54,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":593.49,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":597.45,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"keto","display":"Keto","row":"r92","n":62},"promises":[]},{"t":605.36,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"keto","display":"Keto · 5 carbs a day","row":"r96","n":63},"promises":[]},{"t":617.23,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"fasting","display":"Keto + fasting Thu/Fri","row":"r101","n":64},"promises":[]},{"t":644.92,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"fasting","display":"Keto + fasting Thu/Fri","row":"r101","n":64},"promises":[]},{"t":660.75,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"calories","display":"IF 2-3 days · ~400 kcal","row":"r102","n":65},"promises":[]},{"t":676.57,"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90"],"diet":{"regime":"calories","display":"IF 2-3 days · ~400 kcal","row":"r102","n":65},"promises":[]},{"t":684.48,"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111"],"diet":{"regime":"calories","display":"IF 2-3 days · ~400 kcal","row":"r102","n":65},"promises":[]},{"t":700.31,"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111"],"diet":{"regime":"calories","display":"IF 2-3 days · ~400 kcal","row":"r102","n":65},"promises":[]},{"t":704.26,"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[]},{"t":712.18,"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":[],"claims":[],"outcome":null}]},{"t":716,"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":[],"claims":[{"row":"SYNTH-c01","speaker":"madamsavvy","date":"2026-10-24","label":"I bought the 5 bags — where's the scale video?","synthetic":true}],"outcome":null}]},{"t":720.09,"goal":{"value":226.5,"loss":65,"deadline":"by Christmas","row":"w120"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111","w120"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":[],"claims":[{"row":"SYNTH-c01","speaker":"madamsavvy","date":"2026-10-24","label":"I bought the 5 bags — where's the scale video?","synthetic":true}],"outcome":null}]},{"t":722,"goal":{"value":226.5,"loss":65,"deadline":"by Christmas","row":"w120"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111","w120"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":[],"claims":[{"row":"SYNTH-c01","speaker":"madamsavvy","date":"2026-10-24","label":"I bought the 5 bags — where's the scale video?","synthetic":true}],"outcome":{"kind":"refunded","date":"2026-10-31","row":"SYNTH-o01","synthetic":true}}]},{"t":724.04,"goal":{"value":226.5,"loss":65,"deadline":"by Christmas","row":"w120"},"goals":["w02","w06","w08","w09","w11","w13","w16","w19","w22","w27","w29","w32","w40","w41","w44","w46","w50","w57","w61","w68","w69","w72","w77","w78","w85","w88","w90","w111","w120"],"diet":{"regime":"fasting","display":"Keto + IF + walking","row":"r104","n":66},"promises":[{"row":"p01","said":"2026-10-23","what":"post a video of the scale","due":null,"kept":false,"checks":["p02"],"claims":[{"row":"SYNTH-c01","speaker":"madamsavvy","date":"2026-10-24","label":"I bought the 5 bags — where's the scale video?","synthetic":true}],"outcome":{"kind":"refunded","date":"2026-10-31","row":"SYNTH-o01","synthetic":true}}]}],"totals":{"goals":29,"goalRepeats":{"lose 100":8},"diets":66,"peakDrift":[365.7,370,385,387,390]},"_fixture":"measure-extras test fixture: made by make-fixture.mjs from the lanes' synthetic measure slice (real ledger rows, fake cut times); SYNTHETIC rows SYNTH-c01 (a promiseClaim by madamsavvy) and SYNTH-o01 (a refunded promiseOutcome) added by addSyntheticPromiseRows"}
diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs
@@ -0,0 +1,693 @@
+// THE MEASURE EXTRAS (weight video rev 9, lane measure-extras): what the goal
+// stack, the moving start, the promise clock and the diet badge draw, as data
+// -- each a list of STATES on the cut's clock, read off the schedule's
+// `measure` slice (CONTRACT.md: `measure.events` in cut order, `measure.state`
+// the state after each one). chrome-measure-extras.mjs draws them; the
+// modules (modules/goals.mjs, peak.mjs, promise.mjs, diet.mjs) register them.
+//
+// PURE: a schedule and a render block in, plain data out. No fs, no browser.
+//
+// The rules, as the operator and the contract give them:
+// - GOALS: every goal / goalLoss event drops a note on a pile; a goal said
+// again in the same words merges into its note with a count ("lose 100
+// ×8") and comes to the front. A goal with a `deadline` counts down to
+// `measure.asOfRender` ("by Christmas · 50 days left · needs 226.5"): the
+// date is parsed from his words (deadlineDate), and words with no date in
+// them ("by my birthday") keep their label and no countdown.
+// - PEAK: every remembered weight that is one of the totals' `peakDrift`
+// values (the starts he tells: 365.7 → 370 → 385 → 387 → ≈390) adds a tick
+// on a small vertical scale, a retelling of the same number a count; the
+// spread from the lowest to the highest so far is the drift.
+// - PROMISE: from a promise on, the days since he said it -- to the in-record
+// date of what is on screen, and from the finale (or a beat after the last
+// event) to the render date, counted up a day at a time; each check's words
+// under it; kept, "POSTED".
+// - DIET: the state's diet, re-stamped at each change of regime or diet
+// number; a null diet after one is "NO DIET" (the producer has applied the
+// off-scope rule: this only draws state.diet).
+import { deckGeometry, feedGeometry } from "./deck.mjs";
+import { resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
+
+const r4 = (v) => Math.round(v * 10000) / 10000;
+const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
+const even = (v) => 2 * Math.round(v / 2);
+
+/** The schedule's measure slice, when it has one the extras can read. */
+export function measureOf(schedule) {
+ const m = schedule?.measure;
+ return isObj(m) && Array.isArray(m.events) && Array.isArray(m.state) ? m : null;
+}
+
+// ---------------------------------------------------------------------------
+// Dates.
+// ---------------------------------------------------------------------------
+
+const ISO_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
+const utc = (iso) => {
+ const m = ISO_RE.exec(String(iso ?? ""));
+ return m ? Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : null;
+};
+const iso = (ms) => new Date(ms).toISOString().slice(0, 10);
+
+/** Whole days from `a` to `b` (YYYY-MM-DD), or null. */
+export function daysBetween(a, b) {
+ const x = utc(a);
+ const y = utc(b);
+ return x === null || y === null ? null : Math.round((y - x) / 86400000);
+}
+
+const MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
+
+/** The n-th weekday (0 Sunday) of a month, as UTC ms. */
+function nthWeekday(year, month, weekday, n) {
+ const first = new Date(Date.UTC(year, month, 1)).getUTCDay();
+ return Date.UTC(year, month, 1 + ((weekday - first + 7) % 7) + 7 * (n - 1));
+}
+
+/** The days his words can name, each `(year) => ms`. */
+const NAMED_DAYS = [
+ [/christmas eve/, (y) => Date.UTC(y, 11, 24)],
+ [/christmas|xmas/, (y) => Date.UTC(y, 11, 25)],
+ [/new year'?s eve/, (y) => Date.UTC(y, 11, 31)],
+ [/new year'?s?(?: day)?|the new year/, (y) => Date.UTC(y, 0, 1)],
+ [/halloween/, (y) => Date.UTC(y, 9, 31)],
+ [/thanksgiving/, (y) => nthWeekday(y, 10, 4, 4)],
+ [/valentine'?s/, (y) => Date.UTC(y, 1, 14)],
+ [/(?:the )?(?:4th|fourth) of july|july (?:4th|4)|independence day/, (y) => Date.UTC(y, 6, 4)],
+ [/end of (?:the )?(?:year|(?:19|20)\d{2})|year'?s end/, (y) => Date.UTC(y, 11, 31)],
+];
+
+/**
+ * The date a goal's deadline words name, as YYYY-MM-DD, or null when they
+ * name none he has given ("by my birthday", "by summer"). `said` is the date
+ * he said it: "by Christmas" is the next Christmas from then (25 Dec of its
+ * year, or the year after when said after it), "next year" a year on, an
+ * explicit year that year ("by the end of 2026", "by Halloween 2027"), an ISO
+ * date itself, "by March 3" the next 3 March.
+ *
+ * @param {string | null | undefined} words
+ * @param {string | null | undefined} said
+ */
+export function deadlineDate(words, said) {
+ if (typeof words !== "string" || !words.trim()) return null;
+ const w = words.toLowerCase().replace(/[’`]/g, "'").replace(/\s+/g, " ").trim();
+ const isoIn = /(\d{4}-\d{2}-\d{2})/.exec(w);
+ if (isoIn && utc(isoIn[1]) !== null) return isoIn[1];
+ const base = utc(said);
+ const saidYear = base === null ? null : new Date(base).getUTCFullYear();
+ const yearIn = /\b(20\d{2}|19\d{2})\b/.exec(w);
+ const next = /\bnext year\b/.test(w);
+ const pick = (f) => {
+ if (yearIn) return f(Number(yearIn[1]));
+ if (saidYear === null) return null;
+ let at = f(saidYear + (next ? 1 : 0));
+ // Said after this year's: the next one.
+ if (!next && at < base) at = f(saidYear + 1);
+ return at;
+ };
+ for (const [re, f] of NAMED_DAYS) {
+ if (re.test(w)) {
+ const at = pick(f);
+ return at === null ? null : iso(at);
+ }
+ }
+ // "by March 3", "by 3 March", "by march 3rd".
+ const md = new RegExp(`\\b(${MONTHS.join("|")})[a-z]*\\.? (\\d{1,2})(?:st|nd|rd|th)?\\b|\\b(\\d{1,2})(?:st|nd|rd|th)? (?:of )?(${MONTHS.join("|")})[a-z]*\\b`).exec(w);
+ if (md) {
+ const mon = MONTHS.indexOf(md[1] ?? md[4]);
+ const day = Number(md[2] ?? md[3]);
+ if (day >= 1 && day <= 31) {
+ const at = pick((y) => Date.UTC(y, mon, day));
+ return at === null ? null : iso(at);
+ }
+ }
+ return null;
+}
+
+/** "23 Oct" (or "23 Oct 2025" with `year`) from YYYY-MM-DD. */
+export function shortDate(d, { year = false } = {}) {
+ const m = ISO_RE.exec(String(d ?? ""));
+ if (!m) return String(d ?? "");
+ const mon = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][Number(m[2]) - 1];
+ return `${Number(m[3])} ${mon}${year ? ` ${m[1]}` : ""}`;
+}
+
+/** "Jan 2021" from YYYY-MM-DD. */
+export function monthYear(d) {
+ const m = ISO_RE.exec(String(d ?? ""));
+ if (!m) return "";
+ return `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][Number(m[2]) - 1]} ${m[1]}`;
+}
+
+/** A weight as he says it: 365.7, 390 (no trailing .0). */
+export const weightText = (v) => (Number.isFinite(v) ? (Math.round(v * 10) % 10 === 0 ? String(Math.round(v)) : (Math.round(v * 10) / 10).toFixed(1)) : "");
+
+/** "50 days left" | "1 day left" | "today" | "3 days past". */
+export function daysLeftText(n) {
+ if (n === null) return "";
+ if (n === 0) return "today";
+ if (n > 0) return `${n} day${n === 1 ? "" : "s"} left`;
+ return `${-n} day${n === -1 ? "" : "s"} past`;
+}
+
+// ---------------------------------------------------------------------------
+// The shared clock: when each module is up.
+// ---------------------------------------------------------------------------
+
+/** The finale's window in the cut, or null. */
+const finaleOf = (schedule) => (isObj(schedule?.finale) && Number.isFinite(schedule.finale.from) ? schedule.finale : null);
+
+/**
+ * When a module is up: from each event to `hold` seconds after it (spans
+ * that touch joined), or -- `hold` 0 or null -- from its first event to the end;
+ * never inside the finale's window unless `finale: "show"`.
+ *
+ * @returns {Array<{ in: number, out: number }>}
+ */
+export function upSpans(times, cfg, schedule) {
+ const total = Number(schedule.total) || 0;
+ const fin = finaleOf(schedule);
+ const end = fin && cfg.finale !== "show" ? Math.min(total, fin.from) : total;
+ const ts = times.filter((t) => Number.isFinite(t) && t < end).sort((a, b) => a - b);
+ if (!ts.length) return [];
+ if (!cfg.hold) return [{ in: r4(ts[0]), out: r4(end) }];
+ const out = [];
+ for (const t of ts) {
+ const span = { in: t, out: Math.min(end, t + cfg.hold) };
+ const last = out[out.length - 1];
+ if (last && span.in <= last.out + 1e-6) last.out = Math.max(last.out, span.out);
+ else out.push(span);
+ }
+ return out.map((s) => ({ in: r4(s.in), out: r4(s.out) }));
+}
+
+/** Each event with the state after it, in cut order (events with no time are not on screen). */
+function stepsOf(m) {
+ const out = [];
+ m.events.forEach((e, i) => {
+ if (!Number.isFinite(e?.t)) return;
+ out.push({ e, s: m.state[i + 1] ?? m.state[m.state.length - 1] ?? null, i });
+ });
+ return out.sort((a, b) => a.e.t - b.e.t || a.i - b.i);
+}
+
+/** A stable pseudo-random number in [-1, 1] from a string (a note's jitter). */
+export function jitter(s, salt = 0) {
+ let h = 2166136261 ^ salt;
+ for (const ch of String(s)) h = Math.imul(h ^ ch.charCodeAt(0), 16777619);
+ return ((h >>> 0) % 2001) / 1000 - 1;
+}
+
+// ---------------------------------------------------------------------------
+// GOALS
+// ---------------------------------------------------------------------------
+
+/** How a note's words read: "LOSE 100", "≈250 LB", "220–240 LB". */
+export function goalText(e, unit = "lb") {
+ const d = String(e.display ?? "").trim() || (Number.isFinite(e.value) ? weightText(Math.abs(e.value)) : "");
+ if (e.kind === "goalLoss") return d.toUpperCase();
+ const q = e.qualifier === "≈" && !d.startsWith("≈") ? "≈" : "";
+ const range = d.replace(/(\d)\s*-\s*(\d)/, "$1–$2");
+ return /^[≈~<>]?\d/.test(range) ? `${q}${range} ${unit}`.toUpperCase() : range.toUpperCase();
+}
+
+/**
+ * The pile's states: one per goal event, `{ at, top, goalsSet, notes }` --
+ * `notes` back to front (the last is the one that just landed, `top` its key),
+ * each `{ key, text, count, date, deadline, deadlineDate, days, target, rot,
+ * dx, depth, prev }` (`prev` its depth in the state before, null when new).
+ */
+export function goalStates(schedule, render) {
+ const m = measureOf(schedule);
+ const cfg = resolveMeasureExtra("goals", render);
+ if (!m || !cfg) return [];
+ const notes = new Map();
+ let order = [];
+ const states = [];
+ let prevDepth = new Map();
+ let n = 0;
+ for (const { e, s } of stepsOf(m)) {
+ if (e.kind !== "goal" && e.kind !== "goalLoss") continue;
+ n += 1;
+ const text = goalText(e, m.unit ?? "lb");
+ const key = text.toLowerCase();
+ let note = notes.get(key);
+ if (!note) {
+ note = { key, id: `n${notes.size}`, count: 0, rot: r4(jitter(e.row ?? key) * 5), dx: r4(jitter(e.row ?? key, 7) * 10) };
+ notes.set(key, note);
+ }
+ note.count += 1;
+ note.text = text;
+ note.date = e.date ?? null;
+ note.deadline = typeof e.deadline === "string" && e.deadline.trim() ? e.deadline.trim() : null;
+ // The ledger's own `due` when it has one (the producer resolves it), else his words read here.
+ const due = [e.due, s?.goal?.row === e.row ? s.goal.due : null].find((d) => typeof d === "string" && /^\d{4}-\d{2}-\d{2}$/.test(d)) ?? null;
+ note.deadlineDate = note.deadline ? due ?? deadlineDate(note.deadline, e.date) : null;
+ note.days = note.deadlineDate && m.asOfRender ? daysBetween(m.asOfRender, note.deadlineDate) : null;
+ // The weight it comes to: a goal's own number, or the state's resolution of a goalLoss.
+ const target = s?.goal && s.goal.row === e.row && Number.isFinite(s.goal.value) ? s.goal.value
+ : e.kind === "goal" && Number.isFinite(e.value) ? e.value : null;
+ note.target = target;
+ order = [...order.filter((k) => k !== key), key];
+ const shown = order.slice(-cfg.max);
+ const depth = new Map(shown.map((k, i) => [k, shown.length - 1 - i]));
+ states.push({
+ at: r4(e.t),
+ top: key,
+ repeat: note.count > 1,
+ goalsSet: Array.isArray(s?.goals) ? s.goals.length : n,
+ notes: shown.map((k) => {
+ const x = notes.get(k);
+ return {
+ key: k, id: x.id, text: x.text, count: x.count, date: x.date, deadline: x.deadline,
+ deadlineDate: x.deadlineDate, days: x.days, target: x.target, rot: x.rot, dx: x.dx,
+ depth: depth.get(k), prev: k === key ? null : prevDepth.get(k) ?? null,
+ };
+ }),
+ });
+ prevDepth = depth;
+ }
+ return states;
+}
+
+// ---------------------------------------------------------------------------
+// PEAK
+// ---------------------------------------------------------------------------
+
+const near = (a, b) => Math.abs(a - b) < 0.05;
+
+/**
+ * The moving start's states: one per remembered weight it draws, `{ at,
+ * ticks: [{ value, count, approx, latest }], lo, hi, drift, told }`, and the
+ * scale's range over the whole cut (`range: [min, max]`) on each.
+ */
+export function peakStates(schedule, render) {
+ const m = measureOf(schedule);
+ const cfg = resolveMeasureExtra("peak", render);
+ if (!m || !cfg) return [];
+ const drift = Array.isArray(m.totals?.peakDrift) ? m.totals.peakDrift.filter(Number.isFinite) : [];
+ const counts = cfg.values === "drift" && drift.length > 0;
+ const steps = stepsOf(m).filter(({ e }) => e.kind === "remembered" && Number.isFinite(e.value) && (!counts || drift.some((v) => near(v, e.value))));
+ if (!steps.length) return [];
+ const all = steps.map(({ e }) => e.value);
+ let lo = Math.floor(Math.min(...all) - 3);
+ let hi = Math.ceil(Math.max(...all) + 3);
+ if (hi - lo < 12) {
+ const mid = (hi + lo) / 2;
+ lo = Math.floor(mid - 6);
+ hi = Math.ceil(mid + 6);
+ }
+ const ticks = new Map();
+ const states = [];
+ steps.forEach(({ e }, j) => {
+ const v = Math.round(e.value * 10) / 10;
+ const t = ticks.get(v) ?? { value: v, count: 0, approx: false };
+ t.count += 1;
+ if (e.qualifier === "≈" || String(e.display ?? "").startsWith("≈")) t.approx = true;
+ ticks.set(v, t);
+ const vals = [...ticks.keys()];
+ const min = Math.min(...vals);
+ const max = Math.max(...vals);
+ states.push({
+ at: r4(e.t),
+ row: e.row ?? null,
+ latest: v,
+ repeat: t.count > 1,
+ ticks: [...ticks.values()].sort((a, b) => a.value - b.value).map((x) => ({ ...x, latest: x.value === v })),
+ lo: min, hi: max, drift: r4(max - min), told: j + 1,
+ range: [lo, hi],
+ });
+ });
+ return states;
+}
+
+// ---------------------------------------------------------------------------
+// PROMISE
+// ---------------------------------------------------------------------------
+
+/** After the last event, how long before the clock counts on to the render date (no finale). */
+export const PROMISE_SETTLE = 4;
+/** The count-up to the render date: a day a step, over at most this long. */
+export const PROMISE_COUNT_UP = 1.2;
+
+/** The promise outcomes the clock draws (CONTRACT addendum 2): kept stops the count; refunded and withdrawn do not. */
+export const PROMISE_OUTCOMES = Object.freeze(["kept", "refunded", "withdrawn"]);
+
+/**
+ * The promise clock's states: `{ at, rows: [row], asOf }`, one row (the latest
+ * promise): `{ row, what, said, days, to, kept, outcome: { kind, date } | null,
+ * claim: { speaker, date, paidOn } | null, word: { text, date, speaker, his } |
+ * null, fresh }` -- `to` the date the days are counted to, `claim` another
+ * party's (her) latest claim on it (CONTRACT addendum: "PAID 23 OCT BY
+ * @MadamSavvy"), `word` the latest words said about it -- his check, her
+ * claim, the outcome's -- `fresh` when they just came in (they flash). A state
+ * wherever any of that changes. From the finale's start (else PROMISE_SETTLE
+ * after the last event) the days count up to `measure.asOfRender`, a day a
+ * step -- unless it was kept: the count stops on the day it was.
+ */
+export function promiseStates(schedule, render) {
+ const m = measureOf(schedule);
+ const cfg = resolveMeasureExtra("promise", render);
+ if (!m || !cfg) return [];
+ const steps = stepsOf(m);
+ const first = steps.find(({ e }) => e.kind === "promise");
+ if (!first) return [];
+ const byRow = new Map([...m.events, ...(m.hidden ?? [])].filter((e) => e?.row).map((e) => [e.row, e]));
+ const total = Number(schedule.total) || 0;
+ const wordsOf = (e) => {
+ const w = cfg.checks === "quote" ? e.quote || e.label : e.label || e.quote;
+ return w ? String(w).trim() : null;
+ };
+ // The latest words on each promise, in cut order (his checks, her claims, the outcome's).
+ const lastWord = new Map();
+ const outcomeOf = (p) => {
+ const o = isObj(p.outcome) && PROMISE_OUTCOMES.includes(p.outcome.kind) ? p.outcome : null;
+ return o ? { kind: o.kind, date: o.date ?? null } : p.kept === true ? { kind: "kept", date: null } : null;
+ };
+ const rowsAt = (s, dateNow, freshRow) => (Array.isArray(s?.promises) ? s.promises : [])
+ .filter((p) => p && p.said)
+ .slice(-1)
+ .map((p) => {
+ const ev = byRow.get(p.row);
+ const outcome = outcomeOf(p);
+ const claims = Array.isArray(p.claims) ? p.claims.filter((c) => isObj(c)) : [];
+ const c = claims[claims.length - 1] ?? null;
+ // His checks named by the state (an older slice has no events for the words: the row's).
+ const checks = Array.isArray(p.checks) ? p.checks : [];
+ let word = lastWord.get(p.row) ?? null;
+ if (!word && checks.length) {
+ const ce = byRow.get(checks[checks.length - 1]);
+ const text = ce ? wordsOf(ce) : null;
+ if (text) word = { row: ce.row, text, date: ce.date ?? null, speaker: ce.speaker ?? null, his: !ce.speaker };
+ }
+ // Kept stops the count on the day it was kept.
+ const stop = outcome?.kind === "kept" && outcome.date ? outcome.date : null;
+ const to = stop ?? (dateNow && dateNow > p.said ? dateNow : p.said);
+ return {
+ row: p.row,
+ what: cfg.label ?? ev?.display ?? p.what ?? "promise",
+ said: p.said,
+ days: Math.max(0, daysBetween(p.said, to) ?? 0),
+ to,
+ kept: outcome?.kind === "kept",
+ outcome,
+ claim: c ? { speaker: c.speaker ?? null, date: c.date ?? null, paidOn: c.paidOn ?? null } : null,
+ word: word ? { text: word.text, date: word.date, speaker: word.speaker, his: word.his, outcome: !!word.outcome } : null,
+ fresh: !!freshRow && word?.row === freshRow,
+ };
+ });
+ const out = [];
+ let dateNow = null;
+ let lastSig = null;
+ let lastS = null;
+ for (const { e, s } of steps) {
+ if (e.date && (!dateNow || e.date > dateNow)) dateNow = e.date;
+ if (e.t < first.e.t) continue;
+ let fresh = null;
+ if ((e.kind === "promiseCheck" || e.kind === "promiseClaim" || e.kind === "promiseOutcome") && e.promise) {
+ const text = wordsOf(e);
+ if (text) {
+ lastWord.set(e.promise, { row: e.row, text, date: e.date ?? null, speaker: e.speaker ?? null, his: !e.speaker || e.kind === "promiseCheck", outcome: e.kind === "promiseOutcome" });
+ fresh = e.row;
+ }
+ }
+ const rows = rowsAt(s, dateNow, fresh);
+ lastS = s;
+ if (!rows.length) continue;
+ const sig = JSON.stringify(rows);
+ if (sig === lastSig) continue;
+ lastSig = sig;
+ const at = r4(e.t);
+ if (out.length && Math.abs(out[out.length - 1].at - at) < 1e-6) out.pop();
+ out.push({ at, rows, asOf: false });
+ }
+ if (!out.length) return [];
+ // On to the render date: from the finale, else a beat after the last event.
+ const fin = finaleOf(schedule);
+ const lastAt = out[out.length - 1].at;
+ const from = fin ? Math.max(lastAt + 0.5, fin.from) : lastAt + PROMISE_SETTLE;
+ const asOf = m.asOfRender;
+ if (asOf && from < total - 0.2) {
+ const base = rowsAt(lastS, dateNow, null);
+ const target = base.map((r) => (r.kept && r.outcome?.date ? r.days : Math.max(0, daysBetween(r.said, asOf) ?? 0)));
+ const toOf = (r) => (r.kept && r.outcome?.date ? r.to : asOf);
+ const steps2 = Math.max(0, ...target.map((d, i) => d - base[i].days));
+ if (steps2 > 0) {
+ const n = Math.min(steps2, 30);
+ const dt = Math.min(PROMISE_COUNT_UP / n, 0.25);
+ for (let k = 1; k <= n; k += 1) {
+ const rows = base.map((r, i) => ({ ...r, days: Math.round(r.days + ((target[i] - r.days) * k) / n), to: toOf(r), fresh: false }));
+ out.push({ at: r4(Math.min(total - 0.05, from + (k - 1) * dt)), rows, asOf: k === n });
+ }
+ } else out.push({ at: r4(from), rows: base.map((r) => ({ ...r, to: toOf(r), fresh: false })), asOf: true });
+ }
+ return out;
+}
+
+// ---------------------------------------------------------------------------
+// DIET
+// ---------------------------------------------------------------------------
+
+/**
+ * The diet badge's states: `{ at, diet: { regime, label, detail, n, color } |
+ * null, slam }` -- one per change of the state's diet (regime, number or
+ * words); `slam` when the regime or the number changed (a new stamp), not
+ * for words alone. The states before any diet are left out; a null after
+ * one is "No diet", faded in.
+ */
+export function dietStates(schedule, render) {
+ const m = measureOf(schedule);
+ const cfg = resolveMeasureExtra("diet", render);
+ if (!m || !cfg) return [];
+ const out = [];
+ let prev;
+ let any = false;
+ for (const { e, s } of stepsOf(m)) {
+ const d = isObj(s?.diet) ? s.diet : null;
+ if (!d && !any) continue;
+ const key = d ? `${d.regime}|${d.n}|${d.display}` : "none";
+ if (key === prev?.key) continue;
+ any = true;
+ const regime = d ? String(d.regime ?? "other") : "off";
+ const label = cfg.labels[regime] ?? regime;
+ const display = d ? String(d.display ?? "").trim() : "";
+ const generic = !display || display.toLowerCase() === label.toLowerCase() || display.toLowerCase() === String(cfg.labels.other ?? "").toLowerCase() || display.toLowerCase() === regime;
+ const diet = d ? { regime, label, detail: generic ? "" : display, n: Number.isFinite(d.n) ? d.n : null, color: cfg.colors[regime] ?? cfg.colors.other } : null;
+ const slam = !!d && (!prev?.diet || prev.diet.regime !== regime || prev.diet.n !== diet.n);
+ const at = r4(e.t);
+ if (out.length && Math.abs(out[out.length - 1].at - at) < 1e-6) out.pop();
+ out.push({ at, diet, slam, key });
+ prev = { key, diet };
+ }
+ return out.map(({ key: _k, ...st }) => st);
+}
+
+// ---------------------------------------------------------------------------
+// STREAK: a chain per run, cracked when it ends.
+// ---------------------------------------------------------------------------
+//
+// SOURCE-AGNOSTIC. Each source is an ADAPTER from the measure slice to RUNS --
+// `{ key, name, color, start, startT, end, endT, ended, detail }`: `start` the
+// run's first in-record date and `startT` the cut second it comes on screen,
+// `end`/`endT` the same for its end (null while it is open), `ended` the word
+// for how ("off", "new", "lapse") -- and the chain draws runs, nothing else.
+// A run's length is its days from `start` to `end` (an open run's to the
+// in-record date at the playhead).
+
+const isoMax = (a, b) => (!a ? b : !b ? a : a > b ? a : b);
+
+/**
+ * DIET runs: a run starts when the state's diet turns on (or changes regime
+ * or diet number: a new diet) and ends at the next change -- "new" -- or when
+ * the diet turns off -- "off" (the state's diet, with the producer's
+ * off-scope rule applied).
+ */
+export function dietRuns(m, cfg) {
+ const runs = [];
+ let open = null;
+ for (const { e, s } of stepsOf(m)) {
+ const d = isObj(s?.diet) ? s.diet : null;
+ const key = d ? `${d.regime}|${d.n}` : null;
+ if (key === (open?.key ?? null)) continue;
+ if (open) {
+ open.end = isoMax(open.start, e.date ?? open.start);
+ open.endT = r4(e.t);
+ open.ended = d ? "new" : "off";
+ open = null;
+ }
+ if (d) {
+ const regime = String(d.regime ?? "other");
+ open = {
+ key, name: cfg.labels[regime] ?? regime, color: cfg.colors[regime] ?? cfg.colors.other,
+ // The state's `since` (the producer's: the day the regime opened), else the event's date.
+ start: d.since ?? e.date ?? null, startT: r4(e.t), end: null, endT: null, ended: null,
+ detail: Number.isFinite(d.n) ? `diet #${d.n}` : "",
+ };
+ runs.push(open);
+ }
+ }
+ return runs;
+}
+
+/**
+ * LOST runs (the odometer's runs, `state.lost.runs`): a run starts when the
+ * state first names it -- at its own `start` date -- and ends when the next
+ * one starts ("new"), its chain reaching the last day he claimed a loss in it
+ * (its last `lost` event's date) -- the gap to the next is the time between.
+ */
+export function lostRunsRuns(m, cfg, pal = {}) {
+ const runs = [];
+ const seen = new Set();
+ let open = null;
+ const lastClaim = new Map();
+ for (const { e, s } of stepsOf(m)) {
+ if (e.kind === "lost" && e.run !== null && e.run !== undefined && e.date) lastClaim.set(`run${e.run}`, isoMax(lastClaim.get(`run${e.run}`), e.date));
+ for (const r of Array.isArray(s?.lost?.runs) ? s.lost.runs : []) {
+ const key = `run${r.run}`;
+ if (seen.has(key)) {
+ if (open?.key === key && Number.isFinite(r.peak)) open.detail = `down ${weightText(r.peak)}`;
+ continue;
+ }
+ seen.add(key);
+ const start = r.start ?? e.date ?? null;
+ if (open) {
+ const claimed = lastClaim.get(open.key);
+ const nextStart = start ?? open.start;
+ open.end = isoMax(open.start, claimed && claimed < nextStart ? claimed : nextStart);
+ open.endT = r4(e.t);
+ open.ended = "new";
+ }
+ open = {
+ key, name: `Run ${runs.length + 1}`, color: cfg.color ?? pal.accent ?? "#22AB83", zeroWord: "one claim",
+ start, startT: r4(e.t), end: null, endT: null, ended: null,
+ detail: Number.isFinite(r.peak) ? `down ${weightText(r.peak)}` : "",
+ };
+ runs.push(open);
+ }
+ }
+ return runs;
+}
+
+/**
+ * PLEDGES (the sobriety video's): a `pledge` event starts a run, a `lapse`
+ * snaps it ("after 73 days"). TODO(sobriety video): the measure contract has
+ * no drinking scope yet -- these event kinds are this adapter's assumption
+ * until the ledger writes them; the drawing needs nothing more.
+ */
+export function pledgeRuns(m, cfg, pal = {}) {
+ const runs = [];
+ let open = null;
+ for (const { e } of stepsOf(m)) {
+ if (e.kind === "pledge" && !open) {
+ open = {
+ key: e.row ?? `p${runs.length}`, name: e.display || cfg.labels.dry || "Dry", color: cfg.color ?? pal.accent ?? "#3FA9A0",
+ start: e.date ?? null, startT: r4(e.t), end: null, endT: null, ended: null, detail: "",
+ };
+ runs.push(open);
+ } else if (e.kind === "lapse" && open) {
+ open.end = isoMax(open.start, e.date ?? open.start);
+ open.endT = r4(e.t);
+ open.ended = "lapse";
+ open = null;
+ }
+ }
+ return runs;
+}
+
+const ADAPTERS = { diet: dietRuns, lostRuns: lostRunsRuns, pledges: pledgeRuns };
+
+/** The source's runs, through its adapter. */
+export function streakRuns(schedule, render) {
+ const m = measureOf(schedule);
+ const cfg = resolveMeasureExtra("streak", render);
+ if (!m || !cfg) return [];
+ return ADAPTERS[cfg.source](m, cfg, render?.palette ?? {});
+}
+
+/** A run's days from its start to `to`. */
+export const runDays = (run, to) => Math.max(0, daysBetween(run.start, to) ?? 0);
+
+/** "41 days" | "1 day". */
+export const daysText = (n) => `${n} day${n === 1 ? "" : "s"}`;
+
+/**
+ * The streak chain's states: one wherever the live chain or its count moves
+ * -- a run starting, a run ending, the in-record date moving on under an
+ * open run -- each `{ at, date, live: { i, days } | null, cracked: i | null }`
+ * (`cracked` the run that just ended, at its own state). With the runs, the
+ * date span the axis covers (`span: [from, to]`) and each run's final days.
+ */
+export function streakStates(schedule, render) {
+ const m = measureOf(schedule);
+ const runs = streakRuns(schedule, render);
+ if (!m || !runs.length) return { runs: [], states: [], span: null };
+ const states = [];
+ let date = null;
+ const push = (at, st) => {
+ const sig = JSON.stringify([st.live, st.cracked]);
+ const last = states[states.length - 1];
+ if (last && Math.abs(last.at - at) < 1e-6) states.pop();
+ else if (last && JSON.stringify([last.live, last.cracked]) === sig && st.cracked === null) return;
+ states.push({ at: r4(at), date: st.date, live: st.live, cracked: st.cracked });
+ };
+ const firstT = runs[0].startT;
+ for (const { e } of stepsOf(m)) {
+ if (e.date) date = isoMax(date, e.date);
+ if (e.t < firstT) continue;
+ const t = e.t;
+ const ended = runs.findIndex((r) => r.endT !== null && Math.abs(r.endT - t) < 1e-6);
+ const li = runs.findIndex((r) => r.startT <= t + 1e-6 && (r.endT === null || r.endT > t + 1e-6));
+ const live = li >= 0 ? { i: li, days: runDays(runs[li], isoMax(runs[li].start, date)) } : null;
+ push(t, { date, live, cracked: ended >= 0 ? ended : null });
+ }
+ const finalDate = date;
+ const ends = runs.map((r) => (r.end ?? isoMax(r.start, finalDate)));
+ const from = runs.map((r) => r.start).filter(Boolean).sort()[0] ?? finalDate;
+ const to = [m.asOfRender, ...ends].filter(Boolean).sort().at(-1);
+ return { runs: runs.map((r, i) => ({ ...r, days: runDays(r, ends[i]) })), states, span: [from, to] };
+}
+
+// ---------------------------------------------------------------------------
+// GEOMETRY
+// ---------------------------------------------------------------------------
+
+/** Each module's box in design pixels (1920 wide), before `scale`. */
+export const MEASURE_BOXES = Object.freeze({
+ goals: Object.freeze({ width: 400, height: 330 }),
+ peak: Object.freeze({ width: 280, height: 470 }),
+ promise: Object.freeze({ width: 640, height: 260 }),
+ diet: Object.freeze({ width: 440, height: 200 }),
+ streak: Object.freeze({ width: 620, height: 150 }),
+});
+
+/**
+ * A module's region in the frame: its box (MEASURE_BOXES × `scale`, scaled
+ * with the frame) at its anchor in the footage box (the feed's for a feed
+ * cut), 24 px in -- or at `x`/`y` (design pixels) when set. Never off the frame.
+ *
+ * @param {"goals" | "peak" | "promise" | "diet" | "streak"} id
+ * @returns {{ x: number, y: number, width: number, height: number }}
+ */
+export function measureExtraGeometry(id, render, { feed = false } = {}) {
+ const cfg = resolveMeasureExtra(id, render) ?? resolveMeasureExtra(id, { chrome: { deck: {} } });
+ const g = deckGeometry(render);
+ const f = feed ? feedGeometry(render).footage : g.footage;
+ const k = (g.W / 1920) * (cfg.scale ?? 1);
+ const box = MEASURE_BOXES[id];
+ const width = Math.min(even(box.width * k), even(g.W));
+ const height = Math.min(even(box.height * k), even(g.H));
+ let x;
+ let y;
+ if (Number.isFinite(cfg.x) && Number.isFinite(cfg.y)) {
+ x = cfg.x * (g.W / 1920);
+ y = cfg.y * (g.W / 1920);
+ } else {
+ const inset = Math.round(24 * (g.W / 1920));
+ const [v, h] = cfg.position.split("-");
+ x = h === "left" ? f.x + inset : h === "right" ? f.x + f.width - inset - width : f.x + (f.width - width) / 2;
+ y = v === "top" ? f.y + inset : f.y + f.height - inset - height;
+ }
+ x = Math.max(0, Math.min(g.W - width, Math.round(x)));
+ y = Math.max(0, Math.min(g.H - height, Math.round(y)));
+ return { x, y, width, height };
+}
diff --git a/umtool/report-to-video/measure-extras.test.mjs b/umtool/report-to-video/measure-extras.test.mjs
@@ -0,0 +1,292 @@
+// The measure extras (measure-extras.mjs, chrome-measure-extras.mjs, modules/goals,
+// peak, promise, diet): the goal stack, the moving start, the promise clock and
+// the diet badge, read off the schedule's `measure` slice. Fixture:
+// fixtures/measure-extras/measure.json (make-fixture.mjs: the lanes' synthetic
+// slice, real ledger rows and fake cut times, trimmed to what these read).
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+import { goalsHtml, dietHtml, peakHtml, promiseHtml, spreadLabels, stampSize, streakHtml } from "./chrome-measure-extras.mjs";
+import { cuePageHtml } from "./chrome-cues.mjs";
+import { estimateSchedule, validateChrome } from "./deck.mjs";
+import { frameKeys } from "./frame-keys.mjs";
+import {
+ daysBetween, deadlineDate, dietRuns, dietStates, goalStates, goalText, lostRunsRuns, measureExtraGeometry, peakStates, pledgeRuns,
+ promiseStates, streakStates, upSpans,
+} from "./measure-extras.mjs";
+import { deckOverlays, moduleById, moduleProblems, playModules, scheduleSlices } from "./modules/index.mjs";
+import { resolveMeasureExtra, validateMeasureExtra } from "./modules/measure-extras-settings.mjs";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures/measure-extras/measure.json"), "utf8"));
+const IDS = ["goals", "peak", "promise", "diet", "streak"];
+const PAGES = { goals: goalsHtml, peak: peakHtml, promise: promiseHtml, diet: dietHtml, streak: streakHtml };
+
+const RENDER = {
+ width: 1920, height: 1080, fps: 30,
+ palette: { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" },
+ chrome: { engine: "hyperframes", layout: "deck", deck: {} },
+};
+const withDeck = (deck) => ({ ...RENDER, chrome: { ...RENDER.chrome, deck } });
+const schedule = (measure = MEASURE, extra = {}) => ({
+ kind: "deck", fps: 30, total: 740, transition: 0.4, segments: [{ id: "a", start: 0, duration: 740, end: 740 }], measure, ...extra,
+});
+const clone = (v) => JSON.parse(JSON.stringify(v));
+
+test("deadlineDate: the next named day from when he said it; words with no date in them name none", () => {
+ assert.equal(deadlineDate("by Christmas", "2026-10-26"), "2026-12-25");
+ assert.equal(deadlineDate("by Christmas", "2026-12-28"), "2027-12-25", "said after it: the next one");
+ assert.equal(deadlineDate("by Halloween next year", "2026-03-01"), "2027-10-31");
+ assert.equal(deadlineDate("by Christmas 2027", "2026-03-01"), "2027-12-25");
+ assert.equal(deadlineDate("by the end of 2027", "2026-03-01"), "2027-12-31");
+ assert.equal(deadlineDate("by the end of the year", "2026-03-01"), "2026-12-31");
+ assert.equal(deadlineDate("by New Year's", "2026-05-01"), "2027-01-01");
+ assert.equal(deadlineDate("by Thanksgiving", "2026-05-01"), "2026-11-26");
+ assert.equal(deadlineDate("by March 3rd", "2026-05-01"), "2027-03-03");
+ assert.equal(deadlineDate("by 2026-12-01", "2026-05-01"), "2026-12-01");
+ for (const w of ["by my birthday", "by his birthday", "by summer", "", null]) assert.equal(deadlineDate(w, "2026-05-01"), null, String(w));
+ assert.equal(daysBetween("2026-11-05", "2026-12-25"), 50);
+});
+
+test("goals: a note per goal, a repeat merged with its count and brought to the front, the deadline counted to the render date", () => {
+ const states = goalStates(schedule(), RENDER);
+ assert.equal(states.length, 29, "every goal and goalLoss row on camera");
+ assert.equal(states.at(-1).goalsSet, 29);
+ // "lose 100", one note with its count: the seven times the cut shows it (the
+ // totals' goalRepeats, 8, count the record's off-camera row too).
+ const lose100 = Math.max(...states.flatMap((s) => s.notes.filter((n) => n.key === "lose 100").map((n) => n.count)));
+ assert.equal(lose100, MEASURE.events.filter((e) => e.display === "lose 100").length);
+ assert.equal(lose100, 7);
+ const rep = states.find((s) => s.top === "lose 100" && s.repeat);
+ assert.equal(rep.notes.at(-1).key, "lose 100", "the repeat comes to the front");
+ assert.equal(rep.notes.at(-1).depth, 0);
+ assert.ok(rep.notes.length <= 4, "max notes shown (4)");
+ // The deadline: "65 by Christmas", 50 days from the render date, the target the state resolved.
+ const last = states.at(-1).notes.at(-1);
+ assert.deepEqual([last.text, last.deadline, last.deadlineDate, last.days, last.target], ["LOSE 65", "by Christmas", "2026-12-25", 50, 226.5]);
+ assert.equal(goalText({ kind: "goal", display: "220-240", qualifier: null }), "220–240 LB");
+ assert.equal(goalText({ kind: "goal", display: "250", qualifier: "≈" }), "≈250 LB");
+ // A deadline that names no date: its label, no countdown.
+ const m = clone(MEASURE);
+ const w61 = m.events.findIndex((e) => e.row === "w61");
+ m.events[w61].deadline = "by my birthday";
+ const n61 = goalStates(schedule(m), RENDER).find((s) => s.notes.some((n) => n.deadline === "by my birthday")).notes.at(-1);
+ assert.deepEqual([n61.deadline, n61.deadlineDate, n61.days], ["by my birthday", null, null]);
+ assert.equal(goalStates(schedule(), withDeck({ goals: { max: 2 } })).at(-1).notes.length, 2);
+});
+
+test("peak: a tick per telling of a start in the drift, a count per retelling, the drift from lowest to highest", () => {
+ const states = peakStates(schedule(), RENDER);
+ const last = states.at(-1);
+ assert.deepEqual(last.ticks.map((t) => t.value), MEASURE.totals.peakDrift);
+ const by = Object.fromEntries(last.ticks.map((t) => [t.value, t]));
+ assert.deepEqual([by[390].count, by[390].approx, by[365.7].count], [5, true, 3], "≈390 ×5, 365.7 ×3");
+ assert.equal(last.drift, 24.3);
+ assert.equal(last.told, 11);
+ assert.deepEqual(last.range, states[0].range, "the scale's range is fixed over the cut");
+ assert.ok(last.range[0] < 365.7 && last.range[1] > 390);
+ // `values: "all"` draws every remembered weight (the wedding's 368, the keto 349 and 342).
+ assert.equal(peakStates(schedule(), withDeck({ peak: { values: "all" } })).length, 15);
+ assert.deepEqual(spreadLabels([100, 104, 300], 30, 0, 400), [100, 130, 300]);
+});
+
+test("promise: the days to the clip's in-record date, her claim and the outcome, the words flashed, then counted on to the render date", () => {
+ const states = promiseStates(schedule(), RENDER);
+ assert.deepEqual(states.map((s) => s.rows[0].days), [0, 1, 8, 8, 11, 12, 13]);
+ assert.equal(states[0].at, 712.18, "from the promise on");
+ assert.equal(states[0].rows[0].what, "scale video");
+ assert.equal(states[0].rows[0].claim, null);
+ // Her claim (SYNTHETIC in the fixture): the counterparty, her words fresh, in her voice.
+ const c = states[1].rows[0];
+ assert.deepEqual(c.claim, { speaker: "madamsavvy", date: "2026-10-24", paidOn: null });
+ assert.deepEqual([c.word.speaker, c.word.his, c.fresh], ["madamsavvy", false, true]);
+ assert.match(c.word.text, /I bought the 5 bags/);
+ // The outcome (SYNTHETIC): refunded, and the count keeps running.
+ assert.deepEqual(states[3].rows[0].outcome, { kind: "refunded", date: "2026-10-31" });
+ assert.equal(states[3].rows[0].word.outcome, true);
+ assert.equal(states[4].rows[0].fresh, true, "his check flashes");
+ assert.equal(states[4].rows[0].word.his, true);
+ assert.match(states[4].rows[0].word.text, /pull up a video from three months ago/);
+ assert.equal(states.at(-1).asOf, true);
+ assert.equal(states.at(-1).rows[0].to, MEASURE.asOfRender);
+ assert.equal(states.at(-1).rows[0].kept, false);
+ // From the finale's start when there is one.
+ const fin = promiseStates(schedule(MEASURE, { finale: { from: 730, to: 740 } }), RENDER);
+ assert.equal(fin.at(-2).at, 730);
+ // Kept: green, and the count stops on the day it was kept.
+ const m = clone(MEASURE);
+ for (const s of m.state) for (const p of s.promises ?? []) if (p.outcome) p.outcome = { kind: "kept", date: "2026-10-31", row: "x" };
+ const kept = promiseStates(schedule(m), RENDER);
+ assert.equal(kept.at(-1).rows[0].kept, true);
+ assert.equal(kept.at(-1).rows[0].days, 8, "stopped on 31 Oct");
+ // An older slice's `kept: true` reads as kept.
+ const old = clone(MEASURE);
+ for (const s of old.state) for (const p of s.promises ?? []) { delete p.outcome; p.kept = true; }
+ assert.equal(promiseStates(schedule(old), RENDER)[0].rows[0].kept, true);
+ // The quote instead of the label.
+ assert.match(promiseStates(schedule(), withDeck({ promise: { checks: "quote" } }))[4].rows[0].word.text, /brother just pull up/);
+ // The page: her handle (speakers), her picture when given, else a monogram; the refunded stamp.
+ const page = (o) => promiseHtml(schedule(), withDeck({ promise: { speakers: { madamsavvy: { handle: "MadamSavvy" } } } }), { fonts: {}, ...o }).html;
+ assert.match(page(), /by <b style="color:#E37AB8">@MadamSavvy<\/b>/);
+ assert.match(page(), /class="av mono"[^>]*>M</);
+ assert.match(page({ avatars: { madamsavvy: "assets/avatar-madamsavvy.jpg" } }), /<img class="av" src="assets\/avatar-madamsavvy.jpg"/);
+ assert.match(page(), /<div class="sw">Refunded<\/div><div class="ss">by 31 Oct · no video<\/div>/);
+ assert.match(page(), /@MadamSavvy<\/b> reads/);
+});
+
+test("diet: a stamp per change of regime or number, words alone not slammed, a null after one is No diet", () => {
+ const states = dietStates(schedule(), RENDER);
+ assert.equal(states[0].diet.label, "Some diet");
+ assert.equal(states[0].diet.n, 1);
+ assert.equal(states[0].slam, true);
+ assert.equal(states.at(-1).diet.detail, "Keto + IF + walking");
+ assert.equal(states.at(-1).diet.color, "#4E9BD8");
+ const m = clone(MEASURE);
+ // The state after the last event: no diet (the producer's off-scope rule said so).
+ m.state[m.state.length - 1].diet = null;
+ // And one change of words only.
+ const k = m.state.findIndex((s) => s.diet?.n === 63);
+ m.state[k + 1] = { ...m.state[k + 1], diet: { ...m.state[k].diet, display: "Keto · strict" } };
+ const s2 = dietStates(schedule(m), RENDER);
+ assert.equal(s2.at(-1).diet, null);
+ const words = s2.find((s) => s.diet?.detail === "Keto · strict");
+ assert.equal(words.slam, false);
+ assert.equal(dietStates(schedule(), withDeck({ diet: { labels: { glp1: "Ozempic" } } })).find((s) => s.diet.regime === "glp1").diet.label, "Ozempic");
+ assert.ok(stampSize("Counting calories", 330) < stampSize("Keto", 330));
+});
+
+test("streak: runs through a per-source adapter -- diet runs, lost runs, pledges -- and the chain's states", () => {
+ const cfg = resolveMeasureExtra("streak", RENDER);
+ const runs = dietRuns(MEASURE, cfg);
+ assert.equal(runs.length, 66, "a run per diet (regime and number)");
+ assert.deepEqual([runs[0].name, runs[0].start, runs[0].ended, runs[0].detail], ["Some diet", "2018-02-06", "new", "diet #1"]);
+ assert.equal(runs.at(-1).end, null, "the last is open");
+ for (const r of runs.slice(0, -1)) assert.ok(r.endT >= r.startT && r.end >= r.start);
+ // A diet turned off ends its run "off".
+ const m = clone(MEASURE);
+ m.state[m.state.length - 1].diet = null;
+ assert.equal(dietRuns(m, cfg).at(-1).ended, "off");
+ // Lost runs: the state's runs, each ended at its last claim before the next.
+ const lost = clone(MEASURE);
+ lost.state = lost.state.map((s, i) => ({ ...s, lost: { total: 0, runs: i < 40 ? [{ run: 1, start: "2021-04-30", peak: 13.5 }] : [{ run: 1, start: "2021-04-30", peak: 13.5 }, { run: 2, start: "2023-05-09", peak: 29 }] } }));
+ const lr = lostRunsRuns(lost, cfg, RENDER.palette);
+ assert.deepEqual(lr.map((r) => [r.name, r.start, r.ended, r.detail]), [["Run 1", "2021-04-30", "new", "down 13.5"], ["Run 2", "2023-05-09", null, "down 29"]]);
+ // Pledges (the sobriety video's adapter): a pledge starts a run, a lapse snaps it.
+ const p = { events: [
+ { t: 1, row: "d1", kind: "pledge", date: "2026-01-01", display: "Dry" },
+ { t: 2, row: "d2", kind: "lapse", date: "2026-03-15" },
+ { t: 3, row: "d3", kind: "pledge", date: "2026-04-01", display: "Dry" },
+ ], state: [{}, {}, {}, {}] };
+ const pr = pledgeRuns(p, cfg, RENDER.palette);
+ assert.deepEqual(pr.map((r) => [r.start, r.end, r.ended]), [["2026-01-01", "2026-03-15", "lapse"], ["2026-04-01", null, null]]);
+ // The chain: a state per change, the live run's days with the in-record date; the axis' span to the render date.
+ const { states, span, runs: rs } = streakStates(schedule(), RENDER);
+ assert.equal(span[1], MEASURE.asOfRender);
+ assert.ok(states.some((s) => s.cracked !== null));
+ assert.equal(states.at(-1).live.i, rs.length - 1);
+ assert.equal(streakStates(schedule(), withDeck({ streak: { source: "lostRuns" } })).runs.length, 0, "the trimmed fixture keeps no lost runs");
+});
+
+test("up: from the first event to the end (or the finale), or `hold` seconds after each", () => {
+ assert.deepEqual(upSpans([10, 20], { hold: null, finale: "hide" }, { total: 100 }), [{ in: 10, out: 100 }]);
+ assert.deepEqual(upSpans([10, 20], { hold: 0, finale: "hide" }, { total: 100 }), [{ in: 10, out: 100 }], "0 is stays up (look's null removes the key)");
+ assert.deepEqual(upSpans([10, 20], { hold: null, finale: "hide" }, { total: 100, finale: { from: 90, to: 100 } }), [{ in: 10, out: 90 }]);
+ assert.deepEqual(upSpans([10, 20], { hold: null, finale: "show" }, { total: 100, finale: { from: 90, to: 100 } }), [{ in: 10, out: 100 }]);
+ assert.deepEqual(upSpans([10, 15, 40], { hold: 8, finale: "hide" }, { total: 100 }), [{ in: 10, out: 23 }, { in: 40, out: 48 }]);
+});
+
+test("the pages: a block per state, each an item gated by its own autoAlpha, keyed so unchanged frames are reused", () => {
+ for (const id of IDS) {
+ const { html, items } = PAGES[id](schedule(), RENDER, { fonts: { regular: "assets/DeckSans.ttf", bold: "assets/DeckSansBold.ttf" } });
+ assert.match(html, new RegExp(`<script id="${id}-data" type="application/json">`), id);
+ assert.match(html, new RegExp(`postMessage\\(\\{ type: "${id}:ready"`), id);
+ assert.match(html, /m\.type === "deck:seek"/, id);
+ assert.ok(items.length > 0 && items.every((it) => it.gate?.[1] === "autoAlpha" && html.includes(it.html)), id);
+ const fk = frameKeys({ html, region: id, assets: [], fps: 30, frames: 740 * 30, version: "t", items });
+ assert.ok(fk, `${id}: the frame-key model reads its page`);
+ const distinct = new Set(fk).size;
+ // (The streak cracks 65 times in the fixture's 12 minutes, each a 1.8 s snap: a fifth.)
+ assert.ok(distinct < fk.length / (id === "streak" ? 5 : 10), `${id}: ${distinct} distinct frames of ${fk.length}`);
+ // Before its first event the region is empty: every frame there is the same frame.
+ assert.equal(fk[0], fk[30 * 5], id);
+ }
+});
+
+test("a window of a page is primed, so the renderer's first frame (a seek to 0) draws the cut's state at its start", () => {
+ const { html } = dietHtml(schedule(), RENDER, { fonts: {}, from: 399.4, duration: 1.2 });
+ assert.match(html, /if \(S\.window\) tl\.progress\(1, true\)\.progress\(0, true\);/);
+ // Opt-in: every other cue page is the page it was.
+ const other = cuePageHtml({ id: "x", W: 10, H: 10, fps: 30, css: "", body: "", init: {}, cues: [], whole: { total: 5, from: 1, duration: 2 } });
+ assert.doesNotMatch(other, /progress\(1, true\)/);
+});
+
+test("geometry: an anchor in the footage box, or x/y on the frame, scaled; never off the frame", () => {
+ const f = { x: 173, y: 2, width: 1574, height: 886 };
+ const g = measureExtraGeometry("goals", RENDER);
+ assert.deepEqual([g.x + g.width, g.y + g.height], [f.x + f.width - 24, f.y + f.height - 24], "bottom-right, 24 in");
+ const d = measureExtraGeometry("diet", RENDER);
+ assert.deepEqual([d.x, d.y + d.height], [f.x + 24, f.y + f.height - 24], "bottom-left");
+ const p = measureExtraGeometry("promise", RENDER);
+ assert.equal(p.y, f.y + 24);
+ assert.ok(Math.abs(p.x + p.width / 2 - (f.x + f.width / 2)) <= 1, "top-centre");
+ assert.deepEqual(measureExtraGeometry("peak", withDeck({ peak: { x: 1500, y: 600, scale: 0.5 } })), { x: 1500, y: 600, width: 140, height: 236 });
+ const off = measureExtraGeometry("peak", withDeck({ peak: { x: 1900, y: 1000 } }));
+ assert.ok(off.x + off.width <= 1920 && off.y + off.height <= 1080);
+});
+
+test("settings: true/false or an object of the module's own keys, refused by name; the deck accepts them", () => {
+ assert.deepEqual(validateMeasureExtra("goals", { max: 6, position: "bottom-left", hold: null, color: "#ffcc00" }), []);
+ assert.match(validateMeasureExtra("goals", { maxx: 1 })[0], /goals\.maxx is not a deck setting/);
+ assert.match(validateMeasureExtra("peak", { position: "middle" })[0], /position must be/);
+ assert.match(validateMeasureExtra("peak", { x: 10 }).join(), /x and \.y are set together/);
+ assert.match(validateMeasureExtra("promise", { checks: "both" })[0], /checks must be "label" or "quote"/);
+ assert.deepEqual(validateMeasureExtra("promise", { speakers: { madamsavvy: { handle: "@MadamSavvy", color: "#ff00aa" } }, claimVerb: "bought" }), []);
+ assert.match(validateMeasureExtra("promise", { speakers: { madamsavvy: { name: "x" } } })[0], /speakers\.madamsavvy\.name is not a speaker setting/);
+ assert.match(validateMeasureExtra("diet", { colors: { keto: "orange" } })[0], /colors\.keto must be a #hex colour/);
+ assert.match(validateMeasureExtra("diet", 3)[0], /must be true, false or/);
+ assert.equal(resolveMeasureExtra("goals", withDeck({ goals: false })), null);
+ assert.equal(resolveMeasureExtra("goals", withDeck({ goals: { show: false } })), null);
+ assert.equal(resolveMeasureExtra("goals", RENDER).max, 4);
+ assert.deepEqual(validateChrome(withDeck({ goals: { max: 3 }, peak: true, promise: { finale: "hide" }, diet: false }).chrome, RENDER), []);
+ assert.match(validateChrome(withDeck({ goals: { max: 30 } }).chrome, RENDER).join(), /goals\.max must be a whole number from 1 to 8/);
+ assert.match(validateChrome(withDeck({ gaols: {} }).chrome, RENDER).join(), /gaols is not a deck setting/);
+ assert.match(moduleProblems({ render: withDeck({ diet: { hold: 1 } }), timeline: [] }).diet[0], /diet\.hold must be 0/);
+});
+
+test("the modules: drawn only with a measure slice and something of their own to draw, live in Play, by z", () => {
+ for (const id of IDS) {
+ const m = moduleById(id);
+ assert.equal(m.kind, "overlay-whole");
+ assert.equal(m.region, id);
+ assert.equal(m.configKey, `render.chrome.deck.${id}`);
+ assert.deepEqual(m.play, { clock: "cut", ready: `${id}:ready` });
+ assert.equal(m.on(schedule(), RENDER), true, id);
+ assert.equal(m.on(schedule(null), RENDER), false, id);
+ assert.equal(m.on(schedule(), withDeck({ [id]: false })), false, id);
+ assert.match(m.check(schedule(null), RENDER), /needs a schedule with a measure slice/);
+ const [r] = m.regions(schedule(), { render: RENDER, outDir: "/o" });
+ assert.equal(r.frames, `/o/chrome/${id}-frames`);
+ }
+ assert.ok(playModules().some((m) => m.id === "promise"));
+ assert.ok(moduleById("promise").z > moduleById("finale").z, "the promise clock is drawn over the finale");
+ assert.equal(moduleById("streak").z < moduleById("diet").z, true, "the chain under the badge: either or both");
+ assert.equal(moduleById("goals").on(schedule({ ...MEASURE, events: MEASURE.events.filter((e) => !e.kind.startsWith("goal")) }), RENDER), false);
+ assert.deepEqual(scheduleSlices(schedule()).measure, MEASURE);
+});
+
+test("a deck cut without a measure slice renders exactly as before: none of the four is drawn, no slice, its chrome valid", () => {
+ const MANIFESTS = path.join(HERE, "../../common/testing/draft/manifests");
+ for (const name of ["full", "flips"]) {
+ const m = JSON.parse(readFileSync(path.join(MANIFESTS, `${name}.video.manifest.json`), "utf8"));
+ const sched = estimateSchedule(m);
+ assert.equal(sched.measure, undefined);
+ assert.equal(scheduleSlices(sched).measure, undefined);
+ const drawn = deckOverlays().filter((x) => x.on(sched, m.render)).map((x) => x.id);
+ for (const id of IDS) assert.ok(!drawn.includes(id), `${name}: ${id} not drawn`);
+ const { chrome, ...rest } = m.render;
+ assert.deepEqual(validateChrome(chrome, rest), []);
+ }
+});
diff --git a/umtool/report-to-video/modules/diet.mjs b/umtool/report-to-video/modules/diet.mjs
@@ -0,0 +1,33 @@
+// THE DIET BADGE (module `diet`, region `diet`): the diet he names as a
+// rubber stamp that slams on at each change of regime or diet number ("KETO
+// · DIET #6"), in the regime's ink; a null diet after one fades to "NO DIET".
+// It draws the state's diet as the producer left it (the off-scope rule is
+// the ledger's). Read off the schedule's measure slice
+// (`render.chrome.deck.diet`; measure-extras.mjs dietStates,
+// chrome-measure-extras.mjs dietHtml).
+import { dietHtml } from "../chrome-measure-extras.mjs";
+import { dietStates } from "../measure-extras.mjs";
+import { measureExtraModule } from "./measure-extras-module.mjs";
+
+export default measureExtraModule({
+ id: "diet",
+ z: 66,
+ title: "Diet badge",
+ summary: "The diet he names as a stamp that slams on at each change, with its number; \"No diet\" when the state says so.",
+ states: dietStates,
+ html: dietHtml,
+ needs: "a diet",
+ ui: [
+ { key: "colors", type: "object", label: "Ink per regime ({keto: \"#E0913C\", …})" },
+ { key: "labels", type: "object", label: "Words per regime ({glp1: \"Ozempic\", …})" },
+ ],
+ docs: {
+ intro: "The diet he names as a rubber stamp in a corner of the footage box (`render.chrome.deck.diet`, measure-extras.mjs): at each change of the state's diet -- its regime or its diet number -- a new stamp slams on (in big and turned, onto the page, a shake), the regime's word in its ink and \"DIET #n\" under it with the ledger's words when they say more (\"Keto · 5 carbs a day\"); a change of words alone fades the new stamp in. A null diet after one fades to \"NO DIET\" in grey. It draws `state.diet` as the measure slice gives it -- the off-scope rule (\"off GLP-1\" while on keto is still keto) is the ledger's. The inks default to the quartering-diet regimes' (keto #E0913C, carnivore #C9534B, fasting #4E9BD8, calories #3FA9A0, glp1 #B168C6, other #8E97A8, off #98A29B).",
+ rows: [
+ ["`deck.diet`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, colors, labels}` · default on with a measure slice", "`umtool look <p> deck.diet=false`"],
+ ["`deck.diet.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `bottom-left`, unset, 1", "`umtool look <p> deck.diet.position=top-right`"],
+ ["`deck.diet.hold`, `.finale`", "0 (up from the first diet on) or 2–600 s · `hide` `show` · default 0, `hide`", "`umtool look <p> deck.diet.hold=15`"],
+ ["`deck.diet.colors`, `.labels`", "`{<regime>: #hex}` · `{<regime>: words ≤40}` · default the regimes' inks and names", "`umtool look <p> deck.diet.labels='{\"glp1\":\"Ozempic\"}'`"],
+ ],
+ },
+});
diff --git a/umtool/report-to-video/modules/goals.mjs b/umtool/report-to-video/modules/goals.mjs
@@ -0,0 +1,35 @@
+// THE GOAL STACK (module `goals`, region `goals`): every goal he names drops a
+// sticky note onto a pile in a corner of the footage; the same goal said
+// again merges into its note with a count ("lose 100 ×8") and comes to the
+// front; a goal with a deadline counts down to the render date ("by
+// Christmas · 50 days left · needs 226.5"). Read off the schedule's measure
+// slice (`render.chrome.deck.goals`; measure-extras.mjs goalStates,
+// chrome-measure-extras.mjs goalsHtml).
+import { goalsHtml } from "../chrome-measure-extras.mjs";
+import { goalStates } from "../measure-extras.mjs";
+import { measureExtraModule } from "./measure-extras-module.mjs";
+import { MEASURE_LIMITS } from "./measure-extras-settings.mjs";
+
+export default measureExtraModule({
+ id: "goals",
+ z: 68,
+ title: "Goal stack",
+ summary: "Each goal he names as a sticky note on a pile -- a repeat merged with its count, a deadline counted down to the render date.",
+ states: goalStates,
+ html: goalsHtml,
+ needs: "a goal (a goal or goalLoss row)",
+ ui: [
+ { key: "max", type: "number", min: MEASURE_LIMITS.max[0], max: MEASURE_LIMITS.max[1], label: "Notes shown", default: 4 },
+ { key: "color", type: "color", label: "Paper (default the palette's amber)" },
+ { key: "countdown", type: "boolean", label: "Count a deadline down to the render date", default: true },
+ ],
+ docs: {
+ intro: "A sticky note per goal on a pile in a corner of the footage box, read off the schedule's `measure` slice (`render.chrome.deck.goals`, measure-extras.mjs): each goal or goalLoss event drops one, turned a little, onto the pile; the same goal in the same words (\"lose 100\") merges into its note with a count (\"×8\") and comes to the front; `max` notes show, the newest in front, with the goals set so far under them. A goal with a `deadline` counts down to `measure.asOfRender` (\"by Christmas · 50 days left · needs 226.5\"): Christmas is the next 25 Dec from the day he said it, \"next year\" a year on, a named year that year; words that name no date (\"by my birthday\") keep their label and no countdown. On whenever the cut has a measure slice with a goal on camera; `false` turns it off. Up for `hold` seconds after each goal (default 20), the pile as it stands each time. The four measure extras sit at anchors of the footage box by default, clear of the instrument panel's right column and of the top-left, where the streams' face cam most often is (the diet badge bottom-left, the goal stack bottom-right, the moving start top-right, the promise clock top-centre); `position` or `x`/`y` move one.",
+ rows: [
+ ["`deck.goals`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown}` · default on with a measure slice", "`umtool look <p> deck.goals=false`"],
+ ["`deck.goals.position`, `.x`/`.y`, `.scale`", "`top-left` `top-right` `bottom-left` `bottom-right` `top-center` `bottom-center` · design px · 0.5–2 · default `bottom-right`, unset, 1", "`umtool look <p> deck.goals.position=bottom-left`"],
+ ["`deck.goals.max`, `.color`, `.countdown`", "1–8 notes · #hex paper · bool · default 4, the palette's amber, `true`", "`umtool look <p> deck.goals.max=6`"],
+ ["`deck.goals.hold`, `.finale`", "0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide`", "`umtool look <p> deck.goals.hold=0`"],
+ ],
+ },
+});
diff --git a/umtool/report-to-video/modules/index.mjs b/umtool/report-to-video/modules/index.mjs
@@ -31,12 +31,17 @@ import chapter from "./chapter.mjs";
import status from "./status.mjs";
import chat from "./chat.mjs";
import sectionTitle from "./section-title.mjs";
+import diet from "./diet.mjs";
+import peak from "./peak.mjs";
+import goals from "./goals.mjs";
+import promise from "./promise.mjs";
+import streak from "./streak.mjs";
export { assertRegion, defineModule, MODULE_KINDS, MODULE_SLOTS, PLAY_CLOCKS, REGION_PLACEMENTS };
/** Every module, by z (stack order), then id. */
export const MODULES = Object.freeze(
- [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, intro, blur, pair, chapter, status, chat]
+ [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, intro, blur, pair, chapter, status, chat, diet, peak, goals, promise, streak]
.sort((a, b) => a.z - b.z || a.id.localeCompare(b.id)),
);
diff --git a/umtool/report-to-video/modules/measure-extras-module.mjs b/umtool/report-to-video/modules/measure-extras-module.mjs
@@ -0,0 +1,83 @@
+// THE MEASURE EXTRAS' MODULE SHAPE (weight video rev 9, lane measure-extras):
+// the goal stack, the moving start, the promise clock and the diet badge are
+// four modules of one shape -- a whole-cut overlay in a corner of the footage
+// box (or at `x`/`y`), its page chrome-measure-extras.mjs's, its states
+// measure-extras.mjs's, its settings measure-extras-settings.mjs's at
+// `render.chrome.deck.<id>` -- so they are made here, once, and each module
+// file says only what is its own.
+import path from "node:path";
+
+import { measureExtraGeometry, measureOf } from "../measure-extras.mjs";
+import { assertRegion, defineModule } from "./contract.mjs";
+import {
+ MEASURE_DEFAULTS, MEASURE_FINALE, MEASURE_LIMITS, MEASURE_POSITIONS, resolveMeasureExtra,
+} from "./measure-extras-settings.mjs";
+import { settingsOf } from "./settings.mjs";
+
+/** The ui fields every one of the four has: on, where, how big, how long, over the finale. */
+const commonUi = (id) => [
+ { key: "show", type: "boolean", label: "Drawn (with a measure slice)", default: true },
+ { key: "position", type: "enum", options: MEASURE_POSITIONS, label: "Anchor in the footage", default: MEASURE_DEFAULTS[id].position },
+ { key: "x", type: "number", min: MEASURE_LIMITS.x[0], max: MEASURE_LIMITS.x[1], label: "x (design px, with y: overrides the anchor)" },
+ { key: "y", type: "number", min: MEASURE_LIMITS.y[0], max: MEASURE_LIMITS.y[1], label: "y (design px)" },
+ { key: "scale", type: "number", min: MEASURE_LIMITS.scale[0], max: MEASURE_LIMITS.scale[1], step: 0.05, label: "Scale", default: 1 },
+ { key: "hold", type: "number", min: MEASURE_LIMITS.hold[0], max: MEASURE_LIMITS.hold[1], label: "Seconds up after each event (0: stays up)", ...(MEASURE_DEFAULTS[id].hold !== null ? { default: MEASURE_DEFAULTS[id].hold } : {}) },
+ { key: "finale", type: "enum", options: MEASURE_FINALE, label: "Over the finale", default: MEASURE_DEFAULTS[id].finale },
+];
+
+/**
+ * One of the four, as a module.
+ *
+ * @param {{ id: "goals" | "peak" | "promise" | "diet", z: number, title: string, summary: string,
+ * states: (schedule: any, render: any) => any[], html: (schedule: any, render: any, opts: any) => { html: string, items: any[] },
+ * ui?: any[], docs: { intro: string, rows: string[][] }, needs: string,
+ * pageOpts?: (ctx: any) => Promise<Record<string, any>> }} spec
+ */
+export function measureExtraModule(spec) {
+ const { id } = spec;
+ const drawn = (schedule, render) => !!measureOf(schedule) && !!resolveMeasureExtra(id, render) && spec.states(schedule, render).length > 0;
+ return defineModule({
+ id,
+ version: 1,
+ z: spec.z,
+ kind: "overlay-whole",
+ slot: "footage",
+ title: spec.title,
+ summary: spec.summary,
+ configKey: `render.chrome.deck.${id}`,
+ defaults: MEASURE_DEFAULTS[id],
+ validate: settingsOf(id).validate,
+ resolve: (render) => resolveMeasureExtra(id, render),
+ ui: [...commonUi(id), ...(spec.ui ?? [])],
+ docs: { heading: spec.title, intro: spec.docs.intro, rows: spec.docs.rows },
+ region: id,
+ workers: "narrow",
+ noun: `the ${spec.title.toLowerCase()}'s`,
+ on: drawn,
+ check: (schedule, render) => {
+ if (!measureOf(schedule)) return `the ${id} region needs a schedule with a measure slice (a measure ledger and render.chrome.deck.measure)`;
+ if (!resolveMeasureExtra(id, render)) return `the ${id} region is off (render.chrome.deck.${id})`;
+ return spec.states(schedule, render).length ? null : `the ${id} region needs ${spec.needs} on camera in the measure slice`;
+ },
+ async page(ctx) {
+ const fonts = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true });
+ // The condensed display face the video's other chrome uses, when the render names one.
+ const display = ctx.render.fontDisplay
+ ? await ctx.asset(ctx.render.fontDisplay, `MeasureDisplay${path.extname(ctx.render.fontDisplay) || ".ttf"}`).catch(() => null)
+ : null;
+ const extra = spec.pageOpts ? await spec.pageOpts(ctx) : {};
+ return spec.html(ctx.schedule, ctx.render, { ...extra, fonts: { ...fonts, ...(display ? { display } : {}) }, from: ctx.from, duration: ctx.duration });
+ },
+ regions(schedule, { render, outDir, frames = null }) {
+ return [assertRegion({
+ name: id, frames: frames ?? path.join(outDir, "chrome", `${id}-frames`),
+ ...measureExtraGeometry(id, render, { feed: schedule.layout === "feed" }),
+ })];
+ },
+ preview: (_slice, { render }) => ({ region: id, geometry: measureExtraGeometry(id, render) }),
+ // Its page is its live preview: Play the cut seeks it in the cut's seconds (contract.mjs, PLAY).
+ play: { clock: "cut", ready: `${id}:ready` },
+ // A cue interpreter: each state a block, keyed only while it is shown (frame-keys.mjs).
+ frameKeys: { data: `${id}-data`, omit: ["init", "cues", "window", "total", "ids"] },
+ });
+}
diff --git a/umtool/report-to-video/modules/measure-extras-settings.mjs b/umtool/report-to-video/modules/measure-extras-settings.mjs
@@ -0,0 +1,218 @@
+// THE MEASURE EXTRAS' SETTINGS (weight video rev 9, lane measure-extras): the
+// four small modules that read the schedule's `measure` slice beside the scale
+// dial -- the goal stack (`goals`), the moving start (`peak`), the promise
+// clock (`promise`) and the diet badge (`diet`). Their defaults and validators,
+// the one copy. A LEAF like settings.mjs (deck.mjs imports it through
+// SETTINGS), so it imports nothing.
+//
+// render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown }
+// render.chrome.deck.peak { show, position, x, y, scale, hold, finale, title, color, values }
+// render.chrome.deck.promise { show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks, speakers, claimVerb, claimColor }
+// render.chrome.deck.diet { show, position, x, y, scale, hold, finale, colors, labels }
+// render.chrome.deck.streak { show, position, x, y, scale, hold, finale, source, axis, title, color, colors, labels }
+//
+// Each is ON whenever the cut has a measure slice (the build writes one only
+// for a manifest with a measure ledger and `deck.measure` set) and something
+// of its own to draw; `false` (or `show: false`) turns it off, `true` is the
+// defaults. Absent, the module draws with its defaults -- and a cut with no
+// measure slice draws none of them, so it renders exactly as before.
+//
+// WHERE THEY SIT. The scale-dial lane's instrument panel takes the right
+// column (the dial in its top ~600 px, the odometer and the trail under it),
+// so these four default to anchors of the FOOTAGE BOX, clear of it -- and
+// clear of the top-left, where the streams' face cam most often sits: the
+// diet badge bottom-left, the goal stack bottom-right, the moving start
+// top-right (only for a few seconds after each telling), the promise clock
+// top-centre (from the promise on, the last beat). `position` moves one to another
+// anchor of the footage box; `x`/`y` (design pixels on the 1920×1080 frame)
+// put its top-left corner anywhere -- inside the panel column, say -- and
+// `scale` sizes it.
+
+/** The anchors in the footage box a module may sit at (`position`). */
+export const MEASURE_POSITIONS = Object.freeze(["top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center"]);
+
+/** What a module does over the finale's window (`finale`): hidden under it, or drawn over it. */
+export const MEASURE_FINALE = Object.freeze(["hide", "show"]);
+
+/** Which remembered weights the moving start draws (`peak.values`): the totals' drift values, or every one. */
+export const PEAK_VALUES = Object.freeze(["drift", "all"]);
+
+/** Where the streak chain's runs come from (`streak.source`): diet runs, his lost-weight runs, pledges (the sobriety video's; adapter only). */
+export const STREAK_SOURCES = Object.freeze(["diet", "lostRuns", "pledges"]);
+
+/** How the streak chain lays its runs (`streak.axis`): to scale on the in-record dates, or one after another (√ of their length). */
+export const STREAK_AXES = Object.freeze(["date", "runs"]);
+
+/** What a promise check's line quotes (`promise.checks`): the ledger row's label, or its transcript quote. */
+export const PROMISE_CHECKS = Object.freeze(["label", "quote"]);
+
+/** The diet regimes the ledger names (ledgerSchema.regimes), and what the badge calls each. */
+export const DIET_LABELS = Object.freeze({
+ keto: "Keto", carnivore: "Carnivore", fasting: "Fasting", calories: "Counting calories",
+ glp1: "GLP-1", other: "Some diet", off: "No diet",
+});
+
+/** Each regime's ink (the quartering-diet ledgerSchema's colours). */
+export const DIET_COLORS = Object.freeze({
+ keto: "#E0913C", carnivore: "#C9534B", fasting: "#4E9BD8", calories: "#3FA9A0",
+ glp1: "#B168C6", other: "#8E97A8", off: "#98A29B",
+});
+
+/** The needle's red (the contract's ~#ff5a4e): the moving start's drift, an unkept promise. */
+export const MEASURE_RED = "#FF5A4E";
+
+/** Every module's bounds. */
+export const MEASURE_LIMITS = Object.freeze({
+ scale: Object.freeze([0.5, 2]),
+ hold: Object.freeze([2, 600]),
+ x: Object.freeze([0, 1920]),
+ y: Object.freeze([0, 1080]),
+ max: Object.freeze([1, 8]),
+ text: 40,
+ quote: 160,
+});
+
+const COMMON = Object.freeze({ show: true, position: "top-left", x: null, y: null, scale: 1, hold: null, finale: "hide" });
+
+/** Each module's settings and their defaults. */
+export const MEASURE_DEFAULTS = Object.freeze({
+ // The sticky notes pile in the bottom-right corner, up for `hold` seconds
+ // after each goal; `max` notes show, the newest in front; `color` is the
+ // paper (default the palette's amber).
+ goals: Object.freeze({ ...COMMON, position: "bottom-right", hold: 20, max: 4, color: null, countdown: true }),
+ // The moving start: up for `hold` seconds after each retelling.
+ peak: Object.freeze({ ...COMMON, position: "top-right", hold: 12, title: "The start keeps moving", color: null, values: "drift" }),
+ // The promise clock: up from the promise on, through the finale.
+ // Another party on it (her claims: CONTRACT addendum): `speakers` names each
+ // by ledger speaker -- `{ madamsavvy: { handle: "MadamSavvy", color } }` -- the
+ // handle also finding her picture in the manifest's postAvatars (else a
+ // monogram); `claimVerb` is what her claim says she did; `claimColor` her ink.
+ promise: Object.freeze({ ...COMMON, position: "top-center", finale: "show", label: null, verb: "offered", kept: "Posted", broken: "None posted", checks: "label",
+ speakers: Object.freeze({}), claimVerb: "paid", claimColor: "#E37AB8" }),
+ // The diet badge: up from the first diet on, re-stamped at every change.
+ diet: Object.freeze({ ...COMMON, position: "bottom-left", colors: Object.freeze({}), labels: Object.freeze({}) }),
+ // The streak chain: bottom-centre, between the diet badge and the goal
+ // stack, so either or both can run. `title` null is the source's own word.
+ streak: Object.freeze({ ...COMMON, position: "bottom-center", source: "diet", axis: "date", title: null, color: null, colors: Object.freeze({}), labels: Object.freeze({}) }),
+});
+
+/** The four ids, in the order they are drawn. */
+export const MEASURE_EXTRAS = Object.freeze(["diet", "peak", "goals", "promise", "streak"]);
+
+const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
+const numIn = (v, lo, hi) => typeof v === "number" && Number.isFinite(v) && v >= lo && v <= hi;
+const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
+
+/**
+ * A module's settings with every default filled in, or null when it is off
+ * (`false`, or `show: false`). Absent and `true` are the defaults.
+ *
+ * @param {"goals" | "peak" | "promise" | "diet"} id
+ * @param {any} render
+ */
+export function resolveMeasureExtra(id, render) {
+ const base = MEASURE_DEFAULTS[id];
+ const v = render?.chrome?.deck?.[id];
+ if (v === false) return null;
+ const own = isObj(v) ? v : {};
+ const out = { ...base, ...own };
+ if (id === "diet" || id === "streak") {
+ out.colors = { ...DIET_COLORS, ...(isObj(own.colors) ? own.colors : {}) };
+ out.labels = { ...DIET_LABELS, ...(isObj(own.labels) ? own.labels : {}) };
+ }
+ return out.show === false ? null : out;
+}
+
+function text(v, max, where, errors, { nullable = true } = {}) {
+ if (v === undefined || (nullable && v === null)) return;
+ if (typeof v !== "string" || !v.trim()) errors.push(`${where} must be words`);
+ else if (/[\r\n]/.test(v)) errors.push(`${where} must be one line`);
+ else if ([...v].length > max) errors.push(`${where} is ${[...v].length} characters (at most ${max})`);
+}
+
+const color = (v, where, errors) => {
+ if (v === undefined || v === null) return;
+ if (typeof v !== "string" || !HEX_RE.test(v)) errors.push(`${where} must be a #hex colour`);
+};
+
+/**
+ * Every reason `render.chrome.deck.<id>` cannot be drawn, as sentences (empty:
+ * it can). `true`/`false` or an object of the module's own keys.
+ *
+ * @param {"goals" | "peak" | "promise" | "diet"} id
+ * @returns {string[]}
+ */
+export function validateMeasureExtra(id, v, where = `render.chrome.deck.${id}`) {
+ if (v === undefined || typeof v === "boolean") return [];
+ const keys = Object.keys(MEASURE_DEFAULTS[id]);
+ if (!isObj(v)) return [`${where} must be true, false or { ${keys.join(", ")} }`];
+ const errors = [];
+ const L = MEASURE_LIMITS;
+ for (const k of Object.keys(v)) if (!keys.includes(k)) errors.push(`${where}.${k} is not a deck setting (${keys.join(", ")})`);
+ if (v.show !== undefined && typeof v.show !== "boolean") errors.push(`${where}.show must be true or false`);
+ if (v.position !== undefined && !MEASURE_POSITIONS.includes(v.position)) {
+ errors.push(`${where}.position must be ${MEASURE_POSITIONS.map((p) => `"${p}"`).join(", ")}`);
+ }
+ for (const k of ["x", "y"]) {
+ if (v[k] !== undefined && v[k] !== null && !numIn(v[k], L[k][0], L[k][1])) {
+ errors.push(`${where}.${k} must be null or from ${L[k][0]} to ${L[k][1]} (design pixels on the 1920×1080 frame)`);
+ }
+ }
+ if ((v.x === undefined || v.x === null) !== (v.y === undefined || v.y === null)) errors.push(`${where}.x and .y are set together (or neither)`);
+ if (v.scale !== undefined && !numIn(v.scale, L.scale[0], L.scale[1])) errors.push(`${where}.scale must be from ${L.scale[0]} to ${L.scale[1]}`);
+ // 0 (or null in the file) is "stays up from its first event on": 0 because
+ // `umtool look … hold=null` removes the key, which is the default again.
+ if (v.hold !== undefined && v.hold !== null && v.hold !== 0 && !numIn(v.hold, L.hold[0], L.hold[1])) {
+ errors.push(`${where}.hold must be 0 (up from its first event on) or from ${L.hold[0]} to ${L.hold[1]} seconds`);
+ }
+ if (v.finale !== undefined && !MEASURE_FINALE.includes(v.finale)) errors.push(`${where}.finale must be "hide" or "show"`);
+ if (id === "goals") {
+ if (v.max !== undefined && !(Number.isInteger(v.max) && numIn(v.max, L.max[0], L.max[1]))) {
+ errors.push(`${where}.max must be a whole number from ${L.max[0]} to ${L.max[1]}`);
+ }
+ color(v.color, `${where}.color`, errors);
+ if (v.countdown !== undefined && typeof v.countdown !== "boolean") errors.push(`${where}.countdown must be true or false`);
+ }
+ if (id === "peak") {
+ text(v.title, L.text, `${where}.title`, errors, { nullable: false });
+ color(v.color, `${where}.color`, errors);
+ if (v.values !== undefined && !PEAK_VALUES.includes(v.values)) errors.push(`${where}.values must be "drift" or "all"`);
+ }
+ if (id === "promise") {
+ for (const k of ["label", "verb", "kept", "broken"]) text(v[k], L.text, `${where}.${k}`, errors, { nullable: k === "label" });
+ if (v.checks !== undefined && !PROMISE_CHECKS.includes(v.checks)) errors.push(`${where}.checks must be "label" or "quote"`);
+ text(v.claimVerb, L.text, `${where}.claimVerb`, errors, { nullable: false });
+ color(v.claimColor, `${where}.claimColor`, errors);
+ if (v.speakers !== undefined) {
+ if (!isObj(v.speakers)) errors.push(`${where}.speakers must be { <speaker>: { handle, color } }`);
+ else {
+ for (const [k, x] of Object.entries(v.speakers)) {
+ const at = `${where}.speakers.${k}`;
+ if (!/^[a-z0-9][a-z0-9_.-]{0,63}$/i.test(k)) { errors.push(`${at} is not a speaker key`); continue; }
+ if (!isObj(x)) { errors.push(`${at} must be { handle, color }`); continue; }
+ for (const kk of Object.keys(x)) if (!["handle", "color"].includes(kk)) errors.push(`${at}.${kk} is not a speaker setting (handle, color)`);
+ if (x.handle !== undefined && !(typeof x.handle === "string" && /^@?[A-Za-z0-9_.-]{1,64}$/.test(x.handle))) errors.push(`${at}.handle must be a handle`);
+ color(x.color, `${at}.color`, errors);
+ }
+ }
+ }
+ }
+ if (id === "streak") {
+ if (v.source !== undefined && !STREAK_SOURCES.includes(v.source)) errors.push(`${where}.source must be ${STREAK_SOURCES.map((x) => `"${x}"`).join(", ")}`);
+ if (v.axis !== undefined && !STREAK_AXES.includes(v.axis)) errors.push(`${where}.axis must be "date" or "runs"`);
+ text(v.title, L.text, `${where}.title`, errors);
+ color(v.color, `${where}.color`, errors);
+ }
+ if (id === "diet" || id === "streak") {
+ for (const k of ["colors", "labels"]) {
+ if (v[k] === undefined) continue;
+ if (!isObj(v[k])) { errors.push(`${where}.${k} must be { <regime>: … }`); continue; }
+ for (const [r, x] of Object.entries(v[k])) {
+ if (!/^[a-z][a-z0-9_-]{0,23}$/.test(r)) errors.push(`${where}.${k}.${r} is not a regime key`);
+ else if (k === "colors") color(x, `${where}.colors.${r}`, errors);
+ else text(x, L.text, `${where}.labels.${r}`, errors, { nullable: false });
+ }
+ }
+ }
+ return errors;
+}
diff --git a/umtool/report-to-video/modules/peak.mjs b/umtool/report-to-video/modules/peak.mjs
@@ -0,0 +1,34 @@
+// THE MOVING START (module `peak`, region `peak`): the weight he says he
+// started at, as he retells it -- each telling a tick on a small vertical
+// scale with its value and its count (365.7 → 370 → 385 → 387 → ≈390 ×5), the
+// drift from the lowest to the highest bracketed. Read off the schedule's
+// measure slice (`render.chrome.deck.peak`; measure-extras.mjs peakStates,
+// chrome-measure-extras.mjs peakHtml).
+import { peakHtml } from "../chrome-measure-extras.mjs";
+import { peakStates } from "../measure-extras.mjs";
+import { measureExtraModule } from "./measure-extras-module.mjs";
+import { PEAK_VALUES } from "./measure-extras-settings.mjs";
+
+export default measureExtraModule({
+ id: "peak",
+ z: 67,
+ title: "Moving start",
+ summary: "The starting weight as he retells it: a tick per telling on a small scale, a count per repeat, the drift bracketed.",
+ states: peakStates,
+ html: peakHtml,
+ needs: "a remembered starting weight",
+ ui: [
+ { key: "title", type: "text", label: "Heading", default: "The start keeps moving" },
+ { key: "values", type: "enum", options: PEAK_VALUES, label: "Which remembered weights", default: "drift" },
+ { key: "color", type: "color", label: "The drift's colour (default the needle's red)" },
+ ],
+ docs: {
+ intro: "The weight he says he started at, as he retells it (`render.chrome.deck.peak`, measure-extras.mjs): each remembered weight that is one of the measure totals' `peakDrift` values (`values: \"drift\"`; `all` draws every remembered weight) adds a tick on a small vertical scale -- the scale's range is fixed over the whole cut, so nothing rescales -- with its value, a retelling of the same number a count (\"≈390 ×5\"), the newest lit; the spread from the lowest to the highest so far is bracketed in red and written under it (\"+24.3 lb\"). Up for `hold` seconds after each telling (default 12).",
+ rows: [
+ ["`deck.peak`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, title, values, color}` · default on with a measure slice", "`umtool look <p> deck.peak=false`"],
+ ["`deck.peak.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `top-right`, unset, 1", "`umtool look <p> deck.peak.scale=0.9`"],
+ ["`deck.peak.hold`, `.finale`", "0 (stays up) or 2–600 s · `hide` `show` · default 12, `hide`", "`umtool look <p> deck.peak.hold=0`"],
+ ["`deck.peak.title`, `.values`, `.color`", "≤40 · `drift` `all` · #hex · default \"The start keeps moving\", `drift`, #FF5A4E", "`umtool look <p> deck.peak.values=all`"],
+ ],
+ },
+});
diff --git a/umtool/report-to-video/modules/promise.mjs b/umtool/report-to-video/modules/promise.mjs
@@ -0,0 +1,72 @@
+// THE PROMISE CLOCK (module `promise`, region `promise`): from a promise on,
+// "SCALE VIDEO OFFERED 23 OCT · 13 DAYS · NONE POSTED" -- the days counted to
+// the in-record date of what is on screen, then on to the render date in the
+// finale; each check's words flashed under it; kept, "POSTED" in green.
+// Drawn over the finale by default (z 95). Read off the schedule's measure
+// slice (`render.chrome.deck.promise`; measure-extras.mjs promiseStates,
+// chrome-measure-extras.mjs promiseHtml).
+import path from "node:path";
+
+import { promiseHtml } from "../chrome-measure-extras.mjs";
+import { measureOf, promiseStates } from "../measure-extras.mjs";
+import { avatarEntryOf } from "../post-avatars.mjs";
+import { measureExtraModule } from "./measure-extras-module.mjs";
+import { PROMISE_CHECKS, resolveMeasureExtra } from "./measure-extras-settings.mjs";
+
+/**
+ * The other speakers on a promise (her claims, an outcome she reports): each
+ * one's handle -- `promise.speakers[k].handle`, else the manifest's postAvatars
+ * key that matches -- and her picture from postAvatars, copied in beside the
+ * page. None found: the page draws a monogram.
+ */
+async function speakerOpts(ctx) {
+ const m = measureOf(ctx.schedule);
+ const cfg = resolveMeasureExtra("promise", ctx.render);
+ const speakers = new Set();
+ for (const e of m?.events ?? []) if (e?.speaker && (e.kind === "promiseClaim" || e.kind === "promiseOutcome")) speakers.add(e.speaker);
+ for (const s of m?.state ?? []) for (const p of s?.promises ?? []) for (const c of p?.claims ?? []) if (c?.speaker) speakers.add(c.speaker);
+ const handles = {};
+ const avatars = {};
+ for (const sp of speakers) {
+ const want = cfg?.speakers?.[sp]?.handle ?? sp;
+ const entry = avatarEntryOf(ctx.manifest, want) ?? avatarEntryOf(ctx.manifest, sp);
+ handles[sp] = String(cfg?.speakers?.[sp]?.handle ?? entry?.[0] ?? sp).replace(/^@/, "");
+ if (entry?.[1]?.src && ctx.manifestDir) {
+ const src = path.resolve(ctx.manifestDir, entry[1].src);
+ const url = await ctx.asset(src, `avatar-${sp.replace(/[^A-Za-z0-9_-]/g, "_")}${path.extname(src) || ".jpg"}`).catch(() => null);
+ if (url) avatars[sp] = url;
+ }
+ }
+ return { handles, avatars };
+}
+
+export default measureExtraModule({
+ id: "promise",
+ z: 95,
+ title: "Promise clock",
+ summary: "Days since a promise -- to the clip on screen, then to the render date -- with each check's words and whether it was kept.",
+ states: promiseStates,
+ html: promiseHtml,
+ pageOpts: speakerOpts,
+ needs: "a promise row",
+ ui: [
+ { key: "label", type: "text", label: "What was promised (default the row's display)" },
+ { key: "verb", type: "text", label: "Verb", default: "offered" },
+ { key: "kept", type: "text", label: "Kept", default: "Posted" },
+ { key: "broken", type: "text", label: "Not kept", default: "None posted" },
+ { key: "checks", type: "enum", options: PROMISE_CHECKS, label: "A check's words", default: "label" },
+ { key: "claimVerb", type: "text", label: "What her claim says she did", default: "paid" },
+ { key: "claimColor", type: "color", label: "Her ink (another speaker's claims)", default: "#E37AB8" },
+ { key: "speakers", type: "object", label: "Speakers ({madamsavvy: {handle: \"MadamSavvy\", color: \"#E37AB8\"}})" },
+ ],
+ docs: {
+ intro: "A days-since counter for a promise (`render.chrome.deck.promise`, measure-extras.mjs), from the promise's event on: \"SCALE VIDEO OFFERED 23 OCT\", the days from the day he said it to the in-record date of the latest event on screen, and \"NONE POSTED\" in red until a row says it was kept (\"POSTED\", green). Each promise check's words come in under it with a flash (`checks`: the row's `label`, or its transcript `quote`). From the finale's start -- else 4 s after the last event -- the days count on, a day a step, to `measure.asOfRender`. Another party on the promise (CONTRACT addendum: a ledger row with a `speaker`, a `promise_claim`) shows under the header -- \"PAID 23 OCT BY @MadamSavvy\" (`claimVerb`, her `paidOn` else the claim's date), with her picture from the manifest's `postAvatars` (`umtool posts avatar`; else a monogram) -- and her words flash under the clock in her ink (`claimColor`, or `speakers.<k>.color`), his in amber. An outcome (`promise_outcome`) is drawn too: `refunded` slams on a stamp \"REFUNDED · by 31 Oct · no video\" while the days keep counting to the render date, `withdrawn` likewise in grey, `kept` turns it green (\"POSTED\") and stops the count on the day. Laid over the finale (z 95) unless `finale: \"hide\"`.",
+ rows: [
+ ["`deck.promise`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks}` · default on with a measure slice", "`umtool look <p> deck.promise=false`"],
+ ["`deck.promise.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `top-center`, unset, 1", "`umtool look <p> deck.promise.position=bottom-center`"],
+ ["`deck.promise.hold`, `.finale`", "0 (stays up) or 2–600 s · `hide` `show` · default 0, `show`", "`umtool look <p> deck.promise.finale=hide`"],
+ ["`deck.promise.label`, `.verb`, `.kept`, `.broken`, `.checks`", "≤40 each · `label` `quote` · default the row's display, \"offered\", \"Posted\", \"None posted\", `label`", "`umtool look <p> deck.promise.label='scale video'`"],
+ ["`deck.promise.speakers`, `.claimVerb`, `.claimColor`", "`{<speaker>: {handle, color}}` · ≤40 · #hex · default `{}` (the postAvatars handle), \"paid\", #E37AB8", "`umtool look <p> deck.promise.speakers='{\"madamsavvy\":{\"handle\":\"MadamSavvy\"}}'`"],
+ ],
+ },
+});
diff --git a/umtool/report-to-video/modules/rail.test.mjs b/umtool/report-to-video/modules/rail.test.mjs
@@ -47,5 +47,5 @@ test("rail settings: spacing, pitch, and the deck's other keys refused by name",
assert.equal(resolveDeck(render({})).pip.pitch, undefined, "no pitch unless set: the deck resolves as it did");
assert.equal(rail.resolve(render({ spacing: "pitch" })).pip.pitch, 28);
assert.equal(rail.validate, settingsOf("rail").validate);
- assert.deepEqual(SETTINGS.map((s) => s.id), ["stamp", "threads", "flips", "stats", "fx", "chat", "pair", "chapter", "status", "finale", "claims", "measure", "counter", "shell", "rail", "section-title", "subtitle", "qr", "popup-posts"]);
+ assert.deepEqual(SETTINGS.map((s) => s.id), ["stamp", "threads", "flips", "stats", "fx", "chat", "pair", "chapter", "status", "finale", "claims", "measure", "counter", "shell", "rail", "section-title", "subtitle", "qr", "popup-posts", "diet", "peak", "goals", "promise", "streak"]);
});
diff --git a/umtool/report-to-video/modules/registry.test.mjs b/umtool/report-to-video/modules/registry.test.mjs
@@ -46,8 +46,9 @@ test("the registry: unique ids and regions, sorted by z, the deck's overlays in
const ids = MODULES.map((m) => m.id);
assert.equal(new Set(ids).size, ids.length);
for (let i = 1; i < MODULES.length; i += 1) assert.ok(MODULES[i - 1].z <= MODULES[i].z);
- // The order the build has always laid them in: the finale last.
- assert.deepEqual(deckOverlays().map((m) => m.region), ["deck", "feed", "posts", "stamp", "chat", "stats", "pair", "status", "fx", "threads", "flips", "chapter", "finale"]);
+ // The order the build has always laid them in: the finale last of all but the
+ // promise clock, which is drawn over it (the measure extras, z 65-68 and 95).
+ assert.deepEqual(deckOverlays().map((m) => m.region), ["deck", "feed", "posts", "stamp", "chat", "stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "flips", "chapter", "finale", "promise"]);
assert.equal(moduleOfRegion("deck").id, "shell");
assert.equal(regionModule("posts").id, "popup-posts");
assert.throws(() => regionModule("nope"), /unknown chrome region: nope/);
@@ -151,7 +152,7 @@ test("play: a live-preview contract only an overlay with a page and regions decl
assert.throws(() => defineModule({ ...base, play: { clock: "cut", ready: "x" } }), /play must be/);
assert.throws(() => defineModule({ ...base, page: undefined, play: { clock: "cut", ready: "x:ready" } }), /only an overlay with a page/);
assert.throws(() => defineModule({ ...base, kind: "segment", play: { clock: "cut", ready: "x:ready" } }), /only an overlay with a page/);
- assert.deepEqual(playModules().map((m) => m.id), ["stats", "pair", "status", "fx", "threads", "flips", "chapter"]);
+ assert.deepEqual(playModules().map((m) => m.id), ["stats", "pair", "status", "fx", "streak", "diet", "peak", "goals", "threads", "flips", "chapter", "promise"]);
for (const m of playModules()) assert.equal(m.play.ready, `${m.region}:ready`, m.id);
});
diff --git a/umtool/report-to-video/modules/settings.mjs b/umtool/report-to-video/modules/settings.mjs
@@ -19,6 +19,7 @@ import { validateFx } from "../fx.mjs";
import { validateChat } from "../chat.mjs";
import { validateChapter, validatePair, validateStatus } from "./story-settings.mjs";
import { MARKER_LEVELS, MARKER_LIMITS } from "../marker-limits.mjs";
+import { MEASURE_EXTRAS, validateMeasureExtra } from "./measure-extras-settings.mjs";
import { validateMeasureSettings } from "../measure-slice.mjs";
/**
@@ -481,6 +482,12 @@ export const SETTINGS = Object.freeze([
{ id: "subtitle", key: "deck", configKey: "render.chrome.deck.subtitle", deck: true, whole: true, validate: validateSubtitleSettings },
{ id: "qr", key: "deck", configKey: "render.chrome.deck.qr", deck: true, whole: true, validate: validateQrSettings },
{ id: "popup-posts", key: "deck", configKey: "render.chrome.deck.posts", deck: true, whole: true, validate: validatePostsSettings },
+ // The measure extras (measure-extras-settings.mjs): the goal stack, the moving
+ // start, the promise clock and the diet badge, each its own deck key.
+ ...MEASURE_EXTRAS.map((id) => ({
+ id, key: `deck.${id}`, configKey: `render.chrome.deck.${id}`, deck: true,
+ validate: (v, { where }) => validateMeasureExtra(id, v, `${where}.${id}`),
+ })),
].map((s) => Object.freeze(s)));
/** A module's settings entry, or undefined. */
diff --git a/umtool/report-to-video/modules/streak.mjs b/umtool/report-to-video/modules/streak.mjs
@@ -0,0 +1,41 @@
+// THE STREAK CHAIN (module `streak`, region `streak`): a chain per run along
+// the in-record dates -- a run starts a chain, each day it holds extends it,
+// and when it ends (the diet off, a new run, a lapse) the chain cracks with a
+// snap and its length ("KETO · 41 days"); past chains stay dimmed in the row,
+// so the stop-start rhythm shows. Source-agnostic: each source is an adapter
+// to runs (measure-extras.mjs dietRuns, lostRunsRuns, pledgeRuns) and the
+// drawing reads only runs (`render.chrome.deck.streak`;
+// chrome-measure-extras.mjs streakHtml). It and the diet badge share the
+// bottom of the footage box: either or both.
+import { streakHtml } from "../chrome-measure-extras.mjs";
+import { streakStates } from "../measure-extras.mjs";
+import { measureExtraModule } from "./measure-extras-module.mjs";
+import { STREAK_AXES, STREAK_SOURCES } from "./measure-extras-settings.mjs";
+
+export default measureExtraModule({
+ id: "streak",
+ z: 65,
+ title: "Streak chain",
+ summary: "A chain per run along the in-record dates, cracked with its length when the run ends; past runs dimmed in a row.",
+ states: (schedule, render) => streakStates(schedule, render).states,
+ html: streakHtml,
+ needs: "a run of its source (a diet, a lost-weight run, a pledge)",
+ ui: [
+ { key: "source", type: "enum", options: STREAK_SOURCES, label: "Runs of", default: "diet" },
+ { key: "axis", type: "enum", options: STREAK_AXES, label: "Laid on", default: "date" },
+ { key: "title", type: "text", label: "Heading (default the source's)" },
+ { key: "color", type: "color", label: "Chain colour (lost runs, pledges; default the palette's accent)" },
+ { key: "colors", type: "object", label: "Diet runs: ink per regime" },
+ { key: "labels", type: "object", label: "Diet runs: words per regime" },
+ ],
+ docs: {
+ intro: "A chain per run along a time axis by in-record date (`render.chrome.deck.streak`, measure-extras.mjs): a run starts a chain, each day it holds extends it (the live chain grows with the in-record date of what is on screen, its day count beside it), and when the run ends the chain cracks -- its tip snaps off, a red break, its length tagged (\"KETO · 41 days\", a lapse \"after 73 days\") -- then dims into the row, so the stop-start rhythm stays on screen. `source` picks the runs: `diet` (the state's diet turning on or changing -- a new regime or diet number -- ends the last and starts the next; off ends it), `lostRuns` (the odometer's runs, each from its start to the next one's), `pledges` (the sobriety video's: a `pledge` event starts a run, a `lapse` snaps it -- an adapter only until the ledger writes those kinds). `axis: \"runs\"` lays the chains one after another, each as wide as the square root of its length, instead of on the dates. It sits bottom-centre, between the diet badge and the goal stack, so the diet badge, the chain, or both can run (`umtool look <p> deck.diet=false` / `deck.streak=false`).",
+ rows: [
+ ["`deck.streak`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, source, axis, title, color, colors, labels}` · default on with a measure slice", "`umtool look <p> deck.streak=false`"],
+ ["`deck.streak.source`, `.axis`", "`diet` `lostRuns` `pledges` · `date` `runs` · default `diet`, `date`", "`umtool look <p> deck.streak.source=lostRuns`"],
+ ["`deck.streak.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `bottom-center`, unset, 1", "`umtool look <p> deck.streak.position=bottom-left`"],
+ ["`deck.streak.hold`, `.finale`", "0 (up from the first run on) or 2–600 s · `hide` `show` · default 0, `hide`", "`umtool look <p> deck.streak.hold=15`"],
+ ["`deck.streak.title`, `.color`, `.colors`, `.labels`", "≤40 · #hex · `{<regime>: #hex}` · `{<regime>: words}` · default the source's word, the accent, the regimes' inks and names", "`umtool look <p> deck.streak.title='Every diet'`"],
+ ],
+ },
+});