!function s(o,i,u){function c(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(d)return d(t,!0);var r=new Error("Cannot find module '"+t+"'");throw r.code="MODULE_NOT_FOUND",r}var a=i[t]={exports:{}};o[t][0].call(a.exports,function(e){return c(o[t][1][e]||e)},a,a.exports,s,o,i,u)}return i[t].exports}for(var d="function"==typeof require&&require,e=0;e<u.length;e++)c(u[e]);return c}({1:[function(e,t,n){"use strict";document.addEventListener("DOMContentLoaded",function(e){var t=document.getElementById("katisoft-show-auth-form"),n=document.getElementById("katisoft-auth-container"),r=document.getElementById("katisoft-auth-close"),s=document.getElementById("katisoft-auth-form"),o=s.querySelector('[data-message="status"]');function i(){o.innerHTML="",o.classList.remove("success","error"),s.querySelector('[name="submit"]').value="Login",s.querySelector('[name="submit"]').disabled=!1}t.addEventListener("click",function(){n.classList.add("show"),t.parentElement.classList.add("hide")}),r.addEventListener("click",function(){n.classList.remove("show"),t.parentElement.classList.remove("hide")}),s.addEventListener("submit",function(e){e.preventDefault(),i();var t=s.querySelector('[name="username"]').value,n=s.querySelector('[name="password"]').value;s.querySelector('[name="katisoft_auth"]').value;if(!t||!n)return o.innerHTML="Missing Data",void o.classList.add("error");var r=s.dataset.url,a=new URLSearchParams(new FormData(s));s.querySelector('[name="submit"]').value="Logging in...",s.querySelector('[name="submit"]').disabled=!0,fetch(r,{method:"POST",body:a}).then(function(e){return e.json()}).catch(function(e){i()}).then(function(e){if(i(),0===e||!e.status)return o.innerHTML=e.message,void o.classList.add("error");o.innerHTML=e.message,o.classList.add("success"),s.reset(),window.location.reload()})})})},{}]},{},[1]);
//# sourceMappingURL=auth.js.map
