(()=>{"use strict";const e={generic:[(e,t)=>t.hasAttribute("required")?((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&0===t.value.length&&(e=[...e,n("generic","required")]),e):e]};function n(e,n){var t,r,o,i;return window.NelioFormsErrorMessages&&((null===(r=null===(t=window.NelioFormsErrorMessages)||void 0===t?void 0:t[e])||void 0===r?void 0:r[n])||(null===(i=null===(o=window.NelioFormsErrorMessages)||void 0===o?void 0:o.generic)||void 0===i?void 0:i.unknown))||"Unknown error"}const t=function(){let n=0;return(...t)=>{const r=()=>{(n=>{var t,r;const o=(e=>{var n;return e.dataset.fieldType||(null!==(n=Array.from(e.classList).filter(e=>e.includes("__value--")&&!e.includes("required"))[0])&&void 0!==n?n:"").split("--")[1]||""})(n);if(void 0===e[o])return;const i=[...null!==(t=e.generic)&&void 0!==t?t:[],...null!==(r=e[o])&&void 0!==r?r:[]],l=(e=>{var n;const t=document.getElementById(null!==(n=e.id.split("__")[0])&&void 0!==n?n:"");return t instanceof HTMLFormElement?t:null})(n);if(!l)return;const d=(e=>e.id.split("__")[1]||"")(n);!function(e,n,t){const r=function(e,n){return document.getElementById(`${e.id}__${n}`)||void 0}(e,n);if(!r)return;const o=function(e,n){return document.getElementById(`${e.id}__${n}-error`)||function(e,n){var t,r,o;const i=document.createElement("label");i.setAttribute("id",`${e.id}__${n}-error`),i.setAttribute("for",`${e.id}__${n}`),i.classList.add("nelio-forms-field__error-label");const l=null===(t=document.getElementById(`${e.id}__${n}`))||void 0===t?void 0:t.parentElement;return(null===(r=null==l?void 0:l.classList)||void 0===r?void 0:r.contains("nelio-forms-field__value-container"))?null===(o=null==l?void 0:l.parentNode)||void 0===o||o.appendChild(i):null==l||l.appendChild(i),i}(e,n)}(e,n);r.classList.remove("nelio-forms-field__value--error"),o.innerHTML="",t.length&&(r.classList.add("nelio-forms-field__value--error"),t.forEach(e=>{const n=document.createElement("div");n.textContent=e,o.appendChild(n)}))}(l,d,i.reduce((e,t)=>t(e,n),[]))})(...t),n=0};if(n)return clearTimeout(n),void(n=setTimeout(r,0));n=setTimeout(r,0)}}();var r,o;!function(e){if("undefined"!=typeof document){if("complete"!==document.readyState&&"interactive"!==document.readyState)return document.addEventListener("DOMContentLoaded",e);e()}}(()=>Array.from(document.querySelectorAll(".nelio-forms-field__value")).forEach(e=>(e=>{e.addEventListener("keyup",()=>t(e)),e.addEventListener("change",()=>t(e)),e.addEventListener("blur",()=>t(e))})(e))),e[r="checkbox"]=null!==(o=e[r])&&void 0!==o?o:[],e[r]=e[r]})();