Confluencia-3.0/docs/sequence_flow.html

docs / sequence_flow.html

docs/sequence_flow.html · 23.5 KB

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Confluencia 3.0 — 序列数据流追踪</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
            background: linear-gradient(135deg, #0f0c29 0%, #1a1a2e 50%, #16213e 100%);
            color: #e0e0e0;
            min-height: 100vh;
            overflow-x: hidden;
        }
        h1 { text-align: center; padding: 20px 0 5px; font-weight: 300; letter-spacing: 1px; }
        .subtitle { text-align: center; color: #888; margin-bottom: 20px; font-size: 13px; }

        .input-bar {
            max-width: 900px;
            margin: 0 auto 25px;
            padding: 0 20px;
            display: flex;
            gap: 10px;
            align-items: stretch;
        }
        .seq-input {
            flex: 1;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 8px;
            color: #e0e0e0;
            padding: 12px 16px;
            font-family: 'Consolas', 'Courier New', monospace;
            font-size: 13px;
            outline: none;
            transition: border-color 0.2s;
        }
        .seq-input:focus { border-color: #63b3ed; }
        .seq-input::placeholder { color: #555; }
        .run-btn {
            background: linear-gradient(135deg, #667eea, #764ba2);
            border: none;
            color: white;
            padding: 0 28px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            transition: opacity 0.2s, transform 0.1s;
            white-space: nowrap;
        }
        .run-btn:hover { opacity: 0.9; }
        .run-btn:active { transform: scale(0.97); }
        .run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        .example-btn {
            background: rgba(255,255,255,0.08);
            border: 1px solid rgba(255,255,255,0.15);
            color: #a0aec0;
            padding: 0 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            white-space: nowrap;
        }
        .example-btn:hover { background: rgba(255,255,255,0.15); }

        .status-bar {
            max-width: 900px;
            margin: 0 auto 15px;
            padding: 0 20px;
            font-size: 13px;
            color: #a0aec0;
            min-height: 20px;
        }
        .status-bar.error { color: #fc8181; }
        .status-bar.success { color: #68d391; }

        .canvas-wrap {
            position: relative;
            width: 100%;
            height: 65vh;
            min-height: 480px;
        }
        svg.flow-svg { width: 100%; height: 100%; display: block; }

        .event-list {
            max-width: 900px;
            margin: 20px auto 40px;
            padding: 0 20px;
        }
        .event-list h3 {
            font-size: 14px;
            color: #a0aec0;
            margin-bottom: 12px;
            font-weight: 500;
        }
        .event-row {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px 14px;
            background: rgba(255,255,255,0.03);
            border-left: 3px solid #4a5568;
            border-radius: 4px;
            margin-bottom: 6px;
            font-size: 12px;
            font-family: 'Consolas', monospace;
            opacity: 0.4;
            transition: all 0.3s;
        }
        .event-row.played { opacity: 1; border-left-color: #63b3ed; background: rgba(99,179,237,0.08); }
        .event-row.current { border-left-color: #fbbf24; background: rgba(251,191,36,0.12); transform: translateX(4px); }
        .event-idx { color: #718096; min-width: 30px; }
        .event-type { color: #63b3ed; min-width: 200px; }
        .event-source { color: #a0aec0; }
        .event-data { color: #68d391; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

        .state-panel {
            max-width: 900px;
            margin: 0 auto 40px;
            padding: 20px;
            background: rgba(255,255,255,0.03);
            border-radius: 8px;
        }
        .state-panel h3 { font-size: 14px; color: #a0aec0; margin-bottom: 12px; }
        .state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
        .state-item {
            font-family: 'Consolas', monospace;
            font-size: 11px;
            padding: 6px 10px;
            background: rgba(99,179,237,0.06);
            border-radius: 4px;
            border-left: 2px solid #63b3ed;
        }
        .state-key { color: #a0aec0; }
        .state-val { color: #68d391; float: right; }

        .controls { position: fixed; bottom: 20px; right: 20px; display: flex; gap: 8px; z-index: 50; }
        .btn {
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            color: #e0e0e0;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
        }
        .btn:hover { background: rgba(255,255,255,0.2); }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; }

        @keyframes flowDot {
            0% { offset-distance: 0%; opacity: 0; }
            10% { opacity: 1; }
            90% { opacity: 1; }
            100% { offset-distance: 100%; opacity: 0; }
        }
        .flow-dot { fill: #fbbf24; filter: drop-shadow(0 0 4px #fbbf24); }
        .flow-line { stroke: #4a5568; stroke-width: 1.5; fill: none; opacity: 0.3; }
        .flow-line.active { stroke: #63b3ed; opacity: 0.8; stroke-width: 2; }
    </style>
</head>
<body>
    <h1>Confluencia 3.0 — 序列数据流追踪</h1>
    <p class="subtitle">输入 circRNA 序列 → 观察事件在各插件间流动 → 查看 circRNA 状态输出</p>

    <div class="input-bar">
        <select class="seq-input" id="seqSelect" style="font-family:inherit;font-size:13px;">
            <option value="0">示例A (50nt, 平衡)</option>
            <option value="1">示例B (51nt, 高GC)</option>
            <option value="2">示例C (50nt, G-quad倾向)</option>
        </select>
        <button class="run-btn" id="runBtn" onclick="loadTrace()">加载追踪</button>
    </div>

    <div class="status-bar" id="statusBar">准备就绪 — 点"运行追踪"开始</div>

    <div class="canvas-wrap">
        <svg class="flow-svg" id="flowSvg"></svg>
    </div>

    <div class="event-list">
        <h3>事件流时序 (<span id="eventCount">0</span> 条)</h3>
        <div id="eventList"></div>
    </div>

    <div class="state-panel" id="statePanel" style="display:none;">
        <h3>circRNA 状态输出 (crna_* 键)</h3>
        <div class="state-grid" id="stateGrid"></div>
    </div>

    <div class="controls">
        <button class="btn" id="replayBtn" onclick="replay()" disabled>重播动画</button>
        <button class="btn" onclick="toggleSpeed()" id="speedBtn">速度 1x</button>
    </div>

    <script>
        // 硬编码预跑事件流(由 flow_server 的 trace 逻辑跑出,避免汇报时起服务)
        const TRACES = [{"label": "示例A (50nt, 平衡)", "sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "sequence_length": 48, "event_count": 24, "events": [{"type": "step_start", "source": "agent", "data": {"day": 1}}, {"type": "circrna_sequence_assign", "source": "sequence_provider", "data": {"sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "sequence_id": "sp_mock_day1", "source": "SequenceProvider.mock", "day": 1}}, {"type": "tumor_heterogeneity", "source": "agent", "data": {"day": 1}}, {"type": "tumor_csc_update", "source": "agent", "data": {"day": 1}}, {"type": "tumor_angiogenesis", "source": "agent", "data": {"day": 1}}, {"type": "tumor_metastasis", "source": "agent", "data": {"day": 1}}, {"type": "tme_immune_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_fibroblast_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_evasion_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_immunoediting", "source": "agent", "data": {"day": 1}}, {"type": "drug_administered", "source": "agent", "data": {"drug_name": "paclitaxel", "dose": 175.0, "day": 1}}, {"type": "immunotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "radiotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "biomarker_update", "source": "agent", "data": {"day": 1}}, {"type": "subtype_reclassified", "source": "agent", "data": {"day": 1}}, {"type": "resistance_detected", "source": "agent", "data": {"day": 1}}, {"type": "circrna_immune_eval", "source": "agent", "data": {"sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "day": 1}}, {"type": "circrna_structure_predict", "source": "agent", "data": {"sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "day": 1}}, {"type": "circrna_folding_kinetics", "source": "agent", "data": {"sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "day": 1}}, {"type": "circrna_vaccine_assess", "source": "agent", "data": {"sequence": "UCGCAUUGCUAACGUAGAUUCCUGUAAAGUACGAAUCAAGAAGGUCCU", "day": 1}}, {"type": "recist_evaluation", "source": "agent", "data": {"day": 1}}, {"type": "survival_update", "source": "agent", "data": {"day": 1}}, {"type": "toxicity_update", "source": "agent", "data": {"day": 1}}, {"type": "step_end", "source": "agent", "data": {"day": 1}}], "state_sample": {"crna_structure_method": "pipeline", "crna_mfe_kcal": 2.3, "crna_folding_method": "sequence_too_short", "crna_backend_tier": "pipeline", "crna_torusfold_method": "none", "crna_closure_score": 0.5, "crna_bsj_stability": 0.4671, "crna_dsRNA_fraction": 0.2917, "crna_sasa_mean": 0.8333, "crna_sasa_bsj": 0.5, "crna_bsj_closure_angstrom": 6.7315, "crna_coords_available": true, "crna_translation_efficiency_dl": 0.5, "crna_circ_stability_dl": 0.5, "crna_backend_method": "heuristic_motif_based", "crna_confidence": 0.7, "crna_elapsed_time": 0.0477}}, {"label": "示例B (51nt, 高GC)", "sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "sequence_length": 49, "event_count": 24, "events": [{"type": "step_start", "source": "agent", "data": {"day": 1}}, {"type": "circrna_sequence_assign", "source": "sequence_provider", "data": {"sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "sequence_id": "sp_mock_day1", "source": "SequenceProvider.mock", "day": 1}}, {"type": "tumor_heterogeneity", "source": "agent", "data": {"day": 1}}, {"type": "tumor_csc_update", "source": "agent", "data": {"day": 1}}, {"type": "tumor_angiogenesis", "source": "agent", "data": {"day": 1}}, {"type": "tumor_metastasis", "source": "agent", "data": {"day": 1}}, {"type": "tme_immune_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_fibroblast_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_evasion_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_immunoediting", "source": "agent", "data": {"day": 1}}, {"type": "drug_administered", "source": "agent", "data": {"drug_name": "paclitaxel", "dose": 175.0, "day": 1}}, {"type": "immunotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "radiotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "biomarker_update", "source": "agent", "data": {"day": 1}}, {"type": "subtype_reclassified", "source": "agent", "data": {"day": 1}}, {"type": "resistance_detected", "source": "agent", "data": {"day": 1}}, {"type": "circrna_immune_eval", "source": "agent", "data": {"sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "day": 1}}, {"type": "circrna_structure_predict", "source": "agent", "data": {"sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "day": 1}}, {"type": "circrna_folding_kinetics", "source": "agent", "data": {"sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "day": 1}}, {"type": "circrna_vaccine_assess", "source": "agent", "data": {"sequence": "AUGCCGGAUUACCGGCAUGCAGUACGUACGUACGUACGUACGUACGUAC", "day": 1}}, {"type": "recist_evaluation", "source": "agent", "data": {"day": 1}}, {"type": "survival_update", "source": "agent", "data": {"day": 1}}, {"type": "toxicity_update", "source": "agent", "data": {"day": 1}}, {"type": "step_end", "source": "agent", "data": {"day": 1}}], "state_sample": {"crna_structure_method": "pipeline", "crna_mfe_kcal": -25.2, "crna_folding_method": "sequence_too_short", "crna_backend_tier": "pipeline", "crna_torusfold_method": "none", "crna_closure_score": 0.5, "crna_bsj_stability": 0.4663, "crna_dsRNA_fraction": 0.3878, "crna_sasa_mean": 0.8302, "crna_sasa_bsj": 0.5, "crna_bsj_closure_angstrom": 6.7523, "crna_coords_available": true, "crna_translation_efficiency_dl": 0.5, "crna_circ_stability_dl": 0.5, "crna_backend_method": "heuristic_motif_based", "crna_confidence": 0.7, "crna_elapsed_time": 0.0187}}, {"label": "示例C (50nt, G-quad倾向)", "sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "sequence_length": 49, "event_count": 24, "events": [{"type": "step_start", "source": "agent", "data": {"day": 1}}, {"type": "circrna_sequence_assign", "source": "sequence_provider", "data": {"sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "sequence_id": "sp_mock_day1", "source": "SequenceProvider.mock", "day": 1}}, {"type": "tumor_heterogeneity", "source": "agent", "data": {"day": 1}}, {"type": "tumor_csc_update", "source": "agent", "data": {"day": 1}}, {"type": "tumor_angiogenesis", "source": "agent", "data": {"day": 1}}, {"type": "tumor_metastasis", "source": "agent", "data": {"day": 1}}, {"type": "tme_immune_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_fibroblast_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_evasion_update", "source": "agent", "data": {"day": 1}}, {"type": "tme_immunoediting", "source": "agent", "data": {"day": 1}}, {"type": "drug_administered", "source": "agent", "data": {"drug_name": "paclitaxel", "dose": 175.0, "day": 1}}, {"type": "immunotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "radiotherapy_update", "source": "agent", "data": {"day": 1}}, {"type": "biomarker_update", "source": "agent", "data": {"day": 1}}, {"type": "subtype_reclassified", "source": "agent", "data": {"day": 1}}, {"type": "resistance_detected", "source": "agent", "data": {"day": 1}}, {"type": "circrna_immune_eval", "source": "agent", "data": {"sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "day": 1}}, {"type": "circrna_structure_predict", "source": "agent", "data": {"sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "day": 1}}, {"type": "circrna_folding_kinetics", "source": "agent", "data": {"sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "day": 1}}, {"type": "circrna_vaccine_assess", "source": "agent", "data": {"sequence": "GGGCCCAGUGGGCUUAGGGCUGGGCCAGUGGGCUUAGGGCUGGGCCAGU", "day": 1}}, {"type": "recist_evaluation", "source": "agent", "data": {"day": 1}}, {"type": "survival_update", "source": "agent", "data": {"day": 1}}, {"type": "toxicity_update", "source": "agent", "data": {"day": 1}}, {"type": "step_end", "source": "agent", "data": {"day": 1}}], "state_sample": {"crna_structure_method": "pipeline", "crna_mfe_kcal": -20.6, "crna_folding_method": "sequence_too_short", "crna_backend_tier": "pipeline", "crna_torusfold_method": "none", "crna_closure_score": 0.5, "crna_bsj_stability": 0.4663, "crna_dsRNA_fraction": 0.3673, "crna_sasa_mean": 0.8302, "crna_sasa_bsj": 0.5, "crna_bsj_closure_angstrom": 6.7523, "crna_coords_available": true, "crna_translation_efficiency_dl": 0.5, "crna_circ_stability_dl": 0.5, "crna_backend_method": "heuristic_motif_based", "crna_confidence": 0.7, "crna_elapsed_time": 0.019}}];

        let currentEvents = [];
        let playing = false;
        let speed = 1;
        let nodePositions = {};

        const GROUP_COLORS = {
            'tumor': '#f56565', 'tme': '#ed8936', 'treatment': '#48bb78',
            'biomarker': '#38b2ac', 'clinical': '#805ad5', 'circrna': '#d53f8c',
            'sequence': '#667eea', 'lifecycle': '#fbbf24',
        };

        function eventGroup(eventType) {
            if (eventType.startsWith('step_')) return 'lifecycle';
            if (eventType.startsWith('tumor_')) return 'tumor';
            if (eventType.startsWith('tme_')) return 'tme';
            if (eventType.startsWith('drug_') || eventType.includes('therapy')) return 'treatment';
            if (eventType.startsWith('biomarker') || eventType.startsWith('subtype') || eventType.startsWith('resistance')) return 'biomarker';
            if (eventType.startsWith('recist') || eventType.startsWith('survival') || eventType.startsWith('toxicity')) return 'clinical';
            if (eventType.startsWith('circrna') || eventType.includes('molecule')) return 'circrna';
            return 'sequence';
        }

        function loadExample() { /* 已用下拉框替代 */ }

        function loadTrace() {
            const idx = parseInt(document.getElementById('seqSelect').value);
            const data = TRACES[idx];
            if (!data) return;

            const status = document.getElementById('statusBar');
            currentEvents = data.events;
            status.className = 'status-bar success';
            status.textContent = `已加载 — ${data.label} | 序列 ${data.sequence_length} nt | ${data.event_count} 条事件`;

            renderFlow(data);
            renderEventList(data.events);
            renderState(data.state_sample);
            document.getElementById('replayBtn').disabled = false;

            setTimeout(() => replay(), 400);
        }

        function renderFlow(data) {
            const svg = document.getElementById('flowSvg');
            const W = svg.clientWidth, H = svg.clientHeight;
            const cx = W / 2, cy = H / 2;

            // 去重事件类型 (同一类型画一个节点)
            const uniqueTypes = [...new Set(data.events.map(e => e.type))];
            const n = uniqueTypes.length;
            const radius = Math.min(W, H) * 0.38;

            nodePositions = {};
            uniqueTypes.forEach((t, i) => {
                const angle = (i / n) * 2 * Math.PI - Math.PI / 2;
                nodePositions[t] = {
                    x: cx + radius * Math.cos(angle),
                    y: cy + radius * Math.sin(angle),
                    group: eventGroup(t),
                };
            });

            let html = '';
            // 连线 (总线到每个节点)
            uniqueTypes.forEach(t => {
                const p = nodePositions[t];
                html += `<path class="flow-line" id="line-${t}" d="M${cx},${cy} L${p.x},${p.y}"/>`;
            });
            // 总线核心
            html += `<circle cx="${cx}" cy="${cy}" r="38" fill="url(#busGrad)" stroke="#63b3ed" stroke-width="2"/>`;
            html += `<text x="${cx}" y="${cy-4}" text-anchor="middle" fill="#63b3ed" font-size="13" font-weight="600">EventBus</text>`;
            html += `<text x="${cx}" y="${cy+12}" text-anchor="middle" fill="#a0aec0" font-size="10">${data.sequence_length}nt</text>`;
            // 节点
            uniqueTypes.forEach(t => {
                const p = nodePositions[t];
                const color = GROUP_COLORS[p.group];
                const count = data.events.filter(e => e.type === t).length;
                const label = t.replace(/_/g, ' ').substring(0, 18);
                html += `<g class="node" id="node-${t}">`;
                html += `<circle cx="${p.x}" cy="${p.y}" r="16" fill="rgba(255,255,255,0.05)" stroke="${color}" stroke-width="2"/>`;
                html += `<circle cx="${p.x}" cy="${p.y}" r="6" fill="${color}"/>`;
                html += `<text x="${p.x}" y="${p.y+30}" text-anchor="middle" fill="${color}" font-size="9">${label}</text>`;
                html += `<text x="${p.x}" y="${p.y+42}" text-anchor="middle" fill="#718096" font-size="8">×${count}</text>`;
                html += `</g>`;
            });
            // 渐变定义
            const defs = `<defs><radialGradient id="busGrad"><stop offset="0%" stop-color="#2d3748"/><stop offset="100%" stop-color="#1a202c"/></radialGradient></defs>`;

            svg.innerHTML = defs + html;
        }

        function renderEventList(events) {
            document.getElementById('eventCount').textContent = events.length;
            const list = document.getElementById('eventList');
            list.innerHTML = events.map((e, i) => {
                const dataStr = Object.entries(e.data).map(([k,v]) => `${k}=${v}`).join(' ');
                return `<div class="event-row" id="erow-${i}">
                    <span class="event-idx">${i+1}</span>
                    <span class="event-type">${e.type}</span>
                    <span class="event-source">[${e.source}]</span>
                    <span class="event-data">${dataStr}</span>
                </div>`;
            }).join('');
        }

        function renderState(state) {
            const panel = document.getElementById('statePanel');
            const grid = document.getElementById('stateGrid');
            const entries = Object.entries(state);
            if (entries.length === 0) { panel.style.display = 'none'; return; }
            panel.style.display = 'block';
            grid.innerHTML = entries.map(([k,v]) =>
                `<div class="state-item"><span class="state-key">${k}</span><span class="state-val">${v}</span></div>`
            ).join('');
        }

        function replay() {
            if (currentEvents.length === 0 || playing) return;
            playing = true;

            // 重置
            document.querySelectorAll('.event-row').forEach(r => r.className = 'event-row');
            document.querySelectorAll('.flow-line').forEach(l => l.classList.remove('active'));
            document.querySelectorAll('.node').forEach(n => n.style.opacity = '0.4');

            const interval = 350 / speed;
            currentEvents.forEach((e, i) => {
                setTimeout(() => {
                    const row = document.getElementById(`erow-${i}`);
                    if (row) {
                        document.querySelectorAll('.event-row.current').forEach(r => r.classList.remove('current'));
                        row.classList.add('played', 'current');
                        row.scrollIntoView({behavior: 'smooth', block: 'nearest'});
                    }
                    // 高亮对应节点和连线
                    const line = document.getElementById(`line-${e.type}`);
                    const node = document.getElementById(`node-${e.type}`);
                    if (line) { line.classList.add('active'); setTimeout(() => line.classList.remove('active'), interval * 1.5); }
                    if (node) { node.style.opacity = '1'; node.style.transform = 'scale(1.15)'; node.style.transformOrigin = 'center'; node.style.transition = 'all 0.3s'; setTimeout(() => node.style.transform = 'scale(1)', interval); }

                    if (i === currentEvents.length - 1) {
                        setTimeout(() => {
                            playing = false;
                            document.querySelectorAll('.event-row.current').forEach(r => r.classList.remove('current'));
                        }, interval);
                    }
                }, i * interval);
            });
        }

        function toggleSpeed() {
            const speeds = [1, 2, 4, 0.5];
            const idx = speeds.indexOf(speed);
            speed = speeds[(idx + 1) % speeds.length];
            document.getElementById('speedBtn').textContent = `速度 ${speed}x`;
        }

        // 页面加载后自动展示第一条 trace
        window.addEventListener('load', () => {
            setTimeout(() => loadTrace(), 200);
        });
    </script>
</body>
</html>

← 返回文件树 · 在 GitHub 上查看