const sendButton=document.getElementById("buttonSendData"),email=document.getElementById("email"),password=document.getElementById("password"),div1=document.getElementById("div1"),div2=document.getElementById("div2"),messageError1=document.getElementById("messageError1"),messageError2=document.getElementById("messageError2"),formLogin=document.getElementById("formLogin");let validationLogin=!1;formLogin.addEventListener("submit",function(s){!0===div1.classList.contains("success")&&!0===div2.classList.contains("success")&&(validationLogin=!0),!1===validationLogin&&s.preventDefault()}),sendButton.addEventListener("click",function(){let s=email.value,e=/\S+@\S+\.\S+/.test(s);e?(div1.classList.add("success"),email.classList.remove("error-input"),messageError1.classList.remove("show-error-message")):(div1.classList.remove("success"),email.classList.add("error-input"),messageError1.classList.add("show-error-message"));var r=password.value.trim();""===r?(div2.classList.remove("success"),password.classList.add("error-input"),messageError2.classList.add("show-error-message")):r.length<3?(div2.classList.remove("success"),password.classList.add("error-input"),messageError2.classList.add("show-error-message")):r.length>=3&&(div2.classList.add("success"),password.classList.remove("error-input"),messageError2.classList.remove("show-error-message"))}),email.addEventListener("input",()=>{let s=email.value,e=/\S+@\S+\.\S+/.test(s);e?(div1.classList.add("success"),email.classList.remove("error-input"),messageError1.classList.remove("show-error-message")):(div1.classList.remove("success"),email.classList.add("error-input"),messageError1.classList.add("show-error-message"))}),password.addEventListener("input",()=>{var s=password.value.trim();""===s?(div2.classList.remove("success"),password.classList.add("error-input"),messageError2.classList.add("show-error-message")):s.length<3?(div2.classList.remove("success"),password.classList.add("error-input"),messageError2.classList.add("show-error-message")):s.length>=3&&(div2.classList.add("success"),password.classList.remove("error-input"),messageError2.classList.remove("show-error-message"))});const showOrHide=document.getElementById("showOrHide"),iconShowOrHide=document.getElementById("iconShowOrHide");showOrHide.addEventListener("click",()=>{password.focus(),"password"===password.getAttribute("type")?(password.setAttribute("type","text"),iconShowOrHide.src="../../img/hide-password.png",password.focus()):(password.setAttribute("type","password"),iconShowOrHide.src="../../img/show-password.png",password.focus())});