{"version":3,"sources":["webpack:///./src/pages/login.vue?a748","webpack:///./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack:///./node_modules/@babel/runtime/helpers/esm/classCallCheck.js","webpack:///./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack:///./src/utils/functions.js","webpack:///./src/utils/form.js","webpack:///src/pages/login.vue","webpack:///./src/pages/login.vue?c5a4","webpack:///./src/pages/login.vue?f516","webpack:///./src/pages/login.vue?296c"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","on","$event","preventDefault","login","_v","class","form","invalid","feedback","state","model","value","callback","$$v","$set","expression","domProps","_s","busy","_e","staticRenderFns","_typeof","obj","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","deepCopy","copy","Array","isArray","keys","forEach","arrayWrap","Errors","errors","field","messages","set","hasOwnProperty","fields","some","has","getAll","message","get","push","values","reduce","a","b","concat","Form","data","successful","originalData","assign","filter","ignore","includes","clear","url","config","submit","method","startProcessing","params","Promise","resolve","reject","axios","request","route","then","response","finishProcessing","catch","error","extractErrors","errorMessage","name","parameters","routes","decodeURI","id","replace","event","any","ret","layout","middleware","methods","component"],"mappings":"8IAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,cAAc,CAACA,EAAG,QAAQ,CAACE,YAAY,UAAUC,MAAM,CAAC,GAAK,IAAI,GAAK,IAAI,GAAK,MAAM,CAACH,EAAG,SAAS,CAACE,YAAY,cAAc,CAACF,EAAG,OAAO,CAACI,GAAG,CAAC,OAAS,SAASC,GAAgC,OAAxBA,EAAOC,iBAAwBV,EAAIW,MAAMF,MAAW,CAACL,EAAG,KAAK,CAACE,YAAY,yBAAyB,CAACN,EAAIY,GAAG,WAAWR,EAAG,eAAe,CAACA,EAA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A,4FAYA,oCACA,cACA,sBAdA,UAkBA,oCAlBA,QAqBA,yCArBA,8DCnE+U,I,wBCQ3UC,EAAY,eACd,EACAxH,EACA6B,GACA,EACA,KACA,WACA,MAIa,aAAA2F,E,2CCnBf,yBAAkiB,EAAG","file":"js/chunk-ad9746d8.50ecaaf7.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-container',[_c('b-col',{staticClass:\"mx-auto\",attrs:{\"sm\":\"8\",\"md\":\"6\",\"lg\":\"4\"}},[_c('b-card',{staticClass:\"login-card\"},[_c('form',{on:{\"submit\":function($event){$event.preventDefault();return _vm.login($event)}}},[_c('h1',{staticClass:\"title text-muted pb-3\"},[_vm._v(\" KEA \")]),_c('b-form-group',[_c('b-input-group',{staticClass:\"input-group-seamless no-border\",class:{ 'is-invalid': _vm.form.invalid('email') }},[_c('b-input-group-prepend',[_c('span',{staticClass:\"input-group-text\"},[_c('fa',{class:{ 'text-danger': _vm.form.feedback('email') },attrs:{\"icon\":\"envelope\"}})],1)]),_c('b-form-input',{attrs:{\"type\":\"email\",\"name\":\"email\",\"required\":\"\",\"state\":_vm.form.state('email'),\"placeholder\":\"Email\"},model:{value:(_vm.form.email),callback:function ($$v) {_vm.$set(_vm.form, \"email\", $$v)},expression:\"form.email\"}})],1),_c('b-form-invalid-feedback',{attrs:{\"state\":_vm.form.state('email')}},[_c('div',{domProps:{\"innerHTML\":_vm._s(_vm.form.feedback('email'))}})])],1),_c('b-form-group',[_c('b-input-group',{staticClass:\"input-group-seamless no-border\",class:{ 'is-invalid': _vm.form.invalid('password') }},[_c('b-input-group-prepend',[_c('span',{staticClass:\"input-group-text\"},[_c('fa',{class:{ 'text-danger': _vm.form.feedback('password') },attrs:{\"icon\":\"lock\"}})],1)]),_c('b-form-input',{attrs:{\"type\":\"password\",\"name\":\"password\",\"required\":\"\",\"state\":_vm.form.state('password'),\"placeholder\":\"Password\"},model:{value:(_vm.form.password),callback:function ($$v) {_vm.$set(_vm.form, \"password\", $$v)},expression:\"form.password\"}})],1)],1),_c('b-button',{staticClass:\"w-100\",attrs:{\"type\":\"submit\",\"block\":\"\",\"variant\":\"primary\",\"disabled\":_vm.form.busy}},[(_vm.form.busy)?_c('b-spinner',{staticClass:\"spinner-center\",attrs:{\"small\":\"\"}}):_vm._e(),_vm._v(\" Login \")],1)],1)])],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","/**\n * Get cookie from request.\n *\n * @param {Object} req\n * @param {String} key\n * @return {String|undefined}\n */\nexport function cookieFromRequest (req, key) {\n if (!req.headers.cookie) {\n return\n }\n\n const cookie = req.headers.cookie.split(';').find(\n c => c.trim().startsWith(`${key}=`)\n )\n\n if (cookie) {\n return cookie.split('=')[1]\n }\n}\n\n/**\n * https://router.vuejs.org/en/advanced/scroll-behavior.html\n */\nexport function scrollBehavior (to, from, savedPosition) {\n if (savedPosition) {\n return savedPosition\n }\n\n let position = {}\n\n if (to.matched.length < 2) {\n position = { x: 0, y: 0 }\n } else if (to.matched.some(r => r.components.default.options.scrollToTop)) {\n position = { x: 0, y: 0 }\n } if (to.hash) {\n position = { selector: to.hash }\n }\n\n return position\n}\n\n/**\n * Deep copy the given object.\n *\n * @param {Object} obj\n * @return {Object}\n */\nexport function deepCopy (obj) {\n if (obj === null || typeof obj !== 'object') {\n return obj\n }\n\n const copy = Array.isArray(obj) ? [] : {}\n\n Object.keys(obj).forEach((key) => {\n copy[key] = deepCopy(obj[key])\n })\n\n return copy\n}\n\n/**\n * If the given value is not an array, wrap it in one.\n *\n * @param {Any} value\n * @return {Array}\n */\nexport function arrayWrap (value) {\n return Array.isArray(value) ? value : [value]\n}\n\nexport function passwordChecker () {\n return {\n strong: new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})'),\n medium: new RegExp('^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})')\n }\n}\n\nexport function formatDateISO8601 (date) {\n if (Object.prototype.toString.call(date) === '[object Date]') {\n return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()\n }\n return null\n}\n\nexport function formatDate (date) {\n if (Object.prototype.toString.call(date) === '[object Date]') {\n return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear()\n }\n return null\n}\n\nexport function localeArray2Assoc (arr, keyArg = 'value', valueArg = 'text') {\n const ret = []\n if (arr) {\n for (const key in arr) {\n ret.push({\n [keyArg]: key,\n [valueArg]: arr[key]\n })\n }\n }\n return ret\n}\n\nexport function debounce (fn, time) {\n let timeout\n\n return function () {\n const functionCall = () => fn.apply(this, arguments)\n\n clearTimeout(timeout)\n timeout = setTimeout(functionCall, time)\n }\n}\n\nexport function getAge (birthDate) {\n const ageDifMs = Date.now() - new Date(birthDate).getTime()\n const ageDate = new Date(ageDifMs) // milliseconds from epoch\n return Math.abs(ageDate.getUTCFullYear() - 1970)\n}\n","import axios from 'axios'\nimport { deepCopy, arrayWrap } from './functions'\n\nclass Errors {\n /**\n * Create a new error bag instance.\n */\n constructor () {\n this.errors = {}\n }\n\n /**\n * Set the errors object or field error messages.\n *\n * @param {Object|String} field\n * @param {Array|String|undefined} messages\n */\n set (field, messages) {\n if (typeof field === 'object') {\n this.errors = field\n } else {\n this.set({ ...this.errors, [field]: arrayWrap(messages) })\n }\n }\n\n /**\n * Get all the errors.\n *\n * @return {Object}\n */\n all () {\n return this.errors\n }\n\n /**\n * Determine if there is an error for the given field.\n *\n * @param {String} field\n * @return {Boolean}\n */\n has (field) {\n // eslint-disable-next-line no-prototype-builtins\n return this.errors.hasOwnProperty(field)\n }\n\n /**\n * Determine if there are any errors for the given fields.\n *\n * @param {...String} fields\n * @return {Boolean}\n */\n hasAny (...fields) {\n return fields.some(field => this.has(field))\n }\n\n /**\n * Determine if there are any errors.\n *\n * @return {Boolean}\n */\n any () {\n return Object.keys(this.errors).length > 0\n }\n\n /**\n * Get the first error message for the given field.\n *\n * @param String} field\n * @return {String|undefined}\n */\n get (field) {\n if (this.has(field)) {\n return this.getAll(field)[0]\n }\n }\n\n /**\n * Get all the error messages for the given field.\n *\n * @param {String} field\n * @return {Array}\n */\n getAll (field) {\n return arrayWrap(this.errors[field] || [])\n }\n\n /**\n * Get the error message for the given fields.\n *\n * @param {...String} fields\n * @return {Array}\n */\n only (...fields) {\n const messages = []\n\n fields.forEach((field) => {\n const message = this.get(field)\n\n if (message) {\n messages.push(message)\n }\n })\n\n return messages\n }\n\n /**\n * Get all the errors in a flat array.\n *\n * @return {Array}\n */\n flatten () {\n return Object.values(this.errors).reduce((a, b) => a.concat(b), [])\n }\n\n /**\n * Clear one or all error fields.\n *\n * @param {String|undefined} field\n */\n clear (field) {\n const errors = {}\n\n if (field) {\n Object.keys(this.errors).forEach((key) => {\n if (key !== field) {\n errors[key] = this.errors[key]\n }\n })\n }\n\n this.set(errors)\n }\n}\nclass Form {\n /**\n * Create a new form instance.\n *\n * @param {Object} data\n */\n constructor (data = {}) {\n this.busy = false\n this.successful = false\n this.errors = new Errors()\n this.originalData = deepCopy(data)\n\n Object.assign(this, data)\n }\n\n /**\n * Fill form data.\n *\n * @param {Object} data\n */\n fill (data) {\n this.keys().forEach((key) => {\n this[key] = data[key]\n })\n }\n\n /**\n * Get the form data.\n *\n * @return {Object}\n */\n data () {\n return this.keys().reduce((data, key) => (\n { ...data, [key]: this[key] }\n ), {})\n }\n\n /**\n * Get the form data keys.\n *\n * @return {Array}\n */\n keys () {\n return Object.keys(this)\n .filter(key => !Form.ignore.includes(key))\n }\n\n /**\n * Start processing the form.\n */\n startProcessing () {\n this.errors.clear()\n this.busy = true\n this.successful = false\n }\n\n /**\n * Finish processing the form.\n */\n finishProcessing () {\n this.busy = false\n this.successful = true\n }\n\n /**\n * Clear the form errors.\n */\n clear () {\n this.errors.clear()\n this.successful = false\n }\n\n /**\n * Reset the form fields.\n */\n reset () {\n Object.keys(this)\n .filter(key => !Form.ignore.includes(key))\n .forEach((key) => {\n this[key] = deepCopy(this.originalData[key])\n })\n }\n\n /**\n * Submit the form via a GET request.\n *\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n get (url, config = {}) {\n return this.submit('get', url, config)\n }\n\n /**\n * Submit the form via a POST request.\n *\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n post (url, config = {}) {\n return this.submit('post', url, config)\n }\n\n /**\n * Submit the form via a PATCH request.\n *\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n patch (url, config = {}) {\n return this.submit('patch', url, config)\n }\n\n /**\n * Submit the form via a PUT request.\n *\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n put (url, config = {}) {\n return this.submit('put', url, config)\n }\n\n /**\n * Submit the form via a DELETE request.\n *\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n delete (url, config = {}) {\n return this.submit('delete', url, config)\n }\n\n /**\n * Submit the form data via an HTTP request.\n *\n * @param {String} method (get, post, patch, put)\n * @param {String} url\n * @param {Object} config (axios config)\n * @return {Promise}\n */\n submit (method, url, config = {}) {\n this.startProcessing()\n\n const data = method === 'get'\n ? { params: this.data() }\n : this.data()\n\n return new Promise((resolve, reject) => {\n (Form.axios || axios).request({ url: this.route(url), method, data, ...config })\n .then((response) => {\n this.finishProcessing()\n\n resolve(response)\n })\n .catch((error) => {\n this.busy = false\n\n if (error.response) {\n this.errors.set(this.extractErrors(error.response))\n }\n\n reject(error)\n })\n })\n }\n\n /**\n * Extract the errors from the response object.\n *\n * @param {Object} response\n * @return {Object}\n */\n extractErrors (response) {\n if (!response.data || typeof response.data !== 'object') {\n return { error: Form.errorMessage }\n }\n\n if (response.data.errors) {\n return { ...response.data.errors }\n }\n\n if (response.data.message) {\n return { error: response.data.message }\n }\n\n return { ...response.data }\n }\n\n /**\n * Get a named route.\n *\n * @param {String} name\n * @return {Object} parameters\n * @return {String}\n */\n route (name, parameters = {}) {\n let url = name\n\n // eslint-disable-next-line no-prototype-builtins\n if (Form.routes.hasOwnProperty(name)) {\n url = decodeURI(Form.routes[name])\n }\n\n if (typeof parameters !== 'object') {\n parameters = { id: parameters }\n }\n\n Object.keys(parameters).forEach((key) => {\n url = url.replace(`{${key}}`, parameters[key])\n })\n\n return url\n }\n\n /**\n * Clear errors on keydown.\n *\n * @param {KeyboardEvent} event\n */\n onKeydown (event) {\n if (event.target.name) {\n this.errors.clear(event.target.name)\n }\n }\n\n feedback (name) {\n if (this.errors.has(name)) {\n return this.errors.get(name)\n }\n }\n\n state (name) {\n if (this.errors.any() && this.errors.has(name)) {\n return false\n }\n return null\n }\n\n invalid (name) {\n const ret = this.state(name)\n if (ret === null) { return false }\n return true\n }\n}\n\nForm.routes = {}\nForm.errorMessage = 'Something went wrong. Please try again.'\nForm.ignore = ['busy', 'successful', 'errors', 'originalData']\n\nexport default Form\n","\n \n \n \n \n \n \n \n\n\n\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./login.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./login.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./login.vue?vue&type=template&id=844266b8&scoped=true&\"\nimport script from \"./login.vue?vue&type=script&lang=js&\"\nexport * from \"./login.vue?vue&type=script&lang=js&\"\nimport style0 from \"./login.vue?vue&type=style&index=0&id=844266b8&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"844266b8\",\n null\n \n)\n\nexport default component.exports","import mod from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./login.vue?vue&type=style&index=0&id=844266b8&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./login.vue?vue&type=style&index=0&id=844266b8&lang=scss&scoped=true&\""],"sourceRoot":""}