{"version":3,"file":"predict.mjs","sources":["../../src/debug/predict.ts"],"sourcesContent":["/**\n * Debug panel for `Predict` instances published via the global registry.\n *\n * `@colyseus/sdk/debug` installs a tiny `globalThis.__colyseusDebug.publish()`\n * receiver. Any prediction layer (Predict, PredictedEvents, etc.) calls into\n * it at construction time; this module renders interactive cards under the\n * debug shadow root.\n *\n * Stable contract:\n *   - The `predict` channel expects a `PredictCore` (the engine's portable\n *     introspection handle). `predict-bridge.ts` adapts it into the\n *     panel-facing `PredictDebugHandle` — deriving panel-only data (the\n *     per-profile field list) here rather than in the engine.\n *   - Handle methods are queried lazily — never persisted as fields here,\n *     so live Predict mutations stay reflected.\n *\n * Styling comes from `tokens.ts`, so the mode pills and the room panels' segmented\n * buttons stay in step by construction rather than by convention.\n */\nimport { getDebugRoot, getPanelStack, isOverlayVisible, preferences, PREDICT_CONTAINER_ID } from \"./core.ts\";\nimport { clearEdges, horizontalEdge, setInset, setMaxViewportHeight, verticalEdge } from \"./geometry.ts\";\nimport { applySegmentedState, bindSegmentedHover, RULE, SECONDARY, SEGMENT } from \"./tokens.ts\";\nimport { isCoarsePointer, isCompact } from \"./layout.ts\";\nimport { drawGraph } from \"./panel.ts\";\nimport {\n    toDebugHandle,\n    type PredictCore,\n    type PredictDebugHandle,\n    type PredictMode,\n    type ProfileInfo,\n    type ReconcilerStat,\n} from \"./predict-bridge.ts\";\n\ninterface PredictPanelEntry {\n    handle: PredictDebugHandle;\n    el: HTMLElement;\n    refresh: () => void;\n    /** Per-reconciler drift-peak history (by label) backing the canvas graph. */\n    histories: Map<string, number[]>;\n}\n\nconst panels = new Map<string, PredictPanelEntry>();\nlet container: HTMLElement | null = null;\nlet pollInterval: any = null;\nconst POLL_MS = 250; // refresh attached count at 4 Hz\n\n\nconst CARD_WIDTH = \"240px\";\n\nconst ALL_MODES: PredictMode[] = [\"lerp\", \"extrapolate\", \"damped\", \"reckon\", \"raw\"];\n\n// Compact glyphs so all five modes fit on one line; the mode name is the tooltip.\nconst ICON_ATTRS =\n    'width=\"13\" height=\"13\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" ' +\n    'stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"';\nconst MODE_ICONS: Record<string, string> = {\n    // lerp — linear interpolation between two snapshots\n    lerp: `<svg ${ICON_ATTRS}><circle cx=\"3.5\" cy=\"12.5\" r=\"1.4\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12.5\" cy=\"3.5\" r=\"1.4\" fill=\"currentColor\" stroke=\"none\"/><line x1=\"4.6\" y1=\"11.4\" x2=\"11.4\" y2=\"4.6\"/></svg>`,\n    // extrapolate — project the trajectory forward past the last point\n    extrapolate: `<svg ${ICON_ATTRS}><circle cx=\"2.5\" cy=\"8\" r=\"1.4\" fill=\"currentColor\" stroke=\"none\"/><line x1=\"3.8\" y1=\"8\" x2=\"13\" y2=\"8\"/><polyline points=\"9.5,4.5 13,8 9.5,11.5\"/></svg>`,\n    // damped — oscillation settling to the target\n    damped: `<svg ${ICON_ATTRS}><path d=\"M2 8 C 3 3 5 3 6 8 C 6.8 11 7.8 11 8.6 8 C 9.2 6.2 10 6.2 13 7.6\"/></svg>`,\n    // reckon — re-runs the simulation function forward (dead reckoning), so \"fn\"\n    reckon: `<span style=\"font:italic 700 11px/1 ui-monospace,monospace\">fn</span>`,\n    // raw — snap straight to server values (discrete steps)\n    raw: `<svg ${ICON_ATTRS}><polyline points=\"2,13 5.5,13 5.5,9 9,9 9,5 13,5\"/></svg>`,\n};\n\n// -----------------------------------------------------------------------------\n// Registry installation\n// -----------------------------------------------------------------------------\n\n/**\n * Render (or dedupe) a Predict card for a published core handle. The debug\n * entry (`debug.ts`) routes the `\"predict\"` channel of the shared\n * `globalThis.__colyseusDebug` registry here — including buffered publishes it\n * replays on install.\n */\nexport function onPredictPublished(core: PredictCore): void {\n    if (panels.has(core.name)) return; // dedupe\n    // Adapt the engine's portable core into the panel-facing handle (derives\n    // the per-profile field list from the core's track stream).\n    const handle = toDebugHandle(core);\n    const el = renderCard(handle);\n    getContainer().appendChild(el);\n    const entry: PredictPanelEntry = {\n        handle, el,\n        refresh: () => updateCardLive(handle, entry),\n        histories: new Map(),\n    };\n    panels.set(handle.name, entry);\n    handle.onDispose(() => {\n        const e = panels.get(handle.name);\n        if (!e) return;\n        e.el.remove();\n        panels.delete(handle.name);\n        if (panels.size === 0) stopPolling();\n        syncHeaderNames(); // name may now be redundant (back to a lone panel)\n    });\n    startPolling();\n    syncHeaderNames(); // name is now a disambiguator if this made it 2+\n}\n\n/**\n * Show each panel's instance name in its header ONLY when more than one Predict\n * panel is mounted. The name is a disambiguator between cards — with a single\n * instance it carries no information and is often a stale/misleading artifact\n * (e.g. an instance named after one of its own attach-groups). The name still\n * lives on the handle (keys the panel map, collapse state, and graph ids); this\n * only governs whether the header renders it.\n */\nfunction syncHeaderNames(): void {\n    const show = panels.size > 1;\n    for (const entry of panels.values()) {\n        const nameEl = entry.el.querySelector<HTMLElement>('[data-role=\"name\"]');\n        if (nameEl) nameEl.textContent = show ? ` ${entry.handle.name}` : \"\";\n    }\n}\n\n// -----------------------------------------------------------------------------\n// Container\n// -----------------------------------------------------------------------------\n\n// Deliberately tighter than the room panels' 14px EDGE_INSET: the Predict card\n// floats in the opposite corner, so the extra 2px of breathing room buys nothing.\nconst PREDICT_INSET = 12;\n\nfunction getContainer(): HTMLElement {\n    if (container) return container;\n    container = document.createElement(\"div\");\n    container.id = PREDICT_CONTAINER_ID;\n    container.className = \"cds-surface\";\n    Object.assign(container.style, {\n        // Honor a session that hid the overlay — or a phone that hasn't revealed it —\n        // before Predict mounted.\n        display: isOverlayVisible() ? \"flex\" : \"none\",\n        flexDirection: \"column\",\n        gap: \"8px\",\n        fontFamily: \"monospace\",\n        fontSize: \"11px\",\n        color: \"#fff\",\n        pointerEvents: \"auto\",\n    });\n    positionPredictContainer(); // parents it, and owns everything positional\n    return container;\n}\n\n\n/**\n * Place the Predict overlay relative to the room panels, which own the corner\n * named by the `panelPosition` preference.\n *\n * Desktop floats it in the horizontally-opposite corner — two corners on the same\n * edge can't collide on a wide screen, and it preserves the historical top-left\n * look. Compact instead *reparents* it into the room-panel drawer as the last card,\n * so one scroll container holds everything. Anchoring it to the opposite edge only\n * worked while both stacks were collapsed; expanded, they meet in the middle.\n */\nexport function positionPredictContainer(): void {\n    if (!container) return;\n\n    const style = container.style;\n    const cards = container.querySelectorAll<HTMLElement>(\"[data-name]\");\n\n    if (isCompact()) {\n        const stack = getPanelStack();\n        if (container.parentNode !== stack) { stack.appendChild(container); }\n\n        // A flow child of the drawer: the drawer scrolls, anchors, and clips.\n        style.position = \"static\";\n        clearEdges(container);\n        style.width = \"auto\";\n        style.maxHeight = \"none\";\n        style.zIndex = \"\";\n        style.flexShrink = \"0\";\n        container.classList.remove(\"cds-scroll\");\n        for (const card of cards) { card.style.width = \"auto\"; }\n        return;\n    }\n\n    // parentNode, not parentElement: a ShadowRoot is not an Element, so a direct\n    // child of one reports a null parentElement and we'd re-append every reflow.\n    const root = getDebugRoot();\n    if (container.parentNode !== root) { root.appendChild(container); }\n\n    const position = preferences.panelPosition.position;\n    const vertical = verticalEdge(position);\n    const oppositeHorizontal = horizontalEdge(position) === \"right\" ? \"left\" : \"right\";\n\n    // Above any game HUD — the room panels settle for z-index 999, but Predict is\n    // read continuously while playing.\n    style.position = \"fixed\";\n    style.zIndex = \"2147483645\";\n    style.width = \"\";\n    style.flexShrink = \"\";\n    container.classList.add(\"cds-scroll\");\n\n    clearEdges(container);\n    setInset(container, vertical, PREDICT_INSET);\n    setInset(container, oppositeHorizontal, PREDICT_INSET);\n    setMaxViewportHeight(container, \"80vh\");\n\n    for (const card of cards) { card.style.width = CARD_WIDTH; }\n}\n\n// -----------------------------------------------------------------------------\n// Collapse state — persisted per instance for the session (like the hidden flag)\n// -----------------------------------------------------------------------------\n\nconst COLLAPSE_KEY = \"colyseus-debug-predict-collapsed\";\n// Which profiles have their tuning sliders open. Sub-cards are rebuilt whenever the\n// profile set changes, so an in-memory flag would evaporate under the 4 Hz poll.\nconst TUNING_KEY = \"colyseus-debug-predict-tuning\";\n\nfunction readSessionSet(storageKey: string): Set<string> {\n    try {\n        const arr = JSON.parse(sessionStorage.getItem(storageKey) || \"[]\");\n        return new Set(Array.isArray(arr) ? arr : []);\n    } catch {\n        return new Set();\n    }\n}\n\nfunction updateSessionSet(storageKey: string, member: string, present: boolean): void {\n    const set = readSessionSet(storageKey);\n    if (present) set.add(member);\n    else set.delete(member);\n    try {\n        sessionStorage.setItem(storageKey, JSON.stringify([...set]));\n    } catch {\n        // storage unavailable — ignore\n    }\n}\n\nconst readCollapsed = () => readSessionSet(COLLAPSE_KEY);\nconst setCollapsed = (name: string, collapsed: boolean) => updateSessionSet(COLLAPSE_KEY, name, collapsed);\n\n// -----------------------------------------------------------------------------\n// Mode pills (segmented buttons, styled like panel.ts action buttons)\n// -----------------------------------------------------------------------------\n\n// Instant tooltip — the native `title` attribute waits ~1s before showing.\nlet tooltipEl: HTMLElement | null = null;\n\nfunction getTooltip(): HTMLElement {\n    if (tooltipEl) return tooltipEl;\n    tooltipEl = document.createElement(\"div\");\n    tooltipEl.style.cssText =\n        \"position:fixed;z-index:2147483646;pointer-events:none;display:none;white-space:nowrap;\" +\n        \"background:rgba(0,0,0,0.95);color:#fff;font-family:monospace;font-size:10px;\" +\n        \"padding:3px 6px;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,0.5)\";\n    getDebugRoot().appendChild(tooltipEl);\n    return tooltipEl;\n}\n\nfunction showTooltip(text: string, anchor: HTMLElement): void {\n    const tip = getTooltip();\n    tip.textContent = text;\n    tip.style.display = \"block\";\n    const r = anchor.getBoundingClientRect(); // viewport coords — matches position:fixed\n    tip.style.left = `${r.left}px`;\n    tip.style.top = `${r.bottom + 4}px`;\n}\n\nfunction hideTooltip(): void {\n    if (tooltipEl) tooltipEl.style.display = \"none\";\n}\n\nfunction createPill(value: string, active: boolean, onClick: () => void): HTMLButtonElement {\n    const btn = document.createElement(\"button\");\n    btn.type = \"button\";\n    // Height-only target + flex share: five 44px-wide pills would wrap out of the card.\n    btn.className = \"cds-hit-y\";\n    btn.dataset.value = value;\n    btn.setAttribute(\"aria-label\", value);\n    btn.innerHTML = MODE_ICONS[value] ?? value;\n    btn.style.cssText =\n        \"flex:1;display:inline-flex;align-items:center;justify-content:center;padding:4px 6px;line-height:0;\" +\n        \"border:1px solid;border-radius:4px;cursor:pointer;transition:background .2s,border-color .2s\";\n    applySegmentedState(btn, active);\n    bindSegmentedHover(btn, () => {\n        // A tap fires mouseenter with no matching mouseleave, stranding the tooltip.\n        // It only names the icon — the pill's real job is selecting the mode.\n        if (!isCoarsePointer()) showTooltip(value, btn); // instant — names the icon on hover\n    }, hideTooltip);\n    btn.addEventListener(\"click\", (e) => {\n        e.stopPropagation();\n        onClick();\n    });\n    return btn;\n}\n\n/** Build a fresh row of mode pills; selecting one restyles its siblings then fires `onSelect`. */\nfunction renderModePills(host: HTMLElement, current: PredictMode, onSelect: (m: PredictMode) => void): void {\n    host.innerHTML = \"\";\n    for (const m of ALL_MODES) {\n        host.appendChild(createPill(m, m === current, () => {\n            for (const sib of host.querySelectorAll<HTMLElement>(\"button\")) {\n                applySegmentedState(sib, sib.dataset.value === m);\n            }\n            onSelect(m);\n        }));\n    }\n}\n\nfunction syncModePills(host: HTMLElement, current: PredictMode): void {\n    for (const pill of host.querySelectorAll<HTMLElement>(\"button\")) {\n        applySegmentedState(pill, pill.dataset.value === current);\n    }\n}\n\n// -----------------------------------------------------------------------------\n// Card rendering\n// -----------------------------------------------------------------------------\n\nfunction renderCard(handle: PredictDebugHandle): HTMLElement {\n    const card = document.createElement(\"div\");\n    card.dataset.name = handle.name;\n    card.style.cssText =\n        `width:${CARD_WIDTH};background:rgba(0,0,0,0.85);color:#fff;font-family:monospace;` +\n        \"font-size:11px;border-radius:6px;padding:8px;box-shadow:0 4px 12px rgba(0,0,0,0.5)\";\n    if (isCompact()) { card.style.width = \"auto\"; }\n\n    const collapsed = readCollapsed().has(handle.name);\n\n    // header (attached count + collapse chevron, stays visible when collapsed) / body\n    card.innerHTML = `\n        <div data-role=\"header\" class=\"cds-hit-y\" style=\"display:flex;align-items:center;justify-content:space-between;gap:8px;font-weight:bold;border-bottom:1px solid ${RULE};padding-bottom:4px;cursor:pointer;user-select:none\">\n            <span>Predict<span data-role=\"name\" style=\"color:${SECONDARY};font-weight:normal\"></span></span>\n            <span style=\"display:flex;align-items:center;gap:8px;font-weight:normal\">\n                <span data-role=\"attached\" title=\"attached instances\" style=\"color:${SECONDARY};font-variant-numeric:tabular-nums\"></span>\n                <span data-role=\"chevron\" style=\"color:${SECONDARY}\">${collapsed ? \"▸\" : \"▾\"}</span>\n            </span>\n        </div>\n        <div data-role=\"body\" style=\"display:${collapsed ? \"none\" : \"flex\"};flex-direction:column;gap:8px;margin-top:6px\">\n            <div data-role=\"reconcilers\" style=\"display:none;flex-direction:column;gap:6px\"></div>\n            <div data-role=\"profiles\" style=\"display:none;flex-direction:column;gap:6px\"></div>\n        </div>\n    `;\n\n    // Header name is set by syncHeaderNames() — shown only when >1 panel exists.\n    card.querySelector<HTMLElement>('[data-role=\"attached\"]')!.textContent = String(handle.attachedCount());\n\n    const header = card.querySelector<HTMLElement>('[data-role=\"header\"]')!;\n    const body = card.querySelector<HTMLElement>('[data-role=\"body\"]')!;\n    const chevron = card.querySelector<HTMLElement>('[data-role=\"chevron\"]')!;\n    header.addEventListener(\"click\", () => {\n        const nowCollapsed = body.style.display !== \"none\";\n        body.style.display = nowCollapsed ? \"none\" : \"flex\";\n        chevron.textContent = nowCollapsed ? \"▸\" : \"▾\";\n        setCollapsed(handle.name, nowCollapsed);\n    });\n\n    // No card-level \"defaults\" picker: per-attach-group profiles own every\n    // slot, so editing the defaults is inert for the common case. The defaults\n    // surface only as a sub-card, and only when something actually tracks it\n    // (see renderProfileSubcards).\n    renderProfileSubcards(card, handle);\n    return card;\n}\n\n/**\n * Render one sub-card per profile. Per-attach-group profiles always show; the\n * mutable defaults profile (#0) shows ONLY when something actually tracks it\n * (`fields.length > 0`) — i.e. only when editing it has an effect. With the\n * common `attachAll` usage every slot is group-owned, so the defaults stay\n * hidden. Sticky DOM: only rebuilds when the set of profile IDs changes,\n * otherwise patches text/value in place — keeps slider focus and avoids reflow\n * churn on the 4 Hz poll.\n */\nfunction renderProfileSubcards(card: HTMLElement, handle: PredictDebugHandle): void {\n    const host = card.querySelector<HTMLElement>('[data-role=\"profiles\"]')!;\n    const profiles = handle.profiles().filter((p) => !p.isDefault || p.fields.length > 0);\n    host.style.display = profiles.length ? \"flex\" : \"none\"; // no empty gap when none\n\n    const key = profiles.map((p) => p.id).join(\",\");\n    if (host.dataset.key !== key) {\n        host.dataset.key = key;\n        host.innerHTML = \"\";\n        for (const p of profiles) {\n            host.appendChild(buildProfileSubcard(handle, p));\n        }\n    } else {\n        // Same profile set — refresh per-profile sub-card state so slider\n        // values + mode pills reflect any mutations (e.g. another panel\n        // tweaking the same profile, or `setProfile` calls from code).\n        const nodes = host.children;\n        for (let i = 0; i < profiles.length; i++) {\n            refreshProfileSubcard(nodes[i] as HTMLElement, handle, profiles[i]);\n        }\n    }\n}\n\nfunction buildProfileSubcard(handle: PredictDebugHandle, p: ProfileInfo): HTMLElement {\n    const el = document.createElement(\"div\");\n    el.dataset.profileId = String(p.id);\n    el.dataset.tuneKey = `${handle.name}#${p.id}`;\n    el.style.cssText =\n        \"border-top:1px solid rgba(255,255,255,0.1);background:rgba(255,255,255,0.03);\" +\n        \"border-radius:4px;padding:6px;display:flex;flex-direction:column;gap:4px\";\n    el.innerHTML = `\n        <div data-role=\"fields\" style=\"font-size:10px;display:flex;align-items:baseline;gap:6px\">\n            <span data-role=\"cat\" style=\"color:#fff;font-weight:bold\"></span>\n            <span data-role=\"fieldnames\" style=\"color:${SECONDARY}\"></span>\n        </div>\n        <div data-role=\"modes\" style=\"display:flex;gap:4px;flex-wrap:wrap\"></div>\n        <button data-role=\"tune\" type=\"button\" class=\"cds-hit-y\" style=\"display:none;align-items:center;gap:5px;\n            width:100%;padding:3px 2px;border:none;border-radius:3px;background:none;color:${SECONDARY};\n            font-family:inherit;font-size:10px;text-align:left;cursor:pointer;\n            transition:background .15s,color .15s\">\n            <span data-role=\"tune-chevron\">▸</span><span data-role=\"tune-label\"></span>\n        </button>\n        <div data-role=\"sliders\" style=\"display:none;flex-direction:column;gap:3px\"></div>\n    `;\n\n    const modesEl = el.querySelector<HTMLElement>('[data-role=\"modes\"]')!;\n    renderModePills(modesEl, p.mode, (m) => {\n        try {\n            handle.setProfile(p.id, { mode: m });\n            renderProfileSliders(el, handle, p.id, m);\n        } catch (err) {\n            console.error(\"[predict-debug] setProfile failed:\", err);\n        }\n    });\n\n    const tune = el.querySelector<HTMLElement>('[data-role=\"tune\"]')!;\n    tune.addEventListener(\"mouseenter\", () => { tune.style.background = SEGMENT.background; tune.style.color = \"#fff\"; });\n    tune.addEventListener(\"mouseleave\", () => { tune.style.background = \"none\"; tune.style.color = SECONDARY; });\n    tune.addEventListener(\"click\", (e) => {\n        e.stopPropagation(); // never reaches the card header, which would collapse the card\n        const key = el.dataset.tuneKey!;\n        updateSessionSet(TUNING_KEY, key, !readSessionSet(TUNING_KEY).has(key));\n        syncTuning(el);\n    });\n\n    refreshProfileSubcard(el, handle, p);\n    return el;\n}\n\n\n/**\n * Show the sliders only when the profile has any, and only when the user asked.\n * Tuning is a rare, deliberate act; the sliders would otherwise triple the height of\n * every sub-card just to sit untouched.\n */\nfunction syncTuning(subcard: HTMLElement): void {\n    const sliders = subcard.querySelector<HTMLElement>('[data-role=\"sliders\"]')!;\n    const tune = subcard.querySelector<HTMLElement>('[data-role=\"tune\"]')!;\n    const chevron = subcard.querySelector<HTMLElement>('[data-role=\"tune-chevron\"]')!;\n    const label = subcard.querySelector<HTMLElement>('[data-role=\"tune-label\"]')!;\n\n    const count = sliders.children.length;\n    if (count === 0) {\n        // `reckon` and `raw` take no parameters — no affordance for an empty drawer.\n        tune.style.display = \"none\";\n        sliders.style.display = \"none\";\n        return;\n    }\n\n    const expanded = readSessionSet(TUNING_KEY).has(subcard.dataset.tuneKey!);\n    tune.style.display = \"flex\";\n    chevron.textContent = expanded ? \"▾\" : \"▸\";\n    label.textContent = `${count} parameter${count === 1 ? \"\" : \"s\"}`;\n    sliders.style.display = expanded ? \"flex\" : \"none\";\n}\n\nfunction refreshProfileSubcard(el: HTMLElement, handle: PredictDebugHandle, p: ProfileInfo): void {\n    // Category (attach-group label) + the fields it covers, e.g. \"enemies · x, y, vx\".\n    const catEl = el.querySelector<HTMLElement>('[data-role=\"cat\"]')!;\n    const namesEl = el.querySelector<HTMLElement>('[data-role=\"fieldnames\"]')!;\n    catEl.textContent = p.label ? `${p.label} ·` : (p.isDefault ? \"default ·\" : \"\");\n    namesEl.textContent = p.fields.length === 0 ? \"(no fields)\" : p.fields.join(\", \");\n\n    syncModePills(el.querySelector<HTMLElement>('[data-role=\"modes\"]')!, p.mode);\n\n    // Re-render sliders only when the mode changed, otherwise patch in place\n    // so user-dragged sliders don't snap back on the poll cycle.\n    const slidersEl = el.querySelector<HTMLElement>('[data-role=\"sliders\"]')!;\n    if (slidersEl.dataset.mode !== p.mode) {\n        renderProfileSliders(el, handle, p.id, p.mode);\n    }\n}\n\nfunction renderProfileSliders(subcard: HTMLElement, handle: PredictDebugHandle, id: number, mode: PredictMode): void {\n    const slidersEl = subcard.querySelector<HTMLElement>('[data-role=\"sliders\"]')!;\n    slidersEl.dataset.mode = mode;\n    slidersEl.innerHTML = \"\";\n    const p = handle.profiles().find((x) => x.id === id);\n    if (!p) { syncTuning(subcard); return; }\n    if (mode === \"lerp\") {\n        addSlider(slidersEl, \"delay (ms)\", 0, 300, p.delay, (v) =>\n            handle.setProfile(id, { delay: v }));\n        addSlider(slidersEl, \"tickInterval (ms, 0=off)\", 0, 100, p.tickInterval ?? 0, (v) =>\n            handle.setProfile(id, { tickInterval: v }));\n        addSlider(slidersEl, \"smoothMs (0=off)\", 0, 300, p.smoothMs, (v) =>\n            handle.setProfile(id, { smoothMs: v }));\n    } else if (mode === \"extrapolate\") {\n        addSlider(slidersEl, \"maxExtrapolate (ms)\", 0, 300, p.maxExtrapolate, (v) =>\n            handle.setProfile(id, { maxExtrapolate: v }));\n        addSlider(slidersEl, \"tickInterval (ms, 0=off)\", 0, 100, p.tickInterval ?? 0, (v) =>\n            handle.setProfile(id, { tickInterval: v }));\n        addSlider(slidersEl, \"smoothMs (0=off)\", 0, 300, p.smoothMs, (v) =>\n            handle.setProfile(id, { smoothMs: v }));\n    } else if (mode === \"damped\") {\n        addSlider(slidersEl, \"smoothMs (0=snap)\", 0, 300, p.smoothMs, (v) =>\n            handle.setProfile(id, { smoothMs: v }));\n    }\n    if (mode === \"lerp\" || mode === \"extrapolate\" || mode === \"damped\") {\n        // Value units are game-specific — widen the range to fit the config.\n        const snap = p.snap ?? 0;\n        addSlider(slidersEl, \"snap (units, 0=off)\", 0, Math.max(20, Math.ceil(snap * 2)), snap, (v) =>\n            handle.setProfile(id, { snap: v }));\n    }\n\n    // The parameter count is mode-specific, so the toggle re-labels on every switch.\n    syncTuning(subcard);\n}\n\n// -----------------------------------------------------------------------------\n// Mode-specific slider rendering\n// -----------------------------------------------------------------------------\n\nfunction addSlider(\n    parent: HTMLElement,\n    label: string,\n    min: number,\n    max: number,\n    initial: number,\n    onChange: (value: number) => void,\n): void {\n    // Two lines: label + value on top, full-width track below — long labels can\n    // never push the value readout past the card edge.\n    const row = document.createElement(\"label\");\n    row.style.cssText = `display:flex;flex-direction:column;gap:2px;font-size:10px;color:${SECONDARY}`;\n    row.innerHTML = `\n        <div style=\"display:flex;justify-content:space-between;align-items:baseline;gap:6px\">\n            <span>${label}</span>\n            <span data-role=\"val\" style=\"color:#fff;font-variant-numeric:tabular-nums\"></span>\n        </div>\n        <input type=\"range\" min=\"${min}\" max=\"${max}\" value=\"${initial}\" style=\"width:100%;margin:0;accent-color:#fff\"/>\n    `;\n    const input = row.querySelector<HTMLInputElement>(\"input\")!;\n    const num = row.querySelector<HTMLElement>('[data-role=\"val\"]')!;\n    num.textContent = String(initial);\n    input.addEventListener(\"input\", () => {\n        const v = Number(input.value);\n        num.textContent = String(v);\n        try {\n            onChange(v);\n        } catch (err) {\n            console.error(\"[predict-debug] slider update failed:\", err);\n        }\n    });\n    parent.appendChild(row);\n}\n\n// -----------------------------------------------------------------------------\n// Live polling\n// -----------------------------------------------------------------------------\n\nfunction updateCardLive(handle: PredictDebugHandle, entry: PredictPanelEntry): void {\n    entry.el.querySelector<HTMLElement>('[data-role=\"attached\"]')!.textContent =\n        String(handle.attachedCount());\n    renderReconcilers(entry, handle);\n    renderProfileSubcards(entry.el, handle);\n}\n\n// -----------------------------------------------------------------------------\n// Reconciler drift (divergence vs jitter)\n// -----------------------------------------------------------------------------\n\n/** Drift-EMA samples kept per reconciler for the canvas graph (4 Hz poll). */\nconst GRAPH_LEN = 64;\nconst GRAPH_W = 200;\nconst GRAPH_H = 30;\n\nfunction fmtDrift(v: number): string {\n    if (v < 1e-3) { return \"0\"; }            // below any status floor — float noise\n    if (v < 1) { return v.toFixed(3); }      // keep small REAL drift legible (0.003)\n    if (v < 10) { return v.toFixed(2); }\n    return v.toFixed(1);\n}\n\n// Status → glanceable word, colour, and the one-line action a developer takes.\n// The whole point of the panel: not \"drift 0.42\" but \"here's what it means and\n// what to do\". (Mirrors classifyDrift + the warnOnDivergence message.)\nconst STATUS: Record<string, { word: string; color: string; action: string }> = {\n    matched:   { word: \"✓ matched\",   color: \"#6c9\", action: \"\" },\n    jitter:    { word: \"~ jitter\",    color: \"#dc7\", action: \"transient spikes (packet loss / reorder) — raise smoothMs or ignore; not a bug\" },\n    diverging: { word: \"✗ diverging\", color: \"#e66\", action: \"client/server sim disagree — check dt · shared step · constants · skipped inputs\" },\n};\n\n/** Stable canvas id per reconciler row (Predict name + index), so `drawGraph`'s\n *  `getElementById` resolves it within the debug shadow root. */\nfunction graphId(name: string, i: number): string {\n    return `predict-rc-graph-${name.replace(/[^a-z0-9]/gi, \"-\")}-${i}`;\n}\n\nfunction renderReconcilers(entry: PredictPanelEntry, handle: PredictDebugHandle): void {\n    const host = entry.el.querySelector<HTMLElement>('[data-role=\"reconcilers\"]')!;\n    const stats = handle.reconcilers();\n    if (stats.length === 0) { host.style.display = \"none\"; return; }\n    host.style.display = \"flex\";\n    // Rebuild rows only when the reconciler count changes (cheap steady state).\n    if (host.childElementCount !== stats.length) {\n        host.innerHTML = \"\";\n        for (let i = 0; i < stats.length; i++) { host.appendChild(buildReconcilerRow(graphId(handle.name, i))); }\n    }\n    for (let i = 0; i < stats.length; i++) {\n        refreshReconcilerRow(host.children[i] as HTMLElement, stats[i], entry, graphId(handle.name, i));\n    }\n}\n\nfunction buildReconcilerRow(canvasId: string): HTMLElement {\n    const row = document.createElement(\"div\");\n    // Distinct from the smoothing-profile sub-cards: a status-coloured LEFT\n    // accent (recoloured each refresh) marks this as the prediction-health card,\n    // not another smoothing profile.\n    row.style.cssText =\n        `border:1px solid ${RULE};border-left:3px solid ${SECONDARY};` +\n        \"background:rgba(255,255,255,0.04);border-radius:4px;padding:6px;\" +\n        \"display:flex;flex-direction:column;gap:4px\";\n    row.innerHTML = `\n        <div style=\"display:flex;justify-content:space-between;align-items:center;gap:6px\">\n            <span data-role=\"rc-label\" style=\"color:#fff;font-weight:bold\"></span>\n            <span data-role=\"rc-status\" style=\"font-weight:bold;white-space:nowrap\"></span>\n        </div>\n        <canvas id=\"${canvasId}\" width=\"${GRAPH_W}\" height=\"${GRAPH_H}\" title=\"drift peak over time (auto-scaled; flat when matched)\" style=\"display:block;width:100%;height:${GRAPH_H}px\"></canvas>\n        <div data-role=\"rc-action\" style=\"font-size:10px;line-height:1.3\"></div>\n        <div data-role=\"rc-stats\" style=\"color:${SECONDARY};font-size:10px;font-variant-numeric:tabular-nums\"></div>\n    `;\n    return row;\n}\n\nfunction refreshReconcilerRow(row: HTMLElement, stat: ReconcilerStat, entry: PredictPanelEntry, canvasId: string): void {\n    let hist = entry.histories.get(stat.label);\n    if (!hist) { hist = []; entry.histories.set(stat.label, hist); }\n    // Plot the drift PEAK (spikes for jitter, level for divergence), pinned to 0\n    // when matched. `drawGraph` auto-scales to its own min/max, so feeding it the\n    // matched-state EMA amplified float-noise into wild oscillation while the\n    // numbers read \"0\". Pinning to 0 keeps the line flat at rest — and non-matched\n    // peaks are always ≥ the status floor, so they're real, not noise.\n    hist.push(stat.status === \"matched\" ? 0 : stat.peak);\n    if (hist.length > GRAPH_LEN) { hist.shift(); }\n\n    const v = STATUS[stat.status] ?? STATUS.matched;\n    const sev = stat.status === \"diverging\" && stat.severity !== undefined\n        ? `  ${stat.severity.toFixed(1)}× tol` : \"\";\n\n    row.style.borderLeftColor = v.color;\n    row.querySelector<HTMLElement>('[data-role=\"rc-label\"]')!.textContent = stat.label;\n    const statusEl = row.querySelector<HTMLElement>('[data-role=\"rc-status\"]')!;\n    statusEl.style.color = v.color;\n    statusEl.textContent = `${v.word}${sev}`;\n\n    // Reuse the shared canvas line-graph renderer (same as bytes/messages-per-sec).\n    drawGraph(canvasId, hist, v.color);\n\n    const action = row.querySelector<HTMLElement>('[data-role=\"rc-action\"]')!;\n    action.style.display = v.action ? \"block\" : \"none\";   // matched ⇒ no action line\n    action.style.color = v.color;\n    action.textContent = v.action;\n\n    row.querySelector<HTMLElement>('[data-role=\"rc-stats\"]')!.textContent =\n        `drift ${fmtDrift(stat.ema)} · pk ${fmtDrift(stat.peak)} · Δ ${fmtDrift(stat.lastCorrectionMag)}`;\n}\n\nfunction startPolling(): void {\n    if (pollInterval !== null) return;\n    pollInterval = setInterval(() => {\n        for (const entry of panels.values()) entry.refresh();\n    }, POLL_MS);\n}\n\nfunction stopPolling(): void {\n    if (pollInterval === null) return;\n    clearInterval(pollInterval);\n    pollInterval = null;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAuBH,MAAM,MAAM,GAAG,IAAI,GAAG,EAA6B;AACnD,IAAI,SAAS,GAAuB,IAAI;AACx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