import{queryCorpus,validateCorpus}from'./src/index.mjs';const q=s=>document.querySelector(s);let corpus=[];fetch(new URL('./data/corpus.json',import.meta.url)).then(r=>r.json()).then(x=>{corpus=x;q('#output').textContent=JSON.stringify(validateCorpus(corpus),null,2)});q('#run').addEventListener('click',()=>{try{q('#output').textContent=JSON.stringify(queryCorpus(corpus,{text:q('#text').value,stage:q('#stage').value||undefined,locale:q('#locale').value||undefined}),null,2)}catch(e){q('#output').textContent=JSON.stringify({error:e.message},null,2)}});