(()=>{const e=document.getElementById("restart"),t=document.getElementById("progress"),n=document.getElementById("info"),s=s=>{let d=JSON.parse(s.currentTarget.response);d.data.tmp<=0?(clearInterval(c),t.value=100,e.classList.remove("d-none"),n.classList.add("d-none")):(t.value=(d.data.articles-d.data.tmp)/d.data.articles*100,setTimeout(a,5e3))},d=t=>{let s=JSON.parse(t.currentTarget.response);"continue"===s.status?a():"restart"===s.status&&(e.classList.remove("d-none"),n.classList.add("d-none"))},a=()=>{const e=document.getElementById("body").dataset.cron,t=new XMLHttpRequest;t.addEventListener("load",s),t.open("POST",e,!0),t.send()},o=document.getElementById("body").dataset.start,r=new XMLHttpRequest;r.addEventListener("load",d),r.open("POST",o,!0),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send("method=check");let c=null;e.addEventListener("click",()=>{e.classList.add("d-none"),n.classList.remove("d-none");const t=document.getElementById("body").dataset.start,s=new XMLHttpRequest;s.addEventListener("load",d),s.open("POST",t,!0),s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send("method=cron")})})();