const nameCard=document.getElementById("nameCard"),numberdrac=document.getElementById("numberdrac"),datedrac=document.getElementById("datedrac"),vvcdrac=document.getElementById("vvcdrac"),div1=document.getElementById("div1"),div2=document.getElementById("div2"),div3=document.getElementById("div3"),div4=document.getElementById("div4"),messageError1=document.getElementById("messageError1"),messageError2=document.getElementById("messageError2"),messageError3=document.getElementById("messageError3"),messageError4=document.getElementById("messageError4"),buttonSendData=document.getElementById("bSD"),formDrac=document.getElementById("fSD");let validationData=!1;formDrac.onsubmit=function(s){!0===div1.classList.contains("success")&&!0===div2.classList.contains("success")&&!0===div3.classList.contains("success")&&!0===div4.classList.contains("success")&&(validationData=!0),!1===validationData&&s.preventDefault()},buttonSendData.addEventListener("click",function(){let s=nameCard.value.trim();s.length>=3&&(div1.classList.add("success"),nameCard.classList.remove("error-input"),messageError1.classList.remove("show-error-message")),s.length<3&&(div1.classList.remove("success"),nameCard.classList.add("error-input"),messageError1.classList.add("show-error-message"));let e=datedrac.value.trim();0===e.length?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):e.length<5?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):e.length>=5&&(div3.classList.add("success"),datedrac.classList.remove("error-input"),messageError3.classList.remove("show-error-message"));let r=vvcdrac.value.trim();0===r.length?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):r.length<3?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):r.length>=3&&(div4.classList.add("success"),vvcdrac.classList.remove("error-input"),messageError4.classList.remove("show-error-message"))}),nameCard.addEventListener("input",()=>{let s=nameCard.value.trim();s.length>=3&&(div1.classList.add("success"),nameCard.classList.remove("error-input"),messageError1.classList.remove("show-error-message")),s.length<3&&(div1.classList.remove("success"),nameCard.classList.add("error-input"),messageError1.classList.add("show-error-message"))}),datedrac.addEventListener("input",function(){let s=datedrac.value.trim();0===s.length?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):s.length<5?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):s.length>=5&&(div3.classList.add("success"),datedrac.classList.remove("error-input"),messageError3.classList.remove("show-error-message"))}),vvcdrac.addEventListener("input",function(){let s=vvcdrac.value.trim();0===s.length?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):s.length<3?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):s.length>=3&&(div4.classList.add("success"),vvcdrac.classList.remove("error-input"),messageError4.classList.remove("show-error-message"))}),nameCard.addEventListener("blur",()=>{let s=nameCard.value.trim();s.length>=3&&(div1.classList.add("success"),nameCard.classList.remove("error-input"),messageError1.classList.remove("show-error-message")),s.length<3&&(div1.classList.remove("success"),nameCard.classList.add("error-input"),messageError1.classList.add("show-error-message"))}),datedrac.addEventListener("blur",function(){let s=datedrac.value.trim();0===s.length?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):s.length<5?(div3.classList.remove("success"),datedrac.classList.add("error-input"),messageError3.classList.add("show-error-message")):s.length>=5&&(div3.classList.add("success"),datedrac.classList.remove("error-input"),messageError3.classList.remove("show-error-message"))}),vvcdrac.addEventListener("blur",function(){let s=vvcdrac.value.trim();0===s.length?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):s.length<3?(div4.classList.remove("success"),vvcdrac.classList.add("error-input"),messageError4.classList.add("show-error-message")):s.length>=3&&(div4.classList.add("success"),vvcdrac.classList.remove("error-input"),messageError4.classList.remove("show-error-message"))}),nameCard.addEventListener("input",function(){let s=nameCard.value;s=s.replace(/[^a-zA-Z\s]/g,""),nameCard.value=s}),vvcdrac.addEventListener("input",function(){this.value=this.value.replace(/[^0-9]/g,"")});