const t=/^\s*([a-z0-9.=_/+-]+|@[a-z0-9.=_/+-]+(:.*)?)\s*$/g;function n(e,s,r){if(!e)return null;const o=e.querySelectorAll(`[data-error-kind=${s}][data-error-code=${r}]`);let l=null;for(const a of o){if(!a.classList.contains("hidden"))return a;l=a}return l}function d(e){if(e.readOnly||e.disabled)return;const s=e.parentElement?.querySelector("label"),r=[e];s&&r.push(s);const o=n(e.parentElement,"policy","username-invalid-chars");o||console.warn("Could not find the error message in the DOM for username validation",e),e.addEventListener("input",()=>{e.value=e.value.toLocaleLowerCase();const l=e.value.match(t);if(!e.value.trim()||l!==null){for(const a of r)a.removeAttribute("data-invalid");o?.classList.add("hidden")}else{for(const a of r)a.setAttribute("data-invalid","");o?.classList.remove("hidden")}}),e.addEventListener("blur",()=>{e.value=e.value.trim()})}for(const e of document.querySelectorAll("input[data-choose-username]"))d(e);
//# sourceMappingURL=templates-4a1m02fU.js.map
