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