Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 48ae6dfc3e5fbb5d57203ef47615cc1cd3147665
parent 5c25855eff043b174bc31dc8b8c616c5b12260f8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu,  5 Nov 2026 23:12:27 -0500

umtool: the measure's instruments -- a scale dial, a lost odometer and a weight trail, and the dial's finale

Three deck modules that read the schedule's measure slice (scheduleSlices
passes doc.measure through, the line the producer adds too) and stand in a
column at the frame's right, the clip moved to the left edge to make room
(deck.mjs instrumentsGeometry; 1248x702 footage beside a 600 px column at
1920x1080):

- dial (render.chrome.deck.dial): a bathroom-scale face 220-400 lb, a red
  needle to each stated weight at its event's t with a back.out spring, a
  qualifier wedge in pounds, remembered weights as ghost ticks with a long
  ghost needle and its as-of date, the latest goal as an amber tick on the
  bezel, 300 accented, the weight in big digits under the hub;
- odometer (deck.odometer): rolling wheels to a tenth of state.lost.total,
  held to its running highest so it only rolls up, NET beside it;
- trail (deck.trail): the stated weights by date, drawn as they are said,
  the 300 line and the "under 300" count;
- dial-finale (on with the dial unless deck.dial.finale is false): over
  the finale's window, in its lower column, the needle dropping from his
  highest remembered weight to his last stated one, the wheels rolling to
  the record's total, NET held. Laid over the finale (z 95), in Play too
  (ModuleLayers lays a layer above the finale's z over it).

Each page is a cue interpreter (measure-draw.mjs cueList/pageHtml) the frame
keys model, so a frame at rest is reused. A new layout slot, `instruments`.
With an instrument on, posts.shift does not apply and the side panel and
the feed are refused. A cut without them draws exactly what it drew: the
release 28 kit's manifests hash the same as on main (instruments.test.mjs).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/OnscreenSection.tsx | 59+++++++++++++++++++++++++++++++++++++----------------------
Mumtool/docs/knobs.md | 48+++++++++++++++++++++++++++++++++++++++++++++++-
Aumtool/report-to-video/chrome-instruments.mjs | 595+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/deck.mjs | 61++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Aumtool/report-to-video/fixtures/measure-dial/make.mjs | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/fixtures/measure-dial/measure.json | 1+
Aumtool/report-to-video/instruments.mjs | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/instruments.test.mjs | 237+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/measure-draw.mjs | 392+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/modules/contract.mjs | 5+++--
Aumtool/report-to-video/modules/dial-finale.mjs | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/modules/dial.mjs | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/modules/index.mjs | 7++++++-
Aumtool/report-to-video/modules/instruments-shared.mjs | 37+++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/modules/layout.mjs | 7++++++-
Aumtool/report-to-video/modules/odometer.mjs | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/modules/rail.test.mjs | 2+-
Mumtool/report-to-video/modules/registry.test.mjs | 11++++++-----
Mumtool/report-to-video/modules/settings.mjs | 5+++++
Aumtool/report-to-video/modules/trail.mjs | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 files changed, 1879 insertions(+), 36 deletions(-)

diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx @@ -2344,9 +2344,14 @@ export default function OnscreenSection({ // only inside it, as the build lays it at its own second; a whole-cut // module's page is up for the whole cut and draws its own comings and goings. // Laid over the deck's page (the build lays the deck first) and under the -// finale (which the caller lays last). +// finale (which the caller lays last) -- all but a module whose z is above +// the finale's (FINALE_Z: the dial's finale, laid over the finale's page by +// the build), which goes in a second layer over it. // --------------------------------------------------------------------------- +/** The finale's z (modules/finale.mjs): a play layer above it is laid over the finale's page. */ +const FINALE_Z = 90; + /** How long before its window a window layer's page is mounted, and how long after it stays. */ const LAYER_LEAD_S = 4; const LAYER_TAIL_S = 1; @@ -2363,7 +2368,8 @@ export function ModuleLayers({ testid?: string; }) { if (!layers?.length) return null; - const rows: { key: string; layer: PlayLayer; segment: string | null; src?: string; error?: string; up: boolean }[] = []; + type Row = { key: string; layer: PlayLayer; segment: string | null; src?: string; error?: string; up: boolean }; + const rows: Row[] = []; for (const l of [...layers].sort((a, b) => a.z - b.z)) { if (!l.geometry) continue; if (Array.isArray(l.windows)) { @@ -2375,27 +2381,36 @@ export function ModuleLayers({ rows.push({ key: `${l.id}:${l.src ?? "none"}`, layer: l, segment: null, src: l.src, error: l.error, up: true }); } } + const draw = (r: Row) => ( + <div + key={r.key} + className="pointer-events-none absolute inset-0" + data-play-layer={r.layer.id} + data-play-layer-segment={r.segment ?? undefined} + data-play-layer-up={r.up ? "1" : "0"} + style={{ opacity: r.up ? 1 : 0 }} + > + <FeedOverlay + feed={{ geometry: r.layer.geometry!, src: r.src, error: r.error }} + frame={g} + t={t} + ready={r.layer.ready} + testid={`${testid}-${r.layer.id}`} + name={r.layer.id} + /> + </div> + ); + const over = rows.filter((r) => r.layer.z > FINALE_Z); return ( - <div className="pointer-events-none absolute inset-0" style={{ zIndex: 1 }} data-module-layers=""> - {rows.map((r) => ( - <div - key={r.key} - className="pointer-events-none absolute inset-0" - data-play-layer={r.layer.id} - data-play-layer-segment={r.segment ?? undefined} - data-play-layer-up={r.up ? "1" : "0"} - style={{ opacity: r.up ? 1 : 0 }} - > - <FeedOverlay - feed={{ geometry: r.layer.geometry!, src: r.src, error: r.error }} - frame={g} - t={t} - ready={r.layer.ready} - testid={`${testid}-${r.layer.id}`} - name={r.layer.id} - /> + <> + <div className="pointer-events-none absolute inset-0" style={{ zIndex: 1 }} data-module-layers=""> + {rows.filter((r) => r.layer.z <= FINALE_Z).map(draw)} + </div> + {over.length > 0 && ( + <div className="pointer-events-none absolute inset-0" style={{ zIndex: 3 }} data-module-layers="over-finale"> + {over.map(draw)} </div> - ))} - </div> + )} + </> ); } diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -1467,9 +1467,13 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr | [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` | | [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` | +| [Scale dial](#scale-dial) `dial` | A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel. (a page over the whole cut) | `render.chrome.deck.dial` | +| [Lost odometer](#lost-odometer) `odometer` | Rolling digits of the pounds he says he has lost (only ever up), NET beside them. (a page over the whole cut) | `render.chrome.deck.odometer` | +| [Weight trail](#weight-trail) `trail` | His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it. (a page over the whole cut) | `render.chrome.deck.trail` | | [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` | +| [Dial finale](#dial-finale) `dial-finale` | The finale with the dial and the odometer large: the needle drops to his last stated weight, the wheels roll to the total, NET holds. (pages at their own seconds) | -- | ### Play the cut and the live preview @@ -1481,7 +1485,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`, `threads`, `dial`, `odometer`, `trail`, `flips`, `chapter`, `dial-finale`. 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` @@ -1694,6 +1698,40 @@ A card per thread in the side panel beside the footage, lit as its clips play; a |---|---|---| | `render.chrome.threads.list[]` | `{id, label, outcome?: {verdict, label?}}`; a clip names its thread with `thread` | `umtool look <p> chrome.threads=…` (manifest) | +### Scale dial + +A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused. + +| Knob | Range · default | From a terminal | +|---|---|---| +| `deck.dial` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.dial=true` | +| `deck.dial.mark` | a weight, or `null` · default `300` (its tick and label in the accent) | `umtool look <p> deck.dial.mark=300` | +| `deck.dial.ghosts`, `.goal` | bool · default `true` each | `umtool look <p> deck.dial.ghosts=false` | +| `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` | +| `deck.dial.label` | words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS` | `umtool look <p> deck.dial.label='"…"'` | +| `deck.dial.finale` | bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`) | `umtool look <p> deck.dial.finale=false` | + +### Lost odometer + +Under the dial: the measure's `state.lost.total` (the highest real-time loss claim in each run, summed) on mechanical wheels to a tenth, rolling forward at each claim that raises it (1.3 s) and never back -- a lower total is held at the highest so far. NET (`state.net`: the first stated weight of the record to the latest) in plain digits beside it, `−76.5 · 368 → 291.5`; `ACROSS 8 RUNS` under the wheels. + +| Knob | Range · default | From a terminal | +|---|---|---| +| `deck.odometer` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.odometer=true` | +| `deck.odometer.label` | words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST` | `umtool look <p> deck.odometer.label='"…"'` | +| `deck.odometer.net`, `.runs` | bool · default `true` each | `umtool look <p> deck.odometer.net=false` | + +### Weight trail + +At the foot of the instruments' column: every STATED weight the cut shows, placed by the date he was weighed (its `asOf`, else its date) across the span of them, a dot appearing at its event's `t` and the line between two neighbours drawn once both are said; a red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each. + +| Knob | Range · default | From a terminal | +|---|---|---| +| `deck.trail` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.trail=true` | +| `deck.trail.mark` | a weight, or `null` · default `300` | `umtool look <p> deck.trail.mark=300` | +| `deck.trail.count` | bool · default `true` | `umtool look <p> deck.trail.count=false` | +| `deck.trail.label` | its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE` | `umtool look <p> deck.trail.label='"…"'` | + ### Flips Then-and-now pairs in the side panel (`render.chrome.flips`, flips.mjs); the thread rail and the flips share the panel: one or the other. @@ -1721,4 +1759,12 @@ 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` | +### Dial finale + +With the dial on (`deck.dial`) and a finale (a run of `layout: "finale"` clips), the finale's lower column -- beside the clip, under the finale's totals when it draws them -- carries the instruments large over the finale's window: in over the finale's grow, the needle dropping (1.8 s, `back.out`) from his highest remembered weight (the measure's `totals.peakDrift` and remembered weights) to his last stated one (`totals.net.to`), every ghost tick and the latest goal on the bezel; the odometer rolling up from zero to the whole record's `totals.lost` (the rows the cut never shows included) with `ACROSS N RUNS`; NET (`totals.net`) held beside it; out through the finale's dissolve. Laid over the finale (z 95), in Play too. It needs the lower column clear: a finale with stats cards (`deck.finale.stats`) is refused -- set `deck.dial.finale` false, or drop the cards. + +| Knob | Range · default | From a terminal | +|---|---|---| +| `deck.dial.finale` | bool · default `true` (with the dial on) | `umtool look <p> deck.dial.finale=false` | + <!-- modules:end --> diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -0,0 +1,595 @@ +// THE INSTRUMENTS' PAGES (instruments.mjs): the dial, the odometer, the trail +// -- each one HyperFrames page for the whole cut, in its region of the +// instruments' column (deck.mjs instrumentsGeometry) -- and the dial's finale, +// a page over the finale's window in the finale's lower column. +// +// PURE, like chrome-stats.mjs: a schedule (its `measure`) and a render block in, +// an HTML string out. compose-chrome.mjs copies the assets in beside it, writes +// it and renders it; the build lays the frames over the cut. Play the cut and +// the live preview load the same page (`?preview=1`) and seek it by message. +// +// Every page is a cue interpreter (measure-draw.mjs cueList, pageHtml): every +// state is its own block shown over exactly its span, every move a cue that +// states its from, so a seek lands on the same pixels from either side and a +// frame whose values did not move keys as the frame before it -- the needle at +// rest between two weights is captured once, not once a frame. +import { deckChoreography, even, instrumentsGeometry, railGap } from "./deck.mjs"; +import { mix, rgba } from "./chrome-deck.mjs"; +import { finaleLayout } from "./chrome-finale.mjs"; +import { FINALE_MOTION } from "./finale.mjs"; +import { resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs"; +import { + cueList, dayNumber, dialAngle, dialFaceSvg, DIAL_SWEEP, esc, fmtDate, fmtSigned, fmtWeight, INSTANT, measureTrack, + pageHtml, polar, qualifierMark, r4, sectorPath, wedgeRange, wheelCount, wheelRoll, wheelStrip, +} from "./measure-draw.mjs"; + +/** The motion's seconds: the needle's swing, a ghost's move, the odometer's roll, a block's fade. */ +export const INSTRUMENT_MOTION = Object.freeze({ + needle: 0.9, needleEase: "back.out(1.7)", ghost: 0.7, goal: 0.6, roll: 1.3, fade: 0.25, point: 0.4, segment: 0.45, +}); + +/** The faces a measure page draws in: the deck's, and the manifest's display and condensed faces when it names them. */ +export const INSTRUMENT_FONTS = Object.freeze({ display: "MeasureDisplay", condensed: "MeasureCond" }); + +const fontStack = (fonts, which) => + which === "display" + ? `'${fonts.MeasureDisplay ? "MeasureDisplay" : "DeckSansBold"}', sans-serif` + : which === "condensed" + ? `'${fonts.MeasureCond ? "MeasureCond" : "DeckSans"}', sans-serif` + : which === "bold" ? "'DeckSansBold', sans-serif" : "'DeckSans', sans-serif"; + +/** The palette roles every instrument draws in. */ +function colorsOf(render, dial = resolveDial(render)) { + const pal = render.palette ?? {}; + const bg = pal.bg ?? "#0f1311", fg = pal.fg ?? "#edf0ec"; + return { + bg, fg, + muted: pal.muted ?? "#98a29b", + accent: pal.accent ?? "#22ab83", + amber: pal.amber ?? "#e8a33f", + needle: dial?.needle ?? "#ff5a4e", + card: mix(bg, fg, 0.05), + rule: mix(bg, fg, 0.16), + face: mix(bg, fg, 0.07), + bezel: mix(bg, fg, 0.2), + ink: mix(bg, fg, 0.92), + ghost: pal.muted ?? "#98a29b", + }; +} + +/** The measure, or a sentence why the page cannot draw. */ +function measureOf(schedule, what) { + const m = schedule?.measure; + if (!m || !Array.isArray(m.state) || !m.scale) throw new Error(`${what}: the schedule has no measure (a measure ledger and render.chrome.deck.measure)`); + return m; +} + +/** A whole-cut page's window of the cut (`from`/`duration`, a preview's), or null for the whole cut. */ +function windowOf(schedule, opts, what) { + const total = schedule.total; + const from = Number(opts.from ?? 0); + const dur = opts.duration != null ? r4(Number(opts.duration)) : r4(total - from); + if (!(dur > 0)) throw new Error(`${what}: nothing to render from ${from}s of a ${total}s cut`); + const windowed = from > 0 || Math.abs(dur - total) > 1e-6; + return windowed ? { from: r4(from), dur } : null; +} + +/** The instruments come and go with the deck (a card, the finale): its root `k` on the deck's own visibility. */ +function withDeck(L, schedule, render, k) { + L.set(k, { autoAlpha: 1 }); + for (const v of deckChoreography(schedule, render).visibility) { + const [a, b] = v.at; + L.add(k, a, Math.max(INSTANT, b - a), { autoAlpha: v.hide ? 0 : 1 }, v.hide ? "power1.in" : "power2.out"); + } +} + +/** Blocks shown one at a time: block j from `list[j].t` to the next one's. */ +function blocks(L, list, key, { fade = INSTANT, shown = (x) => true } = {}) { + list.forEach((x, j) => { + const k = `${key}${j}`; + L.set(k, { autoAlpha: 0 }); + if (!shown(x)) return; + L.add(k, x.t, fade, { autoAlpha: 1 }, "power1.out"); + const next = list[j + 1]; + if (next) L.add(k, next.t, INSTANT, { autoAlpha: 0 }); + }); +} + +const goalWords = (g) => { + if (!g) return ""; + const what = Number.isFinite(g.value) ? `GOAL ${fmtWeight(g.value)}` : Number.isFinite(g.loss) ? `GOAL: LOSE ${fmtWeight(Math.abs(g.loss))}` : "GOAL"; + return g.deadline ? `${what} · ${String(g.deadline).toUpperCase()}` : what; +}; + +// --------------------------------------------------------------------------- +// The dial. +// --------------------------------------------------------------------------- + +/** + * The dial's face and everything on it, `size` px square at (ox, oy) in the + * page: the static face, the ghosts, the wedges, the goal tick, the needles, + * the hub and the readout blocks. Shared by the column's dial and the + * finale's. Returns its markup and css; its cues are the caller's. + */ +function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = "" }) { + const face = dialFaceSvg({ size, scale, mark: cfg.mark, colors: { ...colors, mark: colors.accent }, labelFont: fontStack(fonts, "condensed") }); + const { C, R, Rf, u } = face; + const px = (v) => Math.round(v * u * 100) / 100; + const layer = (k, inner, cls = "ly") => `<div class="${cls}" data-k="${prefix}${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${inner}</svg></div>`; + const parts = []; + parts.push(`<div class="ly face">${face.svg}</div>`); + if (cfg.ghosts) { + track.remembered.forEach((g, j) => { + parts.push(layer(`g${j}`, `<line x1="${C}" y1="${C - Rf + 6 * u}" x2="${C}" y2="${C - Rf + 46 * u}" stroke="${colors.ghost}" stroke-width="${px(3.5)}" stroke-linecap="round"/>`)); + }); + } + track.current.forEach((c, j) => { + const w = Number.isFinite(c.value) ? wedgeRange(c.value, c.qualifier) : null; + if (!w) return; + const a0 = dialAngle(w[0], scale), a1 = dialAngle(w[1], scale); + if (!(a1 > a0)) return; + parts.push(layer(`q${j}`, `<path d="${sectorPath(C, C, Rf - 38 * u, Rf - 4 * u, a0, a1)}" fill="${colors.accent}" fill-opacity="0.5" stroke="${colors.accent}" stroke-width="${px(1.5)}"/>`)); + }); + if (cfg.goal) { + parts.push(layer("gl", `<polygon points="${C - 11 * u},${C - R - 2 * u} ${C + 11 * u},${C - R - 2 * u} ${C},${C - Rf + 16 * u}" fill="${colors.amber}" stroke="${colors.bg}" stroke-width="${px(2)}"/>`)); + } + if (cfg.ghosts && track.remembered.length) { + parts.push(layer("gn", `<line x1="${C}" y1="${C + 22 * u}" x2="${C}" y2="${C - Rf + 66 * u}" stroke="${colors.ghost}" stroke-width="${px(5)}" stroke-linecap="round"/>`)); + } + // The needle: a tapered blade from a counterweight through the hub. + parts.push(layer("nd", + `<polygon points="${C - 6 * u},${C + 34 * u} ${C + 6 * u},${C + 34 * u} ${C + 1.8 * u},${C - Rf + 30 * u} ${C - 1.8 * u},${C - Rf + 30 * u}" fill="${colors.needle}"/>` + + `<circle cx="${C}" cy="${C + 34 * u}" r="${px(9)}" fill="${colors.needle}"/>`)); + parts.push(`<div class="ly"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><circle cx="${C}" cy="${C}" r="${px(16)}" fill="${colors.needle}"/><circle cx="${C}" cy="${C}" r="${px(6)}" fill="${colors.face}"/></svg></div>`); + // The as-of labels, each by its ghost, up while it is the latest. + if (cfg.ghosts) { + track.remembered.forEach((g, j) => { + const a = dialAngle(g.value, scale); + // Along its ghost, but never down into the readout's words under the hub. + const [x, y0] = polar(C, C, Rf * 0.52, a); + const y = Math.min(y0, Math.round((C + 30 * u) * 100) / 100); + parts.push(`<div class="asof" data-k="${prefix}ga${j}" style="left:${x}px; top:${y}px"><b>${esc(qualifierMark(g.qualifier))}${esc(fmtWeight(g.value))}</b><span>${g.asOf ? `AS OF ${esc(fmtDate(g.asOf))}` : "REMEMBERED"}</span></div>`); + }); + } + // The readout under the hub: the words, the weight, the weighing's date, the goal. + // Inside the face's open quarter: each line kept within the chord at its height. + parts.push(`<div class="rlab" style="top:${C + 72 * u}px">${esc(cfg.label)}</div>`); + track.current.forEach((c, j) => { + const has = Number.isFinite(c.value); + parts.push(`<div class="read" data-k="${prefix}cv${j}" style="top:${C + 86 * u}px"><div class="big">${has ? `${esc(qualifierMark(c.qualifier))}${esc(fmtWeight(c.value))}<i>LB</i>` : "—"}</div>${has && c.date ? `<div class="when" style="top:${78 * u}px">${esc(fmtDate(c.date))}</div>` : ""}</div>`); + }); + if (cfg.goal) { + track.goals.forEach((g, j) => { + parts.push(`<div class="goalw" data-k="${prefix}gw${j}" style="top:${C + 188 * u}px">${esc(goalWords(g.goal))}</div>`); + }); + } + const css = ` + .dial { position: absolute; left: ${ox}px; top: ${oy}px; width: ${size}px; height: ${size}px; } + .dial .ly { position: absolute; left: 0; top: 0; width: ${size}px; height: ${size}px; transform-origin: ${C}px ${C}px; } + .dial .ly svg { display: block; } + .dial .asof { position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; + color: ${colors.ghost}; line-height: 1.05; padding: ${px(3)}px ${px(7)}px; border-radius: ${px(6)}px; + background: ${rgba(colors.face, 0.86)}; } + .dial .asof b { display: block; font-family: ${fontStack(fonts, "display")}; font-weight: 400; font-size: ${px(24)}px; } + .dial .asof span { display: block; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px; letter-spacing: 0.08em; } + .dial .rlab { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "condensed")}; + font-size: ${px(15)}px; letter-spacing: 0.14em; color: ${colors.muted}; } + .dial .read { position: absolute; left: 0; width: ${size}px; text-align: center; } + .dial .read .big { font-family: ${fontStack(fonts, "display")}; font-size: ${px(72)}px; line-height: ${px(76)}px; color: ${colors.fg}; + font-variant-numeric: tabular-nums; white-space: nowrap; } + .dial .read .big i { font-style: normal; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(20)}px; letter-spacing: 0.1em; + color: ${colors.muted}; margin-left: ${px(6)}px; } + .dial .read .when { position: absolute; left: 0; width: ${size}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(16)}px; + line-height: ${px(20)}px; letter-spacing: 0.1em; color: ${colors.muted}; } + .dial .goalw { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "bold")}; + font-size: ${px(17)}px; line-height: ${px(20)}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }`; + return { html: `<div class="dial">${parts.join("\n ")}</div>`, css, face }; +} + +/** The dial's cues over the cut: the needle on each stated weight, the ghosts, the wedges, the goal, the readout. */ +function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) { + const M = INSTRUMENT_MOTION; + const a0 = DIAL_SWEEP.a0; + const k = (s) => `${prefix}${s}`; + // The finale drives its own needle (dialFinaleHtml). + if (!finale) L.set(k("nd"), { rotation: a0 }); + track.current.forEach((c, j) => { + if (j > 0 && !finale) L.add(k("nd"), c.t, M.needle, { rotation: Number.isFinite(c.value) ? dialAngle(c.value, scale) : a0 }, M.needleEase); + // The wedge once the needle is all but there, gone with its state. + const w = Number.isFinite(c.value) ? wedgeRange(c.value, c.qualifier) : null; + if (w && dialAngle(w[1], scale) > dialAngle(w[0], scale)) { + L.set(k(`q${j}`), { autoAlpha: 0 }); + L.add(k(`q${j}`), c.t + M.needle * 0.6, M.fade, { autoAlpha: 1 }, "power1.out"); + const next = track.current[j + 1]; + if (next) L.add(k(`q${j}`), next.t, M.fade * 0.6, { autoAlpha: 0 }, "power1.in"); + } + }); + blocks(L, track.current, k("cv")); + if (cfg.ghosts) { + track.remembered.forEach((g, j) => { + L.set(k(`g${j}`), { rotation: dialAngle(g.value, scale), autoAlpha: 0 }); + L.add(k(`g${j}`), g.t, M.fade, { autoAlpha: 0.55 }, "power1.out"); + }); + if (track.remembered.length && finale) { + // All at once: the long ghost and its words on the last (the finale puts his highest there). + const last = track.remembered.length - 1; + const g = track.remembered[last]; + L.set(k("gn"), { rotation: dialAngle(g.value, scale), autoAlpha: 0 }); + L.add(k("gn"), g.t, M.fade, { autoAlpha: 0.9 }, "power1.out"); + track.remembered.forEach((_, j) => L.set(k(`ga${j}`), { autoAlpha: 0 })); + L.add(k(`ga${last}`), g.t, M.fade, { autoAlpha: 1 }, "power1.out"); + } else if (track.remembered.length) { + L.set(k("gn"), { rotation: dialAngle(track.remembered[0].value, scale), autoAlpha: 0 }); + track.remembered.forEach((g, j) => { + if (j === 0) L.add(k("gn"), g.t, M.fade, { autoAlpha: 0.9 }, "power1.out"); + else L.add(k("gn"), g.t, M.ghost, { rotation: dialAngle(g.value, scale) }, "power2.inOut"); + }); + blocks(L, track.remembered, k("ga"), { fade: M.fade }); + } + } + if (cfg.goal) { + const first = track.goals.find((g) => Number.isFinite(g.goal?.value)); + L.set(k("gl"), { rotation: first ? dialAngle(first.goal.value, scale) : a0, autoAlpha: 0 }); + let up = false; + for (const g of track.goals) { + const v = g.goal?.value; + if (Number.isFinite(v)) { + if (!up) { + L.add(k("gl"), g.t, INSTANT, { rotation: dialAngle(v, scale) }); + L.add(k("gl"), g.t, M.fade, { autoAlpha: 1 }, "power1.out"); + } else L.add(k("gl"), g.t, M.goal, { rotation: dialAngle(v, scale) }, "power2.inOut"); + up = true; + } else if (up) { + L.add(k("gl"), g.t, M.fade, { autoAlpha: 0 }, "power1.in"); + up = false; + } + } + blocks(L, track.goals, k("gw"), { shown: (g) => !!g.goal }); + } +} + +/** + * The dial's page for the whole cut (or a window of it, `from`/`duration`). + * `fonts` = asset-relative paths by face name (DeckSans, DeckSansBold, and + * MeasureDisplay / MeasureCond when the manifest names them). + */ +export function dialHtml(schedule, render, opts = {}) { + const M = measureOf(schedule, "dial"); + const cfg = resolveDial(render) ?? resolveDial({ chrome: { deck: { dial: true } } }); + const geo = instrumentsGeometry(render).dial ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, dial: true } } }).dial; + const W = geo.width, H = geo.height; + const fps = schedule.fps ?? render.fps ?? 30; + const fonts = opts.fonts ?? {}; + const colors = colorsOf(render, cfg); + const track = measureTrack(M); + const size = even(Math.min(W, H)); + const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track }); + const L = cueList(fps); + withDeck(L, schedule, render, "rt"); + dialCues(L, { track, scale: M.scale, cfg }); + const { init, cues } = L.build(); + return pageHtml({ + id: "dial", W, H, fps, fonts, gsap: opts.gsap, + data: { total: r4(schedule.total), window: windowOf(schedule, opts, "dial"), init, cues }, + css: `#rt { position: absolute; inset: 0; }${parts.css}`, + body: `<div id="rt" data-k="rt">${parts.html}</div>`, + }); +} + +// --------------------------------------------------------------------------- +// The odometer. +// --------------------------------------------------------------------------- + +/** The odometer's wheels and words, in a box `W`x`H`, scale `u` (1 at its column size). */ +function odometerParts({ W, H, u, cfg, colors, fonts, track, wheels, netList, prefix = "", big = false }) { + const px = (v) => Math.round(v * u * 100) / 100; + const wh = px(big ? 104 : 72), ww = px(big ? 74 : 52), gap = px(5); + const parts = []; + const strip = (i) => `<div class="wheel${i === wheels ? " tenth" : ""}"><div class="strip" data-k="${prefix}w${i}">${wheelStrip()}</div></div>`; + const ws = []; + for (let i = 0; i <= wheels; i += 1) { + if (i === wheels) ws.push(`<div class="dot"></div>`); + ws.push(strip(i)); + } + const left = `<div class="lft"><div class="lab">${esc(cfg.label)}</div><div class="wheels">${ws.join("")}</div>${cfg.runs ? track.lost.map((x, j) => `<div class="runs" data-k="${prefix}rn${j}">${x.runs ? `ACROSS ${x.runs} RUN${x.runs === 1 ? "" : "S"}` : ""}</div>`).join("") : ""}</div>`; + parts.push(left); + if (cfg.net) { + const nets = netList.map((n, j) => { + const f = n.net?.from, to = n.net?.to; + const fv = typeof f === "number" ? f : f?.value, tv = typeof to === "number" ? to : to?.value; + const value = Number.isFinite(fv) && Number.isFinite(tv) ? fmtSigned(tv - fv) : "—"; + const sub = Number.isFinite(fv) ? `${fmtWeight(fv)} → ${Number.isFinite(tv) ? fmtWeight(tv) : "?"}` : ""; + return `<div class="net" data-k="${prefix}nt${j}"><div class="val">${esc(value)}</div><div class="sub">${esc(sub)}</div></div>`; + }).join(""); + parts.push(`<div class="rgt" data-k="${prefix}net"><div class="lab">NET</div>${nets}</div>`); + } + const lw = cfg.net ? (big ? Math.round(W) : Math.round(W * 0.56)) : W; + const css = ` + .odo { position: absolute; inset: 0; ${big ? "" : `border-radius: ${px(10)}px; background: ${colors.card};`} } + .odo .lft { position: absolute; left: ${big ? 0 : px(20)}px; top: ${big ? 0 : px(12)}px; width: ${lw - (big ? 0 : px(20))}px; } + .odo .lab { font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(big ? 22 : 15)}px; letter-spacing: 0.12em; color: ${colors.muted}; + white-space: nowrap; } + .odo .wheels { display: flex; align-items: flex-end; gap: ${gap}px; margin-top: ${px(big ? 10 : 7)}px; } + .odo .wheel { position: relative; width: ${ww}px; height: ${wh}px; overflow: hidden; border-radius: ${px(5)}px; background: ${colors.fg}; + box-shadow: inset 0 ${px(8)}px ${px(10)}px rgba(0,0,0,0.28), inset 0 -${px(8)}px ${px(10)}px rgba(0,0,0,0.28); } + .odo .wheel.tenth { background: ${colors.needle}; } + .odo .strip { position: absolute; left: 0; top: 0; width: ${ww}px; } + .odo .dg { height: ${wh}px; line-height: ${wh}px; text-align: center; font-family: ${fontStack(fonts, "display")}; + font-size: ${px(big ? 86 : 60)}px; color: ${colors.bg}; font-variant-numeric: tabular-nums; } + .odo .wheel.tenth .dg { color: #ffffff; } + .odo .dot { width: ${px(big ? 12 : 8)}px; height: ${px(big ? 12 : 8)}px; border-radius: 50%; background: ${colors.fg}; margin: 0 ${px(2)}px ${px(big ? 10 : 8)}px; } + .odo .runs { position: absolute; left: 0; top: ${px(big ? 152 : 104)}px; font-family: ${fontStack(fonts, "condensed")}; + font-size: ${px(big ? 20 : 14)}px; letter-spacing: 0.12em; color: ${colors.muted}; white-space: nowrap; } + .odo .rgt { position: absolute; ${big ? `left: 0; top: ${px(210)}px;` : `left: ${Math.round(W * 0.6)}px; top: ${px(12)}px; border-left: ${px(2)}px solid ${colors.rule}; padding-left: ${px(18)}px; height: ${H - px(24)}px;`} right: ${big ? 0 : px(14)}px; } + .odo .net { position: absolute; left: ${big ? 0 : px(18)}px; top: ${px(big ? 28 : 22)}px; white-space: nowrap; } + .odo .net .val { font-family: ${fontStack(fonts, "display")}; font-size: ${px(big ? 96 : 58)}px; line-height: 1; color: ${colors.fg}; + font-variant-numeric: tabular-nums; } + .odo .net .sub { font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(big ? 24 : 17)}px; letter-spacing: 0.08em; color: ${colors.muted}; + margin-top: ${px(big ? 6 : 4)}px; font-variant-numeric: tabular-nums; }`; + return { html: `<div class="odo">${parts.join("")}</div>`, css, wh }; +} + +/** The wheels rolled from `a` to `b` at `t` over `dur`, each settled back to its digit after. */ +function rollCues(L, { a, b, t, dur, wheels, wh, prefix = "", ease = "power2.inOut" }) { + wheelRoll(a, b, wheels).forEach((w, i) => { + if (w.to === w.from) return; + const k = `${prefix}w${i}`; + L.add(k, t, dur, { y: -w.to * wh }, ease); + if (w.settle !== null) L.add(k, t + dur, INSTANT, { y: -w.settle * wh }); + }); +} + +/** The odometer's page for the whole cut (or a window of it). */ +export function odometerHtml(schedule, render, opts = {}) { + const M = measureOf(schedule, "odometer"); + const cfg = resolveOdometer(render) ?? resolveOdometer({ chrome: { deck: { odometer: true } } }); + const geo = instrumentsGeometry(render).odometer ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, odometer: true } } }).odometer; + const W = geo.width, H = geo.height; + const u = W / 600; + const fps = schedule.fps ?? render.fps ?? 30; + const fonts = opts.fonts ?? {}; + const colors = colorsOf(render); + const track = measureTrack(M); + const top = Math.max(Number(M.totals?.lost) || 0, ...track.lost.map((x) => x.total)); + const wheels = wheelCount(top); + const parts = odometerParts({ W, H, u, cfg, colors, fonts, track, wheels, netList: track.net }); + const L = cueList(fps); + withDeck(L, schedule, render, "rt"); + for (let i = 0; i <= wheels; i += 1) L.set(`w${i}`, { y: 0 }); + track.lost.forEach((x, j) => { + if (j === 0) { + if (x.total > 0) rollCues(L, { a: 0, b: x.total, t: 0, dur: INSTANT, wheels, wh: parts.wh }); + return; + } + const prev = track.lost[j - 1].total; + if (x.total > prev + 1e-9) rollCues(L, { a: prev, b: x.total, t: x.t, dur: INSTRUMENT_MOTION.roll, wheels, wh: parts.wh }); + }); + if (cfg.runs) blocks(L, track.lost, "rn"); + if (cfg.net) blocks(L, track.net, "nt"); + const { init, cues } = L.build(); + return pageHtml({ + id: "odometer", W, H, fps, fonts, gsap: opts.gsap, + data: { total: r4(schedule.total), window: windowOf(schedule, opts, "odometer"), init, cues }, + css: `#rt { position: absolute; inset: 0; }${parts.css}`, + body: `<div id="rt" data-k="rt">${parts.html}</div>`, + }); +} + +// --------------------------------------------------------------------------- +// The trail. +// --------------------------------------------------------------------------- + +/** The trail's page for the whole cut (or a window of it). */ +export function trailHtml(schedule, render, opts = {}) { + const M = measureOf(schedule, "trail"); + const cfg = resolveTrail(render) ?? resolveTrail({ chrome: { deck: { trail: true } } }); + const geo = instrumentsGeometry(render).trail ?? instrumentsGeometry({ ...render, chrome: { ...render.chrome, deck: { ...render.chrome?.deck, trail: true } } }).trail; + const W = geo.width, H = geo.height; + const u = W / 600; + const px = (v) => Math.round(v * u * 100) / 100; + const fps = schedule.fps ?? render.fps ?? 30; + const fonts = opts.fonts ?? {}; + const colors = colorsOf(render); + const track = measureTrack(M); + const mark = Number.isFinite(cfg.mark) ? cfg.mark : null; + // By date: each stated weight at the day it was weighed, in date order. + const pts = track.stated + .map((p, n) => ({ ...p, day: dayNumber(p.date), n })) + .filter((p) => Number.isFinite(p.day)) + .sort((a, b) => a.day - b.day || a.n - b.n); + const x0 = px(54), x1 = W - px(18), y0 = px(38), y1 = H - px(26); + let d0 = pts.length ? pts[0].day : 0, d1 = pts.length ? pts[pts.length - 1].day : 1; + if (d1 - d0 < 60) { d0 -= 30; d1 += 30; } + const vals = pts.map((p) => p.value).concat(mark !== null ? [mark] : []); + const lo = vals.length ? Math.floor((Math.min(...vals) - 5) / 10) * 10 : M.scale.min; + const hi = vals.length ? Math.ceil((Math.max(...vals) + 5) / 10) * 10 : M.scale.max; + const X = (d) => r4(x0 + ((d - d0) / (d1 - d0)) * (x1 - x0)); + const Y = (v) => r4(y1 - ((v - lo) / Math.max(1, hi - lo)) * (y1 - y0)); + const parts = []; + // The years along the foot. + const yearOf = (d) => new Date(d * 86400000).getUTCFullYear(); + for (let yr = yearOf(d0) + 1; yr <= yearOf(d1); yr += 1) { + const x = X(Date.UTC(yr, 0, 1) / 86400000); + parts.push(`<div class="yr" style="left:${x}px; top:${y1 + px(4)}px">${yr}</div><div class="ytick" style="left:${x}px; top:${y0}px; height:${y1 - y0}px"></div>`); + } + if (mark !== null && mark >= lo && mark <= hi) { + parts.push(`<div class="mark" style="left:${x0}px; top:${Y(mark)}px; width:${x1 - x0}px"></div><div class="marklab" style="left:${px(12)}px; top:${Y(mark)}px">${mark}</div>`); + } + parts.push(`<div class="lohi" style="left:${px(12)}px; top:${y0}px">${hi}</div><div class="lohi" style="left:${px(12)}px; top:${y1}px">${lo}</div>`); + const L = cueList(fps); + withDeck(L, schedule, render, "rt"); + const M2 = INSTRUMENT_MOTION; + // The line: each pair of neighbours by date, drawn once both have been said. + for (let j = 0; j + 1 < pts.length; j += 1) { + const a = pts[j], b = pts[j + 1]; + const xa = X(a.day), ya = Y(a.value), xb = X(b.day), yb = Y(b.value); + const len = r4(Math.hypot(xb - xa, yb - ya)); + const ang = r4((Math.atan2(yb - ya, xb - xa) * 180) / Math.PI); + parts.push(`<div class="seg" data-k="s${j}" style="left:${xa}px; top:${ya}px; width:${len}px"></div>`); + L.set(`s${j}`, { rotation: ang, scaleX: 0, transformOrigin: "0% 50%" }); + L.add(`s${j}`, Math.max(a.t, b.t), M2.segment, { scaleX: 1 }, "power2.out"); + } + pts.forEach((p, j) => { + parts.push(`<div class="pt${p.qualifier ? " q" : ""}" data-k="p${j}" style="left:${X(p.day)}px; top:${Y(p.value)}px"></div>`); + L.set(`p${j}`, { autoAlpha: 0, scale: 0.3 }); + L.add(`p${j}`, p.t, M2.point, { autoAlpha: 1, scale: 1 }, "back.out(2)"); + }); + // The latest said, ringed in the needle's red: it travels to each as it lands. + if (pts.length) { + parts.push(`<div class="ring" data-k="pl"></div>`); + const inCut = [...pts].sort((a, b) => a.t - b.t || a.n - b.n); + L.set("pl", { x: X(inCut[0].day), y: Y(inCut[0].value), autoAlpha: 0 }); + inCut.forEach((p, j) => { + if (j === 0) L.add("pl", p.t, M2.point, { autoAlpha: 1 }, "power1.out"); + else L.add("pl", p.t, M2.point, { x: X(p.day), y: Y(p.value) }, "power2.inOut"); + }); + } + // How many times he says he is under 300, counted as each lands. + const counts = cfg.count && mark === 300 ? track.under.slice().sort((a, b) => a.t - b.t).map((x, n) => ({ t: x.t, n: n + 1 })) : []; + counts.forEach((c) => parts.push(`<div class="cnt" data-k="uc${c.n - 1}">UNDER ${mark} · SAID ${c.n}×</div>`)); + if (counts.length) blocks(L, counts, "uc"); + const { init, cues } = L.build(); + const css = ` + #rt { position: absolute; inset: 0; } + .trail { position: absolute; inset: 0; border-radius: ${px(10)}px; background: ${colors.card}; } + .trail .lab { position: absolute; left: ${px(14)}px; top: ${px(10)}px; font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(14)}px; + letter-spacing: 0.12em; color: ${colors.muted}; white-space: nowrap; } + .trail .cnt { position: absolute; right: ${px(16)}px; top: ${px(9)}px; font-family: ${fontStack(fonts, "bold")}; font-size: ${px(15)}px; + letter-spacing: 0.06em; color: ${colors.accent}; white-space: nowrap; } + .trail .yr { position: absolute; transform: translateX(-50%); font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px; + color: ${colors.muted}; letter-spacing: 0.06em; } + .trail .ytick { position: absolute; width: 1px; background: ${colors.rule}; } + .trail .mark { position: absolute; height: 0; border-top: ${px(2)}px dashed ${rgba(colors.accent, 0.75)}; } + .trail .marklab, .trail .lohi { position: absolute; transform: translateY(-50%); font-family: ${fontStack(fonts, "condensed")}; + font-size: ${px(13)}px; color: ${colors.muted}; } + .trail .marklab { color: ${colors.accent}; font-family: ${fontStack(fonts, "bold")}; } + .trail .seg { position: absolute; height: ${px(2.6)}px; margin-top: -${px(1.3)}px; background: ${colors.accent}; border-radius: ${px(2)}px; } + .trail .pt { position: absolute; width: ${px(10)}px; height: ${px(10)}px; margin: -${px(5)}px 0 0 -${px(5)}px; border-radius: 50%; + background: ${colors.accent}; border: ${px(2)}px solid ${colors.card}; } + .trail .pt.q { background: ${colors.card}; border: ${px(2.4)}px solid ${colors.accent}; } + .trail .ring { position: absolute; left: 0; top: 0; width: ${px(20)}px; height: ${px(20)}px; margin: -${px(10)}px 0 0 -${px(10)}px; + border-radius: 50%; border: ${px(3)}px solid ${colors.needle}; }`; + return pageHtml({ + id: "trail", W, H, fps, fonts, gsap: opts.gsap, + data: { total: r4(schedule.total), window: windowOf(schedule, opts, "trail"), init, cues }, + css, + body: `<div id="rt" data-k="rt"><div class="trail"><div class="lab">${esc(cfg.label)}</div>${parts.join("")}</div></div>`, + }); +} + +// --------------------------------------------------------------------------- +// The dial's finale. +// --------------------------------------------------------------------------- + +/** + * Where the dial's finale stands (frame px): the finale's lower column + * (finale.mjs finaleGeometry `column`), under its totals when it draws them -- + * or null when that leaves no room (stats cards fill it, or under 260 px). + */ +export function dialFinaleGeometry(schedule, render) { + if (!schedule?.finale) return null; + const g = finaleLayout(schedule, render).geo; + if (g.stats) return null; + const kh = g.H / 1080; + const y = g.totals ? g.totals.y + g.totals.height + Math.round(28 * kh) : g.column.y; + const h = g.column.y + g.column.height - y; + if (h < 260 * kh || g.column.width < 520 * g.k) return null; + return { x: g.column.x, y, width: even(g.column.width), height: even(h) }; +} + +/** What the finale ends on: the last stated weight, the odometer's total, NET -- the whole record's (`totals`), else the cut's last. */ +export function finaleNumbers(measure) { + const track = measureTrack(measure); + const T = measure?.totals ?? {}; + const n = T.net ?? {}; + const val = (x) => (typeof x === "number" ? x : x?.value); + const lastCur = [...track.current].reverse().find((c) => Number.isFinite(c.value)) ?? null; + const lastNet = track.net[track.net.length - 1]?.net ?? null; + const from = Number.isFinite(val(n.from)) ? val(n.from) : val(lastNet?.from); + const to = Number.isFinite(val(n.to)) ? val(n.to) : Number.isFinite(val(lastNet?.to)) ? val(lastNet.to) : lastCur?.value; + const lost = Number.isFinite(T.lost) ? T.lost : track.lost[track.lost.length - 1]?.total ?? 0; + const runs = Number.isFinite(T.runs) ? T.runs : track.lost[track.lost.length - 1]?.runs ?? 0; + const peaks = (Array.isArray(T.peakDrift) ? T.peakDrift : []).concat(track.remembered.map((r) => r.value)).filter(Number.isFinite); + return { + weight: Number.isFinite(to) ? to : null, + qualifier: lastCur && lastCur.value === to ? lastCur.qualifier : null, + lost, runs, from: Number.isFinite(from) ? from : null, + peak: peaks.length ? Math.max(...peaks) : null, + goal: [...track.goals].reverse().find((g) => g.goal)?.goal ?? null, + }; +} + +/** + * The dial's finale page over the finale's `window` (cut seconds; the + * finale's own, finale.mjs): the dial large, its needle dropping from his + * highest remembered weight to his last stated one; the odometer rolling up + * to the record's total; NET holding beside it. In over the finale's grow, + * out through its dissolve. + */ +export function dialFinaleHtml(schedule, render, window, opts = {}) { + const M = measureOf(schedule, "dial-finale"); + const geo = dialFinaleGeometry(schedule, render); + if (!geo) throw new Error("dial-finale: the finale's lower column has no room (its stats cards fill it)"); + const cfg = resolveDial(render) ?? resolveDial({ chrome: { deck: { dial: true } } }); + const ocfg = resolveOdometer(render) ?? resolveOdometer({ chrome: { deck: { odometer: true } } }); + const W = geo.width, H = geo.height; + const fps = schedule.fps ?? render.fps ?? 30; + const fonts = opts.fonts ?? {}; + const colors = colorsOf(render, cfg); + const from = r4(Number(window.from)); + const dur = r4(Number(window.to) - from); + if (!(dur > 0)) throw new Error("dial-finale: the window is empty"); + const nums = finaleNumbers(M); + const full = measureTrack(M); + // The dial's track in the finale: every ghost already there, one state of the needle, the latest goal. + const A = from + FINALE_MOTION.grow; + // His highest remembered weight last, so the long ghost stands on it. + const rem = full.remembered.map((r, n) => ({ ...r, t: A, n })); + const peakAt = rem.reduce((b, r, n) => (r.value > rem[b].value ? n : b), 0); + const track = { + ...full, + current: [{ t: from, value: null }, { t: A + 0.4, value: nums.weight, qualifier: nums.qualifier, date: null }], + remembered: rem.length ? [...rem.filter((_, n) => n !== peakAt), rem[peakAt]] : [], + goals: nums.goal ? [{ t: from, goal: null }, { t: A + 0.4, goal: nums.goal }] : [{ t: from, goal: null }], + }; + const size = even(Math.min(H, Math.round(W * 0.56))); + const k = size / 524; + const dial = dialParts({ size, ox: 0, oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, prefix: "f" }); + const rw = W - size - Math.round(40 * k); + const top = Math.max(Number(M.totals?.lost) || 0, nums.lost); + const wheels = wheelCount(top); + const ob = { x: size + Math.round(40 * k), y: Math.floor((H - size) / 2) + Math.round(24 * k), width: rw }; + const odo = odometerParts({ + W: rw, H: H - ob.y, u: Math.min(1, rw / 420), cfg: { ...ocfg, runs: true }, colors, fonts, + track: { lost: [{ t: from, total: 0, runs: 0 }, { t: A + 0.6, total: nums.lost, runs: nums.runs }] }, wheels, + netList: [{ t: from, net: null }, { t: A + 3.2, net: nums.from !== null && nums.weight !== null ? { from: nums.from, to: nums.weight } : null }], + prefix: "o", big: true, + }); + const L = cueList(fps); + L.set("rt", { autoAlpha: 0 }); + L.add("rt", A, 0.4, { autoAlpha: 1 }, "power2.out"); + const D = Number(schedule.transition) || 0; + if (D > 0 && from + dur - D > A + 0.4) L.add("rt", from + dur - D, D, { autoAlpha: 0 }, "power1.in"); + // The needle starts at his highest remembered weight (the scale's top without one) and drops. + const start = Number.isFinite(nums.peak) ? nums.peak : M.scale.max; + dialCues(L, { track, scale: M.scale, cfg, prefix: "f", finale: true }); + L.set("fnd", { rotation: dialAngle(start, M.scale) }); + if (Number.isFinite(nums.weight)) L.add("fnd", A + 0.4, 1.8, { rotation: dialAngle(nums.weight, M.scale) }, "back.out(1.4)"); + for (let i = 0; i <= wheels; i += 1) L.set(`ow${i}`, { y: 0 }); + rollCues(L, { a: 0, b: nums.lost, t: A + 0.6, dur: 2.6, wheels, wh: odo.wh, prefix: "o", ease: "power3.out" }); + blocks(L, [{ t: from, runs: 0 }, { t: A + 0.6 + 2.6, runs: nums.runs }], "orn", { fade: 0.3, shown: (x) => x.runs > 0 }); + blocks(L, [{ t: from }, { t: A + 3.2 }], "ont", { fade: 0.5, shown: (x) => x.t > from }); + // NET comes in whole, its word with its number. + L.set("onet", { autoAlpha: 0 }); + L.add("onet", A + 3.2, 0.5, { autoAlpha: 1 }, "power1.out"); + const { init, cues } = L.build(); + return pageHtml({ + id: "dial-finale", W, H, fps, fonts, gsap: opts.gsap, + data: { from, dur, init, cues }, + css: `#rt { position: absolute; inset: 0; }${dial.css} + .ob { position: absolute; left: ${ob.x}px; top: ${ob.y}px; width: ${ob.width}px; height: ${H - ob.y}px; }${odo.css}`, + body: `<div id="rt" data-k="rt">${dial.html}<div class="ob">${odo.html}</div></div>`, + }); +} + +export { railGap }; diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -28,6 +28,7 @@ import { claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, tallyOf, tallyVerdicts, validateFactcheck, } from "./factcheck.mjs"; import { resolveCounter } from "./counter.mjs"; +import { INSTRUMENT_COLUMN, instrumentsOn, instrumentsWanted } from "./instruments.mjs"; import { TRAILER_HIT_TIERS, TRAILER_SWELL } from "./trailer-hits.mjs"; import { DECK_PAD_X, COUNTER_CELL } from "./modules/design.mjs"; import { @@ -115,6 +116,9 @@ export function resolveDeck(render) { if (sh !== undefined && sh !== null) { merged.posts = { ...merged.posts, shift: sh === false ? false : { ...DECK_DEFAULTS.posts.shift, ...sh } }; } + // The instruments' column (instruments.mjs) takes the frame's right side: + // the posts stay in the footage box, and nothing moves them over it. + if (instrumentsOn(render)) merged.posts = { ...merged.posts, shift: false }; return merged; } @@ -175,7 +179,8 @@ 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). - unknownKeys(d, [...Object.keys(DECK_DEFAULTS), "finale", "claims", "counter", "rail", "sectionTitle"], w, errors); + // `dial`, `odometer` and `trail` (instruments.mjs: the measure's instruments) likewise. + unknownKeys(d, [...Object.keys(DECK_DEFAULTS), "finale", "claims", "counter", "rail", "sectionTitle", "dial", "odometer", "trail"], w, errors); deckChecked = true; } errors.push(...entry.validate(settingValue(chrome, entry), { render, chrome, deck: d, where: w })); @@ -190,6 +195,15 @@ export function validateChrome(chrome, render = {}) { // sees the posts. if (d.posts !== undefined && resolveDeck({ chrome }).posts.show) errors.push(...postsFitErrors({ ...render, chrome })); const room = g.H - g.deck.height; + // The instruments take the frame's right side (instrumentsGeometry): the + // side panel would take the left and move the footage into them, and the + // feed is a column of its own. + const instruments = instrumentsWanted({ chrome }); + if (instruments.length) { + const names = instruments.map((n) => `${w}.${n}`).join(", "); + if (railOn({ chrome })) errors.push(`${threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips"} and ${names} both need the frame beside the footage: set one`); + if (resolveDeck({ chrome }).posts.layout === "feed") errors.push(`${names} need the popup posts, not the feed (${w}.posts.layout)`); + } if (railOn({ chrome })) { const which = threadsOn({ chrome }) ? "render.chrome.threads" : "render.chrome.flips"; if (resolveDeck({ chrome }).posts.layout === "feed") errors.push(`${which} needs the popup posts, not the feed`); @@ -429,9 +443,14 @@ export function deckGeometry(render) { // A two-line subtitle grows the band by its head line (subtitleBoxes): // the footage box stands on the band's top edge wherever that is. const dh = deck.height + subtitleBoxes(deck).extra; - const fw = even(W * deck.footageScale); + // The instruments' column (instruments.mjs) takes the right: the footage + // gives it room and stands at the left edge, `railGap` in. + const inst = instrumentsOn(render); + const fw = inst + ? Math.min(even(W * deck.footageScale), even(W - INSTRUMENT_COLUMN * (W / 1920) - 3 * railGap(render))) + : even(W * deck.footageScale); const fh = even((fw * H) / W); - const fx = railOn(render) ? W - fw - railGap(render) : Math.floor((W - fw) / 2); + const fx = inst ? railGap(render) : railOn(render) ? W - fw - railGap(render) : Math.floor((W - fw) / 2); return { W, H, footage: { x: fx, y: Math.floor((H - dh - fh) / 2), width: fw, height: fh }, @@ -458,6 +477,42 @@ export function threadsGeometry(render) { }; } +/** + * The instruments' column (instruments.mjs) and each instrument's region in it, + * frame px: from the footage's right edge `railGap` over to `railGap` short of + * the frame's, from `railGap` under the top to `railGap` over the deck. The + * instruments that are on stack in it top-down -- the dial, the odometer, the + * trail -- the odometer and the trail at their own heights, the dial taking + * what is left (a square face at most). An instrument that is off is null. + * At 1920x1080 with all three: footage 1248x702 at (24, 94), the column + * 600x842 at (1296, 24), the dial 600x540, the odometer 600x140, the trail + * 600x138. + * + * @returns {{ column: {x:number,y:number,width:number,height:number}, + * dial: {x:number,y:number,width:number,height:number}|null, + * odometer: {x:number,y:number,width:number,height:number}|null, + * trail: {x:number,y:number,width:number,height:number}|null }} + */ +export function instrumentsGeometry(render) { + const { W, deck, footage } = deckGeometry(render); + const k = W / 1920; + const gap = railGap(render); + const x = footage.x + footage.width + gap; + const column = { x, y: gap, width: W - gap - x, height: deck.y - 2 * gap }; + const on = instrumentsWanted(render); + const between = Math.round(12 * k); + const fixed = { odometer: Math.round(140 * k), trail: Math.round(138 * k) }; + const out = { column, dial: null, odometer: null, trail: null }; + const rest = column.height - on.filter((n) => n !== "dial").reduce((a, n) => a + fixed[n], 0) - between * (on.length - 1); + let y = column.y; + for (const n of on) { + const h = n === "dial" ? even(Math.max(0, Math.min(rest, column.width))) : fixed[n]; + out[n] = { x: column.x, y, width: column.width, height: h }; + y += h + between; + } + return out; +} + /** The air the band keeps under its text block, px. */ export const BAND_FOOT = 0; /** In a crowded band, the share of the width the title and byline keep at the left (the section title stays out of it). */ diff --git a/umtool/report-to-video/fixtures/measure-dial/make.mjs b/umtool/report-to-video/fixtures/measure-dial/make.mjs @@ -0,0 +1,53 @@ +// The measure-dial fixture (lane scale-dial): a SMALL measure slice for the +// instruments' tests, stills and e2e, cut from the orchestrator's synthetic +// slice (real ledger rows, fake cut times; not the producer's output): +// +// node umtool/report-to-video/fixtures/measure-dial/make.mjs <measure-slice.fixture.json> +// +// Keeps the rows named in ROWS -- every kind the dial, the odometer and the +// trail draw: stated weights with and without a qualifier, remembered +// weights, goals, loss claims, the "under 300" claims -- with the state after +// each, every `t` respread over a 62 s cut (one every 1.75 s from 2 s), the +// quotes dropped. Deterministic: the same input writes the same file. +import { readFileSync, writeFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROWS = [ + "w01", "w06", "w07", "w21", "w26", "w27", "w34", "w35", "w54", "w59", "w62", "w73", "w74", "w75", "w76", "w78", + "w80", "w83", "w87", "w89", "w93", "w99", "w102", "w106", "w107", "w110", "w114", "w115", "w116", "w117", "w118", "w120", +]; +const STEP = 1.75; +const FIRST = 2; + +const src = process.argv[2]; +if (!src) { + console.error("usage: make.mjs <measure-slice.fixture.json>"); + process.exit(2); +} +const M = JSON.parse(readFileSync(src, "utf8")); +const keep = new Set(ROWS); +const idx = M.events.map((e, i) => [e, i]).filter(([e]) => keep.has(e.row)); +const missing = ROWS.filter((r) => !idx.some(([e]) => e.row === r)); +if (missing.length) throw new Error(`rows not in the slice: ${missing.join(", ")}`); +const r2 = (v) => Math.round(v * 100) / 100; +const slim = (e) => { + const { quote: _q, ...rest } = e; + return rest; +}; +const events = idx.map(([e], n) => ({ ...slim(e), t: r2(FIRST + n * STEP) })); +// The state after each kept event: the slice's state after it (state[i + 1] +// follows events[i]), its goal ids and promises left out. +const stateOf = (s, t) => { + const { goals: _g, promises: _p, diet: _d, ...rest } = s; + return { ...rest, t }; +}; +const state = [stateOf(M.state[0], 0), ...idx.map(([, i], n) => stateOf(M.state[i + 1], events[n].t))]; +const out = { + version: M.version, unit: M.unit, scale: M.scale, asOfRender: M.asOfRender, scopes: M.scopes, + events, hidden: [], state, totals: M.totals, + _fixture: "measure-dial: 32 rows of the orchestrator's synthetic slice (real ledger rows, fake cut times), respread over a 62 s cut. make.mjs writes it.", +}; +const file = path.join(path.dirname(fileURLToPath(import.meta.url)), "measure.json"); +writeFileSync(file, JSON.stringify(out) + "\n"); +console.log(`${file}: ${events.length} events, ${state.length} states`); diff --git a/umtool/report-to-video/fixtures/measure-dial/measure.json b/umtool/report-to-video/fixtures/measure-dial/measure.json @@ -0,0 +1 @@ +{"version":1,"unit":"lb","scale":{"min":220,"max":400},"asOfRender":"2026-11-05","scopes":["weight","regime"],"events":[{"row":"w01","date":"2018-02-20","asOf":null,"kind":"lost","value":-12,"qualifier":null,"display":"-12","label":"down 12 on his first on-camera diet","deadline":null,"regime":null,"event":null,"run":0,"source":"clip","segment":"s002","t":2},{"row":"w06","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,"run":null,"source":"clip","segment":"s009","t":3.75},{"row":"w07","date":"2022-06-15","asOf":null,"kind":"stated","value":240,"qualifier":">","display":"240 lb","label":"'over 240' — said while covering an obese-woman story","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s011","t":5.5},{"row":"w21","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,"run":null,"source":"clip","segment":"s033","t":7.25},{"row":"w26","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,"run":null,"source":"clip","segment":"s040","t":9},{"row":"w27","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,"run":null,"source":"clip","segment":"s041","t":10.75},{"row":"w34","date":"2024-02-07","asOf":null,"kind":"lost","value":-19.4,"qualifier":null,"display":"-19.4","label":"19.4 - the 2024 run's high-water mark","deadline":null,"regime":null,"event":null,"run":3,"source":"clip","segment":"s048","t":12.5},{"row":"w35","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,"run":null,"source":"clip","segment":"s055","t":14.25},{"row":"w54","date":"2025-06-06","asOf":null,"kind":"stated","value":300,"qualifier":">","display":"300 lb","label":"'over 300'","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s093","t":16},{"row":"w59","date":"2025-08-15","asOf":null,"kind":"stated","value":351,"qualifier":null,"display":"351 lb","label":"351 - the first hard current weight in two years","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s102","t":17.75},{"row":"w62","date":"2025-09-12","asOf":null,"kind":"lost","value":-40,"qualifier":"≈","display":"-40","label":"'down about 40' vs the app's 19.2","deadline":null,"regime":null,"event":null,"run":6,"source":"clip","segment":"s106","t":19.5},{"row":"w73","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,"run":null,"source":"clip","segment":"s121","t":21.25},{"row":"w74","date":"2026-01-09","asOf":null,"kind":"stated","value":339,"qualifier":null,"display":"339 lb","label":"339","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s122","t":23},{"row":"w75","date":"2026-01-16","asOf":null,"kind":"lost","value":-43.7,"qualifier":null,"display":"-43.7","label":"43.7 - the largest loss the archive documents in real time","deadline":null,"regime":null,"event":null,"run":7,"source":"clip","segment":"s124","t":24.75},{"row":"w76","date":"2026-01-16","asOf":null,"kind":"stated","value":337,"qualifier":null,"display":"337 lb","label":"337 - 'the lowest weight I've been in probably 10 years'","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s125","t":26.5},{"row":"w78","date":"2026-01-16","asOf":null,"kind":"goal","value":240,"qualifier":"≈","display":"240","label":"the eventual target","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s127","t":28.25},{"row":"w80","date":"2026-07-20","asOf":null,"kind":"stated","value":300,"qualifier":null,"display":"300 lb","label":"300, at the keto launch","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s136","t":30},{"row":"w83","date":"2026-07-23","asOf":null,"kind":"lost","value":-5,"qualifier":null,"display":"-5","label":"almost five, on day four","deadline":null,"regime":null,"event":null,"run":8,"source":"clip","segment":"s139","t":31.75},{"row":"w87","date":"2026-07-31","asOf":null,"kind":"stated","value":338,"qualifier":null,"display":"338 lb","label":"338 - one pound above where January left him","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s144","t":33.5},{"row":"w89","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,"run":null,"source":"clip","segment":"s146","t":35.25},{"row":"w93","date":"2026-08-03","asOf":null,"kind":"stated","value":335.5,"qualifier":null,"display":"335.5 lb","label":"335.5 this morning","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s150","t":37},{"row":"w99","date":"2026-08-20","asOf":null,"kind":"stated","value":327,"qualifier":null,"display":"327 lb","label":"327 - \"twenty two pounds in a month\"","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s157","t":38.75},{"row":"w102","date":"2026-08-28","asOf":null,"kind":"stated","value":320,"qualifier":null,"display":"320 lb","label":"320 - \"this is actually bonkers\"","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s160","t":40.5},{"row":"w106","date":"2026-09-15","asOf":null,"kind":"lost","value":-36.1,"qualifier":null,"display":"-36.1","label":"down 36.1 \"since starting keto\"","deadline":null,"regime":null,"event":null,"run":8,"source":"clip","segment":"s166","t":42.25},{"row":"w107","date":"2026-09-15","asOf":null,"kind":"stated","value":300,"qualifier":">","display":"300 lb","label":"\"I haven't been under 300 since college\"","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s167","t":44},{"row":"w110","date":"2026-09-24","asOf":null,"kind":"stated","value":310.5,"qualifier":null,"display":"310.5 lb","label":"310.5 - \"the weight loss has slowed\"","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s170","t":45.75},{"row":"w114","date":"2026-10-07","asOf":null,"kind":"lost","value":-46.2,"qualifier":null,"display":"-46.2","label":"down 46.2, a day after \"47\"","deadline":null,"regime":null,"event":null,"run":8,"source":"clip","segment":"s173","t":47.5},{"row":"w115","date":"2026-10-15","asOf":null,"kind":"stated","value":300,"qualifier":"<","display":"300 lb","label":"\"under three hundred for the first time since college\" - down 50.1","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s174","t":49.25},{"row":"w116","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,"run":null,"source":"clip","segment":"s175","t":51},{"row":"w117","date":"2026-10-23","asOf":null,"kind":"stated","value":291,"qualifier":null,"display":"291 lb","label":"\"291.\" - with the scale-video offer (X)","deadline":null,"regime":null,"event":null,"run":null,"source":"post","segment":"s177","t":52.75},{"row":"w118","date":"2026-10-26","asOf":"2026-10-23","kind":"stated","value":291.5,"qualifier":null,"display":"291.5 lb","label":"291.5 on Friday - \"a new all time low\" then \"back up\"","deadline":null,"regime":null,"event":null,"run":null,"source":"clip","segment":"s179","t":54.5},{"row":"w120","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,"run":null,"source":"post","segment":"s180","t":56.25}],"hidden":[],"state":[{"t":0,"current":null,"remembered":[],"goal":null,"lost":{"total":0,"runs":[]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":null}},{"t":2,"current":null,"remembered":[],"goal":null,"lost":{"total":12,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":null}},{"t":3.75,"current":null,"remembered":[],"goal":{"value":null,"loss":100,"deadline":null,"row":"w06"},"lost":{"total":25.5,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":null}},{"t":5.5,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[],"goal":{"value":null,"loss":100,"deadline":null,"row":"w06"},"lost":{"total":25.5,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":7.25,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"}],"goal":{"value":165,"loss":75,"deadline":null,"row":"w19"},"lost":{"total":54.5,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":9,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"}],"goal":{"value":140,"loss":100,"deadline":null,"row":"w22"},"lost":{"total":54.5,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":10.75,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"}],"goal":{"value":250,"loss":null,"deadline":null,"row":"w27"},"lost":{"total":54.5,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":12.5,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"}],"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"lost":{"total":73.9,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":14.25,"current":{"value":240,"qualifier":">","row":"w07","date":"2022-06-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"}],"goal":{"value":230,"loss":null,"deadline":null,"row":"w32"},"lost":{"total":73.9,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":240,"date":"2022-06-15","row":"w07"}}},{"t":16,"current":{"value":300,"qualifier":">","row":"w54","date":"2025-06-06"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"}],"goal":{"value":140,"loss":100,"deadline":null,"row":"w50"},"lost":{"total":90.4,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":7.5,"row":"w47"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2025-06-06","row":"w54"}}},{"t":17.75,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"}],"goal":{"value":265,"loss":null,"deadline":null,"row":"w57"},"lost":{"total":90.4,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":7.5,"row":"w47"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"}}},{"t":19.5,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"}],"goal":{"value":275,"loss":null,"deadline":null,"row":"w61"},"lost":{"total":122.9,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"}}},{"t":21.25,"current":{"value":351,"qualifier":null,"row":"w59","date":"2025-08-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"lost":{"total":122.9,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":351,"date":"2025-08-15","row":"w59"}}},{"t":23,"current":{"value":339,"qualifier":null,"row":"w74","date":"2026-01-09"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"lost":{"total":122.9,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":339,"date":"2026-01-09","row":"w74"}}},{"t":24.75,"current":{"value":339,"qualifier":null,"row":"w74","date":"2026-01-09"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"lost":{"total":166.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":339,"date":"2026-01-09","row":"w74"}}},{"t":26.5,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":331,"loss":20,"deadline":null,"row":"w72"},"lost":{"total":166.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"}}},{"t":28.25,"current":{"value":337,"qualifier":null,"row":"w76","date":"2026-01-16"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"lost":{"total":166.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":337,"date":"2026-01-16","row":"w76"}}},{"t":30,"current":{"value":300,"qualifier":null,"row":"w80","date":"2026-07-20"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"lost":{"total":166.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-20","row":"w80"}}},{"t":31.75,"current":{"value":300,"qualifier":null,"row":"w80","date":"2026-07-20"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":240,"loss":null,"deadline":null,"row":"w78"},"lost":{"total":171.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":5,"row":"w83"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-07-20","row":"w80"}}},{"t":33.5,"current":{"value":338,"qualifier":null,"row":"w87","date":"2026-07-31"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"}],"goal":{"value":250,"loss":50,"deadline":null,"row":"w85"},"lost":{"total":177.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":338,"date":"2026-07-31","row":"w87"}}},{"t":35.25,"current":{"value":338,"qualifier":null,"row":"w87","date":"2026-07-31"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"}],"goal":{"value":250,"loss":null,"deadline":null,"row":"w88"},"lost":{"total":177.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":338,"date":"2026-07-31","row":"w87"}}},{"t":37,"current":{"value":335.5,"qualifier":null,"row":"w93","date":"2026-08-03"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":177.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":11,"row":"w86"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":335.5,"date":"2026-08-03","row":"w93"}}},{"t":38.75,"current":{"value":327,"qualifier":null,"row":"w99","date":"2026-08-20"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":185.2,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":18.6,"row":"w97"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":327,"date":"2026-08-20","row":"w99"}}},{"t":40.5,"current":{"value":320,"qualifier":null,"row":"w102","date":"2026-08-28"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":188.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":22,"row":"w100"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":320,"date":"2026-08-28","row":"w102"}}},{"t":42.25,"current":{"value":320,"qualifier":null,"row":"w102","date":"2026-08-28"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":202.7,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":36.1,"row":"w106"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":320,"date":"2026-08-28","row":"w102"}}},{"t":44,"current":{"value":300,"qualifier":">","row":"w107","date":"2026-09-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":202.7,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":36.1,"row":"w106"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-09-15","row":"w107"}}},{"t":45.75,"current":{"value":310.5,"qualifier":null,"row":"w110","date":"2026-09-24"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"}],"goal":{"value":235,"loss":null,"deadline":null,"row":"w90"},"lost":{"total":203.6,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":37,"row":"w108"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":310.5,"date":"2026-09-24","row":"w110"}}},{"t":47.5,"current":{"value":310.5,"qualifier":null,"row":"w110","date":"2026-09-24"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"}],"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":310.5,"date":"2026-09-24","row":"w110"}}},{"t":49.25,"current":{"value":300,"qualifier":"<","row":"w115","date":"2026-10-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"}],"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-10-15","row":"w115"}}},{"t":51,"current":{"value":300,"qualifier":"<","row":"w115","date":"2026-10-15"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":300,"date":"2026-10-15","row":"w115"}}},{"t":52.75,"current":{"value":291,"qualifier":null,"row":"w117","date":"2026-10-23"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":291,"date":"2026-10-23","row":"w117"}}},{"t":54.5,"current":{"value":291.5,"qualifier":null,"row":"w118","date":"2026-10-26"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":225,"loss":null,"deadline":null,"row":"w111"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":291.5,"date":"2026-10-26","row":"w118"}}},{"t":56.25,"current":{"value":291.5,"qualifier":null,"row":"w118","date":"2026-10-26"},"remembered":[{"value":390,"asOf":"2023-07-01","row":"w21","date":"2023-09-29"},{"value":365.7,"asOf":"2023-12-31","row":"w26","date":"2024-01-12"},{"value":365.7,"asOf":"2023-12-31","row":"w31","date":"2024-01-30"},{"value":368,"asOf":"2008-06-30","row":"w35","date":"2024-04-25"},{"value":370,"asOf":"2025-02-01","row":"w51","date":"2025-05-02"},{"value":390,"asOf":"2024-07-01","row":"w55","date":"2025-07-15"},{"value":335,"asOf":"2024-05-09","row":"w56","date":"2025-07-15"},{"value":387,"asOf":"2025-04-15","row":"w60","date":"2025-08-15"},{"value":385,"asOf":"2025-02-01","row":"w73","date":"2026-01-09"},{"value":390,"asOf":"2025-02-01","row":"w89","date":"2026-07-31"},{"value":349,"asOf":"2026-07-19","row":"w91","date":"2026-08-03"},{"value":342,"asOf":"2026-07-27","row":"w92","date":"2026-08-03"},{"value":365.7,"asOf":"2023-12-31","row":"w103","date":"2026-08-28"},{"value":390,"asOf":"2024-09-01","row":"w109","date":"2026-09-17"},{"value":390,"asOf":"2025-02-01","row":"w116","date":"2026-10-15"}],"goal":{"value":226.5,"loss":65,"deadline":"by Christmas","row":"w120"},"lost":{"total":212.8,"runs":[{"run":0,"start":"2018-02-20","peak":12,"row":"w01"},{"run":1,"start":"2021-04-30","peak":13.5,"row":"w04"},{"run":2,"start":"2023-05-09","peak":29,"row":"w18"},{"run":3,"start":"2024-01-26","peak":19.4,"row":"w34"},{"run":5,"start":"2024-11-15","peak":9,"row":"w43"},{"run":6,"start":"2025-04-11","peak":40,"row":"w62"},{"run":7,"start":"2026-01-16","peak":43.7,"row":"w75"},{"run":8,"start":"2026-07-23","peak":46.2,"row":"w114"}]},"net":{"from":{"value":368,"date":"2008-06-30","row":"w35"},"to":{"value":291.5,"date":"2026-10-26","row":"w118"}}}],"totals":{"lost":212.8,"net":{"from":368,"to":291.5,"value":-76.5},"runs":8,"goals":29,"goalRepeats":{"lose 100":8},"diets":66,"peakDrift":[365.7,370,385,387,390],"under300":{"said":3,"rows":["w107","w115","w117"]},"span":{"from":"2008-06-30","to":"2026-11-03"}},"_fixture":"measure-dial: 32 rows of the orchestrator's synthetic slice (real ledger rows, fake cut times), respread over a 62 s cut. make.mjs writes it."} diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs @@ -0,0 +1,144 @@ +// THE INSTRUMENTS (rev 9 of the weight video, lane scale-dial): three deck +// modules that read the schedule's MEASURE slice (`doc.measure`, written by the +// build from a manifest's measure ledger) and stand in a column at the frame's +// right, the clip moved to the left to make room for it: +// +// render.chrome.deck.dial an analog bathroom-scale face: a red needle to +// every weight he states, on the word, with a +// spring; his remembered weights as grey ghosts; +// his latest goal as an amber tick on the bezel +// render.chrome.deck.odometer rolling digits of the pounds he says he has +// lost (only ever up), NET beside them +// render.chrome.deck.trail his stated weights by DATE, a thin line drawn +// up to the playhead, the 300 lb line, a count +// of the times he says he is under it +// +// Each is `true` (its defaults), an object of its settings, or absent/false +// (off). With any of them on the frame changes: the footage box moves to the +// left edge and the column takes the right (deck.mjs deckGeometry, +// instrumentsGeometry); the posts stay in the footage box (`posts.shift` does +// not apply) and the side panel (threads, flips) and the feed are refused. +// `deck.dial.finale` (default on) also draws the dial and the odometer large +// in the finale's lower column (module `dial-finale`). +// +// A LEAF, like modules/settings.mjs: deck.mjs and settings.mjs import it, so it +// imports neither. + +/** The column's width at 1920 wide (scaled with the frame): what the footage gives up. */ +export const INSTRUMENT_COLUMN = 600; + +/** The needle's red, the spec's (contract §Screen design). */ +export const NEEDLE_RED = "#ff5a4e"; + +/** Each instrument's settings and their defaults. */ +export const DIAL_DEFAULTS = Object.freeze({ + // The weight the face accents (its tick and label in the accent colour); null for none. + mark: 300, + // The remembered weights as ghost ticks, the latest a long ghost needle with its as-of date. + ghosts: true, + // The latest goal as an amber tick on the bezel, and its words under the digits. + goal: true, + // The needle's colour: a #hex. + needle: NEEDLE_RED, + // The dial and the odometer drawn large in the finale's lower column (module dial-finale). + finale: true, + // The words over the big digits. + label: "HE SAYS HE WEIGHS", +}); + +export const ODOMETER_DEFAULTS = Object.freeze({ + label: "POUNDS HE SAYS HE'S LOST", + // NET (first stated weight of the record to the latest) in plain digits beside the wheels. + net: true, + // "ACROSS 8 RUNS" under the wheels. + runs: true, +}); + +export const TRAIL_DEFAULTS = Object.freeze({ + // The weight drawn as a line across the trail; null for none. + mark: 300, + // How many times he says he is under 300 (the measure's `totals.under300` rows), as they land. + count: true, + label: "WHAT HE SAYS HE WEIGHS, BY DATE", +}); + +/** A label's characters at most. */ +export const INSTRUMENT_LABEL_MAX = 40; + +const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); +const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/; +const numIn = (v, lo, hi) => typeof v === "number" && Number.isFinite(v) && v >= lo && v <= hi; + +/** An instrument's settings, its defaults filled, or null when it is off. */ +function resolveOne(v, defaults) { + if (v === true) return { ...defaults }; + if (!isObj(v)) return null; + return { ...defaults, ...v }; +} + +export const resolveDial = (render) => resolveOne(render?.chrome?.deck?.dial, DIAL_DEFAULTS); +export const resolveOdometer = (render) => resolveOne(render?.chrome?.deck?.odometer, ODOMETER_DEFAULTS); +export const resolveTrail = (render) => resolveOne(render?.chrome?.deck?.trail, TRAIL_DEFAULTS); + +/** Which instruments the render block asks for, in the column's order (top first). */ +export function instrumentsWanted(render) { + const out = []; + if (resolveDial(render)) out.push("dial"); + if (resolveOdometer(render)) out.push("odometer"); + if (resolveTrail(render)) out.push("trail"); + return out; +} + +/** Is the instrument column on: any of the three asked for. The frame's layout changes with it. */ +export const instrumentsOn = (render) => instrumentsWanted(render).length > 0; + +function labelProblem(v, where) { + if (typeof v !== "string") return `${where} must be text`; + if (/[\r\n]/.test(v)) return `${where} must be one line`; + if ([...v].length > INSTRUMENT_LABEL_MAX) return `${where} is ${[...v].length} characters (at most ${INSTRUMENT_LABEL_MAX})`; + return null; +} + +/** The common shape: absent, true/false, or an object of known keys. */ +function shapeErrors(v, defaults, where) { + if (v === undefined || typeof v === "boolean") return { errors: [], obj: null }; + if (!isObj(v)) return { errors: [`${where} must be true, false or { ${Object.keys(defaults).join(", ")} }`], obj: null }; + const errors = []; + for (const k of Object.keys(v)) { + if (!Object.hasOwn(defaults, k)) errors.push(`${where}.${k} is not a setting of it (${Object.keys(defaults).join(", ")})`); + } + return { errors, obj: v }; +} + +const markProblem = (v, where) => (v === null || numIn(v, 0, 2000) ? null : `${where} must be a weight (0 to 2000) or null`); +const boolProblem = (v, where) => (typeof v === "boolean" ? null : `${where} must be true or false`); + +/** `render.chrome.deck.dial`, as sentences. */ +export function validateDial(v, where = "render.chrome.deck.dial") { + const { errors, obj } = shapeErrors(v, DIAL_DEFAULTS, where); + if (!obj) return errors; + if (obj.mark !== undefined) { const p = markProblem(obj.mark, `${where}.mark`); if (p) errors.push(p); } + for (const k of ["ghosts", "goal", "finale"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); } + if (obj.needle !== undefined && !(typeof obj.needle === "string" && HEX_RE.test(obj.needle))) errors.push(`${where}.needle must be a #hex colour`); + if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); } + return errors; +} + +/** `render.chrome.deck.odometer`, as sentences. */ +export function validateOdometer(v, where = "render.chrome.deck.odometer") { + const { errors, obj } = shapeErrors(v, ODOMETER_DEFAULTS, where); + if (!obj) return errors; + for (const k of ["net", "runs"]) if (obj[k] !== undefined) { const p = boolProblem(obj[k], `${where}.${k}`); if (p) errors.push(p); } + if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); } + return errors; +} + +/** `render.chrome.deck.trail`, as sentences. */ +export function validateTrail(v, where = "render.chrome.deck.trail") { + const { errors, obj } = shapeErrors(v, TRAIL_DEFAULTS, where); + if (!obj) return errors; + if (obj.mark !== undefined) { const p = markProblem(obj.mark, `${where}.mark`); if (p) errors.push(p); } + if (obj.count !== undefined) { const p = boolProblem(obj.count, `${where}.count`); if (p) errors.push(p); } + if (obj.label !== undefined) { const p = labelProblem(obj.label, `${where}.label`); if (p) errors.push(p); } + return errors; +} diff --git a/umtool/report-to-video/instruments.test.mjs b/umtool/report-to-video/instruments.test.mjs @@ -0,0 +1,237 @@ +// The measure's instruments (instruments.mjs, chrome-instruments.mjs, +// modules/dial|odometer|trail|dial-finale.mjs): their settings, the frame they +// make room in, the pages and their frame keys -- and that a cut without them +// draws exactly what it drew before they existed. +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import test from "node:test"; +import { fileURLToPath } from "node:url"; + +import { deckGeometry, estimateSchedule, instrumentsGeometry, postsGeometry, resolveDeck, validateChrome } from "./deck.mjs"; +import { deckHtml } from "./chrome-deck.mjs"; +import { dialFinaleGeometry, dialFinaleHtml, dialHtml, finaleNumbers, odometerHtml, trailHtml } from "./chrome-instruments.mjs"; +import { frameKeys } from "./frame-keys.mjs"; +import { instrumentsOn, resolveDial, validateDial } from "./instruments.mjs"; +import { dialAngle, fmtDate, fmtSigned, measureTrack, wheelDigits, wheelRoll } from "./measure-draw.mjs"; +import { deckOverlays, moduleById, moduleProblems, playModules, scheduleSlices } from "./modules/index.mjs"; +import { slotRect } from "./modules/layout.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8")); +const FPS = 30; + +const chromeWith = (deck = {}) => ({ engine: "hyperframes", layout: "deck", deck }); +const RENDER = { + width: 1920, height: 1080, fps: FPS, transition: 0.4, + palette: { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }, + chrome: chromeWith({ dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false } }), +}; + +/** A deck cut long enough for the fixture's 62 s, its last clip the finale, with the measure in its schedule. */ +function cut(render = RENDER) { + const timeline = Array.from({ length: 9 }, (_, i) => ({ + type: "clip", id: `c${i + 1}`, video: "vidx", start: 10 * i, end: 10 * i + (i === 8 ? 14 : 8), cite: 1, section: 0, + quote: "q", onscreen: { title: `Clip ${i + 1}` }, ...(i === 8 ? { layout: "finale" } : {}), + })); + const manifest = { slug: "m", title: "M", provenance: {}, render, timeline }; + return { manifest, schedule: { ...estimateSchedule(manifest), measure: MEASURE } }; +} + +// --------------------------------------------------------------------------- +// A cut without them is the cut it was. +// --------------------------------------------------------------------------- + +// What the release 28 kit's manifests drew on main before the instruments (c05e5314): the estimate's +// schedule, the deck's page, the frame and every whole-cut overlay's region, hashed. Unchanged. +const BEFORE = { + full: "0eeb6303e621af4b88c8e0eaae2eca7228da0e3dbae997c60fd45fdd5744e18a", + flips: "565472d4e03834bdf8f2fdd656d76f48d1bca37019be27f33422c0f27d6f270e", +}; + +test("a cut without the instruments draws exactly what it drew before them (the release 28 kit's manifests)", () => { + for (const name of ["full", "flips"]) { + const m = JSON.parse(readFileSync(path.join(HERE, "../../common/testing/draft/manifests", `${name}.video.manifest.json`), "utf8")); + const s = estimateSchedule(m); + const render = m.render; + const html = deckHtml(s, render, { fonts: { regular: "assets/r.ttf", bold: "assets/b.ttf" } }); + const regions = deckOverlays().filter((mod) => mod.on(s, render) && mod.kind === "overlay-whole").map((mod) => [mod.id, mod.regions(s, { render, outDir: "/o" })]); + const doc = { s, html, g: deckGeometry(render), regions, slices: Object.keys(scheduleSlices(s)).sort() }; + assert.equal(createHash("sha256").update(JSON.stringify(doc)).digest("hex"), BEFORE[name], name); + assert.ok(!regions.some(([id]) => ["dial", "odometer", "trail"].includes(id))); + assert.equal(instrumentsOn(render), false); + } +}); + +test("the deck's frame is moved only when an instrument is asked for", () => { + const plain = { width: 1920, height: 1080, chrome: chromeWith({}) }; + assert.deepEqual(deckGeometry(plain).footage, { x: 173, y: 2, width: 1574, height: 886 }); + for (const off of [{ dial: false }, { odometer: false, trail: false }]) { + assert.deepEqual(deckGeometry({ ...plain, chrome: chromeWith(off) }).footage, deckGeometry(plain).footage); + } + const g = deckGeometry(RENDER); + assert.deepEqual(g.footage, { x: 24, y: 94, width: 1248, height: 702 }); + const ig = instrumentsGeometry(RENDER); + assert.deepEqual(ig.column, { x: 1296, y: 24, width: 600, height: 842 }); + assert.deepEqual([ig.dial.height, ig.odometer.height, ig.trail.height], [540, 140, 138]); + assert.equal(ig.trail.y + ig.trail.height, g.deck.y - 24); + assert.deepEqual(slotRect("instruments", RENDER), ig.column); + // The dial alone takes a square face; an instrument that is off has no region. + const one = instrumentsGeometry({ ...RENDER, chrome: chromeWith({ odometer: true }) }); + assert.equal(one.dial, null); + assert.equal(one.odometer.y, 24); +}); + +test("with the instruments the posts stay in the footage box: posts.shift does not apply", () => { + assert.ok(resolveDeck({ chrome: chromeWith({}) }).posts.shift); + assert.equal(resolveDeck(RENDER).posts.shift, false); + const p = postsGeometry(RENDER); + const f = deckGeometry(RENDER).footage; + assert.ok(p.x + p.width <= f.x + f.width, "the posts column is inside the footage, clear of the instruments"); +}); + +// --------------------------------------------------------------------------- +// Settings. +// --------------------------------------------------------------------------- + +test("the instruments' settings: true, an object of known keys, or off; the side panel and the feed refused beside them", () => { + assert.deepEqual(validateChrome(RENDER.chrome, RENDER), []); + assert.deepEqual(validateChrome(chromeWith({ dial: { mark: 300, needle: "#ff0000", finale: false } }), {}), []); + assert.match(validateChrome(chromeWith({ dial: { marks: 3 } }), {})[0], /deck\.dial\.marks is not a setting of it/); + assert.match(validateChrome(chromeWith({ odometer: "yes" }), {})[0], /deck\.odometer must be true, false or/); + assert.match(validateChrome(chromeWith({ trail: { mark: "300" } }), {})[0], /deck\.trail\.mark must be a weight/); + assert.deepEqual(validateDial({ label: "x".repeat(41) }), ["render.chrome.deck.dial.label is 41 characters (at most 40)"]); + const feed = validateChrome(chromeWith({ dial: true, posts: { layout: "feed" } }), {}); + assert.ok(feed.some((e) => /need the popup posts, not the feed/.test(e)), feed.join("\n")); + const side = validateChrome({ ...chromeWith({ trail: true }), threads: { list: [{ id: "a", label: "A" }] } }, {}); + assert.ok(side.some((e) => /render\.chrome\.threads and render\.chrome\.deck\.trail both need the frame/.test(e)), side.join("\n")); + assert.deepEqual(resolveDial(RENDER), { mark: 300, ghosts: true, goal: true, needle: "#ff5a4e", finale: true, label: "HE SAYS HE WEIGHS" }); + assert.equal(resolveDial({ chrome: chromeWith({ dial: false }) }), null); + assert.deepEqual(moduleProblems({ render: { ...RENDER, chrome: chromeWith({ dial: { ghost: true } }) } }).dial, ["render.chrome.deck.dial.ghost is not a setting of it (mark, ghosts, goal, needle, finale, label)"]); +}); + +// --------------------------------------------------------------------------- +// The slice and the modules. +// --------------------------------------------------------------------------- + +test("the measure is a slice only when the schedule has one; each instrument is on with its setting and the measure", () => { + const { schedule } = cut(); + const { measure: _m, ...bare } = schedule; + assert.equal(scheduleSlices(schedule).measure, MEASURE); + assert.equal("measure" in scheduleSlices(bare), false); + for (const id of ["dial", "odometer", "trail"]) { + const m = moduleById(id); + assert.equal(m.on(schedule, RENDER), true, id); + assert.equal(m.on(bare, RENDER), false, id); + assert.equal(m.on(schedule, { ...RENDER, chrome: chromeWith({}) }), false, id); + assert.match(m.check(bare, RENDER), /needs a schedule with a measure/); + assert.equal(m.regions(schedule, { render: RENDER, outDir: "/o" })[0].frames, `/o/chrome/${id}-frames`); + assert.ok(playModules().includes(m), id); + } + const fin = moduleById("dial-finale"); + assert.equal(fin.on(schedule, RENDER), true); + assert.equal(fin.on(schedule, { ...RENDER, chrome: chromeWith({ dial: { finale: false } }) }), false); + const [r] = fin.regions(schedule, { render: RENDER, outDir: "/o" }); + assert.deepEqual([r.x, r.y, r.width, r.height], [48, 448, 1008, 596]); + assert.equal(r.offset, r.window.from); + // Stats cards fill the finale's lower column: no room, and it says so. + const crowded = { ...RENDER, chrome: chromeWith({ dial: true, finale: { video: "side", stats: [{ label: "A", value: "1" }] } }) }; + assert.equal(dialFinaleGeometry(schedule, crowded), null); + assert.match(fin.check(schedule, crowded), /needs the finale's lower column clear/); +}); + +// --------------------------------------------------------------------------- +// The measure, read. +// --------------------------------------------------------------------------- + +test("measureTrack: the stated weights, the ghosts, a goal, and an odometer that only goes up", () => { + const t = measureTrack(MEASURE); + assert.equal(t.current[0].value, null); + assert.deepEqual(t.current.slice(1, 3).map((c) => [c.value, c.qualifier]), [[240, ">"], [300, ">"]]); + // A stated weight with an as-of is dated by its weighing: 291.5 "on Friday". + assert.equal(t.current.at(-1).date, "2026-10-23"); + assert.equal(t.remembered.length, MEASURE.state.at(-1).remembered.length); + for (let i = 1; i < t.lost.length; i += 1) assert.ok(t.lost[i].total >= t.lost[i - 1].total); + assert.equal(t.lost.at(-1).total, 212.8); + assert.deepEqual(t.under.map((u) => u.row), ["w107", "w115", "w117"]); + assert.equal(t.stated.length, 15); + // A loss that would lower the total holds it at its highest. + const lower = { ...MEASURE, state: [...MEASURE.state, { ...MEASURE.state.at(-1), t: 61, lost: { total: 100, runs: MEASURE.state.at(-1).lost.runs } }] }; + assert.equal(measureTrack(lower).lost.at(-1).total, 212.8); +}); + +test("the dial's angles, the odometer's wheels, the words", () => { + const scale = { min: 220, max: 400 }; + assert.deepEqual([dialAngle(220, scale), dialAngle(310, scale), dialAngle(400, scale), dialAngle(500, scale)], [-135, 0, 135, 135]); + assert.deepEqual(wheelDigits(212.8, 3), [2, 1, 2, 8]); + // 90.4 -> 122.9: the hundreds 0 -> 1, the tens 9 through 0 to 2, the lower wheels a turn more. + assert.deepEqual(wheelRoll(90.4, 122.9, 3), [ + { from: 0, to: 1, settle: null }, { from: 9, to: 12, settle: 2 }, { from: 0, to: 12, settle: 2 }, { from: 4, to: 19, settle: 9 }, + ]); + assert.equal(fmtDate("2026-10-26"), "26 OCT 2026"); + assert.equal(fmtDate("2025-02-01"), "FEB 2025"); + assert.equal(fmtSigned(-76.5), "−76.5"); +}); + +// --------------------------------------------------------------------------- +// The pages: cue interpreters the frame keys model. +// --------------------------------------------------------------------------- + +const fonts = { DeckSans: "assets/DeckSans.ttf", DeckSansBold: "assets/DeckSansBold.ttf" }; + +test("the dial's page: the needle swings on each stated weight and is keyed once at rest", () => { + const { schedule } = cut(); + const html = dialHtml(schedule, RENDER, { fonts }); + assert.match(html, /data-composition-id="dial"/); + assert.match(html, /dial:ready/); + assert.match(html, />&gt;240<i>LB<\/i>/); + assert.match(html, /HE SAYS HE WEIGHS/); + const frames = Math.round(schedule.total * FPS); + const keys = frameKeys({ html, region: "dial", fps: FPS, frames, version: "t" }); + assert.ok(keys, "the frame keys model the dial's page"); + const at = (s) => keys[Math.round(s * FPS)]; + // Before the first stated weight (5.5 s) the needle rests: one key. During the swing every frame is new. + assert.equal(at(4.0), at(5.0)); + assert.notEqual(at(5.6), at(5.8)); + // After it settles (and its wedge is in), at rest again until the next event (7.25 s). + assert.equal(at(6.5), at(7.0)); + const distinct = new Set(keys).size; + assert.ok(distinct < frames / 2, `${distinct} distinct frames of ${frames}: the needle at rest is reused`); +}); + +test("the odometer's and the trail's pages are modelled too, and draw what the measure says", () => { + const { schedule } = cut(); + const frames = Math.round(schedule.total * FPS); + const odo = odometerHtml(schedule, RENDER, { fonts }); + assert.match(odo, /POUNDS HE SAYS HE&#39;S LOST|POUNDS HE SAYS HE'S LOST/); + assert.match(odo, /−76\.5/); + assert.match(odo, /368 → 291\.5/); + assert.match(odo, /ACROSS 8 RUNS/); + const ok = frameKeys({ html: odo, region: "odometer", fps: FPS, frames, version: "t" }); + assert.ok(ok); + assert.ok(new Set(ok).size < frames / 2); + const trail = trailHtml(schedule, RENDER, { fonts }); + assert.match(trail, /UNDER 300 · SAID 3×/); + const tk = frameKeys({ html: trail, region: "trail", fps: FPS, frames, version: "t" }); + assert.ok(tk); + assert.ok(new Set(tk).size < frames / 2); +}); + +test("the dial's finale: the record's numbers, a window page the frame keys model", () => { + const { schedule } = cut(); + const n = finaleNumbers(MEASURE); + assert.deepEqual([n.weight, n.lost, n.runs, n.from, n.peak], [291.5, 212.8, 8, 368, 390]); + const fin = moduleById("dial-finale"); + const win = fin.window(schedule, { fps: FPS, total: schedule.total }); + const html = dialFinaleHtml(schedule, RENDER, win, { fonts }); + assert.match(html, /data-composition-id="dial-finale"/); + assert.match(html, />291\.5<i>LB<\/i>/); + assert.match(html, /GOAL 226\.5 · BY CHRISTMAS/); + const keys = frameKeys({ html, region: "dial-finale", fps: FPS, frames: win.frames, version: "t" }); + assert.ok(keys); + // Held once the needle, the wheels and NET are in (by 4 s into the window): one key. + const at = (sec) => keys[Math.round((sec - win.from) * FPS)]; + assert.equal(at(win.from + 6), at(win.from + 9)); + assert.notEqual(at(win.from + 1.5), at(win.from + 1.6)); +}); diff --git a/umtool/report-to-video/measure-draw.mjs b/umtool/report-to-video/measure-draw.mjs @@ -0,0 +1,392 @@ +// THE MEASURE'S DRAWING KIT (lane scale-dial): the pure pieces the measure's +// pages share -- the dial (chrome-instruments.mjs: `dial`, `dial-finale`), the +// odometer, the trail, and any later module that reads `schedule.measure` +// (measure-extras' goals, peak, promise and diet are meant to take them too): +// +// - cueList: a cue interpreter's `init` and `cues` (chrome-deck.mjs says why +// a page is one), every cue with its FROM stated and clamped so no two run +// on one element at once -- the shape frame-keys.mjs models, so a frame +// whose values are a frame's before it is reused, not captured again; +// - measureTrack: the measure's states read once into what changes when +// (the stated weight, the remembered ones, the goal, the odometer's total, +// NET, the "under 300" claims); +// - the dial's face, its angles and the odometer's wheels, as markup; +// - pageHtml: the page around them -- HyperFrames' root and clip, the data +// script, and the interpreter with `?still=` and the preview's `deck:seek`. +// +// Pure: strings in, strings out. No fs. +import { cueTime, pageDuration } from "./deck.mjs"; + +/** Instant cues still take a millisecond: a zero-duration tween has its own seek rules. */ +export const INSTANT = 0.001; + +export const r4 = (v) => Math.round(v * 10000) / 10000; +const r2 = (v) => Math.round(v * 100) / 100; + +export const esc = (s) => + String(s ?? "") + .replace(/&/g, "&amp;") + .replace(/</g, "&lt;") + .replace(/>/g, "&gt;") + .replace(/"/g, "&quot;"); + +/** + * A cue list being built. `add(k, at, dur, to, ease)` asks for element `k` + * to reach `to` over [at, at + dur]; `build()` orders them, clamps each to + * start once the last cue on its element has finished (shortened to end + * where it would have), and states every FROM (the last `to` on that + * element, or its init). Times land on the deck's sub-frame grid (cueTime), + * so a moment the cut moved by whole frames draws exactly what it drew. + */ +export function cueList(fps) { + const init = {}; + const ev = []; + return { + init, + set(k, props) { + init[k] = { ...(init[k] ?? {}), ...props }; + }, + add(k, at, dur, to, ease = "none") { + if (!Number.isFinite(at)) return; + const rounded = Object.fromEntries(Object.entries(to).map(([p, v]) => [p, typeof v === "number" ? r4(v) : v])); + ev.push({ k, at: cueTime(Math.max(0, at), fps), dur: r4(Math.max(INSTANT, dur)), to: rounded, ease, n: ev.length }); + }, + build() { + ev.sort((a, b) => a.at - b.at || a.n - b.n); + const state = Object.fromEntries(Object.entries(init).map(([k, v]) => [k, { ...v }])); + const freeAt = new Map(); + const cues = []; + for (const e of ev) { + let { at, dur } = e; + const free = freeAt.get(e.k) ?? 0; + if (at < free) { + const end = at + dur; + at = r4(free); + dur = r4(Math.max(INSTANT, end - at)); + } + const cur = state[e.k] ?? (state[e.k] = {}); + const from = {}; + for (const p of Object.keys(e.to)) from[p] = cur[p]; + Object.assign(cur, e.to); + freeAt.set(e.k, r4(at + dur)); + cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease }); + } + return { init, cues }; + }, + }; +} + +// --------------------------------------------------------------------------- +// Words and numbers. +// --------------------------------------------------------------------------- + +const MONTHS = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]; + +/** "2026-10-26" as "26 OCT 2026"; a first of the month (an approximate as-of) as "JUL 2023". */ +export function fmtDate(iso, { day = true } = {}) { + const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso ?? "")); + if (!m) return ""; + const mon = MONTHS[Number(m[2]) - 1] ?? ""; + return day && m[3] !== "01" ? `${Number(m[3])} ${mon} ${m[1]}` : `${mon} ${m[1]}`; +} + +/** A weight as he gave it: whole when whole, else to a tenth. */ +export function fmtWeight(v) { + if (!Number.isFinite(v)) return "—"; + const r = Math.round(v * 10) / 10; + return Number.isInteger(r) ? String(r) : r.toFixed(1); +} + +/** A signed difference with a real minus: "−76.5", "+4". */ +export function fmtSigned(v) { + if (!Number.isFinite(v)) return "—"; + const s = fmtWeight(Math.abs(v)); + return v < 0 ? `−${s}` : v > 0 ? `+${s}` : "0"; +} + +/** The qualifier as the dial prints it before the digits. */ +export const qualifierMark = (q) => (q === "≈" ? "≈" : q === ">" ? ">" : q === "<" ? "<" : ""); + +/** A day number for an ISO date (for spacing by date). */ +export const dayNumber = (iso) => { + const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso ?? "")); + return m ? Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])) / 86400000 : NaN; +}; + +// --------------------------------------------------------------------------- +// The measure, read into what changes when. +// --------------------------------------------------------------------------- + +/** The index of the state in force at cut second `t` (the last with state.t <= t). */ +export function stateIndexAt(states, t) { + let lo = 0, hi = states.length - 1, ans = 0; + while (lo <= hi) { + const mid = (lo + hi) >> 1; + if (states[mid].t <= t + 1e-9) { ans = mid; lo = mid + 1; } else hi = mid - 1; + } + return ans; +} + +const sameCurrent = (a, b) => (a?.row ?? null) === (b?.row ?? null) && (a?.value ?? null) === (b?.value ?? null) && (a?.qualifier ?? null) === (b?.qualifier ?? null); +const sameGoal = (a, b) => (a?.row ?? null) === (b?.row ?? null) && (a?.value ?? null) === (b?.value ?? null); +const sameNet = (a, b) => (a?.from?.row ?? null) === (b?.from?.row ?? null) && (a?.to?.row ?? null) === (b?.to?.row ?? null) && + (a?.from?.value ?? null) === (b?.from?.value ?? null) && (a?.to?.value ?? null) === (b?.to?.value ?? null); + +/** + * The measure read once: each thing an instrument draws, as the list of times + * it changes, from the states (`measure.state`, sorted by t, the first at 0). + * + * - `current`: each stated weight in force, from its `t` (the first entry + * the state before any, `value: null`), with the date of the weighing + * (the event's `asOf`, else its date); + * - `remembered`: each remembered weight as it is first said; + * - `goals`: each latest goal (null when none), from its `t`; + * - `lost`: the odometer's total from each `t` -- the running HIGHEST, so it + * only ever goes up -- and its runs; + * - `net`: NET from each `t` it changes; + * - `under`: each "under 300" claim (`totals.under300.rows`) the cut shows; + * - `stated`: every stated weight the cut shows, for the trail (by date). + */ +export function measureTrack(measure) { + const states = Array.isArray(measure?.state) && measure.state.length ? measure.state : [{ t: 0 }]; + const events = Array.isArray(measure?.events) ? measure.events : []; + const byRow = new Map(events.map((e) => [e.row, e])); + const current = []; + const remembered = []; + const goals = []; + const lost = []; + const net = []; + states.forEach((s, i) => { + const prev = i ? states[i - 1] : null; + const t = i ? Number(s.t) : 0; + if (!i || !sameCurrent(prev.current, s.current)) { + const c = s.current ?? null; + const ev = c ? byRow.get(c.row) : null; + current.push({ t, value: c?.value ?? null, qualifier: c?.qualifier ?? null, row: c?.row ?? null, date: ev?.asOf ?? c?.date ?? null }); + } + const rem = Array.isArray(s.remembered) ? s.remembered : []; + const had = prev && Array.isArray(prev.remembered) ? prev.remembered.length : 0; + for (let j = had; j < rem.length; j += 1) { + const ev = byRow.get(rem[j].row); + remembered.push({ t, value: rem[j].value, asOf: rem[j].asOf ?? null, row: rem[j].row, qualifier: ev?.qualifier ?? null }); + } + if (!i || !sameGoal(prev.goal, s.goal)) goals.push({ t, goal: s.goal ?? null }); + const total = Number(s.lost?.total) || 0; + const top = lost.length ? lost[lost.length - 1].total : 0; + const runs = Array.isArray(s.lost?.runs) ? s.lost.runs.length : 0; + if (!i) lost.push({ t, total: Math.max(0, total), runs }); + else if (total > top + 1e-9 || runs !== lost[lost.length - 1].runs) lost.push({ t, total: Math.max(top, total), runs }); + if (!i || !sameNet(prev.net, s.net)) net.push({ t, net: s.net ?? null }); + }); + const underRows = new Set(measure?.totals?.under300?.rows ?? []); + const under = events.filter((e) => underRows.has(e.row) && Number.isFinite(e.t)).map((e) => ({ t: e.t, row: e.row })); + const stated = events + .filter((e) => e.kind === "stated" && Number.isFinite(e.value) && Number.isFinite(e.t)) + .map((e) => ({ t: e.t, row: e.row, value: e.value, qualifier: e.qualifier ?? null, date: e.asOf ?? e.date })); + return { current, remembered, goals, lost, net, under, stated }; +} + +// --------------------------------------------------------------------------- +// The dial. +// --------------------------------------------------------------------------- + +/** The dial's sweep: the scale's min at A0, its max at A1, degrees clockwise from 12 o'clock. */ +export const DIAL_SWEEP = Object.freeze({ a0: -135, a1: 135 }); + +/** A weight's angle on a dial of `scale` ({min, max}), clamped to the sweep. */ +export function dialAngle(v, scale) { + const { min, max } = scale; + const c = Math.max(min, Math.min(max, v)); + return DIAL_SWEEP.a0 + ((c - min) / (max - min)) * (DIAL_SWEEP.a1 - DIAL_SWEEP.a0); +} + +/** The point at `deg` (clockwise from 12 o'clock) and radius `r` about (cx, cy). */ +export function polar(cx, cy, r, deg) { + const a = ((deg - 90) * Math.PI) / 180; + return [r2(cx + r * Math.cos(a)), r2(cy + r * Math.sin(a))]; +} + +/** An annular sector's path, from `a0` to `a1` degrees between radii r0 < r1. */ +export function sectorPath(cx, cy, r0, r1, a0, a1) { + const [p, q] = [polar(cx, cy, r1, a0), polar(cx, cy, r1, a1)]; + const [s, t] = [polar(cx, cy, r0, a1), polar(cx, cy, r0, a0)]; + const lg = Math.abs(a1 - a0) > 180 ? 1 : 0; + return `M${p} A${r1},${r1} 0 ${lg} 1 ${q} L${s} A${r0},${r0} 0 ${lg} 0 ${t}Z`; +} + +/** A qualifier's wedge, in pounds: "≈" 3 under to 1 over, ">" 10 up, "<" 10 down. */ +export function wedgeRange(value, q) { + if (q === "≈") return [value - 3, value + 1]; + if (q === ">") return [value, value + 10]; + if (q === "<") return [value - 10, value]; + return null; +} + +/** + * The dial face as SVG markup, `size` px square: the bezel, the face, a tick + * every 2 lb (longer every 10, longest every 20), a label every 20, the + * `mark` weight (300) accented. Static: nothing on it moves. + */ +export function dialFaceSvg({ size, scale, mark = 300, colors, labelFont = "sans-serif" }) { + const C = size / 2; + const R = C - Math.round(size * 0.012); + const Rf = R - Math.round(size * 0.026); + const u = size / 524; + const out = []; + out.push(`<circle cx="${C}" cy="${C}" r="${R}" fill="${colors.bezel}"/>`); + out.push(`<circle cx="${C}" cy="${C}" r="${Rf}" fill="${colors.face}"/>`); + const step = 2; + for (let v = Math.ceil(scale.min / step) * step; v <= scale.max + 1e-9; v += step) { + const a = dialAngle(v, scale); + const major = v % 20 === 0, mid = v % 10 === 0; + const [x1, y1] = polar(C, C, Rf - 6 * u, a); + const [x2, y2] = polar(C, C, Rf - (major ? 30 : mid ? 22 : 14) * u, a); + out.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${colors.ink}" stroke-width="${r2((major ? 3 : mid ? 2 : 1.2) * u)}" stroke-opacity="${major ? 1 : mid ? 0.85 : 0.6}"/>`); + } + for (let v = Math.ceil(scale.min / 20) * 20; v <= scale.max + 1e-9; v += 20) { + if (Number.isFinite(mark) && v === mark) continue; + const [x, y] = polar(C, C, Rf - 54 * u, dialAngle(v, scale)); + out.push(`<text x="${x}" y="${r2(y + 8 * u)}" text-anchor="middle" font-family="${labelFont}" font-size="${r2(24 * u)}" fill="${colors.ink}">${v}</text>`); + } + if (Number.isFinite(mark) && mark >= scale.min && mark <= scale.max) { + const a = dialAngle(mark, scale); + const [x1, y1] = polar(C, C, Rf - 3 * u, a); + const [x2, y2] = polar(C, C, Rf - 36 * u, a); + out.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${colors.mark}" stroke-width="${r2(6 * u)}" stroke-linecap="round"/>`); + const [x, y] = polar(C, C, Rf - 58 * u, a); + out.push(`<text x="${x}" y="${r2(y + 9 * u)}" text-anchor="middle" font-family="${labelFont}" font-size="${r2(28 * u)}" fill="${colors.mark}">${mark}</text>`); + } + return { svg: `<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${out.join("")}</svg>`, C, R, Rf, u }; +} + +// --------------------------------------------------------------------------- +// The odometer. +// --------------------------------------------------------------------------- + +/** How many whole-number wheels a total needs (three at least: "000.0"). */ +export const wheelCount = (max) => Math.max(3, String(Math.floor(Math.max(0, max))).length); + +/** A total's digits, tenths last: 212.8 with 3 wheels -> [2, 1, 2, 8]. */ +export function wheelDigits(total, wheels) { + const tenths = Math.round(Math.max(0, total) * 10); + const s = String(tenths).padStart(wheels + 1, "0").slice(-(wheels + 1)); + return [...s].map(Number); +} + +/** + * The wheels' moves for a roll from `a` to `b` (b >= a): per wheel, its + * position (a digit, or past 9 to roll forward through 0) at the end, and + * whether it lands past 9 and so is set back to its digit the instant after. + * A wheel rolls a whole turn more for every ten of its place the total moved, + * one turn at most -- the lower wheels spin as a real counter's do. + */ +export function wheelRoll(a, b, wheels) { + const d0 = wheelDigits(a, wheels); + const d1 = wheelDigits(b, wheels); + const delta = Math.max(0, b - a); + return d1.map((d, i) => { + const place = 10 ** (wheels - 1 - i); // tenths last: place 0.1 + const turns = (d < d0[i] ? 1 : 0) + (delta >= 10 * place && i > 0 ? 1 : 0); + const end = d + 10 * Math.min(2, turns); + return { from: d0[i], to: end, settle: end !== d ? d : null }; + }); +} + +/** One wheel's strip: the digits 0-9 three times over, so a roll forward never runs out. */ +export const wheelStrip = (cls = "dg") => + Array.from({ length: 30 }, (_, i) => `<div class="${cls}">${i % 10}</div>`).join(""); + +// --------------------------------------------------------------------------- +// The page. +// --------------------------------------------------------------------------- + +/** + * A measure page: HyperFrames' root and clip `W`x`H` (transparent), `css`, + * `body`, and the interpreter over `data` (`init`, `cues`, `total`, and + * either `window` -- a whole-cut page's window of the cut, or null -- or + * `from`/`dur`, a window page whose cues are in the cut's clock). `id` names + * the region: its data script is `<id>-data`, its timeline + * `window.__timelines[id]`, and the preview's ready message `<id>:ready`. + */ +export function pageHtml({ id, W, H, fps, data, css, body, fonts = {}, gsap = "assets/gsap.min.js" }) { + const windowPage = Number.isFinite(data.from) && Number.isFinite(data.dur); + const dur = windowPage ? data.dur : data.window ? data.window.dur : data.total; + const json = JSON.stringify(data).replace(/</g, "\\u003c"); + const faces = Object.entries(fonts) + .filter(([, src]) => src) + .map(([name, src]) => `@font-face { font-family: '${name}'; font-weight: 400; font-style: normal; src: url('${esc(src)}'); }`) + .join("\n "); + return `<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=${W}, height=${H}" /> + <script src="${esc(gsap)}"></script> + <style> + ${faces} + * { margin: 0; padding: 0; box-sizing: border-box; } + html, body { width: ${W}px; height: ${H}px; overflow: hidden; background: transparent; } + body { font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; } + #root { position: relative; width: ${W}px; height: ${H}px; overflow: hidden; } + #${id}-clip { position: absolute; left: 0; top: 0; width: ${W}px; height: ${H}px; } + ${css} + </style> + </head> + <body> + <div id="root" data-composition-id="${id}" data-start="0" data-duration="${pageDuration(dur, fps)}" + data-width="${W}" data-height="${H}"> + <div id="${id}-clip" class="clip" data-start="0" data-duration="${pageDuration(dur, fps)}" data-track-index="1"> + ${body} + </div> + </div> + + <script id="${id}-data" type="application/json">${json}</script> + <script> + const S = JSON.parse(document.getElementById("${id}-data").textContent); + const byK = {}; + for (const el of document.querySelectorAll("[data-k]")) byK[el.dataset.k] = el; + // t = 0, then the cues. Every cue states its from, so a seek from + // anywhere to anywhere lands on the same pixels. + for (const k of Object.keys(S.init)) if (byK[k]) gsap.set(byK[k], S.init[k]); + const inner = gsap.timeline({ paused: true }); + for (const c of S.cues) { + const el = byK[c.k]; + if (!el) continue; + inner.fromTo(el, c.from, { ...c.to, duration: c.dur, ease: c.ease, immediateRender: false }, c.at); + } + const WIN = Number.isFinite(S.from) ? { from: S.from, dur: S.dur } : S.window; + inner.set({}, {}, WIN ? WIN.from + WIN.dur : S.total); + let tl = inner; + if (WIN) { + tl = gsap.timeline({ paused: true }); + tl.add(inner.tweenFromTo(WIN.from, WIN.from + WIN.dur, { duration: WIN.dur, ease: "none" }), 0); + } + window.__timelines = window.__timelines || {}; + window.__timelines["${id}"] = tl; + const ready = document.fonts.ready.catch(() => {}).then(() => { document.documentElement.dataset.fit = "1"; }); + const params = new URLSearchParams(location.search); + // In CUT seconds, a window's page seeked in its own. + const local = (t) => { + const v = Number(t) || 0; + return WIN ? Math.max(0, Math.min(WIN.dur, v - WIN.from)) : Math.max(0, v); + }; + const still = params.get("still"); + if (still !== null) { + tl.seek(local(still), false); + ready.then(() => tl.seek(local(still), false)); + } + // umtool's live preview: the parent seeks in cut seconds, as it seeks the deck. + if (params.get("preview") === "1") { + window.addEventListener("message", (e) => { + const m = e.data || {}; + if (m.type === "deck:seek") tl.seek(local(m.t), false); + }); + ready.then(() => { + if (window.parent !== window) window.parent.postMessage({ type: "${id}:ready", total: S.total }, "*"); + }); + } + </script> + </body> +</html> +`; +} diff --git a/umtool/report-to-video/modules/contract.mjs b/umtool/report-to-video/modules/contract.mjs @@ -51,9 +51,10 @@ export const MODULE_KINDS = Object.freeze([ * The layout slots a module may ask for (layout.mjs `slotRect`): the deck's * band at the foot of the frame, the posts column, the stamp's box in the * footage, the footage box itself, the side panel beside it, a popup column - * over the footage, the whole frame, or `inline` (a part, in its host's slot). + * over the footage, the measure's instruments' column at the frame's right + * (instruments.mjs), the whole frame, or `inline` (a part, in its host's slot). */ -export const MODULE_SLOTS = Object.freeze(["footer", "column", "popup", "stamp", "panel", "footage", "side", "full", "inline"]); +export const MODULE_SLOTS = Object.freeze(["footer", "column", "popup", "stamp", "panel", "footage", "side", "instruments", "full", "inline"]); /** * The clocks a module's live page is seeked on (`play.clock`): the cut's diff --git a/umtool/report-to-video/modules/dial-finale.mjs b/umtool/report-to-video/modules/dial-finale.mjs @@ -0,0 +1,73 @@ +// THE DIAL'S FINALE (module `dial-finale`, region `dial-finale`): the finale +// (module `finale`) with the instruments large in its lower column -- the +// dial's needle dropping from his highest remembered weight to his last +// stated one, the odometer rolling up to the whole record's total, NET +// holding beside it. A window over the finale's, laid OVER the finale (z 95): +// the finale's ground covers the column's instruments while it is up. On with +// the dial unless `deck.dial.finale` is false; it needs the finale's lower +// column clear of stats cards (`deck.finale.stats`). chrome-instruments.mjs +// writes the page. +import path from "node:path"; + +import { snapWindow } from "../deck.mjs"; +import { dialFinaleGeometry, dialFinaleHtml } from "../chrome-instruments.mjs"; +import { resolveDial } from "../instruments.mjs"; +import { assertRegion, defineModule } from "./contract.mjs"; +import { hasMeasure, instrumentFonts, noMeasure } from "./instruments-shared.mjs"; + +const wanted = (render) => resolveDial(render)?.finale === true; + +export default defineModule({ + id: "dial-finale", + version: 1, + z: 95, + kind: "overlay-window", + slot: "full", + title: "Dial finale", + summary: "The finale with the dial and the odometer large: the needle drops to his last stated weight, the wheels roll to the total, NET holds.", + docs: { + heading: "Dial finale", + intro: "With the dial on (`deck.dial`) and a finale (a run of `layout: \"finale\"` clips), the finale's lower column -- beside the clip, under the finale's totals when it draws them -- carries the instruments large over the finale's window: in over the finale's grow, the needle dropping (1.8 s, `back.out`) from his highest remembered weight (the measure's `totals.peakDrift` and remembered weights) to his last stated one (`totals.net.to`), every ghost tick and the latest goal on the bezel; the odometer rolling up from zero to the whole record's `totals.lost` (the rows the cut never shows included) with `ACROSS N RUNS`; NET (`totals.net`) held beside it; out through the finale's dissolve. Laid over the finale (z 95), in Play too. It needs the lower column clear: a finale with stats cards (`deck.finale.stats`) is refused -- set `deck.dial.finale` false, or drop the cards.", + rows: [ + ["`deck.dial.finale`", "bool · default `true` (with the dial on)", "`umtool look <p> deck.dial.finale=false`"], + ], + }, + region: "dial-finale", + workers: "narrow", + noun: "the dial finale's", + on: (schedule, render) => !!schedule?.finale && hasMeasure(schedule) && wanted(render), + check: (schedule, render) => { + if (!schedule.finale) return "the dial's finale needs a schedule with a finale (a clip with layout \"finale\")"; + if (!hasMeasure(schedule)) return noMeasure("dial's finale"); + if (!dialFinaleGeometry(schedule, render)) { + return "the dial's finale needs the finale's lower column clear: its stats cards (render.chrome.deck.finale.stats) fill it -- drop them, or set render.chrome.deck.dial.finale false"; + } + return null; + }, + window: (schedule, { fps, total }) => snapWindow({ segment: "dial-finale", from: schedule.finale.from, to: schedule.finale.to }, { fps, total }), + names: ({ preview }) => ({ project: `dial-finale${preview ? "-preview" : ""}`, stem: "dial-finale" }), + async page(ctx) { + return dialFinaleHtml(ctx.schedule, ctx.render, ctx.window, { fonts: await instrumentFonts(ctx) }); + }, + /** Over the finale's window, laid at its own second (the finale's own regions, finale.mjs). */ + regions(schedule, { render, outDir, shift = 0, clip = null }) { + const f = schedule?.finale; + if (!f || !hasMeasure(schedule)) return []; + const g = dialFinaleGeometry(schedule, render); + if (!g) return []; + const fps = Number(schedule.fps ?? render.fps); + const s = snapWindow({ segment: "dial-finale", from: f.from, to: f.to }, { fps, total: schedule.total }); + if (clip && !(s.from < clip.at + clip.dur && s.to > clip.at)) return []; + return [assertRegion({ + name: "dial-finale", + frames: path.join(outDir, "chrome", "dial-finale-frames"), + ...g, + offset: s.from - shift, + frameCount: s.frames, + window: s, + }, "window")]; + }, + play: { clock: "cut", ready: "dial-finale:ready" }, + // A window of the cut, as the finale's: its frame n is cut time `from` + n / fps. + frameKeys: { data: "dial-finale-data", omit: ["init", "cues", "from", "dur"], offset: "from" }, +}); diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs @@ -0,0 +1,64 @@ +// THE DIAL (module `dial`, region `dial`): an analog bathroom-scale face in +// the instruments' column (instruments.mjs, deck.mjs instrumentsGeometry). A +// red needle swings to every weight he states, on the word, overshoots and +// settles; "almost", "over", "under" draw a wedge; his remembered weights are +// grey ghost ticks, the latest a long ghost needle with its as-of date; his +// latest goal an amber tick on the bezel; the 300 lb mark accented; the +// weight in big digits under the hub. chrome-instruments.mjs writes the page. +import path from "node:path"; + +import { instrumentsGeometry } from "../deck.mjs"; +import { dialHtml } from "../chrome-instruments.mjs"; +import { DIAL_DEFAULTS, resolveDial } from "../instruments.mjs"; +import { assertRegion, defineModule } from "./contract.mjs"; +import { settingsOf } from "./settings.mjs"; +import { hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs"; + +export default defineModule({ + id: "dial", + version: 1, + z: 74, + kind: "overlay-whole", + slot: "instruments", + title: "Scale dial", + summary: "A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel.", + configKey: "render.chrome.deck.dial", + defaults: DIAL_DEFAULTS, + validate: settingsOf("dial").validate, + resolve: resolveDial, + ui: [ + { key: "mark", type: "number", min: 0, max: 2000, step: 1, label: "Accented weight", default: 300 }, + { key: "ghosts", type: "boolean", label: "Remembered weights as ghosts", default: true }, + { key: "goal", type: "boolean", label: "The latest goal on the bezel", default: true }, + { key: "finale", type: "boolean", label: "Large in the finale", default: true }, + { key: "label", type: "text", label: "Over the digits", default: DIAL_DEFAULTS.label }, + ], + docs: { + heading: "Scale dial", + intro: "A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.", + rows: [ + ["`deck.dial`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.dial=true`"], + ["`deck.dial.mark`", "a weight, or `null` · default `300` (its tick and label in the accent)", "`umtool look <p> deck.dial.mark=300`"], + ["`deck.dial.ghosts`, `.goal`", "bool · default `true` each", "`umtool look <p> deck.dial.ghosts=false`"], + ["`deck.dial.needle`", "a #hex · default `#ff5a4e`", "`umtool look <p> deck.dial.needle='\"#ff5a4e\"'`"], + ["`deck.dial.label`", "words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS`", "`umtool look <p> deck.dial.label='\"…\"'`"], + ["`deck.dial.finale`", "bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`)", "`umtool look <p> deck.dial.finale=false`"], + ], + }, + region: "dial", + workers: "narrow", + noun: "the dial's", + on: (schedule, render) => hasMeasure(schedule) && !!resolveDial(render), + check: (schedule) => (hasMeasure(schedule) ? null : noMeasure("dial")), + async page(ctx) { + return dialHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration }); + }, + regions(schedule, { render, outDir, frames = null }) { + const g = instrumentsGeometry(render).dial; + if (!g) return []; + return [assertRegion({ name: "dial", frames: frames ?? path.join(outDir, "chrome", "dial-frames"), ...g })]; + }, + // Its page is its live preview: Play the cut seeks it in the cut's seconds (contract.mjs, PLAY). + play: { clock: "cut", ready: "dial:ready" }, + frameKeys: wholeCutKeys("dial"), +}); diff --git a/umtool/report-to-video/modules/index.mjs b/umtool/report-to-video/modules/index.mjs @@ -31,12 +31,16 @@ import chapter from "./chapter.mjs"; import status from "./status.mjs"; import chat from "./chat.mjs"; import sectionTitle from "./section-title.mjs"; +import dial from "./dial.mjs"; +import odometer from "./odometer.mjs"; +import trail from "./trail.mjs"; +import dialFinale from "./dial-finale.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, dial, odometer, trail, dialFinale] .sort((a, b) => a.z - b.z || a.id.localeCompare(b.id)), ); @@ -129,6 +133,7 @@ export function scheduleSlices(doc) { ...(doc.flips ? { flips: doc.flips } : {}), ...(doc.stats ? { stats: doc.stats } : {}), ...(doc.fx ? { fx: doc.fx } : {}), + ...(doc.measure ? { measure: doc.measure } : {}), }; return out; } diff --git a/umtool/report-to-video/modules/instruments-shared.mjs b/umtool/report-to-video/modules/instruments-shared.mjs @@ -0,0 +1,37 @@ +// What the measure's instrument modules share (dial, odometer, trail, +// dial-finale): their faces -- the deck's, plus the manifest's display and +// condensed faces when it names them (`render.fontDisplay`, +// `render.fontCondensed`) -- and their frame-key model. +import { INSTRUMENT_FONTS } from "../chrome-instruments.mjs"; + +/** + * The faces a measure page draws in, copied in beside it: `{ DeckSans, + * DeckSansBold, MeasureDisplay?, MeasureCond? }` asset paths. A display or + * condensed face that cannot be copied is left out, and the page falls back + * to the deck's bold or regular. + */ +export async function instrumentFonts(ctx) { + const deck = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); + const out = { DeckSans: deck.regular, DeckSansBold: deck.bold }; + for (const [key, name] of [["fontDisplay", INSTRUMENT_FONTS.display], ["fontCondensed", INSTRUMENT_FONTS.condensed]]) { + const src = ctx.render?.[key]; + if (typeof src !== "string" || !src) continue; + const ext = (/\.[A-Za-z0-9]+$/.exec(src)?.[0] ?? ".ttf").toLowerCase(); + try { + out[name] = await ctx.asset(src, `${name}${ext}`); + } catch { + // The deck's face stands in. + } + } + return out; +} + +/** A whole-cut cue interpreter's frame keys (frame-keys.mjs): its data less what is keyed per frame. */ +export const wholeCutKeys = (region) => ({ data: `${region}-data`, omit: ["init", "cues", "window", "total"] }); + +/** Is the measure in the schedule: what every instrument draws from. */ +export const hasMeasure = (schedule) => !!(schedule?.measure && Array.isArray(schedule.measure.state) && schedule.measure.scale); + +/** The sentence a page refuses with when the schedule has no measure. */ +export const noMeasure = (what) => + `the ${what} needs a schedule with a measure (a manifest with a measure ledger and render.chrome.deck.measure)`; diff --git a/umtool/report-to-video/modules/layout.mjs b/umtool/report-to-video/modules/layout.mjs @@ -9,7 +9,7 @@ // Pure. The numbers are deck.mjs's geometry functions' -- those stay the one // arithmetic, and this file is the one place a module asks them. import { - deckGeometry, feedGeometry, fxGeometry, postsGeometry, stampGeometry, statsGeometry, threadsGeometry, + deckGeometry, feedGeometry, fxGeometry, instrumentsGeometry, postsGeometry, stampGeometry, statsGeometry, threadsGeometry, } from "../deck.mjs"; import { MODULE_SLOTS } from "./contract.mjs"; import { DESIGN, designScale } from "./design.mjs"; @@ -28,6 +28,9 @@ export { DESIGN, designScale }; * - `stamp`: the fact-check stamp's box in the footage, at its position. * - `panel`: the stats panel in the footage, at its position. * - `side`: the side panel (the thread rail, the flips) beside the footage. + * - `instruments`: the measure's instruments' column at the frame's right + * (the dial, the odometer, the trail; instruments.mjs), the footage moved + * to the left for it. * - `full`: the whole frame. * * @param {string} slot @@ -53,6 +56,8 @@ export function slotRect(slot, render, { feed = false } = {}) { const { cards: _c, ...box } = threadsGeometry(render); return box; } + case "instruments": + return { ...instrumentsGeometry(render).column }; case "full": return { x: 0, y: 0, width: render?.width ?? DESIGN.width, height: render?.height ?? DESIGN.height }; default: diff --git a/umtool/report-to-video/modules/odometer.mjs b/umtool/report-to-video/modules/odometer.mjs @@ -0,0 +1,57 @@ +// THE ODOMETER (module `odometer`, region `odometer`): mechanical rolling +// digits of the pounds he says he has lost, under the dial in the +// instruments' column. The total is the measure's (the odometer rule: the +// highest real-time claim in each run, summed -- "go by his words"), held to +// its running highest so the wheels only ever roll up; NET beside it in plain +// digits. chrome-instruments.mjs writes the page. +import path from "node:path"; + +import { instrumentsGeometry } from "../deck.mjs"; +import { odometerHtml } from "../chrome-instruments.mjs"; +import { ODOMETER_DEFAULTS, resolveOdometer } from "../instruments.mjs"; +import { assertRegion, defineModule } from "./contract.mjs"; +import { settingsOf } from "./settings.mjs"; +import { hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs"; + +export default defineModule({ + id: "odometer", + version: 1, + z: 75, + kind: "overlay-whole", + slot: "instruments", + title: "Lost odometer", + summary: "Rolling digits of the pounds he says he has lost (only ever up), NET beside them.", + configKey: "render.chrome.deck.odometer", + defaults: ODOMETER_DEFAULTS, + validate: settingsOf("odometer").validate, + resolve: resolveOdometer, + ui: [ + { key: "label", type: "text", label: "Over the wheels", default: ODOMETER_DEFAULTS.label }, + { key: "net", type: "boolean", label: "NET beside them", default: true }, + { key: "runs", type: "boolean", label: "How many runs", default: true }, + ], + docs: { + heading: "Lost odometer", + intro: "Under the dial: the measure's `state.lost.total` (the highest real-time loss claim in each run, summed) on mechanical wheels to a tenth, rolling forward at each claim that raises it (1.3 s) and never back -- a lower total is held at the highest so far. NET (`state.net`: the first stated weight of the record to the latest) in plain digits beside it, `−76.5 · 368 → 291.5`; `ACROSS 8 RUNS` under the wheels.", + rows: [ + ["`deck.odometer`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.odometer=true`"], + ["`deck.odometer.label`", "words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST`", "`umtool look <p> deck.odometer.label='\"…\"'`"], + ["`deck.odometer.net`, `.runs`", "bool · default `true` each", "`umtool look <p> deck.odometer.net=false`"], + ], + }, + region: "odometer", + workers: "narrow", + noun: "the odometer's", + on: (schedule, render) => hasMeasure(schedule) && !!resolveOdometer(render), + check: (schedule) => (hasMeasure(schedule) ? null : noMeasure("odometer")), + async page(ctx) { + return odometerHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration }); + }, + regions(schedule, { render, outDir, frames = null }) { + const g = instrumentsGeometry(render).odometer; + if (!g) return []; + return [assertRegion({ name: "odometer", frames: frames ?? path.join(outDir, "chrome", "odometer-frames"), ...g })]; + }, + play: { clock: "cut", ready: "odometer:ready" }, + frameKeys: wholeCutKeys("odometer"), +}); 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", "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", "counter", "shell", "rail", "section-title", "subtitle", "qr", "popup-posts", "dial", "odometer", "trail"]); }); 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 measure's instruments beside the side panel; the + // finale over all of them but the dial's finale, laid over it. + assert.deepEqual(deckOverlays().map((m) => m.region), ["deck", "feed", "posts", "stamp", "chat", "stats", "pair", "status", "fx", "threads", "dial", "odometer", "trail", "flips", "chapter", "finale", "dial-finale"]); assert.equal(moduleOfRegion("deck").id, "shell"); assert.equal(regionModule("posts").id, "popup-posts"); assert.throws(() => regionModule("nope"), /unknown chrome region: nope/); @@ -57,8 +58,8 @@ test("the registry: unique ids and regions, sorted by z, the deck's overlays in }); test("placement and caching come from the module's kind", () => { - for (const r of ["deck", "feed", "stamp", "chat", "stats", "fx", "threads", "flips"]) assert.equal(placementOf(r), "whole", r); - for (const r of ["posts", "finale"]) assert.equal(placementOf(r), "window", r); + for (const r of ["deck", "feed", "stamp", "chat", "stats", "fx", "threads", "flips", "dial", "odometer", "trail"]) assert.equal(placementOf(r), "whole", r); + for (const r of ["posts", "finale", "dial-finale"]) assert.equal(placementOf(r), "window", r); assert.equal(placementOf("chart"), null); assert.equal(placementOf("teaser"), null); assert.deepEqual(regionCaching("deck"), { keyed: true, wholeCut: true }); @@ -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", "threads", "dial", "odometer", "trail", "flips", "chapter", "dial-finale"]); 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 { validateDial, validateOdometer, validateTrail } from "../instruments.mjs"; /** * Every deck setting and its default. A manifest names only what it changes; @@ -477,6 +478,10 @@ 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's instruments (instruments.mjs): the dial, the odometer, the trail. + { id: "dial", key: "deck.dial", configKey: "render.chrome.deck.dial", deck: true, validate: (v, { where }) => validateDial(v, `${where}.dial`) }, + { id: "odometer", key: "deck.odometer", configKey: "render.chrome.deck.odometer", deck: true, validate: (v, { where }) => validateOdometer(v, `${where}.odometer`) }, + { id: "trail", key: "deck.trail", configKey: "render.chrome.deck.trail", deck: true, validate: (v, { where }) => validateTrail(v, `${where}.trail`) }, ].map((s) => Object.freeze(s))); /** A module's settings entry, or undefined. */ diff --git a/umtool/report-to-video/modules/trail.mjs b/umtool/report-to-video/modules/trail.mjs @@ -0,0 +1,57 @@ +// THE TRAIL (module `trail`, region `trail`): his stated weights as a thin +// line by DATE (not cut time) at the foot of the instruments' column, each +// point appearing as he says it and the line drawn between neighbours once +// both are said; the 300 lb line; how many times he says he is under it. +// chrome-instruments.mjs writes the page. +import path from "node:path"; + +import { instrumentsGeometry } from "../deck.mjs"; +import { trailHtml } from "../chrome-instruments.mjs"; +import { resolveTrail, TRAIL_DEFAULTS } from "../instruments.mjs"; +import { assertRegion, defineModule } from "./contract.mjs"; +import { settingsOf } from "./settings.mjs"; +import { hasMeasure, instrumentFonts, noMeasure, wholeCutKeys } from "./instruments-shared.mjs"; + +export default defineModule({ + id: "trail", + version: 1, + z: 76, + kind: "overlay-whole", + slot: "instruments", + title: "Weight trail", + summary: "His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it.", + configKey: "render.chrome.deck.trail", + defaults: TRAIL_DEFAULTS, + validate: settingsOf("trail").validate, + resolve: resolveTrail, + ui: [ + { key: "mark", type: "number", min: 0, max: 2000, step: 1, label: "The line across", default: 300 }, + { key: "count", type: "boolean", label: "Count the \"under 300\" claims", default: true }, + { key: "label", type: "text", label: "Its title", default: TRAIL_DEFAULTS.label }, + ], + docs: { + heading: "Weight trail", + intro: "At the foot of the instruments' column: every STATED weight the cut shows, placed by the date he was weighed (its `asOf`, else its date) across the span of them, a dot appearing at its event's `t` and the line between two neighbours drawn once both are said; a red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each.", + rows: [ + ["`deck.trail`", "`true` · an object of the knobs below · absent or `false` off", "`umtool look <p> deck.trail=true`"], + ["`deck.trail.mark`", "a weight, or `null` · default `300`", "`umtool look <p> deck.trail.mark=300`"], + ["`deck.trail.count`", "bool · default `true`", "`umtool look <p> deck.trail.count=false`"], + ["`deck.trail.label`", "its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE`", "`umtool look <p> deck.trail.label='\"…\"'`"], + ], + }, + region: "trail", + workers: "narrow", + noun: "the trail's", + on: (schedule, render) => hasMeasure(schedule) && !!resolveTrail(render), + check: (schedule) => (hasMeasure(schedule) ? null : noMeasure("trail")), + async page(ctx) { + return trailHtml(ctx.schedule, ctx.render, { fonts: await instrumentFonts(ctx), from: ctx.from, duration: ctx.duration }); + }, + regions(schedule, { render, outDir, frames = null }) { + const g = instrumentsGeometry(render).trail; + if (!g) return []; + return [assertRegion({ name: "trail", frames: frames ?? path.join(outDir, "chrome", "trail-frames"), ...g })]; + }, + play: { clock: "cut", ready: "trail:ready" }, + frameKeys: wholeCutKeys("trail"), +});