diff --git a/README.md b/README.md index 08250e7..1090b84 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or # Download https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/ -# Version: 0.2.2.0 -Refactored code and added tab count per session. +# Version: 0.2.1.4 +Removed SweetAlerts and am using Mustard UI # Images ![1 Default interface with no sessions. ](images/pic1.png) diff --git a/images/pic1.png b/images/pic1.png index 28df0df..5619851 100644 Binary files a/images/pic1.png and b/images/pic1.png differ diff --git a/images/pic2.png b/images/pic2.png index d09a4e3..b199b0f 100644 Binary files a/images/pic2.png and b/images/pic2.png differ diff --git a/images/pic3.png b/images/pic3.png index f192393..97697fa 100644 Binary files a/images/pic3.png and b/images/pic3.png differ diff --git a/images/pic4.png b/images/pic4.png index 70bb283..50bd110 100644 Binary files a/images/pic4.png and b/images/pic4.png differ diff --git a/images/pic5.png b/images/pic5.png index d806f61..c0c1e97 100644 Binary files a/images/pic5.png and b/images/pic5.png differ diff --git a/images/pic6.png b/images/pic6.png index b55bd1b..9cbf5ca 100644 Binary files a/images/pic6.png and b/images/pic6.png differ diff --git a/images/pic7.png b/images/pic7.png index ac04356..d14ce33 100644 Binary files a/images/pic7.png and b/images/pic7.png differ diff --git a/src/manifest.json b/src/manifest.json index 5f6842b..28589b7 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": " Easy Session Manager", - "version": "0.2.2.2", + "version": "0.2.2.4", "description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.", "applications": { diff --git a/src/pages/import.html b/src/pages/import.html index 70a6920..43fe8b9 100644 --- a/src/pages/import.html +++ b/src/pages/import.html @@ -4,32 +4,74 @@ Easy Session Manager Import + + + + + + -
+

Select File

- + + + +
- + +
+
+
+
+
+
+ + + + + + -
- diff --git a/src/pages/sessionManager.html b/src/pages/sessionManager.html index 6a50ed8..35d6936 100755 --- a/src/pages/sessionManager.html +++ b/src/pages/sessionManager.html @@ -2,50 +2,229 @@ + + + + + + + -
- - - + +
+
+ +
-

