From d09a06c0546abc69bbed76be3c0feecbd5a82329 Mon Sep 17 00:00:00 2001
From: Kev
Date: Fri, 10 Jul 2026 15:39:13 -0400
Subject: [PATCH] Session 55: Self-learning loop + real-time layer (2274 tests)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Product overhaul core — the two transformative, differentiated systems:
Self-learning loop (Phase 2): outcomeService settles locked snapshot grades
against real MLB Stats API results → hit/miss/push, rolling accuracy by grade
tier (30d window). Idempotent, injectable, unit-tested. New GET /api/accuracy +
/api/ledger/accuracy + internal settle triggers + cron hook. AccuracyBadge
(dashboard/scan/landing) is honest — "LEARNING" below MIN_SAMPLE, never a fake
number. Settled HIT/MISS chips overlay the live slate.
Real-time layer (Phase 1): Slate silent 60s auto-refresh (no flash, no wipe on
transient blips) + "SIGNAL LIVE · UPDATED Xs ago" freshness strip; Ticker LIVE
badge that flashes on fresh events.
Landing (Phase 3): TopSignals shows tonight's real top-3 A-rated grades + live
accuracy — the product shown, not described.
Founder pricing: FOUNDER_CODE_EXPIRY default 2026-06-30 → 2026-12-31 (had
lapsed, disabling every founder code + the ClaimMeter pitch). That expiry — not
a tier change — was the real cause of the 4 stripe test failures.
Backend 2255 (4 failing) → 2274 (all green; +19 new, +4 fixed). Web build exit 0.
Co-Authored-By: Claude Opus 4.8 (1M context)
---
BACKEND_HANDOFF.md | 31 +++
BUILD-STATE.md | 59 +++-
CLAUDE.md | 39 +++
specs/session55-self-learning.md | 76 ++++++
src/app.js | 4 +
src/routes/accuracy.js | 30 +++
src/routes/internal.js | 31 +++
src/routes/ledger.js | 30 +++
src/routes/snapshot.js | 30 ++-
src/services/outcomeService.js | 296 +++++++++++++++++++++
src/services/stripeService.js | 6 +-
src/snapshotScheduler.js | 11 +
tests/integration/accuracy.test.js | 67 +++++
tests/unit/outcomeService.test.js | 162 +++++++++++
tests/unit/slateAdapterStrips.test.js | 24 ++
web/public/sw.js | 2 +-
web/src/app/api/accuracy/route.ts | 24 ++
web/src/app/dashboard/page.tsx | 7 +
web/src/app/page.tsx | 5 +
web/src/app/scan/page.tsx | 7 +
web/src/components/Slate.tsx | 74 +++++-
web/src/components/TopSignals.tsx | 114 ++++++++
web/src/components/vyndr/AccuracyBadge.tsx | 116 ++++++++
web/src/components/vyndr/StatStrip.tsx | 25 +-
web/src/components/vyndr/Ticker.tsx | 28 +-
web/src/components/vyndr/index.ts | 1 +
web/src/lib/slateAdapter.js | 3 +
27 files changed, 1285 insertions(+), 17 deletions(-)
create mode 100644 specs/session55-self-learning.md
create mode 100644 src/routes/accuracy.js
create mode 100644 src/routes/ledger.js
create mode 100644 src/services/outcomeService.js
create mode 100644 tests/integration/accuracy.test.js
create mode 100644 tests/unit/outcomeService.test.js
create mode 100644 web/src/app/api/accuracy/route.ts
create mode 100644 web/src/components/TopSignals.tsx
create mode 100644 web/src/components/vyndr/AccuracyBadge.tsx
diff --git a/BACKEND_HANDOFF.md b/BACKEND_HANDOFF.md
index 8ff6eeb..0b3e985 100644
--- a/BACKEND_HANDOFF.md
+++ b/BACKEND_HANDOFF.md
@@ -175,3 +175,34 @@ Slate builds a team→pitcher map (`slateAdapter.buildPitcherMap` /
- Player props: PropLine primary (3-key rotation), The-Odds-API backup.
- `grades:{sport}` cache (TTL 2h) is written by `gradeSlateService` on a fresh
odds fetch; it feeds `/leaders` + the player card's `activeProps`.
+
+---
+
+## 7. Accuracy / self-learning loop (`outcomeService`, Session 55)
+
+The system's track record — settled grades vs real results. Written by
+`outcomeService.settleAllOutcomes()` (cron, before grading); read-only endpoints.
+
+### `GET /api/accuracy` (public, cached 5m)
+```
+{
+ overall: { // aggregate across sports
+ sport: 'overall', updated_at, window_days: 30, sample,
+ overall: { hits, misses, pushes, total, pct|null }, // pct excludes pushes
+ byGrade: { 'A+':{…}, 'A':{…}, 'B':{…}, 'C':{…}, 'D':{…}, 'F':{…} }
+ } | null,
+ sports: { mlb?: , nba?: , … }, // same shape per sport
+ min_sample: 8, // below this, show "LEARNING" not a %
+ updated_at: string | null
+}
+```
+
+### `GET /api/ledger/accuracy` (public) — the ledger `buckets` shape
+```
+{ buckets: [{ grade, hits, total, pct|null }], overall, updated_at }
+```
+
+### Settled outcome overlay
+`GET /api/snapshot/:sport` grades may carry `outcome: { result:'hit'|'miss'|
+'push', actual:number }` once the game is final. `AccuracyBadge` +
+`StatStrip.OutcomeChip` render these. Frontend proxy: `web/src/app/api/accuracy`.
diff --git a/BUILD-STATE.md b/BUILD-STATE.md
index d2b3a9a..2dd91e0 100755
--- a/BUILD-STATE.md
+++ b/BUILD-STATE.md
@@ -1,11 +1,64 @@
# VYNDR — Build State
## Last Updated
-2026-06-19
+2026-07-10
## Current Phase
-SHIP BUILD v54.0 — Audit cleanup: name edge cases (hyphen / middle-initial /
-richie), Team Hub name normalization, accent-keeping dedup, parlay copy.
+SHIP BUILD v55.0 — Product overhaul: the self-learning loop (outcome tracking +
+accuracy) + the real-time layer (auto-refresh, freshness, live signals) + landing
+top-signals preview. Founder-pricing expiry restored.
+
+## Session 55 (2026-07-10) — SHIPPED ✅ SELF-LEARNING LOOP + REAL-TIME LAYER
+
+Backend 2255 (4 failing) → **2274 tests** (all green; +19 new, +4 fixed), 196
+suites. Web build clean (exit 0). Spec: `specs/session55-self-learning.md`.
+
+### Phase 2 — the self-learning loop (the crown jewel; nothing like it existed)
+- **`src/services/outcomeService.js`** — settles each locked snapshot grade
+ against the REAL result (MLB Stats API game log — free, same source the grade
+ pipeline uses) → hit/miss/push, aggregated by grade tier over a trailing 30-day
+ window. Presence of a game-log row for the graded date ⇒ FINAL. Fully
+ injectable → unit-tested with zero network. Idempotent (dedupe by
+ `nameKey|stat|line|side|date`). NBA/WNBA degrade to `pending` (offline stats),
+ never throw.
+- **Redis:** `outcomes:{sport}:log` (settled, cap 1000), `accuracy:{sport}`,
+ `accuracy:overall` ({ overall, byGrade } over 30d; pct excludes pushes).
+- **Routes:** `GET /api/accuracy` (public, cached 5m), `GET /api/ledger/accuracy`
+ (buckets — fills the pre-existing Next proxy that had no writer), internal
+ `POST /api/internal/outcomes/:sport|/all`. Cron: `settleAllOutcomes()` runs on
+ the snapshot scheduler tick BEFORE grading (settle yesterday, grade today).
+- **UI:** `AccuracyBadge` (dashboard header + scan result + landing) — honest by
+ construction: below MIN_SAMPLE (8) it reads "MODEL · LEARNING" (amber) instead
+ of faking a number; above it, "A-RATED · 68% HIT · 30D" (green). Settled
+ outcome chips (`✓ HIT (2)` / `✕ MISS`) on slate props via a snapshot-route
+ overlay + `StatStrip.OutcomeChip`.
+
+### Phase 1 — the real-time layer (make it feel ALIVE)
+- **Slate auto-refresh:** silent 60s poll (no skeleton flash, never wipes a good
+ view on a transient blip) + a "SIGNAL LIVE · N PROPS GRADED · M LIVE · UPDATED
+ Xs ago" strip with a ticking freshness clock (`nowTick`, 15s).
+- **Ticker:** anchored `LIVE` badge (pulsing dot) that flashes green when a fresh
+ event slides in (breaking-news feel).
+
+### Phase 3 — landing top-signals preview
+- **`TopSignals.tsx`** — pulls tonight's REAL top-3 A-rated grades from
+ `/api/snapshot/{mlb,nba,wnba}` as mini grade cards (archetype + grade + line) +
+ the live `AccuracyBadge`. Self-hides off-hours. The product shown, not described.
+
+### Founder pricing (the real cause of the "4 stripe failures")
+`FOUNDER_CODE_EXPIRY` default was `2026-06-30` — lapsed as of the current date
+(2026-07-10), silently disabling every founder code (and the ClaimMeter scarcity
+pitch). Extended the default to `2026-12-31` (operators still override via env).
+That restored founder pricing AND turned the 4 failing tests green.
+
+### Honest scope (deferred — NOT built this session)
+The prompt's Phases 4–8 (dashboard card redesign, scan reveal polish, Parlay Lab
+derivatives-desk polish, nav/mobile/onboarding/settings/team-hub polish) are real
+follow-on work. This session invested in the two TRANSFORMATIVE, differentiated
+systems (real-time + self-learning) end-to-end with tests + the highest-leverage
+first-visit surfaces (landing signals, dashboard accuracy). Live calibration
+adjustment (spec 2.3, feeding outcomes back into grade confidence) is scaffolded
+by the accuracy record but not yet wired into the engine.
## Session 54 (2026-06-19) — SHIPPED ✅ AUDIT CLEANUP
diff --git a/CLAUDE.md b/CLAUDE.md
index 073b12f..d2413c9 100755
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -619,6 +619,45 @@ snapshot, locked to the line, and read from cache.
regression"). "kill conditions" is still legit IN-APP product copy (help/pricing/
scan) — only the social meta was cleaned.
+## Self-Learning Loop + Real-Time Layer (Session 55 — non-obvious)
+- **`outcomeService.settleSnapshot(sport, deps)`** is the self-learning loop:
+ reads `snapshot:{sport}:latest`, settles each locked grade vs the REAL result
+ from `mlbStatsAdapter.getPlayerStats().last10` (game-log row whose `date`
+ matches the graded date — UTC **or** ET, to cover late-game rollover), records
+ hit/miss/push, and writes `outcomes:{sport}:log` + `accuracy:{sport}` +
+ `accuracy:overall`. **Idempotent** — dedupe key is `nameKey|stat|line|side|date`;
+ re-running never double-counts. Presence of a game-log row ⇒ the game is FINAL
+ (no separate status check). NBA/WNBA have no free settled-result feed → they
+ stay `pending` (never throw). If you add an MLB stat_type, add it to
+ `MLB_LOG_FIELD` in outcomeService (a LOCAL copy — settlement is decoupled from
+ featureCache's map on purpose) or its props won't settle.
+- **Accuracy pct EXCLUDES pushes** (`hits/(hits+misses)`); `sample` counts pushes.
+ Grade buckets: `A+` stands alone, then first-letter (`A-`/`A`→A, `B±`/`B`→B).
+ 30-day trailing window keyed off each outcome's game `date`.
+- **The cron settles BEFORE it grades** (`snapshotScheduler` tick): settle
+ yesterday's now-completed games, then grade today's fresh slate. Trigger
+ manually via internal `POST /api/internal/outcomes/all` (same key as snapshot).
+- **`GET /api/accuracy`** (public, cached) + **`GET /api/ledger/accuracy`**
+ (buckets — the pre-existing Next `ledger/accuracy` proxy finally has a writer).
+ Browser reaches them via `web/src/app/api/accuracy/route.ts` (new proxy) — same
+ S25 rule.
+- **`AccuracyBadge`** (`@/components/vyndr`) is HONEST: `< MIN_SAMPLE` (8 settled)
+ → "MODEL · LEARNING" (amber), else "A-RATED · X% HIT · 30D" (green). Pass
+ `sport=` for a sport-specific record. Self-hides only when the fetch fails/empty.
+- **Settled outcomes overlay the live slate:** `GET /api/snapshot/:sport` merges
+ `outcomes:{sport}:log` onto grades (`outcome:{result,actual}`), threaded through
+ `slateAdapter.buildPlayerStripsFromProps` → `StatStrip.OutcomeChip` (`✓ HIT (2)`
+ / `✕ MISS`). A settled prop hides its "+parlay" / BOOK-IT chips (the bet is over).
+- **Real-time Slate:** `fetchSlate(tab, silent=true)` polls every 60s WITHOUT the
+ skeleton flash and NEVER wipes a good view on a transient empty result (guard:
+ `if (silent && allGames.length===0) return`). The "SIGNAL LIVE · UPDATED Xs ago"
+ strip uses `lastRefreshed` + a 15s `nowTick`. Ticker has an anchored LIVE badge
+ that flashes on a new head event.
+- **Founder pricing:** `stripeService` `FOUNDER_CODE_EXPIRY` default is now
+ `2026-12-31` (was `2026-06-30`, which had lapsed and disabled every founder code
+ + the ClaimMeter pitch). That expiry lapsing — NOT a tier-limit change — was the
+ cause of the "4 stripe test failures." Operators override via `FOUNDER_CODE_EXPIRY`.
+
## Active Skills
- vyndr-voice (all user-facing output)
- prop-analysis (grading methodology)
diff --git a/specs/session55-self-learning.md b/specs/session55-self-learning.md
new file mode 100644
index 0000000..0344439
--- /dev/null
+++ b/specs/session55-self-learning.md
@@ -0,0 +1,76 @@
+# Spec — Self-Learning Loop (Outcome Tracking + Accuracy) — Session 55
+
+## Problem
+VYNDR grades props but never checks whether it was right. The intelligence is
+static — no outcome tracking, no accuracy record, no "the system learns" signal.
+This is the #1 trust builder for a product a 98K-follower bettor would stake his
+reputation on: showing real accuracy, including misses.
+
+## What we build
+`outcomeService` — settles locked snapshot grades against real game results,
+records hit/miss per graded prop, and aggregates a rolling accuracy record by
+grade tier. Powered by the FREE MLB Stats API game log (the same source the
+grade pipeline already uses); NBA/WNBA degrade to `pending` when the Python
+stats service is offline (matches existing posture). Zero new dependency, zero
+new paid API credits.
+
+## Data source
+`mlbStatsAdapter.getPlayerStats(name)` → `{ found, last10: [{ date, opponent, stat:{…} }] }`.
+A prop is "settled" when a game-log row exists for the graded date (presence in
+the log ⇒ the game is FINAL). The actual stat value is read via a settlement
+map (VYNDR `stat_type` → statsapi game-log field), mirroring `MLB_LOG_FIELD`.
+
+## Settlement logic
+For each grade in `snapshot:{sport}:latest`:
+- `targetDates` = the UTC date and America/New_York date of `gradedAt.timestamp`
+ (covers late-game ET rollover without heavy TZ math).
+- Find the game-log row whose `date` ∈ `targetDates`. None ⇒ `pending` (skip).
+- `actual` = settlement-map value for the graded `stat_type`. Unmappable ⇒ skip.
+- `result`:
+ - side `over`: actual > line ⇒ `hit`; actual < line ⇒ `miss`; == ⇒ `push`
+ - side `under`: actual < line ⇒ `hit`; actual > line ⇒ `miss`; == ⇒ `push`
+- Idempotent: outcome key = `nameKey(player)|stat|line|side|date`. A prop settles
+ once; re-runs never double-count.
+
+## Persistence (Redis, no DB migration)
+- `outcomes:{sport}:log` — array of settled outcomes (newest first, cap 1000,
+ deduped by key). Each: `{ key, player, stat, line, side, grade, actual, result, date, gradedAt, settledAt }`.
+- `accuracy:{sport}` — `{ sport, updated_at, window_days:30, sample, overall:{hits,total,pushes,pct}, byGrade:{'A+':{…},'A':{…},'B':{…},'C':{…},'D':{…}} }`.
+- `accuracy:overall` — same shape aggregated across sports (dashboard header).
+- `pct` = hits / (hits + misses) over the trailing 30 days; pushes excluded from pct.
+
+## Endpoints
+- `GET /api/accuracy` (public, cached 5m) → `{ overall, sports:{mlb,nba,wnba,…}, updated_at }`.
+- `GET /api/ledger/accuracy` (public) → `{ buckets:[{ grade, hits, total, pct }] }`
+ (feeds the existing Next proxy `web/src/app/api/ledger/accuracy`).
+- `POST /api/internal/outcomes/:sport` and `/outcomes/all` (internal-key gated) —
+ trigger settlement. Same auth as the snapshot trigger.
+- Cron: `settleAllOutcomes()` runs on the snapshot scheduler tick BEFORE grading
+ (settle yesterday's completed games, then grade today's).
+
+## Frontend
+- Dashboard header accuracy pill: "A-RATED · 68% HIT RATE (30D)" from `/api/accuracy`.
+ Self-hides when sample is too small (< MIN_SAMPLE).
+- `GradeResultCard`: "A-rated props hit 68% of the time" line when accuracy for
+ that grade tier is available (passed via `gradeAdapter`).
+- Snapshot prop rows: a settled prop shows `✅ HIT (2)` / `❌ MISS (1)` /
+ `PUSH` derived from `outcomes:{sport}:log` (via the snapshot read merge).
+
+## Acceptance criteria
+1. `settleSnapshot('mlb', deps)` with injected grades + game logs returns settled
+ outcomes with correct hit/miss/push for over AND under sides.
+2. Settlement is idempotent — running twice does not double-count.
+3. Accuracy aggregates hits/total/pct by grade tier over the 30-day window.
+4. A prop with no matching game-log row stays `pending` and is excluded.
+5. `GET /api/accuracy` returns the persisted record (empty-safe when cold).
+6. NBA/WNBA (offline stats) degrade to `pending`, never throw.
+7. All deps injectable → tests hit zero network.
+
+## Test plan
+`tests/unit/outcomeService.test.js`:
+- hit/miss/push for over + under; unmappable stat skipped; missing game skipped.
+- idempotency (dedupe by key across two runs).
+- accuracy bucketing + pct math + 30-day window filter + MIN_SAMPLE gating.
+- `getAccuracy` cold-cache empty shape.
+`tests/integration/accuracy.test.js`:
+- `GET /api/accuracy` and `GET /api/ledger/accuracy` return valid shapes.
diff --git a/src/app.js b/src/app.js
index da720d7..8c41c4b 100644
--- a/src/app.js
+++ b/src/app.js
@@ -155,6 +155,10 @@ const snapshotReadRoutes = require('./routes/snapshot');
app.use('/api/snapshot', snapshotReadRoutes);
// Session 51 — Team Hub (roster + archetypes + graded props). Public, cached.
app.use('/api/team', require('./routes/team'));
+// Session 55 — self-learning loop: the system's rolling accuracy record
+// (settled snapshot grades vs real results). Public, cache-only.
+app.use('/api/accuracy', require('./routes/accuracy'));
+app.use('/api/ledger', require('./routes/ledger'));
const gameLinesRoutes = require('./routes/gameLines');
app.use('/api/gamelines', gameLinesRoutes);
const streaksRoutes = require('./routes/streaks');
diff --git a/src/routes/accuracy.js b/src/routes/accuracy.js
new file mode 100644
index 0000000..e740457
--- /dev/null
+++ b/src/routes/accuracy.js
@@ -0,0 +1,30 @@
+'use strict';
+
+/**
+ * GET /api/accuracy (Session 55) — the system's track record.
+ *
+ * Public, cache-only read of the rolling accuracy record written by
+ * outcomeService (settled snapshot grades vs real results). Powers the
+ * dashboard "A-rated: 68% hit rate" pill and the grade-card accuracy line.
+ * NEVER triggers settlement (that's the internal cron) → no API credits spent.
+ */
+
+const express = require('express');
+const { createRateLimit } = require('../middleware/rateLimit');
+const outcomeService = require('../services/outcomeService');
+
+const router = express.Router();
+router.use(createRateLimit({ windowMs: 60_000, max: 60 }));
+
+router.get('/', async (req, res) => {
+ try {
+ const acc = await outcomeService.getAccuracy();
+ res.set('Cache-Control', 'public, max-age=300');
+ return res.json(acc);
+ } catch (err) {
+ console.error('[accuracy]', err.message);
+ return res.status(200).json({ overall: null, sports: {}, min_sample: outcomeService.MIN_SAMPLE, updated_at: null });
+ }
+});
+
+module.exports = router;
diff --git a/src/routes/internal.js b/src/routes/internal.js
index 0275544..93d0fbe 100644
--- a/src/routes/internal.js
+++ b/src/routes/internal.js
@@ -159,4 +159,35 @@ router.post('/snapshot/:sport', async (req, res) => {
}
});
+/**
+ * POST /api/internal/outcomes/all (Session 55) — settle every sport's latest
+ * snapshot against real results + recompute the overall accuracy record. This
+ * is the self-learning loop's write path (the public /api/accuracy is read-only).
+ * Registered BEFORE /outcomes/:sport so "all" isn't captured as a sport.
+ */
+router.post('/outcomes/all', async (req, res) => {
+ const outcomes = require('../services/outcomeService');
+ try {
+ const results = await outcomes.settleAllOutcomes();
+ return res.json({ ok: true, results });
+ } catch (err) {
+ const message = err && err.message ? err.message : String(err);
+ console.error('[internal/outcomes/all] failed:', message);
+ return res.status(500).json({ ok: false, error: message });
+ }
+});
+
+router.post('/outcomes/:sport', async (req, res) => {
+ const outcomes = require('../services/outcomeService');
+ try {
+ const summary = await outcomes.settleSnapshot(req.params.sport);
+ await outcomes.recomputeOverall();
+ return res.json({ ok: true, summary: { sport: summary.sport, settled: summary.settled, pending: summary.pending, accuracy: summary.accuracy } });
+ } catch (err) {
+ const message = err && err.message ? err.message : String(err);
+ console.error('[internal/outcomes] failed:', message);
+ return res.status(500).json({ ok: false, error: message });
+ }
+});
+
module.exports = router;
diff --git a/src/routes/ledger.js b/src/routes/ledger.js
new file mode 100644
index 0000000..aad152e
--- /dev/null
+++ b/src/routes/ledger.js
@@ -0,0 +1,30 @@
+'use strict';
+
+/**
+ * GET /api/ledger/accuracy (Session 55) — grade-tier buckets for the ledger UI.
+ *
+ * The Next proxy `web/src/app/api/ledger/accuracy` has expected a `{ buckets }`
+ * shape since before a writer existed; the self-learning loop now fills it.
+ * Public, cache-only (reads outcomeService's persisted accuracy record).
+ */
+
+const express = require('express');
+const { createRateLimit } = require('../middleware/rateLimit');
+const outcomeService = require('../services/outcomeService');
+
+const router = express.Router();
+router.use(createRateLimit({ windowMs: 60_000, max: 60 }));
+
+router.get('/accuracy', async (req, res) => {
+ try {
+ const acc = await outcomeService.getAccuracy();
+ const buckets = outcomeService.accuracyBuckets(acc.overall);
+ res.set('Cache-Control', 'public, max-age=300');
+ return res.json({ buckets, overall: acc.overall && acc.overall.overall, updated_at: acc.updated_at });
+ } catch (err) {
+ console.error('[ledger/accuracy]', err.message);
+ return res.status(200).json({ buckets: [] });
+ }
+});
+
+module.exports = router;
diff --git a/src/routes/snapshot.js b/src/routes/snapshot.js
index c93c0b4..ae3f8b0 100644
--- a/src/routes/snapshot.js
+++ b/src/routes/snapshot.js
@@ -12,23 +12,47 @@
const express = require('express');
const { createRateLimit } = require('../middleware/rateLimit');
const { cacheGet } = require('../utils/redis');
+const { nameKey } = require('../utils/playerName');
const router = express.Router();
router.use(createRateLimit({ windowMs: 60_000, max: 60 }));
+// Session 55 — overlay settled outcomes (self-learning loop) onto the grades so
+// a completed prop can render "✅ HIT (2)" / "❌ MISS". Keyed by player+stat+line+side.
+function outcomeIndex(log) {
+ const map = {};
+ for (const o of Array.isArray(log) ? log : []) {
+ const side = String(o.side || 'O').toUpperCase() === 'U' ? 'U' : 'O';
+ map[`${nameKey(o.player)}|${String(o.stat).toLowerCase()}|${o.line}|${side}`] = o;
+ }
+ return map;
+}
+function attachOutcomes(grades, index) {
+ if (!index || Object.keys(index).length === 0) return grades;
+ return grades.map((g) => {
+ const side = String(g.direction || 'over').toLowerCase() === 'under' ? 'U' : 'O';
+ const o = index[`${nameKey(g.player || g.player_name)}|${String(g.stat_type || g.stat || '').toLowerCase()}|${g.line}|${side}`];
+ return o ? { ...g, outcome: { result: o.result, actual: o.actual } } : g;
+ });
+}
+
router.get('/:sport', async (req, res) => {
const sport = String(req.params.sport || '').toLowerCase();
try {
- const snap = await cacheGet(`snapshot:${sport}:latest`);
+ const [snap, outcomeLog] = await Promise.all([
+ cacheGet(`snapshot:${sport}:latest`),
+ cacheGet(`outcomes:${sport}:log`),
+ ]);
+ const idx = outcomeIndex(outcomeLog);
if (snap && Array.isArray(snap.grades)) {
res.set('Cache-Control', 'public, max-age=30');
- return res.json({ sport, updated_at: snap.updated_at, grades: snap.grades, deltas: snap.deltas || [] });
+ return res.json({ sport, updated_at: snap.updated_at, grades: attachOutcomes(snap.grades, idx), deltas: snap.deltas || [] });
}
// Fallback: the grades envelope (no deltas yet).
const env = await cacheGet(`grades:${sport}`);
const grades = env && Array.isArray(env.grades) ? env.grades : [];
res.set('Cache-Control', 'public, max-age=30');
- return res.json({ sport, updated_at: env && env.updated_at, grades, deltas: [] });
+ return res.json({ sport, updated_at: env && env.updated_at, grades: attachOutcomes(grades, idx), deltas: [] });
} catch (err) {
console.error('[snapshot]', err.message);
return res.status(200).json({ sport, grades: [], deltas: [] });
diff --git a/src/services/outcomeService.js b/src/services/outcomeService.js
new file mode 100644
index 0000000..24ca5a8
--- /dev/null
+++ b/src/services/outcomeService.js
@@ -0,0 +1,296 @@
+'use strict';
+
+/**
+ * outcomeService — the self-learning loop (Session 55).
+ *
+ * VYNDR grades props but never checked whether it was right. This closes the
+ * loop: after games complete, settle each locked snapshot grade against the
+ * REAL result (did the player clear the line?), record hit/miss/push, and
+ * aggregate a rolling accuracy record by grade tier. That powers the accuracy
+ * display ("A-rated props: 68% hit rate"), the #1 trust builder — a system that
+ * shows its misses, not just its hits.
+ *
+ * Data source: the FREE MLB Stats API game log (mlbStatsAdapter.getPlayerStats)
+ * — the same source the grade pipeline already uses. Presence of a game-log row
+ * for the graded date ⇒ the game is FINAL. NBA/WNBA degrade to `pending` when
+ * their (usually offline) Python stats service returns nothing — never throw.
+ * Zero new dependency, zero paid API credits.
+ *
+ * Redis keys written:
+ * outcomes:{sport}:log — settled outcomes, newest first, cap 1000, deduped
+ * accuracy:{sport} — { overall, byGrade } over a trailing 30-day window
+ * accuracy:overall — same, aggregated across sports (dashboard header)
+ *
+ * Everything is injectable → the whole cycle is unit-tested with zero network.
+ */
+
+const { nameKey } = require('../utils/playerName');
+
+const LOG_CAP = 1000;
+const LOG_TTL = 30 * 24 * 3600; // 30d — matches the accuracy window
+const ACC_TTL = 7 * 24 * 3600;
+const WINDOW_DAYS = 30;
+const MIN_SAMPLE = 8; // below this, callers should hide the pct
+const SPORTS = ['mlb', 'nba', 'wnba', 'soccer'];
+
+// VYNDR stat_type → the per-game field in a statsapi.mlb.com game-log row.
+// Mirrors featureCache.MLB_LOG_FIELD (settlement is a distinct concern, kept
+// self-contained so this service doesn't depend on test-only internals).
+const MLB_LOG_FIELD = {
+ total_bases: 'totalBases', home_runs: 'homeRuns', hits: 'hits', rbi: 'rbi',
+ runs: 'runs', stolen_bases: 'stolenBases', walks: 'baseOnBalls',
+ strikeouts: 'strikeOuts', earned_runs: 'earnedRuns', hits_allowed: 'hits',
+ innings_pitched: 'inningsPitched',
+};
+
+function statValue(statObj, statType) {
+ const f = MLB_LOG_FIELD[String(statType || '').toLowerCase()];
+ if (!f || !statObj) return null;
+ const n = parseFloat(statObj[f]);
+ return Number.isFinite(n) ? n : null;
+}
+
+// The UTC date AND the America/New_York date of an ISO timestamp — covers a
+// late game whose ET calendar date differs from UTC, without heavy TZ math.
+function dateStrings(ts) {
+ if (!ts) return [];
+ const d = new Date(ts);
+ if (isNaN(d.getTime())) return [];
+ const utc = d.toISOString().slice(0, 10);
+ let et = utc;
+ try {
+ et = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/New_York' }).format(d);
+ } catch { /* Intl missing → UTC only */ }
+ return [...new Set([utc, et])];
+}
+
+const sideOver = (side) => {
+ const s = String(side || 'over').toLowerCase();
+ return s === 'over' || s === 'o';
+};
+
+// hit / miss / push for a graded side given the actual result and the line.
+function settleResult(side, actual, line) {
+ if (actual == null || line == null) return null;
+ const a = Number(actual), l = Number(line);
+ if (!Number.isFinite(a) || !Number.isFinite(l)) return null;
+ if (a === l) return 'push';
+ return sideOver(side) ? (a > l ? 'hit' : 'miss') : (a < l ? 'hit' : 'miss');
+}
+
+// Bucket a letter grade into a tier: A+ stands alone; A-/A → A; B±/B → B; …
+function gradeBucket(grade) {
+ const g = String(grade || '').trim().toUpperCase();
+ if (!g) return null;
+ if (g === 'A+') return 'A+';
+ return g[0];
+}
+
+const TIERS = ['A+', 'A', 'B', 'C', 'D', 'F'];
+
+function outcomeKey(o) {
+ return `${nameKey(o.player)}|${String(o.stat).toLowerCase()}|${o.line}|${sideOver(o.side) ? 'O' : 'U'}|${o.date}`;
+}
+
+/**
+ * Settle one sport's latest snapshot against real results. Returns
+ * { sport, settled, pending, log } and persists the merged log + accuracy.
+ * Never throws; a player/stat that can't be resolved is simply left pending.
+ *
+ * opts (all injectable): cacheGet, cacheSet, getPlayerStats(name, sport),
+ * now (ISO string).
+ */
+async function settleSnapshot(sport, opts = {}) {
+ const sp = String(sport || '').toLowerCase();
+ const deps = {
+ cacheGet: opts.cacheGet || require('../utils/redis').cacheGet,
+ cacheSet: opts.cacheSet || require('../utils/redis').cacheSet,
+ getPlayerStats: opts.getPlayerStats || defaultGetPlayerStats,
+ now: opts.now || (() => new Date().toISOString()),
+ };
+ const nowIso = deps.now();
+
+ const snap = await deps.cacheGet(`snapshot:${sp}:latest`);
+ const grades = snap && Array.isArray(snap.grades) ? snap.grades : [];
+ if (grades.length === 0) return { sport: sp, settled: 0, pending: 0, log: [] };
+
+ // Existing settled log (idempotency source).
+ const prevLog = normalizeLog(await deps.cacheGet(`outcomes:${sp}:log`));
+ const seen = new Set(prevLog.map(outcomeKey));
+
+ // Resolve each unique player's game log ONCE per run.
+ const players = [...new Set(grades.map((g) => g.player || g.player_name).filter(Boolean))];
+ const logByPlayer = {};
+ for (const player of players) {
+ try {
+ const stats = await deps.getPlayerStats(player, sp);
+ logByPlayer[player] = stats && stats.found && Array.isArray(stats.last10) ? stats.last10 : [];
+ } catch { logByPlayer[player] = []; }
+ }
+
+ const fresh = [];
+ let pending = 0;
+ for (const g of grades) {
+ const player = g.player || g.player_name;
+ const stat = g.stat_type || g.stat;
+ const side = g.direction || 'over';
+ const line = g.line;
+ const gradedTs = (g.gradedAt && g.gradedAt.timestamp) || snap.updated_at || nowIso;
+ const dates = dateStrings(gradedTs);
+ const log = logByPlayer[player] || [];
+ // Find the game played on the graded date.
+ const row = log.find((r) => r && r.date && dates.includes(r.date));
+ if (!row) { pending += 1; continue; }
+ const actual = statValue(row.stat, stat);
+ if (actual == null) { pending += 1; continue; }
+ const result = settleResult(side, actual, line);
+ if (!result) { pending += 1; continue; }
+ const outcome = {
+ player, stat, line, side: sideOver(side) ? 'O' : 'U',
+ grade: g.grade, actual, result, date: row.date,
+ gradedAt: gradedTs, settledAt: nowIso,
+ };
+ const key = outcomeKey(outcome);
+ if (seen.has(key)) continue; // idempotent — already settled
+ seen.add(key);
+ fresh.push({ ...outcome, key });
+ }
+
+ // Merge (newest first), cap.
+ const merged = [...fresh, ...prevLog].slice(0, LOG_CAP);
+ await deps.cacheSet(`outcomes:${sp}:log`, merged, LOG_TTL);
+
+ const accuracy = computeAccuracy(sp, merged, nowIso);
+ await deps.cacheSet(`accuracy:${sp}`, accuracy, ACC_TTL);
+
+ return { sport: sp, settled: fresh.length, pending, log: merged, accuracy };
+}
+
+// Aggregate a settled log into an accuracy record over the trailing window.
+function computeAccuracy(sport, log, nowIso, windowDays = WINDOW_DAYS) {
+ const cutoff = new Date(nowIso).getTime() - windowDays * 24 * 3600 * 1000;
+ const inWindow = (log || []).filter((o) => {
+ const t = new Date(`${o.date}T12:00:00Z`).getTime();
+ return Number.isFinite(t) && t >= cutoff;
+ });
+ const bucketFor = (grade) => {
+ const b = gradeBucket(grade);
+ return TIERS.includes(b) ? b : null;
+ };
+ const blank = () => ({ hits: 0, misses: 0, pushes: 0, total: 0, pct: null });
+ const byGrade = {};
+ for (const t of TIERS) byGrade[t] = blank();
+ const overall = blank();
+ for (const o of inWindow) {
+ const tier = bucketFor(o.grade);
+ const targets = [overall];
+ if (tier) targets.push(byGrade[tier]);
+ for (const bucket of targets) {
+ if (o.result === 'hit') bucket.hits += 1;
+ else if (o.result === 'miss') bucket.misses += 1;
+ else if (o.result === 'push') bucket.pushes += 1;
+ }
+ }
+ const finalize = (b) => {
+ b.total = b.hits + b.misses + b.pushes;
+ const decided = b.hits + b.misses;
+ b.pct = decided > 0 ? Math.round((b.hits / decided) * 100) : null;
+ return b;
+ };
+ finalize(overall);
+ for (const t of TIERS) finalize(byGrade[t]);
+ return {
+ sport, updated_at: nowIso, window_days: windowDays,
+ sample: overall.total, min_sample: MIN_SAMPLE,
+ overall, byGrade,
+ };
+}
+
+function normalizeLog(raw) {
+ if (Array.isArray(raw)) return raw;
+ if (raw && Array.isArray(raw.log)) return raw.log;
+ return [];
+}
+
+async function defaultGetPlayerStats(name, sport) {
+ if (String(sport).toLowerCase() === 'mlb') {
+ return require('./adapters/mlbStatsAdapter').getPlayerStats(name);
+ }
+ // NBA/WNBA/soccer: no free settled-result feed here → pending.
+ return { found: false };
+}
+
+/**
+ * Recompute the cross-sport accuracy:overall record from every sport's log.
+ * Called after settling. Deps: cacheGet, cacheSet, now.
+ */
+async function recomputeOverall(opts = {}) {
+ const deps = {
+ cacheGet: opts.cacheGet || require('../utils/redis').cacheGet,
+ cacheSet: opts.cacheSet || require('../utils/redis').cacheSet,
+ now: opts.now || (() => new Date().toISOString()),
+ };
+ const nowIso = deps.now();
+ const logs = [];
+ for (const sp of SPORTS) {
+ const l = normalizeLog(await deps.cacheGet(`outcomes:${sp}:log`));
+ logs.push(...l);
+ }
+ const acc = computeAccuracy('overall', logs, nowIso);
+ await deps.cacheSet('accuracy:overall', acc, ACC_TTL);
+ return acc;
+}
+
+/** Settle every sport, then recompute the overall record. Cron entrypoint. */
+async function settleAllOutcomes(opts = {}) {
+ const results = [];
+ for (const sp of SPORTS) {
+ try { results.push(await settleSnapshot(sp, opts)); }
+ catch (e) { results.push({ sport: sp, settled: 0, pending: 0, error: e.message }); }
+ }
+ await recomputeOverall(opts);
+ return results;
+}
+
+/**
+ * Read the persisted accuracy record for the public endpoint. Cold-cache safe:
+ * returns an empty-but-valid shape. Deps: cacheGet.
+ */
+async function getAccuracy(opts = {}) {
+ const cacheGet = opts.cacheGet || require('../utils/redis').cacheGet;
+ const overall = await cacheGet('accuracy:overall');
+ const sports = {};
+ for (const sp of SPORTS) {
+ const a = await cacheGet(`accuracy:${sp}`);
+ if (a) sports[sp] = a;
+ }
+ return {
+ overall: overall || computeAccuracy('overall', [], new Date().toISOString()),
+ sports,
+ min_sample: MIN_SAMPLE,
+ updated_at: overall && overall.updated_at ? overall.updated_at : null,
+ };
+}
+
+/** Flatten an accuracy record into the ledger `buckets` shape. */
+function accuracyBuckets(acc) {
+ if (!acc || !acc.byGrade) return [];
+ return TIERS
+ .map((tier) => {
+ const b = acc.byGrade[tier] || {};
+ return { grade: tier, hits: b.hits || 0, total: b.total || 0, pct: b.pct };
+ })
+ .filter((b) => b.total > 0);
+}
+
+module.exports = {
+ settleSnapshot,
+ settleAllOutcomes,
+ recomputeOverall,
+ getAccuracy,
+ computeAccuracy,
+ accuracyBuckets,
+ SPORTS,
+ MIN_SAMPLE,
+ __internals: { settleResult, gradeBucket, dateStrings, statValue, outcomeKey, MLB_LOG_FIELD, TIERS },
+};
diff --git a/src/services/stripeService.js b/src/services/stripeService.js
index f2a07cf..78edb81 100644
--- a/src/services/stripeService.js
+++ b/src/services/stripeService.js
@@ -31,7 +31,11 @@ const PRICE_UNCONFIGURED = '__unconfigured__';
// VYNDR is the canonical brand promo. BETONBLK stays in the default list so
// codes distributed before the rebrand keep redeeming during the transition.
const VALID_FOUNDER_CODES = (process.env.FOUNDER_CODES || 'FOUNDER2026,VYNDR,BETONBLK,EARLYBIRD').split(',');
-const FOUNDER_EXPIRY = new Date(process.env.FOUNDER_CODE_EXPIRY || '2026-06-30');
+// Session 55 — founder pricing is still an active launch lever (the ClaimMeter
+// scarcity meter + the $14.99/$34.99 founder tiers advertise it), so the default
+// window runs through 2026. The 2026-06-30 default had silently lapsed (current
+// date 2026-07-10), disabling every founder code. Operators override via env.
+const FOUNDER_EXPIRY = new Date(process.env.FOUNDER_CODE_EXPIRY || '2026-12-31');
function isFounderCodeValid(code) {
if (!code) return false;
diff --git a/src/snapshotScheduler.js b/src/snapshotScheduler.js
index bcf0f3c..68ee465 100644
--- a/src/snapshotScheduler.js
+++ b/src/snapshotScheduler.js
@@ -27,6 +27,10 @@ function startSnapshotScheduler(opts = {}) {
return null;
}
const runAll = opts.runAllSnapshots || require('./services/snapshotService').runAllSnapshots;
+ // Session 55 — self-learning loop. Settle the PRIOR snapshot's grades against
+ // real (now-completed) results BEFORE grading the fresh slate, so the accuracy
+ // record reflects yesterday's games each cycle.
+ const settleAll = opts.settleAllOutcomes || require('./services/outcomeService').settleAllOutcomes;
const now = opts.now || (() => new Date());
let lastFiredSlot = null;
@@ -38,6 +42,13 @@ function startSnapshotScheduler(opts = {}) {
const slot = `${d.getUTCFullYear()}-${d.getUTCMonth()}-${d.getUTCDate()}-${h}`;
if (slot === lastFiredSlot) return; // fire once per slot
lastFiredSlot = slot;
+ try {
+ const settled = await settleAll();
+ const totalSettled = settled.reduce((n, r) => n + (r.settled || 0), 0);
+ console.log(`[outcomes] cron fired ${h}:00 UTC — ${totalSettled} props settled vs real results`);
+ } catch (e) {
+ console.warn('[outcomes] settle run failed:', e.message);
+ }
try {
const results = await runAll();
const ok = results.filter((r) => r.status === 'ok');
diff --git a/tests/integration/accuracy.test.js b/tests/integration/accuracy.test.js
new file mode 100644
index 0000000..9d4de4c
--- /dev/null
+++ b/tests/integration/accuracy.test.js
@@ -0,0 +1,67 @@
+'use strict';
+
+// Session 55 — the self-learning loop's public read endpoints. Redis is mocked
+// so these run offline; the store is seeded per-test via cacheGet.
+
+const request = require('supertest');
+
+let mockStore = {};
+jest.mock('../../src/utils/redis', () => ({
+ getRedisClient: () => ({}),
+ cacheGet: async (k) => (k in mockStore ? mockStore[k] : null),
+ cacheSet: async (k, v) => { mockStore[k] = v; return true; },
+ cacheDel: async () => true,
+ isDegraded: () => false,
+}));
+
+const app = require('../../src/app');
+
+beforeEach(() => { mockStore = {}; });
+
+describe('GET /api/accuracy', () => {
+ test('cold cache → valid empty-safe shape', async () => {
+ const res = await request(app).get('/api/accuracy');
+ expect(res.status).toBe(200);
+ expect(res.body).toHaveProperty('overall');
+ expect(res.body).toHaveProperty('sports');
+ expect(res.body.min_sample).toBeGreaterThan(0);
+ });
+
+ test('returns the persisted record when present', async () => {
+ mockStore['accuracy:overall'] = {
+ sport: 'overall', updated_at: '2026-07-10T00:00:00Z', window_days: 30, sample: 20,
+ overall: { hits: 14, misses: 6, pushes: 0, total: 20, pct: 70 },
+ byGrade: { 'A': { hits: 8, misses: 2, pushes: 0, total: 10, pct: 80 } },
+ };
+ mockStore['accuracy:mlb'] = mockStore['accuracy:overall'];
+ const res = await request(app).get('/api/accuracy');
+ expect(res.body.overall.overall.pct).toBe(70);
+ expect(res.body.sports.mlb).toBeTruthy();
+ });
+});
+
+describe('GET /api/ledger/accuracy', () => {
+ test('returns grade-tier buckets from the accuracy record', async () => {
+ mockStore['accuracy:overall'] = {
+ sport: 'overall', updated_at: '2026-07-10T00:00:00Z', window_days: 30, sample: 15,
+ overall: { hits: 10, misses: 5, pushes: 0, total: 15, pct: 67 },
+ byGrade: {
+ 'A+': { hits: 3, misses: 0, pushes: 0, total: 3, pct: 100 },
+ 'A': { hits: 5, misses: 2, pushes: 0, total: 7, pct: 71 },
+ 'B': { hits: 2, misses: 3, pushes: 0, total: 5, pct: 40 },
+ },
+ };
+ const res = await request(app).get('/api/ledger/accuracy');
+ expect(res.status).toBe(200);
+ expect(Array.isArray(res.body.buckets)).toBe(true);
+ const grades = res.body.buckets.map((b) => b.grade);
+ expect(grades).toContain('A+');
+ expect(grades).toContain('A');
+ });
+
+ test('cold cache → empty buckets, never 500', async () => {
+ const res = await request(app).get('/api/ledger/accuracy');
+ expect(res.status).toBe(200);
+ expect(res.body.buckets).toEqual([]);
+ });
+});
diff --git a/tests/unit/outcomeService.test.js b/tests/unit/outcomeService.test.js
new file mode 100644
index 0000000..9f5c602
--- /dev/null
+++ b/tests/unit/outcomeService.test.js
@@ -0,0 +1,162 @@
+'use strict';
+
+const svc = require('../../src/services/outcomeService');
+const { settleResult, gradeBucket, dateStrings, statValue, outcomeKey } = svc.__internals;
+
+// A tiny in-memory Redis so settleSnapshot round-trips through cacheGet/cacheSet.
+function memCache(seed = {}) {
+ const store = { ...seed };
+ return {
+ store,
+ cacheGet: async (k) => (k in store ? store[k] : null),
+ cacheSet: async (k, v) => { store[k] = v; return true; },
+ };
+}
+
+const ISO = '2026-07-10T02:00:00.000Z'; // ~10pm ET Jul 9 — exercises the ET rollover
+
+function snapshot(grades) {
+ return { sport: 'mlb', updated_at: ISO, grades };
+}
+function grade(over = {}) {
+ return {
+ player: over.player || 'Aaron Judge',
+ stat_type: over.stat || 'hits',
+ line: over.line != null ? over.line : 1.5,
+ direction: over.side || 'over',
+ grade: over.grade || 'A',
+ gradedAt: { line: over.line != null ? over.line : 1.5, odds: -115, timestamp: ISO },
+ };
+}
+// Game-log rows keyed to the ET or UTC date of ISO.
+function log(date, stat) { return [{ date, opponent: 'BOS', stat }]; }
+
+describe('outcomeService — settlement math', () => {
+ test('over: actual above line = hit, below = miss, equal = push', () => {
+ expect(settleResult('over', 2, 1.5)).toBe('hit');
+ expect(settleResult('over', 1, 1.5)).toBe('miss');
+ expect(settleResult('over', 2, 2)).toBe('push');
+ });
+ test('under: actual below line = hit, above = miss', () => {
+ expect(settleResult('under', 1, 1.5)).toBe('hit');
+ expect(settleResult('under', 2, 1.5)).toBe('miss');
+ expect(settleResult('U', 3, 3)).toBe('push');
+ });
+ test('non-numeric actual/line → null (unsettleable)', () => {
+ expect(settleResult('over', null, 1.5)).toBeNull();
+ expect(settleResult('over', 2, undefined)).toBeNull();
+ });
+ test('gradeBucket tiers: A+ stands alone, letters collapse', () => {
+ expect(gradeBucket('A+')).toBe('A+');
+ expect(gradeBucket('A-')).toBe('A');
+ expect(gradeBucket('B+')).toBe('B');
+ expect(gradeBucket('C')).toBe('C');
+ expect(gradeBucket('')).toBeNull();
+ });
+ test('statValue maps VYNDR stat_type → game-log field', () => {
+ expect(statValue({ totalBases: 3 }, 'total_bases')).toBe(3);
+ expect(statValue({ homeRuns: 1 }, 'home_runs')).toBe(1);
+ expect(statValue({ strikeOuts: 7 }, 'strikeouts')).toBe(7);
+ expect(statValue({ hits: 2 }, 'unknown_stat')).toBeNull();
+ });
+ test('dateStrings yields both UTC and ET calendar dates', () => {
+ const ds = dateStrings(ISO);
+ expect(ds).toContain('2026-07-10'); // UTC
+ expect(ds).toContain('2026-07-09'); // ET (10pm prior day)
+ });
+});
+
+describe('outcomeService — settleSnapshot', () => {
+ const judgeStats = async (name) => {
+ if (name === 'Aaron Judge') return { found: true, last10: log('2026-07-09', { hits: 2, totalBases: 4 }) };
+ return { found: false };
+ };
+
+ test('settles a hit against the real game log', async () => {
+ const cache = memCache({ 'snapshot:mlb:latest': snapshot([grade({ stat: 'hits', line: 1.5, side: 'over', grade: 'A' })]) });
+ const res = await svc.settleSnapshot('mlb', { ...cache, getPlayerStats: judgeStats, now: () => '2026-07-10T15:00:00Z' });
+ expect(res.settled).toBe(1);
+ expect(res.log[0]).toMatchObject({ result: 'hit', actual: 2, grade: 'A', side: 'O' });
+ expect(cache.store['accuracy:mlb'].byGrade['A'].hits).toBe(1);
+ expect(cache.store['accuracy:mlb'].overall.pct).toBe(100);
+ });
+
+ test('settles a miss (under, actual above line)', async () => {
+ const cache = memCache({ 'snapshot:mlb:latest': snapshot([grade({ stat: 'hits', line: 1.5, side: 'under', grade: 'B+' })]) });
+ const res = await svc.settleSnapshot('mlb', { ...cache, getPlayerStats: judgeStats, now: () => '2026-07-10T15:00:00Z' });
+ expect(res.log[0].result).toBe('miss');
+ expect(cache.store['accuracy:mlb'].byGrade['B'].misses).toBe(1);
+ });
+
+ test('is idempotent — a second run does not double-count', async () => {
+ const cache = memCache({ 'snapshot:mlb:latest': snapshot([grade({ grade: 'A' })]) });
+ const deps = { ...cache, getPlayerStats: judgeStats, now: () => '2026-07-10T15:00:00Z' };
+ await svc.settleSnapshot('mlb', deps);
+ const res2 = await svc.settleSnapshot('mlb', deps);
+ expect(res2.settled).toBe(0);
+ expect(res2.log.length).toBe(1);
+ expect(cache.store['accuracy:mlb'].overall.total).toBe(1);
+ });
+
+ test('a prop with no matching game stays pending', async () => {
+ const noGame = async () => ({ found: true, last10: log('2026-01-01', { hits: 0 }) });
+ const cache = memCache({ 'snapshot:mlb:latest': snapshot([grade()]) });
+ const res = await svc.settleSnapshot('mlb', { ...cache, getPlayerStats: noGame, now: () => '2026-07-10T15:00:00Z' });
+ expect(res.settled).toBe(0);
+ expect(res.pending).toBe(1);
+ });
+
+ test('offline stats (found:false) → pending, never throws', async () => {
+ const cache = memCache({ 'snapshot:nba:latest': snapshot([grade()]) });
+ const res = await svc.settleSnapshot('nba', { ...cache, getPlayerStats: async () => ({ found: false }), now: () => '2026-07-10T15:00:00Z' });
+ expect(res.settled).toBe(0);
+ expect(res.pending).toBe(1);
+ });
+});
+
+describe('outcomeService — accuracy aggregation', () => {
+ test('pct excludes pushes and gates on the 30-day window', () => {
+ const nowIso = '2026-07-10T00:00:00Z';
+ const mk = (grade, result, date) => ({ grade, result, date, player: 'X', stat: 'hits', line: 1.5, side: 'O' });
+ const logRows = [
+ mk('A', 'hit', '2026-07-09'),
+ mk('A', 'hit', '2026-07-08'),
+ mk('A', 'miss', '2026-07-07'),
+ mk('A', 'push', '2026-07-06'),
+ mk('A', 'hit', '2026-01-01'), // outside 30d — excluded
+ ];
+ const acc = svc.computeAccuracy('mlb', logRows, nowIso);
+ expect(acc.byGrade['A'].hits).toBe(2);
+ expect(acc.byGrade['A'].misses).toBe(1);
+ expect(acc.byGrade['A'].pushes).toBe(1);
+ expect(acc.byGrade['A'].pct).toBe(67); // 2/(2+1) rounded
+ expect(acc.sample).toBe(4); // 4 in-window, push counts toward sample
+ });
+
+ test('accuracyBuckets flattens only non-empty tiers', () => {
+ const acc = svc.computeAccuracy('mlb', [
+ { grade: 'A', result: 'hit', date: '2026-07-09' },
+ { grade: 'B', result: 'miss', date: '2026-07-09' },
+ ], '2026-07-10T00:00:00Z');
+ const buckets = svc.accuracyBuckets(acc);
+ expect(buckets.map((b) => b.grade).sort()).toEqual(['A', 'B']);
+ });
+
+ test('getAccuracy is cold-cache safe', async () => {
+ const cache = memCache();
+ const out = await svc.getAccuracy(cache);
+ expect(out.overall.overall.total).toBe(0);
+ expect(out.sports).toEqual({});
+ });
+
+ test('recomputeOverall merges every sport log', async () => {
+ const cache = memCache({
+ 'outcomes:mlb:log': [{ grade: 'A', result: 'hit', date: '2026-07-09' }],
+ 'outcomes:nba:log': [{ grade: 'A', result: 'miss', date: '2026-07-09' }],
+ });
+ const acc = await svc.recomputeOverall({ ...cache, now: () => '2026-07-10T00:00:00Z' });
+ expect(acc.overall.total).toBe(2);
+ expect(acc.overall.pct).toBe(50);
+ expect(cache.store['accuracy:overall']).toBeTruthy();
+ });
+});
diff --git a/tests/unit/slateAdapterStrips.test.js b/tests/unit/slateAdapterStrips.test.js
index 6766836..b03130e 100644
--- a/tests/unit/slateAdapterStrips.test.js
+++ b/tests/unit/slateAdapterStrips.test.js
@@ -33,6 +33,30 @@ describe('groupPropsByPlayer', () => {
});
});
+describe('buildPlayerStripsFromProps — settled outcome passthrough (Session 55)', () => {
+ it('attaches the settled outcome from the snapshot grade onto the prop', () => {
+ const props = [{ player: 'Aaron Judge', stat_type: 'hits', line: 1.5 }];
+ const gradeIndex = adapter.indexGrades([
+ { player: 'Aaron Judge', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'A',
+ gradedAt: { line: 1.5, timestamp: '2026-07-10T02:00:00Z' },
+ outcome: { result: 'hit', actual: 2 } },
+ ]);
+ const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {});
+ expect(strips[0].props[0].outcome).toEqual({ result: 'hit', actual: 2 });
+ expect(strips[0].props[0].grade).toBe('A');
+ });
+
+ it('leaves outcome null when the grade has not settled', () => {
+ const props = [{ player: 'Aaron Judge', stat_type: 'hits', line: 1.5 }];
+ const gradeIndex = adapter.indexGrades([
+ { player: 'Aaron Judge', stat_type: 'hits', line: 1.5, direction: 'over', grade: 'A',
+ gradedAt: { line: 1.5, timestamp: '2026-07-10T02:00:00Z' } },
+ ]);
+ const strips = adapter.buildPlayerStripsFromProps(props, gradeIndex, {});
+ expect(strips[0].props[0].outcome).toBeNull();
+ });
+});
+
describe('mapPitchers', () => {
it('maps MLB probable pitchers to the GameCard shape', () => {
const p = adapter.mapPitchers({
diff --git a/web/public/sw.js b/web/public/sw.js
index 7423ffa..9c99d17 100644
--- a/web/public/sw.js
+++ b/web/public/sw.js
@@ -1,2 +1,2 @@
(()=>{"use strict";let e,t,a,s,r,i={googleAnalytics:"googleAnalytics",precache:"precache-v2",prefix:"serwist",runtime:"runtime",suffix:"u">typeof registration?registration.scope:""},n=e=>[i.prefix,e,i.suffix].filter(e=>e&&e.length>0).join("-"),c=e=>e||n(i.precache),o=e=>e||n(i.runtime);var l=class extends Error{details;constructor(e,t){super(((e,...t)=>{let a=e;return t.length>0&&(a+=` :: ${JSON.stringify(t)}`),a})(e,t)),this.name=e,this.details=t}};function h(e){return new Promise(t=>setTimeout(t,e))}let u=new Set;function d(e,t){let a=new URL(e);for(let e of t)a.searchParams.delete(e);return a.href}async function f(e,t,a,s){let r=d(t.url,a);if(t.url===r)return e.match(t,s);let i={...s,ignoreSearch:!0};for(let n of(await e.keys(t,i)))if(r===d(n.url,a))return e.match(n,s)}var p=class{promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}};let m=async()=>{for(let e of u)await e()},w="-precache-",g=async(e,t=w)=>{let a=(await self.caches.keys()).filter(a=>a.includes(t)&&a.includes(self.registration.scope)&&a!==e);return await Promise.all(a.map(e=>self.caches.delete(e))),a},y=(e,t)=>{let a=t();return e.waitUntil(a),a},_=(e,t)=>t.some(t=>e instanceof t),b=new WeakMap,v=new WeakMap,R=new WeakMap,E={get(e,t,a){if(e instanceof IDBTransaction){if("done"===t)return b.get(e);if("store"===t)return a.objectStoreNames[1]?void 0:a.objectStore(a.objectStoreNames[0])}return q(e[t])},set:(e,t,a)=>(e[t]=a,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function q(e){if(e instanceof IDBRequest){let t;return t=new Promise((t,a)=>{let s=()=>{e.removeEventListener("success",r),e.removeEventListener("error",i)},r=()=>{t(q(e.result)),s()},i=()=>{a(e.error),s()};e.addEventListener("success",r),e.addEventListener("error",i)}),R.set(t,e),t}if(v.has(e))return v.get(e);let t=function(e){if("function"==typeof e)return(r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(x(this),t),q(this.request)}:function(...t){return q(e.apply(x(this),t))};return(e instanceof IDBTransaction&&function(e){if(b.has(e))return;let t=new Promise((t,a)=>{let s=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",i),e.removeEventListener("abort",i)},r=()=>{t(),s()},i=()=>{a(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",r),e.addEventListener("error",i),e.addEventListener("abort",i)});b.set(e,t)}(e),_(e,s||(s=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,E):e}(e);return t!==e&&(v.set(e,t),R.set(t,e)),t}let x=e=>R.get(e);function D(e,t,{blocked:a,upgrade:s,blocking:r,terminated:i}={}){let n=indexedDB.open(e,t),c=q(n);return s&&n.addEventListener("upgradeneeded",e=>{s(q(n.result),e.oldVersion,e.newVersion,q(n.transaction),e)}),a&&n.addEventListener("blocked",e=>a(e.oldVersion,e.newVersion,e)),c.then(e=>{i&&e.addEventListener("close",()=>i()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),c}let S=["get","getKey","getAll","getAllKeys","count"],k=["put","add","delete","clear"],T=new Map;function P(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(T.get(t))return T.get(t);let a=t.replace(/FromIndex$/,""),s=t!==a,r=k.includes(a);if(!(a in(s?IDBIndex:IDBObjectStore).prototype)||!(r||S.includes(a)))return;let i=async function(e,...t){let i=this.transaction(e,r?"readwrite":"readonly"),n=i.store;return s&&(n=n.index(t.shift())),(await Promise.all([n[a](...t),r&&i.done]))[0]};return T.set(t,i),i}E={...e=E,get:(t,a,s)=>P(t,a)||e.get(t,a,s),has:(t,a)=>!!P(t,a)||e.has(t,a)};let C=["continue","continuePrimaryKey","advance"],N={},I=new WeakMap,U=new WeakMap,L={get(e,t){if(!C.includes(t))return e[t];let a=N[t];return a||(a=N[t]=function(...e){I.set(this,U.get(this)[t](...e))}),a}};async function*A(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let a=new Proxy(t,L);for(U.set(a,t),R.set(a,x(t));t;)yield a,t=await (I.get(a)||t.continue()),I.delete(a)}function O(e,t){return t===Symbol.asyncIterator&&_(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&_(e,[IDBIndex,IDBObjectStore])}E={...t=E,get:(e,a,s)=>O(e,a)?A:t.get(e,a,s),has:(e,a)=>O(e,a)||t.has(e,a)};let M=async(e,t)=>{let s=null;if(e.url&&(s=new URL(e.url).origin),s!==self.location.origin)throw new l("cross-origin-copy-response",{origin:s});let r=e.clone(),i={headers:new Headers(r.headers),status:r.status,statusText:r.statusText},n=t?t(i):i,c=!function(){if(void 0===a){let e=new Response("");if("body"in e)try{new Response(e.body),a=!0}catch{a=!1}a=!1}return a}()?await r.blob():r.body;return new Response(c,n)},B="requests",K="queueName";var F=class{_db=null;async addEntry(e){let t=(await this.getDb()).transaction(B,"readwrite",{durability:"relaxed"});await t.store.add(e),await t.done}async getFirstEntryId(){return(await (await this.getDb()).transaction(B).store.openCursor())?.value.id}async getAllEntriesByQueueName(e){return await (await this.getDb()).getAllFromIndex(B,K,IDBKeyRange.only(e))||[]}async getEntryCountByQueueName(e){return(await this.getDb()).countFromIndex(B,K,IDBKeyRange.only(e))}async deleteEntry(e){await (await this.getDb()).delete(B,e)}async getFirstEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"next")}async getLastEntryByQueueName(e){return await this.getEndEntryFromIndex(IDBKeyRange.only(e),"prev")}async getEndEntryFromIndex(e,t){return(await (await this.getDb()).transaction(B).store.index(K).openCursor(e,t))?.value}async getDb(){return this._db||(this._db=await D("serwist-background-sync",3,{upgrade:this._upgradeDb})),this._db}_upgradeDb(e,t){t>0&&t<3&&e.objectStoreNames.contains(B)&&e.deleteObjectStore(B),e.createObjectStore(B,{autoIncrement:!0,keyPath:"id"}).createIndex(K,K,{unique:!1})}},W=class{_queueName;_queueDb;constructor(e){this._queueName=e,this._queueDb=new F}async pushEntry(e){delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async unshiftEntry(e){let t=await this._queueDb.getFirstEntryId();t?e.id=t-1:delete e.id,e.queueName=this._queueName,await this._queueDb.addEntry(e)}async popEntry(){return this._removeEntry(await this._queueDb.getLastEntryByQueueName(this._queueName))}async shiftEntry(){return this._removeEntry(await this._queueDb.getFirstEntryByQueueName(this._queueName))}async getAll(){return await this._queueDb.getAllEntriesByQueueName(this._queueName)}async size(){return await this._queueDb.getEntryCountByQueueName(this._queueName)}async deleteEntry(e){await this._queueDb.deleteEntry(e)}async _removeEntry(e){return e&&await this.deleteEntry(e.id),e}};let j=["method","referrer","referrerPolicy","mode","credentials","cache","redirect","integrity","keepalive"];var H=class e{_requestData;static async fromRequest(t){let a={url:t.url,headers:{}};for(let e of("GET"!==t.method&&(a.body=await t.clone().arrayBuffer()),t.headers.forEach((e,t)=>{a.headers[t]=e}),j))void 0!==t[e]&&(a[e]=t[e]);return new e(a)}constructor(e){"navigate"===e.mode&&(e.mode="same-origin"),this._requestData=e}toObject(){let e=Object.assign({},this._requestData);return e.headers=Object.assign({},this._requestData.headers),e.body&&(e.body=e.body.slice(0)),e}toRequest(){return new Request(this._requestData.url,this._requestData)}clone(){return new e(this.toObject())}};let $="serwist-background-sync",V=new Set,Q=e=>{let t={request:new H(e.requestData).toRequest(),timestamp:e.timestamp};return e.metadata&&(t.metadata=e.metadata),t};var G=class{_name;_onSync;_maxRetentionTime;_queueStore;_forceSyncFallback;_syncInProgress=!1;_requestsAddedDuringSync=!1;constructor(e,{forceSyncFallback:t,onSync:a,maxRetentionTime:s}={}){if(V.has(e))throw new l("duplicate-queue-name",{name:e});V.add(e),this._name=e,this._onSync=a||this.replayRequests,this._maxRetentionTime=s||10080,this._forceSyncFallback=!!t,this._queueStore=new W(this._name),this._addSyncListener()}get name(){return this._name}async pushRequest(e){await this._addRequest(e,"push")}async unshiftRequest(e){await this._addRequest(e,"unshift")}async popRequest(){return this._removeRequest("pop")}async shiftRequest(){return this._removeRequest("shift")}async getAll(){let e=await this._queueStore.getAll(),t=Date.now(),a=[];for(let s of e){let e=60*this._maxRetentionTime*1e3;t-s.timestamp>e?await this._queueStore.deleteEntry(s.id):a.push(Q(s))}return a}async size(){return await this._queueStore.size()}async _addRequest({request:e,metadata:t,timestamp:a=Date.now()},s){let r={requestData:(await H.fromRequest(e.clone())).toObject(),timestamp:a};switch(t&&(r.metadata=t),s){case"push":await this._queueStore.pushEntry(r);break;case"unshift":await this._queueStore.unshiftEntry(r)}this._syncInProgress?this._requestsAddedDuringSync=!0:await this.registerSync()}async _removeRequest(e){let t,a=Date.now();switch(e){case"pop":t=await this._queueStore.popEntry();break;case"shift":t=await this._queueStore.shiftEntry()}if(t){let s=60*this._maxRetentionTime*1e3;return a-t.timestamp>s?this._removeRequest(e):Q(t)}}async replayRequests(){let e;for(;e=await this.shiftRequest();)try{await fetch(e.request.clone())}catch{throw await this.unshiftRequest(e),new l("queue-replay-failed",{name:this._name})}}async registerSync(){if("sync"in self.registration&&!this._forceSyncFallback)try{await self.registration.sync.register(`${$}:${this._name}`)}catch(e){}}_addSyncListener(){"sync"in self.registration&&!this._forceSyncFallback?self.addEventListener("sync",e=>{if(e.tag===`${$}:${this._name}`){let t=async()=>{let t;this._syncInProgress=!0;try{await this._onSync({queue:this})}catch(e){if(e instanceof Error)throw e}finally{this._requestsAddedDuringSync&&!(t&&!e.lastChance)&&await this.registerSync(),this._syncInProgress=!1,this._requestsAddedDuringSync=!1}};e.waitUntil(t())}}):this._onSync({queue:this})}static get _queueNames(){return V}},z=class{_queue;constructor(e,t){this._queue=new G(e,t)}async fetchDidFail({request:e}){await this._queue.pushRequest({request:e})}};let Y={cacheWillUpdate:async({response:e})=>200===e.status||0===e.status?e:null};function J(e){return"string"==typeof e?new Request(e):e}var X=class{event;request;url;params;_cacheKeys={};_strategy;_handlerDeferred;_extendLifetimePromises;_plugins;_pluginStateMap;constructor(e,t){for(const a of(this.event=t.event,this.request=t.request,t.url&&(this.url=t.url,this.params=t.params),this._strategy=e,this._handlerDeferred=new p,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map,this._plugins))this._pluginStateMap.set(a,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,a=J(e),s=await this.getPreloadResponse();if(s)return s;let r=this.hasCallback("fetchDidFail")?a.clone():null;try{for(let e of this.iterateCallbacks("requestWillFetch"))a=await e({request:a.clone(),event:t})}catch(e){if(e instanceof Error)throw new l("plugin-error-request-will-fetch",{thrownErrorMessage:e.message})}let i=a.clone();try{let e;for(let s of(e=await fetch(a,"navigate"===a.mode?void 0:this._strategy.fetchOptions),this.iterateCallbacks("fetchDidSucceed")))e=await s({event:t,request:i,response:e});return e}catch(e){throw r&&await this.runCallbacks("fetchDidFail",{error:e,event:t,originalRequest:r.clone(),request:i.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),a=t.clone();return this.waitUntil(this.cachePut(e,a)),t}async cacheMatch(e){let t,a=J(e),{cacheName:s,matchOptions:r}=this._strategy,i=await this.getCacheKey(a,"read"),n={...r,cacheName:s};for(let e of(t=await caches.match(i,n),this.iterateCallbacks("cachedResponseWillBeUsed")))t=await e({cacheName:s,matchOptions:r,cachedResponse:t,request:i,event:this.event})||void 0;return t}async cachePut(e,t){let a=J(e);await h(0);let s=await this.getCacheKey(a,"write");if(!t)throw new l("cache-put-with-no-response",{url:new URL(String(s.url),location.href).href.replace(RegExp(`^${location.origin}`),"")});let r=await this._ensureResponseSafeToCache(t);if(!r)return!1;let{cacheName:i,matchOptions:n}=this._strategy,c=await self.caches.open(i),o=this.hasCallback("cacheDidUpdate"),u=o?await f(c,s.clone(),["__WB_REVISION__"],n):null;try{await c.put(s,o?r.clone():r)}catch(e){if(e instanceof Error)throw"QuotaExceededError"===e.name&&await m(),e}for(let e of this.iterateCallbacks("cacheDidUpdate"))await e({cacheName:i,oldResponse:u,newResponse:r.clone(),request:s,event:this.event});return!0}async getCacheKey(e,t){let a=`${e.url} | ${t}`;if(!this._cacheKeys[a]){let s=e;for(let e of this.iterateCallbacks("cacheKeyWillBeUsed"))s=J(await e({mode:t,request:s,event:this.event,params:this.params}));this._cacheKeys[a]=s}return this._cacheKeys[a]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let a of this.iterateCallbacks(e))await a(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if("function"==typeof t[e]){let a=this._pluginStateMap.get(t),s=s=>{let r={...s,state:a};return t[e](r)};yield s}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){let e;for(;e=this._extendLifetimePromises.shift();)await e}destroy(){this._handlerDeferred.resolve(null)}async getPreloadResponse(){if(this.event instanceof FetchEvent&&"navigate"===this.event.request.mode&&"preloadResponse"in this.event)try{let e=await this.event.preloadResponse;if(e)return e}catch(e){return}}async _ensureResponseSafeToCache(e){let t=e,a=!1;for(let e of this.iterateCallbacks("cacheWillUpdate"))if(t=await e({request:this.request,response:t,event:this.event})||void 0,a=!0,!t)break;return!a&&t&&200!==t.status&&(t=void 0),t}},Z=class{cacheName;plugins;fetchOptions;matchOptions;constructor(e={}){this.cacheName=o(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,a="string"==typeof e.request?new Request(e.request):e.request,s=new X(this,e.url?{event:t,request:a,url:e.url,params:e.params}:{event:t,request:a}),r=this._getResponse(s,a,t);return[r,this._awaitComplete(r,s,a,t)]}async _getResponse(e,t,a){let s;await e.runCallbacks("handlerWillStart",{event:a,request:t});try{if(s=await this._handle(t,e),void 0===s||"error"===s.type)throw new l("no-response",{url:t.url})}catch(r){if(r instanceof Error){for(let i of e.iterateCallbacks("handlerDidError"))if(void 0!==(s=await i({error:r,event:a,request:t})))break}if(!s)throw r}for(let r of e.iterateCallbacks("handlerWillRespond"))s=await r({event:a,request:t,response:s});return s}async _awaitComplete(e,t,a,s){let r,i;try{r=await e}catch{}try{await t.runCallbacks("handlerDidRespond",{event:s,request:a,response:r}),await t.doneWaiting()}catch(e){e instanceof Error&&(i=e)}if(await t.runCallbacks("handlerDidComplete",{event:s,request:a,response:r,error:i}),t.destroy(),i)throw i}},ee=class extends Z{_networkTimeoutSeconds;constructor(e={}){super(e),this.plugins.some(e=>"cacheWillUpdate"in e)||this.plugins.unshift(Y),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let a,s=[],r=[];if(this._networkTimeoutSeconds){let{id:i,promise:n}=this._getTimeoutPromise({request:e,logs:s,handler:t});a=i,r.push(n)}let i=this._getNetworkPromise({timeoutId:a,request:e,logs:s,handler:t});r.push(i);let n=await t.waitUntil((async()=>await t.waitUntil(Promise.race(r))||await i)());if(!n)throw new l("no-response",{url:e.url});return n}_getTimeoutPromise({request:e,logs:t,handler:a}){let s;return{promise:new Promise(t=>{s=setTimeout(async()=>{t(await a.cacheMatch(e))},1e3*this._networkTimeoutSeconds)}),id:s}}async _getNetworkPromise({timeoutId:e,request:t,logs:a,handler:s}){let r,i;try{i=await s.fetchAndCachePut(t)}catch(e){e instanceof Error&&(r=e)}return e&&clearTimeout(e),(r||!i)&&(i=await s.cacheMatch(t)),i}},et=class extends Z{_networkTimeoutSeconds;constructor(e={}){super(e),this._networkTimeoutSeconds=e.networkTimeoutSeconds||0}async _handle(e,t){let a,s;try{let a=[t.fetch(e)];if(this._networkTimeoutSeconds){let e=h(1e3*this._networkTimeoutSeconds);a.push(e)}if(!(s=await Promise.race(a)))throw Error(`Timed out the network response after ${this._networkTimeoutSeconds} seconds.`)}catch(e){e instanceof Error&&(a=e)}if(!s)throw new l("no-response",{url:e.url,error:a});return s}};let ea=e=>e&&"object"==typeof e?e:{handle:e};var es=class{handler;match;method;catchHandler;constructor(e,t,a="GET"){this.handler=ea(t),this.match=e,this.method=a}setCatchHandler(e){this.catchHandler=ea(e)}},er=class e extends Z{_fallbackToNetwork;static defaultPrecacheCacheabilityPlugin={cacheWillUpdate:async({response:e})=>!e||e.status>=400?null:e};static copyRedirectedCacheableResponsesPlugin={cacheWillUpdate:async({response:e})=>e.redirected?await M(e):e};constructor(t={}){t.cacheName=c(t.cacheName),super(t),this._fallbackToNetwork=!1!==t.fallbackToNetwork,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){let a=await t.getPreloadResponse();if(a)return a;let s=await t.cacheMatch(e);return s||(t.event&&"install"===t.event.type?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let a,s=t.params||{};if(this._fallbackToNetwork){let r=s.integrity,i=e.integrity,n=!i||i===r;a=await t.fetch(new Request(e,{integrity:"no-cors"!==e.mode?i||r:void 0})),r&&n&&"no-cors"!==e.mode&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,a.clone()))}else throw new l("missing-precache-entry",{cacheName:this.cacheName,url:e.url});return a}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();let a=await t.fetch(e);if(!await t.cachePut(e,a.clone()))throw new l("bad-precaching-response",{url:e.url,status:a.status});return a}_useDefaultCacheabilityPluginIfNeeded(){let t=null,a=0;for(let[s,r]of this.plugins.entries())r!==e.copyRedirectedCacheableResponsesPlugin&&(r===e.defaultPrecacheCacheabilityPlugin&&(t=s),r.cacheWillUpdate&&a++);0===a?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):a>1&&null!==t&&this.plugins.splice(t,1)}},ei=class extends es{_allowlist;_denylist;constructor(e,{allowlist:t=[/./],denylist:a=[]}={}){super(e=>this._match(e),e),this._allowlist=t,this._denylist=a}_match({url:e,request:t}){if(t&&"navigate"!==t.mode)return!1;let a=e.pathname+e.search;for(let e of this._denylist)if(e.test(a))return!1;return!!this._allowlist.some(e=>e.test(a))}},en=class extends es{constructor(e,t,a){super(({url:t})=>{let a=e.exec(t.href);if(a)return t.origin!==location.origin&&0!==a.index?void 0:a.slice(1)},t,a)}};let ec=e=>{if(!e)throw new l("add-to-cache-list-unexpected-type",{entry:e});if("string"==typeof e){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:t,url:a}=e;if(!a)throw new l("add-to-cache-list-unexpected-type",{entry:e});if(!t){let e=new URL(a,location.href);return{cacheKey:e.href,url:e.href}}let s=new URL(a,location.href),r=new URL(a,location.href);return s.searchParams.set("__WB_REVISION__",t),{cacheKey:s.href,url:r.href}};var eo=class{updatedURLs=[];notUpdatedURLs=[];handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)};cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:a})=>{if("install"===e.type&&t?.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;a?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return a}};let el=async(e,t,a)=>{let s=t.map((e,t)=>({index:t,item:e})),r=async e=>{let t=[];for(;;){let r=s.pop();if(!r)return e(t);let i=await a(r.item);t.push({result:i,index:r.index})}},i=Array.from({length:e},()=>new Promise(r));return(await Promise.all(i)).flat().sort((e,t)=>e.indexe.result)};"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let eh="cache-entries",eu=e=>{let t=new URL(e,location.href);return t.hash="",t.href};var ed=class{_cacheName;_db=null;constructor(e){this._cacheName=e}_getId(e){return`${this._cacheName}|${eu(e)}`}_upgradeDb(e){let t=e.createObjectStore(eh,{keyPath:"id"});t.createIndex("cacheName","cacheName",{unique:!1}),t.createIndex("timestamp","timestamp",{unique:!1})}_upgradeDbAndDeleteOldDbs(e){this._upgradeDb(e),this._cacheName&&function(e,{blocked:t}={}){let a=indexedDB.deleteDatabase(e);t&&a.addEventListener("blocked",e=>t(e.oldVersion,e)),q(a).then(()=>void 0)}(this._cacheName)}async setTimestamp(e,t){e=eu(e);let a={id:this._getId(e),cacheName:this._cacheName,url:e,timestamp:t},s=(await this.getDb()).transaction(eh,"readwrite",{durability:"relaxed"});await s.store.put(a),await s.done}async getTimestamp(e){return(await (await this.getDb()).get(eh,this._getId(e)))?.timestamp}async expireEntries(e,t){let a=await (await this.getDb()).transaction(eh,"readwrite").store.index("timestamp").openCursor(null,"prev"),s=[],r=0;for(;a;){let i=a.value;i.cacheName===this._cacheName&&(e&&i.timestamp=t?(a.delete(),s.push(i.url)):r++),a=await a.continue()}return s}async getDb(){return this._db||(this._db=await D("serwist-expiration",1,{upgrade:this._upgradeDbAndDeleteOldDbs.bind(this)})),this._db}},ef=class{_isRunning=!1;_rerunRequested=!1;_maxEntries;_maxAgeSeconds;_matchOptions;_cacheName;_timestampModel;constructor(e,t={}){this._maxEntries=t.maxEntries,this._maxAgeSeconds=t.maxAgeSeconds,this._matchOptions=t.matchOptions,this._cacheName=e,this._timestampModel=new ed(e)}async expireEntries(){if(this._isRunning){this._rerunRequested=!0;return}this._isRunning=!0;let e=this._maxAgeSeconds?Date.now()-1e3*this._maxAgeSeconds:0,t=await this._timestampModel.expireEntries(e,this._maxEntries),a=await self.caches.open(this._cacheName);for(let e of t)await a.delete(e,this._matchOptions);this._isRunning=!1,this._rerunRequested&&(this._rerunRequested=!1,this.expireEntries())}async updateTimestamp(e){await this._timestampModel.setTimestamp(e,Date.now())}async isURLExpired(e){if(!this._maxAgeSeconds)return!1;let t=await this._timestampModel.getTimestamp(e),a=Date.now()-1e3*this._maxAgeSeconds;return void 0===t||t{u.add(e)})(()=>this.deleteCacheAndMetadata())}_getCacheExpiration(e){if(e===o())throw new l("expire-custom-caches-only");let t=this._cacheExpirations.get(e);return t||(t=new ef(e,this._config),this._cacheExpirations.set(e,t)),t}cachedResponseWillBeUsed({event:e,cacheName:t,request:a,cachedResponse:s}){if(!s)return null;let r=this._isResponseDateFresh(s),i=this._getCacheExpiration(t),n="last-used"===this._config.maxAgeFrom,c=(async()=>{n&&await i.updateTimestamp(a.url),await i.expireEntries()})();try{e.waitUntil(c)}catch{}return r?s:null}_isResponseDateFresh(e){if("last-used"===this._config.maxAgeFrom)return!0;let t=Date.now();if(!this._config.maxAgeSeconds)return!0;let a=this._getDateHeaderTimestamp(e);return null===a||a>=t-1e3*this._config.maxAgeSeconds}_getDateHeaderTimestamp(e){if(!e.headers.has("date"))return null;let t=new Date(e.headers.get("date")).getTime();return Number.isNaN(t)?null:t}async cacheDidUpdate({cacheName:e,request:t}){let a=this._getCacheExpiration(e);await a.updateTimestamp(t.url),await a.expireEntries()}async deleteCacheAndMetadata(){for(let[e,t]of this._cacheExpirations)await self.caches.delete(e),await t.delete();this._cacheExpirations=new Map}};let em=/^\/(\w+\/)?collect/,ew=({serwist:e,cacheName:t,...a})=>{let s,r,c=t||n(i.googleAnalytics),o=new z("serwist-google-analytics",{maxRetentionTime:2880,onSync:async({queue:e})=>{let t;for(;t=await e.shiftRequest();){let{request:s,timestamp:r}=t,i=new URL(s.url);try{let e="POST"===s.method?new URLSearchParams(await s.clone().text()):i.searchParams,t=r-(Number(e.get("qt"))||0),n=Date.now()-t;if(e.set("qt",String(n)),a.parameterOverrides)for(let t of Object.keys(a.parameterOverrides)){let s=a.parameterOverrides[t];e.set(t,s)}"function"==typeof a.hitFilter&&a.hitFilter.call(null,e),await fetch(new Request(i.origin+i.pathname,{body:e.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(a){throw await e.unshiftRequest(t),a}}}});for(let t of[new es(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtm.js"===e.pathname,new ee({cacheName:c}),"GET"),new es(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,new ee({cacheName:c}),"GET"),new es(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,new ee({cacheName:c}),"GET"),new es(s=({url:e})=>"www.google-analytics.com"===e.hostname&&em.test(e.pathname),r=new et({plugins:[o]}),"GET"),new es(s,r,"POST")])e.registerRoute(t)};var eg=class{_fallbackUrls;_serwist;constructor({fallbackUrls:e,serwist:t}){this._fallbackUrls=e,this._serwist=t}async handlerDidError(e){for(let t of this._fallbackUrls)if("string"==typeof t){let e=await this._serwist.matchPrecache(t);if(void 0!==e)return e}else if(t.matcher(e)){let e=await this._serwist.matchPrecache(t.url);if(void 0!==e)return e}}},ey=class extends Z{async _handle(e,t){let a,s=await t.cacheMatch(e);if(s);else try{s=await t.fetchAndCachePut(e)}catch(e){e instanceof Error&&(a=e)}if(!s)throw new l("no-response",{url:e.url,error:a});return s}},e_=class extends es{constructor(e,t){super(({request:a})=>{let s=e.getUrlsToPrecacheKeys();for(let r of function*(e,{directoryIndex:t="index.html",ignoreURLParametersMatching:a=[/^utm_/,/^fbclid$/],cleanURLs:s=!0,urlManipulation:r}={}){let i=new URL(e,location.href);i.hash="",yield i.href;let n=((e,t=[])=>{for(let a of[...e.searchParams.keys()])t.some(e=>e.test(a))&&e.searchParams.delete(a);return e})(i,a);if(yield n.href,t&&n.pathname.endsWith("/")){let e=new URL(n.href);e.pathname+=t,yield e.href}if(s){let e=new URL(n.href);e.pathname+=".html",yield e.href}if(r)for(let e of r({url:i}))yield e.href}(a.url,t)){let t=s.get(r);if(t)return{cacheKey:t,integrity:e.getIntegrityForPrecacheKey(t)}}},e.precacheStrategy)}},eb=class{_precacheController;constructor({precacheController:e}){this._precacheController=e}cacheKeyWillBeUsed=async({request:e,params:t})=>{let a=t?.cacheKey||this._precacheController.getPrecacheKeyForUrl(e.url);return a?new Request(a,{headers:e.headers}):e}},ev=class{_urlsToCacheKeys=new Map;_urlsToCacheModes=new Map;_cacheKeysToIntegrities=new Map;_concurrentPrecaching;_precacheStrategy;_routes;_defaultHandlerMap;_catchHandler;_requestRules;constructor({precacheEntries:e,precacheOptions:t,skipWaiting:a=!1,importScripts:s,navigationPreload:r=!1,cacheId:n,clientsClaim:o=!1,runtimeCaching:l,offlineAnalyticsConfig:h,disableDevLogs:u=!1,fallbacks:d,requestRules:f}={}){const{precacheStrategyOptions:p,precacheRouteOptions:m,precacheMiscOptions:w}=((e,t={})=>{let{cacheName:a,plugins:s=[],fetchOptions:r,matchOptions:i,fallbackToNetwork:n,directoryIndex:o,ignoreURLParametersMatching:l,cleanURLs:h,urlManipulation:u,cleanupOutdatedCaches:d,concurrency:f=10,navigateFallback:p,navigateFallbackAllowlist:m,navigateFallbackDenylist:w}=t??{};return{precacheStrategyOptions:{cacheName:c(a),plugins:[...s,new eb({precacheController:e})],fetchOptions:r,matchOptions:i,fallbackToNetwork:n},precacheRouteOptions:{directoryIndex:o,ignoreURLParametersMatching:l,cleanURLs:h,urlManipulation:u},precacheMiscOptions:{cleanupOutdatedCaches:d,concurrency:f,navigateFallback:p,navigateFallbackAllowlist:m,navigateFallbackDenylist:w}}})(this,t);if(this._concurrentPrecaching=w.concurrency,this._precacheStrategy=new er(p),this._routes=new Map,this._defaultHandlerMap=new Map,this._requestRules=f,this.handleInstall=this.handleInstall.bind(this),this.handleActivate=this.handleActivate.bind(this),this.handleFetch=this.handleFetch.bind(this),this.handleCache=this.handleCache.bind(this),s&&s.length>0&&self.importScripts(...s),r&&self.registration?.navigationPreload&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{}))}),void 0!==n&&(e=>{var t=e;for(let e of Object.keys(i))(e=>{let a=t[e];"string"==typeof a&&(i[e]=a)})(e)})({prefix:n}),a?self.skipWaiting():self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),o&&self.addEventListener("activate",()=>self.clients.claim()),e&&e.length>0&&this.addToPrecacheList(e),w.cleanupOutdatedCaches&&(e=>{self.addEventListener("activate",t=>{t.waitUntil(g(c(e)).then(e=>{}))})})(p.cacheName),this.registerRoute(new e_(this,m)),w.navigateFallback&&this.registerRoute(new ei(this.createHandlerBoundToUrl(w.navigateFallback),{allowlist:w.navigateFallbackAllowlist,denylist:w.navigateFallbackDenylist})),void 0!==h&&("boolean"==typeof h?h&&ew({serwist:this}):ew({...h,serwist:this})),void 0!==l){if(void 0!==d){const e=new eg({fallbackUrls:d.entries,serwist:this});l.forEach(t=>{t.handler instanceof Z&&!t.handler.plugins.some(e=>"handlerDidError"in e)&&t.handler.plugins.push(e)})}for(const e of l)this.registerCapture(e.matcher,e.handler,e.method)}u&&(self.__WB_DISABLE_DEV_LOGS=!0)}get precacheStrategy(){return this._precacheStrategy}get routes(){return this._routes}addEventListeners(){self.addEventListener("install",this.handleInstall),self.addEventListener("activate",this.handleActivate),self.addEventListener("fetch",this.handleFetch),self.addEventListener("message",this.handleCache)}addToPrecacheList(e){let t=[];for(let a of e){"string"==typeof a?t.push(a):a&&!a.integrity&&void 0===a.revision&&t.push(a.url);let{cacheKey:e,url:s}=ec(a),r="string"!=typeof a&&a.revision?"reload":"default";if(this._urlsToCacheKeys.has(s)&&this._urlsToCacheKeys.get(s)!==e)throw new l("add-to-cache-list-conflicting-entries",{firstEntry:this._urlsToCacheKeys.get(s),secondEntry:e});if("string"!=typeof a&&a.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==a.integrity)throw new l("add-to-cache-list-conflicting-integrities",{url:s});this._cacheKeysToIntegrities.set(e,a.integrity)}this._urlsToCacheKeys.set(s,e),this._urlsToCacheModes.set(s,r)}t.length>0&&console.warn(`Serwist is precaching URLs without revision info: ${t.join(", ")}
-This is generally NOT safe. Learn more at https://bit.ly/wb-precache`)}handleInstall(e){return this.registerRequestRules(e),y(e,async()=>{let t=new eo;this.precacheStrategy.plugins.push(t),await el(this._concurrentPrecaching,Array.from(this._urlsToCacheKeys.entries()),async([t,a])=>{let s=this._cacheKeysToIntegrities.get(a),r=this._urlsToCacheModes.get(t),i=new Request(t,{integrity:s,cache:r,credentials:"same-origin"});await Promise.all(this.precacheStrategy.handleAll({event:e,request:i,url:new URL(i.url),params:{cacheKey:a}}))});let{updatedURLs:a,notUpdatedURLs:s}=t;return{updatedURLs:a,notUpdatedURLs:s}})}async registerRequestRules(e){if(this._requestRules&&e?.addRoutes)try{await e.addRoutes(this._requestRules),this._requestRules=void 0}catch(e){throw e}}handleActivate(e){return y(e,async()=>{let e=await self.caches.open(this.precacheStrategy.cacheName),t=await e.keys(),a=new Set(this._urlsToCacheKeys.values()),s=[];for(let r of t)a.has(r.url)||(await e.delete(r),s.push(r.url));return{deletedCacheRequests:s}})}handleFetch(e){let{request:t}=e,a=this.handleRequest({request:t,event:e});a&&e.respondWith(a)}handleCache(e){if(e.data&&"CACHE_URLS"===e.data.type){let{payload:t}=e.data,a=Promise.all(t.urlsToCache.map(t=>{let a;return a="string"==typeof t?new Request(t):new Request(...t),this.handleRequest({request:a,event:e})}));e.waitUntil(a),e.ports?.[0]&&a.then(()=>e.ports[0].postMessage(!0))}}setDefaultHandler(e,t="GET"){this._defaultHandlerMap.set(t,ea(e))}setCatchHandler(e){this._catchHandler=ea(e)}registerCapture(e,t,a){let s=((e,t,a)=>{if("string"==typeof e){let s=new URL(e,location.href);return new es(({url:e})=>e.href===s.href,t,a)}if(e instanceof RegExp)return new en(e,t,a);if("function"==typeof e)return new es(e,t,a);if(e instanceof es)return e;throw new l("unsupported-route-type",{moduleName:"serwist",funcName:"parseRoute",paramName:"capture"})})(e,t,a);return this.registerRoute(s),s}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}getUrlsToPrecacheKeys(){return this._urlsToCacheKeys}getPrecachedUrls(){return[...this._urlsToCacheKeys.keys()]}getPrecacheKeyForUrl(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForPrecacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,a=this.getPrecacheKeyForUrl(t);if(a)return(await self.caches.open(this.precacheStrategy.cacheName)).match(a)}createHandlerBoundToUrl(e){let t=this.getPrecacheKeyForUrl(e);if(!t)throw new l("non-precached-url",{url:e});return a=>(a.request=new Request(e),a.params={cacheKey:t,...a.params},this.precacheStrategy.handle(a))}handleRequest({request:e,event:t}){let a,s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return;let r=s.origin===location.origin,{params:i,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:s}),c=n?.handler,o=e.method;if(!c&&this._defaultHandlerMap.has(o)&&(c=this._defaultHandlerMap.get(o)),!c)return;try{a=c.handle({url:s,request:e,event:t,params:i})}catch(e){a=Promise.reject(e)}let l=n?.catchHandler;return a instanceof Promise&&(this._catchHandler||l)&&(a=a.catch(async a=>{if(l)try{return await l.handle({url:s,request:e,event:t,params:i})}catch(e){e instanceof Error&&(a=e)}if(this._catchHandler)return this._catchHandler.handle({url:s,request:e,event:t});throw a})),a}findMatchingRoute({url:e,sameOrigin:t,request:a,event:s}){for(let r of this._routes.get(a.method)||[]){let i,n=r.match({url:e,sameOrigin:t,request:a,event:s});if(n)return Array.isArray(i=n)&&0===i.length||n.constructor===Object&&0===Object.keys(n).length?i=void 0:"boolean"==typeof n&&(i=void 0),{route:r,params:i}}return{}}};let eR="/offline",eE=["pages","api-responses","next-static","static-media","fallback","offline-fallback"],eq=[{matcher:({url:e,sameOrigin:t})=>t&&e.pathname.startsWith("/api/"),handler:new ee({cacheName:"api-responses",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:100,maxAgeSeconds:3600})]})},{matcher:({request:e})=>"navigate"===e.mode,handler:new ee({cacheName:"pages",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:50,maxAgeSeconds:86400}),{handlerDidError:async()=>await caches.match(eR)||Response.error()}]})},{matcher:({url:e,sameOrigin:t})=>t&&e.pathname.startsWith("/_next/static/"),handler:new ey({cacheName:"next-static",plugins:[new ep({maxEntries:200,maxAgeSeconds:2592e3})]})},{matcher:({url:e})=>e.pathname.startsWith("/images/")||e.pathname.startsWith("/icons/")||/\.(?:png|jpe?g|gif|svg|webp|ico|woff2?)$/.test(e.pathname),handler:new ey({cacheName:"static-media",plugins:[new ep({maxEntries:100,maxAgeSeconds:2592e3})]})},{matcher:()=>!0,handler:new ee({cacheName:"fallback",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:50,maxAgeSeconds:86400})]})}];new ev({precacheEntries:[{'revision':'0559a485c62fe57db670f1bdcc9b6d2b','url':'/_next/static/IH7hxf6tLKMR7xPHT70BM/_buildManifest.js'},{'revision':'b6652df95db52feb4daf4eca35380933','url':'/_next/static/IH7hxf6tLKMR7xPHT70BM/_ssgManifest.js'},{'revision':null,'url':'/_next/static/chunks/1079-304a546a4a673437.js'},{'revision':null,'url':'/_next/static/chunks/1896-359ed2e68a8c4f1d.js'},{'revision':null,'url':'/_next/static/chunks/1958-56cbbb8dba15fd2f.js'},{'revision':null,'url':'/_next/static/chunks/2346-36e36720a5f6591a.js'},{'revision':null,'url':'/_next/static/chunks/4233-b8966732b4186087.js'},{'revision':null,'url':'/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js'},{'revision':null,'url':'/_next/static/chunks/52774a7f.f2ab7a9b4b8ba576.js'},{'revision':null,'url':'/_next/static/chunks/5562-7d3d2482da79939a.js'},{'revision':null,'url':'/_next/static/chunks/5838-7e0aa455e9f24259.js'},{'revision':null,'url':'/_next/static/chunks/7363-209a1a709d8f324d.js'},{'revision':null,'url':'/_next/static/chunks/7602.2868ff821d53ee09.js'},{'revision':null,'url':'/_next/static/chunks/8078-0cb13480a43e9ef1.js'},{'revision':null,'url':'/_next/static/chunks/8500-f62a38ff68ab7f42.js'},{'revision':null,'url':'/_next/static/chunks/9da6db1e-9623f3245f088d02.js'},{'revision':null,'url':'/_next/static/chunks/app/_global-error/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/_not-found/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/about/page-c4423424333614ed.js'},{'revision':null,'url':'/_next/static/chunks/app/account/page-9300f08c33aa8887.js'},{'revision':null,'url':'/_next/static/chunks/app/admin/page-b3b6af59ae9681bb.js'},{'revision':null,'url':'/_next/static/chunks/app/api/admin/stats/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/books/%5B...path%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/checkout/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/content/%5B...path%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/gamelines/%5Bsport%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/%5Bid%5D/props/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/%5Bid%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/tonight/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/hero-prop/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/hotlist/%5Bsport%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/intelligence/feed/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ledger/accuracy/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ledger/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/lines/%5B...path%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/mlb/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/nba/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/soccer/%5Bleague%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/wnba/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/add-leg/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/calculate/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/grade/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/players/search/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/preferences/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/live/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/most-parlayed/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/top-graded/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/scan/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/schedule/%5Bsport%5D/pitchers/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/schedule/%5Bsport%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/snapshot/%5Bsport%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/cascade/%5Bplayer%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/depth/%5Bteam%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/leaders/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/lineup/%5Bteam%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/parlays-graded/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/player/%5Bname%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/public/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/streaks/%5Bsport%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/team/%5Babbr%5D/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ticker/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/profile/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/recent-scans/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/scans/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/waitlist/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/webhook/nexapay/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/api/welcome-email/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/auth/callback/page-e6df9771a50edb87.js'},{'revision':null,'url':'/_next/static/chunks/app/blog/%5Bslug%5D/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/blog/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/compare/page-5e631b0c698c6f5f.js'},{'revision':null,'url':'/_next/static/chunks/app/dashboard/page-0f800702d00be146.js'},{'revision':null,'url':'/_next/static/chunks/app/explore/page-8856c642532e2773.js'},{'revision':null,'url':'/_next/static/chunks/app/forgot-password/page-a251f52b4206e8d1.js'},{'revision':null,'url':'/_next/static/chunks/app/game/%5Bid%5D/page-3d020b802c020ad8.js'},{'revision':null,'url':'/_next/static/chunks/app/help/page-03c6534f006d09da.js'},{'revision':null,'url':'/_next/static/chunks/app/intelligence/page-772d69c9ecfe1503.js'},{'revision':null,'url':'/_next/static/chunks/app/invite/page-e1e3f46af5f1e44b.js'},{'revision':null,'url':'/_next/static/chunks/app/layout-693c2dd4d6a6fc0e.js'},{'revision':null,'url':'/_next/static/chunks/app/ledger/page-47459e4f664b707a.js'},{'revision':null,'url':'/_next/static/chunks/app/login/page-5ab357bd6974642c.js'},{'revision':null,'url':'/_next/static/chunks/app/marketplace/page-cbada49ae96a7527.js'},{'revision':null,'url':'/_next/static/chunks/app/not-found-108d10a892324183.js'},{'revision':null,'url':'/_next/static/chunks/app/notifications/page-c4423424333614ed.js'},{'revision':null,'url':'/_next/static/chunks/app/offline/page-a7a57ff039afc1af.js'},{'revision':null,'url':'/_next/static/chunks/app/onboarding/page-3483923fb16d41ff.js'},{'revision':null,'url':'/_next/static/chunks/app/opengraph-image/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/page-9cbfc34d94afa4a6.js'},{'revision':null,'url':'/_next/static/chunks/app/player/%5Bname%5D/page-a9a1a22752478255.js'},{'revision':null,'url':'/_next/static/chunks/app/pricing/page-ce5fd8b3a31f76b9.js'},{'revision':null,'url':'/_next/static/chunks/app/privacy/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/profile/page-d607627acb1b73ab.js'},{'revision':null,'url':'/_next/static/chunks/app/report/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/responsible-gambling/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/scan/page-2bf11bac023ab148.js'},{'revision':null,'url':'/_next/static/chunks/app/settings/page-eea60cdbf9380312.js'},{'revision':null,'url':'/_next/static/chunks/app/settings/security/page-697d02aa2d05cf7e.js'},{'revision':null,'url':'/_next/static/chunks/app/signup/page-f429c5ddc836e247.js'},{'revision':null,'url':'/_next/static/chunks/app/soccer/page-5a64e650908111d7.js'},{'revision':null,'url':'/_next/static/chunks/app/team/%5Babbr%5D/page-9ab56fcb07ae8687.js'},{'revision':null,'url':'/_next/static/chunks/app/terminal/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/terms/page-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/tracker/page-e23baec2b3735bb1.js'},{'revision':null,'url':'/_next/static/chunks/app/twitter-image/route-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/cancel/page-3702e818a6853705.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/desk/page-b88c47031c7d7d63.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/success/page-ea358cb8f714f1ea.js'},{'revision':null,'url':'/_next/static/chunks/app/verify/page-9df376f065215168.js'},{'revision':null,'url':'/_next/static/chunks/app/welcome/page-259277230533599f.js'},{'revision':null,'url':'/_next/static/chunks/framework-95da69ac6843d788.js'},{'revision':null,'url':'/_next/static/chunks/main-a354262253293123.js'},{'revision':null,'url':'/_next/static/chunks/main-app-4231d5f500f33972.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/app-error-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/forbidden-6b4a33f27c16e10b.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/global-error-756d787dba63aa4d.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/unauthorized-6b4a33f27c16e10b.js'},{'revision':'846118c33b2c0e922d7b3a7676f81f6f','url':'/_next/static/chunks/polyfills-42372ed130431b0a.js'},{'revision':null,'url':'/_next/static/chunks/webpack-42b9616650231776.js'},{'revision':null,'url':'/_next/static/css/6ee3c69ef5f8952b.css'},{'revision':'cd34c7793d9776838308cfbe5d93922b','url':'/_next/static/media/011e180705008d6f-s.woff2'},{'revision':'324703f03c390d2e2a4f387de85fe63d','url':'/_next/static/media/0aa834ed78bf6d07-s.woff2'},{'revision':'9dda5cfc9a46f256d0e131bb535e46f8','url':'/_next/static/media/19cfc7226ec3afaa-s.woff2'},{'revision':'7de6d31e5076eb437418b6e01998ee12','url':'/_next/static/media/20535187d867b7b9-s.woff2'},{'revision':'4e2553027f1d60eff32898367dd4d541','url':'/_next/static/media/21350d82a1f187e9-s.woff2'},{'revision':'0d11e07b5aaafda6ae2efc53256932ec','url':'/_next/static/media/37786be940ec402b-s.p.woff2'},{'revision':'5de0bff80f9f432b5cf52c1c2f80fe20','url':'/_next/static/media/46e154b2fcbd6033-s.woff2'},{'revision':'6041b3192dc3e1a50141d5d418a24199','url':'/_next/static/media/5356a6a4f2c8c8d8-s.woff2'},{'revision':'f572f7b57d27ec7fd8373961f0b762b0','url':'/_next/static/media/58f386aa6b1a2a92-s.woff2'},{'revision':'e829cbe042e8b2b2e6b99c0eec9e230d','url':'/_next/static/media/656feb427634a431-s.woff2'},{'revision':'54f02056e07c55023315568c637e3a96','url':'/_next/static/media/67957d42bae0796d-s.woff2'},{'revision':'e220ad1849c282590e47db0ff88fc3f3','url':'/_next/static/media/704b853f32d191d5-s.woff2'},{'revision':'662cde3543f3375874e26c26845cec22','url':'/_next/static/media/73cb51aac9c97f90-s.woff2'},{'revision':'afac1fab355fe8db5c2dcaa7623dffb3','url':'/_next/static/media/7ba5fb2a8c88521c-s.woff2'},{'revision':'c94e6e6c23e789fcb0fc60d790c9d2c1','url':'/_next/static/media/886030b0b59bc5a7-s.woff2'},{'revision':'01ba6c2a184b8cba08b0d57167664d75','url':'/_next/static/media/8e9860b6e62d6359-s.woff2'},{'revision':'17a5b2a15bf5647b49cadb9a3bb02e1c','url':'/_next/static/media/92eeb95d069020cc-s.woff2'},{'revision':'4a4e74bed5809194e4bc6538eb1a1e30','url':'/_next/static/media/939c4f875ee75fbb-s.woff2'},{'revision':'6708425c446b05de1c2d471a0eaf4099','url':'/_next/static/media/98e207f02528a563-s.p.woff2'},{'revision':'13dface50f6dc0bff1015561c84119e6','url':'/_next/static/media/991629005c80bdf1-s.woff2'},{'revision':'216ee1a35b060106ed2852cdd8c026c7','url':'/_next/static/media/99dcf268bda04fe5-s.woff2'},{'revision':'9e494903d6b0ffec1a1e14d34427d44d','url':'/_next/static/media/ba9851c3c22cd980-s.woff2'},{'revision':'782150e6836b9b074d1a798807adcb18','url':'/_next/static/media/bb3ef058b751a6ad-s.p.woff2'},{'revision':'027a89e9ab733a145db70f09b8a18b42','url':'/_next/static/media/c5fe6dc8356a8c31-s.woff2'},{'revision':'75fa2e527eaae805bbf44e3378d1232c','url':'/_next/static/media/d26bbd13d6b70f89-s.woff2'},{'revision':'0ba762bde65aaa682fcc089f8c57288e','url':'/_next/static/media/d29838c109ef09b4-s.woff2'},{'revision':'814fe1615d4dbc7bbd92d26a6bda0905','url':'/_next/static/media/d3ebbfd689654d3a-s.p.woff2'},{'revision':'e71a597e376ed91862e822b5a5de8c04','url':'/_next/static/media/db96af6b531dc71f-s.p.woff2'},{'revision':'d54db44de5ccb18886ece2fda72bdfe0','url':'/_next/static/media/df0a9ae256c0569c-s.woff2'},{'revision':'9fb609fe01d739bb9df558e1fba2498e','url':'/_next/static/media/e40af3453d7c920a-s.woff2'},{'revision':'65850a373e258f1c897a2b3d75eb74de','url':'/_next/static/media/e4af272ccee01ff0-s.p.woff2'},{'revision':'de1d49f26130d43f91829088086625f4','url':'/_next/static/media/ef4d5661765d0e49-s.woff2'},{'revision':'0f8d347d49960d05c9430d83e49edeb7','url':'/_next/static/media/f911b923c6adde36-s.woff2'},{'revision':'d7bc0f63f9618b8b700d028d7d242de8','url':'/apple-touch-icon.png'},{'revision':'5616f81ec5f8a9f726a17fb7ac66a54a','url':'/favicon-16.png'},{'revision':'1fc285cfb0116a0523eb34c779a7d282','url':'/favicon-32.png'},{'revision':'583b034f36839a8af92841771eef38b6','url':'/favicon.ico'},{'revision':'b15795128b3691e5703d0ce14ce10827','url':'/favicon.png'},{'revision':'44e9d71551be13574ac2e10063d03aa9','url':'/favicon.svg'},{'revision':'252b8f8c4d0f64c7cd120f182a6c74ab','url':'/icon-192.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icon-512.png'},{'revision':'252b8f8c4d0f64c7cd120f182a6c74ab','url':'/icons/icon-192.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icons/icon-512.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icons/icon-maskable-512.png'},{'revision':'bf670b1fafa1b3127bd50abe86d723b9','url':'/images/player-silhouette.svg'},{'revision':'d692f690fbd1564f090131e02be5ba9c','url':'/manifest.json'},{'revision':'9f61cf51298661d5c57a782534216240','url':'/og-image.png'},{'revision':'7c759c20b35840eacf9344692cb51061','url':'/og-image.svg'},{'revision':'9327802333275f11e68c3f19f20c160d','url':'/widget.js'}],skipWaiting:!0,clientsClaim:!0,navigationPreload:!0,runtimeCaching:eq}).addEventListeners(),self.addEventListener("install",e=>{e.waitUntil(caches.open("offline-fallback").then(e=>e.add(eR)).catch(()=>{}))}),self.addEventListener("activate",e=>{e.waitUntil(caches.keys().then(e=>Promise.all(e.filter(e=>!eE.includes(e)&&!e.startsWith("serwist")).map(e=>(console.log("[SW] deleting stale cache:",e),caches.delete(e))))))}),self.addEventListener("push",e=>{let t;if(!e.data)return;try{t=e.data.json()}catch{t={title:"VYNDR",body:e.data.text()}}let{title:a="VYNDR",body:s="",icon:r="/icons/icon-192.png",url:i="/",tag:n="vyndr-notification"}=t;e.waitUntil(self.registration.showNotification(a,{body:s,icon:r,badge:"/icons/icon-192.png",tag:n,data:{url:i}}))}),self.addEventListener("notificationclick",e=>{e.notification.close();let t=e.notification.data?.url??"/";e.waitUntil(self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(e=>{let a=e.find(e=>e.url.endsWith(t));return a?a.focus():self.clients.openWindow(t)}))})})();
\ No newline at end of file
+This is generally NOT safe. Learn more at https://bit.ly/wb-precache`)}handleInstall(e){return this.registerRequestRules(e),y(e,async()=>{let t=new eo;this.precacheStrategy.plugins.push(t),await el(this._concurrentPrecaching,Array.from(this._urlsToCacheKeys.entries()),async([t,a])=>{let s=this._cacheKeysToIntegrities.get(a),r=this._urlsToCacheModes.get(t),i=new Request(t,{integrity:s,cache:r,credentials:"same-origin"});await Promise.all(this.precacheStrategy.handleAll({event:e,request:i,url:new URL(i.url),params:{cacheKey:a}}))});let{updatedURLs:a,notUpdatedURLs:s}=t;return{updatedURLs:a,notUpdatedURLs:s}})}async registerRequestRules(e){if(this._requestRules&&e?.addRoutes)try{await e.addRoutes(this._requestRules),this._requestRules=void 0}catch(e){throw e}}handleActivate(e){return y(e,async()=>{let e=await self.caches.open(this.precacheStrategy.cacheName),t=await e.keys(),a=new Set(this._urlsToCacheKeys.values()),s=[];for(let r of t)a.has(r.url)||(await e.delete(r),s.push(r.url));return{deletedCacheRequests:s}})}handleFetch(e){let{request:t}=e,a=this.handleRequest({request:t,event:e});a&&e.respondWith(a)}handleCache(e){if(e.data&&"CACHE_URLS"===e.data.type){let{payload:t}=e.data,a=Promise.all(t.urlsToCache.map(t=>{let a;return a="string"==typeof t?new Request(t):new Request(...t),this.handleRequest({request:a,event:e})}));e.waitUntil(a),e.ports?.[0]&&a.then(()=>e.ports[0].postMessage(!0))}}setDefaultHandler(e,t="GET"){this._defaultHandlerMap.set(t,ea(e))}setCatchHandler(e){this._catchHandler=ea(e)}registerCapture(e,t,a){let s=((e,t,a)=>{if("string"==typeof e){let s=new URL(e,location.href);return new es(({url:e})=>e.href===s.href,t,a)}if(e instanceof RegExp)return new en(e,t,a);if("function"==typeof e)return new es(e,t,a);if(e instanceof es)return e;throw new l("unsupported-route-type",{moduleName:"serwist",funcName:"parseRoute",paramName:"capture"})})(e,t,a);return this.registerRoute(s),s}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new l("unregister-route-but-not-found-with-method",{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new l("unregister-route-route-not-registered")}getUrlsToPrecacheKeys(){return this._urlsToCacheKeys}getPrecachedUrls(){return[...this._urlsToCacheKeys.keys()]}getPrecacheKeyForUrl(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForPrecacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,a=this.getPrecacheKeyForUrl(t);if(a)return(await self.caches.open(this.precacheStrategy.cacheName)).match(a)}createHandlerBoundToUrl(e){let t=this.getPrecacheKeyForUrl(e);if(!t)throw new l("non-precached-url",{url:e});return a=>(a.request=new Request(e),a.params={cacheKey:t,...a.params},this.precacheStrategy.handle(a))}handleRequest({request:e,event:t}){let a,s=new URL(e.url,location.href);if(!s.protocol.startsWith("http"))return;let r=s.origin===location.origin,{params:i,route:n}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:s}),c=n?.handler,o=e.method;if(!c&&this._defaultHandlerMap.has(o)&&(c=this._defaultHandlerMap.get(o)),!c)return;try{a=c.handle({url:s,request:e,event:t,params:i})}catch(e){a=Promise.reject(e)}let l=n?.catchHandler;return a instanceof Promise&&(this._catchHandler||l)&&(a=a.catch(async a=>{if(l)try{return await l.handle({url:s,request:e,event:t,params:i})}catch(e){e instanceof Error&&(a=e)}if(this._catchHandler)return this._catchHandler.handle({url:s,request:e,event:t});throw a})),a}findMatchingRoute({url:e,sameOrigin:t,request:a,event:s}){for(let r of this._routes.get(a.method)||[]){let i,n=r.match({url:e,sameOrigin:t,request:a,event:s});if(n)return Array.isArray(i=n)&&0===i.length||n.constructor===Object&&0===Object.keys(n).length?i=void 0:"boolean"==typeof n&&(i=void 0),{route:r,params:i}}return{}}};let eR="/offline",eE=["pages","api-responses","next-static","static-media","fallback","offline-fallback"],eq=[{matcher:({url:e,sameOrigin:t})=>t&&e.pathname.startsWith("/api/"),handler:new ee({cacheName:"api-responses",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:100,maxAgeSeconds:3600})]})},{matcher:({request:e})=>"navigate"===e.mode,handler:new ee({cacheName:"pages",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:50,maxAgeSeconds:86400}),{handlerDidError:async()=>await caches.match(eR)||Response.error()}]})},{matcher:({url:e,sameOrigin:t})=>t&&e.pathname.startsWith("/_next/static/"),handler:new ey({cacheName:"next-static",plugins:[new ep({maxEntries:200,maxAgeSeconds:2592e3})]})},{matcher:({url:e})=>e.pathname.startsWith("/images/")||e.pathname.startsWith("/icons/")||/\.(?:png|jpe?g|gif|svg|webp|ico|woff2?)$/.test(e.pathname),handler:new ey({cacheName:"static-media",plugins:[new ep({maxEntries:100,maxAgeSeconds:2592e3})]})},{matcher:()=>!0,handler:new ee({cacheName:"fallback",networkTimeoutSeconds:5,plugins:[new ep({maxEntries:50,maxAgeSeconds:86400})]})}];new ev({precacheEntries:[{'revision':'f782881382efdee04951fb8fda52f691','url':'/_next/static/AAG__QkujHLyFLqyxgBSB/_buildManifest.js'},{'revision':'b6652df95db52feb4daf4eca35380933','url':'/_next/static/AAG__QkujHLyFLqyxgBSB/_ssgManifest.js'},{'revision':null,'url':'/_next/static/chunks/1079-304a546a4a673437.js'},{'revision':null,'url':'/_next/static/chunks/1896-359ed2e68a8c4f1d.js'},{'revision':null,'url':'/_next/static/chunks/1958-56cbbb8dba15fd2f.js'},{'revision':null,'url':'/_next/static/chunks/2004-a5d4899ef0da0bd8.js'},{'revision':null,'url':'/_next/static/chunks/2346-36e36720a5f6591a.js'},{'revision':null,'url':'/_next/static/chunks/4180-ed9d37a89d0dc424.js'},{'revision':null,'url':'/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js'},{'revision':null,'url':'/_next/static/chunks/52774a7f.f2ab7a9b4b8ba576.js'},{'revision':null,'url':'/_next/static/chunks/5838-7e0aa455e9f24259.js'},{'revision':null,'url':'/_next/static/chunks/7363-209a1a709d8f324d.js'},{'revision':null,'url':'/_next/static/chunks/7602.2868ff821d53ee09.js'},{'revision':null,'url':'/_next/static/chunks/7918-9cfe56e3ee27ed27.js'},{'revision':null,'url':'/_next/static/chunks/8500-f62a38ff68ab7f42.js'},{'revision':null,'url':'/_next/static/chunks/9da6db1e-9623f3245f088d02.js'},{'revision':null,'url':'/_next/static/chunks/app/_global-error/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/_not-found/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/about/page-072b5f07665fa274.js'},{'revision':null,'url':'/_next/static/chunks/app/account/page-9300f08c33aa8887.js'},{'revision':null,'url':'/_next/static/chunks/app/admin/page-b3b6af59ae9681bb.js'},{'revision':null,'url':'/_next/static/chunks/app/api/accuracy/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/admin/stats/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/books/%5B...path%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/checkout/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/content/%5B...path%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/gamelines/%5Bsport%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/%5Bid%5D/props/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/%5Bid%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/games/tonight/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/hero-prop/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/hotlist/%5Bsport%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/intelligence/feed/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ledger/accuracy/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ledger/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/lines/%5B...path%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/mlb/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/nba/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/soccer/%5Bleague%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/odds/wnba/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/add-leg/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/calculate/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/parlay/grade/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/players/search/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/preferences/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/live/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/most-parlayed/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/props/top-graded/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/scan/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/schedule/%5Bsport%5D/pitchers/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/schedule/%5Bsport%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/snapshot/%5Bsport%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/cascade/%5Bplayer%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/depth/%5Bteam%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/leaders/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/lineup/%5Bteam%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/parlays-graded/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/player/%5Bname%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/stats/public/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/streaks/%5Bsport%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/team/%5Babbr%5D/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/ticker/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/profile/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/recent-scans/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/user/scans/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/waitlist/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/webhook/nexapay/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/api/welcome-email/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/auth/callback/page-e6df9771a50edb87.js'},{'revision':null,'url':'/_next/static/chunks/app/blog/%5Bslug%5D/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/blog/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/compare/page-5e631b0c698c6f5f.js'},{'revision':null,'url':'/_next/static/chunks/app/dashboard/page-62cd345aa56e5baa.js'},{'revision':null,'url':'/_next/static/chunks/app/explore/page-8856c642532e2773.js'},{'revision':null,'url':'/_next/static/chunks/app/forgot-password/page-a251f52b4206e8d1.js'},{'revision':null,'url':'/_next/static/chunks/app/game/%5Bid%5D/page-3d020b802c020ad8.js'},{'revision':null,'url':'/_next/static/chunks/app/help/page-03c6534f006d09da.js'},{'revision':null,'url':'/_next/static/chunks/app/intelligence/page-772d69c9ecfe1503.js'},{'revision':null,'url':'/_next/static/chunks/app/invite/page-e1e3f46af5f1e44b.js'},{'revision':null,'url':'/_next/static/chunks/app/layout-03d79648328d9ec1.js'},{'revision':null,'url':'/_next/static/chunks/app/ledger/page-47459e4f664b707a.js'},{'revision':null,'url':'/_next/static/chunks/app/login/page-e75dd5939a169485.js'},{'revision':null,'url':'/_next/static/chunks/app/marketplace/page-cbada49ae96a7527.js'},{'revision':null,'url':'/_next/static/chunks/app/not-found-6cf954604c0add96.js'},{'revision':null,'url':'/_next/static/chunks/app/notifications/page-072b5f07665fa274.js'},{'revision':null,'url':'/_next/static/chunks/app/offline/page-a7a57ff039afc1af.js'},{'revision':null,'url':'/_next/static/chunks/app/onboarding/page-3483923fb16d41ff.js'},{'revision':null,'url':'/_next/static/chunks/app/opengraph-image/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/page-5fcb06eec53c778e.js'},{'revision':null,'url':'/_next/static/chunks/app/player/%5Bname%5D/page-a9a1a22752478255.js'},{'revision':null,'url':'/_next/static/chunks/app/pricing/page-5b9fc1cee887f2d3.js'},{'revision':null,'url':'/_next/static/chunks/app/privacy/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/profile/page-d607627acb1b73ab.js'},{'revision':null,'url':'/_next/static/chunks/app/report/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/responsible-gambling/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/scan/page-fa0499b15c4e8210.js'},{'revision':null,'url':'/_next/static/chunks/app/settings/page-eea60cdbf9380312.js'},{'revision':null,'url':'/_next/static/chunks/app/settings/security/page-697d02aa2d05cf7e.js'},{'revision':null,'url':'/_next/static/chunks/app/signup/page-f429c5ddc836e247.js'},{'revision':null,'url':'/_next/static/chunks/app/soccer/page-5a64e650908111d7.js'},{'revision':null,'url':'/_next/static/chunks/app/team/%5Babbr%5D/page-9ab56fcb07ae8687.js'},{'revision':null,'url':'/_next/static/chunks/app/terminal/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/terms/page-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/tracker/page-e23baec2b3735bb1.js'},{'revision':null,'url':'/_next/static/chunks/app/twitter-image/route-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/cancel/page-3702e818a6853705.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/desk/page-b88c47031c7d7d63.js'},{'revision':null,'url':'/_next/static/chunks/app/upgrade/success/page-ea358cb8f714f1ea.js'},{'revision':null,'url':'/_next/static/chunks/app/verify/page-9df376f065215168.js'},{'revision':null,'url':'/_next/static/chunks/app/welcome/page-259277230533599f.js'},{'revision':null,'url':'/_next/static/chunks/framework-95da69ac6843d788.js'},{'revision':null,'url':'/_next/static/chunks/main-a354262253293123.js'},{'revision':null,'url':'/_next/static/chunks/main-app-4231d5f500f33972.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/app-error-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/forbidden-7eb567e5889fc982.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/global-error-756d787dba63aa4d.js'},{'revision':null,'url':'/_next/static/chunks/next/dist/client/components/builtin/unauthorized-7eb567e5889fc982.js'},{'revision':'846118c33b2c0e922d7b3a7676f81f6f','url':'/_next/static/chunks/polyfills-42372ed130431b0a.js'},{'revision':null,'url':'/_next/static/chunks/webpack-42b9616650231776.js'},{'revision':null,'url':'/_next/static/css/6ee3c69ef5f8952b.css'},{'revision':'cd34c7793d9776838308cfbe5d93922b','url':'/_next/static/media/011e180705008d6f-s.woff2'},{'revision':'324703f03c390d2e2a4f387de85fe63d','url':'/_next/static/media/0aa834ed78bf6d07-s.woff2'},{'revision':'9dda5cfc9a46f256d0e131bb535e46f8','url':'/_next/static/media/19cfc7226ec3afaa-s.woff2'},{'revision':'7de6d31e5076eb437418b6e01998ee12','url':'/_next/static/media/20535187d867b7b9-s.woff2'},{'revision':'4e2553027f1d60eff32898367dd4d541','url':'/_next/static/media/21350d82a1f187e9-s.woff2'},{'revision':'0d11e07b5aaafda6ae2efc53256932ec','url':'/_next/static/media/37786be940ec402b-s.p.woff2'},{'revision':'5de0bff80f9f432b5cf52c1c2f80fe20','url':'/_next/static/media/46e154b2fcbd6033-s.woff2'},{'revision':'6041b3192dc3e1a50141d5d418a24199','url':'/_next/static/media/5356a6a4f2c8c8d8-s.woff2'},{'revision':'f572f7b57d27ec7fd8373961f0b762b0','url':'/_next/static/media/58f386aa6b1a2a92-s.woff2'},{'revision':'e829cbe042e8b2b2e6b99c0eec9e230d','url':'/_next/static/media/656feb427634a431-s.woff2'},{'revision':'54f02056e07c55023315568c637e3a96','url':'/_next/static/media/67957d42bae0796d-s.woff2'},{'revision':'e220ad1849c282590e47db0ff88fc3f3','url':'/_next/static/media/704b853f32d191d5-s.woff2'},{'revision':'662cde3543f3375874e26c26845cec22','url':'/_next/static/media/73cb51aac9c97f90-s.woff2'},{'revision':'afac1fab355fe8db5c2dcaa7623dffb3','url':'/_next/static/media/7ba5fb2a8c88521c-s.woff2'},{'revision':'c94e6e6c23e789fcb0fc60d790c9d2c1','url':'/_next/static/media/886030b0b59bc5a7-s.woff2'},{'revision':'01ba6c2a184b8cba08b0d57167664d75','url':'/_next/static/media/8e9860b6e62d6359-s.woff2'},{'revision':'17a5b2a15bf5647b49cadb9a3bb02e1c','url':'/_next/static/media/92eeb95d069020cc-s.woff2'},{'revision':'4a4e74bed5809194e4bc6538eb1a1e30','url':'/_next/static/media/939c4f875ee75fbb-s.woff2'},{'revision':'6708425c446b05de1c2d471a0eaf4099','url':'/_next/static/media/98e207f02528a563-s.p.woff2'},{'revision':'13dface50f6dc0bff1015561c84119e6','url':'/_next/static/media/991629005c80bdf1-s.woff2'},{'revision':'216ee1a35b060106ed2852cdd8c026c7','url':'/_next/static/media/99dcf268bda04fe5-s.woff2'},{'revision':'9e494903d6b0ffec1a1e14d34427d44d','url':'/_next/static/media/ba9851c3c22cd980-s.woff2'},{'revision':'782150e6836b9b074d1a798807adcb18','url':'/_next/static/media/bb3ef058b751a6ad-s.p.woff2'},{'revision':'027a89e9ab733a145db70f09b8a18b42','url':'/_next/static/media/c5fe6dc8356a8c31-s.woff2'},{'revision':'75fa2e527eaae805bbf44e3378d1232c','url':'/_next/static/media/d26bbd13d6b70f89-s.woff2'},{'revision':'0ba762bde65aaa682fcc089f8c57288e','url':'/_next/static/media/d29838c109ef09b4-s.woff2'},{'revision':'814fe1615d4dbc7bbd92d26a6bda0905','url':'/_next/static/media/d3ebbfd689654d3a-s.p.woff2'},{'revision':'e71a597e376ed91862e822b5a5de8c04','url':'/_next/static/media/db96af6b531dc71f-s.p.woff2'},{'revision':'d54db44de5ccb18886ece2fda72bdfe0','url':'/_next/static/media/df0a9ae256c0569c-s.woff2'},{'revision':'9fb609fe01d739bb9df558e1fba2498e','url':'/_next/static/media/e40af3453d7c920a-s.woff2'},{'revision':'65850a373e258f1c897a2b3d75eb74de','url':'/_next/static/media/e4af272ccee01ff0-s.p.woff2'},{'revision':'de1d49f26130d43f91829088086625f4','url':'/_next/static/media/ef4d5661765d0e49-s.woff2'},{'revision':'0f8d347d49960d05c9430d83e49edeb7','url':'/_next/static/media/f911b923c6adde36-s.woff2'},{'revision':'d7bc0f63f9618b8b700d028d7d242de8','url':'/apple-touch-icon.png'},{'revision':'5616f81ec5f8a9f726a17fb7ac66a54a','url':'/favicon-16.png'},{'revision':'1fc285cfb0116a0523eb34c779a7d282','url':'/favicon-32.png'},{'revision':'583b034f36839a8af92841771eef38b6','url':'/favicon.ico'},{'revision':'b15795128b3691e5703d0ce14ce10827','url':'/favicon.png'},{'revision':'44e9d71551be13574ac2e10063d03aa9','url':'/favicon.svg'},{'revision':'252b8f8c4d0f64c7cd120f182a6c74ab','url':'/icon-192.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icon-512.png'},{'revision':'252b8f8c4d0f64c7cd120f182a6c74ab','url':'/icons/icon-192.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icons/icon-512.png'},{'revision':'3e3b53bbd210bd772b36b70165657e7c','url':'/icons/icon-maskable-512.png'},{'revision':'bf670b1fafa1b3127bd50abe86d723b9','url':'/images/player-silhouette.svg'},{'revision':'d692f690fbd1564f090131e02be5ba9c','url':'/manifest.json'},{'revision':'9f61cf51298661d5c57a782534216240','url':'/og-image.png'},{'revision':'7c759c20b35840eacf9344692cb51061','url':'/og-image.svg'},{'revision':'9327802333275f11e68c3f19f20c160d','url':'/widget.js'}],skipWaiting:!0,clientsClaim:!0,navigationPreload:!0,runtimeCaching:eq}).addEventListeners(),self.addEventListener("install",e=>{e.waitUntil(caches.open("offline-fallback").then(e=>e.add(eR)).catch(()=>{}))}),self.addEventListener("activate",e=>{e.waitUntil(caches.keys().then(e=>Promise.all(e.filter(e=>!eE.includes(e)&&!e.startsWith("serwist")).map(e=>(console.log("[SW] deleting stale cache:",e),caches.delete(e))))))}),self.addEventListener("push",e=>{let t;if(!e.data)return;try{t=e.data.json()}catch{t={title:"VYNDR",body:e.data.text()}}let{title:a="VYNDR",body:s="",icon:r="/icons/icon-192.png",url:i="/",tag:n="vyndr-notification"}=t;e.waitUntil(self.registration.showNotification(a,{body:s,icon:r,badge:"/icons/icon-192.png",tag:n,data:{url:i}}))}),self.addEventListener("notificationclick",e=>{e.notification.close();let t=e.notification.data?.url??"/";e.waitUntil(self.clients.matchAll({type:"window",includeUncontrolled:!0}).then(e=>{let a=e.find(e=>e.url.endsWith(t));return a?a.focus():self.clients.openWindow(t)}))})})();
\ No newline at end of file
diff --git a/web/src/app/api/accuracy/route.ts b/web/src/app/api/accuracy/route.ts
new file mode 100644
index 0000000..10b729e
--- /dev/null
+++ b/web/src/app/api/accuracy/route.ts
@@ -0,0 +1,24 @@
+import { NextResponse } from 'next/server';
+
+export const dynamic = 'force-dynamic';
+
+const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:3000';
+
+/**
+ * Accuracy proxy (Session 55) — forwards GET /api/accuracy to Express (the
+ * self-learning loop's rolling track record). Thin pass-through; the dashboard
+ * header + grade card read this. Empty-safe on any upstream failure.
+ */
+export async function GET() {
+ try {
+ const upstream = await fetch(`${BACKEND_URL}/api/accuracy`, {
+ method: 'GET',
+ headers: { Accept: 'application/json' },
+ cache: 'no-store',
+ });
+ const data = await upstream.json().catch(() => ({ overall: null, sports: {} }));
+ return NextResponse.json(data, { status: upstream.ok ? 200 : upstream.status });
+ } catch {
+ return NextResponse.json({ overall: null, sports: {}, min_sample: 8, updated_at: null }, { status: 200 });
+ }
+}
diff --git a/web/src/app/dashboard/page.tsx b/web/src/app/dashboard/page.tsx
index fc84bf6..49c3bcc 100644
--- a/web/src/app/dashboard/page.tsx
+++ b/web/src/app/dashboard/page.tsx
@@ -9,6 +9,8 @@ import { GradePill } from '@/components/GradeCard';
// existing dashboard sections (Most Parlayed, Recent Reads) stay
// below as intelligence layers on top of the raw odds.
import Slate from '@/components/Slate';
+// Session 55 — the self-learning loop's track record, live in the header.
+import { AccuracyBadge } from '@/components/vyndr';
type Sport = 'NBA' | 'MLB' | 'WNBA';
@@ -205,6 +207,10 @@ export default function DashboardPage() {
{new Date().toLocaleDateString([], { weekday: 'long', month: 'short', day: 'numeric' }).toUpperCase()}
+ {/* Session 55 — the system's live track record. Self-hides while it has
+ no data; reads "LEARNING" until the settled sample is honest. */}
+
+
{tier === 'free' && scansRemaining != null && (
)}
+
{/* Session 13 — Browse-first slate. Owns its own sport-tab UI,
diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx
index 6edae41..7c90ccd 100644
--- a/web/src/app/page.tsx
+++ b/web/src/app/page.tsx
@@ -5,6 +5,9 @@ import { useRouter } from 'next/navigation';
import { useAuth } from '@/contexts/AuthContext';
import Hero from '@/components/Hero';
import { ClaimMeter } from '@/components/vyndr';
+// Session 55 — live top A-rated grades pulled from tonight's real snapshot,
+// with the self-learning loop's accuracy line. The product shown, not described.
+import TopSignals from '@/components/TopSignals';
// Session 17 — game-count strip mounted between the hero and the
// existing LivePropsStrip. Shows "X NBA · Y WNBA · Z MLB games
// being graded right now" with a signup CTA. Hides itself when
@@ -45,6 +48,8 @@ export default function Home() {
return (
<>
+ {/* Session 55 — tonight's real top signals + live accuracy (the system works). */}
+
{/* Founder-seat scarcity meter (§12) */}
diff --git a/web/src/app/scan/page.tsx b/web/src/app/scan/page.tsx
index ec5d8e9..f909149 100644
--- a/web/src/app/scan/page.tsx
+++ b/web/src/app/scan/page.tsx
@@ -3,6 +3,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useRouter } from 'next/navigation';
import ProcessingGrade from '@/components/vyndr/ProcessingGrade';
+import { AccuracyBadge } from '@/components/vyndr';
import type { GradeResultData } from '@/components/vyndr/GradeResultCard';
import { mapScanToGradeResult } from '@/lib/gradeAdapter';
import { normalizeName, nameKey } from '@/lib/playerName';
@@ -736,6 +737,12 @@ export default function ScanPage() {
onReadAnother={reset}
/>
+ {/* Session 55 — the self-learning loop's track record for this sport.
+ "The system learns" — real hit rate on graded props, misses shown. */}
+
+
{/* Sportsbook hand-off (preserved feature) */}
{SPORTSBOOKS.map((b) => (
diff --git a/web/src/components/Slate.tsx b/web/src/components/Slate.tsx
index e2fb3e2..f5178ec 100644
--- a/web/src/components/Slate.tsx
+++ b/web/src/components/Slate.tsx
@@ -211,6 +211,16 @@ interface GameLinesResponse { games?: Record
}
// Nickname token (last word) — the most stable cross-source identifier
// between ESPN full names and odds-api full names ("San Antonio Spurs"
// ↔ "spurs"). Falls back to the whole normalized string.
+// Session 55 — relative freshness label ("updated 12s ago" → "3m ago").
+function freshLabel(ts: number | null, now: number): string {
+ if (!ts) return '';
+ const s = Math.max(0, Math.round((now - ts) / 1000));
+ if (s < 60) return `${s}s ago`;
+ const m = Math.round(s / 60);
+ if (m < 60) return `${m}m ago`;
+ return `${Math.round(m / 60)}h ago`;
+}
+
function nickToken(name?: string | null): string {
const w = String(name || '').trim().split(/\s+/);
const last = w[w.length - 1] || '';
@@ -365,6 +375,10 @@ export default function Slate({ initialTab = 'all', tier = 'free', preferredBook
const [pitcherGames, setPitcherGames] = useState([]);
const [loading, setLoading] = useState(false);
const [fetchError, setFetchError] = useState(null);
+ // Session 55 — real-time freshness: when the slate last pulled fresh data,
+ // and a ticking clock so "updated Xs ago" advances between polls.
+ const [lastRefreshed, setLastRefreshed] = useState(null);
+ const [nowTick, setNowTick] = useState(() => Date.now());
// Session 26 — per-sport schedule counts for the tab labels, fetched
// ONCE on mount for every schedule-backed sport (free ESPN, cached 60s).
// This makes "MLB (15)" / "WNBA (2)" show on their tabs even while the
@@ -383,10 +397,14 @@ export default function Slate({ initialTab = 'all', tier = 'free', preferredBook
// Schedule is the foundation — games render even when odds are
// empty/503. Odds + lines overlay on top. The slate is never empty
// just because one provider is down.
- const fetchSlate = useCallback(async (active: SlateTab) => {
- setLoading(true);
- setFetchError(null);
- setOddsNotice(false);
+ // Session 55 — real-time layer. `silent` background refreshes keep the slate
+ // alive (polling) without the skeleton flash or clearing the current view.
+ const fetchSlate = useCallback(async (active: SlateTab, silent = false) => {
+ if (!silent) {
+ setLoading(true);
+ setFetchError(null);
+ setOddsNotice(false);
+ }
// Sports that carry a schedule/streaks feed (ESPN-backed). Soccer
// has no schedule endpoint, so it stays odds-only.
@@ -457,15 +475,23 @@ export default function Slate({ initialTab = 'all', tier = 'free', preferredBook
if (s.hadSchedule) anyScheduleShown = true;
}
+ // A silent background poll that came back empty (transient blip) must NOT
+ // wipe the current view or flash an error — keep what the user is seeing.
+ if (silent && allGames.length === 0) {
+ setLoading(false);
+ return;
+ }
+
setGames(allGames);
setSnapGrades(allSnapGrades);
setSnapDeltas(allSnapDeltas);
setPitcherGames(allPitcherGames);
+ setLastRefreshed(Date.now());
// Odds down but schedule carried the slate → soft notice, not a wall.
- if (!anyOddsOk && anyScheduleShown) setOddsNotice(true);
+ if (!silent && !anyOddsOk && anyScheduleShown) setOddsNotice(true);
// Genuine total failure (no odds, no schedule, anywhere) → error.
- if (!anyOddsOk && !anyScheduleShown && allGames.length === 0) {
+ if (!silent && !anyOddsOk && !anyScheduleShown && allGames.length === 0) {
setFetchError('No games available right now. Check back soon.');
}
setLoading(false);
@@ -473,6 +499,19 @@ export default function Slate({ initialTab = 'all', tier = 'free', preferredBook
useEffect(() => { fetchSlate(tab); }, [tab, fetchSlate]);
+ // Session 55 — auto-refresh: poll the slate every 60s so fresh snapshot grades
+ // + schedule/score updates appear without a page reload. Silent (no skeleton).
+ useEffect(() => {
+ const id = setInterval(() => { fetchSlate(tab, true); }, 60_000);
+ return () => clearInterval(id);
+ }, [tab, fetchSlate]);
+
+ // A 15s ticking clock so the "updated Xs ago" freshness label stays honest.
+ useEffect(() => {
+ const id = setInterval(() => setNowTick(Date.now()), 15_000);
+ return () => clearInterval(id);
+ }, []);
+
// Session 24 — switching sport resets the stat filter. The categories
// differ per sport (Points vs Hits), so a stale "points" filter would
// silently blank the MLB panels. Always land back on 'all'.
@@ -574,6 +613,29 @@ export default function Slate({ initialTab = 'all', tier = 'free', preferredBook
paddingBottom: 12,
}}
>
+ {/* Session 55 — the live signal strip: proves the data is alive. A
+ pulsing dot, the graded-prop count, any in-progress games, and a
+ ticking "updated Xs ago" freshness stamp fed by the 60s poll. */}
+
+
+ SIGNAL LIVE
+ {snapGrades.length > 0 && (
+ <>· {snapGrades.length} PROPS GRADED >
+ )}
+ {games.some((g) => g.status === 'in') && (
+ <>· {games.filter((g) => g.status === 'in').length} LIVE >
+ )}
+ {lastRefreshed && (
+ <>· UPDATED {freshLabel(lastRefreshed, nowTick)} >
+ )}
+
= {
+ total_bases: 'TB', home_runs: 'HR', hits: 'Hits', rbi: 'RBI', runs: 'Runs',
+ strikeouts: 'Ks', hits_allowed: 'HA', earned_runs: 'ER', innings_pitched: 'IP',
+ stolen_bases: 'SB', points: 'Pts', rebounds: 'Reb', assists: 'Ast', threes: '3PT',
+};
+function shortStat(s?: string) {
+ if (!s) return '';
+ return STAT_SHORT[s] || s.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
+}
+const isTop = (g?: string) => g === 'A+' || g === 'A';
+
+export default function TopSignals() {
+ const [signals, setSignals] = useState(null);
+
+ useEffect(() => {
+ let active = true;
+ const load = async () => {
+ try {
+ const results = await Promise.all(
+ SPORTS.map((sp) =>
+ fetch(`/api/snapshot/${sp}`, { cache: 'no-store' })
+ .then((r) => (r.ok ? r.json() : null))
+ .catch(() => null),
+ ),
+ );
+ if (!active) return;
+ const all: SnapGrade[] = [];
+ for (const res of results) {
+ const grades = res && Array.isArray(res.grades) ? res.grades : [];
+ for (const g of grades) if (isTop(g.grade)) all.push(g);
+ }
+ all.sort((a, b) => (Number(b.confidence) || 0) - (Number(a.confidence) || 0));
+ setSignals(all.slice(0, 3));
+ } catch {
+ if (active) setSignals([]);
+ }
+ };
+ load();
+ const id = setInterval(load, 60_000);
+ return () => { active = false; clearInterval(id); };
+ }, []);
+
+ // Self-hide off-hours (nothing graded A yet) — never an empty shell.
+ if (!signals || signals.length === 0) return null;
+
+ return (
+
+
+
+
+ TONIGHT'S TOP SIGNALS
+ · LIVE FROM THE SLATE
+
+
+
+
+
+ );
+}
diff --git a/web/src/components/vyndr/AccuracyBadge.tsx b/web/src/components/vyndr/AccuracyBadge.tsx
new file mode 100644
index 0000000..5bf58b2
--- /dev/null
+++ b/web/src/components/vyndr/AccuracyBadge.tsx
@@ -0,0 +1,116 @@
+'use client';
+
+import { useEffect, useState } from 'react';
+
+/**
+ * AccuracyBadge (Session 55) — the self-learning loop made visible.
+ *
+ * Reads the rolling accuracy record (`/api/accuracy`, written by outcomeService
+ * from settled grades vs REAL results) and renders the system's track record.
+ * This is the #1 trust builder: a system that shows its hit rate, including its
+ * misses. Honest by construction — below MIN_SAMPLE it reads "LEARNING" rather
+ * than faking a number. All data (%) is mono per the brand rule; never glitches.
+ */
+
+interface Bucket { hits: number; misses: number; pushes: number; total: number; pct: number | null }
+interface AccuracyRecord {
+ window_days?: number;
+ overall?: Bucket;
+ byGrade?: Record;
+}
+interface AccuracyResponse {
+ overall?: AccuracyRecord | null;
+ min_sample?: number;
+}
+
+const BLANK: Bucket = { hits: 0, misses: 0, pushes: 0, total: 0, pct: null };
+
+function merge(a?: Bucket, b?: Bucket): Bucket {
+ const x = a || BLANK, y = b || BLANK;
+ const hits = x.hits + y.hits, misses = x.misses + y.misses, pushes = x.pushes + y.pushes;
+ const decided = hits + misses;
+ return { hits, misses, pushes, total: hits + misses + pushes, pct: decided > 0 ? Math.round((hits / decided) * 100) : null };
+}
+
+type Variant = 'inline' | 'chip';
+
+export default function AccuracyBadge({ variant = 'chip', sport }: { variant?: Variant; sport?: string }) {
+ const [rec, setRec] = useState(null);
+ const [minSample, setMinSample] = useState(8);
+ const [loaded, setLoaded] = useState(false);
+
+ useEffect(() => {
+ let active = true;
+ fetch('/api/accuracy', { cache: 'no-store' })
+ .then((r) => (r.ok ? r.json() : null))
+ .then((data: AccuracyResponse | null) => {
+ if (!active) return;
+ setMinSample(data?.min_sample ?? 8);
+ // Prefer a specific sport's record when asked; else the overall.
+ const sportRec = sport && data && (data as unknown as { sports?: Record }).sports?.[sport];
+ setRec((sportRec as AccuracyRecord) || data?.overall || null);
+ setLoaded(true);
+ })
+ .catch(() => { if (active) setLoaded(true); });
+ return () => { active = false; };
+ }, [sport]);
+
+ if (!loaded || !rec) return null;
+
+ const aRated = merge(rec.byGrade?.['A+'], rec.byGrade?.['A']);
+ const overall = rec.overall || BLANK;
+ const window = rec.window_days || 30;
+
+ // Honest states: A-rated record → overall record → "LEARNING".
+ let label: string;
+ let value: string;
+ let color: string;
+ let calibrated = true;
+ if (aRated.hits + aRated.misses >= minSample && aRated.pct != null) {
+ label = 'A-RATED'; value = `${aRated.pct}% HIT`; color = 'var(--g-a, #00D4A0)';
+ } else if (overall.hits + overall.misses >= minSample && overall.pct != null) {
+ label = 'MODEL'; value = `${overall.pct}% HIT`; color = 'var(--g-a, #00D4A0)';
+ } else {
+ label = 'MODEL'; value = 'LEARNING'; color = 'var(--amber, #FFB347)'; calibrated = false;
+ }
+
+ const title = calibrated
+ ? `VYNDR's ${label === 'A-RATED' ? 'A-rated props' : 'graded props'} over the last ${window} days — including misses. The system settles every grade against real results.`
+ : 'The self-learning loop is still collecting settled results. Hit rate appears once the sample is large enough to be honest.';
+
+ if (variant === 'inline') {
+ return (
+
+ {label} · {value} {calibrated ? `· ${window}D` : ''}
+
+ );
+ }
+
+ return (
+
+
+ {label}
+ ·
+ {value}
+ {calibrated && <>· {window}D >}
+
+ );
+}
diff --git a/web/src/components/vyndr/StatStrip.tsx b/web/src/components/vyndr/StatStrip.tsx
index 0f8c47f..5020901 100644
--- a/web/src/components/vyndr/StatStrip.tsx
+++ b/web/src/components/vyndr/StatStrip.tsx
@@ -14,6 +14,8 @@ export interface StripProp {
gradedAt?: { line: number; odds?: number | null; timestamp?: string; ago?: string } | null;
delta?: { delta: number; direction: 'toward' | 'away'; currentLine: number } | null;
awaiting?: boolean; // not yet graded by a snapshot → "Awaiting next scan"
+ // Session 55 — settled outcome from the self-learning loop (once the game is final).
+ outcome?: { result: 'hit' | 'miss' | 'push' | string; actual?: number | null } | null;
}
export interface StripArchetype {
primary: string;
@@ -82,6 +84,24 @@ export default function StatStrip({
);
};
+ // Session 55 — settled outcome chip. The self-learning loop's transparency
+ // moment: show HIT and MISS, with the real stat. Data → mono, never glitches.
+ const OutcomeChip = ({ p }: { p: StripProp }) => {
+ if (!p.outcome || !p.outcome.result) return null;
+ const r = String(p.outcome.result).toLowerCase();
+ const map: Record = {
+ hit: { label: '✓ HIT', color: 'var(--hit, #00D4A0)', bg: 'color-mix(in srgb, var(--g-a, #00D4A0) 16%, transparent)' },
+ miss: { label: '✕ MISS', color: 'var(--miss, #FF4757)', bg: 'color-mix(in srgb, #FF4757 16%, transparent)' },
+ push: { label: 'PUSH', color: 'var(--text-1, #B8BCC8)', bg: 'var(--bg-2, #12121A)' },
+ };
+ const s = map[r] || map.push;
+ const actual = p.outcome.actual != null ? ` (${p.outcome.actual})` : '';
+ return (
+
+ {s.label}{actual}
+
+ );
+ };
// Session 52 — Push-to-Book teaser on graded props (feature not live yet).
const BookItTeaser = ({ p }: { p: StripProp }) => {
if (!p.grade) return null;
@@ -209,8 +229,9 @@ export default function StatStrip({
{p.stat} {p.side}{p.line}
{p.grade &&
}
-
-
+
+ {!p.outcome &&
}
+ {!p.outcome &&
}
{p.gradedAt?.ago && (
Graded {p.gradedAt.ago}{p.gradedAt.odds != null ? ` at ${p.gradedAt.odds}` : ''}
diff --git a/web/src/components/vyndr/Ticker.tsx b/web/src/components/vyndr/Ticker.tsx
index d82603a..81b3100 100644
--- a/web/src/components/vyndr/Ticker.tsx
+++ b/web/src/components/vyndr/Ticker.tsx
@@ -35,16 +35,25 @@ const TAG_COLORS: Record = {
*/
export default function Ticker({ items, height = 34, live = true, pollMs = 30_000 }: TickerProps) {
const [feed, setFeed] = useState(null);
+ // Session 55 — flash the LIVE dot when a fresh event slides in (breaking-news feel).
+ const [flash, setFlash] = useState(false);
useEffect(() => {
if (!live) return;
let active = true;
+ let lastHead = '';
const load = async () => {
try {
const r = await fetch('/api/ticker', { cache: 'no-store' });
if (!r.ok) return;
const data = (await r.json()) as { items?: TickerItem[] };
if (active && Array.isArray(data.items) && data.items.length > 0) {
+ const head = `${data.items[0]?.tag}|${data.items[0]?.text}`;
+ if (lastHead && head !== lastHead) {
+ setFlash(true);
+ setTimeout(() => { if (active) setFlash(false); }, 2500);
+ }
+ lastHead = head;
setFeed(data.items.map((it) => ({ ...it, color: it.color || TAG_COLORS[it.tag] || 'var(--amber)' })));
}
} catch {
@@ -89,7 +98,24 @@ export default function Ticker({ items, height = 34, live = true, pollMs = 30_00
{content}
{content}
-
+ {/* Session 55 — anchored LIVE badge (chrome, not data → may pulse). */}
+ {live && (
+
+
+ LIVE
+
+ )}
+
);
diff --git a/web/src/components/vyndr/index.ts b/web/src/components/vyndr/index.ts
index b5988f5..7aa40c2 100644
--- a/web/src/components/vyndr/index.ts
+++ b/web/src/components/vyndr/index.ts
@@ -14,6 +14,7 @@ export { default as ProcessingGrade } from './ProcessingGrade';
export { default as GameCard } from './GameCard';
export type { GameCardData, GameLine, GameProp, PlayerStrip, StartingPitcher } from './GameCard';
export { default as ClaimMeter } from './ClaimMeter';
+export { default as AccuracyBadge } from './AccuracyBadge';
/* Player Intelligence (Session 42) */
export { default as ArchetypeBadge } from './ArchetypeBadge';
diff --git a/web/src/lib/slateAdapter.js b/web/src/lib/slateAdapter.js
index f24ba7b..de26a51 100644
--- a/web/src/lib/slateAdapter.js
+++ b/web/src/lib/slateAdapter.js
@@ -284,6 +284,9 @@ function buildPlayerStripsFromProps(gameProps, gradeIndex, deltaIndex, now = Dat
? { ...rec.gradedAt, ago: gradedAgo(rec.gradedAt.timestamp, now) }
: null,
delta: delta ? { delta: delta.delta, direction: delta.direction, currentLine: delta.currentLine } : null,
+ // Session 55 — settled outcome from the self-learning loop (hit/miss/push
+ // + actual stat) once the game completes. null until settled.
+ outcome: rec.outcome ? { result: rec.outcome.result, actual: rec.outcome.actual } : null,
});
} else {
byPlayer[pk].props.push({