{"version":3,"file":"form.js","sources":["../../../../../Flow.Showcase.Static.Bundler/Root/entrypoints/form.ts"],"sourcesContent":["// @ts-nocheck\n\nimport { sendFormData } from \"../modules/form.module.ts\";\n\nconst formHandlers = new WeakMap();\n\nfunction initFormHandle() {\n const forms = document.querySelectorAll(\"[data-handle-form-submit=true]\");\n for (const form of forms) {\n if (formHandlers.has(form)) continue;\n if (form instanceof HTMLFormElement) {\n form.addEventListener(\"submit\", (e) => {\n e.preventDefault();\n formSubmitHandler(form);\n });\n formHandlers.set(form, {});\n }\n }\n}\n\n/**\n * Обработчик отправки формы\n * @param {HTMLFormElement} form\n */\nfunction formSubmitHandler(form) {\n let formSuccessHandler;\n if (form.dataset.formSuccessHandler) {\n formSuccessHandler = window[form.dataset.formSuccessHandler];\n }\n let formErrorHandler;\n if (form.dataset.formErrorHandler) {\n formErrorHandler = window[form.dataset.formErrorHandler];\n }\n sendFormData(form, formSuccessHandler, formErrorHandler);\n}\n\ninitFormHandle();\n\nfunction showHidePassword(target) {\n let input = target.parentElement.getElementsByTagName(\"input\")[0];\n if (input.getAttribute(\"type\") === \"password\") {\n target.classList.add(\"view\");\n input.setAttribute(\"type\", \"text\");\n } else {\n target.classList.remove(\"view\");\n input.setAttribute(\"type\", \"password\");\n }\n return false;\n}\n\nwindow[\"showHidePassword\"] = showHidePassword;\n"],"names":["formHandlers","initFormHandle","forms","form","e","formSubmitHandler","formSuccessHandler","formErrorHandler","sendFormData","showHidePassword","target","input"],"mappings":"wGAIA,MAAMA,MAAmB,QAEzB,SAASC,GAAiB,CAChB,MAAAC,EAAQ,SAAS,iBAAiB,gCAAgC,EACxE,UAAWC,KAAQD,EACXF,EAAa,IAAIG,CAAI,GACrBA,aAAgB,kBACXA,EAAA,iBAAiB,SAAWC,GAAM,CACnCA,EAAE,eAAe,EACjBC,EAAkBF,CAAI,CAAA,CACzB,EACYH,EAAA,IAAIG,EAAM,EAAE,EAGrC,CAMA,SAASE,EAAkBF,EAAM,CACzB,IAAAG,EACAH,EAAK,QAAQ,qBACQG,EAAA,OAAOH,EAAK,QAAQ,kBAAkB,GAE3D,IAAAI,EACAJ,EAAK,QAAQ,mBACMI,EAAA,OAAOJ,EAAK,QAAQ,gBAAgB,GAE9CK,EAAAL,EAAMG,EAAoBC,CAAgB,CAC3D,CAEAN,EAAe,EAEf,SAASQ,EAAiBC,EAAQ,CAC9B,IAAIC,EAAQD,EAAO,cAAc,qBAAqB,OAAO,EAAE,CAAC,EAChE,OAAIC,EAAM,aAAa,MAAM,IAAM,YACxBD,EAAA,UAAU,IAAI,MAAM,EACrBC,EAAA,aAAa,OAAQ,MAAM,IAE1BD,EAAA,UAAU,OAAO,MAAM,EACxBC,EAAA,aAAa,OAAQ,UAAU,GAElC,EACX,CAEA,OAAO,iBAAsBF"}