{"version":3,"file":"core.mjs","sources":["../../src/debug/core.ts"],"sourcesContent":["import type { Auth } from \"../Auth.ts\";\nimport { clearEdges, EDGE_INSET, horizontalEdge, setInset, setMaxViewportHeight, verticalEdge, type HorizontalEdge, type VerticalEdge } from \"./geometry.ts\";\nimport { isCompact } from \"./layout.ts\";\nimport { injectBaseStyles } from \"./styles.ts\";\n\n// Store debug info per room\nexport const roomDebugInfo = new Map();\n\n// Distance from the logo to whatever sits beside it. The logo is 21px + 10px padding\n// + 3px border on each side = 47px.\nconst LOGO_CLEARANCE = 48;\n// The compact drawer passes directly under the logo rather than beside it, so it\n// wants a little more air than the 1px the desktop row gets away with.\nconst COMPACT_LOGO_CLEARANCE = 56;\nconst MENU_OFFSET = 60;\n\n// Compact surfaces span the viewport on a phone but stop widening past this. A\n// full-width 844px landscape sheet stretches four preset buttons to 200px each, and\n// the drawer's stats end up marooned at one edge of an empty panel.\nconst COMPACT_MAX_WIDTH = 520;\n\n// Live `client.auth` instances seen via matchmake calls (see debug.ts). Lets the\n// \"Clear auth token\" menu action null the in-memory token, not just storage.\nexport const authInstances = new Set<Auth>();\n\n\n// Preferences state\nexport const preferences = {\n    maxLatency: 350, // milliseconds\n    latencySimulation: {\n        enabled: false,\n        delay: 0, // milliseconds (one-way inbound; outbound uses half)\n        jitter: 0, // milliseconds — per-message delay varies by ±jitter (order-preserving)\n    },\n    panelPosition: {\n        position: 'top-right' // 'bottom-right', 'bottom-left', 'top-left', 'top-right'\n    }\n};\n\n\n// Load preferences from localStorage (hidden state from sessionStorage)\nexport function loadPreferences() {\n    try {\n        const savedPrefs = localStorage.getItem('colyseus-debug-preferences') || '{}';\n        const prefs = JSON.parse(savedPrefs);\n\n        // Load position\n        if (prefs.position && ['bottom-right', 'bottom-left', 'top-left', 'top-right'].includes(prefs.position)) {\n            preferences.panelPosition.position = prefs.position;\n        }\n\n        // Load latency\n        if (prefs.latency !== undefined && prefs.latency !== null) {\n            const latencyValue = parseInt(prefs.latency, 10);\n            if (!isNaN(latencyValue) && latencyValue >= 0 && latencyValue <= 500) {\n                preferences.latencySimulation.delay = latencyValue;\n                preferences.latencySimulation.enabled = latencyValue > 0;\n            }\n        }\n\n        // Load jitter\n        if (prefs.jitter !== undefined && prefs.jitter !== null) {\n            const jitterValue = parseInt(prefs.jitter, 10);\n            if (!isNaN(jitterValue) && jitterValue >= 0) {\n                preferences.latencySimulation.jitter = jitterValue;\n                if (jitterValue > 0) preferences.latencySimulation.enabled = true;\n            }\n        }\n\n        // Load hidden state from sessionStorage\n        if (sessionStorage.getItem('colyseus-debug-hidden') === 'true') {\n            panelsHidden = true;\n        }\n    } catch (e) {\n        // Storage might not be available or JSON parse failed, ignore\n    }\n}\n\n\n// Save preferences to localStorage (hidden state to sessionStorage)\nexport function savePreferences() {\n    try {\n        localStorage.setItem('colyseus-debug-preferences', JSON.stringify({\n            position: preferences.panelPosition.position,\n            latency: preferences.latencySimulation.delay,\n            jitter: preferences.latencySimulation.jitter,\n        }));\n        sessionStorage.setItem('colyseus-debug-hidden', panelsHidden ? 'true' : 'false');\n    } catch (e) {\n        // Storage might not be available, ignore\n    }\n}\n\n\n// Panel visibility state\nlet panelsHidden = false;\n\n// On a phone the room panels and the Predict overlay would sit on top of the game\n// from the moment it loads, so they stay closed until the logo is tapped. Not\n// persisted: a reload starts clean, which is what you want when the overlay is\n// covering the thing you are trying to look at.\nlet compactRevealed = false;\n\n// The compact menu takes over the drawer's box rather than stacking on top of it.\nlet compactMenuOpen = false;\n\n\n// Shadow DOM root — isolates all debug UI from page-level CSS.\n// Every SDK element is appended here so page rules like `canvas { width: 100vw }`\n// can't reach (or stretch) the debug panel's sparklines, logo, menu, or modals.\nlet _debugShadowRoot: ShadowRoot | null = null;\n\nexport function getDebugRoot(): ShadowRoot {\n    if (_debugShadowRoot) return _debugShadowRoot;\n    const host = document.createElement('div');\n    host.id = 'colyseus-debug-shadow-host';\n\n    // A tap on the overlay must not also drive the game. Games listen for\n    // `pointerdown`/`touchstart` on window/document, and our handlers only ever\n    // stopped `click`. Start events only: swallowing `pointerup` would strand an\n    // in-flight drag whose move/up listeners live on `document`. Never\n    // preventDefault here — that kills slider thumbs and scrolling.\n    // Limit: a game listening in the CAPTURE phase still sees these, since capture\n    // runs before the target and nothing downstream can suppress it.\n    ['pointerdown', 'touchstart', 'mousedown'].forEach(function(type) {\n        host.addEventListener(type, function(e) { e.stopPropagation(); });\n    });\n\n    _debugShadowRoot = host.attachShadow({ mode: 'open' });\n    injectBaseStyles(_debugShadowRoot);\n    document.body.appendChild(host);\n    return _debugShadowRoot;\n}\n\n\n/** The corner the `panelPosition` preference currently names. */\nfunction anchorEdges(): { vertical: VerticalEdge; horizontal: HorizontalEdge } {\n    const position = preferences.panelPosition.position;\n    return { vertical: verticalEdge(position), horizontal: horizontalEdge(position) };\n}\n\n\n/**\n * The latency ramp: green (0) → yellow (half of `maxLatency`) → red (max).\n *\n * Drives both the logo's border ring and the network sliders' track gradient, which\n * must agree — a slider that reads amber above a green ring is just confusing.\n */\nexport function latencyRamp(value: number, max: number): { r: number; g: number; b: number } {\n    const percentage = max > 0 ? value / max : 0;\n    if (percentage <= 0.5) {\n        return { r: Math.round(percentage * 2 * 200), g: 200, b: 0 };\n    }\n    return { r: 200, g: Math.round((1 - (percentage - 0.5) * 2) * 200), b: 0 };\n}\n\n// Function to get border color based on latency simulation value\nexport function getBorderColor(latencyValue, opacity) {\n    var c = latencyRamp(latencyValue, preferences.maxLatency);\n    return 'rgba(' + c.r + ', ' + c.g + ', ' + c.b + ', ' + opacity + ')';\n}\n\n\n// Apply panel position based on current setting\nexport function applyPanelPosition() {\n    if (panelsHidden) return; // nothing mounted — don't force the shadow root into existence\n\n    var root = getDebugRoot();\n    var logoContainer = root.getElementById('debug-logo-container') as HTMLElement;\n    var menu = root.getElementById('debug-menu') as HTMLElement;\n\n    var edges = anchorEdges();\n    var vertical = edges.vertical;\n    var horizontal = edges.horizontal;\n\n    if (logoContainer) {\n        clearEdges(logoContainer);\n        setInset(logoContainer, vertical, EDGE_INSET);\n        setInset(logoContainer, horizontal, EDGE_INSET);\n    }\n\n    if (menu) { applyMenuPosition(menu, vertical, horizontal); }\n\n    repositionDebugPanels();\n    applyOverlayVisibility(); // crossing into/out of compact changes what's on screen\n}\n\n\n/**\n * The one box every compact surface occupies: hanging off the logo's edge, capped\n * at {@link COMPACT_MAX_WIDTH}, height-capped to the viewport, scrolling inside.\n *\n * The room drawer and the menu share it, and never appear at once — holding the\n * logo swaps one for the other in place.\n */\nfunction applyCompactBox(el: HTMLElement, vertical: 'top' | 'bottom', horizontal: 'left' | 'right') {\n    setInset(el, 'left', EDGE_INSET);\n    setInset(el, 'right', EDGE_INSET);\n    setInset(el, vertical, EDGE_INSET, COMPACT_LOGO_CLEARANCE);\n\n    // Both edges are pinned, so max-width leaves slack; the auto margin spends it all\n    // on one side, parking the box under the logo instead of centering it.\n    el.style.maxWidth = COMPACT_MAX_WIDTH + 'px';\n    el.style.marginLeft = (horizontal === 'right') ? 'auto' : '0';\n    el.style.marginRight = (horizontal === 'right') ? '0' : 'auto';\n\n    var reserved = EDGE_INSET + COMPACT_LOGO_CLEARANCE + EDGE_INSET;\n    setMaxViewportHeight(el, `calc(100vh - ${reserved}px)`);\n}\n\nfunction clearCompactBox(el: HTMLElement) {\n    el.style.maxWidth = '';\n    el.style.marginLeft = '';\n    el.style.marginRight = '';\n    el.style.maxHeight = '';\n}\n\n\n// A corner-anchored dropdown on desktop; on a phone it takes over the room drawer's\n// box, hanging off the logo. Either way it is capped to the viewport and scrolls: a\n// short window used to clip the auth section off the bottom with no way to reach it.\nfunction applyMenuPosition(menu: HTMLElement, vertical: 'top' | 'bottom', horizontal: 'left' | 'right') {\n    clearEdges(menu);\n\n    // Only the block axis scrolls: a horizontal scrollbar here would mean a control\n    // has overflowed, and hiding it is the lesser evil.\n    menu.style.overflowX = 'hidden';\n    menu.style.overflowY = 'auto';\n    menu.style.borderRadius = '8px';\n\n    if (isCompact()) {\n        applyCompactBox(menu, vertical, horizontal);\n        menu.style.minWidth = '0';\n    } else {\n        clearCompactBox(menu);\n        setInset(menu, horizontal, EDGE_INSET);\n        menu.style[vertical] = MENU_OFFSET + 'px';\n        // Pinned, not just floored: the menu shrink-to-fits, so a long unwrapped line\n        // (the \"remove debug.js\" hint) would otherwise stretch it well past 226.\n        menu.style.minWidth = '226px'; // 224 content + the 1px border on each side\n        menu.style.maxWidth = '226px';\n        setMaxViewportHeight(menu, `calc(100vh - ${MENU_OFFSET + EDGE_INSET}px)`);\n    }\n}\n\n\nexport const PREDICT_CONTAINER_ID = 'colyseus-debug-predict-container';\n\n/** True when the room panels + Predict overlay should be on screen right now. */\nexport function isOverlayVisible(): boolean {\n    if (panelsHidden) return false;\n    if (!isCompact()) return true;\n    // The compact menu occupies the drawer's box, so the two can't share the screen.\n    return compactRevealed && !compactMenuOpen;\n}\n\nexport function isCompactRevealed(): boolean { return compactRevealed; }\n\n/** Show/hide the compact overlay content. The logo itself always stays put. */\nexport function setCompactRevealed(revealed: boolean) {\n    compactRevealed = revealed;\n    applyOverlayVisibility();\n}\n\n/** The menu is opening or closing — on compact it displaces the drawer. */\nexport function setCompactMenuOpen(open: boolean) {\n    compactMenuOpen = open;\n    applyOverlayVisibility();\n}\n\n// Both surfaces share one visibility rule. In compact the Predict card is a child of\n// the stack, so hiding the stack already hides it — setting it too keeps the desktop\n// case (where Predict floats free) on the same code path.\nexport function applyOverlayVisibility() {\n    var root = getDebugRoot();\n    var display = isOverlayVisible() ? 'flex' : 'none';\n    var stack = root.getElementById(PANEL_STACK_ID);\n    var predictContainer = root.getElementById(PREDICT_CONTAINER_ID);\n    if (stack) { stack.style.display = display; }\n    if (predictContainer) { predictContainer.style.display = display; }\n}\n\n\n// Hide panels for this session\nexport function hidePanelsForSession() {\n    panelsHidden = true;\n    savePreferences(); // Save the hidden state\n\n    var root = getDebugRoot();\n    var logoContainer = root.getElementById('debug-logo-container');\n    var menu = root.getElementById('debug-menu');\n    var stack = root.getElementById(PANEL_STACK_ID);\n    var predictContainer = root.getElementById(PREDICT_CONTAINER_ID);\n\n    if (logoContainer) {\n        logoContainer.style.display = 'none';\n    }\n    if (menu) {\n        menu.style.display = 'none';\n    }\n    if (stack) {\n        stack.style.display = 'none';\n    }\n    // Predict panel is a sibling overlay (own id) — hide it alongside the rest.\n    if (predictContainer) {\n        predictContainer.style.display = 'none';\n    }\n}\n\n\n// Helper function to format bytes\nexport function formatBytes(bytes) {\n    if (!bytes) {\n        return '0 B';\n    } else if (bytes < 1) {\n        bytes = 1; // avoid visual glitches\n    }\n    var k = 1024;\n    var sizes = ['B', 'KB', 'MB', 'GB'];\n    var i = Math.floor(Math.log(bytes) / Math.log(k));\n    return (Math.round(bytes) / Math.pow(k, i)).toFixed(1)  + ' ' + sizes[i];\n}\n\n\n// Every room panel lives in one flex container rather than being individually\n// positioned. Panel heights change constantly — updateDebugPanel() rewrites the\n// stats markup every second and the jitter row comes and goes — so a JS-accumulated\n// offset stack would drift. Flex resolves the layout for free.\nconst PANEL_STACK_ID = 'colyseus-debug-panel-stack';\n\nexport function getPanelStack(): HTMLElement {\n    var root = getDebugRoot();\n    var stack = root.getElementById(PANEL_STACK_ID) as HTMLElement;\n    if (stack) { return stack; }\n\n    stack = document.createElement('div');\n    stack.id = PANEL_STACK_ID;\n    stack.style.position = 'fixed';\n    stack.style.display = isOverlayVisible() ? 'flex' : 'none';\n    stack.style.gap = '6px';\n    stack.style.zIndex = '999';\n    stack.style.pointerEvents = 'none'; // gaps between panels stay clickable in the game\n    root.appendChild(stack);\n    repositionDebugPanels();\n    return stack;\n}\n\n\n/**\n * Anchor the stack and pick its axis.\n *\n * Desktop keeps the historical row along the anchored edge, with Predict floating\n * in the opposite corner. Compact turns the stack into a **drawer**: one full-width\n * scrollable column that also adopts the Predict card (see positionPredictContainer).\n * Two fixed stacks growing toward each other from opposite edges only worked while\n * both were collapsed — expanded, they meet in the middle of a short screen.\n *\n * Either way the first child (oldest panel) sits nearest the anchor corner.\n */\nexport function repositionDebugPanels() {\n    if (panelsHidden) return;\n\n    var stack = getDebugRoot().getElementById(PANEL_STACK_ID) as HTMLElement;\n    if (!stack) return;\n\n    var edges = anchorEdges();\n    var vertical = edges.vertical;\n    var horizontal = edges.horizontal;\n    clearEdges(stack);\n\n    if (isCompact()) {\n        stack.style.flexDirection = (vertical === 'bottom') ? 'column-reverse' : 'column';\n        stack.style.alignItems = 'stretch';\n        stack.style.pointerEvents = 'auto'; // the drawer is a surface, and it scrolls\n        stack.classList.add('cds-scroll');\n        applyCompactBox(stack, vertical, horizontal);\n    } else {\n        stack.style.flexDirection = (horizontal === 'right') ? 'row-reverse' : 'row';\n        stack.style.alignItems = (vertical === 'top') ? 'flex-start' : 'flex-end';\n        stack.style.pointerEvents = 'none'; // gaps between panels stay clickable in the game\n        stack.classList.remove('cds-scroll');\n        stack.style.overflowY = '';\n        clearCompactBox(stack);\n        setInset(stack, vertical, EDGE_INSET);\n        setInset(stack, horizontal, EDGE_INSET, LOGO_CLEARANCE);\n    }\n}\n\nexport function isPanelsHidden(): boolean { return panelsHidden; }\n"],"names":[],"mappings":";;;;;;;;;;AAKA;AACO,MAAM,aAAa,GAAG,IAAI,GAAG;AAEpC;AACA;AACA,MAAM,cAAc,GAAG,EAAE;AACzB;AACA;AACA,MAAM,sBAAsB,GAAG,EAAE;AACjC,MAAM,WAAW,GAAG,EAAE;AAEtB;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,GAAG;AAE7B;AACA;AACO,MAAM,aAAa,GAAG,IAAI,GAAG;AAGpC;AACO,MAAM,WAAW,GAAG;IACvB,UAAU,EAAE,GAAG;AACf,IAAA,iBAAiB,EAAE;AACf,QAAA,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;AACZ,KAAA;AACD,IAAA,aAAa,EAAE;QACX,QAAQ,EAAE,WAAW;AACxB;;AAIL;SACgB,eAAe,GAAA;AAC3B,IAAA,IAAI;QACA,MAAM,UAAU,GAAG,YAAY,CAAC,O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