{"version":3,"file":"sessions_application-Bnl91Cu8.js","sources":["../../../app/javascript/entrypoints/sessions_application.js"],"sourcesContent":["import Ajv from 'ajv';\nimport addFormats from 'ajv-formats';\n\nconst setValidateEmail = () => {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => validateEmail());\n } else {\n validateEmail();\n }\n};\n\nconst validateEmail = () => {\n const validateTarget = document.getElementById('organization_user_email');\n if (!validateTarget) return;\n\n const ajv = new Ajv();\n addFormats(ajv);\n\n const validate = ajv.compile({\n type: 'string',\n format: 'email',\n });\n\n const errorMessage = document.createElement('div');\n errorMessage.className = 'p-loginForm__invailed';\n errorMessage.textContent = '*メールアドレスが無効です。';\n validateTarget.insertAdjacentElement('afterend', errorMessage);\n errorMessage.style.display = 'none';\n\n validateTarget.addEventListener('blur', () => {\n const email = validateTarget.value.trim();\n const isValid = validate(email);\n\n if (email === '' || isValid) {\n validateTarget.classList.remove('isInvailed');\n errorMessage.style.display = 'none';\n } else {\n validateTarget.classList.add('isInvailed');\n errorMessage.style.display = 'block';\n }\n });\n};\n\nsetValidateEmail();\n"],"names":["setValidateEmail","validateEmail","validateTarget","ajv","Ajv","addFormats","validate","errorMessage","email","isValid"],"mappings":"sFAGA,MAAMA,EAAmB,IAAM,CACzB,SAAS,aAAe,UAC1B,SAAS,iBAAiB,mBAAoB,IAAMC,EAAa,CAAE,EAEnEA,EAAe,CAEnB,EAEMA,EAAgB,IAAM,CAC1B,MAAMC,EAAiB,SAAS,eAAe,yBAAyB,EACxE,GAAI,CAACA,EAAgB,OAErB,MAAMC,EAAM,IAAIC,EAChBC,EAAWF,CAAG,EAEd,MAAMG,EAAWH,EAAI,QAAQ,CAC3B,KAAM,SACN,OAAQ,OACZ,CAAG,EAEKI,EAAe,SAAS,cAAc,KAAK,EACjDA,EAAa,UAAY,wBACzBA,EAAa,YAAc,iBAC3BL,EAAe,sBAAsB,WAAYK,CAAY,EAC7DA,EAAa,MAAM,QAAU,OAE7BL,EAAe,iBAAiB,OAAQ,IAAM,CAC5C,MAAMM,EAAQN,EAAe,MAAM,KAAM,EACnCO,EAAUH,EAASE,CAAK,EAE1BA,IAAU,IAAMC,GAClBP,EAAe,UAAU,OAAO,YAAY,EAC5CK,EAAa,MAAM,QAAU,SAE7BL,EAAe,UAAU,IAAI,YAAY,EACzCK,EAAa,MAAM,QAAU,QAEnC,CAAG,CACH,EAEAP,EAAkB"}