function formatScore(value) { return Number.isFinite(value) ? value.toFixed(2) : "--"; } function renderLeaderboard() {} const leaderboardConfig = { textual: { categories: [ null, ["Explicit Fact Recall", "Facts, attributes, sources, and entities recalled from long histories."], ["Compositional Inference", "Relations and multi-hop evidence combined across memory fragments."], ["Temporal & Event Reasoning", "Dates, ordering, intervals, and evolving states over time."], ["Memory Governance", "Updates, conflict resolution, deletion, and forgetting."], ["Personalization & Care", "Preferences, background, wellbeing context, and appropriate adaptation."], ["Context Learning & Execution", "Rules, procedures, domain constraints, and format execution."], ["Safety & Privacy", "Evidence boundaries, robust abstention, and minimal disclosure."], ], }, coding: { categories: [ null, ["New Feature", "Performance across 51 new-feature implementation tasks."], ["Bug Fix", "Performance across 99 bug-fixing tasks."], ], }, }; function renderGithubIconLink(url, systemName) { const link = document.createElement("a"); link.href = url; link.target = "_blank"; link.rel = "noreferrer"; link.className = "github-icon-link"; link.setAttribute("aria-label", `Open ${systemName} GitHub repository`); link.title = "GitHub"; link.innerHTML = ` `; return link; } let activeBadgeTooltip = null; function hideBadgeTooltip() { if (activeBadgeTooltip) { activeBadgeTooltip.remove(); activeBadgeTooltip = null; } } function showBadgeTooltip(target) { const text = target.dataset.tooltip; if (!text) return; hideBadgeTooltip(); const tooltip = document.createElement("span"); tooltip.className = "badge-floating-tooltip"; tooltip.textContent = text; document.body.append(tooltip); const rect = target.getBoundingClientRect(); const margin = 10; const tooltipRect = tooltip.getBoundingClientRect(); const left = Math.min( Math.max(rect.left, margin), window.innerWidth - tooltipRect.width - margin, ); const top = Math.max(rect.top - tooltipRect.height - 10, margin); tooltip.style.left = `${left}px`; tooltip.style.top = `${top}px`; activeBadgeTooltip = tooltip; } function attachBadgeTooltip(target) { target.addEventListener("mouseenter", () => showBadgeTooltip(target)); target.addEventListener("mouseleave", hideBadgeTooltip); target.addEventListener("focus", () => showBadgeTooltip(target)); target.addEventListener("blur", hideBadgeTooltip); } function getScoreTier(value, tiers) { return tiers.findIndex((score) => score === value) + 1; } function getColumnTiers(rows, field) { return [...new Set(rows.map((entry) => entry[field]).filter(Number.isFinite))] .sort((a, b) => b - a) .slice(0, 3); } function getCompetitionRanks(rows, field) { const ranks = []; let lastScore = null; let lastRank = 0; rows.forEach((entry, index) => { const score = entry[field]; if (!Number.isFinite(score)) { ranks.push(index + 1); lastScore = score; lastRank = index + 1; return; } if (index === 0 || score !== lastScore) { lastRank = index + 1; } ranks.push(lastRank); lastScore = score; }); return ranks; } function renderScoreCell(value, tier) { const cell = document.createElement("span"); cell.className = "score-cell"; const score = document.createElement("b"); score.className = tier > 0 ? `score-value score-rank-${tier}` : "score-value"; score.textContent = formatScore(value); cell.append(score); return cell; } function renderStatusCell(value, type) { const cell = document.createElement("span"); cell.className = `score-cell ${type === "volume" ? "volume-cell" : "speed-cell"}`; const status = document.createElement("b"); const normalized = typeof value === "string" ? value : "--"; const statusMap = { "快速": { className: "speed-fast", label: "Fast" }, Fast: { className: "speed-fast", label: "Fast" }, "中速": { className: "speed-medium", label: "Medium" }, Medium: { className: "speed-medium", label: "Medium" }, "慢速": { className: "speed-slow", label: "Slow" }, Slow: { className: "speed-slow", label: "Slow" }, Compact: { className: "volume-compact", label: "Compact" }, Balanced: { className: "volume-balanced", label: "Balanced" }, Verbose: { className: "volume-verbose", label: "Verbose" }, }; const state = statusMap[normalized] || { className: "speed-unknown", label: "--" }; if (type === "volume") { status.className = `speed-value volume-value ${state.className}`; status.textContent = state.label; } else { status.className = `speed-inline ${state.className}`; status.innerHTML = `${state.label}`; } cell.append(status); return cell; } function renderTextCell(value) { const cell = document.createElement("span"); cell.className = "text-cell"; cell.textContent = value || "--"; return cell; } function renderMetricCell(entry, metric, tiers) { if (metric.type === "text") { return renderTextCell(entry[metric.field]); } if (metric.type === "speed" || metric.type === "volume") { return renderStatusCell(entry[metric.field], metric.type); } return renderScoreCell(entry[metric.field], getScoreTier(entry[metric.field], tiers)); } const state = { view: window.location.hash === "#leaderboard" ? "leaderboard" : "home", track: "textual", division: "academic", category: 0, }; function setView(view, updateHash = true) { state.view = view; document.querySelectorAll("[data-view]").forEach((element) => { const active = element.dataset.view === view; element.hidden = !active; element.classList.toggle("is-active", active); }); document.querySelectorAll(".nav-link[data-view-link]").forEach((button) => { button.classList.toggle("is-active", button.dataset.viewLink === view); }); if (updateHash) { history.pushState(null, "", view === "leaderboard" ? "#leaderboard" : "#home"); } window.scrollTo({ top: 0, behavior: "smooth" }); } document.querySelectorAll("[data-view-link]").forEach((element) => { element.addEventListener("click", (event) => { event.preventDefault(); setView(element.dataset.viewLink); }); }); document.querySelectorAll("[data-open-track]").forEach((button) => { button.addEventListener("click", () => { state.track = button.dataset.openTrack; state.category = 0; document.querySelectorAll("[data-track]").forEach((trackButton) => { const active = trackButton.dataset.track === state.track; trackButton.classList.toggle("is-active", active); trackButton.setAttribute("aria-selected", String(active)); }); renderLeaderboard(); setView("leaderboard"); }); }); document.querySelectorAll("[data-track]").forEach((button) => { button.addEventListener("click", () => { state.track = button.dataset.track; state.category = 0; document.querySelectorAll("[data-track]").forEach((trackButton) => { const active = trackButton === button; trackButton.classList.toggle("is-active", active); trackButton.setAttribute("aria-selected", String(active)); }); renderLeaderboard(); }); }); document.querySelectorAll("[data-division]").forEach((button) => { button.addEventListener("click", () => { state.division = button.dataset.division; document.querySelectorAll("[data-division]").forEach((divisionButton) => { const active = divisionButton === button; divisionButton.classList.toggle("is-active", active); divisionButton.setAttribute("aria-selected", String(active)); }); renderLeaderboard(); }); }); window.addEventListener("popstate", () => { setView(window.location.hash === "#leaderboard" ? "leaderboard" : "home", false); });