'use strict';dotclear.ready(()=>{Object.assign(dotclear.msg,dotclear.getData('maintenance'));function doStep(box,code,count){dotclear.jsonServicesPost('dcMaintenanceStep',(data)=>{const msg=document.querySelector('.step-msg');if(msg){msg.textContent=data.title;}
const next=data.code;if(next>0){doStep(box,next,data.count);return;}
const title=document.querySelector('#content h2');if(title&&msg){const div=document.createElement('div');div.classList.add('success');div.appendChild(msg);title.after(msg);}
const wait=document.querySelector('.step-wait');if(wait)wait.remove();const back=document.querySelector('.step-back');if(back)back.style.display='';},{task:box.getAttribute('id'),code,count,},(error)=>{const msg=document.querySelector('.step-msg');if(msg)msg.textContent=error;const wait=document.querySelector('.step-wait');if(wait)wait.remove();const back=document.querySelector('.step-back');if(back)back.style.display='';},);}
const box=document.querySelector('.step-box');if(!box){return;}
const code=box.querySelector('input[name=code]')?.value;const count=box.querySelector('input[name=count]')?.value;const submit=document.querySelector('.step-submit');if(submit)submit.remove();const back=document.querySelector('.step-back');if(back)back.style.display='none';const msg=document.querySelector('.step-msg');if(msg){const para=document.createElement('p');para.classList.add('step-wait');para.textContent=dotclear.msg.wait;msg.after(para);}
doStep(box,code,count);});