1const clearErrors=function(container){container.querySelectorAll(".n-form__error-msg").forEach(x=>x.parentElement?.removeChild(x)),container.querySelectorAll(".n-form .has-error").forEach(x=>{x.classList.remove("has-error")})},showErrors=function(container,errors){for(const error of errors){const input=error.key==="token"?container.querySelector(".n-form__recaptcha .g-recaptcha"):container.querySelector(`[name="${error.key}"]`);if(input){input.classList.add("has-error");const errorMsg=document.createElement("div");errorMsg.className="n-form__error-msg",errorMsg.setAttribute("role","alert");const describedById=input.id?`${input.id}-error`:`${error.key}-error`;errorMsg.id=describedById,errorMsg.textContent=error.msg,input.parentElement.appendChild(errorMsg)}}},saveData=async function(container,url,data){if(container.dataset.captchaRequired==="true"&&!data.token)return{success:!1,errors:[{key:"token",msg:"Please select the checkbox."}]};"token"in data&&delete data.token;const body=new URLSearchParams(data),res=await fetch(url,{method:"POST",body,headers:{"Content-Type":"application/x-www-form-urlencoded"},mode:"no-cors"});return res.status===200?{success:!0,errors:[]}:res.status===422?{success:!1,errors:(await res.json()).errors}:{success:!1,errors:[]}},getData=function(form){const inputs=form.querySelectorAll("input,select,textarea");let data={},isValid=!0;return inputs.forEach(function(input){data[input.name]=input.value.trim()}),[isValid,data]},initForm=function(container){const form=container.querySelector("form");let captchaToken="";window.onDNSCaptchaSubmit=function(token){captchaToken=token},window.onDNSCaptchaExpired=function(){captchaToken=""},form.querySelectorAll("input[maxlength],textarea[maxlength]").forEach(input=>{const parent=input.parentElement,help=document.createElement("div");help.className="n-form__chars",help.innerHTML=[`Max <strong>${input.maxLength}</strong> characters`,`remaining: <strong class="is-chars">${input.maxLength}</strong>`].join(", "),parent.appendChild(help),input.addEventListener("keydown",function(){setTimeout(function(){const counter=help.querySelector(".is-chars");counter.textContent=input.maxLength-input.value.length},1)})}),form.addEventListener("submit",event=>{if(event.preventDefault(),container.dataset.status==="loading")return;const[_isValid,data]=getData(form);container.dataset.status="loading",clearErrors(container),saveData(container,form.action,{...data,token:captchaToken}).then(res=>{if(res.errors.length>0){showErrors(container,res.errors),container.dataset.status="errors";return}container.dataset.status="submitted"})})};document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".n-form").forEach(x=>initForm(x))}); 2//# sourceMappingURL=/cdn/shop/t/632/assets/app-bundle.n-form.js.map?v=134311640868905268621789658318
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.