1import{D as m,_ as u}from"./site-B0IjnxmE.js";import{S as h}from"./site-lang-Bijq8_jq.js";import{F as l}from"./formater-BczQVLTd.js";import{E as f}from"./element.prototypes-CxdXTpvc.js";class p{constructor(){}static activateCountDecimals(){Number.prototype.countDecimals=function(){return Math.floor(this.valueOf())===this.valueOf()?0:this.toString().split(".")[1].length||0}}}p.activateCountDecimals();f.activateNearest();class g{constructor(e={}){this.siteLang=h.getLang(),this.options={plugins:[]},this.getLang().then(()=>{this.options={...this.options,...e};const t=document.querySelectorAll("form[data-validate]");Array.from(t).forEach((r,n)=>{new c(r,n,this)}),m.onDynamicContent(document.documentElement,"form[data-validate]",r=>{r.forEach((n,i)=>{new c(n,i+Date.now(),this)})}),this.options.plugins.forEach(r=>{(typeof r.module=="function"?new r.module(this):new r.module.plugin(this)).initElement()})})}async getLang(){this.lang=await b(`../i18n/s-validation-${this.siteLang}.json`)}checkValidation(e){const t=e.target;let r=!1;t.hasAttribute("readonly")&&(r=!0,t.removeAttribute("readonly"));const n=t.validity;let i=t.closest("[data-validate-wrapper]");if(i||(i=t.parentElement,i.setAttribute("data-validate-wrapper","")),t.getAttribute("disabled")==null)if(n.valid){if(t.type!=="hidden"){t.hasAttribute("aria-errormessage")&&(t.removeAttribute("aria-invalid"),t.removeAttribute("aria-errormessage"));const a=i.querySelector('[role="alert"]');a&&(a.classList.contains("[data-error-placeholder]")?(a.removeAttribute("role"),a.innerHTML=""):a.parentNode.removeChild(a))}}else{if(!i.querySelector('[role="alert"]')){const o=i.querySelector("[data-error-placeholder]");o?(o.setAttribute("role","alert"),o.id="error-"+t.getAttribute("data-unique-id")):i.insertAdjacentHTML("beforeend",`<div class="" id="${"error-"+t.getAttribute("data-unique-id")}" role="alert"></div>`)}t.setAttribute("aria-invalid","true"),t.setAttribute("aria-errormessage","error-"+t.getAttribute("data-unique-id"));const a=i.querySelector('[role="alert"]');a.innerHTML=this.getErrorMessage(n,t.getAttribute("type"),t)}r&&t.setAttribute("readonly","readonly")}getErrorMessage(e,t,r){const n=r.getAttribute("data-extra-message"),i=n?`<br />${n}`:"";return e.badInput&&t==="number"?this.lang.type.number+i:e.valueMissing?this.lang.required+i:e.typeMismatch&&t==="email"?this.lang.type.email+i:e.typeMismatch&&t==="url"?this.lang.type.url+i:e.typeMismatch&&t==="tel"?this.lang.type.tel+i:e.typeMismatch?this.lang.defaultMessage+i:e.stepMismatch&&parseFloat(r.getAttribute("step"))>=1?this.lang.stepInt+i:e.stepMismatch&&parseFloat(r.getAttribute("step"))<1?l.sprintf(this.lang.stepFloat,{max:parseFloat(r.getAttribute("step")).countDecimals()})+i:(e.rangeUnderflow||e.rangeOverflow)&&(t==="number"||t==="range")&&r.getAttribute("min")&&r.getAttribute("max")?l.sprintf(this.lang.range,{min:r.getAttribute("min"),max:r.getAttribute("max")})+i:e.rangeUnderflow&&(t==="number"||t==="range")&&r.getAttribute("min")?l.sprintf(this.lang.min,{min:r.getAttribute("min")})+i:e.rangeOverflow&&(t==="number"||t==="range")&&r.getAttribute("max")?l.sprintf(this.lang.max,{min:r.getAttribute("max")})+i:e.tooShort?l.sprintf(this.lang.minlength,{min:r.getAttribute("minlength")})+i:e.customError?r.validationMessage:n||this.lang.defaultMessage}}class c{constructor(e,t,r=new g){this.scrollToError=!0,this.validationComponent=r,e.setAttribute("novalidate","true"),this.initFormElements(e,t),this.initFormSubmit(e),this.scrollToError=e.getAttribute("data-scroll-to-error")!=="false";const n=document.querySelector('[aria-invalid="true"]');n&&this.scrollToError&&window.scrollTo({top:n.parentElement.offsetTop-100,behavior:"smooth"})}initFormElements(e,t){const r=e.querySelectorAll("input,textarea,select");Array.from(r).forEach((n,i)=>{this.initFormElement(n,`${t}-${i}`)})}initFormElement(e,t){e.getAttribute("novalidate")===null&&(e.addEventListener("blur",this.validationComponent.checkValidation.bind(this.validationComponent)),e.addEventListener("check-validation",this.validationComponent.checkValidation.bind(this.validationComponent)),e.setAttribute("data-unique-id","validate-"+t),(e.tagName==="SELECT"||e.tagName==="INPUT"&&(e.getAttribute("type").toLowerCase()==="checkbox"||e.getAttribute("type").toLowerCase()==="radio"))&&e.addEventListener("change",this.validationComponent.checkValidation.bind(this.validationComponent)))}initFormSubmit(e){e.addEventListener("onFormieValidate",t=>{this.submitForm(t,e)}),e.addEventListener("submit",t=>{this.submitForm(t,e)})}submitForm(e,t){let r=!0,n=!1;const i=t.querySelectorAll("input:not([data-dont-validate]),textarea:not(.g-recaptcha-response),select");
1if(Array.from(i).forEach((a,o)=>{if(a.getAttribute("disabled")==null){if(a.getAttribute("data-unique-id")===null&&this.initFormElement(a,`live-${document.querySelectorAll("[data-unique-id]").length+o}`),a.dispatchEvent(new Event("check-validation")),a.hasAttribute("readonly")?(a.removeAttribute("readonly"),r=a.validity.valid?r:!1,a.setAttribute("readonly","readonly")):r=a.validity.valid?r:!1,this.scrollToError&&!a.validity.valid&&!n){n=!0;const d=a.closest("[data-validate-wrapper]");d?window.scrollTo({top:d.offsetTop-100,behavior:"smooth"}):window.scrollTo({top:a.parentElement.offsetTop-100,behavior:"smooth"})}o===0&&a.focus()}}),!r)e.preventDefault();else{const a=t.querySelector("button[type=submit]");t.querySelectorAll(".g-recaptcha-response").length==0&&a.setAttribute("disabled","true"),a.classList.add("is-submitted"),t.dispatchEvent(new Event("valid-submit"))}}}function b(s){switch(s){case"../i18n/s-validation-en":case"../i18n/s-validation-en.json":return u(()=>import("./s-validation-en-B50yIM9J.js"),[]);case"../i18n/s-validation-fr":case"../i18n/s-validation-fr.json":return u(()=>import("./s-validation-fr-BVgQ3yrS.js"),[]);case"../i18n/s-validation-nl":case"../i18n/s-validation-nl.json":return u(()=>import("./s-validation-nl-CLzpi6h_.js"),[]);default:return new Promise(function(e,t){(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(t.bind(null,new Error("Unknown variable dynamic import: "+s)))})}}export{g as default};
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.