{"version":3,"sources":["webpack://Events/./Source/TypeScript/Dna/core.ts","webpack://Events/./Source/TypeScript/login.ts","webpack://Events/webpack/bootstrap","webpack://Events/webpack/startup"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,2FAA2F;AAC3F,uBAAuB;AACvB,2FAA2F;AAC3F;IAKG,sBAAsB;IACtB;QAAA,iBAWC;QATE,4BAA4B;QAC5B,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,2CAA2C;QAC3C,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE;YAE1C,8DAA8D;YAC9D,KAAI,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACN,CAAC;IAED,6BAA6B;IAC7B,4BAAa,GAAb;QAEG,oBAAoB;QACpB,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAC,IAAI;YAEjC,sBAAsB;YACtB,IAAI,EAAE,CAAC;QACV,CAAC,CAAC,CAAC;IACN,CAAC;IAED,6DAA6D;IAC7D,qBAAM,GAAN,UAAO,QAAsB;QAC1B,gCAAgC;QAChC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IACJ,WAAC;AAAD,CAAC;;AAED,4CAA4C;AAC5C,SAAgB,OAAO,CAAI,KAAe,EAAE,QAA2B;IAEpE,oBAAoB;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,qCAAqC;QACrC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KACrB;AACJ,CAAC;AAPD,0BAOC;;;;;;;;;;;;;;;;ACjDD,kEAAkE;;AAElE,4FAA4F;AAC5F,iCAAiC;AACjC,4FAA4F;AAE5F,sFAA6C;AAE7C,sBAAsB;AACtB,IAAM,OAAO,GAAG,IAAI,cAAI,EAAE,CAAC;AAE3B,cAAc;AACd,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\r\n//*****************************************************************************************\r\n//\t\t\t\tCore helper class\r\n//*****************************************************************************************\r\nexport default class Core \r\n{\r\n // Callback array to run on page load\r\n private mOnLoadCallbacks: { (): void }[];\r\n\r\n // Default constructor\r\n constructor() \r\n {\r\n // Initialize callback array\r\n this.mOnLoadCallbacks = [];\r\n\r\n // Listen out for page content loaded event\r\n document.addEventListener(\"DOMContentLoaded\", () =>\r\n {\r\n // Process anything that should happen once the page is loaded\r\n this.ProcessOnLoad();\r\n });\r\n }\r\n \r\n // Process any on load events\r\n ProcessOnLoad()\r\n {\r\n // Call the callback\r\n ForEach(this.mOnLoadCallbacks, (item) =>\r\n {\r\n // Invoke the callback\r\n item();\r\n });\r\n }\r\n\r\n // Called to add a function to be invoked once the page loads\r\n OnLoad(callback: { (): void }) {\r\n // Add this callback to the list\r\n this.mOnLoadCallbacks.push(callback);\r\n }\r\n}\r\n\r\n// // Helper function to iterate over arrays\r\nexport function ForEach(array: Array, callback: {(item: T): void}) \r\n{\r\n // Loop each item...\r\n for (var i = 0; i < array.length; i++) {\r\n // Pass the item back to the function\r\n callback(array[i]);\r\n }\r\n}","///\r\n\r\n//******************************************************************************************\r\n//\t\t\t\tMain entry for a login page\r\n//******************************************************************************************\r\n\r\nimport { default as Core } from \"./Dna/core\";\r\n\r\n// Initialize Dna Core\r\nconst DnaCore = new Core();\r\n\r\n// Run on load\r\nDnaCore.OnLoad(Initialize);\r\n\r\n//******************************************************************************************\r\n//\t\t\t\tInitialize on startup\r\n//******************************************************************************************\r\nfunction Initialize()\r\n{\r\n // Find all elements that have a href of #topmenu\r\n let loginButton = document.getElementById(\"login-button\");\r\n\r\n // Listen on the click event\r\n loginButton.addEventListener(\"click\", (e) =>\r\n {\r\n // Process event\r\n SubmitLogin(e);\r\n });\r\n\r\n // List for enter key\r\n document.addEventListener('keypress', (e) =>\r\n {\r\n var key = e.which || e.keyCode;\r\n if (key === 13) { \r\n SubmitLogin(e);\r\n }\r\n });\r\n}\r\n\r\n//******************************************************************************************\r\n//\t\t\t\tProcesses login response from server\r\n//******************************************************************************************\r\nfunction ProcessLoginResponse(result)\r\n{\r\n console.log(result);\r\n\r\n // Reset waiting flag\r\n AwaitingResponse(false);\r\n\r\n // If successful...\r\n if (result.successful)\r\n {\r\n // Get redirect URL\r\n let elements = DomSelectAll(\"[data-url]\");\r\n let url = elements[0].getAttribute(\"data-url\");\r\n\r\n // Redirect to main page\r\n window.location.href = url;\r\n }\r\n // Otherwise...\r\n else\r\n {\r\n // Log error message\r\n console.log(result.errorMessage);\r\n \r\n // Get error element\r\n let errorText = document.getElementById(\"invalid\");\r\n\r\n // If error text isn't visible...\r\n if (errorText.classList.contains(\"hidden\"))\r\n // Make visible\r\n errorText.classList.remove(\"hidden\");\r\n }\r\n}\r\n\r\n//******************************************************************************************\r\n//\t\t\t\tProcesses login data and submits to server\r\n//******************************************************************************************\r\nfunction SubmitLogin(e)\r\n{\r\n // Cancel navigation\r\n e.preventDefault();\r\n\r\n // Set waiting flag\r\n AwaitingResponse(true);\r\n\r\n // Get input elements\r\n let usernameInput = document.getElementById(\"username-input\") as HTMLInputElement;\r\n let passwordInput = document.getElementById(\"password-input\") as HTMLInputElement;\r\n\r\n // Get values\r\n let user = usernameInput.value.trim();\r\n let pass = passwordInput.value.trim();\r\n\r\n // If either is emtpy...\r\n if (user === \"\" || pass === \"\")\r\n {\r\n // Get error element\r\n let errorText = document.getElementById(\"invalid\");\r\n\r\n // Show the invalid text\r\n errorText.classList.remove(\"hidden\");\r\n\r\n // Don't send request to server\r\n return;\r\n }\r\n\r\n // Setup credentials\r\n let credentials = \r\n {\r\n \"UsernameOrEmail\": user,\r\n \"Password\": pass,\r\n };\r\n\r\n // Send login request\r\n $.ajax({\r\n url: \"/api/login\",\r\n type: \"POST\",\r\n data: JSON.stringify(credentials),\r\n contentType: \"application/json\",\r\n success: (result) => \r\n {\r\n ProcessLoginResponse(result);\r\n },\r\n error: (xhr, _, thrownError) => \r\n {\r\n alert(xhr.status);\r\n alert(thrownError);\r\n }\r\n });\r\n}\r\n\r\n//******************************************************************************************\r\n//\t\t\t\tSets waiting icon based on value\r\n//******************************************************************************************\r\nlet mAwaitingResponse = false;\r\nfunction AwaitingResponse(value)\r\n{\r\n // If no value...\r\n if (value === null)\r\n // This is a get request\r\n return mAwaitingResponse;\r\n\r\n // If same value...return\r\n if (mAwaitingResponse === value) return;\r\n\r\n // Set backing member\r\n mAwaitingResponse = value;\r\n\r\n // If waiting is true...\r\n if (value === true)\r\n // Show waiting icon\r\n GetById(\"waitingIcon\").classList.remove(\"hidden\");\r\n // Otherwise...\r\n else\r\n // Hide the icon\r\n GetById(\"waitingIcon\").classList.add(\"hidden\");\r\n}\r\n\r\n//******************************************************************************************\r\n// Shorthand helper to query dom elements by selector\r\n//******************************************************************************************\r\nfunction DomSelectAll(selector)\r\n{\r\n return document.querySelectorAll(selector);\r\n}\r\n\r\n//******************************************************************************************\r\n// Shorthand helper to get dom element by ID\r\n//******************************************************************************************\r\nfunction GetById(element)\r\n{\r\n return document.getElementById(element);\r\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./Source/TypeScript/login.ts\");\n"],"sourceRoot":""}