Maggio33's picture
Plain-language copy (PL/EN), partial update; files from ee7bf16
61b1a08 verified
Raw History Blame Contribute Delete
31 kB
"use strict";
(() => {
const contract = window.BenchContract;
const T = {
en: {
search:"Find a test in the older comparison", language:"Test language", show:"Show tests", all:"All", withResults:"With a published score", clear:"Clear filters",
benchmark:"Test", results:"Test results", notPublished:"No published result yet",
noPacket:"No results file is linked for the older 50-test comparison. Only the test list, sources and score types can be shown. The separate nine-task table below is unaffected.",
loadError:"The older 50-test comparison could not be loaded and checked, so it is hidden. The nine-task table below is separate.", rejected:"The older results are hidden because their file could not be loaded or did not pass the checks.",
empty:"No tests match these filters. Clear the filters to see the full list.", shown:"Showing", of:"of", benchmarks:"tests",
pills:{panel:"Older comparison · 29.10.2026", total:"tests", langs:"38 English · 12 Polish", models:"models in the older comparison", published:"tests with a published score"},
higher:"higher is better", lower:"lower is better", ci:"95% confidence interval", noCI:"no confidence interval reported", random:"random guessing", majority:"always the most common correct answer", delta:"score difference",
majorityShare:"uses its most frequent answer for", none:"none listed", refMissing:"guessing reference not available",
scan:{clean:"no matches found", flagged:"matches found", partially_scanned:"training-data check incomplete", unscanned:"training-data check pending", unknown:"training data unknown"},
noNumber:{partially_scanned:"No score shown: too few questions could be checked against training data.", unscanned:"No score shown until the training-data check is complete."},
hitFree:"After removing questions matching any checked training-data field", hitFreeAnswer:"After removing matches in question or answer fields", hits:"questions matched", n:"questions",
noHitFree:"no questions remain after removing matches", tooFew:"fewer than 50 questions remain; no score shown",
mostly:"fewer than 50 questions have no training-data matches", inSlayer:"in Slayer1B-1.06 training data", slayerSubset:"These questions were selected using Slayer1B-1.06 training data, not this model’s unknown training data.", mostlyVerdict:"The full-sample score cannot support a better/worse statement here. Only a comparison on the same questions without question- or answer-field matches can support one.",
pending:n => `${n} of these 50 tests were not run. A missing result is not zero. The older comparison statements remain as published; they account for all 98 planned comparisons. This does not apply to the separate nine-task table.`,
constant:"same answer every time", constantNote:"The model chose one class for every question. This score is not used to compare models.",
states:{ok:"Measured",not_run:"Not run; no score",blocked_access:"Not measured: no data access",blocked_runtime:"Not measured: evaluation environment blocked",blocked_security:"Not measured: blocked by security review",blocked_judge:"Not measured: no approved answer evaluator",unsupported:"Not measured: this test is not supported",failed:"Measurement failed; no score",skipped:"Skipped; no score"},
verdicts:{better:"scored better on this test than",worse:"scored worse on this test than",inconclusive:"evidence does not settle the comparison with"}, verdictNote:"paired test, Holm-adjusted", verdictNoteSubset:"paired test on questions without answer-field hits, Holm-adjusted",
amendments:{answer_leading_space_strip:"Scoring was corrected after the first measurement because of an initial space. Read how the tests were scored.", other:"Scoring was changed after the first measurement. Read how the tests were scored."},
scoringNotes:{source_extractor_floor:"The scoring script can miss a correctly formatted answer: it reads only text between dollar signs and gives zero to answers written in \\boxed{}. This result is not used to compare ability. Read the scoring details.", other:"There is a limitation in how this score was calculated. Read the scoring details."},
details:"Details", population:"available questions / selected questions / scored questions", revision:"source version", licence:"licence stated on the dataset card", files:"These are the files used for the older 50-test comparison and their SHA-256 checksums. Each file must match the published copy before the comparison is displayed. results-feed.json identifies results.json and its required checksum.",
packet:"results file", run:"measurement run", protocol:"evaluation procedure", resultsSha:"Results-file SHA-256", receiptSha:"training-data check receipt SHA-256",
langName:{EN:"English", PL:"Polish"},
pageLang:"Page language", title:"Slayer1B: what do the tests show?", metric:"score type"
},
pl: {
search:"Znajdź test w starszym porównaniu", language:"Język testu", show:"Pokaż testy", all:"Wszystkie", withResults:"Z opublikowanym wynikiem", clear:"Wyczyść filtry",
benchmark:"Test", results:"Wyniki testów", notPublished:"Nie ma jeszcze opublikowanego wyniku",
noPacket:"Do starszego porównania w 50 testach nie dołączono pliku wyników. Można pokazać tylko listę testów, ich źródła i rodzaje punktacji. Nie dotyczy to osobnej tabeli dziewięciu zadań poniżej.",
loadError:"Nie udało się wczytać i sprawdzić starszego porównania w 50 testach, więc go nie pokazujemy. Tabela dziewięciu zadań poniżej jest osobna.", rejected:"Starsze wyniki są ukryte, ponieważ nie udało się wczytać ich pliku lub plik nie przeszedł kontroli.",
empty:"Żaden test nie pasuje do tych filtrów. Wyczyść filtry, aby zobaczyć całą listę.", shown:"Pokazano", of:"z", benchmarks:"testów",
pills:{panel:"Starsze porównanie · 29.10.2026", total:"testów", langs:"38 angielskich · 12 polskich", models:"modele w starszym porównaniu", published:"testów z opublikowanym wynikiem"},
higher:"więcej = lepiej", lower:"mniej = lepiej", ci:"95% przedział ufności", noCI:"nie podano przedziału ufności", random:"losowe zgadywanie", majority:"zawsze najczęstsza poprawna odpowiedź", delta:"różnica wyników",
majorityShare:"wybiera swoją najczęstszą odpowiedź w", none:"nie podano", refMissing:"brak wyniku odniesienia dla zgadywania",
scan:{clean:"nie znaleziono dopasowań", flagged:"znaleziono dopasowania", partially_scanned:"kontrola danych treningowych niepełna", unscanned:"dane treningowe czekają na kontrolę", unknown:"dane treningowe nieznane"},
noNumber:{partially_scanned:"Nie pokazujemy wyniku: zbyt mało pytań udało się sprawdzić w danych treningowych.", unscanned:"Nie pokazujemy wyniku do zakończenia kontroli danych treningowych."},
hitFree:"Po usunięciu pytań z dopasowaniem w dowolnym sprawdzanym polu danych treningowych", hitFreeAnswer:"Po usunięciu dopasowań w polach pytania lub odpowiedzi", hits:"pytań z dopasowaniem", n:"pytań",
noHitFree:"po usunięciu dopasowań nie zostały żadne pytania", tooFew:"zostało mniej niż 50 pytań; nie pokazujemy wyniku",
mostly:"mniej niż 50 pytań nie ma dopasowań do danych treningowych", inSlayer:"w danych treningowych Slayer1B-1.06", slayerSubset:"Te pytania wybrano na podstawie danych treningowych Slayer1B-1.06, nie nieznanych danych treningowych tego modelu.", mostlyVerdict:"Wynik całej próbki nie pozwala tu stwierdzić „lepiej” ani „gorzej”. Podstawą może być tylko porównanie na tych samych pytaniach bez dopasowań w polach pytania lub odpowiedzi.",
pending:n => `${n} z tych 50 testów nie uruchomiono. Brak wyniku nie oznacza zera. Starsze stwierdzenia o porównaniu pozostają bez zmian; uwzględniają wszystkie 98 zaplanowanych porównań. Nie dotyczy to osobnej tabeli dziewięciu zadań.`,
constant:"za każdym razem ta sama odpowiedź", constantNote:"Model wybierał jedną klasę dla każdego pytania. Tego wyniku nie używamy do porównania modeli.",
states:{ok:"Zmierzono",not_run:"Nie uruchomiono; brak wyniku",blocked_access:"Nie zmierzono: brak dostępu do danych",blocked_runtime:"Nie zmierzono: blokada środowiska oceny",blocked_security:"Nie zmierzono: zablokowane po kontroli bezpieczeństwa",blocked_judge:"Nie zmierzono: brak zatwierdzonej oceny odpowiedzi",unsupported:"Nie zmierzono: ten test nie jest obsługiwany",failed:"Pomiar nie powiódł się; brak wyniku",skipped:"Pominięto; brak wyniku"},
verdicts:{better:"w tym teście wypadł lepiej niż",worse:"w tym teście wypadł gorzej niż",inconclusive:"dane nie rozstrzygają porównania z"}, verdictNote:"test sparowany, poprawka Holma", verdictNoteSubset:"test sparowany na pytaniach bez trafień w polach odpowiedzi, poprawka Holma",
amendments:{answer_leading_space_strip:"Po pierwszym pomiarze poprawiono punktację z powodu spacji na początku. Przeczytaj opis oceniania testów.", other:"Po pierwszym pomiarze zmieniono punktację. Przeczytaj opis oceniania testów."},
scoringNotes:{source_extractor_floor:"Skrypt oceniający może nie odczytać odpowiedzi zapisanej w innym formacie: czyta tylko tekst między znakami dolara i daje zero odpowiedziom w \\boxed{}. Tego wyniku nie używamy do porównania umiejętności. Przeczytaj szczegóły punktacji.", other:"Sposób liczenia tego wyniku ma ograniczenie. Przeczytaj szczegóły punktacji."},
details:"Szczegóły", population:"dostępne pytania / wybrane pytania / ocenione pytania", revision:"wersja źródła", licence:"licencja podana w karcie zbioru", files:"To pliki starszego porównania w 50 testach i ich sumy SHA-256. Każdy plik musi być zgodny z opublikowaną kopią, zanim porównanie zostanie wyświetlone. results-feed.json wskazuje results.json i jego wymaganą sumę.",
packet:"plik wyników", run:"pomiar", protocol:"sposób oceny", resultsSha:"SHA-256 pliku wyników", receiptSha:"SHA-256 potwierdzenia kontroli danych treningowych",
langName:{EN:"angielski", PL:"polski"},
pageLang:"Język strony", title:"Slayer1B: co pokazują testy?", metric:"rodzaj wyniku"
}
};
const state = {lang:"en", tasks:null, packet:null, index:null, packetSHA:null, error:null, files:[], query:"", language:"all", show:"all"};
function el(tag, text, cls) {
const n = document.createElement(tag);
if (text !== undefined && text !== null) n.textContent = String(text);
if (cls) n.className = cls;
return n;
}
function fmt(v, unit) {
const digits = unit === "byte_ppl" ? 3 : unit === "percent" ? 1 : 3;
return new Intl.NumberFormat(state.lang === "pl" ? "pl-PL" : "en-GB", {minimumFractionDigits:digits, maximumFractionDigits:digits}).format(v);
}
const unitLabel = u => u === "percent" ? "%" : u === "byte_ppl" ? "byte-PPL" : "";
const pct = v => new Intl.NumberFormat(state.lang === "pl" ? "pl-PL" : "en-GB", {style:"percent", maximumFractionDigits:1}).format(v);
function modelName(m) { return m.repo.split("/").pop(); }
// Thresholds and the "most items found in training data" class come from the contract, which also guarantees that every
// non-withheld verdict in an accepted packet follows the display rules (binding rules 2026-10-29 16:55 and 17:07).
const MIN_HIT_FREE_N = contract.MIN_HIT_FREE_N;
const mostlyTrained = taskId => state.index ? contract.mostlyTrained(state.index.observations, taskId, state.packet.protocol_id) : null;
// Whether the cell carries a number at all, and why not otherwise.
function numberRule(o) {
if (o.state !== "ok") return {show:false, reason:null};
if (["clean","flagged","unknown"].includes(o.contamination)) return {show:true};
return {show:false, reason:o.contamination};
}
function hitFreeLine(label, value, n, rate, ci, unit, t) {
const tail = `${n} ${t.n}; ${pct(rate)} ${t.hits}`;
if (n === 0) return `${label}: ${t.noHitFree}`;
if (n < MIN_HIT_FREE_N) return `${label}: ${t.tooFew} (${tail})`;
const interval = ci ? `${t.ci} ${fmt(ci.lower, unit)} – ${fmt(ci.upper, unit)}` : t.noCI;
return `${label}: ${fmt(value, unit)}, ${interval} (${tail})`;
}
const isConstant = x => !!(x && x.reference && x.reference.constant_prediction === true);
function cell(task, model, t) {
const td = el("td");
const o = state.index && state.index.observations.get(contract.key(task.id, model.model_id, state.packet.protocol_id));
if (!o) { td.append(el("span", t.notPublished, "state")); return td; }
const mostly = mostlyTrained(task.id);
const rule = numberRule(o);
const tags = el("div", undefined, "tags");
if (o.state !== "ok") {
td.append(el("span", t.states[o.state], "state"));
if (o.reason) td.append(el("span", o.reason, "meta"));
} else if (!rule.show) {
td.append(el("span", t.noNumber[rule.reason], "state"));
} else {
const v = el("span", fmt(o.value, o.unit), mostly === null ? "value" : "value dim");
if (unitLabel(o.unit)) v.append(el("small", unitLabel(o.unit)));
td.append(v);
td.append(el("span", o.ci95 ? `${t.ci} ${fmt(o.ci95.lower, o.unit)} – ${fmt(o.ci95.upper, o.unit)}` : t.noCI, "meta"));
if (mostly !== null) td.append(el("span", `${t.mostly} (${pct(mostly)} ${t.hits}${o.contamination === "unknown" ? `, ${t.inSlayer}` : ""})`, "mostly"));
const hasA = Number.isInteger(o.n_hit_free), hasB = Number.isInteger(o.n_hit_free_answer_fields);
if (hasA) td.append(el("span", hitFreeLine(t.hitFree, o.value_hit_free, o.n_hit_free, o.hit_rate, o.ci95_hit_free, o.unit, t), "ref"));
if (hasB) td.append(el("span", hitFreeLine(t.hitFreeAnswer, o.value_hit_free_answer_fields, o.n_hit_free_answer_fields, o.hit_rate_answer_fields, o.ci95_hit_free_answer_fields, o.unit, t), "ref"));
if ((hasA || hasB) && o.contamination === "unknown") td.append(el("span", t.slayerSubset, "meta"));
const r = o.reference;
const refs = [];
if (r && r.chance_value !== null) refs.push(`${t.random} ${fmt(r.chance_value, o.unit)}`);
if (r && r.majority_value !== null) refs.push(`${t.majority} ${fmt(r.majority_value, o.unit)}`);
td.append(el("span", refs.length ? refs.join(" · ") : t.refMissing, "ref"));
if (r && r.majority_prediction_share !== null) td.append(el("span", `${t.majorityShare} ${pct(r.majority_prediction_share)}`, "meta"));
if (isConstant(o)) tags.append(el("span", t.constant, "tag constant"));
}
const scanClass = {clean:"clean", flagged:"flagged", unknown:"unknown"}[o.contamination] || "pending";
tags.append(el("span", t.scan[o.contamination], `tag ${scanClass}`));
td.append(tags);
if (rule.show && isConstant(o)) td.append(el("span", t.constantNote, "meta"));
if (rule.show && mostly !== null) td.append(el("span", t.mostlyVerdict, "meta"));
const tests = [];
for (const c of state.index.contrasts) {
if (c.task_id !== task.id || c.model_id !== model.model_id || c.verdict === "withheld") continue;
const ref = state.index.models.get(c.model_ref);
const p = new Intl.NumberFormat(state.lang === "pl" ? "pl-PL" : "en-GB", {maximumSignificantDigits:2}).format(c.p_holm);
const note = c.subset === "full" ? t.verdictNote : `${t.verdictNoteSubset}, ${c.n} ${t.n}`;
const signed = v => `${v > 0 ? "+" : ""}${fmt(v, c.unit)}`;
const isNum = v => typeof v === "number" && Number.isFinite(v);
const diff = isNum(c.delta) ? `${t.delta} ${signed(c.delta)}${c.ci95 ? ` (${t.ci} ${signed(c.ci95.lower)} – ${signed(c.ci95.upper)})` : ""} · ` : "";
td.append(el("span", `${t.verdicts[c.verdict]} ${modelName(ref)}`, "verdict"));
tests.push(`${diff}${note}: p = ${p}`);
}
const d = el("details");
d.append(el("summary", t.details));
for (const line of tests) d.append(el("p", line));
d.append(el("p", `${t.population}: ${o.n_population ?? "—"} / ${o.n_selected ?? "—"} / ${o.n_scored}`));
d.append(el("p", `${t.resultsSha} ${o.results_sha256 ?? "—"}`));
if (o.contamination_receipt_sha256) d.append(el("p", `${t.receiptSha} ${o.contamination_receipt_sha256}`));
td.append(d);
return td;
}
// Plain-language labels for the tasks_50 domain values: what the test asks, not a demonstrated ability.
const DOMAIN = {
en: {
syntax:"Sentence grammar",
science_reasoning:"Reasoning about science",
language_modeling:"Predicting text",
morphosyntax:"Word forms and sentence grammar",
commonsense:"Everyday situations",
physical_reasoning:"Everyday physical problems",
coreference:"Who or what a word refers to",
science_knowledge:"Science knowledge",
reading:"Understanding a text",
causal_reasoning:"Causes and effects",
entailment:"Whether a statement follows from a text",
word_sense:"Word meaning in context",
adversarial_entailment:"Whether a statement follows from a text, with tricky cases",
contextual_prediction:"Predicting what fits the context",
logical_reasoning:"Logical reasoning",
mathematics_mc:"Choosing a mathematical answer",
sentiment:"Recognising the tone of a text",
topic_classification:"Identifying the topic",
question_relevance:"Whether a question fits the text",
paraphrase:"Whether texts express the same meaning",
summary_matching:"Matching a summary to a text",
toxicity_detection:"Recognising harmful language",
sentence_entity_classification:"Assigning labels to sentences and named things",
question_answering:"Answering questions",
academic_knowledge:"Knowledge across academic subjects",
mathematics_generation:"Writing a mathematical answer",
competition_mathematics:"Competition mathematics",
truthfulness:"Answering without repeating common falsehoods",
instruction_following:"Following instructions",
native_exam_knowledge:"Knowledge tested in national exams",
unanswerable_reading:"Recognising when a text has no answer",
discrete_reading:"Understanding a text and counting",
conversational_reading:"Answering a sequence of questions about a text",
closed_book_knowledge:"Answering without a reference text",
biomedical_reading:"Understanding biomedical text",
medical_exam_knowledge:"Medical exam knowledge",
social_reasoning:"Reasoning about social situations",
formal_reasoning:"Reasoning with formal rules",
adversarial_paraphrase:"Whether texts mean the same thing, with tricky cases",
acceptability:"Whether a sentence is well formed",
entity_reading:"Finding information about named things in a text"
},
pl: {
syntax:"Gramatyka zdań",
science_reasoning:"Rozumowanie o nauce",
language_modeling:"Przewidywanie tekstu",
morphosyntax:"Formy wyrazów i gramatyka zdań",
commonsense:"Codzienne sytuacje",
physical_reasoning:"Codzienne problemy fizyczne",
coreference:"Do kogo lub czego odnosi się słowo",
science_knowledge:"Wiedza z nauk przyrodniczych",
reading:"Rozumienie tekstu",
causal_reasoning:"Przyczyny i skutki",
entailment:"Czy stwierdzenie wynika z tekstu",
word_sense:"Znaczenie słowa w kontekście",
adversarial_entailment:"Czy stwierdzenie wynika z tekstu, także w trudnych przypadkach",
contextual_prediction:"Przewidywanie, co pasuje do kontekstu",
logical_reasoning:"Rozumowanie logiczne",
mathematics_mc:"Wybór odpowiedzi matematycznej",
sentiment:"Rozpoznawanie wydźwięku tekstu",
topic_classification:"Rozpoznawanie tematu",
question_relevance:"Czy pytanie pasuje do tekstu",
paraphrase:"Czy teksty wyrażają to samo znaczenie",
summary_matching:"Dopasowanie streszczenia do tekstu",
toxicity_detection:"Rozpoznawanie krzywdzącego języka",
sentence_entity_classification:"Przypisywanie kategorii zdaniom i nazwanym obiektom",
question_answering:"Odpowiadanie na pytania",
academic_knowledge:"Wiedza z różnych dziedzin akademickich",
mathematics_generation:"Zapisanie odpowiedzi matematycznej",
competition_mathematics:"Matematyka konkursowa",
truthfulness:"Odpowiadanie bez powtarzania popularnych fałszów",
instruction_following:"Wykonywanie poleceń",
native_exam_knowledge:"Wiedza sprawdzana na egzaminach krajowych",
unanswerable_reading:"Rozpoznawanie, kiedy tekst nie zawiera odpowiedzi",
discrete_reading:"Rozumienie tekstu i liczenie",
conversational_reading:"Odpowiadanie na kolejne pytania o tekst",
closed_book_knowledge:"Odpowiadanie bez tekstu źródłowego",
biomedical_reading:"Rozumienie tekstu biomedycznego",
medical_exam_knowledge:"Wiedza z egzaminów medycznych",
social_reasoning:"Rozumowanie o sytuacjach społecznych",
formal_reasoning:"Rozumowanie według reguł formalnych",
adversarial_paraphrase:"Czy teksty znaczą to samo, także w trudnych przypadkach",
acceptability:"Czy zdanie jest poprawnie zbudowane",
entity_reading:"Wyszukiwanie w tekście informacji o nazwanych obiektach"
}
};
const domainLabel = d => DOMAIN[state.lang][d] || d.replace(/_/g, " ");
function taskHeader(task, t) {
const th = el("th", task.name, "task");
th.scope = "row";
th.append(el("span", `${t.langName[task.language] || task.language} · ${domainLabel(task.domain)}; ${task.higher_is_better ? t.higher : t.lower}`, "meta"));
// Public scoring amendments are a property of the pinned benchmark list, never of a result file.
for (const code of task.scoring_amendments || []) th.append(el("span", t.amendments[code] || t.amendments.other, "amend"));
for (const code of task.scoring_notes || []) th.append(el("span", t.scoringNotes[code] || t.scoringNotes.other, "amend"));
const d = el("details");
d.append(el("summary", t.details));
for (const s of task.license.source_revisions) {
const p = el("p");
const a = el("a", s.repo_id);
a.href = `https://huggingface.co/datasets/${s.repo_id}`;
a.rel = "noopener";
p.append(a, document.createTextNode(` · ${t.revision} ${s.revision.slice(0, 8)}`));
d.append(p);
}
d.append(el("p", `${t.licence}: ${task.license.declared_tags.join(", ") || t.none}`));
d.append(el("p", `${t.metric}: ${task.metric} · ${task.split} · ${task.shots}-shot · ${task.instrument}`));
th.append(d);
return th;
}
// Plain message visible; the exact technical diagnostic stays untranslated under Details.
function errorNotice(message, t) {
const box = el("div", undefined, "notice error");
box.append(el("p", message));
const d = el("details");
d.append(el("summary", t.details), el("p", state.error));
box.append(d);
return box;
}
function render() {
const t = T[state.lang];
const app = document.getElementById("app");
const pills = document.getElementById("pills");
pills.replaceChildren();
const pill = (b, txt) => { const p = el("span", undefined, "pill"); p.append(el("b", b), document.createTextNode(` ${txt}`)); pills.append(p); };
if (!state.tasks) {
app.replaceChildren(errorNotice(t.loadError, t));
return;
}
const rows = state.tasks.rows;
// Models whose training corpus was scanned come first; models with unknown training data follow, in packet order.
const scanned = m => state.index && [...state.index.observations.values()].some(o => o.model_id === m.model_id && o.contamination !== "unknown");
const models = state.packet ? [...state.packet.models].sort((a, b) => scanned(b) - scanned(a)) : [];
const published = new Set();
if (state.index) for (const o of state.index.observations.values()) if (numberRule(o).show) published.add(o.task_id);
pills.append(el("span", t.pills.panel, "pill"));
pill(rows.length, t.pills.total);
pills.append(el("span", t.pills.langs, "pill"));
if (models.length) pill(models.length, t.pills.models);
pill(published.size, t.pills.published);
// Benchmarks where some model has no measurement yet (binding sentence 2026-10-29 20:18).
const pendingEl = document.getElementById("pending");
const unmeasured = state.index ? rows.filter(r => models.some(m => { const o = state.index.observations.get(contract.key(r.id, m.model_id, state.packet.protocol_id)); return !o || o.state !== "ok"; })).length : 0;
pendingEl.hidden = unmeasured === 0;
pendingEl.textContent = unmeasured ? t.pending(unmeasured) : "";
const nodes = [];
if (state.error && state.tasks) nodes.push(errorNotice(t.rejected, t));
else if (!state.packet) nodes.push(el("p", t.noPacket, "notice"));
const controls = el("div", undefined, "controls");
const search = el("input"); search.type = "search"; search.value = state.query;
const lang = el("select");
for (const [v, txt] of [["all", t.all], ["EN", "EN"], ["PL", "PL"]]) { const op = el("option", txt); op.value = v; lang.append(op); }
lang.value = state.language;
const show = el("select");
for (const [v, txt] of [["all", t.all], ["published", t.withResults]]) { const op = el("option", txt); op.value = v; show.append(op); }
show.value = state.show;
show.disabled = !state.packet;
const clear = el("button", t.clear, "clear"); clear.type = "button";
const lab = (txt, input) => { const l = el("label", txt); l.append(input); return l; };
controls.append(lab(t.search, search), lab(t.language, lang), lab(t.show, show), clear);
const summary = el("p", undefined, "summary");
summary.setAttribute("role", "status");
const wrap = el("div", undefined, "wrap");
wrap.tabIndex = 0;
wrap.setAttribute("role", "region");
wrap.setAttribute("aria-label", t.results);
const table = el("table");
table.setAttribute("aria-labelledby", "results-title");
const head = el("tr");
const th0 = el("th", t.benchmark); th0.scope = "col"; head.append(th0);
if (models.length) for (const m of models) {
const th = el("th", modelName(m)); th.scope = "col";
head.append(th);
} else { const th = el("th", t.results); th.scope = "col"; head.append(th); }
const thead = el("thead"); thead.append(head);
const tbody = el("tbody");
table.append(thead, tbody);
wrap.append(table);
const empty = el("p", t.empty, "summary");
nodes.push(controls, summary, wrap, empty);
app.replaceChildren(...nodes);
function fill() {
const q = state.query.trim().toLocaleLowerCase(state.lang);
const visible = rows.filter(r => (state.language === "all" || r.language === state.language) &&
(state.show === "all" || published.has(r.id)) &&
`${r.name} ${r.benchmark_id} ${r.domain} ${domainLabel(r.domain)}`.toLocaleLowerCase(state.lang).includes(q));
const frag = document.createDocumentFragment();
for (const r of visible) {
const tr = el("tr");
tr.append(taskHeader(r, t));
if (models.length) for (const m of models) tr.append(cell(r, m, t));
else tr.append(el("td", t.notPublished, "state"));
frag.append(tr);
}
tbody.replaceChildren(frag);
summary.textContent = `${t.shown} ${visible.length} ${t.of} ${rows.length} ${t.benchmarks}`;
empty.hidden = visible.length !== 0;
wrap.hidden = visible.length === 0;
}
search.addEventListener("input", () => { state.query = search.value; fill(); });
lang.addEventListener("change", () => { state.language = lang.value; fill(); });
show.addEventListener("change", () => { state.show = show.value; fill(); });
clear.addEventListener("click", () => { state.query = ""; state.language = "all"; state.show = "all"; search.value = ""; lang.value = "all"; show.value = "all"; fill(); search.focus(); });
fill();
const files = document.getElementById("files");
files.replaceChildren(el("p", t.files));
for (const f of state.files) { const p = el("p"); p.append(el("code", `${f.name} · sha256 ${f.sha}`)); files.append(p); }
if (state.packet) files.append(el("p", `${t.packet}: ${t.run} ${state.packet.run_id} · ${t.protocol} ${state.packet.protocol_id}`));
}
async function read(path, pin) {
const res = await fetch(path, {cache:"no-store"});
if (!res.ok) throw new Error(`${path}: HTTP ${res.status}`);
const bytes = await res.arrayBuffer();
const digest = await crypto.subtle.digest("SHA-256", bytes);
const sha = [...new Uint8Array(digest)].map(b => b.toString(16).padStart(2, "0")).join("");
if (pin && sha !== pin) throw new Error(`${path}: pinned bytes changed`);
state.files.push({name:path, sha});
return {bytes, sha};
}
const json = r => JSON.parse(new TextDecoder().decode(r.bytes));
function setLang(l) {
state.lang = l === "pl" ? "pl" : "en";
document.body.dataset.lang = state.lang;
document.documentElement.lang = state.lang;
document.title = T[state.lang].title;
document.querySelector(".lang").setAttribute("aria-label", T[state.lang].pageLang);
document.querySelectorAll(".lang button").forEach(b => b.setAttribute("aria-pressed", String(b.dataset.set === state.lang)));
try { localStorage.setItem("slayer-lang", state.lang); } catch (e) {}
render();
}
async function start() {
try {
const tasks = await read("tasks_50.json", contract.PINS.tasks);
await read("results.schema.json", contract.PINS.schema);
await read("METHOD.md", contract.PINS.method);
await read("contamination_field_roles.json", contract.PINS.fieldRoles);
state.tasks = json(tasks);
if (state.tasks.rows.length !== 50) throw new Error("tasks_50.json: expected 50 rows");
} catch (e) { state.error = e.message; state.tasks = null; return; }
try {
const feed = json(await read("results-feed.json"));
if (feed.results !== null) {
if (feed.results !== "results.json") throw new Error("only results.json next to this page is allowed");
// The feed names the exact reviewed packet; any other bytes are refused.
if (!/^[0-9a-f]{64}$/.test(feed.sha256 || "")) throw new Error("results-feed.json: missing sha256 of results.json");
const res = await read("results.json", feed.sha256);
const packet = json(res);
state.index = contract.validate(packet, state.tasks);
state.packet = packet;
state.packetSHA = res.sha;
}
} catch (e) { state.error = e.message; state.packet = null; state.index = null; }
}
document.querySelectorAll(".lang button").forEach(b => b.addEventListener("click", () => setLang(b.dataset.set)));
let saved = null; try { saved = localStorage.getItem("slayer-lang"); } catch (e) {}
const q = new URLSearchParams(location.search).get("lang");
start().finally(() => setLang(q || saved || "en"));
})();