// Replay the unchanged published Python results; no user address/hash/network input. export function filterCaseIndexes(rows,scenario='all',bytes='all'){return rows.map((r,i)=>({r,i})).filter(({r})=>(scenario==='all'||r.scenario===scenario)&&(bytes==='all'||(bytes==='same'?r.same_20_bytes_as_official===true:bytes==='different'&&r.same_20_bytes_as_official===false))).map(({i})=>i);} export function caseIndexFromHash(hash,count){if(!hash.startsWith('#erc55-case-'))return null;const m=/^#erc55-case-(\d+)$/.exec(hash);if(!m)return -1;const i=Number(m[1]);return Number.isSafeInteger(i)&&i>=0&&i=8?'대문자':'소문자'):'숫자는 유지',expected,c===expected?'일치':'다름']){const td=document.createElement('td');td.textContent=v;tr.append(td);}body.append(tr);}} function apply(preferred=Number(select.value)){const indices=filterCaseIndexes(data.rows,kind.value,bytes.value);select.replaceChildren();for(const i of indices){const row=data.rows[i],o=document.createElement('option');o.value=String(i);o.textContent=`테스트 ${row.vector} · ${names[row.scenario]}`;select.append(o);}select.disabled=!indices.length;if(indices.includes(preferred))select.value=String(preferred);count.textContent=`전체 ${data.rows.length}개 중 ${indices.length}개 사례`;draw();} function openHash(){const index=caseIndexFromHash(location.hash,data.rows.length);if(index===null)return;if(index<0){kind.value='all';bytes.value='all';apply(0);count.textContent+=' · 없는 사례 번호여서 첫 사례를 표시합니다.';return;}kind.value='all';bytes.value='all';apply(index);document.getElementById('viewer').scrollIntoView({block:'start'});} select.addEventListener('change',draw);kind.addEventListener('change',()=>apply());bytes.addEventListener('change',()=>apply());document.getElementById('case-reset').addEventListener('click',()=>{kind.value='all';bytes.value='all';history.replaceState(null,'',location.pathname+location.search+'#viewer');apply(0);select.focus();});window.addEventListener('hashchange',openHash);apply(0);openHash(); }