- - - - - -
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
- - - -
- - - - + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + diff --git a/src/scripts/actions.js b/src/scripts/actions.js index 2e4237a..d5fe0e8 100644 --- a/src/scripts/actions.js +++ b/src/scripts/actions.js @@ -1,10 +1,3 @@ -const messageWindow = (type = "warning", message = "No message passed in...") => { - Swal.fire({ - text: message, - icon: type - }); -} - const getSavedSessionIDs = () => { storageApi.get(null).then((results) => { const sessions = Object.keys(results); @@ -23,22 +16,10 @@ const saveToStorage = (name, data, action = "undefined", willReplace = false, sv try { const json = JSON.parse(results[name]); // If a session is found if (!willReplace) { - Swal.fire({ - title: "Replace?", - text: "Found a session with that name! Do you want to replace it?", - icon: "warning", - showCloseButton: true, - showCancelButton: true, - }).then((willReplace) => { - if (willReplace.value) { - storageApi.set({[name]: data}); - sveElm.innerText = size + " | " + name; - sveElm.name = name; - messageWindow("warning", "Overwrote session..."); - } else { - messageWindow("warning", "Canceled " + action + "..."); - } - }); + holderName = name; + holderData = data; + holderSize = size; + showModal("confModal"); } else { sveElm.innerText = size + " | " + name; sveElm.name = name; @@ -59,23 +40,11 @@ const saveToStorage = (name, data, action = "undefined", willReplace = false, sv } const deleteFromStorage = (elm = null, name = null) => { - Swal.fire({ - title: "Are you sure?", - text: "Do you wish to delete session:\n" + name + "?", - icon: "warning", - showCloseButton: true, - showCancelButton: true, - }).then((willDelete) => { - if (willDelete.value) { - storageApi.remove(name).then(() => { - elm.parentElement.removeChild(elm); - }); - selectedItem = null; // reset selectedItem - messageWindow("success", "Deleted session successfully..."); - } else { - messageWindow("warning", "Canceled deletion..."); - } + storageApi.remove(name).then(() => { + elm.parentElement.removeChild(elm); }); + selectedItem = null; // reset selectedItem + messageWindow("success", "Deleted session successfully..."); } const windowMaker = (i, keysLength, keys, json) => { diff --git a/src/scripts/background.js b/src/scripts/background.js index c71a8e4..1f655ef 100644 --- a/src/scripts/background.js +++ b/src/scripts/background.js @@ -1,79 +1,132 @@ -const message1 = "What is this session's name? Allowed: a-z, A-Z, -, _"; +const message2 = "Name too long or none provided; or, unacceptable character used."; const regexp = /^[a-zA-Z0-9-_]+$/; // Alphanumeric, dash, underscore -const messageWindow = (type = "warning", message = "No message passed in...") => { - Swal.fire({ - text: message, - icon: type - }); +let data = null; + + +const prePprocessor = (obj, enteryName = '', message = "") => { + let inputTag = document.getElementsByName("toSaveNameImport")[0]; + inputTag.value = enteryName.replace(/ /g, "_"); + data = obj.target.result; + document.getElementsByName("toSaveImportErrMessage")[0].innerText = message; } -const processor = (obj, enteryName = '', message = message1) => { - let data = obj.target.result; - let inputTag = document.createElement("INPUT"); - - let pTag = document.createElement("P"); - let brTag = document.createElement("BR"); - let textTag = document.createTextNode(message); - +const processor = () => { + let inputTag = document.getElementsByName("toSaveNameImport")[0]; + enteryName = inputTag.value.replace(/ /g, "_"); inputTag.value = enteryName; - pTag.append(textTag); - pTag.appendChild(brTag); - pTag.appendChild(inputTag); + if (enteryName.length < 0 || enteryName.length > 54 || enteryName.search(regexp) == -1) { + messageWindow("danger", message2, "modal-gutter"); + // prePprocessor(obj, "", message2); + return ; + } - Swal.fire({ - title: "Session Name:", - text: message, - html: pTag, - showCloseButton: true, - showCancelButton: true, - customClass: 'swal-modal', - }).then((result) => { - if (result.value) { - enteryName = inputTag.value.replace(/ /g, "_"); - - if (enteryName.length < 0 || enteryName.length > 54 || enteryName.search(regexp) == -1) { - processor(obj, "", "Allowed: a-z, A-Z, 0-9, -, _ Please try again...\nName too long or none provided; or, unacceptable character used."); - return ; - } - - try { - console.log("Importing session..."); - JSON.parse(data); // See if parsing fails and throw error - browser.storage.local.set({[enteryName]: data}); - messageWindow("success", "Imported file successfully."); - } catch (e) { - messageWindow("error", "Failed to import data. Not a JSON parsable file."); - return ; - } - } else { - messageWindow("warning", "Canceled import."); - } - }); + try { + console.log("Importing session..."); + JSON.parse(data); // See if parsing fails and throw error + browser.storage.local.set({[enteryName]: data}); + messageWindow("success", "Imported file successfully."); + hideModal(); + } catch (e) { + hideModal(); + messageWindow("error", "Failed to import data. Not a JSON parsable file."); + return ; + } }; +// Get files after being chosen document.getElementById("inputId").onchange = (e) => { let size = e.target.files.length; let fileArry = e.target.files; + // Loop throughg the chosen files... for (var i = 0; i < size; i++) { let reader = new FileReader(); let name = fileArry[i].name; name = name.split(".")[0]; - reader.onloadend = (obj) => { processor(obj, name); }; + reader.onloadend = (obj) => { + prePprocessor(obj, name); + showModal(); + }; if (fileArry[i].type == "application/json") reader.readAsText(fileArry[i], {encoding: "string"}); } }; - +// Bring up file selector... document.addEventListener("click", (e) => { if (e.button == 0) { // Left click - if (e.target.className == "container") { + const target = e.target; + const action = target.name; + + if (target.className.includes("container")) { document.getElementById("inputId").click(); + } else if (action == "importSave") { + processor(); } } }); + + + +const showModal = async (modalID = "saveModal") => { + tween(1600, "up", modalID); // in miliseconds +} + +const hideModal = (modalID = "saveModal") => { + tween(1600, "down", modalID); // in miliseconds +} + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +const tween = async (miliseconds, direction, modalID) => { + const elm = document.getElementById(modalID); + const timeStep = 1000 / miliseconds; + const steps = timeStep * 100 + + if (direction == "up") { // Go up + elm.style.display = ""; + // elm.style.opacity = "1"; + for (var i = 1; i <= steps; i++) { + await sleep(timeStep); + elm.style.opacity = i/steps; + } + } else { // Go down + for (var i = steps; i > 1; i--) { + await sleep(timeStep); + elm.style.opacity = i/steps; + } + // elm.style.opacity = "0"; + elm.style.display = "none"; + } + +} + +const messageWindow = (type = "warning", message = "No message passed in...", target = "") => { + let pTag = document.createElement("P"); + let text = document.createTextNode(message); + let gutter = document.getElementById("message-gutter"); + + if (target !== "") { + gutter = document.getElementById(target); + } + + pTag.className = "alert alert-" + type; + pTag.appendChild(text); + gutter.prepend(pTag); + + setTimeout(function () { + clearChildNodes(gutter); + }, 3200); +} + +const clearChildNodes = (parent) => { + while (parent.firstChild) { + parent.removeChild(parent.firstChild); + } +} diff --git a/src/scripts/events.js b/src/scripts/events.js index 7a1be15..2f42208 100644 --- a/src/scripts/events.js +++ b/src/scripts/events.js @@ -2,8 +2,8 @@ getSavedSessionIDs(); document.addEventListener("click", (e) => { if (e.button == 0) { // Left click - const target = e.target; - const action = target.name; + const target = e.target; + const action = target.name; // Set selection first before doing any actions... if (target.tagName == "LI" && target.className.includes("sessionLI")) { @@ -22,21 +22,69 @@ document.addEventListener("click", (e) => { } } - // If elm has certain action do it. const selectedItemName = (selectedItem !== null) ? selectedItem.getAttribute("name") : ""; - if (/(download|delete|edit)/.test(action)) { + + // Modals + if (/(saveModalLauncher|editModalLauncher|deleteModalLauncher|downloadModalLauncher)/.test(action)) { + if (action == "saveModalLauncher") { + preSaveSession(selectedItem, selectedItemName); + showModal("saveModal"); + return ; + } + if (selectedItem) { - if (action == "download") - downloadSession(selectedItemName); - else if (action == "delete") - deleteFromStorage(selectedItem, selectedItemName); - else if (action == "edit") - editSession(selectedItem, selectedItemName); + if (action == "editModalLauncher") { + preEditSession(selectedItem, selectedItemName); + showModal("editModal"); + } else if (action == "deleteModalLauncher") { + document.getElementsByName("toDeleteName")[0].innerText = selectedItemName; + showModal("deleteModal"); + } else if (action == "downloadModalLauncher") { + preDownloadSession(selectedItemName); + showModal("downloadModal"); + } } else { messageWindow("warning", "Select a session first..."); } + + return ; + } + + if (/(closeSave|closeEdit|closeDownload|closeDelete|closeConfirm|closeLoad)/.test(action)) { + if (action.includes("closeSave")) { + hideModal("saveModal"); + } else if (action.includes("closeEdit")) { + hideModal("editModal"); + } else if (action.includes("closeDownload")) { + hideModal("downloadModal"); + } else if (action.includes("closeDelete")) { + hideModal("deleteModal"); + } else if (action.includes("closeConfirm")) { + hideModal("confModal"); + } else if (action.includes("closeLoad")) { + hideModal("loadModal"); + } + } + + + // Actions + if (/(download|delete|edit|load)/.test(action)) { + if (selectedItem) { + if (action == "download") { + downloadSession(selectedItemName); + } else if (action == "delete") { + deleteFromStorage(selectedItem, selectedItemName); + hideModal("deleteModal"); + } else if (action == "edit") { + editSession(selectedItem, selectedItemName); + } else if (action == "load") { + startLoadSession(); + } + } } else if (action == "save") { saveSession(selectedItem, selectedItemName); + } else if (action == "confirm") { + confirmSessionOverwrite(); } else if (action == "import") { importSession(); } else if (action == "donate") { @@ -45,6 +93,7 @@ document.addEventListener("click", (e) => { } }); + document.addEventListener("dblclick", (e) => { if (e.button == 0) { // Left click if (e.target.tagName == "LI" && e.target.className.includes("sessionLI")) { diff --git a/src/scripts/libs/place-holder.txt b/src/scripts/libs/place-holder.txt new file mode 100644 index 0000000..90a1d60 --- /dev/null +++ b/src/scripts/libs/place-holder.txt @@ -0,0 +1 @@ +... \ No newline at end of file diff --git a/src/scripts/libs/sweetalert2.all.js b/src/scripts/libs/sweetalert2.all.js deleted file mode 100644 index 94235e4..0000000 --- a/src/scripts/libs/sweetalert2.all.js +++ /dev/null @@ -1,3056 +0,0 @@ -/*! -* sweetalert2 v9.8.2 -* Released under the MIT License. -*/ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.Sweetalert2 = factory()); -}(this, function () { 'use strict'; - - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - function _extends() { - _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - }; - - return _extends.apply(this, arguments); - } - - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); - } - - function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - function isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); - return true; - } catch (e) { - return false; - } - } - - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) _setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); - } - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } - - return _assertThisInitialized(self); - } - - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) break; - } - - return object; - } - - function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); - - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); - } - - var consolePrefix = 'SweetAlert2:'; - /** - * Filter the unique values into a new array - * @param arr - */ - - var uniqueArray = function uniqueArray(arr) { - var result = []; - - for (var i = 0; i < arr.length; i++) { - if (result.indexOf(arr[i]) === -1) { - result.push(arr[i]); - } - } - - return result; - }; - /** - * Capitalize the first letter of a string - * @param str - */ - - var capitalizeFirstLetter = function capitalizeFirstLetter(str) { - return str.charAt(0).toUpperCase() + str.slice(1); - }; - /** - * Returns the array ob object values (Object.values isn't supported in IE11) - * @param obj - */ - - var objectValues = function objectValues(obj) { - return Object.keys(obj).map(function (key) { - return obj[key]; - }); - }; - /** - * Convert NodeList to Array - * @param nodeList - */ - - var toArray = function toArray(nodeList) { - return Array.prototype.slice.call(nodeList); - }; - /** - * Standardise console warnings - * @param message - */ - - var warn = function warn(message) { - console.warn("".concat(consolePrefix, " ").concat(message)); - }; - /** - * Standardise console errors - * @param message - */ - - var error = function error(message) { - console.error("".concat(consolePrefix, " ").concat(message)); - }; - /** - * Private global state for `warnOnce` - * @type {Array} - * @private - */ - - var previousWarnOnceMessages = []; - /** - * Show a console warning, but only if it hasn't already been shown - * @param message - */ - - var warnOnce = function warnOnce(message) { - if (!(previousWarnOnceMessages.indexOf(message) !== -1)) { - previousWarnOnceMessages.push(message); - warn(message); - } - }; - /** - * Show a one-time console warning about deprecated params/methods - */ - - var warnAboutDepreation = function warnAboutDepreation(deprecatedParam, useInstead) { - warnOnce("\"".concat(deprecatedParam, "\" is deprecated and will be removed in the next major release. Please use \"").concat(useInstead, "\" instead.")); - }; - /** - * If `arg` is a function, call it (with no arguments or context) and return the result. - * Otherwise, just pass the value through - * @param arg - */ - - var callIfFunction = function callIfFunction(arg) { - return typeof arg === 'function' ? arg() : arg; - }; - var isPromise = function isPromise(arg) { - return arg && Promise.resolve(arg) === arg; - }; - - var DismissReason = Object.freeze({ - cancel: 'cancel', - backdrop: 'backdrop', - close: 'close', - esc: 'esc', - timer: 'timer' - }); - - var isJqueryElement = function isJqueryElement(elem) { - return _typeof(elem) === 'object' && elem.jquery; - }; - - var isElement = function isElement(elem) { - return elem instanceof Element || isJqueryElement(elem); - }; - - var argsToParams = function argsToParams(args) { - var params = {}; - - if (_typeof(args[0]) === 'object' && !isElement(args[0])) { - _extends(params, args[0]); - } else { - ['title', 'html', 'icon'].forEach(function (name, index) { - var arg = args[index]; - - if (typeof arg === 'string' || isElement(arg)) { - params[name] = arg; - } else if (arg !== undefined) { - error("Unexpected type of ".concat(name, "! Expected \"string\" or \"Element\", got ").concat(_typeof(arg))); - } - }); - } - - return params; - }; - - var swalPrefix = 'swal2-'; - var prefix = function prefix(items) { - var result = {}; - - for (var i in items) { - result[items[i]] = swalPrefix + items[i]; - } - - return result; - }; - var swalClasses = prefix(['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'toast-column', 'show', 'hide', 'close', 'title', 'header', 'content', 'html-container', 'actions', 'confirm', 'cancel', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error']); - var iconTypes = prefix(['success', 'warning', 'info', 'question', 'error']); - - var getContainer = function getContainer() { - return document.body.querySelector(".".concat(swalClasses.container)); - }; - var elementBySelector = function elementBySelector(selectorString) { - var container = getContainer(); - return container ? container.querySelector(selectorString) : null; - }; - - var elementByClass = function elementByClass(className) { - return elementBySelector(".".concat(className)); - }; - - var getPopup = function getPopup() { - return elementByClass(swalClasses.popup); - }; - var getIcons = function getIcons() { - var popup = getPopup(); - return toArray(popup.querySelectorAll(".".concat(swalClasses.icon))); - }; - var getIcon = function getIcon() { - var visibleIcon = getIcons().filter(function (icon) { - return isVisible(icon); - }); - return visibleIcon.length ? visibleIcon[0] : null; - }; - var getTitle = function getTitle() { - return elementByClass(swalClasses.title); - }; - var getContent = function getContent() { - return elementByClass(swalClasses.content); - }; - var getHtmlContainer = function getHtmlContainer() { - return elementByClass(swalClasses['html-container']); - }; - var getImage = function getImage() { - return elementByClass(swalClasses.image); - }; - var getProgressSteps = function getProgressSteps() { - return elementByClass(swalClasses['progress-steps']); - }; - var getValidationMessage = function getValidationMessage() { - return elementByClass(swalClasses['validation-message']); - }; - var getConfirmButton = function getConfirmButton() { - return elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.confirm)); - }; - var getCancelButton = function getCancelButton() { - return elementBySelector(".".concat(swalClasses.actions, " .").concat(swalClasses.cancel)); - }; - var getActions = function getActions() { - return elementByClass(swalClasses.actions); - }; - var getHeader = function getHeader() { - return elementByClass(swalClasses.header); - }; - var getFooter = function getFooter() { - return elementByClass(swalClasses.footer); - }; - var getTimerProgressBar = function getTimerProgressBar() { - return elementByClass(swalClasses['timer-progress-bar']); - }; - var getCloseButton = function getCloseButton() { - return elementByClass(swalClasses.close); - }; // https://github.com/jkup/focusable/blob/master/index.js - - var focusable = "\n a[href],\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n [tabindex=\"0\"],\n [contenteditable],\n audio[controls],\n video[controls],\n summary\n"; - var getFocusableElements = function getFocusableElements() { - var focusableElementsWithTabindex = toArray(getPopup().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')) // sort according to tabindex - .sort(function (a, b) { - a = parseInt(a.getAttribute('tabindex')); - b = parseInt(b.getAttribute('tabindex')); - - if (a > b) { - return 1; - } else if (a < b) { - return -1; - } - - return 0; - }); - var otherFocusableElements = toArray(getPopup().querySelectorAll(focusable)).filter(function (el) { - return el.getAttribute('tabindex') !== '-1'; - }); - return uniqueArray(focusableElementsWithTabindex.concat(otherFocusableElements)).filter(function (el) { - return isVisible(el); - }); - }; - var isModal = function isModal() { - return !isToast() && !document.body.classList.contains(swalClasses['no-backdrop']); - }; - var isToast = function isToast() { - return document.body.classList.contains(swalClasses['toast-shown']); - }; - var isLoading = function isLoading() { - return getPopup().hasAttribute('data-loading'); - }; - - var states = { - previousBodyPadding: null - }; - var hasClass = function hasClass(elem, className) { - if (!className) { - return false; - } - - var classList = className.split(/\s+/); - - for (var i = 0; i < classList.length; i++) { - if (!elem.classList.contains(classList[i])) { - return false; - } - } - - return true; - }; - - var removeCustomClasses = function removeCustomClasses(elem, params) { - toArray(elem.classList).forEach(function (className) { - if (!(objectValues(swalClasses).indexOf(className) !== -1) && !(objectValues(iconTypes).indexOf(className) !== -1) && !(objectValues(params.showClass).indexOf(className) !== -1)) { - elem.classList.remove(className); - } - }); - }; - - var applyCustomClass = function applyCustomClass(elem, params, className) { - removeCustomClasses(elem, params); - - if (params.customClass && params.customClass[className]) { - if (typeof params.customClass[className] !== 'string' && !params.customClass[className].forEach) { - return warn("Invalid type of customClass.".concat(className, "! Expected string or iterable object, got \"").concat(_typeof(params.customClass[className]), "\"")); - } - - addClass(elem, params.customClass[className]); - } - }; - function getInput(content, inputType) { - if (!inputType) { - return null; - } - - switch (inputType) { - case 'select': - case 'textarea': - case 'file': - return getChildByClass(content, swalClasses[inputType]); - - case 'checkbox': - return content.querySelector(".".concat(swalClasses.checkbox, " input")); - - case 'radio': - return content.querySelector(".".concat(swalClasses.radio, " input:checked")) || content.querySelector(".".concat(swalClasses.radio, " input:first-child")); - - case 'range': - return content.querySelector(".".concat(swalClasses.range, " input")); - - default: - return getChildByClass(content, swalClasses.input); - } - } - var focusInput = function focusInput(input) { - input.focus(); // place cursor at end of text in text input - - if (input.type !== 'file') { - // http://stackoverflow.com/a/2345915 - var val = input.value; - input.value = ''; - input.value = val; - } - }; - var toggleClass = function toggleClass(target, classList, condition) { - if (!target || !classList) { - return; - } - - if (typeof classList === 'string') { - classList = classList.split(/\s+/).filter(Boolean); - } - - classList.forEach(function (className) { - if (target.forEach) { - target.forEach(function (elem) { - condition ? elem.classList.add(className) : elem.classList.remove(className); - }); - } else { - condition ? target.classList.add(className) : target.classList.remove(className); - } - }); - }; - var addClass = function addClass(target, classList) { - toggleClass(target, classList, true); - }; - var removeClass = function removeClass(target, classList) { - toggleClass(target, classList, false); - }; - var getChildByClass = function getChildByClass(elem, className) { - for (var i = 0; i < elem.childNodes.length; i++) { - if (hasClass(elem.childNodes[i], className)) { - return elem.childNodes[i]; - } - } - }; - var applyNumericalStyle = function applyNumericalStyle(elem, property, value) { - if (value || parseInt(value) === 0) { - elem.style[property] = typeof value === 'number' ? "".concat(value, "px") : value; - } else { - elem.style.removeProperty(property); - } - }; - var show = function show(elem) { - var display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'flex'; - elem.style.opacity = ''; - elem.style.display = display; - }; - var hide = function hide(elem) { - elem.style.opacity = ''; - elem.style.display = 'none'; - }; - var toggle = function toggle(elem, condition, display) { - condition ? show(elem, display) : hide(elem); - }; // borrowed from jquery $(elem).is(':visible') implementation - - var isVisible = function isVisible(elem) { - return !!(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length)); - }; - /* istanbul ignore next */ - - var isScrollable = function isScrollable(elem) { - return !!(elem.scrollHeight > elem.clientHeight); - }; // borrowed from https://stackoverflow.com/a/46352119 - - var hasCssAnimation = function hasCssAnimation(elem) { - var style = window.getComputedStyle(elem); - var animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0'); - var transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0'); - return animDuration > 0 || transDuration > 0; - }; - var contains = function contains(haystack, needle) { - if (typeof haystack.contains === 'function') { - return haystack.contains(needle); - } - }; - var animateTimerProgressBar = function animateTimerProgressBar(timer) { - var reset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - var timerProgressBar = getTimerProgressBar(); - - if (isVisible(timerProgressBar)) { - if (reset) { - timerProgressBar.style.transition = 'none'; - timerProgressBar.style.width = '100%'; - } - - setTimeout(function () { - timerProgressBar.style.transition = "width ".concat(timer / 1000, "s linear"); - timerProgressBar.style.width = '0%'; - }, 10); - } - }; - var stopTimerProgressBar = function stopTimerProgressBar() { - var timerProgressBar = getTimerProgressBar(); - var timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width); - timerProgressBar.style.removeProperty('transition'); - timerProgressBar.style.width = '100%'; - var timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width); - var timerProgressBarPercent = parseInt(timerProgressBarWidth / timerProgressBarFullWidth * 100); - timerProgressBar.style.removeProperty('transition'); - timerProgressBar.style.width = "".concat(timerProgressBarPercent, "%"); - }; - - // Detect Node env - var isNodeEnv = function isNodeEnv() { - return typeof window === 'undefined' || typeof document === 'undefined'; - }; - - var sweetHTML = "\n
\n
\n
    \n
    \n
    \n
    \n
    \n
    \n \n

    \n \n
    \n
    \n
    \n \n \n
    \n \n \n
    \n \n
    \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n").replace(/(^|\n)\s*/g, ''); - - var resetOldContainer = function resetOldContainer() { - var oldContainer = getContainer(); - - if (!oldContainer) { - return false; - } - - oldContainer.parentNode.removeChild(oldContainer); - removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); - return true; - }; - - var oldInputVal; // IE11 workaround, see #1109 for details - - var resetValidationMessage = function resetValidationMessage(e) { - if (Swal.isVisible() && oldInputVal !== e.target.value) { - Swal.resetValidationMessage(); - } - - oldInputVal = e.target.value; - }; - - var addInputChangeListeners = function addInputChangeListeners() { - var content = getContent(); - var input = getChildByClass(content, swalClasses.input); - var file = getChildByClass(content, swalClasses.file); - var range = content.querySelector(".".concat(swalClasses.range, " input")); - var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output")); - var select = getChildByClass(content, swalClasses.select); - var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input")); - var textarea = getChildByClass(content, swalClasses.textarea); - input.oninput = resetValidationMessage; - file.onchange = resetValidationMessage; - select.onchange = resetValidationMessage; - checkbox.onchange = resetValidationMessage; - textarea.oninput = resetValidationMessage; - - range.oninput = function (e) { - resetValidationMessage(e); - rangeOutput.value = range.value; - }; - - range.onchange = function (e) { - resetValidationMessage(e); - range.nextSibling.value = range.value; - }; - }; - - var getTarget = function getTarget(target) { - return typeof target === 'string' ? document.querySelector(target) : target; - }; - - var setupAccessibility = function setupAccessibility(params) { - var popup = getPopup(); - popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); - popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); - - if (!params.toast) { - popup.setAttribute('aria-modal', 'true'); - } - }; - - var setupRTL = function setupRTL(targetElement) { - if (window.getComputedStyle(targetElement).direction === 'rtl') { - addClass(getContainer(), swalClasses.rtl); - } - }; - /* - * Add modal + backdrop to DOM - */ - - - var init = function init(params) { - // Clean up the old popup container if it exists - var oldContainerExisted = resetOldContainer(); - /* istanbul ignore if */ - - if (isNodeEnv()) { - error('SweetAlert2 requires document to initialize'); - return; - } - - var container = document.createElement('div'); - container.className = swalClasses.container; - - if (oldContainerExisted) { - addClass(container, swalClasses['no-transition']); - } - - container.innerHTML = sweetHTML; - var targetElement = getTarget(params.target); - targetElement.appendChild(container); - setupAccessibility(params); - setupRTL(targetElement); - addInputChangeListeners(); - }; - - var parseHtmlToContainer = function parseHtmlToContainer(param, target) { - // DOM element - if (param instanceof HTMLElement) { - target.appendChild(param); // Object - } else if (_typeof(param) === 'object') { - handleObject(param, target); // Plain string - } else if (param) { - target.innerHTML = param; - } - }; - - var handleObject = function handleObject(param, target) { - // JQuery element(s) - if (param.jquery) { - handleJqueryElem(target, param); // For other objects use their string representation - } else { - target.innerHTML = param.toString(); - } - }; - - var handleJqueryElem = function handleJqueryElem(target, elem) { - target.innerHTML = ''; - - if (0 in elem) { - for (var i = 0; i in elem; i++) { - target.appendChild(elem[i].cloneNode(true)); - } - } else { - target.appendChild(elem.cloneNode(true)); - } - }; - - var animationEndEvent = function () { - // Prevent run in Node env - - /* istanbul ignore if */ - if (isNodeEnv()) { - return false; - } - - var testEl = document.createElement('div'); - var transEndEventNames = { - WebkitAnimation: 'webkitAnimationEnd', - OAnimation: 'oAnimationEnd oanimationend', - animation: 'animationend' - }; - - for (var i in transEndEventNames) { - if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') { - return transEndEventNames[i]; - } - } - - return false; - }(); - - // https://github.com/twbs/bootstrap/blob/master/js/src/modal.js - - var measureScrollbar = function measureScrollbar() { - var scrollDiv = document.createElement('div'); - scrollDiv.className = swalClasses['scrollbar-measure']; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; - }; - - var renderActions = function renderActions(instance, params) { - var actions = getActions(); - var confirmButton = getConfirmButton(); - var cancelButton = getCancelButton(); // Actions (buttons) wrapper - - if (!params.showConfirmButton && !params.showCancelButton) { - hide(actions); - } // Custom class - - - applyCustomClass(actions, params, 'actions'); // Render confirm button - - renderButton(confirmButton, 'confirm', params); // render Cancel Button - - renderButton(cancelButton, 'cancel', params); - - if (params.buttonsStyling) { - handleButtonsStyling(confirmButton, cancelButton, params); - } else { - removeClass([confirmButton, cancelButton], swalClasses.styled); - confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = ''; - cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = ''; - } - - if (params.reverseButtons) { - confirmButton.parentNode.insertBefore(cancelButton, confirmButton); - } - }; - - function handleButtonsStyling(confirmButton, cancelButton, params) { - addClass([confirmButton, cancelButton], swalClasses.styled); // Buttons background colors - - if (params.confirmButtonColor) { - confirmButton.style.backgroundColor = params.confirmButtonColor; - } - - if (params.cancelButtonColor) { - cancelButton.style.backgroundColor = params.cancelButtonColor; - } // Loading state - - - var confirmButtonBackgroundColor = window.getComputedStyle(confirmButton).getPropertyValue('background-color'); - confirmButton.style.borderLeftColor = confirmButtonBackgroundColor; - confirmButton.style.borderRightColor = confirmButtonBackgroundColor; - } - - function renderButton(button, buttonType, params) { - toggle(button, params["show".concat(capitalizeFirstLetter(buttonType), "Button")], 'inline-block'); - button.innerHTML = params["".concat(buttonType, "ButtonText")]; // Set caption text - - button.setAttribute('aria-label', params["".concat(buttonType, "ButtonAriaLabel")]); // ARIA label - // Add buttons custom classes - - button.className = swalClasses[buttonType]; - applyCustomClass(button, params, "".concat(buttonType, "Button")); - addClass(button, params["".concat(buttonType, "ButtonClass")]); - } - - function handleBackdropParam(container, backdrop) { - if (typeof backdrop === 'string') { - container.style.background = backdrop; - } else if (!backdrop) { - addClass([document.documentElement, document.body], swalClasses['no-backdrop']); - } - } - - function handlePositionParam(container, position) { - if (position in swalClasses) { - addClass(container, swalClasses[position]); - } else { - warn('The "position" parameter is not valid, defaulting to "center"'); - addClass(container, swalClasses.center); - } - } - - function handleGrowParam(container, grow) { - if (grow && typeof grow === 'string') { - var growClass = "grow-".concat(grow); - - if (growClass in swalClasses) { - addClass(container, swalClasses[growClass]); - } - } - } - - var renderContainer = function renderContainer(instance, params) { - var container = getContainer(); - - if (!container) { - return; - } - - handleBackdropParam(container, params.backdrop); - - if (!params.backdrop && params.allowOutsideClick) { - warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); - } - - handlePositionParam(container, params.position); - handleGrowParam(container, params.grow); // Custom class - - applyCustomClass(container, params, 'container'); // Set queue step attribute for getQueueStep() method - - var queueStep = document.body.getAttribute('data-swal2-queue-step'); - - if (queueStep) { - container.setAttribute('data-queue-step', queueStep); - document.body.removeAttribute('data-swal2-queue-step'); - } - }; - - /** - * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ - var privateProps = { - promise: new WeakMap(), - innerParams: new WeakMap(), - domCache: new WeakMap() - }; - - var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; - var renderInput = function renderInput(instance, params) { - var content = getContent(); - var innerParams = privateProps.innerParams.get(instance); - var rerender = !innerParams || params.input !== innerParams.input; - inputTypes.forEach(function (inputType) { - var inputClass = swalClasses[inputType]; - var inputContainer = getChildByClass(content, inputClass); // set attributes - - setAttributes(inputType, params.inputAttributes); // set class - - inputContainer.className = inputClass; - - if (rerender) { - hide(inputContainer); - } - }); - - if (params.input) { - if (rerender) { - showInput(params); - } // set custom class - - - setCustomClass(params); - } - }; - - var showInput = function showInput(params) { - if (!renderInputType[params.input]) { - return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\"")); - } - - var inputContainer = getInputContainer(params.input); - var input = renderInputType[params.input](inputContainer, params); - show(input); // input autofocus - - setTimeout(function () { - focusInput(input); - }); - }; - - var removeAttributes = function removeAttributes(input) { - for (var i = 0; i < input.attributes.length; i++) { - var attrName = input.attributes[i].name; - - if (!(['type', 'value', 'style'].indexOf(attrName) !== -1)) { - input.removeAttribute(attrName); - } - } - }; - - var setAttributes = function setAttributes(inputType, inputAttributes) { - var input = getInput(getContent(), inputType); - - if (!input) { - return; - } - - removeAttributes(input); - - for (var attr in inputAttributes) { - // Do not set a placeholder for - // it'll crash Edge, #1298 - if (inputType === 'range' && attr === 'placeholder') { - continue; - } - - input.setAttribute(attr, inputAttributes[attr]); - } - }; - - var setCustomClass = function setCustomClass(params) { - var inputContainer = getInputContainer(params.input); - - if (params.customClass) { - addClass(inputContainer, params.customClass.input); - } - }; - - var setInputPlaceholder = function setInputPlaceholder(input, params) { - if (!input.placeholder || params.inputPlaceholder) { - input.placeholder = params.inputPlaceholder; - } - }; - - var getInputContainer = function getInputContainer(inputType) { - var inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input; - return getChildByClass(getContent(), inputClass); - }; - - var renderInputType = {}; - - renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = function (input, params) { - if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') { - input.value = params.inputValue; - } else if (!isPromise(params.inputValue)) { - warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(params.inputValue), "\"")); - } - - setInputPlaceholder(input, params); - input.type = params.input; - return input; - }; - - renderInputType.file = function (input, params) { - setInputPlaceholder(input, params); - return input; - }; - - renderInputType.range = function (range, params) { - var rangeInput = range.querySelector('input'); - var rangeOutput = range.querySelector('output'); - rangeInput.value = params.inputValue; - rangeInput.type = params.input; - rangeOutput.value = params.inputValue; - return range; - }; - - renderInputType.select = function (select, params) { - select.innerHTML = ''; - - if (params.inputPlaceholder) { - var placeholder = document.createElement('option'); - placeholder.innerHTML = params.inputPlaceholder; - placeholder.value = ''; - placeholder.disabled = true; - placeholder.selected = true; - select.appendChild(placeholder); - } - - return select; - }; - - renderInputType.radio = function (radio) { - radio.innerHTML = ''; - return radio; - }; - - renderInputType.checkbox = function (checkboxContainer, params) { - var checkbox = getInput(getContent(), 'checkbox'); - checkbox.value = 1; - checkbox.id = swalClasses.checkbox; - checkbox.checked = Boolean(params.inputValue); - var label = checkboxContainer.querySelector('span'); - label.innerHTML = params.inputPlaceholder; - return checkboxContainer; - }; - - renderInputType.textarea = function (textarea, params) { - textarea.value = params.inputValue; - setInputPlaceholder(textarea, params); - - if ('MutationObserver' in window) { - // #1699 - var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); - var popupPadding = parseInt(window.getComputedStyle(getPopup()).paddingLeft) + parseInt(window.getComputedStyle(getPopup()).paddingRight); - - var outputsize = function outputsize() { - var contentWidth = textarea.offsetWidth + popupPadding; - - if (contentWidth > initialPopupWidth) { - getPopup().style.width = "".concat(contentWidth, "px"); - } else { - getPopup().style.width = null; - } - }; - - new MutationObserver(outputsize).observe(textarea, { - attributes: true, - attributeFilter: ['style'] - }); - } - - return textarea; - }; - - var renderContent = function renderContent(instance, params) { - var content = getContent().querySelector("#".concat(swalClasses.content)); // Content as HTML - - if (params.html) { - parseHtmlToContainer(params.html, content); - show(content, 'block'); // Content as plain text - } else if (params.text) { - content.textContent = params.text; - show(content, 'block'); // No content - } else { - hide(content); - } - - renderInput(instance, params); // Custom class - - applyCustomClass(getContent(), params, 'content'); - }; - - var renderFooter = function renderFooter(instance, params) { - var footer = getFooter(); - toggle(footer, params.footer); - - if (params.footer) { - parseHtmlToContainer(params.footer, footer); - } // Custom class - - - applyCustomClass(footer, params, 'footer'); - }; - - var renderCloseButton = function renderCloseButton(instance, params) { - var closeButton = getCloseButton(); - closeButton.innerHTML = params.closeButtonHtml; // Custom class - - applyCustomClass(closeButton, params, 'closeButton'); - toggle(closeButton, params.showCloseButton); - closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); - }; - - var renderIcon = function renderIcon(instance, params) { - var innerParams = privateProps.innerParams.get(instance); // if the give icon already rendered, apply the custom class without re-rendering the icon - - if (innerParams && params.icon === innerParams.icon && getIcon()) { - applyCustomClass(getIcon(), params, 'icon'); - return; - } - - hideAllIcons(); - - if (!params.icon) { - return; - } - - if (Object.keys(iconTypes).indexOf(params.icon) !== -1) { - var icon = elementBySelector(".".concat(swalClasses.icon, ".").concat(iconTypes[params.icon])); - show(icon); // Custom or default content - - setContent(icon, params); - adjustSuccessIconBackgoundColor(); // Custom class - - applyCustomClass(icon, params, 'icon'); // Animate icon - - addClass(icon, params.showClass.icon); - } else { - error("Unknown icon! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.icon, "\"")); - } - }; - - var hideAllIcons = function hideAllIcons() { - var icons = getIcons(); - - for (var i = 0; i < icons.length; i++) { - hide(icons[i]); - } - }; // Adjust success icon background color to match the popup background color - - - var adjustSuccessIconBackgoundColor = function adjustSuccessIconBackgoundColor() { - var popup = getPopup(); - var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); - var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); - - for (var i = 0; i < successIconParts.length; i++) { - successIconParts[i].style.backgroundColor = popupBackgroundColor; - } - }; - - var setContent = function setContent(icon, params) { - icon.innerHTML = ''; - - if (params.iconHtml) { - icon.innerHTML = iconContent(params.iconHtml); - } else if (params.icon === 'success') { - icon.innerHTML = "\n
    \n \n
    \n
    \n "; - } else if (params.icon === 'error') { - icon.innerHTML = "\n \n \n \n \n "; - } else { - var defaultIconHtml = { - question: '?', - warning: '!', - info: 'i' - }; - icon.innerHTML = iconContent(defaultIconHtml[params.icon]); - } - }; - - var iconContent = function iconContent(content) { - return "
    ").concat(content, "
    "); - }; - - var renderImage = function renderImage(instance, params) { - var image = getImage(); - - if (!params.imageUrl) { - return hide(image); - } - - show(image); // Src, alt - - image.setAttribute('src', params.imageUrl); - image.setAttribute('alt', params.imageAlt); // Width, height - - applyNumericalStyle(image, 'width', params.imageWidth); - applyNumericalStyle(image, 'height', params.imageHeight); // Class - - image.className = swalClasses.image; - applyCustomClass(image, params, 'image'); - }; - - var currentSteps = []; - /* - * Global function for chaining sweetAlert popups - */ - - var queue = function queue(steps) { - var Swal = this; - currentSteps = steps; - - var resetAndResolve = function resetAndResolve(resolve, value) { - currentSteps = []; - resolve(value); - }; - - var queueResult = []; - return new Promise(function (resolve) { - (function step(i, callback) { - if (i < currentSteps.length) { - document.body.setAttribute('data-swal2-queue-step', i); - Swal.fire(currentSteps[i]).then(function (result) { - if (typeof result.value !== 'undefined') { - queueResult.push(result.value); - step(i + 1, callback); - } else { - resetAndResolve(resolve, { - dismiss: result.dismiss - }); - } - }); - } else { - resetAndResolve(resolve, { - value: queueResult - }); - } - })(0); - }); - }; - /* - * Global function for getting the index of current popup in queue - */ - - var getQueueStep = function getQueueStep() { - return getContainer().getAttribute('data-queue-step'); - }; - /* - * Global function for inserting a popup to the queue - */ - - var insertQueueStep = function insertQueueStep(step, index) { - if (index && index < currentSteps.length) { - return currentSteps.splice(index, 0, step); - } - - return currentSteps.push(step); - }; - /* - * Global function for deleting a popup from the queue - */ - - var deleteQueueStep = function deleteQueueStep(index) { - if (typeof currentSteps[index] !== 'undefined') { - currentSteps.splice(index, 1); - } - }; - - var createStepElement = function createStepElement(step) { - var stepEl = document.createElement('li'); - addClass(stepEl, swalClasses['progress-step']); - stepEl.innerHTML = step; - return stepEl; - }; - - var createLineElement = function createLineElement(params) { - var lineEl = document.createElement('li'); - addClass(lineEl, swalClasses['progress-step-line']); - - if (params.progressStepsDistance) { - lineEl.style.width = params.progressStepsDistance; - } - - return lineEl; - }; - - var renderProgressSteps = function renderProgressSteps(instance, params) { - var progressStepsContainer = getProgressSteps(); - - if (!params.progressSteps || params.progressSteps.length === 0) { - return hide(progressStepsContainer); - } - - show(progressStepsContainer); - progressStepsContainer.innerHTML = ''; - var currentProgressStep = parseInt(params.currentProgressStep === undefined ? getQueueStep() : params.currentProgressStep); - - if (currentProgressStep >= params.progressSteps.length) { - warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); - } - - params.progressSteps.forEach(function (step, index) { - var stepEl = createStepElement(step); - progressStepsContainer.appendChild(stepEl); - - if (index === currentProgressStep) { - addClass(stepEl, swalClasses['active-progress-step']); - } - - if (index !== params.progressSteps.length - 1) { - var lineEl = createLineElement(step); - progressStepsContainer.appendChild(lineEl); - } - }); - }; - - var renderTitle = function renderTitle(instance, params) { - var title = getTitle(); - toggle(title, params.title || params.titleText); - - if (params.title) { - parseHtmlToContainer(params.title, title); - } - - if (params.titleText) { - title.innerText = params.titleText; - } // Custom class - - - applyCustomClass(title, params, 'title'); - }; - - var renderHeader = function renderHeader(instance, params) { - var header = getHeader(); // Custom class - - applyCustomClass(header, params, 'header'); // Progress steps - - renderProgressSteps(instance, params); // Icon - - renderIcon(instance, params); // Image - - renderImage(instance, params); // Title - - renderTitle(instance, params); // Close button - - renderCloseButton(instance, params); - }; - - var renderPopup = function renderPopup(instance, params) { - var popup = getPopup(); // Width - - applyNumericalStyle(popup, 'width', params.width); // Padding - - applyNumericalStyle(popup, 'padding', params.padding); // Background - - if (params.background) { - popup.style.background = params.background; - } // Classes - - - addClasses(popup, params); - }; - - var addClasses = function addClasses(popup, params) { - // Default Class + showClass when updating Swal.update({}) - popup.className = "".concat(swalClasses.popup, " ").concat(isVisible(popup) ? params.showClass.popup : ''); - - if (params.toast) { - addClass([document.documentElement, document.body], swalClasses['toast-shown']); - addClass(popup, swalClasses.toast); - } else { - addClass(popup, swalClasses.modal); - } // Custom class - - - applyCustomClass(popup, params, 'popup'); - - if (typeof params.customClass === 'string') { - addClass(popup, params.customClass); - } // Icon class (#1842) - - - if (params.icon) { - addClass(popup, swalClasses["icon-".concat(params.icon)]); - } - }; - - var render = function render(instance, params) { - renderPopup(instance, params); - renderContainer(instance, params); - renderHeader(instance, params); - renderContent(instance, params); - renderActions(instance, params); - renderFooter(instance, params); - - if (typeof params.onRender === 'function') { - params.onRender(getPopup()); - } - }; - - /* - * Global function to determine if SweetAlert2 popup is shown - */ - - var isVisible$1 = function isVisible$$1() { - return isVisible(getPopup()); - }; - /* - * Global function to click 'Confirm' button - */ - - var clickConfirm = function clickConfirm() { - return getConfirmButton() && getConfirmButton().click(); - }; - /* - * Global function to click 'Cancel' button - */ - - var clickCancel = function clickCancel() { - return getCancelButton() && getCancelButton().click(); - }; - - function fire() { - var Swal = this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _construct(Swal, args); - } - - /** - * Returns an extended version of `Swal` containing `params` as defaults. - * Useful for reusing Swal configuration. - * - * For example: - * - * Before: - * const textPromptOptions = { input: 'text', showCancelButton: true } - * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) - * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) - * - * After: - * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) - * const {value: firstName} = await TextPrompt('What is your first name?') - * const {value: lastName} = await TextPrompt('What is your last name?') - * - * @param mixinParams - */ - function mixin(mixinParams) { - var MixinSwal = - /*#__PURE__*/ - function (_this) { - _inherits(MixinSwal, _this); - - function MixinSwal() { - _classCallCheck(this, MixinSwal); - - return _possibleConstructorReturn(this, _getPrototypeOf(MixinSwal).apply(this, arguments)); - } - - _createClass(MixinSwal, [{ - key: "_main", - value: function _main(params) { - return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, _extends({}, mixinParams, params)); - } - }]); - - return MixinSwal; - }(this); - - return MixinSwal; - } - - /** - * Show spinner instead of Confirm button - */ - - var showLoading = function showLoading() { - var popup = getPopup(); - - if (!popup) { - Swal.fire(); - } - - popup = getPopup(); - var actions = getActions(); - var confirmButton = getConfirmButton(); - show(actions); - show(confirmButton, 'inline-block'); - addClass([popup, actions], swalClasses.loading); - confirmButton.disabled = true; - popup.setAttribute('data-loading', true); - popup.setAttribute('aria-busy', true); - popup.focus(); - }; - - var RESTORE_FOCUS_TIMEOUT = 100; - - var globalState = {}; - - var focusPreviousActiveElement = function focusPreviousActiveElement() { - if (globalState.previousActiveElement && globalState.previousActiveElement.focus) { - globalState.previousActiveElement.focus(); - globalState.previousActiveElement = null; - } else if (document.body) { - document.body.focus(); - } - }; // Restore previous active (focused) element - - - var restoreActiveElement = function restoreActiveElement() { - return new Promise(function (resolve) { - var x = window.scrollX; - var y = window.scrollY; - globalState.restoreFocusTimeout = setTimeout(function () { - focusPreviousActiveElement(); - resolve(); - }, RESTORE_FOCUS_TIMEOUT); // issues/900 - - /* istanbul ignore if */ - - if (typeof x !== 'undefined' && typeof y !== 'undefined') { - // IE doesn't have scrollX/scrollY support - window.scrollTo(x, y); - } - }); - }; - - /** - * If `timer` parameter is set, returns number of milliseconds of timer remained. - * Otherwise, returns undefined. - */ - - var getTimerLeft = function getTimerLeft() { - return globalState.timeout && globalState.timeout.getTimerLeft(); - }; - /** - * Stop timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - - var stopTimer = function stopTimer() { - if (globalState.timeout) { - stopTimerProgressBar(); - return globalState.timeout.stop(); - } - }; - /** - * Resume timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - - var resumeTimer = function resumeTimer() { - if (globalState.timeout) { - var remaining = globalState.timeout.start(); - animateTimerProgressBar(remaining); - return remaining; - } - }; - /** - * Resume timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - - var toggleTimer = function toggleTimer() { - var timer = globalState.timeout; - return timer && (timer.running ? stopTimer() : resumeTimer()); - }; - /** - * Increase timer. Returns number of milliseconds of an updated timer. - * If `timer` parameter isn't set, returns undefined. - */ - - var increaseTimer = function increaseTimer(n) { - if (globalState.timeout) { - var remaining = globalState.timeout.increase(n); - animateTimerProgressBar(remaining, true); - return remaining; - } - }; - /** - * Check if timer is running. Returns true if timer is running - * or false if timer is paused or stopped. - * If `timer` parameter isn't set, returns undefined - */ - - var isTimerRunning = function isTimerRunning() { - return globalState.timeout && globalState.timeout.isRunning(); - }; - - var defaultParams = { - title: '', - titleText: '', - text: '', - html: '', - footer: '', - icon: undefined, - iconHtml: undefined, - toast: false, - animation: true, - showClass: { - popup: 'swal2-show', - backdrop: 'swal2-backdrop-show', - icon: 'swal2-icon-show' - }, - hideClass: { - popup: 'swal2-hide', - backdrop: 'swal2-backdrop-hide', - icon: 'swal2-icon-hide' - }, - customClass: undefined, - target: 'body', - backdrop: true, - heightAuto: true, - allowOutsideClick: true, - allowEscapeKey: true, - allowEnterKey: true, - stopKeydownPropagation: true, - keydownListenerCapture: false, - showConfirmButton: true, - showCancelButton: false, - preConfirm: undefined, - confirmButtonText: 'OK', - confirmButtonAriaLabel: '', - confirmButtonColor: undefined, - cancelButtonText: 'Cancel', - cancelButtonAriaLabel: '', - cancelButtonColor: undefined, - buttonsStyling: true, - reverseButtons: false, - focusConfirm: true, - focusCancel: false, - showCloseButton: false, - closeButtonHtml: '×', - closeButtonAriaLabel: 'Close this dialog', - showLoaderOnConfirm: false, - imageUrl: undefined, - imageWidth: undefined, - imageHeight: undefined, - imageAlt: '', - timer: undefined, - timerProgressBar: false, - width: undefined, - padding: undefined, - background: undefined, - input: undefined, - inputPlaceholder: '', - inputValue: '', - inputOptions: {}, - inputAutoTrim: true, - inputAttributes: {}, - inputValidator: undefined, - validationMessage: undefined, - grow: false, - position: 'center', - progressSteps: [], - currentProgressStep: undefined, - progressStepsDistance: undefined, - onBeforeOpen: undefined, - onOpen: undefined, - onRender: undefined, - onClose: undefined, - onAfterClose: undefined, - onDestroy: undefined, - scrollbarPadding: true - }; - var updatableParams = ['title', 'titleText', 'text', 'html', 'icon', 'customClass', 'allowOutsideClick', 'allowEscapeKey', 'showConfirmButton', 'showCancelButton', 'confirmButtonText', 'confirmButtonAriaLabel', 'confirmButtonColor', 'cancelButtonText', 'cancelButtonAriaLabel', 'cancelButtonColor', 'buttonsStyling', 'reverseButtons', 'imageUrl', 'imageWidth', 'imageHeight', 'imageAlt', 'progressSteps', 'currentProgressStep']; - var deprecatedParams = { - animation: 'showClass" and "hideClass' - }; - var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusCancel', 'heightAuto', 'keydownListenerCapture']; - /** - * Is valid parameter - * @param {String} paramName - */ - - var isValidParameter = function isValidParameter(paramName) { - return Object.prototype.hasOwnProperty.call(defaultParams, paramName); - }; - /** - * Is valid parameter for Swal.update() method - * @param {String} paramName - */ - - var isUpdatableParameter = function isUpdatableParameter(paramName) { - return updatableParams.indexOf(paramName) !== -1; - }; - /** - * Is deprecated parameter - * @param {String} paramName - */ - - var isDeprecatedParameter = function isDeprecatedParameter(paramName) { - return deprecatedParams[paramName]; - }; - - var checkIfParamIsValid = function checkIfParamIsValid(param) { - if (!isValidParameter(param)) { - warn("Unknown parameter \"".concat(param, "\"")); - } - }; - - var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) { - if (toastIncompatibleParams.indexOf(param) !== -1) { - warn("The parameter \"".concat(param, "\" is incompatible with toasts")); - } - }; - - var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) { - if (isDeprecatedParameter(param)) { - warnAboutDepreation(param, isDeprecatedParameter(param)); - } - }; - /** - * Show relevant warnings for given params - * - * @param params - */ - - - var showWarningsForParams = function showWarningsForParams(params) { - for (var param in params) { - checkIfParamIsValid(param); - - if (params.toast) { - checkIfToastParamIsValid(param); - } - - checkIfParamIsDeprecated(param); - } - }; - - - - var staticMethods = /*#__PURE__*/Object.freeze({ - isValidParameter: isValidParameter, - isUpdatableParameter: isUpdatableParameter, - isDeprecatedParameter: isDeprecatedParameter, - argsToParams: argsToParams, - isVisible: isVisible$1, - clickConfirm: clickConfirm, - clickCancel: clickCancel, - getContainer: getContainer, - getPopup: getPopup, - getTitle: getTitle, - getContent: getContent, - getHtmlContainer: getHtmlContainer, - getImage: getImage, - getIcon: getIcon, - getIcons: getIcons, - getCloseButton: getCloseButton, - getActions: getActions, - getConfirmButton: getConfirmButton, - getCancelButton: getCancelButton, - getHeader: getHeader, - getFooter: getFooter, - getTimerProgressBar: getTimerProgressBar, - getFocusableElements: getFocusableElements, - getValidationMessage: getValidationMessage, - isLoading: isLoading, - fire: fire, - mixin: mixin, - queue: queue, - getQueueStep: getQueueStep, - insertQueueStep: insertQueueStep, - deleteQueueStep: deleteQueueStep, - showLoading: showLoading, - enableLoading: showLoading, - getTimerLeft: getTimerLeft, - stopTimer: stopTimer, - resumeTimer: resumeTimer, - toggleTimer: toggleTimer, - increaseTimer: increaseTimer, - isTimerRunning: isTimerRunning - }); - - /** - * Enables buttons and hide loader. - */ - - function hideLoading() { - // do nothing if popup is closed - var innerParams = privateProps.innerParams.get(this); - - if (!innerParams) { - return; - } - - var domCache = privateProps.domCache.get(this); - - if (!innerParams.showConfirmButton) { - hide(domCache.confirmButton); - - if (!innerParams.showCancelButton) { - hide(domCache.actions); - } - } - - removeClass([domCache.popup, domCache.actions], swalClasses.loading); - domCache.popup.removeAttribute('aria-busy'); - domCache.popup.removeAttribute('data-loading'); - domCache.confirmButton.disabled = false; - domCache.cancelButton.disabled = false; - } - - function getInput$1(instance) { - var innerParams = privateProps.innerParams.get(instance || this); - var domCache = privateProps.domCache.get(instance || this); - - if (!domCache) { - return null; - } - - return getInput(domCache.content, innerParams.input); - } - - var fixScrollbar = function fixScrollbar() { - // for queues, do not do this more than once - if (states.previousBodyPadding !== null) { - return; - } // if the body has overflow - - - if (document.body.scrollHeight > window.innerHeight) { - // add padding so the content doesn't shift after removal of scrollbar - states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); - document.body.style.paddingRight = "".concat(states.previousBodyPadding + measureScrollbar(), "px"); - } - }; - var undoScrollbar = function undoScrollbar() { - if (states.previousBodyPadding !== null) { - document.body.style.paddingRight = "".concat(states.previousBodyPadding, "px"); - states.previousBodyPadding = null; - } - }; - - /* istanbul ignore file */ - - var iOSfix = function iOSfix() { - var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; - - if (iOS && !hasClass(document.body, swalClasses.iosfix)) { - var offset = document.body.scrollTop; - document.body.style.top = "".concat(offset * -1, "px"); - addClass(document.body, swalClasses.iosfix); - lockBodyScroll(); - } - }; - - var lockBodyScroll = function lockBodyScroll() { - // #1246 - var container = getContainer(); - var preventTouchMove; - - container.ontouchstart = function (e) { - preventTouchMove = e.target === container || !isScrollable(container) && e.target.tagName !== 'INPUT' // #1603 - ; - }; - - container.ontouchmove = function (e) { - if (preventTouchMove) { - e.preventDefault(); - e.stopPropagation(); - } - }; - }; - - var undoIOSfix = function undoIOSfix() { - if (hasClass(document.body, swalClasses.iosfix)) { - var offset = parseInt(document.body.style.top, 10); - removeClass(document.body, swalClasses.iosfix); - document.body.style.top = ''; - document.body.scrollTop = offset * -1; - } - }; - - /* istanbul ignore file */ - - var isIE11 = function isIE11() { - return !!window.MSInputMethodContext && !!document.documentMode; - }; // Fix IE11 centering sweetalert2/issues/933 - - - var fixVerticalPositionIE = function fixVerticalPositionIE() { - var container = getContainer(); - var popup = getPopup(); - container.style.removeProperty('align-items'); - - if (popup.offsetTop < 0) { - container.style.alignItems = 'flex-start'; - } - }; - - var IEfix = function IEfix() { - if (typeof window !== 'undefined' && isIE11()) { - fixVerticalPositionIE(); - window.addEventListener('resize', fixVerticalPositionIE); - } - }; - var undoIEfix = function undoIEfix() { - if (typeof window !== 'undefined' && isIE11()) { - window.removeEventListener('resize', fixVerticalPositionIE); - } - }; - - // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that - // elements not within the active modal dialog will not be surfaced if a user opens a screen - // reader’s list of elements (headings, form controls, landmarks, etc.) in the document. - - var setAriaHidden = function setAriaHidden() { - var bodyChildren = toArray(document.body.children); - bodyChildren.forEach(function (el) { - if (el === getContainer() || contains(el, getContainer())) { - return; - } - - if (el.hasAttribute('aria-hidden')) { - el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden')); - } - - el.setAttribute('aria-hidden', 'true'); - }); - }; - var unsetAriaHidden = function unsetAriaHidden() { - var bodyChildren = toArray(document.body.children); - bodyChildren.forEach(function (el) { - if (el.hasAttribute('data-previous-aria-hidden')) { - el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden')); - el.removeAttribute('data-previous-aria-hidden'); - } else { - el.removeAttribute('aria-hidden'); - } - }); - }; - - /** - * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ - var privateMethods = { - swalPromiseResolve: new WeakMap() - }; - - /* - * Instance method to close sweetAlert - */ - - function removePopupAndResetState(instance, container, isToast$$1, onAfterClose) { - if (isToast$$1) { - triggerOnAfterCloseAndDispose(instance, onAfterClose); - } else { - restoreActiveElement().then(function () { - return triggerOnAfterCloseAndDispose(instance, onAfterClose); - }); - globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = false; - } - - if (container.parentNode && !document.body.getAttribute('data-swal2-queue-step')) { - container.parentNode.removeChild(container); - } - - if (isModal()) { - undoScrollbar(); - undoIOSfix(); - undoIEfix(); - unsetAriaHidden(); - } - - removeBodyClasses(); - } - - function removeBodyClasses() { - removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]); - } - - function close(resolveValue) { - var popup = getPopup(); - - if (!popup) { - return; - } - - var innerParams = privateProps.innerParams.get(this); - - if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) { - return; - } - - var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); - removeClass(popup, innerParams.showClass.popup); - addClass(popup, innerParams.hideClass.popup); - var backdrop = getContainer(); - removeClass(backdrop, innerParams.showClass.backdrop); - addClass(backdrop, innerParams.hideClass.backdrop); - handlePopupAnimation(this, popup, innerParams); // Resolve Swal promise - - swalPromiseResolve(resolveValue || {}); - } - - var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) { - var container = getContainer(); // If animation is supported, animate - - var animationIsSupported = animationEndEvent && hasCssAnimation(popup); - var onClose = innerParams.onClose, - onAfterClose = innerParams.onAfterClose; - - if (onClose !== null && typeof onClose === 'function') { - onClose(popup); - } - - if (animationIsSupported) { - animatePopup(instance, popup, container, onAfterClose); - } else { - // Otherwise, remove immediately - removePopupAndResetState(instance, container, isToast(), onAfterClose); - } - }; - - var animatePopup = function animatePopup(instance, popup, container, onAfterClose) { - globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, isToast(), onAfterClose); - popup.addEventListener(animationEndEvent, function (e) { - if (e.target === popup) { - globalState.swalCloseEventFinishedCallback(); - delete globalState.swalCloseEventFinishedCallback; - } - }); - }; - - var triggerOnAfterCloseAndDispose = function triggerOnAfterCloseAndDispose(instance, onAfterClose) { - setTimeout(function () { - if (typeof onAfterClose === 'function') { - onAfterClose(); - } - - instance._destroy(); - }); - }; - - function setButtonsDisabled(instance, buttons, disabled) { - var domCache = privateProps.domCache.get(instance); - buttons.forEach(function (button) { - domCache[button].disabled = disabled; - }); - } - - function setInputDisabled(input, disabled) { - if (!input) { - return false; - } - - if (input.type === 'radio') { - var radiosContainer = input.parentNode.parentNode; - var radios = radiosContainer.querySelectorAll('input'); - - for (var i = 0; i < radios.length; i++) { - radios[i].disabled = disabled; - } - } else { - input.disabled = disabled; - } - } - - function enableButtons() { - setButtonsDisabled(this, ['confirmButton', 'cancelButton'], false); - } - function disableButtons() { - setButtonsDisabled(this, ['confirmButton', 'cancelButton'], true); - } - function enableInput() { - return setInputDisabled(this.getInput(), false); - } - function disableInput() { - return setInputDisabled(this.getInput(), true); - } - - function showValidationMessage(error) { - var domCache = privateProps.domCache.get(this); - domCache.validationMessage.innerHTML = error; - var popupComputedStyle = window.getComputedStyle(domCache.popup); - domCache.validationMessage.style.marginLeft = "-".concat(popupComputedStyle.getPropertyValue('padding-left')); - domCache.validationMessage.style.marginRight = "-".concat(popupComputedStyle.getPropertyValue('padding-right')); - show(domCache.validationMessage); - var input = this.getInput(); - - if (input) { - input.setAttribute('aria-invalid', true); - input.setAttribute('aria-describedBy', swalClasses['validation-message']); - focusInput(input); - addClass(input, swalClasses.inputerror); - } - } // Hide block with validation message - - function resetValidationMessage$1() { - var domCache = privateProps.domCache.get(this); - - if (domCache.validationMessage) { - hide(domCache.validationMessage); - } - - var input = this.getInput(); - - if (input) { - input.removeAttribute('aria-invalid'); - input.removeAttribute('aria-describedBy'); - removeClass(input, swalClasses.inputerror); - } - } - - function getProgressSteps$1() { - var domCache = privateProps.domCache.get(this); - return domCache.progressSteps; - } - - var Timer = - /*#__PURE__*/ - function () { - function Timer(callback, delay) { - _classCallCheck(this, Timer); - - this.callback = callback; - this.remaining = delay; - this.running = false; - this.start(); - } - - _createClass(Timer, [{ - key: "start", - value: function start() { - if (!this.running) { - this.running = true; - this.started = new Date(); - this.id = setTimeout(this.callback, this.remaining); - } - - return this.remaining; - } - }, { - key: "stop", - value: function stop() { - if (this.running) { - this.running = false; - clearTimeout(this.id); - this.remaining -= new Date() - this.started; - } - - return this.remaining; - } - }, { - key: "increase", - value: function increase(n) { - var running = this.running; - - if (running) { - this.stop(); - } - - this.remaining += n; - - if (running) { - this.start(); - } - - return this.remaining; - } - }, { - key: "getTimerLeft", - value: function getTimerLeft() { - if (this.running) { - this.stop(); - this.start(); - } - - return this.remaining; - } - }, { - key: "isRunning", - value: function isRunning() { - return this.running; - } - }]); - - return Timer; - }(); - - var defaultInputValidators = { - email: function email(string, validationMessage) { - return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); - }, - url: function url(string, validationMessage) { - // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 - return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); - } - }; - - function setDefaultInputValidators(params) { - // Use default `inputValidator` for supported input types if not provided - if (!params.inputValidator) { - Object.keys(defaultInputValidators).forEach(function (key) { - if (params.input === key) { - params.inputValidator = defaultInputValidators[key]; - } - }); - } - } - - function validateCustomTargetElement(params) { - // Determine if the custom target element is valid - if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { - warn('Target parameter is not valid, defaulting to "body"'); - params.target = 'body'; - } - } - /** - * Set type, text and actions on popup - * - * @param params - * @returns {boolean} - */ - - - function setParameters(params) { - setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm - - if (params.showLoaderOnConfirm && !params.preConfirm) { - warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request'); - } // params.animation will be actually used in renderPopup.js - // but in case when params.animation is a function, we need to call that function - // before popup (re)initialization, so it'll be possible to check Swal.isVisible() - // inside the params.animation function - - - params.animation = callIfFunction(params.animation); - validateCustomTargetElement(params); // Replace newlines with
    in title - - if (typeof params.title === 'string') { - params.title = params.title.split('\n').join('
    '); - } - - init(params); - } - - /** - * Open popup, add necessary classes and styles, fix scrollbar - * - * @param {Array} params - */ - - var openPopup = function openPopup(params) { - var container = getContainer(); - var popup = getPopup(); - - if (typeof params.onBeforeOpen === 'function') { - params.onBeforeOpen(popup); - } - - addClasses$1(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto' - - setScrollingVisibility(container, popup); - - if (isModal()) { - fixScrollContainer(container, params.scrollbarPadding); - } - - if (!isToast() && !globalState.previousActiveElement) { - globalState.previousActiveElement = document.activeElement; - } - - if (typeof params.onOpen === 'function') { - setTimeout(function () { - return params.onOpen(popup); - }); - } - - removeClass(container, swalClasses['no-transition']); - }; - - function swalOpenAnimationFinished(event) { - var popup = getPopup(); - - if (event.target !== popup) { - return; - } - - var container = getContainer(); - popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished); - container.style.overflowY = 'auto'; - } - - var setScrollingVisibility = function setScrollingVisibility(container, popup) { - if (animationEndEvent && hasCssAnimation(popup)) { - container.style.overflowY = 'hidden'; - popup.addEventListener(animationEndEvent, swalOpenAnimationFinished); - } else { - container.style.overflowY = 'auto'; - } - }; - - var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding) { - iOSfix(); - IEfix(); - setAriaHidden(); - - if (scrollbarPadding) { - fixScrollbar(); - } // sweetalert2/issues/1247 - - - setTimeout(function () { - container.scrollTop = 0; - }); - }; - - var addClasses$1 = function addClasses(container, popup, params) { - addClass(container, params.showClass.backdrop); - show(popup); // Animate popup right after showing it - - addClass(popup, params.showClass.popup); - addClass([document.documentElement, document.body], swalClasses.shown); - - if (params.heightAuto && params.backdrop && !params.toast) { - addClass([document.documentElement, document.body], swalClasses['height-auto']); - } - }; - - var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) { - if (params.input === 'select' || params.input === 'radio') { - handleInputOptions(instance, params); - } else if (['text', 'email', 'number', 'tel', 'textarea'].indexOf(params.input) !== -1 && isPromise(params.inputValue)) { - handleInputValue(instance, params); - } - }; - var getInputValue = function getInputValue(instance, innerParams) { - var input = instance.getInput(); - - if (!input) { - return null; - } - - switch (innerParams.input) { - case 'checkbox': - return getCheckboxValue(input); - - case 'radio': - return getRadioValue(input); - - case 'file': - return getFileValue(input); - - default: - return innerParams.inputAutoTrim ? input.value.trim() : input.value; - } - }; - - var getCheckboxValue = function getCheckboxValue(input) { - return input.checked ? 1 : 0; - }; - - var getRadioValue = function getRadioValue(input) { - return input.checked ? input.value : null; - }; - - var getFileValue = function getFileValue(input) { - return input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; - }; - - var handleInputOptions = function handleInputOptions(instance, params) { - var content = getContent(); - - var processInputOptions = function processInputOptions(inputOptions) { - return populateInputOptions[params.input](content, formatInputOptions(inputOptions), params); - }; - - if (isPromise(params.inputOptions)) { - showLoading(); - params.inputOptions.then(function (inputOptions) { - instance.hideLoading(); - processInputOptions(inputOptions); - }); - } else if (_typeof(params.inputOptions) === 'object') { - processInputOptions(params.inputOptions); - } else { - error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions))); - } - }; - - var handleInputValue = function handleInputValue(instance, params) { - var input = instance.getInput(); - hide(input); - params.inputValue.then(function (inputValue) { - input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : "".concat(inputValue); - show(input); - input.focus(); - instance.hideLoading(); - })["catch"](function (err) { - error("Error in inputValue promise: ".concat(err)); - input.value = ''; - show(input); - input.focus(); - instance.hideLoading(); - }); - }; - - var populateInputOptions = { - select: function select(content, inputOptions, params) { - var select = getChildByClass(content, swalClasses.select); - inputOptions.forEach(function (inputOption) { - var optionValue = inputOption[0]; - var optionLabel = inputOption[1]; - var option = document.createElement('option'); - option.value = optionValue; - option.innerHTML = optionLabel; - - if (params.inputValue.toString() === optionValue.toString()) { - option.selected = true; - } - - select.appendChild(option); - }); - select.focus(); - }, - radio: function radio(content, inputOptions, params) { - var radio = getChildByClass(content, swalClasses.radio); - inputOptions.forEach(function (inputOption) { - var radioValue = inputOption[0]; - var radioLabel = inputOption[1]; - var radioInput = document.createElement('input'); - var radioLabelElement = document.createElement('label'); - radioInput.type = 'radio'; - radioInput.name = swalClasses.radio; - radioInput.value = radioValue; - - if (params.inputValue.toString() === radioValue.toString()) { - radioInput.checked = true; - } - - var label = document.createElement('span'); - label.innerHTML = radioLabel; - label.className = swalClasses.label; - radioLabelElement.appendChild(radioInput); - radioLabelElement.appendChild(label); - radio.appendChild(radioLabelElement); - }); - var radios = radio.querySelectorAll('input'); - - if (radios.length) { - radios[0].focus(); - } - } - }; - /** - * Converts `inputOptions` into an array of `[value, label]`s - * @param inputOptions - */ - - var formatInputOptions = function formatInputOptions(inputOptions) { - var result = []; - - if (typeof Map !== 'undefined' && inputOptions instanceof Map) { - inputOptions.forEach(function (value, key) { - result.push([key, value]); - }); - } else { - Object.keys(inputOptions).forEach(function (key) { - result.push([key, inputOptions[key]]); - }); - } - - return result; - }; - - var handleConfirmButtonClick = function handleConfirmButtonClick(instance, innerParams) { - instance.disableButtons(); - - if (innerParams.input) { - handleConfirmWithInput(instance, innerParams); - } else { - confirm(instance, innerParams, true); - } - }; - var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) { - instance.disableButtons(); - dismissWith(DismissReason.cancel); - }; - - var handleConfirmWithInput = function handleConfirmWithInput(instance, innerParams) { - var inputValue = getInputValue(instance, innerParams); - - if (innerParams.inputValidator) { - instance.disableInput(); - var validationPromise = Promise.resolve().then(function () { - return innerParams.inputValidator(inputValue, innerParams.validationMessage); - }); - validationPromise.then(function (validationMessage) { - instance.enableButtons(); - instance.enableInput(); - - if (validationMessage) { - instance.showValidationMessage(validationMessage); - } else { - confirm(instance, innerParams, inputValue); - } - }); - } else if (!instance.getInput().checkValidity()) { - instance.enableButtons(); - instance.showValidationMessage(innerParams.validationMessage); - } else { - confirm(instance, innerParams, inputValue); - } - }; - - var succeedWith = function succeedWith(instance, value) { - instance.closePopup({ - value: value - }); - }; - - var confirm = function confirm(instance, innerParams, value) { - if (innerParams.showLoaderOnConfirm) { - showLoading(); // TODO: make showLoading an *instance* method - } - - if (innerParams.preConfirm) { - instance.resetValidationMessage(); - var preConfirmPromise = Promise.resolve().then(function () { - return innerParams.preConfirm(value, innerParams.validationMessage); - }); - preConfirmPromise.then(function (preConfirmValue) { - if (isVisible(getValidationMessage()) || preConfirmValue === false) { - instance.hideLoading(); - } else { - succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); - } - }); - } else { - succeedWith(instance, value); - } - }; - - var addKeydownHandler = function addKeydownHandler(instance, globalState, innerParams, dismissWith) { - if (globalState.keydownTarget && globalState.keydownHandlerAdded) { - globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = false; - } - - if (!innerParams.toast) { - globalState.keydownHandler = function (e) { - return keydownHandler(instance, e, dismissWith); - }; - - globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); - globalState.keydownListenerCapture = innerParams.keydownListenerCapture; - globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = true; - } - }; // Focus handling - - var setFocus = function setFocus(innerParams, index, increment) { - var focusableElements = getFocusableElements(); // search for visible elements and select the next possible match - - for (var i = 0; i < focusableElements.length; i++) { - index = index + increment; // rollover to first item - - if (index === focusableElements.length) { - index = 0; // go to last item - } else if (index === -1) { - index = focusableElements.length - 1; - } - - return focusableElements[index].focus(); - } // no visible focusable elements, focus the popup - - - getPopup().focus(); - }; - var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11 - ]; - var escKeys = ['Escape', 'Esc' // IE11 - ]; - - var keydownHandler = function keydownHandler(instance, e, dismissWith) { - var innerParams = privateProps.innerParams.get(instance); - - if (innerParams.stopKeydownPropagation) { - e.stopPropagation(); - } // ENTER - - - if (e.key === 'Enter') { - handleEnter(instance, e, innerParams); // TAB - } else if (e.key === 'Tab') { - handleTab(e, innerParams); // ARROWS - switch focus between buttons - } else if (arrowKeys.indexOf(e.key) !== -1) { - handleArrows(); // ESC - } else if (escKeys.indexOf(e.key) !== -1) { - handleEsc(e, innerParams, dismissWith); - } - }; - - var handleEnter = function handleEnter(instance, e, innerParams) { - // #720 #721 - if (e.isComposing) { - return; - } - - if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) { - if (['textarea', 'file'].indexOf(innerParams.input) !== -1) { - return; // do not submit - } - - clickConfirm(); - e.preventDefault(); - } - }; - - var handleTab = function handleTab(e, innerParams) { - var targetElement = e.target; - var focusableElements = getFocusableElements(); - var btnIndex = -1; - - for (var i = 0; i < focusableElements.length; i++) { - if (targetElement === focusableElements[i]) { - btnIndex = i; - break; - } - } - - if (!e.shiftKey) { - // Cycle to the next button - setFocus(innerParams, btnIndex, 1); - } else { - // Cycle to the prev button - setFocus(innerParams, btnIndex, -1); - } - - e.stopPropagation(); - e.preventDefault(); - }; - - var handleArrows = function handleArrows() { - var confirmButton = getConfirmButton(); - var cancelButton = getCancelButton(); // focus Cancel button if Confirm button is currently focused - - if (document.activeElement === confirmButton && isVisible(cancelButton)) { - cancelButton.focus(); // and vice versa - } else if (document.activeElement === cancelButton && isVisible(confirmButton)) { - confirmButton.focus(); - } - }; - - var handleEsc = function handleEsc(e, innerParams, dismissWith) { - if (callIfFunction(innerParams.allowEscapeKey)) { - e.preventDefault(); - dismissWith(DismissReason.esc); - } - }; - - var handlePopupClick = function handlePopupClick(instance, domCache, dismissWith) { - var innerParams = privateProps.innerParams.get(instance); - - if (innerParams.toast) { - handleToastClick(instance, domCache, dismissWith); - } else { - // Ignore click events that had mousedown on the popup but mouseup on the container - // This can happen when the user drags a slider - handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup - - handleContainerMousedown(domCache); - handleModalClick(instance, domCache, dismissWith); - } - }; - - var handleToastClick = function handleToastClick(instance, domCache, dismissWith) { - // Closing toast by internal click - domCache.popup.onclick = function () { - var innerParams = privateProps.innerParams.get(instance); - - if (innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input) { - return; - } - - dismissWith(DismissReason.close); - }; - }; - - var ignoreOutsideClick = false; - - var handleModalMousedown = function handleModalMousedown(domCache) { - domCache.popup.onmousedown = function () { - domCache.container.onmouseup = function (e) { - domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't - // have any other direct children aside of the popup - - if (e.target === domCache.container) { - ignoreOutsideClick = true; - } - }; - }; - }; - - var handleContainerMousedown = function handleContainerMousedown(domCache) { - domCache.container.onmousedown = function () { - domCache.popup.onmouseup = function (e) { - domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup - - if (e.target === domCache.popup || domCache.popup.contains(e.target)) { - ignoreOutsideClick = true; - } - }; - }; - }; - - var handleModalClick = function handleModalClick(instance, domCache, dismissWith) { - domCache.container.onclick = function (e) { - var innerParams = privateProps.innerParams.get(instance); - - if (ignoreOutsideClick) { - ignoreOutsideClick = false; - return; - } - - if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { - dismissWith(DismissReason.backdrop); - } - }; - }; - - function _main(userParams) { - showWarningsForParams(userParams); - - if (globalState.currentInstance) { - globalState.currentInstance._destroy(); - } - - globalState.currentInstance = this; - var innerParams = prepareParams(userParams); - setParameters(innerParams); - Object.freeze(innerParams); // clear the previous timer - - if (globalState.timeout) { - globalState.timeout.stop(); - delete globalState.timeout; - } // clear the restore focus timeout - - - clearTimeout(globalState.restoreFocusTimeout); - var domCache = populateDomCache(this); - render(this, innerParams); - privateProps.innerParams.set(this, innerParams); - return swalPromise(this, domCache, innerParams); - } - - var prepareParams = function prepareParams(userParams) { - var showClass = _extends({}, defaultParams.showClass, userParams.showClass); - - var hideClass = _extends({}, defaultParams.hideClass, userParams.hideClass); - - var params = _extends({}, defaultParams, userParams); - - params.showClass = showClass; - params.hideClass = hideClass; // @deprecated - - if (userParams.animation === false) { - params.showClass = { - popup: '', - backdrop: 'swal2-backdrop-show swal2-noanimation' - }; - params.hideClass = {}; - } - - return params; - }; - - var swalPromise = function swalPromise(instance, domCache, innerParams) { - return new Promise(function (resolve) { - // functions to handle all closings/dismissals - var dismissWith = function dismissWith(dismiss) { - instance.closePopup({ - dismiss: dismiss - }); - }; - - privateMethods.swalPromiseResolve.set(instance, resolve); - setupTimer(globalState, innerParams, dismissWith); - - domCache.confirmButton.onclick = function () { - return handleConfirmButtonClick(instance, innerParams); - }; - - domCache.cancelButton.onclick = function () { - return handleCancelButtonClick(instance, dismissWith); - }; - - domCache.closeButton.onclick = function () { - return dismissWith(DismissReason.close); - }; - - handlePopupClick(instance, domCache, dismissWith); - addKeydownHandler(instance, globalState, innerParams, dismissWith); - - if (innerParams.toast && (innerParams.input || innerParams.footer || innerParams.showCloseButton)) { - addClass(document.body, swalClasses['toast-column']); - } else { - removeClass(document.body, swalClasses['toast-column']); - } - - handleInputOptionsAndValue(instance, innerParams); - openPopup(innerParams); - initFocus(domCache, innerParams); // Scroll container to top on open (#1247) - - domCache.container.scrollTop = 0; - }); - }; - - var populateDomCache = function populateDomCache(instance) { - var domCache = { - popup: getPopup(), - container: getContainer(), - content: getContent(), - actions: getActions(), - confirmButton: getConfirmButton(), - cancelButton: getCancelButton(), - closeButton: getCloseButton(), - validationMessage: getValidationMessage(), - progressSteps: getProgressSteps() - }; - privateProps.domCache.set(instance, domCache); - return domCache; - }; - - var setupTimer = function setupTimer(globalState$$1, innerParams, dismissWith) { - var timerProgressBar = getTimerProgressBar(); - hide(timerProgressBar); - - if (innerParams.timer) { - globalState$$1.timeout = new Timer(function () { - dismissWith('timer'); - delete globalState$$1.timeout; - }, innerParams.timer); - - if (innerParams.timerProgressBar) { - show(timerProgressBar); - setTimeout(function () { - if (globalState$$1.timeout.running) { - // timer can be already stopped at this point - animateTimerProgressBar(innerParams.timer); - } - }); - } - } - }; - - var initFocus = function initFocus(domCache, innerParams) { - if (innerParams.toast) { - return; - } - - if (!callIfFunction(innerParams.allowEnterKey)) { - return blurActiveElement(); - } - - if (innerParams.focusCancel && isVisible(domCache.cancelButton)) { - return domCache.cancelButton.focus(); - } - - if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) { - return domCache.confirmButton.focus(); - } - - setFocus(innerParams, -1, 1); - }; - - var blurActiveElement = function blurActiveElement() { - if (document.activeElement && typeof document.activeElement.blur === 'function') { - document.activeElement.blur(); - } - }; - - /** - * Updates popup parameters. - */ - - function update(params) { - var popup = getPopup(); - var innerParams = privateProps.innerParams.get(this); - - if (!popup || hasClass(popup, innerParams.hideClass.popup)) { - return warn("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup."); - } - - var validUpdatableParams = {}; // assign valid params from `params` to `defaults` - - Object.keys(params).forEach(function (param) { - if (Swal.isUpdatableParameter(param)) { - validUpdatableParams[param] = params[param]; - } else { - warn("Invalid parameter to update: \"".concat(param, "\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js")); - } - }); - - var updatedParams = _extends({}, innerParams, validUpdatableParams); - - render(this, updatedParams); - privateProps.innerParams.set(this, updatedParams); - Object.defineProperties(this, { - params: { - value: _extends({}, this.params, params), - writable: false, - enumerable: true - } - }); - } - - function _destroy() { - var domCache = privateProps.domCache.get(this); - var innerParams = privateProps.innerParams.get(this); - - if (!innerParams) { - return; // This instance has already been destroyed - } // Check if there is another Swal closing - - - if (domCache.popup && globalState.swalCloseEventFinishedCallback) { - globalState.swalCloseEventFinishedCallback(); - delete globalState.swalCloseEventFinishedCallback; - } // Check if there is a swal disposal defer timer - - - if (globalState.deferDisposalTimer) { - clearTimeout(globalState.deferDisposalTimer); - delete globalState.deferDisposalTimer; - } - - if (typeof innerParams.onDestroy === 'function') { - innerParams.onDestroy(); - } - - disposeSwal(this); - } - - var disposeSwal = function disposeSwal(instance) { - // Unset this.params so GC will dispose it (#1569) - delete instance.params; // Unset globalState props so GC will dispose globalState (#1569) - - delete globalState.keydownHandler; - delete globalState.keydownTarget; // Unset WeakMaps so GC will be able to dispose them (#1569) - - unsetWeakMaps(privateProps); - unsetWeakMaps(privateMethods); - }; - - var unsetWeakMaps = function unsetWeakMaps(obj) { - for (var i in obj) { - obj[i] = new WeakMap(); - } - }; - - - - var instanceMethods = /*#__PURE__*/Object.freeze({ - hideLoading: hideLoading, - disableLoading: hideLoading, - getInput: getInput$1, - close: close, - closePopup: close, - closeModal: close, - closeToast: close, - enableButtons: enableButtons, - disableButtons: disableButtons, - enableInput: enableInput, - disableInput: disableInput, - showValidationMessage: showValidationMessage, - resetValidationMessage: resetValidationMessage$1, - getProgressSteps: getProgressSteps$1, - _main: _main, - update: update, - _destroy: _destroy - }); - - var currentInstance; // SweetAlert constructor - - function SweetAlert() { - // Prevent run in Node env - - /* istanbul ignore if */ - if (typeof window === 'undefined') { - return; - } // Check for the existence of Promise - - /* istanbul ignore if */ - - - if (typeof Promise === 'undefined') { - error('This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)'); - } - - currentInstance = this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var outerParams = Object.freeze(this.constructor.argsToParams(args)); - Object.defineProperties(this, { - params: { - value: outerParams, - writable: false, - enumerable: true, - configurable: true - } - }); - - var promise = this._main(this.params); - - privateProps.promise.set(this, promise); - } // `catch` cannot be the name of a module export, so we define our thenable methods here instead - - - SweetAlert.prototype.then = function (onFulfilled) { - var promise = privateProps.promise.get(this); - return promise.then(onFulfilled); - }; - - SweetAlert.prototype["finally"] = function (onFinally) { - var promise = privateProps.promise.get(this); - return promise["finally"](onFinally); - }; // Assign instance methods from src/instanceMethods/*.js to prototype - - - _extends(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor - - - _extends(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility - - - Object.keys(instanceMethods).forEach(function (key) { - SweetAlert[key] = function () { - if (currentInstance) { - var _currentInstance; - - return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments); - } - }; - }); - SweetAlert.DismissReason = DismissReason; - SweetAlert.version = '9.8.2'; - - var Swal = SweetAlert; - Swal["default"] = Swal; - - return Swal; - -})); -if (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} - -"undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,".swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;background:#fff;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;width:auto;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-no-transition{transition:none!important}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-timer-progress-bar{position:absolute;bottom:0;left:0;width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close::-moz-focus-inner{border:0}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent!important}body.swal2-no-backdrop .swal2-container>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-container.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-top-left,body.swal2-no-backdrop .swal2-container.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-top-end,body.swal2-no-backdrop .swal2-container.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-container.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-left,body.swal2-no-backdrop .swal2-container.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-center-end,body.swal2-no-backdrop .swal2-container.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-container.swal2-bottom-left,body.swal2-no-backdrop .swal2-container.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-container.swal2-bottom-end,body.swal2-no-backdrop .swal2-container.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}"); diff --git a/src/scripts/session-manager.js b/src/scripts/session-manager.js index 2d1ee2e..7f8506b 100644 --- a/src/scripts/session-manager.js +++ b/src/scripts/session-manager.js @@ -1,14 +1,40 @@ -const message1 = "[ Session Name ] Allowed: a-z, A-Z, 0-9, -, _"; -const message2 = "Allowed: a-z, A-Z, 0-9, -, _ Please try again...\nName too long or none provided; or, unacceptable character used."; +const message2 = "Name too long or none provided; or, unacceptable character used."; const storageApi = browser.storage.local; const tabsApi = browser.tabs; const windowApi = browser.windows; const regexp = /^[a-zA-Z0-9-_]+$/; // Alphanumeric, dash, underscore +let willReplace = false; + +// Used as holder for vertain actions and 'cross' modal routs +let container = null; +let holderElm = null; +let holderName = null; +let holderData = null; +let holderSize = null; + +let keys = null; +let keysLength = null; -const saveSession = (elm = null, name = null, message = message1) => { - let inputTag = document.createElement("INPUT"); - let willReplace = false; +const resetArgs = (modal = "") => { + if (modal !== "") { + hideModal(modal); + } + + willReplace = false; + container = null; + + holderElm = null; + holderName = null; + holderData = null; + holderSize = null; + keys = null; + keysLength = null; +} + + +const preSaveSession = (elm = null, name = null, message = "") => { + let inputTag = document.getElementsByName("toSaveName")[0]; inputTag.value = new Date().toLocaleString().split(',')[0].replace(/\//g, '-'); if (elm !== null) { @@ -16,203 +42,150 @@ const saveSession = (elm = null, name = null, message = message1) => { willReplace = true; } + document.getElementsByName("toSaveErrMessage")[0].innerText = message; + windowApi.getAll({ populate: true, windowTypes: ["normal"] }).then((windows) => { let sessionData = getSessionData(windows); - let keys = Object.keys(sessionData); - let keysLength = Object.keys(sessionData).length; - let container = generateSelectionWindow(sessionData, keys, keysLength); - let textTag = document.createTextNode(message); - let brTag = document.createElement("BR"); - - container.prepend(inputTag); - container.prepend(brTag); - container.prepend(message); - - Swal.fire({ - html: container, - showCloseButton: true, - showCancelButton: true, - customClass: 'swal-modal', - }).then((result) => { - if (result.value) { - let enteryName = inputTag.value.replace(/ /g, "_"); - - if (enteryName.length < 0 || enteryName.length > 54 || enteryName.search(regexp) == -1) { - saveSession(elm, name, message2); - return ; - } - - console.log("Saving session..."); - sessionData = getSelectionData(container, keys, keysLength); - saveToStorage(enteryName, JSON.stringify(sessionData), "save", willReplace, elm); - } else { - messageWindow("warning", "Canceled save..."); - } - }); + keys = Object.keys(sessionData); + keysLength = Object.keys(sessionData).length; + container = loadContainer(sessionData, keys, keysLength, "saveList"); }); } -const editSession = (elm = null, name = null, message = message1) => { - let id = name; - let inputTag = document.createElement("INPUT"); - let newSessionTag = document.createElement("INPUT"); - let labelTag = document.createElement("LABEL"); - let brTag = document.createElement("BR"); - let brTag2 = document.createElement("BR"); +const saveSession = (elm = null, name = null) => { + let inputTag = document.getElementsByName("toSaveName")[0]; + let enteryName = inputTag.value.replace(/ /g, "_"); - inputTag.value = id; - newSessionTag.type = "checkbox"; - newSessionTag.id = "newSession"; - newSessionTag.checked = false; - labelTag.innerText = "Create New Session"; - labelTag.htmlFor = "newSession"; + if (enteryName.length < 0 || enteryName.length > 54 || enteryName.search(regexp) == -1) { + preSaveSession(elm, name, message2); + return ; + } + + console.log("Saving session..."); + sessionData = getSelectionData(container, keys, keysLength); + saveToStorage(enteryName, JSON.stringify(sessionData), "save", willReplace, elm); + resetArgs("saveModal"); +} + + + + +const preEditSession = (elm = null, name = null, message = "") => { + let inputTag = document.getElementsByName("toEditName")[0]; + let id = name; + inputTag.value = name; + + document.getElementsByName("toEditErrMessage")[0].innerText = message; storageApi.get(id).then((results) => { - let json = null; - let keys = null; - let keysLength = null; - try { - json = JSON.parse(results[id]); - keys = Object.keys(json); - keysLength = Object.keys(json).length; + let sessionData = JSON.parse(results[id]); + keys = Object.keys(sessionData); + keysLength = Object.keys(sessionData).length; + container = loadContainer(sessionData, keys, keysLength, "editList"); } catch (e) { messageWindow("warning", "Canceled edit; couldn't load any data..."); + resetArgs(); return ; } - - let container = generateSelectionWindow(json, keys, keysLength); - let textTag = document.createTextNode(message); - - container.prepend(labelTag); - container.prepend(newSessionTag); - container.prepend(brTag); - container.prepend(inputTag); - container.prepend(brTag2); - container.prepend(message); - - console.log("Editing session..."); - Swal.fire({ - html: container, - showCloseButton: true, - showCancelButton: true, - customClass: 'swal-modal', - }).then((result) => { - if (result.value) { - let newName = inputTag.value.replace(/ /g, "_"); - - if (newName.length < 0 || newName.length > 54 || newName.search(regexp) == -1) { - editSession(elm, name, message2); - return ; - } - - json = getSelectionData(container, keys, keysLength); - const strData = JSON.stringify(json); - if (newSessionTag.checked) { // If creating new session - newName = checkSessionListForDuplicate(newName); - saveToStorage(newName, strData, "save", false, elm); - } else { - if (newName == name) { // If not creating new session and are the same name - storageApi.get(id).then((results) => { - storageApi.remove(id); - saveToStorage(newName, strData, "edit", true, elm); - }).then(() => { - const size = getStoreSize(strData); - elm.innerText = size + " | " + newName; - elm.setAttribute("name", newName); - }); - } else { // If not creating new session and names are not the same rename - storageApi.get(id).then((results) => { - newName = checkSessionListForDuplicate(newName); - storageApi.remove(id); - saveToStorage(newName, strData, "edit", false, elm); - }).then(() => { - const size = getStoreSize(strData); - elm.innerText = size + " | " + newName; - elm.setAttribute("name", newName); - }); - } - } - } else { - messageWindow("warning", "Canceled edit..."); - } - }); }); } +const editSession = (elm = null, name = null, message = "") => { + let newSessionTag = document.getElementsByName("toEditNewSession")[0]; + let inputTag = document.getElementsByName("toEditName")[0]; + let newName = inputTag.value.replace(/ /g, "_"); + const id = name; + + if (newName.length < 0 || newName.length > 54 || newName.search(regexp) == -1) { + preEditSession(elm, name, message2); + return ; + } + + let sessionData = getSelectionData(container, keys, keysLength); + const strData = JSON.stringify(sessionData); + if (newSessionTag.checked) { // If creating new session + newName = checkSessionListForDuplicate(newName); + saveToStorage(newName, strData, "save", false, elm); + } else { + if (newName == name) { // If not creating new session and are the same name + storageApi.get(id).then((results) => { + storageApi.remove(id); + saveToStorage(newName, strData, "edit", true, elm); + }).then(() => { + const size = getStoreSize(strData); + elm.innerText = size + " | " + newName; + elm.setAttribute("name", newName); + }); + } else { // If not creating new session and names are not the same rename + storageApi.get(id).then((results) => { + newName = checkSessionListForDuplicate(newName); + storageApi.remove(id); + saveToStorage(newName, strData, "edit", false, elm); + }).then(() => { + const size = getStoreSize(strData); + elm.innerText = size + " | " + newName; + elm.setAttribute("name", newName); + }); + } + } + + resetArgs("editModal"); +} + + + + +const preDownloadSession = (session = null) => { + let fileName = session; + document.getElementsByName("toDownloadName")[0].value = fileName; +} + const downloadSession = (session = null) => { - let pTag = document.createElement("P"); - let inputTag = document.createElement("INPUT"); - let chkBoxTag = document.createElement("INPUT"); - let lblTag = document.createElement("LABEL"); - let brTag = document.createElement("BR"); - let aTagElm = document.getElementById('downloadAnchorElem'); - let text = document.createTextNode("Append Date?"); - let fileName = "session:" + session + ".json"; - let id = session; - chkBoxTag.type = "checkbox"; - inputTag.value = fileName; - chkBoxTag.id = "chkbx"; - lblTag.htmlFor = "chkbx"; - lblTag.append(text); - pTag.append(lblTag); - pTag.append(chkBoxTag); - pTag.append(brTag); - pTag.append(inputTag); + let chkBoxTag = document.getElementsByName("appendDateDlModal")[0]; + let fileName = document.getElementsByName("toDownloadName")[0].value; + const id = session; - Swal.fire({ - text: "Download Session?", - html: pTag, - showCloseButton: true, - showCancelButton: true, - customClass: 'swal-modal', - }).then((willDl) => { - if (willDl.value) { - if (chkBoxTag.checked) { - fileName = "session:" + id + ":" + new Date().toLocaleString() - .split(',')[0] - .replace(/\//g, "-") + ".json"; - } + if (chkBoxTag.checked) { + fileName = "session_" + fileName + "_" + new Date().toLocaleString() + .split(',')[0] + .replace(/\//g, "-") + ".json"; + } else { + fileName = "session_" + fileName + ".json"; + } - storageApi.get(id).then((results) => { - let json = JSON.parse(results[id]); - let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(json)); - console.log("Downloading: " + id); - doUrlAction(dataStr, fileName, true); - }); - } + storageApi.get(id).then((results) => { + let sessionData = JSON.parse(results[id]); + let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(sessionData)); + console.log("Downloading: " + id); + doUrlAction(dataStr, fileName, true); }); } + + + const preLoadSession = (id) => { storageApi.get(id).then(results => { try { - let json = JSON.parse(results[id]); - let keys = Object.keys(json); - let keysLength = Object.keys(json).length; + let sessionData = JSON.parse(results[id]); + let keys = Object.keys(sessionData); + let keysLength = Object.keys(sessionData).length; let replaceTabs = document.getElementsByName("replaceTabs")[0]; let selectiveOpen = document.getElementsByName("selectiveOpen")[0]; if (!selectiveOpen.checked) { - loadSession(json, replaceTabs.checked); + asyn = () => { + loadSession(sessionData, replaceTabs.checked); + } + asyn(); } else { - let container = generateSelectionWindow(json, keys, keysLength); - Swal.fire({ - text: "Selective Open", - html: container, - showCloseButton: true, - showCancelButton: true, - }).then((willOpen) => { - if (willOpen.value) { - json = getSelectionData(container, keys, keysLength); - keysLength = Object.keys(json).length; - if (keysLength > 0) { - loadSession(json, replaceTabs.checked); - } else { - messageWindow("warning", "Canceled Operation: No tabs were selected..."); - } - } - }); + container = loadContainer(sessionData, keys, keysLength, "loadList"); + asyn = () => { + setKeyData(keys, keysLength); + } + asyn(); + showModal("loadModal"); } } catch (e) { messageWindow("error", "Couldn't load session:\n" + e); @@ -220,6 +193,24 @@ const preLoadSession = (id) => { }); } +// Supports startLoadSession getting the proper data... +const setKeyData = (_keys, _keysLength) => { + keys = _keys; + keysLength = _keysLength; +} + +const startLoadSession = () => { + sessionData = getSelectionData(container, keys, keysLength); + keysLength = Object.keys(sessionData).length; + if (keysLength > 0) { + loadSession(sessionData, replaceTabs.checked); + hideModal("loadModal"); + } else { + hideModal("loadModal"); + messageWindow("warning", "Canceled Operation: No tabs were selected..."); + } +} + const loadSession = (json = null, replaceTabs = false) => { let keys = Object.keys(json); let keysLength = Object.keys(json).length; @@ -274,3 +265,14 @@ const loadSession = (json = null, replaceTabs = false) => { messageWindow("error", "Couldn't load session:\n" + e); } } + + + +const confirmSessionOverwrite = () => { + storageApi.set({[holderName]: holderData}); + holderElm = document.getElementsByName(holderName)[0]; + holderElm.innerText = holderSize + " | " + holderName; + holderElm.name = holderName; + messageWindow("warning", "Overwrote session..."); + resetArgs("confModal"); +} diff --git a/src/scripts/utils.js b/src/scripts/utils.js index bcd8438..930454b 100644 --- a/src/scripts/utils.js +++ b/src/scripts/utils.js @@ -1,7 +1,43 @@ let selectedItem = null; + +const messageWindow = (type = "warning", message = "No message passed in...", target = "") => { + let pTag = document.createElement("P"); + let text = document.createTextNode(message); + let gutter = document.getElementById("message-gutter"); + + if (target !== "") { + gutter = document.getElementById(target); + } + + pTag.className = "alert alert-" + type; + pTag.appendChild(text); + gutter.prepend(pTag); + + setTimeout(function () { + clearChildNodes(gutter); + }, 3200); +} + + + + // UI supporters +const loadContainer = (sessionData, keys, keysLength, divID) => { + let container = generateSelectionWindow(sessionData, keys, keysLength); + let divElm = document.getElementById(divID); + container.className = "col"; + clearChildNodes(divElm); + divElm.append(container); + return container; +} + + + + + + /* Selection Process */ const generateSelectionWindow = (json = "", keys = null, keysLength = 0) => { let container = document.createElement("DIV"); @@ -139,6 +175,45 @@ const doUrlAction = (url = "https://www.paypal.me/ITDominator", fileName = "", i aTagElm.click(); } + + + +const showModal = async (modalID = "saveModal") => { + tween(1600, "up", modalID); // in miliseconds +} + +const hideModal = (modalID = "saveModal") => { + tween(1600, "down", modalID); // in miliseconds +} + +const tween = async (miliseconds, direction, modalID) => { + const elm = document.getElementById(modalID); + const timeStep = 1000 / miliseconds; + const steps = timeStep * 100 + + if (direction == "up") { // Go up + elm.style.display = ""; + // elm.style.opacity = "1"; + for (var i = 1; i <= steps; i++) { + await sleep(timeStep); + elm.style.opacity = i/steps; + } + } else { // Go down + for (var i = steps; i > 1; i--) { + await sleep(timeStep); + elm.style.opacity = i/steps; + } + // elm.style.opacity = "0"; + elm.style.display = "none"; + } + +} + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + + const importSession = () => { browser.tabs.create({ url: browser.extension.getURL("../pages/import.html"), @@ -152,3 +227,9 @@ const toggleSelect = (source, name) => { checkboxes[i].checked = source.checked; } } + +const clearChildNodes = (parent) => { + while (parent.firstChild) { + parent.removeChild(parent.firstChild); + } +} diff --git a/src/styles/libs/mustard-ui.min.css b/src/styles/libs/mustard-ui.min.css new file mode 100644 index 0000000..bc317cb --- /dev/null +++ b/src/styles/libs/mustard-ui.min.css @@ -0,0 +1,7 @@ +/*! +Mustard UI v0.0.5 +MIT License +https://mustard-ui.com +*/*{margin:0;padding:0}html{box-sizing:border-box}*,*::after,*::before{box-sizing:inherit}body{display:flex;flex-direction:column;min-height:100vh;background-color:#fff}main{flex:1}.float-left{float:left}.float-right{float:right}.clear-fix::before,.clear-fix::after{content:"";display:table}.clear-fix::after{clear:both}.align-left{text-align:left}.align-center{text-align:center}.align-right{text-align:right}.container{max-width:1200px;margin-left:auto;margin-right:auto;padding:30px 0}.container-small{max-width:768px}.container-large{max-width:1440px}.display-flex{display:flex;justify-content:space-around}.display-none{display:none}.display-sm-up{display:none}@media (min-width: 425px){.display-sm-up{display:initial}}.display-md-up{display:none}@media (min-width: 768px){.display-md-up{display:initial}}.display-lg-up{display:none}@media (min-width: 1024px){.display-lg-up{display:initial}}.display-xlg-up{display:none}@media (min-width: 1440px){.display-xlg-up{display:initial}}.display-sm-down{display:none}@media (max-width: 424px){.display-sm-down{display:initial}}.display-md-down{display:none}@media (max-width: 767px){.display-md-down{display:initial}}.display-lg-down{display:none}@media (max-width: 1023px){.display-lg-down{display:initial}}.display-xlg-down{display:none}@media (max-width: 1439px){.display-xlg-down{display:initial}}.display-sm-to-md{display:none}@media (min-width: 425px) and (max-width: 767px){.display-sm-to-md{display:initial}}.display-sm-to-lg{display:none}@media (min-width: 425px) and (max-width: 1023px){.display-sm-to-lg{display:initial}}.display-sm-to-xlg{display:none}@media (min-width: 425px) and (max-width: 1439px){.display-sm-to-xlg{display:initial}}.display-md-to-lg{display:none}@media (min-width: 768px) and (max-width: 1023px){.display-md-to-lg{display:initial}}.display-md-to-xlg{display:none}@media (min-width: 768px) and (max-width: 1439px){.display-md-to-xlg{display:initial}}.display-lg-to-xlg{display:none}@media (min-width: 1024px) and (max-width: 1439px){.display-lg-to-xlg{display:initial}}.row{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:15px;margin-bottom:15px}.row.row-reverse{flex-direction:row-reverse}.row .col{flex-grow:1;flex-basis:100%;max-width:100%;padding:5px 5px}.row .col.col-reverse{flex-direction:column-reverse}.row .col-xs-1{flex-basis:8.33333%;max-width:8.33333%}.row .col-xs-2{flex-basis:16.66667%;max-width:16.66667%}.row .col-xs-3{flex-basis:25%;max-width:25%}.row .col-xs-4{flex-basis:33.33333%;max-width:33.33333%}.row .col-xs-5{flex-basis:41.66667%;max-width:41.66667%}.row .col-xs-6{flex-basis:50%;max-width:50%}.row .col-xs-7{flex-basis:58.33333%;max-width:58.33333%}.row .col-xs-8{flex-basis:66.66667%;max-width:66.66667%}.row .col-xs-9{flex-basis:75%;max-width:75%}.row .col-xs-10{flex-basis:83.33333%;max-width:83.33333%}.row .col-xs-11{flex-basis:91.66667%;max-width:91.66667%}.row .col-xs-12{flex-basis:100%;max-width:100%}.row .col-xs-offset-1{margin-left:8.33333%}.row .col-xs-offset-2{margin-left:16.66667%}.row .col-xs-offset-3{margin-left:25%}.row .col-xs-offset-4{margin-left:33.33333%}.row .col-xs-offset-5{margin-left:41.66667%}.row .col-xs-offset-6{margin-left:50%}.row .col-xs-offset-7{margin-left:58.33333%}.row .col-xs-offset-8{margin-left:66.66667%}.row .col-xs-offset-9{margin-left:75%}.row .col-xs-offset-10{margin-left:83.33333%}.row .col-xs-offset-11{margin-left:91.66667%}.row .col-xs-offset-12{margin-left:100%}@media (min-width: 425px){.row .col-sm-1{flex-basis:8.33333%;max-width:8.33333%}.row .col-sm-2{flex-basis:16.66667%;max-width:16.66667%}.row .col-sm-3{flex-basis:25%;max-width:25%}.row .col-sm-4{flex-basis:33.33333%;max-width:33.33333%}.row .col-sm-5{flex-basis:41.66667%;max-width:41.66667%}.row .col-sm-6{flex-basis:50%;max-width:50%}.row .col-sm-7{flex-basis:58.33333%;max-width:58.33333%}.row .col-sm-8{flex-basis:66.66667%;max-width:66.66667%}.row .col-sm-9{flex-basis:75%;max-width:75%}.row .col-sm-10{flex-basis:83.33333%;max-width:83.33333%}.row .col-sm-11{flex-basis:91.66667%;max-width:91.66667%}.row .col-sm-12{flex-basis:100%;max-width:100%}.row .col-sm-offset-1{margin-left:8.33333%}.row .col-sm-offset-2{margin-left:16.66667%}.row .col-sm-offset-3{margin-left:25%}.row .col-sm-offset-4{margin-left:33.33333%}.row .col-sm-offset-5{margin-left:41.66667%}.row .col-sm-offset-6{margin-left:50%}.row .col-sm-offset-7{margin-left:58.33333%}.row .col-sm-offset-8{margin-left:66.66667%}.row .col-sm-offset-9{margin-left:75%}.row .col-sm-offset-10{margin-left:83.33333%}.row .col-sm-offset-11{margin-left:91.66667%}.row .col-sm-offset-12{margin-left:100%}}@media (min-width: 768px){.row .col-md-1{flex-basis:8.33333%;max-width:8.33333%}.row .col-md-2{flex-basis:16.66667%;max-width:16.66667%}.row .col-md-3{flex-basis:25%;max-width:25%}.row .col-md-4{flex-basis:33.33333%;max-width:33.33333%}.row .col-md-5{flex-basis:41.66667%;max-width:41.66667%}.row .col-md-6{flex-basis:50%;max-width:50%}.row .col-md-7{flex-basis:58.33333%;max-width:58.33333%}.row .col-md-8{flex-basis:66.66667%;max-width:66.66667%}.row .col-md-9{flex-basis:75%;max-width:75%}.row .col-md-10{flex-basis:83.33333%;max-width:83.33333%}.row .col-md-11{flex-basis:91.66667%;max-width:91.66667%}.row .col-md-12{flex-basis:100%;max-width:100%}.row .col-md-offset-1{margin-left:8.33333%}.row .col-md-offset-2{margin-left:16.66667%}.row .col-md-offset-3{margin-left:25%}.row .col-md-offset-4{margin-left:33.33333%}.row .col-md-offset-5{margin-left:41.66667%}.row .col-md-offset-6{margin-left:50%}.row .col-md-offset-7{margin-left:58.33333%}.row .col-md-offset-8{margin-left:66.66667%}.row .col-md-offset-9{margin-left:75%}.row .col-md-offset-10{margin-left:83.33333%}.row .col-md-offset-11{margin-left:91.66667%}.row .col-md-offset-12{margin-left:100%}}@media (min-width: 1024px){.row .col-lg-1{flex-basis:8.33333%;max-width:8.33333%}.row .col-lg-2{flex-basis:16.66667%;max-width:16.66667%}.row .col-lg-3{flex-basis:25%;max-width:25%}.row .col-lg-4{flex-basis:33.33333%;max-width:33.33333%}.row .col-lg-5{flex-basis:41.66667%;max-width:41.66667%}.row .col-lg-6{flex-basis:50%;max-width:50%}.row .col-lg-7{flex-basis:58.33333%;max-width:58.33333%}.row .col-lg-8{flex-basis:66.66667%;max-width:66.66667%}.row .col-lg-9{flex-basis:75%;max-width:75%}.row .col-lg-10{flex-basis:83.33333%;max-width:83.33333%}.row .col-lg-11{flex-basis:91.66667%;max-width:91.66667%}.row .col-lg-12{flex-basis:100%;max-width:100%}.row .col-lg-offset-1{margin-left:8.33333%}.row .col-lg-offset-2{margin-left:16.66667%}.row .col-lg-offset-3{margin-left:25%}.row .col-lg-offset-4{margin-left:33.33333%}.row .col-lg-offset-5{margin-left:41.66667%}.row .col-lg-offset-6{margin-left:50%}.row .col-lg-offset-7{margin-left:58.33333%}.row .col-lg-offset-8{margin-left:66.66667%}.row .col-lg-offset-9{margin-left:75%}.row .col-lg-offset-10{margin-left:83.33333%}.row .col-lg-offset-11{margin-left:91.66667%}.row .col-lg-offset-12{margin-left:100%}}@media (min-width: 1440px){.row .col-xlg-1{flex-basis:8.33333%;max-width:8.33333%}.row .col-xlg-2{flex-basis:16.66667%;max-width:16.66667%}.row .col-xlg-3{flex-basis:25%;max-width:25%}.row .col-xlg-4{flex-basis:33.33333%;max-width:33.33333%}.row .col-xlg-5{flex-basis:41.66667%;max-width:41.66667%}.row .col-xlg-6{flex-basis:50%;max-width:50%}.row .col-xlg-7{flex-basis:58.33333%;max-width:58.33333%}.row .col-xlg-8{flex-basis:66.66667%;max-width:66.66667%}.row .col-xlg-9{flex-basis:75%;max-width:75%}.row .col-xlg-10{flex-basis:83.33333%;max-width:83.33333%}.row .col-xlg-11{flex-basis:91.66667%;max-width:91.66667%}.row .col-xlg-12{flex-basis:100%;max-width:100%}.row .col-xlg-offset-1{margin-left:8.33333%}.row .col-xlg-offset-2{margin-left:16.66667%}.row .col-xlg-offset-3{margin-left:25%}.row .col-xlg-offset-4{margin-left:33.33333%}.row .col-xlg-offset-5{margin-left:41.66667%}.row .col-xlg-offset-6{margin-left:50%}.row .col-xlg-offset-7{margin-left:58.33333%}.row .col-xlg-offset-8{margin-left:66.66667%}.row .col-xlg-offset-9{margin-left:75%}.row .col-xlg-offset-10{margin-left:83.33333%}.row .col-xlg-offset-11{margin-left:91.66667%}.row .col-xlg-offset-12{margin-left:100%}}.section,section{padding:30px}.section :last-child,section :last-child{margin-bottom:0}.section-primary{background:#ffca28}.section-secondary{background:#f5f5f5}.section-tertiary{background:#fff}blockquote{display:block;margin:15px 15px 30px;padding:15px;font-size:18px;font-weight:400;border-left:4px solid #4caf50;background:#fff}blockquote :last-child{margin-bottom:0}.button,button,input[type='button'],input[type='reset'],input[type='submit']{display:inline-block;height:40px;margin:0 2px 15px;padding:0 20px;width:auto;background:none;overflow:visible;-webkit-appearance:none;-moz-appearance:none;appearance:none;transition:all .1s ease-out;font-size:14px;font-weight:600;color:inherit;line-height:40px;letter-spacing:1px;text-decoration:none;text-transform:uppercase;white-space:nowrap;border-radius:4px;border-style:solid;border-width:1px}.button:focus,button:focus,input[type='button']:focus,input[type='reset']:focus,input[type='submit']:focus{outline:none}.button:focus,.button:hover,button:focus,button:hover,input[type='button']:focus,input[type='button']:hover,input[type='reset']:focus,input[type='reset']:hover,input[type='submit']:focus,input[type='submit']:hover{opacity:0.85;cursor:pointer;transform:scale(1.025)}.button:active,button:active,input[type='button']:active,input[type='reset']:active,input[type='submit']:active{opacity:1;transform:scale(1)}.button:disabled,button:disabled,input[type='button']:disabled,input[type='reset']:disabled,input[type='submit']:disabled{opacity:0.5}.button:disabled:hover,button:disabled:hover,input[type='button']:disabled:hover,input[type='reset']:disabled:hover,input[type='submit']:disabled:hover{cursor:not-allowed}.button-primary{background-color:#4caf50;color:#fff;border-color:#4caf50}.button-primary-outlined{background-color:#fff;color:#4caf50;border-color:#4caf50}.button-primary-text{color:#4caf50;border-color:transparent}.button-success{background-color:#4caf50;color:#fff;border-color:#4caf50}.button-success-outlined{background-color:#fff;color:#4caf50;border-color:#4caf50}.button-success-text{color:#4caf50;border-color:transparent}.button-info{background-color:#9e9e9e;color:#fff;border-color:#9e9e9e}.button-info-outlined{background-color:#fff;color:#9e9e9e;border-color:#9e9e9e}.button-info-text{color:#9e9e9e;border-color:transparent}.button-warning{background-color:#ffb300;color:#fff;border-color:#ffb300}.button-warning-outlined{background-color:#fff;color:#ffb300;border-color:#ffb300}.button-warning-text{color:#ffb300;border-color:transparent}.button-danger{background-color:#f44336;color:#fff;border-color:#f44336}.button-danger-outlined{background-color:#fff;color:#f44336;border-color:#f44336}.button-danger-text{color:#f44336;border-color:transparent}.button-round{border-radius:24px}.button-large{height:48px;line-height:48px;padding:0 30px;font-size:16px}.button-small{height:30px;line-height:30px;padding:0 15px;font-size:12px}pre{display:block;margin:15px 0;padding:10px 15px;border-left:4px solid #4caf50;background:#f5f5f5;font-family:Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;font-size:15px;color:#212121;white-space:normal;overflow-x:auto}code{background:#f5f5f5;color:#212121;font-family:Monaco, 'Courier New', Courier, monospace;white-space:pre}.form-control{position:relative;margin-bottom:10px}.form-control-group{display:flex;justify-content:flex-start}.form-control-group .form-control{flex:1;padding-right:15px}.form-control-group .form-control:last-of-type{padding-right:0}.form-control-group .form-control.grow-1x{flex-grow:1}.form-control-group .form-control.grow-2x{flex-grow:2}.form-control-group .form-control.grow-3x{flex-grow:3}.validation-error{margin-top:2px;font-size:12px;color:#f44336}label{font-size:14px;font-weight:400}input[type="text"],input[type="password"],select{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:block;width:100%;padding:10px;line-height:20px;font-size:16px;font-weight:inherit;background:#fff;border-radius:5px;border:1px solid #bdbdbd}input[type="text"]::-webkit-input-placeholder,input[type="password"]::-webkit-input-placeholder,select::-webkit-input-placeholder{color:#9e9e9e}input[type="text"]:-ms-input-placeholder,input[type="password"]:-ms-input-placeholder,select:-ms-input-placeholder{color:#9e9e9e}input[type="text"]::-ms-input-placeholder,input[type="password"]::-ms-input-placeholder,select::-ms-input-placeholder{color:#9e9e9e}input[type="text"]::placeholder,input[type="password"]::placeholder,select::placeholder{color:#9e9e9e}input[type="text"]:focus,input[type="password"]:focus,select:focus{outline:none;border-color:#4caf50}input[type="text"].invalid,input[type="password"].invalid,select.invalid{border-color:#f44336}fieldset{margin:15px 0;padding:15px;font-size:14px;border:1px solid #bdbdbd;border-radius:5px}fieldset legend{padding:0 5px}input[type="checkbox"],input[type="radio"]{margin-right:10px}select{background:#fff url('data:image/svg+xml;utf8,') center right no-repeat;padding-right:30px}select:hover{cursor:pointer}select:disabled{opacity:0.5}select:focus{background:#fff url('data:image/svg+xml;utf8,') center right no-repeat}textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:block;width:100%;padding:10px 15px;min-height:100px;font-size:16px;font-weight:300;line-height:1.4;color:#000;background-color:#fff;border:1px solid #bdbdbd;border-radius:5px}textarea::-webkit-input-placeholder{color:#9e9e9e}textarea:-ms-input-placeholder{color:#9e9e9e}textarea::-ms-input-placeholder{color:#9e9e9e}textarea::placeholder{color:#9e9e9e}textarea:focus{border-color:#4caf50;outline:none}textarea.invalid{border-color:#ef9a9a}a{text-decoration:none;color:#4caf50;font-weight:400;transition:opacity .1s ease-out}a:focus,a:hover{opacity:0.75}a:active{opacity:1}ul,ol,dl{list-style:none;margin-bottom:15px}ul{list-style:circle inside}ol{list-style:decimal inside}table{margin:15px 0;width:100%;border-spacing:0;border-collapse:collapse}table tr{border-bottom:1px solid #eee;text-align:left}table thead th{padding:15px;font-weight:300;color:#9e9e9e}table tbody td{padding:15px;font-weight:300}body{font-family:"Open Sans",sans-serif;font-size:16px;line-height:1.6;font-weight:300;color:#424242}h1,h2,h3,h4,h5,h6{font-family:"Open Sans",sans-serif;font-weight:300;color:#424242;margin:0 0 10px;font-weight:600}.h1,h1{font-size:48px;line-height:60px}.h2,h2{font-size:40px;line-height:52px}.h3,h3{font-size:32px;line-height:44px}.h4,h4{font-size:28px;line-height:40px}.h5,h5{font-size:24px;line-height:36px}.h6,h6{font-size:20px;line-height:32px}p{margin-bottom:15px}p.magnify{font-size:17.6px;line-height:1.8}strong,b{font-weight:600}.alert{margin:15px 0;padding:15px;border-radius:5px}.alert-danger{background:#ffebee}.alert-info{background:#e3f2fd}.alert-warning{background:#fff8e1}.alert-success{background:#e8f5e9}.breadcrumbs{display:flex;list-style:none;font-size:14px}.breadcrumbs li{display:block}.breadcrumbs li::after{display:inline-block;content:"/";padding:0 5px;color:#9e9e9e}.breadcrumbs li:last-of-type::after{display:none}.card{margin:15px;padding:30px;background:#fff;overflow:hidden;border-radius:5px;box-shadow:0 4px 12px rgba(224,224,224,0.5)}.card-title{font-size:24px;margin-bottom:5px}.card-actions{display:flex;align-items:center;margin-top:30px;list-style:none;justify-content:space-around}.card-actions>*{margin-bottom:0}.footer,footer{padding:30px;width:100%;background:#757575}.footer .copyright,footer .copyright{margin:0;padding-top:30px;font-size:14px;color:#fff;border-top:1px solid #9e9e9e}.footer .copyright a,footer .copyright a{color:#bdbdbd}.footer-text p{color:#fff}.footer-links-category{color:#fff;font-size:14px;font-weight:600;text-transform:uppercase;letter-spacing:1px}.footer-links{list-style:none}.footer-links li{margin-top:5px}.footer-links a{color:#bdbdbd}header,.header{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 15px;height:100vh;background:#ffc107}header .title,.header .title{font-size:50px;line-height:50px;font-weight:400;color:#424242;text-align:center}@media (min-width: 768px){header .title,.header .title{font-size:60px;line-height:60px}}header .subtitle,.header .subtitle{font-size:18px;line-height:26px;font-weight:300;color:#424242;text-align:center}@media (min-width: 768px){header .subtitle,.header .subtitle{font-size:25.2px;line-height:25.2px}}header .disclaimer,.header .disclaimer{font-size:12px;color:#424242;text-align:center}header .scroll-down,.header .scroll-down{opacity:1;transition:all .5s ease-in 3s}header .scroll-down,.header .scroll-down{display:flex;align-items:center;justify-content:center;position:absolute;bottom:45px;left:50%;margin-left:-16px;width:32px;height:32px;border:2px solid #424242;border-radius:50%;animation:bounce 2s infinite 2s;transition:all .2s ease-in}header .scroll-down::before,.header .scroll-down::before{display:block;position:relative;bottom:2px;content:'';transform:rotate(-45deg);width:12px;height:12px;border:2px solid #424242;border-width:0px 0 2px 2px}@keyframes bounce{0%,100%,20%,50%,80%{transform:translateY(0)}40%{transform:translateY(-10px)}60%{transform:translateY(-5px)}}.menu{display:inline-block;list-style:none;background:#fff;border-radius:5px;box-shadow:0 4px 12px rgba(158,158,158,0.5)}.menu li a{display:block;padding:10px 30px;border-bottom:1px solid #eee}.menu li a:focus,.menu li a:hover{background:#fafafa}.modal-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(97,97,97,0.5);z-index:10}.modal{display:flex;flex-direction:column;justify-content:space-between;position:fixed;top:50%;left:50%;max-width:540px;transform:translate(-50%, -50%);background:#fff;border-radius:5px;overflow:hidden;box-shadow:0 4px 12px rgba(117,117,117,0.5)}.modal-head{padding:10px 15px}.modal-head .modal-title{font-size:24px}.modal-body{flex:1;padding:30px 15px;background:#eee}.modal-footer{padding:15px}.modal-footer>*{margin-bottom:0}nav,.nav{padding:0 15px;height:60px;width:100%;background:#ffc107}nav a,.nav a{display:block;color:#424242}.nav-container{display:flex;align-items:center;justify-content:space-between;height:100%;max-width:1200px;margin:0 auto;padding:0 30px}.nav-logo{display:flex;align-items:center;font-size:32px;line-height:32px}.nav-links{display:none;list-style:none;margin:0;height:100%}@media (min-width: 768px){.nav-links{display:flex}}.nav-links li,.nav-links a{height:100%}.nav-links a{display:flex;align-items:center;padding:0 30px}.nav-links a:active{color:#4caf50}.nav-links a.active{border-bottom:4px solid #4caf50}.mobile-menu-toggle{display:block;position:relative;height:20px;width:26px}@media (min-width: 768px){.mobile-menu-toggle{display:none}}.mobile-menu-toggle:focus,.mobile-menu-toggle:hover{cursor:pointer}.mobile-menu-toggle::before{position:absolute;top:0;left:0;width:26px;height:4px;content:'';background:#424242;border-radius:4px;box-shadow:0 8px 0 0 #424242,0 16px 0 0 #424242}.pagination{display:flex;list-style:none;margin:15px 0}.pagination li{margin:0 5px}.pagination li a{display:block;padding:5px 10px;border-radius:5px;background:#fff;border:1px solid #e0e0e0}.pagination li a.active,.pagination li a:focus,.pagination li a:hover{opacity:1;border-color:#4caf50}.pagination li a.active{background:#4caf50;color:#fff}.pagination li a:active{transform:scale(0.95)}.panel{background:#fff;border-radius:5px;overflow:hidden;margin:30px 0;box-shadow:0 4px 12px rgba(224,224,224,0.5)}.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;padding:10px 15px;background:#fafafa}.panel-head .panel-title{font-size:28px}.panel-body{padding:30px 15px}.panel-footer{padding:15px;background:#fafafa}.panel-footer>*{margin-bottom:0}.pricing-table .package{display:flex;flex-direction:column;justify-content:space-between;flex-wrap:wrap;margin:15px;padding:30px;border:1px solid #e0e0e0;border-radius:5px;text-align:center;background:#fff}.pricing-table .package.featured{border-color:#4caf50;border-width:2px}.pricing-table .package.featured .package-name{color:#4caf50}.pricing-table .package hr{border:0;border-bottom:1px solid #e0e0e0;height:1px}.pricing-table .package .package-name{font-weight:700;text-transform:uppercase}.pricing-table .package .price{margin:15px 0 0 0;font-size:36px;line-height:1.2}.pricing-table .package .price-disclaimer{font-size:12px}.pricing-table .package .features{flex:1;padding:15px;list-style:none}.pricing-table .package .features li{margin-bottom:5px}.progress-bar{position:relative;margin:15px 0;height:20px;background:#eee;border-radius:5px;overflow:hidden}.progress-bar>span{display:block;position:absolute;height:100%;border-radius:4px;overflow:hidden}.progress-bar>span.progress-bar-green{background:#66bb6a}.progress-bar>span.progress-bar-blue{background:#42a5f5}.progress-bar>span.progress-bar-red{background:#ef5350}.progress-bar.striped>span:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:linear-gradient(-45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%, transparent);background-size:50px 50px;overflow:hidden}.progress-bar.animated>span:after{animation:move 2s linear infinite}@keyframes move{0%{background-position:0 0}100%{background-position:50px 50px}}.sidebar{padding:15px}.sidebar-left{border-right:1px solid #e0e0e0}.sidebar-right{border-left:1px solid #e0e0e0}.sidebar-category{padding:10px;font-size:18px;color:#757575;border-bottom:1px solid #e0e0e0;background:url('data:image/svg+xml;utf8,') center right no-repeat}.sidebar-category:focus,.sidebar-category:hover{cursor:pointer;opacity:0.75}.sidebar-links{list-style:none;padding-left:10px}.sidebar-links a{display:block;padding:5px 10px}.sidebar-links a.active{font-weight:700}.stepper{margin:30px 15px}.stepper .step{position:relative;padding:0 30px;margin-bottom:30px;border-left:1px solid #bdbdbd}.stepper .step:last-of-type{border:none}.stepper .step .step-number{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;top:0;left:-18px;height:36px;width:36px;z-index:1;font-weight:600;color:#fff;background:#8bc34a;border-radius:50%;box-shadow:0 2px 4px #e0e0e0}.stepper .step .step-title{margin:0;font-weight:600;font-size:20px;line-height:36px}.tabs{list-style:none;display:flex;margin:15px 0 30px}.tabs .tab{padding:8px 45px;border-bottom:1px solid #e0e0e0;color:#bdbdbd}.tabs .tab.active{border-top:2px solid #4caf50;border-left:1px solid #e0e0e0;border-right:1px solid #e0e0e0;border-bottom:none;color:#757575}.tabs .tab:focus,.tabs .tab:hover{opacity:1;color:#424242}.tags{display:flex;flex-wrap:wrap;list-style:none}.tags .tag{margin-right:5px;padding:5px 15px;font-size:14px;font-weight:400;border-radius:4px;color:#fff;background:#9e9e9e;box-shadow:0 2px 4px #eee}.tags .tag a{display:block;color:#fff}.tags .tag-rounded{border-radius:16px}.tags .tag-blue{background:#2196f3}.tags .tag-red{background:#f44336}.tags .tag-green{background:#4caf50}.tags .tag-orange{background:#ff9800}.tooltip{display:inline-block;position:relative;border-bottom:1px dashed #bdbdbd}.tooltip:focus,.tooltip:hover{cursor:pointer}.tooltip:focus .tooltip-text,.tooltip:hover .tooltip-text{display:block}.tooltip-text{display:none;position:absolute;bottom:125%;left:50%;transform:translateX(-50%);min-width:300px;padding:10px 15px;color:#fff;text-align:center;background:#424242;border-radius:5px;box-shadow:0 2px 4px #9e9e9e}.tooltip-text::after{position:absolute;content:'';top:100%;left:50%;transform:translateX(-50%);border-width:8px;border-style:solid;border-color:#424242 transparent transparent} + +/*# sourceMappingURL=mustard-ui.min.css.map */ diff --git a/src/styles/styles.css b/src/styles/styles.css index 29081ba..24b06df 100644 --- a/src/styles/styles.css +++ b/src/styles/styles.css @@ -20,8 +20,34 @@ input[type=image]:hover { color: #ffffff; } + +/* IDs */ +#master-row { + padding: 2em; +} + +#master-left-column { + background-color:grey +} + +#master-right-column { + padding: 0em 4em; +} + +#master-left-column > li > button { + width: 14em; +} + +#master-gutter { + position: absolute; + width: 100%; + bottom: 0.5em; + max-height: 6em; + overflow: auto; +} + #savedSessions { - width: 85%; + width: 100%; height: 450px; min-height: 450px; max-height: 450px; @@ -30,6 +56,13 @@ input[type=image]:hover { margin: 0em auto; } +#editList, +#saveList, +#loadList { + max-height: 250px; + overflow: auto; +} + #editSelectionContainer { width: 100%; height: auto; @@ -61,11 +94,17 @@ input[type=image]:hover { color: rgba(255, 255, 255, 0.5); } -/* Overide sweetalert modal size */ -.swal-modal{ - top: 2em !important; - width: 650px !important; - height: auto !important; + +/* Classes */ + +.modal { + width: 650px; + height: auto; +} + +.scroller { + scrollbar-color: #00000084 #ffffff64; + scrollbar-width: thin; } .collection { @@ -73,7 +112,7 @@ input[type=image]:hover { padding-bottom: 1em; } -.container { +.download-container { width: 100%; height: 100%; background-image: url('../images/icons/import.png'); @@ -84,7 +123,7 @@ input[type=image]:hover { transition: 0.6s; } -.container:hover { +.download-container:hover { transition: 0.6s; background-color: rgba(41, 95, 115, 0.65); cursor: pointer;